Class Controllable

java.lang.Object
net.citizensnpcs.api.trait.Trait
net.citizensnpcs.trait.Controllable
All Implemented Interfaces:
Runnable, Toggleable, Listener

public class Controllable extends Trait implements Toggleable
Persists the controllable status for /npc controllable A controllable NPC can be mounted by a Player using right click or /npc mount and moved around using e.g. arrow keys.
  • Constructor Details

    • Controllable

      public Controllable()
  • Method Details

    • isEnabled

      public boolean isEnabled()
    • mount

      public boolean mount(Player toMount)
      Attempts to mount the Player onto the NPC.
      Parameters:
      toMount - the player to mount
      Returns:
      whether the mount was successful
    • onSpawn

      public void onSpawn()
      Description copied from class: Trait
      Called when an NPC is spawned. NPC.getEntity() will return null until this is called. This is also called onAttach when the NPC is already spawned.
      Overrides:
      onSpawn in class Trait
    • run

      public void run()
      Description copied from class: Trait
      Called every tick if overridden.
      Specified by:
      run in interface Runnable
      Overrides:
      run in class Trait
    • setControls

      public void setControls(Controllable.BuiltInControls controls)
    • setEnabled

      public boolean setEnabled(boolean enabled)
    • setOwnerRequired

      public void setOwnerRequired(boolean ownerRequired)
      Sets whether the Player attempting to mount the NPC must actually own the NPC to mount it.
      See Also:
    • toggle

      public boolean toggle()
      Specified by:
      toggle in interface Toggleable