diff --git a/main/src/main/java/net/citizensnpcs/npc/CitizensNPC.java b/main/src/main/java/net/citizensnpcs/npc/CitizensNPC.java index af8d9bde8..8e91c0428 100644 --- a/main/src/main/java/net/citizensnpcs/npc/CitizensNPC.java +++ b/main/src/main/java/net/citizensnpcs/npc/CitizensNPC.java @@ -581,7 +581,7 @@ public class CitizensNPC extends AbstractNPC { data().setPersistent(NPC.Metadata.FLYABLE, true); } if (!hasTrait(Gravity.class)) { - getOrAddTrait(Gravity.class).setEnabled(true); + getOrAddTrait(Gravity.class).setHasGravity(false); } } diff --git a/main/src/main/java/net/citizensnpcs/trait/Age.java b/main/src/main/java/net/citizensnpcs/trait/Age.java index aba7969a6..f08da3e52 100644 --- a/main/src/main/java/net/citizensnpcs/trait/Age.java +++ b/main/src/main/java/net/citizensnpcs/trait/Age.java @@ -17,7 +17,7 @@ import net.citizensnpcs.util.Messages; * @see Ageable */ @TraitName("age") -public class Age extends Trait implements Toggleable { +public class Age extends Trait { @Persist private int age = 0; private Ageable ageable; @@ -82,7 +82,6 @@ public class Age extends Trait implements Toggleable { /** * Toggles the age lock variable and returns whether the age is currently locked. */ - @Override public boolean toggle() { locked = !locked; if (isAgeable()) { diff --git a/main/src/main/java/net/citizensnpcs/trait/Controllable.java b/main/src/main/java/net/citizensnpcs/trait/Controllable.java index 59bfa16c1..0500c9178 100644 --- a/main/src/main/java/net/citizensnpcs/trait/Controllable.java +++ b/main/src/main/java/net/citizensnpcs/trait/Controllable.java @@ -32,7 +32,7 @@ import net.citizensnpcs.util.Util; * e.g. arrow keys. */ @TraitName("controllable") -public class Controllable extends Trait implements Toggleable { +public class Controllable extends Trait { private MovementController controller; @Persist private BuiltInControls controls; @@ -152,7 +152,6 @@ public class Controllable extends Trait implements Toggleable { this.ownerRequired = ownerRequired; } - @Override public boolean toggle() { enabled = !enabled; if (!enabled && NMS.getPassengers(npc.getEntity()).size() > 0) { diff --git a/main/src/main/java/net/citizensnpcs/trait/Gravity.java b/main/src/main/java/net/citizensnpcs/trait/Gravity.java index 2ea7b1e4e..c058a0002 100644 --- a/main/src/main/java/net/citizensnpcs/trait/Gravity.java +++ b/main/src/main/java/net/citizensnpcs/trait/Gravity.java @@ -9,7 +9,7 @@ import net.citizensnpcs.util.NMS; * Enable/disable Minecraft's gravity. */ @TraitName("gravity") -public class Gravity extends Trait implements Toggleable { +public class Gravity extends Trait { @Persist("enabled") private boolean nogravity; @@ -24,16 +24,6 @@ public class Gravity extends Trait implements Toggleable { } } - /** - * Set whether to disable gravity or not - * - * @param gravitate - * true = disable gravity, false = enable gravity - */ - public void gravitate(boolean gravitate) { - nogravity = gravitate; - } - public boolean hasGravity() { return !nogravity; } @@ -50,11 +40,13 @@ public class Gravity extends Trait implements Toggleable { NMS.setNoGravity(npc.getEntity(), nogravity); } - public void setEnabled(boolean enabled) { - nogravity = enabled; + /** + * Set whether to have gravity or not + */ + public void setHasGravity(boolean hasGravity) { + nogravity = !hasGravity; } - @Override public boolean toggle() { nogravity = !nogravity; applyImmediately(); diff --git a/main/src/main/java/net/citizensnpcs/trait/LookClose.java b/main/src/main/java/net/citizensnpcs/trait/LookClose.java index c89ed93e4..79595adb9 100644 --- a/main/src/main/java/net/citizensnpcs/trait/LookClose.java +++ b/main/src/main/java/net/citizensnpcs/trait/LookClose.java @@ -36,7 +36,7 @@ import net.citizensnpcs.util.Util; * */ @TraitName("lookclose") -public class LookClose extends Trait implements Toggleable { +public class LookClose extends Trait { @Persist("disablewhilenavigating") private boolean disableWhileNavigating = Setting.DISABLE_LOOKCLOSE_WHILE_NAVIGATING.asBoolean(); @Persist("enabled") @@ -376,7 +376,6 @@ public class LookClose extends Trait implements Toggleable { return targetNPCs; } - @Override public boolean toggle() { enabled = !enabled; return enabled; diff --git a/main/src/main/java/net/citizensnpcs/trait/Saddle.java b/main/src/main/java/net/citizensnpcs/trait/Saddle.java index 63f04998c..d766b2907 100644 --- a/main/src/main/java/net/citizensnpcs/trait/Saddle.java +++ b/main/src/main/java/net/citizensnpcs/trait/Saddle.java @@ -14,7 +14,7 @@ import net.citizensnpcs.util.Util; * @see Pig#hasSaddle() */ @TraitName("saddle") -public class Saddle extends Trait implements Toggleable { +public class Saddle extends Trait { @Persist("") private boolean saddle; private boolean steerable; @@ -33,7 +33,6 @@ public class Saddle extends Trait implements Toggleable { } } - @Override public boolean toggle() { saddle = !saddle; if (steerable) { diff --git a/main/src/main/java/net/citizensnpcs/trait/Toggleable.java b/main/src/main/java/net/citizensnpcs/trait/Toggleable.java deleted file mode 100644 index 2068dec12..000000000 --- a/main/src/main/java/net/citizensnpcs/trait/Toggleable.java +++ /dev/null @@ -1,8 +0,0 @@ -package net.citizensnpcs.trait; - -/** - * Representing a state that can be toggled between enabled/disabled. - */ -public interface Toggleable { - public boolean toggle(); -} \ No newline at end of file