diff --git a/src/Crafting/Hammock.yml b/src/Crafting/Hammock.yml new file mode 100644 index 0000000..e521122 --- /dev/null +++ b/src/Crafting/Hammock.yml @@ -0,0 +1,13 @@ +Hammock: + name: '&cHammock' + material: 383 + glow: false + lore: '' + crafting: + disable: false + recipe: 000,XEX,A0A + index: + X: 280 + E: 425 + A: 17 + 0: 0 \ No newline at end of file diff --git a/src/config.yml b/src/config.yml index 7826fdc..860249d 100644 --- a/src/config.yml +++ b/src/config.yml @@ -1,75 +1,70 @@ -Material: - - 1 - - 2 - - 3 - - 4 - - 5 - - 7 - - 12 - - 13 - - 14 - - 15 - - 16 - - 17 - - 18 - - 19 - - 20 - - 21 - - 22 - - 24 - - 25 - - 29 - - 33 - - 35 - - 41 - - 42 - - 45 - - 46 - - 47 - - 48 - - 49 - - 52 - - 56 - - 57 - - 58 - - 61 - - 73 - - 79 - - 80 - - 81 - - 82 - - 84 - - 86 - - 87 - - 88 - - 89 - - 91 - - 95 - - 97 - - 98 - - 99 - - 100 - - 103 - - 110 - - 112 - - 121 - - 123 - - 129 - - 133 - - 137 - - 138 - - 152 - - 153 - - 155 - - 158 - - 159 - - 161 - - 162 - - 165 - - 168 - - 169 - - 170 - - 172 - - 173 - - 174 - - 179 \ No newline at end of file +MaterialData: + - STONE + - GRASS + - DIRT + - COBBLESTONE + - WOOD + - BEDROCK + - SAND + - GRAVEL + - GOLD_ORE + - IRON_ORE + - COAL_ORE + - LOG + - LEAVES + - SPONGE + - GLASS + - LAPIS_ORE + - LAPIS_BLOCK + - SANDSTONE + - NOTE_BLOCK + - PISTON_STICKY_BASE + - PISTON_BASE + - WOOL + - GOLD_BLOCK + - IRON_BLOCK + - BRICK + - TNT + - BOOKSHELF + - MOSSY_COBBLESTONE + - OBSIDIAN + - MOB_SPAWNER + - DIAMOND_ORE + - DIAMOND_BLOCK + - WORKBENCH + - FURNACE + - REDSTONE_ORE + - ICE + - SNOW_BLOCK + - CACTUS + - CLAY + - JUKEBOX + - PUMPKIN + - NETHERRACK + - SOUL_SAND + - GLOWSTONE + - JACK_O_LANTERN + - MONSTER_EGGS + - SMOOTH_BRICK + - HUGE_MUSHROOM_1 + - HUGE_MUSHROOM_2 + - MELON_BLOCK + - MYCEL + - NETHER_BRICK + - ENDER_STONE + - REDSTONE_LAMP_OFF + - EMERALD_ORE + - EMERALD_BLOCK + - COMMAND + - BEACON + - REDSTONE_BLOCK + - QUARTZ_ORE + - QUARTZ_BLOCK + - DROPPER + - STAINED_CLAY + - LEAVES_2 + - LOG_2 + - HAY_BLOCK + - HARD_CLAY + - COAL_BLOCK + - PACKED_ICE \ No newline at end of file diff --git a/src/de/Ste3et_C0st/Furniture/Main/main.java b/src/de/Ste3et_C0st/Furniture/Main/main.java index 7b434e3..e15781f 100644 --- a/src/de/Ste3et_C0st/Furniture/Main/main.java +++ b/src/de/Ste3et_C0st/Furniture/Main/main.java @@ -32,6 +32,7 @@ import de.Ste3et_C0st.Furniture.Objects.indoor.table; import de.Ste3et_C0st.Furniture.Objects.outdoor.barrels; import de.Ste3et_C0st.Furniture.Objects.outdoor.campfire_1; import de.Ste3et_C0st.Furniture.Objects.outdoor.campfire_2; +import de.Ste3et_C0st.Furniture.Objects.outdoor.hammock; import de.Ste3et_C0st.Furniture.Objects.outdoor.tent_1; import de.Ste3et_C0st.Furniture.Objects.outdoor.tent_2; import de.Ste3et_C0st.Furniture.Objects.outdoor.tent_3; @@ -82,6 +83,7 @@ public class main extends JavaPlugin implements Listener{ new Project("Billboard", new CraftingFile("Billboard", getResource("Crafting/Billboard.yml")), this, billboard.class); new Project("Mailbox", new CraftingFile("Mailbox", getResource("Crafting/Mailbox.yml")), this, mailBox.class); new Project("WeaponStand", new CraftingFile("WeaponStand", getResource("Crafting/WeaponStand.yml")), this, weaponStand.class); + new Project("Hammock", new CraftingFile("Hammock", getResource("Crafting/Hammock.yml")), this, hammock.class); List objList = new ArrayList(); for(ObjectID obj : manager.getObjectList()){ @@ -111,6 +113,7 @@ public class main extends JavaPlugin implements Listener{ case "Streetlamp":new streetlamp(lib, this, obj);break; case "Billboard": new billboard(lib, this, obj); break; case "WeaponStand": new weaponStand(lib, this, obj);break; + case "Hammock": new hammock(lib, this, obj); break; case "Mailbox" : mailBox mail = new mailBox(lib, this, obj); /*try { @@ -134,13 +137,12 @@ public class main extends JavaPlugin implements Listener{ this.c.saveConfig("whiteList", this.file, "plugin/fence/"); setDefaults(); } - - @SuppressWarnings("deprecation") + private void setDefaults(){ c = new config(); this.file = c.getConfig("whiteList", "plugin/fence/"); - List intList = this.file.getIntegerList("Material"); - for(int i : intList){ + List intList = this.file.getStringList("MaterialData"); + for(String i : intList){ if(Material.getMaterial(i)!=null){ Material m = Material.getMaterial(i); materialWhiteList.add(m); @@ -194,6 +196,7 @@ public class main extends JavaPlugin implements Listener{ case "Billboard": new billboard(lib, instance, obj);break; case "Mailbox" : new mailBox(lib, instance, obj); break; case "WeaponStand": new weaponStand(lib, instance, obj); break; + case "Hammock": new hammock(lib, instance, obj); break; } e.finish(); e.removeItem(); diff --git a/src/de/Ste3et_C0st/Furniture/Objects/RPG/weaponStand.java b/src/de/Ste3et_C0st/Furniture/Objects/RPG/weaponStand.java index 0ee09ba..0129613 100644 --- a/src/de/Ste3et_C0st/Furniture/Objects/RPG/weaponStand.java +++ b/src/de/Ste3et_C0st/Furniture/Objects/RPG/weaponStand.java @@ -29,6 +29,7 @@ import de.Ste3et_C0st.FurnitureLib.main.FurnitureLib; import de.Ste3et_C0st.FurnitureLib.main.FurnitureManager; import de.Ste3et_C0st.FurnitureLib.main.ObjectID; import de.Ste3et_C0st.FurnitureLib.main.Type.BodyPart; +import de.Ste3et_C0st.FurnitureLib.main.Type.SQLAction; public class weaponStand extends Furniture { @@ -101,10 +102,11 @@ public class weaponStand extends Furniture { @EventHandler public void onFurnitureClick(FurnitureClickEvent e) { if(obj==null){return;} + if(obj.getSQLAction().equals(SQLAction.REMOVE)){return;} if(p!=null){return;} if(e.isCancelled()){return;} - if(!e.canBuild()){return;} if(!e.getID().equals(obj)){return;} + if(!e.canBuild()){return;} ItemStack is1 = new ItemStack(Material.STAINED_GLASS_PANE, 1, (short) 15); ItemStack is3 = new ItemStack(Material.STAINED_GLASS_PANE, 1, (short) 14); @@ -158,6 +160,7 @@ public class weaponStand extends Furniture { @EventHandler private void onClick(InventoryClickEvent e){ if(obj==null){return;} + if(obj.getSQLAction().equals(SQLAction.REMOVE)){return;} if(p==null){return;} if(inv==null){return;} if(e.getInventory()==null){return;} @@ -183,6 +186,7 @@ public class weaponStand extends Furniture { @EventHandler private void onClose(InventoryCloseEvent e){ if(obj==null){return;} + if(obj.getSQLAction().equals(SQLAction.REMOVE)){return;} if(p==null){return;} if(inv==null){return;} if(!e.getInventory().getTitle().equalsIgnoreCase(inv.getTitle())){return;} diff --git a/src/de/Ste3et_C0st/Furniture/Objects/electric/billboard.java b/src/de/Ste3et_C0st/Furniture/Objects/electric/billboard.java index efd3194..28356a5 100644 --- a/src/de/Ste3et_C0st/Furniture/Objects/electric/billboard.java +++ b/src/de/Ste3et_C0st/Furniture/Objects/electric/billboard.java @@ -25,6 +25,7 @@ import de.Ste3et_C0st.FurnitureLib.main.FurnitureLib; import de.Ste3et_C0st.FurnitureLib.main.FurnitureManager; import de.Ste3et_C0st.FurnitureLib.main.ObjectID; import de.Ste3et_C0st.FurnitureLib.main.Type.BodyPart; +import de.Ste3et_C0st.FurnitureLib.main.Type.SQLAction; public class billboard extends Furniture implements Listener{ @@ -122,6 +123,7 @@ public class billboard extends Furniture implements Listener{ @EventHandler public void onFurnitureBreak(FurnitureBreakEvent e) { if(obj==null){return;} + if(obj.getSQLAction().equals(SQLAction.REMOVE)){return;} if(e.isCancelled()){return;} if(!e.getID().equals(obj)){return;} if(!e.canBuild()){return;} diff --git a/src/de/Ste3et_C0st/Furniture/Objects/electric/camera.java b/src/de/Ste3et_C0st/Furniture/Objects/electric/camera.java index 061f35d..25e5c53 100644 --- a/src/de/Ste3et_C0st/Furniture/Objects/electric/camera.java +++ b/src/de/Ste3et_C0st/Furniture/Objects/electric/camera.java @@ -29,6 +29,7 @@ import de.Ste3et_C0st.FurnitureLib.main.FurnitureLib; import de.Ste3et_C0st.FurnitureLib.main.FurnitureManager; import de.Ste3et_C0st.FurnitureLib.main.ObjectID; import de.Ste3et_C0st.FurnitureLib.main.Type.BodyPart; +import de.Ste3et_C0st.FurnitureLib.main.Type.SQLAction; public class camera extends Furniture implements Listener{ Location loc; @@ -132,6 +133,7 @@ public class camera extends Furniture implements Listener{ @EventHandler public void onFurnitureBreak(FurnitureBreakEvent e) { if(obj==null){return;} + if(obj.getSQLAction().equals(SQLAction.REMOVE)){return;} if(e.isCancelled()){return;} if(!e.getID().equals(obj)){return;} if(!e.canBuild()){return;} @@ -144,6 +146,7 @@ public class camera extends Furniture implements Listener{ @EventHandler public void onFurnitureClick(FurnitureClickEvent e) { if(obj==null){return;} + if(obj.getSQLAction().equals(SQLAction.REMOVE)){return;} if(e.isCancelled()){return;} if(!e.getID().equals(obj)){return;} Player p = e.getPlayer(); diff --git a/src/de/Ste3et_C0st/Furniture/Objects/electric/streetlamp.java b/src/de/Ste3et_C0st/Furniture/Objects/electric/streetlamp.java index b18a7ba..3aff9d5 100644 --- a/src/de/Ste3et_C0st/Furniture/Objects/electric/streetlamp.java +++ b/src/de/Ste3et_C0st/Furniture/Objects/electric/streetlamp.java @@ -30,6 +30,7 @@ import de.Ste3et_C0st.FurnitureLib.main.FurnitureManager; import de.Ste3et_C0st.FurnitureLib.main.ObjectID; import de.Ste3et_C0st.FurnitureLib.main.Type.BodyPart; import de.Ste3et_C0st.FurnitureLib.main.Type.EventType; +import de.Ste3et_C0st.FurnitureLib.main.Type.SQLAction; public class streetlamp extends Furniture implements Listener{ @@ -150,6 +151,7 @@ public class streetlamp extends Furniture implements Listener{ @EventHandler private void onPlayerInteract(PlayerInteractEvent e){ if(obj==null){return;} + if(obj.getSQLAction().equals(SQLAction.REMOVE)){return;} if(e.isCancelled()){return;} if(e.getAction()==null) return; if(e.getClickedBlock()==null) return; @@ -176,6 +178,7 @@ public class streetlamp extends Furniture implements Listener{ @EventHandler private void onBlockPowered(BlockRedstoneEvent e){ if(obj==null){return;} + if(obj.getSQLAction().equals(SQLAction.REMOVE)){return;} if(e.getBlock()==null){return;} Vector loc = e.getBlock().getLocation().toVector(); if(loc2.distance(loc)<=1){ @@ -244,6 +247,7 @@ public class streetlamp extends Furniture implements Listener{ public void onFurnitureBreak(FurnitureBreakEvent e) { if(e.isCancelled()){return;} if(!e.getID().equals(obj)){return;} + if(obj.getSQLAction().equals(SQLAction.REMOVE)){return;} if(!e.canBuild()){return;} FurnitureLib.getInstance().getLightManager().removeLight(light); e.remove(); @@ -258,6 +262,7 @@ public class streetlamp extends Furniture implements Listener{ @EventHandler public void onFurnitureClick(FurnitureClickEvent e) { if(obj==null){return;} + if(obj.getSQLAction().equals(SQLAction.REMOVE)){return;} if(e.isCancelled()){return;} if(!e.getID().equals(obj)){return;} if(!e.canBuild()){return;} diff --git a/src/de/Ste3et_C0st/Furniture/Objects/electric/tv.java b/src/de/Ste3et_C0st/Furniture/Objects/electric/tv.java index 5212444..8ed739f 100644 --- a/src/de/Ste3et_C0st/Furniture/Objects/electric/tv.java +++ b/src/de/Ste3et_C0st/Furniture/Objects/electric/tv.java @@ -24,6 +24,7 @@ import de.Ste3et_C0st.FurnitureLib.main.FurnitureLib; import de.Ste3et_C0st.FurnitureLib.main.FurnitureManager; import de.Ste3et_C0st.FurnitureLib.main.ObjectID; import de.Ste3et_C0st.FurnitureLib.main.Type.BodyPart; +import de.Ste3et_C0st.FurnitureLib.main.Type.SQLAction; public class tv extends Furniture implements Listener{ @@ -114,6 +115,7 @@ public class tv extends Furniture implements Listener{ @EventHandler public void onFurnitureBreak(FurnitureBreakEvent e){ if(obj==null){return;} + if(obj.getSQLAction().equals(SQLAction.REMOVE)){return;} if(e.isCancelled()){return;} if(!e.getID().equals(obj)){return;} if(!e.canBuild()){return;} diff --git a/src/de/Ste3et_C0st/Furniture/Objects/garden/fance.java b/src/de/Ste3et_C0st/Furniture/Objects/garden/fance.java index 8b52e22..8b0968f 100644 --- a/src/de/Ste3et_C0st/Furniture/Objects/garden/fance.java +++ b/src/de/Ste3et_C0st/Furniture/Objects/garden/fance.java @@ -29,6 +29,7 @@ import de.Ste3et_C0st.FurnitureLib.main.FurnitureLib; import de.Ste3et_C0st.FurnitureLib.main.FurnitureManager; import de.Ste3et_C0st.FurnitureLib.main.ObjectID; import de.Ste3et_C0st.FurnitureLib.main.Type.EventType; +import de.Ste3et_C0st.FurnitureLib.main.Type.SQLAction; public class fance extends Furniture implements Listener{ @@ -100,6 +101,7 @@ public class fance extends Furniture implements Listener{ @EventHandler private void onBlockBreak(BlockBreakEvent e){ if(obj==null){return;} + if(obj.getSQLAction().equals(SQLAction.REMOVE)){return;} if(block==null){return;} if(!e.getBlock().getLocation().equals(block.getLocation())){return;} if(!lib.canBuild(e.getPlayer(), obj, EventType.BREAK)){return;} @@ -113,6 +115,7 @@ public class fance extends Furniture implements Listener{ @EventHandler public void onFurnitureBreak(FurnitureBreakEvent e){ if(obj==null){return;} + if(obj.getSQLAction().equals(SQLAction.REMOVE)){return;} if(e.isCancelled()){return;} if(!e.getID().equals(obj)){return;} if(!e.canBuild()){return;} @@ -128,6 +131,7 @@ public class fance extends Furniture implements Listener{ @EventHandler private void onInteract(PlayerInteractEvent e){ if(obj==null){return;} + if(obj.getSQLAction().equals(SQLAction.REMOVE)){return;} if(e.isCancelled()) return; if(this.block==null) return; if(e.getAction()==null)return; @@ -165,6 +169,7 @@ public class fance extends Furniture implements Listener{ @EventHandler public void onFurnitureClick(FurnitureClickEvent e){ if(obj==null){return;} + if(obj.getSQLAction().equals(SQLAction.REMOVE)){return;} if(e.isCancelled()){return;} if(this.block==null) return; if(!e.getID().equals(obj)){return;} diff --git a/src/de/Ste3et_C0st/Furniture/Objects/garden/graveStone.java b/src/de/Ste3et_C0st/Furniture/Objects/garden/graveStone.java index dfb1cd4..e73c2d4 100644 --- a/src/de/Ste3et_C0st/Furniture/Objects/garden/graveStone.java +++ b/src/de/Ste3et_C0st/Furniture/Objects/garden/graveStone.java @@ -32,6 +32,7 @@ import de.Ste3et_C0st.FurnitureLib.main.FurnitureLib; import de.Ste3et_C0st.FurnitureLib.main.FurnitureManager; import de.Ste3et_C0st.FurnitureLib.main.ObjectID; import de.Ste3et_C0st.FurnitureLib.main.Type.BodyPart; +import de.Ste3et_C0st.FurnitureLib.main.Type.SQLAction; public class graveStone extends Furniture implements Listener{ @@ -153,7 +154,9 @@ public class graveStone extends Furniture implements Listener{ @EventHandler public void onFurnitureBreak(FurnitureBreakEvent e){ if(obj==null){return;} + if(obj.getSQLAction().equals(SQLAction.REMOVE)){return;} if(e.isCancelled()) return; + if(!e.getID().equals(obj)){return;} if(!e.canBuild()){return;} e.remove(); sign.setType(Material.AIR); @@ -165,6 +168,7 @@ public class graveStone extends Furniture implements Listener{ private void onBlockRemove(BlockBreakEvent e) { if(obj==null){return;} + if(obj.getSQLAction().equals(SQLAction.REMOVE)){return;} if (sign==null) return; if (e.getBlock() == null) return; if (e.getBlock().getLocation() == null) return; @@ -175,6 +179,7 @@ public class graveStone extends Furniture implements Listener{ @EventHandler private void onBlockPlaceEvent(BlockPlaceEvent e){ if(obj==null){return;} + if(obj.getSQLAction().equals(SQLAction.REMOVE)){return;} if (sign==null) return; if (e.getBlock() == null) return; if (e.getBlock().getLocation() == null) return; @@ -185,6 +190,7 @@ public class graveStone extends Furniture implements Listener{ @EventHandler private void onDrop(ItemSpawnEvent e){ if(obj==null){return;} + if(obj.getSQLAction().equals(SQLAction.REMOVE)){return;} if (sign==null) return; if (e.getLocation() == null) return; ItemStack is = e.getEntity().getItemStack(); @@ -198,6 +204,7 @@ public class graveStone extends Furniture implements Listener{ @EventHandler public void onFurnitureClick(FurnitureClickEvent e){ if(obj==null){return;} + if(obj.getSQLAction().equals(SQLAction.REMOVE)){return;} Player p = e.getPlayer(); if(e.isCancelled()) return; if(!e.getID().equals(obj)) return; diff --git a/src/de/Ste3et_C0st/Furniture/Objects/garden/mailBox.java b/src/de/Ste3et_C0st/Furniture/Objects/garden/mailBox.java index be52ee8..fd9ff9e 100644 --- a/src/de/Ste3et_C0st/Furniture/Objects/garden/mailBox.java +++ b/src/de/Ste3et_C0st/Furniture/Objects/garden/mailBox.java @@ -29,6 +29,7 @@ import de.Ste3et_C0st.FurnitureLib.main.FurnitureManager; import de.Ste3et_C0st.FurnitureLib.main.ObjectID; import de.Ste3et_C0st.FurnitureLib.main.Type.BodyPart; import de.Ste3et_C0st.FurnitureLib.main.Type.EventType; +import de.Ste3et_C0st.FurnitureLib.main.Type.SQLAction; public class mailBox extends Furniture implements Listener { @@ -211,6 +212,7 @@ public class mailBox extends Furniture implements Listener { @EventHandler public void onFurnitureBreak(FurnitureBreakEvent e){ if(obj==null){return;} + if(obj.getSQLAction().equals(SQLAction.REMOVE)){return;} if(e.isCancelled()) return; if(!e.getID().equals(obj)) return; if(!e.canBuild()){return;} @@ -228,6 +230,7 @@ public class mailBox extends Furniture implements Listener { @EventHandler private void onInteract(PlayerInteractEvent e){ if(obj==null){return;} + if(obj.getSQLAction().equals(SQLAction.REMOVE)){return;} if(e.isCancelled()){return;} if(e.getAction()==null){return;} if(e.getClickedBlock()==null){return;} diff --git a/src/de/Ste3et_C0st/Furniture/Objects/garden/sunshade.java b/src/de/Ste3et_C0st/Furniture/Objects/garden/sunshade.java index 7360cfd..ad88a89 100644 --- a/src/de/Ste3et_C0st/Furniture/Objects/garden/sunshade.java +++ b/src/de/Ste3et_C0st/Furniture/Objects/garden/sunshade.java @@ -35,6 +35,7 @@ import de.Ste3et_C0st.FurnitureLib.main.FurnitureManager; import de.Ste3et_C0st.FurnitureLib.main.ObjectID; import de.Ste3et_C0st.FurnitureLib.main.Type.BodyPart; import de.Ste3et_C0st.FurnitureLib.main.Type.EventType; +import de.Ste3et_C0st.FurnitureLib.main.Type.SQLAction; public class sunshade extends Furniture implements Listener{ @@ -139,6 +140,7 @@ public class sunshade extends Furniture implements Listener{ @EventHandler public void onFurnitureClick(FurnitureClickEvent e){ if(obj==null){return;} + if(obj.getSQLAction().equals(SQLAction.REMOVE)){return;} if(e.isCancelled()){return;} if(!e.getID().equals(obj)){return;} if(!e.canBuild()){return;} @@ -187,6 +189,7 @@ public class sunshade extends Furniture implements Listener{ @EventHandler private void onInteract(PlayerInteractEvent e){ if(obj==null){return;} + if(obj.getSQLAction().equals(SQLAction.REMOVE)){return;} if(e.isCancelled()){return;} if(e.getAction()==null){return;} if(e.getClickedBlock()==null){return;} @@ -249,6 +252,7 @@ public class sunshade extends Furniture implements Listener{ @EventHandler public void onFurnitureBreak(FurnitureBreakEvent e){ if(obj==null){return;} + if(obj.getSQLAction().equals(SQLAction.REMOVE)){return;} if(e.isCancelled()){return;} if(!e.getID().equals(obj)){return;} if(!e.canBuild()){return;} diff --git a/src/de/Ste3et_C0st/Furniture/Objects/indoor/chair.java b/src/de/Ste3et_C0st/Furniture/Objects/indoor/chair.java index 4844345..91f9276 100644 --- a/src/de/Ste3et_C0st/Furniture/Objects/indoor/chair.java +++ b/src/de/Ste3et_C0st/Furniture/Objects/indoor/chair.java @@ -24,6 +24,7 @@ import de.Ste3et_C0st.FurnitureLib.main.FurnitureLib; import de.Ste3et_C0st.FurnitureLib.main.FurnitureManager; import de.Ste3et_C0st.FurnitureLib.main.ObjectID; import de.Ste3et_C0st.FurnitureLib.main.Type.BodyPart; +import de.Ste3et_C0st.FurnitureLib.main.Type.SQLAction; public class chair extends Furniture implements Listener{ @@ -119,6 +120,7 @@ public class chair extends Furniture implements Listener{ @EventHandler public void onFurnitureBreak(FurnitureBreakEvent e){ if(obj==null){return;} + if(obj.getSQLAction().equals(SQLAction.REMOVE)){return;} if(e.isCancelled()){return;} if(!e.getID().equals(obj)){return;} if(!e.canBuild()){return;} @@ -129,6 +131,7 @@ public class chair extends Furniture implements Listener{ @EventHandler public void onFurnitureClick(FurnitureClickEvent e){ if(obj==null){return;} + if(obj.getSQLAction().equals(SQLAction.REMOVE)){return;} if(e.isCancelled()){return;} if(!e.getID().equals(obj)){return;} ArmorStandPacket packet = null; diff --git a/src/de/Ste3et_C0st/Furniture/Objects/indoor/lantern.java b/src/de/Ste3et_C0st/Furniture/Objects/indoor/lantern.java index 3f2f1ef..14952d9 100644 --- a/src/de/Ste3et_C0st/Furniture/Objects/indoor/lantern.java +++ b/src/de/Ste3et_C0st/Furniture/Objects/indoor/lantern.java @@ -25,6 +25,7 @@ import de.Ste3et_C0st.FurnitureLib.main.Furniture; import de.Ste3et_C0st.FurnitureLib.main.FurnitureLib; import de.Ste3et_C0st.FurnitureLib.main.FurnitureManager; import de.Ste3et_C0st.FurnitureLib.main.ObjectID; +import de.Ste3et_C0st.FurnitureLib.main.Type.SQLAction; public class lantern extends Furniture implements Listener{ @@ -121,6 +122,7 @@ public class lantern extends Furniture implements Listener{ @EventHandler public void onWaterFlow(BlockFromToEvent e){ if(obj==null){return;} + if(obj.getSQLAction().equals(SQLAction.REMOVE)){return;} Location locTo = e.getToBlock().getLocation(); if(loc!=null && locTo.equals(loc.getBlock().getLocation())){ e.setCancelled(true); @@ -130,6 +132,7 @@ public class lantern extends Furniture implements Listener{ @EventHandler public void onFurnitureBreak(FurnitureBreakEvent e){ if(obj==null){return;} + if(obj.getSQLAction().equals(SQLAction.REMOVE)){return;} if(e.isCancelled()) return; if(block==null) return; if(!e.getID().equals(obj)) return; @@ -141,6 +144,7 @@ public class lantern extends Furniture implements Listener{ @EventHandler public void onFurnitureClick(FurnitureClickEvent e){ if(obj==null){return;} + if(obj.getSQLAction().equals(SQLAction.REMOVE)){return;} if(e.isCancelled()) return; if(block==null) return; if(!e.getID().equals(obj)) return; diff --git a/src/de/Ste3et_C0st/Furniture/Objects/indoor/largeTable.java b/src/de/Ste3et_C0st/Furniture/Objects/indoor/largeTable.java index 01c03d1..97b0107 100644 --- a/src/de/Ste3et_C0st/Furniture/Objects/indoor/largeTable.java +++ b/src/de/Ste3et_C0st/Furniture/Objects/indoor/largeTable.java @@ -28,6 +28,7 @@ import de.Ste3et_C0st.FurnitureLib.main.FurnitureManager; import de.Ste3et_C0st.FurnitureLib.main.ObjectID; import de.Ste3et_C0st.FurnitureLib.main.Type.BodyPart; import de.Ste3et_C0st.FurnitureLib.main.Type.ColorType; +import de.Ste3et_C0st.FurnitureLib.main.Type.SQLAction; public class largeTable extends Furniture implements Listener{ @@ -203,6 +204,7 @@ public class largeTable extends Furniture implements Listener{ @EventHandler public void onFurnitureBreak(FurnitureBreakEvent e){ if(obj==null){return;} + if(obj.getSQLAction().equals(SQLAction.REMOVE)){return;} if(e.isCancelled()){return;} if(!e.getID().equals(obj)){return;} if(!e.canBuild()){return;} @@ -222,6 +224,7 @@ public class largeTable extends Furniture implements Listener{ @EventHandler public void onFurnitureClick(FurnitureClickEvent e){ if(obj==null){return;} + if(obj.getSQLAction().equals(SQLAction.REMOVE)){return;} if(e.isCancelled()){return;} if(!e.getID().equals(obj)){return;} if(!e.canBuild()){return;} diff --git a/src/de/Ste3et_C0st/Furniture/Objects/indoor/sofa.java b/src/de/Ste3et_C0st/Furniture/Objects/indoor/sofa.java index 59d2a27..d8e0a3f 100644 --- a/src/de/Ste3et_C0st/Furniture/Objects/indoor/sofa.java +++ b/src/de/Ste3et_C0st/Furniture/Objects/indoor/sofa.java @@ -27,6 +27,7 @@ import de.Ste3et_C0st.FurnitureLib.main.ObjectID; import de.Ste3et_C0st.FurnitureLib.main.Type.BodyPart; import de.Ste3et_C0st.FurnitureLib.main.Type.ColorType; import de.Ste3et_C0st.FurnitureLib.main.Type.EventType; +import de.Ste3et_C0st.FurnitureLib.main.Type.SQLAction; public class sofa extends Furniture implements Listener { @@ -174,6 +175,7 @@ public class sofa extends Furniture implements Listener { @EventHandler public void onFurnitureClick(FurnitureClickEvent e){ if(obj==null){return;} + if(obj.getSQLAction().equals(SQLAction.REMOVE)){return;} if(e.isCancelled()){return;} if(!e.getID().equals(obj)){return;} e.setCancelled(true); diff --git a/src/de/Ste3et_C0st/Furniture/Objects/indoor/table.java b/src/de/Ste3et_C0st/Furniture/Objects/indoor/table.java index dc34ff1..334038e 100644 --- a/src/de/Ste3et_C0st/Furniture/Objects/indoor/table.java +++ b/src/de/Ste3et_C0st/Furniture/Objects/indoor/table.java @@ -26,6 +26,7 @@ import de.Ste3et_C0st.FurnitureLib.main.FurnitureLib; import de.Ste3et_C0st.FurnitureLib.main.FurnitureManager; import de.Ste3et_C0st.FurnitureLib.main.ObjectID; import de.Ste3et_C0st.FurnitureLib.main.Type.BodyPart; +import de.Ste3et_C0st.FurnitureLib.main.Type.SQLAction; public class table extends Furniture implements Listener { @@ -95,6 +96,7 @@ public class table extends Furniture implements Listener { @EventHandler public void onFurnitureBreak(FurnitureBreakEvent e){ if(obj==null){return;} + if(obj.getSQLAction().equals(SQLAction.REMOVE)){return;} if(e.isCancelled()){return;} if(!e.getID().equals(obj)){return;} if(!e.canBuild()){return;} @@ -114,6 +116,7 @@ public class table extends Furniture implements Listener { @EventHandler public void onFurnitureClick(FurnitureClickEvent e){ if(obj==null){return;} + if(obj.getSQLAction().equals(SQLAction.REMOVE)){return;} if(e.isCancelled()){return;} if(!e.getID().equals(obj)){return;} Player p = e.getPlayer(); diff --git a/src/de/Ste3et_C0st/Furniture/Objects/outdoor/barrels.java b/src/de/Ste3et_C0st/Furniture/Objects/outdoor/barrels.java index 8b6385b..af65282 100644 --- a/src/de/Ste3et_C0st/Furniture/Objects/outdoor/barrels.java +++ b/src/de/Ste3et_C0st/Furniture/Objects/outdoor/barrels.java @@ -26,6 +26,7 @@ import de.Ste3et_C0st.FurnitureLib.main.FurnitureLib; import de.Ste3et_C0st.FurnitureLib.main.FurnitureManager; import de.Ste3et_C0st.FurnitureLib.main.ObjectID; import de.Ste3et_C0st.FurnitureLib.main.Type.EventType; +import de.Ste3et_C0st.FurnitureLib.main.Type.SQLAction; public class barrels extends Furniture implements Listener { @@ -138,6 +139,7 @@ public class barrels extends Furniture implements Listener { @EventHandler private void onBlockBreak(BlockBreakEvent e){ if(obj==null){return;} + if(obj.getSQLAction().equals(SQLAction.REMOVE)){return;} if(block==null){return;} if(!e.getBlock().getLocation().equals(block.getLocation())){return;} if(!lib.canBuild(e.getPlayer(), obj, EventType.BREAK)){return;} @@ -165,4 +167,4 @@ public class barrels extends Furniture implements Listener { block.setType(Material.AIR); block=null; } -} +} \ No newline at end of file diff --git a/src/de/Ste3et_C0st/Furniture/Objects/outdoor/campfire_1.java b/src/de/Ste3et_C0st/Furniture/Objects/outdoor/campfire_1.java index 490d142..41f57d9 100644 --- a/src/de/Ste3et_C0st/Furniture/Objects/outdoor/campfire_1.java +++ b/src/de/Ste3et_C0st/Furniture/Objects/outdoor/campfire_1.java @@ -21,6 +21,7 @@ import de.Ste3et_C0st.FurnitureLib.main.Furniture; import de.Ste3et_C0st.FurnitureLib.main.FurnitureLib; import de.Ste3et_C0st.FurnitureLib.main.FurnitureManager; import de.Ste3et_C0st.FurnitureLib.main.ObjectID; +import de.Ste3et_C0st.FurnitureLib.main.Type.SQLAction; public class campfire_1 extends Furniture implements Listener{ @@ -59,6 +60,7 @@ public class campfire_1 extends Furniture implements Listener{ @EventHandler public void onFurnitureBreak(FurnitureBreakEvent e){ if(obj==null){return;} + if(obj.getSQLAction().equals(SQLAction.REMOVE)){return;} if(e.isCancelled()){return;} if(!e.getID().equals(obj)){return;} if(!e.canBuild()){return;} @@ -76,6 +78,7 @@ public class campfire_1 extends Furniture implements Listener{ @EventHandler public void onFurnitureClick(FurnitureClickEvent e){ if(obj==null){return;} + if(obj.getSQLAction().equals(SQLAction.REMOVE)){return;} if(e.isCancelled()){return;} if(!e.getID().equals(obj)){return;} if(!e.canBuild()){return;} diff --git a/src/de/Ste3et_C0st/Furniture/Objects/outdoor/campfire_2.java b/src/de/Ste3et_C0st/Furniture/Objects/outdoor/campfire_2.java index 52fe39f..392d815 100644 --- a/src/de/Ste3et_C0st/Furniture/Objects/outdoor/campfire_2.java +++ b/src/de/Ste3et_C0st/Furniture/Objects/outdoor/campfire_2.java @@ -26,6 +26,7 @@ import de.Ste3et_C0st.FurnitureLib.main.FurnitureLib; import de.Ste3et_C0st.FurnitureLib.main.FurnitureManager; import de.Ste3et_C0st.FurnitureLib.main.ObjectID; import de.Ste3et_C0st.FurnitureLib.main.Type.BodyPart; +import de.Ste3et_C0st.FurnitureLib.main.Type.SQLAction; public class campfire_2 extends Furniture implements Listener{ List items = new ArrayList( @@ -179,6 +180,7 @@ public class campfire_2 extends Furniture implements Listener{ @EventHandler public void onFurnitureClick(FurnitureClickEvent e){ if(obj==null){return;} + if(obj.getSQLAction().equals(SQLAction.REMOVE)){return;} if(e.isCancelled()){return;} if(!e.getID().equals(obj)){return;} if(!e.canBuild()){return;} @@ -233,6 +235,7 @@ public class campfire_2 extends Furniture implements Listener{ @EventHandler public void onFurnitureBreak(FurnitureBreakEvent e){ if(obj==null){return;} + if(obj.getSQLAction().equals(SQLAction.REMOVE)){return;} if(e.isCancelled()){return;} if(!e.getID().equals(obj)){return;} if(!e.canBuild()){return;} diff --git a/src/de/Ste3et_C0st/Furniture/Objects/outdoor/hammock.java b/src/de/Ste3et_C0st/Furniture/Objects/outdoor/hammock.java new file mode 100644 index 0000000..224bf32 --- /dev/null +++ b/src/de/Ste3et_C0st/Furniture/Objects/outdoor/hammock.java @@ -0,0 +1,349 @@ +package de.Ste3et_C0st.Furniture.Objects.outdoor; + +import java.util.ArrayList; +import java.util.List; + +import org.bukkit.Bukkit; +import org.bukkit.GameMode; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.World; +import org.bukkit.block.Block; +import org.bukkit.block.BlockFace; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.block.Action; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.inventory.ItemStack; +import org.bukkit.plugin.Plugin; +import org.bukkit.util.EulerAngle; + +import de.Ste3et_C0st.Furniture.Main.main; +import de.Ste3et_C0st.FurnitureLib.Events.FurnitureBreakEvent; +import de.Ste3et_C0st.FurnitureLib.Events.FurnitureClickEvent; +import de.Ste3et_C0st.FurnitureLib.Utilitis.LocationUtil; +import de.Ste3et_C0st.FurnitureLib.main.ArmorStandPacket; +import de.Ste3et_C0st.FurnitureLib.main.Furniture; +import de.Ste3et_C0st.FurnitureLib.main.FurnitureLib; +import de.Ste3et_C0st.FurnitureLib.main.FurnitureManager; +import de.Ste3et_C0st.FurnitureLib.main.ObjectID; +import de.Ste3et_C0st.FurnitureLib.main.Type.BodyPart; +import de.Ste3et_C0st.FurnitureLib.main.Type.EventType; +import de.Ste3et_C0st.FurnitureLib.main.Type.SQLAction; + +public class hammock extends Furniture{ + + Location loc; + BlockFace b; + World w; + ObjectID obj; + FurnitureManager manager; + FurnitureLib lib; + LocationUtil lutil; + Integer id; + Block block; + Plugin plugin; + + List blockList = new ArrayList(); + + public ObjectID getObjectID(){return this.obj;} + public Location getLocation(){return this.loc;} + public BlockFace getBlockFace(){return this.b;} + + public hammock(FurnitureLib lib, Plugin plugin, ObjectID id) { + super(lib, plugin, id); + this.lutil = main.getLocationUtil(); + this.b = lutil.yawToFace(id.getStartLocation().getYaw()); + this.loc = id.getStartLocation().getBlock().getLocation(); + this.loc.setYaw(id.getStartLocation().getYaw()); + this.w = id.getStartLocation().getWorld(); + this.manager = lib.getFurnitureManager(); + this.lib = lib; + this.plugin = plugin; + this.obj = id; + setBlock(); + if(id.isFinish()){ + Bukkit.getPluginManager().registerEvents(this, plugin); + return; + } + spawn(loc); + + } + + private void setBlock(){ + BlockFace Right = lutil.yawToFace(lutil.FaceToYaw(b)+90); + Location center2 = lutil.getRelativ(loc, Right, 6D, 0D); + Block b1 = this.loc.getBlock(); + Block b2 = this.loc.getBlock().getRelative(BlockFace.UP); + Block b3 = center2.getBlock(); + Block b4 = center2.getBlock().getRelative(BlockFace.UP); + + if(!isFence(b1.getType())) b1.setType(Material.FENCE); + if(!isFence(b2.getType())) b2.setType(Material.FENCE); + if(!isFence(b3.getType())) b3.setType(Material.FENCE); + if(!isFence(b4.getType())) b4.setType(Material.FENCE); + + blockList.add(b1); + blockList.add(b2); + blockList.add(b3); + blockList.add(b4); + } + + private boolean isFence(Material m){ + if(m==null){return false;} + return m.toString().toLowerCase().endsWith("fence"); + } + + private boolean isMaterial(Material m){ + if(m==null){return false;} + boolean b = false; + if(m.toString().toLowerCase().startsWith("log")){ + b=true; + }else if(m.toString().toLowerCase().equalsIgnoreCase("banner")){ + b=true; + } + + return b; + } + + @EventHandler + public void onFurnitureBreak(FurnitureBreakEvent e) { + if(obj==null){return;} + if(obj.getSQLAction().equals(SQLAction.REMOVE)){return;} + if(e.isCancelled()){return;} + if(!e.getID().equals(obj)){return;} + if(!e.canBuild()){return;} + for(Block b : blockList){ + if(b!=null){ + b.setType(Material.AIR); + } + } + e.remove(); + blockList.clear(); + } + + @EventHandler + public void onFurnitureClick(FurnitureClickEvent e) { + if(obj==null){return;} + if(obj.getSQLAction().equals(SQLAction.REMOVE)){return;} + if(e.isCancelled()){return;} + if(!e.getID().equals(obj)){return;} + List aspList = manager.getArmorStandPacketByObjectID(obj); + Player p = e.getPlayer(); + ItemStack stack = p.getItemInHand(); + if(stack!=null){ + if(isMaterial(stack.getType())){ + if(setColor(p,stack, e.canBuild(), aspList)){return;} + } + } + + for(ArmorStandPacket packet : aspList){ + if(packet.getName().equalsIgnoreCase("#SITZ#")){ + if(packet.getPessanger()==null){ + packet.setPessanger(e.getPlayer()); + return; + } + } + } + } + + public void removeItem(Player p){ + Boolean useGameMode = FurnitureLib.getInstance().useGamemode(); + if(useGameMode&&p.getGameMode().equals(GameMode.CREATIVE)){return;} + Integer slot = p.getInventory().getHeldItemSlot(); + ItemStack itemStack = p.getItemInHand().clone(); + itemStack.setAmount(itemStack.getAmount()-1); + p.getInventory().setItem(slot, itemStack); + p.updateInventory(); + } + + @EventHandler + private void onClick(PlayerInteractEvent e){ + if(obj==null){return;} + if(obj.getSQLAction().equals(SQLAction.REMOVE)){return;} + if(e.isCancelled()){return;} + if(e.getClickedBlock()==null){return;} + if(e.getAction() == null){return;} + if(e.getPlayer()==null){return;} + if(!blockList.contains(e.getClickedBlock())){return;} + if(e.getAction().equals(Action.LEFT_CLICK_BLOCK)){ + e.setCancelled(true); + if(!lib.canBuild(e.getPlayer(), obj, EventType.BREAK)){return;} + for(Block b : blockList){ + if(b!=null){ + b.setType(Material.AIR); + } + } + obj.remove(e.getPlayer()); + blockList.clear(); + return; + }else if(e.getAction().equals(Action.RIGHT_CLICK_BLOCK)){ + e.setCancelled(true); + List aspList = manager.getArmorStandPacketByObjectID(obj); + Player p = e.getPlayer(); + ItemStack stack = p.getItemInHand(); + + if(stack!=null){ + if(isMaterial(stack.getType())){ + if(setColor(p,stack, lib.canBuild(e.getPlayer(), obj, EventType.INTERACT), aspList)){return;} + } + } + + for(ArmorStandPacket packet : aspList){ + if(packet.getName().equalsIgnoreCase("#SITZ#")){ + if(packet.getPessanger()==null){ + packet.setPessanger(e.getPlayer()); + return; + } + } + } + } + } + + private boolean setColor(Player p,ItemStack stack, Boolean canbuild, List aspList){ + if(!canbuild){return true;} + if(stack!=null){ + switch (stack.getType()) { + case BANNER: + for(ArmorStandPacket packet : aspList){ + if(packet.getInventory().getHelmet()!=null&&packet.getInventory().getHelmet().getType().equals(Material.BANNER)){ + packet.getInventory().setHelmet(stack); + } + } + removeItem(p); + manager.updateFurniture(obj); + return true; + case LOG: + for(ArmorStandPacket packet : aspList){ + if(packet.getName().equalsIgnoreCase("#PILLAR#")){ + packet.getInventory().setHelmet(stack); + } + } + setPillar(stack.getDurability()); + removeItem(p); + manager.updateFurniture(obj); + return true; + case LOG_2: + for(ArmorStandPacket packet : aspList){ + if(packet.getName().equalsIgnoreCase("#PILLAR#")){ + packet.getInventory().setHelmet(stack); + } + } + setPillar(4 + stack.getDurability()); + removeItem(p); + manager.updateFurniture(obj); + return true; + default: break; + } + } + return false; + } + + private void setPillar(int i){ + Material m = null; + switch (i) { + case 0: m = Material.FENCE;break; + case 1: m = Material.SPRUCE_FENCE;break; + case 2: m = Material.BIRCH_FENCE;break; + case 3: m = Material.JUNGLE_FENCE;break; + case 4: m = Material.ACACIA_FENCE;break; + case 5: m = Material.DARK_OAK_FENCE;break; + } + if(m!=null){ + for(Block b : blockList){ + b.setType(m); + } + } + } + + + public void spawn(Location location) { + Location center1 = lutil.getCenter(location); + center1 = center1.add(0, -1.9, 0); + + BlockFace Right = lutil.yawToFace(lutil.FaceToYaw(b)+90); + Location center2 = lutil.getRelativ(center1, Right, 6D, 0D); + List aspList = new ArrayList(); + + ArmorStandPacket packet = manager.createArmorStand(obj, center1); + packet.getInventory().setHelmet(new ItemStack(Material.LOG)); + packet.setName("#PILLAR#"); + aspList.add(packet); + + packet = manager.createArmorStand(obj, center2); + packet.getInventory().setHelmet(new ItemStack(Material.LOG)); + packet.setName("#PILLAR#"); + aspList.add(packet); + + Location middle = lutil.getRelativ(center1, Right, 2.85D, 0D); + middle = middle.add(0, .75, 0); + packet = manager.createArmorStand(obj, middle); + packet.getInventory().setHelmet(new ItemStack(Material.BANNER, 1, (short) 0)); + packet.setPose(lutil.degresstoRad(new EulerAngle(-69f,0f,0f)), BodyPart.HEAD); + aspList.add(packet); + + Location middle2 = lutil.getRelativ(middle, Right, 1.5D, 0D); + middle2 = middle2.add(0, .23, 0); + packet = manager.createArmorStand(obj, middle2); + packet.getInventory().setHelmet(new ItemStack(Material.BANNER, 1, (short) 0)); + packet.setPose(lutil.degresstoRad(new EulerAngle(-90f,0f,0f)), BodyPart.HEAD); + aspList.add(packet); + + Location sitz = lutil.getRelativ(center1, Right, 3D, 0D).add(0, .6, 0); + sitz.setYaw(lutil.FaceToYaw(b.getOppositeFace())); + packet = manager.createArmorStand(obj, sitz); + packet.setName("#SITZ#"); + aspList.add(packet); + + middle = lutil.getRelativ(middle, Right, .3D, 0D); + middle.setYaw(middle.getYaw()+180); + packet = manager.createArmorStand(obj, middle); + packet.getInventory().setHelmet(new ItemStack(Material.BANNER, 1, (short) 0)); + packet.setPose(lutil.degresstoRad(new EulerAngle(-69f,0f,0f)), BodyPart.HEAD); + aspList.add(packet); + + Location stick = lutil.getRelativ(center1, Right, 4.6d, .5d); + stick = stick.add(0, 1.7, 0); + stick.setYaw(lutil.FaceToYaw(b)); + packet = manager.createArmorStand(obj, stick); + packet.getInventory().setItemInHand(new ItemStack(Material.STICK)); + packet.setPose(lutil.degresstoRad(new EulerAngle(-40f,110f,0f)), BodyPart.RIGHT_ARM); + aspList.add(packet); + + stick = lutil.getRelativ(center1, Right, 4.6d, -.335d); + stick = stick.add(0, 1.7, 0); + stick.setYaw(lutil.FaceToYaw(b)); + packet = manager.createArmorStand(obj, stick); + packet.getInventory().setItemInHand(new ItemStack(Material.STICK)); + packet.setPose(lutil.degresstoRad(new EulerAngle(-40f,73f,0f)), BodyPart.RIGHT_ARM); + packet.setArms(true); + aspList.add(packet); + + stick = lutil.getRelativ(center1, Right.getOppositeFace(), -1.37d, -.335d); + stick = stick.add(0, 1.7, 0); + stick.setYaw(lutil.FaceToYaw(b.getOppositeFace())); + packet = manager.createArmorStand(obj, stick); + packet.getInventory().setItemInHand(new ItemStack(Material.STICK)); + packet.setPose(lutil.degresstoRad(new EulerAngle(-40f,73f,0f)), BodyPart.RIGHT_ARM); + packet.setArms(true); + aspList.add(packet); + + stick = lutil.getRelativ(center1, Right.getOppositeFace(), -1.37d, .5d); + stick = stick.add(0, 1.7, 0); + stick.setYaw(lutil.FaceToYaw(b.getOppositeFace())); + packet = manager.createArmorStand(obj, stick); + packet.getInventory().setItemInHand(new ItemStack(Material.STICK)); + packet.setPose(lutil.degresstoRad(new EulerAngle(-40f,110f,0f)), BodyPart.RIGHT_ARM); + packet.setArms(true); + aspList.add(packet); + + for(ArmorStandPacket pack : aspList){ + pack.setInvisible(true); + pack.setGravity(false); + pack.setBasePlate(false); + } + + manager.send(obj); + Bukkit.getPluginManager().registerEvents(this, plugin); + } +} diff --git a/src/de/Ste3et_C0st/Furniture/Objects/outdoor/tent_1.java b/src/de/Ste3et_C0st/Furniture/Objects/outdoor/tent_1.java index 6a89fab..9516751 100644 --- a/src/de/Ste3et_C0st/Furniture/Objects/outdoor/tent_1.java +++ b/src/de/Ste3et_C0st/Furniture/Objects/outdoor/tent_1.java @@ -29,6 +29,7 @@ import de.Ste3et_C0st.FurnitureLib.main.ObjectID; import de.Ste3et_C0st.FurnitureLib.main.Type.BodyPart; import de.Ste3et_C0st.FurnitureLib.main.Type.ColorType; import de.Ste3et_C0st.FurnitureLib.main.Type.EventType; +import de.Ste3et_C0st.FurnitureLib.main.Type.SQLAction; public class tent_1 extends Furniture implements Listener{ @@ -262,6 +263,7 @@ public class tent_1 extends Furniture implements Listener{ @EventHandler public void onFurnitureBreak(FurnitureBreakEvent e){ if(obj==null){return;} + if(obj.getSQLAction().equals(SQLAction.REMOVE)){return;} if(e.isCancelled()){return;} if(!e.getID().equals(obj)){return;} if(!e.canBuild()){return;} @@ -274,6 +276,7 @@ public class tent_1 extends Furniture implements Listener{ @EventHandler public void onFurnitureClick(FurnitureClickEvent e){ if(obj==null){return;} + if(obj.getSQLAction().equals(SQLAction.REMOVE)){return;} if(e.isCancelled()){return;} if(!e.getID().equals(obj)){return;} if(!e.canBuild()){return;} @@ -289,8 +292,12 @@ public class tent_1 extends Furniture implements Listener{ @EventHandler private void onBlockBreak(BlockBreakEvent e){ if(obj==null){return;} + if(obj.getSQLAction().equals(SQLAction.REMOVE)){return;} if(e.isCancelled()){return;} - if(!lib.canBuild(e.getPlayer(), obj, EventType.BREAK)){return;} + if(e.getBlock()==null){return;} + if(block==null){return;} + if(!e.getBlock().equals(block)){return;} + if(!lib.canBuild(e.getPlayer(), obj, EventType.BREAK)){e.getPlayer().sendMessage("ERROR1");return;} if(this.block!=null&&e.getBlock().equals(block)){this.block.setType(Material.AIR);this.block=null;} this.obj.remove(e.getPlayer()); obj=null; diff --git a/src/de/Ste3et_C0st/Furniture/Objects/outdoor/tent_2.java b/src/de/Ste3et_C0st/Furniture/Objects/outdoor/tent_2.java index b2d80b7..9ed651b 100644 --- a/src/de/Ste3et_C0st/Furniture/Objects/outdoor/tent_2.java +++ b/src/de/Ste3et_C0st/Furniture/Objects/outdoor/tent_2.java @@ -29,6 +29,7 @@ import de.Ste3et_C0st.FurnitureLib.main.FurnitureManager; import de.Ste3et_C0st.FurnitureLib.main.ObjectID; import de.Ste3et_C0st.FurnitureLib.main.Type.BodyPart; import de.Ste3et_C0st.FurnitureLib.main.Type.ColorType; +import de.Ste3et_C0st.FurnitureLib.main.Type.SQLAction; public class tent_2 extends Furniture implements Listener{ @@ -200,6 +201,7 @@ public class tent_2 extends Furniture implements Listener{ @EventHandler public void onFurnitureBreak(FurnitureBreakEvent e){ if(obj==null){return;} + if(obj.getSQLAction().equals(SQLAction.REMOVE)){return;} if(e.isCancelled()){return;} if(!e.getID().equals(obj)){return;} if(!e.canBuild()){return;} @@ -214,6 +216,7 @@ public class tent_2 extends Furniture implements Listener{ @EventHandler public void onFurnitureClick(final FurnitureClickEvent e){ if(obj==null){return;} + if(obj.getSQLAction().equals(SQLAction.REMOVE)){return;} if(e.isCancelled()){return;} if(!e.getID().equals(obj)){return;} e.setCancelled(true); diff --git a/src/de/Ste3et_C0st/Furniture/Objects/outdoor/tent_3.java b/src/de/Ste3et_C0st/Furniture/Objects/outdoor/tent_3.java index 6b71b9f..949c50d 100644 --- a/src/de/Ste3et_C0st/Furniture/Objects/outdoor/tent_3.java +++ b/src/de/Ste3et_C0st/Furniture/Objects/outdoor/tent_3.java @@ -31,6 +31,7 @@ import de.Ste3et_C0st.FurnitureLib.main.FurnitureManager; import de.Ste3et_C0st.FurnitureLib.main.ObjectID; import de.Ste3et_C0st.FurnitureLib.main.Type.BodyPart; import de.Ste3et_C0st.FurnitureLib.main.Type.ColorType; +import de.Ste3et_C0st.FurnitureLib.main.Type.SQLAction; public class tent_3 extends Furniture implements Listener{ @@ -175,6 +176,7 @@ public class tent_3 extends Furniture implements Listener{ @EventHandler public void onFurnitureBreak(FurnitureBreakEvent e){ if(obj==null){return;} + if(obj.getSQLAction().equals(SQLAction.REMOVE)){return;} if(e.isCancelled()){return;} if(!e.getID().equals(obj)){return;} if(!e.canBuild()){return;} @@ -187,6 +189,7 @@ public class tent_3 extends Furniture implements Listener{ @EventHandler public void onFurnitureClick(FurnitureClickEvent e){ if(obj==null){return;} + if(obj.getSQLAction().equals(SQLAction.REMOVE)){return;} if(e.isCancelled()){return;} if(!e.getID().equals(obj)){return;} e.setCancelled(true); diff --git a/src/plugin.yml b/src/plugin.yml index b96e09a..1835059 100644 --- a/src/plugin.yml +++ b/src/plugin.yml @@ -1,5 +1,5 @@ name: DiceFurniture -version: 2.3.1 +version: 2.3.5 description: Add some new Objects to the Server author: Ste3et_C0st website: http://dicecraft.de