Class Player

java.lang.Object
  extended by BaseEntity
      extended by LivingEntity
          extended by HumanEntity
              extended by Player
All Implemented Interfaces:
MessageReceiver

public class Player
extends HumanEntity
implements MessageReceiver

Player.java - Interface for eo so mods don't have to update often.


Constructor Summary
Constructor and Description
Player()
          Creates an empty player.
 
Method Summary
Modifier and Type Method and Description
 void addGroup(java.lang.String group)
          Adds the player to the specified group
 boolean canBuild()
          Returns false if this player can not modify terrain, edit chests, etc.
 boolean canIgnoreRestrictions()
          If the user can ignore restrictions this will return true.
 boolean canModifyWorld()
          Don't use this, use canBuild()
 boolean canUseCommand(java.lang.String command)
          Returns true if this player can use the specified command
 void chat(java.lang.String message)
          Makes player send message.
 void command(java.lang.String command)
          Makes player use command.
 boolean equals(java.lang.Object obj)
          Tests the given object to see if it equals this object
 boolean getAdmin()
          Don't use this! Use isAdmin
 java.lang.String getColor()
          Returns the correct color/prefix for this player
 java.lang.String[] getCommands()
          Set allowed commands
 fy getEntity()
          Returns the entity we're wrapping.
 java.lang.String[] getGroups()
          Returns this player's groups
 Inventory getInventory()
          Returns this player's inventory
 java.lang.String getIP()
          Returns the IP of this player
 java.lang.String[] getIps()
          Returns allowed IPs
 int getItemInHand()
          Returns item id in player's hand
 Location getLocation()
          Returns the player's current location
 java.lang.String getPrefix()
          Returns the prefix.
 boolean getSneaking()
          Returns whether or not this Player is currently sneaking (crouching)
 int getSqlId()
          Returns the sql ID.
 fy getUser()
          Gets the actual user class.
 void giveItem(int itemId, int amount)
          Gives an item to the player
 void giveItem(Item item)
          Gives an item to the player
 void giveItemDrop(int itemId, int amount)
          Gives the player this item by dropping it in front of them
 void giveItemDrop(Item item)
          Gives the player this item by dropping it in front of them
 boolean hasControlOver(Player player)
          Returns true if this player has control over the other player
 int hashCode()
          Returns a unique hashcode for this Player
 boolean hasNoGroups()
          Checks to see if this player is in any groups
 boolean ignoreRestrictions()
          Don't use.
 boolean isAdmin()
          Returns true if this player is an admin.
 boolean isConnected()
          Returns if the player is still connected
 boolean isInGroup(java.lang.String group)
          Checks to see if this player is in the specified group
 boolean isMuted()
          Returns true if the player is muted
 void kick(java.lang.String reason)
          Kicks player with the specified reason
 void notify(java.lang.String message)
          Sends player a notification
 void removeGroup(java.lang.String group)
          Removes specified group from list of groups
 void sendMessage(java.lang.String message)
          Sends a message to the player
 void setAdmin(boolean admin)
          Sets whether or not this player is an administrator
 void setCanModifyWorld(boolean canModifyWorld)
          Sets whether or not this player can modify the world terrain
 void setCommands(java.lang.String[] commands)
          Sets this player's allowed commands
 void setGroups(java.lang.String[] groups)
          Sets this player's groups
 void setIgnoreRestrictions(boolean ignoreRestrictions)
          Sets ignore restrictions
 void setIps(java.lang.String[] ips)
          Sets allowed IPs
 void setPrefix(java.lang.String prefix)
          Sets the prefix
 void setSneaking(boolean sneaking)
          Force this Player to be sneaking or not
 void setSqlId(int id)
          Sets the sql ID.
 void setUser(fy player)
          Sets the user.
 void teleportTo(double x, double y, double z, float rotation, float pitch)
          Teleports to the provided location
 boolean toggleMute()
          Toggles mute
 java.lang.String toString()
          Returns a String representation of this Player
 
Methods inherited from class HumanEntity
getName
 
Methods inherited from class LivingEntity
getBaseNoDamageTicks, getDeathTicks, getHealth, getLastDamage, increaseHealth, setBaseNoDamageTicks, setDeathTicks, setHealth, setLastDamage
 
Methods inherited from class BaseEntity
getAirTicks, getBaseAirTicks, getFireTicks, getId, getNoDamageTicks, getPitch, getPlayer, getRotation, getX, getY, getZ, isAnimal, isLiving, isMob, isPlayer, setAirTicks, setBaseAirTicks, setFireTicks, setNoDamageTicks, setPitch, setRotation, setX, setY, setZ, teleportTo, teleportTo
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface MessageReceiver
getName
 

Constructor Detail

Player

public Player()
Creates an empty player. Add the player by calling #setUser(es)

Method Detail

getEntity

public fy getEntity()
Returns the entity we're wrapping.

Overrides:
getEntity in class HumanEntity
Returns:

isConnected

public boolean isConnected()
Returns if the player is still connected

Returns:

kick

public void kick(java.lang.String reason)
Kicks player with the specified reason

Parameters:
reason -

notify

public void notify(java.lang.String message)
Sends player a notification

Specified by:
notify in interface MessageReceiver
Parameters:
message -

sendMessage

public void sendMessage(java.lang.String message)
Sends a message to the player

Parameters:
message -

giveItem

public void giveItem(Item item)
Gives an item to the player

Parameters:
item -

chat

public void chat(java.lang.String message)
Makes player send message.

Parameters:
message -

command

public void command(java.lang.String command)
Makes player use command.

Parameters:
command -

giveItem

public void giveItem(int itemId,
                     int amount)
Gives an item to the player

Parameters:
itemId -
amount -

giveItemDrop

public void giveItemDrop(Item item)
Gives the player this item by dropping it in front of them

Parameters:
item -

giveItemDrop

public void giveItemDrop(int itemId,
                         int amount)
Gives the player this item by dropping it in front of them

Parameters:
itemId -
amount -

canUseCommand

public boolean canUseCommand(java.lang.String command)
Returns true if this player can use the specified command

Parameters:
command -
Returns:

isInGroup

public boolean isInGroup(java.lang.String group)
Checks to see if this player is in the specified group

Parameters:
group -
Returns:

hasControlOver

public boolean hasControlOver(Player player)
Returns true if this player has control over the other player

Parameters:
player -
Returns:
true if player has control

getLocation

public Location getLocation()
Returns the player's current location

Returns:

getIP

public java.lang.String getIP()
Returns the IP of this player

Returns:

isAdmin

public boolean isAdmin()
Returns true if this player is an admin.

Returns:

getAdmin

public boolean getAdmin()
Don't use this! Use isAdmin

Returns:

setAdmin

public void setAdmin(boolean admin)
Sets whether or not this player is an administrator

Parameters:
admin -

canBuild

public boolean canBuild()
Returns false if this player can not modify terrain, edit chests, etc.

Returns:

canModifyWorld

public boolean canModifyWorld()
Don't use this, use canBuild()

Returns:

setCanModifyWorld

public void setCanModifyWorld(boolean canModifyWorld)
Sets whether or not this player can modify the world terrain

Parameters:
canModifyWorld -

getCommands

public java.lang.String[] getCommands()
Set allowed commands

Returns:

setCommands

public void setCommands(java.lang.String[] commands)
Sets this player's allowed commands

Parameters:
commands -

getGroups

public java.lang.String[] getGroups()
Returns this player's groups

Returns:

setGroups

public void setGroups(java.lang.String[] groups)
Sets this player's groups

Parameters:
groups -

addGroup

public void addGroup(java.lang.String group)
Adds the player to the specified group

Parameters:
group - group to add player to

removeGroup

public void removeGroup(java.lang.String group)
Removes specified group from list of groups

Parameters:
group - group to remove

getSqlId

public int getSqlId()
Returns the sql ID.

Returns:

setSqlId

public void setSqlId(int id)
Sets the sql ID. Don't touch this.

Parameters:
id -

canIgnoreRestrictions

public boolean canIgnoreRestrictions()
If the user can ignore restrictions this will return true. Things like item amounts and such are unlimited, etc.

Returns:

ignoreRestrictions

public boolean ignoreRestrictions()
Don't use. Use canIgnoreRestrictions()

Returns:

setIgnoreRestrictions

public void setIgnoreRestrictions(boolean ignoreRestrictions)
Sets ignore restrictions

Parameters:
ignoreRestrictions -

getIps

public java.lang.String[] getIps()
Returns allowed IPs

Returns:

setIps

public void setIps(java.lang.String[] ips)
Sets allowed IPs

Parameters:
ips -

getColor

public java.lang.String getColor()
Returns the correct color/prefix for this player

Returns:

getPrefix

public java.lang.String getPrefix()
Returns the prefix. NOTE: Don't use this, use getColor() instead.

Returns:

setPrefix

public void setPrefix(java.lang.String prefix)
Sets the prefix

Parameters:
prefix -

getUser

public fy getUser()
Gets the actual user class.

Returns:

setUser

public void setUser(fy player)
Sets the user. Don't use this.

Parameters:
er -

teleportTo

public void teleportTo(double x,
                       double y,
                       double z,
                       float rotation,
                       float pitch)
Description copied from class: BaseEntity
Teleports to the provided location

Overrides:
teleportTo in class BaseEntity

isMuted

public boolean isMuted()
Returns true if the player is muted

Returns:

toggleMute

public boolean toggleMute()
Toggles mute

Returns:

hasNoGroups

public boolean hasNoGroups()
Checks to see if this player is in any groups

Returns:
true if this player is in any group

getItemInHand

public int getItemInHand()
Returns item id in player's hand

Returns:

getInventory

public Inventory getInventory()
Returns this player's inventory

Returns:
inventory

getSneaking

public boolean getSneaking()
Returns whether or not this Player is currently sneaking (crouching)

Returns:
true if sneaking

setSneaking

public void setSneaking(boolean sneaking)
Force this Player to be sneaking or not

Parameters:
sneaking - true if sneaking

toString

public java.lang.String toString()
Returns a String representation of this Player

Overrides:
toString in class java.lang.Object
Returns:
String representation of this Player

equals

public boolean equals(java.lang.Object obj)
Tests the given object to see if it equals this object

Overrides:
equals in class java.lang.Object
Parameters:
obj - the object to test
Returns:
true if the two objects match

hashCode

public int hashCode()
Returns a unique hashcode for this Player

Overrides:
hashCode in class java.lang.Object
Returns:
hashcode