Update for new FurnitureLib pls use FunritureLib build #119

This commit is contained in:
Ste3et_C0st 2019-02-24 00:33:02 +01:00
parent 3742238bb6
commit 0e6a05cd41
29 changed files with 971 additions and 1059 deletions

View File

@ -204,19 +204,23 @@ public class main extends JavaPlugin implements Listener{
if(id.getProjectOBJ() == null) continue;
if(id.getSQLAction().equals(SQLAction.REMOVE)) continue;
switch (id.getProjectOBJ().getName()) {
case "Catapult":new Catapult(id);break;
case "Barrels": new barrels(id);break;
case "WaxCandle": new WaxCandle(id);break;
case "Lantern": new WaxCandle(id);break;
case "Fence": new fance(id);break;
case "Trunk": new Trunk(id);break;
case "Sunshade": new sunshade(id);break;
case "Hammock": new hammock(id);break;
case "Crossbow": new Crossbow(id);break;
case "Tent1": new tent_1(id);break;
case "GraveStone": new graveStone(id);break;
case "Camera": new camera(id);break;
case "Log": new log(id);break;
case "Catapult":id.setFunctionObject(new Catapult(id));break;
case "Barrels": id.setFunctionObject(new barrels(id));break;
case "WaxCandle": id.setFunctionObject(new WaxCandle(id));break;
case "Lantern": id.setFunctionObject(new WaxCandle(id));break;
case "Fence":{
System.out.println("test");
id.setFunctionObject(new fance(id));break;
}
case "Trunk": id.setFunctionObject(new Trunk(id));break;
case "Sunshade": id.setFunctionObject(new sunshade(id));break;
case "Hammock": id.setFunctionObject(new hammock(id));break;
case "Crossbow": id.setFunctionObject(new Crossbow(id));break;
case "Tent1": id.setFunctionObject(new tent_1(id));break;
case "GraveStone": id.setFunctionObject(new graveStone(id));break;
case "Camera": id.setFunctionObject(new camera(id));break;
case "Log": id.setFunctionObject(new log(id));break;
default:break;
}
}
@ -229,19 +233,19 @@ public class main extends JavaPlugin implements Listener{
if(event.getProject().getName()==null) return;
if(event.getID().getSQLAction().equals(SQLAction.REMOVE)) return;
switch (event.getProject().getName()) {
case "Catapult":new Catapult(event.getID());break;
case "Barrels": new barrels(event.getID());break;
case "WaxCandle": new WaxCandle(event.getID());break;
case "Lantern": new WaxCandle(event.getID());break;
case "Fence": new fance(event.getID());break;
case "Trunk": new Trunk(event.getID());break;
case "Sunshade": new sunshade(event.getID());break;
case "Hammock": new hammock(event.getID());break;
case "Crossbow": new Crossbow(event.getID());break;
case "Tent1": new tent_1(event.getID());break;
case "GraveStone": new graveStone(event.getID());break;
case "Camera": new camera(event.getID());break;
case "Log": new log(event.getID());break;
case "Catapult":event.getID().setFunctionObject(new Catapult(event.getID()));break;
case "Barrels": event.getID().setFunctionObject(new barrels(event.getID()));break;
case "WaxCandle": event.getID().setFunctionObject(new WaxCandle(event.getID()));break;
case "Lantern": event.getID().setFunctionObject(new WaxCandle(event.getID()));break;
case "Fence": event.getID().setFunctionObject(new fance(event.getID()));break;
case "Trunk": event.getID().setFunctionObject(new Trunk(event.getID()));break;
case "Sunshade": event.getID().setFunctionObject(new sunshade(event.getID()));break;
case "Hammock": event.getID().setFunctionObject(new hammock(event.getID()));break;
case "Crossbow": event.getID().setFunctionObject(new Crossbow(event.getID()));break;
case "Tent1": event.getID().setFunctionObject(new tent_1(event.getID()));break;
case "GraveStone": event.getID().setFunctionObject(new graveStone(event.getID()));break;
case "Camera": event.getID().setFunctionObject(new camera(event.getID()));break;
case "Log": event.getID().setFunctionObject(new log(event.getID()));break;
default:break;
}
}

View File

@ -6,36 +6,26 @@ import java.util.List;
import java.util.Random;
import org.bukkit.Bukkit;
import org.bukkit.DyeColor;
import org.bukkit.EntityEffect;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.block.data.BlockData;
import org.bukkit.entity.Creeper;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.FallingBlock;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.entity.Sheep;
import org.bukkit.entity.TNTPrimed;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityChangeBlockEvent;
import org.bukkit.event.entity.EntityExplodeEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import org.bukkit.util.EulerAngle;
import org.bukkit.util.Vector;
import de.Ste3et_C0st.Furniture.Main.main;
import de.Ste3et_C0st.FurnitureLib.NBT.CraftItemStack;
import de.Ste3et_C0st.FurnitureLib.NBT.NBTTagCompound;
import de.Ste3et_C0st.FurnitureLib.ShematicLoader.Events.ProjectClickEvent;
import de.Ste3et_C0st.FurnitureLib.main.FurnitureHelper;
import de.Ste3et_C0st.FurnitureLib.main.FurnitureLib;
import de.Ste3et_C0st.FurnitureLib.main.ObjectID;
@ -99,25 +89,25 @@ public class Catapult extends FurnitureHelper implements Listener{
}
}
@EventHandler
public void FurnitureClickEvent(ProjectClickEvent e){
@Override
public void onClick(Player player){
if(getObjID() == null) return;
if(e.getID()==null) return;
if(!e.getID().equals(getObjID())) return;
if(e.getID().getSQLAction().equals(SQLAction.REMOVE)) return;
if(getObjID().getSQLAction().equals(SQLAction.REMOVE)) return;
if(player == null) return;
if(canBuild(player)) {
Location loc = getRelative(getCenter(), getBlockFace(), -.8, -1.03).add(0, -.2, 0);
loc.setYaw(getYaw());
ItemStack stack = e.getPlayer().getInventory().getItemInMainHand();
ItemStack stack = player.getInventory().getItemInMainHand();
if(stack.getType().equals(Material.TNT)){
TNTPrimed tnt = (TNTPrimed) e.getID().getWorld().spawnEntity(loc, EntityType.PRIMED_TNT);
TNTPrimed tnt = (TNTPrimed) getWorld().spawnEntity(loc, EntityType.PRIMED_TNT);
if(tnt == null) return;
Vector v= getLaunchVector(getBlockFace());
if(v == null) return;
tnt.playEffect(EntityEffect.WITCH_MAGIC);
tnt.setVelocity(v.multiply(1));
fallingSandList.put(tnt, e.getPlayer());
fallingSandList.put(tnt, player);
}else if(stack.getType().equals(Material.AIR)){
setRange(e.getPlayer());
setRange(player);
return;
}else{
// if(stack.getType().isBlock()){
@ -166,11 +156,22 @@ public class Catapult extends FurnitureHelper implements Listener{
// ex.printStackTrace();
// }
// }else{
setRange(e.getPlayer());
setRange(player);
return;
// }
}
consumeItem(e.getPlayer());
consumeItem(player);
}
}
@Override
public void onBreak(Player player) {
if(getObjID() == null) return;
if(getObjID().getSQLAction().equals(SQLAction.REMOVE)) return;
if(player == null) return;
if(canBuild(player)) {
this.destroy(player);
}
}
public void setRange(Player p){

View File

@ -2,7 +2,6 @@ package de.Ste3et_C0st.Furniture.Objects.RPG;
import java.util.Random;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Sound;
@ -12,45 +11,41 @@ import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.entity.SpectralArrow;
import org.bukkit.entity.TippedArrow;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.inventory.ItemStack;
import org.bukkit.util.Vector;
import de.Ste3et_C0st.Furniture.Main.main;
import de.Ste3et_C0st.FurnitureLib.ShematicLoader.Events.ProjectClickEvent;
import de.Ste3et_C0st.FurnitureLib.main.FurnitureHelper;
import de.Ste3et_C0st.FurnitureLib.main.ObjectID;
import de.Ste3et_C0st.FurnitureLib.main.Type.SQLAction;
import de.Ste3et_C0st.FurnitureLib.main.entity.fEntity;
public class Crossbow extends FurnitureHelper implements Listener {
public class Crossbow extends FurnitureHelper {
public Crossbow(ObjectID id){
super(id);
Bukkit.getPluginManager().registerEvents(this, main.instance);
}
@EventHandler
public void onFurnitureClick(ProjectClickEvent e) {
if(e.getID() == null || getObjID() == null) return;
if(getObjID().getSQLAction().equals(SQLAction.REMOVE)){return;}
if(!e.getID().equals(getObjID())) return;
if(!e.canBuild()){return;}
@Override
public void onClick(Player player){
if(getObjID() == null) return;
if(getObjID().getSQLAction().equals(SQLAction.REMOVE)) return;
if(player == null) return;
if(canBuild(player)) {
fEntity stand = getArmorStand();
if(stand==null){return;}
ItemStack is = e.getPlayer().getInventory().getItemInMainHand();
ItemStack is = player.getInventory().getItemInMainHand();
if(is!=null&& (is.getType().equals(Material.ARROW) || is.getType().equals(Material.SPECTRAL_ARROW) || is.getType().equals(Material.TIPPED_ARROW)) ){
if(!hasArrow()){
fEntity entity = getArmorStand();
entity.setItemInMainHand(is.clone());
update();
consumeItem(e.getPlayer());
consumeItem(player);
return;
}
}
if(hasArrow()){
spawnArrow(getArrow().getType(), e.getPlayer());
spawnArrow(getArrow().getType(), player);
}
}
}
@ -132,4 +127,14 @@ public class Crossbow extends FurnitureHelper implements Listener {
}
return false;
}
@Override
public void onBreak(Player player) {
if(getObjID() == null) return;
if(getObjID().getSQLAction().equals(SQLAction.REMOVE)) return;
if(player == null) return;
if(canBuild(player)) {
this.destroy(player);
}
}
}

View File

@ -3,8 +3,6 @@ package de.Ste3et_C0st.Furniture.Objects.RPG;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Effect;
@ -14,7 +12,6 @@ import org.bukkit.Sound;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.inventory.ClickType;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.event.inventory.InventoryCloseEvent;
import org.bukkit.inventory.Inventory;
@ -23,8 +20,6 @@ import org.bukkit.inventory.meta.ItemMeta;
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.main.Furniture;
import de.Ste3et_C0st.FurnitureLib.main.ObjectID;
import de.Ste3et_C0st.FurnitureLib.main.Type.BodyPart;
@ -61,9 +56,9 @@ public class Guillotine extends Furniture implements Listener{
public Guillotine(ObjectID id) {
super(id);
if(isFinish()){
Bukkit.getPluginManager().registerEvents(this, main.getInstance());
setDefault();
initializeInventory();
Bukkit.getPluginManager().registerEvents(this, main.getInstance());
return;
}
spawn(id.getStartLocation());
@ -299,13 +294,12 @@ public class Guillotine extends Furniture implements Listener{
return true;
}
@EventHandler
public void onFurnitureBreak(FurnitureBreakEvent e) {
if(e.getID() == null || getObjID() == null) return;
if(getObjID().getSQLAction().equals(SQLAction.REMOVE)){return;}
if(!e.getID().equals(getObjID())){return;}
if(!e.canBuild()){return;}
if(!isRunning()){
@Override
public void onBreak(Player player) {
if(getObjID() == null) return;
if(getObjID().getSQLAction().equals(SQLAction.REMOVE)) return;
if(player == null) return;
if(canBuild(player)) {
if(canDrop(packet1.getHelmet())){getWorld().dropItem(getLocation(), packet1.getHelmet());}
if(canDrop(packet1.getChestPlate())){getWorld().dropItem(getLocation(), packet1.getChestPlate());}
if(canDrop(packet1.getLeggings())){getWorld().dropItem(getLocation(), packet1.getLeggings());}
@ -322,24 +316,20 @@ public class Guillotine extends Furniture implements Listener{
im.setDisplayName(packet1.getName());
getWorld().dropItem(getLocation(), is);
}
this.getObjID().remove(e.getPlayer());
getManager().remove(getObjID());
delete();
this.destroy(player);
}
}
@EventHandler
public void onFurnitureClick(FurnitureClickEvent e) {
if(e.getID() == null || getObjID() == null) return;
if(getObjID().getSQLAction().equals(SQLAction.REMOVE)){return;}
if(!e.getID().equals(getObjID())){return;}
if(!e.canBuild()){return;}
Player p = e.getPlayer();
if(!getLib().canBuild(e.getPlayer(), getObjID(), EventType.INTERACT)){return;}
if(p.isSneaking()){
@Override
public void onClick(Player player){
if(getObjID() == null) return;
if(getObjID().getSQLAction().equals(SQLAction.REMOVE)) return;
if(player == null) return;
if(canBuild(player)) {
if(!getLib().canBuild(player, getObjID(), EventType.INTERACT)){return;}
if(player.isSneaking()){
if(isFinish){return;}
p.openInventory(invI);
player.openInventory(invI);
for(int i = 0; i<9;i++){invI.setItem(i, pane);}
ItemStack is = new ItemStack(Material.ZOMBIE_HEAD);
@ -353,7 +343,7 @@ public class Guillotine extends Furniture implements Listener{
im.setDisplayName("§cOblation");
is.setItemMeta(im);
invI.setItem(6, is);
this.p = p;
this.p = player;
}else{
if(isRunning()){return;}
if(canStart()&&!isFinish){
@ -363,6 +353,7 @@ public class Guillotine extends Furniture implements Listener{
}
}
}
}
@EventHandler
private void onClick(InventoryClickEvent e){

View File

@ -9,16 +9,10 @@ import org.bukkit.GameMode;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.util.EulerAngle;
import de.Ste3et_C0st.Furniture.Main.main;
import de.Ste3et_C0st.FurnitureLib.Events.FurnitureBlockBreakEvent;
import de.Ste3et_C0st.FurnitureLib.Events.FurnitureBlockClickEvent;
import de.Ste3et_C0st.FurnitureLib.Events.FurnitureBreakEvent;
import de.Ste3et_C0st.FurnitureLib.Events.FurnitureClickEvent;
import de.Ste3et_C0st.FurnitureLib.main.Furniture;
import de.Ste3et_C0st.FurnitureLib.main.ObjectID;
import de.Ste3et_C0st.FurnitureLib.main.Type.BodyPart;
@ -26,14 +20,13 @@ import de.Ste3et_C0st.FurnitureLib.main.Type.SQLAction;
import de.Ste3et_C0st.FurnitureLib.main.entity.fArmorStand;
import de.Ste3et_C0st.FurnitureLib.main.entity.fEntity;
public class flag extends Furniture implements Listener {
public class flag extends Furniture {
public flag(ObjectID id){
super(id);
setBlock();
if(isFinish()){
setState(3, getStand());
Bukkit.getPluginManager().registerEvents(this, main.getInstance());
return;
}
spawn(id.getStartLocation());
@ -127,70 +120,31 @@ public class flag extends Furniture implements Listener {
update();
}
@EventHandler
public void onFurnitureBreak(FurnitureBreakEvent e) {
if(e.getID() == null || getObjID() == null) return;
if(getObjID().getSQLAction().equals(SQLAction.REMOVE)){return;}
if(e.getID() == null || getObjID() == null) return;
if(!e.getID().equals(getObjID())){return;}
if(!e.canBuild()){return;}
delete();
e.remove();
@Override
public void onBreak(Player player) {
if(getObjID() == null) return;
if(getObjID().getSQLAction().equals(SQLAction.REMOVE)) return;
if(player == null) return;
if(canBuild(player)) {
this.destroy(player);
}
}
@EventHandler
public void onFurnitureClick(FurnitureClickEvent e) {
if(e.getID() == null || getObjID() == null) return;
if(getObjID().getSQLAction().equals(SQLAction.REMOVE)){return;}
if(!e.getID().equals(getObjID())){return;}
if(!e.canBuild()){return;}
if(e.getPlayer().getInventory().getItemInMainHand()!=null&&e.getPlayer().getInventory().getItemInMainHand().getType()!=null){
if(e.getPlayer().getInventory().getItemInMainHand().getType().name().contains("_BANNER")){
getStand().setHelmet(e.getPlayer().getInventory().getItemInMainHand());update();
if(e.getPlayer().getGameMode().equals(GameMode.CREATIVE) && getLib().useGamemode()) return;
Integer i = e.getPlayer().getInventory().getHeldItemSlot();
ItemStack is = e.getPlayer().getInventory().getItemInMainHand();
@Override
public void onClick(Player player){
if(getObjID() == null) return;
if(getObjID().getSQLAction().equals(SQLAction.REMOVE)) return;
if(player == null) return;
if(canBuild(player)) {
if(player.getInventory().getItemInMainHand()!=null&&player.getInventory().getItemInMainHand().getType()!=null){
if(player.getInventory().getItemInMainHand().getType().name().contains("_BANNER")){
getStand().setHelmet(player.getInventory().getItemInMainHand());update();
if(player.getGameMode().equals(GameMode.CREATIVE) && getLib().useGamemode()) return;
Integer i = player.getInventory().getHeldItemSlot();
ItemStack is = player.getInventory().getItemInMainHand();
is.setAmount(is.getAmount()-1);
e.getPlayer().getInventory().setItem(i, is);
e.getPlayer().updateInventory();
return;
}
}
int state = getState();
switch (state) {
case 3:state=2;break;
case 2:state=1;break;
case 1:state=3;break;
}
setState(state, getStand());
}
@EventHandler
public void onFurnitureBreak(FurnitureBlockBreakEvent e) {
if(e.getID() == null || getObjID() == null) return;
if(getObjID().getSQLAction().equals(SQLAction.REMOVE)){return;}
if(!e.getID().equals(getObjID())){return;}
if(!e.canBuild()){return;}
delete();
e.remove();
}
@EventHandler
public void onFurnitureClick(FurnitureBlockClickEvent e) {
if(e.getID() == null || getObjID() == null) return;
if(getObjID().getSQLAction().equals(SQLAction.REMOVE)){return;}
if(!e.getID().equals(getObjID())){return;}
if(!e.canBuild()){return;}
if(e.getPlayer().getInventory().getItemInMainHand()!=null&&e.getPlayer().getInventory().getItemInMainHand().getType()!=null){
if(e.getPlayer().getInventory().getItemInMainHand().getType().name().contains("_BANNER")){
getStand().setHelmet(e.getPlayer().getInventory().getItemInMainHand());update();
if(e.getPlayer().getGameMode().equals(GameMode.CREATIVE) && getLib().useGamemode()) return;
Integer i = e.getPlayer().getInventory().getHeldItemSlot();
ItemStack is = e.getPlayer().getInventory().getItemInMainHand();
is.setAmount(is.getAmount()-1);
e.getPlayer().getInventory().setItem(i, is);
e.getPlayer().updateInventory();
player.getInventory().setItem(i, is);
player.updateInventory();
return;
}
}
@ -204,3 +158,4 @@ public class flag extends Furniture implements Listener {
setState(state, getStand());
}
}
}

View File

@ -10,6 +10,7 @@ import org.bukkit.Material;
import org.bukkit.block.BlockFace;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.event.inventory.InventoryCloseEvent;
import org.bukkit.inventory.Inventory;
@ -18,8 +19,6 @@ import org.bukkit.inventory.meta.ItemMeta;
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.main.Furniture;
import de.Ste3et_C0st.FurnitureLib.main.ObjectID;
import de.Ste3et_C0st.FurnitureLib.main.Type.BodyPart;
@ -27,7 +26,7 @@ import de.Ste3et_C0st.FurnitureLib.main.Type.SQLAction;
import de.Ste3et_C0st.FurnitureLib.main.entity.fArmorStand;
import de.Ste3et_C0st.FurnitureLib.main.entity.fEntity;
public class weaponStand extends Furniture {
public class weaponStand extends Furniture implements Listener{
List<Integer> slotList1 = Arrays.asList(6,11,14,16,19,21,24,29,32,34,42);
List<Integer> slotList2 = Arrays.asList(20, 15, 33);
@ -51,13 +50,15 @@ public class weaponStand extends Furniture {
Player p = null;
Inventory inv = null;
@EventHandler
public void onFurnitureBreak(FurnitureBreakEvent e) {
if(e.getID() == null || getObjID() == null) return;
if(!e.getID().equals(getObjID())){return;}
if(!e.canBuild()){return;}
@Override
public void onBreak(Player player) {
if(getObjID() == null) return;
if(getObjID().getSQLAction().equals(SQLAction.REMOVE)) return;
if(player == null) return;
if(canBuild(player)) {
if(p!=null){
p.closeInventory();
inv = null;
}
List<fEntity> asList = getManager().getfArmorStandByObjectID(getObjID());
for(fEntity packet : asList){
@ -69,26 +70,24 @@ public class weaponStand extends Furniture {
}
}
}
e.remove();
inv = null;
delete();
this.destroy(player);
}
}
@EventHandler
public void onFurnitureClick(FurnitureClickEvent e) {
if(e.getID() == null || getObjID() == null) return;
if(getObjID().getSQLAction().equals(SQLAction.REMOVE)){return;}
if(p!=null){return;}
if(!e.getID().equals(getObjID())){return;}
if(!e.canBuild()){return;}
this.p = e.getPlayer();
@Override
public void onClick(Player player){
if(getObjID() == null) return;
if(getObjID().getSQLAction().equals(SQLAction.REMOVE)) return;
if(player == null) return;
if(canBuild(player)) {
this.p = player;
ItemStack itemstack = p.getInventory().getItemInMainHand();
if(itemstack!=null&&matList.contains(itemstack.getType())){
for(fEntity packet : getManager().getfArmorStandByObjectID(getObjID())){
if(packet.getInventory().getHelmet()!=null){
if(packet.getInventory().getHelmet().getType().name().toLowerCase().endsWith("gate")){
ItemStack itemStack = new ItemStack(itemstack.getType(), 1, (short) 0);
ItemStack itemStack = new ItemStack(itemstack.getType(), 1);
packet.getInventory().setHelmet(itemStack);
}
}
@ -133,6 +132,7 @@ public class weaponStand extends Furniture {
this.p.openInventory(inv);
this.p.updateInventory();
}
}
@EventHandler
private void onClick(InventoryClickEvent e){

View File

@ -6,21 +6,18 @@ import java.util.List;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
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.main.Furniture;
import de.Ste3et_C0st.FurnitureLib.main.ObjectID;
import de.Ste3et_C0st.FurnitureLib.main.Type.SQLAction;
import de.Ste3et_C0st.FurnitureLib.main.entity.fArmorStand;
import de.Ste3et_C0st.FurnitureLib.main.entity.fEntity;
public class TrashCan extends Furniture implements Listener {
public class TrashCan extends Furniture{
public TrashCan(ObjectID id){
super(id);
@ -31,23 +28,23 @@ public class TrashCan extends Furniture implements Listener {
spawn(id.getStartLocation());
}
@EventHandler
public void onFurnitureBreak(FurnitureBreakEvent e) {
if(e.getID() == null || getObjID() == null) return;
if(getObjID().getSQLAction().equals(SQLAction.REMOVE)){return;}
if(!e.getID().equals(getObjID())) return;
if(!e.canBuild()){return;}
e.remove();
delete();
@Override
public void onBreak(Player player) {
if(getObjID() == null) return;
if(getObjID().getSQLAction().equals(SQLAction.REMOVE)) return;
if(player == null) return;
if(canBuild(player)) {
this.destroy(player);
}
}
@EventHandler
public void onFurnitureClick(FurnitureClickEvent e) {
if(e.getID() == null || getObjID() == null) return;
if(getObjID().getSQLAction().equals(SQLAction.REMOVE)){return;}
if(!e.getID().equals(getObjID())) return;
if(!e.canBuild()){return;}
ItemStack is = e.getPlayer().getInventory().getItemInMainHand();
@Override
public void onClick(Player player){
if(getObjID() == null) return;
if(getObjID().getSQLAction().equals(SQLAction.REMOVE)) return;
if(player == null) return;
if(canBuild(player)) {
ItemStack is = player.getInventory().getItemInMainHand();
fEntity stand = null;
for(fEntity s : getfAsList()){
if(s.getName().equalsIgnoreCase("#TRASH#")){
@ -64,11 +61,12 @@ public class TrashCan extends Furniture implements Listener {
}
}
stand.setItemInMainHand(is);
e.getPlayer().getInventory().clear(e.getPlayer().getInventory().getHeldItemSlot());
e.getPlayer().updateInventory();
player.getInventory().clear(player.getInventory().getHeldItemSlot());
player.updateInventory();
update();
return;
}
}
@Override
public void spawn(Location loc) {

View File

@ -38,8 +38,6 @@ import org.bukkit.util.io.BukkitObjectOutputStream;
import org.yaml.snakeyaml.external.biz.base64Coder.Base64Coder;
import de.Ste3et_C0st.Furniture.Objects.garden.config;
import de.Ste3et_C0st.FurnitureLib.Events.FurnitureBreakEvent;
import de.Ste3et_C0st.FurnitureLib.Events.FurnitureClickEvent;
import de.Ste3et_C0st.FurnitureLib.main.Furniture;
import de.Ste3et_C0st.FurnitureLib.main.ObjectID;
import de.Ste3et_C0st.FurnitureLib.main.Type.SQLAction;
@ -79,38 +77,38 @@ public class AdventCalender extends Furniture implements Listener {
spawn(id.getStartLocation());
}
@EventHandler
public void onFurnitureBreak(FurnitureBreakEvent e) {
if(e.getID() == null || getObjID() == null) return;
if(getObjID().getSQLAction().equals(SQLAction.REMOVE)){return;}
if(!e.getID().equals(getObjID())){return;}
if(!canBuild(e.getPlayer())){return;}
e.remove(true,false);
delete();
@Override
public void onBreak(Player player) {
if(getObjID() == null) return;
if(getObjID().getSQLAction().equals(SQLAction.REMOVE)) return;
if(player == null) return;
if(canBuild(player)) {
this.destroy(player);
}
}
@EventHandler
public void onFurnitureClick(FurnitureClickEvent e) {
if(e.getID() == null || getObjID() == null) return;
if(getObjID().getSQLAction().equals(SQLAction.REMOVE)){return;}
if(!e.getID().equals(getObjID())){return;}
ItemStack is = e.getPlayer().getInventory().getItemInMainHand();
if(is==null){open(e.getPlayer()); return;}
if(is.getType()==null){open(e.getPlayer()); return;}
@Override
public void onClick(Player player){
if(getObjID() == null) return;
if(getObjID().getSQLAction().equals(SQLAction.REMOVE)) return;
if(player == null) return;
ItemStack is = player.getInventory().getItemInMainHand();
if(is==null){open(player); return;}
if(is.getType()==null){open(player); return;}
if(is.getType().equals(Material.ARROW)){
if(p!=null){open(e.getPlayer());return;}
if(!getObjID().getUUID().equals(e.getPlayer().getUniqueId())){open(e.getPlayer());return;}
if(!canBuild(e.getPlayer())){return;}
if(p!=null){open(player);return;}
if(!getObjID().getUUID().equals(player.getUniqueId())){open(player);return;}
if(!canBuild(player)){return;}
i = is.getAmount();
if(i>31 || i<1) return;
this.p = e.getPlayer();
this.p = player;
if(isList.containsKey(i)){
openInventory(isList.get(i));
}else{
openInventory(null);
}
}else{
open(e.getPlayer());
open(player);
}
}

View File

@ -7,20 +7,17 @@ import java.util.List;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.util.EulerAngle;
import de.Ste3et_C0st.FurnitureLib.Events.FurnitureBreakEvent;
import de.Ste3et_C0st.FurnitureLib.Events.FurnitureClickEvent;
import de.Ste3et_C0st.FurnitureLib.main.Furniture;
import de.Ste3et_C0st.FurnitureLib.main.ObjectID;
import de.Ste3et_C0st.FurnitureLib.main.Type.SQLAction;
import de.Ste3et_C0st.FurnitureLib.main.entity.fArmorStand;
import de.Ste3et_C0st.FurnitureLib.main.entity.fEntity;
public class AdventWreath extends Furniture implements Listener {
public class AdventWreath extends Furniture {
double sub = .9;
List<Location> locationList = Arrays.asList(
@ -40,34 +37,36 @@ public class AdventWreath extends Furniture implements Listener {
spawn(id.getStartLocation());
}
@EventHandler
public void onFurnitureBreak(FurnitureBreakEvent e) {
if(e.getID() == null || getObjID() == null) return;
if(getObjID().getSQLAction().equals(SQLAction.REMOVE)){return;}
if(!e.getID().equals(getObjID())){return;}
if(!canBuild(e.getPlayer())){return;}
e.remove(true,false);
delete();
@Override
public void onBreak(Player player) {
if(getObjID() == null) return;
if(getObjID().getSQLAction().equals(SQLAction.REMOVE)) return;
if(player == null) return;
if(canBuild(player)) {
this.destroy(player);
}
}
@EventHandler
public void onFurnitureClick(FurnitureClickEvent e) {
if(e.getID() == null || getObjID() == null) return;
if(!e.getID().equals(getObjID())){return;}
if(!e.canBuild()){return;}
fArmorStand stand = (fArmorStand) e.getfEntity();
String str = stand.getName();
if(str.startsWith("Fire") || str.startsWith("Torch")){
int i = Integer.parseInt(str.split(":")[1]);
for(fEntity fstand : getfAsList()){
if(fstand.getName().equalsIgnoreCase("Fire:" + i)){
if(!fstand.getName().endsWith("Burn")){
fstand.sendParticle(fstand.getLocation().clone().add(0, .93, 0), 26, true);
fstand.setName("Fire:" + i + ":Burn");
update();
}
}
}
@Override
public void onClick(Player player){
if(getObjID() == null) return;
if(getObjID().getSQLAction().equals(SQLAction.REMOVE)) return;
if(player == null) return;
if(canBuild(player)) {
// fArmorStand stand = (fArmorStand) e.getfEntity();
// String str = stand.getName();
// if(str.startsWith("Fire") || str.startsWith("Torch")){
// int i = Integer.parseInt(str.split(":")[1]);
// for(fEntity fstand : getfAsList()){
// if(fstand.getName().equalsIgnoreCase("Fire:" + i)){
// if(!fstand.getName().endsWith("Burn")){
// fstand.sendParticle(fstand.getLocation().clone().add(0, .93, 0), 26, true);
// fstand.setName("Fire:" + i + ":Burn");
// update();
// }
// }
// }
// }
}
}
@ -150,18 +149,18 @@ public class AdventWreath extends Furniture implements Listener {
stand.setRightArmPose(getLutil().degresstoRad(new EulerAngle(-41,-37.5f,18)));
stand.setSmall(true);
stand.setName("Torch:" + i);
stand.setHelmet(new ItemStack(Material.LEVER, 1, (short) 13));
stand.setHelmet(new ItemStack(Material.LEVER, 1));
asList.add(stand);
y=y+90;
}
ItemStack is = new ItemStack(Material.POPPY, 1, (short) 8);
ItemStack is = new ItemStack(Material.POPPY, 1);
spawnFlower(getRelative(getCenter().subtract(0, .7, 0), getLutil().yawToFace(0), .5, .5), is);
spawnFlower(getRelative(getCenter().subtract(0, .7, 0), getLutil().yawToFace(0), -.5, -.5), is);
spawnFlower(getRelative(getCenter().subtract(0, .7, 0), getLutil().yawToFace(0), -.5, .5), is);
spawnFlower(getRelative(getCenter().subtract(0, .7, 0), getLutil().yawToFace(0), .5, -.5), is);
is = new ItemStack(Material.POPPY, 1, (short) 4);
is = new ItemStack(Material.POPPY, 1);
spawnFlower(getRelative(getCenter().subtract(0, .7, 0), getLutil().yawToFace(0), .25, .25), is);
spawnFlower(getRelative(getCenter().subtract(0, .7, 0), getLutil().yawToFace(0), -.25, -.25), is);
spawnFlower(getRelative(getCenter().subtract(0, .7, 0), getLutil().yawToFace(0), -.25, .25), is);

View File

@ -11,14 +11,11 @@ import org.bukkit.Material;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Firework;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.FireworkMeta;
import org.bukkit.util.EulerAngle;
import de.Ste3et_C0st.FurnitureLib.Events.FurnitureBreakEvent;
import de.Ste3et_C0st.FurnitureLib.Events.FurnitureClickEvent;
import de.Ste3et_C0st.FurnitureLib.main.Furniture;
import de.Ste3et_C0st.FurnitureLib.main.ObjectID;
import de.Ste3et_C0st.FurnitureLib.main.Type.SQLAction;
@ -36,12 +33,12 @@ public class FireworkLauncher extends Furniture implements Listener {
spawn(id.getStartLocation());
}
@EventHandler
public void onFurnitureBreak(FurnitureBreakEvent e) {
if(e.getID() == null || getObjID() == null) return;
if(getObjID().getSQLAction().equals(SQLAction.REMOVE)){return;}
if(!e.getID().equals(getObjID())){return;}
if(!canBuild(e.getPlayer())){return;}
@Override
public void onBreak(Player player) {
if(getObjID() == null) return;
if(getObjID().getSQLAction().equals(SQLAction.REMOVE)) return;
if(player == null) return;
if(canBuild(player)) {
for(fEntity packet : getManager().getfArmorStandByObjectID(getObjID())){
if(packet.getName().equalsIgnoreCase("#FIREWORK#")){
if(packet.getInventory().getItemInMainHand()!=null&&!packet.getInventory().getItemInMainHand().getType().equals(Material.AIR)){
@ -50,17 +47,16 @@ public class FireworkLauncher extends Furniture implements Listener {
}
}
}
e.remove(true,true);
delete();
this.destroy(player);
}
}
@EventHandler
public void onFurnitureClick(FurnitureClickEvent e) {
if(e.getID() == null || getObjID() == null) return;
if(getObjID().getSQLAction().equals(SQLAction.REMOVE)){return;}
if(!e.getID().equals(getObjID())){return;}
if(!canBuild(e.getPlayer())){return;}
Player p = e.getPlayer();
@Override
public void onClick(Player player){
if(getObjID() == null) return;
if(getObjID().getSQLAction().equals(SQLAction.REMOVE)) return;
if(player == null) return;
if(canBuild(player)) {
fEntity stand = null;
for(fEntity st : getfAsList()){
if(st.getName().equalsIgnoreCase("#FIREWORK#")){
@ -69,11 +65,11 @@ public class FireworkLauncher extends Furniture implements Listener {
}
}
if(stand == null) return;
if(p.getInventory().getItemInMainHand()!=null){
if(p.getInventory().getItemInMainHand().getType()!=null){
if(p.getInventory().getItemInMainHand().getType().equals(Material.FIREWORK_ROCKET)){
if(player.getInventory().getItemInMainHand()!=null){
if(player.getInventory().getItemInMainHand().getType()!=null){
if(player.getInventory().getItemInMainHand().getType().equals(Material.FIREWORK_ROCKET)){
drop(stand);
setItem(stand, p.getInventory().getItemInMainHand());
setItem(stand, player.getInventory().getItemInMainHand());
Bukkit.getScheduler().runTaskLater(getPlugin(), new Runnable() {
@ -84,12 +80,12 @@ public class FireworkLauncher extends Furniture implements Listener {
}
}, 5);
if(e.getPlayer().getGameMode().equals(GameMode.CREATIVE) && getLib().useGamemode()) return;
Integer i = e.getPlayer().getInventory().getHeldItemSlot();
ItemStack is = e.getPlayer().getInventory().getItemInMainHand();
if(player.getGameMode().equals(GameMode.CREATIVE) && getLib().useGamemode()) return;
Integer i = player.getInventory().getHeldItemSlot();
ItemStack is = player.getInventory().getItemInMainHand();
is.setAmount(is.getAmount()-1);
p.getInventory().setItem(i, is);
p.updateInventory();
player.getInventory().setItem(i, is);
player.updateInventory();
return;
}
}
@ -102,6 +98,7 @@ public class FireworkLauncher extends Furniture implements Listener {
setItem(stand, new ItemStack(Material.AIR));
}
}
}
public double getRandom(double min, double max){
return ThreadLocalRandom.current().nextDouble(min, max);

View File

@ -8,14 +8,13 @@ import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
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;
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.main.Furniture;
import de.Ste3et_C0st.FurnitureLib.main.ObjectID;
import de.Ste3et_C0st.FurnitureLib.main.Type.BodyPart;
@ -93,16 +92,16 @@ public class billboard extends Furniture implements Listener{
Bukkit.getPluginManager().registerEvents(this, getPlugin());
}
@EventHandler
public void onFurnitureBreak(FurnitureBreakEvent e) {
if(e.getID() == null || getObjID() == null) return;
if(getObjID().getSQLAction().equals(SQLAction.REMOVE)){return;}
if(!e.getID().equals(getObjID())){return;}
if(!canBuild(e.getPlayer())){return;}
e.remove();
delete();
@Override
public void onBreak(Player player) {
if(getObjID() == null) return;
if(getObjID().getSQLAction().equals(SQLAction.REMOVE)) return;
if(player == null) return;
if(canBuild(player)) {
this.destroy(player);
}
}
@EventHandler
public void onFurnitureClick(FurnitureClickEvent e) {}
@Override
public void onClick(Player p) {}
}

View File

@ -4,17 +4,16 @@ import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.map.MapView;
import de.Ste3et_C0st.Furniture.Camera.Utils.RenderClass;
import de.Ste3et_C0st.Furniture.Camera.Utils.RenderClass.ScaleMode;
import de.Ste3et_C0st.Furniture.Main.main;
import de.Ste3et_C0st.FurnitureLib.ShematicLoader.Events.ProjectClickEvent;
import de.Ste3et_C0st.FurnitureLib.Utilitis.Relative;
import de.Ste3et_C0st.FurnitureLib.main.FurnitureHelper;
import de.Ste3et_C0st.FurnitureLib.main.ObjectID;
import de.Ste3et_C0st.FurnitureLib.main.Type.SQLAction;
import de.Ste3et_C0st.FurnitureLib.main.entity.fEntity;
public class camera extends FurnitureHelper implements Listener{
@ -66,19 +65,29 @@ public class camera extends FurnitureHelper implements Listener{
update();
}
@Override
public void onBreak(Player player) {
if(getObjID() == null) return;
if(getObjID().getSQLAction().equals(SQLAction.REMOVE)) return;
if(player == null) return;
if(canBuild(player)) {
this.destroy(player);
}
}
@SuppressWarnings("deprecation")
@EventHandler
public void onFurnitureClick(ProjectClickEvent e) {
if(!e.getID().equals(getObjID())){return;}
Player p = e.getPlayer();
Location pLocation = getLutil().getRelativ(p.getLocation().getBlock().getLocation(), getBlockFace(), -1D, 0D).clone();
@Override
public void onClick(Player player) {
if(getObjID() == null) return;
if(getObjID().getSQLAction().equals(SQLAction.REMOVE)) return;
if(player == null) return;
Location pLocation = getLutil().getRelativ(player.getLocation().getBlock().getLocation(), getBlockFace(), -1D, 0D).clone();
Location locCopy = getLocation().getBlock().getLocation().clone();
pLocation.setYaw(locCopy.getYaw());
if(pLocation.equals(locCopy)){
if(getLutil().yawToFace(p.getLocation().getYaw()).getOppositeFace().equals(getBlockFace())){
if(e.canBuild()){
if(!p.getInventory().getItemInMainHand().getType().equals(Material.FILLED_MAP)){
if(getLutil().yawToFace(player.getLocation().getYaw()).getOppositeFace().equals(getBlockFace())){
if(canBuild(player)){
if(!player.getInventory().getItemInMainHand().getType().equals(Material.FILLED_MAP)){
if(entity == null || entity2 == null)return;
if(this.zoom.equalsIgnoreCase("#ZOOM0#")){
this.mode = ScaleMode.FAR;
@ -98,12 +107,10 @@ public class camera extends FurnitureHelper implements Listener{
update();
return;
}
}else{
if(!p.getInventory().getItemInMainHand().getType().equals(Material.MAP)){
}else if(!player.getInventory().getItemInMainHand().getType().equals(Material.MAP)){
return;
}
}
MapView view = Bukkit.getMap(p.getInventory().getItemInMainHand().getDurability());
MapView view = Bukkit.getMap(player.getInventory().getItemInMainHand().getDurability());
Location l = getLocation().clone();
l.setYaw(getLutil().FaceToYaw(getBlockFace().getOppositeFace()));
view.getRenderers().clear();

View File

@ -8,6 +8,7 @@ import org.bukkit.Location;
import org.bukkit.Material;
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.BlockRedstoneEvent;
@ -16,10 +17,6 @@ import org.bukkit.util.EulerAngle;
import org.bukkit.util.Vector;
import de.Ste3et_C0st.Furniture.Main.main;
import de.Ste3et_C0st.FurnitureLib.Events.FurnitureBlockBreakEvent;
import de.Ste3et_C0st.FurnitureLib.Events.FurnitureBlockClickEvent;
import de.Ste3et_C0st.FurnitureLib.Events.FurnitureBreakEvent;
import de.Ste3et_C0st.FurnitureLib.Events.FurnitureClickEvent;
import de.Ste3et_C0st.FurnitureLib.main.Furniture;
import de.Ste3et_C0st.FurnitureLib.main.FurnitureLib;
import de.Ste3et_C0st.FurnitureLib.main.ObjectID;
@ -125,23 +122,23 @@ public class streetlamp extends Furniture implements Listener{
getObjID().addBlock(blockLocation);
}
@EventHandler
private void onBlockBreak(FurnitureBlockBreakEvent e){
if(e.getID() == null || getObjID() == null) return;
if(!e.getID().equals(getObjID())){return;}
if(getObjID().getSQLAction().equals(SQLAction.REMOVE)){return;}
if(!e.canBuild()){return;}
@Override
public void onBreak(Player player) {
if(getObjID() == null) return;
if(getObjID().getSQLAction().equals(SQLAction.REMOVE)) return;
if(player == null) return;
if(canBuild(player)) {
FurnitureLib.getInstance().getLightManager().removeLight(light);
e.remove();
delete();
this.destroy(player);
}
}
@EventHandler
private void onBlockClick(FurnitureBlockClickEvent e){
if(e.getID() == null || getObjID() == null) return;
if(!e.getID().equals(getObjID())){return;}
if(getObjID().getSQLAction().equals(SQLAction.REMOVE)){return;}
if(!e.canBuild()){return;}
@Override
public void onClick(Player player){
if(getObjID() == null) return;
if(getObjID().getSQLAction().equals(SQLAction.REMOVE)) return;
if(player == null) return;
if(!canBuild(player)) {return;}
if(isOn()){
setLight(false);
}else{
@ -216,32 +213,4 @@ public class streetlamp extends Furniture implements Listener{
}
return false;
}
@EventHandler
public void onFurnitureBreak(FurnitureBreakEvent e) {
if(e.getID() == null || getObjID() == null) return;
if(!e.getID().equals(getObjID())){return;}
if(getObjID().getSQLAction().equals(SQLAction.REMOVE)){return;}
if(!e.canBuild()){return;}
FurnitureLib.getInstance().getLightManager().removeLight(light);
e.remove();
delete();
}
@EventHandler
public void onFurnitureClick(FurnitureClickEvent e) {
if(e.getID() == null || getObjID() == null) return;
if(getObjID().getSQLAction().equals(SQLAction.REMOVE)){return;}
if(!e.getID().equals(getObjID())){return;}
if(!e.canBuild()){return;}
Boolean isOn = isOn();
fEntity packet = getPacket();
if(packet==null) return;
if(redstone) return;
if(isOn){
setLight(false);
}else{
setLight(true);
}
}
}

View File

@ -9,6 +9,7 @@ import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Tag;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockPhysicsEvent;
@ -16,9 +17,6 @@ import org.bukkit.inventory.ItemStack;
import org.bukkit.util.EulerAngle;
import de.Ste3et_C0st.Furniture.Main.main;
import de.Ste3et_C0st.FurnitureLib.Events.FurnitureBlockBreakEvent;
import de.Ste3et_C0st.FurnitureLib.Events.FurnitureBreakEvent;
import de.Ste3et_C0st.FurnitureLib.Events.FurnitureClickEvent;
import de.Ste3et_C0st.FurnitureLib.main.Furniture;
import de.Ste3et_C0st.FurnitureLib.main.ObjectID;
import de.Ste3et_C0st.FurnitureLib.main.Type.SQLAction;
@ -70,24 +68,18 @@ public class TFlowerPot extends Furniture implements Listener {
}
@Override
public void onFurnitureBreak(FurnitureBreakEvent paramFurnitureBreakEvent) {}
public void onClick(Player p) {}
@Override
public void onFurnitureClick(FurnitureClickEvent paramFurnitureClickEvent) {}
@EventHandler
private void BlockBreak(FurnitureBlockBreakEvent e){
if(e.getID() == null || getObjID() == null) return;
if(getObjID().getSQLAction().equals(SQLAction.REMOVE)){return;}
if (pot==null) return;
if (e.getBlock() == null) return;
if (e.getBlock().getLocation() == null) return;
if(!e.getBlock().equals(pot)){return;}
if(!canBuild(e.getPlayer())){return;}
destroy(e.getPlayer());
public void onBreak(Player player) {
if(getObjID() == null) return;
if(getObjID().getSQLAction().equals(SQLAction.REMOVE)) return;
if(player == null) return;
if(canBuild(player)) {
pot.setType(Material.AIR);
pot=null;
return;
this.destroy(player);
}
}
@EventHandler

View File

@ -1,46 +1,55 @@
package de.Ste3et_C0st.Furniture.Objects.garden;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import de.Ste3et_C0st.Furniture.Main.main;
import de.Ste3et_C0st.FurnitureLib.ShematicLoader.Events.ProjectClickEvent;
import de.Ste3et_C0st.FurnitureLib.main.FurnitureHelper;
import de.Ste3et_C0st.FurnitureLib.main.ObjectID;
import de.Ste3et_C0st.FurnitureLib.main.Type.SQLAction;
import de.Ste3et_C0st.FurnitureLib.main.entity.fEntity;
public class Trunk extends FurnitureHelper implements Listener{
public class Trunk extends FurnitureHelper{
public Trunk(ObjectID id){
super(id);
Bukkit.getPluginManager().registerEvents(this, main.instance);
}
@EventHandler
public void onClick(ProjectClickEvent e){
if(!e.getID().equals(getObjID())){return;}
ItemStack stack = e.getPlayer().getInventory().getItemInMainHand();
@Override
public void onClick(Player player){
if(getObjID() == null) return;
if(getObjID().getSQLAction().equals(SQLAction.REMOVE)) return;
if(player == null) return;
ItemStack stack = player.getInventory().getItemInMainHand();
if(stack==null) return;
if(main.materialWhiteList.contains(stack.getType())){
if(stack.getType().equals(Material.AIR)) return;
for(fEntity entity : e.getID().getPacketList()){
for(fEntity entity : getfAsList()){
if(entity.getName().startsWith("#TO")){
entity.setHelmet(stack);
}
}
update();
}else{
for(fEntity entity : e.getID().getPacketList()){
for(fEntity entity : getfAsList()){
if(entity.getName().startsWith("#SITZ:")){
if(entity.getPassanger()==null){
entity.setPassanger(e.getPlayer());
if(entity.getPassanger()==null||entity.getPassanger().isEmpty()){
entity.setPassanger(player);
return;
}
}
}
}
}
@Override
public void onBreak(Player player) {
if(getObjID() == null) return;
if(getObjID().getSQLAction().equals(SQLAction.REMOVE)) return;
if(player == null) return;
if(canBuild(player)) {
this.destroy(player);
}
}
}

View File

@ -3,21 +3,19 @@ package de.Ste3et_C0st.Furniture.Objects.garden;
import java.util.Arrays;
import java.util.List;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import de.Ste3et_C0st.Furniture.Main.main;
import de.Ste3et_C0st.FurnitureLib.ShematicLoader.Events.ProjectClickEvent;
import de.Ste3et_C0st.FurnitureLib.main.FurnitureHelper;
import de.Ste3et_C0st.FurnitureLib.main.ObjectID;
import de.Ste3et_C0st.FurnitureLib.main.Type.SQLAction;
import de.Ste3et_C0st.FurnitureLib.main.entity.fEntity;
public class fance extends FurnitureHelper implements Listener{
public class fance extends FurnitureHelper{
List<Material> matList = Arrays.asList(
Material.SPRUCE_FENCE,
Material.BIRCH_FENCE,
@ -29,27 +27,40 @@ public class fance extends FurnitureHelper implements Listener{
public fance(ObjectID id){
super(id);
Bukkit.getPluginManager().registerEvents(this, main.instance);
}
@EventHandler
public void onClick(ProjectClickEvent e){
if(!e.getID().equals(getObjID())){return;}
@Override
public void onClick(Player player){
if(getObjID() == null) return;
if(getObjID().getSQLAction().equals(SQLAction.REMOVE)) return;
if(player == null) return;
if(canBuild(player)) {
Block b = getWorld().getBlockAt(getObjID().getBlockList().toArray(new Location[getObjID().getBlockList().size()])[0]);
ItemStack stack = e.getPlayer().getInventory().getItemInMainHand();
ItemStack stack = player.getInventory().getItemInMainHand();
if(stack==null) return;
if(stack.getType().equals(Material.AIR)) return;
if(matList.contains(stack.getType())){
b.setType(stack.getType());
consumeItem(e.getPlayer());
consumeItem(player);
return;
}else if(main.materialWhiteList.contains(stack.getType())){
setTypes(stack);
consumeItem(e.getPlayer());
consumeItem(player);
update();
return;
}
}
}
@Override
public void onBreak(Player player) {
if(getObjID() == null) return;
if(getObjID().getSQLAction().equals(SQLAction.REMOVE)) return;
if(player == null) return;
if(canBuild(player)) {
this.destroy(player);
}
}
private void setTypes(ItemStack is){for(fEntity packet : getManager().getfArmorStandByObjectID(getObjID())){packet.getInventory().setHelmet(is);}}
}

View File

@ -11,17 +11,15 @@ import org.bukkit.block.BlockFace;
import org.bukkit.block.BlockState;
import org.bukkit.block.Sign;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.BookMeta;
import de.Ste3et_C0st.Furniture.Main.main;
import de.Ste3et_C0st.FurnitureLib.ShematicLoader.Events.ProjectBreakEvent;
import de.Ste3et_C0st.FurnitureLib.ShematicLoader.Events.ProjectClickEvent;
import de.Ste3et_C0st.FurnitureLib.Utilitis.LocationUtil;
import de.Ste3et_C0st.FurnitureLib.main.FurnitureHelper;
import de.Ste3et_C0st.FurnitureLib.main.ObjectID;
import de.Ste3et_C0st.FurnitureLib.main.Type.SQLAction;
public class graveStone extends FurnitureHelper implements Listener{
@ -61,29 +59,31 @@ public class graveStone extends FurnitureHelper implements Listener{
getObjID().addBlock(Arrays.asList(this.sign));
}
@EventHandler
private void onBlockBreak(ProjectBreakEvent e){
if(e.getID() == null || getObjID() == null) return;
if(!e.getID().equals(getObjID())){return;}
if(!e.canBuild()){return;}
@Override
public void onBreak(Player player) {
if(getObjID() == null) return;
if(getObjID().getSQLAction().equals(SQLAction.REMOVE)) return;
if(player == null) return;
if(canBuild(player)) {
this.destroy(player);
if(sign!=null){
sign.setType(Material.AIR);
}
}
}
@EventHandler
private void onBlockClick(ProjectClickEvent e){
if(e.getID() == null || getObjID() == null) return;
if(!e.getID().equals(getObjID())){return;}
if(!e.canBuild()){return;}
Player p = e.getPlayer();
if(!e.getID().equals(getObjID())) return;
if(!e.canBuild()){return;}
ItemStack is = p.getInventory().getItemInMainHand();
@Override
public void onClick(Player player){
if(getObjID() == null) return;
if(getObjID().getSQLAction().equals(SQLAction.REMOVE)) return;
if(player == null) return;
if(canBuild(player)) {
ItemStack is = player.getInventory().getItemInMainHand();
if (is == null) return;
if (!is.getType().equals(Material.WRITTEN_BOOK)) return;
readFromBook(is);
}
}
public void resetSign(){
Bukkit.getScheduler().scheduleSyncDelayedTask(getPlugin(), new Runnable() {

View File

@ -18,8 +18,6 @@ import org.bukkit.inventory.meta.ItemMeta;
import de.Ste3et_C0st.Furniture.Main.main;
import de.Ste3et_C0st.FurnitureLib.Crafting.Project;
import de.Ste3et_C0st.FurnitureLib.ShematicLoader.Events.ProjectBreakEvent;
import de.Ste3et_C0st.FurnitureLib.ShematicLoader.Events.ProjectClickEvent;
import de.Ste3et_C0st.FurnitureLib.Utilitis.HiddenStringUtils;
import de.Ste3et_C0st.FurnitureLib.Utilitis.ManageInv;
import de.Ste3et_C0st.FurnitureLib.main.FurnitureHelper;
@ -49,11 +47,14 @@ public class log extends FurnitureHelper implements Listener{
setList();
}
@EventHandler
private void onBlockBreak(ProjectBreakEvent e){
if(e.getID() == null || getObjID() == null) return;
if(!e.getID().equals(getObjID())){return;}
if(!e.canBuild()){return;}
@Override
public void onBreak(Player player) {
if(getObjID() == null) return;
if(getObjID().getSQLAction().equals(SQLAction.REMOVE)) return;
if(player == null) return;
if(canBuild(player)) {
this.destroy(player);
}
}
private Project getProjectByItem(ItemStack is){
@ -83,19 +84,20 @@ public class log extends FurnitureHelper implements Listener{
return copy;
}
@EventHandler
private void onBlockBreak(ProjectClickEvent e){
if(e.getID() == null || getObjID() == null) return;
if(!e.getID().equals(getObjID())){return;}
if(!e.canBuild()){return;}
if(e.getPlayer().isSneaking()){
if(e.getPlayer().getInventory().getItemInMainHand().getType().isBlock()&&
!e.getPlayer().getInventory().getItemInMainHand().getType().equals(Material.AIR)){
@Override
public void onClick(Player player){
if(getObjID() == null) return;
if(getObjID().getSQLAction().equals(SQLAction.REMOVE)) return;
if(player == null) return;
if(canBuild(player)) {
if(player.isSneaking()){
if(player.getInventory().getItemInMainHand().getType().isBlock()&&
!player.getInventory().getItemInMainHand().getType().equals(Material.AIR)){
return;
}
openInventory(e.getPlayer());
openInventory(player);
}else{
ItemStack stack = e.getPlayer().getInventory().getItemInMainHand();
ItemStack stack = player.getInventory().getItemInMainHand();
if(stack == null || stack.getType().equals(Material.AIR)){
//dropItem
fEntity entity = entityByCustomName(this.mode + "");
@ -126,13 +128,14 @@ public class log extends FurnitureHelper implements Listener{
ItemStack placeItem = stack.clone();
placeItem.setAmount(1);
entity.getInventory().setItemInMainHand(placeItem);
consumeItem(e.getPlayer());
consumeItem(player);
update();
}
}
}
}
}
}
private void setList(){
ItemStack stack = new ItemStack(Material.WHITE_BANNER);

View File

@ -3,17 +3,15 @@ package de.Ste3et_C0st.Furniture.Objects.garden;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.inventory.ItemStack;
import org.bukkit.util.EulerAngle;
import de.Ste3et_C0st.Furniture.Main.main;
import de.Ste3et_C0st.FurnitureLib.ShematicLoader.Events.ProjectBreakEvent;
import de.Ste3et_C0st.FurnitureLib.ShematicLoader.Events.ProjectClickEvent;
import de.Ste3et_C0st.FurnitureLib.main.FurnitureHelper;
import de.Ste3et_C0st.FurnitureLib.main.ObjectID;
import de.Ste3et_C0st.FurnitureLib.main.Type.BodyPart;
import de.Ste3et_C0st.FurnitureLib.main.Type.SQLAction;
import de.Ste3et_C0st.FurnitureLib.main.entity.fArmorStand;
import de.Ste3et_C0st.FurnitureLib.main.entity.fEntity;
@ -39,13 +37,13 @@ public class sunshade extends FurnitureHelper implements Listener{
}return true;
}
@EventHandler
public void onClick(ProjectClickEvent e){
if(e.getID() == null || getObjID() == null) return;
if(!e.getID().equals(getObjID())){return;}
if(!e.canBuild()){return;}
Player p = e.getPlayer();
ItemStack is = p.getInventory().getItemInMainHand();
@Override
public void onClick(Player player){
if(getObjID() == null) return;
if(getObjID().getSQLAction().equals(SQLAction.REMOVE)) return;
if(player == null) return;
if(canBuild(player)) {
ItemStack is = player.getInventory().getItemInMainHand();
if(is.getType().name().contains("BANNER")){
for(fEntity packet : getfAsList()){
if(packet.getInventory().getHelmet()!=null&&packet.getInventory().getHelmet().getType().name().contains("BANNER")){
@ -57,7 +55,7 @@ public class sunshade extends FurnitureHelper implements Listener{
}
}
update();
consumeItem(p);
consumeItem(player);
}else{
if(!isOpen()){
open();
@ -65,16 +63,17 @@ public class sunshade extends FurnitureHelper implements Listener{
close();
}
}
}
}
@EventHandler
public void onBreak(ProjectBreakEvent e){
if(e.getID() == null || getObjID() == null) return;
if(!e.getID().equals(getObjID())){return;}
if(!e.canBuild()){return;}
if(isRunning){
stopTimer();
@Override
public void onBreak(Player player) {
if(getObjID() == null) return;
if(getObjID().getSQLAction().equals(SQLAction.REMOVE)) return;
if(player == null) return;
if(canBuild(player)) {
this.destroy(player);
if(isRunning) stopTimer();
}
}

View File

@ -10,14 +10,9 @@ import org.bukkit.Location;
import org.bukkit.Material;
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;
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.main.Furniture;
import de.Ste3et_C0st.FurnitureLib.main.ObjectID;
import de.Ste3et_C0st.FurnitureLib.main.Type.BodyPart;
@ -27,7 +22,7 @@ import de.Ste3et_C0st.FurnitureLib.main.Type.SQLAction;
import de.Ste3et_C0st.FurnitureLib.main.entity.fArmorStand;
import de.Ste3et_C0st.FurnitureLib.main.entity.fEntity;
public class largeTable extends Furniture implements Listener{
public class largeTable extends Furniture{
public largeTable(ObjectID id){
super(id);
@ -37,8 +32,6 @@ public class largeTable extends Furniture implements Listener{
tellerIDs.add(packet.getEntityID());
}
}
Bukkit.getPluginManager().registerEvents(this, main.getInstance());
return;
}
spawn(id.getStartLocation());
@ -176,40 +169,38 @@ public class largeTable extends Furniture implements Listener{
}
}
@EventHandler
public void onFurnitureBreak(FurnitureBreakEvent e){
if(e.getID() == null || getObjID() == null) return;
if(getObjID().getSQLAction().equals(SQLAction.REMOVE)){return;}
if(e.getID()==null){return;}
if(!e.getID().equals(getObjID())){return;}
if(!e.canBuild()){return;}
@Override
public void onBreak(Player player) {
if(getObjID() == null) return;
if(getObjID().getSQLAction().equals(SQLAction.REMOVE)) return;
if(player == null) return;
if(canBuild(player)) {
for(Integer id : tellerIDs){
fEntity asp = getManager().getfArmorStandByID(id);
if(asp!=null&&asp.getInventory().getItemInMainHand()!=null){
if(asp.getName().startsWith("#TELLER")){
fEntity packet = asp;
e.getLocation().getWorld().dropItem(e.getLocation(), packet.getInventory().getItemInMainHand());
getWorld().dropItem(getLocation(), packet.getInventory().getItemInMainHand());
}
}
}
e.remove();
delete();
this.destroy(player);
}
}
@EventHandler
public void onFurnitureClick(FurnitureClickEvent e){
if(e.getID() == null || getObjID() == null) return;
if(getObjID().getSQLAction().equals(SQLAction.REMOVE)){return;}
if(e.getID()==null) return;
if(!e.getID().equals(getObjID())){return;}
if(!e.canBuild()){return;}
Player p = e.getPlayer();
if(DyeColor.getDyeColor(p.getInventory().getItemInMainHand().getType()) != null){
getLib().getColorManager().color(p, e.canBuild(), "_STAINED_GLASS_PANE", getObjID(), ColorType.BLOCK, 3);
@Override
public void onClick(Player player){
if(getObjID() == null) return;
if(getObjID().getSQLAction().equals(SQLAction.REMOVE)) return;
if(player == null) return;
if(canBuild(player)) {
if(DyeColor.getDyeColor(player.getInventory().getItemInMainHand().getType()) != null){
getLib().getColorManager().color(player, canBuild(player), "_STAINED_GLASS_PANE", getObjID(), ColorType.BLOCK, 3);
update();
return;
}else{
setTeller(p, p.getInventory().getItemInMainHand());
setTeller(player, player.getInventory().getItemInMainHand());
}
}
}

View File

@ -1,44 +1,29 @@
package de.Ste3et_C0st.Furniture.Objects.light;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockFromToEvent;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import de.Ste3et_C0st.Furniture.Main.main;
import de.Ste3et_C0st.FurnitureLib.ShematicLoader.Events.ProjectClickEvent;
import de.Ste3et_C0st.FurnitureLib.main.FurnitureHelper;
import de.Ste3et_C0st.FurnitureLib.main.ObjectID;
import de.Ste3et_C0st.FurnitureLib.main.Type.SQLAction;
public class WaxCandle extends FurnitureHelper implements Listener{
public class WaxCandle extends FurnitureHelper{
public WaxCandle(ObjectID id){
super(id);
Bukkit.getPluginManager().registerEvents(this, main.instance);
}
@EventHandler
public void onWaterFlow(BlockFromToEvent e){
if(getObjID()==null){return;}
if(getObjID().getSQLAction().equals(SQLAction.REMOVE)){return;}
Location locTo = e.getToBlock().getLocation();
if(getLocation()!=null && getLocation().getChunk().isLoaded()){
if(locTo.equals(getLocation().getBlock().getLocation())) {
e.setCancelled(true);
}
}
}
@EventHandler
public void onClick(ProjectClickEvent e){
if(!e.getID().equals(getObjID())){return;}
@Override
public void onClick(Player player){
if(getObjID() == null) return;
if(getObjID().getSQLAction().equals(SQLAction.REMOVE)) return;
if(player == null) return;
if(canBuild(player)) {
Block b = getWorld().getBlockAt(getObjID().getBlockList().toArray(new Location[getObjID().getBlockList().size()])[0]);
ItemStack stack = e.getPlayer().getInventory().getItemInMainHand();
ItemStack stack = player.getInventory().getItemInMainHand();
if(stack==null) return;
if(stack.getType().equals(Material.AIR)) return;
if(b!=null){
@ -50,3 +35,14 @@ public class WaxCandle extends FurnitureHelper implements Listener{
}
}
}
@Override
public void onBreak(Player player) {
if(getObjID() == null) return;
if(getObjID().getSQLAction().equals(SQLAction.REMOVE)) return;
if(player == null) return;
if(canBuild(player)) {
this.destroy(player);
}
}
}

View File

@ -1,57 +1,55 @@
package de.Ste3et_C0st.Furniture.Objects.outdoor;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.inventory.ItemStack;
import de.Ste3et_C0st.Furniture.Main.main;
import de.Ste3et_C0st.FurnitureLib.ShematicLoader.Events.ProjectBreakEvent;
import de.Ste3et_C0st.FurnitureLib.ShematicLoader.Events.ProjectClickEvent;
import de.Ste3et_C0st.FurnitureLib.main.FurnitureHelper;
import de.Ste3et_C0st.FurnitureLib.main.ObjectID;
import de.Ste3et_C0st.FurnitureLib.main.Type.SQLAction;
import de.Ste3et_C0st.FurnitureLib.main.entity.fEntity;
public class barrels extends FurnitureHelper implements Listener {
public class barrels extends FurnitureHelper{
Integer id;
Block block;
public barrels(ObjectID id){
super(id);
Bukkit.getPluginManager().registerEvents(this, main.instance);
}
@EventHandler
public void onFurnitureClick(ProjectClickEvent e){
if(e.getID() == null || getObjID() == null) return;
if(!e.getID().equals(getObjID())){return;}
if(!e.canBuild()){return;}
Player p = e.getPlayer();
if(!p.getInventory().getItemInMainHand().getType().isBlock()&&!p.getInventory().getItemInMainHand().getType().equals(Material.AIR)){return;}
@Override
public void onClick(Player player){
if(getObjID() == null) return;
if(getObjID().getSQLAction().equals(SQLAction.REMOVE)) return;
if(player == null) return;
if(canBuild(player)) {
if(!player.getInventory().getItemInMainHand().getType().isBlock()&&!player.getInventory().getItemInMainHand().getType().equals(Material.AIR)){return;}
fEntity packet = getManager().getfArmorStandByObjectID(getObjID()).get(0);
if(packet.getInventory().getHelmet()!=null&&!packet.getInventory().getHelmet().getType().equals(Material.AIR)){
ItemStack is = packet.getInventory().getHelmet();
is.setAmount(1);
getWorld().dropItem(getLocation(), is);
}
packet.getInventory().setHelmet(p.getInventory().getItemInMainHand());
packet.getInventory().setHelmet(player.getInventory().getItemInMainHand());
update();
consumeItem(e.getPlayer());
consumeItem(player);
}
}
@EventHandler
private void onBlockBreak(ProjectBreakEvent e){
if(e.getID() == null || getObjID() == null) return;
if(!e.getID().equals(getObjID())){return;}
if(!e.canBuild()){return;}
@Override
public void onBreak(Player player) {
if(getObjID() == null) return;
if(getObjID().getSQLAction().equals(SQLAction.REMOVE)) return;
if(player == null) return;
if(canBuild(player)) {
fEntity packet = getManager().getfArmorStandByObjectID(getObjID()).get(0);
if(packet.getInventory().getHelmet()!=null&&!packet.getInventory().getHelmet().getType().equals(Material.AIR)){
ItemStack is = packet.getInventory().getHelmet();
is.setAmount(1);
getWorld().dropItem(getLocation(), is);
}
this.destroy(player);
}
}
}

View File

@ -5,55 +5,46 @@ import java.util.List;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
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.main.Furniture;
import de.Ste3et_C0st.FurnitureLib.main.ObjectID;
import de.Ste3et_C0st.FurnitureLib.main.Type.SQLAction;
import de.Ste3et_C0st.FurnitureLib.main.entity.fEntity;
public class campfire_1 extends Furniture implements Listener{
public class campfire_1 extends Furniture{
public campfire_1(ObjectID id){
super(id);
if(isFinish()){
Bukkit.getPluginManager().registerEvents(this, main.getInstance());
return;
}
if(isFinish()){return;}
spawn(id.getStartLocation());
}
@EventHandler
public void onFurnitureBreak(FurnitureBreakEvent e){
if(getObjID()==null||e.getID()==null){return;}
if(getObjID().getSQLAction().equals(SQLAction.REMOVE)){return;}
if(e.getID()==null) return;
if(!e.getID().equals(getObjID())){return;}
if(!e.canBuild()){return;}
@Override
public void onBreak(Player player) {
if(getObjID() == null) return;
if(getObjID().getSQLAction().equals(SQLAction.REMOVE)) return;
if(player == null) return;
if(canBuild(player)) {
for(fEntity packet : getManager().getfArmorStandByObjectID(getObjID())){
packet.setFire(false);
Location location = getLocation().clone();
location.add(0, 1.2, 0);
getLib().getLightManager().removeLight(location);
}
getManager().updateFurniture(getObjID());
e.remove();
delete();
this.destroy(player);
}
}
@EventHandler
public void onFurnitureClick(FurnitureClickEvent e){
if(e.getID() == null || getObjID() == null) return;
if(getObjID().getSQLAction().equals(SQLAction.REMOVE)){return;}
if(!e.getID().equals(getObjID())){return;}
if(!e.canBuild()){return;}
@Override
public void onClick(Player player){
if(getObjID() == null) return;
if(getObjID().getSQLAction().equals(SQLAction.REMOVE)) return;
if(player == null) return;
if(canBuild(player)) {
List<fEntity> aspList = getManager().getfArmorStandByObjectID(getObjID());
ItemStack is = e.getPlayer().getInventory().getItemInMainHand();
ItemStack is = player.getInventory().getItemInMainHand();
if(is.getType().equals(Material.WATER_BUCKET)){
for(fEntity packet : aspList){
packet.setFire(false);
@ -72,6 +63,7 @@ public class campfire_1 extends Furniture implements Listener{
getManager().updateFurniture(getObjID());
}
}
}
public void spawn(Location loc){

View File

@ -2,22 +2,18 @@ package de.Ste3et_C0st.Furniture.Objects.outdoor;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.EnumSet;
import java.util.List;
import org.bukkit.Bukkit;
import org.bukkit.GameMode;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.util.EulerAngle;
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.main.Furniture;
import de.Ste3et_C0st.FurnitureLib.main.ObjectID;
import de.Ste3et_C0st.FurnitureLib.main.Type.BodyPart;
@ -25,7 +21,7 @@ import de.Ste3et_C0st.FurnitureLib.main.Type.SQLAction;
import de.Ste3et_C0st.FurnitureLib.main.entity.fArmorStand;
import de.Ste3et_C0st.FurnitureLib.main.entity.fEntity;
public class campfire_2 extends Furniture implements Listener{
public class campfire_2 extends Furniture{
List<Material> items = new ArrayList<Material>(
Arrays.asList(
Material.BEEF,
@ -61,7 +57,6 @@ public class campfire_2 extends Furniture implements Listener{
grill = getLutil().getRelativ(middle,getBlockFace(), .0D, .5D);
grill.setYaw(getLutil().FaceToYaw(getBlockFace())+90);
if(id.isFinish()){
Bukkit.getPluginManager().registerEvents(this, main.getInstance());
return;
}
spawn(id.getStartLocation());
@ -139,14 +134,14 @@ public class campfire_2 extends Furniture implements Listener{
Bukkit.getPluginManager().registerEvents(this, getPlugin());
}
@EventHandler
public void onFurnitureClick(FurnitureClickEvent e){
if(e.getID() == null || getObjID() == null) return;
if(getObjID().getSQLAction().equals(SQLAction.REMOVE)){return;}
if(!e.getID().equals(getObjID())){return;}
if(!e.canBuild()){return;}
@Override
public void onClick(Player player){
if(getObjID() == null) return;
if(getObjID().getSQLAction().equals(SQLAction.REMOVE)) return;
if(player == null) return;
if(canBuild(player)) {
List<fEntity> aspList = getManager().getfArmorStandByObjectID(getObjID());
final ItemStack itemStack = e.getPlayer().getInventory().getItemInMainHand();
final ItemStack itemStack = player.getInventory().getItemInMainHand();
fArmorStand packet = null;
for(fEntity pack : aspList){
if(pack instanceof fArmorStand){
@ -169,14 +164,14 @@ public class campfire_2 extends Furniture implements Listener{
setGrill();
if(e.getPlayer().getGameMode().equals(GameMode.CREATIVE) && getLib().useGamemode()) return;
Integer i = e.getPlayer().getInventory().getHeldItemSlot();
ItemStack item = e.getPlayer().getInventory().getItemInMainHand();
if(player.getGameMode().equals(GameMode.CREATIVE) && getLib().useGamemode()) return;
Integer i = player.getInventory().getHeldItemSlot();
ItemStack item = player.getInventory().getItemInMainHand();
item.setAmount(item.getAmount()-1);
e.getPlayer().getInventory().setItem(i, item);
e.getPlayer().updateInventory();
player.getInventory().setItem(i, item);
player.updateInventory();
}
}
}
private void setfire(boolean b){
@ -202,20 +197,20 @@ public class campfire_2 extends Furniture implements Listener{
update();
}
@EventHandler
public void onFurnitureBreak(FurnitureBreakEvent e){
if(e.getID() == null || getObjID() == null) return;
if(getObjID().getSQLAction().equals(SQLAction.REMOVE)){return;}
if(!e.getID().equals(getObjID())){return;}
if(!e.canBuild()){return;}
@Override
public void onBreak(Player player) {
if(getObjID() == null) return;
if(getObjID().getSQLAction().equals(SQLAction.REMOVE)) return;
if(player == null) return;
if(canBuild(player)) {
if(isRunning()){
Bukkit.getScheduler().cancelTask(timer);
timer=null;
getWorld().dropItemNaturally(middle.clone().add(0, 1, 0), is).setVelocity(new Vector().zero());
}
setfire(false);
e.remove();
delete();
this.destroy(player);
}
}
public void removeGrill(){

View File

@ -1,34 +1,27 @@
package de.Ste3et_C0st.Furniture.Objects.outdoor;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.inventory.ItemStack;
import de.Ste3et_C0st.Furniture.Main.main;
import de.Ste3et_C0st.FurnitureLib.ShematicLoader.Events.ProjectClickEvent;
import de.Ste3et_C0st.FurnitureLib.main.FurnitureHelper;
import de.Ste3et_C0st.FurnitureLib.main.ObjectID;
import de.Ste3et_C0st.FurnitureLib.main.Type.SQLAction;
import de.Ste3et_C0st.FurnitureLib.main.entity.fEntity;
public class hammock extends FurnitureHelper implements Listener{
public class hammock extends FurnitureHelper{
public hammock(ObjectID id) {
super(id);
Bukkit.getPluginManager().registerEvents(this, main.getInstance());
}
@EventHandler(priority = EventPriority.LOW)
public void onClick(ProjectClickEvent e){
if(e.getID() == null || getObjID() == null) return;
if(getObjID().getSQLAction().equals(SQLAction.REMOVE)){return;}
if(!e.getID().equals(getObjID())){return;}
Player p = e.getPlayer();
ItemStack stack = p.getInventory().getItemInMainHand();
@Override
public void onClick(Player player){
if(getObjID() == null) return;
if(getObjID().getSQLAction().equals(SQLAction.REMOVE)) return;
if(player == null) return;
if(canBuild(player)) {
ItemStack stack = player.getInventory().getItemInMainHand();
if(stack!=null){
if(isMaterial(stack.getType())){
if(stack.getType().name().contains("BANNER")){
@ -39,31 +32,49 @@ public class hammock extends FurnitureHelper implements Listener{
}
}
}
e.setCancelled(true);
consumeItem(p);
consumeItem(player);
update();
}else{
for(fEntity entity : getfAsList()){
if(entity.getHelmet()!=null){
if(entity.getHelmet().getType().toString().toLowerCase().startsWith("log")){
if(entity.getHelmet().getType().toString().toLowerCase().endsWith("log")){
entity.setHelmet(stack.clone());
}
}
}
e.setCancelled(true);
consumeItem(p);
consumeItem(player);
update();
}
}else {
for(fEntity entity : getfAsList()){
if(entity.getName().startsWith("#SITZ#")){
if(entity.getPassanger()==null||entity.getPassanger().isEmpty()){
entity.setPassanger(player);
}
return;
}
}
}
}
}
}
@Override
public void onBreak(Player player) {
if(getObjID() == null) return;
if(getObjID().getSQLAction().equals(SQLAction.REMOVE)) return;
if(player == null) return;
if(canBuild(player)) {
this.destroy(player);
}
}
private boolean isMaterial(Material m){
if(m==null){return false;}
boolean b = false;
if(m.toString().toLowerCase().startsWith("log")){
if(m.toString().toLowerCase().endsWith("log")){
b=true;
}else if(m.toString().toLowerCase().equalsIgnoreCase("banner")){
}else if(m.toString().toLowerCase().endsWith("banner")){
b=true;
}

View File

@ -1,36 +1,39 @@
package de.Ste3et_C0st.Furniture.Objects.outdoor;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import de.Ste3et_C0st.Furniture.Main.main;
import de.Ste3et_C0st.FurnitureLib.ShematicLoader.Events.ProjectClickEvent;
import de.Ste3et_C0st.FurnitureLib.main.FurnitureHelper;
import de.Ste3et_C0st.FurnitureLib.main.ObjectID;
import de.Ste3et_C0st.FurnitureLib.main.Type.ColorType;
import de.Ste3et_C0st.FurnitureLib.main.Type.DyeColor;
import de.Ste3et_C0st.FurnitureLib.main.Type.SQLAction;
public class tent_1 extends FurnitureHelper implements Listener{
public class tent_1 extends FurnitureHelper{
public tent_1(ObjectID id){
super(id);
Bukkit.getPluginManager().registerEvents(this, main.getInstance());
}
@EventHandler
public void onFurnitureClick(ProjectClickEvent e){
if(e.getID() == null || getObjID() == null) return;
if(getObjID().getSQLAction().equals(SQLAction.REMOVE)){return;}
if(!e.getID().equals(getObjID())){return;}
if(!e.canBuild()){return;}
final Player p = e.getPlayer();
if(DyeColor.getDyeColor(p.getInventory().getItemInMainHand().getType()) == null){
p.openWorkbench(null, true);
@Override
public void onClick(Player player){
if(getObjID() == null) return;
if(getObjID().getSQLAction().equals(SQLAction.REMOVE)) return;
if(player == null) return;
if(canBuild(player)) {
if(DyeColor.getDyeColor(player.getInventory().getItemInMainHand().getType()) == null){
player.openWorkbench(null, true);
}else{
getLib().getColorManager().color(p, e.canBuild(), "_CARPET", getObjID(), ColorType.BLOCK, 1);
getLib().getColorManager().color(player, true, "_CARPET", getObjID(), ColorType.BLOCK, 1);
}
}
}
@Override
public void onBreak(Player player) {
if(getObjID() == null) return;
if(getObjID().getSQLAction().equals(SQLAction.REMOVE)) return;
if(player == null) return;
if(canBuild(player)) {
this.destroy(player);
}
}
}

View File

@ -12,14 +12,11 @@ import org.bukkit.block.BlockFace;
import org.bukkit.block.BlockState;
import org.bukkit.block.Chest;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.inventory.ItemStack;
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.main.Furniture;
import de.Ste3et_C0st.FurnitureLib.main.ObjectID;
import de.Ste3et_C0st.FurnitureLib.main.Type.BodyPart;
@ -178,35 +175,35 @@ public class tent_2 extends Furniture implements Listener{
}
}
@EventHandler
public void onFurnitureBreak(FurnitureBreakEvent e){
if(e.getID() == null || getObjID() == null) return;
if(getObjID().getSQLAction().equals(SQLAction.REMOVE)){return;}
if(!e.getID().equals(getObjID())){return;}
if(!e.canBuild()){return;}
@Override
public void onBreak(Player player) {
if(getObjID() == null) return;
if(getObjID().getSQLAction().equals(SQLAction.REMOVE)) return;
if(player == null) return;
if(canBuild(player)) {
for(Block bl : block){
bl.setType(Material.AIR);
}
e.remove();
delete();
this.destroy(player);
}
}
@EventHandler
public void onFurnitureClick(final FurnitureClickEvent e){
if(e.getID() == null || getObjID() == null) return;
if(getObjID().getSQLAction().equals(SQLAction.REMOVE)){return;}
if(!e.getID().equals(getObjID())){return;}
Player p = e.getPlayer();
if(!e.canBuild()){return;}
if(DyeColor.getDyeColor(p.getInventory().getItemInMainHand().getType()) == null){
@Override
public void onClick(Player player){
if(getObjID() == null) return;
if(getObjID().getSQLAction().equals(SQLAction.REMOVE)) return;
if(player == null) return;
if(canBuild(player)) {
if(DyeColor.getDyeColor(player.getInventory().getItemInMainHand().getType()) == null){
for(Block b : block){
if(b.getType().equals(Material.CHEST)){
Chest c = (Chest) b.getState();
e.getPlayer().openInventory(c.getBlockInventory());
player.getPlayer().openInventory(c.getBlockInventory());
}
}
}else{
getLib().getColorManager().color(p, e.canBuild(), "_CARPET", getObjID(), ColorType.BLOCK, 1);
getLib().getColorManager().color(player, true, "_CARPET", getObjID(), ColorType.BLOCK, 1);
}
}
}
}

View File

@ -12,15 +12,10 @@ import org.bukkit.block.BlockFace;
import org.bukkit.block.banner.Pattern;
import org.bukkit.block.banner.PatternType;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.BannerMeta;
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.main.Furniture;
import de.Ste3et_C0st.FurnitureLib.main.ObjectID;
import de.Ste3et_C0st.FurnitureLib.main.Type.BodyPart;
@ -30,12 +25,11 @@ import de.Ste3et_C0st.FurnitureLib.main.Type.SQLAction;
import de.Ste3et_C0st.FurnitureLib.main.entity.fArmorStand;
import de.Ste3et_C0st.FurnitureLib.main.entity.fEntity;
public class tent_3 extends Furniture implements Listener{
public class tent_3 extends Furniture{
public tent_3(ObjectID id){
super(id);
setBlock();
if(isFinish()){
Bukkit.getPluginManager().registerEvents(this, main.getInstance());
return;
}
Location loc = getLocation();
@ -151,33 +145,33 @@ public class tent_3 extends Furniture implements Listener{
getObjID().addBlock(Arrays.asList(bed));
}
@EventHandler
public void onFurnitureBreak(FurnitureBreakEvent e){
if(e.getID() == null || getObjID() == null) return;
if(getObjID().getSQLAction().equals(SQLAction.REMOVE)){return;}
if(!e.getID().equals(getObjID())){return;}
if(!e.canBuild()){return;}
@Override
public void onBreak(Player player) {
if(getObjID() == null) return;
if(getObjID().getSQLAction().equals(SQLAction.REMOVE)) return;
if(player == null) return;
if(canBuild(player)) {
bed.setType(Material.AIR);
e.remove();
delete();
this.destroy(player);
}
}
@EventHandler
public void onFurnitureClick(FurnitureClickEvent e){
if(e.getID() == null || getObjID() == null) return;
if(getObjID().getSQLAction().equals(SQLAction.REMOVE)){return;}
if(!e.getID().equals(getObjID())){return;}
if(!e.canBuild()){return;}
Player p = e.getPlayer();
if(DyeColor.getDyeColor(p.getInventory().getItemInMainHand().getType()) != null){
getLib().getColorManager().color(p, e.canBuild(), "_BANNER", getObjID(), ColorType.BANNER, 1);
@Override
public void onClick(Player player){
if(getObjID() == null) return;
if(getObjID().getSQLAction().equals(SQLAction.REMOVE)) return;
if(player == null) return;
if(canBuild(player)) {
if(DyeColor.getDyeColor(player.getInventory().getItemInMainHand().getType()) != null){
getLib().getColorManager().color(player, true, "_BANNER", getObjID(), ColorType.BANNER, 1);
}else{
for(fEntity packet : getManager().getfArmorStandByObjectID(getObjID())){
if(packet.getName().equalsIgnoreCase("#SITZ#")){
packet.setPassanger(p);
packet.setPassanger(player);
packet.update();
}
}
}
}
}
}

View File

@ -15,8 +15,6 @@ import org.bukkit.inventory.ItemStack;
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.main.Furniture;
import de.Ste3et_C0st.FurnitureLib.main.ObjectID;
import de.Ste3et_C0st.FurnitureLib.main.Type.SQLAction;
@ -102,28 +100,28 @@ public class BearTrap extends Furniture implements Listener{
Bukkit.getPluginManager().registerEvents(this, getPlugin());
}
@EventHandler
public void onFurnitureBreak(FurnitureBreakEvent e){
if(e.getID() == null || getObjID() == null) return;
if(getObjID().getSQLAction().equals(SQLAction.REMOVE)){return;}
if(e.getID() == null || getObjID() == null) return;
if(!e.getID().equals(getObjID())){return;}
if(!e.canBuild()){return;}
e.remove();
delete();
@Override
public void onBreak(Player player) {
if(getObjID() == null) return;
if(getObjID().getSQLAction().equals(SQLAction.REMOVE)) return;
if(player == null) return;
if(canBuild(player)) {
this.destroy(player);
}
}
@EventHandler
public void onFurnitureClick(FurnitureClickEvent e) {
if(e.getID() == null || getObjID() == null) return;
if(getObjID().getSQLAction().equals(SQLAction.REMOVE)){return;}
if(!e.getID().equals(getObjID())){return;}
if(!e.canBuild()){return;}
@Override
public void onClick(Player player){
if(getObjID() == null) return;
if(getObjID().getSQLAction().equals(SQLAction.REMOVE)) return;
if(player == null) return;
if(canBuild(player)) {
if(b){
setStatus(false);
getWorld().playSound(getLocation(), Sound.BLOCK_ANVIL_LAND, 10, 1);
}
}
}
private void setStatus(boolean b){
if(!b){