DiceFurniture

This commit is contained in:
BuildTools 2015-08-17 22:27:16 +02:00
parent 4d4e00de2c
commit 6c49c04950
21 changed files with 261 additions and 272 deletions

View File

@ -5,7 +5,6 @@ import java.util.List;
import java.util.UUID;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.configuration.file.FileConfiguration;
@ -87,26 +86,26 @@ public class main extends JavaPlugin implements Listener{
if(!objList.contains(obj)) objList.add(obj);
if(obj.getPlugin().equalsIgnoreCase(this.getName())){
switch (obj.getProject()) {
case "Camera":new camera(obj.getStartLocation(), lib, this, obj);break;
case "TV":new tv(obj.getStartLocation(), lib, this, obj);break;
case "GraveStone":new graveStone(obj.getStartLocation(), lib, this, obj);break;
case "Chair":new chair(obj.getStartLocation(), lib, this, obj);break;
case "LargeTable":new largeTable(obj.getStartLocation(), lib, this, obj);break;
case "Lantern":new lantern(obj.getStartLocation(), lib, this, obj);break;
case "Sofa":new sofa(obj.getStartLocation(), lib, this, obj);break;
case "Table":new table(obj.getStartLocation(), lib, this, obj);break;
case "Barrels":new barrels(obj.getStartLocation(), lib, this, obj);break;
case "Campfire1":new campfire_1(obj.getStartLocation(), lib, this, obj);break;
case "Campfire2":new campfire_2(obj.getStartLocation(), lib, this, obj);break;
case "Tent1":new tent_1(obj.getStartLocation(), lib, this, obj);break;
case "Tent2":new tent_2(obj.getStartLocation(), lib, this, obj);break;
case "Tent3":new tent_3(obj.getStartLocation(), lib, this, obj);break;
case "Fence":new fance(obj.getStartLocation(), lib, this, obj);break;
case "Sunshade":new sunshade(obj.getStartLocation(), lib, this, obj);break;
case "Streetlamp":new streetlamp(obj.getStartLocation(), lib, this, obj);break;
case "Billboard": new billboard(obj.getStartLocation(), lib, this, obj); break;
case "Camera":new camera(lib, this, obj);break;
case "TV":new tv(lib, this, obj);break;
case "GraveStone":new graveStone(lib, this, obj);break;
case "Chair":new chair(lib, this, obj);break;
case "LargeTable":new largeTable(lib, this, obj);break;
case "Lantern":new lantern(lib, this, obj);break;
case "Sofa":new sofa(lib, this, obj);break;
case "Table":new table(lib, this, obj);break;
case "Barrels":new barrels(lib, this, obj);break;
case "Campfire1":new campfire_1(lib, this, obj);break;
case "Campfire2":new campfire_2(lib, this, obj);break;
case "Tent1":new tent_1(lib, this, obj);break;
case "Tent2":new tent_2(lib, this, obj);break;
case "Tent3":new tent_3(lib, this, obj);break;
case "Fence":new fance(lib, this, obj);break;
case "Sunshade":new sunshade(lib, this, obj);break;
case "Streetlamp":new streetlamp(lib, this, obj);break;
case "Billboard": new billboard(lib, this, obj); break;
case "Mailbox" :
mailBox mail = new mailBox(obj.getStartLocation(), lib, this, obj);
mailBox mail = new mailBox(lib, this, obj);
/*try {
mail.addMailbox(loadPlayerMailBox(obj));
} catch (Exception e) {
@ -164,39 +163,33 @@ public class main extends JavaPlugin implements Listener{
@EventHandler
private void onClick(FurnitureItemEvent e){
if(e.isCancelled()){return;}
if(!e.canBuild()){return;}
if(!e.getProject().hasPermissions(e.getPlayer())){return;}
if(!e.getProject().getPlugin().getName().equalsIgnoreCase(this.getName())){return;}
Location loc = e.getLocation().getBlock().getLocation();
loc.setYaw(e.getPlayer().getLocation().getYaw());
loc.add(0, 1, 0);
Project pro = e.getProject();
lib.getLimitationManager().add(loc, pro);
ObjectID obj = new ObjectID(pro.getName(), pro.getPlugin().getName(), loc);
ObjectID obj = e.getObjID();
if(!e.canBuild()){return;}
switch(e.getProject().getName()){
case "Camera" : new camera(loc, lib, instance, obj);break;
case "TV" : new tv(loc, lib, instance, obj);break;
case "GraveStone" : new graveStone(loc, lib, instance, obj);break;
case "Chair" : new chair(loc, lib, instance, obj); break;
case "LargeTable" : new largeTable(loc, lib, instance, obj);break;
case "Lantern" : new lantern(loc, lib, instance, obj);break;
case "Sofa" : new sofa(loc, lib, instance, obj);break;
case "Table" : new table(loc, lib, instance, obj);break;
case "Barrels" : new barrels(loc, lib, instance, obj);break;
case "Campfire1" : new campfire_1(loc, lib, instance, obj);break;
case "Campfire2" : new campfire_2(loc, lib, instance, obj);break;
case "Tent1" : new tent_1(loc, lib, instance, obj);break;
case "Tent2" : new tent_2(loc, lib, instance, obj);break;
case "Tent3" : new tent_3(loc, lib, instance, obj);break;
case "Fence" : new fance(loc, lib, instance, obj);break;
case "Sunshade": new sunshade(loc, lib, instance, obj);break;
case "Streetlamp": new streetlamp(loc, lib, this, obj);break;
case "Billboard": new billboard(loc, lib, instance, obj);break;
case "Mailbox" : new mailBox(loc, lib, instance, obj); break;
case "Camera" : new camera(lib, instance, obj);break;
case "TV" : new tv(lib, instance, obj);break;
case "GraveStone" : new graveStone(lib, instance, obj);break;
case "Chair" : new chair(lib, instance, obj); break;
case "LargeTable" : new largeTable(lib, instance, obj);break;
case "Lantern" : new lantern(lib, instance, obj);break;
case "Sofa" : new sofa(lib, instance, obj);break;
case "Table" : new table(lib, instance, obj);break;
case "Barrels" : new barrels(lib, instance, obj);break;
case "Campfire1" : new campfire_1(lib, instance, obj);break;
case "Campfire2" : new campfire_2(lib, instance, obj);break;
case "Tent1" : new tent_1(lib, instance, obj);break;
case "Tent2" : new tent_2(lib, instance, obj);break;
case "Tent3" : new tent_3(lib, instance, obj);break;
case "Fence" : new fance(lib, instance, obj);break;
case "Sunshade": new sunshade(lib, instance, obj);break;
case "Streetlamp": new streetlamp(lib, this, obj);break;
case "Billboard": new billboard(lib, instance, obj);break;
case "Mailbox" : new mailBox(lib, instance, obj); break;
default: e.getPlayer().sendMessage("A error occorupted");return;
}
obj.setFinish();
e.finish();
e.removeItem();
}

View File

@ -40,13 +40,13 @@ public class billboard extends Furniture implements Listener{
public Location getLocation(){return this.loc;}
public BlockFace getBlockFace(){return this.b;}
public billboard(Location location, FurnitureLib lib, Plugin plugin, ObjectID id){
super(location, lib, plugin, id);
public billboard(FurnitureLib lib, Plugin plugin, ObjectID id){
super(lib, plugin, id);
this.lutil = main.getLocationUtil();
this.b = lutil.yawToFace(location.getYaw());
this.loc = location.getBlock().getLocation();
this.loc.setYaw(location.getYaw());
this.w = location.getWorld();
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;
@ -55,7 +55,7 @@ public class billboard extends Furniture implements Listener{
Bukkit.getPluginManager().registerEvents(this, plugin);
return;
}
spawn(location);
spawn(id.getStartLocation());
}
public void spawn(Location location){
@ -121,8 +121,8 @@ public class billboard extends Furniture implements Listener{
@EventHandler
public void onFurnitureBreak(FurnitureBreakEvent e) {
if(e.isCancelled()){return;}
if(!e.canBuild()){return;}
if(!e.getID().equals(obj)){return;}
if(!e.canBuild()){return;}
if(obj==null){return;}
e.remove();
obj=null;

View File

@ -43,13 +43,13 @@ public class camera extends Furniture implements Listener{
public Location getLocation(){return this.loc;}
public BlockFace getBlockFace(){return this.b;}
public camera(Location location, FurnitureLib lib, Plugin plugin, ObjectID id){
super(location, lib, plugin, id);
public camera(FurnitureLib lib, Plugin plugin, ObjectID id){
super(lib, plugin, id);
this.lutil = main.getLocationUtil();
this.b = lutil.yawToFace(location.getYaw());
this.loc = location.getBlock().getLocation();
this.loc.setYaw(location.getYaw());
this.w = location.getWorld();
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;
@ -58,7 +58,7 @@ public class camera extends Furniture implements Listener{
Bukkit.getPluginManager().registerEvents(this, plugin);
return;
}
spawn(location);
spawn(id.getStartLocation());
}
public void spawn(Location location){
@ -132,13 +132,14 @@ public class camera extends Furniture implements Listener{
@EventHandler
public void onFurnitureBreak(FurnitureBreakEvent e) {
if(e.isCancelled()){return;}
if(!e.canBuild()){return;}
if(!e.getID().equals(obj)){return;}
if(!e.canBuild()){return;}
if(obj==null){return;}
e.remove();
obj=null;
}
@SuppressWarnings("deprecation")
@EventHandler
public void onFurnitureClick(FurnitureClickEvent e) {
@ -147,21 +148,24 @@ public class camera extends Furniture implements Listener{
if(obj==null){return;}
Player p = e.getPlayer();
Location pLocation = lutil.getRelativ(p.getLocation().getBlock().getLocation(), b, -1D, 0D).clone();
Location locCopy = getLocation().clone();
if(pLocation.equals(locCopy) && lutil.yawToFace(p.getLocation().getYaw()).getOppositeFace().equals(b)){
if(!p.getInventory().getItemInHand().getType().equals(Material.MAP)){return;}
MapView view = Bukkit.getMap(p.getItemInHand().getDurability());
Location l = getLocation();
l.setYaw(lutil.FaceToYaw(b.getOppositeFace()));
Iterator<MapRenderer> iter = view.getRenderers().iterator();
while(iter.hasNext()){
view.removeRenderer(iter.next());
}
try{
RenderClass renderer = new RenderClass(l);
view.addRenderer(renderer);
}catch (Exception ex){}
Location locCopy = getLocation().getBlock().getLocation().clone();
pLocation.setYaw(locCopy.getYaw());
if(pLocation.equals(locCopy)){
if(lutil.yawToFace(p.getLocation().getYaw()).getOppositeFace().equals(b)){
if(!p.getInventory().getItemInHand().getType().equals(Material.MAP)){return;}
MapView view = Bukkit.getMap(p.getItemInHand().getDurability());
Location l = getLocation();
l.setYaw(lutil.FaceToYaw(b.getOppositeFace()));
Iterator<MapRenderer> iter = view.getRenderers().iterator();
while(iter.hasNext()){
view.removeRenderer(iter.next());
}
try{
RenderClass renderer = new RenderClass(l);
view.addRenderer(renderer);
}catch (Exception ex){}
}
}
}

View File

@ -48,14 +48,14 @@ public class streetlamp extends Furniture implements Listener{
public Location getLocation(){return this.loc;}
public BlockFace getBlockFace(){return this.b;}
public streetlamp(Location location, FurnitureLib lib, Plugin plugin, ObjectID id){
super(location, lib, plugin, id);
public streetlamp(FurnitureLib lib, Plugin plugin, ObjectID id){
super(lib, plugin, id);
this.lutil = main.getLocationUtil();
this.b = lutil.yawToFace(location.getYaw());
this.loc = location.getBlock().getLocation();
this.loc.setYaw(location.getYaw());
this.loc2 = location.toVector();
this.w = location.getWorld();
this.b = lutil.yawToFace(id.getStartLocation().getYaw());
this.loc = id.getStartLocation().getBlock().getLocation();
this.loc.setYaw(id.getStartLocation().getYaw());
this.loc2 = id.getStartLocation().toVector();
this.w = id.getStartLocation().getWorld();
this.manager = lib.getFurnitureManager();
this.lib = lib;
this.plugin = plugin;
@ -66,7 +66,7 @@ public class streetlamp extends Furniture implements Listener{
Bukkit.getPluginManager().registerEvents(this, plugin);
return;
}
spawn(location);
spawn(id.getStartLocation());
}
public void spawn(Location location){
@ -152,28 +152,23 @@ public class streetlamp extends Furniture implements Listener{
if(e.isCancelled()){return;}
if(redstone) return;
if(e.getAction()==null) return;
if(e.getClickedBlock()==null) return;
if(!blockLocation.contains(e.getClickedBlock().getLocation())){return;}
if(!lib.canBuild(e.getPlayer(), obj, EventType.INTERACT)){return;}
e.setCancelled(true);
if(e.getAction().equals(Action.LEFT_CLICK_BLOCK)){
if(e.getClickedBlock()==null) return;
if(blockLocation.contains(e.getClickedBlock().getLocation())){
e.setCancelled(true);
if(!lib.canBuild(e.getPlayer(), e.getClickedBlock().getLocation(), EventType.BREAK)){return;}
FurnitureLib.getInstance().getLightManager().removeLight(light);
obj.remove(e.getPlayer());
for(Location loc : blockLocation){
loc.getBlock().setType(Material.AIR);
}
obj=null;
}
}else if(e.getAction().equals(Action.RIGHT_CLICK_BLOCK)){
if(e.getClickedBlock()==null) return;
if(blockLocation.contains(e.getClickedBlock().getLocation())){
if(!lib.canBuild(e.getPlayer(), e.getClickedBlock().getLocation(), EventType.INTERACT)){return;}
if(isOn()){
setLight(false);
}else{
setLight(true);
}
}
}
}
@ -234,9 +229,8 @@ public class streetlamp extends Furniture implements Listener{
@EventHandler
public void onFurnitureBreak(FurnitureBreakEvent e) {
if(e.isCancelled()){return;}
if(!e.canBuild()){return;}
if(!e.getID().equals(obj)){return;}
if(obj==null){return;}
if(!e.canBuild()){return;}
FurnitureLib.getInstance().getLightManager().removeLight(light);
e.remove();
obj=null;

View File

@ -39,13 +39,13 @@ public class tv extends Furniture implements Listener{
public Location getLocation(){return this.loc;}
public BlockFace getBlockFace(){return this.b;}
public tv(Location location, FurnitureLib lib, Plugin plugin, ObjectID id){
super(location, lib, plugin, id);
public tv(FurnitureLib lib, Plugin plugin, ObjectID id){
super(lib, plugin, id);
this.lutil = main.getLocationUtil();
this.b = lutil.yawToFace(location.getYaw());
this.loc = location.getBlock().getLocation();
this.loc.setYaw(location.getYaw());
this.w = location.getWorld();
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;
@ -54,7 +54,7 @@ public class tv extends Furniture implements Listener{
Bukkit.getPluginManager().registerEvents(this, plugin);
return;
}
spawn(location);
spawn(id.getStartLocation());
}
public void spawn(Location location){
@ -114,8 +114,8 @@ public class tv extends Furniture implements Listener{
@EventHandler
public void onFurnitureBreak(FurnitureBreakEvent e){
if(e.isCancelled()){return;}
if(!e.canBuild()){return;}
if(!e.getID().equals(obj)){return;}
if(!e.canBuild()){return;}
if(obj==null){return;}
e.remove();
obj=null;

View File

@ -56,13 +56,13 @@ public class fance extends Furniture implements Listener{
Block block;
Material m;
public fance(Location location, FurnitureLib lib, Plugin plugin, ObjectID id){
super(location, lib, plugin, id);
public fance(FurnitureLib lib, Plugin plugin, ObjectID id){
super(lib, plugin, id);
this.lutil = main.getLocationUtil();
this.b = lutil.yawToFace(location.getYaw());
this.loc = location.getBlock().getLocation();
this.loc.setYaw(location.getYaw());
this.w = location.getWorld();
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;
@ -72,7 +72,7 @@ public class fance extends Furniture implements Listener{
Bukkit.getPluginManager().registerEvents(this, plugin);
return;
}
spawn(location);
spawn(id.getStartLocation());
setBlock();
}
@ -102,7 +102,7 @@ public class fance extends Furniture implements Listener{
if(obj==null){return;}
if(block==null){return;}
if(!e.getBlock().getLocation().equals(block.getLocation())){return;}
if(!lib.canBuild(e.getPlayer(), e.getBlock().getLocation(), EventType.BREAK)){return;}
if(!lib.canBuild(e.getPlayer(), obj, EventType.BREAK)){return;}
this.block.setType(Material.AIR);
this.obj.remove(e.getPlayer());
block=null;
@ -114,8 +114,8 @@ public class fance extends Furniture implements Listener{
public void onFurnitureBreak(FurnitureBreakEvent e){
if(obj==null){return;}
if(e.isCancelled()){return;}
if(!e.canBuild()){return;}
if(!e.getID().equals(obj)){return;}
if(!e.canBuild()){return;}
e.setCancelled(true);
if(this.block!=null) this.block.setType(Material.AIR);
e.remove();
@ -133,6 +133,7 @@ public class fance extends Furniture implements Listener{
if(e.getAction()==null)return;
if(!e.getAction().equals(Action.RIGHT_CLICK_BLOCK)) return;
if(!e.getClickedBlock().getLocation().equals(this.block.getLocation())) return;
if(!lib.canBuild(e.getPlayer(), obj, EventType.INTERACT)){return;}
e.setCancelled(true);
Player p = e.getPlayer();
ItemStack is = p.getItemInHand();
@ -167,8 +168,8 @@ public class fance extends Furniture implements Listener{
if(obj==null){return;}
if(e.isCancelled()){return;}
if(this.block==null) return;
if(!e.canBuild()){return;}
if(!e.getID().equals(obj)){return;}
if(!e.canBuild()){return;}
e.setCancelled(true);
Player p = e.getPlayer();
ItemStack is = p.getItemInHand();

View File

@ -48,13 +48,13 @@ public class graveStone extends Furniture implements Listener{
public Location getLocation(){return this.loc;}
public BlockFace getBlockFace(){return this.b;}
public graveStone(Location location, FurnitureLib lib, Plugin plugin, ObjectID id){
super(location, lib, plugin, id);
public graveStone(FurnitureLib lib, Plugin plugin, ObjectID id){
super(lib, plugin, id);
this.lutil = main.getLocationUtil();
this.b = lutil.yawToFace(location.getYaw());
this.loc = location.getBlock().getLocation();
this.loc.setYaw(location.getYaw());
this.w = location.getWorld();
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;
@ -64,7 +64,7 @@ public class graveStone extends Furniture implements Listener{
Bukkit.getPluginManager().registerEvents(this, plugin);
return;
}
spawn(location);
spawn(id.getStartLocation());
setBlock();
}
@ -153,8 +153,8 @@ public class graveStone extends Furniture implements Listener{
@EventHandler
public void onFurnitureBreak(FurnitureBreakEvent e){
if(e.isCancelled()) return;
if(!e.canBuild()) return;
if(!e.getID().equals(obj)) return;
if(!e.canBuild()){return;}
if(obj==null){return;}
e.remove();
sign.setType(Material.AIR);
@ -200,8 +200,8 @@ public class graveStone extends Furniture implements Listener{
public void onFurnitureClick(FurnitureClickEvent e){
Player p = e.getPlayer();
if(e.isCancelled()) return;
if(!e.canBuild()) return;
if(!e.getID().equals(obj)) return;
if(!e.canBuild()){return;}
ItemStack is = p.getItemInHand();
if (is == null) return;
if (!is.getType().equals(Material.WRITTEN_BOOK)) return;

View File

@ -28,6 +28,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.EventType;
public class mailBox extends Furniture implements Listener {
@ -47,13 +48,13 @@ public class mailBox extends Furniture implements Listener {
UUID uuid;
public mailBox(Location location, FurnitureLib lib, Plugin plugin, ObjectID id){
super(location, lib, plugin, id);
public mailBox(FurnitureLib lib, Plugin plugin, ObjectID id){
super(lib, plugin, id);
this.lutil = main.getLocationUtil();
this.b = lutil.yawToFace(location.getYaw());
this.loc = location.getBlock().getLocation();
this.loc.setYaw(location.getYaw());
this.w = location.getWorld();
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;
@ -62,7 +63,7 @@ public class mailBox extends Furniture implements Listener {
Bukkit.getPluginManager().registerEvents(this, plugin);
return;
}
spawn(location);
spawn(id.getStartLocation());
}
public void spawn(Location location){
@ -210,8 +211,8 @@ public class mailBox extends Furniture implements Listener {
@EventHandler
public void onFurnitureBreak(FurnitureBreakEvent e){
if(e.isCancelled()) return;
if(!e.canBuild()) return;
if(!e.getID().equals(obj)) return;
if(!e.canBuild()){return;}
if(obj==null){return;}
for(Block b : blockList){
b.setType(Material.AIR);
@ -228,6 +229,7 @@ public class mailBox extends Furniture implements Listener {
if(obj==null){return;}
if(e.isCancelled()){return;}
if(e.getAction()==null){return;}
if(!lib.canBuild(e.getPlayer(), obj, EventType.INTERACT)){return;}
if(e.getAction().equals(Action.LEFT_CLICK_BLOCK)){
if(blockList.contains(e.getClickedBlock())){
e.setCancelled(true);

View File

@ -63,13 +63,13 @@ public class sunshade extends Furniture implements Listener{
Integer timer;
Block block;
public sunshade(Location location, FurnitureLib lib, Plugin plugin, ObjectID id){
super(location, lib, plugin, id);
public sunshade(FurnitureLib lib, Plugin plugin, ObjectID id){
super(lib, plugin, id);
this.lutil = main.getLocationUtil();
this.b = lutil.yawToFace(location.getYaw());
this.loc = location.getBlock().getLocation();
this.loc.setYaw(location.getYaw());
this.w = location.getWorld();
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;
@ -80,7 +80,7 @@ public class sunshade extends Furniture implements Listener{
return;
}
setblock();
spawn(location);
spawn(id.getStartLocation());
}
private void setblock(){
@ -140,8 +140,8 @@ public class sunshade extends Furniture implements Listener{
public void onFurnitureClick(FurnitureClickEvent e){
if(obj==null){return;}
if(e.isCancelled()){return;}
if(!e.canBuild()){return;}
if(!e.getID().equals(obj)){return;}
if(!e.canBuild()){return;}
e.setCancelled(true);
Player p = e.getPlayer();
ItemStack is = p.getItemInHand();
@ -189,10 +189,10 @@ public class sunshade extends Furniture implements Listener{
if(obj==null){return;}
if(e.isCancelled()){return;}
if(e.getAction()==null){return;}
if(!e.getClickedBlock().getLocation().equals(block.getLocation())){return;}
if(e.getAction().equals(Action.LEFT_CLICK_BLOCK)){
if(e.getClickedBlock().getLocation().equals(block.getLocation())){
e.setCancelled(true);
if(!lib.canBuild(e.getPlayer(), e.getClickedBlock().getLocation(), EventType.BREAK)){return;}
if(!lib.canBuild(e.getPlayer(), obj, EventType.BREAK)){return;}
stopTimer();
for(ArmorStandPacket packet : manager.getArmorStandPacketByObjectID(obj)){
if(packet.getName().equalsIgnoreCase("#ITEM#")){
@ -206,10 +206,8 @@ public class sunshade extends Furniture implements Listener{
this.block = null;
this.obj.remove(e.getPlayer());
obj=null;
}
}else if(e.getAction().equals(Action.RIGHT_CLICK_BLOCK)){
if(e.getClickedBlock().getLocation().equals(block.getLocation())){
if(!lib.canBuild(e.getPlayer(), e.getClickedBlock().getLocation(), EventType.INTERACT)){return;}
if(!lib.canBuild(e.getPlayer(), obj, EventType.INTERACT)){return;}
Player p = e.getPlayer();
ItemStack is = p.getItemInHand();
if(is==null||!is.getType().equals(Material.BANNER)){
@ -242,7 +240,6 @@ public class sunshade extends Furniture implements Listener{
p.updateInventory();
}
}
}
}
}
@ -250,8 +247,8 @@ public class sunshade extends Furniture implements Listener{
public void onFurnitureBreak(FurnitureBreakEvent e){
if(obj==null){return;}
if(e.isCancelled()){return;}
if(!e.canBuild()){return;}
if(!e.getID().equals(obj)){return;}
if(!e.canBuild()){return;}
e.setCancelled(true);
stopTimer();
for(ArmorStandPacket packet : manager.getArmorStandPacketByObjectID(obj)){

View File

@ -40,13 +40,13 @@ public class chair extends Furniture implements Listener{
public Location getLocation(){return this.loc;}
public BlockFace getBlockFace(){return this.b;}
public chair(Location location, FurnitureLib lib, Plugin plugin, ObjectID id){
super(location, lib, plugin, id);
public chair(FurnitureLib lib, Plugin plugin, ObjectID id){
super(lib, plugin, id);
this.lutil = main.getLocationUtil();
this.b = lutil.yawToFace(location.getYaw());
this.loc = location.getBlock().getLocation();
this.loc.setYaw(location.getYaw());
this.w = location.getWorld();
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;
@ -55,7 +55,7 @@ public class chair extends Furniture implements Listener{
Bukkit.getPluginManager().registerEvents(this, plugin);
return;
}
spawn(location);
spawn(id.getStartLocation());
}
public void spawn(Location loc){
@ -120,8 +120,8 @@ public class chair extends Furniture implements Listener{
public void onFurnitureBreak(FurnitureBreakEvent e){
if(obj==null){return;}
if(e.isCancelled()){return;}
if(!e.canBuild()){return;}
if(!e.getID().equals(obj)){return;}
if(!e.canBuild()){return;}
e.remove();
obj=null;
}

View File

@ -42,13 +42,13 @@ public class lantern extends Furniture implements Listener{
public Location getLocation(){return this.loc;}
public BlockFace getBlockFace(){return this.b;}
public lantern(Location location, FurnitureLib lib, Plugin plugin, ObjectID id){
super(location, lib, plugin, id);
public lantern(FurnitureLib lib, Plugin plugin, ObjectID id){
super(lib, plugin, id);
this.lutil = main.getLocationUtil();
this.b = lutil.yawToFace(location.getYaw());
this.loc = location.getBlock().getLocation();
this.loc.setYaw(location.getYaw());
this.w = location.getWorld();
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;
@ -59,7 +59,7 @@ public class lantern extends Furniture implements Listener{
Bukkit.getPluginManager().registerEvents(this, plugin);
return;
}
spawn(location);
spawn(id.getStartLocation());
}
Block block;
@ -133,7 +133,7 @@ public class lantern extends Furniture implements Listener{
if(e.isCancelled()) return;
if(block==null) return;
if(!e.getID().equals(obj)) return;
if(!e.canBuild()) return;
if(!e.canBuild()){return;}
e.remove();
block.setType(Material.AIR);
}
@ -144,7 +144,7 @@ public class lantern extends Furniture implements Listener{
if(e.isCancelled()) return;
if(block==null) return;
if(!e.getID().equals(obj)) return;
if(!e.canBuild()) return;
if(!e.canBuild()){return;}
Player p = e.getPlayer();
ItemStack is = p.getItemInHand();
if(is.getType().equals(Material.FLINT_AND_STEEL)){

View File

@ -44,13 +44,13 @@ public class largeTable extends Furniture implements Listener{
public Location getLocation(){return this.loc;}
public BlockFace getBlockFace(){return this.b;}
public largeTable(Location location, FurnitureLib lib, Plugin plugin, ObjectID id){
super(location, lib, plugin, id);
public largeTable(FurnitureLib lib, Plugin plugin, ObjectID id){
super(lib, plugin, id);
this.lutil = main.getLocationUtil();
this.b = lutil.yawToFace(location.getYaw());
this.loc = location.getBlock().getLocation();
this.loc.setYaw(location.getYaw());
this.w = location.getWorld();
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;
@ -65,7 +65,7 @@ public class largeTable extends Furniture implements Listener{
Bukkit.getPluginManager().registerEvents(this, plugin);
return;
}
spawn(location);
spawn(id.getStartLocation());
}
List<Integer> tellerIDs = new ArrayList<Integer>();
@ -201,8 +201,8 @@ public class largeTable extends Furniture implements Listener{
public void onFurnitureBreak(FurnitureBreakEvent e){
if(obj==null){return;}
if(e.isCancelled()){return;}
if(!e.canBuild()){return;}
if(!e.getID().equals(obj)){return;}
if(!e.canBuild()){return;}
for(Integer id : tellerIDs){
ArmorStandPacket asp = manager.getArmorStandPacketByID(id);
if(asp!=null&&asp.getInventory().getItemInHand()!=null){
@ -221,6 +221,7 @@ public class largeTable extends Furniture implements Listener{
if(obj==null){return;}
if(e.isCancelled()){return;}
if(!e.getID().equals(obj)){return;}
if(!e.canBuild()){return;}
e.setCancelled(true);
final Player p = e.getPlayer();
if(p.getItemInHand().getType().equals(Material.INK_SACK)){

View File

@ -44,13 +44,13 @@ public class sofa extends Furniture implements Listener {
public Location getLocation(){return this.loc;}
public BlockFace getBlockFace(){return this.b;}
public sofa(Location location, FurnitureLib lib, Plugin plugin, ObjectID id){
super(location, lib, plugin, id);
public sofa(FurnitureLib lib, Plugin plugin, ObjectID id){
super(lib, plugin, id);
this.lutil = main.getLocationUtil();
this.b = lutil.yawToFace(location.getYaw());
this.loc = location.getBlock().getLocation();
this.loc.setYaw(location.getYaw());
this.w = location.getWorld();
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;
@ -60,7 +60,7 @@ public class sofa extends Furniture implements Listener {
return;
}
place = .3;
spawn(location);
spawn(id.getStartLocation());
}
ItemStack is;
@ -179,7 +179,7 @@ public class sofa extends Furniture implements Listener {
e.setCancelled(true);
final Player p = e.getPlayer();
if(p.getItemInHand().getType().equals(Material.INK_SACK)){
Boolean canBuild = lib.canBuild(p, e.getLocation(), EventType.INTERACT);
Boolean canBuild = lib.canBuild(e.getPlayer(), obj, EventType.INTERACT);
Material m = Material.CARPET;
color(p, canBuild, m);
}else{
@ -239,8 +239,8 @@ public class sofa extends Furniture implements Listener {
public void onFurnitureBreak(FurnitureBreakEvent e){
if(obj==null){return;}
if(e.isCancelled()){return;}
if(!e.canBuild()){return;}
if(!e.getID().equals(obj)){return;}
if(!lib.canBuild(e.getPlayer(), obj, EventType.BREAK)){return;}
e.setCancelled(true);
for(ArmorStandPacket packet : manager.getArmorStandPacketByObjectID(obj)){
if(packet.getPessanger()!=null){

View File

@ -43,13 +43,13 @@ public class table extends Furniture implements Listener {
public Location getLocation(){return this.loc;}
public BlockFace getBlockFace(){return this.b;}
public table(Location location, FurnitureLib lib, Plugin plugin, ObjectID id){
super(location, lib, plugin, id);
public table(FurnitureLib lib, Plugin plugin, ObjectID id){
super(lib, plugin, id);
this.lutil = main.getLocationUtil();
this.b = lutil.yawToFace(location.getYaw());
this.loc = location.getBlock().getLocation();
this.loc.setYaw(location.getYaw());
this.w = location.getWorld();
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;
@ -58,7 +58,7 @@ public class table extends Furniture implements Listener {
Bukkit.getPluginManager().registerEvents(this, plugin);
return;
}
spawn(location);
spawn(id.getStartLocation());
}
public void spawn(Location loc){
List<ArmorStandPacket> packetL = new ArrayList<ArmorStandPacket>();
@ -96,8 +96,8 @@ public class table extends Furniture implements Listener {
public void onFurnitureBreak(FurnitureBreakEvent e){
if(obj==null){return;}
if(e.isCancelled()){return;}
if(!e.canBuild()){return;}
if(!e.getID().equals(obj)){return;}
if(!e.canBuild()){return;}
e.setCancelled(true);
for(ArmorStandPacket packet : manager.getArmorStandPacketByObjectID(obj)){
if(packet.getName().equalsIgnoreCase("#ITEM#")){
@ -116,9 +116,9 @@ public class table extends Furniture implements Listener {
if(obj==null){return;}
if(e.isCancelled()){return;}
if(!e.getID().equals(obj)){return;}
Player p = e.getPlayer();
if(!e.canBuild()){return;}
e.setCancelled(true);
Player p = e.getPlayer();
if(p.getItemInHand().getType().isBlock()&&!p.getItemInHand().getType().equals(Material.AIR)){return;}
for(ArmorStandPacket packet : manager.getArmorStandPacketByObjectID(obj)){
if(packet.getName().equalsIgnoreCase("#ITEM#")){

View File

@ -44,13 +44,13 @@ public class barrels extends Furniture implements Listener {
public Location getLocation(){return this.loc;}
public BlockFace getBlockFace(){return this.b;}
public barrels(Location location, FurnitureLib lib, Plugin plugin, ObjectID id){
super(location, lib, plugin, id);
public barrels(FurnitureLib lib, Plugin plugin, ObjectID id){
super(lib, plugin, id);
this.lutil = main.getLocationUtil();
this.b = lutil.yawToFace(location.getYaw());
this.loc = location.getBlock().getLocation();
this.loc.setYaw(location.getYaw());
this.w = location.getWorld();
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;
@ -61,7 +61,7 @@ public class barrels extends Furniture implements Listener {
Bukkit.getPluginManager().registerEvents(this, plugin);
return;
}
spawn(location);
spawn(id.getStartLocation());
}
public void spawn(Location loc){
@ -109,7 +109,7 @@ public class barrels extends Furniture implements Listener {
if(e.getClickedBlock()==null){return;}
if(!e.getClickedBlock().getLocation().equals(block.getLocation())){return;}
if(!e.getAction().equals(Action.RIGHT_CLICK_BLOCK)){return;}
if(!lib.canBuild(e.getPlayer(), e.getClickedBlock().getLocation(), EventType.INTERACT)){return;}
if(!lib.canBuild(e.getPlayer(), obj, EventType.INTERACT)){return;}
Player p = e.getPlayer();
if(!p.getItemInHand().getType().isBlock()&&!p.getItemInHand().getType().equals(Material.AIR)){e.getPlayer().sendMessage("03");return;}
e.setCancelled(true);
@ -140,7 +140,7 @@ public class barrels extends Furniture implements Listener {
if(obj==null){return;}
if(block==null){return;}
if(!e.getBlock().getLocation().equals(block.getLocation())){return;}
if(!lib.canBuild(e.getPlayer(), e.getBlock().getLocation(), EventType.BREAK)){return;}
if(!lib.canBuild(e.getPlayer(), obj, EventType.BREAK)){return;}
ArmorStandPacket packet = manager.getArmorStandPacketByObjectID(obj).get(0);
if(packet.getInventory().getHelmet()!=null&&!packet.getInventory().getHelmet().getType().equals(Material.AIR)){
ItemStack is = packet.getInventory().getHelmet();
@ -157,8 +157,8 @@ public class barrels extends Furniture implements Listener {
public void onFurnitureBreak(FurnitureBreakEvent e){
if(obj==null){return;}
if(e.isCancelled()){return;}
if(!e.canBuild()){return;}
if(!e.getID().equals(obj)){return;}
if(!e.canBuild()){return;}
e.setCancelled(true);
e.remove();
obj=null;

View File

@ -38,13 +38,13 @@ public class campfire_1 extends Furniture implements Listener{
public Location getLocation(){return this.loc;}
public BlockFace getBlockFace(){return this.b;}
public campfire_1(Location location, FurnitureLib lib, Plugin plugin, ObjectID id){
super(location, lib, plugin, id);
public campfire_1(FurnitureLib lib, Plugin plugin, ObjectID id){
super(lib, plugin, id);
this.lutil = main.getLocationUtil();
this.b = lutil.yawToFace(location.getYaw());
this.loc = location.getBlock().getLocation();
this.loc.setYaw(location.getYaw());
this.w = location.getWorld();
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;
@ -53,15 +53,15 @@ public class campfire_1 extends Furniture implements Listener{
Bukkit.getPluginManager().registerEvents(this, plugin);
return;
}
spawn(location);
spawn(id.getStartLocation());
}
@EventHandler
public void onFurnitureBreak(FurnitureBreakEvent e){
if(obj==null){return;}
if(e.isCancelled()){return;}
if(!e.canBuild()){return;}
if(!e.getID().equals(obj)){return;}
if(!e.canBuild()){return;}
for(ArmorStandPacket packet : manager.getArmorStandPacketByObjectID(obj)){
packet.setFire(false);
Location location = this.loc.clone();
@ -77,8 +77,8 @@ public class campfire_1 extends Furniture implements Listener{
public void onFurnitureClick(FurnitureClickEvent e){
if(obj==null){return;}
if(e.isCancelled()){return;}
if(!e.canBuild()){return;}
if(!e.getID().equals(obj)){return;}
if(!e.canBuild()){return;}
e.setCancelled(true);
List<ArmorStandPacket> aspList = manager.getArmorStandPacketByObjectID(obj);
ItemStack is = e.getPlayer().getItemInHand();

View File

@ -79,13 +79,13 @@ public class campfire_2 extends Furniture implements Listener{
public Location getLocation(){return this.loc;}
public BlockFace getBlockFace(){return this.b;}
public campfire_2(Location location, FurnitureLib lib, Plugin plugin, ObjectID id){
super(location, lib, plugin, id);
public campfire_2(FurnitureLib lib, Plugin plugin, ObjectID id){
super(lib, plugin, id);
this.lutil = main.getLocationUtil();
this.b = lutil.yawToFace(location.getYaw());
this.loc = location.getBlock().getLocation();
this.loc.setYaw(location.getYaw());
this.w = location.getWorld();
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;
@ -100,7 +100,7 @@ public class campfire_2 extends Furniture implements Listener{
Bukkit.getPluginManager().registerEvents(this, plugin);
return;
}
spawn(location);
spawn(id.getStartLocation());
}
public void spawn(Location loc){
@ -180,8 +180,8 @@ public class campfire_2 extends Furniture implements Listener{
public void onFurnitureClick(FurnitureClickEvent e){
if(obj==null){return;}
if(e.isCancelled()){return;}
if(!e.canBuild()){return;}
if(!e.getID().equals(obj)){return;}
if(!e.canBuild()){return;}
e.setCancelled(true);
List<ArmorStandPacket> aspList = manager.getArmorStandPacketByObjectID(obj);
final ItemStack itemStack = e.getPlayer().getItemInHand();
@ -234,8 +234,8 @@ public class campfire_2 extends Furniture implements Listener{
public void onFurnitureBreak(FurnitureBreakEvent e){
if(obj==null){return;}
if(e.isCancelled()){return;}
if(!e.canBuild()){return;}
if(!e.getID().equals(obj)){return;}
if(!e.canBuild()){return;}
e.setCancelled(true);
if(isRunning()){
Bukkit.getScheduler().cancelTask(timer);

View File

@ -47,13 +47,13 @@ public class tent_1 extends Furniture implements Listener{
public Location getLocation(){return this.loc;}
public BlockFace getBlockFace(){return this.b;}
public tent_1(Location location, FurnitureLib lib, Plugin plugin, ObjectID id){
super(location, lib, plugin, id);
public tent_1(FurnitureLib lib, Plugin plugin, ObjectID id){
super(lib, plugin, id);
this.lutil = main.getLocationUtil();
this.b = lutil.yawToFace(location.getYaw());
this.loc = location.getBlock().getLocation();
this.loc.setYaw(location.getYaw());
this.w = location.getWorld();
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;
@ -263,8 +263,8 @@ public class tent_1 extends Furniture implements Listener{
public void onFurnitureBreak(FurnitureBreakEvent e){
if(obj==null){return;}
if(e.isCancelled()){return;}
if(!e.canBuild()){return;}
if(!e.getID().equals(obj)){return;}
if(!e.canBuild()){return;}
e.setCancelled(true);
block.setType(Material.AIR);
e.remove();
@ -276,12 +276,13 @@ public class tent_1 extends Furniture implements Listener{
if(obj==null){return;}
if(e.isCancelled()){return;}
if(!e.getID().equals(obj)){return;}
if(!e.canBuild()){return;}
e.setCancelled(true);
final Player p = e.getPlayer();
if(!p.getItemInHand().getType().equals(Material.INK_SACK)){
p.openWorkbench(this.block.getLocation(), true);
}else{
Boolean canBuild = lib.canBuild(p, e.getLocation(), EventType.INTERACT);
Boolean canBuild = true;
Material m = Material.CARPET;
color(p, canBuild, m);
}
@ -291,8 +292,7 @@ public class tent_1 extends Furniture implements Listener{
private void onBlockBreak(BlockBreakEvent e){
if(obj==null){return;}
if(e.isCancelled()){return;}
if(!lib.canBuild(e.getPlayer(), loc, EventType.BREAK)){return;}
if(obj==null){return;}
if(!lib.canBuild(e.getPlayer(), obj, EventType.BREAK)){return;}
if(this.block!=null&&e.getBlock().equals(block)){this.block.setType(Material.AIR);this.block=null;}
this.obj.remove(e.getPlayer());
obj=null;

View File

@ -51,37 +51,37 @@ public class tent_2 extends Furniture implements Listener{
public Location getLocation(){return this.loc;}
public BlockFace getBlockFace(){return this.b;}
public tent_2(Location location, FurnitureLib lib, Plugin plugin, ObjectID id){
super(location, lib, plugin, id);
public tent_2(FurnitureLib lib, Plugin plugin, ObjectID id){
super(lib, plugin, id);
this.lutil = main.getLocationUtil();
this.b = lutil.yawToFace(location.getYaw());
this.loc = location.getBlock().getLocation();
this.loc.setYaw(location.getYaw());
this.w = location.getWorld();
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;
if(b.equals(BlockFace.WEST)){location=lutil.getRelativ(location, b, 1D, 0D);}
if(b.equals(BlockFace.NORTH)){location=lutil.getRelativ(location, b, 1D, 1D);}
if(b.equals(BlockFace.EAST)){location=lutil.getRelativ(location, b, 0D, 1D);}
if(b.equals(BlockFace.WEST)){loc=lutil.getRelativ(loc, b, 1D, 0D);}
if(b.equals(BlockFace.NORTH)){loc=lutil.getRelativ(loc, b, 1D, 1D);}
if(b.equals(BlockFace.EAST)){loc=lutil.getRelativ(loc, b, 0D, 1D);}
this.obj = id;
Location loca = loc.clone();
switch (b) {
case NORTH: loca=lutil.getRelativ(loca, b, -1D, -1D); break;
case EAST: loca=lutil.getRelativ(loca, b, 0D, -1D); break;
case WEST: loca=lutil.getRelativ(loca, b, -1D, 0D); break;
default:break;
}
setBlock(loca);
if(id.isFinish()){
Bukkit.broadcastMessage(b.name());
Location loca = loc.clone();
switch (b) {
case NORTH: loca=lutil.getRelativ(loca, b, -1D, -1D); break;
case EAST: loca=lutil.getRelativ(loca, b, 0D, -1D); break;
case WEST: loca=lutil.getRelativ(loca, b, -1D, 0D); break;
default:break;
}
setBlock(loca);
Bukkit.getPluginManager().registerEvents(this, plugin);
return;
}
spawn(location);
spawn(loc);
}
@ -145,7 +145,6 @@ public class tent_2 extends Furniture implements Listener{
packet.setInvisible(true);
packet.setGravity(false);
}
setBlock(this.loc);
manager.send(obj);
Bukkit.getPluginManager().registerEvents(this, plugin);
}
@ -203,8 +202,8 @@ public class tent_2 extends Furniture implements Listener{
public void onFurnitureBreak(FurnitureBreakEvent e){
if(obj==null){return;}
if(e.isCancelled()){return;}
if(!e.canBuild()){return;}
if(!e.getID().equals(obj)){return;}
if(!e.canBuild()){return;}
e.setCancelled(true);
for(Block bl : block){
bl.setType(Material.AIR);
@ -220,7 +219,8 @@ public class tent_2 extends Furniture implements Listener{
if(!e.getID().equals(obj)){return;}
e.setCancelled(true);
Player p = e.getPlayer();
if(!e.canBuild()){return;}
Boolean canBuild = lib.canBuild(e.getPlayer(), obj, EventType.INTERACT);
if(!p.getItemInHand().getType().equals(Material.INK_SACK)){
for(Block b : block){
@ -230,7 +230,6 @@ public class tent_2 extends Furniture implements Listener{
}
}
}else{
Boolean canBuild = lib.canBuild(p, e.getLocation(), EventType.INTERACT);
Material m = Material.CARPET;
color(p, canBuild, m);
}

View File

@ -31,7 +31,6 @@ 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;
public class tent_3 extends Furniture implements Listener{
@ -49,27 +48,27 @@ public class tent_3 extends Furniture implements Listener{
public Location getLocation(){return this.loc;}
public BlockFace getBlockFace(){return this.b;}
public tent_3(Location location, FurnitureLib lib, Plugin plugin, ObjectID id){
super(location, lib, plugin, id);
public tent_3(FurnitureLib lib, Plugin plugin, ObjectID id){
super(lib, plugin, id);
this.lutil = main.getLocationUtil();
this.b = lutil.yawToFace(location.getYaw());
this.loc = location.getBlock().getLocation();
this.loc.setYaw(location.getYaw());
this.w = location.getWorld();
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()){
setBlock();
Bukkit.getPluginManager().registerEvents(this, plugin);
return;
}
if(b.equals(BlockFace.WEST)){location=lutil.getRelativ(location, b, 1D, 0D);}
if(b.equals(BlockFace.NORTH)){location=lutil.getRelativ(location, b, 1D, 1D);}
if(b.equals(BlockFace.EAST)){location=lutil.getRelativ(location, b, 0D, 1D);}
if(b.equals(BlockFace.WEST)){loc=lutil.getRelativ(loc, b, 1D, 0D);}
if(b.equals(BlockFace.NORTH)){loc=lutil.getRelativ(loc, b, 1D, 1D);}
if(b.equals(BlockFace.EAST)){loc=lutil.getRelativ(loc, b, 0D, 1D);}
spawn(location);
spawn(loc);
}
Block bed;
@ -159,8 +158,6 @@ public class tent_3 extends Furniture implements Listener{
as.setName("#SITZ#");
aspL.add(as);
setBlock();
for(ArmorStandPacket packet : aspL){
packet.setInvisible(true);
packet.setGravity(false);
@ -178,8 +175,8 @@ public class tent_3 extends Furniture implements Listener{
@EventHandler
public void onFurnitureBreak(FurnitureBreakEvent e){
if(e.isCancelled()){return;}
if(!e.canBuild()){return;}
if(!e.getID().equals(obj)){return;}
if(!e.canBuild()){return;}
if(obj==null){return;}
e.setCancelled(true);
bed.setType(Material.AIR);
@ -193,9 +190,10 @@ public class tent_3 extends Furniture implements Listener{
if(e.isCancelled()){return;}
if(!e.getID().equals(obj)){return;}
e.setCancelled(true);
if(!e.canBuild()){return;}
Player p = e.getPlayer();
if(p.getItemInHand().getType().equals(Material.INK_SACK)){
Boolean canBuild = lib.canBuild(p, e.getLocation(), EventType.INTERACT);
Boolean canBuild = true;
Material m = Material.BANNER;
color(p, canBuild, m);
}else{

View File

@ -1,5 +1,5 @@
name: DiceFurniture
version: 2.0.9
version: 2.1
description: Furniture
author: Ste3et_C0st
website: http://dicecraft.de