And a few more

This commit is contained in:
Dan Mulloy 2015-06-17 15:08:58 -04:00
parent bba1054f97
commit 273b470140
26 changed files with 142 additions and 67 deletions

View File

@ -321,7 +321,6 @@ 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 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(); ) {

View File

@ -2,16 +2,16 @@
* ProtocolLib - Bukkit server library that allows access to the Minecraft protocol. * ProtocolLib - Bukkit server library that allows access to the Minecraft protocol.
* Copyright (C) 2012 Kristian S. Stangeland * Copyright (C) 2012 Kristian S. Stangeland
* *
* This program is free software; you can redistribute it and/or modify it under the terms of the * This program is free software; you can redistribute it and/or modify it under the terms of the
* GNU General Public License as published by the Free Software Foundation; either version 2 of * GNU General Public License as published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version. * the License, or (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details. * See the GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License along with this program; * You should have received a copy of the GNU General Public License along with this program;
* if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA * if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
* 02111-1307 USA * 02111-1307 USA
*/ */
@ -48,7 +48,7 @@ import com.google.common.base.Joiner;
*/ */
public class AsyncListenerHandler { public class AsyncListenerHandler {
public static final ReportType REPORT_HANDLER_NOT_STARTED = new ReportType( public static final ReportType REPORT_HANDLER_NOT_STARTED = new ReportType(
"Plugin %s did not start the asynchronous handler %s by calling start() or syncStart()."); "Plugin %s did not start the asynchronous handler %s by calling start() or syncStart().");
/** /**
* Signal an end to packet processing. * Signal an end to packet processing.
@ -209,6 +209,7 @@ public class AsyncListenerHandler {
* close a specific worker is less efficient than stopping an arbitrary worker. * close a specific worker is less efficient than stopping an arbitrary worker.
* <p> * <p>
* <b>Warning</b>: Never call the run() method in the main thread. * <b>Warning</b>: Never call the run() method in the main thread.
* @return The listener loop
*/ */
public AsyncRunnable getListenerLoop() { public AsyncRunnable getListenerLoop() {
return new AsyncRunnable() { return new AsyncRunnable() {
@ -315,7 +316,7 @@ public class AsyncListenerHandler {
* public Void apply(&#64;Nullable AsyncRunnable workerLoop) { * public Void apply(&#64;Nullable AsyncRunnable workerLoop) {
* Thread thread = Thread.currentThread(); * Thread thread = Thread.currentThread();
* int prevPriority = thread.getPriority(); * int prevPriority = thread.getPriority();
* *
* thread.setPriority(Thread.MIN_PRIORITY); * thread.setPriority(Thread.MIN_PRIORITY);
* workerLoop.run(); * workerLoop.run();
* thread.setPriority(prevPriority); * thread.setPriority(prevPriority);
@ -357,9 +358,9 @@ public class AsyncListenerHandler {
* @return A friendly thread name. * @return A friendly thread name.
*/ */
public String getFriendlyWorkerName(int id) { public String getFriendlyWorkerName(int id) {
return String.format("Protocol Worker #%s - %s - [recv: %s, send: %s]", return String.format("Protocol Worker #%s - %s - [recv: %s, send: %s]",
id, id,
PacketAdapter.getPluginName(listener), PacketAdapter.getPluginName(listener),
fromWhitelist(listener.getReceivingWhitelist()), fromWhitelist(listener.getReceivingWhitelist()),
fromWhitelist(listener.getSendingWhitelist()) fromWhitelist(listener.getSendingWhitelist())
); );
@ -383,8 +384,8 @@ public class AsyncListenerHandler {
* This is useful if you need to synchronize with the main thread in your packet listener, but * This is useful if you need to synchronize with the main thread in your packet listener, but
* you're not performing any expensive processing. * you're not performing any expensive processing.
* <p> * <p>
* <b>Note</b>: Use a asynchronous worker if the packet listener may use more than 0.5 ms * <b>Note</b>: Use a asynchronous worker if the packet listener may use more than 0.5 ms
* of processing time on a single packet. Do as much as possible on the worker thread, and schedule synchronous tasks * of processing time on a single packet. Do as much as possible on the worker thread, and schedule synchronous tasks
* to use the Bukkit API instead. * to use the Bukkit API instead.
* @return TRUE if the synchronized processing was successfully started, FALSE if it's already running. * @return TRUE if the synchronized processing was successfully started, FALSE if it's already running.
* @throws IllegalStateException If we couldn't start the underlying task. * @throws IllegalStateException If we couldn't start the underlying task.
@ -399,12 +400,12 @@ public class AsyncListenerHandler {
* This is useful if you need to synchronize with the main thread in your packet listener, but * This is useful if you need to synchronize with the main thread in your packet listener, but
* you're not performing any expensive processing. * you're not performing any expensive processing.
* <p> * <p>
* The processing time parameter gives the upper bound for the amount of time spent processing pending packets. * The processing time parameter gives the upper bound for the amount of time spent processing pending packets.
* It should be set to a fairly low number, such as 0.5 ms or 1% of a game tick - to reduce the impact * It should be set to a fairly low number, such as 0.5 ms or 1% of a game tick - to reduce the impact
* on the main thread. Never go beyond 50 milliseconds. * on the main thread. Never go beyond 50 milliseconds.
* <p> * <p>
* <b>Note</b>: Use a asynchronous worker if the packet listener may exceed the ideal processing time * <b>Note</b>: Use a asynchronous worker if the packet listener may exceed the ideal processing time
* on a single packet. Do as much as possible on the worker thread, and schedule synchronous tasks * on a single packet. Do as much as possible on the worker thread, and schedule synchronous tasks
* to use the Bukkit API instead. * to use the Bukkit API instead.
* *
* @param time - the amount of processing time alloted per game tick (20 ticks per second). * @param time - the amount of processing time alloted per game tick (20 ticks per second).
@ -503,7 +504,7 @@ public class AsyncListenerHandler {
} }
/** /**
* Set the current number of workers. * Set the current number of workers.
* <p> * <p>
* This method can only be called with a count of zero when the listener is closing. * This method can only be called with a count of zero when the listener is closing.
* @param count - new number of workers. * @param count - new number of workers.
@ -563,7 +564,7 @@ public class AsyncListenerHandler {
*/ */
private void listenerLoop(int workerID) { private void listenerLoop(int workerID) {
// Danger, danger! // Danger, danger!
if (Thread.currentThread().getId() == mainThread.getId()) if (Thread.currentThread().getId() == mainThread.getId())
throw new IllegalStateException("Do not call this method from the main thread."); throw new IllegalStateException("Do not call this method from the main thread.");
if (cancelled) if (cancelled)
throw new IllegalStateException("Listener has been cancelled. Create a new listener instead."); throw new IllegalStateException("Listener has been cancelled. Create a new listener instead.");
@ -584,7 +585,7 @@ public class AsyncListenerHandler {
// This is a bit slow, but it should be safe // This is a bit slow, but it should be safe
synchronized (stopLock) { synchronized (stopLock) {
// Are we the one who is supposed to stop? // Are we the one who is supposed to stop?
if (stoppedTasks.contains(workerID)) if (stoppedTasks.contains(workerID))
return; return;
if (waitForStops()) if (waitForStops())
return; return;
@ -616,7 +617,7 @@ public class AsyncListenerHandler {
AsyncMarker marker = packet.getAsyncMarker(); AsyncMarker marker = packet.getAsyncMarker();
// Here's the core of the asynchronous processing // Here's the core of the asynchronous processing
try { try {
synchronized (marker.getProcessingLock()) { synchronized (marker.getProcessingLock()) {
marker.setListenerHandler(this); marker.setListenerHandler(this);
marker.setWorkerID(workerID); marker.setWorkerID(workerID);
@ -624,7 +625,7 @@ public class AsyncListenerHandler {
// We're not THAT worried about performance here // We're not THAT worried about performance here
if (timedManager.isTiming()) { if (timedManager.isTiming()) {
// Retrieve the tracker to use // Retrieve the tracker to use
TimedTracker tracker = timedManager.getTracker(listener, TimedTracker tracker = timedManager.getTracker(listener,
packet.isServerPacket() ? ListenerType.ASYNC_SERVER_SIDE : ListenerType.ASYNC_CLIENT_SIDE); packet.isServerPacket() ? ListenerType.ASYNC_SERVER_SIDE : ListenerType.ASYNC_CLIENT_SIDE);
long token = tracker.beginTracking(); long token = tracker.beginTracking();

View File

@ -401,6 +401,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.
* @param event - packet event
* @return TRUE if it does, FALSE otherwise. * @return TRUE if it does, FALSE otherwise.
* @throws FieldAccessException If determining fails for some reasaon * @throws FieldAccessException If determining fails for some reasaon
*/ */

View File

@ -139,6 +139,7 @@ public abstract class AbstractIntervalTree<TKey extends Comparable<TKey>, TValue
* Removes every interval that intersects with the given range. * Removes every interval that intersects with the given range.
* @param lowerBound - lowest value to remove. * @param lowerBound - lowest value to remove.
* @param upperBound - highest value to remove. * @param upperBound - highest value to remove.
* @return Intervals that were removed
*/ */
public Set<Entry> remove(TKey lowerBound, TKey upperBound) { public Set<Entry> remove(TKey lowerBound, TKey upperBound) {
return remove(lowerBound, upperBound, false); return remove(lowerBound, upperBound, false);

View File

@ -339,6 +339,7 @@ public abstract class NetworkMarker {
* <p> * <p>
* It's safe to modify the input stream. * It's safe to modify the input stream.
* @throws IOException If integer reading fails * @throws IOException If integer reading fails
* @return An input stream without the header
*/ */
protected abstract DataInputStream skipHeader(DataInputStream input) throws IOException; protected abstract DataInputStream skipHeader(DataInputStream input) throws IOException;

View File

@ -443,9 +443,10 @@ 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 * @param 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.
* @return The current net handler for this player
*/ */
protected Object getNetHandler(boolean refresh) throws IllegalAccessException { protected Object getNetHandler(boolean refresh) throws IllegalAccessException {
// What a mess // What a mess
@ -564,7 +565,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 * @param state - 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);

View File

@ -52,7 +52,7 @@ import com.google.common.collect.MapMaker;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
/** /**
* Offload all the work to Spigot, if possible. * Offload all the work to Spigot, if possible.
* *
* @author Kristian * @author Kristian
*/ */
@ -104,11 +104,14 @@ public class SpigotPacketInjector implements SpigotPacketListener {
private PacketInjector proxyPacketInjector; private PacketInjector proxyPacketInjector;
// Background task // Background task
private static final int BACKGROUND_DELAY = 30 * PacketFilterManager.TICKS_PER_SECOND; private static final int BACKGROUND_DELAY = 30 * PacketFilterManager.TICKS_PER_SECOND;
private int backgroundId; private int backgroundId;
/** /**
* Create a new spigot injector. * Create a new spigot injector.
* @param reporter - error reporter
* @param invoker - listener invoker
* @param server - server
*/ */
public SpigotPacketInjector(ErrorReporter reporter, ListenerInvoker invoker, Server server) { public SpigotPacketInjector(ErrorReporter reporter, ListenerInvoker invoker, Server server) {
this.reporter = reporter; this.reporter = reporter;

View File

@ -157,7 +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 <TField> 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.
*/ */
@ -192,6 +192,7 @@ public final class StructureCompiler {
* <p> * <p>
* WARNING: Do NOT call this method in the main thread. Compiling may easily take 10 ms, which is already * WARNING: Do NOT call this method in the main thread. Compiling may easily take 10 ms, which is already
* over 1/4 of a tick (50 ms). Let the background thread automatically compile the structure modifiers instead. * over 1/4 of a tick (50 ms). Let the background thread automatically compile the structure modifiers instead.
* @param <TField> Type
* @param source - structure modifier to compile. * @param source - structure modifier to compile.
* @return A compiled structure modifier. * @return A compiled structure modifier.
*/ */

View File

@ -133,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 length - the number of bytes to dump.
* @throws IOException Any underlying IO exception. * @throws IOException Any underlying IO exception.
*/ */
public void appendTo(Appendable appendable, byte[] data) throws IOException { public void appendTo(Appendable appendable, byte[] data) throws IOException {

View File

@ -61,7 +61,7 @@ public class SafeCacheBuilder<K, V> {
* *
* @throws IllegalArgumentException if {@code concurrencyLevel} is * @throws IllegalArgumentException if {@code concurrencyLevel} is
* nonpositive * nonpositive
* @throws IllegalStateExeption if a concurrency level was already set * @throws IllegalStateException 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);
@ -121,6 +121,8 @@ public class SafeCacheBuilder<K, V> {
* @param duration the length of time after an entry is created that it * @param duration the length of time after an entry is created that it
* should be automatically removed * 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 live or time to idle was * @throws IllegalStateException if the time to live or time to idle was
* already set * already set
@ -138,6 +140,9 @@ public class SafeCacheBuilder<K, V> {
* the need for expensive resizing operations later, but setting this value * the need for expensive resizing operations later, but setting this value
* unnecessarily high wastes memory. * unnecessarily high wastes memory.
* *
* @param initialCapacity - initial capacity
* @return This for chaining
*
* @throws IllegalArgumentException if {@code initialCapacity} is negative * @throws IllegalArgumentException if {@code initialCapacity} is negative
* @throws IllegalStateException if an initial capacity was already set * @throws IllegalStateException if an initial capacity was already set
*/ */
@ -162,6 +167,8 @@ public class SafeCacheBuilder<K, V> {
* without a code change. * without a code change.
* *
* @param size the maximum size of the cache * @param size the maximum size of the cache
* @return This for chaining
*
* @throws IllegalArgumentException if {@code size} is negative * @throws IllegalArgumentException if {@code size} is negative
* @throws IllegalStateException if a maximum size was already set * @throws IllegalStateException if a maximum size was already set
*/ */
@ -202,6 +209,9 @@ public class SafeCacheBuilder<K, V> {
* incompatible with the listener, you will likely experience a * incompatible with the listener, you will likely experience a
* {@link ClassCastException} at some <i>undefined</i> point in the future. * {@link ClassCastException} at some <i>undefined</i> point in the future.
* *
* @param listener - removal listener
* @return This for chaining
*
* @throws IllegalStateException if a removal listener was already set * @throws IllegalStateException if a removal listener was already set
*/ */
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@ -219,6 +229,9 @@ public class SafeCacheBuilder<K, V> {
* which have been configured with {@link #expireAfterWrite} or * which have been configured with {@link #expireAfterWrite} or
* {@link #expireAfterAccess}. * {@link #expireAfterAccess}.
* *
* @param ticker - ticker
* @return This for chaining
*
* @throws IllegalStateException if a ticker was already set * @throws IllegalStateException if a ticker was already set
*/ */
public SafeCacheBuilder<K, V> ticker(Ticker ticker) { public SafeCacheBuilder<K, V> ticker(Ticker ticker) {
@ -242,6 +255,8 @@ public class SafeCacheBuilder<K, V> {
* <b>Note:</b> when this method is used, the resulting cache will use * <b>Note:</b> when this method is used, the resulting cache will use
* identity ({@code ==}) comparison to determine equality of values. * identity ({@code ==}) comparison to determine equality of values.
* *
* @return This for chaining
*
* @throws IllegalStateException if the value strength was already set * @throws IllegalStateException if the value strength was already set
*/ */
public SafeCacheBuilder<K, V> softValues() { public SafeCacheBuilder<K, V> softValues() {
@ -257,6 +272,8 @@ public class SafeCacheBuilder<K, V> {
* <b>Warning:</b> when this method is used, the resulting cache will use * <b>Warning:</b> when this method is used, the resulting cache will use
* identity ({@code ==}) comparison to determine equality of keys. * identity ({@code ==}) comparison to determine equality of keys.
* *
* @return This for chaining
*
* @throws IllegalStateException if the key strength was already set * @throws IllegalStateException if the key strength was already set
*/ */
public SafeCacheBuilder<K, V> weakKeys() { public SafeCacheBuilder<K, V> weakKeys() {
@ -277,6 +294,8 @@ public class SafeCacheBuilder<K, V> {
* <b>Note:</b> when this method is used, the resulting cache will use * <b>Note:</b> when this method is used, the resulting cache will use
* identity ({@code ==}) comparison to determine equality of values. * identity ({@code ==}) comparison to determine equality of values.
* *
* @return This for chaining
*
* @throws IllegalStateException if the value strength was already set * @throws IllegalStateException if the value strength was already set
*/ */
public SafeCacheBuilder<K, V> weakValues() { public SafeCacheBuilder<K, V> weakValues() {

View File

@ -50,6 +50,9 @@ public class BlockPosition {
/** /**
* Construct an immutable 3D vector. * Construct an immutable 3D vector.
* @param x - x coordinate
* @param y - y coordinate
* @param z - z coordinate
*/ */
public BlockPosition(int x, int y, int z) { public BlockPosition(int x, int y, int z) {
this.x = x; this.x = x;

View File

@ -210,6 +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 <T> Key type
* @param <U> Value type
* @param genericKeyType - the generic key type. * @param genericKeyType - the generic key type.
* @param keyConverter - an equivalent converter for the generic type. * @param keyConverter - an equivalent converter for the generic type.
* @return An equivalent converter. * @return An equivalent converter.
@ -264,6 +266,7 @@ public class BukkitConverters {
/** /**
* Retrieve an equivalent converter for a list of generic items. * Retrieve an equivalent converter for a list of generic items.
* @param <T> Type
* @param genericItemType - the generic item type. * @param genericItemType - the generic item type.
* @param itemConverter - an equivalent converter for the generic type. * @param itemConverter - an equivalent converter for the generic type.
* @return An equivalent converter. * @return An equivalent converter.
@ -320,6 +323,7 @@ public class BukkitConverters {
/** /**
* Retrieve an equivalent converter for an array of generic items. * Retrieve an equivalent converter for an array of generic items.
* @param <T> Type
* <p> * <p>
* The array is wrapped in a list. * The array is wrapped in a list.
* @param genericItemType - the generic item type. * @param genericItemType - the generic item type.
@ -878,6 +882,7 @@ public class BukkitConverters {
/** /**
* Wraps a given equivalent converter in NULL checks, ensuring that such values are ignored. * Wraps a given equivalent converter in NULL checks, ensuring that such values are ignored.
* @param <TType> Type
* @param delegate - the underlying equivalent converter. * @param delegate - the underlying equivalent converter.
* @return A equivalent converter that ignores NULL values. * @return A equivalent converter that ignores NULL values.
*/ */

View File

@ -2,16 +2,16 @@
* ProtocolLib - Bukkit server library that allows access to the Minecraft protocol. * ProtocolLib - Bukkit server library that allows access to the Minecraft protocol.
* Copyright (C) 2012 Kristian S. Stangeland * Copyright (C) 2012 Kristian S. Stangeland
* *
* This program is free software; you can redistribute it and/or modify it under the terms of the * This program is free software; you can redistribute it and/or modify it under the terms of the
* GNU General Public License as published by the Free Software Foundation; either version 2 of * GNU General Public License as published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version. * the License, or (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details. * See the GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License along with this program; * You should have received a copy of the GNU General Public License along with this program;
* if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA * if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
* 02111-1307 USA * 02111-1307 USA
*/ */
@ -51,6 +51,9 @@ public class ChunkPosition {
/** /**
* Construct an immutable 3D vector. * Construct an immutable 3D vector.
* @param x - x coordinate
* @param y - y coordinate
* @param z - z coordinate
*/ */
public ChunkPosition(int x, int y, int z) { public ChunkPosition(int x, int y, int z) {
this.x = x; this.x = x;
@ -173,7 +176,7 @@ public class ChunkPosition {
@Override @Override
public ChunkPosition getSpecific(Object generic) { public ChunkPosition getSpecific(Object generic) {
if (MinecraftReflection.isChunkPosition(generic)) { if (MinecraftReflection.isChunkPosition(generic)) {
// Use a structure modifier // Use a structure modifier
intModifier = new StructureModifier<Object>(generic.getClass(), null, false).withType(int.class); intModifier = new StructureModifier<Object>(generic.getClass(), null, false).withType(int.class);
// Damn it all // Damn it all
@ -189,7 +192,7 @@ public class ChunkPosition {
} catch (FieldAccessException e) { } catch (FieldAccessException e) {
// This is an exeptional work-around, so we don't want to burden the caller with the messy details // This is an exeptional work-around, so we don't want to burden the caller with the messy details
throw new RuntimeException("Field access error.", e); throw new RuntimeException("Field access error.", e);
} }
} }
} }

View File

@ -51,6 +51,7 @@ public class TroveWrapper {
*/ */
public static ReadOnlyFieldAccessor wrapMapField(final FieldAccessor accessor, final Function<Integer, Integer> noEntryTransform) { public static ReadOnlyFieldAccessor wrapMapField(final FieldAccessor accessor, final Function<Integer, Integer> noEntryTransform) {
return new ReadOnlyFieldAccessor() { return new ReadOnlyFieldAccessor() {
@Override
public Object get(Object instance) { public Object get(Object instance) {
Object troveMap = accessor.get(instance); Object troveMap = accessor.get(instance);
@ -59,6 +60,7 @@ public class TroveWrapper {
TroveWrapper.transformNoEntryValue(troveMap, noEntryTransform); TroveWrapper.transformNoEntryValue(troveMap, noEntryTransform);
return getDecoratedMap(troveMap); return getDecoratedMap(troveMap);
} }
@Override
public Field getField() { public Field getField() {
return accessor.getField(); return accessor.getField();
} }
@ -72,9 +74,11 @@ public class TroveWrapper {
*/ */
public static ReadOnlyFieldAccessor wrapSetField(final FieldAccessor accessor) { public static ReadOnlyFieldAccessor wrapSetField(final FieldAccessor accessor) {
return new ReadOnlyFieldAccessor() { return new ReadOnlyFieldAccessor() {
@Override
public Object get(Object instance) { public Object get(Object instance) {
return getDecoratedSet(accessor.get(instance)); return getDecoratedSet(accessor.get(instance));
} }
@Override
public Field getField() { public Field getField() {
return accessor.getField(); return accessor.getField();
} }
@ -88,9 +92,11 @@ public class TroveWrapper {
*/ */
public static ReadOnlyFieldAccessor wrapListField(final FieldAccessor accessor) { public static ReadOnlyFieldAccessor wrapListField(final FieldAccessor accessor) {
return new ReadOnlyFieldAccessor() { return new ReadOnlyFieldAccessor() {
@Override
public Object get(Object instance) { public Object get(Object instance) {
return getDecoratedList(accessor.get(instance)); return getDecoratedList(accessor.get(instance));
} }
@Override
public Field getField() { public Field getField() {
return accessor.getField(); return accessor.getField();
} }
@ -99,6 +105,8 @@ public class TroveWrapper {
/** /**
* Retrieve a Java wrapper for the corresponding Trove map. * Retrieve a Java wrapper for the corresponding Trove map.
* @param <TKey> Key type
* @param <TValue> Value type
* @param troveMap - the trove map to wrap. * @param troveMap - the trove map to wrap.
* @return The wrapped GNU Trove map. * @return The wrapped GNU Trove map.
* @throws IllegalStateException If GNU Trove cannot be found in the class map. * @throws IllegalStateException If GNU Trove cannot be found in the class map.
@ -113,6 +121,7 @@ public class TroveWrapper {
/** /**
* Retrieve a Java wrapper for the corresponding Trove set. * Retrieve a Java wrapper for the corresponding Trove set.
* @param <TValue> Type
* @param troveSet - the trove set to wrap. * @param troveSet - the trove set to wrap.
* @return The wrapped GNU Trove set. * @return The wrapped GNU Trove set.
* @throws IllegalStateException If GNU Trove cannot be found in the class map. * @throws IllegalStateException If GNU Trove cannot be found in the class map.
@ -127,6 +136,7 @@ public class TroveWrapper {
/** /**
* Retrieve a Java wrapper for the corresponding Trove list. * Retrieve a Java wrapper for the corresponding Trove list.
* @param <TValue> Type
* @param troveList - the trove list to wrap. * @param troveList - the trove list to wrap.
* @return The wrapped GNU Trove list. * @return The wrapped GNU Trove list.
* @throws IllegalStateException If GNU Trove cannot be found in the class map. * @throws IllegalStateException If GNU Trove cannot be found in the class map.
@ -185,7 +195,7 @@ public class TroveWrapper {
} }
/** /**
* Retrieve the corresponding decorator. * Retrieve the corresponding decorator.
* @param trove - the trove class. * @param trove - the trove class.
* @return The wrapped trove class. * @return The wrapped trove class.
*/ */

View File

@ -121,13 +121,14 @@ public class WrappedAttribute extends AbstractWrapper {
*/ */
public PacketContainer getParentPacket() { public PacketContainer getParentPacket() {
return new PacketContainer( return new PacketContainer(
PacketType.Play.Server.UPDATE_ATTRIBUTES, PacketType.Play.Server.UPDATE_ATTRIBUTES,
modifier.withType(MinecraftReflection.getPacketClass()).read(0) modifier.withType(MinecraftReflection.getPacketClass()).read(0)
); );
} }
/** /**
* Determine if the attribute has a given attribute modifier, identified by UUID. * Determine if the attribute has a given attribute modifier, identified by UUID.
* @param id - the id to check for.
* @return TRUE if it does, FALSE otherwise. * @return TRUE if it does, FALSE otherwise.
*/ */
public boolean hasModifier(UUID id) { public boolean hasModifier(UUID id) {
@ -154,13 +155,13 @@ public class WrappedAttribute extends AbstractWrapper {
* Retrieve an immutable set of all the attribute modifiers that will compute the final value of this attribute. * Retrieve an immutable set of all the attribute modifiers that will compute the final value of this attribute.
* @return Every attribute modifier. * @return Every attribute modifier.
*/ */
public Set<WrappedAttributeModifier> getModifiers() { public Set<WrappedAttributeModifier> getModifiers() {
if (attributeModifiers == null) { if (attributeModifiers == null) {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
Collection<Object> collection = (Collection<Object>) modifier.withType(Collection.class).read(0); Collection<Object> collection = (Collection<Object>) modifier.withType(Collection.class).read(0);
// Convert to an equivalent wrapper // Convert to an equivalent wrapper
ConvertedSet<Object, WrappedAttributeModifier> converted = ConvertedSet<Object, WrappedAttributeModifier> converted =
new ConvertedSet<Object, WrappedAttributeModifier>(getSetSafely(collection)) { new ConvertedSet<Object, WrappedAttributeModifier>(getSetSafely(collection)) {
@Override @Override
protected Object toInner(WrappedAttributeModifier outer) { protected Object toInner(WrappedAttributeModifier outer) {
@ -197,7 +198,7 @@ public class WrappedAttribute extends AbstractWrapper {
return getBaseValue() == other.getBaseValue() && return getBaseValue() == other.getBaseValue() &&
Objects.equal(getAttributeKey(), other.getAttributeKey()) && Objects.equal(getAttributeKey(), other.getAttributeKey()) &&
Sets.symmetricDifference( Sets.symmetricDifference(
getModifiers(), getModifiers(),
other.getModifiers() other.getModifiers()
).isEmpty(); ).isEmpty();
} }
@ -229,7 +230,7 @@ public class WrappedAttribute extends AbstractWrapper {
x += modifier.getAmount(); x += modifier.getAmount();
break; break;
case 1: // Multiply percentage case 1: // Multiply percentage
y += x * modifier.getAmount(); y += x * modifier.getAmount();
break; break;
case 2: case 2:
y *= 1 + modifier.getAmount(); y *= 1 + modifier.getAmount();
@ -280,7 +281,7 @@ public class WrappedAttribute extends AbstractWrapper {
} }
/** /**
* Represents a builder for wrapped attributes. * Represents a builder for wrapped attributes.
* <p> * <p>
* Use {@link WrappedAttribute#newBuilder()} to construct it. * Use {@link WrappedAttribute#newBuilder()} to construct it.
* @author Kristian * @author Kristian
@ -390,9 +391,9 @@ public class WrappedAttribute extends AbstractWrapper {
try { try {
Object handle = ATTRIBUTE_CONSTRUCTOR.newInstance( Object handle = ATTRIBUTE_CONSTRUCTOR.newInstance(
packet.getHandle(), packet.getHandle(),
attributeKey, attributeKey,
baseValue, baseValue,
getUnwrappedModifiers()); getUnwrappedModifiers());
// Create it // Create it

View File

@ -322,6 +322,7 @@ public class WrappedDataWatcher extends AbstractWrapper implements Iterable<Wrap
/** /**
* Retrieve the ID of a given type, if it's allowed to be watched. * Retrieve the ID of a given type, if it's allowed to be watched.
* @param clazz - Class to check for.
* @return The ID, or NULL if it cannot be watched. * @return The ID, or NULL if it cannot be watched.
* @throws FieldAccessException If we cannot initialize the reflection machinery. * @throws FieldAccessException If we cannot initialize the reflection machinery.
*/ */
@ -609,7 +610,8 @@ public class WrappedDataWatcher extends AbstractWrapper implements Iterable<Wrap
* @param newValue - the new watched value. * @param newValue - the new watched value.
* @param secondary - optional secondary value. * @param secondary - optional secondary value.
* @param update - whether or not to refresh every listening client. * @param update - whether or not to refresh every listening client.
* @throws FieldAccessException Cannot read underlying field. * @param type - custom type.
* @throws FieldAccessException If we cannot read the underlying field.
*/ */
public void setObject(int index, Object newValue, Object secondary, boolean update, CustomType type) throws FieldAccessException { public void setObject(int index, Object newValue, Object secondary, boolean update, CustomType type) throws FieldAccessException {
Object created = type.newInstance(newValue, secondary); Object created = type.newInstance(newValue, secondary);

View File

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

View File

@ -445,6 +445,7 @@ public class WrappedServerPing extends AbstractWrapper {
/** /**
* Retrieve a compressed image from an image. * Retrieve a compressed image from an image.
* @param image - the image. * @param image - the image.
* @return A compressed image from an image.
* @throws IOException If we were unable to compress the image. * @throws IOException If we were unable to compress the image.
*/ */
public static CompressedImage fromPng(RenderedImage image) throws IOException { public static CompressedImage fromPng(RenderedImage image) throws IOException {

View File

@ -184,7 +184,6 @@ public class WrappedWatchableObject extends AbstractWrapper {
/** /**
* Retrieve the type ID of a watchable object. * Retrieve the type ID of a watchable object.
* <p>
* <table border=1> * <table border=1>
* <caption>Type to Value</caption> * <caption>Type to Value</caption>
* <tbody> * <tbody>

View File

@ -2,16 +2,16 @@
* ProtocolLib - Bukkit server library that allows access to the Minecraft protocol. * ProtocolLib - Bukkit server library that allows access to the Minecraft protocol.
* Copyright (C) 2012 Kristian S. Stangeland * Copyright (C) 2012 Kristian S. Stangeland
* *
* This program is free software; you can redistribute it and/or modify it under the terms of the * This program is free software; you can redistribute it and/or modify it under the terms of the
* GNU General Public License as published by the Free Software Foundation; either version 2 of * GNU General Public License as published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version. * the License, or (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details. * See the GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License along with this program; * You should have received a copy of the GNU General Public License along with this program;
* if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA * if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
* 02111-1307 USA * 02111-1307 USA
*/ */
@ -84,6 +84,7 @@ public abstract class ConvertedMap<Key, VInner, VOuter> extends AbstractConverte
/** /**
* Convert a value from the inner map to the outer visible map. * Convert a value from the inner map to the outer visible map.
* @param key - unused value.
* @param inner - the inner value. * @param inner - the inner value.
* @return The outer value. * @return The outer value.
*/ */
@ -93,6 +94,7 @@ public abstract class ConvertedMap<Key, VInner, VOuter> extends AbstractConverte
/** /**
* Convert a value from the outer map to the internal inner map. * Convert a value from the outer map to the internal inner map.
* @param key - unused value.
* @param outer - the outer value. * @param outer - the outer value.
* @return The inner value. * @return The inner value.
*/ */
@ -161,7 +163,8 @@ public abstract class ConvertedMap<Key, VInner, VOuter> extends AbstractConverte
* *
* @return a string representation of this map * @return a string representation of this map
*/ */
public String toString() { @Override
public String toString() {
Iterator<Entry<Key, VOuter>> i = entrySet().iterator(); Iterator<Entry<Key, VOuter>> i = entrySet().iterator();
if (!i.hasNext()) if (!i.hasNext())
return "{}"; return "{}";
@ -189,7 +192,7 @@ public abstract class ConvertedMap<Key, VInner, VOuter> extends AbstractConverte
* @return The converted set of entries. * @return The converted set of entries.
*/ */
static <Key, VInner, VOuter> Set<Entry<Key, VOuter>> convertedEntrySet( static <Key, VInner, VOuter> Set<Entry<Key, VOuter>> convertedEntrySet(
final Collection<Entry<Key, VInner>> entries, final Collection<Entry<Key, VInner>> entries,
final BiFunction<Key, VOuter, VInner> innerFunction, final BiFunction<Key, VOuter, VInner> innerFunction,
final BiFunction<Key, VInner, VOuter> outerFunction) { final BiFunction<Key, VInner, VOuter> outerFunction) {
@ -209,7 +212,7 @@ public abstract class ConvertedMap<Key, VInner, VOuter> extends AbstractConverte
@Override @Override
public VInner setValue(VInner value) { public VInner setValue(VInner value) {
return innerFunction.apply(getKey(), outer.setValue(outerFunction.apply(getKey(), value))); return innerFunction.apply(getKey(), outer.setValue(outerFunction.apply(getKey(), value)));
} }
@Override @Override
@ -235,7 +238,7 @@ public abstract class ConvertedMap<Key, VInner, VOuter> extends AbstractConverte
@Override @Override
public VOuter setValue(VOuter value) { public VOuter setValue(VOuter value) {
final VInner converted = innerFunction.apply(getKey(), value); final VInner converted = innerFunction.apply(getKey(), value);
return outerFunction.apply(getKey(), inner.setValue(converted)); return outerFunction.apply(getKey(), inner.setValue(converted));
} }
@Override @Override

View File

@ -37,6 +37,7 @@ public interface NbtCompound extends NbtBase<Map<String, NbtBase<?>>>, Iterable<
/** /**
* Retrieve the value of a given entry. * Retrieve the value of a given entry.
* @param <T> Type
* @param key - key of the entry to retrieve. * @param key - key of the entry to retrieve.
* @return The value of this entry, or NULL if not found. * @return The value of this entry, or NULL if not found.
*/ */
@ -52,6 +53,7 @@ public interface NbtCompound extends NbtBase<Map<String, NbtBase<?>>>, Iterable<
/** /**
* Set a entry based on its name. * Set a entry based on its name.
* @param <T> Type
* @param entry - entry with a name and value. * @param entry - entry with a name and value.
* @return This compound, for chaining. * @return This compound, for chaining.
* @throws IllegalArgumentException If entry is NULL. * @throws IllegalArgumentException If entry is NULL.
@ -302,6 +304,7 @@ public interface NbtCompound extends NbtBase<Map<String, NbtBase<?>>>, Iterable<
/** /**
* Retrieve the NBT list value of an entry identified by a given key. * Retrieve the NBT list value of an entry identified by a given key.
* @param <T> Type
* @param key - the key of the entry. * @param key - the key of the entry.
* @return The NBT list value of the entry. * @return The NBT list value of the entry.
* @throws IllegalArgumentException If the key doesn't exist. * @throws IllegalArgumentException If the key doesn't exist.
@ -310,6 +313,7 @@ public interface NbtCompound extends NbtBase<Map<String, NbtBase<?>>>, Iterable<
/** /**
* Retrieve a NBT list value by its key, or create a new list if it doesn't exist. * Retrieve a NBT list value by its key, or create a new list if it doesn't exist.
* @param <T> Type
* @param key - the key of the entry to find or create. * @param key - the key of the entry to find or create.
* @return The compound value that was retrieved or just created. * @return The compound value that was retrieved or just created.
*/ */
@ -317,6 +321,7 @@ public interface NbtCompound extends NbtBase<Map<String, NbtBase<?>>>, Iterable<
/** /**
* Associate a NBT list with the given key. * Associate a NBT list with the given key.
* @param <T> Type
* @param list - the list value. * @param list - the list value.
* @return This current compound, for chaining. * @return This current compound, for chaining.
*/ */
@ -324,6 +329,7 @@ public interface NbtCompound extends NbtBase<Map<String, NbtBase<?>>>, Iterable<
/** /**
* Associate a new NBT list with the given key. * Associate a new NBT list with the given key.
* @param <T> Type
* @param key - the key and name of the new NBT list. * @param key - the key and name of the new NBT list.
* @param list - the list of NBT elements. * @param list - the list of NBT elements.
* @return This current compound, for chaining. * @return This current compound, for chaining.
@ -332,6 +338,7 @@ public interface NbtCompound extends NbtBase<Map<String, NbtBase<?>>>, Iterable<
/** /**
* Remove the NBT element that is associated with the given key. * Remove the NBT element that is associated with the given key.
* @param <T> Type
* @param key - the key of the element to remove. * @param key - the key of the element to remove.
* @return The removed element, or NULL if no such element was found. * @return The removed element, or NULL if no such element was found.
*/ */

View File

@ -94,6 +94,8 @@ public class NbtFactory {
* Get a NBT wrapper from a NBT base. * Get a NBT wrapper from a NBT base.
* <p> * <p>
* This may clone the content if the NbtBase is not a NbtWrapper. * This may clone the content if the NbtBase is not a NbtWrapper.
*
* @param <T> Type
* @param base - the base class. * @param base - the base class.
* @return A NBT wrapper. * @return A NBT wrapper.
*/ */
@ -282,6 +284,7 @@ public class NbtFactory {
* Initialize a NBT wrapper. * Initialize a NBT wrapper.
* <p> * <p>
* Use {@link #fromNMS(Object, String)} instead. * Use {@link #fromNMS(Object, String)} instead.
* @param <T> Type
* @param handle - the underlying net.minecraft.server object to wrap. * @param handle - the underlying net.minecraft.server object to wrap.
* @return A NBT wrapper. * @return A NBT wrapper.
*/ */
@ -301,6 +304,7 @@ public class NbtFactory {
/** /**
* Initialize a NBT wrapper with a name. * Initialize a NBT wrapper with a name.
* @param <T> Type
* @param name - the name of the tag, or NULL if not valid. * @param name - the name of the tag, or NULL if not valid.
* @param handle - the underlying net.minecraft.server object to wrap. * @param handle - the underlying net.minecraft.server object to wrap.
* @return A NBT wrapper. * @return A NBT wrapper.
@ -460,6 +464,7 @@ public class NbtFactory {
/** /**
* Create a new NBT wrapper from a given type. * Create a new NBT wrapper from a given type.
* @param <T> Type
* @param type - the NBT type. * @param type - the NBT type.
* @param name - the name of the NBT tag. * @param name - the name of the NBT tag.
* @return The new wrapped NBT tag. * @return The new wrapped NBT tag.
@ -539,6 +544,7 @@ public class NbtFactory {
/** /**
* Create a new NBT wrapper from a given type. * Create a new NBT wrapper from a given type.
* @param <T> Type
* @param type - the NBT type. * @param type - the NBT type.
* @param name - the name of the NBT tag. * @param name - the name of the NBT tag.
* @param value - the value of the new tag. * @param value - the value of the new tag.
@ -555,6 +561,7 @@ public class NbtFactory {
/** /**
* Create a new NBT wrapper from a given type. * Create a new NBT wrapper from a given type.
* @param <T> Type
* @param type - type of the NBT value. * @param type - type of the NBT value.
* @param name - the name of the NBT tag. * @param name - the name of the NBT tag.
* @param value - the value of the new tag. * @param value - the value of the new tag.

View File

@ -46,7 +46,7 @@ public interface NbtList<TType> extends NbtBase<List<NbtBase<TType>>>, Iterable<
/** /**
* Add a NBT list or NBT compound to the list. * Add a NBT list or NBT compound to the list.
* @param element * @param element Element to add
*/ */
public abstract void add(NbtBase<TType> element); public abstract void add(NbtBase<TType> element);

View File

@ -102,6 +102,7 @@ public class NbtBinarySerializer {
/** /**
* Load an NBT tag from a stream. * Load an NBT tag from a stream.
* @param <TType> Type
* @param source - the input stream. * @param source - the input stream.
* @return An NBT tag. * @return An NBT tag.
*/ */

View File

@ -69,6 +69,7 @@ public class NbtConfigurationSerializer {
/** /**
* Write the content of a NBT tag to a configuration section. * Write the content of a NBT tag to a configuration section.
* @param <TType> Type
* @param value - the NBT tag to write. * @param value - the NBT tag to write.
* @param destination - the destination section. * @param destination - the destination section.
*/ */
@ -143,7 +144,7 @@ public class NbtConfigurationSerializer {
private Integer getNextIndex() { private Integer getNextIndex() {
Integer listIndex = workingIndex.get(current); Integer listIndex = workingIndex.get(current);
if (listIndex != null) if (listIndex != null)
return workingIndex.put(current, listIndex + 1); return workingIndex.put(current, listIndex + 1);
else else
return null; return null;
@ -167,7 +168,8 @@ public class NbtConfigurationSerializer {
} }
/** /**
* Read a NBT tag from a root configuration. * Read a NBT tag from a root configuration.
* @param <TType> Type
* @param root - configuration that contains the NBT tag. * @param root - configuration that contains the NBT tag.
* @param nodeName - name of the NBT tag. * @param nodeName - name of the NBT tag.
* @return The read NBT tag. * @return The read NBT tag.
@ -178,7 +180,7 @@ public class NbtConfigurationSerializer {
} }
/** /**
* Read a NBT compound from a root configuration. * Read a NBT compound from a root configuration.
* @param root - configuration that contains the NBT compound. * @param root - configuration that contains the NBT compound.
* @param nodeName - name of the NBT compound. * @param nodeName - name of the NBT compound.
* @return The read NBT compound. * @return The read NBT compound.
@ -188,7 +190,8 @@ public class NbtConfigurationSerializer {
} }
/** /**
* Read a NBT compound from a root configuration. * Read a NBT compound from a root configuration.
* @param <T> Type
* @param root - configuration that contains the NBT compound. * @param root - configuration that contains the NBT compound.
* @param nodeName - name of the NBT compound. * @param nodeName - name of the NBT compound.
* @return The read NBT compound. * @return The read NBT compound.
@ -248,7 +251,7 @@ public class NbtConfigurationSerializer {
ConfigurationSection section = (ConfigurationSection) node; ConfigurationSection section = (ConfigurationSection) node;
// As above // As above
for (String key : section.getKeys(false)) for (String key : section.getKeys(false))
compound.put(readNode(section, key)); compound.put(readNode(section, key));
return (NbtWrapper<?>) compound; return (NbtWrapper<?>) compound;
} }
@ -315,7 +318,7 @@ public class NbtConfigurationSerializer {
* @return An equivalent byte array. * @return An equivalent byte array.
*/ */
private static byte[] toByteArray(int[] data) { private static byte[] toByteArray(int[] data) {
ByteBuffer byteBuffer = ByteBuffer.allocate(data.length * 4); ByteBuffer byteBuffer = ByteBuffer.allocate(data.length * 4);
IntBuffer intBuffer = byteBuffer.asIntBuffer(); IntBuffer intBuffer = byteBuffer.asIntBuffer();
intBuffer.put(data); intBuffer.put(data);

View File

@ -48,6 +48,7 @@ public class NbtTextSerializer {
/** /**
* Serialize a NBT tag to a base-64 encoded string. * Serialize a NBT tag to a base-64 encoded string.
* @param <TType> Type
* @param value - the NBT tag to serialize. * @param value - the NBT tag to serialize.
* @return The NBT tag in base-64 form. * @return The NBT tag in base-64 form.
*/ */
@ -63,6 +64,7 @@ public class NbtTextSerializer {
/** /**
* Deserialize a NBT tag from a base-64 encoded string. * Deserialize a NBT tag from a base-64 encoded string.
* @param <TType> Type
* @param input - the base-64 string. * @param input - the base-64 string.
* @return The NBT tag contained in the string. * @return The NBT tag contained in the string.
* @throws IOException If we are unable to parse the input. * @throws IOException If we are unable to parse the input.
@ -87,6 +89,7 @@ public class NbtTextSerializer {
/** /**
* Deserialize a NBT list from a base-64 encoded string. * Deserialize a NBT list from a base-64 encoded string.
* @param <T> Type
* @param input - the base-64 string. * @param input - the base-64 string.
* @return The NBT tag contained in the string. * @return The NBT tag contained in the string.
* @throws IOException If we are unable to parse the input. * @throws IOException If we are unable to parse the input.