Fixed disguise player not being constructable
This commit is contained in:
		| @@ -167,9 +167,6 @@ public class LibsDisguises extends JavaPlugin { | ||||
|             case LEASH_HITCH: | ||||
|                 name = "Leash"; | ||||
|                 break; | ||||
|             case PLAYER: | ||||
|                 name = "Human"; | ||||
|                 break; | ||||
|             default: | ||||
|                 break; | ||||
|             } | ||||
| @@ -197,10 +194,10 @@ public class LibsDisguises extends JavaPlugin { | ||||
|                         sound.setDamageSoundVolume((Float) soundStrength); | ||||
|                     } | ||||
|                 } | ||||
|             } catch (Exception e1) { | ||||
|                 System.out.print("[LibsDisguises] Trouble while making values for " + name + ": " + e1.getMessage()); | ||||
|             } catch (Exception ex) { | ||||
|                 System.out.print("[LibsDisguises] Trouble while making values for " + name + ": " + ex.getMessage()); | ||||
|                 System.out.print("[LibsDisguises] Please report this to LibsDisguises author"); | ||||
|                 e1.printStackTrace(); | ||||
|                 ex.printStackTrace(); | ||||
|             } | ||||
|         } | ||||
|     } | ||||
|   | ||||
| @@ -3,9 +3,13 @@ package me.libraryaddict.disguise; | ||||
| import java.lang.reflect.Field; | ||||
| import java.lang.reflect.Method; | ||||
|  | ||||
| import net.minecraft.server.v1_6_R3.World; | ||||
|  | ||||
| import org.bukkit.Art; | ||||
| import org.bukkit.Bukkit; | ||||
| import org.bukkit.Server; | ||||
| import org.bukkit.Sound; | ||||
| import org.bukkit.craftbukkit.v1_6_R3.CraftWorld; | ||||
| import org.bukkit.inventory.ItemStack; | ||||
|  | ||||
| public class ReflectionManager { | ||||
| @@ -49,8 +53,13 @@ public class ReflectionManager { | ||||
|             Class entityClass = getNmsClass("Entity" + entityName); | ||||
|             Object entityObject; | ||||
|             Object world = getWorld(); | ||||
|             if (entityName.equals("Human")) { | ||||
|                 entityObject = entityClass.getConstructor(getNmsClass("World"), String.class).newInstance(world, "LibsDisguises"); | ||||
|             if (entityName.equals("Player")) { | ||||
|                 Object minecraftServer = getNmsClass("MinecraftServer").getMethod("getServer").invoke(null); | ||||
|                 Object playerinteractmanager = getNmsClass("PlayerInteractManager").getConstructor(getNmsClass("World")) | ||||
|                         .newInstance(world); | ||||
|                 entityObject = entityClass.getConstructor(getNmsClass("MinecraftServer"), getNmsClass("World"), String.class, | ||||
|                         playerinteractmanager.getClass()).newInstance(minecraftServer, world, "LibsDisguises", | ||||
|                         playerinteractmanager); | ||||
|             } else { | ||||
|                 entityObject = entityClass.getConstructor(getNmsClass("World")).newInstance(world); | ||||
|             } | ||||
|   | ||||
| @@ -6,9 +6,9 @@ public class Values { | ||||
|  | ||||
|     private static HashMap<DisguiseType, Values> values = new HashMap<DisguiseType, Values>(); | ||||
|  | ||||
|    /* public static HashMap<String, Double> getAttributesValues(DisguiseType type) { | ||||
|         return getValues(type).getAttributesValues(); | ||||
|     }*/ | ||||
|     /* public static HashMap<String, Double> getAttributesValues(DisguiseType type) { | ||||
|          return getValues(type).getAttributesValues(); | ||||
|      }*/ | ||||
|  | ||||
|     public static Class getEntityClass(DisguiseType type) { | ||||
|         return getValues(type).getEntityClass(); | ||||
| @@ -45,7 +45,7 @@ public class Values { | ||||
|         return values.get(type); | ||||
|     } | ||||
|  | ||||
|   //  private HashMap<String, Double> attributesValues = new HashMap<String, Double>(); | ||||
|     // private HashMap<String, Double> attributesValues = new HashMap<String, Double>(); | ||||
|  | ||||
|     private Class declared; | ||||
|     private int enumEntitySize; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user