Fixed bug where players switching worlds would become invisible.
Fixed bug where arrows wouldn't blow disguises. Added default permission for /libsdisguises reload (only ops can use by default)
This commit is contained in:
@@ -43,7 +43,7 @@ public class DisguiseCloneCommand extends BaseDisguiseCommand {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
LibsDisguises.instance.getListener().setDisguiseClone(sender.getName(), new Boolean[] { doEquipment, doSneak, doSprint });
|
||||
LibsDisguises.instance.getListener().setDisguiseClone(sender.getName(), new Boolean[]{doEquipment, doSneak, doSprint});
|
||||
sender.sendMessage(ChatColor.RED + "Right click a entity in the next " + DisguiseConfig.getDisguiseCloneExpire()
|
||||
+ " seconds to grab the disguise reference!");
|
||||
} else {
|
||||
|
@@ -62,10 +62,12 @@ public class DisguiseCommand extends BaseDisguiseCommand {
|
||||
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));
|
||||
if (allowedDisguises.contains("player"))
|
||||
if (allowedDisguises.contains("player")) {
|
||||
sender.sendMessage(ChatColor.DARK_GREEN + "/disguise player <Name>");
|
||||
}
|
||||
sender.sendMessage(ChatColor.DARK_GREEN + "/disguise <DisguiseType> <Baby>");
|
||||
if (allowedDisguises.contains("dropped_item") || allowedDisguises.contains("falling_block"))
|
||||
if (allowedDisguises.contains("dropped_item") || allowedDisguises.contains("falling_block")) {
|
||||
sender.sendMessage(ChatColor.DARK_GREEN + "/disguiseplayer <Dropped_Item/Falling_Block> <Id> <Durability>");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -42,6 +42,7 @@ public class DisguiseEntityCommand extends BaseDisguiseCommand {
|
||||
|
||||
/**
|
||||
* Send the player the information
|
||||
*
|
||||
* @param sender
|
||||
* @param map
|
||||
*/
|
||||
@@ -51,11 +52,13 @@ public class DisguiseEntityCommand extends BaseDisguiseCommand {
|
||||
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));
|
||||
if (allowedDisguises.contains("player"))
|
||||
if (allowedDisguises.contains("player")) {
|
||||
sender.sendMessage(ChatColor.DARK_GREEN + "/disguiseentity player <Name>");
|
||||
}
|
||||
sender.sendMessage(ChatColor.DARK_GREEN + "/disguiseentity <DisguiseType> <Baby>");
|
||||
if (allowedDisguises.contains("dropped_item") || allowedDisguises.contains("falling_block"))
|
||||
if (allowedDisguises.contains("dropped_item") || allowedDisguises.contains("falling_block")) {
|
||||
sender.sendMessage(ChatColor.DARK_GREEN + "/disguiseentity <Dropped_Item/Falling_Block> <Id> <Durability>");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -22,7 +22,9 @@ import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
|
||||
public class DisguiseHelpCommand extends BaseDisguiseCommand {
|
||||
|
||||
private class EnumHelp {
|
||||
|
||||
private String enumDescription;
|
||||
private String enumName;
|
||||
private String[] enums;
|
||||
@@ -81,38 +83,39 @@ public class DisguiseHelpCommand extends BaseDisguiseCommand {
|
||||
try {
|
||||
enumHelp.add(new EnumHelp("HorseColor", "Horse colors", ChatColor.RED + "/disguisehelp HorseColors "
|
||||
+ ChatColor.GREEN + "- View all the colors you can use for a horses color", (Enum[]) Class.forName(
|
||||
"org.bukkit.entity.Horse$Color").getEnumConstants()));
|
||||
"org.bukkit.entity.Horse$Color").getEnumConstants()));
|
||||
} catch (Exception ex) {
|
||||
}
|
||||
try {
|
||||
enumHelp.add(new EnumHelp("HorseStyle", "Horse styles", ChatColor.RED + "/disguisehelp HorseStyles "
|
||||
+ ChatColor.GREEN + "- View all the styles you can use for a horses style", (Enum[]) Class.forName(
|
||||
"org.bukkit.entity.Horse$Style").getEnumConstants()));
|
||||
"org.bukkit.entity.Horse$Style").getEnumConstants()));
|
||||
} catch (Exception ex) {
|
||||
}
|
||||
try {
|
||||
enumHelp.add(new EnumHelp("OcelotType", "Ocelot types", ChatColor.RED + "/disguisehelp OcelotTypes "
|
||||
+ ChatColor.GREEN + "- View all the ocelot types you can use for ocelots", (Enum[]) Class.forName(
|
||||
"org.bukkit.entity.Ocelot$Type").getEnumConstants()));
|
||||
"org.bukkit.entity.Ocelot$Type").getEnumConstants()));
|
||||
} catch (Exception ex) {
|
||||
}
|
||||
try {
|
||||
ArrayList<String> enumReturns = new ArrayList<>();
|
||||
for (PotionEffectType potionType : PotionEffectType.values()) {
|
||||
if (potionType != null)
|
||||
if (potionType != null) {
|
||||
enumReturns.add(toReadable(potionType.getName()) + ChatColor.RED + "(" + ChatColor.GREEN + potionType.getId()
|
||||
+ ChatColor.RED + ")");
|
||||
}
|
||||
}
|
||||
enumHelp.add(new EnumHelp("PotionEffect", "PotionEffect", ChatColor.RED + "/disguisehelp PotionEffect "
|
||||
+ ChatColor.GREEN + "- View all the potion effects you can set", enumReturns.toArray(new String[enumReturns
|
||||
.size()])));
|
||||
.size()])));
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace(System.out);
|
||||
}
|
||||
try {
|
||||
enumHelp.add(new EnumHelp("Profession", "Villager professions", ChatColor.RED + "/disguisehelp Professions "
|
||||
+ ChatColor.GREEN + "- View all the professions you can set on a villager", (Enum[]) Class.forName(
|
||||
"org.bukkit.entity.Villager$Profession").getEnumConstants()));
|
||||
"org.bukkit.entity.Villager$Profession").getEnumConstants()));
|
||||
} catch (Exception ex) {
|
||||
}
|
||||
enumHelp.add(new EnumHelp("Direction", "Directions", ChatColor.RED + "/disguisehelp Directions " + ChatColor.GREEN
|
||||
@@ -123,7 +126,7 @@ 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" }) {
|
||||
for (String node : new String[]{"disguise", "disguiseradius", "disguiseentity", "disguiseplayer"}) {
|
||||
HashMap<DisguiseType, HashMap<ArrayList<String>, Boolean>> permMap = getPermissions(sender, "libsdisguises." + node
|
||||
+ ".");
|
||||
if (!permMap.isEmpty()) {
|
||||
@@ -273,8 +276,9 @@ public class DisguiseHelpCommand extends BaseDisguiseCommand {
|
||||
|
||||
public String toReadable(String string) {
|
||||
String[] split = string.split("_");
|
||||
for (int i = 0; i < split.length; i++)
|
||||
for (int i = 0; i < split.length; i++) {
|
||||
split[i] = split[i].substring(0, 1) + split[i].substring(1).toLowerCase();
|
||||
}
|
||||
return StringUtils.join(split, "_");
|
||||
}
|
||||
}
|
||||
|
@@ -85,11 +85,13 @@ public class DisguisePlayerCommand extends BaseDisguiseCommand {
|
||||
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));
|
||||
if (allowedDisguises.contains("player"))
|
||||
if (allowedDisguises.contains("player")) {
|
||||
sender.sendMessage(ChatColor.DARK_GREEN + "/disguiseplayer <PlayerName> player <Name>");
|
||||
}
|
||||
sender.sendMessage(ChatColor.DARK_GREEN + "/disguiseplayer <PlayerName> <DisguiseType> <Baby>");
|
||||
if (allowedDisguises.contains("dropped_item") || allowedDisguises.contains("falling_block"))
|
||||
if (allowedDisguises.contains("dropped_item") || allowedDisguises.contains("falling_block")) {
|
||||
sender.sendMessage(ChatColor.DARK_GREEN
|
||||
+ "/disguiseplayer <PlayerName> <Dropped_Item/Falling_Block> <Id> <Durability>");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -21,6 +21,7 @@ import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class DisguiseRadiusCommand extends BaseDisguiseCommand {
|
||||
|
||||
private int maxRadius = 30;
|
||||
private ArrayList<Class> validClasses = new ArrayList<>();
|
||||
|
||||
@@ -111,8 +112,9 @@ public class DisguiseRadiusCommand extends BaseDisguiseCommand {
|
||||
int disguisedEntitys = 0;
|
||||
int miscDisguises = 0;
|
||||
for (Entity entity : ((Player) sender).getNearbyEntities(radius, radius, radius)) {
|
||||
if (entity == sender)
|
||||
if (entity == sender) {
|
||||
continue;
|
||||
}
|
||||
if (type != null ? entity.getType() == type : entityClass.isAssignableFrom(entity.getClass())) {
|
||||
if (disguise.isMiscDisguise() && !DisguiseConfig.isMiscDisguisesForLivingEnabled()
|
||||
&& entity instanceof LivingEntity) {
|
||||
@@ -165,7 +167,7 @@ public class DisguiseRadiusCommand extends BaseDisguiseCommand {
|
||||
if (allowedDisguises.contains("dropped_item") || allowedDisguises.contains("falling_block")) {
|
||||
sender.sendMessage((ChatColor.DARK_GREEN + "/disguiseradius <EntityType" + optional
|
||||
+ "> <Radius> <Dropped_Item/Falling_Block> <Id> <Durability" + optional + ">").replace("<",
|
||||
"<" + ChatColor.GREEN).replace(">", ChatColor.DARK_GREEN + ">"));
|
||||
"<" + ChatColor.GREEN).replace(">", ChatColor.DARK_GREEN + ">"));
|
||||
}
|
||||
sender.sendMessage(ChatColor.DARK_GREEN + "See the EntityType's usable by " + ChatColor.GREEN
|
||||
+ "/disguiseradius EntityTypes");
|
||||
|
@@ -11,26 +11,26 @@ public class LibsDisguisesCommand implements CommandExecutor {
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
|
||||
if (args.length == 0) {
|
||||
sender.sendMessage(ChatColor.DARK_GREEN
|
||||
+ "This server is running "
|
||||
+ "Lib's Disguises v."
|
||||
+ Bukkit.getPluginManager().getPlugin("LibsDisguises").getDescription().getVersion()
|
||||
+ " by libraryaddict, maintained by NavidK0.\n"
|
||||
+ "Use /libsdisguises reload to reload the config. All disguises will be blown by doing this.");
|
||||
} else if (args.length > 0) {
|
||||
if (!sender.hasPermission("libsdisguises.reload")) {
|
||||
if (args[0].equalsIgnoreCase("reload")) {
|
||||
LibsDisguises.instance.reload();
|
||||
sender.sendMessage(ChatColor.GREEN + "[LibsDisguises] Reloaded config.");
|
||||
return true;
|
||||
} else {
|
||||
sender.sendMessage(ChatColor.RED + "[LibsDisguises] That command doesn't exist!");
|
||||
}
|
||||
if (args.length == 0) {
|
||||
sender.sendMessage(ChatColor.DARK_GREEN
|
||||
+ "This server is running "
|
||||
+ "Lib's Disguises v."
|
||||
+ Bukkit.getPluginManager().getPlugin("LibsDisguises").getDescription().getVersion()
|
||||
+ " by libraryaddict, maintained by NavidK0.\n"
|
||||
+ "Use /libsdisguises reload to reload the config. All disguises will be blown by doing this.");
|
||||
} else if (args.length > 0) {
|
||||
if (sender.hasPermission("libsdisguises.reload")) {
|
||||
if (args[0].equalsIgnoreCase("reload")) {
|
||||
LibsDisguises.instance.reload();
|
||||
sender.sendMessage(ChatColor.GREEN + "[LibsDisguises] Reloaded config.");
|
||||
return true;
|
||||
} else {
|
||||
sender.sendMessage(ChatColor.RED + "You are forbidden to use this command.");
|
||||
sender.sendMessage(ChatColor.RED + "[LibsDisguises] That command doesn't exist!");
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(ChatColor.RED + "You are forbidden to use this command.");
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@@ -21,10 +21,12 @@ public class UndisguiseCommand implements CommandExecutor {
|
||||
if (DisguiseAPI.isDisguised((Entity) sender)) {
|
||||
DisguiseAPI.undisguiseToAll((Player) sender);
|
||||
sender.sendMessage(ChatColor.RED + "You are no longer disguised");
|
||||
} else
|
||||
} else {
|
||||
sender.sendMessage(ChatColor.RED + "You are not disguised!");
|
||||
} else
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(ChatColor.RED + "You are forbidden to use this command.");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@@ -19,8 +19,9 @@ public class UndisguiseEntityCommand implements CommandExecutor {
|
||||
if (sender.hasPermission("libsdisguises.undisguiseentity")) {
|
||||
LibsDisguises.instance.getListener().setDisguiseEntity(sender.getName(), null);
|
||||
sender.sendMessage(ChatColor.RED + "Right click a disguised entity to undisguise them!");
|
||||
} else
|
||||
} else {
|
||||
sender.sendMessage(ChatColor.RED + "You are forbidden to use this command.");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@@ -20,14 +20,18 @@ public class UndisguisePlayerCommand implements CommandExecutor {
|
||||
if (DisguiseAPI.isDisguised(p)) {
|
||||
DisguiseAPI.undisguiseToAll(p);
|
||||
sender.sendMessage(ChatColor.RED + "The player is no longer disguised");
|
||||
} else
|
||||
} else {
|
||||
sender.sendMessage(ChatColor.RED + "The player is not disguised!");
|
||||
} else
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(ChatColor.RED + "Player not found");
|
||||
} else
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(ChatColor.RED + "/undisguiseplayer <Name>");
|
||||
} else
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(ChatColor.RED + "You are forbidden to use this command.");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@@ -10,6 +10,7 @@ import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class UndisguiseRadiusCommand implements CommandExecutor {
|
||||
|
||||
private int maxRadius = 30;
|
||||
|
||||
public UndisguiseRadiusCommand(int maxRadius) {
|
||||
@@ -48,16 +49,18 @@ public class UndisguiseRadiusCommand implements CommandExecutor {
|
||||
}
|
||||
int disguisedEntitys = 0;
|
||||
for (Entity entity : ((Player) sender).getNearbyEntities(radius, radius, radius)) {
|
||||
if (entity == sender)
|
||||
if (entity == sender) {
|
||||
continue;
|
||||
}
|
||||
if (DisguiseAPI.isDisguised(entity)) {
|
||||
DisguiseAPI.undisguiseToAll(entity);
|
||||
disguisedEntitys++;
|
||||
}
|
||||
}
|
||||
sender.sendMessage(ChatColor.RED + "Successfully undisguised " + disguisedEntitys + " entities!");
|
||||
} else
|
||||
} else {
|
||||
sender.sendMessage(ChatColor.RED + "You are forbidden to use this command.");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user