From 10595695c6f6a0f8fe3d4695f7b6ad0952b76842 Mon Sep 17 00:00:00 2001 From: Andrew Date: Fri, 12 Jul 2013 06:38:38 +1200 Subject: [PATCH] Sort by name --- .../disguise/DisguiseTypes/Values.java | 42 +++++++++---------- .../libraryaddict/disguise/LibsDisguises.java | 25 +++++------ 2 files changed, 32 insertions(+), 35 deletions(-) diff --git a/src/me/libraryaddict/disguise/DisguiseTypes/Values.java b/src/me/libraryaddict/disguise/DisguiseTypes/Values.java index a9371c4b..6b2e9258 100644 --- a/src/me/libraryaddict/disguise/DisguiseTypes/Values.java +++ b/src/me/libraryaddict/disguise/DisguiseTypes/Values.java @@ -6,18 +6,18 @@ import net.minecraft.server.v1_6_R2.IAttribute; public class Values { - private static HashMap> metaValues = new HashMap>(); private static HashMap> attributesValues = new HashMap>(); - private DisguiseType type; - - public Values(DisguiseType type) { - this.type = type; - metaValues.put(this.type, new HashMap()); - attributesValues.put(this.type, new HashMap()); - } - - public void setMetaValue(int no, Object value) { - metaValues.get(type).put(no, value); + private static HashMap> metaValues = new HashMap>(); + public static HashMap getAttributesValues(DisguiseType type) { + if (type == DisguiseType.DONKEY || type == DisguiseType.MULE || type == DisguiseType.ZOMBIE_HORSE + || type == DisguiseType.SKELETON_HORSE) + type = DisguiseType.HORSE; + if (type == DisguiseType.MINECART_CHEST || type == DisguiseType.MINECART_FURNACE || type == DisguiseType.MINECART_HOPPER + || type == DisguiseType.MINECART_TNT || type == DisguiseType.MINECART_MOB_SPAWNER) + type = DisguiseType.MINECART_RIDEABLE; + if (type == DisguiseType.WITHER_SKELETON) + type = DisguiseType.SKELETON; + return attributesValues.get(type); } public static HashMap getMetaValues(DisguiseType type) { @@ -32,19 +32,19 @@ public class Values { return metaValues.get(type); } + private DisguiseType type; + + public Values(DisguiseType type) { + this.type = type; + metaValues.put(this.type, new HashMap()); + attributesValues.put(this.type, new HashMap()); + } + public void setAttributesValue(IAttribute no, Double value) { attributesValues.get(type).put(no.a(), value); } - public static HashMap getAttributesValues(DisguiseType type) { - if (type == DisguiseType.DONKEY || type == DisguiseType.MULE || type == DisguiseType.ZOMBIE_HORSE - || type == DisguiseType.SKELETON_HORSE) - type = DisguiseType.HORSE; - if (type == DisguiseType.MINECART_CHEST || type == DisguiseType.MINECART_FURNACE || type == DisguiseType.MINECART_HOPPER - || type == DisguiseType.MINECART_TNT || type == DisguiseType.MINECART_MOB_SPAWNER) - type = DisguiseType.MINECART_RIDEABLE; - if (type == DisguiseType.WITHER_SKELETON) - type = DisguiseType.SKELETON; - return attributesValues.get(type); + public void setMetaValue(int no, Object value) { + metaValues.get(type).put(no, value); } } diff --git a/src/me/libraryaddict/disguise/LibsDisguises.java b/src/me/libraryaddict/disguise/LibsDisguises.java index 7f40c900..0a94b2f7 100644 --- a/src/me/libraryaddict/disguise/LibsDisguises.java +++ b/src/me/libraryaddict/disguise/LibsDisguises.java @@ -1,9 +1,7 @@ package me.libraryaddict.disguise; -import java.lang.reflect.Field; import java.util.ArrayList; import java.util.Collection; -import java.util.Collections; import java.util.HashMap; import java.util.Iterator; import java.util.List; @@ -24,7 +22,6 @@ import net.minecraft.server.v1_6_R2.GenericAttributes; import net.minecraft.server.v1_6_R2.WatchableObject; import net.minecraft.server.v1_6_R2.World; -import org.apache.commons.lang.StringUtils; import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.craftbukkit.v1_6_R2.CraftWorld; @@ -221,12 +218,11 @@ public class LibsDisguises extends JavaPlugin implements Listener { registerValues(); } - private String toReadable(String string) { - String[] strings = string.split("_"); - string = ""; - for (String s : strings) - string += s.substring(0, 1) + s.substring(1).toLowerCase(); - return string; + @EventHandler + public void onJoin(PlayerJoinEvent event) { + Player p = event.getPlayer(); + if (latestVersion != null && p.hasPermission(permission)) + p.sendMessage(String.format(updateMessage, currentVersion, latestVersion)); } private void registerValues() { @@ -280,10 +276,11 @@ public class LibsDisguises extends JavaPlugin implements Listener { } } - @EventHandler - public void onJoin(PlayerJoinEvent event) { - Player p = event.getPlayer(); - if (latestVersion != null && p.hasPermission(permission)) - p.sendMessage(String.format(updateMessage, currentVersion, latestVersion)); + private String toReadable(String string) { + String[] strings = string.split("_"); + string = ""; + for (String s : strings) + string += s.substring(0, 1) + s.substring(1).toLowerCase(); + return string; } } \ No newline at end of file