Class KeyedPortalFactory
java.lang.Object
games.stendhal.server.entity.mapstuff.portal.KeyedPortalFactory
- All Implemented Interfaces:
ConfigurableFactory
A factory for
KeyedPortal
objects.-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionCreate a keyed portal.protected games.stendhal.server.entity.mapstuff.portal.AccessCheckingPortal
Create a keyed portal.protected int
getIntValue(ConfigurableFactoryContext ctx, String key)
Extract integer value from a context.protected String
Extract the portal key from a context.protected int
Extract the portal key quantity from a context.protected ChatAction
Creates a new ChatAction from ConfigurableFactoryContext.protected String
getStringValue(ConfigurableFactoryContext ctx, String key)
Extract string value from a context.
-
Constructor Details
-
KeyedPortalFactory
public KeyedPortalFactory()
-
-
Method Details
-
getKey
Extract the portal key from a context.- Parameters:
ctx
- The configuration context.- Returns:
- The key name.
- Throws:
IllegalArgumentException
- If the class attribute is missing.
-
getQuantity
Extract the portal key quantity from a context.- Parameters:
ctx
- The configuration context.- Returns:
- The required key quantity.
- Throws:
IllegalArgumentException
- If the class attribute is missing.
-
createPortal
protected games.stendhal.server.entity.mapstuff.portal.AccessCheckingPortal createPortal(ConfigurableFactoryContext ctx)Create a keyed portal.- Parameters:
ctx
- The configuration context.- Returns:
- The portal.
- Throws:
IllegalArgumentException
- If the class attribute is missing.
-
create
Create a keyed portal.- Specified by:
create
in interfaceConfigurableFactory
- Parameters:
ctx
- Configuration context.- Returns:
- A KeyedPortal.
- Throws:
IllegalArgumentException
- If there is a problem with the attributes. The exception message should be a value suitable for meaningful user interpretation.- See Also:
KeyedPortal
-
getStringValue
Extract string value from a context.- Parameters:
ctx
- The configuration context.key
- The key to search for.- Returns:
- The string value of the key, or
null
if none. - Throws:
IllegalArgumentException
- If the class attribute is missing.
-
getIntValue
Extract integer value from a context.- Parameters:
ctx
- The configuration context.key
- The key to search for.- Returns:
- The integer value of the key, or
null
if none. - Throws:
IllegalArgumentException
- If the class attribute is missing.
-
getRejectedAction
Creates a new ChatAction from ConfigurableFactoryContext.- Parameters:
ctx
- ConfigurableFactoryContext- Returns:
- ChatAction instance
-