mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-11-23 19:16:34 +01:00
add /npc nameplate command
This commit is contained in:
parent
482eb05766
commit
76b2bc3864
@ -647,10 +647,22 @@ public class NPCCommands {
|
|||||||
}
|
}
|
||||||
|
|
||||||
npc.getBukkitEntity().teleport(to, TeleportCause.COMMAND);
|
npc.getBukkitEntity().teleport(to, TeleportCause.COMMAND);
|
||||||
|
|
||||||
Messaging.sendTr(sender, Messages.MOVETO_TELEPORTED, npc.getName(), to);
|
Messaging.sendTr(sender, Messages.MOVETO_TELEPORTED, npc.getName(), to);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Command(
|
||||||
|
aliases = { "npc" },
|
||||||
|
modifiers = "nameplate",
|
||||||
|
desc = "Toggle nameplate visibility",
|
||||||
|
min = 1,
|
||||||
|
max = 1,
|
||||||
|
permission = "citizens.npc.nameplate")
|
||||||
|
@Requirements(selected = true, ownership = true, excludedTypes = EntityType.PLAYER)
|
||||||
|
public void nameplate(CommandContext args, CommandSender sender, NPC npc) {
|
||||||
|
npc.getBukkitEntity().setCustomNameVisible(!npc.getBukkitEntity().isCustomNameVisible());
|
||||||
|
Messaging.sendTr(sender, Messages.NAMEPLATE_VISIBILITY_TOGGLED);
|
||||||
|
}
|
||||||
|
|
||||||
@Command(aliases = { "npc" }, desc = "Show basic NPC information", max = 0, permission = "citizens.npc.info")
|
@Command(aliases = { "npc" }, desc = "Show basic NPC information", max = 0, permission = "citizens.npc.info")
|
||||||
public void npc(CommandContext args, CommandSender sender, NPC npc) {
|
public void npc(CommandContext args, CommandSender sender, NPC npc) {
|
||||||
Messaging.send(sender, StringHelper.wrapHeader(npc.getName()));
|
Messaging.send(sender, StringHelper.wrapHeader(npc.getName()));
|
||||||
|
@ -4,6 +4,7 @@ import net.citizensnpcs.api.CitizensAPI;
|
|||||||
import net.citizensnpcs.api.ai.Goal;
|
import net.citizensnpcs.api.ai.Goal;
|
||||||
import net.citizensnpcs.api.ai.goals.WanderGoal;
|
import net.citizensnpcs.api.ai.goals.WanderGoal;
|
||||||
import net.citizensnpcs.api.npc.NPC;
|
import net.citizensnpcs.api.npc.NPC;
|
||||||
|
import net.citizensnpcs.api.persistence.Persist;
|
||||||
import net.citizensnpcs.api.util.DataKey;
|
import net.citizensnpcs.api.util.DataKey;
|
||||||
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -11,7 +12,10 @@ import org.bukkit.entity.Player;
|
|||||||
public class WanderWaypointProvider implements WaypointProvider {
|
public class WanderWaypointProvider implements WaypointProvider {
|
||||||
private Goal currentGoal;
|
private Goal currentGoal;
|
||||||
private volatile boolean paused;
|
private volatile boolean paused;
|
||||||
private int xrange = DEFAULT_XRANGE, yrange = DEFAULT_YRANGE;
|
@Persist
|
||||||
|
private final int xrange = DEFAULT_XRANGE;
|
||||||
|
@Persist
|
||||||
|
private final int yrange = DEFAULT_YRANGE;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public WaypointEditor createEditor(Player player) {
|
public WaypointEditor createEditor(Player player) {
|
||||||
@ -37,8 +41,6 @@ public class WanderWaypointProvider implements WaypointProvider {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void load(DataKey key) {
|
public void load(DataKey key) {
|
||||||
xrange = key.getInt("xrange", DEFAULT_XRANGE);
|
|
||||||
yrange = key.getInt("yrange", DEFAULT_YRANGE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -52,8 +54,6 @@ public class WanderWaypointProvider implements WaypointProvider {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void save(DataKey key) {
|
public void save(DataKey key) {
|
||||||
key.setInt("xrange", xrange);
|
|
||||||
key.setInt("yrange", yrange);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -107,6 +107,7 @@ public class Messages {
|
|||||||
public static final String MONEY_WITHDRAWN = "citizens.economy.money-withdrawn";
|
public static final String MONEY_WITHDRAWN = "citizens.economy.money-withdrawn";
|
||||||
public static final String MOVETO_FORMAT = "citizens.commands.npc.moveto.format";
|
public static final String MOVETO_FORMAT = "citizens.commands.npc.moveto.format";
|
||||||
public static final String MOVETO_TELEPORTED = "citizens.commands.npc.moveto.teleported";
|
public static final String MOVETO_TELEPORTED = "citizens.commands.npc.moveto.teleported";
|
||||||
|
public static final String NAMEPLATE_VISIBILITY_TOGGLED = "citizens.commands.npc.nameplate.toggled";
|
||||||
public static final String NO_NPC_WITH_ID_FOUND = "citizens.commands.npc.spawn.missing-npc-id";
|
public static final String NO_NPC_WITH_ID_FOUND = "citizens.commands.npc.spawn.missing-npc-id";
|
||||||
public static final String NO_STORED_SPAWN_LOCATION = "citizens.commands.npc.spawn.no-location";
|
public static final String NO_STORED_SPAWN_LOCATION = "citizens.commands.npc.spawn.no-location";
|
||||||
public static final String NOT_LIVING_MOBTYPE = "citizens.commands.npc.create.not-living-mobtype";
|
public static final String NOT_LIVING_MOBTYPE = "citizens.commands.npc.create.not-living-mobtype";
|
||||||
|
@ -45,6 +45,7 @@ citizens.commands.npc.lookclose.stopped=[[{0}]] will no longer rotate when playe
|
|||||||
citizens.commands.npc.mount.failed=Couldn''t mount [[{0}]].
|
citizens.commands.npc.mount.failed=Couldn''t mount [[{0}]].
|
||||||
citizens.commands.npc.moveto.format=Format is x:y:z(:world) or x y z( world).
|
citizens.commands.npc.moveto.format=Format is x:y:z(:world) or x y z( world).
|
||||||
citizens.commands.npc.moveto.teleported=[[{0}]] teleported to {1}.
|
citizens.commands.npc.moveto.teleported=[[{0}]] teleported to {1}.
|
||||||
|
citizens.commands.npc.nameplate.toggled=Nameplate visibility toggled.
|
||||||
citizens.commands.npc.owner.already-owner={0} is already the owner of {1}.
|
citizens.commands.npc.owner.already-owner={0} is already the owner of {1}.
|
||||||
citizens.commands.npc.owner.owner=[[{0}]]''s owner is [[{1}]].
|
citizens.commands.npc.owner.owner=[[{0}]]''s owner is [[{1}]].
|
||||||
citizens.commands.npc.owner.set-server=[[The server]] is now the owner of {0}.
|
citizens.commands.npc.owner.set-server=[[The server]] is now the owner of {0}.
|
||||||
|
Loading…
Reference in New Issue
Block a user