mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-11-22 18:45:29 +01:00
Add warning for npc select within commands
This commit is contained in:
parent
027e4d27a9
commit
cdb75dbc96
@ -107,8 +107,8 @@ public class NPCCommandSelector extends NumericPrompt {
|
||||
String name = args.getString(1);
|
||||
List<NPC> possible = Lists.newArrayList();
|
||||
double range = -1;
|
||||
if (args.hasValueFlag("r")) {
|
||||
range = Math.abs(args.getFlagDouble("r"));
|
||||
if (args.hasValueFlag("range")) {
|
||||
range = Math.abs(args.getFlagDouble("range"));
|
||||
}
|
||||
for (NPC test : npcRegistry) {
|
||||
if (test.getName().equalsIgnoreCase(name)) {
|
||||
|
@ -455,6 +455,9 @@ public class NPCCommands {
|
||||
if (permissions != null) {
|
||||
perms.addAll(Arrays.asList(permissions.split(",")));
|
||||
}
|
||||
if (command.startsWith("npc select")) {
|
||||
throw new CommandException("npc select not currently supported within commands. Use --id <id> instead");
|
||||
}
|
||||
try {
|
||||
int id = commands.addCommand(new NPCCommandBuilder(command, hand).addPerms(perms)
|
||||
.player(args.hasFlag('p') || args.hasFlag('o')).op(args.hasFlag('o')).cooldown(cooldown)
|
||||
@ -2270,7 +2273,7 @@ public class NPCCommands {
|
||||
|
||||
@Command(
|
||||
aliases = { "npc" },
|
||||
usage = "select|sel [id|name] (--r range) (--registry [name])",
|
||||
usage = "select|sel [id|name] (--range range) (--registry [name])",
|
||||
desc = "Select a NPC with the given ID or name",
|
||||
modifiers = { "select", "sel" },
|
||||
min = 1,
|
||||
|
@ -355,27 +355,29 @@ public class Util {
|
||||
Messaging.debug("Running command " + interpolatedCommand + " on NPC " + (npc == null ? -1 : npc.getId())
|
||||
+ " clicker " + clicker);
|
||||
}
|
||||
|
||||
if (!player) {
|
||||
Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), interpolatedCommand);
|
||||
return;
|
||||
}
|
||||
|
||||
boolean wasOp = clicker.isOp();
|
||||
if (op) {
|
||||
clicker.setOp(true);
|
||||
}
|
||||
|
||||
if (bungeeServer != null) {
|
||||
ByteArrayDataOutput out = ByteStreams.newDataOutput();
|
||||
out.writeUTF("Connect");
|
||||
out.writeUTF(bungeeServer);
|
||||
try {
|
||||
if (bungeeServer != null) {
|
||||
ByteArrayDataOutput out = ByteStreams.newDataOutput();
|
||||
out.writeUTF("Connect");
|
||||
out.writeUTF(bungeeServer);
|
||||
|
||||
clicker.sendPluginMessage(CitizensAPI.getPlugin(), "BungeeCord", out.toByteArray());
|
||||
} else {
|
||||
try {
|
||||
clicker.sendPluginMessage(CitizensAPI.getPlugin(), "BungeeCord", out.toByteArray());
|
||||
} else {
|
||||
clicker.chat("/" + interpolatedCommand);
|
||||
} catch (Throwable t) {
|
||||
t.printStackTrace();
|
||||
}
|
||||
} catch (Throwable t) {
|
||||
t.printStackTrace();
|
||||
}
|
||||
|
||||
if (op) {
|
||||
|
Loading…
Reference in New Issue
Block a user