Fork of Poseidon providing Bukkit #1060 to older Beta versions (b1.0-b1.7.3)
at develop 362 lines 11 kB view raw
1package org.bukkit.entity; 2 3import com.projectposeidon.ConnectionType; 4import net.minecraft.server.Packet; 5import org.bukkit.*; 6import org.bukkit.command.CommandSender; 7import org.bukkit.map.MapView; 8 9import java.net.InetSocketAddress; 10import java.util.UUID; 11 12/** 13 * Represents a player, connected or not 14 */ 15public interface Player extends HumanEntity, CommandSender, OfflinePlayer { 16 /** 17 * Gets the "friendly" name to display of this player. This may include color. 18 * <p> 19 * Note that this name will not be displayed in game, only in chat and places 20 * defined by plugins 21 * 22 * @return the friendly name 23 */ 24 public String getDisplayName(); 25 26 /** 27 * Sets the "friendly" name to display of this player. This may include color. 28 * <p> 29 * Note that this name will not be displayed in game, only in chat and places 30 * defined by plugins 31 * 32 * @param name 33 */ 34 public void setDisplayName(String name); 35 36 /** 37 * Set the target of the player's compass. 38 * 39 * @param loc 40 */ 41 public void setCompassTarget(Location loc); 42 //Project Poseidon Start 43 44 /** 45 * Get the players Mojang UUID. 46 * 47 * @return Player UUID 48 */ 49 public UUID getUniqueId(); 50 51 52 /** 53 * Get the players Mojang UUID. 54 * 55 * @return Player UUID 56 */ 57 @Deprecated 58 public UUID getPlayerUUID(); 59 //Project Poseidon End 60 61 /** 62 * Get the previously set compass target. 63 * 64 * @return location of the target 65 */ 66 public Location getCompassTarget(); 67 68 /** 69 * Gets the socket address of this player 70 * 71 * @return the player's address 72 */ 73 public InetSocketAddress getAddress(); 74 75 /** 76 * Sends this sender a message raw 77 * 78 * @param message Message to be displayed 79 */ 80 public void sendRawMessage(String message); 81 82 /** 83 * Kicks player with custom kick message. 84 * 85 * @param message kick message 86 */ 87 public void kickPlayer(String message); 88 89 /** 90 * Says a message (or runs a command). 91 * 92 * @param msg message to print 93 */ 94 public void chat(String msg); 95 96 /** 97 * Makes the player perform the given command 98 * 99 * @param command Command to perform 100 * @return true if the command was successful, otherwise false 101 */ 102 public boolean performCommand(String command); 103 104 /** 105 * Returns if the player is in sneak mode 106 * 107 * @return true if player is in sneak mode 108 */ 109 public boolean isSneaking(); 110 111 /** 112 * Sets the sneak mode the player 113 * 114 * @param sneak true if player should appear sneaking 115 */ 116 public void setSneaking(boolean sneak); 117 118 /** 119 * Saves the players current location, health, inventory, motion, and other information into the username.dat file, in the world/player folder 120 */ 121 public void saveData(); 122 123 /** 124 * Loads the players current location, health, inventory, motion, and other information from the username.dat file, in the world/player folder 125 * <p> 126 * Note: This will overwrite the players current inventory, health, motion, etc, with the state from the saved dat file. 127 */ 128 public void loadData(); 129 130 /** 131 * Sets whether the player is ignored as not sleeping. If everyone is 132 * either sleeping or has this flag set, then time will advance to the 133 * next day. If everyone has this flag set but no one is actually in bed, 134 * then nothing will happen. 135 * 136 * @param isSleeping 137 */ 138 public void setSleepingIgnored(boolean isSleeping); 139 140 /** 141 * Returns whether the player is sleeping ignored. 142 * 143 * @return 144 */ 145 public boolean isSleepingIgnored(); 146 147 /** 148 * Play a note for a player at a location. This requires a note block 149 * at the particular location (as far as the client is concerned). This 150 * will not work without a note block. This will not work with cake. 151 * 152 * @param loc 153 * @param instrument 154 * @param note 155 */ 156 public void playNote(Location loc, byte instrument, byte note); 157 158 /** 159 * Play a note for a player at a location. This requires a note block 160 * at the particular location (as far as the client is concerned). This 161 * will not work without a note block. This will not work with cake. 162 * 163 * @param loc 164 * @param instrument 165 * @param note 166 */ 167 public void playNote(Location loc, Instrument instrument, Note note); 168 169 /** 170 * Plays an effect to just this player. 171 * 172 * @param loc the player to play the effect for 173 * @param effect the {@link Effect} 174 * @param data a data bit needed for the RECORD_PLAY, SMOKE, and STEP_SOUND sounds 175 */ 176 public void playEffect(Location loc, Effect effect, int data); 177 178 /** 179 * Send a block change. This fakes a block change packet for a user at 180 * a certain location. This will not actually change the world in any way. 181 * 182 * @param loc 183 * @param material 184 * @param data 185 */ 186 public void sendBlockChange(Location loc, Material material, byte data); 187 188 /** 189 * Send a chunk change. This fakes a chunk change packet for a user at 190 * a certain location. The updated cuboid must be entirely within a single 191 * chunk. This will not actually change the world in any way. 192 * <p> 193 * At least one of the dimensions of the cuboid must be even. The size of the 194 * data buffer must be 2.5*sx*sy*sz and formatted in accordance with the Packet51 195 * format. 196 * 197 * @param loc The location of the cuboid 198 * @param sx The x size of the cuboid 199 * @param sy The y size of the cuboid 200 * @param sz The z size of the cuboid 201 * @param data The data to be sent 202 * @return true if the chunk change packet was sent 203 */ 204 public boolean sendChunkChange(Location loc, int sx, int sy, int sz, byte[] data); 205 206 /** 207 * Send a block change. This fakes a block change packet for a user at 208 * a certain location. This will not actually change the world in any way. 209 * 210 * @param loc 211 * @param material 212 * @param data 213 */ 214 public void sendBlockChange(Location loc, int material, byte data); 215 216 /** 217 * Render a map and send it to the player in its entirety. This may be used 218 * when streaming the map in the normal manner is not desirbale. 219 * 220 * @pram map The map to be sent 221 */ 222 public void sendMap(MapView map); 223 224 /** 225 * Forces an update of the player's entire inventory. 226 * 227 * @deprecated This method should not be relied upon as it is a temporary work-around for a larger, more complicated issue. 228 */ 229 @Deprecated 230 public void updateInventory(); 231 232 /** 233 * Awards this player the given achievement 234 * 235 * @param achievement Achievement to award 236 */ 237 public void awardAchievement(Achievement achievement); 238 239 /** 240 * Increments the given statistic for this player 241 * 242 * @param statistic Statistic to increment 243 */ 244 public void incrementStatistic(Statistic statistic); 245 246 /** 247 * Increments the given statistic for this player 248 * 249 * @param statistic Statistic to increment 250 * @param amount Amount to increment this statistic by 251 */ 252 public void incrementStatistic(Statistic statistic, int amount); 253 254 /** 255 * Increments the given statistic for this player for the given material 256 * 257 * @param statistic Statistic to increment 258 * @param material Material to offset the statistic with 259 */ 260 public void incrementStatistic(Statistic statistic, Material material); 261 262 /** 263 * Increments the given statistic for this player for the given material 264 * 265 * @param statistic Statistic to increment 266 * @param material Material to offset the statistic with 267 * @param amount Amount to increment this statistic by 268 */ 269 public void incrementStatistic(Statistic statistic, Material material, int amount); 270 271 /** 272 * Sets the current time on the player's client. When relative is true the player's time 273 * will be kept synchronized to its world time with the specified offset. 274 * <p> 275 * When using non relative time the player's time will stay fixed at the specified time parameter. It's up to 276 * the caller to continue updating the player's time. To restore player time to normal use resetPlayerTime(). 277 * 278 * @param time The current player's perceived time or the player's time offset from the server time. 279 * @param relative When true the player time is kept relative to its world time. 280 */ 281 public void setPlayerTime(long time, boolean relative); 282 283 /** 284 * Returns the player's current timestamp. 285 * 286 * @return 287 */ 288 public long getPlayerTime(); 289 290 /** 291 * Returns the player's current time offset relative to server time, or the current player's fixed time 292 * if the player's time is absolute. 293 * 294 * @return 295 */ 296 public long getPlayerTimeOffset(); 297 298 /** 299 * Returns true if the player's time is relative to the server time, otherwise the player's time is absolute and 300 * will not change its current time unless done so with setPlayerTime(). 301 * 302 * @return true if the player's time is relative to the server time. 303 */ 304 public boolean isPlayerTimeRelative(); 305 306 /** 307 * Returns connection type which allows for a plugin to know if a user is using a proxy, and if IP Forwarding is enabled. 308 * 309 * @return ConntionType enum 310 */ 311 public ConnectionType getConnectionType(); 312 313 public boolean hasReceivedPacket0(); 314 315 /** 316 * Returns whether the player is using a Release2Beta proxy 317 * 318 * @return true if the player is using a Release2Beta proxy 319 */ 320 @Deprecated 321 public boolean isUsingReleaseToBeta(); 322 323 /** 324 * Restores the normal condition where the player's time is synchronized with the server time. 325 * Equivalent to calling setPlayerTime(0, true). 326 */ 327 public void resetPlayerTime(); 328 329 /** 330 * Hides a player from this player 331 * 332 * @param player Player to hide 333 */ 334 public void hidePlayer(Player player); 335 336 /** 337 * Allows this player to see a player that was previously hidden 338 * 339 * @param player Player to show 340 */ 341 public void showPlayer(Player player); 342 343 /** 344 * Checks to see if a player has been hidden from this player 345 * 346 * @param player Player to check 347 * @return True if the provided player is not being hidden from this player 348 */ 349 public boolean canSee(Player player); 350 351 public void sendPacket(final Player player, final Packet packet); 352 353 // uberbukkit start 354 public boolean isCracked(); 355 356 public boolean hasBed(); 357 358 public Location getBedLocation(); 359 360 public void setBedLocation(Location location); 361 // uberbukkit end 362}