mirror of
https://github.com/dmulloy2/ProtocolLib.git
synced 2024-11-24 03:25:29 +01:00
Fix a ton of JavaDoc errors
This commit is contained in:
parent
241003b56a
commit
bba1054f97
@ -321,7 +321,7 @@ public class CommandFilter extends CommandBase {
|
||||
* @param event - the event.
|
||||
* @param handler - failure handler.
|
||||
* @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) {
|
||||
for (Iterator<Filter> it = filters.iterator(); it.hasNext(); ) {
|
||||
|
@ -823,6 +823,7 @@ public class PacketType implements Serializable, Comparable<PacketType> {
|
||||
* Construct a legacy packet type.
|
||||
* @param sender - client or server.
|
||||
* @param legacyId - the legacy packet ID.
|
||||
* @return Legacy packet type
|
||||
*/
|
||||
public static PacketType newLegacy(Sender sender, int legacyId) {
|
||||
return new PacketType(Protocol.LEGACY, sender, PacketType.UNKNOWN_PACKET, legacyId, MinecraftVersion.WORLD_UPDATE);
|
||||
|
@ -423,7 +423,7 @@ public class ProtocolConfig {
|
||||
|
||||
/**
|
||||
* Set the starting injection method to use.
|
||||
* @return Injection method.
|
||||
* @param hook Injection method
|
||||
*/
|
||||
public void setInjectionMethod(PlayerInjectHooks hook) {
|
||||
setConfig(global, INJECTION_METHOD, hook.name());
|
||||
|
@ -199,7 +199,7 @@ public interface ProtocolManager extends PacketStream {
|
||||
|
||||
/**
|
||||
* 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.
|
||||
* @return The packet constructor.
|
||||
*/
|
||||
|
@ -373,7 +373,6 @@ public class AsyncFilterManager implements AsynchronousManager {
|
||||
|
||||
/**
|
||||
* 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.
|
||||
* @return An async marker.
|
||||
*/
|
||||
@ -473,6 +472,8 @@ public class AsyncFilterManager implements AsynchronousManager {
|
||||
|
||||
/**
|
||||
* 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) {
|
||||
// The server queue is unlikely to need checking that often
|
||||
|
@ -402,6 +402,7 @@ public class AsyncMarker implements Serializable, Comparable<AsyncMarker> {
|
||||
/**
|
||||
* Determine if Minecraft allows asynchronous processing of this packet.
|
||||
* @return TRUE if it does, FALSE otherwise.
|
||||
* @throws FieldAccessException If determining fails for some reasaon
|
||||
*/
|
||||
public boolean isMinecraftAsync(PacketEvent event) throws FieldAccessException {
|
||||
if (isMinecraftAsync == null && !alwaysSync) {
|
||||
|
@ -35,6 +35,7 @@ public interface AsyncRunnable extends Runnable {
|
||||
* <p>
|
||||
* This may not occur right away.
|
||||
* @return TRUE if the thread was stopped, FALSE if it was already stopped.
|
||||
* @throws InterruptedException if it is interrupted
|
||||
*/
|
||||
public boolean stop() throws InterruptedException;
|
||||
|
||||
|
@ -18,6 +18,7 @@ public class IntegerMap<T> {
|
||||
|
||||
/**
|
||||
* Construct a new integer map.
|
||||
* @param <T> Parameter type
|
||||
* @return A new integer map.
|
||||
*/
|
||||
public static <T> IntegerMap<T> newMap() {
|
||||
|
@ -149,6 +149,7 @@ public abstract class AbstractIntervalTree<TKey extends Comparable<TKey>, TValue
|
||||
* @param lowerBound - lowest value to remove.
|
||||
* @param upperBound - highest value to remove.
|
||||
* @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) {
|
||||
checkBounds(lowerBound, upperBound);
|
||||
|
@ -48,6 +48,8 @@ public class BlockingHashMap<TKey, TValue> {
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
public static <TKey, TValue> CacheLoader<TKey, TValue> newInvalidCacheLoader() {
|
||||
@ -83,6 +85,8 @@ public class BlockingHashMap<TKey, TValue> {
|
||||
|
||||
/**
|
||||
* Initialize a new map.
|
||||
* @param <TKey> Type of the key
|
||||
* @param <TValue> Type of the value
|
||||
* @return The created map.
|
||||
*/
|
||||
public static <TKey, TValue> BlockingHashMap<TKey, TValue> create() {
|
||||
|
@ -6,7 +6,6 @@ import java.util.Iterator;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ConcurrentMap;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
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.
|
||||
* @param <T> Parameter type
|
||||
* @return Concurrent player map.
|
||||
*/
|
||||
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.
|
||||
* @param <T> Parameter type
|
||||
* @return Concurrent player map.
|
||||
*/
|
||||
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.
|
||||
* @param key - the key of the player we are locating.
|
||||
* @return The player, or NULL if not found.
|
||||
* @throws ExecutionException
|
||||
*/
|
||||
protected Player lookupPlayer(Object key) {
|
||||
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
|
||||
return new Iterator<Entry<Player, TValue>>() {
|
||||
@Override
|
||||
public boolean hasNext() {
|
||||
return filtered.hasNext();
|
||||
}
|
||||
@Override
|
||||
public Entry<Player, TValue> next() {
|
||||
return filtered.next();
|
||||
}
|
||||
@Override
|
||||
public void remove() {
|
||||
source.remove();
|
||||
}
|
||||
|
@ -67,7 +67,7 @@ public class IntegerSet {
|
||||
/**
|
||||
* Add the given element to the set, or do nothing if it already exists.
|
||||
* @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) {
|
||||
array[element] = true;
|
||||
|
@ -65,7 +65,7 @@ public class PacketTypeSet {
|
||||
|
||||
/**
|
||||
* 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) {
|
||||
for (PacketType type : types) {
|
||||
|
@ -93,6 +93,7 @@ public class DetailedErrorReporter implements ErrorReporter {
|
||||
|
||||
/**
|
||||
* Create a default error reporting system.
|
||||
* @param plugin - the plugin owner.
|
||||
*/
|
||||
public DetailedErrorReporter(Plugin plugin) {
|
||||
this(plugin, DEFAULT_PREFIX, DEFAULT_SUPPORT_URL);
|
||||
|
@ -56,7 +56,7 @@ public interface ErrorReporter {
|
||||
/**
|
||||
* Prints a debug message from the current sender.
|
||||
* @param sender - the sender.
|
||||
* @param report - the report builder.
|
||||
* @param builder - the report builder.
|
||||
*/
|
||||
public abstract void reportDebug(Object sender, ReportBuilder builder);
|
||||
|
||||
|
@ -157,7 +157,7 @@ public class Report {
|
||||
|
||||
/**
|
||||
* 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.
|
||||
* @return Message parameters.
|
||||
*/
|
||||
|
@ -47,7 +47,7 @@ public enum ListenerPriority {
|
||||
HIGHEST(4),
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
MONITOR(5);
|
||||
|
@ -442,7 +442,7 @@ public class ListeningWhitelist {
|
||||
|
||||
/**
|
||||
* Set the options to copy when constructing new whitelists.
|
||||
* @param options - the options array.
|
||||
* @param serverOptions - the options array.
|
||||
* @return This builder, for chaining.
|
||||
*/
|
||||
public Builder options(ListenerOptions[] serverOptions) {
|
||||
@ -452,7 +452,7 @@ public class ListeningWhitelist {
|
||||
|
||||
/**
|
||||
* Options to merge into the current set of options.
|
||||
* @param options - the options array.
|
||||
* @param serverOptions - the options array.
|
||||
* @return This builder, for chaining.
|
||||
*/
|
||||
public Builder mergeOptions(ListenerOptions... serverOptions) {
|
||||
@ -461,7 +461,7 @@ public class ListeningWhitelist {
|
||||
|
||||
/**
|
||||
* Options to merge into the current set of options.
|
||||
* @param options - the options array.
|
||||
* @param serverOptions - the options array.
|
||||
* @return This builder, for chaining.
|
||||
*/
|
||||
public Builder mergeOptions(Collection<ListenerOptions> serverOptions) {
|
||||
|
@ -68,8 +68,9 @@ public abstract class NetworkMarker {
|
||||
|
||||
/**
|
||||
* 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 type - packet type
|
||||
*/
|
||||
public NetworkMarker(@Nonnull ConnectionSide side, ByteBuffer inputBuffer, PacketType type) {
|
||||
this.side = Preconditions.checkNotNull(side, "side cannot be NULL.");
|
||||
@ -81,9 +82,9 @@ public abstract class NetworkMarker {
|
||||
* Construct a new network marker.
|
||||
* <p>
|
||||
* 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 handler - handle skipping headers.
|
||||
* @param type - packet type
|
||||
*/
|
||||
public NetworkMarker(@Nonnull ConnectionSide side, byte[] inputBuffer, PacketType type) {
|
||||
this.side = Preconditions.checkNotNull(side, "side cannot be NULL.");
|
||||
@ -325,6 +326,8 @@ public abstract class NetworkMarker {
|
||||
* <p>
|
||||
* It's safe to modify the position of the buffer.
|
||||
* @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 {
|
||||
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.
|
||||
* <p>
|
||||
* It's safe to modify the input stream.
|
||||
* @throws IOException If integer reading fails
|
||||
*/
|
||||
protected abstract DataInputStream skipHeader(DataInputStream input) throws IOException;
|
||||
|
||||
|
@ -58,7 +58,6 @@ public abstract class PacketAdapter implements PacketListener {
|
||||
/**
|
||||
* Initialize a packet listener with the given parameters.
|
||||
* @param plugin - the plugin.
|
||||
* @param listenerPriority - the priority.
|
||||
* @param types - the packet types.
|
||||
*/
|
||||
public PacketAdapter(Plugin plugin, PacketType... types) {
|
||||
|
@ -164,10 +164,9 @@ public class PacketContainer implements Serializable {
|
||||
|
||||
/**
|
||||
* Creates a packet container for an existing packet.
|
||||
* <p>
|
||||
* Deprecated: Use {@link #PacketContainer(PacketType, Object))} instead.
|
||||
* @param id - ID of the given packet.
|
||||
* @param handle - contained packet.
|
||||
* @deprecated Use {@link #PacketContainer(PacketType, Object)} instead
|
||||
*/
|
||||
@Deprecated
|
||||
public PacketContainer(int id, Object handle) {
|
||||
@ -176,11 +175,10 @@ public class PacketContainer implements Serializable {
|
||||
|
||||
/**
|
||||
* 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 handle - contained packet.
|
||||
* @param structure - structure modifier.
|
||||
* @deprecated Use {@link #PacketContainer(PacketType, Object, StructureModifier)} instead
|
||||
*/
|
||||
@Deprecated
|
||||
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.
|
||||
* @param id - ID of the given packet.
|
||||
* @param type - Type of the given packet.
|
||||
* @param handle - contained packet.
|
||||
*/
|
||||
public PacketContainer(PacketType type, Object handle) {
|
||||
@ -206,7 +204,7 @@ public class PacketContainer implements Serializable {
|
||||
|
||||
/**
|
||||
* 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 structure - structure modifier.
|
||||
*/
|
||||
@ -255,6 +253,7 @@ public class PacketContainer implements Serializable {
|
||||
|
||||
/**
|
||||
* Retrieves a read/write structure for every field with the given type.
|
||||
* @param <T> Type
|
||||
* @param primitiveType - the type to find.
|
||||
* @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>
|
||||
* <ul>
|
||||
* <li>{@link PacketType.Play.Server.PLAYER_INFO}</li>
|
||||
* <li>{@link PacketType.Play.Server#PLAYER_INFO}
|
||||
* </ul>
|
||||
* @return A modifier for PlayerInfoData list fields.
|
||||
*/
|
||||
|
@ -43,7 +43,7 @@ public interface PacketListener {
|
||||
/**
|
||||
* Invoked right before a received packet from a client is being processed.
|
||||
* <p>
|
||||
* <b>WARNING</b>: </br>
|
||||
* <b>WARNING</b>: <br>
|
||||
* 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}
|
||||
* if you need to call the Bukkit API.
|
||||
|
@ -38,8 +38,8 @@ import com.google.common.primitives.Primitives;
|
||||
* <p>
|
||||
* Typical conversions include:
|
||||
* <ul>
|
||||
* <li>org.bukkit.entity.Player -> net.minecraft.server.EntityPlayer</li>
|
||||
* <li>org.bukkit.World -> net.minecraft.server.WorldServer</li>
|
||||
* <li>org.bukkit.entity.Player to net.minecraft.server.EntityPlayer</li>
|
||||
* <li>org.bukkit.World to net.minecraft.server.WorldServer</li>
|
||||
* </ul>
|
||||
*
|
||||
* @author Kristian
|
||||
|
@ -66,6 +66,7 @@ public class NetworkProcessor {
|
||||
|
||||
/**
|
||||
* Invoke the post listeners and packet transmission, if any.
|
||||
* @param event - PacketEvent
|
||||
* @param marker - the network marker, or NULL.
|
||||
*/
|
||||
public void invokePostEvent(PacketEvent event, NetworkMarker marker) {
|
||||
|
@ -104,7 +104,7 @@ public class PacketConstructor {
|
||||
/**
|
||||
* Create a packet constructor that creates packets using the given ID.
|
||||
* <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>
|
||||
* Deprecated: Use {@link #withPacket(PacketType, Object[])} instead.
|
||||
* @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.
|
||||
* <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 values - the values that will match each parameter in the desired constructor.
|
||||
* @return A packet constructor with these types.
|
||||
|
@ -223,7 +223,8 @@ public final class PacketFilterManager implements ProtocolManager, ListenerInvok
|
||||
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) {
|
||||
// Used to determine if injection is needed
|
||||
|
@ -201,7 +201,7 @@ public class NettyProtocolInjector implements ChannelListener {
|
||||
|
||||
/**
|
||||
* Inject our packet handling into a specific player.
|
||||
* @param player
|
||||
* @param player Player to inject into
|
||||
*/
|
||||
public void injectPlayer(Player player) {
|
||||
injectionFactory.fromPlayer(player, this).inject();
|
||||
|
@ -116,7 +116,10 @@ public class InterceptWritePacket {
|
||||
|
||||
/**
|
||||
* 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")
|
||||
public Object constructProxy(Object proxyObject, PacketEvent event, NetworkMarker marker) {
|
||||
|
@ -139,6 +139,7 @@ public class PacketRegistry {
|
||||
if (NETTY != null) {
|
||||
@SuppressWarnings("unchecked")
|
||||
Map<Class, Integer> result = (Map)Maps.transformValues(NETTY.getPacketClassLookup(), new Function<PacketType, Integer>() {
|
||||
@Override
|
||||
public Integer apply(PacketType type) {
|
||||
return type.getLegacyId();
|
||||
};
|
||||
@ -161,6 +162,7 @@ public class PacketRegistry {
|
||||
return result;
|
||||
}
|
||||
return Maps.transformValues(LEGACY.getPacketToID(), new Function<Integer, PacketType>() {
|
||||
@Override
|
||||
public PacketType apply(Integer packetId) {
|
||||
return PacketType.findLegacy(packetId);
|
||||
};
|
||||
@ -298,7 +300,7 @@ public class PacketRegistry {
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
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.
|
||||
* @param types - legacy packet IDs.
|
||||
* @param ids - legacy packet IDs.
|
||||
* @param preference - the sender preference, if any.
|
||||
* @return Set of packet types.
|
||||
*/
|
||||
|
@ -129,7 +129,7 @@ public interface PlayerInjectionHandler {
|
||||
* Send the given packet to the given receiver.
|
||||
* @param receiver - the player receiver.
|
||||
* @param packet - the packet to send.
|
||||
* @param marker
|
||||
* @param marker - network marker.
|
||||
* @param filters - whether or not to invoke the packet filters.
|
||||
* @throws InvocationTargetException If an error occurred during sending.
|
||||
*/
|
||||
|
@ -156,6 +156,7 @@ public abstract class PlayerInjector implements SocketInjector {
|
||||
|
||||
/**
|
||||
* Initialize all fields for this player injector, if it hasn't already.
|
||||
* @param injectionSource - Injection source
|
||||
* @throws IllegalAccessException An error has occured.
|
||||
*/
|
||||
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.
|
||||
* @boolean refresh - Whether or not to refresh
|
||||
* @return Current 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.
|
||||
* @param GamePhase - Game phase
|
||||
* @return TRUE if can be attempted, though possibly with failure, FALSE otherwise.
|
||||
*/
|
||||
public abstract boolean canInject(GamePhase state);
|
||||
|
@ -47,6 +47,7 @@ public interface SocketInjector {
|
||||
|
||||
/**
|
||||
* Retrieve the hooked player.
|
||||
* @return The hooked player.
|
||||
*/
|
||||
public abstract Player getPlayer();
|
||||
|
||||
|
@ -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.
|
||||
*
|
||||
* @throws java.io.IOException
|
||||
* @throws IOException If configuration saving fails
|
||||
*/
|
||||
public void enable() throws IOException {
|
||||
// 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.
|
||||
*
|
||||
* @throws java.io.IOException
|
||||
* @throws IOException If configuration saving fails
|
||||
*/
|
||||
public void disable() throws IOException {
|
||||
// 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
|
||||
*
|
||||
* @throws IOException If posting fails
|
||||
*/
|
||||
private void postPlugin(final boolean isPing) throws IOException {
|
||||
// Server software specific section
|
||||
@ -496,8 +498,8 @@ public class Metrics {
|
||||
/**
|
||||
* GZip compress a string of bytes
|
||||
*
|
||||
* @param input
|
||||
* @return
|
||||
* @param input Input to compress
|
||||
* @return Compressed string
|
||||
*/
|
||||
public static byte[] gzip(String input) {
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
@ -532,14 +534,7 @@ public class Metrics {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Appends a json encoded key/value pair to the given string builder.
|
||||
*
|
||||
* @param json
|
||||
* @param key
|
||||
* @param value
|
||||
* @throws UnsupportedEncodingException
|
||||
*/
|
||||
// Appends a json encoded key/value pair to the given string builder.
|
||||
private static void appendJSONPair(StringBuilder json, String key, String value) throws UnsupportedEncodingException {
|
||||
boolean isValueNumeric = false;
|
||||
|
||||
@ -566,12 +561,7 @@ public class Metrics {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Escape a string to create a valid JSON string
|
||||
*
|
||||
* @param text
|
||||
* @return
|
||||
*/
|
||||
// Escape a string to create a valid JSON string
|
||||
private static String escapeJSON(String text) {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
|
||||
@ -612,12 +602,7 @@ public class Metrics {
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Encode text as UTF-8
|
||||
*
|
||||
* @param text the text to encode
|
||||
* @return the encoded text, as UTF-8
|
||||
*/
|
||||
// Encode text as UTF-8
|
||||
private static String urlEncode(final String text) throws UnsupportedEncodingException {
|
||||
return URLEncoder.encode(text, "UTF-8");
|
||||
}
|
||||
|
@ -68,7 +68,7 @@ public class ClassAnalyser {
|
||||
/**
|
||||
* Retrieve the associated owner class.
|
||||
* @return The owner class.
|
||||
* @throws ClassNotFoundException
|
||||
* @throws ClassNotFoundException If the class was not found
|
||||
*/
|
||||
public Class<?> getOwnerClass() throws ClassNotFoundException {
|
||||
return AsmMethod.class.getClassLoader().loadClass(getOwnerName().replace('/', '.'));
|
||||
|
@ -93,6 +93,7 @@ public class FuzzyReflection {
|
||||
|
||||
/**
|
||||
* Retrieve the value of the first field of the given type.
|
||||
* @param <T> Type
|
||||
* @param instance - the instance to retrieve from.
|
||||
* @param fieldClass - type of the field to retrieve.
|
||||
* @param forceAccess - whether or not to look for private and protected fields.
|
||||
@ -107,6 +108,7 @@ public class FuzzyReflection {
|
||||
|
||||
/**
|
||||
* Retrieves the underlying class.
|
||||
* @return The underlying class.
|
||||
*/
|
||||
public Class<?> getSource() {
|
||||
return source;
|
||||
|
@ -893,7 +893,7 @@ public class MethodUtils {
|
||||
* Compatible parameters mean that every method parameter is assignable from
|
||||
* the given parameters.
|
||||
* 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
|
||||
* through methods names and return the first matching method.</p>
|
||||
@ -1298,6 +1298,7 @@ public class MethodUtils {
|
||||
* @param obj object to be tested for equality
|
||||
* @return true, if the object describes the same Method.
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (!(obj instanceof MethodDescriptor)) {
|
||||
return false;
|
||||
@ -1318,6 +1319,7 @@ public class MethodUtils {
|
||||
* determine equality.
|
||||
* @return the string length of method name.
|
||||
*/
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return hashCode;
|
||||
}
|
||||
|
@ -39,6 +39,7 @@ public class ObjectEnum<T> implements Iterable<T> {
|
||||
|
||||
/**
|
||||
* Registers every declared integer field.
|
||||
* @param fieldType Field type
|
||||
*/
|
||||
public ObjectEnum(Class<T> fieldType) {
|
||||
registerAll(fieldType);
|
||||
@ -46,6 +47,7 @@ public class ObjectEnum<T> implements Iterable<T> {
|
||||
|
||||
/**
|
||||
* Registers every public assignable static field as a member.
|
||||
* @param fieldType Field type
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
protected void registerAll(Class<T> fieldType) {
|
||||
|
@ -62,10 +62,10 @@ public class PrettyPrinter {
|
||||
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.
|
||||
* @return String representation of the class.
|
||||
* @throws IllegalAccessException
|
||||
* @throws IllegalAccessException If the object is null
|
||||
*/
|
||||
public static String printObject(Object object) throws IllegalAccessException {
|
||||
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 start - class to start at.
|
||||
* @param stop - superclass that will stop the process.
|
||||
* @return String representation of the class.
|
||||
* @throws IllegalAccessException
|
||||
* @return String representation of the class
|
||||
* @throws IllegalAccessException If the object is null
|
||||
*/
|
||||
public static String printObject(Object object, Class<?> start, Class<?> stop) throws IllegalAccessException {
|
||||
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 start - class to start at.
|
||||
* @param stop - superclass that will stop the process.
|
||||
* @param hierachyDepth - maximum recursion level.
|
||||
* @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 {
|
||||
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 start - class to start at.
|
||||
* @param stop - superclass that will stop the process.
|
||||
* @param hierachyDepth - maximum recursion level.
|
||||
* @param printer - a generic object printer.
|
||||
* @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 {
|
||||
if (object == null)
|
||||
|
@ -393,6 +393,7 @@ public class StructureModifier<TField> {
|
||||
|
||||
/**
|
||||
* 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.
|
||||
* @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.
|
||||
* @param <T> Type
|
||||
* @param fieldType - the type, or supertype, of every field to modify.
|
||||
* @param converter - converts objects into the given 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.
|
||||
* @param <T> Type
|
||||
* @param fieldType - common type of each field.
|
||||
* @param filtered - list of fields after filtering the original modifier.
|
||||
* @param defaults - list of default values after filtering the original.
|
||||
* @param converter - the new converter
|
||||
* @return A new structure modifier.
|
||||
*/
|
||||
protected <T> StructureModifier<T> withFieldType(
|
||||
@ -520,6 +522,7 @@ public class StructureModifier<TField> {
|
||||
|
||||
/**
|
||||
* Create a new structure modifier for the new field type.
|
||||
* @param <T> Type
|
||||
* @param fieldType - common type of each field.
|
||||
* @param filtered - list of fields after filtering the original modifier.
|
||||
* @param defaults - list of default values after filtering the original.
|
||||
|
@ -200,6 +200,7 @@ public class VolatileField {
|
||||
|
||||
/**
|
||||
* Determine whether or not we'll need to revert the value.
|
||||
* @return True if it is set, false if not.
|
||||
*/
|
||||
public boolean isCurrentSet() {
|
||||
return currentSet;
|
||||
|
@ -78,7 +78,7 @@ public final class Accessors {
|
||||
/**
|
||||
* Retrieve an accessor for the first field of the given type.
|
||||
* @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.
|
||||
* @return The value of that field.
|
||||
* @throws IllegalArgumentException If the field cannot be found.
|
||||
|
@ -26,6 +26,7 @@ public class SerializableCloner implements Cloner {
|
||||
|
||||
/**
|
||||
* Clone the given object using serialization.
|
||||
* @param <T> Type
|
||||
* @param obj - the object to clone.
|
||||
* @return The cloned object.
|
||||
* @throws RuntimeException If we were unable to clone the object.
|
||||
|
@ -158,6 +158,7 @@ public class BackgroundCompiler {
|
||||
|
||||
/**
|
||||
* Ensure that the given structure modifier is eventually compiled.
|
||||
* @param <TKey> Type
|
||||
* @param uncompiled - structure modifier to compile.
|
||||
* @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.
|
||||
* @param <TKey> Type
|
||||
* @param uncompiled - the structure modifier that may get compiled.
|
||||
* @param listener - the listener to invoke in that case.
|
||||
*/
|
||||
|
@ -157,6 +157,7 @@ public final class StructureCompiler {
|
||||
|
||||
/**
|
||||
* 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.
|
||||
* @return TRUE if we successfully found a previously generated class, FALSE otherwise.
|
||||
*/
|
||||
|
@ -87,7 +87,7 @@ public abstract class AbstractFuzzyMember<T extends Member> extends AbstractFuzz
|
||||
|
||||
/**
|
||||
* Set the exact name of the member we are matching.
|
||||
* <p<
|
||||
* <p>
|
||||
* This will overwrite the regular expression rule.
|
||||
* @param name - exact name.
|
||||
* @return This builder, for chaining.
|
||||
|
@ -93,6 +93,7 @@ public class FuzzyMethodContract extends AbstractFuzzyMember<MethodInfo> {
|
||||
* @author Kristian
|
||||
*/
|
||||
public static class Builder extends AbstractFuzzyMember.Builder<FuzzyMethodContract> {
|
||||
@Override
|
||||
public Builder requireModifier(int modifier) {
|
||||
super.requireModifier(modifier);
|
||||
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.
|
||||
* @param type - the types of every parameters in order.
|
||||
* @param types - the types of every parameters in order.
|
||||
* @return This builder, for chaining.
|
||||
*/
|
||||
public Builder parameterExactArray(Class<?>... types) {
|
||||
|
@ -157,7 +157,7 @@ public class DefaultInstances implements InstanceProvider {
|
||||
* <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>
|
||||
* </ul>
|
||||
* </ul>
|
||||
* @param <T> Type
|
||||
* @param type - the type to construct a default value.
|
||||
* @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.
|
||||
* @param <T> Type
|
||||
* @param type - type to construct.
|
||||
* @return A constructor with the fewest number of parameters, or NULL if the type has no constructors.
|
||||
*/
|
||||
@ -240,7 +241,7 @@ public class DefaultInstances implements InstanceProvider {
|
||||
* <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>
|
||||
* </ul>
|
||||
* </ul>
|
||||
* @param <T> Type
|
||||
* @param type - the type to construct a default value.
|
||||
* @param providers - instance providers used during the construction.
|
||||
* @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.
|
||||
* The default method uses reflection.
|
||||
* @param <T> Type
|
||||
* @param type - the type to create.
|
||||
* @param constructor - the constructor to use.
|
||||
* @param types - type of each parameter in order.
|
||||
|
@ -21,6 +21,7 @@ public class NotConstructableException extends IllegalArgumentException {
|
||||
|
||||
/**
|
||||
* Construct a new not constructable exception with a custom message.
|
||||
* @param message - detail message
|
||||
*/
|
||||
public NotConstructableException(String message) {
|
||||
super(message);
|
||||
@ -28,6 +29,8 @@ public class NotConstructableException extends IllegalArgumentException {
|
||||
|
||||
/**
|
||||
* 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) {
|
||||
super(message, cause);
|
||||
@ -35,6 +38,7 @@ public class NotConstructableException extends IllegalArgumentException {
|
||||
|
||||
/**
|
||||
* Construct a new not constructable exception with a custom cause.
|
||||
* @param cause - cause
|
||||
*/
|
||||
public NotConstructableException(Throwable cause) {
|
||||
super( cause);
|
||||
|
@ -107,6 +107,7 @@ public class StatisticsStream extends OnlineComputation {
|
||||
/**
|
||||
* Combine the two statistics.
|
||||
* @param other - the other statistics.
|
||||
* @return Combined statistics
|
||||
*/
|
||||
public StatisticsStream add(StatisticsStream other) {
|
||||
// Special cases
|
||||
|
@ -26,7 +26,7 @@ public class TimedTracker {
|
||||
/**
|
||||
* Stop and record the execution time since the creation of the given 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) {
|
||||
StatisticsStream stream = packets.get(type);
|
||||
|
@ -172,6 +172,7 @@ public class ChatExtensions {
|
||||
* @param marginChar - the character to use as 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.
|
||||
* @return Flowerboxed message
|
||||
*/
|
||||
public static String[] toFlowerBox(String[] message, String marginChar, int marginWidth, int marginHeight) {
|
||||
String[] output = new String[message.length + marginHeight * 2];
|
||||
|
@ -23,6 +23,7 @@ public class HexDumper {
|
||||
/**
|
||||
* Retrieve a hex dumper tuned for lines of 80 characters:
|
||||
* <table border="1">
|
||||
* <caption>Values</caption>
|
||||
* <tr>
|
||||
* <th>Property</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.
|
||||
* <p>
|
||||
* 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.
|
||||
*/
|
||||
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.
|
||||
* @param appendable - appendable source.
|
||||
* @param data - the data to dump.
|
||||
* @param start - the starting index of the data.
|
||||
* @param length - the number of bytes to dump.
|
||||
* @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.
|
||||
* @param builder - the builder.
|
||||
* @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) {
|
||||
appendTo(builder, data, 0, data.length);
|
||||
|
@ -1752,12 +1752,14 @@ public class MinecraftReflection {
|
||||
}
|
||||
|
||||
private static MethodAccessor asCraftMirror;
|
||||
private static MethodAccessor asCraftCopy;
|
||||
private static MethodAccessor asNMSCopy;
|
||||
|
||||
/**
|
||||
* Retrieve a CraftItemStack from a given ItemStack.
|
||||
* @param bukkitItemStack - the Bukkit ItemStack to convert.
|
||||
* @return A CraftItemStack as an ItemStack.
|
||||
* Retrieve a CraftItemStack from a given NMS ItemStack.
|
||||
*
|
||||
* @param nmsItem - the NMS ItemStack to convert.
|
||||
* @return A CraftItemStack as a NMS ItemStack.
|
||||
*/
|
||||
public static ItemStack getBukkitItemStack(Object nmsItem) {
|
||||
if (asCraftMirror == null) {
|
||||
@ -1768,9 +1770,24 @@ public class MinecraftReflection {
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve the Bukkit ItemStack from a given net.minecraft.server ItemStack.
|
||||
* @param minecraftItemStack - the NMS ItemStack to wrap.
|
||||
* @return The wrapped ItemStack.
|
||||
* Retrieve a CraftItemStack from a given 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) {
|
||||
if (asNMSCopy == null) {
|
||||
|
@ -28,6 +28,8 @@ public class SafeCacheBuilder<K, V> {
|
||||
|
||||
/**
|
||||
* Construct a new safe cache builder.
|
||||
* @param <K> Key type
|
||||
* @param <V> Value type
|
||||
*
|
||||
* @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
|
||||
* value, you should always choose it explicitly.
|
||||
*
|
||||
* @param concurrencyLevel New concurrency level
|
||||
* @return This for chaining
|
||||
*
|
||||
* @throws IllegalArgumentException if {@code concurrencyLevel} is
|
||||
* 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) {
|
||||
builder.concurrencyLevel(concurrencyLevel);
|
||||
@ -66,8 +71,7 @@ public class SafeCacheBuilder<K, V> {
|
||||
/**
|
||||
* Specifies that each entry should be automatically removed from the cache
|
||||
* 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
|
||||
* {@link com.google.common.cache.Cache#getUnchecked Cache.getUnchecked()},
|
||||
* access. Access time is reset by {@link com.google.common.cache.Cache#get Cache.get()},
|
||||
* but not by operations on the view returned by
|
||||
* {@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
|
||||
* it should be automatically removed
|
||||
* @param unit the unit that {@code duration} is expressed in
|
||||
* @return This for chaining
|
||||
*
|
||||
* @throws IllegalArgumentException if {@code duration} is negative
|
||||
* @throws IllegalStateException if the time to idle or time to live was
|
||||
* already set
|
||||
@ -280,7 +286,7 @@ public class SafeCacheBuilder<K, V> {
|
||||
|
||||
/**
|
||||
* Returns the cache wrapped as a ConcurrentMap.
|
||||
* <>
|
||||
* <p>
|
||||
* We can't return the direct Cache instance as it changed in Guava 13.
|
||||
* @return The cache as a map.
|
||||
*/
|
||||
|
@ -12,7 +12,7 @@ public abstract class AbstractWrapper {
|
||||
|
||||
/**
|
||||
* Construct a new NMS wrapper.
|
||||
* @param handle - the wrapped NMS object.
|
||||
* @param handleType - the NMS handle type.
|
||||
*/
|
||||
public AbstractWrapper(Class<?> handleType) {
|
||||
this.handleType = Preconditions.checkNotNull(handleType, "handleType cannot be NULL");
|
||||
|
@ -210,8 +210,8 @@ public class BukkitConverters {
|
||||
|
||||
/**
|
||||
* Retrieve an equivalent converter for a map of generic keys and primitive values.
|
||||
* @param genericItemType - the generic item type.
|
||||
* @param itemConverter - an equivalent converter for the generic type.
|
||||
* @param genericKeyType - the generic key type.
|
||||
* @param keyConverter - an equivalent converter for the generic type.
|
||||
* @return An equivalent converter.
|
||||
*/
|
||||
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.
|
||||
*/
|
||||
public static List<Unwrapper> getUnwrappers() {
|
||||
|
@ -147,7 +147,7 @@ public class WrappedGameProfile extends AbstractWrapper {
|
||||
/**
|
||||
* 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) {
|
||||
if (handle == null)
|
||||
|
@ -175,7 +175,7 @@ public class WrappedServerPing extends AbstractWrapper {
|
||||
|
||||
/**
|
||||
* Set the message of the day.
|
||||
* @param description - the message.
|
||||
* @param message - the message.
|
||||
*/
|
||||
public void setMotD(String message) {
|
||||
setMotD(WrappedChatComponent.fromText(message));
|
||||
@ -200,9 +200,9 @@ public class WrappedServerPing extends AbstractWrapper {
|
||||
|
||||
/**
|
||||
* Retrieve the displayed number of online players.
|
||||
* @see {@link #setPlayersOnline(int)} for more information.
|
||||
* @return The displayed number.
|
||||
* @throws IllegalStateException If the player count has been hidden via {@link #setPlayersVisible(boolean)}.
|
||||
* @see #setPlayersOnline(int)
|
||||
*/
|
||||
public int getPlayersOnline() {
|
||||
if (players == null)
|
||||
@ -225,9 +225,9 @@ public class WrappedServerPing extends AbstractWrapper {
|
||||
|
||||
/**
|
||||
* Retrieve the displayed maximum number of players.
|
||||
* @see {@link #setPlayersMaximum(int)} for more information.
|
||||
* @return The maximum number.
|
||||
* @throws IllegalStateException If the player maximum has been hidden via {@link #setPlayersVisible(boolean)}.
|
||||
* @see #setPlayersMaximum(int)
|
||||
*/
|
||||
public int getPlayersMaximum() {
|
||||
if (players == null)
|
||||
|
@ -15,7 +15,6 @@ public class WrappedSignedProperty extends AbstractWrapper {
|
||||
* @param name - the name of the property.
|
||||
* @param value - the value of the property.
|
||||
* @param signature - the BASE64-encoded signature of the value.
|
||||
* @return The signed property.
|
||||
*/
|
||||
public WrappedSignedProperty(String name, String value, String signature) {
|
||||
this(new Property(name, value, signature));
|
||||
|
@ -46,7 +46,7 @@ public class WrappedStatistic extends AbstractWrapper {
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
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);
|
||||
|
||||
return Iterables.transform(map.values(), new Function<Object, WrappedStatistic>() {
|
||||
@Override
|
||||
public WrappedStatistic apply(Object handle) {
|
||||
return fromHandle(handle);
|
||||
};
|
||||
|
@ -186,6 +186,7 @@ public class WrappedWatchableObject extends AbstractWrapper {
|
||||
* Retrieve the type ID of a watchable object.
|
||||
* <p>
|
||||
* <table border=1>
|
||||
* <caption>Type to Value</caption>
|
||||
* <tbody>
|
||||
* <tr>
|
||||
* <th>Type ID</th>
|
||||
@ -230,9 +231,9 @@ public class WrappedWatchableObject extends AbstractWrapper {
|
||||
|
||||
/**
|
||||
* Set the type ID of a watchable object.
|
||||
* @see {@link #getTypeID()} for more information.
|
||||
* @param id - the new ID.
|
||||
* @throws FieldAccessException Reflection failed.
|
||||
* @see #getTypeID()
|
||||
*/
|
||||
public void setTypeID(int id) throws FieldAccessException {
|
||||
modifier.<Integer>withType(int.class).write(0, id);
|
||||
|
@ -19,7 +19,7 @@ import javax.annotation.Nonnull;
|
||||
*/
|
||||
public interface NbtCompound extends NbtBase<Map<String, NbtBase<?>>>, Iterable<NbtBase<?>> {
|
||||
@Override
|
||||
@Deprecated()
|
||||
@Deprecated
|
||||
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);
|
||||
|
||||
/**
|
||||
* 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>
|
||||
* If the value is NULL, the corresponding key is removed. Any Map or List will be converted
|
||||
* 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.
|
||||
* @return The tags stored in this compound.
|
||||
*/
|
||||
@Override
|
||||
public abstract Iterator<NbtBase<?>> iterator();
|
||||
}
|
@ -131,7 +131,7 @@ public class NbtFactory {
|
||||
* Set the NBT compound tag of a given item stack.
|
||||
* <p>
|
||||
* 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 compound - the new NBT compound, or NULL to remove it.
|
||||
* @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.
|
||||
* <p>
|
||||
* 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.
|
||||
* @return A wrapper for its NBT tag.
|
||||
*/
|
||||
@ -219,7 +219,7 @@ public class NbtFactory {
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
public static NbtCompound readBlockState(Block block) {
|
||||
@ -519,7 +519,7 @@ public class NbtFactory {
|
||||
if (type == NbtType.TAG_COMPOUND)
|
||||
return (NbtWrapper<T>) new WrappedCompound(handle);
|
||||
else if (type == NbtType.TAG_LIST)
|
||||
return (NbtWrapper<T>) new WrappedList(handle);
|
||||
return new WrappedList(handle);
|
||||
else
|
||||
return new WrappedElement<T>(handle);
|
||||
}
|
||||
@ -532,7 +532,7 @@ public class NbtFactory {
|
||||
if (type == NbtType.TAG_COMPOUND)
|
||||
return (NbtWrapper<T>) new WrappedCompound(handle, name);
|
||||
else if (type == NbtType.TAG_LIST)
|
||||
return (NbtWrapper<T>) new WrappedList(handle, name);
|
||||
return new WrappedList(handle, name);
|
||||
else
|
||||
return new WrappedElement<T>(handle, name);
|
||||
}
|
||||
|
@ -116,7 +116,7 @@ public interface NbtList<TType> extends NbtBase<List<NbtBase<TType>>>, Iterable<
|
||||
* Retrieve an element by index.
|
||||
* @param index - index of 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);
|
||||
|
||||
@ -135,5 +135,6 @@ public interface NbtList<TType> extends NbtBase<List<NbtBase<TType>>>, Iterable<
|
||||
/**
|
||||
* Iterate over all the elements in this list.
|
||||
*/
|
||||
@Override
|
||||
public abstract Iterator<TType> iterator();
|
||||
}
|
Loading…
Reference in New Issue
Block a user