colors in holograms
This commit is contained in:
parent
5a65995699
commit
b482317684
3 changed files with 6 additions and 3 deletions
|
@ -8,6 +8,7 @@ import lol.pyr.znpcsplus.npc.NpcEntryImpl;
|
||||||
import lol.pyr.znpcsplus.npc.NpcRegistryImpl;
|
import lol.pyr.znpcsplus.npc.NpcRegistryImpl;
|
||||||
import net.kyori.adventure.text.Component;
|
import net.kyori.adventure.text.Component;
|
||||||
import net.kyori.adventure.text.format.NamedTextColor;
|
import net.kyori.adventure.text.format.NamedTextColor;
|
||||||
|
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
|
||||||
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -17,7 +18,7 @@ public class HoloAddCommand implements CommandHandler {
|
||||||
public void run(CommandContext context) throws CommandExecutionException {
|
public void run(CommandContext context) throws CommandExecutionException {
|
||||||
context.setUsage(context.getLabel() + " holo add <npc_id> <text>");
|
context.setUsage(context.getLabel() + " holo add <npc_id> <text>");
|
||||||
HologramImpl hologram = context.parse(NpcEntryImpl.class).getNpc().getHologram();
|
HologramImpl hologram = context.parse(NpcEntryImpl.class).getNpc().getHologram();
|
||||||
hologram.addLine(Component.text(context.dumpAllArgs()));
|
hologram.addLine(LegacyComponentSerializer.legacyAmpersand().deserialize(context.dumpAllArgs()));
|
||||||
context.send(Component.text("NPC line added!", NamedTextColor.GREEN));
|
context.send(Component.text("NPC line added!", NamedTextColor.GREEN));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,7 @@ import lol.pyr.znpcsplus.npc.NpcEntryImpl;
|
||||||
import lol.pyr.znpcsplus.npc.NpcRegistryImpl;
|
import lol.pyr.znpcsplus.npc.NpcRegistryImpl;
|
||||||
import net.kyori.adventure.text.Component;
|
import net.kyori.adventure.text.Component;
|
||||||
import net.kyori.adventure.text.format.NamedTextColor;
|
import net.kyori.adventure.text.format.NamedTextColor;
|
||||||
|
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
|
||||||
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -20,7 +21,7 @@ public class HoloInsertCommand implements CommandHandler {
|
||||||
HologramImpl hologram = context.parse(NpcEntryImpl.class).getNpc().getHologram();
|
HologramImpl hologram = context.parse(NpcEntryImpl.class).getNpc().getHologram();
|
||||||
int line = context.parse(Integer.class);
|
int line = context.parse(Integer.class);
|
||||||
if (line < 0 || line >= hologram.getLines().size()) context.halt(Component.text("Invalid line number!", NamedTextColor.RED));
|
if (line < 0 || line >= hologram.getLines().size()) context.halt(Component.text("Invalid line number!", NamedTextColor.RED));
|
||||||
hologram.insertLine(line, Component.text(context.dumpAllArgs()));
|
hologram.insertLine(line, LegacyComponentSerializer.legacyAmpersand().deserialize(context.dumpAllArgs()));
|
||||||
context.send(Component.text("NPC line inserted!", NamedTextColor.GREEN));
|
context.send(Component.text("NPC line inserted!", NamedTextColor.GREEN));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,7 @@ import lol.pyr.znpcsplus.npc.NpcEntryImpl;
|
||||||
import lol.pyr.znpcsplus.npc.NpcRegistryImpl;
|
import lol.pyr.znpcsplus.npc.NpcRegistryImpl;
|
||||||
import net.kyori.adventure.text.Component;
|
import net.kyori.adventure.text.Component;
|
||||||
import net.kyori.adventure.text.format.NamedTextColor;
|
import net.kyori.adventure.text.format.NamedTextColor;
|
||||||
|
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
|
||||||
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -21,7 +22,7 @@ public class HoloSetCommand implements CommandHandler {
|
||||||
int line = context.parse(Integer.class);
|
int line = context.parse(Integer.class);
|
||||||
if (line < 0 || line >= hologram.getLines().size()) context.halt(Component.text("Invalid line number!", NamedTextColor.RED));
|
if (line < 0 || line >= hologram.getLines().size()) context.halt(Component.text("Invalid line number!", NamedTextColor.RED));
|
||||||
hologram.removeLine(line);
|
hologram.removeLine(line);
|
||||||
hologram.insertLine(line, Component.text(context.dumpAllArgs()));
|
hologram.insertLine(line, LegacyComponentSerializer.legacyAmpersand().deserialize(context.dumpAllArgs()));
|
||||||
context.send(Component.text("NPC line set!", NamedTextColor.GREEN));
|
context.send(Component.text("NPC line set!", NamedTextColor.GREEN));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue