From f485d2fbde9d171ec4d3209950d7b8c8c2f20494 Mon Sep 17 00:00:00 2001 From: Ste3et_C0st Date: Thu, 14 Nov 2019 09:59:36 +0100 Subject: [PATCH] Fix Models [GraveStone{BlockData},Crossbow{NPE},Guillotine{Blades}] --- src/Models109/GraveStone.yml | 9 +++++- src/Models113/GraveStone.dModel | 5 ++++ .../Furniture/Objects/RPG/Crossbow.java | 5 +--- .../Furniture/Objects/RPG/Guillotine.java | 9 ++++++ .../Furniture/Objects/garden/graveStone.java | 29 ++----------------- 5 files changed, 25 insertions(+), 32 deletions(-) diff --git a/src/Models109/GraveStone.yml b/src/Models109/GraveStone.yml index 932ed81..818d6b8 100644 --- a/src/Models109/GraveStone.yml +++ b/src/Models109/GraveStone.yml @@ -34,4 +34,11 @@ GraveStone: Y-Offset: 0.0 Z-Offset: 0.0 Type: BARRIER - Data: 0 \ No newline at end of file + Data: 0 + '1': + X-Offset: 0.0 + Y-Offset: 0.0 + Z-Offset: 1.0 + Type: WALL_SIGN + Data: 0 + Rotation: SOUTH \ No newline at end of file diff --git a/src/Models113/GraveStone.dModel b/src/Models113/GraveStone.dModel index 9aa71e1..27e0d9b 100644 --- a/src/Models113/GraveStone.dModel +++ b/src/Models113/GraveStone.dModel @@ -40,3 +40,8 @@ GraveStone: yOffset: 0.0 zOffset: 0.0 material: BARRIER + '1': + xOffset: 0.0 + yOffset: 0.0 + zOffset: 1.0 + material: WALL_SIGN[facing=south] \ No newline at end of file diff --git a/src/de/Ste3et_C0st/Furniture/Objects/RPG/Crossbow.java b/src/de/Ste3et_C0st/Furniture/Objects/RPG/Crossbow.java index 88e1b0a..df760d4 100644 --- a/src/de/Ste3et_C0st/Furniture/Objects/RPG/Crossbow.java +++ b/src/de/Ste3et_C0st/Furniture/Objects/RPG/Crossbow.java @@ -56,10 +56,7 @@ public class Crossbow extends Furniture{ Location start = getRelative(getCenter(), getBlockFace(), 0,0); start.setYaw(getYaw()); start = start.add(0, 1.8, 0); - Arrow a = null; - if(mat.equals(Material.ARROW)){ - a = (Arrow) getWorld().spawnEntity(start, EntityType.ARROW); - } + Arrow a = (Arrow) getWorld().spawnEntity(start, EntityType.ARROW);; a.setCritical(true); a.setVelocity(v); a.setShooter(p); diff --git a/src/de/Ste3et_C0st/Furniture/Objects/RPG/Guillotine.java b/src/de/Ste3et_C0st/Furniture/Objects/RPG/Guillotine.java index ca5c810..ace9c69 100644 --- a/src/de/Ste3et_C0st/Furniture/Objects/RPG/Guillotine.java +++ b/src/de/Ste3et_C0st/Furniture/Objects/RPG/Guillotine.java @@ -61,9 +61,18 @@ public class Guillotine extends Furniture implements Listener{ Bukkit.getPluginManager().registerEvents(this, main.getInstance()); return; } + + getfAsList().stream().filter(entity -> entity.getCustomName().startsWith("iron")).forEach(entity -> { + String[] a = entity.getCustomName().split(":"); + String b = a + ":" + entity.getLocation().getX() + ":" + entity.getLocation().getY() + ":" + entity.getLocation().getZ(); + entity.setCustomName(b); + }); + setDefault(); initializeInventory(); Bukkit.getPluginManager().registerEvents(this, getPlugin()); + + } private void initializeInventory(){ diff --git a/src/de/Ste3et_C0st/Furniture/Objects/garden/graveStone.java b/src/de/Ste3et_C0st/Furniture/Objects/garden/graveStone.java index 5020e65..615382c 100644 --- a/src/de/Ste3et_C0st/Furniture/Objects/garden/graveStone.java +++ b/src/de/Ste3et_C0st/Furniture/Objects/garden/graveStone.java @@ -33,34 +33,9 @@ public class graveStone extends Furniture{ } private void setBlock(){ - Location location = getLocation().clone(); - if(getBlockFace().equals(BlockFace.WEST)){location = getLutil().getRelativ(location, getBlockFace(), .0, -1.02);} - if(getBlockFace().equals(BlockFace.SOUTH)){location = getLutil().getRelativ(location, getBlockFace(), -1.0, -1.02);} - if(getBlockFace().equals(BlockFace.EAST)){location = getLutil().getRelativ(location, getBlockFace(), -1.0, .0);} - Location center = getLutil().getRelativ(location, getBlockFace(), .18D, .955D); - center.setYaw(getLutil().FaceToYaw(getBlockFace().getOppositeFace()) + 90); - Location kreutz2 = getLutil().getRelativ(center, getBlockFace(), -.23, -1.27); - Location sign = getLutil().getRelativ(kreutz2.getBlock().getLocation(), getBlockFace(), 0D, 1D); - this.signLoc = sign; - - if(!sign.getBlock().getType().name().contains("SIGN")){ - sign.getBlock().setType(Material.valueOf(Type.version.equalsIgnoreCase("1.13") ? "WALL_SIGN" : "OAK_WALL_SIGN")); - this.sign = sign.getBlock(); - if(FurnitureHook.isNewVersion()) { - org.bukkit.block.data.Directional direct = (org.bukkit.block.data.Directional) this.sign.getBlockData(); - direct.setFacing(getBlockFace()); - this.sign.setBlockData(direct); - }else { - BlockState state = this.sign.getState(); - LocationUtil util = getLutil(); - state.setRawData(util.getFacebyte(util.yawToFace(getYaw() + 90))); - state.update(); - } - }else{ - this.sign = sign.getBlock(); - } + this.signLoc = getObjID().getBlockList().stream().filter(b -> b.getBlock().getType().name().contains("SIGN")).findFirst().orElse(null); + if(this.signLoc != null) this.sign = this.signLoc.getBlock(); this.lines = getText(); - getObjID().addBlock(Arrays.asList(this.sign)); } @Override