mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-17 15:45:10 +00:00
IWorld:
-Implemented spawnClone() with a boolean parameter to check entity protection from mods & plugins correctly (for real this time). ICloneHandler: -Implemented ignoreProtection boolean value for the spawn() function.
This commit is contained in:
1 parent
a4585fdf4d
commit
a3b5f5993e
5 files changed
+51
-8
No files matched your search
@@ -194,16 +194,25 @@ public class ServerCloneController implements ICloneHandler {
|
||||
}
|
||||
}
|
||||
|
||||
public IEntity spawn(double x, double y, double z, int tab, String name, IWorld world) {
|
||||
public IEntity spawn(double x, double y, double z, int tab, String name, IWorld world, boolean ignoreProtection) {
|
||||
NBTTagCompound compound = this.getCloneData((ICommandSender)null, name, tab);
|
||||
if (compound == null) {
|
||||
throw new CustomNPCsException("Unknown clone tab:" + tab + " name:" + name, new Object[0]);
|
||||
} else {
|
||||
Entity entity = NoppesUtilServer.spawnClone(compound, (int)x, (int)y, (int)z, world.getMCWorld());
|
||||
Entity entity;
|
||||
if (!ignoreProtection) {
|
||||
entity = NoppesUtilServer.spawnCloneWithProtection(compound, (int) x, (int) y, (int) z, world.getMCWorld());
|
||||
} else {
|
||||
entity = NoppesUtilServer.spawnClone(compound, (int) x, (int) y, (int) z, world.getMCWorld());
|
||||
}
|
||||
return entity == null ? null : NpcAPI.Instance().getIEntity(entity);
|
||||
}
|
||||
}
|
||||
|
||||
public IEntity spawn(double x, double y, double z, int tab, String name, IWorld world) {
|
||||
return spawn(x, y, z, tab, name, world, true);
|
||||
}
|
||||
|
||||
public IEntity[] getTab(int tab, IWorld world) {
|
||||
File dir = new File(getDir(), tab + "");
|
||||
if (!dir.exists() || !dir.isDirectory() || dir.listFiles() == null) {
|
||||
|
||||
Reference in new issue
Block a user