Remove unused code, revert some unnecessary changes
Dieser Commit ist enthalten in:
Ursprung
5e5eff5e5f
Commit
3dda5c6a0a
@ -59,14 +59,14 @@ class CommandProtocol extends CommandBase {
|
||||
else if (subCommand.equalsIgnoreCase("timings"))
|
||||
toggleTimings(sender, args);
|
||||
else if (subCommand.equalsIgnoreCase("listeners"))
|
||||
printListeners(sender, args);
|
||||
printListeners(sender);
|
||||
else
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
// Display every listener on the server
|
||||
private void printListeners(final CommandSender sender, String[] args) {
|
||||
private void printListeners(final CommandSender sender) {
|
||||
ProtocolManager manager = ProtocolLibrary.getProtocolManager();
|
||||
|
||||
for (PacketListener listener : manager.getPacketListeners()) {
|
||||
|
@ -77,10 +77,6 @@ public class ProtocolConfig {
|
||||
private int modCount;
|
||||
|
||||
public ProtocolConfig(Plugin plugin) {
|
||||
this(plugin, plugin.getConfig());
|
||||
}
|
||||
|
||||
public ProtocolConfig(Plugin plugin, Configuration config) {
|
||||
this.plugin = plugin;
|
||||
reloadConfig();
|
||||
}
|
||||
|
@ -362,7 +362,7 @@ public class AsyncFilterManager implements AsynchronousManager {
|
||||
* @return Asynchronous marker.
|
||||
*/
|
||||
public AsyncMarker createAsyncMarker() {
|
||||
return createAsyncMarker(AsyncMarker.DEFAULT_SENDING_DELTA, AsyncMarker.DEFAULT_TIMEOUT_DELTA);
|
||||
return createAsyncMarker(AsyncMarker.DEFAULT_TIMEOUT_DELTA);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -371,14 +371,13 @@ public class AsyncFilterManager implements AsynchronousManager {
|
||||
* @param timeoutDelta - how long (in ms) until the packet expire.
|
||||
* @return An async marker.
|
||||
*/
|
||||
public AsyncMarker createAsyncMarker(long sendingDelta, long timeoutDelta) {
|
||||
return createAsyncMarker(sendingDelta, timeoutDelta,
|
||||
currentSendingIndex.incrementAndGet(), System.currentTimeMillis());
|
||||
public AsyncMarker createAsyncMarker(long timeoutDelta) {
|
||||
return createAsyncMarker(timeoutDelta, currentSendingIndex.incrementAndGet());
|
||||
}
|
||||
|
||||
// Helper method
|
||||
private AsyncMarker createAsyncMarker(long sendingDelta, long timeoutDelta, long sendingIndex, long currentTime) {
|
||||
return new AsyncMarker(manager, sendingIndex, sendingDelta, System.currentTimeMillis(), timeoutDelta);
|
||||
private AsyncMarker createAsyncMarker(long timeoutDelta, long sendingIndex) {
|
||||
return new AsyncMarker(manager, sendingIndex, System.currentTimeMillis(), timeoutDelta);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -110,7 +110,7 @@ public class AsyncMarker implements Serializable, Comparable<AsyncMarker> {
|
||||
* Create a container for asyncronous packets.
|
||||
* @param initialTime - the current time in milliseconds since 01.01.1970 00:00.
|
||||
*/
|
||||
AsyncMarker(PacketStream packetStream, long sendingIndex, long sendingDelta, long initialTime, long timeoutDelta) {
|
||||
AsyncMarker(PacketStream packetStream, long sendingIndex, long initialTime, long timeoutDelta) {
|
||||
if (packetStream == null)
|
||||
throw new IllegalArgumentException("packetStream cannot be NULL");
|
||||
|
||||
|
@ -152,8 +152,6 @@ class EntityUtilities {
|
||||
|
||||
} catch (IllegalAccessException e) {
|
||||
throw new FieldAccessException("Security limitation prevented access to the list of tracked players.", e);
|
||||
} catch (InvocationTargetException e) {
|
||||
throw new FieldAccessException("Exception occurred in Minecraft.", e);
|
||||
}
|
||||
}
|
||||
|
||||
@ -164,7 +162,7 @@ class EntityUtilities {
|
||||
* @return The entity tracker entry.
|
||||
* @throws FieldAccessException
|
||||
*/
|
||||
private static Object getEntityTrackerEntry(World world, int entityID) throws FieldAccessException, IllegalArgumentException, IllegalAccessException, InvocationTargetException {
|
||||
private static Object getEntityTrackerEntry(World world, int entityID) throws FieldAccessException, IllegalArgumentException {
|
||||
BukkitUnwrapper unwrapper = new BukkitUnwrapper();
|
||||
Object worldServer = unwrapper.unwrapItem(world);
|
||||
|
||||
|
@ -441,7 +441,7 @@ public final class PacketFilterManager implements ProtocolManager, ListenerInvok
|
||||
playerInjection.checkListener(listener);
|
||||
}
|
||||
if (hasSending)
|
||||
incrementPhases(processPhase(sending, ConnectionSide.SERVER_SIDE));
|
||||
incrementPhases(processPhase(sending));
|
||||
|
||||
// Handle receivers after senders
|
||||
if (hasReceiving) {
|
||||
@ -450,7 +450,7 @@ public final class PacketFilterManager implements ProtocolManager, ListenerInvok
|
||||
enablePacketFilters(listener, receiving.getTypes());
|
||||
}
|
||||
if (hasReceiving)
|
||||
incrementPhases(processPhase(receiving, ConnectionSide.CLIENT_SIDE));
|
||||
incrementPhases(processPhase(receiving));
|
||||
|
||||
// Inform our injected hooks
|
||||
packetListeners.add(listener);
|
||||
@ -458,7 +458,7 @@ public final class PacketFilterManager implements ProtocolManager, ListenerInvok
|
||||
}
|
||||
}
|
||||
|
||||
private GamePhase processPhase(ListeningWhitelist whitelist, ConnectionSide side) {
|
||||
private GamePhase processPhase(ListeningWhitelist whitelist) {
|
||||
// Determine if this is a login packet, ensuring that gamephase detection is enabled
|
||||
if (!whitelist.getGamePhase().hasLogin() &&
|
||||
!whitelist.getOptions().contains(ListenerOptions.DISABLE_GAMEPHASE_DETECTION)) {
|
||||
@ -571,11 +571,11 @@ public final class PacketFilterManager implements ProtocolManager, ListenerInvok
|
||||
// Remove listeners and phases
|
||||
if (sending != null && sending.isEnabled()) {
|
||||
sendingRemoved = sendingListeners.removeListener(listener, sending);
|
||||
decrementPhases(processPhase(sending, ConnectionSide.SERVER_SIDE));
|
||||
decrementPhases(processPhase(sending));
|
||||
}
|
||||
if (receiving != null && receiving.isEnabled()) {
|
||||
receivingRemoved = recievedListeners.removeListener(listener, receiving);
|
||||
decrementPhases(processPhase(receiving, ConnectionSide.CLIENT_SIDE));
|
||||
decrementPhases(processPhase(receiving));
|
||||
}
|
||||
|
||||
// Remove hooks, if needed
|
||||
|
@ -225,7 +225,7 @@ class ChannelInjector extends ByteToMessageDecoder implements Injector {
|
||||
protected void encode(ChannelHandlerContext ctx, Object packet, ByteBuf output) throws Exception {
|
||||
if (packet instanceof WirePacket) {
|
||||
// Special case for wire format
|
||||
ChannelInjector.this.encodeWirePacket(ctx, (WirePacket) packet, output);
|
||||
ChannelInjector.this.encodeWirePacket((WirePacket) packet, output);
|
||||
} else {
|
||||
ChannelInjector.this.encode(ctx, packet, output);
|
||||
}
|
||||
@ -356,7 +356,7 @@ class ChannelInjector extends ByteToMessageDecoder implements Injector {
|
||||
*/
|
||||
private boolean guessCompression(ChannelHandler handler) {
|
||||
String className = handler != null ? handler.getClass().getCanonicalName() : null;
|
||||
return className.contains("PacketCompressor") || className.contains("PacketDecompressor");
|
||||
return className.contains("Compressor") || className.contains("Decompressor");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -386,7 +386,7 @@ class ChannelInjector extends ByteToMessageDecoder implements Injector {
|
||||
super.exceptionCaught(ctx, cause);
|
||||
}
|
||||
|
||||
protected void encodeWirePacket(ChannelHandlerContext ctx, WirePacket packet, ByteBuf output) throws Exception {
|
||||
protected void encodeWirePacket(WirePacket packet, ByteBuf output) throws Exception {
|
||||
packet.writeId(output);
|
||||
packet.writeBytes(output);
|
||||
}
|
||||
|
@ -160,19 +160,16 @@ public class PipelineProxy implements ChannelPipeline {
|
||||
}
|
||||
|
||||
// We have to call the depreciated methods to properly implement the proxy
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
public ChannelFuture deregister() {
|
||||
return pipeline.deregister();
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
public ChannelFuture deregister(ChannelPromise arg0) {
|
||||
return pipeline.deregister(arg0);
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
public ChannelPipeline fireChannelUnregistered() {
|
||||
pipeline.fireChannelUnregistered();
|
||||
|
@ -53,6 +53,7 @@ public class InterceptWritePacket {
|
||||
this.modifierRest = new WritePacketModifier(reporter, false);
|
||||
}
|
||||
|
||||
// TODO: PacketId should probably do something...
|
||||
private Class<?> createProxyClass(int packetId) {
|
||||
// Construct the proxy object
|
||||
Enhancer ex = EnhancerFactory.getInstance().createEnhancer();
|
||||
|
@ -11,8 +11,7 @@ import javax.annotation.Nonnull;
|
||||
import com.comphenix.protocol.PacketType;
|
||||
import com.comphenix.protocol.events.ConnectionSide;
|
||||
import com.comphenix.protocol.events.NetworkMarker;
|
||||
import com.google.common.io.ByteStreams;
|
||||
import com.google.common.io.InputSupplier;
|
||||
import com.google.common.io.ByteSource;
|
||||
import com.google.common.primitives.Bytes;
|
||||
|
||||
/**
|
||||
@ -39,27 +38,26 @@ public class LegacyNetworkMarker extends NetworkMarker {
|
||||
return ByteBuffer.wrap(Bytes.concat(new byte[] { (byte) type.getLegacyId() }, buffer.array()));
|
||||
}
|
||||
|
||||
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||
@Override
|
||||
protected DataInputStream addHeader(final DataInputStream input, final PacketType type) {
|
||||
InputSupplier<InputStream> header = new InputSupplier<InputStream>() {
|
||||
ByteSource header = new ByteSource() {
|
||||
@Override
|
||||
public InputStream getInput() throws IOException {
|
||||
public InputStream openStream() throws IOException {
|
||||
byte[] data = new byte[] { (byte) type.getLegacyId() };
|
||||
return new ByteArrayInputStream(data);
|
||||
}
|
||||
};
|
||||
|
||||
InputSupplier<InputStream> data = new InputSupplier<InputStream>() {
|
||||
ByteSource data = new ByteSource() {
|
||||
@Override
|
||||
public InputStream getInput() throws IOException {
|
||||
public InputStream openStream() throws IOException {
|
||||
return input;
|
||||
}
|
||||
};
|
||||
|
||||
// Combine them into a single stream
|
||||
try {
|
||||
return new DataInputStream(ByteStreams.join((InputSupplier) header, (InputSupplier) data).getInput());
|
||||
return new DataInputStream(ByteSource.concat(header, data).openStream());
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException("Cannot add header.", e);
|
||||
}
|
||||
|
@ -77,9 +77,7 @@ class NetworkFieldInjector extends PlayerInjector {
|
||||
// Determine if we're listening
|
||||
private IntegerSet sendingFilters;
|
||||
|
||||
public NetworkFieldInjector(ErrorReporter reporter, Player player,
|
||||
ListenerInvoker manager, IntegerSet sendingFilters) throws IllegalAccessException {
|
||||
|
||||
public NetworkFieldInjector(ErrorReporter reporter, Player player, ListenerInvoker manager, IntegerSet sendingFilters) {
|
||||
super(reporter, player, manager);
|
||||
this.sendingFilters = sendingFilters;
|
||||
}
|
||||
@ -178,6 +176,7 @@ class NetworkFieldInjector extends PlayerInjector {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
protected void cleanHook() {
|
||||
// Clean up
|
||||
|
@ -81,8 +81,7 @@ class NetworkServerInjector extends PlayerInjector {
|
||||
public NetworkServerInjector(
|
||||
ErrorReporter reporter, Player player,
|
||||
ListenerInvoker invoker, IntegerSet sendingFilters,
|
||||
InjectedServerConnection serverInjection) throws IllegalAccessException {
|
||||
|
||||
InjectedServerConnection serverInjection) {
|
||||
super(reporter, player, invoker);
|
||||
this.sendingFilters = sendingFilters;
|
||||
this.serverInjection = serverInjection;
|
||||
|
@ -137,7 +137,7 @@ public abstract class PlayerInjector implements SocketInjector {
|
||||
boolean updateOnLogin;
|
||||
volatile Player updatedPlayer;
|
||||
|
||||
public PlayerInjector(ErrorReporter reporter, Player player, ListenerInvoker invoker) throws IllegalAccessException {
|
||||
public PlayerInjector(ErrorReporter reporter, Player player, ListenerInvoker invoker) {
|
||||
this.reporter = reporter;
|
||||
this.player = player;
|
||||
this.invoker = invoker;
|
||||
@ -176,7 +176,7 @@ public abstract class PlayerInjector implements SocketInjector {
|
||||
* @param player - the player to hook.
|
||||
*/
|
||||
public void initializePlayer(Player player) {
|
||||
Object notchEntity = getEntityPlayer((Player) player);
|
||||
Object notchEntity = getEntityPlayer(player);
|
||||
|
||||
// Save the player too
|
||||
this.player = player;
|
||||
|
@ -124,7 +124,7 @@ public class PrettyPrinter {
|
||||
}
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
private static void printIterables(StringBuilder output, Iterable iterable, Class<?> current, Class<?> stop,
|
||||
private static void printIterables(StringBuilder output, Iterable iterable, Class<?> stop,
|
||||
Set<Object> previous, int hierachyIndex, ObjectPrinter printer) throws IllegalAccessException {
|
||||
|
||||
boolean first = true;
|
||||
@ -270,7 +270,7 @@ public class PrettyPrinter {
|
||||
} else if (type.isArray()) {
|
||||
printArray(output, value, type, stop, previous, hierachyIndex, printer);
|
||||
} else if (Iterable.class.isAssignableFrom(type)) {
|
||||
printIterables(output, (Iterable) value, type, stop, previous, hierachyIndex, printer);
|
||||
printIterables(output, (Iterable) value, stop, previous, hierachyIndex, printer);
|
||||
} else if (Map.class.isAssignableFrom(type)) {
|
||||
printMap(output, (Map<Object, Object>) value, type, stop, previous, hierachyIndex, printer);
|
||||
} else if (ClassLoader.class.isAssignableFrom(type) || previous.contains(value)) {
|
||||
|
@ -12,7 +12,6 @@ import com.comphenix.protocol.timing.TimedListenerManager.ListenerType;
|
||||
import com.google.common.base.Charsets;
|
||||
import com.google.common.base.Strings;
|
||||
import com.google.common.collect.Sets;
|
||||
import com.google.common.io.Closer;
|
||||
import com.google.common.io.Files;
|
||||
|
||||
public class TimingReportGenerator {
|
||||
@ -29,14 +28,13 @@ public class TimingReportGenerator {
|
||||
private static final String SUM_MAIN_THREAD = " => Time on main thread: %.6f ms" + NEWLINE;
|
||||
|
||||
public void saveTo(File destination, TimedListenerManager manager) throws IOException {
|
||||
Closer closer = Closer.create();
|
||||
BufferedWriter writer = null;
|
||||
Date started = manager.getStarted();
|
||||
Date stopped = manager.getStopped();
|
||||
long seconds = Math.abs((stopped.getTime() - started.getTime()) / 1000);
|
||||
|
||||
try {
|
||||
writer = closer.register(Files.newWriter(destination, Charsets.UTF_8));
|
||||
writer = Files.newWriter(destination, Charsets.UTF_8);
|
||||
|
||||
// Write some timing information
|
||||
writer.write(String.format(META_STARTED, started));
|
||||
@ -62,7 +60,9 @@ public class TimingReportGenerator {
|
||||
writer.write(NEWLINE);
|
||||
}
|
||||
} finally {
|
||||
closer.close();
|
||||
if (writer != null) {
|
||||
writer.flush();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -104,12 +104,12 @@ public class StreamSerializer {
|
||||
if (READ_ITEM_METHOD == null) {
|
||||
READ_ITEM_METHOD = Accessors.getMethodAccessor(
|
||||
FuzzyReflection.fromClass(MinecraftReflection.getPacketDataSerializerClass(), true).
|
||||
getMethodByParameters("i", /* readItemStack */
|
||||
getMethodByParameters("readItemStack", /* i */
|
||||
MinecraftReflection.getItemStackClass(), new Class<?>[0])
|
||||
);
|
||||
}
|
||||
nmsItem = READ_ITEM_METHOD.invoke(ByteBufAdapter.packetReader(input));
|
||||
|
||||
nmsItem = READ_ITEM_METHOD.invoke(ByteBufAdapter.packetReader(input));
|
||||
} else {
|
||||
if (READ_ITEM_METHOD == null) {
|
||||
READ_ITEM_METHOD = Accessors.getMethodAccessor(
|
||||
@ -121,6 +121,7 @@ public class StreamSerializer {
|
||||
build())
|
||||
);
|
||||
}
|
||||
|
||||
nmsItem = READ_ITEM_METHOD.invoke(null, input);
|
||||
}
|
||||
|
||||
@ -147,12 +148,12 @@ public class StreamSerializer {
|
||||
if (READ_NBT_METHOD == null) {
|
||||
READ_NBT_METHOD = Accessors.getMethodAccessor(
|
||||
FuzzyReflection.fromClass(MinecraftReflection.getPacketDataSerializerClass(), true).
|
||||
getMethodByParameters("h", /* readNbtCompound */
|
||||
getMethodByParameters("readNbtCompound", /* h */
|
||||
MinecraftReflection.getNBTCompoundClass(), new Class<?>[0])
|
||||
);
|
||||
}
|
||||
nmsCompound = READ_NBT_METHOD.invoke(ByteBufAdapter.packetReader(input));
|
||||
|
||||
nmsCompound = READ_NBT_METHOD.invoke(ByteBufAdapter.packetReader(input));
|
||||
} else {
|
||||
if (READ_NBT_METHOD == null) {
|
||||
READ_NBT_METHOD = Accessors.getMethodAccessor(
|
||||
@ -200,12 +201,12 @@ public class StreamSerializer {
|
||||
if (READ_STRING_METHOD == null) {
|
||||
READ_STRING_METHOD = Accessors.getMethodAccessor(
|
||||
FuzzyReflection.fromClass(MinecraftReflection.getPacketDataSerializerClass(), true).
|
||||
getMethodByParameters("c", /* readString */
|
||||
getMethodByParameters("readString", /* c */
|
||||
String.class, new Class<?>[] { int.class })
|
||||
);
|
||||
}
|
||||
return (String) READ_STRING_METHOD.invoke(ByteBufAdapter.packetReader(input), maximumLength);
|
||||
|
||||
return (String) READ_STRING_METHOD.invoke(ByteBufAdapter.packetReader(input), maximumLength);
|
||||
} else {
|
||||
if (READ_STRING_METHOD == null) {
|
||||
READ_STRING_METHOD = Accessors.getMethodAccessor(
|
||||
@ -218,6 +219,7 @@ public class StreamSerializer {
|
||||
build())
|
||||
);
|
||||
}
|
||||
|
||||
return (String) READ_STRING_METHOD.invoke(null, input, maximumLength);
|
||||
}
|
||||
}
|
||||
@ -259,12 +261,12 @@ public class StreamSerializer {
|
||||
if (WRITE_ITEM_METHOD == null) {
|
||||
WRITE_ITEM_METHOD = Accessors.getMethodAccessor(
|
||||
FuzzyReflection.fromClass(MinecraftReflection.getPacketDataSerializerClass(), true).
|
||||
getMethodByParameters("a", /* writeStack */
|
||||
getMethodByParameters("writeStack", /* a */
|
||||
MinecraftReflection.getItemStackClass())
|
||||
);
|
||||
}
|
||||
WRITE_ITEM_METHOD.invoke(ByteBufAdapter.packetWriter(output), nmsItem);
|
||||
|
||||
WRITE_ITEM_METHOD.invoke(ByteBufAdapter.packetWriter(output), nmsItem);
|
||||
} else {
|
||||
if (WRITE_ITEM_METHOD == null)
|
||||
WRITE_ITEM_METHOD = Accessors.getMethodAccessor(
|
||||
@ -275,6 +277,7 @@ public class StreamSerializer {
|
||||
parameterDerivedOf(DataOutput.class, 1).
|
||||
build())
|
||||
);
|
||||
|
||||
WRITE_ITEM_METHOD.invoke(null, nmsItem, output);
|
||||
}
|
||||
}
|
||||
@ -299,12 +302,12 @@ public class StreamSerializer {
|
||||
if (WRITE_NBT_METHOD == null) {
|
||||
WRITE_NBT_METHOD = Accessors.getMethodAccessor(
|
||||
FuzzyReflection.fromClass(MinecraftReflection.getPacketDataSerializerClass(), true).
|
||||
getMethodByParameters("a", /* writeNbtCompound */
|
||||
getMethodByParameters("writeNbtCompound", /* a */
|
||||
MinecraftReflection.getNBTCompoundClass())
|
||||
);
|
||||
}
|
||||
WRITE_NBT_METHOD.invoke(ByteBufAdapter.packetWriter(output), handle);
|
||||
|
||||
WRITE_NBT_METHOD.invoke(ByteBufAdapter.packetWriter(output), handle);
|
||||
} else {
|
||||
if (WRITE_NBT_METHOD == null) {
|
||||
WRITE_NBT_METHOD = Accessors.getMethodAccessor(
|
||||
@ -317,6 +320,7 @@ public class StreamSerializer {
|
||||
build())
|
||||
);
|
||||
}
|
||||
|
||||
WRITE_NBT_METHOD.invoke(null, handle, output);
|
||||
}
|
||||
}
|
||||
@ -339,12 +343,12 @@ public class StreamSerializer {
|
||||
if (WRITE_STRING_METHOD == null) {
|
||||
WRITE_STRING_METHOD = Accessors.getMethodAccessor(
|
||||
FuzzyReflection.fromClass(MinecraftReflection.getPacketDataSerializerClass(), true).
|
||||
getMethodByParameters("a", /* writeString */
|
||||
getMethodByParameters("writeString", /* a */
|
||||
String.class)
|
||||
);
|
||||
}
|
||||
WRITE_STRING_METHOD.invoke(ByteBufAdapter.packetWriter(output), text);
|
||||
|
||||
WRITE_STRING_METHOD.invoke(ByteBufAdapter.packetWriter(output), text);
|
||||
} else {
|
||||
if (WRITE_STRING_METHOD == null) {
|
||||
WRITE_STRING_METHOD = Accessors.getMethodAccessor(
|
||||
@ -357,6 +361,7 @@ public class StreamSerializer {
|
||||
build())
|
||||
);
|
||||
}
|
||||
|
||||
WRITE_STRING_METHOD.invoke(null, text, output);
|
||||
}
|
||||
}
|
||||
@ -371,12 +376,12 @@ public class StreamSerializer {
|
||||
* @throws IOException If the operation fails due to reflection problems.
|
||||
*/
|
||||
public String serializeItemStack(ItemStack stack) throws IOException {
|
||||
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
|
||||
DataOutputStream dataOutput = new DataOutputStream(outputStream);
|
||||
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
|
||||
DataOutputStream dataOutput = new DataOutputStream(outputStream);
|
||||
|
||||
serializeItemStack(dataOutput, stack);
|
||||
serializeItemStack(dataOutput, stack);
|
||||
|
||||
// Serialize that array
|
||||
// Serialize that array
|
||||
return Base64Coder.encodeLines(outputStream.toByteArray());
|
||||
}
|
||||
}
|
||||
|
@ -25,9 +25,9 @@ public class WrappedChatComponent extends AbstractWrapper {
|
||||
FuzzyReflection fuzzy = FuzzyReflection.fromClass(SERIALIZER);
|
||||
|
||||
// Retrieve the correct methods
|
||||
SERIALIZE_COMPONENT = Accessors.getMethodAccessor(fuzzy.getMethodByParameters("a", /* serialize */
|
||||
SERIALIZE_COMPONENT = Accessors.getMethodAccessor(fuzzy.getMethodByParameters("serialize", /* a */
|
||||
String.class, new Class<?>[] { COMPONENT }));
|
||||
DESERIALIZE_COMPONENT = Accessors.getMethodAccessor(fuzzy.getMethodByParameters("a", /* serialize */
|
||||
DESERIALIZE_COMPONENT = Accessors.getMethodAccessor(fuzzy.getMethodByParameters("deserialize", /* a */
|
||||
COMPONENT, new Class<?>[] { String.class }));
|
||||
|
||||
// Get a component from a standard Minecraft message
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren