2013-05-17 23:05:19 +02:00
|
|
|
package me.libraryaddict.disguise;
|
|
|
|
|
2013-07-15 09:33:23 +02:00
|
|
|
import java.lang.reflect.InvocationTargetException;
|
2013-07-11 20:38:07 +02:00
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.Collection;
|
|
|
|
import java.util.HashMap;
|
|
|
|
import java.util.Iterator;
|
2013-05-17 23:05:19 +02:00
|
|
|
import java.util.List;
|
2013-07-16 07:23:11 +02:00
|
|
|
import me.libraryaddict.disguise.Commands.*;
|
2013-05-17 23:05:19 +02:00
|
|
|
import me.libraryaddict.disguise.DisguiseTypes.Disguise;
|
2013-05-21 02:59:57 +02:00
|
|
|
import me.libraryaddict.disguise.DisguiseTypes.DisguiseType;
|
2013-05-17 23:05:19 +02:00
|
|
|
import me.libraryaddict.disguise.DisguiseTypes.PlayerDisguise;
|
2013-07-11 20:38:07 +02:00
|
|
|
import me.libraryaddict.disguise.DisguiseTypes.Values;
|
|
|
|
import net.minecraft.server.v1_6_R2.AttributeSnapshot;
|
|
|
|
import net.minecraft.server.v1_6_R2.ChatMessage;
|
|
|
|
import net.minecraft.server.v1_6_R2.ChunkCoordinates;
|
|
|
|
import net.minecraft.server.v1_6_R2.EntityHuman;
|
|
|
|
import net.minecraft.server.v1_6_R2.EntityLiving;
|
|
|
|
import net.minecraft.server.v1_6_R2.GenericAttributes;
|
2013-07-09 04:51:35 +02:00
|
|
|
import net.minecraft.server.v1_6_R2.WatchableObject;
|
2013-07-11 20:38:07 +02:00
|
|
|
import net.minecraft.server.v1_6_R2.World;
|
2013-05-29 16:25:00 +02:00
|
|
|
|
|
|
|
import org.bukkit.Bukkit;
|
2013-05-31 10:55:55 +02:00
|
|
|
import org.bukkit.ChatColor;
|
2013-07-11 20:38:07 +02:00
|
|
|
import org.bukkit.craftbukkit.v1_6_R2.CraftWorld;
|
2013-05-29 00:29:36 +02:00
|
|
|
import org.bukkit.entity.Arrow;
|
2013-05-27 14:11:12 +02:00
|
|
|
import org.bukkit.entity.Entity;
|
2013-05-29 00:29:36 +02:00
|
|
|
import org.bukkit.entity.ExperienceOrb;
|
|
|
|
import org.bukkit.entity.Item;
|
2013-05-17 23:05:19 +02:00
|
|
|
import org.bukkit.entity.Player;
|
2013-05-31 10:55:55 +02:00
|
|
|
import org.bukkit.event.EventHandler;
|
|
|
|
import org.bukkit.event.Listener;
|
|
|
|
import org.bukkit.event.player.PlayerJoinEvent;
|
2013-05-17 23:05:19 +02:00
|
|
|
import org.bukkit.plugin.java.JavaPlugin;
|
|
|
|
|
|
|
|
import com.comphenix.protocol.Packets;
|
|
|
|
import com.comphenix.protocol.ProtocolLibrary;
|
2013-05-29 00:29:36 +02:00
|
|
|
import com.comphenix.protocol.ProtocolManager;
|
2013-05-17 23:05:19 +02:00
|
|
|
import com.comphenix.protocol.events.ConnectionSide;
|
|
|
|
import com.comphenix.protocol.events.ListenerPriority;
|
|
|
|
import com.comphenix.protocol.events.PacketAdapter;
|
2013-07-06 16:34:12 +02:00
|
|
|
import com.comphenix.protocol.events.PacketContainer;
|
2013-05-17 23:05:19 +02:00
|
|
|
import com.comphenix.protocol.events.PacketEvent;
|
|
|
|
import com.comphenix.protocol.reflect.StructureModifier;
|
|
|
|
|
2013-05-31 10:55:55 +02:00
|
|
|
public class LibsDisguises extends JavaPlugin implements Listener {
|
2013-07-11 20:38:07 +02:00
|
|
|
private class DisguiseHuman extends EntityHuman {
|
|
|
|
|
|
|
|
public DisguiseHuman(World world) {
|
|
|
|
super(world, "LibsDisguises");
|
|
|
|
}
|
|
|
|
|
|
|
|
public boolean a(int arg0, String arg1) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
public ChunkCoordinates b() {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void sendMessage(ChatMessage arg0) {
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2013-05-31 10:55:55 +02:00
|
|
|
private String currentVersion;
|
2013-07-06 17:43:59 +02:00
|
|
|
private String latestVersion;
|
2013-05-31 10:55:55 +02:00
|
|
|
private String permission;
|
2013-06-25 05:15:38 +02:00
|
|
|
private String updateMessage = ChatColor.RED + "[LibsDisguises] " + ChatColor.DARK_RED
|
2013-07-09 21:25:12 +02:00
|
|
|
+ "There is a update ready to be downloaded! You are using " + ChatColor.RED + "v%s" + ChatColor.DARK_RED
|
2013-06-25 05:15:38 +02:00
|
|
|
+ ", the new version is " + ChatColor.RED + "%s" + ChatColor.DARK_RED + "!";
|
2013-05-17 23:05:19 +02:00
|
|
|
|
2013-05-29 00:52:54 +02:00
|
|
|
@Override
|
2013-05-17 23:05:19 +02:00
|
|
|
public void onEnable() {
|
2013-05-29 16:25:00 +02:00
|
|
|
if (Bukkit.getPluginManager().getPlugin("ProtocolLib") == null) {
|
2013-05-29 19:17:48 +02:00
|
|
|
System.out
|
|
|
|
.print("[LibsDisguises] WARNING! WARNING! LibsDisguises couldn't find ProtocolLib! This plugin depends on it to run!");
|
|
|
|
System.out
|
|
|
|
.print("[LibsDisguises] WARNING! WARNING! LibsDisguises couldn't find ProtocolLib! LibsDisguises is now shutting down!");
|
2013-05-29 16:25:00 +02:00
|
|
|
getPluginLoader().disablePlugin(this);
|
|
|
|
return;
|
|
|
|
}
|
2013-05-29 00:29:36 +02:00
|
|
|
DisguiseAPI.init(this);
|
|
|
|
DisguiseAPI.enableSounds(true);
|
|
|
|
final ProtocolManager manager = ProtocolLibrary.getProtocolManager();
|
2013-06-02 06:10:37 +02:00
|
|
|
manager.addPacketListener(new PacketAdapter(this, ConnectionSide.SERVER_SIDE, ListenerPriority.HIGHEST,
|
2013-05-29 00:29:36 +02:00
|
|
|
Packets.Server.NAMED_ENTITY_SPAWN, Packets.Server.ENTITY_METADATA, Packets.Server.ARM_ANIMATION,
|
|
|
|
Packets.Server.REL_ENTITY_MOVE_LOOK, Packets.Server.ENTITY_LOOK, Packets.Server.ENTITY_TELEPORT,
|
|
|
|
Packets.Server.ADD_EXP_ORB, Packets.Server.VEHICLE_SPAWN, Packets.Server.MOB_SPAWN,
|
2013-07-06 16:34:12 +02:00
|
|
|
Packets.Server.ENTITY_PAINTING, Packets.Server.COLLECT, 44) {
|
2013-05-29 00:29:36 +02:00
|
|
|
@Override
|
|
|
|
public void onPacketSending(PacketEvent event) {
|
|
|
|
try {
|
2013-07-15 09:33:23 +02:00
|
|
|
final Player observer = event.getPlayer();
|
2013-05-29 00:29:36 +02:00
|
|
|
StructureModifier<Entity> entityModifer = event.getPacket().getEntityModifier(observer.getWorld());
|
|
|
|
org.bukkit.entity.Entity entity = entityModifer.read((Packets.Server.COLLECT == event.getPacketID() ? 1 : 0));
|
2013-07-11 22:33:17 +02:00
|
|
|
if (entity == observer)
|
|
|
|
return;
|
2013-05-29 00:29:36 +02:00
|
|
|
if (DisguiseAPI.isDisguised(entity)) {
|
|
|
|
Disguise disguise = DisguiseAPI.getDisguise(entity);
|
2013-07-06 16:34:12 +02:00
|
|
|
if (event.getPacketID() == 44) {
|
2013-07-11 20:38:07 +02:00
|
|
|
if (disguise.getType().isMisc() && entity.getType().isAlive()) {
|
2013-07-06 16:34:12 +02:00
|
|
|
event.setCancelled(true);
|
2013-07-11 20:38:07 +02:00
|
|
|
} else {
|
|
|
|
HashMap<String, Double> values = Values.getAttributesValues(disguise.getType());
|
|
|
|
Iterator<AttributeSnapshot> itel = ((List<AttributeSnapshot>) event.getPacket().getModifier()
|
|
|
|
.read(1)).iterator();
|
|
|
|
event.setPacket(new PacketContainer(event.getPacketID()));
|
|
|
|
Collection collection = new ArrayList<AttributeSnapshot>();
|
|
|
|
while (itel.hasNext()) {
|
|
|
|
AttributeSnapshot att = itel.next();
|
|
|
|
if (values.containsKey(att.a())) {
|
|
|
|
collection.add(new AttributeSnapshot(null, att.a(), values.get(att.a()), att.c()));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
StructureModifier<Object> mods = event.getPacket().getModifier();
|
|
|
|
mods.write(0, entity.getEntityId());
|
|
|
|
mods.write(1, collection);
|
|
|
|
}
|
2013-07-06 16:34:12 +02:00
|
|
|
} else if (event.getPacketID() == Packets.Server.ENTITY_METADATA) {
|
2013-06-25 03:35:32 +02:00
|
|
|
StructureModifier<Object> mods = event.getPacket().getModifier();
|
2013-07-06 17:42:25 +02:00
|
|
|
event.setPacket(new PacketContainer(event.getPacketID()));
|
2013-07-07 09:18:17 +02:00
|
|
|
StructureModifier<Object> newMods = event.getPacket().getModifier();
|
|
|
|
newMods.write(0, mods.read(0));
|
|
|
|
newMods.write(1, disguise.getWatcher().convert((List<WatchableObject>) mods.read(1)));
|
2013-05-29 00:29:36 +02:00
|
|
|
} else if (event.getPacketID() == Packets.Server.NAMED_ENTITY_SPAWN) {
|
|
|
|
if (disguise.getType().isPlayer()) {
|
2013-06-25 03:35:32 +02:00
|
|
|
StructureModifier<Object> mods = event.getPacket().getModifier();
|
2013-05-29 00:29:36 +02:00
|
|
|
String name = (String) mods.read(1);
|
|
|
|
if (!name.equals(((PlayerDisguise) disguise).getName())) {
|
2013-07-15 09:33:23 +02:00
|
|
|
final PacketContainer[] packets = disguise.constructPacket(entity);
|
|
|
|
event.setPacket(packets[0]);
|
|
|
|
if (packets.length > 1) {
|
|
|
|
Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() {
|
|
|
|
public void run() {
|
|
|
|
try {
|
|
|
|
manager.sendServerPacket(observer, packets[1]);
|
|
|
|
} catch (InvocationTargetException e) {
|
|
|
|
e.printStackTrace();
|
|
|
|
}
|
|
|
|
}
|
2013-07-15 10:02:43 +02:00
|
|
|
});
|
2013-07-15 09:33:23 +02:00
|
|
|
}
|
2013-05-21 02:59:57 +02:00
|
|
|
}
|
|
|
|
} else {
|
2013-07-15 09:33:23 +02:00
|
|
|
final PacketContainer[] packets = disguise.constructPacket(entity);
|
|
|
|
event.setPacket(packets[0]);
|
|
|
|
if (packets.length > 1) {
|
|
|
|
Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() {
|
|
|
|
public void run() {
|
|
|
|
try {
|
|
|
|
manager.sendServerPacket(observer, packets[1]);
|
|
|
|
} catch (InvocationTargetException e) {
|
|
|
|
e.printStackTrace();
|
|
|
|
}
|
|
|
|
}
|
2013-07-15 10:02:43 +02:00
|
|
|
});
|
2013-07-15 09:33:23 +02:00
|
|
|
}
|
2013-05-29 00:29:36 +02:00
|
|
|
}
|
|
|
|
} else if (event.getPacketID() == Packets.Server.MOB_SPAWN
|
|
|
|
|| event.getPacketID() == Packets.Server.ADD_EXP_ORB
|
|
|
|
|| event.getPacketID() == Packets.Server.VEHICLE_SPAWN
|
|
|
|
|| event.getPacketID() == Packets.Server.ENTITY_PAINTING) {
|
2013-07-15 09:33:23 +02:00
|
|
|
final PacketContainer[] packets = disguise.constructPacket(entity);
|
|
|
|
event.setPacket(packets[0]);
|
|
|
|
if (packets.length > 1) {
|
|
|
|
Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() {
|
|
|
|
public void run() {
|
|
|
|
try {
|
|
|
|
manager.sendServerPacket(observer, packets[1]);
|
|
|
|
} catch (InvocationTargetException e) {
|
|
|
|
e.printStackTrace();
|
|
|
|
}
|
|
|
|
}
|
2013-07-15 10:02:43 +02:00
|
|
|
});
|
2013-07-15 09:33:23 +02:00
|
|
|
}
|
2013-05-29 00:29:36 +02:00
|
|
|
} else if (event.getPacketID() == Packets.Server.ARM_ANIMATION
|
|
|
|
|| event.getPacketID() == Packets.Server.COLLECT) {
|
|
|
|
if (disguise.getType().isMisc()) {
|
|
|
|
event.setCancelled(true);
|
|
|
|
}
|
|
|
|
} else if (Packets.Server.REL_ENTITY_MOVE_LOOK == event.getPacketID()
|
|
|
|
|| Packets.Server.ENTITY_LOOK == event.getPacketID()
|
|
|
|
|| Packets.Server.ENTITY_TELEPORT == event.getPacketID()) {
|
2013-06-25 03:35:32 +02:00
|
|
|
event.setPacket(event.getPacket().deepClone());
|
|
|
|
StructureModifier<Object> mods = event.getPacket().getModifier();
|
2013-05-29 00:29:36 +02:00
|
|
|
if (disguise.getType() == DisguiseType.ENDER_DRAGON) {
|
|
|
|
byte value = (Byte) mods.read(4);
|
|
|
|
mods.write(4, (byte) (value - 128));
|
2013-07-15 09:33:23 +02:00
|
|
|
} else if (disguise.getType().isMisc()) {
|
2013-05-29 00:29:36 +02:00
|
|
|
byte value = (Byte) mods.read(4);
|
2013-07-15 09:59:30 +02:00
|
|
|
if (disguise.getType() == DisguiseType.ITEM_FRAME || disguise.getType() == DisguiseType.ARROW) {
|
|
|
|
mods.write(4, (byte) -value);
|
2013-07-15 09:33:23 +02:00
|
|
|
} else if (disguise.getType() == DisguiseType.PAINTING) {
|
2013-07-15 09:59:30 +02:00
|
|
|
mods.write(4, (byte) -(value + 128));
|
2013-07-15 09:33:23 +02:00
|
|
|
} else if (disguise.getType().isMisc())
|
2013-05-29 22:46:51 +02:00
|
|
|
mods.write(4, (byte) (value - 64));
|
2013-05-17 23:05:19 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2013-05-29 00:29:36 +02:00
|
|
|
} catch (Exception e) {
|
|
|
|
e.printStackTrace();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
manager.addPacketListener(new PacketAdapter(this, ConnectionSide.CLIENT_SIDE, ListenerPriority.NORMAL,
|
|
|
|
Packets.Client.USE_ENTITY) {
|
|
|
|
@Override
|
|
|
|
public void onPacketReceiving(PacketEvent event) {
|
|
|
|
try {
|
|
|
|
Player observer = event.getPlayer();
|
|
|
|
StructureModifier<Entity> entityModifer = event.getPacket().getEntityModifier(observer.getWorld());
|
|
|
|
org.bukkit.entity.Entity entity = entityModifer.read(1);
|
|
|
|
if (DisguiseAPI.isDisguised(entity)
|
|
|
|
&& (entity instanceof ExperienceOrb || entity instanceof Item || entity instanceof Arrow)) {
|
|
|
|
event.setCancelled(true);
|
|
|
|
}
|
|
|
|
} catch (Exception e) {
|
|
|
|
e.printStackTrace();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
2013-07-16 08:53:39 +02:00
|
|
|
saveDefaultConfig();
|
2013-07-16 07:23:11 +02:00
|
|
|
DisguiseListener listener = new DisguiseListener(this);
|
|
|
|
Bukkit.getPluginManager().registerEvents(listener, this);
|
2013-05-21 04:23:58 +02:00
|
|
|
getCommand("disguise").setExecutor(new DisguiseCommand());
|
|
|
|
getCommand("undisguise").setExecutor(new UndisguiseCommand());
|
2013-05-29 00:44:55 +02:00
|
|
|
getCommand("disguiseplayer").setExecutor(new DisguisePlayerCommand());
|
|
|
|
getCommand("undisguiseplayer").setExecutor(new UndisguisePlayerCommand());
|
2013-07-16 07:23:11 +02:00
|
|
|
getCommand("undisguiseentity").setExecutor(new UndisguiseEntityCommand(listener));
|
|
|
|
getCommand("disguiseentity").setExecutor(new DisguiseEntityCommand(listener));
|
2013-07-16 08:53:39 +02:00
|
|
|
getCommand("disguiseradius").setExecutor(new DisguiseRadiusCommand(getConfig().getInt("DisguiseRadiusMax")));
|
|
|
|
getCommand("undisguiseradius").setExecutor(new UndisguiseRadiusCommand(getConfig().getInt("UndisguiseRadiusMax")));
|
2013-05-31 10:55:55 +02:00
|
|
|
permission = getConfig().getString("Permission");
|
2013-06-25 03:37:17 +02:00
|
|
|
if (getConfig().getBoolean("NotifyUpdate")) {
|
|
|
|
currentVersion = getDescription().getVersion();
|
2013-05-31 10:55:55 +02:00
|
|
|
Bukkit.getScheduler().scheduleAsyncDelayedTask(this, new Runnable() {
|
|
|
|
public void run() {
|
|
|
|
try {
|
|
|
|
UpdateChecker updateChecker = new UpdateChecker();
|
|
|
|
updateChecker.checkUpdate("v"
|
|
|
|
+ Bukkit.getPluginManager().getPlugin("LibsDisguises").getDescription().getVersion());
|
|
|
|
latestVersion = updateChecker.getLatestVersion();
|
|
|
|
if (latestVersion != null) {
|
|
|
|
latestVersion = "v" + latestVersion;
|
|
|
|
for (Player p : Bukkit.getOnlinePlayers())
|
|
|
|
if (p.hasPermission(permission))
|
2013-06-25 05:15:38 +02:00
|
|
|
p.sendMessage(String.format(updateMessage, currentVersion, latestVersion));
|
2013-05-31 10:55:55 +02:00
|
|
|
}
|
|
|
|
} catch (Exception ex) {
|
|
|
|
System.out.print(String.format("[LibsDisguises] Failed to check for update: %s", ex.getMessage()));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
2013-06-25 03:37:17 +02:00
|
|
|
}
|
2013-06-01 08:35:31 +02:00
|
|
|
Bukkit.getPluginManager().registerEvents(this, this);
|
2013-07-11 20:38:07 +02:00
|
|
|
registerValues();
|
|
|
|
}
|
|
|
|
|
2013-07-11 20:38:38 +02:00
|
|
|
@EventHandler
|
|
|
|
public void onJoin(PlayerJoinEvent event) {
|
|
|
|
Player p = event.getPlayer();
|
|
|
|
if (latestVersion != null && p.hasPermission(permission))
|
|
|
|
p.sendMessage(String.format(updateMessage, currentVersion, latestVersion));
|
2013-07-11 20:38:07 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
private void registerValues() {
|
|
|
|
World world = ((CraftWorld) Bukkit.getWorlds().get(0)).getHandle();
|
|
|
|
for (DisguiseType disguiseType : DisguiseType.values()) {
|
|
|
|
String name = toReadable(disguiseType.name());
|
|
|
|
if (disguiseType == DisguiseType.WITHER_SKELETON) {
|
|
|
|
continue;
|
2013-07-16 13:42:35 +02:00
|
|
|
} else if (disguiseType == DisguiseType.ZOMBIE_VILLAGER) {
|
|
|
|
continue;
|
2013-07-11 20:38:07 +02:00
|
|
|
} else if (disguiseType == DisguiseType.PRIMED_TNT) {
|
|
|
|
name = "TNTPrimed";
|
|
|
|
} else if (disguiseType == DisguiseType.DONKEY) {
|
|
|
|
continue;
|
|
|
|
} else if (disguiseType == DisguiseType.MULE) {
|
|
|
|
continue;
|
2013-07-16 13:42:35 +02:00
|
|
|
} else if (disguiseType == DisguiseType.UNDEAD_HORSE) {
|
2013-07-11 20:38:07 +02:00
|
|
|
continue;
|
|
|
|
} else if (disguiseType == DisguiseType.SKELETON_HORSE) {
|
|
|
|
continue;
|
|
|
|
} else if (disguiseType == DisguiseType.MINECART_TNT) {
|
|
|
|
name = "MinecartTNT";
|
2013-07-16 13:42:35 +02:00
|
|
|
} else if (disguiseType == DisguiseType.MINECART) {
|
|
|
|
name = "MinecartRideable";
|
|
|
|
} else if (disguiseType == DisguiseType.FIREWORK) {
|
|
|
|
name = "Fireworks";
|
2013-07-11 20:38:07 +02:00
|
|
|
} else if (disguiseType == DisguiseType.SPLASH_POTION)
|
|
|
|
name = "Potion";
|
|
|
|
else if (disguiseType == DisguiseType.GIANT)
|
|
|
|
name = "GiantZombie";
|
|
|
|
else if (disguiseType == DisguiseType.DROPPED_ITEM)
|
|
|
|
name = "Item";
|
|
|
|
else if (disguiseType == DisguiseType.FIREBALL)
|
|
|
|
name = "LargeFireball";
|
|
|
|
try {
|
|
|
|
net.minecraft.server.v1_6_R2.Entity entity = null;
|
2013-07-15 09:33:23 +02:00
|
|
|
Class entityClass;
|
2013-07-11 20:38:07 +02:00
|
|
|
if (disguiseType == DisguiseType.PLAYER) {
|
2013-07-15 09:33:23 +02:00
|
|
|
entityClass = EntityHuman.class;
|
2013-07-11 20:38:07 +02:00
|
|
|
entity = new DisguiseHuman(world);
|
|
|
|
} else {
|
2013-07-15 09:33:23 +02:00
|
|
|
entityClass = Class.forName("net.minecraft.server.v1_6_R2.Entity" + name);
|
2013-07-11 20:38:07 +02:00
|
|
|
entity = (net.minecraft.server.v1_6_R2.Entity) entityClass.getConstructor(World.class).newInstance(world);
|
|
|
|
}
|
2013-07-15 09:33:23 +02:00
|
|
|
Values value = new Values(disguiseType, entityClass);
|
2013-07-11 20:38:07 +02:00
|
|
|
List<WatchableObject> watchers = entity.getDataWatcher().c();
|
|
|
|
for (WatchableObject watch : watchers)
|
|
|
|
value.setMetaValue(watch.a(), watch.b());
|
|
|
|
if (entity instanceof EntityLiving) {
|
|
|
|
EntityLiving livingEntity = (EntityLiving) entity;
|
2013-07-12 22:19:24 +02:00
|
|
|
value.setAttributesValue(GenericAttributes.d.a(), livingEntity.getAttributeInstance(GenericAttributes.d)
|
2013-07-11 20:38:07 +02:00
|
|
|
.getValue());
|
|
|
|
}
|
|
|
|
} catch (Exception e1) {
|
|
|
|
System.out.print("[LibsDisguises] Trouble while making values for " + name + ": " + e1.getMessage());
|
|
|
|
System.out.print("[LibsDisguises] Please report this to LibsDisguises author");
|
|
|
|
e1.printStackTrace();
|
|
|
|
}
|
|
|
|
}
|
2013-05-31 10:55:55 +02:00
|
|
|
}
|
|
|
|
|
2013-07-11 20:38:38 +02:00
|
|
|
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;
|
2013-05-17 23:05:19 +02:00
|
|
|
}
|
|
|
|
}
|