mirror of
https://github.com/ViaVersion/ViaVersion.git
synced 2024-11-23 02:25:19 +01:00
Move Idle thread.
This commit is contained in:
parent
c552b12696
commit
45952d3759
@ -6,7 +6,6 @@ import io.netty.handler.codec.ByteToMessageDecoder;
|
||||
import us.myles.ViaVersion.ViaVersionPlugin;
|
||||
import us.myles.ViaVersion.api.PacketWrapper;
|
||||
import us.myles.ViaVersion.api.ViaVersion;
|
||||
import us.myles.ViaVersion.api.ViaVersionAPI;
|
||||
import us.myles.ViaVersion.api.data.UserConnection;
|
||||
import us.myles.ViaVersion.api.type.Type;
|
||||
import us.myles.ViaVersion.exception.CancelException;
|
||||
|
@ -4,8 +4,6 @@ import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import com.google.gson.JsonObject;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import us.myles.ViaVersion.ViaIdleThread;
|
||||
import us.myles.ViaVersion.ViaVersionPlugin;
|
||||
import us.myles.ViaVersion.api.PacketWrapper;
|
||||
import us.myles.ViaVersion.api.ViaVersion;
|
||||
|
@ -1,4 +1,4 @@
|
||||
package us.myles.ViaVersion;
|
||||
package us.myles.ViaVersion.protocols.protocol1_9to1_8;
|
||||
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
@ -232,8 +232,12 @@ public class WorldPackets {
|
||||
@Override
|
||||
public void handle(PacketWrapper wrapper) throws Exception {
|
||||
int status = wrapper.get(Type.UNSIGNED_BYTE, 0);
|
||||
if (status == 6)
|
||||
if (status == 5)
|
||||
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
|
||||
@ -251,25 +255,25 @@ public class WorldPackets {
|
||||
}
|
||||
});
|
||||
// Digging patch (prevents it glitching)
|
||||
handler(new PacketHandler() {
|
||||
@Override
|
||||
public void handle(PacketWrapper wrapper) throws Exception {
|
||||
if(!ViaVersion.getConfig().isBlockBreakPatch()) return;
|
||||
|
||||
EntityTracker entityTracker = wrapper.user().get(EntityTracker.class);
|
||||
final Position block = wrapper.get(Type.POSITION, 0);
|
||||
int status = wrapper.get(Type.UNSIGNED_BYTE, 0);
|
||||
if (status == 0) {
|
||||
entityTracker.setCurrentlyDigging(null);
|
||||
}
|
||||
if (status == 1) {
|
||||
entityTracker.setCurrentlyDigging(null);
|
||||
}
|
||||
if (status == 2) {
|
||||
entityTracker.setCurrentlyDigging(block);
|
||||
}
|
||||
}
|
||||
});
|
||||
// handler(new PacketHandler() {
|
||||
// @Override
|
||||
// public void handle(PacketWrapper wrapper) throws Exception {
|
||||
// if(!ViaVersion.getConfig().isBlockBreakPatch()) return;
|
||||
//
|
||||
// EntityTracker entityTracker = wrapper.user().get(EntityTracker.class);
|
||||
// final Position block = wrapper.get(Type.POSITION, 0);
|
||||
// int status = wrapper.get(Type.UNSIGNED_BYTE, 0);
|
||||
// if (status == 0) {
|
||||
// entityTracker.setCurrentlyDigging(null);
|
||||
// }
|
||||
// if (status == 1) {
|
||||
// entityTracker.setCurrentlyDigging(null);
|
||||
// }
|
||||
// if (status == 2) {
|
||||
// entityTracker.setCurrentlyDigging(block);
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
}
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user