From aba637be14f9b11936ae64f2ac4631eb192b2d9b Mon Sep 17 00:00:00 2001 From: 1whohears <1whohears28@gmail.com> Date: Wed, 25 May 2022 23:56:36 -0500 Subject: [PATCH] removed redundant faction functions Luis C.M. will add API.getFactions() which returns the FactionController. All these functions use the faction controller anyway. Also Luis PR already has entity.getDimension and world.spawnEntity --- .../noppes/npcs/scripted/ScriptWorld.java | 34 ------------------- .../npcs/scripted/entity/ScriptEntity.java | 4 --- .../npcs/scripted/interfaces/IEntity.java | 2 -- .../npcs/scripted/interfaces/IWorld.java | 13 ------- 4 files changed, 53 deletions(-) diff --git a/src/main/java/noppes/npcs/scripted/ScriptWorld.java b/src/main/java/noppes/npcs/scripted/ScriptWorld.java index b2e7fe1cd..c84774456 100644 --- a/src/main/java/noppes/npcs/scripted/ScriptWorld.java +++ b/src/main/java/noppes/npcs/scripted/ScriptWorld.java @@ -420,40 +420,6 @@ public class ScriptWorld implements IWorld { return ScriptController.Instance.getScriptForEntity(entity); } - public boolean spawnEntity(Entity e) { - if (world.spawnEntityInWorld(e)) return true; - return false; - } - - /** - * Create a new default faction - * @param name The name of the new faction. If the name already exists an '_' will be added at the end - * @return The faction object which was created - */ - public ScriptFaction createFaction(String name) { - //System.out.println("Attempting to create new faction "+name); - int maxValue = 0xFFFFFF; - Random r = new Random(); - int randomColor = r.nextInt(maxValue + 1); - - Faction fac = new Faction(-1, name, randomColor, 1000); - FactionController.getInstance().saveFaction(fac); - - return new ScriptFaction(fac); - } - - public ScriptFaction getFactionFromName(String name) { - Faction f = FactionController.getInstance().getFactionFromName(name); - if (f == null) return null; - return new ScriptFaction(f); - } - - public ScriptFaction getFactionFromId(int id) { - Faction f = FactionController.getInstance().get(id); - if (f == null) return null; - return new ScriptFaction(f); - } - public ScriptScoreboard getScoreboard(){ return new ScriptScoreboard(); } diff --git a/src/main/java/noppes/npcs/scripted/entity/ScriptEntity.java b/src/main/java/noppes/npcs/scripted/entity/ScriptEntity.java index 5434300ad..2e3c734bf 100644 --- a/src/main/java/noppes/npcs/scripted/entity/ScriptEntity.java +++ b/src/main/java/noppes/npcs/scripted/entity/ScriptEntity.java @@ -318,10 +318,6 @@ public class ScriptEntity implements IEntity { public void setPos(IPos pos) { this.entity.setPosition((double)((float)pos.getX() + 0.5F), (double)pos.getY(), (double)((float)pos.getZ() + 0.5F)); } - - public int getDimension() { - return entity.dimension; - } /** * @param range The search range for entities around this entity diff --git a/src/main/java/noppes/npcs/scripted/interfaces/IEntity.java b/src/main/java/noppes/npcs/scripted/interfaces/IEntity.java index 83618ef57..7e77cad95 100644 --- a/src/main/java/noppes/npcs/scripted/interfaces/IEntity.java +++ b/src/main/java/noppes/npcs/scripted/interfaces/IEntity.java @@ -129,8 +129,6 @@ public interface IEntity { * @param z The z position */ public void setPosition(double x, double y, double z); - - public int getDimension(); /** * @param range The search range for entities around this entity diff --git a/src/main/java/noppes/npcs/scripted/interfaces/IWorld.java b/src/main/java/noppes/npcs/scripted/interfaces/IWorld.java index fe09a6df1..64d035d05 100644 --- a/src/main/java/noppes/npcs/scripted/interfaces/IWorld.java +++ b/src/main/java/noppes/npcs/scripted/interfaces/IWorld.java @@ -219,19 +219,6 @@ public interface IWorld { */ public ScriptEntity spawnClone(int x, int y, int z, int tab, String name); - public boolean spawnEntity(Entity e); - - /** - * Create a new default faction - * @param name The name of the new faction. If the name already exists an '_' will be added at the end - * @return The faction object which was created - */ - public ScriptFaction createFaction(String name); - - public ScriptFaction getFactionFromName(String name); - - public ScriptFaction getFactionFromId(int id); - public ScriptScoreboard getScoreboard(); BlockPos getMCBlockPos(int x, int y, int z);