mirror of
https://github.com/Ste3et/furniture.git
synced 2025-02-19 22:03:10 +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
|
||||
lore: ''
|
||||
crafting:
|
||||
disable: true
|
||||
disable: false
|
||||
recipe: XTX,ATA,TAT
|
||||
index:
|
||||
T: 0
|
||||
|
@ -14,9 +14,7 @@ import org.bukkit.block.Sign;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.block.BlockBreakEvent;
|
||||
import org.bukkit.event.block.BlockPlaceEvent;
|
||||
import org.bukkit.event.entity.ItemSpawnEvent;
|
||||
import org.bukkit.event.block.BlockPhysicsEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.BookMeta;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
@ -135,45 +133,19 @@ public class graveStone extends Furniture implements Listener{
|
||||
sign.setType(Material.AIR);
|
||||
sign = null;
|
||||
delete();
|
||||
removeSign();
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
private void onBlockRemove(BlockBreakEvent e)
|
||||
{
|
||||
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;}
|
||||
private void onPhysiks(BlockPhysicsEvent e){
|
||||
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())!=1) return;
|
||||
resetSign();
|
||||
if (!e.getBlock().equals(sign)) return;
|
||||
e.setCancelled(true);
|
||||
}
|
||||
|
||||
@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
|
||||
public void onFurnitureClick(FurnitureClickEvent e){
|
||||
if(getObjID()==null){return;}
|
||||
@ -237,14 +209,16 @@ public class graveStone extends Furniture implements Listener{
|
||||
}
|
||||
|
||||
public void placetext(){
|
||||
Sign sign = (Sign) this.sign.getState();
|
||||
Integer i = 0;
|
||||
for(String s : lines){
|
||||
if(i>3){break;}
|
||||
sign.setLine(i, s);
|
||||
i++;
|
||||
if ((this.sign.getState() instanceof Sign) && lines != null){
|
||||
Sign sign = (Sign) this.sign.getState();
|
||||
Integer i = 0;
|
||||
for(String s : lines){
|
||||
if(i>3){break;}
|
||||
sign.setLine(i, s);
|
||||
i++;
|
||||
}
|
||||
sign.update(true, false);
|
||||
}
|
||||
sign.update(true, false);
|
||||
}
|
||||
|
||||
public String[] getText(){
|
||||
|
@ -1,5 +1,5 @@
|
||||
name: DiceFurniture
|
||||
version: 2.4
|
||||
version: 2.4.1
|
||||
description: Add some new Objects to the Server
|
||||
author: Ste3et_C0st
|
||||
website: http://dicecraft.de
|
||||
|
Loading…
Reference in New Issue
Block a user