Added config option ContactMojangServers which disables player skins, but stops the plugin from pinging Mojang servers.

Added reload command to reload the config.
Tweaked a couple of things.
Fixed isInvulnerable issue.
This commit is contained in:
NavidK0
2015-03-29 22:47:29 -04:00
parent a33bb0b139
commit 15c0141c3d
27 changed files with 174 additions and 236 deletions

View File

@@ -5,6 +5,7 @@ import java.util.HashMap;
import me.libraryaddict.disguise.DisguiseConfig;
import me.libraryaddict.disguise.DisguiseListener;
import me.libraryaddict.disguise.LibsDisguises;
import me.libraryaddict.disguise.disguisetypes.DisguiseType;
import me.libraryaddict.disguise.utilities.BaseDisguiseCommand;
@@ -15,12 +16,6 @@ import org.bukkit.command.CommandSender;
public class DisguiseCloneCommand extends BaseDisguiseCommand {
private DisguiseListener listener;
public DisguiseCloneCommand(DisguiseListener listener) {
this.listener = listener;
}
@Override
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
if (sender.getName().equals("CONSOLE")) {
@@ -48,7 +43,7 @@ public class DisguiseCloneCommand extends BaseDisguiseCommand {
return true;
}
}
listener.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 {

View File

@@ -33,7 +33,7 @@ public class DisguiseCommand extends BaseDisguiseCommand {
}
return true;
} catch (Exception ex) {
ex.printStackTrace();
ex.printStackTrace(System.out);
return true;
}
if (DisguiseConfig.isNameOfPlayerShownAboveDisguise()) {

View File

@@ -5,6 +5,7 @@ import java.util.HashMap;
import me.libraryaddict.disguise.DisguiseConfig;
import me.libraryaddict.disguise.DisguiseListener;
import me.libraryaddict.disguise.LibsDisguises;
import me.libraryaddict.disguise.disguisetypes.Disguise;
import me.libraryaddict.disguise.disguisetypes.DisguiseType;
import me.libraryaddict.disguise.utilities.BaseDisguiseCommand;
@@ -15,12 +16,6 @@ import org.bukkit.command.CommandSender;
public class DisguiseEntityCommand extends BaseDisguiseCommand {
private DisguiseListener listener;
public DisguiseEntityCommand(DisguiseListener listener) {
this.listener = listener;
}
@Override
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
if (sender.getName().equals("CONSOLE")) {
@@ -36,10 +31,10 @@ public class DisguiseEntityCommand extends BaseDisguiseCommand {
}
return true;
} catch (Exception ex) {
ex.printStackTrace();
ex.printStackTrace(System.out);
return true;
}
listener.setDisguiseEntity(sender.getName(), disguise);
LibsDisguises.instance.getListener().setDisguiseEntity(sender.getName(), disguise);
sender.sendMessage(ChatColor.RED + "Right click a entity in the next " + DisguiseConfig.getDisguiseEntityExpire()
+ " seconds to disguise it as a " + disguise.getType().toReadable() + "!");
return true;

View File

@@ -70,7 +70,7 @@ public class DisguiseHelpCommand extends BaseDisguiseCommand {
enumHelp.add(new EnumHelp("AnimalColor", "Animal colors", ChatColor.RED + "/disguisehelp AnimalColors "
+ ChatColor.GREEN + "- View all the colors you can use for a animal color", AnimalColor.values()));
} catch (Exception ex) {
ex.printStackTrace();
ex.printStackTrace(System.out);
}
try {
enumHelp.add(new EnumHelp("Art", "Arts", ChatColor.RED + "/disguisehelp Art " + ChatColor.GREEN
@@ -107,7 +107,7 @@ public class DisguiseHelpCommand extends BaseDisguiseCommand {
+ ChatColor.GREEN + "- View all the potion effects you can set", enumReturns.toArray(new String[enumReturns
.size()])));
} catch (Exception ex) {
ex.printStackTrace();
ex.printStackTrace(System.out);
}
try {
enumHelp.add(new EnumHelp("Profession", "Villager professions", ChatColor.RED + "/disguisehelp Professions "
@@ -234,7 +234,7 @@ public class DisguiseHelpCommand extends BaseDisguiseCommand {
}
}
} catch (Exception ex) {
ex.printStackTrace();
ex.printStackTrace(System.out);
}
Collections.sort(methods, String.CASE_INSENSITIVE_ORDER);
for (int i = 0; i < methods.size(); i++) {

View File

@@ -49,7 +49,7 @@ public class DisguisePlayerCommand extends BaseDisguiseCommand {
}
return true;
} catch (Exception ex) {
ex.printStackTrace();
ex.printStackTrace(System.out);
return true;
}
if (disguise.isMiscDisguise() && !DisguiseConfig.isMiscDisguisesForLivingEnabled()) {

View File

@@ -105,7 +105,7 @@ public class DisguiseRadiusCommand extends BaseDisguiseCommand {
}
return true;
} catch (Exception ex) {
ex.printStackTrace();
ex.printStackTrace(System.out);
return true;
} // Time to use it!
int disguisedEntitys = 0;

View File

@@ -1,5 +1,6 @@
package me.libraryaddict.disguise.commands;
import me.libraryaddict.disguise.LibsDisguises;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
@@ -10,11 +11,22 @@ 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");
+ " 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 (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!");
}
}
return true;
}
}

View File

@@ -1,6 +1,7 @@
package me.libraryaddict.disguise.commands;
import me.libraryaddict.disguise.DisguiseListener;
import me.libraryaddict.disguise.LibsDisguises;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
@@ -8,11 +9,6 @@ import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
public class UndisguiseEntityCommand implements CommandExecutor {
private DisguiseListener listener;
public UndisguiseEntityCommand(DisguiseListener listener) {
this.listener = listener;
}
@Override
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
@@ -21,7 +17,7 @@ public class UndisguiseEntityCommand implements CommandExecutor {
return true;
}
if (sender.hasPermission("libsdisguises.undisguiseentity")) {
listener.setDisguiseEntity(sender.getName(), null);
LibsDisguises.instance.getListener().setDisguiseEntity(sender.getName(), null);
sender.sendMessage(ChatColor.RED + "Right click a disguised entity to undisguise them!");
} else
sender.sendMessage(ChatColor.RED + "You are forbidden to use this command.");