mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2025-01-13 03:40:39 +01:00
Add /npc remove --world
This commit is contained in:
parent
f4e3786514
commit
733064c18d
@ -30,9 +30,8 @@ public class AdminCommands {
|
||||
public void citizens(CommandContext args, CommandSender sender, NPC npc) throws CommandException {
|
||||
Messaging.send(sender, StringHelper.wrapHeader("<e>Citizens v" + plugin.getDescription().getVersion()));
|
||||
Messaging.send(sender, " <7>-- <c>Author: fullwall");
|
||||
Messaging.send(sender, " <7>-- <c>Source Code: http://github.com/CitizensDev");
|
||||
Messaging.send(sender, " <7>-- <c>Website: " + plugin.getDescription().getWebsite());
|
||||
Messaging.send(sender, " <7>-- <c>Report an issue: http://github.com/CitizensDev/Citizens2/issues");
|
||||
Messaging.send(sender, " <7>-- <c>Support: https://discord.gg/Q6pZGSR");
|
||||
}
|
||||
|
||||
@Command(
|
||||
|
@ -1761,7 +1761,7 @@ public class NPCCommands {
|
||||
|
||||
@Command(
|
||||
aliases = { "npc" },
|
||||
usage = "remove|rem (all|id|name| --owner [owner] | --eid [entity uuid])",
|
||||
usage = "remove|rem (all|id|name| --owner [owner] | --eid [entity uuid] | --world [world])",
|
||||
desc = "Remove a NPC",
|
||||
modifiers = { "remove", "rem" },
|
||||
min = 1,
|
||||
@ -1779,6 +1779,19 @@ public class NPCCommands {
|
||||
Messaging.sendTr(sender, Messages.NPCS_REMOVED);
|
||||
return;
|
||||
}
|
||||
if (args.hasValueFlag("world")) {
|
||||
String world = args.getFlag("world");
|
||||
for (NPC rem : Lists.newArrayList(CitizensAPI.getNPCRegistry())) {
|
||||
Location loc = npc.getStoredLocation();
|
||||
if (loc != null && loc.getWorld() != null && (loc.getWorld().getUID().toString().equals(world)
|
||||
|| loc.getWorld().getName().equalsIgnoreCase(world))) {
|
||||
history.add(sender, new RemoveNPCHistoryItem(rem));
|
||||
rem.destroy(sender);
|
||||
}
|
||||
}
|
||||
Messaging.sendTr(sender, Messages.NPCS_REMOVED);
|
||||
return;
|
||||
}
|
||||
if (args.hasValueFlag("eid")) {
|
||||
Entity entity = Bukkit.getServer().getEntity(UUID.fromString(args.getFlag("eid")));
|
||||
if (entity != null && (npc = CitizensAPI.getNPCRegistry().getNPC(entity)) != null) {
|
||||
|
Loading…
Reference in New Issue
Block a user