From 0620cc69658f9f3680b36ba78e75d34d9f9b814d Mon Sep 17 00:00:00 2001 From: montlikadani Date: Tue, 13 Aug 2019 11:19:15 +0200 Subject: [PATCH] Signs should work now in older versions --- .../java/com/gamingmesh/jobs/Signs/SignUtil.java | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/gamingmesh/jobs/Signs/SignUtil.java b/src/main/java/com/gamingmesh/jobs/Signs/SignUtil.java index 59e16b13..0e34b570 100644 --- a/src/main/java/com/gamingmesh/jobs/Signs/SignUtil.java +++ b/src/main/java/com/gamingmesh/jobs/Signs/SignUtil.java @@ -275,10 +275,8 @@ public class SignUtil { Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() { @Override public void run() { - Block b = loc.getBlock(); final Material type = b.getType(); - final BlockData data = b.getBlockData(); b.setType(Material.AIR); @@ -288,10 +286,22 @@ public class SignUtil { Block b = loc.getBlock(); b.setType(type); - b.setBlockData(data); + if (Version.isCurrentEqualOrLower(Version.v1_13_R2)) { + byte data = b.getData(); + try { + Block.class.getMethod("setData", byte.class).invoke(b, data); + } catch (Exception e) { + e.printStackTrace(); + } + } else { + BlockData data = b.getBlockData(); + b.setBlockData(data); + } + Skull skull = (Skull) b.getState(); if (skull == null) return; + skull.setOwner(Playername); skull.update(); return;