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);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user