Pulling all pending Bukkit-JavaDoc changes
A special thanks goes to @aerouk for almost all of the changes found here. By: Wesley Wolfe <weswolf@aol.com>
This commit is contained in:
@@ -8,14 +8,20 @@ import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
/**
|
||||
* This event will sometimes fire synchronously, depending on how it was triggered.
|
||||
* The constructor provides a boolean to indicate if the event was fired synchronously or asynchronously.
|
||||
* When asynchronous, this event can be called from any thread, but the main thread, and has limited access to the API.<br>
|
||||
* <br>
|
||||
* If a player is the direct cause of this event by incoming packet, this event will be asynchronous.
|
||||
* If a plugin triggers this event by compelling a player to chat, this event will be synchronous.<br>
|
||||
* <br>
|
||||
* <b>Care should be taken to check {@link #isAsynchronous()} and treat the event appropriately.</b>
|
||||
* This event will sometimes fire synchronously, depending on how it was
|
||||
* triggered.
|
||||
* <p>
|
||||
* The constructor provides a boolean to indicate if the event was fired
|
||||
* synchronously or asynchronously. When asynchronous, this event can be
|
||||
* called from any thread, but the main thread, and has limited access to the
|
||||
* API.
|
||||
* <p>
|
||||
* If a player is the direct cause of this event by incoming packet, this
|
||||
* event will be asynchronous. If a plugin triggers this event by compelling a
|
||||
* player to chat, this event will be synchronous.
|
||||
* <p>
|
||||
* Care should be taken to check {@link #isAsynchronous()} and treat the event
|
||||
* appropriately.
|
||||
*/
|
||||
public class AsyncPlayerChatEvent extends PlayerEvent implements Cancellable {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
@@ -29,7 +35,8 @@ public class AsyncPlayerChatEvent extends PlayerEvent implements Cancellable {
|
||||
* @param async This changes the event to a synchronous state.
|
||||
* @param who the chat sender
|
||||
* @param message the message sent
|
||||
* @param players the players to receive the message. This may be a lazy or unmodifiable collection.
|
||||
* @param players the players to receive the message. This may be a lazy
|
||||
* or unmodifiable collection.
|
||||
*/
|
||||
public AsyncPlayerChatEvent(final boolean async, final Player who, final String message, final Set<Player> players) {
|
||||
super(who, async);
|
||||
@@ -38,7 +45,8 @@ public class AsyncPlayerChatEvent extends PlayerEvent implements Cancellable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the message that the player is attempting to send. This message will be used with {@link #getFormat()}.
|
||||
* Gets the message that the player is attempting to send. This message
|
||||
* will be used with {@link #getFormat()}.
|
||||
*
|
||||
* @return Message the player is attempting to send
|
||||
*/
|
||||
@@ -47,7 +55,8 @@ public class AsyncPlayerChatEvent extends PlayerEvent implements Cancellable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the message that the player will send. This message will be used with {@link #getFormat()}.
|
||||
* Sets the message that the player will send. This message will be used
|
||||
* with {@link #getFormat()}.
|
||||
*
|
||||
* @param message New message that the player will send
|
||||
*/
|
||||
@@ -57,9 +66,13 @@ public class AsyncPlayerChatEvent extends PlayerEvent implements Cancellable {
|
||||
|
||||
/**
|
||||
* Gets the format to use to display this chat message.
|
||||
* When this event finishes execution, the first format parameter is the {@link Player#getDisplayName()} and the second parameter is {@link #getMessage()}
|
||||
* <p>
|
||||
* When this event finishes execution, the first format parameter is the
|
||||
* {@link Player#getDisplayName()} and the second parameter is {@link
|
||||
* #getMessage()}
|
||||
*
|
||||
* @return {@link String#format(String, Object...)} compatible format string
|
||||
* @return {@link String#format(String, Object...)} compatible format
|
||||
* string
|
||||
*/
|
||||
public String getFormat() {
|
||||
return format;
|
||||
@@ -67,10 +80,15 @@ public class AsyncPlayerChatEvent extends PlayerEvent implements Cancellable {
|
||||
|
||||
/**
|
||||
* Sets the format to use to display this chat message.
|
||||
* When this event finishes execution, the first format parameter is the {@link Player#getDisplayName()} and the second parameter is {@link #getMessage()}
|
||||
* <p>
|
||||
* When this event finishes execution, the first format parameter is the
|
||||
* {@link Player#getDisplayName()} and the second parameter is {@link
|
||||
* #getMessage()}
|
||||
*
|
||||
* @param format {@link String#format(String, Object...)} compatible format string
|
||||
* @throws IllegalFormatException if the underlying API throws the exception
|
||||
* @param format {@link String#format(String, Object...)} compatible
|
||||
* format string
|
||||
* @throws IllegalFormatException if the underlying API throws the
|
||||
* exception
|
||||
* @throws NullPointerException if format is null
|
||||
* @see String#format(String, Object...)
|
||||
*/
|
||||
@@ -88,10 +106,14 @@ public class AsyncPlayerChatEvent extends PlayerEvent implements Cancellable {
|
||||
|
||||
/**
|
||||
* Gets a set of recipients that this chat message will be displayed to.
|
||||
* The set returned is not guaranteed to be mutable and may auto-populate on access.
|
||||
* Any listener accessing the returned set should be aware that it may reduce performance for a lazy set implementation.<br>
|
||||
* <br>
|
||||
* <b>Listeners should be aware that modifying the list may throw {@link UnsupportedOperationException} if the event caller provides an unmodifiable set.</b>
|
||||
* <p>
|
||||
* The set returned is not guaranteed to be mutable and may auto-populate
|
||||
* on access. Any listener accessing the returned set should be aware that
|
||||
* it may reduce performance for a lazy set implementation.
|
||||
* <p>
|
||||
* Listeners should be aware that modifying the list may throw {@link
|
||||
* UnsupportedOperationException} if the event caller provides an
|
||||
* unmodifiable set.
|
||||
*
|
||||
* @return All Players who will see this chat message
|
||||
*/
|
||||
|
||||
@@ -6,7 +6,8 @@ import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
/**
|
||||
* Stores details for players attempting to log in.<br>
|
||||
* Stores details for players attempting to log in.
|
||||
* <p>
|
||||
* This event is asynchronous, and not run using main thread.
|
||||
*/
|
||||
public class AsyncPlayerPreLoginEvent extends Event {
|
||||
@@ -37,7 +38,8 @@ public class AsyncPlayerPreLoginEvent extends Event {
|
||||
* Gets the current result of the login, as an enum
|
||||
*
|
||||
* @return Current Result of the login
|
||||
* @deprecated This method uses a deprecated enum from {@link PlayerPreLoginEvent}
|
||||
* @deprecated This method uses a deprecated enum from {@link
|
||||
* PlayerPreLoginEvent}
|
||||
* @see #getLoginResult()
|
||||
*/
|
||||
@Deprecated
|
||||
@@ -58,7 +60,8 @@ public class AsyncPlayerPreLoginEvent extends Event {
|
||||
* Sets the new result of the login, as an enum
|
||||
*
|
||||
* @param result New result to set
|
||||
* @deprecated This method uses a deprecated enum from {@link PlayerPreLoginEvent}
|
||||
* @deprecated This method uses a deprecated enum from {@link
|
||||
* PlayerPreLoginEvent}
|
||||
* @see #setLoginResult(Result)
|
||||
*/
|
||||
@Deprecated
|
||||
@@ -67,7 +70,8 @@ public class AsyncPlayerPreLoginEvent extends Event {
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the current kick message that will be used if getResult() != Result.ALLOWED
|
||||
* Gets the current kick message that will be used if getResult() !=
|
||||
* Result.ALLOWED
|
||||
*
|
||||
* @return Current kick message
|
||||
*/
|
||||
@@ -108,7 +112,8 @@ public class AsyncPlayerPreLoginEvent extends Event {
|
||||
*
|
||||
* @param result New result for disallowing the player
|
||||
* @param message Kick message to display to the user
|
||||
* @deprecated This method uses a deprecated enum from {@link PlayerPreLoginEvent}
|
||||
* @deprecated This method uses a deprecated enum from {@link
|
||||
* PlayerPreLoginEvent}
|
||||
* @see #disallow(Result, String)
|
||||
*/
|
||||
@Deprecated
|
||||
@@ -162,7 +167,8 @@ public class AsyncPlayerPreLoginEvent extends Event {
|
||||
*/
|
||||
KICK_BANNED,
|
||||
/**
|
||||
* The player is not allowed to log in, due to them not being on the white list
|
||||
* The player is not allowed to log in, due to them not being on the
|
||||
* white list
|
||||
*/
|
||||
KICK_WHITELIST,
|
||||
/**
|
||||
|
||||
@@ -1,30 +1,31 @@
|
||||
package org.bukkit.event.player;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
/**
|
||||
* This event is called after a player registers or unregisters a new plugin channel.
|
||||
*/
|
||||
public abstract class PlayerChannelEvent extends PlayerEvent {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private final String channel;
|
||||
|
||||
public PlayerChannelEvent(final Player player, final String channel) {
|
||||
super(player);
|
||||
this.channel = channel;
|
||||
}
|
||||
|
||||
public final String getChannel() {
|
||||
return channel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
}
|
||||
package org.bukkit.event.player;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
/**
|
||||
* This event is called after a player registers or unregisters a new plugin
|
||||
* channel.
|
||||
*/
|
||||
public abstract class PlayerChannelEvent extends PlayerEvent {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private final String channel;
|
||||
|
||||
public PlayerChannelEvent(final Player player, final String channel) {
|
||||
super(player);
|
||||
this.channel = channel;
|
||||
}
|
||||
|
||||
public final String getChannel() {
|
||||
return channel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,10 +12,13 @@ import org.bukkit.event.HandlerList;
|
||||
|
||||
/**
|
||||
* Holds information for player chat and commands
|
||||
* @deprecated This event will fire from the main thread and allows the use of all of the Bukkit API, unlike the {@link AsyncPlayerChatEvent}.<br>
|
||||
* <br>
|
||||
* Listening to this event forces chat to wait for the main thread which causes delays for chat.<br>
|
||||
* {@link AsyncPlayerChatEvent} is the encouraged alternative for thread safe implementations.
|
||||
*
|
||||
* @deprecated This event will fire from the main thread and allows the use of
|
||||
* all of the Bukkit API, unlike the {@link AsyncPlayerChatEvent}.
|
||||
* <p>
|
||||
* Listening to this event forces chat to wait for the main thread which
|
||||
* causes delays for chat. {@link AsyncPlayerChatEvent} is the encouraged
|
||||
* alternative for thread safe implementations.
|
||||
*/
|
||||
@Deprecated
|
||||
@Warning(reason="Listening to this event forces chat to wait for the main thread, delaying chat messages.")
|
||||
|
||||
@@ -40,7 +40,9 @@ public class PlayerChatTabCompleteEvent extends PlayerEvent {
|
||||
|
||||
/**
|
||||
* Gets the last 'token' of the message being tab-completed.
|
||||
* The token is the substring starting with the character after the last space in the message.
|
||||
* <p>
|
||||
* The token is the substring starting with the character after the last
|
||||
* space in the message.
|
||||
*
|
||||
* @return The last token for the chat message
|
||||
*/
|
||||
|
||||
@@ -75,7 +75,9 @@ public class PlayerCommandPreprocessEvent extends PlayerEvent implements Cancell
|
||||
|
||||
/**
|
||||
* Gets the command that the player is attempting to send.
|
||||
* All commands begin with a special character; implementations do not consider the first character when executing the content.
|
||||
* <p>
|
||||
* All commands begin with a special character; implementations do not
|
||||
* consider the first character when executing the content.
|
||||
*
|
||||
* @return Message the player is attempting to send
|
||||
*/
|
||||
@@ -85,7 +87,9 @@ public class PlayerCommandPreprocessEvent extends PlayerEvent implements Cancell
|
||||
|
||||
/**
|
||||
* Sets the command that the player will send.
|
||||
* All commands begin with a special character; implementations do not consider the first character when executing the content.
|
||||
* <p>
|
||||
* All commands begin with a special character; implementations do not
|
||||
* consider the first character when executing the content.
|
||||
*
|
||||
* @param command New message that the player will send
|
||||
* @throws IllegalArgumentException if command is null or empty
|
||||
@@ -110,7 +114,8 @@ public class PlayerCommandPreprocessEvent extends PlayerEvent implements Cancell
|
||||
/**
|
||||
* Gets the format to use to display this chat message
|
||||
*
|
||||
* @deprecated This method is provided for backward compatibility with no guarantee to the use of the format.
|
||||
* @deprecated This method is provided for backward compatibility with no
|
||||
* guarantee to the use of the format.
|
||||
* @return String.Format compatible format string
|
||||
*/
|
||||
@Deprecated
|
||||
@@ -121,7 +126,8 @@ public class PlayerCommandPreprocessEvent extends PlayerEvent implements Cancell
|
||||
/**
|
||||
* Sets the format to use to display this chat message
|
||||
*
|
||||
* @deprecated This method is provided for backward compatibility with no guarantee to the effect of modifying the format.
|
||||
* @deprecated This method is provided for backward compatibility with no
|
||||
* guarantee to the effect of modifying the format.
|
||||
* @param format String.Format compatible format string
|
||||
*/
|
||||
@Deprecated
|
||||
@@ -139,11 +145,16 @@ public class PlayerCommandPreprocessEvent extends PlayerEvent implements Cancell
|
||||
|
||||
/**
|
||||
* Gets a set of recipients that this chat message will be displayed to.
|
||||
* The set returned is not guaranteed to be mutable and may auto-populate on access.
|
||||
* Any listener accessing the returned set should be aware that it may reduce performance for a lazy set implementation.
|
||||
* Listeners should be aware that modifying the list may throw {@link UnsupportedOperationException} if the event caller provides an unmodifiable set.
|
||||
* <p>
|
||||
* The set returned is not guaranteed to be mutable and may auto-populate
|
||||
* on access. Any listener accessing the returned set should be aware that
|
||||
* it may reduce performance for a lazy set implementation. Listeners
|
||||
* should be aware that modifying the list may throw {@link
|
||||
* UnsupportedOperationException} if the event caller provides an
|
||||
* unmodifiable set.
|
||||
*
|
||||
* @deprecated This method is provided for backward compatibility with no guarantee to the effect of viewing or modifying the set.
|
||||
* @deprecated This method is provided for backward compatibility with no
|
||||
* guarantee to the effect of viewing or modifying the set.
|
||||
* @return All Players who will see this chat message
|
||||
*/
|
||||
@Deprecated
|
||||
|
||||
@@ -8,8 +8,8 @@ import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.inventory.meta.BookMeta;
|
||||
|
||||
/**
|
||||
* Called when a player edits or signs a book and quill item. If the event
|
||||
* is cancelled, no changes are made to the BookMeta
|
||||
* Called when a player edits or signs a book and quill item. If the event is
|
||||
* cancelled, no changes are made to the BookMeta
|
||||
*/
|
||||
public class PlayerEditBookEvent extends PlayerEvent implements Cancellable {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
@@ -39,7 +39,7 @@ public class PlayerEditBookEvent extends PlayerEvent implements Cancellable {
|
||||
/**
|
||||
* Gets the book meta currently on the book.
|
||||
* <p>
|
||||
* Note: this is a copy of the book meta. You cannot use this object to
|
||||
* Note: this is a copy of the book meta. You cannot use this object to
|
||||
* change the existing book meta.
|
||||
*
|
||||
* @return the book meta currently on the book
|
||||
@@ -49,12 +49,11 @@ public class PlayerEditBookEvent extends PlayerEvent implements Cancellable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the book meta that the player is attempting to add to
|
||||
* the book.
|
||||
* Gets the book meta that the player is attempting to add to the book.
|
||||
* <p>
|
||||
* Note: this is a copy of the proposed new book meta. Use {@link
|
||||
* #setNewBookMeta(BookMeta)} to change what will actually be
|
||||
* added to the book.
|
||||
* #setNewBookMeta(BookMeta)} to change what will actually be added to the
|
||||
* book.
|
||||
*
|
||||
* @return the book meta that the player is attempting to add
|
||||
*/
|
||||
|
||||
@@ -51,8 +51,8 @@ public class PlayerEggThrowEvent extends PlayerEvent {
|
||||
/**
|
||||
* Sets whether the egg will hatch or not.
|
||||
*
|
||||
* @param hatching true if you want the egg to hatch
|
||||
* false if you want it not to
|
||||
* @param hatching true if you want the egg to hatch, false if you want it
|
||||
* not to
|
||||
*/
|
||||
public void setHatching(boolean hatching) {
|
||||
this.hatching = hatching;
|
||||
@@ -100,12 +100,13 @@ public class PlayerEggThrowEvent extends PlayerEvent {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the number of mob hatches from the egg. By default the number
|
||||
* will be he number the server would've done
|
||||
* <p>
|
||||
* 7/8 chance of being 0
|
||||
* 31/256 ~= 1/8 chance to be 1
|
||||
* 1/256 chance to be 4
|
||||
* Get the number of mob hatches from the egg. By default the number will
|
||||
* be the number the server would've done
|
||||
* <ul>
|
||||
* <li>7/8 chance of being 0
|
||||
* <li>31/256 ~= 1/8 chance to be 1
|
||||
* <li>1/256 chance to be 4
|
||||
* </ul>
|
||||
*
|
||||
* @return The number of mobs going to be hatched by the egg
|
||||
*/
|
||||
@@ -116,8 +117,8 @@ public class PlayerEggThrowEvent extends PlayerEvent {
|
||||
/**
|
||||
* Change the number of mobs coming out of the hatched egg
|
||||
* <p>
|
||||
* The boolean hatching will override this number.
|
||||
* Ie. If hatching = false, this number will not matter
|
||||
* The boolean hatching will override this number. Ie. If hatching =
|
||||
* false, this number will not matter
|
||||
*
|
||||
* @param numHatches The number of mobs coming out of the egg
|
||||
*/
|
||||
|
||||
@@ -19,7 +19,7 @@ public class PlayerFishEvent extends PlayerEvent implements Cancellable {
|
||||
|
||||
/**
|
||||
* @deprecated replaced by {@link #PlayerFishEvent(Player, Entity, Fish,
|
||||
* State)} to include the {@link Fish} hook entity.
|
||||
* State)} to include the {@link Fish} hook entity.
|
||||
* @param player
|
||||
* @param entity
|
||||
* @param state
|
||||
@@ -39,7 +39,8 @@ public class PlayerFishEvent extends PlayerEvent implements Cancellable {
|
||||
/**
|
||||
* Gets the entity caught by the player
|
||||
*
|
||||
* @return Entity caught by the player, null if fishing, bobber has gotten stuck in the ground or nothing has been caught
|
||||
* @return Entity caught by the player, null if fishing, bobber has gotten
|
||||
* stuck in the ground or nothing has been caught
|
||||
*/
|
||||
public Entity getCaught() {
|
||||
return entity;
|
||||
@@ -65,7 +66,8 @@ public class PlayerFishEvent extends PlayerEvent implements Cancellable {
|
||||
/**
|
||||
* Gets the amount of experience received when fishing.
|
||||
* <p>
|
||||
* Note: This value has no default effect unless the event state is {@link State#CAUGHT_FISH}.
|
||||
* Note: This value has no default effect unless the event state is {@link
|
||||
* State#CAUGHT_FISH}.
|
||||
*
|
||||
* @return the amount of experience to drop
|
||||
*/
|
||||
@@ -76,7 +78,8 @@ public class PlayerFishEvent extends PlayerEvent implements Cancellable {
|
||||
/**
|
||||
* Sets the amount of experience received when fishing.
|
||||
* <p>
|
||||
* Note: This value has no default effect unless the event state is {@link State#CAUGHT_FISH}.
|
||||
* Note: This value has no default effect unless the event state is {@link
|
||||
* State#CAUGHT_FISH}.
|
||||
*
|
||||
* @param amount the amount of experience to drop
|
||||
*/
|
||||
@@ -124,7 +127,8 @@ public class PlayerFishEvent extends PlayerEvent implements Cancellable {
|
||||
*/
|
||||
IN_GROUND,
|
||||
/**
|
||||
* When a player fails to catch anything while fishing usually due to poor aiming or timing
|
||||
* When a player fails to catch anything while fishing usually due to
|
||||
* poor aiming or timing
|
||||
*/
|
||||
FAILED_ATTEMPT,
|
||||
}
|
||||
|
||||
@@ -42,8 +42,8 @@ public class PlayerInteractEvent extends PlayerEvent implements Cancellable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the cancellation state of this event. Set to true if you
|
||||
* want to prevent buckets from placing water and so forth
|
||||
* Gets the cancellation state of this event. Set to true if you want to
|
||||
* prevent buckets from placing water and so forth
|
||||
*
|
||||
* @return boolean cancellation state
|
||||
*/
|
||||
@@ -52,8 +52,8 @@ public class PlayerInteractEvent extends PlayerEvent implements Cancellable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the cancellation state of this event. A canceled event will not
|
||||
* be executed in the server, but will still pass to other plugins
|
||||
* Sets the cancellation state of this event. A canceled event will not be
|
||||
* executed in the server, but will still pass to other plugins
|
||||
* <p>
|
||||
* Canceling this event will prevent use of food (player won't lose the
|
||||
* food item), prevent bows/snowballs/eggs from firing, etc. (player won't
|
||||
@@ -76,8 +76,8 @@ public class PlayerInteractEvent extends PlayerEvent implements Cancellable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method. Returns the material of the item represented by this
|
||||
* event
|
||||
* Convenience method. Returns the material of the item represented by
|
||||
* this event
|
||||
*
|
||||
* @return Material the material of the item used
|
||||
*/
|
||||
@@ -108,8 +108,8 @@ public class PlayerInteractEvent extends PlayerEvent implements Cancellable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method to inform the user whether this was a block placement
|
||||
* event.
|
||||
* Convenience method to inform the user whether this was a block
|
||||
* placement event.
|
||||
*
|
||||
* @return boolean true if the item in hand was a block
|
||||
*/
|
||||
@@ -140,8 +140,9 @@ public class PlayerInteractEvent extends PlayerEvent implements Cancellable {
|
||||
}
|
||||
|
||||
/**
|
||||
* This controls the action to take with the block (if any) that was clicked on
|
||||
* This event gets processed for all blocks, but most don't have a default action
|
||||
* This controls the action to take with the block (if any) that was
|
||||
* clicked on. This event gets processed for all blocks, but most don't
|
||||
* have a default action
|
||||
*
|
||||
* @return the action to take with the interacted block
|
||||
*/
|
||||
@@ -157,9 +158,10 @@ public class PlayerInteractEvent extends PlayerEvent implements Cancellable {
|
||||
}
|
||||
|
||||
/**
|
||||
* This controls the action to take with the item the player is holding
|
||||
* This includes both blocks and items (such as flint and steel or records)
|
||||
* When this is set to default, it will be allowed if no action is taken on the interacted block
|
||||
* This controls the action to take with the item the player is holding.
|
||||
* This includes both blocks and items (such as flint and steel or
|
||||
* records). When this is set to default, it will be allowed if no action
|
||||
* is taken on the interacted block.
|
||||
*
|
||||
* @return the action to take with the item in hand
|
||||
*/
|
||||
|
||||
@@ -7,9 +7,12 @@ import org.bukkit.event.inventory.InventoryOpenEvent;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
|
||||
/**
|
||||
* Represents a player related inventory event; note that this event never actually did anything
|
||||
* @deprecated Use {@link InventoryClickEvent} or {@link InventoryOpenEvent} instead, or one of
|
||||
* the other inventory events in {@link org.bukkit.event.inventory}.
|
||||
* Represents a player related inventory event; note that this event never
|
||||
* actually did anything
|
||||
*
|
||||
* @deprecated Use {@link InventoryClickEvent} or {@link InventoryOpenEvent}
|
||||
* instead, or one of the other inventory events in {@link
|
||||
* org.bukkit.event.inventory}.
|
||||
*/
|
||||
@Deprecated
|
||||
public class PlayerInventoryEvent extends PlayerEvent {
|
||||
|
||||
@@ -6,8 +6,9 @@ import org.bukkit.inventory.ItemStack;
|
||||
|
||||
/**
|
||||
* Fired when a player's item breaks (such as a shovel or flint and steel).
|
||||
* The item that's breaking will exist in the inventory with a stack size of 0.
|
||||
* After the event, the item's durability will be reset to 0.
|
||||
* <p>
|
||||
* The item that's breaking will exist in the inventory with a stack size of
|
||||
* 0. After the event, the item's durability will be reset to 0.
|
||||
*/
|
||||
public class PlayerItemBreakEvent extends PlayerEvent {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
@@ -32,11 +32,13 @@ public class PlayerLoginEvent extends PlayerEvent {
|
||||
}
|
||||
|
||||
/**
|
||||
* This constructor defaults message to an empty string, and result to ALLOWED
|
||||
* This constructor defaults message to an empty string, and result to
|
||||
* ALLOWED
|
||||
*
|
||||
* @param player The {@link Player} for this event
|
||||
* @param hostname The hostname that was used to connect to the server
|
||||
* @param address The address the player used to connect, provided for timing issues
|
||||
* @param address The address the player used to connect, provided for
|
||||
* timing issues
|
||||
*/
|
||||
public PlayerLoginEvent(final Player player, final String hostname, final InetAddress address) {
|
||||
super(player);
|
||||
@@ -45,7 +47,8 @@ public class PlayerLoginEvent extends PlayerEvent {
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Address and hostname should be provided in other constructor
|
||||
* @deprecated Address and hostname should be provided in other
|
||||
* constructor
|
||||
*/
|
||||
@Deprecated
|
||||
public PlayerLoginEvent(final Player player, final Result result, final String message) {
|
||||
@@ -57,7 +60,8 @@ public class PlayerLoginEvent extends PlayerEvent {
|
||||
*
|
||||
* @param player The {@link Player} for this event
|
||||
* @param hostname The hostname that was used to connect to the server
|
||||
* @param address The address the player used to connect, provided for timing issues
|
||||
* @param address The address the player used to connect, provided for
|
||||
* timing issues
|
||||
* @param result The result status for this event
|
||||
* @param message The message to be displayed if result denies login
|
||||
*/
|
||||
@@ -86,7 +90,8 @@ public class PlayerLoginEvent extends PlayerEvent {
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the current kick message that will be used if getResult() != Result.ALLOWED
|
||||
* Gets the current kick message that will be used if getResult() !=
|
||||
* Result.ALLOWED
|
||||
*
|
||||
* @return Current kick message
|
||||
*/
|
||||
@@ -104,7 +109,8 @@ public class PlayerLoginEvent extends PlayerEvent {
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the hostname that the player used to connect to the server, or blank if unknown
|
||||
* Gets the hostname that the player used to connect to the server, or
|
||||
* blank if unknown
|
||||
*
|
||||
* @return The hostname
|
||||
*/
|
||||
@@ -132,12 +138,12 @@ public class PlayerLoginEvent extends PlayerEvent {
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the {@link InetAddress} for the Player associated
|
||||
* with this event. This method is provided as a workaround for
|
||||
* player.getAddress() returning null during PlayerLoginEvent.
|
||||
* Gets the {@link InetAddress} for the Player associated with this event.
|
||||
* This method is provided as a workaround for player.getAddress()
|
||||
* returning null during PlayerLoginEvent.
|
||||
*
|
||||
* @return The address for this player. For legacy compatibility,
|
||||
* this may be null.
|
||||
* @return The address for this player. For legacy compatibility, this may
|
||||
* be null.
|
||||
*/
|
||||
public InetAddress getAddress() {
|
||||
return address;
|
||||
@@ -170,7 +176,8 @@ public class PlayerLoginEvent extends PlayerEvent {
|
||||
*/
|
||||
KICK_BANNED,
|
||||
/**
|
||||
* The player is not allowed to log in, due to them not being on the white list
|
||||
* The player is not allowed to log in, due to them not being on the
|
||||
* white list
|
||||
*/
|
||||
KICK_WHITELIST,
|
||||
/**
|
||||
|
||||
@@ -8,7 +8,10 @@ import org.bukkit.event.HandlerList;
|
||||
|
||||
/**
|
||||
* Stores details for players attempting to log in
|
||||
* @deprecated This event causes synchronization from the login thread; {@link AsyncPlayerPreLoginEvent} is preferred to keep the secondary threads asynchronous.
|
||||
*
|
||||
* @deprecated This event causes synchronization from the login thread; {@link
|
||||
* AsyncPlayerPreLoginEvent} is preferred to keep the secondary threads
|
||||
* asynchronous.
|
||||
*/
|
||||
@Deprecated
|
||||
@Warning(reason="This event causes a login thread to synchronize with the main thread")
|
||||
@@ -45,7 +48,8 @@ public class PlayerPreLoginEvent extends Event {
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the current kick message that will be used if getResult() != Result.ALLOWED
|
||||
* Gets the current kick message that will be used if getResult() !=
|
||||
* Result.ALLOWED
|
||||
*
|
||||
* @return Current kick message
|
||||
*/
|
||||
@@ -126,7 +130,8 @@ public class PlayerPreLoginEvent extends Event {
|
||||
*/
|
||||
KICK_BANNED,
|
||||
/**
|
||||
* The player is not allowed to log in, due to them not being on the white list
|
||||
* The player is not allowed to log in, due to them not being on the
|
||||
* white list
|
||||
*/
|
||||
KICK_WHITELIST,
|
||||
/**
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
package org.bukkit.event.player;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
/**
|
||||
* This is called immediately after a player registers for a plugin channel.
|
||||
*/
|
||||
public class PlayerRegisterChannelEvent extends PlayerChannelEvent {
|
||||
|
||||
public PlayerRegisterChannelEvent(final Player player, final String channel) {
|
||||
super(player, channel);
|
||||
}
|
||||
}
|
||||
package org.bukkit.event.player;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
/**
|
||||
* This is called immediately after a player registers for a plugin channel.
|
||||
*/
|
||||
public class PlayerRegisterChannelEvent extends PlayerChannelEvent {
|
||||
|
||||
public PlayerRegisterChannelEvent(final Player player, final String channel) {
|
||||
super(player, channel);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,6 +5,9 @@ import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
/**
|
||||
* Called when a player respawns.
|
||||
*/
|
||||
public class PlayerRespawnEvent extends PlayerEvent {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private Location respawnLocation;
|
||||
|
||||
@@ -32,11 +32,13 @@ public class PlayerTeleportEvent extends PlayerMoveEvent {
|
||||
|
||||
public enum TeleportCause {
|
||||
/**
|
||||
* Indicates the teleporation was caused by a player throwing an Ender Pearl
|
||||
* Indicates the teleporation was caused by a player throwing an Ender
|
||||
* Pearl
|
||||
*/
|
||||
ENDER_PEARL,
|
||||
/**
|
||||
* Indicates the teleportation was caused by a player executing a command
|
||||
* Indicates the teleportation was caused by a player executing a
|
||||
* command
|
||||
*/
|
||||
COMMAND,
|
||||
/**
|
||||
@@ -44,15 +46,18 @@ public class PlayerTeleportEvent extends PlayerMoveEvent {
|
||||
*/
|
||||
PLUGIN,
|
||||
/**
|
||||
* Indicates the teleportation was caused by a player entering a Nether portal
|
||||
* Indicates the teleportation was caused by a player entering a
|
||||
* Nether portal
|
||||
*/
|
||||
NETHER_PORTAL,
|
||||
/**
|
||||
* Indicates the teleportation was caused by a player entering an End portal
|
||||
* Indicates the teleportation was caused by a player entering an End
|
||||
* portal
|
||||
*/
|
||||
END_PORTAL,
|
||||
/**
|
||||
* Indicates the teleportation was caused by an event not covered by this enum
|
||||
* Indicates the teleportation was caused by an event not covered by
|
||||
* this enum
|
||||
*/
|
||||
UNKNOWN;
|
||||
}
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
package org.bukkit.event.player;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
/**
|
||||
* This is called immediately after a player unregisters for a plugin channel.
|
||||
*/
|
||||
public class PlayerUnregisterChannelEvent extends PlayerChannelEvent {
|
||||
|
||||
public PlayerUnregisterChannelEvent(final Player player, final String channel) {
|
||||
super(player, channel);
|
||||
}
|
||||
}
|
||||
package org.bukkit.event.player;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
/**
|
||||
* This is called immediately after a player unregisters for a plugin channel.
|
||||
*/
|
||||
public class PlayerUnregisterChannelEvent extends PlayerChannelEvent {
|
||||
|
||||
public PlayerUnregisterChannelEvent(final Player player, final String channel) {
|
||||
super(player, channel);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,64 +1,55 @@
|
||||
package org.bukkit.event.player;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
public class PlayerVelocityEvent extends PlayerEvent implements Cancellable {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private boolean cancel = false;
|
||||
private Vector velocity;
|
||||
|
||||
public PlayerVelocityEvent(final Player player, final Vector velocity) {
|
||||
super(player);
|
||||
this.velocity = velocity;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the cancellation state of this event. A cancelled event will not
|
||||
* be executed in the server, but will still pass to other plugins
|
||||
*
|
||||
* @return true if this event is cancelled
|
||||
*/
|
||||
public boolean isCancelled() {
|
||||
return cancel;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the cancellation state of this event. A cancelled event will not
|
||||
* be executed in the server, but will still pass to other plugins
|
||||
*
|
||||
* @param cancel true if you wish to cancel this event
|
||||
*/
|
||||
public void setCancelled(boolean cancel) {
|
||||
this.cancel = cancel;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the velocity vector that will be sent to the player
|
||||
*
|
||||
* @return Vector the player will get
|
||||
*/
|
||||
public Vector getVelocity() {
|
||||
return velocity;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the velocity vector that will be sent to the player
|
||||
*
|
||||
* @param velocity The velocity vector that will be sent to the player
|
||||
*/
|
||||
public void setVelocity(Vector velocity) {
|
||||
this.velocity = velocity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
}
|
||||
package org.bukkit.event.player;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
/**
|
||||
* Called when the velocity of a player changes.
|
||||
*/
|
||||
public class PlayerVelocityEvent extends PlayerEvent implements Cancellable {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private boolean cancel = false;
|
||||
private Vector velocity;
|
||||
|
||||
public PlayerVelocityEvent(final Player player, final Vector velocity) {
|
||||
super(player);
|
||||
this.velocity = velocity;
|
||||
}
|
||||
|
||||
public boolean isCancelled() {
|
||||
return cancel;
|
||||
}
|
||||
|
||||
public void setCancelled(boolean cancel) {
|
||||
this.cancel = cancel;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the velocity vector that will be sent to the player
|
||||
*
|
||||
* @return Vector the player will get
|
||||
*/
|
||||
public Vector getVelocity() {
|
||||
return velocity;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the velocity vector that will be sent to the player
|
||||
*
|
||||
* @param velocity The velocity vector that will be sent to the player
|
||||
*/
|
||||
public void setVelocity(Vector velocity) {
|
||||
this.velocity = velocity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user