diff --git a/src/de/steamwar/fightsystem/listener/PlayerConnectionListener.java b/src/de/steamwar/fightsystem/listener/PlayerConnectionListener.java index 5d29ce6..912bc84 100644 --- a/src/de/steamwar/fightsystem/listener/PlayerConnectionListener.java +++ b/src/de/steamwar/fightsystem/listener/PlayerConnectionListener.java @@ -8,6 +8,8 @@ import de.steamwar.fightsystem.fight.FightPlayer; import de.steamwar.fightsystem.fight.FightState; import org.bukkit.Bukkit; import org.bukkit.GameMode; +import org.bukkit.attribute.Attribute; +import org.bukkit.attribute.AttributeInstance; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; @@ -23,6 +25,8 @@ public class PlayerConnectionListener extends BasicListener{ Player player = event.getPlayer(); player.setHealth(20); player.setFoodLevel(20); + AttributeInstance attribute = player.getAttribute(Attribute.GENERIC_ATTACK_SPEED); + attribute.setBaseValue(16); FightTeam fightTeam = Fight.getPlayerTeam(player); diff --git a/src/de/steamwar/fightsystem/utils/TechHider.java b/src/de/steamwar/fightsystem/utils/TechHider.java index 52be39a..117ad1a 100644 --- a/src/de/steamwar/fightsystem/utils/TechHider.java +++ b/src/de/steamwar/fightsystem/utils/TechHider.java @@ -90,7 +90,6 @@ public class TechHider { packet = packet.deepClone(); e.setPacket(packet); - StructureModifier byteArray = packet.getByteArrays(); StructureModifier list = packet.getSpecificModifier(List.class); List nmsTags = list.read(0); boolean changed = false; @@ -106,8 +105,9 @@ public class TechHider { } changed = false; + StructureModifier byteArray = packet.getByteArrays(); byte [] data = byteArray.read(0); - ByteBuf buffer = UnpooledByteBufAllocator.DEFAULT.directBuffer(data.length); + ByteBuf buffer = UnpooledByteBufAllocator.DEFAULT.directBuffer(data.length + 100); int i = 0; while(i < data.length){ @@ -117,8 +117,7 @@ public class TechHider { bitsPerBlock = 4; else if(bitsPerBlock > 8){ bitsPerBlock = 13; - i++; - buffer.writeByte(data[1]); + buffer.writeByte(data[++i]); } if(bitsPerBlock != 13){ @@ -176,6 +175,7 @@ public class TechHider { } if(changed){ + data = new byte[buffer.readableBytes()]; buffer.readBytes(data); byteArray.write(0, data); }