mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-09 08:32:07 -07:00
Update CraftBukkit to Minecraft 1.3.1
This commit is contained in:
committed by
Travis Watkins
parent
08e2923bd4
commit
a43d621c01
@@ -1,6 +1,10 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.DataInputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.Random;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
@@ -10,7 +14,6 @@ import java.util.logging.Level;
|
||||
import java.util.HashSet;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.craftbukkit.CraftWorld;
|
||||
import org.bukkit.craftbukkit.inventory.CraftInventoryView;
|
||||
import org.bukkit.craftbukkit.inventory.CraftItemStack;
|
||||
import org.bukkit.craftbukkit.entity.CraftPlayer;
|
||||
@@ -29,7 +32,6 @@ import org.bukkit.event.player.PlayerMoveEvent;
|
||||
import org.bukkit.event.player.PlayerTeleportEvent;
|
||||
import org.bukkit.event.player.PlayerToggleSneakEvent;
|
||||
import org.bukkit.event.player.PlayerToggleSprintEvent;
|
||||
import org.bukkit.event.player.PlayerPortalEvent;
|
||||
import org.bukkit.event.inventory.*;
|
||||
import org.bukkit.event.inventory.InventoryType.SlotType;
|
||||
import org.bukkit.event.player.PlayerToggleFlightEvent;
|
||||
@@ -37,10 +39,10 @@ import org.bukkit.inventory.CraftingInventory;
|
||||
import org.bukkit.inventory.InventoryView;
|
||||
// CraftBukkit end
|
||||
|
||||
public class NetServerHandler extends NetHandler implements ICommandListener {
|
||||
public class NetServerHandler extends NetHandler {
|
||||
|
||||
public static Logger logger = Logger.getLogger("Minecraft");
|
||||
public NetworkManager networkManager;
|
||||
public INetworkManager networkManager;
|
||||
public boolean disconnected = false;
|
||||
private MinecraftServer minecraftServer;
|
||||
public EntityPlayer player; // CraftBukkit - private -> public
|
||||
@@ -56,13 +58,13 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
||||
private double y;
|
||||
private double z;
|
||||
private double q;
|
||||
private boolean checkMovement = true;
|
||||
public boolean checkMovement = true; // CraftBukkit - private -> public
|
||||
private IntHashMap s = new IntHashMap();
|
||||
|
||||
public NetServerHandler(MinecraftServer minecraftserver, NetworkManager networkmanager, EntityPlayer entityplayer) {
|
||||
public NetServerHandler(MinecraftServer minecraftserver, INetworkManager inetworkmanager, EntityPlayer entityplayer) {
|
||||
this.minecraftServer = minecraftserver;
|
||||
this.networkManager = networkmanager;
|
||||
networkmanager.a((NetHandler) this);
|
||||
this.networkManager = inetworkmanager;
|
||||
inetworkmanager.a(this);
|
||||
this.player = entityplayer;
|
||||
entityplayer.netServerHandler = this;
|
||||
|
||||
@@ -96,10 +98,12 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
||||
private final static HashSet<Integer> invalidItems = new HashSet<Integer>(java.util.Arrays.asList(8, 9, 10, 11, 26, 34, 36, 51, 52, 55, 59, 60, 63, 64, 68, 71, 75, 78, 83, 90, 92, 93, 94, 95));
|
||||
// CraftBukkit end
|
||||
|
||||
public void a() {
|
||||
public void d() {
|
||||
this.h = false;
|
||||
++this.f;
|
||||
// this.minecraftServer.methodProfiler.a("packetflow"); // CraftBukkit - not in production code
|
||||
this.networkManager.b();
|
||||
// this.minecraftServer.methodProfiler.c("keepAlive"); // CraftBukkit - not in production code
|
||||
if ((long) this.f - this.l > 20L) {
|
||||
this.l = (long) this.f;
|
||||
this.j = System.nanoTime() / 1000000L;
|
||||
@@ -114,6 +118,13 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
||||
if (this.x > 0) {
|
||||
--this.x;
|
||||
}
|
||||
|
||||
// this.minecraftServer.methodProfiler.c("playerTick"); // CraftBukkit - not in production code
|
||||
if (!this.h && !this.player.viewingCredits) {
|
||||
this.player.g();
|
||||
}
|
||||
|
||||
// this.minecraftServer.methodProfiler.b(); // CraftBukkit - not in production code
|
||||
}
|
||||
|
||||
public void disconnect(String s) {
|
||||
@@ -132,19 +143,19 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
||||
s = event.getReason();
|
||||
// CraftBukkit end
|
||||
|
||||
this.player.I();
|
||||
this.player.m();
|
||||
this.sendPacket(new Packet255KickDisconnect(s));
|
||||
this.networkManager.d();
|
||||
|
||||
// CraftBukkit start
|
||||
leaveMessage = event.getLeaveMessage();
|
||||
if (leaveMessage != null && leaveMessage.length() > 0) {
|
||||
this.minecraftServer.serverConfigurationManager.sendAll(new Packet3Chat(leaveMessage));
|
||||
this.minecraftServer.getServerConfigurationManager().sendAll(new Packet3Chat(leaveMessage));
|
||||
}
|
||||
getPlayer().disconnect(s);
|
||||
// CraftBukkit end
|
||||
|
||||
this.minecraftServer.serverConfigurationManager.disconnect(this.player);
|
||||
this.minecraftServer.getServerConfigurationManager().disconnect(this.player);
|
||||
this.disconnected = true;
|
||||
}
|
||||
}
|
||||
@@ -238,7 +249,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
||||
float f = this.player.yaw;
|
||||
float f1 = this.player.pitch;
|
||||
|
||||
this.player.vehicle.i_();
|
||||
this.player.vehicle.V();
|
||||
d1 = this.player.locX;
|
||||
d2 = this.player.locY;
|
||||
d3 = this.player.locZ;
|
||||
@@ -258,12 +269,13 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
||||
return;
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
d5 = packet10flying.x;
|
||||
d4 = packet10flying.z;
|
||||
}
|
||||
|
||||
this.player.onGround = packet10flying.g;
|
||||
this.player.a(true);
|
||||
this.player.g();
|
||||
this.player.move(d5, 0.0D, d4);
|
||||
this.player.setLocation(d1, d2, d3, f, f1);
|
||||
this.player.motX = d5;
|
||||
@@ -273,10 +285,10 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
||||
}
|
||||
|
||||
if (this.player.vehicle != null) {
|
||||
this.player.vehicle.i_();
|
||||
this.player.vehicle.V();
|
||||
}
|
||||
|
||||
this.minecraftServer.serverConfigurationManager.d(this.player);
|
||||
this.minecraftServer.getServerConfigurationManager().d(this.player);
|
||||
this.y = this.player.locX;
|
||||
this.z = this.player.locY;
|
||||
this.q = this.player.locZ;
|
||||
@@ -285,7 +297,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
||||
}
|
||||
|
||||
if (this.player.isSleeping()) {
|
||||
this.player.a(true);
|
||||
this.player.g();
|
||||
this.player.setLocation(this.y, this.z, this.q, this.player.yaw, this.player.pitch);
|
||||
worldserver.playerJoinedWorld(this.player);
|
||||
return;
|
||||
@@ -327,8 +339,8 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
||||
f3 = packet10flying.pitch;
|
||||
}
|
||||
|
||||
this.player.a(true);
|
||||
this.player.bO = 0.0F;
|
||||
this.player.g();
|
||||
this.player.V = 0.0F;
|
||||
this.player.setLocation(this.y, this.z, this.q, f2, f3);
|
||||
if (!this.checkMovement) {
|
||||
return;
|
||||
@@ -337,25 +349,31 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
||||
d4 = d1 - this.player.locX;
|
||||
double d6 = d2 - this.player.locY;
|
||||
double d7 = d3 - this.player.locZ;
|
||||
double d8 = d4 * d4 + d6 * d6 + d7 * d7;
|
||||
double d8 = Math.min(Math.abs(d4), Math.abs(this.player.motX));
|
||||
double d9 = Math.min(Math.abs(d6), Math.abs(this.player.motY));
|
||||
double d10 = Math.min(Math.abs(d7), Math.abs(this.player.motZ));
|
||||
double d11 = d8 * d8 + d9 * d9 + d10 * d10;
|
||||
|
||||
if (d8 > 100.0D && this.checkMovement) { // CraftBukkit - Added this.checkMovement condition to solve this check being triggered by teleports
|
||||
logger.warning(this.player.name + " moved too quickly!");
|
||||
if (d11 > 100.0D && this.checkMovement && (!this.minecraftServer.H() || !this.minecraftServer.G().equals(this.player.name))) { // CraftBukkit - Added this.checkMovement condition to solve this check being triggered by teleports
|
||||
logger.warning(this.player.name + " moved too quickly! " + d4 + "," + d6 + "," + d7 + " (" + d8 + ", " + d9 + ", " + d10 + ")");
|
||||
// CraftBukkit start - temporarily switch back to kicking
|
||||
// this.a(this.y, this.z, this.q, this.player.yaw, this.player.pitch);
|
||||
this.disconnect("You moved too quickly :( (Hacking?)");
|
||||
// CraftBukkit end
|
||||
return;
|
||||
}
|
||||
|
||||
float f4 = 0.0625F;
|
||||
boolean flag = worldserver.getCubes(this.player, this.player.boundingBox.clone().shrink((double) f4, (double) f4, (double) f4)).size() == 0;
|
||||
boolean flag = worldserver.getCubes(this.player, this.player.boundingBox.clone().shrink((double) f4, (double) f4, (double) f4)).isEmpty();
|
||||
|
||||
if (this.player.onGround && !packet10flying.g && d6 > 0.0D) {
|
||||
this.player.c(0.2F);
|
||||
this.player.j(0.2F);
|
||||
}
|
||||
|
||||
this.player.move(d4, d6, d7);
|
||||
this.player.onGround = packet10flying.g;
|
||||
this.player.checkMovement(d4, d6, d7);
|
||||
double d9 = d6;
|
||||
double d12 = d6;
|
||||
|
||||
d4 = d1 - this.player.locX;
|
||||
d6 = d2 - this.player.locY;
|
||||
@@ -364,18 +382,16 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
||||
}
|
||||
|
||||
d7 = d3 - this.player.locZ;
|
||||
d8 = d4 * d4 + d6 * d6 + d7 * d7;
|
||||
d11 = d4 * d4 + d6 * d6 + d7 * d7;
|
||||
boolean flag1 = false;
|
||||
|
||||
if (d8 > 0.0625D && !this.player.isSleeping() && !this.player.itemInWorldManager.isCreative()) {
|
||||
if (d11 > 0.0625D && !this.player.isSleeping() && !this.player.itemInWorldManager.isCreative()) {
|
||||
flag1 = true;
|
||||
logger.warning(this.player.name + " moved wrongly!");
|
||||
System.out.println("Got position " + d1 + ", " + d2 + ", " + d3);
|
||||
System.out.println("Expected " + this.player.locX + ", " + this.player.locY + ", " + this.player.locZ);
|
||||
}
|
||||
|
||||
this.player.setLocation(d1, d2, d3, f2, f3);
|
||||
boolean flag2 = worldserver.getCubes(this.player, this.player.boundingBox.clone().shrink((double) f4, (double) f4, (double) f4)).size() == 0;
|
||||
boolean flag2 = worldserver.getCubes(this.player, this.player.boundingBox.clone().shrink((double) f4, (double) f4, (double) f4)).isEmpty();
|
||||
|
||||
if (flag && (flag1 || !flag2) && !this.player.isSleeping()) {
|
||||
this.a(this.y, this.z, this.q, f2, f3);
|
||||
@@ -384,8 +400,8 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
||||
|
||||
AxisAlignedBB axisalignedbb = this.player.boundingBox.clone().grow((double) f4, (double) f4, (double) f4).a(0.0D, -0.55D, 0.0D);
|
||||
|
||||
if (!this.minecraftServer.allowFlight && !this.player.abilities.canFly && !worldserver.b(axisalignedbb)) { // CraftBukkit - check abilities instead of creative mode
|
||||
if (d9 >= -0.03125D) {
|
||||
if (!this.minecraftServer.getAllowFlight() && !this.player.abilities.canFly && !worldserver.c(axisalignedbb)) { // CraftBukkit - check abilities instead of creative mode
|
||||
if (d12 >= -0.03125D) {
|
||||
++this.g;
|
||||
if (this.g > 80) {
|
||||
logger.warning(this.player.name + " was kicked for floating too long!");
|
||||
@@ -398,7 +414,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
||||
}
|
||||
|
||||
this.player.onGround = packet10flying.g;
|
||||
this.minecraftServer.serverConfigurationManager.d(this.player);
|
||||
this.minecraftServer.getServerConfigurationManager().d(this.player);
|
||||
if (this.player.itemInWorldManager.isCreative()) return; // CraftBukkit - fixed fall distance accumulating while being in Creative mode.
|
||||
this.player.b(this.player.locY - d0, packet10flying.g);
|
||||
}
|
||||
@@ -475,11 +491,11 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
||||
}
|
||||
}
|
||||
// CraftBukkit end
|
||||
this.player.S();
|
||||
this.player.bB();
|
||||
} else if (packet14blockdig.e == 5) {
|
||||
this.player.N();
|
||||
this.player.by();
|
||||
} else {
|
||||
boolean flag = worldserver.weirdIsOpCache = worldserver.dimension != 0 || this.minecraftServer.serverConfigurationManager.isOp(this.player.name); // CraftBukkit
|
||||
boolean flag = worldserver.weirdIsOpCache = worldserver.dimension != 0 || this.minecraftServer.getServerConfigurationManager().isOp(this.player.name) || this.minecraftServer.H(); // CraftBukkit
|
||||
boolean flag1 = false;
|
||||
|
||||
if (packet14blockdig.e == 0) {
|
||||
@@ -504,7 +520,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
||||
return;
|
||||
}
|
||||
|
||||
if (j >= this.minecraftServer.t) {
|
||||
if (j >= this.minecraftServer.getMaxBuildHeight()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -531,6 +547,11 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
||||
if (worldserver.getTypeId(i, j, k) != 0) {
|
||||
this.player.netServerHandler.sendPacket(new Packet53BlockChange(i, j, k, worldserver));
|
||||
}
|
||||
} else if (packet14blockdig.e == 1) {
|
||||
this.player.itemInWorldManager.c(i, j, k);
|
||||
if (worldserver.getTypeId(i, j, k) != 0) {
|
||||
this.player.netServerHandler.sendPacket(new Packet53BlockChange(i, j, k, worldserver));
|
||||
}
|
||||
} else if (packet14blockdig.e == 3) {
|
||||
double d4 = this.player.locX - ((double) i + 0.5D);
|
||||
double d5 = this.player.locY - ((double) j + 0.5D);
|
||||
@@ -560,13 +581,13 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
||||
// second one. This sadly has to remain until Mojang makes their packets saner. :(
|
||||
// -- Grum
|
||||
|
||||
if (packet15place.face == 255) {
|
||||
if (packet15place.itemstack != null && packet15place.itemstack.id == this.lastMaterial && this.lastPacket != null && packet15place.timestamp - this.lastPacket < 100) {
|
||||
if (packet15place.getFace() == 255) {
|
||||
if (packet15place.getItemStack() != null && packet15place.getItemStack().id == this.lastMaterial && this.lastPacket != null && packet15place.timestamp - this.lastPacket < 100) {
|
||||
this.lastPacket = null;
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
this.lastMaterial = packet15place.itemstack == null ? -1 : packet15place.itemstack.id;
|
||||
this.lastMaterial = packet15place.getItemStack() == null ? -1 : packet15place.getItemStack().id;
|
||||
this.lastPacket = packet15place.timestamp;
|
||||
}
|
||||
|
||||
@@ -579,13 +600,13 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
||||
|
||||
ItemStack itemstack = this.player.inventory.getItemInHand();
|
||||
boolean flag = false;
|
||||
int i = packet15place.a;
|
||||
int j = packet15place.b;
|
||||
int k = packet15place.c;
|
||||
int l = packet15place.face;
|
||||
boolean flag1 = worldserver.weirdIsOpCache = worldserver.dimension != 0 || this.minecraftServer.serverConfigurationManager.isOp(this.player.name); // CraftBukkit
|
||||
int i = packet15place.d();
|
||||
int j = packet15place.f();
|
||||
int k = packet15place.g();
|
||||
int l = packet15place.getFace();
|
||||
boolean flag1 = worldserver.weirdIsOpCache = worldserver.worldProvider.dimension != 0 || this.minecraftServer.getServerConfigurationManager().isOp(this.player.name) || this.minecraftServer.H();
|
||||
|
||||
if (packet15place.face == 255) {
|
||||
if (packet15place.getFace() == 255) {
|
||||
if (itemstack == null) {
|
||||
return;
|
||||
}
|
||||
@@ -602,8 +623,8 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
||||
// inventory update packet to get sent
|
||||
always = (itemstack.count != itemstackAmount);
|
||||
// CraftBukkit end
|
||||
} else if (packet15place.b >= this.minecraftServer.t - 1 && (packet15place.face == 1 || packet15place.b >= this.minecraftServer.t)) {
|
||||
this.player.netServerHandler.sendPacket(new Packet3Chat("\u00A77Height limit for building is " + this.minecraftServer.t));
|
||||
} else if (packet15place.f() >= this.minecraftServer.getMaxBuildHeight() - 1 && (packet15place.getFace() == 1 || packet15place.f() >= this.minecraftServer.getMaxBuildHeight())) {
|
||||
this.player.netServerHandler.sendPacket(new Packet3Chat("\u00A77Height limit for building is " + this.minecraftServer.getMaxBuildHeight()));
|
||||
flag = true;
|
||||
} else {
|
||||
ChunkCoordinates chunkcoordinates = worldserver.getSpawn();
|
||||
@@ -620,10 +641,9 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
||||
return;
|
||||
}
|
||||
flag1 = true; // spawn protection moved to ItemBlock!!!
|
||||
// CraftBukkit end
|
||||
|
||||
if (j1 > 16 || flag1) {
|
||||
this.player.itemInWorldManager.interact(this.player, worldserver, itemstack, i, j, k, l);
|
||||
// CraftBukkit end
|
||||
this.player.itemInWorldManager.interact(this.player, worldserver, itemstack, i, j, k, l, packet15place.j(), packet15place.l(), packet15place.m());
|
||||
}
|
||||
|
||||
flag = true;
|
||||
@@ -664,16 +684,16 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
||||
itemstack = null;
|
||||
}
|
||||
|
||||
if (itemstack == null || itemstack.l() == 0) {
|
||||
if (itemstack == null || itemstack.m() == 0) {
|
||||
this.player.h = true;
|
||||
this.player.inventory.items[this.player.inventory.itemInHandIndex] = ItemStack.b(this.player.inventory.items[this.player.inventory.itemInHandIndex]);
|
||||
Slot slot = this.player.activeContainer.a((IInventory) this.player.inventory, this.player.inventory.itemInHandIndex);
|
||||
|
||||
this.player.activeContainer.a();
|
||||
this.player.activeContainer.b();
|
||||
this.player.h = false;
|
||||
// CraftBukkit - TODO CHECK IF NEEDED -- new if structure might not need 'always'. Kept it in for now, but may be able to remove in future
|
||||
if (!ItemStack.matches(this.player.inventory.getItemInHand(), packet15place.itemstack) || always) {
|
||||
this.sendPacket(new Packet103SetSlot(this.player.activeContainer.windowId, slot.c, this.player.inventory.getItemInHand()));
|
||||
if (!ItemStack.matches(this.player.inventory.getItemInHand(), packet15place.getItemStack()) || always) {
|
||||
this.sendPacket(new Packet103SetSlot(this.player.activeContainer.windowId, slot.d, this.player.inventory.getItemInHand()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -685,12 +705,16 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
||||
|
||||
logger.info(this.player.name + " lost connection: " + s);
|
||||
// CraftBukkit start - we need to handle custom quit messages
|
||||
String quitMessage = this.minecraftServer.serverConfigurationManager.disconnect(this.player);
|
||||
String quitMessage = this.minecraftServer.getServerConfigurationManager().disconnect(this.player);
|
||||
if ((quitMessage != null) && (quitMessage.length() > 0)) {
|
||||
this.minecraftServer.serverConfigurationManager.sendAll(new Packet3Chat(quitMessage));
|
||||
this.minecraftServer.getServerConfigurationManager().sendAll(new Packet3Chat(quitMessage));
|
||||
}
|
||||
// CraftBukkit end
|
||||
this.disconnected = true;
|
||||
if (this.minecraftServer.H() && this.player.name.equals(this.minecraftServer.G())) {
|
||||
logger.info("Stopping singleplayer server as player logged out");
|
||||
this.minecraftServer.safeShutdown();
|
||||
}
|
||||
}
|
||||
|
||||
public void onUnhandledPacket(Packet packet) {
|
||||
@@ -700,23 +724,41 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
||||
}
|
||||
|
||||
public void sendPacket(Packet packet) {
|
||||
// CraftBukkit start
|
||||
if (packet instanceof Packet6SpawnPosition) {
|
||||
Packet6SpawnPosition packet6 = (Packet6SpawnPosition) packet;
|
||||
this.player.compassTarget = new Location(this.getPlayer().getWorld(), packet6.x, packet6.y, packet6.z);
|
||||
} else if (packet instanceof Packet3Chat) {
|
||||
String message = ((Packet3Chat) packet).message;
|
||||
if (packet instanceof Packet3Chat) {
|
||||
Packet3Chat packet3chat = (Packet3Chat) packet;
|
||||
int i = this.player.getChatFlags();
|
||||
|
||||
if (i == 2) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (i == 1 && !packet3chat.isServer()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// CraftBukkit start
|
||||
String message = packet3chat.message;
|
||||
for (final String line : org.bukkit.craftbukkit.TextWrapper.wrapText(message)) {
|
||||
this.networkManager.queue(new Packet3Chat(line));
|
||||
}
|
||||
packet = null;
|
||||
} else if (packet != null && packet.lowPriority == true) {
|
||||
return;
|
||||
// CraftBukkit end
|
||||
}
|
||||
|
||||
// CraftBukkit start
|
||||
if (packet == null) {
|
||||
return;
|
||||
} else if (packet instanceof Packet6SpawnPosition) {
|
||||
Packet6SpawnPosition packet6 = (Packet6SpawnPosition) packet;
|
||||
this.player.compassTarget = new Location(this.getPlayer().getWorld(), packet6.x, packet6.y, packet6.z);
|
||||
} else if (packet.lowPriority == true) {
|
||||
// Reroute all low-priority packets through to compression thread.
|
||||
org.bukkit.craftbukkit.ChunkCompressionThread.sendPacket(this.player, packet);
|
||||
packet = null;
|
||||
return;
|
||||
}
|
||||
if (packet != null) this.networkManager.queue(packet);
|
||||
// CraftBukkit end
|
||||
|
||||
this.networkManager.queue(packet);
|
||||
}
|
||||
|
||||
public void a(Packet16BlockItemSwitch packet16blockitemswitch) {
|
||||
@@ -736,22 +778,31 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
||||
}
|
||||
|
||||
public void a(Packet3Chat packet3chat) {
|
||||
String s = packet3chat.message;
|
||||
|
||||
if (s.length() > 100) {
|
||||
this.disconnect("Chat message too long");
|
||||
if (this.player.getChatFlags() == 2) {
|
||||
this.sendPacket(new Packet3Chat("Cannot send chat message."));
|
||||
} else {
|
||||
s = s.trim();
|
||||
String s = packet3chat.message;
|
||||
|
||||
for (int i = 0; i < s.length(); ++i) {
|
||||
if (!SharedConstants.isAllowedChatCharacter(s.charAt(i))) {
|
||||
this.disconnect("Illegal characters in chat");
|
||||
if (s.length() > 100) {
|
||||
this.disconnect("Chat message too long");
|
||||
} else {
|
||||
s = s.trim();
|
||||
|
||||
for (int i = 0; i < s.length(); ++i) {
|
||||
if (!SharedConstants.isAllowedChatCharacter(s.charAt(i))) {
|
||||
this.disconnect("Illegal characters in chat");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// CraftBukkit start
|
||||
if (this.player.getChatFlags() == 1) {
|
||||
this.sendPacket(new Packet3Chat("Cannot send chat message."));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// CraftBukkit start
|
||||
this.chat(s);
|
||||
this.chat(s);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -784,17 +835,17 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
||||
for (Player recipient : event.getRecipients()) {
|
||||
recipient.sendMessage(s);
|
||||
}
|
||||
// CraftBukkit end
|
||||
}
|
||||
|
||||
this.m += 20;
|
||||
if (this.m > 200) {
|
||||
if (this.m > 200 && !this.minecraftServer.getServerConfigurationManager().isOp(this.player.name)) {
|
||||
this.disconnect("disconnect.spam");
|
||||
}
|
||||
}
|
||||
|
||||
return false; // CraftBukkit
|
||||
return false;
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
private void handleCommand(String s) {
|
||||
// CraftBukkit start
|
||||
@@ -819,35 +870,9 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
||||
// CraftBukkit end
|
||||
|
||||
/* CraftBukkit start - No longer needed as we have already handled it in server.dispatchServerCommand above.
|
||||
if (s.toLowerCase().startsWith("/me ")) {
|
||||
s = "* " + this.player.name + " " + s.substring(s.indexOf(" ")).trim();
|
||||
logger.info(s);
|
||||
this.minecraftServer.serverConfigurationManager.sendAll(new Packet3Chat(s));
|
||||
} else if (s.toLowerCase().startsWith("/kill")) {
|
||||
this.player.damageEntity(DamageSource.GENERIC, 1000);
|
||||
} else if (s.toLowerCase().startsWith("/tell ")) {
|
||||
String[] astring = s.split(" ");
|
||||
|
||||
if (astring.length >= 3) {
|
||||
s = s.substring(s.indexOf(" ")).trim();
|
||||
s = s.substring(s.indexOf(" ")).trim();
|
||||
s = "\u00A77" + this.player.name + " whispers " + s;
|
||||
logger.info(s + " to " + astring[1]);
|
||||
if (!this.minecraftServer.serverConfigurationManager.a(astring[1], (Packet) (new Packet3Chat(s)))) {
|
||||
this.sendPacket(new Packet3Chat("\u00A7cThere\'s no player by that name online."));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
String s1;
|
||||
|
||||
if (this.minecraftServer.serverConfigurationManager.isOp(this.player.name)) {
|
||||
s1 = s.substring(1);
|
||||
logger.info(this.player.name + " issued server command: " + s1);
|
||||
this.minecraftServer.issueCommand(s1, this);
|
||||
} else {
|
||||
s1 = s.substring(1);
|
||||
logger.info(this.player.name + " tried command: " + s1);
|
||||
}
|
||||
if (this.minecraftServer.getServerConfigurationManager().isOp(this.player.name) || "/seed".equals(s)) {
|
||||
logger.info(this.player.name + " issued server command: " + s);
|
||||
this.minecraftServer.getCommandHandler().a(this.player, s);
|
||||
}
|
||||
// CraftBukkit end */
|
||||
}
|
||||
@@ -863,7 +888,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
||||
double d0 = this.player.lastX + (this.player.locX - this.player.lastX) * (double) f;
|
||||
double d1 = this.player.lastY + (this.player.locY - this.player.lastY) * (double) f + 1.62D - (double) this.player.height;
|
||||
double d2 = this.player.lastZ + (this.player.locZ - this.player.lastZ) * (double) f;
|
||||
Vec3D vec3d = Vec3D.create(d0, d1, d2);
|
||||
Vec3D vec3d = Vec3D.a().create(d0, d1, d2);
|
||||
|
||||
float f3 = MathHelper.cos(-f2 * 0.017453292F - 3.1415927F);
|
||||
float f4 = MathHelper.sin(-f2 * 0.017453292F - 3.1415927F);
|
||||
@@ -886,7 +911,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
||||
if (event.isCancelled()) return;
|
||||
// CraftBukkit end
|
||||
|
||||
this.player.C_();
|
||||
this.player.i();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -914,15 +939,14 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
||||
// CraftBukkit end
|
||||
|
||||
if (packet19entityaction.animation == 1) {
|
||||
this.player.setSneak(true);
|
||||
this.player.setSneaking(true);
|
||||
} else if (packet19entityaction.animation == 2) {
|
||||
this.player.setSneak(false);
|
||||
this.player.setSneaking(false);
|
||||
} else if (packet19entityaction.animation == 4) {
|
||||
this.player.setSprinting(true);
|
||||
} else if (packet19entityaction.animation == 5) {
|
||||
this.player.setSprinting(false);
|
||||
} else if (packet19entityaction.animation == 3) {
|
||||
if (this.player.fauxSleeping && !this.player.sleeping) return; // CraftBukkit - Can't leave bed if not in one!
|
||||
this.player.a(false, true, true);
|
||||
this.checkMovement = false;
|
||||
}
|
||||
@@ -939,14 +963,6 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
||||
return this.networkManager.e();
|
||||
}
|
||||
|
||||
public void sendMessage(String s) {
|
||||
this.sendPacket(new Packet3Chat("\u00A77" + s));
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return this.player.name;
|
||||
}
|
||||
|
||||
public void a(Packet7UseEntity packet7useentity) {
|
||||
if (this.player.dead) return; // CraftBukkit
|
||||
|
||||
@@ -954,14 +970,14 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
||||
Entity entity = worldserver.getEntity(packet7useentity.target);
|
||||
|
||||
if (entity != null) {
|
||||
boolean flag = this.player.h(entity);
|
||||
boolean flag = this.player.l(entity);
|
||||
double d0 = 36.0D;
|
||||
|
||||
if (!flag) {
|
||||
d0 = 9.0D;
|
||||
}
|
||||
|
||||
if (this.player.j(entity) < d0) {
|
||||
if (this.player.e(entity) < d0) {
|
||||
ItemStack itemInHand = this.player.inventory.getItemInHand(); // CraftBukkit
|
||||
if (packet7useentity.action == 0) {
|
||||
// CraftBukkit start
|
||||
@@ -972,7 +988,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
||||
return;
|
||||
}
|
||||
// CraftBukkit end
|
||||
this.player.e(entity);
|
||||
this.player.m(entity);
|
||||
// CraftBukkit start - update the client if the item is an infinite one
|
||||
if (itemInHand != null && itemInHand.count <= -1) {
|
||||
this.player.updateInventory(this.player.activeContainer);
|
||||
@@ -996,57 +1012,45 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
||||
}
|
||||
}
|
||||
|
||||
public void a(Packet9Respawn packet9respawn) {
|
||||
if (this.player.viewingCredits) {
|
||||
// CraftBukkit start
|
||||
org.bukkit.craftbukkit.PortalTravelAgent pta = new org.bukkit.craftbukkit.PortalTravelAgent();
|
||||
Location toLocation;
|
||||
public void a(Packet205ClientCommand packet205clientcommand) {
|
||||
if (packet205clientcommand.a == 1) {
|
||||
if (this.player.viewingCredits) {
|
||||
this.player = this.minecraftServer.getServerConfigurationManager().moveToWorld(this.player, 0, true);
|
||||
} else if (this.player.q().getWorldData().isHardcore()) {
|
||||
if (this.minecraftServer.H() && this.player.name.equals(this.minecraftServer.G())) {
|
||||
this.player.netServerHandler.disconnect("You have died. Game over, man, it\'s game over!");
|
||||
this.minecraftServer.O();
|
||||
} else {
|
||||
BanEntry banentry = new BanEntry(this.player.name);
|
||||
|
||||
if (this.player.getBukkitEntity().getBedSpawnLocation() == null) {
|
||||
CraftWorld cworld = (CraftWorld) this.server.getWorlds().get(0);
|
||||
ChunkCoordinates chunkcoordinates = cworld.getHandle().getSpawn();
|
||||
toLocation = new Location(cworld, chunkcoordinates.x + 0.5, chunkcoordinates.y, chunkcoordinates.z + 0.5);
|
||||
this.player.netServerHandler.sendPacket(new Packet70Bed(0, 0));
|
||||
banentry.setReason("Death in Hardcore");
|
||||
this.minecraftServer.getServerConfigurationManager().getNameBans().add(banentry);
|
||||
this.player.netServerHandler.disconnect("You have died. Game over, man, it\'s game over!");
|
||||
}
|
||||
} else {
|
||||
toLocation = this.player.getBukkitEntity().getBedSpawnLocation();
|
||||
toLocation = new Location(toLocation.getWorld(), toLocation.getX() + 0.5, toLocation.getY(), toLocation.getZ() + 0.5);
|
||||
if (this.player.getHealth() > 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.player = this.minecraftServer.getServerConfigurationManager().moveToWorld(this.player, 0, false);
|
||||
}
|
||||
|
||||
PlayerPortalEvent event = new PlayerPortalEvent(this.player.getBukkitEntity(), this.player.getBukkitEntity().getLocation(), toLocation, pta, PlayerPortalEvent.TeleportCause.END_PORTAL);
|
||||
event.useTravelAgent(false);
|
||||
|
||||
org.bukkit.Bukkit.getServer().getPluginManager().callEvent(event);
|
||||
this.player = this.minecraftServer.serverConfigurationManager.moveToWorld(this.player, 0, true, event.getTo());
|
||||
// CraftBukkit end
|
||||
} else {
|
||||
if (this.player.getHealth() > 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.player = this.minecraftServer.serverConfigurationManager.moveToWorld(this.player, 0, false);
|
||||
}
|
||||
// CraftBukkit start
|
||||
this.getPlayer().setHandle(this.player);
|
||||
this.player.viewingCredits = false; // allow the player to receive movement packets again.
|
||||
// CraftBukkit end
|
||||
}
|
||||
|
||||
public boolean b() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public void a(Packet9Respawn packet9respawn) {}
|
||||
|
||||
public void handleContainerClose(Packet101CloseWindow packet101closewindow) {
|
||||
if (this.player.dead) return; // CraftBukkit
|
||||
|
||||
// CraftBukkit start - INVENTORY_CLOSE hook
|
||||
InventoryCloseEvent event = new InventoryCloseEvent(this.player.activeContainer.getBukkitView());
|
||||
server.getPluginManager().callEvent(event);
|
||||
this.player.activeContainer.transferTo(this.player.defaultContainer, getPlayer());
|
||||
// CraftBukkit end
|
||||
|
||||
this.player.H();
|
||||
this.player.l();
|
||||
}
|
||||
|
||||
public void a(Packet102WindowClick packet102windowclick) {
|
||||
if (this.player.dead) return; // CraftBukkit
|
||||
|
||||
if (this.player.activeContainer.windowId == packet102windowclick.a && this.player.activeContainer.c(this.player)) {
|
||||
if (this.player.activeContainer.windowId == packet102windowclick.a && this.player.activeContainer.b(this.player)) {
|
||||
// CraftBukkit start - fire InventoryClickEvent
|
||||
InventoryView inventory = this.player.activeContainer.getBukkitView();
|
||||
SlotType type = CraftInventoryView.getSlotType(inventory, packet102windowclick.slot);
|
||||
@@ -1093,10 +1097,10 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
if (defaultBehaviour && ItemStack.matches(packet102windowclick.item, itemstack)) { // CraftBukkit - additional condition added
|
||||
this.player.netServerHandler.sendPacket((Packet) (new Packet106Transaction(packet102windowclick.a, packet102windowclick.d, true)));
|
||||
if (ItemStack.matches(packet102windowclick.item, itemstack)) {
|
||||
this.player.netServerHandler.sendPacket(new Packet106Transaction(packet102windowclick.a, packet102windowclick.d, true));
|
||||
this.player.h = true;
|
||||
this.player.activeContainer.a();
|
||||
this.player.activeContainer.b();
|
||||
this.player.broadcastCarriedItem();
|
||||
this.player.h = false;
|
||||
} else {
|
||||
@@ -1105,8 +1109,8 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
||||
this.player.activeContainer.a(this.player, false);
|
||||
ArrayList arraylist = new ArrayList();
|
||||
|
||||
for (int i = 0; i < this.player.activeContainer.e.size(); ++i) {
|
||||
arraylist.add(((Slot) this.player.activeContainer.e.get(i)).getItem());
|
||||
for (int i = 0; i < this.player.activeContainer.b.size(); ++i) {
|
||||
arraylist.add(((Slot) this.player.activeContainer.b.get(i)).getItem());
|
||||
}
|
||||
|
||||
this.player.a(this.player.activeContainer, arraylist);
|
||||
@@ -1120,9 +1124,9 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
||||
}
|
||||
|
||||
public void a(Packet108ButtonClick packet108buttonclick) {
|
||||
if (this.player.activeContainer.windowId == packet108buttonclick.a && this.player.activeContainer.c(this.player)) {
|
||||
if (this.player.activeContainer.windowId == packet108buttonclick.a && this.player.activeContainer.b(this.player)) {
|
||||
this.player.activeContainer.a((EntityHuman) this.player, packet108buttonclick.b);
|
||||
this.player.activeContainer.a();
|
||||
this.player.activeContainer.b();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1130,7 +1134,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
||||
if (this.player.itemInWorldManager.isCreative()) {
|
||||
boolean flag = packet107setcreativeslot.slot < 0;
|
||||
ItemStack itemstack = packet107setcreativeslot.b;
|
||||
boolean flag1 = packet107setcreativeslot.slot >= 36 && packet107setcreativeslot.slot < 36 + PlayerInventory.getHotbarSize();
|
||||
boolean flag1 = packet107setcreativeslot.slot >= 1 && packet107setcreativeslot.slot < 36 + PlayerInventory.getHotbarSize();
|
||||
// CraftBukkit
|
||||
boolean flag2 = itemstack == null || itemstack.id < Item.byId.length && itemstack.id >= 0 && Item.byId[itemstack.id] != null && !invalidItems.contains(itemstack.id);
|
||||
boolean flag3 = itemstack == null || itemstack.getData() >= 0 && itemstack.getData() >= 0 && itemstack.count <= 64 && itemstack.count > 0;
|
||||
@@ -1186,7 +1190,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
||||
EntityItem entityitem = this.player.drop(itemstack);
|
||||
|
||||
if (entityitem != null) {
|
||||
entityitem.k();
|
||||
entityitem.d();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1196,7 +1200,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
||||
if (this.player.dead) return; // CraftBukkit
|
||||
Short oshort = (Short) this.s.get(this.player.activeContainer.windowId);
|
||||
|
||||
if (oshort != null && packet106transaction.b == oshort.shortValue() && this.player.activeContainer.windowId == packet106transaction.a && !this.player.activeContainer.c(this.player)) {
|
||||
if (oshort != null && packet106transaction.b == oshort.shortValue() && this.player.activeContainer.windowId == packet106transaction.a && !this.player.activeContainer.b(this.player)) {
|
||||
this.player.activeContainer.a(this.player, true);
|
||||
}
|
||||
}
|
||||
@@ -1212,7 +1216,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
||||
if (tileentity instanceof TileEntitySign) {
|
||||
TileEntitySign tileentitysign = (TileEntitySign) tileentity;
|
||||
|
||||
if (!tileentitysign.c()) {
|
||||
if (!tileentitysign.a()) {
|
||||
this.minecraftServer.warning("Player " + this.player.name + " just tried to change non-editable sign");
|
||||
this.sendPacket(new Packet130UpdateSign(packet130updatesign.x, packet130updatesign.y, packet130updatesign.z, tileentitysign.lines)); // CraftBukkit
|
||||
return;
|
||||
@@ -1274,17 +1278,17 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
||||
}
|
||||
}
|
||||
|
||||
public boolean c() {
|
||||
public boolean a() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public void a(Packet202Abilities packet202abilities) {
|
||||
// CraftBukkit start
|
||||
if (this.player.abilities.canFly && this.player.abilities.isFlying != packet202abilities.b) {
|
||||
PlayerToggleFlightEvent event = new PlayerToggleFlightEvent(this.server.getPlayer(this.player), packet202abilities.b);
|
||||
if (this.player.abilities.canFly && this.player.abilities.isFlying != packet202abilities.f()) {
|
||||
PlayerToggleFlightEvent event = new PlayerToggleFlightEvent(this.server.getPlayer(this.player), packet202abilities.f());
|
||||
this.server.getPluginManager().callEvent(event);
|
||||
if (!event.isCancelled()) {
|
||||
this.player.abilities.isFlying = packet202abilities.b; // Actually set the player's flying status
|
||||
this.player.abilities.isFlying = packet202abilities.f(); // Actually set the player's flying status
|
||||
}
|
||||
else {
|
||||
this.player.updateAbilities(); // Tell the player their ability was reverted
|
||||
@@ -1293,21 +1297,90 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
||||
// CraftBukkit end
|
||||
}
|
||||
|
||||
// CraftBukkit start
|
||||
@Override
|
||||
public void a(Packet250CustomPayload packet) {
|
||||
if (packet.tag.equals("REGISTER")) {
|
||||
public void a(Packet203TabComplete packet203tabcomplete) {
|
||||
StringBuilder stringbuilder = new StringBuilder();
|
||||
|
||||
String s;
|
||||
|
||||
for (Iterator iterator = this.minecraftServer.a((ICommandListener) this.player, packet203tabcomplete.d()).iterator(); iterator.hasNext(); stringbuilder.append(s)) {
|
||||
s = (String) iterator.next();
|
||||
if (stringbuilder.length() > 0) {
|
||||
stringbuilder.append('\0'); // CraftBukkit - fix decompile issue
|
||||
}
|
||||
}
|
||||
|
||||
this.player.netServerHandler.sendPacket(new Packet203TabComplete(stringbuilder.toString()));
|
||||
}
|
||||
|
||||
public void a(Packet204LocaleAndViewDistance packet204localeandviewdistance) {
|
||||
this.player.a(packet204localeandviewdistance);
|
||||
}
|
||||
|
||||
public void a(Packet250CustomPayload packet250custompayload) {
|
||||
DataInputStream datainputstream;
|
||||
ItemStack itemstack;
|
||||
ItemStack itemstack1;
|
||||
|
||||
if ("MC|BEdit".equals(packet250custompayload.tag)) {
|
||||
try {
|
||||
String channels = new String(packet.data, "UTF8");
|
||||
datainputstream = new DataInputStream(new ByteArrayInputStream(packet250custompayload.data));
|
||||
itemstack = Packet.c(datainputstream);
|
||||
if (!ItemBookAndQuill.a(itemstack.getTag())) {
|
||||
throw new IOException("Invalid book tag!");
|
||||
}
|
||||
|
||||
itemstack1 = this.player.inventory.getItemInHand();
|
||||
if (itemstack != null && itemstack.id == Item.BOOK_AND_QUILL.id && itemstack.id == itemstack1.id) {
|
||||
itemstack1.setTag(itemstack.getTag());
|
||||
}
|
||||
} catch (Exception exception) {
|
||||
exception.printStackTrace();
|
||||
}
|
||||
} else if ("MC|BSign".equals(packet250custompayload.tag)) {
|
||||
try {
|
||||
datainputstream = new DataInputStream(new ByteArrayInputStream(packet250custompayload.data));
|
||||
itemstack = Packet.c(datainputstream);
|
||||
if (!ItemWrittenBook.a(itemstack.getTag())) {
|
||||
throw new IOException("Invalid book tag!");
|
||||
}
|
||||
|
||||
itemstack1 = this.player.inventory.getItemInHand();
|
||||
if (itemstack != null && itemstack.id == Item.WRITTEN_BOOK.id && itemstack1.id == Item.BOOK_AND_QUILL.id) {
|
||||
itemstack1.setTag(itemstack.getTag());
|
||||
itemstack1.id = Item.WRITTEN_BOOK.id;
|
||||
}
|
||||
} catch (Exception exception1) {
|
||||
// CraftBukkit start
|
||||
// exception1.printStackTrace();
|
||||
// CraftBukkit end
|
||||
}
|
||||
} else if ("MC|TrSel".equals(packet250custompayload.tag)) {
|
||||
try {
|
||||
datainputstream = new DataInputStream(new ByteArrayInputStream(packet250custompayload.data));
|
||||
int i = datainputstream.readInt();
|
||||
Container container = this.player.activeContainer;
|
||||
|
||||
if (container instanceof ContainerMerchant) {
|
||||
((ContainerMerchant) container).c(i);
|
||||
}
|
||||
} catch (Exception exception2) {
|
||||
exception2.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
// CraftBukkit start
|
||||
else if (packet250custompayload.tag.equals("REGISTER")) {
|
||||
try {
|
||||
String channels = new String(packet250custompayload.data, "UTF8");
|
||||
for (String channel : channels.split("\0")) {
|
||||
getPlayer().addChannel(channel);
|
||||
}
|
||||
} catch (UnsupportedEncodingException ex) {
|
||||
Logger.getLogger(NetServerHandler.class.getName()).log(Level.SEVERE, "Could not parse REGISTER payload in plugin message packet", ex);
|
||||
}
|
||||
} else if (packet.tag.equals("UNREGISTER")) {
|
||||
} else if (packet250custompayload.tag.equals("UNREGISTER")) {
|
||||
try {
|
||||
String channels = new String(packet.data, "UTF8");
|
||||
String channels = new String(packet250custompayload.data, "UTF8");
|
||||
for (String channel : channels.split("\0")) {
|
||||
getPlayer().removeChannel(channel);
|
||||
}
|
||||
@@ -1315,8 +1388,8 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
||||
Logger.getLogger(NetServerHandler.class.getName()).log(Level.SEVERE, "Could not parse UNREGISTER payload in plugin message packet", ex);
|
||||
}
|
||||
} else {
|
||||
server.getMessenger().dispatchIncomingMessage(player.getBukkitEntity(), packet.tag, packet.data);
|
||||
server.getMessenger().dispatchIncomingMessage(player.getBukkitEntity(), packet250custompayload.tag, packet250custompayload.data);
|
||||
}
|
||||
// CraftBukkit end
|
||||
}
|
||||
// CraftBukkit end
|
||||
}
|
||||
|
Reference in New Issue
Block a user