3
0
Mirror von https://github.com/ViaVersion/ViaVersion.git synchronisiert 2024-11-08 17:20:24 +01:00

Move Idle thread.

Dieser Commit ist enthalten in:
Myles 2016-04-20 00:50:44 +01:00
Ursprung c552b12696
Commit 45952d3759
4 geänderte Dateien mit 25 neuen und 24 gelöschten Zeilen

Datei anzeigen

@ -6,7 +6,6 @@ import io.netty.handler.codec.ByteToMessageDecoder;
import us.myles.ViaVersion.ViaVersionPlugin; import us.myles.ViaVersion.ViaVersionPlugin;
import us.myles.ViaVersion.api.PacketWrapper; import us.myles.ViaVersion.api.PacketWrapper;
import us.myles.ViaVersion.api.ViaVersion; import us.myles.ViaVersion.api.ViaVersion;
import us.myles.ViaVersion.api.ViaVersionAPI;
import us.myles.ViaVersion.api.data.UserConnection; import us.myles.ViaVersion.api.data.UserConnection;
import us.myles.ViaVersion.api.type.Type; import us.myles.ViaVersion.api.type.Type;
import us.myles.ViaVersion.exception.CancelException; import us.myles.ViaVersion.exception.CancelException;

Datei anzeigen

@ -4,8 +4,6 @@ import com.google.gson.Gson;
import com.google.gson.GsonBuilder; import com.google.gson.GsonBuilder;
import com.google.gson.JsonObject; import com.google.gson.JsonObject;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.inventory.ItemStack;
import us.myles.ViaVersion.ViaIdleThread;
import us.myles.ViaVersion.ViaVersionPlugin; import us.myles.ViaVersion.ViaVersionPlugin;
import us.myles.ViaVersion.api.PacketWrapper; import us.myles.ViaVersion.api.PacketWrapper;
import us.myles.ViaVersion.api.ViaVersion; import us.myles.ViaVersion.api.ViaVersion;

Datei anzeigen

@ -1,4 +1,4 @@
package us.myles.ViaVersion; package us.myles.ViaVersion.protocols.protocol1_9to1_8;
import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelHandlerContext;
import org.bukkit.scheduler.BukkitRunnable; import org.bukkit.scheduler.BukkitRunnable;

Datei anzeigen

@ -232,8 +232,12 @@ public class WorldPackets {
@Override @Override
public void handle(PacketWrapper wrapper) throws Exception { public void handle(PacketWrapper wrapper) throws Exception {
int status = wrapper.get(Type.UNSIGNED_BYTE, 0); int status = wrapper.get(Type.UNSIGNED_BYTE, 0);
if (status == 6) if (status == 5)
wrapper.cancel(); wrapper.cancel();
if(status > 5){
wrapper.set(Type.UNSIGNED_BYTE, 0, (short) (status - 1));
}
System.out.println("SENDING ID: " + wrapper.get(Type.UNSIGNED_BYTE, 0));
} }
}); });
// Blocking // Blocking
@ -251,25 +255,25 @@ public class WorldPackets {
} }
}); });
// Digging patch (prevents it glitching) // Digging patch (prevents it glitching)
handler(new PacketHandler() { // handler(new PacketHandler() {
@Override // @Override
public void handle(PacketWrapper wrapper) throws Exception { // public void handle(PacketWrapper wrapper) throws Exception {
if(!ViaVersion.getConfig().isBlockBreakPatch()) return; // if(!ViaVersion.getConfig().isBlockBreakPatch()) return;
//
EntityTracker entityTracker = wrapper.user().get(EntityTracker.class); // EntityTracker entityTracker = wrapper.user().get(EntityTracker.class);
final Position block = wrapper.get(Type.POSITION, 0); // final Position block = wrapper.get(Type.POSITION, 0);
int status = wrapper.get(Type.UNSIGNED_BYTE, 0); // int status = wrapper.get(Type.UNSIGNED_BYTE, 0);
if (status == 0) { // if (status == 0) {
entityTracker.setCurrentlyDigging(null); // entityTracker.setCurrentlyDigging(null);
} // }
if (status == 1) { // if (status == 1) {
entityTracker.setCurrentlyDigging(null); // entityTracker.setCurrentlyDigging(null);
} // }
if (status == 2) { // if (status == 2) {
entityTracker.setCurrentlyDigging(block); // entityTracker.setCurrentlyDigging(block);
} // }
} // }
}); // });
} }
}); });