Cleaned up perms
This commit is contained in:
parent
a7908e5738
commit
b29a3fae5e
@ -98,7 +98,7 @@ public class DisguiseCommand implements CommandExecutor {
|
|||||||
type = DisguiseType.valueOf(args[0].toUpperCase());
|
type = DisguiseType.valueOf(args[0].toUpperCase());
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
sender.sendMessage(ChatColor.RED + "Failed to find disguise: " + ChatColor.GREEN + args[0]
|
sender.sendMessage(ChatColor.RED + "Failed to find disguise: " + ChatColor.GREEN + args[0]
|
||||||
+ "\n/disguise player <Name>\n/disguise <Mob Name>\n/disguise undisguise/un/undis");
|
+ "\n/disguise player <Name>\n/disguise <Mob Name>\n/disguise undisguise/un/undis\n/undisguise");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (sender.hasPermission("libsdisguises.disguise." + type.name().toLowerCase())) {
|
if (sender.hasPermission("libsdisguises.disguise." + type.name().toLowerCase())) {
|
||||||
|
@ -24,7 +24,7 @@ public class DisguisePlayerCommand implements CommandExecutor {
|
|||||||
ArrayList<String> names = new ArrayList<String>();
|
ArrayList<String> names = new ArrayList<String>();
|
||||||
for (DisguiseType type : DisguiseType.values()) {
|
for (DisguiseType type : DisguiseType.values()) {
|
||||||
String name = type.name().toLowerCase();
|
String name = type.name().toLowerCase();
|
||||||
if (sender.hasPermission("libsdisguises.disguise." + name))
|
if (sender.hasPermission("libsdisguises.disguiseothers." + name))
|
||||||
names.add(name);
|
names.add(name);
|
||||||
}
|
}
|
||||||
Collections.sort(names);
|
Collections.sort(names);
|
||||||
@ -35,7 +35,7 @@ public class DisguisePlayerCommand implements CommandExecutor {
|
|||||||
ArrayList<String> names = new ArrayList<String>();
|
ArrayList<String> names = new ArrayList<String>();
|
||||||
for (DisguiseType type : DisguiseType.values()) {
|
for (DisguiseType type : DisguiseType.values()) {
|
||||||
String name = type.name().toLowerCase();
|
String name = type.name().toLowerCase();
|
||||||
if (!sender.hasPermission("libsdisguises.disguise." + name))
|
if (!sender.hasPermission("libsdisguises.disguiseothers." + name))
|
||||||
names.add(name);
|
names.add(name);
|
||||||
}
|
}
|
||||||
Collections.sort(names);
|
Collections.sort(names);
|
||||||
@ -52,7 +52,9 @@ public class DisguisePlayerCommand implements CommandExecutor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
|
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
|
||||||
if (sender.hasPermission("libsdisguises.disguiseothers")) {
|
if (sender.hasPermission("libsdisguises.disguiseothers")
|
||||||
|
|| (args.length > 0 && args[0].toLowerCase().startsWith("un") && sender
|
||||||
|
.hasPermission("libsdisguises.undisguiseothers"))) {
|
||||||
if (args.length == 0) {
|
if (args.length == 0) {
|
||||||
ArrayList<String> names = allowedDisguises(sender);
|
ArrayList<String> names = allowedDisguises(sender);
|
||||||
ArrayList<String> otherNames = forbiddenDisguises(sender);
|
ArrayList<String> otherNames = forbiddenDisguises(sender);
|
||||||
@ -71,23 +73,23 @@ public class DisguisePlayerCommand implements CommandExecutor {
|
|||||||
if (p != null) {
|
if (p != null) {
|
||||||
if (args[1].equalsIgnoreCase("undiguise") || args[1].equalsIgnoreCase("undis")
|
if (args[1].equalsIgnoreCase("undiguise") || args[1].equalsIgnoreCase("undis")
|
||||||
|| args[1].equalsIgnoreCase("un")) {
|
|| args[1].equalsIgnoreCase("un")) {
|
||||||
if (sender.hasPermission("libsdisguises.undisguise")) {
|
if (sender.hasPermission("libsdisguises.undisguiseothers")) {
|
||||||
if (DisguiseAPI.isDisguised(p.getName())) {
|
if (DisguiseAPI.isDisguised(p.getName())) {
|
||||||
DisguiseAPI.undisguiseToAll(p);
|
DisguiseAPI.undisguiseToAll(p);
|
||||||
sender.sendMessage(ChatColor.RED + "You are no longer disguised");
|
sender.sendMessage(ChatColor.RED + "They are no longer disguised");
|
||||||
} else
|
} else
|
||||||
sender.sendMessage(ChatColor.RED + "You are not disguised!");
|
sender.sendMessage(ChatColor.RED + "They are not disguised!");
|
||||||
} else
|
} else
|
||||||
sender.sendMessage(ChatColor.RED + "You do not have permission to use this command.");
|
sender.sendMessage(ChatColor.RED + "You do not have permission to use this command.");
|
||||||
} else if (args[1].equalsIgnoreCase("player")) {
|
} else if (args[1].equalsIgnoreCase("player")) {
|
||||||
if (sender.hasPermission("libsdisguises.disguise.player")) {
|
if (sender.hasPermission("libsdisguises.disguiseothers.player")) {
|
||||||
if (args.length > 2) {
|
if (args.length > 2) {
|
||||||
String name = ChatColor.translateAlternateColorCodes('&', StringUtils.join(args, " ")
|
String name = ChatColor.translateAlternateColorCodes('&', StringUtils.join(args, " ")
|
||||||
.substring(args[0].length() + args[1].length() + 2));
|
.substring(args[0].length() + args[1].length() + 2));
|
||||||
PlayerDisguise disguise = new PlayerDisguise(name);
|
PlayerDisguise disguise = new PlayerDisguise(name);
|
||||||
DisguiseAPI.disguiseToAll(p, disguise);
|
DisguiseAPI.disguiseToAll(p, disguise);
|
||||||
sender.sendMessage(ChatColor.RED + "Disguised as the player '" + ChatColor.GREEN + name
|
sender.sendMessage(ChatColor.RED + "Disguised " + p.getName() + " as the player '"
|
||||||
+ ChatColor.RESET + ChatColor.RED + "'");
|
+ ChatColor.GREEN + name + ChatColor.RESET + ChatColor.RED + "'");
|
||||||
} else
|
} else
|
||||||
sender.sendMessage(ChatColor.RED + "You need to provide a player name");
|
sender.sendMessage(ChatColor.RED + "You need to provide a player name");
|
||||||
} else {
|
} else {
|
||||||
@ -103,11 +105,14 @@ public class DisguisePlayerCommand implements CommandExecutor {
|
|||||||
try {
|
try {
|
||||||
type = DisguiseType.valueOf(args[1].toUpperCase());
|
type = DisguiseType.valueOf(args[1].toUpperCase());
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
sender.sendMessage(ChatColor.RED + "Failed to find disguise: " + ChatColor.GREEN + args[1]
|
sender.sendMessage(ChatColor.RED
|
||||||
+ "\n/disguise player <Name>\n/disguise <Mob Name>\n/disguise undisguise/un/undis");
|
+ "Failed to find disguise: "
|
||||||
|
+ ChatColor.GREEN
|
||||||
|
+ args[1]
|
||||||
|
+ "\n/disguiseplayer <Name> player <Name>\n/disguiseplayer <Name><Mob Name>\n/disguiseplayer <Name> undisguise/un/undis\n/undisguiseplayer");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (sender.hasPermission("libsdisguises.disguise." + type.name().toLowerCase())) {
|
if (sender.hasPermission("libsdisguises.disguiseothers." + type.name().toLowerCase())) {
|
||||||
Object args1 = true;
|
Object args1 = true;
|
||||||
if (type.isMisc())
|
if (type.isMisc())
|
||||||
args1 = -1;
|
args1 = -1;
|
||||||
@ -143,7 +148,8 @@ public class DisguisePlayerCommand implements CommandExecutor {
|
|||||||
else
|
else
|
||||||
disguise = new MiscDisguise(type, (Integer) args1, args2);
|
disguise = new MiscDisguise(type, (Integer) args1, args2);
|
||||||
DisguiseAPI.disguiseToAll(p, disguise);
|
DisguiseAPI.disguiseToAll(p, disguise);
|
||||||
sender.sendMessage(ChatColor.RED + "Now disguised as a " + type.name().toLowerCase() + "!");
|
sender.sendMessage(ChatColor.RED + "Disguised " + p.getName() + " as a "
|
||||||
|
+ type.name().toLowerCase() + "!");
|
||||||
} else
|
} else
|
||||||
sender.sendMessage(ChatColor.RED + "You do not have permission to use this disguise.");
|
sender.sendMessage(ChatColor.RED + "You do not have permission to use this disguise.");
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,7 @@ public class UndisguisePlayerCommand implements CommandExecutor {
|
|||||||
sender.sendMessage(ChatColor.RED + "He is no longer disguised");
|
sender.sendMessage(ChatColor.RED + "He is no longer disguised");
|
||||||
} else
|
} else
|
||||||
sender.sendMessage(ChatColor.RED + "He is not disguised!");
|
sender.sendMessage(ChatColor.RED + "He is not disguised!");
|
||||||
}
|
} else
|
||||||
sender.sendMessage(ChatColor.RED + "Player not found");
|
sender.sendMessage(ChatColor.RED + "Player not found");
|
||||||
} else
|
} else
|
||||||
sender.sendMessage(ChatColor.RED + "/undisguiseplayer <Name>");
|
sender.sendMessage(ChatColor.RED + "/undisguiseplayer <Name>");
|
||||||
|
Loading…
Reference in New Issue
Block a user