|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object wyvern.world.World
The game world. It handles loading and caching maps and players.
Nested Class Summary | |
static interface |
World.ShoutFlags
Flags to pass to World.shout(). |
Field Summary |
Fields inherited from interface wyvern.lib.WizTypes |
ARCH, ELDER, JUNIOR, MAX_LEVEL, MIN_LEVEL, PLAYER, SENIOR, WIZARD |
Constructor Summary | |
World()
Creates the World object. |
Method Summary | |
static void |
addMapListener(MapLoaderListener callback,
java.lang.String filename)
Adds another listener to be notified when a map finishes loading. |
static void |
addPlayer(Player p)
Adds an existing player to the list of registered players. |
static void |
autoloadMap(java.lang.String path)
Used for autoloading the destinations of "autoload" teleporters. |
static boolean |
ban(java.lang.String name)
Bans a player until the next reboot. |
static void |
bootAllPlayers()
Boots every player off the game. |
static void |
bootIdlePlayers()
Goes through the player list and boots any players that have been idle for too long. |
static void |
cancelReboot(Commandable agent)
Cancels the current reboot, if any. |
static boolean |
enableShouting(Commandable agent,
boolean on)
Turns all shouting on or off. |
static int |
getAveragePlayers()
Returns the average number of players that have been logged in during this session. |
static GameMap |
getCreationMap()
Returns a new instance of the map used for creating new chars. |
static GameMap |
getMap(MapLoaderListener callback,
java.lang.String name)
Returns a reference to the specified map, loading it if necessary. |
static GameMap |
getMap(MapLoaderListener callback,
java.lang.String name,
GameMapLoader loader,
boolean cache)
Loads a map in the background using a custom map loader. |
static GameMap |
getMap(java.lang.String name)
Returns a reference to the specified map, loading it if necessary. |
static GameMap |
getMapNoLoad(java.lang.String name)
Retrieves the current map if it's already loaded in memory, else returns null. |
static GameMap |
getMapSynchronously(java.lang.String name)
Loads a map, NOT in the background, using a custom map loader. |
static GameMap |
getMapSynchronously(java.lang.String name,
GameMapLoader loader)
Loads a map, NOT in the background, using a custom map loader. |
static int |
getMaxPlayers()
Returns the highest number of players who've been logged in at once during this session. |
static java.lang.String |
getName()
Returns the name of this world. |
static Player |
getPlayer(java.lang.String name)
Returns a Player object, looking up their name. |
static Player |
getPlayer(java.lang.String name,
boolean partial)
Returns a player from the online-players list, and you can specify only the first few characters of the player's name. |
static int |
getPlayerCount()
Returns the number of players currently active on this server. |
static java.util.Set |
getPlayerList()
Returns a Set view of the players currently in the game. |
static wyvern.world.PlayerList |
getPlayerListInstance()
This method is for debugging only. |
static java.lang.String[] |
getRegisteredMaps()
Returns a list of all currently loaded maps. |
static Location |
getRestartLocation()
Returns the newbie village chapel - the default restart location if we can't determine where to put the player when they die. |
static java.lang.String[] |
getSortedPlayers()
Returns a list of players online, sorted by their start times for this session, from first to most recent. |
static long |
getStartTime()
Returns the result of System.currentTimeMillis() when the server was started. |
double |
getSystemLoad()
Returns the current unix system 5-minute load average. |
static int |
getUniquePlayers()
Returns the count of unique players who've played during this session, not including guests. |
static java.lang.String |
getUptime()
Returns a string saying how long the server has been up. |
static java.lang.String[] |
getWizardList()
|
static int |
getWizLevel(java.lang.String name)
Returns the AccessControl.WizLevel for this player |
static boolean |
isAtLeast(Commandable agent,
int level)
Returns true if the passed player is at least the specified wizard level. |
static boolean |
isAtLeast(java.lang.String name,
int level)
Returns true if the passed player name is a wizard character. |
static boolean |
isBanished(java.lang.String name)
Returns true if the specified name is on the banish list. |
static boolean |
isBanned(java.lang.String name)
Returns true if the player is banned for this session. |
static boolean |
isElderWizard(Commandable agent)
Returns true if the passed player is an Elder Wizard. |
static boolean |
isElderWizard(java.lang.String name)
Returns true if the passed player is an Elder Wizard. |
static boolean |
isExtremelyNaughty(java.lang.String s)
Returns true if the passed string has an obvious attempt to bypass the shout filter. |
static boolean |
isGod(Commandable agent)
Returns true if the passed player is a God. |
static boolean |
isGod(java.lang.String name)
Returns true if the passed player is a God. |
static boolean |
isIPBanished(java.lang.String ip)
Returns true if the specified IP address is banished. |
static boolean |
isJuniorWizard(Commandable agent)
Returns true if the passed player is a Junior Wizard. |
static boolean |
isJuniorWizard(java.lang.String name)
Returns true if the passed player is a Junior Wizard. |
static boolean |
isNaughty(java.lang.String s)
Returns true if the passed string contains any naughty language. |
static boolean |
isSeniorWizard(Commandable agent)
Returns true if the passed player is a Senior Wizard. |
static boolean |
isSeniorWizard(java.lang.String name)
Returns true if the passed player is a Senior Wizard. |
static boolean |
isWizAlt(java.lang.String name)
Returns true if the passed player name has the same email address as an existing wizard. |
static boolean |
isWizard(Commandable agent)
Returns true if the passed player is a mid-level Wizard. |
static boolean |
isWizard(java.lang.String name)
Returns true if the passed player is a mid-level Wizard. |
static void |
mailPlayer(java.lang.String player,
java.lang.String sender,
java.lang.String body)
Sends a post-office mail message to a player. |
void |
mapLoaded(GameMap map,
java.lang.String name)
Called when the requested map finishes loading. |
void |
mapLoadFailed(java.lang.String name)
Called when the requested map couldn't be loaded. |
static java.lang.String |
matchPlayer(java.lang.String name)
Looks for a player matching the passed partial-name. |
static boolean |
outranks(Commandable wizardA,
Commandable wizardB)
Returns true if the first wizard outranks the second wizard. |
static boolean |
outranks(java.lang.String name1,
java.lang.String name2)
Returns true if the first wizard outranks the second wizard. |
static boolean |
rebootPending()
Returns true if the game is currently being rebooted. |
static void |
registerMap(GameMap map)
Adds a map to the World. |
static void |
scheduleReboot(int delay)
Sets a timer to schedule a reboot. |
static void |
shout(java.lang.String msg)
Sends a shout message to everyone on the game. |
static void |
shout(java.lang.String msg,
byte style)
Sends a shout message to everyone on the game, in the specified RPCConstants.TextStyle. |
static void |
shout(java.lang.String msg,
byte style,
int flags)
Sends a shout message to everyone on the game, in the specified RPCConstants.TextStyle. |
static boolean |
shoutingEnabled()
Returns true if shouting is currently enabled. |
static void |
shutdown()
Shuts down the game server. |
void |
timerExpired()
World timer: updates score list once an hour, checks load averages, unloads unused maps, etc. |
java.lang.String |
toString()
|
static boolean |
unban(java.lang.String name)
Unbans a player for this session. |
static int |
unloadMap(java.lang.String name)
Attempts to unload a map from the game. |
static void |
unloadMaps(boolean all)
Tries to recover some memory for the game by unloading all maps that don't have players in them. |
static void |
unloadUnusedMaps()
Tries to recover some memory for the game by unloading all maps that don't have players in them. |
static void |
unregisterPlayer(Player player)
Removes a player from the World list. |
void |
updateHighScores()
Re-generates the high score list. |
static java.util.List |
wiztell(java.lang.String msg,
java.lang.String teller)
Sends a message to every wizard logged into the game. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public World()
Method Detail |
public static java.lang.String getName()
public static GameMap getCreationMap()
public static void unregisterPlayer(Player player)
player
- the player to kick outpublic static Player getPlayer(java.lang.String name)
name
- the player's name - no title, case is not significant
public static Player getPlayer(java.lang.String name, boolean partial)
name
- the (partial) player namepartial
- true to use partial name-matching
public static java.lang.String matchPlayer(java.lang.String name)
name
- the first part of a player's name
public static java.util.Set getPlayerList()
public static java.lang.String[] getSortedPlayers()
public static java.lang.String[] getWizardList()
public static int getPlayerCount()
public static void addPlayer(Player p)
public static int getMaxPlayers()
public static int getAveragePlayers()
public static Location getRestartLocation()
public static boolean isBanished(java.lang.String name)
public static boolean isIPBanished(java.lang.String ip)
ip
- a full IP address (4 octets) or a subnet (3 octets,
e.g. 207.42.131) - formatting must be exact.
public static int getUniquePlayers()
public static GameMap getMap(MapLoaderListener callback, java.lang.String name)
callback
- the listener to notify when the map is loaded.
If the map is already loaded, no notification occurs.name
- the relative path to the map, e.g.
"wiz/bowser/town/blacksmith" (for wizard maps) or
"town/blacksmith" for built-in maps.
public static GameMap getMap(MapLoaderListener callback, java.lang.String name, GameMapLoader loader, boolean cache)
name
- a name by which to refer to the mapcallback
- the callback wanting to know when it's loadedloader
- a custom map loader, perhaps one that constructs
the map dynamically without reading it from a mapfilecache
- true to cache the map in the world list, keyed
on its path, after the map is loaded. You probably want to
pass false
public static GameMap getMap(java.lang.String name)
name
- the relative path to the map
public static GameMap getMapSynchronously(java.lang.String name)
Make SURE you never call this method from the Kernel thread. It's OK to call it if the BackgroundMapLoader has called your GameMapLoader.loadMap() function, requesting you to load the map.
The map is not put in the World map cache. You have to do this explicitly with World.registerMap(), if you want it to show up in the World list.
name
- path to the map
public static GameMap getMapSynchronously(java.lang.String name, GameMapLoader loader)
Make SURE you never call this method from the Kernel thread. It's OK to call it if the BackgroundMapLoader has called your GameMapLoader.loadMap() function, requesting you to load the map.
The map is not put in the World map cache. You have to do this explicitly with World.registerMap(), if you want it to show up in the World list.
name
- path to the map
public static void registerMap(GameMap map)
map
- the map to add; must have its name setpublic static int unloadMap(java.lang.String name)
name
- the map to unload
public static java.lang.String[] getRegisteredMaps()
public static GameMap getMapNoLoad(java.lang.String name)
name
- the relative path to the map to fetch
public static void autoloadMap(java.lang.String path)
path
- the relative map pathpublic static void addMapListener(MapLoaderListener callback, java.lang.String filename)
callback
- the listener to notifyfilename
- the unique name of the map being loadedpublic void mapLoaded(GameMap map, java.lang.String name)
mapLoaded
in interface MapLoaderListener
map
- the map referencename
- the name of the mappublic void mapLoadFailed(java.lang.String name)
mapLoadFailed
in interface MapLoaderListener
name
- the name of the map that failed.public static void unloadUnusedMaps()
public static void unloadMaps(boolean all)
all
- true to unload all maps, false to skip maps that
have the "no-reset" propertypublic static void shutdown()
public static void bootAllPlayers()
public static void shout(java.lang.String msg)
msg
- any message to sendpublic static void shout(java.lang.String msg, byte style)
msg
- any message to sendstyle
- the wyvern.common.net.RPCConstants.TextStylepublic static void shout(java.lang.String msg, byte style, int flags)
msg
- any message to sendstyle
- the wyvern.common.net.RPCConstants.TextStyleflags
- an int consisting of or'ed-together World.ShoutFlags
constants.public static void mailPlayer(java.lang.String player, java.lang.String sender, java.lang.String body) throws java.lang.Exception
player
- the name of the player to send the mail to.sender
- who to say the mail is frombody
- the message
any
- Exception if it fails to be delivered
java.lang.Exception
public static boolean isGod(java.lang.String name)
public static boolean isGod(Commandable agent)
public static boolean isElderWizard(java.lang.String name)
public static boolean isElderWizard(Commandable agent)
public static boolean isSeniorWizard(java.lang.String name)
public static boolean isSeniorWizard(Commandable agent)
public static boolean isWizard(java.lang.String name)
public static boolean isWizard(Commandable agent)
public static boolean isJuniorWizard(java.lang.String name)
public static boolean isJuniorWizard(Commandable agent)
public static boolean isAtLeast(Commandable agent, int level)
public static boolean isAtLeast(java.lang.String name, int level)
public static int getWizLevel(java.lang.String name)
name
- the player name
public static boolean outranks(java.lang.String name1, java.lang.String name2)
name1
- the first wizard's namename2
- the second wizard's name
public static boolean outranks(Commandable wizardA, Commandable wizardB)
wizardA
- the first wizardwizardB
- the second wizard
public static boolean isWizAlt(java.lang.String name)
name
- the name of a player
public static boolean isNaughty(java.lang.String s)
public static boolean isExtremelyNaughty(java.lang.String s)
s
- the message
public static java.util.List wiztell(java.lang.String msg, java.lang.String teller)
teller
- the wizard to skip (if a wizard is doing it)
public static long getStartTime()
public void timerExpired()
timerExpired
in interface Timed
public void updateHighScores()
public static void bootIdlePlayers()
public static void scheduleReboot(int delay)
delay
- minutes to rebootpublic static void cancelReboot(Commandable agent)
public static boolean rebootPending()
public static java.lang.String getUptime()
public double getSystemLoad()
public static boolean enableShouting(Commandable agent, boolean on)
on
- true to turn shouting on, false to turn it off
public static boolean shoutingEnabled()
public static boolean ban(java.lang.String name)
public static boolean isBanned(java.lang.String name)
name
- a player name - no partial matches accepted
public static boolean unban(java.lang.String name)
name
- the name of a player.
public java.lang.String toString()
public static wyvern.world.PlayerList getPlayerListInstance()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |