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