SteamWar/BauSystem2.0
Archiviert
12
0

Closes: #118
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Signed-off-by: yoyosource <yoyosource@nidido.de>
Dieser Commit ist enthalten in:
yoyosource 2022-08-28 17:22:25 +02:00
Ursprung 6a6eadb937
Commit 210fd0bd9f

Datei anzeigen

@ -58,10 +58,7 @@ public class SignEdit implements Listener {
if (!event.getPlayer().isSneaking()) return; if (!event.getPlayer().isSneaking()) return;
if (event.getClickedBlock() == null || !event.getClickedBlock().getType().name().contains("SIGN")) return; if (event.getClickedBlock() == null || !event.getClickedBlock().getType().name().contains("SIGN")) return;
if (event.getAction() == Action.RIGHT_CLICK_BLOCK && (event.getItem() == null || event.getItem().getType() == Material.AIR)) { if (event.getAction() == Action.RIGHT_CLICK_BLOCK && (event.getItem() == null || event.getItem().getType() == Material.AIR) || event.getAction() == Action.LEFT_CLICK_BLOCK) {
event.setCancelled(true);
edit(event.getPlayer(), event.getClickedBlock());
} else if (event.getAction() == Action.LEFT_CLICK_BLOCK) {
event.setCancelled(true); event.setCancelled(true);
Bukkit.getScheduler().runTaskLater(BauSystem.getInstance(), () -> { Bukkit.getScheduler().runTaskLater(BauSystem.getInstance(), () -> {
edit(event.getPlayer(), event.getClickedBlock()); edit(event.getPlayer(), event.getClickedBlock());
@ -75,11 +72,13 @@ public class SignEdit implements Listener {
for (int i = 0; i < lines.length; i++) { for (int i = 0; i < lines.length; i++) {
sign.setLine(i, lines[i].replace('§', '&')); sign.setLine(i, lines[i].replace('§', '&'));
} }
sign.update(); sign.update(true);
Object openSignObject = Reflection.newInstance(openSign); Bukkit.getScheduler().runTaskLater(BauSystem.getInstance(), () -> {
blockPositionFieldAccessor.set(openSignObject, getPosition.invoke(block)); Object openSignObject = Reflection.newInstance(openSign);
TinyProtocol.instance.sendPacket(player, openSignObject); blockPositionFieldAccessor.set(openSignObject, getPosition.invoke(block));
TinyProtocol.instance.sendPacket(player, openSignObject);
}, 1);
} }
{ {