DiceFurniture

This commit is contained in:
BuildTools 2015-08-13 19:26:30 +02:00
parent 3af153b756
commit 0598bdb636
22 changed files with 335 additions and 369 deletions

View File

@ -4,5 +4,6 @@
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="lib" path="C:/Plugins/jars/spigot.jar"/>
<classpathentry kind="lib" path="C:/Plugins/jars/FurnitureLib.jar"/>
<classpathentry kind="lib" path="C:/Plugins/jars/PostalService-1.0.6.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>

View File

@ -87,26 +87,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, "Camera", this, obj, null);break;
case "TV":new tv(obj.getStartLocation(), lib, "TV", this, obj, null);break;
case "GraveStone":new graveStone(obj.getStartLocation(), lib, "GraveStone", this, obj, null);break;
case "Chair":new chair(obj.getStartLocation(), lib, "Chair", this, obj, null);break;
case "LargeTable":new largeTable(obj.getStartLocation(), lib, "LargeTable", this, obj, null);break;
case "Lantern":new lantern(obj.getStartLocation(), lib, "Lantern", this, obj, null);break;
case "Sofa":new sofa(obj.getStartLocation(), lib, "Sofa", this, obj, null);break;
case "Table":new table(obj.getStartLocation(), lib, "Table", this, obj, null);break;
case "Barrels":new barrels(obj.getStartLocation(), lib, "Barrels", this, obj, null);break;
case "Campfire1":new campfire_1(obj.getStartLocation(), lib, "Campfire1", this, obj, null);break;
case "Campfire2":new campfire_2(obj.getStartLocation(), lib, "Campfire2", this, obj, null);break;
case "Tent1":new tent_1(obj.getStartLocation(), lib, "Tent1", this, obj, null);break;
case "Tent2":new tent_2(obj.getStartLocation(), lib, "Tent2", this, obj, null);break;
case "Tent3":new tent_3(obj.getStartLocation(), lib, "Tent3", this, obj, null);break;
case "Fence":new fance(obj.getStartLocation(), lib, "Fence", this, obj, null);break;
case "Sunshade":new sunshade(obj.getStartLocation(), lib, "Sunshade", this, obj, null);break;
case "Streetlamp":new streetlamp(obj.getStartLocation(), lib, "Streetlamp", this, obj, null);break;
case "Billboard": new billboard(obj.getStartLocation(), lib, "Billboard", this, obj, null); break;
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 "Mailbox" :
mailBox mail = new mailBox(obj.getStartLocation(), lib, "Mailbox", this, obj, null);
mailBox mail = new mailBox(obj.getStartLocation(), lib, this, obj);
/*try {
mail.addMailbox(loadPlayerMailBox(obj));
} catch (Exception e) {
@ -172,28 +172,32 @@ public class main extends JavaPlugin implements Listener{
loc.add(0, 1, 0);
Project pro = e.getProject();
lib.getLimitationManager().add(e.getLocation(), pro);
ObjectID obj = new ObjectID(pro.getName(), pro.getPlugin().getName(), e.getLocation());
switch(e.getProject().getName()){
case "Camera" : new camera(loc, lib, "Camera", instance, null, e.getPlayer());break;
case "TV" : new tv(loc, lib, "TV", instance, null, e.getPlayer());break;
case "GraveStone" : new graveStone(loc, lib, "GraveStone", instance, null, e.getPlayer());break;
case "Chair" : new chair(loc, lib, "Chair", instance, null, e.getPlayer()); break;
case "LargeTable" : new largeTable(loc, lib, "LargeTable", instance, null, e.getPlayer());break;
case "Lantern" : new lantern(loc, lib, "Lantern", instance, null, e.getPlayer());break;
case "Sofa" : new sofa(loc, lib, "Sofa", instance, null, e.getPlayer());break;
case "Table" : new table(loc, lib, "Table", instance, null, e.getPlayer());break;
case "Barrels" : new barrels(loc, lib, "Barrels", instance, null, e.getPlayer());break;
case "Campfire1" : new campfire_1(loc, lib, "Campfire1", instance, null, e.getPlayer());break;
case "Campfire2" : new campfire_2(loc, lib, "Campfire2", instance, null, e.getPlayer());break;
case "Tent1" : new tent_1(loc, lib, "Tent1", instance, null, e.getPlayer());break;
case "Tent2" : new tent_2(loc, lib, "Tent2", instance, null, e.getPlayer());break;
case "Tent3" : new tent_3(loc, lib, "Tent3", instance, null, e.getPlayer());break;
case "Fence" : new fance(loc, lib, "Fence", instance, null, e.getPlayer());break;
case "Sunshade": new sunshade(loc, lib, "Sunshade", instance, null, e.getPlayer());break;
case "Streetlamp": new streetlamp(loc, lib, "Streetlamp", this, null, e.getPlayer());break;
case "Billboard": new billboard(loc, lib, "Billboard", instance, null, e.getPlayer());break;
case "Mailbox" : new mailBox(loc, lib, "Mailbox", this, null, e.getPlayer()); break;
default: e.getPlayer().sendMessage("A error occorupted");break;
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;
default: e.getPlayer().sendMessage("A error occorupted");return;
}
obj.setFinish();
e.removeItem();
}

View File

@ -9,7 +9,6 @@ import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.block.BlockFace;
import org.bukkit.entity.ItemFrame;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.inventory.ItemStack;
@ -18,15 +17,16 @@ 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.FurnitureLateSpawnEvent;
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;
public class billboard implements Listener{
public class billboard extends Furniture implements Listener{
Location loc;
BlockFace b;
@ -36,13 +36,12 @@ public class billboard implements Listener{
FurnitureLib lib;
LocationUtil lutil;
Plugin plugin;
private String id;
public String getID(){return this.id;}
public Location getLocation(){return this.loc;}
public BlockFace getBlockFace(){return this.b;}
public billboard(Location location, FurnitureLib lib, String name, Plugin plugin, ObjectID id, Player player){
public billboard(Location location, FurnitureLib lib, Plugin plugin, ObjectID id){
super(location, lib, plugin, id);
this.lutil = main.getLocationUtil();
this.b = lutil.yawToFace(location.getYaw());
this.loc = location.getBlock().getLocation();
@ -51,16 +50,10 @@ public class billboard implements Listener{
this.manager = lib.getFurnitureManager();
this.lib = lib;
this.plugin = plugin;
if(id!=null){
if(id.isFinish()){
this.obj = id;
Bukkit.getPluginManager().registerEvents(this, plugin);
return;
}else{
this.obj = new ObjectID(name, plugin.getName(), location);
if(player!=null){
FurnitureLateSpawnEvent lateSpawn = new FurnitureLateSpawnEvent(player, obj, obj.getProjectOBJ(), location);
Bukkit.getServer().getPluginManager().callEvent(lateSpawn);
}
}
spawn(location);
}
@ -122,18 +115,20 @@ public class billboard implements Listener{
pack.setGravity(false);
pack.setBasePlate(false);
}
manager.send(obj);
Bukkit.getPluginManager().registerEvents(this, plugin);
}
@EventHandler
private void onBreak(FurnitureBreakEvent e){
public void onFurnitureBreak(FurnitureBreakEvent e) {
if(e.isCancelled()){return;}
if(!e.canBuild()){return;}
if(!e.getID().equals(obj)){return;}
if(obj==null){return;}
e.remove();
obj=null;
}
@EventHandler
public void onFurnitureClick(FurnitureClickEvent e) {}
}

View File

@ -22,15 +22,15 @@ import de.Ste3et_C0st.Furniture.Camera.Utils.RenderClass;
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.Events.FurnitureLateSpawnEvent;
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;
public class camera implements Listener{
public class camera extends Furniture implements Listener{
Location loc;
BlockFace b;
World w;
@ -39,13 +39,12 @@ public class camera implements Listener{
FurnitureLib lib;
LocationUtil lutil;
Plugin plugin;
private String id;
public String getID(){return this.id;}
public Location getLocation(){return this.loc;}
public BlockFace getBlockFace(){return this.b;}
public camera(Location location, FurnitureLib lib, String name, Plugin plugin, ObjectID id, Player player){
public camera(Location location, FurnitureLib lib, Plugin plugin, ObjectID id){
super(location, lib, plugin, id);
this.lutil = main.getLocationUtil();
this.b = lutil.yawToFace(location.getYaw());
this.loc = location.getBlock().getLocation();
@ -54,16 +53,10 @@ public class camera implements Listener{
this.manager = lib.getFurnitureManager();
this.lib = lib;
this.plugin = plugin;
if(id!=null){
this.obj = id;
this.obj = id;
if(id.isFinish()){
Bukkit.getPluginManager().registerEvents(this, plugin);
return;
}else{
this.obj = new ObjectID(name, plugin.getName(), location);
if(player!=null){
FurnitureLateSpawnEvent lateSpawn = new FurnitureLateSpawnEvent(player, obj, obj.getProjectOBJ(), location);
Bukkit.getServer().getPluginManager().callEvent(lateSpawn);
}
}
spawn(location);
}
@ -132,15 +125,23 @@ public class camera implements Listener{
asp.setInvisible(true);
asp.setGravity(false);
}
manager.send(obj);
Bukkit.getPluginManager().registerEvents(this, plugin);
//lib.saveObjToDB(obj);
}
@EventHandler
public void onFurnitureBreak(FurnitureBreakEvent e) {
if(e.isCancelled()){return;}
if(!e.canBuild()){return;}
if(!e.getID().equals(obj)){return;}
if(obj==null){return;}
e.remove();
obj=null;
}
@SuppressWarnings("deprecation")
@EventHandler
private void onClick(FurnitureClickEvent e){
public void onFurnitureClick(FurnitureClickEvent e) {
if(e.isCancelled()){return;}
if(!e.getID().equals(obj)){return;}
if(obj==null){return;}
@ -149,6 +150,7 @@ public class camera implements Listener{
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()));
@ -163,14 +165,4 @@ public class camera implements Listener{
}
}
@EventHandler
private void onBreak(FurnitureBreakEvent e){
if(e.isCancelled()){return;}
if(!e.canBuild()){return;}
if(!e.getID().equals(obj)){return;}
if(obj==null){return;}
e.remove();
obj=null;
}
}

View File

@ -9,7 +9,6 @@ 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.Listener;
import org.bukkit.event.block.Action;
@ -23,15 +22,15 @@ import org.bukkit.util.Vector;
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.Events.FurnitureLateSpawnEvent;
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;
public class streetlamp implements Listener{
public class streetlamp extends Furniture implements Listener{
Location loc, light;
Vector loc2;
@ -45,12 +44,11 @@ public class streetlamp implements Listener{
boolean redstone = false;
List<Location> blockLocation = new ArrayList<Location>();
private String id;
public String getID(){return this.id;}
public Location getLocation(){return this.loc;}
public BlockFace getBlockFace(){return this.b;}
public streetlamp(Location location, FurnitureLib lib, String name, Plugin plugin, ObjectID id, Player player){
public streetlamp(Location location, FurnitureLib lib, Plugin plugin, ObjectID id){
super(location, lib, plugin, id);
this.lutil = main.getLocationUtil();
this.b = lutil.yawToFace(location.getYaw());
this.loc = location.getBlock().getLocation();
@ -61,17 +59,11 @@ public class streetlamp implements Listener{
this.lib = lib;
this.plugin = plugin;
this.light = lutil.getRelativ(loc, b, -1D, 0D);
this.obj = id;
setBlock();
if(id!=null){
this.obj = id;
if(id.isFinish()){
Bukkit.getPluginManager().registerEvents(this, plugin);
return;
}else{
this.obj = new ObjectID(name, plugin.getName(), location);
if(player!=null){
FurnitureLateSpawnEvent lateSpawn = new FurnitureLateSpawnEvent(player, obj, obj.getProjectOBJ(), location);
Bukkit.getServer().getPluginManager().callEvent(lateSpawn);
}
}
spawn(location);
}
@ -132,7 +124,6 @@ public class streetlamp implements Listener{
pack.setGravity(false);
pack.setBasePlate(false);
}
manager.send(obj);
Bukkit.getPluginManager().registerEvents(this, plugin);
}
@ -164,6 +155,7 @@ public class streetlamp implements Listener{
if(e.getClickedBlock()==null) return;
if(blockLocation.contains(e.getClickedBlock().getLocation())){
e.setCancelled(true);
if(!lib.canBuild(e.getPlayer(), e.getClickedBlock().getLocation())){return;}
FurnitureLib.getInstance().getLightManager().removeLight(light);
obj.remove(e.getPlayer());
for(Location loc : blockLocation){
@ -174,6 +166,7 @@ public class streetlamp implements Listener{
}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())){return;}
if(isOn()){
setLight(false);
}else{
@ -182,24 +175,7 @@ public class streetlamp implements Listener{
}
}
}
@EventHandler
private void onClick(FurnitureClickEvent e){
if(obj==null){return;}
if(e.isCancelled()){return;}
if(!e.getID().equals(obj)){return;}
e.setCancelled(true);
Boolean isOn = isOn();
ArmorStandPacket packet = getPacket();
if(packet==null) return;
if(redstone) return;
if(isOn){
setLight(false);
}else{
setLight(true);
}
}
@EventHandler
private void onBlockPowered(BlockRedstoneEvent e){
if(e.getBlock()==null) return;
@ -255,7 +231,7 @@ public class streetlamp implements Listener{
}
@EventHandler
private void onBreak(FurnitureBreakEvent e){
public void onFurnitureBreak(FurnitureBreakEvent e) {
if(e.isCancelled()){return;}
if(!e.canBuild()){return;}
if(!e.getID().equals(obj)){return;}
@ -267,5 +243,23 @@ public class streetlamp implements Listener{
loc.getBlock().setType(Material.AIR);
}
blockLocation.clear();
}
@EventHandler
public void onFurnitureClick(FurnitureClickEvent e) {
if(obj==null){return;}
if(e.isCancelled()){return;}
if(!e.getID().equals(obj)){return;}
e.setCancelled(true);
Boolean isOn = isOn();
ArmorStandPacket packet = getPacket();
if(packet==null) return;
if(redstone) return;
if(isOn){
setLight(false);
}else{
setLight(true);
}
}
}

View File

@ -8,7 +8,6 @@ import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.block.BlockFace;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.inventory.ItemStack;
@ -17,15 +16,16 @@ 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.FurnitureLateSpawnEvent;
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;
public class tv implements Listener{
public class tv extends Furniture implements Listener{
Location loc;
BlockFace b;
@ -35,13 +35,12 @@ public class tv implements Listener{
FurnitureLib lib;
LocationUtil lutil;
Plugin plugin;
private String id;
public String getID(){return this.id;}
public Location getLocation(){return this.loc;}
public BlockFace getBlockFace(){return this.b;}
public tv(Location location, FurnitureLib lib, String name, Plugin plugin, ObjectID id, Player player){
public tv(Location location, FurnitureLib lib, Plugin plugin, ObjectID id){
super(location, lib, plugin, id);
this.lutil = main.getLocationUtil();
this.b = lutil.yawToFace(location.getYaw());
this.loc = location.getBlock().getLocation();
@ -50,16 +49,10 @@ public class tv implements Listener{
this.manager = lib.getFurnitureManager();
this.lib = lib;
this.plugin = plugin;
if(id!=null){
this.obj = id;
this.obj = id;
if(id.isFinish()){
Bukkit.getPluginManager().registerEvents(this, plugin);
return;
}else{
this.obj = new ObjectID(name, plugin.getName(), location);
if(player!=null){
FurnitureLateSpawnEvent lateSpawn = new FurnitureLateSpawnEvent(player, obj, obj.getProjectOBJ(), location);
Bukkit.getServer().getPluginManager().callEvent(lateSpawn);
}
}
spawn(location);
}
@ -78,8 +71,6 @@ public class tv implements Listener{
as.getInventory().setHelmet(new ItemStack(Material.IRON_PLATE));
as.setSmall(true);
aspList.add(as);
// Loc ,angle, ITEMSTACK , Arm , Mini, invis, ID , List
center.add(0, -.45, 0);
center.setYaw(lutil.FaceToYaw(b));
@ -101,7 +92,6 @@ public class tv implements Listener{
asp.setBasePlate(false);
asp.setInvisible(true);
}
manager.send(obj);
Bukkit.getPluginManager().registerEvents(this, plugin);
}
@ -122,7 +112,7 @@ public class tv implements Listener{
@EventHandler
private void onBreak(FurnitureBreakEvent e){
public void onFurnitureBreak(FurnitureBreakEvent e){
if(e.isCancelled()){return;}
if(!e.canBuild()){return;}
if(!e.getID().equals(obj)){return;}
@ -130,4 +120,7 @@ public class tv implements Listener{
e.remove();
obj=null;
}
@EventHandler
public void onFurnitureClick(FurnitureClickEvent e){}
}

View File

@ -22,14 +22,14 @@ import org.bukkit.plugin.Plugin;
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.Events.FurnitureLateSpawnEvent;
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;
public class fance implements Listener{
public class fance extends Furniture implements Listener{
Location loc;
BlockFace b;
@ -40,11 +40,10 @@ public class fance implements Listener{
LocationUtil lutil;
Plugin plugin;
private String id;
public String getID(){return this.id;}
public ObjectID getObjectID(){return this.obj;}
public Location getLocation(){return this.loc;}
public BlockFace getBlockFace(){return this.b;}
List<Material> matList = Arrays.asList(
Material.SPRUCE_FENCE,
Material.BIRCH_FENCE,
@ -56,7 +55,8 @@ public class fance implements Listener{
Block block;
Material m;
public fance(Location location, FurnitureLib lib, String name, Plugin plugin, ObjectID id, Player player){
public fance(Location location, FurnitureLib lib, Plugin plugin, ObjectID id){
super(location, lib, plugin, id);
this.lutil = main.getLocationUtil();
this.b = lutil.yawToFace(location.getYaw());
this.loc = location.getBlock().getLocation();
@ -65,17 +65,11 @@ public class fance implements Listener{
this.manager = lib.getFurnitureManager();
this.lib = lib;
this.plugin = plugin;
if(id!=null){
this.obj = id;
this.obj = id;
if(id.isFinish()){
setBlock();
Bukkit.getPluginManager().registerEvents(this, plugin);
return;
}else{
this.obj = new ObjectID(name, plugin.getName(), location);
if(player!=null){
FurnitureLateSpawnEvent lateSpawn = new FurnitureLateSpawnEvent(player, obj, obj.getProjectOBJ(), location);
Bukkit.getServer().getPluginManager().callEvent(lateSpawn);
}
}
spawn(location);
setBlock();
@ -97,7 +91,6 @@ public class fance implements Listener{
packet.setSmall(true);
locat.add(0, .44, 0);
}
manager.send(obj);
Bukkit.getPluginManager().registerEvents(this, plugin);
}
@ -117,7 +110,7 @@ public class fance implements Listener{
}
@EventHandler
private void onBreak(FurnitureBreakEvent e){
public void onFurnitureBreak(FurnitureBreakEvent e){
if(obj==null){return;}
if(e.isCancelled()){return;}
if(!e.canBuild()){return;}
@ -169,7 +162,7 @@ public class fance implements Listener{
@SuppressWarnings("deprecation")
@EventHandler
private void onClick(FurnitureClickEvent e){
public void onFurnitureClick(FurnitureClickEvent e){
if(obj==null){return;}
if(e.isCancelled()){return;}
if(this.block==null) return;

View File

@ -25,15 +25,15 @@ 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.Events.FurnitureLateSpawnEvent;
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;
public class graveStone implements Listener{
public class graveStone extends Furniture implements Listener{
Location loc;
BlockFace b;
@ -43,14 +43,13 @@ public class graveStone implements Listener{
FurnitureLib lib;
LocationUtil lutil;
Plugin plugin;
private String id;
public String getID(){return this.id;}
public ObjectID getObjectID(){return this.obj;}
public Location getLocation(){return this.loc;}
public BlockFace getBlockFace(){return this.b;}
public graveStone(Location location, FurnitureLib lib, String name, Plugin plugin, ObjectID id, Player player){
public graveStone(Location location, FurnitureLib lib, Plugin plugin, ObjectID id){
super(location, lib, plugin, id);
this.lutil = main.getLocationUtil();
this.b = lutil.yawToFace(location.getYaw());
this.loc = location.getBlock().getLocation();
@ -59,17 +58,11 @@ public class graveStone implements Listener{
this.manager = lib.getFurnitureManager();
this.lib = lib;
this.plugin = plugin;
if(id!=null){
this.obj = id;
this.obj = id;
if(id.isFinish()){
setBlock();
Bukkit.getPluginManager().registerEvents(this, plugin);
return;
}else{
this.obj = new ObjectID(name, plugin.getName(), location);
if(player!=null){
FurnitureLateSpawnEvent lateSpawn = new FurnitureLateSpawnEvent(player, obj, obj.getProjectOBJ(), location);
Bukkit.getServer().getPluginManager().callEvent(lateSpawn);
}
}
spawn(location);
setBlock();
@ -153,13 +146,12 @@ public class graveStone implements Listener{
asp.setInvisible(true);
asp.setBasePlate(false);
}
manager.send(obj);
Bukkit.getPluginManager().registerEvents(this, plugin);
}
@EventHandler
private void onBreak(FurnitureBreakEvent e){
public void onFurnitureBreak(FurnitureBreakEvent e){
if(e.isCancelled()) return;
if(!e.canBuild()) return;
if(!e.getID().equals(obj)) return;
@ -205,7 +197,7 @@ public class graveStone implements Listener{
@EventHandler
private void onClick(FurnitureClickEvent e){
public void onFurnitureClick(FurnitureClickEvent e){
Player p = e.getPlayer();
if(e.isCancelled()) return;
if(!e.canBuild()) return;

View File

@ -2,13 +2,14 @@ package de.Ste3et_C0st.Furniture.Objects.garden;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import org.bukkit.Bukkit;
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.Listener;
import org.bukkit.event.block.Action;
@ -19,15 +20,16 @@ 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.FurnitureLateSpawnEvent;
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;
public class mailBox implements Listener {
public class mailBox extends Furniture implements Listener {
Location loc;
BlockFace b;
@ -38,15 +40,15 @@ public class mailBox implements Listener {
LocationUtil lutil;
Plugin plugin;
List<Block> blockList = new ArrayList<Block>();
private String id;
public String getID(){return this.id;}
public ObjectID getObjectID(){return this.obj;}
public Location getLocation(){return this.loc;}
public BlockFace getBlockFace(){return this.b;}
UUID uuid;
public mailBox(Location location, FurnitureLib lib, String name, Plugin plugin, ObjectID id, Player player){
public mailBox(Location location, FurnitureLib lib, Plugin plugin, ObjectID id){
super(location, lib, plugin, id);
this.lutil = main.getLocationUtil();
this.b = lutil.yawToFace(location.getYaw());
this.loc = location.getBlock().getLocation();
@ -55,16 +57,10 @@ public class mailBox implements Listener {
this.manager = lib.getFurnitureManager();
this.lib = lib;
this.plugin = plugin;
if(id!=null){
this.obj = id;
this.obj = id;
if(id.isFinish()){
Bukkit.getPluginManager().registerEvents(this, plugin);
return;
}else{
this.obj = new ObjectID(name, plugin.getName(), location);
if(player!=null){
FurnitureLateSpawnEvent lateSpawn = new FurnitureLateSpawnEvent(player, obj, obj.getProjectOBJ(), location);
Bukkit.getServer().getPluginManager().callEvent(lateSpawn);
}
}
spawn(location);
}
@ -138,6 +134,7 @@ public class mailBox implements Listener {
as = manager.createArmorStand(obj, lutil.getRelativ(middle.clone().add(0, 1.5, 0), face, -.21, -.32D));
as.getInventory().setHelmet(new ItemStack(Material.REDSTONE_TORCH_ON, 1, (short) 0));
as.setPose(lutil.degresstoRad(new EulerAngle(0, 0, 90)), BodyPart.HEAD);
as.setName("#ELEMENT#");
as.setSmall(true);
aspList.add(as);
@ -171,19 +168,47 @@ public class mailBox implements Listener {
b.setType(Material.BARRIER);
blockList.add(b);
}
manager.send(obj);
Bukkit.getPluginManager().registerEvents(this, plugin);
}
/*public void addMailbox(Player p) throws MailboxException{
/*public void addMailbox(Player p){
if(Bukkit.getPluginManager().isPluginEnabled("PostalService")){
PostalService.getMailboxManager().addMailboxAtLoc(blockList.get(1).getLocation(), p);
try {
PostalService.getMailboxManager().addMailboxAtLoc(blockList.get(1).getLocation(), p);
this.uuid = p.getUniqueId();
} catch (Exception e) {
e.printStackTrace();
}
}
}
public void setSendet(Boolean b){
for(ArmorStandPacket packet : manager.getArmorStandPacketByObjectID(obj)){
if(packet!=null&&packet.getName().equalsIgnoreCase("#ELEMENT#")){
if(b){
packet.setPose(lutil.degresstoRad(new EulerAngle(0, 0, 0)), BodyPart.HEAD);
manager.updateFurniture(obj);
return;
}
packet.setPose(lutil.degresstoRad(new EulerAngle(0, 0, 90)), BodyPart.HEAD);
manager.updateFurniture(obj);
return;
}
}
}
@EventHandler
private void onMove(PlayerSendMailEvent e){
if(!Bukkit.getPluginManager().isPluginEnabled("PostalService")){return;}
UUID p1 = this.uuid;
UUID p2 = e.getRecipient().getUUID();
if(!p1.equals(p2)){return;}
setSendet(true);
}*/
@EventHandler
private void onBreak(FurnitureBreakEvent e){
public void onFurnitureBreak(FurnitureBreakEvent e){
if(e.isCancelled()) return;
if(!e.canBuild()) return;
if(!e.getID().equals(obj)) return;
@ -196,6 +221,8 @@ public class mailBox implements Listener {
obj=null;
}
public void onFurnitureClick(FurnitureClickEvent e){}
@EventHandler
private void onInteract(PlayerInteractEvent e){
if(obj==null){return;}

View File

@ -27,15 +27,15 @@ 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.Events.FurnitureLateSpawnEvent;
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;
public class sunshade implements Listener{
public class sunshade extends Furniture implements Listener{
Location loc;
BlockFace b;
@ -45,12 +45,11 @@ public class sunshade implements Listener{
FurnitureLib lib;
LocationUtil lutil;
Plugin plugin;
private String id;
public String getID(){return this.id;}
public ObjectID getObjectID(){return this.obj;}
public Location getLocation(){return this.loc;}
public BlockFace getBlockFace(){return this.b;}
List<Material> matList = Arrays.asList(
Material.SPRUCE_FENCE,
Material.BIRCH_FENCE,
@ -63,7 +62,8 @@ public class sunshade implements Listener{
Integer timer;
Block block;
public sunshade(Location location, FurnitureLib lib, String name, Plugin plugin, ObjectID id, Player player){
public sunshade(Location location, FurnitureLib lib, Plugin plugin, ObjectID id){
super(location, lib, plugin, id);
this.lutil = main.getLocationUtil();
this.b = lutil.yawToFace(location.getYaw());
this.loc = location.getBlock().getLocation();
@ -72,17 +72,11 @@ public class sunshade implements Listener{
this.manager = lib.getFurnitureManager();
this.lib = lib;
this.plugin = plugin;
if(id!=null){
this.obj = id;
this.obj = id;
if(id.isFinish()){
setblock();
Bukkit.getPluginManager().registerEvents(this, plugin);
return;
}else{
this.obj = new ObjectID(name, plugin.getName(), location);
if(player!=null){
FurnitureLateSpawnEvent lateSpawn = new FurnitureLateSpawnEvent(player, obj, obj.getProjectOBJ(), location);
Bukkit.getServer().getPluginManager().callEvent(lateSpawn);
}
}
setblock();
spawn(location);
@ -137,14 +131,12 @@ public class sunshade implements Listener{
packet.setGravity(false);
packet.setBasePlate(false);
}
manager.send(obj);
Bukkit.getPluginManager().registerEvents(this, plugin);
}
@EventHandler
private void onClick(FurnitureClickEvent e){
public void onFurnitureClick(FurnitureClickEvent e){
if(obj==null){return;}
if(e.isCancelled()){return;}
if(!e.canBuild()){return;}
@ -199,6 +191,7 @@ public class sunshade implements Listener{
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())){return;}
stopTimer();
for(ArmorStandPacket packet : manager.getArmorStandPacketByObjectID(obj)){
if(packet.getName().equalsIgnoreCase("#ITEM#")){
@ -215,6 +208,7 @@ public class sunshade implements Listener{
}
}else if(e.getAction().equals(Action.RIGHT_CLICK_BLOCK)){
if(e.getClickedBlock().getLocation().equals(block.getLocation())){
if(!lib.canBuild(e.getPlayer(), e.getClickedBlock().getLocation())){return;}
Player p = e.getPlayer();
ItemStack is = p.getItemInHand();
if(is==null||!is.getType().equals(Material.BANNER)){
@ -252,7 +246,7 @@ public class sunshade implements Listener{
}
@EventHandler
private void onBreak(FurnitureBreakEvent e){
public void onFurnitureBreak(FurnitureBreakEvent e){
if(obj==null){return;}
if(e.isCancelled()){return;}
if(!e.canBuild()){return;}

View File

@ -8,7 +8,6 @@ import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.block.BlockFace;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.inventory.ItemStack;
@ -18,15 +17,15 @@ 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.Events.FurnitureLateSpawnEvent;
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;
public class chair implements Listener{
public class chair extends Furniture implements Listener{
Location loc;
BlockFace b;
@ -37,7 +36,12 @@ public class chair implements Listener{
LocationUtil lutil;
Plugin plugin;
public chair(Location location, FurnitureLib lib, String name, Plugin plugin, ObjectID id, Player player){
public ObjectID getObjectID(){return this.obj;}
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);
this.lutil = main.getLocationUtil();
this.b = lutil.yawToFace(location.getYaw());
this.loc = location.getBlock().getLocation();
@ -46,16 +50,10 @@ public class chair implements Listener{
this.manager = lib.getFurnitureManager();
this.lib = lib;
this.plugin = plugin;
if(id!=null){
this.obj = id;
this.obj = id;
if(id.isFinish()){
Bukkit.getPluginManager().registerEvents(this, plugin);
return;
}else{
this.obj = new ObjectID(name, plugin.getName(), location);
if(player!=null){
FurnitureLateSpawnEvent lateSpawn = new FurnitureLateSpawnEvent(player, obj, obj.getProjectOBJ(), location);
Bukkit.getServer().getPluginManager().callEvent(lateSpawn);
}
}
spawn(location);
}
@ -114,13 +112,12 @@ public class chair implements Listener{
asp.setInvisible(true);
asp.setBasePlate(false);
}
manager.send(obj);
Bukkit.getPluginManager().registerEvents(this, plugin);
}
@EventHandler
private void onBreak(FurnitureBreakEvent e){
public void onFurnitureBreak(FurnitureBreakEvent e){
if(obj==null){return;}
if(e.isCancelled()){return;}
if(!e.canBuild()){return;}
@ -130,7 +127,7 @@ public class chair implements Listener{
}
@EventHandler
private void onClick(FurnitureClickEvent e){
public void onFurnitureClick(FurnitureClickEvent e){
if(obj==null){return;}
if(e.isCancelled()){return;}
if(!e.getID().equals(obj)){return;}

View File

@ -19,14 +19,14 @@ import org.bukkit.plugin.Plugin;
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.Events.FurnitureLateSpawnEvent;
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;
public class lantern implements Listener{
public class lantern extends Furniture implements Listener{
Location loc;
BlockFace b;
@ -38,7 +38,12 @@ public class lantern implements Listener{
Integer id;
Plugin plugin;
public lantern(Location location, FurnitureLib lib, String name, Plugin plugin, ObjectID id, Player player){
public ObjectID getObjectID(){return this.obj;}
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);
this.lutil = main.getLocationUtil();
this.b = lutil.yawToFace(location.getYaw());
this.loc = location.getBlock().getLocation();
@ -47,17 +52,12 @@ public class lantern implements Listener{
this.manager = lib.getFurnitureManager();
this.lib = lib;
this.plugin = plugin;
if(id!=null){
this.obj = id;
this.obj = id;
if(id.isFinish()){
setBlock();
Bukkit.getPluginManager().registerEvents(this, plugin);
return;
}else{
this.obj = new ObjectID(name, plugin.getName(), location);
if(player!=null){
FurnitureLateSpawnEvent lateSpawn = new FurnitureLateSpawnEvent(player, obj, obj.getProjectOBJ(), location);
Bukkit.getServer().getPluginManager().callEvent(lateSpawn);
}
}
spawn(location);
}
@ -112,7 +112,6 @@ public class lantern implements Listener{
packet.setGravity(false);
packet.setInvisible(true);
}
manager.send(obj);
Bukkit.getPluginManager().registerEvents(this, plugin);
}
@ -129,7 +128,7 @@ public class lantern implements Listener{
}
@EventHandler
private void onBreak(FurnitureBreakEvent e){
public void onFurnitureBreak(FurnitureBreakEvent e){
if(obj==null){return;}
if(e.isCancelled()) return;
if(block==null) return;
@ -140,7 +139,7 @@ public class lantern implements Listener{
}
@EventHandler
private void onInteract(FurnitureClickEvent e){
public void onFurnitureClick(FurnitureClickEvent e){
if(obj==null){return;}
if(e.isCancelled()) return;
if(block==null) return;

View File

@ -20,15 +20,15 @@ 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.Events.FurnitureLateSpawnEvent;
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;
public class largeTable implements Listener{
public class largeTable extends Furniture implements Listener{
Location loc;
BlockFace b;
@ -40,7 +40,12 @@ public class largeTable implements Listener{
Integer id;
Plugin plugin;
public largeTable(Location location, FurnitureLib lib, String name, Plugin plugin, ObjectID id, Player player){
public ObjectID getObjectID(){return this.obj;}
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);
this.lutil = main.getLocationUtil();
this.b = lutil.yawToFace(location.getYaw());
this.loc = location.getBlock().getLocation();
@ -49,9 +54,8 @@ public class largeTable implements Listener{
this.manager = lib.getFurnitureManager();
this.lib = lib;
this.plugin = plugin;
if(id!=null){
this.obj = id;
this.obj = id;
if(id.isFinish()){
for(ArmorStandPacket packet : manager.getArmorStandPacketByObjectID(obj)){
if(packet.getName().startsWith("#TELLER")){
tellerIDs.add(packet.getEntityId());
@ -60,12 +64,6 @@ public class largeTable implements Listener{
Bukkit.getPluginManager().registerEvents(this, plugin);
return;
}else{
this.obj = new ObjectID(name, plugin.getName(), location);
if(player!=null){
FurnitureLateSpawnEvent lateSpawn = new FurnitureLateSpawnEvent(player, obj, obj.getProjectOBJ(), location);
Bukkit.getServer().getPluginManager().callEvent(lateSpawn);
}
}
spawn(location);
}
@ -186,7 +184,6 @@ public class largeTable implements Listener{
asp.setInvisible(true);
asp.setBasePlate(false);
}
manager.send(obj);
Bukkit.getPluginManager().registerEvents(this, plugin);
}
@ -201,7 +198,7 @@ public class largeTable implements Listener{
}
@EventHandler
private void onBreak(FurnitureBreakEvent e){
public void onFurnitureBreak(FurnitureBreakEvent e){
if(obj==null){return;}
if(e.isCancelled()){return;}
if(!e.canBuild()){return;}
@ -220,7 +217,7 @@ public class largeTable implements Listener{
}
@EventHandler
private void onClick(FurnitureClickEvent e){
public void onFurnitureClick(FurnitureClickEvent e){
if(obj==null){return;}
if(e.isCancelled()){return;}
if(!e.getID().equals(obj)){return;}
@ -284,7 +281,9 @@ public class largeTable implements Listener{
if(as!=null&&as.getInventory().getItemInHand()!= null && as.getInventory().getItemInHand().equals(is)){return;}
if(as.getInventory().getItemInHand()!=null&&!as.getInventory().getItemInHand().getType().equals(Material.AIR)){
ArmorStandPacket asp = as;
asp.getLocation().getWorld().dropItem(asp.getLocation(), asp.getInventory().getItemInHand());
ItemStack item = asp.getInventory().getItemInHand();
item.setAmount(1);
asp.getLocation().getWorld().dropItem(asp.getLocation(), item);
}
ItemStack IS = is.clone();

View File

@ -19,15 +19,15 @@ 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.Events.FurnitureLateSpawnEvent;
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;
public class sofa implements Listener {
public class sofa extends Furniture implements Listener {
Location loc;
BlockFace b;
@ -39,7 +39,12 @@ public class sofa implements Listener {
Integer id;
Plugin plugin;
public sofa(Location location, FurnitureLib lib, String name, Plugin plugin, ObjectID id, Player player){
public ObjectID getObjectID(){return this.obj;}
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);
this.lutil = main.getLocationUtil();
this.b = lutil.yawToFace(location.getYaw());
this.loc = location.getBlock().getLocation();
@ -48,16 +53,10 @@ public class sofa implements Listener {
this.manager = lib.getFurnitureManager();
this.lib = lib;
this.plugin = plugin;
if(id!=null){
this.obj = id;
this.obj = id;
if(id.isFinish()){
Bukkit.getPluginManager().registerEvents(this, plugin);
return;
}else{
this.obj = new ObjectID(name, plugin.getName(), location);
if(player!=null){
FurnitureLateSpawnEvent lateSpawn = new FurnitureLateSpawnEvent(player, obj, obj.getProjectOBJ(), location);
Bukkit.getServer().getPluginManager().callEvent(lateSpawn);
}
}
place = .3;
spawn(location);
@ -167,13 +166,12 @@ public class sofa implements Listener {
asps.setGravity(false);
asps.setBasePlate(false);
}
manager.send(obj);
Bukkit.getPluginManager().registerEvents(this, plugin);
}
@EventHandler
private void onClick(FurnitureClickEvent e){
public void onFurnitureClick(FurnitureClickEvent e){
if(obj==null){return;}
if(e.isCancelled()){return;}
if(!e.getID().equals(obj)){return;}
@ -237,7 +235,7 @@ public class sofa implements Listener {
}
@EventHandler
private void onBreak(FurnitureBreakEvent e){
public void onFurnitureBreak(FurnitureBreakEvent e){
if(obj==null){return;}
if(e.isCancelled()){return;}
if(!e.canBuild()){return;}

View File

@ -19,15 +19,15 @@ 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.Events.FurnitureLateSpawnEvent;
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;
public class table implements Listener {
public class table extends Furniture implements Listener {
Location loc;
BlockFace b;
@ -39,7 +39,12 @@ public class table implements Listener {
Integer id;
Plugin plugin;
public table(Location location, FurnitureLib lib, String name, Plugin plugin, ObjectID id, Player player){
public ObjectID getObjectID(){return this.obj;}
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);
this.lutil = main.getLocationUtil();
this.b = lutil.yawToFace(location.getYaw());
this.loc = location.getBlock().getLocation();
@ -48,16 +53,10 @@ public class table implements Listener {
this.manager = lib.getFurnitureManager();
this.lib = lib;
this.plugin = plugin;
if(id!=null){
this.obj = id;
this.obj = id;
if(id.isFinish()){
Bukkit.getPluginManager().registerEvents(this, plugin);
return;
}else{
this.obj = new ObjectID(name, plugin.getName(), location);
if(player!=null){
FurnitureLateSpawnEvent lateSpawn = new FurnitureLateSpawnEvent(player, obj, obj.getProjectOBJ(), location);
Bukkit.getServer().getPluginManager().callEvent(lateSpawn);
}
}
spawn(location);
}
@ -89,13 +88,12 @@ public class table implements Listener {
packet.setInvisible(true);
packet.setGravity(false);
}
manager.send(obj);
Bukkit.getPluginManager().registerEvents(this, plugin);
}
@EventHandler
private void onBreak(FurnitureBreakEvent e){
public void onFurnitureBreak(FurnitureBreakEvent e){
if(obj==null){return;}
if(e.isCancelled()){return;}
if(!e.canBuild()){return;}
@ -114,7 +112,7 @@ public class table implements Listener {
}
@EventHandler
private void onClick(FurnitureClickEvent e){
public void onFurnitureClick(FurnitureClickEvent e){
if(obj==null){return;}
if(e.isCancelled()){return;}
if(!e.getID().equals(obj)){return;}
@ -128,6 +126,7 @@ public class table implements Listener {
Itemstack.setAmount(1);
if(packet.getInventory().getItemInHand()!=null&&!packet.getInventory().getItemInHand().getType().equals(Material.AIR)){
ItemStack is = packet.getInventory().getItemInHand();
is.setAmount(1);
w.dropItem(loc, is);
}
packet.getInventory().setItemInHand(Itemstack);

View File

@ -19,14 +19,14 @@ import org.bukkit.plugin.Plugin;
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.Events.FurnitureLateSpawnEvent;
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;
public class barrels implements Listener {
public class barrels extends Furniture implements Listener {
Location loc;
BlockFace b;
@ -39,7 +39,12 @@ public class barrels implements Listener {
Block block;
Plugin plugin;
public barrels(Location location, FurnitureLib lib, String name, Plugin plugin, ObjectID id, Player player){
public ObjectID getObjectID(){return this.obj;}
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);
this.lutil = main.getLocationUtil();
this.b = lutil.yawToFace(location.getYaw());
this.loc = location.getBlock().getLocation();
@ -48,18 +53,12 @@ public class barrels implements Listener {
this.manager = lib.getFurnitureManager();
this.lib = lib;
this.plugin = plugin;
if(id!=null){
this.obj = id;
this.obj = id;
if(id.isFinish()){
this.block = loc.getBlock();
this.block.setType(Material.CAULDRON);
Bukkit.getPluginManager().registerEvents(this, plugin);
return;
}else{
this.obj = new ObjectID(name, plugin.getName(), location);
if(player!=null){
FurnitureLateSpawnEvent lateSpawn = new FurnitureLateSpawnEvent(player, obj, obj.getProjectOBJ(), location);
Bukkit.getServer().getPluginManager().callEvent(lateSpawn);
}
}
spawn(location);
}
@ -70,13 +69,12 @@ public class barrels implements Listener {
ArmorStandPacket packet = manager.createArmorStand(obj, lutil.getCenter(loc).add(0,-1.5,0));
packet.setInvisible(true);
manager.send(obj);
Bukkit.getPluginManager().registerEvents(this, plugin);
}
@EventHandler
private void onClick(FurnitureClickEvent e){
public void onFurnitureClick(FurnitureClickEvent e){
if(obj==null){return;}
if(e.isCancelled()){return;}
if(!e.getID().equals(obj)){return;}
@ -87,6 +85,7 @@ public class barrels implements Listener {
ArmorStandPacket packet = manager.getArmorStandPacketByObjectID(obj).get(0);
if(packet.getInventory().getHelmet()!=null&&!packet.getInventory().getHelmet().getType().equals(Material.AIR)){
ItemStack is = packet.getInventory().getHelmet();
is.setAmount(1);
w.dropItem(loc, is);
}
@ -116,8 +115,10 @@ public class barrels implements Listener {
ItemStack Itemstack = p.getItemInHand().clone();
Itemstack.setAmount(1);
ArmorStandPacket packet = manager.getArmorStandPacketByObjectID(obj).get(0);
if(packet.getInventory().getHelmet()!=null&&!packet.getInventory().getHelmet().getType().equals(Material.AIR)){
ItemStack is = packet.getInventory().getHelmet();
is.setAmount(1);
w.dropItem(loc, is);
}
@ -152,7 +153,7 @@ public class barrels implements Listener {
}
@EventHandler
private void onBreak(FurnitureBreakEvent e){
public void onFurnitureBreak(FurnitureBreakEvent e){
if(obj==null){return;}
if(e.isCancelled()){return;}
if(!e.canBuild()){return;}

View File

@ -7,7 +7,6 @@ import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.block.BlockFace;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.inventory.ItemStack;
@ -16,14 +15,14 @@ import org.bukkit.plugin.Plugin;
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.Events.FurnitureLateSpawnEvent;
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;
public class campfire_1 implements Listener{
public class campfire_1 extends Furniture implements Listener{
Location loc;
BlockFace b;
@ -35,7 +34,12 @@ public class campfire_1 implements Listener{
Integer id;
Plugin plugin;
public campfire_1(Location location, FurnitureLib lib, String name, Plugin plugin, ObjectID id, Player player){
public ObjectID getObjectID(){return this.obj;}
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);
this.lutil = main.getLocationUtil();
this.b = lutil.yawToFace(location.getYaw());
this.loc = location.getBlock().getLocation();
@ -44,22 +48,16 @@ public class campfire_1 implements Listener{
this.manager = lib.getFurnitureManager();
this.lib = lib;
this.plugin = plugin;
if(id!=null){
this.obj = id;
this.obj = id;
if(id.isFinish()){
Bukkit.getPluginManager().registerEvents(this, plugin);
return;
}else{
this.obj = new ObjectID(name, plugin.getName(), location);
if(player!=null){
FurnitureLateSpawnEvent lateSpawn = new FurnitureLateSpawnEvent(player, obj, obj.getProjectOBJ(), location);
Bukkit.getServer().getPluginManager().callEvent(lateSpawn);
}
}
spawn(location);
}
@EventHandler
private void onBreak(FurnitureBreakEvent e){
public void onFurnitureBreak(FurnitureBreakEvent e){
if(obj==null){return;}
if(e.isCancelled()){return;}
if(!e.canBuild()){return;}
@ -76,7 +74,7 @@ public class campfire_1 implements Listener{
}
@EventHandler
private void onClick(FurnitureClickEvent e){
public void onFurnitureClick(FurnitureClickEvent e){
if(obj==null){return;}
if(e.isCancelled()){return;}
if(!e.canBuild()){return;}

View File

@ -10,7 +10,6 @@ import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.block.BlockFace;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.inventory.ItemStack;
@ -20,15 +19,15 @@ 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.Events.FurnitureLateSpawnEvent;
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;
public class campfire_2 implements Listener{
public class campfire_2 extends Furniture implements Listener{
List<Material> items = new ArrayList<Material>(
Arrays.asList(
Material.RAW_BEEF,
@ -75,7 +74,13 @@ public class campfire_2 implements Listener{
Integer timer;
ArmorStandPacket armorS;
ItemStack is;
public campfire_2(Location location, FurnitureLib lib, String name, Plugin plugin, ObjectID id, Player player){
public ObjectID getObjectID(){return this.obj;}
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);
this.lutil = main.getLocationUtil();
this.b = lutil.yawToFace(location.getYaw());
this.loc = location.getBlock().getLocation();
@ -90,17 +95,10 @@ public class campfire_2 implements Listener{
grill = lutil.getRelativ(middle,b, .0D, .5D);
grill.setYaw(lutil.FaceToYaw(b)+90);
if(id!=null){
this.obj = id;
this.obj = id;
if(id.isFinish()){
Bukkit.getPluginManager().registerEvents(this, plugin);
return;
}else{
this.obj = new ObjectID(name, plugin.getName(), location);
if(player!=null){
FurnitureLateSpawnEvent lateSpawn = new FurnitureLateSpawnEvent(player, obj, obj.getProjectOBJ(), location);
Bukkit.getServer().getPluginManager().callEvent(lateSpawn);
}
}
spawn(location);
}
@ -174,13 +172,12 @@ public class campfire_2 implements Listener{
packet.setInvisible(true);
packet.setGravity(false);
}
manager.send(obj);
Bukkit.getPluginManager().registerEvents(this, plugin);
}
@EventHandler
private void onClick(FurnitureClickEvent e){
public void onFurnitureClick(FurnitureClickEvent e){
if(obj==null){return;}
if(e.isCancelled()){return;}
if(!e.canBuild()){return;}
@ -234,7 +231,7 @@ public class campfire_2 implements Listener{
}
@EventHandler
private void onBreak(FurnitureBreakEvent e){
public void onFurnitureBreak(FurnitureBreakEvent e){
if(obj==null){return;}
if(e.isCancelled()){return;}
if(!e.canBuild()){return;}

View File

@ -21,15 +21,15 @@ 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.Events.FurnitureLateSpawnEvent;
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;
public class tent_1 implements Listener{
public class tent_1 extends Furniture implements Listener{
Location loc;
BlockFace b;
@ -42,7 +42,12 @@ public class tent_1 implements Listener{
Block block;
Plugin plugin;
public tent_1(Location location, FurnitureLib lib, String name, Plugin plugin, ObjectID id, Player player){
public ObjectID getObjectID(){return this.obj;}
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);
this.lutil = main.getLocationUtil();
this.b = lutil.yawToFace(location.getYaw());
this.loc = location.getBlock().getLocation();
@ -54,18 +59,11 @@ public class tent_1 implements Listener{
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);}
if(id!=null){
this.obj = id;
this.obj = id;
if(id.isFinish()){
setblock();
Bukkit.getPluginManager().registerEvents(this, plugin);
return;
}else{
this.obj = new ObjectID(name, plugin.getName(), location);
if(player!=null){
FurnitureLateSpawnEvent lateSpawn = new FurnitureLateSpawnEvent(player, obj, obj.getProjectOBJ(), location);
Bukkit.getServer().getPluginManager().callEvent(lateSpawn);
}
}
spawn(loc);
}
@ -256,13 +254,12 @@ public class tent_1 implements Listener{
packet.setInvisible(true);
packet.setGravity(false);
}
manager.send(obj);
Bukkit.getPluginManager().registerEvents(this, plugin);
}
@EventHandler
private void onBreak(FurnitureBreakEvent e){
public void onFurnitureBreak(FurnitureBreakEvent e){
if(obj==null){return;}
if(e.isCancelled()){return;}
if(!e.canBuild()){return;}
@ -274,7 +271,7 @@ public class tent_1 implements Listener{
}
@EventHandler
private void onClick(FurnitureClickEvent e){
public void onFurnitureClick(FurnitureClickEvent e){
if(obj==null){return;}
if(e.isCancelled()){return;}
if(!e.getID().equals(obj)){return;}

View File

@ -22,15 +22,15 @@ 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.Events.FurnitureLateSpawnEvent;
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;
public class tent_2 implements Listener{
public class tent_2 extends Furniture implements Listener{
Location loc;
BlockFace b;
@ -45,7 +45,13 @@ public class tent_2 implements Listener{
Plugin plugin;
Location bedLoc;
public tent_2(Location location, FurnitureLib lib, String name, Plugin plugin, ObjectID id, Player player){
public ObjectID getObjectID(){return this.obj;}
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);
this.lutil = main.getLocationUtil();
this.b = lutil.yawToFace(location.getYaw());
this.loc = location.getBlock().getLocation();
@ -57,10 +63,8 @@ public class tent_2 implements Listener{
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(id!=null){
this.obj = id;
this.obj = id;
if(id.isFinish()){
Bukkit.broadcastMessage(b.name());
Location loca = loc.clone();
@ -75,12 +79,6 @@ public class tent_2 implements Listener{
setBlock(loca);
Bukkit.getPluginManager().registerEvents(this, plugin);
return;
}else{
this.obj = new ObjectID(name, plugin.getName(), location);
if(player!=null){
FurnitureLateSpawnEvent lateSpawn = new FurnitureLateSpawnEvent(player, obj, obj.getProjectOBJ(), location);
Bukkit.getServer().getPluginManager().callEvent(lateSpawn);
}
}
spawn(location);
}
@ -201,7 +199,7 @@ public class tent_2 implements Listener{
}
@EventHandler
private void onBreak(FurnitureBreakEvent e){
public void onFurnitureBreak(FurnitureBreakEvent e){
if(obj==null){return;}
if(e.isCancelled()){return;}
if(!e.canBuild()){return;}
@ -215,7 +213,7 @@ public class tent_2 implements Listener{
}
@EventHandler
private void onClick(final FurnitureClickEvent e){
public void onFurnitureClick(final FurnitureClickEvent e){
if(obj==null){return;}
if(e.isCancelled()){return;}
if(!e.getID().equals(obj)){return;}

View File

@ -24,15 +24,15 @@ 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.Events.FurnitureLateSpawnEvent;
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;
public class tent_3 implements Listener{
public class tent_3 extends Furniture implements Listener{
Location loc;
BlockFace b;
@ -44,7 +44,12 @@ public class tent_3 implements Listener{
Integer id;
Plugin plugin;
public tent_3(Location location, FurnitureLib lib, String name, Plugin plugin, ObjectID id, Player player){
public ObjectID getObjectID(){return this.obj;}
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);
this.lutil = main.getLocationUtil();
this.b = lutil.yawToFace(location.getYaw());
this.loc = location.getBlock().getLocation();
@ -53,17 +58,11 @@ public class tent_3 implements Listener{
this.manager = lib.getFurnitureManager();
this.lib = lib;
this.plugin = plugin;
if(id!=null){
this.obj = id;
this.obj = id;
if(id.isFinish()){
setBlock();
Bukkit.getPluginManager().registerEvents(this, plugin);
return;
}else{
this.obj = new ObjectID(name, plugin.getName(), location);
if(player!=null){
FurnitureLateSpawnEvent lateSpawn = new FurnitureLateSpawnEvent(player, obj, obj.getProjectOBJ(), location);
Bukkit.getServer().getPluginManager().callEvent(lateSpawn);
}
}
if(b.equals(BlockFace.WEST)){location=lutil.getRelativ(location, b, 1D, 0D);}
if(b.equals(BlockFace.NORTH)){location=lutil.getRelativ(location, b, 1D, 1D);}
@ -165,7 +164,6 @@ public class tent_3 implements Listener{
packet.setInvisible(true);
packet.setGravity(false);
}
manager.send(obj);
Bukkit.getPluginManager().registerEvents(this, plugin);
}
@ -177,7 +175,7 @@ public class tent_3 implements Listener{
}
@EventHandler
private void onBreak(FurnitureBreakEvent e){
public void onFurnitureBreak(FurnitureBreakEvent e){
if(e.isCancelled()){return;}
if(!e.canBuild()){return;}
if(!e.getID().equals(obj)){return;}
@ -189,7 +187,7 @@ public class tent_3 implements Listener{
}
@EventHandler
private void onClick(FurnitureClickEvent e){
public void onFurnitureClick(FurnitureClickEvent e){
if(obj==null){return;}
if(e.isCancelled()){return;}
if(!e.getID().equals(obj)){return;}

View File

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