2014-06-01 18:08:54 +02:00
|
|
|
package me.libraryaddict.disguise.commands;
|
|
|
|
|
2016-05-09 17:28:38 +02:00
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.HashMap;
|
|
|
|
|
2014-06-01 18:08:54 +02:00
|
|
|
import org.apache.commons.lang.StringUtils;
|
|
|
|
import org.bukkit.ChatColor;
|
|
|
|
import org.bukkit.command.Command;
|
|
|
|
import org.bukkit.command.CommandSender;
|
|
|
|
|
2016-05-09 17:28:38 +02:00
|
|
|
import me.libraryaddict.disguise.DisguiseConfig;
|
|
|
|
import me.libraryaddict.disguise.LibsDisguises;
|
|
|
|
import me.libraryaddict.disguise.disguisetypes.DisguiseType;
|
2016-02-19 20:23:46 +01:00
|
|
|
|
2016-03-05 05:45:38 +01:00
|
|
|
public class CloneDisguiseCommand extends BaseDisguiseCommand {
|
2014-06-01 18:08:54 +02:00
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
|
|
|
|
if (sender.getName().equals("CONSOLE")) {
|
|
|
|
sender.sendMessage(ChatColor.RED + "You may not use this command from the console!");
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
if (sender.hasPermission("libsdisguises.disguise.disguiseclone")) {
|
2014-06-14 19:16:36 +02:00
|
|
|
boolean doEquipment = true;
|
2014-06-01 18:08:54 +02:00
|
|
|
boolean doSneak = false;
|
|
|
|
boolean doSprint = false;
|
|
|
|
for (String option : args) {
|
2014-06-15 09:35:47 +02:00
|
|
|
if (StringUtils.startsWithIgnoreCase(option, "ignoreEquip")
|
|
|
|
|| StringUtils.startsWithIgnoreCase(option, "ignoreEnquip")) {
|
2014-06-14 19:16:36 +02:00
|
|
|
doEquipment = false;
|
2014-06-01 18:08:54 +02:00
|
|
|
} else if (option.equalsIgnoreCase("doSneakSprint")) {
|
|
|
|
doSneak = true;
|
|
|
|
doSprint = true;
|
|
|
|
} else if (option.equalsIgnoreCase("doSneak")) {
|
|
|
|
doSneak = true;
|
|
|
|
} else if (option.equalsIgnoreCase("doSprint")) {
|
|
|
|
doSprint = true;
|
|
|
|
} else {
|
|
|
|
sender.sendMessage(ChatColor.DARK_RED + "Unknown option '" + option
|
2014-06-14 19:16:36 +02:00
|
|
|
+ "' - Valid options are 'IgnoreEquipment' 'DoSneakSprint' 'DoSneak' 'DoSprint'");
|
2014-06-01 18:08:54 +02:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
2016-02-19 20:23:46 +01:00
|
|
|
LibsDisguises.getInstance().getListener().setDisguiseClone(sender.getName(), new Boolean[]{doEquipment, doSneak, doSprint});
|
2014-06-01 18:14:35 +02:00
|
|
|
sender.sendMessage(ChatColor.RED + "Right click a entity in the next " + DisguiseConfig.getDisguiseCloneExpire()
|
2014-06-02 00:03:59 +02:00
|
|
|
+ " seconds to grab the disguise reference!");
|
2014-06-01 18:08:54 +02:00
|
|
|
} else {
|
2014-06-01 18:17:11 +02:00
|
|
|
sender.sendMessage(ChatColor.RED + "You are forbidden to use this command.");
|
2014-06-01 18:08:54 +02:00
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Send the player the information
|
|
|
|
*/
|
2015-05-30 15:34:38 +02:00
|
|
|
@Override
|
2014-06-14 10:16:48 +02:00
|
|
|
protected void sendCommandUsage(CommandSender sender, HashMap<DisguiseType, HashMap<ArrayList<String>, Boolean>> map) {
|
2014-06-02 00:03:59 +02:00
|
|
|
sender.sendMessage(ChatColor.DARK_GREEN
|
|
|
|
+ "Right click a entity to get a disguise reference you can pass to other disguise commands!");
|
2014-06-15 09:35:47 +02:00
|
|
|
sender.sendMessage(ChatColor.DARK_GREEN
|
|
|
|
+ "Security note: Any references you create will be available to all players able to use disguise references.");
|
|
|
|
sender.sendMessage(ChatColor.DARK_GREEN + "/disguiseclone IgnoreEquipment" + ChatColor.DARK_GREEN + "(" + ChatColor.GREEN
|
|
|
|
+ "Optional" + ChatColor.DARK_GREEN + ")");
|
2014-06-01 18:08:54 +02:00
|
|
|
}
|
|
|
|
}
|