Skip to content

Commit 86cfb4b

Browse files
committed
use byte arrays
1 parent dc00d7c commit 86cfb4b

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/dev/_2lstudios/hamsterapi/wrappers/PacketWrapper.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ public class PacketWrapper {
3838
private Map<String, Double> doublesCache;
3939
private Map<String, Float> floatsCache;
4040
private Map<String, Long> longsCache;
41+
private Map<String, byte[]> byteArraysCache;
4142
private Map<String, ItemStack> itemsCache;
4243
private Map<String, Object> objectsCache;
4344

@@ -259,6 +260,18 @@ public Map<String, Long> getLongs() {
259260
}
260261
return this.longsCache = results;
261262
}
263+
264+
public Map<String, byte[]> getByteArrays() {
265+
if (this.byteArraysCache != null) return this.byteArraysCache;
266+
final Map<String, byte[]> results = new HashMap<>();
267+
for (final Field field : getClassFields().values()) {
268+
try {
269+
Object value = field.get(this.packet);
270+
if (value instanceof byte[]) results.put(field.getName(), (byte[]) value);
271+
} catch (IllegalAccessException ignored) {}
272+
}
273+
return this.byteArraysCache = results;
274+
}
262275

263276
public Map<String, ItemStack> getItems() {
264277
if (this.itemsCache != null) return this.itemsCache;

0 commit comments

Comments
 (0)