public class MGPlayer extends java.lang.Object implements Metadatable
Constructor and Description |
---|
MGPlayer(java.lang.String plugin,
java.lang.String name,
java.lang.String arena)
Creates a new MGPlayer instance.
|
Modifier and Type | Method and Description |
---|---|
JoinResult |
addToRound(java.lang.String round)
|
org.bukkit.entity.Player |
b()
Deprecated.
Encourages poor coding practice; please use
Bukkit.getPlayer(String) |
boolean |
equals(java.lang.Object p) |
java.util.HashMap<java.lang.String,java.lang.Object> |
getAllMetadata()
Retrieves a
HashMap representing this object's complete metadata. |
java.lang.String |
getArena()
Gets the arena associated with this
MGPlayer . |
org.bukkit.entity.Player |
getBukkitPlayer()
Deprecated.
Use
Bukkit.getPlayer(String) |
java.lang.Object |
getMetadata(java.lang.String key)
Retrieves a given value from this object's metadata by its key.
|
Minigame |
getMinigame()
Gets the MGLib API instance registered by the minigame plugin associated
with this
MGPlayer . |
java.lang.String |
getName()
Gets the username of this
MGPlayer . |
java.lang.String |
getPlugin()
Gets the minigame plugin associated with this
MGPlayer . |
java.lang.String |
getPrefix()
Retrieves the prefix of this player (used on lobby signs).
|
GameMode |
getPrevGameMode()
Gets the gamemode MGLib will impose upon the player upon round exit.
|
Round |
getRound()
Gets the
Round associated with this player. |
java.lang.String |
getTeam()
Retrieves the name of the team this player is on, or null if they are not
on a team.
|
int |
hashCode() |
boolean |
hasMetadata(java.lang.String key)
Checks whether a given key is present in this object's metadata.
|
boolean |
isFrozen()
Retrieves whether the player is frozen.
|
boolean |
isSpectating()
Gets whether this player is spectating their round, as opposed to
participating in it.
|
void |
removeFromRound()
Removes this
MGPlayer from the round they are currently in. |
void |
removeFromRound(org.bukkit.Location location)
Deprecated.
|
void |
removeFromRound(Location3D location)
Removes this
MGPlayer from the round they are currently in. |
void |
removeMetadata(java.lang.String key)
Removes the given key from this object's metadata.
|
void |
reset()
Resets the
Bukkit player after they've left a round. |
void |
reset(org.bukkit.Location location)
Deprecated.
|
void |
reset(Location3D location)
Resets the
Bukkit player after they've left a round. |
void |
setArena(java.lang.String arena)
Sets the arena of this
MGPlayer . |
void |
setFrozen(boolean frozen)
Cleanly freezes or unfreezes the player.
|
void |
setMetadata(java.lang.String key,
java.lang.Object value)
Adds a key-value pair to this object's metadata.
|
void |
setPrefix(java.lang.String prefix)
Sets the prefix of this player (used on lobby signs).
|
void |
setPrevGameMode(GameMode gameMode)
Sets the gamemode MGLib will impose upon the player upon round exit.
|
void |
setPrevGameMode(org.bukkit.GameMode gameMode)
Deprecated.
|
void |
setSpectating(boolean spectating)
Sets whether this player is spectating or not.
|
void |
setTeam(java.lang.String team)
Sets the name of the team this player is on.
|
void |
spawnIn()
Respawns the player at a random or sequential spawn, depending on your
configuration.
|
void |
spawnIn(int spawn)
Respawns the player at the given spawn.
|
public MGPlayer(java.lang.String plugin, java.lang.String name, java.lang.String arena)
plugin
- the plugin to associate the MGPlayer withname
- the username of the playerarena
- the arena of the playerpublic java.lang.String getPlugin()
MGPlayer
.MGPlayer
public Minigame getMinigame()
MGPlayer
.MGPlayer
public java.lang.String getName()
MGPlayer
.MGPlayer
public java.lang.String getArena()
MGPlayer
.MGPlayer
public java.lang.String getPrefix()
public java.lang.String getTeam()
public void setTeam(java.lang.String team)
team
- the name of the team this player is on. Set to null for no
team.public void setArena(java.lang.String arena)
MGPlayer
. Please do not call this method
unless you understand the implications of doing so.arena
- the new arena of this MGPlayer
public Round getRound()
Round
associated with this player.Round
associated with this playerpublic boolean isSpectating()
Entity.isDead()
returns false).public void setSpectating(boolean spectating)
spectating
- whether the player is spectatingpublic void setPrefix(java.lang.String prefix)
prefix
- the new prefix of this playerpublic JoinResult addToRound(java.lang.String round) throws PlayerOfflineException, PlayerPresentException, RoundFullException
round
- the name of the round to add the player toPlayerOfflineException
- if the player is not onlinePlayerPresentException
- if the player is already in a roundRoundFullException
- if the round is fullpublic void removeFromRound(Location3D location) throws NoSuchPlayerException, PlayerOfflineException
MGPlayer
from the round they are currently in.location
- the location to teleport this player to. Please omit it
if you wish to teleport them to the round's default exit
point.NoSuchPlayerException
- if the given player is not in a roundPlayerOfflineException
- if the given player is not online@Deprecated public void removeFromRound(org.bukkit.Location location) throws NoSuchPlayerException, PlayerOfflineException
removeFromRound(Location3D)
MGPlayer
from the round they are currently in.location
- the location to teleport this player to. Please omit it
if you wish to teleport them to the round's default exit
point.NoSuchPlayerException
- if the given player is not in a roundPlayerOfflineException
- if the given player is not onlinepublic void removeFromRound() throws NoSuchPlayerException, PlayerOfflineException
MGPlayer
from the round they are currently in.NoSuchPlayerException
- if the player is not in a roundPlayerOfflineException
- if the player is not onlinepublic void reset(Location3D location)
Bukkit player
after they've left a round.location
- the location to teleport the player to, or null to skip
teleportation@Deprecated public void reset(org.bukkit.Location location)
reset(Location3D)
Bukkit player
after they've left a round.location
- the location to teleport the player to, or null to skip
teleportationpublic void reset() throws PlayerOfflineException
Bukkit player
after they've left a round.PlayerOfflineException
- if the player is offlinepublic GameMode getPrevGameMode()
This method typically should not be called from outside the library.
public void setPrevGameMode(GameMode gameMode)
This method typically should not be called from outside the library.
gameMode
- the gamemode MGLib will impose upon the player upon round
exit.@Deprecated public void setPrevGameMode(org.bukkit.GameMode gameMode)
setPrevGameMode(GameMode)
This method typically should not be called from outside the library.
gameMode
- the gamemode MGLib will impose upon the player upon round
exit.@Deprecated public org.bukkit.entity.Player getBukkitPlayer()
Bukkit.getPlayer(String)
Player
object for this MGPlayer
.Player
object for this MGPlayer
@Deprecated public org.bukkit.entity.Player b()
Bukkit.getPlayer(String)
getBukkitPlayer()
. Use this only
if aesthetic ambiguity is not a point of concern.Player
object for this MGPlayer
public boolean isFrozen()
public void setFrozen(boolean frozen)
frozen
- whether the player should be frozenpublic void spawnIn(int spawn)
spawn
- the index of the spawn to send the player topublic void spawnIn()
public boolean equals(java.lang.Object p)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.Object getMetadata(java.lang.String key)
Metadatable
getMetadata
in interface Metadatable
key
- the key to retrieve.public void setMetadata(java.lang.String key, java.lang.Object value)
Metadatable
Note: This method consists of a single call to
HashMap.put(Object, Object)
, so existing keys will be overwritten.
setMetadata
in interface Metadatable
key
- the key to store in the round's metadata.value
- the value to assign to the given key.public void removeMetadata(java.lang.String key)
Metadatable
removeMetadata
in interface Metadatable
key
- the key to remove from this object's metadata.public boolean hasMetadata(java.lang.String key)
Metadatable
hasMetadata
in interface Metadatable
key
- the key to test for.public java.util.HashMap<java.lang.String,java.lang.Object> getAllMetadata()
Metadatable
HashMap
representing this object's complete metadata.getAllMetadata
in interface Metadatable
HashMap
.