FULLCHUNK TECHHIDER + Performanceimprovement + Bugfix #211
@ -25,15 +25,12 @@ import com.comphenix.protocol.events.PacketAdapter;
|
|||||||
import com.comphenix.protocol.events.PacketContainer;
|
import com.comphenix.protocol.events.PacketContainer;
|
||||||
import com.comphenix.protocol.events.PacketEvent;
|
import com.comphenix.protocol.events.PacketEvent;
|
||||||
import com.comphenix.protocol.reflect.StructureModifier;
|
import com.comphenix.protocol.reflect.StructureModifier;
|
||||||
import com.comphenix.protocol.wrappers.WrappedBlockData;
|
|
||||||
import com.comphenix.protocol.wrappers.nbt.NbtBase;
|
import com.comphenix.protocol.wrappers.nbt.NbtBase;
|
||||||
import com.comphenix.protocol.wrappers.nbt.NbtCompound;
|
import com.comphenix.protocol.wrappers.nbt.NbtCompound;
|
||||||
import de.steamwar.fightsystem.Config;
|
import de.steamwar.fightsystem.Config;
|
||||||
import de.steamwar.fightsystem.IFightSystem;
|
import de.steamwar.fightsystem.IFightSystem;
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
import io.netty.buffer.UnpooledByteBufAllocator;
|
import io.netty.buffer.UnpooledByteBufAllocator;
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.World;
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
@ -45,9 +42,6 @@ import static de.steamwar.fightsystem.utils.ITechHider.bypass;
|
|||||||
public class TechHider_15 {
|
public class TechHider_15 {
|
||||||
private TechHider_15(){}
|
private TechHider_15(){}
|
||||||
|
|
||||||
private static final World WORLD = Bukkit.getWorlds().get(0);
|
|
||||||
private static final WrappedBlockData WRAPPED_BLOCK_DATA = WrappedBlockData.createData(ITechHider.obfuscateMaterial);
|
|
||||||
|
|
||||||
static void start(){
|
static void start(){
|
||||||
chunkHider();
|
chunkHider();
|
||||||
}
|
}
|
||||||
@ -59,7 +53,6 @@ public class TechHider_15 {
|
|||||||
ProtocolLibrary.getProtocolManager().getAsynchronousManager().registerAsyncHandler(new PacketAdapter(IFightSystem.getPlugin(), PacketType.Play.Server.MAP_CHUNK) {
|
ProtocolLibrary.getProtocolManager().getAsynchronousManager().registerAsyncHandler(new PacketAdapter(IFightSystem.getPlugin(), PacketType.Play.Server.MAP_CHUNK) {
|
||||||
@Override
|
@Override
|
||||||
public void onPacketSending(PacketEvent e) {
|
public void onPacketSending(PacketEvent e) {
|
||||||
long startTime = System.nanoTime();
|
|
||||||
PacketContainer packet = e.getPacket();
|
PacketContainer packet = e.getPacket();
|
||||||
StructureModifier<Integer> ints = packet.getIntegers();
|
StructureModifier<Integer> ints = packet.getIntegers();
|
||||||
|
|
||||||
@ -132,13 +125,11 @@ public class TechHider_15 {
|
|||||||
i += dataArrayLengthLength;
|
i += dataArrayLengthLength;
|
||||||
i += dataArrayLength * 8;
|
i += dataArrayLength * 8;
|
||||||
}else{
|
}else{
|
||||||
System.out.println("Full chunk: " + (chunkX*16) + " " + (chunkY*16) + " " + (chunkZ*16));
|
|
||||||
//Full Chunk/no palette, so the chunk has to be crawled through
|
//Full Chunk/no palette, so the chunk has to be crawled through
|
||||||
int dataArrayLength = ITechHider.readVarInt(data, i);
|
int dataArrayLength = ITechHider.readVarInt(data, i);
|
||||||
int dataArrayLengthLength = ITechHider.readVarIntLength(data, i);
|
int dataArrayLengthLength = ITechHider.readVarIntLength(data, i);
|
||||||
buffer.writeBytes(data, i, dataArrayLengthLength);
|
buffer.writeBytes(data, i, dataArrayLengthLength);
|
||||||
i += dataArrayLengthLength;
|
i += dataArrayLengthLength;
|
||||||
System.out.println(dataArrayLength + " " + bitsPerBlock);
|
|
||||||
|
|
||||||
ByteBuffer source = ByteBuffer.wrap(data, i, dataArrayLength * 8);
|
ByteBuffer source = ByteBuffer.wrap(data, i, dataArrayLength * 8);
|
||||||
VariableValueArray values = new VariableValueArray(bitsPerBlock, dataArrayLength, source.asLongBuffer());
|
VariableValueArray values = new VariableValueArray(bitsPerBlock, dataArrayLength, source.asLongBuffer());
|
||||||
|
|||||||
@ -165,9 +156,6 @@ public class TechHider_15 {
|
|||||||
data = new byte[buffer.readableBytes()];
|
data = new byte[buffer.readableBytes()];
|
||||||
buffer.readBytes(data);
|
buffer.readBytes(data);
|
||||||
byteArray.write(0, data);
|
byteArray.write(0, data);
|
||||||
System.out.println("changes: " + (System.nanoTime() - startTime));
|
|
||||||
}else{
|
|
||||||
System.out.println("without changes: " + (System.nanoTime() - startTime));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}).start(ITechHider.threadMultiplier * 4);
|
}).start(ITechHider.threadMultiplier * 4);
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren
Noch eine