Package games.stendhal.server.entity.npc
Class CloneManager
java.lang.Object
games.stendhal.server.entity.npc.CloneManager
Manages registered SpeakerNPC clones.
-
Method Summary
Modifier and TypeMethodDescriptionclone(SpeakerNPC orig)
Creates a new clone.clone(SpeakerNPC orig, String cloneName)
Creates a new clone.Creates a new clone.Creates a new clone.static CloneManager
get()
Retrieves the static instance.static CloneManager
Deprecated.Use CloneManager.get().getOriginal(SpeakerNPC npc)
Retrieves the original SpeakerNPC.getOriginal(String name)
Retrieves the original SpeakerNPC.boolean
isClone(SpeakerNPC npc)
Checks if a SpeakerNPC is registered as a clone.boolean
Checks if a name is registered as a clone.void
registerAsClone(SpeakerNPC orig, SpeakerNPC clone)
Registeres an existing SpeakerNPC as a clone of another.void
registerAsClone(String origName, String cloneName)
Registeres an existing SpeakerNPC as a clone of another.
-
Method Details
-
get
Retrieves the static instance.- Returns:
- CloneManager instance.
-
getInstance
Deprecated.Use CloneManager.get().Retrieves the static instance.- Returns:
- CloneManager instance.
-
clone
Creates a new clone.- Parameters:
orig
- The SpeakerNPC to be cloned.cloneName
- The hidden actual name of the entity. Ifnull
, the name of the original NPC suffixed with an integer index will be used.- Returns:
- New SpeakerNPC.
-
clone
Creates a new clone.- Parameters:
orig
- The SpeakerNPC to be cloned.- Returns:
- New SpeakerNPC.
-
clone
Creates a new clone.- Parameters:
name
- Name of the SpeakerNPC to be cloned.cloneName
- The hidden actual name of the entity. Ifnull
, the name of the original NPC suffixed with an integer index will be used.- Returns:
- New SpeakerNPC.
-
clone
Creates a new clone.- Parameters:
name
- Name of the SpeakerNPC to be cloned.- Returns:
- New SpeakerNPC.
-
registerAsClone
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
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
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
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
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
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
.
-