use of io.github.retrooper.packetevents.packetwrappers.WrappedPacket in project packetevents by retrooper.
the class AttributeSnapshotWrapper method getKey.
public String getKey() {
if (stringKeyPresent) {
return readString(0);
} else {
Object attributeBase = readObject(0, attributeBaseClass);
WrappedPacket attributeBaseWrapper = new WrappedPacket(new NMSPacket(attributeBase), attributeBaseClass);
return attributeBaseWrapper.readString(0);
}
}
use of io.github.retrooper.packetevents.packetwrappers.WrappedPacket in project packetevents by retrooper.
the class WrappedPacketOutCustomPayload method getBuffer.
private Object getBuffer() {
Object dataSerializer = readObject(0, NMSUtils.packetDataSerializerClass);
WrappedPacket dataSerializerWrapper = new WrappedPacket(new NMSPacket(dataSerializer));
return dataSerializerWrapper.readObject(0, NMSUtils.byteBufClass);
}
use of io.github.retrooper.packetevents.packetwrappers.WrappedPacket in project packetevents by retrooper.
the class WrappedPacketOutMapChunk method setCompressedData.
public void setCompressedData(byte[] data) {
if (v_1_8_x) {
if (nmsChunkMap == null) {
try {
nmsChunkMap = chunkMapConstructor.newInstance();
} catch (InstantiationException | IllegalAccessException | InvocationTargetException e) {
e.printStackTrace();
}
}
WrappedPacket nmsChunkMapWrapper = new WrappedPacket(new NMSPacket(nmsChunkMap));
nmsChunkMapWrapper.writeByteArray(0, data);
write(chunkMapClass, 0, nmsChunkMap);
} else if (v_1_18) {
new WrappedPacket(new NMSPacket(readObject(0, chunkPacketDataClass))).writeByteArray(0, data);
} else {
writeByteArray(0, data);
}
}
use of io.github.retrooper.packetevents.packetwrappers.WrappedPacket in project packetevents by retrooper.
the class WrappedPacketOutTabComplete method getMatches.
public String[] getMatches() {
if (packet != null) {
if (v_1_13) {
Object suggestions = readObject(0, suggestionsClass);
WrappedPacket suggestionsWrapper = new WrappedPacket(new NMSPacket(suggestions));
List<Object> suggestionList = suggestionsWrapper.readList(0);
String[] matches = new String[suggestionList.size()];
for (int i = 0; i < matches.length; i++) {
Object suggestion = suggestionList.get(i);
WrappedPacket suggestionWrapper = new WrappedPacket(new NMSPacket(suggestion));
matches[i] = suggestionWrapper.readString(0);
}
return matches;
} else {
return readStringArray(0);
}
} else {
return matches;
}
}
use of io.github.retrooper.packetevents.packetwrappers.WrappedPacket in project packetevents by retrooper.
the class WrappedWatchableObject method getIndex.
public int getIndex() {
if (version.isNewerThan(ServerVersion.v_1_8_8)) {
Object dataWatcherObject = readAnyObject(0);
WrappedPacket wrappedDataWatcher = new WrappedPacket(new NMSPacket(dataWatcherObject));
return wrappedDataWatcher.readInt(0);
} else {
return readInt(0);
}
}
Aggregations