Class CloneManager

java.lang.Object
games.stendhal.server.entity.npc.CloneManager

public class CloneManager extends Object
Manages registered SpeakerNPC clones.
  • Method Details

    • get

      public static CloneManager get()
      Retrieves the static instance.
      Returns:
      CloneManager instance.
    • getInstance

      @Deprecated public static CloneManager getInstance()
      Deprecated.
      Use CloneManager.get().
      Retrieves the static instance.
      Returns:
      CloneManager instance.
    • clone

      public SpeakerNPC clone(SpeakerNPC orig, String cloneName)
      Creates a new clone.
      Parameters:
      orig - The SpeakerNPC to be cloned.
      cloneName - The hidden actual name of the entity. If null, the name of the original NPC suffixed with an integer index will be used.
      Returns:
      New SpeakerNPC.
    • clone

      public SpeakerNPC clone(SpeakerNPC orig)
      Creates a new clone.
      Parameters:
      orig - The SpeakerNPC to be cloned.
      Returns:
      New SpeakerNPC.
    • clone

      public SpeakerNPC clone(String name, String cloneName)
      Creates a new clone.
      Parameters:
      name - Name of the SpeakerNPC to be cloned.
      cloneName - The hidden actual name of the entity. If null, the name of the original NPC suffixed with an integer index will be used.
      Returns:
      New SpeakerNPC.
    • clone

      public SpeakerNPC clone(String name)
      Creates a new clone.
      Parameters:
      name - Name of the SpeakerNPC to be cloned.
      Returns:
      New SpeakerNPC.
    • registerAsClone

      public void registerAsClone(SpeakerNPC orig, SpeakerNPC clone)
      Registeres an existing SpeakerNPC as a clone of another. This only sets the "cloned" attribute for the clone entity. Any other attributes must be set manually.
      Parameters:
      orig - SpeakerNPC entity to be cloned.
      clone - SpeakerNPC entity to be registered as a clone.
    • registerAsClone

      public void registerAsClone(String origName, String cloneName)
      Registeres an existing SpeakerNPC as a clone of another. This only sets the "cloned" attribute for the clone entity. Any other attributes must be set manually.
      Parameters:
      origName - Name of the SpeakerNPC to be cloned.
      cloneName - Name to be registered as a clone.
    • isClone

      public boolean isClone(String name)
      Checks if a name is registered as a clone.
      Parameters:
      name - Name to be checked.
      Returns:
      true if the name is found in the registered list.
    • isClone

      public boolean isClone(SpeakerNPC npc)
      Checks if a SpeakerNPC is registered as a clone.
      Parameters:
      npc - The SpeakerNPC to be checked.
      Returns:
      true if the name of the SpeakerNPC is found in the registered list.
    • getOriginal

      public SpeakerNPC getOriginal(String name)
      Retrieves the original SpeakerNPC.
      Parameters:
      name - Name of the clone.
      Returns:
      The original SpeakerNPC if the clone name was found in the registered list, otherwise null.
    • getOriginal

      public SpeakerNPC getOriginal(SpeakerNPC npc)
      Retrieves the original SpeakerNPC.
      Parameters:
      npc - The SpeakerNPC clone.
      Returns:
      The original SpeakerNPC if the clone name was found in the registered list, otherwise null.