Read desc
Change all the permissions code to a 'better' version By default people can no longer use options without the option perm or * DisguiseType returns is now nicer looking
This commit is contained in:
@@ -1,7 +1,11 @@
|
||||
package me.libraryaddict.disguise.commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
|
||||
import me.libraryaddict.disguise.DisguiseConfig;
|
||||
import me.libraryaddict.disguise.DisguiseListener;
|
||||
import me.libraryaddict.disguise.disguisetypes.DisguiseType;
|
||||
import me.libraryaddict.disguise.utilities.BaseDisguiseCommand;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
@@ -55,7 +59,7 @@ public class DisguiseCloneCommand extends BaseDisguiseCommand {
|
||||
/**
|
||||
* Send the player the information
|
||||
*/
|
||||
protected void sendCommandUsage(CommandSender sender) {
|
||||
protected void sendCommandUsage(CommandSender sender, HashMap<DisguiseType, HashMap<ArrayList<String>, Boolean>> map) {
|
||||
sender.sendMessage(ChatColor.DARK_GREEN
|
||||
+ "Right click a entity to get a disguise reference you can pass to other disguise commands!");
|
||||
sender.sendMessage(ChatColor.DARK_GREEN + "Beware however, the reference bypasses all permissions checks");
|
||||
|
@@ -1,10 +1,12 @@
|
||||
package me.libraryaddict.disguise.commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
|
||||
import me.libraryaddict.disguise.DisguiseAPI;
|
||||
import me.libraryaddict.disguise.DisguiseConfig;
|
||||
import me.libraryaddict.disguise.disguisetypes.Disguise;
|
||||
import me.libraryaddict.disguise.disguisetypes.DisguiseType;
|
||||
import me.libraryaddict.disguise.disguisetypes.watchers.LivingWatcher;
|
||||
import me.libraryaddict.disguise.utilities.BaseDisguiseCommand;
|
||||
|
||||
@@ -24,7 +26,7 @@ public class DisguiseCommand extends BaseDisguiseCommand {
|
||||
}
|
||||
Disguise disguise;
|
||||
try {
|
||||
disguise = parseDisguise(sender, args);
|
||||
disguise = parseDisguise(sender, args, getPermissions(sender));
|
||||
} catch (Exception ex) {
|
||||
if (ex.getMessage() != null && !ChatColor.getLastColors(ex.getMessage()).equals("")) {
|
||||
sender.sendMessage(ex.getMessage());
|
||||
@@ -53,8 +55,8 @@ public class DisguiseCommand extends BaseDisguiseCommand {
|
||||
/**
|
||||
* Send the player the information
|
||||
*/
|
||||
protected void sendCommandUsage(CommandSender sender) {
|
||||
ArrayList<String> allowedDisguises = getAllowedDisguises(sender);
|
||||
protected void sendCommandUsage(CommandSender sender, HashMap<DisguiseType, HashMap<ArrayList<String>, Boolean>> map) {
|
||||
ArrayList<String> allowedDisguises = getAllowedDisguises(map);
|
||||
sender.sendMessage(ChatColor.DARK_GREEN + "Choose a disguise to become the disguise!");
|
||||
sender.sendMessage(ChatColor.DARK_GREEN + "You can use the disguises: " + ChatColor.GREEN
|
||||
+ StringUtils.join(allowedDisguises, ChatColor.RED + ", " + ChatColor.GREEN));
|
||||
|
@@ -1,10 +1,12 @@
|
||||
package me.libraryaddict.disguise.commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
|
||||
import me.libraryaddict.disguise.DisguiseConfig;
|
||||
import me.libraryaddict.disguise.DisguiseListener;
|
||||
import me.libraryaddict.disguise.disguisetypes.Disguise;
|
||||
import me.libraryaddict.disguise.disguisetypes.DisguiseType;
|
||||
import me.libraryaddict.disguise.utilities.BaseDisguiseCommand;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
@@ -28,7 +30,7 @@ public class DisguiseEntityCommand extends BaseDisguiseCommand {
|
||||
}
|
||||
Disguise disguise;
|
||||
try {
|
||||
disguise = parseDisguise(sender, args);
|
||||
disguise = parseDisguise(sender, args, getPermissions(sender));
|
||||
} catch (Exception ex) {
|
||||
if (ex.getMessage() != null && !ChatColor.getLastColors(ex.getMessage()).equals("")) {
|
||||
sender.sendMessage(ex.getMessage());
|
||||
@@ -46,8 +48,8 @@ public class DisguiseEntityCommand extends BaseDisguiseCommand {
|
||||
/**
|
||||
* Send the player the information
|
||||
*/
|
||||
protected void sendCommandUsage(CommandSender sender) {
|
||||
ArrayList<String> allowedDisguises = getAllowedDisguises(sender);
|
||||
protected void sendCommandUsage(CommandSender sender, HashMap<DisguiseType, HashMap<ArrayList<String>, Boolean>> map) {
|
||||
ArrayList<String> allowedDisguises = getAllowedDisguises(map);
|
||||
sender.sendMessage(ChatColor.DARK_GREEN + "Choose a disguise then right click a entity to disguise it!");
|
||||
sender.sendMessage(ChatColor.DARK_GREEN + "You can use the disguises: " + ChatColor.GREEN
|
||||
+ StringUtils.join(allowedDisguises, ChatColor.RED + ", " + ChatColor.GREEN));
|
||||
|
@@ -117,10 +117,9 @@ public class DisguiseHelpCommand extends BaseDisguiseCommand {
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
|
||||
for (String node : new String[] { "disguise", "disguiseradius", "disguiseentity", "disguiseplayer" }) {
|
||||
ArrayList<String> allowedDisguises = getAllowedDisguises(sender, "libsdisguises." + node + ".");
|
||||
if (!allowedDisguises.isEmpty()) {
|
||||
if (!getPermissions(sender, "libsdisguises." + node + ".").isEmpty()) {
|
||||
if (args.length == 0) {
|
||||
sendCommandUsage(sender);
|
||||
sendCommandUsage(sender, null);
|
||||
return true;
|
||||
} else {
|
||||
EnumHelp help = null;
|
||||
@@ -219,7 +218,7 @@ public class DisguiseHelpCommand extends BaseDisguiseCommand {
|
||||
/**
|
||||
* Send the player the information
|
||||
*/
|
||||
protected void sendCommandUsage(CommandSender sender) {
|
||||
protected void sendCommandUsage(CommandSender sender, HashMap<DisguiseType, HashMap<ArrayList<String>, Boolean>> map) {
|
||||
sender.sendMessage(ChatColor.RED + "/disguisehelp <DisguiseType> " + ChatColor.GREEN
|
||||
+ "- View the options you can set on a disguise");
|
||||
for (EnumHelp s : enumHelp) {
|
||||
|
@@ -1,10 +1,12 @@
|
||||
package me.libraryaddict.disguise.commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
|
||||
import me.libraryaddict.disguise.DisguiseAPI;
|
||||
import me.libraryaddict.disguise.DisguiseConfig;
|
||||
import me.libraryaddict.disguise.disguisetypes.Disguise;
|
||||
import me.libraryaddict.disguise.disguisetypes.DisguiseType;
|
||||
import me.libraryaddict.disguise.disguisetypes.watchers.LivingWatcher;
|
||||
import me.libraryaddict.disguise.utilities.BaseDisguiseCommand;
|
||||
|
||||
@@ -19,13 +21,13 @@ public class DisguisePlayerCommand extends BaseDisguiseCommand {
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
|
||||
ArrayList<String> allowedDisguises = getAllowedDisguises(sender);
|
||||
if (allowedDisguises.isEmpty()) {
|
||||
HashMap<DisguiseType, HashMap<ArrayList<String>, Boolean>> map = getPermissions(sender);
|
||||
if (map.isEmpty()) {
|
||||
sender.sendMessage(ChatColor.RED + "You are forbidden to use this command.");
|
||||
return true;
|
||||
}
|
||||
if (args.length == 0) {
|
||||
sendCommandUsage(sender);
|
||||
sendCommandUsage(sender, map);
|
||||
return true;
|
||||
}
|
||||
if (args.length == 1) {
|
||||
@@ -41,7 +43,7 @@ public class DisguisePlayerCommand extends BaseDisguiseCommand {
|
||||
System.arraycopy(args, 1, newArgs, 0, newArgs.length);
|
||||
Disguise disguise;
|
||||
try {
|
||||
disguise = parseDisguise(sender, newArgs);
|
||||
disguise = parseDisguise(sender, newArgs, map);
|
||||
} catch (Exception ex) {
|
||||
if (ex.getMessage() != null && !ChatColor.getLastColors(ex.getMessage()).equals("")) {
|
||||
sender.sendMessage(ex.getMessage());
|
||||
@@ -77,8 +79,8 @@ public class DisguisePlayerCommand extends BaseDisguiseCommand {
|
||||
/**
|
||||
* Send the player the information
|
||||
*/
|
||||
protected void sendCommandUsage(CommandSender sender) {
|
||||
ArrayList<String> allowedDisguises = getAllowedDisguises(sender);
|
||||
protected void sendCommandUsage(CommandSender sender, HashMap<DisguiseType, HashMap<ArrayList<String>, Boolean>> map) {
|
||||
ArrayList<String> allowedDisguises = getAllowedDisguises(map);
|
||||
sender.sendMessage(ChatColor.DARK_GREEN + "Disguise another player!");
|
||||
sender.sendMessage(ChatColor.DARK_GREEN + "You can use the disguises: " + ChatColor.GREEN
|
||||
+ StringUtils.join(allowedDisguises, ChatColor.RED + ", " + ChatColor.GREEN));
|
||||
|
@@ -2,10 +2,12 @@ package me.libraryaddict.disguise.commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
|
||||
import me.libraryaddict.disguise.DisguiseAPI;
|
||||
import me.libraryaddict.disguise.DisguiseConfig;
|
||||
import me.libraryaddict.disguise.disguisetypes.Disguise;
|
||||
import me.libraryaddict.disguise.disguisetypes.DisguiseType;
|
||||
import me.libraryaddict.disguise.disguisetypes.watchers.LivingWatcher;
|
||||
import me.libraryaddict.disguise.utilities.BaseDisguiseCommand;
|
||||
import me.libraryaddict.disguise.utilities.ClassGetter;
|
||||
@@ -38,13 +40,13 @@ public class DisguiseRadiusCommand extends BaseDisguiseCommand {
|
||||
sender.sendMessage(ChatColor.RED + "You may not use this command from the console!");
|
||||
return true;
|
||||
}
|
||||
ArrayList<String> allowedDisguises = getAllowedDisguises(sender);
|
||||
if (allowedDisguises.isEmpty()) {
|
||||
HashMap<DisguiseType, HashMap<ArrayList<String>, Boolean>> map = getPermissions(sender);
|
||||
if (map.isEmpty()) {
|
||||
sender.sendMessage(ChatColor.RED + "You are forbidden to use this command.");
|
||||
return true;
|
||||
}
|
||||
if (args.length == 0) {
|
||||
sendCommandUsage(sender);
|
||||
sendCommandUsage(sender, map);
|
||||
return true;
|
||||
}
|
||||
if (args[0].equalsIgnoreCase("entitytype") || args[0].equalsIgnoreCase("entitytypes")) {
|
||||
@@ -97,7 +99,7 @@ public class DisguiseRadiusCommand extends BaseDisguiseCommand {
|
||||
System.arraycopy(args, starting + 1, newArgs, 0, newArgs.length);
|
||||
Disguise disguise;
|
||||
try {
|
||||
disguise = parseDisguise(sender, newArgs);
|
||||
disguise = parseDisguise(sender, newArgs, map);
|
||||
} catch (Exception ex) {
|
||||
if (ex.getMessage() != null && !ChatColor.getLastColors(ex.getMessage()).equals("")) {
|
||||
sender.sendMessage(ex.getMessage());
|
||||
@@ -147,8 +149,8 @@ public class DisguiseRadiusCommand extends BaseDisguiseCommand {
|
||||
/**
|
||||
* Send the player the information
|
||||
*/
|
||||
protected void sendCommandUsage(CommandSender sender) {
|
||||
ArrayList<String> allowedDisguises = getAllowedDisguises(sender);
|
||||
protected void sendCommandUsage(CommandSender sender, HashMap<DisguiseType, HashMap<ArrayList<String>, Boolean>> map) {
|
||||
ArrayList<String> allowedDisguises = getAllowedDisguises(map);
|
||||
sender.sendMessage(ChatColor.DARK_GREEN + "Disguise all entities in a radius! Caps at 30 blocks!");
|
||||
sender.sendMessage(ChatColor.DARK_GREEN + "You can use the disguises: " + ChatColor.GREEN
|
||||
+ StringUtils.join(allowedDisguises, ChatColor.RED + ", " + ChatColor.GREEN));
|
||||
|
Reference in New Issue
Block a user