mirror of
https://github.com/libraryaddict/LibsDisguises.git
synced 2024-11-05 09:09:40 +01:00
Sort by name
This commit is contained in:
parent
65e42e0132
commit
10595695c6
@ -6,18 +6,18 @@ import net.minecraft.server.v1_6_R2.IAttribute;
|
||||
|
||||
public class Values {
|
||||
|
||||
private static HashMap<DisguiseType, HashMap<Integer, Object>> metaValues = new HashMap<DisguiseType, HashMap<Integer, Object>>();
|
||||
private static HashMap<DisguiseType, HashMap<String, Double>> attributesValues = new HashMap<DisguiseType, HashMap<String, Double>>();
|
||||
private DisguiseType type;
|
||||
|
||||
public Values(DisguiseType type) {
|
||||
this.type = type;
|
||||
metaValues.put(this.type, new HashMap<Integer, Object>());
|
||||
attributesValues.put(this.type, new HashMap<String, Double>());
|
||||
}
|
||||
|
||||
public void setMetaValue(int no, Object value) {
|
||||
metaValues.get(type).put(no, value);
|
||||
private static HashMap<DisguiseType, HashMap<Integer, Object>> metaValues = new HashMap<DisguiseType, HashMap<Integer, Object>>();
|
||||
public static HashMap<String, Double> 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<Integer, Object> 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<Integer, Object>());
|
||||
attributesValues.put(this.type, new HashMap<String, Double>());
|
||||
}
|
||||
|
||||
public void setAttributesValue(IAttribute no, Double value) {
|
||||
attributesValues.get(type).put(no.a(), value);
|
||||
}
|
||||
|
||||
public static HashMap<String, Double> 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);
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user