SteamWar/FightSystem
Archiviert
13
1

Techhider + 1.8 PvP

Dieser Commit ist enthalten in:
Lixfel 2019-09-29 19:35:32 +02:00
Ursprung b6d622b170
Commit 2921f53194
2 geänderte Dateien mit 8 neuen und 4 gelöschten Zeilen

Datei anzeigen

@ -8,6 +8,8 @@ import de.steamwar.fightsystem.fight.FightPlayer;
import de.steamwar.fightsystem.fight.FightState; import de.steamwar.fightsystem.fight.FightState;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.GameMode; import org.bukkit.GameMode;
import org.bukkit.attribute.Attribute;
import org.bukkit.attribute.AttributeInstance;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority; import org.bukkit.event.EventPriority;
@ -23,6 +25,8 @@ public class PlayerConnectionListener extends BasicListener{
Player player = event.getPlayer(); Player player = event.getPlayer();
player.setHealth(20); player.setHealth(20);
player.setFoodLevel(20); player.setFoodLevel(20);
AttributeInstance attribute = player.getAttribute(Attribute.GENERIC_ATTACK_SPEED);
attribute.setBaseValue(16);
FightTeam fightTeam = Fight.getPlayerTeam(player); FightTeam fightTeam = Fight.getPlayerTeam(player);

Datei anzeigen

@ -90,7 +90,6 @@ public class TechHider {
packet = packet.deepClone(); packet = packet.deepClone();
e.setPacket(packet); e.setPacket(packet);
StructureModifier<byte[]> byteArray = packet.getByteArrays();
StructureModifier<List> list = packet.getSpecificModifier(List.class); StructureModifier<List> list = packet.getSpecificModifier(List.class);
List nmsTags = list.read(0); List nmsTags = list.read(0);
boolean changed = false; boolean changed = false;
@ -106,8 +105,9 @@ public class TechHider {
} }
changed = false; changed = false;
StructureModifier<byte[]> byteArray = packet.getByteArrays();
byte [] data = byteArray.read(0); byte [] data = byteArray.read(0);
ByteBuf buffer = UnpooledByteBufAllocator.DEFAULT.directBuffer(data.length); ByteBuf buffer = UnpooledByteBufAllocator.DEFAULT.directBuffer(data.length + 100);
int i = 0; int i = 0;
while(i < data.length){ while(i < data.length){
@ -117,8 +117,7 @@ public class TechHider {
bitsPerBlock = 4; bitsPerBlock = 4;
else if(bitsPerBlock > 8){ else if(bitsPerBlock > 8){
bitsPerBlock = 13; bitsPerBlock = 13;
i++; buffer.writeByte(data[++i]);
buffer.writeByte(data[1]);
} }
if(bitsPerBlock != 13){ if(bitsPerBlock != 13){
@ -176,6 +175,7 @@ public class TechHider {
} }
if(changed){ if(changed){
data = new byte[buffer.readableBytes()];
buffer.readBytes(data); buffer.readBytes(data);
byteArray.write(0, data); byteArray.write(0, data);
} }