mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-11-22 10:36:10 +01:00
Be more aggressive with bed packets in older minecraft versions
This commit is contained in:
parent
4c958b5e7c
commit
8f21f87867
@ -1201,9 +1201,14 @@ public class NMSImpl implements NMSBridge {
|
||||
public void sleep(Player entity, boolean sleep) {
|
||||
EntityPlayer player = (EntityPlayer) getHandle(entity);
|
||||
if (sleep) {
|
||||
PacketPlayOutBed packet = new PacketPlayOutBed(player,
|
||||
Location loc = player.getBukkitEntity().getLocation();
|
||||
PacketPlayOutBed bed = new PacketPlayOutBed(player,
|
||||
new BlockPosition((int) player.locX, (int) player.locY, (int) player.locZ));
|
||||
sendPacketNearby(entity, entity.getLocation(), packet, 64);
|
||||
for (Player nearby : CitizensAPI.getLocationLookup().getNearbyPlayers(entity.getLocation(), 64)) {
|
||||
nearby.sendBlockChange(loc, Material.BED.getId(), (byte) 11);
|
||||
sendPacket(nearby, bed);
|
||||
nearby.sendBlockChange(loc, 0, (byte) 0);
|
||||
}
|
||||
} else {
|
||||
PacketPlayOutAnimation packet = new PacketPlayOutAnimation(player, 2);
|
||||
sendPacketNearby(entity, entity.getLocation(), packet, 64);
|
||||
|
@ -1268,9 +1268,14 @@ public class NMSImpl implements NMSBridge {
|
||||
public void sleep(Player entity, boolean sleep) {
|
||||
EntityPlayer player = (EntityPlayer) getHandle(entity);
|
||||
if (sleep) {
|
||||
PacketPlayOutBed packet = new PacketPlayOutBed(player,
|
||||
Location loc = player.getBukkitEntity().getLocation();
|
||||
PacketPlayOutBed bed = new PacketPlayOutBed(player,
|
||||
new BlockPosition((int) player.locX, (int) player.locY, (int) player.locZ));
|
||||
sendPacketNearby(entity, entity.getLocation(), packet, 64);
|
||||
for (Player nearby : CitizensAPI.getLocationLookup().getNearbyPlayers(entity.getLocation(), 64)) {
|
||||
nearby.sendBlockChange(loc, Material.BED.getId(), (byte) 11);
|
||||
sendPacket(nearby, bed);
|
||||
nearby.sendBlockChange(loc, 0, (byte) 0);
|
||||
}
|
||||
} else {
|
||||
PacketPlayOutAnimation packet = new PacketPlayOutAnimation(player, 2);
|
||||
sendPacketNearby(entity, entity.getLocation(), packet, 64);
|
||||
|
@ -1278,9 +1278,14 @@ public class NMSImpl implements NMSBridge {
|
||||
public void sleep(Player entity, boolean sleep) {
|
||||
EntityPlayer player = (EntityPlayer) getHandle(entity);
|
||||
if (sleep) {
|
||||
PacketPlayOutBed packet = new PacketPlayOutBed(player,
|
||||
Location loc = player.getBukkitEntity().getLocation();
|
||||
PacketPlayOutBed bed = new PacketPlayOutBed(player,
|
||||
new BlockPosition((int) player.locX, (int) player.locY, (int) player.locZ));
|
||||
sendPacketNearby(entity, entity.getLocation(), packet, 64);
|
||||
for (Player nearby : CitizensAPI.getLocationLookup().getNearbyPlayers(entity.getLocation(), 64)) {
|
||||
nearby.sendBlockChange(loc, Material.BED.getId(), (byte) 11);
|
||||
sendPacket(nearby, bed);
|
||||
nearby.sendBlockChange(loc, 0, (byte) 0);
|
||||
}
|
||||
} else {
|
||||
PacketPlayOutAnimation packet = new PacketPlayOutAnimation(player, 2);
|
||||
sendPacketNearby(entity, entity.getLocation(), packet, 64);
|
||||
|
@ -1318,9 +1318,14 @@ public class NMSImpl implements NMSBridge {
|
||||
public void sleep(Player entity, boolean sleep) {
|
||||
EntityPlayer player = (EntityPlayer) getHandle(entity);
|
||||
if (sleep) {
|
||||
PacketPlayOutBed packet = new PacketPlayOutBed(player,
|
||||
Location loc = player.getBukkitEntity().getLocation();
|
||||
PacketPlayOutBed bed = new PacketPlayOutBed(player,
|
||||
new BlockPosition((int) player.locX, (int) player.locY, (int) player.locZ));
|
||||
sendPacketNearby(entity, entity.getLocation(), packet, 64);
|
||||
for (Player nearby : CitizensAPI.getLocationLookup().getNearbyPlayers(entity.getLocation(), 64)) {
|
||||
nearby.sendBlockChange(loc, Material.BLACK_BED, (byte) 11);
|
||||
sendPacket(nearby, bed);
|
||||
nearby.sendBlockChange(loc, Material.AIR, (byte) 0);
|
||||
}
|
||||
} else {
|
||||
PacketPlayOutAnimation packet = new PacketPlayOutAnimation(player, 2);
|
||||
sendPacketNearby(entity, entity.getLocation(), packet, 64);
|
||||
|
@ -1138,9 +1138,14 @@ public class NMSImpl implements NMSBridge {
|
||||
public void sleep(Player entity, boolean sleep) {
|
||||
EntityPlayer player = (EntityPlayer) getHandle(entity);
|
||||
if (sleep) {
|
||||
PacketPlayOutBed packet = new PacketPlayOutBed(player,
|
||||
Location loc = player.getBukkitEntity().getLocation();
|
||||
PacketPlayOutBed bed = new PacketPlayOutBed(player,
|
||||
new BlockPosition((int) player.locX, (int) player.locY, (int) player.locZ));
|
||||
sendPacketNearby(entity, entity.getLocation(), packet, 64);
|
||||
for (Player nearby : CitizensAPI.getLocationLookup().getNearbyPlayers(entity.getLocation(), 64)) {
|
||||
nearby.sendBlockChange(loc, Material.BED.getId(), (byte) 11);
|
||||
sendPacket(nearby, bed);
|
||||
nearby.sendBlockChange(loc, 0, (byte) 0);
|
||||
}
|
||||
} else {
|
||||
PacketPlayOutAnimation packet = new PacketPlayOutAnimation(player, 2);
|
||||
sendPacketNearby(entity, entity.getLocation(), packet, 64);
|
||||
|
Loading…
Reference in New Issue
Block a user