Archiviert
13
0

Fix a ton of JavaDoc errors

Dieser Commit ist enthalten in:
Dan Mulloy 2015-06-17 14:25:39 -04:00
Ursprung 241003b56a
Commit bba1054f97
64 geänderte Dateien mit 529 neuen und 466 gelöschten Zeilen

Datei anzeigen

@ -321,7 +321,7 @@ public class CommandFilter extends CommandBase {
* @param event - the event. * @param event - the event.
* @param handler - failure handler. * @param handler - failure handler.
* @return TRUE if we should, FALSE otherwise. * @return TRUE if we should, FALSE otherwise.
* @throws FilterFailedException If one of the filters failed. * @throws ScriptException If one of the filters failed.
*/ */
public boolean filterEvent(PacketEvent event, FilterFailedHandler handler) { public boolean filterEvent(PacketEvent event, FilterFailedHandler handler) {
for (Iterator<Filter> it = filters.iterator(); it.hasNext(); ) { for (Iterator<Filter> it = filters.iterator(); it.hasNext(); ) {

Datei anzeigen

@ -823,6 +823,7 @@ public class PacketType implements Serializable, Comparable<PacketType> {
* Construct a legacy packet type. * Construct a legacy packet type.
* @param sender - client or server. * @param sender - client or server.
* @param legacyId - the legacy packet ID. * @param legacyId - the legacy packet ID.
* @return Legacy packet type
*/ */
public static PacketType newLegacy(Sender sender, int legacyId) { public static PacketType newLegacy(Sender sender, int legacyId) {
return new PacketType(Protocol.LEGACY, sender, PacketType.UNKNOWN_PACKET, legacyId, MinecraftVersion.WORLD_UPDATE); return new PacketType(Protocol.LEGACY, sender, PacketType.UNKNOWN_PACKET, legacyId, MinecraftVersion.WORLD_UPDATE);

Datei anzeigen

@ -423,7 +423,7 @@ public class ProtocolConfig {
/** /**
* Set the starting injection method to use. * Set the starting injection method to use.
* @return Injection method. * @param hook Injection method
*/ */
public void setInjectionMethod(PlayerInjectHooks hook) { public void setInjectionMethod(PlayerInjectHooks hook) {
setConfig(global, INJECTION_METHOD, hook.name()); setConfig(global, INJECTION_METHOD, hook.name());

Datei anzeigen

@ -199,7 +199,7 @@ public interface ProtocolManager extends PacketStream {
/** /**
* Construct a packet using the special builtin Minecraft constructors. * Construct a packet using the special builtin Minecraft constructors.
* @param id - the packet type. * @param type - the packet type.
* @param arguments - arguments that will be passed to the constructor. * @param arguments - arguments that will be passed to the constructor.
* @return The packet constructor. * @return The packet constructor.
*/ */

Datei anzeigen

@ -373,7 +373,6 @@ public class AsyncFilterManager implements AsynchronousManager {
/** /**
* Construct an async marker with the given sending priority delta and timeout delta. * Construct an async marker with the given sending priority delta and timeout delta.
* @param sendingDelta - how many packets we're willing to wait.
* @param timeoutDelta - how long (in ms) until the packet expire. * @param timeoutDelta - how long (in ms) until the packet expire.
* @return An async marker. * @return An async marker.
*/ */
@ -473,6 +472,8 @@ public class AsyncFilterManager implements AsynchronousManager {
/** /**
* Send any due packets, or clean up packets that have expired. * Send any due packets, or clean up packets that have expired.
* @param tickCounter Tick counter
* @param onMainThread Whether or not to execute on the main thread
*/ */
public void sendProcessedPackets(int tickCounter, boolean onMainThread) { public void sendProcessedPackets(int tickCounter, boolean onMainThread) {
// The server queue is unlikely to need checking that often // The server queue is unlikely to need checking that often

Datei anzeigen

@ -402,6 +402,7 @@ public class AsyncMarker implements Serializable, Comparable<AsyncMarker> {
/** /**
* Determine if Minecraft allows asynchronous processing of this packet. * Determine if Minecraft allows asynchronous processing of this packet.
* @return TRUE if it does, FALSE otherwise. * @return TRUE if it does, FALSE otherwise.
* @throws FieldAccessException If determining fails for some reasaon
*/ */
public boolean isMinecraftAsync(PacketEvent event) throws FieldAccessException { public boolean isMinecraftAsync(PacketEvent event) throws FieldAccessException {
if (isMinecraftAsync == null && !alwaysSync) { if (isMinecraftAsync == null && !alwaysSync) {

Datei anzeigen

@ -35,6 +35,7 @@ public interface AsyncRunnable extends Runnable {
* <p> * <p>
* This may not occur right away. * This may not occur right away.
* @return TRUE if the thread was stopped, FALSE if it was already stopped. * @return TRUE if the thread was stopped, FALSE if it was already stopped.
* @throws InterruptedException if it is interrupted
*/ */
public boolean stop() throws InterruptedException; public boolean stop() throws InterruptedException;

Datei anzeigen

@ -18,6 +18,7 @@ public class IntegerMap<T> {
/** /**
* Construct a new integer map. * Construct a new integer map.
* @param <T> Parameter type
* @return A new integer map. * @return A new integer map.
*/ */
public static <T> IntegerMap<T> newMap() { public static <T> IntegerMap<T> newMap() {

Datei anzeigen

@ -149,6 +149,7 @@ public abstract class AbstractIntervalTree<TKey extends Comparable<TKey>, TValue
* @param lowerBound - lowest value to remove. * @param lowerBound - lowest value to remove.
* @param upperBound - highest value to remove. * @param upperBound - highest value to remove.
* @param preserveDifference - whether or not to preserve the intervals that are partially outside. * @param preserveDifference - whether or not to preserve the intervals that are partially outside.
* @return Intervals that were removed
*/ */
public Set<Entry> remove(TKey lowerBound, TKey upperBound, boolean preserveDifference) { public Set<Entry> remove(TKey lowerBound, TKey upperBound, boolean preserveDifference) {
checkBounds(lowerBound, upperBound); checkBounds(lowerBound, upperBound);

Datei anzeigen

@ -48,6 +48,8 @@ public class BlockingHashMap<TKey, TValue> {
/** /**
* Retrieve a cache loader that will always throw an exception. * Retrieve a cache loader that will always throw an exception.
* @param <TKey> Type of the key
* @param <TValue> Type of the value
* @return An invalid cache loader. * @return An invalid cache loader.
*/ */
public static <TKey, TValue> CacheLoader<TKey, TValue> newInvalidCacheLoader() { public static <TKey, TValue> CacheLoader<TKey, TValue> newInvalidCacheLoader() {
@ -83,6 +85,8 @@ public class BlockingHashMap<TKey, TValue> {
/** /**
* Initialize a new map. * Initialize a new map.
* @param <TKey> Type of the key
* @param <TValue> Type of the value
* @return The created map. * @return The created map.
*/ */
public static <TKey, TValue> BlockingHashMap<TKey, TValue> create() { public static <TKey, TValue> BlockingHashMap<TKey, TValue> create() {

Datei anzeigen

@ -6,7 +6,6 @@ import java.util.Iterator;
import java.util.Set; import java.util.Set;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap; import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.ExecutionException;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -70,6 +69,7 @@ public class ConcurrentPlayerMap<TValue> extends AbstractMap<Player, TValue> imp
/** /**
* Construct a new concurrent player map that uses each player's address as key. * Construct a new concurrent player map that uses each player's address as key.
* @param <T> Parameter type
* @return Concurrent player map. * @return Concurrent player map.
*/ */
public static <T> ConcurrentPlayerMap<T> usingAddress() { public static <T> ConcurrentPlayerMap<T> usingAddress() {
@ -78,6 +78,7 @@ public class ConcurrentPlayerMap<TValue> extends AbstractMap<Player, TValue> imp
/** /**
* Construct a new concurrent player map that uses each player's name as key. * Construct a new concurrent player map that uses each player's name as key.
* @param <T> Parameter type
* @return Concurrent player map. * @return Concurrent player map.
*/ */
public static <T> ConcurrentPlayerMap<T> usingName() { public static <T> ConcurrentPlayerMap<T> usingName() {
@ -177,7 +178,6 @@ public class ConcurrentPlayerMap<TValue> extends AbstractMap<Player, TValue> imp
* Lookup a player by key in the cache, optionally searching every online player. * Lookup a player by key in the cache, optionally searching every online player.
* @param key - the key of the player we are locating. * @param key - the key of the player we are locating.
* @return The player, or NULL if not found. * @return The player, or NULL if not found.
* @throws ExecutionException
*/ */
protected Player lookupPlayer(Object key) { protected Player lookupPlayer(Object key) {
try { try {
@ -315,12 +315,15 @@ public class ConcurrentPlayerMap<TValue> extends AbstractMap<Player, TValue> imp
// We can't return AbstractIterator directly, as it doesn't permitt the remove() method // We can't return AbstractIterator directly, as it doesn't permitt the remove() method
return new Iterator<Entry<Player, TValue>>() { return new Iterator<Entry<Player, TValue>>() {
@Override
public boolean hasNext() { public boolean hasNext() {
return filtered.hasNext(); return filtered.hasNext();
} }
@Override
public Entry<Player, TValue> next() { public Entry<Player, TValue> next() {
return filtered.next(); return filtered.next();
} }
@Override
public void remove() { public void remove() {
source.remove(); source.remove();
} }

Datei anzeigen

@ -67,7 +67,7 @@ public class IntegerSet {
/** /**
* Add the given element to the set, or do nothing if it already exists. * Add the given element to the set, or do nothing if it already exists.
* @param element - element to add. * @param element - element to add.
* @throws OutOfBoundsException If the given element is not in the range [0, count). * @throws ArrayIndexOutOfBoundsException If the given element is not in the range [0, count).
*/ */
public void add(int element) { public void add(int element) {
array[element] = true; array[element] = true;

Datei anzeigen

@ -65,7 +65,7 @@ public class PacketTypeSet {
/** /**
* Remove the given types from the set. * Remove the given types from the set.
* @param type - the types to remove. * @param types Types to remove
*/ */
public synchronized void removeAll(Iterable<? extends PacketType> types) { public synchronized void removeAll(Iterable<? extends PacketType> types) {
for (PacketType type : types) { for (PacketType type : types) {

Datei anzeigen

@ -93,6 +93,7 @@ public class DetailedErrorReporter implements ErrorReporter {
/** /**
* Create a default error reporting system. * Create a default error reporting system.
* @param plugin - the plugin owner.
*/ */
public DetailedErrorReporter(Plugin plugin) { public DetailedErrorReporter(Plugin plugin) {
this(plugin, DEFAULT_PREFIX, DEFAULT_SUPPORT_URL); this(plugin, DEFAULT_PREFIX, DEFAULT_SUPPORT_URL);

Datei anzeigen

@ -56,7 +56,7 @@ public interface ErrorReporter {
/** /**
* Prints a debug message from the current sender. * Prints a debug message from the current sender.
* @param sender - the sender. * @param sender - the sender.
* @param report - the report builder. * @param builder - the report builder.
*/ */
public abstract void reportDebug(Object sender, ReportBuilder builder); public abstract void reportDebug(Object sender, ReportBuilder builder);

Datei anzeigen

@ -157,7 +157,7 @@ public class Report {
/** /**
* Retrieve the message parameters that will be used to construc the report message. * Retrieve the message parameters that will be used to construc the report message.
* <p< * <p>
* This should not be confused with the method parameters of the caller method. * This should not be confused with the method parameters of the caller method.
* @return Message parameters. * @return Message parameters.
*/ */

Datei anzeigen

@ -47,7 +47,7 @@ public enum ListenerPriority {
HIGHEST(4), HIGHEST(4),
/** /**
* Event is listened to purely for monitoring the outcome of an event. * Event is listened to purely for monitoring the outcome of an event.
* <p/> * <p>
* No modifications to the event should be made under this priority. * No modifications to the event should be made under this priority.
*/ */
MONITOR(5); MONITOR(5);

Datei anzeigen

@ -442,7 +442,7 @@ public class ListeningWhitelist {
/** /**
* Set the options to copy when constructing new whitelists. * Set the options to copy when constructing new whitelists.
* @param options - the options array. * @param serverOptions - the options array.
* @return This builder, for chaining. * @return This builder, for chaining.
*/ */
public Builder options(ListenerOptions[] serverOptions) { public Builder options(ListenerOptions[] serverOptions) {
@ -452,7 +452,7 @@ public class ListeningWhitelist {
/** /**
* Options to merge into the current set of options. * Options to merge into the current set of options.
* @param options - the options array. * @param serverOptions - the options array.
* @return This builder, for chaining. * @return This builder, for chaining.
*/ */
public Builder mergeOptions(ListenerOptions... serverOptions) { public Builder mergeOptions(ListenerOptions... serverOptions) {
@ -461,7 +461,7 @@ public class ListeningWhitelist {
/** /**
* Options to merge into the current set of options. * Options to merge into the current set of options.
* @param options - the options array. * @param serverOptions - the options array.
* @return This builder, for chaining. * @return This builder, for chaining.
*/ */
public Builder mergeOptions(Collection<ListenerOptions> serverOptions) { public Builder mergeOptions(Collection<ListenerOptions> serverOptions) {

Datei anzeigen

@ -68,8 +68,9 @@ public abstract class NetworkMarker {
/** /**
* Construct a new network marker. * Construct a new network marker.
* @param side - whether or not this marker belongs to a client or server packet. * @param side - which side this marker belongs to.
* @param inputBuffer - the read serialized packet data. * @param inputBuffer - the read serialized packet data.
* @param type - packet type
*/ */
public NetworkMarker(@Nonnull ConnectionSide side, ByteBuffer inputBuffer, PacketType type) { public NetworkMarker(@Nonnull ConnectionSide side, ByteBuffer inputBuffer, PacketType type) {
this.side = Preconditions.checkNotNull(side, "side cannot be NULL."); this.side = Preconditions.checkNotNull(side, "side cannot be NULL.");
@ -81,9 +82,9 @@ public abstract class NetworkMarker {
* Construct a new network marker. * Construct a new network marker.
* <p> * <p>
* The input buffer is only non-null for client-side packets. * The input buffer is only non-null for client-side packets.
* @param side - whether or not this marker belongs to a client or server packet. * @param side - which side this marker belongs to.
* @param inputBuffer - the read serialized packet data. * @param inputBuffer - the read serialized packet data.
* @param handler - handle skipping headers. * @param type - packet type
*/ */
public NetworkMarker(@Nonnull ConnectionSide side, byte[] inputBuffer, PacketType type) { public NetworkMarker(@Nonnull ConnectionSide side, byte[] inputBuffer, PacketType type) {
this.side = Preconditions.checkNotNull(side, "side cannot be NULL."); this.side = Preconditions.checkNotNull(side, "side cannot be NULL.");
@ -325,6 +326,8 @@ public abstract class NetworkMarker {
* <p> * <p>
* It's safe to modify the position of the buffer. * It's safe to modify the position of the buffer.
* @param buffer - a read-only byte source. * @param buffer - a read-only byte source.
* @return A byte buffer without the header in the current packet.
* @throws IOException If integer reading fails
*/ */
protected ByteBuffer skipHeader(ByteBuffer buffer) throws IOException { protected ByteBuffer skipHeader(ByteBuffer buffer) throws IOException {
skipHeader(new DataInputStream(new ByteBufferInputStream(buffer))); skipHeader(new DataInputStream(new ByteBufferInputStream(buffer)));
@ -335,6 +338,7 @@ public abstract class NetworkMarker {
* Return an input stream without the header in the current packet. * Return an input stream without the header in the current packet.
* <p> * <p>
* It's safe to modify the input stream. * It's safe to modify the input stream.
* @throws IOException If integer reading fails
*/ */
protected abstract DataInputStream skipHeader(DataInputStream input) throws IOException; protected abstract DataInputStream skipHeader(DataInputStream input) throws IOException;

Datei anzeigen

@ -58,7 +58,6 @@ public abstract class PacketAdapter implements PacketListener {
/** /**
* Initialize a packet listener with the given parameters. * Initialize a packet listener with the given parameters.
* @param plugin - the plugin. * @param plugin - the plugin.
* @param listenerPriority - the priority.
* @param types - the packet types. * @param types - the packet types.
*/ */
public PacketAdapter(Plugin plugin, PacketType... types) { public PacketAdapter(Plugin plugin, PacketType... types) {

Datei anzeigen

@ -164,10 +164,9 @@ public class PacketContainer implements Serializable {
/** /**
* Creates a packet container for an existing packet. * Creates a packet container for an existing packet.
* <p>
* Deprecated: Use {@link #PacketContainer(PacketType, Object))} instead.
* @param id - ID of the given packet. * @param id - ID of the given packet.
* @param handle - contained packet. * @param handle - contained packet.
* @deprecated Use {@link #PacketContainer(PacketType, Object)} instead
*/ */
@Deprecated @Deprecated
public PacketContainer(int id, Object handle) { public PacketContainer(int id, Object handle) {
@ -176,11 +175,10 @@ public class PacketContainer implements Serializable {
/** /**
* Creates a packet container for an existing packet. * Creates a packet container for an existing packet.
* <p>
* Deprecated: Use {@link #PacketContainer(PacketType, Object, StructureModifier))} instead.
* @param id - ID of the given packet. * @param id - ID of the given packet.
* @param handle - contained packet. * @param handle - contained packet.
* @param structure - structure modifier. * @param structure - structure modifier.
* @deprecated Use {@link #PacketContainer(PacketType, Object, StructureModifier)} instead
*/ */
@Deprecated @Deprecated
public PacketContainer(int id, Object handle, StructureModifier<Object> structure) { public PacketContainer(int id, Object handle, StructureModifier<Object> structure) {
@ -197,7 +195,7 @@ public class PacketContainer implements Serializable {
/** /**
* Creates a packet container for an existing packet. * Creates a packet container for an existing packet.
* @param id - ID of the given packet. * @param type - Type of the given packet.
* @param handle - contained packet. * @param handle - contained packet.
*/ */
public PacketContainer(PacketType type, Object handle) { public PacketContainer(PacketType type, Object handle) {
@ -206,7 +204,7 @@ public class PacketContainer implements Serializable {
/** /**
* Creates a packet container for an existing packet. * Creates a packet container for an existing packet.
* @param id - ID of the given packet. * @param type - Type of the given packet.
* @param handle - contained packet. * @param handle - contained packet.
* @param structure - structure modifier. * @param structure - structure modifier.
*/ */
@ -255,6 +253,7 @@ public class PacketContainer implements Serializable {
/** /**
* Retrieves a read/write structure for every field with the given type. * Retrieves a read/write structure for every field with the given type.
* @param <T> Type
* @param primitiveType - the type to find. * @param primitiveType - the type to find.
* @return A modifier for this specific type. * @return A modifier for this specific type.
*/ */
@ -681,7 +680,7 @@ public class PacketContainer implements Serializable {
/** /**
* Retrieve a read/write structure for the PlayerInfoData list fields in the following packet: <br> * Retrieve a read/write structure for the PlayerInfoData list fields in the following packet: <br>
* <ul> * <ul>
* <li>{@link PacketType.Play.Server.PLAYER_INFO}</li> * <li>{@link PacketType.Play.Server#PLAYER_INFO}
* </ul> * </ul>
* @return A modifier for PlayerInfoData list fields. * @return A modifier for PlayerInfoData list fields.
*/ */

Datei anzeigen

@ -43,7 +43,7 @@ public interface PacketListener {
/** /**
* Invoked right before a received packet from a client is being processed. * Invoked right before a received packet from a client is being processed.
* <p> * <p>
* <b>WARNING</b>: </br> * <b>WARNING</b>: <br>
* This method will be called <i>asynchronously</i>! You should synchronize with the main * This method will be called <i>asynchronously</i>! You should synchronize with the main
* thread using {@link org.bukkit.scheduler.BukkitScheduler#scheduleSyncDelayedTask(Plugin, Runnable, long) scheduleSyncDelayedTask} * thread using {@link org.bukkit.scheduler.BukkitScheduler#scheduleSyncDelayedTask(Plugin, Runnable, long) scheduleSyncDelayedTask}
* if you need to call the Bukkit API. * if you need to call the Bukkit API.

Datei anzeigen

@ -38,8 +38,8 @@ import com.google.common.primitives.Primitives;
* <p> * <p>
* Typical conversions include: * Typical conversions include:
* <ul> * <ul>
* <li>org.bukkit.entity.Player -> net.minecraft.server.EntityPlayer</li> * <li>org.bukkit.entity.Player to net.minecraft.server.EntityPlayer</li>
* <li>org.bukkit.World -> net.minecraft.server.WorldServer</li> * <li>org.bukkit.World to net.minecraft.server.WorldServer</li>
* </ul> * </ul>
* *
* @author Kristian * @author Kristian

Datei anzeigen

@ -66,6 +66,7 @@ public class NetworkProcessor {
/** /**
* Invoke the post listeners and packet transmission, if any. * Invoke the post listeners and packet transmission, if any.
* @param event - PacketEvent
* @param marker - the network marker, or NULL. * @param marker - the network marker, or NULL.
*/ */
public void invokePostEvent(PacketEvent event, NetworkMarker marker) { public void invokePostEvent(PacketEvent event, NetworkMarker marker) {

Datei anzeigen

@ -104,7 +104,7 @@ public class PacketConstructor {
/** /**
* Create a packet constructor that creates packets using the given ID. * Create a packet constructor that creates packets using the given ID.
* <p> * <p>
* Note that if you pass a Class<?> as a value, it will use its type directly. * Note that if you pass a Class as a value, it will use its type directly.
* <p> * <p>
* Deprecated: Use {@link #withPacket(PacketType, Object[])} instead. * Deprecated: Use {@link #withPacket(PacketType, Object[])} instead.
* @param id - legacy (1.6.4) packet ID. * @param id - legacy (1.6.4) packet ID.
@ -120,7 +120,7 @@ public class PacketConstructor {
/** /**
* Create a packet constructor that creates packets using the given types. * Create a packet constructor that creates packets using the given types.
* <p> * <p>
* Note that if you pass a Class<?> as a value, it will use its type directly. * Note that if you pass a Class as a value, it will use its type directly.
* @param type - the type of the packet to create. * @param type - the type of the packet to create.
* @param values - the values that will match each parameter in the desired constructor. * @param values - the values that will match each parameter in the desired constructor.
* @return A packet constructor with these types. * @return A packet constructor with these types.

Datei anzeigen

@ -223,7 +223,8 @@ public final class PacketFilterManager implements ProtocolManager, ListenerInvok
private boolean debug; private boolean debug;
/** /**
* Only create instances of this class if protocol lib is disabled. * Only create instances of this class if ProtocolLib is disabled.
* @param builder - PacketFilterBuilder
*/ */
public PacketFilterManager(PacketFilterBuilder builder) { public PacketFilterManager(PacketFilterBuilder builder) {
// Used to determine if injection is needed // Used to determine if injection is needed

Datei anzeigen

@ -201,7 +201,7 @@ public class NettyProtocolInjector implements ChannelListener {
/** /**
* Inject our packet handling into a specific player. * Inject our packet handling into a specific player.
* @param player * @param player Player to inject into
*/ */
public void injectPlayer(Player player) { public void injectPlayer(Player player) {
injectionFactory.fromPlayer(player, this).inject(); injectionFactory.fromPlayer(player, this).inject();

Datei anzeigen

@ -116,7 +116,10 @@ public class InterceptWritePacket {
/** /**
* Construct a new instance of the proxy object. * Construct a new instance of the proxy object.
* @return New instance of proxy, or NULL if we failed. * @param proxyObject - Object to construct proxy of
* @param event - Packet event
* @param marker - Network marker
* @return New instance of the proxy, or null if we failed.
*/ */
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
public Object constructProxy(Object proxyObject, PacketEvent event, NetworkMarker marker) { public Object constructProxy(Object proxyObject, PacketEvent event, NetworkMarker marker) {

Datei anzeigen

@ -139,6 +139,7 @@ public class PacketRegistry {
if (NETTY != null) { if (NETTY != null) {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
Map<Class, Integer> result = (Map)Maps.transformValues(NETTY.getPacketClassLookup(), new Function<PacketType, Integer>() { Map<Class, Integer> result = (Map)Maps.transformValues(NETTY.getPacketClassLookup(), new Function<PacketType, Integer>() {
@Override
public Integer apply(PacketType type) { public Integer apply(PacketType type) {
return type.getLegacyId(); return type.getLegacyId();
}; };
@ -161,6 +162,7 @@ public class PacketRegistry {
return result; return result;
} }
return Maps.transformValues(LEGACY.getPacketToID(), new Function<Integer, PacketType>() { return Maps.transformValues(LEGACY.getPacketToID(), new Function<Integer, PacketType>() {
@Override
public PacketType apply(Integer packetId) { public PacketType apply(Integer packetId) {
return PacketType.findLegacy(packetId); return PacketType.findLegacy(packetId);
}; };
@ -298,7 +300,7 @@ public class PacketRegistry {
/** /**
* Convert a set of legacy packet IDs to packet types. * Convert a set of legacy packet IDs to packet types.
* @param types - legacy packet IDs. * @param ids - legacy packet IDs.
* @return Set of packet types. * @return Set of packet types.
*/ */
public static Set<PacketType> toPacketTypes(Set<Integer> ids) { public static Set<PacketType> toPacketTypes(Set<Integer> ids) {
@ -307,7 +309,7 @@ public class PacketRegistry {
/** /**
* Convert a set of legacy packet IDs to packet types. * Convert a set of legacy packet IDs to packet types.
* @param types - legacy packet IDs. * @param ids - legacy packet IDs.
* @param preference - the sender preference, if any. * @param preference - the sender preference, if any.
* @return Set of packet types. * @return Set of packet types.
*/ */

Datei anzeigen

@ -129,7 +129,7 @@ public interface PlayerInjectionHandler {
* Send the given packet to the given receiver. * Send the given packet to the given receiver.
* @param receiver - the player receiver. * @param receiver - the player receiver.
* @param packet - the packet to send. * @param packet - the packet to send.
* @param marker * @param marker - network marker.
* @param filters - whether or not to invoke the packet filters. * @param filters - whether or not to invoke the packet filters.
* @throws InvocationTargetException If an error occurred during sending. * @throws InvocationTargetException If an error occurred during sending.
*/ */

Datei anzeigen

@ -156,6 +156,7 @@ public abstract class PlayerInjector implements SocketInjector {
/** /**
* Initialize all fields for this player injector, if it hasn't already. * Initialize all fields for this player injector, if it hasn't already.
* @param injectionSource - Injection source
* @throws IllegalAccessException An error has occured. * @throws IllegalAccessException An error has occured.
*/ */
public void initialize(Object injectionSource) throws IllegalAccessException { public void initialize(Object injectionSource) throws IllegalAccessException {
@ -442,6 +443,7 @@ public abstract class PlayerInjector implements SocketInjector {
/** /**
* Retrieves the current net handler for this player. * Retrieves the current net handler for this player.
* @boolean refresh - Whether or not to refresh
* @return Current net handler. * @return Current net handler.
* @throws IllegalAccessException Unable to find or retrieve net handler. * @throws IllegalAccessException Unable to find or retrieve net handler.
*/ */
@ -562,6 +564,7 @@ public abstract class PlayerInjector implements SocketInjector {
/** /**
* Determine if this inject method can even be attempted. * Determine if this inject method can even be attempted.
* @param GamePhase - Game phase
* @return TRUE if can be attempted, though possibly with failure, FALSE otherwise. * @return TRUE if can be attempted, though possibly with failure, FALSE otherwise.
*/ */
public abstract boolean canInject(GamePhase state); public abstract boolean canInject(GamePhase state);

Datei anzeigen

@ -47,6 +47,7 @@ public interface SocketInjector {
/** /**
* Retrieve the hooked player. * Retrieve the hooked player.
* @return The hooked player.
*/ */
public abstract Player getPlayer(); public abstract Player getPlayer();

Datei anzeigen

@ -268,7 +268,7 @@ public class Metrics {
/** /**
* Enables metrics for the server by setting "opt-out" to false in the config file and starting the metrics task. * Enables metrics for the server by setting "opt-out" to false in the config file and starting the metrics task.
* *
* @throws java.io.IOException * @throws IOException If configuration saving fails
*/ */
public void enable() throws IOException { public void enable() throws IOException {
// This has to be synchronized or it can collide with the check in the task. // This has to be synchronized or it can collide with the check in the task.
@ -289,7 +289,7 @@ public class Metrics {
/** /**
* Disables metrics for the server by setting "opt-out" to true in the config file and canceling the metrics task. * Disables metrics for the server by setting "opt-out" to true in the config file and canceling the metrics task.
* *
* @throws java.io.IOException * @throws IOException If configuration saving fails
*/ */
public void disable() throws IOException { public void disable() throws IOException {
// This has to be synchronized or it can collide with the check in the task. // This has to be synchronized or it can collide with the check in the task.
@ -327,6 +327,8 @@ public class Metrics {
/** /**
* Generic method that posts a plugin to the metrics website * Generic method that posts a plugin to the metrics website
*
* @throws IOException If posting fails
*/ */
private void postPlugin(final boolean isPing) throws IOException { private void postPlugin(final boolean isPing) throws IOException {
// Server software specific section // Server software specific section
@ -496,8 +498,8 @@ public class Metrics {
/** /**
* GZip compress a string of bytes * GZip compress a string of bytes
* *
* @param input * @param input Input to compress
* @return * @return Compressed string
*/ */
public static byte[] gzip(String input) { public static byte[] gzip(String input) {
ByteArrayOutputStream baos = new ByteArrayOutputStream(); ByteArrayOutputStream baos = new ByteArrayOutputStream();
@ -532,14 +534,7 @@ public class Metrics {
} }
} }
/** // Appends a json encoded key/value pair to the given string builder.
* Appends a json encoded key/value pair to the given string builder.
*
* @param json
* @param key
* @param value
* @throws UnsupportedEncodingException
*/
private static void appendJSONPair(StringBuilder json, String key, String value) throws UnsupportedEncodingException { private static void appendJSONPair(StringBuilder json, String key, String value) throws UnsupportedEncodingException {
boolean isValueNumeric = false; boolean isValueNumeric = false;
@ -566,12 +561,7 @@ public class Metrics {
} }
} }
/** // Escape a string to create a valid JSON string
* Escape a string to create a valid JSON string
*
* @param text
* @return
*/
private static String escapeJSON(String text) { private static String escapeJSON(String text) {
StringBuilder builder = new StringBuilder(); StringBuilder builder = new StringBuilder();
@ -612,12 +602,7 @@ public class Metrics {
return builder.toString(); return builder.toString();
} }
/** // Encode text as UTF-8
* Encode text as UTF-8
*
* @param text the text to encode
* @return the encoded text, as UTF-8
*/
private static String urlEncode(final String text) throws UnsupportedEncodingException { private static String urlEncode(final String text) throws UnsupportedEncodingException {
return URLEncoder.encode(text, "UTF-8"); return URLEncoder.encode(text, "UTF-8");
} }

Datei anzeigen

@ -68,7 +68,7 @@ public class ClassAnalyser {
/** /**
* Retrieve the associated owner class. * Retrieve the associated owner class.
* @return The owner class. * @return The owner class.
* @throws ClassNotFoundException * @throws ClassNotFoundException If the class was not found
*/ */
public Class<?> getOwnerClass() throws ClassNotFoundException { public Class<?> getOwnerClass() throws ClassNotFoundException {
return AsmMethod.class.getClassLoader().loadClass(getOwnerName().replace('/', '.')); return AsmMethod.class.getClassLoader().loadClass(getOwnerName().replace('/', '.'));

Datei anzeigen

@ -93,6 +93,7 @@ public class FuzzyReflection {
/** /**
* Retrieve the value of the first field of the given type. * Retrieve the value of the first field of the given type.
* @param <T> Type
* @param instance - the instance to retrieve from. * @param instance - the instance to retrieve from.
* @param fieldClass - type of the field to retrieve. * @param fieldClass - type of the field to retrieve.
* @param forceAccess - whether or not to look for private and protected fields. * @param forceAccess - whether or not to look for private and protected fields.
@ -107,6 +108,7 @@ public class FuzzyReflection {
/** /**
* Retrieves the underlying class. * Retrieves the underlying class.
* @return The underlying class.
*/ */
public Class<?> getSource() { public Class<?> getSource() {
return source; return source;

Datei anzeigen

@ -893,7 +893,7 @@ public class MethodUtils {
* Compatible parameters mean that every method parameter is assignable from * Compatible parameters mean that every method parameter is assignable from
* the given parameters. * the given parameters.
* In other words, it finds a method with the given name * In other words, it finds a method with the given name
* that will take the parameters given.<p> * that will take the parameters given.</p>
* *
* <p>This method is slightly undeterminstic since it loops * <p>This method is slightly undeterminstic since it loops
* through methods names and return the first matching method.</p> * through methods names and return the first matching method.</p>
@ -1298,7 +1298,8 @@ public class MethodUtils {
* @param obj object to be tested for equality * @param obj object to be tested for equality
* @return true, if the object describes the same Method. * @return true, if the object describes the same Method.
*/ */
public boolean equals(Object obj) { @Override
public boolean equals(Object obj) {
if (!(obj instanceof MethodDescriptor)) { if (!(obj instanceof MethodDescriptor)) {
return false; return false;
} }
@ -1318,7 +1319,8 @@ public class MethodUtils {
* determine equality. * determine equality.
* @return the string length of method name. * @return the string length of method name.
*/ */
public int hashCode() { @Override
public int hashCode() {
return hashCode; return hashCode;
} }
} }

Datei anzeigen

@ -39,6 +39,7 @@ public class ObjectEnum<T> implements Iterable<T> {
/** /**
* Registers every declared integer field. * Registers every declared integer field.
* @param fieldType Field type
*/ */
public ObjectEnum(Class<T> fieldType) { public ObjectEnum(Class<T> fieldType) {
registerAll(fieldType); registerAll(fieldType);
@ -46,6 +47,7 @@ public class ObjectEnum<T> implements Iterable<T> {
/** /**
* Registers every public assignable static field as a member. * Registers every public assignable static field as a member.
* @param fieldType Field type
*/ */
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
protected void registerAll(Class<T> fieldType) { protected void registerAll(Class<T> fieldType) {

Datei anzeigen

@ -62,10 +62,10 @@ public class PrettyPrinter {
public final static int RECURSE_DEPTH = 3; public final static int RECURSE_DEPTH = 3;
/** /**
* Print the content of an object. * Print the contents of an object.
* @param object - the object to serialize. * @param object - the object to serialize.
* @return String representation of the class. * @return String representation of the class.
* @throws IllegalAccessException * @throws IllegalAccessException If the object is null
*/ */
public static String printObject(Object object) throws IllegalAccessException { public static String printObject(Object object) throws IllegalAccessException {
if (object == null) if (object == null)
@ -75,11 +75,12 @@ public class PrettyPrinter {
} }
/** /**
* Print the content of an object. * Print the contents of an object.
* @param object - the object to serialize. * @param object - the object to serialize.
* @param start - class to start at.
* @param stop - superclass that will stop the process. * @param stop - superclass that will stop the process.
* @return String representation of the class. * @return String representation of the class
* @throws IllegalAccessException * @throws IllegalAccessException If the object is null
*/ */
public static String printObject(Object object, Class<?> start, Class<?> stop) throws IllegalAccessException { public static String printObject(Object object, Class<?> start, Class<?> stop) throws IllegalAccessException {
if (object == null) if (object == null)
@ -89,24 +90,27 @@ public class PrettyPrinter {
} }
/** /**
* Print the content of an object. * Print the contents of an object.
* @param object - the object to serialize. * @param object - the object to serialize.
* @param start - class to start at.
* @param stop - superclass that will stop the process. * @param stop - superclass that will stop the process.
* @param hierachyDepth - maximum recursion level.
* @return String representation of the class. * @return String representation of the class.
* @throws IllegalAccessException * @throws IllegalAccessException If the object is null
*/ */
public static String printObject(Object object, Class<?> start, Class<?> stop, int hierachyDepth) throws IllegalAccessException { public static String printObject(Object object, Class<?> start, Class<?> stop, int hierachyDepth) throws IllegalAccessException {
return printObject(object, start, stop, hierachyDepth, ObjectPrinter.DEFAULT); return printObject(object, start, stop, hierachyDepth, ObjectPrinter.DEFAULT);
} }
/** /**
* Print the content of an object. * Print the contents of an object.
* @param object - the object to serialize. * @param object - the object to serialize.
* @param start - class to start at.
* @param stop - superclass that will stop the process. * @param stop - superclass that will stop the process.
* @param hierachyDepth - maximum recursion level. * @param hierachyDepth - maximum recursion level.
* @param printer - a generic object printer. * @param printer - a generic object printer.
* @return String representation of the class. * @return String representation of the class.
* @throws IllegalAccessException * @throws IllegalAccessException If the object is null
*/ */
public static String printObject(Object object, Class<?> start, Class<?> stop, int hierachyDepth, ObjectPrinter printer) throws IllegalAccessException { public static String printObject(Object object, Class<?> start, Class<?> stop, int hierachyDepth, ObjectPrinter printer) throws IllegalAccessException {
if (object == null) if (object == null)

Datei anzeigen

@ -393,6 +393,7 @@ public class StructureModifier<TField> {
/** /**
* Retrieves a structure modifier that only reads and writes fields of a given type. * Retrieves a structure modifier that only reads and writes fields of a given type.
* @param <T> Type
* @param fieldType - the type, or supertype, of every field to modify. * @param fieldType - the type, or supertype, of every field to modify.
* @return A structure modifier for fields of this type. * @return A structure modifier for fields of this type.
*/ */
@ -424,6 +425,7 @@ public class StructureModifier<TField> {
/** /**
* Retrieves a structure modifier that only reads and writes fields of a given type. * Retrieves a structure modifier that only reads and writes fields of a given type.
* @param <T> Type
* @param fieldType - the type, or supertype, of every field to modify. * @param fieldType - the type, or supertype, of every field to modify.
* @param converter - converts objects into the given type. * @param converter - converts objects into the given type.
* @return A structure modifier for fields of this type. * @return A structure modifier for fields of this type.
@ -507,10 +509,10 @@ public class StructureModifier<TField> {
/** /**
* Create a new structure modifier for the new field type. * Create a new structure modifier for the new field type.
* @param <T> Type
* @param fieldType - common type of each field. * @param fieldType - common type of each field.
* @param filtered - list of fields after filtering the original modifier. * @param filtered - list of fields after filtering the original modifier.
* @param defaults - list of default values after filtering the original. * @param defaults - list of default values after filtering the original.
* @param converter - the new converter
* @return A new structure modifier. * @return A new structure modifier.
*/ */
protected <T> StructureModifier<T> withFieldType( protected <T> StructureModifier<T> withFieldType(
@ -520,6 +522,7 @@ public class StructureModifier<TField> {
/** /**
* Create a new structure modifier for the new field type. * Create a new structure modifier for the new field type.
* @param <T> Type
* @param fieldType - common type of each field. * @param fieldType - common type of each field.
* @param filtered - list of fields after filtering the original modifier. * @param filtered - list of fields after filtering the original modifier.
* @param defaults - list of default values after filtering the original. * @param defaults - list of default values after filtering the original.

Datei anzeigen

@ -200,6 +200,7 @@ public class VolatileField {
/** /**
* Determine whether or not we'll need to revert the value. * Determine whether or not we'll need to revert the value.
* @return True if it is set, false if not.
*/ */
public boolean isCurrentSet() { public boolean isCurrentSet() {
return currentSet; return currentSet;

Datei anzeigen

@ -78,7 +78,7 @@ public final class Accessors {
/** /**
* Retrieve an accessor for the first field of the given type. * Retrieve an accessor for the first field of the given type.
* @param instanceClass - the type of the instance to retrieve. * @param instanceClass - the type of the instance to retrieve.
* @param fieldClass - type of the field to retrieve. * @param fieldName - name of the field to retrieve.
* @param forceAccess - whether or not to look for private and protected fields. * @param forceAccess - whether or not to look for private and protected fields.
* @return The value of that field. * @return The value of that field.
* @throws IllegalArgumentException If the field cannot be found. * @throws IllegalArgumentException If the field cannot be found.

Datei anzeigen

@ -26,6 +26,7 @@ public class SerializableCloner implements Cloner {
/** /**
* Clone the given object using serialization. * Clone the given object using serialization.
* @param <T> Type
* @param obj - the object to clone. * @param obj - the object to clone.
* @return The cloned object. * @return The cloned object.
* @throws RuntimeException If we were unable to clone the object. * @throws RuntimeException If we were unable to clone the object.

Datei anzeigen

@ -158,6 +158,7 @@ public class BackgroundCompiler {
/** /**
* Ensure that the given structure modifier is eventually compiled. * Ensure that the given structure modifier is eventually compiled.
* @param <TKey> Type
* @param uncompiled - structure modifier to compile. * @param uncompiled - structure modifier to compile.
* @param listener - listener responsible for responding to the compilation. * @param listener - listener responsible for responding to the compilation.
*/ */
@ -271,6 +272,7 @@ public class BackgroundCompiler {
/** /**
* Add a compile listener if we are still waiting for the structure modifier to be compiled. * Add a compile listener if we are still waiting for the structure modifier to be compiled.
* @param <TKey> Type
* @param uncompiled - the structure modifier that may get compiled. * @param uncompiled - the structure modifier that may get compiled.
* @param listener - the listener to invoke in that case. * @param listener - the listener to invoke in that case.
*/ */

Datei anzeigen

@ -157,6 +157,7 @@ public final class StructureCompiler {
/** /**
* Lookup the current class loader for any previously generated classes before we attempt to generate something. * Lookup the current class loader for any previously generated classes before we attempt to generate something.
* @param <TKey> Type
* @param source - the structure modifier to look up. * @param source - the structure modifier to look up.
* @return TRUE if we successfully found a previously generated class, FALSE otherwise. * @return TRUE if we successfully found a previously generated class, FALSE otherwise.
*/ */

Datei anzeigen

@ -87,7 +87,7 @@ public abstract class AbstractFuzzyMember<T extends Member> extends AbstractFuzz
/** /**
* Set the exact name of the member we are matching. * Set the exact name of the member we are matching.
* <p< * <p>
* This will overwrite the regular expression rule. * This will overwrite the regular expression rule.
* @param name - exact name. * @param name - exact name.
* @return This builder, for chaining. * @return This builder, for chaining.

Datei anzeigen

@ -93,6 +93,7 @@ public class FuzzyMethodContract extends AbstractFuzzyMember<MethodInfo> {
* @author Kristian * @author Kristian
*/ */
public static class Builder extends AbstractFuzzyMember.Builder<FuzzyMethodContract> { public static class Builder extends AbstractFuzzyMember.Builder<FuzzyMethodContract> {
@Override
public Builder requireModifier(int modifier) { public Builder requireModifier(int modifier) {
super.requireModifier(modifier); super.requireModifier(modifier);
return this; return this;
@ -209,7 +210,7 @@ public class FuzzyMethodContract extends AbstractFuzzyMember<MethodInfo> {
/** /**
* Add a new required parameters by type and order for any matching method. * Add a new required parameters by type and order for any matching method.
* @param type - the types of every parameters in order. * @param types - the types of every parameters in order.
* @return This builder, for chaining. * @return This builder, for chaining.
*/ */
public Builder parameterExactArray(Class<?>... types) { public Builder parameterExactArray(Class<?>... types) {

Datei anzeigen

@ -156,8 +156,8 @@ public class DefaultInstances implements InstanceProvider {
* <li>Enums. Returns the first declared element.</li> * <li>Enums. Returns the first declared element.</li>
* <li>Collection interfaces, such as List and Set. Returns the most appropriate empty container.</li> * <li>Collection interfaces, such as List and Set. Returns the most appropriate empty container.</li>
* <li>Any type with a public constructor that has parameters with defaults.</li> * <li>Any type with a public constructor that has parameters with defaults.</li>
* </ul>
* </ul> * </ul>
* @param <T> Type
* @param type - the type to construct a default value. * @param type - the type to construct a default value.
* @return A default value/instance, or NULL if not possible. * @return A default value/instance, or NULL if not possible.
*/ */
@ -167,6 +167,7 @@ public class DefaultInstances implements InstanceProvider {
/** /**
* Retrieve the constructor with the fewest number of parameters. * Retrieve the constructor with the fewest number of parameters.
* @param <T> Type
* @param type - type to construct. * @param type - type to construct.
* @return A constructor with the fewest number of parameters, or NULL if the type has no constructors. * @return A constructor with the fewest number of parameters, or NULL if the type has no constructors.
*/ */
@ -239,8 +240,8 @@ public class DefaultInstances implements InstanceProvider {
* <li>Enums. Returns the first declared element.</li> * <li>Enums. Returns the first declared element.</li>
* <li>Collection interfaces, such as List and Set. Returns the most appropriate empty container.</li> * <li>Collection interfaces, such as List and Set. Returns the most appropriate empty container.</li>
* <li>Any type with a public constructor that has parameters with defaults.</li> * <li>Any type with a public constructor that has parameters with defaults.</li>
* </ul>
* </ul> * </ul>
* @param <T> Type
* @param type - the type to construct a default value. * @param type - the type to construct a default value.
* @param providers - instance providers used during the construction. * @param providers - instance providers used during the construction.
* @return A default value/instance, or NULL if not possible. * @return A default value/instance, or NULL if not possible.
@ -319,6 +320,7 @@ public class DefaultInstances implements InstanceProvider {
/** /**
* Used by the default instance provider to create a class from a given constructor. * Used by the default instance provider to create a class from a given constructor.
* The default method uses reflection. * The default method uses reflection.
* @param <T> Type
* @param type - the type to create. * @param type - the type to create.
* @param constructor - the constructor to use. * @param constructor - the constructor to use.
* @param types - type of each parameter in order. * @param types - type of each parameter in order.

Datei anzeigen

@ -21,6 +21,7 @@ public class NotConstructableException extends IllegalArgumentException {
/** /**
* Construct a new not constructable exception with a custom message. * Construct a new not constructable exception with a custom message.
* @param message - detail message
*/ */
public NotConstructableException(String message) { public NotConstructableException(String message) {
super(message); super(message);
@ -28,6 +29,8 @@ public class NotConstructableException extends IllegalArgumentException {
/** /**
* Construct a new not constructable exception with a custom message and cause. * Construct a new not constructable exception with a custom message and cause.
* @param message - detail message
* @param cause - cause
*/ */
public NotConstructableException(String message, Throwable cause) { public NotConstructableException(String message, Throwable cause) {
super(message, cause); super(message, cause);
@ -35,6 +38,7 @@ public class NotConstructableException extends IllegalArgumentException {
/** /**
* Construct a new not constructable exception with a custom cause. * Construct a new not constructable exception with a custom cause.
* @param cause - cause
*/ */
public NotConstructableException(Throwable cause) { public NotConstructableException(Throwable cause) {
super( cause); super( cause);

Datei anzeigen

@ -107,6 +107,7 @@ public class StatisticsStream extends OnlineComputation {
/** /**
* Combine the two statistics. * Combine the two statistics.
* @param other - the other statistics. * @param other - the other statistics.
* @return Combined statistics
*/ */
public StatisticsStream add(StatisticsStream other) { public StatisticsStream add(StatisticsStream other) {
// Special cases // Special cases

Datei anzeigen

@ -26,7 +26,7 @@ public class TimedTracker {
/** /**
* Stop and record the execution time since the creation of the given tracking token. * Stop and record the execution time since the creation of the given tracking token.
* @param trackingToken - the tracking token. * @param trackingToken - the tracking token.
* @param packetId - the packet ID. * @param type - the packet type.
*/ */
public synchronized void endTracking(long trackingToken, PacketType type) { public synchronized void endTracking(long trackingToken, PacketType type) {
StatisticsStream stream = packets.get(type); StatisticsStream stream = packets.get(type);

Datei anzeigen

@ -172,6 +172,7 @@ public class ChatExtensions {
* @param marginChar - the character to use as margin. * @param marginChar - the character to use as margin.
* @param marginWidth - the width (in characters) of the left and right margin. * @param marginWidth - the width (in characters) of the left and right margin.
* @param marginHeight - the height (in characters) of the top and buttom margin. * @param marginHeight - the height (in characters) of the top and buttom margin.
* @return Flowerboxed message
*/ */
public static String[] toFlowerBox(String[] message, String marginChar, int marginWidth, int marginHeight) { public static String[] toFlowerBox(String[] message, String marginChar, int marginWidth, int marginHeight) {
String[] output = new String[message.length + marginHeight * 2]; String[] output = new String[message.length + marginHeight * 2];

Datei anzeigen

@ -23,6 +23,7 @@ public class HexDumper {
/** /**
* Retrieve a hex dumper tuned for lines of 80 characters: * Retrieve a hex dumper tuned for lines of 80 characters:
* <table border="1"> * <table border="1">
* <caption>Values</caption>
* <tr> * <tr>
* <th>Property</th> * <th>Property</th>
* <th>Value</th> * <th>Value</th>
@ -118,7 +119,7 @@ public class HexDumper {
* Set the number of groups in each line. This is limited by the supply of bytes in the byte array. * Set the number of groups in each line. This is limited by the supply of bytes in the byte array.
* <p> * <p>
* Use {@link Integer#MAX_VALUE} to effectively disable lines. * Use {@link Integer#MAX_VALUE} to effectively disable lines.
* @param groupLength - the length of each group. * @param groupCount - the count of groups.
* @return This instance, for chaining. * @return This instance, for chaining.
*/ */
public HexDumper groupCount(int groupCount) { public HexDumper groupCount(int groupCount) {
@ -132,7 +133,6 @@ public class HexDumper {
* Append the hex dump of the given data to the string builder, using the current formatting settings. * Append the hex dump of the given data to the string builder, using the current formatting settings.
* @param appendable - appendable source. * @param appendable - appendable source.
* @param data - the data to dump. * @param data - the data to dump.
* @param start - the starting index of the data.
* @param length - the number of bytes to dump. * @param length - the number of bytes to dump.
* @throws IOException Any underlying IO exception. * @throws IOException Any underlying IO exception.
*/ */
@ -158,8 +158,6 @@ public class HexDumper {
* Append the hex dump of the given data to the string builder, using the current formatting settings. * Append the hex dump of the given data to the string builder, using the current formatting settings.
* @param builder - the builder. * @param builder - the builder.
* @param data - the data to dump. * @param data - the data to dump.
* @param start - the starting index of the data.
* @param length - the number of bytes to dump.
*/ */
public void appendTo(StringBuilder builder, byte[] data) { public void appendTo(StringBuilder builder, byte[] data) {
appendTo(builder, data, 0, data.length); appendTo(builder, data, 0, data.length);

Datei anzeigen

@ -1752,12 +1752,14 @@ public class MinecraftReflection {
} }
private static MethodAccessor asCraftMirror; private static MethodAccessor asCraftMirror;
private static MethodAccessor asCraftCopy;
private static MethodAccessor asNMSCopy; private static MethodAccessor asNMSCopy;
/** /**
* Retrieve a CraftItemStack from a given ItemStack. * Retrieve a CraftItemStack from a given NMS ItemStack.
* @param bukkitItemStack - the Bukkit ItemStack to convert. *
* @return A CraftItemStack as an ItemStack. * @param nmsItem - the NMS ItemStack to convert.
* @return A CraftItemStack as a NMS ItemStack.
*/ */
public static ItemStack getBukkitItemStack(Object nmsItem) { public static ItemStack getBukkitItemStack(Object nmsItem) {
if (asCraftMirror == null) { if (asCraftMirror == null) {
@ -1768,9 +1770,24 @@ public class MinecraftReflection {
} }
/** /**
* Retrieve the Bukkit ItemStack from a given net.minecraft.server ItemStack. * Retrieve a CraftItemStack from a given ItemStack.
* @param minecraftItemStack - the NMS ItemStack to wrap. *
* @return The wrapped ItemStack. * @param stack - the Bukkit ItemStack to convert.
* @return A CraftItemStack as an ItemStack.
*/
public static ItemStack getCraftItemStack(ItemStack stack) {
if (asCraftCopy == null) {
asCraftCopy = Accessors.getMethodAccessor(getCraftItemStackClass(), "asCraftCopy", ItemStack.class);
}
return (ItemStack) asCraftCopy.invoke(null, stack);
}
/**
* Retrieve the NMS ItemStack from a given ItemStack.
*
* @param stack - the ItemStack to convert.
* @return The NMS ItemStack.
*/ */
public static Object getMinecraftItemStack(ItemStack stack) { public static Object getMinecraftItemStack(ItemStack stack) {
if (asNMSCopy == null) { if (asNMSCopy == null) {

Datei anzeigen

@ -28,6 +28,8 @@ public class SafeCacheBuilder<K, V> {
/** /**
* Construct a new safe cache builder. * Construct a new safe cache builder.
* @param <K> Key type
* @param <V> Value type
* *
* @return A new cache builder. * @return A new cache builder.
*/ */
@ -54,9 +56,12 @@ public class SafeCacheBuilder<K, V> {
* <b>Note:</b>The default may change in the future. If you care about this * <b>Note:</b>The default may change in the future. If you care about this
* value, you should always choose it explicitly. * value, you should always choose it explicitly.
* *
* @param concurrencyLevel New concurrency level
* @return This for chaining
*
* @throws IllegalArgumentException if {@code concurrencyLevel} is * @throws IllegalArgumentException if {@code concurrencyLevel} is
* nonpositive * nonpositive
* @throws IllegalStateException if a concurrency level was already set * @throws IllegalStateExeption if a concurrency level was already set
*/ */
public SafeCacheBuilder<K, V> concurrencyLevel(int concurrencyLevel) { public SafeCacheBuilder<K, V> concurrencyLevel(int concurrencyLevel) {
builder.concurrencyLevel(concurrencyLevel); builder.concurrencyLevel(concurrencyLevel);
@ -66,8 +71,7 @@ public class SafeCacheBuilder<K, V> {
/** /**
* Specifies that each entry should be automatically removed from the cache * Specifies that each entry should be automatically removed from the cache
* once a fixed duration has elapsed after the entry's creation, or last * once a fixed duration has elapsed after the entry's creation, or last
* access. Access time is reset by {@link com.google.common.cache.Cache#get Cache.get()} and * access. Access time is reset by {@link com.google.common.cache.Cache#get Cache.get()},
* {@link com.google.common.cache.Cache#getUnchecked Cache.getUnchecked()},
* but not by operations on the view returned by * but not by operations on the view returned by
* {@link com.google.common.cache.Cache#asMap() Cache.asMap()}. * {@link com.google.common.cache.Cache#asMap() Cache.asMap()}.
* *
@ -86,6 +90,8 @@ public class SafeCacheBuilder<K, V> {
* @param duration the length of time after an entry is last accessed that * @param duration the length of time after an entry is last accessed that
* it should be automatically removed * it should be automatically removed
* @param unit the unit that {@code duration} is expressed in * @param unit the unit that {@code duration} is expressed in
* @return This for chaining
*
* @throws IllegalArgumentException if {@code duration} is negative * @throws IllegalArgumentException if {@code duration} is negative
* @throws IllegalStateException if the time to idle or time to live was * @throws IllegalStateException if the time to idle or time to live was
* already set * already set
@ -280,7 +286,7 @@ public class SafeCacheBuilder<K, V> {
/** /**
* Returns the cache wrapped as a ConcurrentMap. * Returns the cache wrapped as a ConcurrentMap.
* <> * <p>
* We can't return the direct Cache instance as it changed in Guava 13. * We can't return the direct Cache instance as it changed in Guava 13.
* @return The cache as a map. * @return The cache as a map.
*/ */

Datei anzeigen

@ -12,7 +12,7 @@ public abstract class AbstractWrapper {
/** /**
* Construct a new NMS wrapper. * Construct a new NMS wrapper.
* @param handle - the wrapped NMS object. * @param handleType - the NMS handle type.
*/ */
public AbstractWrapper(Class<?> handleType) { public AbstractWrapper(Class<?> handleType) {
this.handleType = Preconditions.checkNotNull(handleType, "handleType cannot be NULL"); this.handleType = Preconditions.checkNotNull(handleType, "handleType cannot be NULL");

Datei anzeigen

@ -210,8 +210,8 @@ public class BukkitConverters {
/** /**
* Retrieve an equivalent converter for a map of generic keys and primitive values. * Retrieve an equivalent converter for a map of generic keys and primitive values.
* @param genericItemType - the generic item type. * @param genericKeyType - the generic key type.
* @param itemConverter - an equivalent converter for the generic type. * @param keyConverter - an equivalent converter for the generic type.
* @return An equivalent converter. * @return An equivalent converter.
*/ */
public static <T, U> EquivalentConverter<Map<T, U>> getMapConverter( public static <T, U> EquivalentConverter<Map<T, U>> getMapConverter(
@ -1006,7 +1006,7 @@ public class BukkitConverters {
} }
/** /**
* Retrieve every NMS <-> Bukkit converter as unwrappers. * Retrieve every NMS to/from Bukkit converter as unwrappers.
* @return Every unwrapper. * @return Every unwrapper.
*/ */
public static List<Unwrapper> getUnwrappers() { public static List<Unwrapper> getUnwrappers() {

Datei anzeigen

@ -147,7 +147,7 @@ public class WrappedGameProfile extends AbstractWrapper {
/** /**
* Construct a wrapper around an existing game profile. * Construct a wrapper around an existing game profile.
* *
* @param profile - the underlying profile, or NULL. * @param handle - the underlying profile, or NULL.
*/ */
public static WrappedGameProfile fromHandle(Object handle) { public static WrappedGameProfile fromHandle(Object handle) {
if (handle == null) if (handle == null)

Datei anzeigen

@ -175,7 +175,7 @@ public class WrappedServerPing extends AbstractWrapper {
/** /**
* Set the message of the day. * Set the message of the day.
* @param description - the message. * @param message - the message.
*/ */
public void setMotD(String message) { public void setMotD(String message) {
setMotD(WrappedChatComponent.fromText(message)); setMotD(WrappedChatComponent.fromText(message));
@ -200,9 +200,9 @@ public class WrappedServerPing extends AbstractWrapper {
/** /**
* Retrieve the displayed number of online players. * Retrieve the displayed number of online players.
* @see {@link #setPlayersOnline(int)} for more information.
* @return The displayed number. * @return The displayed number.
* @throws IllegalStateException If the player count has been hidden via {@link #setPlayersVisible(boolean)}. * @throws IllegalStateException If the player count has been hidden via {@link #setPlayersVisible(boolean)}.
* @see #setPlayersOnline(int)
*/ */
public int getPlayersOnline() { public int getPlayersOnline() {
if (players == null) if (players == null)
@ -225,9 +225,9 @@ public class WrappedServerPing extends AbstractWrapper {
/** /**
* Retrieve the displayed maximum number of players. * Retrieve the displayed maximum number of players.
* @see {@link #setPlayersMaximum(int)} for more information.
* @return The maximum number. * @return The maximum number.
* @throws IllegalStateException If the player maximum has been hidden via {@link #setPlayersVisible(boolean)}. * @throws IllegalStateException If the player maximum has been hidden via {@link #setPlayersVisible(boolean)}.
* @see #setPlayersMaximum(int)
*/ */
public int getPlayersMaximum() { public int getPlayersMaximum() {
if (players == null) if (players == null)

Datei anzeigen

@ -15,7 +15,6 @@ public class WrappedSignedProperty extends AbstractWrapper {
* @param name - the name of the property. * @param name - the name of the property.
* @param value - the value of the property. * @param value - the value of the property.
* @param signature - the BASE64-encoded signature of the value. * @param signature - the BASE64-encoded signature of the value.
* @return The signed property.
*/ */
public WrappedSignedProperty(String name, String value, String signature) { public WrappedSignedProperty(String name, String value, String signature) {
this(new Property(name, value, signature)); this(new Property(name, value, signature));

Datei anzeigen

@ -46,7 +46,7 @@ public class WrappedStatistic extends AbstractWrapper {
/** /**
* Construct a wrapper around an existing game profile. * Construct a wrapper around an existing game profile.
* @param profile - the underlying profile. * @param name - statistic name.
* @return The wrapped statistics, or NULL if not found. * @return The wrapped statistics, or NULL if not found.
*/ */
public static WrappedStatistic fromName(String name) { public static WrappedStatistic fromName(String name) {
@ -63,6 +63,7 @@ public class WrappedStatistic extends AbstractWrapper {
Map<Object, Object> map = (Map<Object, Object>) MAP_ACCESSOR.get(null); Map<Object, Object> map = (Map<Object, Object>) MAP_ACCESSOR.get(null);
return Iterables.transform(map.values(), new Function<Object, WrappedStatistic>() { return Iterables.transform(map.values(), new Function<Object, WrappedStatistic>() {
@Override
public WrappedStatistic apply(Object handle) { public WrappedStatistic apply(Object handle) {
return fromHandle(handle); return fromHandle(handle);
}; };

Datei anzeigen

@ -186,6 +186,7 @@ public class WrappedWatchableObject extends AbstractWrapper {
* Retrieve the type ID of a watchable object. * Retrieve the type ID of a watchable object.
* <p> * <p>
* <table border=1> * <table border=1>
* <caption>Type to Value</caption>
* <tbody> * <tbody>
* <tr> * <tr>
* <th>Type ID</th> * <th>Type ID</th>
@ -230,9 +231,9 @@ public class WrappedWatchableObject extends AbstractWrapper {
/** /**
* Set the type ID of a watchable object. * Set the type ID of a watchable object.
* @see {@link #getTypeID()} for more information.
* @param id - the new ID. * @param id - the new ID.
* @throws FieldAccessException Reflection failed. * @throws FieldAccessException Reflection failed.
* @see #getTypeID()
*/ */
public void setTypeID(int id) throws FieldAccessException { public void setTypeID(int id) throws FieldAccessException {
modifier.<Integer>withType(int.class).write(0, id); modifier.<Integer>withType(int.class).write(0, id);

Datei anzeigen

@ -19,7 +19,7 @@ import javax.annotation.Nonnull;
*/ */
public interface NbtCompound extends NbtBase<Map<String, NbtBase<?>>>, Iterable<NbtBase<?>> { public interface NbtCompound extends NbtBase<Map<String, NbtBase<?>>>, Iterable<NbtBase<?>> {
@Override @Override
@Deprecated() @Deprecated
public Map<String, NbtBase<?>> getValue(); public Map<String, NbtBase<?>> getValue();
/** /**
@ -260,7 +260,7 @@ public interface NbtCompound extends NbtBase<Map<String, NbtBase<?>>>, Iterable<
public abstract NbtCompound put(String key, int[] value); public abstract NbtCompound put(String key, int[] value);
/** /**
* Associates a given Java primitive value, list, map or NbtBase<?> with a certain key. * Associates a given Java primitive value, list, map or NbtBase with a certain key.
* <p> * <p>
* If the value is NULL, the corresponding key is removed. Any Map or List will be converted * If the value is NULL, the corresponding key is removed. Any Map or List will be converted
* to a corresponding NbtCompound or NbtList. * to a corresponding NbtCompound or NbtList.
@ -341,5 +341,6 @@ public interface NbtCompound extends NbtBase<Map<String, NbtBase<?>>>, Iterable<
* Retrieve an iterator view of the NBT tags stored in this compound. * Retrieve an iterator view of the NBT tags stored in this compound.
* @return The tags stored in this compound. * @return The tags stored in this compound.
*/ */
@Override
public abstract Iterator<NbtBase<?>> iterator(); public abstract Iterator<NbtBase<?>> iterator();
} }

Datei anzeigen

@ -131,7 +131,7 @@ public class NbtFactory {
* Set the NBT compound tag of a given item stack. * Set the NBT compound tag of a given item stack.
* <p> * <p>
* The item stack must be a wrapper for a CraftItemStack. Use * The item stack must be a wrapper for a CraftItemStack. Use
* {@link MinecraftReflection#getBukkitItemStack(ItemStack)} if not. * {@link MinecraftReflection#getCraftItemStack(ItemStack)} if not.
* @param stack - the item stack, cannot be air. * @param stack - the item stack, cannot be air.
* @param compound - the new NBT compound, or NULL to remove it. * @param compound - the new NBT compound, or NULL to remove it.
* @throws IllegalArgumentException If the stack is not a CraftItemStack, or it represents air. * @throws IllegalArgumentException If the stack is not a CraftItemStack, or it represents air.
@ -149,7 +149,7 @@ public class NbtFactory {
* material, damage value or count. * material, damage value or count.
* <p> * <p>
* The item stack must be a wrapper for a CraftItemStack. Use * The item stack must be a wrapper for a CraftItemStack. Use
* {@link MinecraftReflection#getBukkitItemStack(ItemStack)} if not. * {@link MinecraftReflection#getCraftItemStack(ItemStack)} if not.
* @param stack - the item stack. * @param stack - the item stack.
* @return A wrapper for its NBT tag. * @return A wrapper for its NBT tag.
*/ */
@ -219,7 +219,7 @@ public class NbtFactory {
/** /**
* Retrieve the NBT tile entity that represents the given block. * Retrieve the NBT tile entity that represents the given block.
* @param state - the block state. * @param block - the block.
* @return The NBT compound, or NULL if the state doesn't have a tile entity. * @return The NBT compound, or NULL if the state doesn't have a tile entity.
*/ */
public static NbtCompound readBlockState(Block block) { public static NbtCompound readBlockState(Block block) {
@ -519,7 +519,7 @@ public class NbtFactory {
if (type == NbtType.TAG_COMPOUND) if (type == NbtType.TAG_COMPOUND)
return (NbtWrapper<T>) new WrappedCompound(handle); return (NbtWrapper<T>) new WrappedCompound(handle);
else if (type == NbtType.TAG_LIST) else if (type == NbtType.TAG_LIST)
return (NbtWrapper<T>) new WrappedList(handle); return new WrappedList(handle);
else else
return new WrappedElement<T>(handle); return new WrappedElement<T>(handle);
} }
@ -532,7 +532,7 @@ public class NbtFactory {
if (type == NbtType.TAG_COMPOUND) if (type == NbtType.TAG_COMPOUND)
return (NbtWrapper<T>) new WrappedCompound(handle, name); return (NbtWrapper<T>) new WrappedCompound(handle, name);
else if (type == NbtType.TAG_LIST) else if (type == NbtType.TAG_LIST)
return (NbtWrapper<T>) new WrappedList(handle, name); return new WrappedList(handle, name);
else else
return new WrappedElement<T>(handle, name); return new WrappedElement<T>(handle, name);
} }

Datei anzeigen

@ -116,7 +116,7 @@ public interface NbtList<TType> extends NbtBase<List<NbtBase<TType>>>, Iterable<
* Retrieve an element by index. * Retrieve an element by index.
* @param index - index of the element to retrieve. * @param index - index of the element to retrieve.
* @return The element to retrieve. * @return The element to retrieve.
* @throws IndexOutOfBoundsException If the index is out of range (index < 0 || index >= size()) * @throws IndexOutOfBoundsException If the index is out of range
*/ */
public abstract TType getValue(int index); public abstract TType getValue(int index);
@ -135,5 +135,6 @@ public interface NbtList<TType> extends NbtBase<List<NbtBase<TType>>>, Iterable<
/** /**
* Iterate over all the elements in this list. * Iterate over all the elements in this list.
*/ */
@Override
public abstract Iterator<TType> iterator(); public abstract Iterator<TType> iterator();
} }