mirror of
https://github.com/Ste3et/furniture.git
synced 2025-02-21 14:51:20 +01:00
GraveStone removed 3 Events and add BlockPhysicsEvent
This commit is contained in:
parent
358a44962e
commit
1e681f23d1
@ -4,7 +4,7 @@ FlowerPot:
|
|||||||
glow: false
|
glow: false
|
||||||
lore: ''
|
lore: ''
|
||||||
crafting:
|
crafting:
|
||||||
disable: true
|
disable: false
|
||||||
recipe: XTX,ATA,TAT
|
recipe: XTX,ATA,TAT
|
||||||
index:
|
index:
|
||||||
T: 0
|
T: 0
|
||||||
|
@ -14,9 +14,7 @@ import org.bukkit.block.Sign;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.event.block.BlockBreakEvent;
|
import org.bukkit.event.block.BlockPhysicsEvent;
|
||||||
import org.bukkit.event.block.BlockPlaceEvent;
|
|
||||||
import org.bukkit.event.entity.ItemSpawnEvent;
|
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.inventory.meta.BookMeta;
|
import org.bukkit.inventory.meta.BookMeta;
|
||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
@ -135,45 +133,19 @@ public class graveStone extends Furniture implements Listener{
|
|||||||
sign.setType(Material.AIR);
|
sign.setType(Material.AIR);
|
||||||
sign = null;
|
sign = null;
|
||||||
delete();
|
delete();
|
||||||
|
removeSign();
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
private void onBlockRemove(BlockBreakEvent e)
|
private void onPhysiks(BlockPhysicsEvent e){
|
||||||
{
|
if(getObjID()==null){return;}
|
||||||
if(getObjID()==null){return;}
|
|
||||||
if(getObjID().getSQLAction().equals(SQLAction.REMOVE)){return;}
|
|
||||||
if (sign==null) return;
|
|
||||||
if (e.getBlock() == null) return;
|
|
||||||
if (e.getBlock().getLocation() == null) return;
|
|
||||||
if (e.getBlock().getLocation().toVector().distance(signLoc.toVector())==0) return;
|
|
||||||
resetSign();
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
private void onBlockPlaceEvent(BlockPlaceEvent e){
|
|
||||||
if(getObjID()==null){return;}
|
|
||||||
if(getObjID().getSQLAction().equals(SQLAction.REMOVE)){return;}
|
if(getObjID().getSQLAction().equals(SQLAction.REMOVE)){return;}
|
||||||
if (sign==null) return;
|
if (sign==null) return;
|
||||||
if (e.getBlock() == null) return;
|
if (e.getBlock() == null) return;
|
||||||
if (e.getBlock().getLocation() == null) return;
|
if (!e.getBlock().equals(sign)) return;
|
||||||
if (e.getBlock().getLocation().toVector().distance(signLoc.toVector())!=1) return;
|
e.setCancelled(true);
|
||||||
resetSign();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
private void onDrop(ItemSpawnEvent e){
|
|
||||||
if(getObjID()==null){return;}
|
|
||||||
if(getObjID().getSQLAction().equals(SQLAction.REMOVE)){return;}
|
|
||||||
if (sign==null) return;
|
|
||||||
if (e.getLocation() == null) return;
|
|
||||||
ItemStack is = e.getEntity().getItemStack();
|
|
||||||
if (is == null) return;
|
|
||||||
if (!is.getType().equals(Material.SIGN)) return;
|
|
||||||
if (e.getLocation().toVector().distance(signLoc.toVector())>=2) return;
|
|
||||||
e.getEntity().remove();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onFurnitureClick(FurnitureClickEvent e){
|
public void onFurnitureClick(FurnitureClickEvent e){
|
||||||
if(getObjID()==null){return;}
|
if(getObjID()==null){return;}
|
||||||
@ -237,14 +209,16 @@ public class graveStone extends Furniture implements Listener{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void placetext(){
|
public void placetext(){
|
||||||
Sign sign = (Sign) this.sign.getState();
|
if ((this.sign.getState() instanceof Sign) && lines != null){
|
||||||
Integer i = 0;
|
Sign sign = (Sign) this.sign.getState();
|
||||||
for(String s : lines){
|
Integer i = 0;
|
||||||
if(i>3){break;}
|
for(String s : lines){
|
||||||
sign.setLine(i, s);
|
if(i>3){break;}
|
||||||
i++;
|
sign.setLine(i, s);
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
sign.update(true, false);
|
||||||
}
|
}
|
||||||
sign.update(true, false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public String[] getText(){
|
public String[] getText(){
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
name: DiceFurniture
|
name: DiceFurniture
|
||||||
version: 2.4
|
version: 2.4.1
|
||||||
description: Add some new Objects to the Server
|
description: Add some new Objects to the Server
|
||||||
author: Ste3et_C0st
|
author: Ste3et_C0st
|
||||||
website: http://dicecraft.de
|
website: http://dicecraft.de
|
||||||
|
Loading…
Reference in New Issue
Block a user