Class StendhalRPRuleProcessor
java.lang.Object
games.stendhal.server.core.engine.StendhalRPRuleProcessor
- All Implemented Interfaces:
IRPRuleProcessor
adds game rules for Stendhal to the marauroa environment.
- Author:
- hendrik
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static StendhalRPRuleProcessorThe Singleton instance.protected PlayerLista list of online players -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedcreates a new StendhalRPRuleProcessor -
Method Summary
Modifier and TypeMethodDescriptionvoidNotify it when a new turn happens.booleancheckGameVersion(String game, String version)Returns true if the version of the game is compatiblecreateAccount(String username, String password, String email)Creates an account for the gamecreateAccountWithToken(String username, String tokenType, String token)Create an account for a player in game.createCharacter(String username, String character, RPObject template)Creates an new character for an account already logged into the gamevoidendTurn()Notify it when a end of actual turn happens.voidExecute an action in the name of a player.protected voidprotected voidstatic StendhalRPRuleProcessorget()gets the singleton instance of StendhalRPRuleProcessorstatic intgetMimeTypeForResource(String resource)gets the content type for the requested resourcegets a list of online playersFinds an online player with a specific name.getResource(String resource)gets an input stream to the requested resourceintgetTurn()protected voidprotected voidvoidkillRPEntity(RPEntity entity, Entity killer)Kills an RPEntity.voidlogGameEvent(GameEvent gameEvent)logs a gameEventvoidlogGameEvent(String source, String event, String... params)logs a game eventprotected voidvoidnotifyOnlineStatus(boolean isOnline, Player playerToNotifyAbout)Notifies buddies about going online/offline.booleanonActionAdd(RPObject caster, RPAction action, List<RPAction> actionList)This method is called *before* adding an action by RPScheduler so you can choose not to allow the action to be added by returning falsebooleanCallback method called when a player exits the gamebooleanCallback method called when a new player enters in the gamevoidCallback method called when a new player time out.voidremovePlayerText(Player player)voidremoveZone(StendhalRPZone zone)Removes a zone (like a personalized vault).voidsendMessageToSupporters(String message)Sends a message to all supporters.voidsendMessageToSupporters(String source, String message)Sends a message to all supporters.voidsetContext(RPServerManager rpman)Set the context where the actions are executed.static voidsetWelcomeMessage(String msg)Sets the welcome message.voidtellAllPlayers(NotificationType notificationType, String message)Tell this message all players.
-
Field Details
-
instance
The Singleton instance. -
onlinePlayers
a list of online players
-
-
Constructor Details
-
StendhalRPRuleProcessor
protected StendhalRPRuleProcessor()creates a new StendhalRPRuleProcessor
-
-
Method Details
-
get
gets the singleton instance of StendhalRPRuleProcessor- Returns:
- StendhalRPRuleProcessor
-
getOnlinePlayers
gets a list of online players- Returns:
- list of online players
-
setContext
Description copied from interface:IRPRuleProcessorSet the context where the actions are executed.- Specified by:
setContextin interfaceIRPRuleProcessor- Parameters:
rpman- the RPServerManager object that is running our actions
-
checkGameVersion
Description copied from interface:IRPRuleProcessorReturns true if the version of the game is compatible- Specified by:
checkGameVersionin interfaceIRPRuleProcessor- Parameters:
game- the game nameversion- the game version- Returns:
- true if game,version is compatible
-
killRPEntity
Kills an RPEntity.- Parameters:
entity-killer-
-
removePlayerText
-
getPlayer
Finds an online player with a specific name.- Parameters:
name- The player's name- Returns:
- The player, or null if no player with the given name is currently online.
-
onActionAdd
Description copied from interface:IRPRuleProcessorThis method is called *before* adding an action by RPScheduler so you can choose not to allow the action to be added by returning false- Specified by:
onActionAddin interfaceIRPRuleProcessor- Parameters:
caster- the object that casted the actionaction- the action that is going to be added.actionList- the actions that this player already owns.- Returns:
- true if we approve the action to be added.
-
execute
Description copied from interface:IRPRuleProcessorExecute an action in the name of a player.- Specified by:
executein interfaceIRPRuleProcessor- Parameters:
caster- the object that executesaction- the action to execute
-
getTurn
public int getTurn() -
beginTurn
public void beginTurn()Notify it when a new turn happens.- Specified by:
beginTurnin interfaceIRPRuleProcessor
-
logNumberOfPlayersOnline
protected void logNumberOfPlayersOnline() -
handlePlayersRmTexts
protected void handlePlayersRmTexts() -
executeNPCsPreLogic
protected void executeNPCsPreLogic() -
executePlayerLogic
protected void executePlayerLogic() -
handleKilledEntities
protected void handleKilledEntities() -
endTurn
public void endTurn()Description copied from interface:IRPRuleProcessorNotify it when a end of actual turn happens.- Specified by:
endTurnin interfaceIRPRuleProcessor
-
onInit
Description copied from interface:IRPRuleProcessorCallback method called when a new player enters in the game- Specified by:
onInitin interfaceIRPRuleProcessor- Parameters:
object- the new player that enters in the game.- Returns:
- true if object has been added.
-
onExit
Description copied from interface:IRPRuleProcessorCallback method called when a player exits the game- Specified by:
onExitin interfaceIRPRuleProcessor- Parameters:
object- the new player that exits the game.- Returns:
- true to allow player to exit
-
onTimeout
Description copied from interface:IRPRuleProcessorCallback method called when a new player time out. This method MUST logout the player- Specified by:
onTimeoutin interfaceIRPRuleProcessor- Parameters:
object- the new player that timeouts.
-
createAccount
Description copied from interface:IRPRuleProcessorCreates an account for the game- Specified by:
createAccountin interfaceIRPRuleProcessor- Parameters:
username- the username who is going to be added.password- the password for our username.email- the email of the player for notifications or password reminders.- Returns:
- the Result of creating the account.
-
createAccountWithToken
Description copied from interface:IRPRuleProcessorCreate an account for a player in game. Uses token instead of password for cases like 3rd party authentication (e.g. google sign-in).- Specified by:
createAccountWithTokenin interfaceIRPRuleProcessor- Parameters:
username- username for a new accounttokenType- token type for useful data about tokentoken- auth token to verify, usually obtained from 3rd party- Returns:
- the Result of creating a new account
-
createCharacter
Description copied from interface:IRPRuleProcessorCreates an new character for an account already logged into the game- Specified by:
createCharacterin interfaceIRPRuleProcessor- Parameters:
username- the username who owns the account of the character to be added.character- the character to createtemplate- the desired values of the avatar representing the character.- Returns:
- the Result of creating the character.
-
getRPManager
-
tellAllPlayers
Tell this message all players.- Parameters:
notificationType- type of notification message, usually NotificationType.PRIVMSGmessage- Message to tell all players
-
sendMessageToSupporters
Sends a message to all supporters.- Parameters:
message- Support message
-
sendMessageToSupporters
Sends a message to all supporters.- Parameters:
source- a player or script namemessage- Support message
-
getAmountOfOnlinePlayers
public static int getAmountOfOnlinePlayers() -
notifyOnlineStatus
Notifies buddies about going online/offline.- Parameters:
isOnline- did the player login?playerToNotifyAbout- name of the player
-
removeZone
Removes a zone (like a personalized vault).- Parameters:
zone- StendhalRPZone to remove
-
setWelcomeMessage
Sets the welcome message.- Parameters:
msg- welcome message
-
logGameEvent
logs a gameEvent- Parameters:
gameEvent- a game event
-
logGameEvent
logs a game event- Parameters:
source- sourceevent- eventparams- parameters
-
getMimeTypeForResource
gets the content type for the requested resource- Specified by:
getMimeTypeForResourcein interfaceIRPRuleProcessor- Parameters:
resource- name of resource- Returns:
- mime content/type or
null
-
getResource
gets an input stream to the requested resource- Specified by:
getResourcein interfaceIRPRuleProcessor- Parameters:
resource- name of resource- Returns:
- InputStream or
null
-