Skip to content

Commit 5421746

Browse files
committed
Fixes
1 parent 6c2e444 commit 5421746

File tree

7 files changed

+14
-13
lines changed

7 files changed

+14
-13
lines changed

Api/src/main/java/uwu/narumi/packetlib/api/helper/ReflectionHelper.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ public final class ReflectionHelper {
2121
try {
2222
BUKKIT = Bukkit.getServer().getClass().getName().replace(".CraftServer", "");
2323
NMS = BUKKIT.replace("org.bukkit.craftbukkit", "net.minecraft.server");
24-
VERSION = (BUKKIT.split("\\.")[BUKKIT.split("\\.").length - 1]).substring(1).replace("_", "."); //Yes i know boiler plate
24+
VERSION = (BUKKIT.split("\\.")[BUKKIT.split("\\.").length - 1]).substring(1)
25+
.replace("_", "."); //Yes i know boiler plate
2526

2627
Class<?> craftPlayerClass = Class.forName(BUKKIT + ".entity.CraftPlayer");
2728
Class<?> entityPlayerClass = Class.forName(NMS + ".EntityPlayer");

EthyrNBT/src/main/java/uwu/narumi/nbt/helper/NbtStreamHelper.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
import java.io.IOException;
66
import uwu.narumi.nbt.NbtTag;
77
import uwu.narumi.nbt.NbtType;
8-
import uwu.narumi.nbt.exception.NBTException;
98

109
public class NbtStreamHelper {
1110

EthyrNBT/src/main/java/uwu/narumi/nbt/impl/CompoundTag.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ private String getTagsString() {
139139
.append("name=")
140140
.append(name)
141141
.append(", ")
142-
.append(tag.toString())
142+
.append(tag)
143143
.append((atomicInteger.get() >= tags.size() ? "" : ", "));
144144
});
145145

EthyrStack/src/main/java/uwu/narumi/itemstack/helper/ItemStackStreamHelper.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
import io.netty.buffer.ByteBufInputStream;
55
import io.netty.buffer.ByteBufOutputStream;
66
import java.io.IOException;
7-
import net.minecraft.server.v1_8_R3.NBTBase;
87
import uwu.narumi.itemstack.ItemStack;
98
import uwu.narumi.nbt.NbtTag;
109
import uwu.narumi.nbt.helper.NbtStreamHelper;
@@ -20,10 +19,11 @@ public static void writeItemStack(ItemStack itemStack, ByteBuf buf) throws IOExc
2019
buf.writeByte(itemStack.amount());
2120
buf.writeShort(itemStack.data());
2221

23-
if (itemStack.getCompoundTag() != null)
22+
if (itemStack.getCompoundTag() != null) {
2423
NbtStreamHelper.writeTag(itemStack.getCompoundTag(), new ByteBufOutputStream(buf));
25-
else
24+
} else {
2625
buf.writeByte(0);
26+
}
2727
}
2828
}
2929

@@ -34,7 +34,8 @@ public static ItemStack readItemStack(ByteBuf buf) throws IOException {
3434
byte amount = buf.readByte();
3535
short data = buf.readShort();
3636
NbtTag compoundTag = NbtStreamHelper.readTag(new ByteBufInputStream(buf));
37-
itemStack = new ItemStack(id, amount, data, compoundTag instanceof CompoundTag ? (CompoundTag) compoundTag : null);
37+
itemStack = new ItemStack(id, amount, data,
38+
compoundTag instanceof CompoundTag ? (CompoundTag) compoundTag : null);
3839
}
3940

4041
return itemStack;

Example/src/main/java/uwu/narumi/example/itemstack/ItemStackExample.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
public class ItemStackExample {
88

9-
public static void main(String... args) throws Exception {
9+
public static void main(String... args) {
1010
CompoundTag compoundTag = new CompoundTag();
1111
compoundTag.with("pages",
1212
new StringTag("page 1"),
@@ -25,6 +25,6 @@ public static void main(String... args) throws Exception {
2525
itemStack.lore("lore1", "lore2");
2626
itemStack.enchant(5, 1);
2727

28-
System.out.println(itemStack.toString());
28+
System.out.println(itemStack);
2929
}
3030
}

Example/src/main/java/uwu/narumi/example/nbt/NamedBinaryTagExample.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public static void main(String... args) throws Exception {
4141

4242
try (DataInputStream in = new DataInputStream(new FileInputStream("test.nbt"))) {
4343
CompoundTag tag = (CompoundTag) NbtStreamHelper.readTag(in);
44-
System.out.println(tag.toString());
44+
System.out.println(tag);
4545
}
4646
}
4747
}

Example/src/main/java/uwu/narumi/example/packetlib/PluginExample.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package uwu.narumi.example.packetlib;
22

33
import io.netty.buffer.ByteBuf;
4+
import java.io.IOException;
45
import java.util.UUID;
56
import java.util.concurrent.ConcurrentHashMap;
67
import java.util.concurrent.ConcurrentMap;
@@ -12,7 +13,6 @@
1213
import uwu.narumi.itemstack.ItemStack;
1314
import uwu.narumi.itemstack.helper.ItemStackStreamHelper;
1415
import uwu.narumi.nbt.impl.CompoundTag;
15-
import uwu.narumi.packetlib.api.helper.BufHelper;
1616
import uwu.narumi.packetlib.api.helper.ReflectionHelper;
1717
import uwu.narumi.packetlib.api.packet.PacketHandler;
1818
import uwu.narumi.packetlib.api.packet.PacketInterceptor;
@@ -80,7 +80,7 @@ public PacketInterceptorExample(Session session) {
8080
}
8181

8282
@Override
83-
public PacketState receive(int packetId, ByteBuf data, ByteBuf newData) throws Exception {
83+
public PacketState receive(int packetId, ByteBuf data, ByteBuf newData) throws IOException {
8484
if (packetId == 0x10 && canReWrite) {
8585
newData.writeShort(data.readShort()); //Slot id
8686

@@ -89,7 +89,7 @@ public PacketState receive(int packetId, ByteBuf data, ByteBuf newData) throws E
8989
itemStack.setCompoundTag(new CompoundTag()); //setting new item nbt
9090
itemStack.name("Noice");
9191
itemStack.lore("B", "U", "S", "T", "A", "R", "D");
92-
itemStack.enchant(1,1);
92+
itemStack.enchant(1, 1);
9393
}
9494

9595
ItemStackStreamHelper.writeItemStack(itemStack, newData); //writing new data

0 commit comments

Comments
 (0)