use of com.denizenscript.denizen.nms.v1_17.impl.network.handlers.DenizenNetworkManagerImpl in project Denizen-For-Bukkit by DenizenScript.
the class PacketHelperImpl method showSignEditor.
@Override
public boolean showSignEditor(Player player, Location location) {
if (location == null) {
LocationTag fakeSign = new LocationTag(player.getLocation());
fakeSign.setY(0);
FakeBlock.showFakeBlockTo(Collections.singletonList(new PlayerTag(player)), fakeSign, new MaterialTag(org.bukkit.Material.OAK_WALL_SIGN), new DurationTag(1), true);
BlockPos pos = new BlockPos(fakeSign.getX(), 0, fakeSign.getZ());
((DenizenNetworkManagerImpl) ((CraftPlayer) player).getHandle().connection.connection).packetListener.fakeSignExpected = pos;
send(player, new ClientboundOpenSignEditorPacket(pos));
return true;
}
BlockEntity tileEntity = ((CraftWorld) location.getWorld()).getHandle().getTileEntity(new BlockPos(location.getBlockX(), location.getBlockY(), location.getBlockZ()), true);
if (tileEntity instanceof SignBlockEntity) {
SignBlockEntity sign = (SignBlockEntity) tileEntity;
// Prevent client crashing by sending current state of the sign
send(player, sign.getUpdatePacket());
sign.isEditable = true;
sign.setAllowedPlayerEditor(player.getUniqueId());
send(player, new ClientboundOpenSignEditorPacket(sign.getBlockPos()));
return true;
} else {
return false;
}
}
use of com.denizenscript.denizen.nms.v1_17.impl.network.handlers.DenizenNetworkManagerImpl in project Denizen-For-Bukkit by DenizenScript.
the class PacketHelperImpl method showSignEditor.
@Override
public boolean showSignEditor(Player player, Location location) {
if (location == null) {
LocationTag fakeSign = new LocationTag(player.getLocation());
fakeSign.setY(0);
FakeBlock.showFakeBlockTo(Collections.singletonList(new PlayerTag(player)), fakeSign, new MaterialTag(org.bukkit.Material.OAK_WALL_SIGN), new DurationTag(1), true);
BlockPos pos = new BlockPos(fakeSign.getX(), 0, fakeSign.getZ());
((DenizenNetworkManagerImpl) ((CraftPlayer) player).getHandle().connection.connection).packetListener.fakeSignExpected = pos;
send(player, new ClientboundOpenSignEditorPacket(pos));
return true;
}
BlockEntity tileEntity = ((CraftWorld) location.getWorld()).getHandle().getBlockEntity(new BlockPos(location.getBlockX(), location.getBlockY(), location.getBlockZ()), true);
if (tileEntity instanceof SignBlockEntity) {
SignBlockEntity sign = (SignBlockEntity) tileEntity;
// Prevent client crashing by sending current state of the sign
send(player, sign.getUpdatePacket());
sign.isEditable = true;
sign.setAllowedPlayerEditor(player.getUniqueId());
send(player, new ClientboundOpenSignEditorPacket(sign.getBlockPos()));
return true;
} else {
return false;
}
}
use of com.denizenscript.denizen.nms.v1_17.impl.network.handlers.DenizenNetworkManagerImpl in project Denizen-For-Bukkit by DenizenScript.
the class PacketHelperImpl method showSignEditor.
@Override
public boolean showSignEditor(Player player, Location location) {
if (location == null) {
LocationTag fakeSign = new LocationTag(player.getLocation());
fakeSign.setY(0);
FakeBlock.showFakeBlockTo(Collections.singletonList(new PlayerTag(player)), fakeSign, new MaterialTag(org.bukkit.Material.OAK_WALL_SIGN), new DurationTag(1), true);
BlockPosition pos = new BlockPosition(fakeSign.getX(), 0, fakeSign.getZ());
((DenizenNetworkManagerImpl) ((CraftPlayer) player).getHandle().playerConnection.networkManager).packetListener.fakeSignExpected = pos;
sendPacket(player, new PacketPlayOutOpenSignEditor(pos));
return true;
}
TileEntity tileEntity = ((CraftWorld) location.getWorld()).getHandle().getTileEntity(new BlockPosition(location.getBlockX(), location.getBlockY(), location.getBlockZ()));
if (tileEntity instanceof TileEntitySign) {
TileEntitySign sign = (TileEntitySign) tileEntity;
// Prevent client crashing by sending current state of the sign
sendPacket(player, sign.getUpdatePacket());
sign.isEditable = true;
sign.a((EntityHuman) ((CraftPlayer) player).getHandle());
sendPacket(player, new PacketPlayOutOpenSignEditor(sign.getPosition()));
return true;
} else {
return false;
}
}
Aggregations