mirror of
https://github.com/Ste3et/furniture.git
synced 2024-09-27 07:12:39 +02:00
Dicecraft Furniture
This commit is contained in:
parent
a04154d012
commit
e5b345124c
@ -31,7 +31,7 @@ public class OnInteract implements Listener {
|
||||
if(!is.getItemMeta().hasDisplayName()){return;}
|
||||
if(e.getClickedBlock()==null){return;}
|
||||
if(!e.getAction().equals(Action.RIGHT_CLICK_BLOCK)){return;}
|
||||
Location location = e.getClickedBlock().getLocation();
|
||||
Location location = new Location(p.getWorld(), e.getClickedBlock().getLocation().getBlockX(), e.getClickedBlock().getLocation().getBlockY(), e.getClickedBlock().getLocation().getBlockZ());
|
||||
location.setYaw(p.getLocation().getYaw());
|
||||
location.setY(location.getY() + 1);
|
||||
if(ChatColor.stripColor(is.getItemMeta().getDisplayName()).equalsIgnoreCase("sofa")){
|
||||
|
@ -2,6 +2,7 @@ package de.Ste3et_C0st.Furniture.Main;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.util.EulerAngle;
|
||||
|
||||
public class Utils {
|
||||
|
||||
@ -11,13 +12,19 @@ public class Utils {
|
||||
return axis[Math.round(yaw / 90f) & 0x3];
|
||||
}
|
||||
|
||||
public static Float FaceToYaw(BlockFace face) {
|
||||
Float yaw = 0F;
|
||||
if(face.equals(BlockFace.NORTH)){yaw = 0f;}
|
||||
if(face.equals(BlockFace.WEST)){yaw = 270f;}
|
||||
if(face.equals(BlockFace.SOUTH)){yaw = 180f;}
|
||||
if(face.equals(BlockFace.EAST)){yaw = 90f;}
|
||||
return yaw;
|
||||
public static int FaceToYaw(final BlockFace face) {
|
||||
switch (face) {
|
||||
case NORTH: return 0;
|
||||
case EAST: return 90;
|
||||
case SOUTH: return 180;
|
||||
case WEST: return -90;
|
||||
default: return 0;
|
||||
}
|
||||
}
|
||||
|
||||
//NORDEN GEHT
|
||||
public static EulerAngle FaceEuler(final BlockFace face, Double x, Double y, Double z) {
|
||||
return new EulerAngle(x,y,z);
|
||||
}
|
||||
|
||||
public static Location getCenter(Location loc) {
|
||||
@ -29,7 +36,7 @@ public class Utils {
|
||||
|
||||
private static double getRelativeCoord(int i) {
|
||||
double d = i;
|
||||
d = d < 0 ? d - .5 : d + .5;
|
||||
if(d<0){d+=.5;}else{d+=.5;}
|
||||
return d;
|
||||
}
|
||||
}
|
||||
|
@ -86,13 +86,7 @@ public class main extends JavaPlugin {
|
||||
}
|
||||
}
|
||||
|
||||
//NORDEN IST KOMPLETT
|
||||
|
||||
public static Location getNew(Location loc, BlockFace b, Double z, Double x){
|
||||
//WESTEN FALSCH HERUM
|
||||
//NORDEN IST RICHTIG
|
||||
//OSTEN FALSCH HERUM
|
||||
//Süden Falschherum
|
||||
Location l = new Location(loc.getWorld(), loc.getX(), loc.getY(), loc.getZ());
|
||||
if(b.equals(BlockFace.NORTH)){
|
||||
l.add(x,0,z);
|
||||
@ -110,11 +104,8 @@ public class main extends JavaPlugin {
|
||||
return l;
|
||||
}
|
||||
|
||||
|
||||
public static EulerAngle getNewEuler(BlockFace b, Double z, Double x,Double y){
|
||||
//!! SÜDEN GEHT !!
|
||||
//!! NORDEN GEHT !!
|
||||
//!! OSTEN GEHT !!
|
||||
//!! Westen FALSCHHERUM !!
|
||||
EulerAngle l = new EulerAngle(0, 0, 0);
|
||||
if(b.equals(BlockFace.NORTH)){l = new EulerAngle(x,y,-z);
|
||||
}else if(b.equals(BlockFace.SOUTH)){l = new EulerAngle(-x,y,z);
|
||||
|
@ -17,7 +17,6 @@ import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.block.BlockFromToEvent;
|
||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||
import org.bukkit.event.player.PlayerInteractAtEntityEvent;
|
||||
import org.bukkit.event.player.PlayerMoveEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.util.EulerAngle;
|
||||
@ -32,80 +31,127 @@ public class largeTable implements Listener {
|
||||
public largeTable(Location loc, Plugin plugin){
|
||||
BlockFace b = Utils.yawToFace(loc.getYaw());
|
||||
Location location = Utils.getCenter(loc.getBlock().getLocation());
|
||||
plugin.getServer().broadcastMessage(b.name());
|
||||
|
||||
//East WORK
|
||||
//SOUT Z WORK
|
||||
location = main.getNew(location, b, 0.0, 0.0);
|
||||
|
||||
Double d = .0;
|
||||
//Glass Platte
|
||||
for(int i = 0; i<=2;i++){
|
||||
Double winkel = 1.57;
|
||||
Location l = new Location(loc.getWorld(), location.getX()+d, location.getY()-1.0, location.getZ());
|
||||
l.setYaw(0);
|
||||
ArmorStand as = (ArmorStand) loc.getWorld().spawnEntity(l, EntityType.ARMOR_STAND);
|
||||
as.setVisible(false);
|
||||
as.setGravity(false);
|
||||
float yaw = Utils.FaceToYaw(b);
|
||||
location = main.getNew(location, b, 0.1, 0.28);
|
||||
location.add(0,.2,0);
|
||||
Double winkel = 1.57;
|
||||
for(int x=1; x<=3;x++){
|
||||
Location l = null;
|
||||
l = main.getNew(location, b, 0.0, x*-.63);
|
||||
l.add(0,-1.2,0);
|
||||
l.setYaw(yaw);
|
||||
ArmorStand as = (ArmorStand) l.getWorld().spawnEntity(l, EntityType.ARMOR_STAND);
|
||||
as.setHelmet(new ItemStack(Material.STAINED_GLASS_PANE));
|
||||
as.setHeadPose(new EulerAngle(winkel, 0, 0));
|
||||
this.armorList.add(as);
|
||||
this.location.add(as.getLocation());
|
||||
l = main.getNew(l, b, 0.0, -0.62);
|
||||
as = (ArmorStand) loc.getWorld().spawnEntity(l, EntityType.ARMOR_STAND);
|
||||
as.setVisible(false);
|
||||
as.setGravity(false);
|
||||
this.location.add(l.add(0,.5,0).getBlock().getLocation());
|
||||
armorList.add(as);
|
||||
|
||||
l = main.getNew(location, b, 0.63, x*-.63);
|
||||
l.add(0,-1.2,0);
|
||||
l.setYaw(yaw);
|
||||
as = (ArmorStand) l.getWorld().spawnEntity(l, EntityType.ARMOR_STAND);
|
||||
as.setHelmet(new ItemStack(Material.STAINED_GLASS_PANE));
|
||||
as.setHeadPose(new EulerAngle(winkel, 0, 0));
|
||||
this.armorList.add(as);
|
||||
this.location.add(as.getLocation());
|
||||
l = main.getNew(l, b, 0.0, -0.62);
|
||||
as = (ArmorStand) loc.getWorld().spawnEntity(l, EntityType.ARMOR_STAND);
|
||||
as.setVisible(false);
|
||||
as.setGravity(false);
|
||||
this.location.add(l.add(0,.5,0).getBlock().getLocation());
|
||||
armorList.add(as);
|
||||
|
||||
l = main.getNew(location, b, 1.26, x*-.63);
|
||||
l.add(0,-1.2,0);
|
||||
l.setYaw(yaw);
|
||||
as = (ArmorStand) l.getWorld().spawnEntity(l, EntityType.ARMOR_STAND);
|
||||
as.setHelmet(new ItemStack(Material.STAINED_GLASS_PANE));
|
||||
as.setHeadPose(new EulerAngle(winkel, 0, 0));
|
||||
d+=.62;
|
||||
this.armorList.add(as);
|
||||
this.location.add(as.getLocation());
|
||||
this.location.add(l.add(0,.5,0).getBlock().getLocation());
|
||||
|
||||
armorList.add(as);
|
||||
}
|
||||
|
||||
Location middle = Utils.getCenter(armorList.get(4).getLocation()).add(1, -.88, -1.0);
|
||||
middle.setYaw(0);
|
||||
ArmorStand as = (ArmorStand) middle.getWorld().spawnEntity(middle, EntityType.ARMOR_STAND);
|
||||
/*Teller {
|
||||
|
||||
###
|
||||
###
|
||||
###
|
||||
|
||||
3;7;5;1
|
||||
}*/
|
||||
|
||||
Location middle = Utils.getCenter(armorList.get(0).getLocation());
|
||||
middle.add(0, -.9, 0);
|
||||
Location feet1 = main.getNew(middle, b, -.2, .1);
|
||||
Location feet2 = main.getNew(middle, b, -.2, -1.3);
|
||||
Location feet3 = main.getNew(middle, b, 1.1, .1);
|
||||
Location feet4 = main.getNew(middle, b, 1.1, -1.3);
|
||||
|
||||
double hight = .68;
|
||||
|
||||
Location t1 = new Location(middle.getWorld(), this.location.get(3).getX(), this.location.get(3).getY()+hight, this.location.get(3).getZ());
|
||||
Location t2 = new Location(middle.getWorld(), this.location.get(7).getX(), this.location.get(7).getY()+hight, this.location.get(7).getZ());
|
||||
Location t3 = new Location(middle.getWorld(), this.location.get(5).getX(), this.location.get(5).getY()+hight, this.location.get(5).getZ());
|
||||
Location t4 = new Location(middle.getWorld(), this.location.get(1).getX(), this.location.get(1).getY()+hight, this.location.get(1).getZ());
|
||||
|
||||
t1 =main.getNew(t1, b, -.05D, .37D);
|
||||
t2 =main.getNew(t2, b, -.13D, -.32D);
|
||||
t3 =main.getNew(t3, b, .55D, -.38D);
|
||||
t4 =main.getNew(t4, b, .62D, .30D);
|
||||
|
||||
float yaw1 = yaw;
|
||||
float yaw2 = yaw1-90;
|
||||
float yaw3 = yaw2-90;
|
||||
float yaw4 = yaw3-90;
|
||||
|
||||
t1.setYaw(yaw1);
|
||||
t2.setYaw(yaw2);
|
||||
t3.setYaw(yaw3);
|
||||
t4.setYaw(yaw4);
|
||||
|
||||
feet1.setYaw(yaw);
|
||||
feet2.setYaw(yaw);
|
||||
feet3.setYaw(yaw);
|
||||
feet4.setYaw(yaw);
|
||||
|
||||
|
||||
ArmorStand as = (ArmorStand) feet1.getWorld().spawnEntity(feet1, EntityType.ARMOR_STAND);
|
||||
as.setRightArmPose(new EulerAngle(-1.75, 0, 0));
|
||||
as.setItemInHand(new ItemStack(Material.BONE));
|
||||
as.setGravity(false);
|
||||
as.setVisible(false);
|
||||
this.armorList.add(as);
|
||||
|
||||
middle = Utils.getCenter(armorList.get(4).getLocation()).add(1.5, -.88, 1.45);
|
||||
middle.setYaw(180);
|
||||
as = (ArmorStand) middle.getWorld().spawnEntity(middle, EntityType.ARMOR_STAND);
|
||||
as = (ArmorStand) feet2.getWorld().spawnEntity(feet2, EntityType.ARMOR_STAND);
|
||||
as.setRightArmPose(new EulerAngle(-1.75, 0, 0));
|
||||
as.setItemInHand(new ItemStack(Material.BONE));
|
||||
as.setGravity(false);
|
||||
as.setVisible(false);
|
||||
this.armorList.add(as);
|
||||
|
||||
middle = Utils.getCenter(armorList.get(4).getLocation()).add(1.5, -.88, 0);
|
||||
middle.setYaw(180);
|
||||
as = (ArmorStand) middle.getWorld().spawnEntity(middle, EntityType.ARMOR_STAND);
|
||||
as = (ArmorStand) feet3.getWorld().spawnEntity(feet3, EntityType.ARMOR_STAND);
|
||||
as.setRightArmPose(new EulerAngle(-1.75, 0, 0));
|
||||
as.setItemInHand(new ItemStack(Material.BONE));
|
||||
as.setGravity(false);
|
||||
as.setVisible(false);
|
||||
this.armorList.add(as);
|
||||
|
||||
middle = Utils.getCenter(armorList.get(4).getLocation()).add(1, -.88, .45);
|
||||
middle.setYaw(0);
|
||||
as = (ArmorStand) middle.getWorld().spawnEntity(middle, EntityType.ARMOR_STAND);
|
||||
as = (ArmorStand) feet4.getWorld().spawnEntity(feet4, EntityType.ARMOR_STAND);
|
||||
as.setRightArmPose(new EulerAngle(-1.75, 0, 0));
|
||||
as.setItemInHand(new ItemStack(Material.BONE));
|
||||
as.setGravity(false);
|
||||
as.setVisible(false);
|
||||
this.armorList.add(as);
|
||||
|
||||
as = (ArmorStand) t1.getWorld().spawnEntity(t1, EntityType.ARMOR_STAND);
|
||||
as.setRightArmPose(new EulerAngle(0,.0,.0));
|
||||
this.armorList.add(as);
|
||||
|
||||
as = (ArmorStand) t2.getWorld().spawnEntity(t2, EntityType.ARMOR_STAND);
|
||||
as.setRightArmPose(new EulerAngle(0,.0,.0));
|
||||
this.armorList.add(as);
|
||||
|
||||
as = (ArmorStand) t3.getWorld().spawnEntity(t3, EntityType.ARMOR_STAND);
|
||||
as.setRightArmPose(new EulerAngle(0,.0,.0));
|
||||
this.armorList.add(as);
|
||||
|
||||
as = (ArmorStand) t4.getWorld().spawnEntity(t4, EntityType.ARMOR_STAND);
|
||||
as.setRightArmPose(new EulerAngle(0,.0,.0));
|
||||
this.armorList.add(as);
|
||||
|
||||
for(Entity e : armorList){
|
||||
ArmorStand armor = (ArmorStand) e;
|
||||
armor.setVisible(false);
|
||||
armor.setGravity(false);
|
||||
}
|
||||
|
||||
plugin.getServer().getPluginManager().registerEvents(this, plugin);
|
||||
main.getInstance().tische2.add(this);
|
||||
}
|
||||
@ -159,6 +205,32 @@ public class largeTable implements Listener {
|
||||
player.getInventory().setItem(player.getInventory().getHeldItemSlot(), is);
|
||||
player.updateInventory();
|
||||
}
|
||||
}else{
|
||||
Integer i = armorList.size();
|
||||
if(armorList.get(3).equals(e.getRightClicked())){
|
||||
i-=4;
|
||||
ArmorStand as = (ArmorStand) armorList.get(i);
|
||||
if(as.getItemInHand()!=null&&!as.getItemInHand().getType().equals(Material.AIR)){as.getLocation().getWorld().dropItem(as.getLocation(), as.getItemInHand());}
|
||||
as.setItemInHand(is);
|
||||
}
|
||||
if(armorList.get(7).equals(e.getRightClicked())){
|
||||
i-=3;
|
||||
ArmorStand as = (ArmorStand) armorList.get(i);
|
||||
if(as.getItemInHand()!=null&&!as.getItemInHand().getType().equals(Material.AIR)){as.getLocation().getWorld().dropItem(as.getLocation(), as.getItemInHand());}
|
||||
as.setItemInHand(is);
|
||||
}
|
||||
if(armorList.get(5).equals(e.getRightClicked())){
|
||||
i-=2;
|
||||
ArmorStand as = (ArmorStand) armorList.get(i);
|
||||
if(as.getItemInHand()!=null&&!as.getItemInHand().getType().equals(Material.AIR)){as.getLocation().getWorld().dropItem(as.getLocation(), as.getItemInHand());}
|
||||
as.setItemInHand(is);
|
||||
}
|
||||
if(armorList.get(1).equals(e.getRightClicked())){
|
||||
i-=1;
|
||||
ArmorStand as = (ArmorStand) armorList.get(i);
|
||||
if(as.getItemInHand()!=null&&!as.getItemInHand().getType().equals(Material.AIR)){as.getLocation().getWorld().dropItem(as.getLocation(), as.getItemInHand());}
|
||||
as.setItemInHand(is);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -180,12 +252,13 @@ public class largeTable implements Listener {
|
||||
public void onWaterFlow(BlockFromToEvent e){
|
||||
Location locTo = e.getToBlock().getLocation();
|
||||
if(location!=null && !location.isEmpty()){
|
||||
if(location.contains(locTo) || location.contains(locTo.add(0,1,0))){
|
||||
if(location.contains(locTo) || location.contains(locTo.add(0,-0.5,0))){
|
||||
e.setCancelled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@EventHandler
|
||||
public void onHit(PlayerMoveEvent e){
|
||||
Player p = e.getPlayer();
|
||||
@ -195,4 +268,5 @@ public class largeTable implements Listener {
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
@ -17,7 +17,6 @@ import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.block.BlockFromToEvent;
|
||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||
import org.bukkit.event.player.PlayerInteractAtEntityEvent;
|
||||
import org.bukkit.event.player.PlayerMoveEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
@ -31,10 +30,10 @@ public class laterne implements Listener {
|
||||
public laterne(Location loc, Plugin plugin){
|
||||
this.loc = loc;
|
||||
Location center = Utils.getCenter(loc);
|
||||
center.add(1,0,0);
|
||||
b = center.getWorld().getBlockAt(center);
|
||||
b.setType(Material.TORCH);
|
||||
Location obsidian = center;
|
||||
Bukkit.getServer().broadcastMessage(obsidian.getX() + ";" + obsidian.getY() + ";" + obsidian.getZ());
|
||||
obsidian.add(0D, -2.2, 0D);
|
||||
ArmorStand as = (ArmorStand) loc.getWorld().spawnEntity(obsidian, EntityType.ARMOR_STAND);
|
||||
as.setBasePlate(false);
|
||||
@ -110,6 +109,7 @@ public class laterne implements Listener {
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@EventHandler
|
||||
public void onHit(PlayerMoveEvent e){
|
||||
Player p = e.getPlayer();
|
||||
@ -120,6 +120,7 @@ public class laterne implements Listener {
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
public void delete(){
|
||||
armorList.get(0).getLocation().getWorld().dropItem(b.getLocation(), main.getInstance().itemse.Laterne);
|
||||
|
@ -18,9 +18,9 @@ import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.block.BlockFromToEvent;
|
||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||
import org.bukkit.event.player.PlayerInteractAtEntityEvent;
|
||||
import org.bukkit.event.player.PlayerMoveEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.util.EulerAngle;
|
||||
|
||||
import de.Ste3et_C0st.Furniture.Main.Utils;
|
||||
import de.Ste3et_C0st.Furniture.Main.main;
|
||||
@ -63,18 +63,6 @@ public class sofa implements Listener {
|
||||
ArmorStand armor2 = (ArmorStand) w.spawnEntity(feet2, EntityType.ARMOR_STAND);
|
||||
ArmorStand armor3 = (ArmorStand) w.spawnEntity(feet3, EntityType.ARMOR_STAND);
|
||||
ArmorStand armor4 = (ArmorStand) w.spawnEntity(feet4, EntityType.ARMOR_STAND);
|
||||
armor1.setBasePlate(false);
|
||||
armor2.setBasePlate(false);
|
||||
armor3.setBasePlate(false);
|
||||
armor4.setBasePlate(false);
|
||||
armor1.setVisible(false);
|
||||
armor2.setVisible(false);
|
||||
armor3.setVisible(false);
|
||||
armor4.setVisible(false);
|
||||
armor1.setGravity(false);
|
||||
armor2.setGravity(false);
|
||||
armor3.setGravity(false);
|
||||
armor4.setGravity(false);
|
||||
armor1.setHelmet(new ItemStack(Material.LEVER));
|
||||
armor2.setHelmet(new ItemStack(Material.LEVER));
|
||||
armor3.setHelmet(new ItemStack(Material.LEVER));
|
||||
@ -84,25 +72,25 @@ public class sofa implements Listener {
|
||||
//sitz
|
||||
carpetHight = main.getNew(carpetHight, b, .25,.3);
|
||||
Double d = .02;
|
||||
float facing = Utils.FaceToYaw(b);
|
||||
for(Double i = .0; i<=lengt; i+=0.65){
|
||||
//SITZ
|
||||
|
||||
location.add(main.getNew(carpetHight, b, place,(double) d).getBlock().getLocation().add(0, 1, 0));
|
||||
Location carpet = main.getNew(carpetHight, b, place,(double) d);
|
||||
|
||||
carpet.setYaw(facing);
|
||||
ArmorStand armorcarpet = (ArmorStand) w.spawnEntity(carpet, EntityType.ARMOR_STAND);
|
||||
armorcarpet.setVisible(false);
|
||||
armorcarpet.setGravity(false);
|
||||
armorcarpet.setHelmet(is);
|
||||
armorList.add(armorcarpet);
|
||||
sitz.add(armorcarpet);
|
||||
|
||||
|
||||
//OBERER TEIL
|
||||
armorcarpet = (ArmorStand) w.spawnEntity(main.getNew(carpetHight, b, place-.25,(double) d), EntityType.ARMOR_STAND);
|
||||
armorcarpet.setHeadPose(main.getNewEuler(b, 0.0, 1.57, .0));
|
||||
armorcarpet.setVisible(false);
|
||||
armorcarpet.setGravity(false);
|
||||
|
||||
|
||||
Location location = main.getNew(carpetHight, b, place-.25,(double) d);
|
||||
location.setYaw(facing);
|
||||
armorcarpet = (ArmorStand) w.spawnEntity(location, EntityType.ARMOR_STAND);
|
||||
armorcarpet.setHeadPose(new EulerAngle(1.57, .0, .0));
|
||||
armorcarpet.setHelmet(is);
|
||||
armorList.add(armorcarpet);
|
||||
|
||||
@ -111,22 +99,18 @@ public class sofa implements Listener {
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
Float yaw1= facing;
|
||||
Float yaw2= facing;
|
||||
Location last = main.getNew(sitz.get(sitz.size()-1).getLocation(), b, 0D, 0.26D);
|
||||
Location first = main.getNew(new Location(loc.getWorld(), loc.getX(), last.getY(), loc.getZ()), b, place+.25, 0.0D);
|
||||
last.setYaw(yaw1+90);
|
||||
Location first = main.getNew(new Location(loc.getWorld(), loc.getX(), last.getY(), loc.getZ()), b, place+.25, 0.07D);
|
||||
first.setYaw(yaw2-90);
|
||||
ArmorStand leftCarpet = (ArmorStand) w.spawnEntity(first.add(0,-.05,0), EntityType.ARMOR_STAND);
|
||||
ArmorStand RightCarpet = (ArmorStand) w.spawnEntity(last.add(0,-.05,0), EntityType.ARMOR_STAND);
|
||||
leftCarpet.setBasePlate(false);
|
||||
RightCarpet.setBasePlate(false);
|
||||
leftCarpet.setVisible(false);
|
||||
RightCarpet.setVisible(false);
|
||||
leftCarpet.setGravity(false);
|
||||
RightCarpet.setGravity(false);
|
||||
leftCarpet.setHelmet(is);
|
||||
RightCarpet.setHelmet(is);
|
||||
leftCarpet.setHeadPose(main.getNewEuler(b, 1.57, 0.0, 0.0));
|
||||
RightCarpet.setHeadPose(main.getNewEuler(b, 1.57, 0.0, 0.0));
|
||||
leftCarpet.setHeadPose(new EulerAngle(1.57, 0.0, 0.0));
|
||||
RightCarpet.setHeadPose(new EulerAngle(1.57, 0.0, 0.0));
|
||||
|
||||
armorList.add(leftCarpet);
|
||||
armorList.add(RightCarpet);
|
||||
@ -134,6 +118,12 @@ public class sofa implements Listener {
|
||||
armorList.add(armor2);
|
||||
armorList.add(armor3);
|
||||
armorList.add(armor4);
|
||||
for(Entity as : armorList){
|
||||
ArmorStand a = (ArmorStand) as;
|
||||
a.setVisible(false);
|
||||
a.setGravity(false);
|
||||
a.setBasePlate(false);
|
||||
}
|
||||
plugin.getServer().getPluginManager().registerEvents(this, plugin);
|
||||
main.getInstance().sofas.add(this);
|
||||
|
||||
@ -149,6 +139,7 @@ public class sofa implements Listener {
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@EventHandler
|
||||
public void onHit(PlayerMoveEvent e){
|
||||
Player p = e.getPlayer();
|
||||
@ -157,7 +148,7 @@ public class sofa implements Listener {
|
||||
p.teleport(e.getFrom());
|
||||
}
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
public void delete(){
|
||||
armorList.get(0).getLocation().getWorld().dropItem(armorList.get(0).getLocation().getBlock().getLocation().add(0, 1, 0), main.getInstance().itemse.Sofa);
|
||||
|
@ -16,9 +16,9 @@ import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.block.BlockFromToEvent;
|
||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||
import org.bukkit.event.player.PlayerInteractAtEntityEvent;
|
||||
import org.bukkit.event.player.PlayerMoveEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.util.EulerAngle;
|
||||
|
||||
import de.Ste3et_C0st.Furniture.Main.Utils;
|
||||
import de.Ste3et_C0st.Furniture.Main.main;
|
||||
@ -29,7 +29,6 @@ public class stuhl implements Listener {
|
||||
Location loc = null;
|
||||
public stuhl(Location loc, Plugin plugin){
|
||||
this.loc = loc.getBlock().getLocation();
|
||||
loc.add(1, 0, 0);
|
||||
BlockFace b = Utils.yawToFace(loc.getYaw()).getOppositeFace();
|
||||
Location center = Utils.getCenter(loc);
|
||||
Location sitz = new Location(center.getWorld(), center.getX(), center.getY(), center.getZ());
|
||||
@ -93,13 +92,13 @@ public class stuhl implements Listener {
|
||||
feet1 = new Location(center.getWorld(), center.getX(), center.getY(), center.getZ());
|
||||
feet1.add(0,-1.1,0);
|
||||
feet1 = main.getNew(feet1, b, -.25, .0);
|
||||
|
||||
feet1.setYaw(Utils.FaceToYaw(b));
|
||||
as = (ArmorStand) loc.getWorld().spawnEntity(feet1, EntityType.ARMOR_STAND);
|
||||
as.setBasePlate(false);
|
||||
as.setGravity(false);
|
||||
as.setVisible(false);
|
||||
as.setHelmet(new ItemStack(Material.TRAP_DOOR));
|
||||
as.setHeadPose(main.getNewEuler(b, .0, 1.55, .0));
|
||||
as.setHeadPose(new EulerAngle(1.57, .0, .0));
|
||||
armorList.add(as);
|
||||
main.getInstance().stuehle.add(this);
|
||||
plugin.getServer().getPluginManager().registerEvents(this, plugin);
|
||||
@ -117,6 +116,7 @@ public class stuhl implements Listener {
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@EventHandler
|
||||
public void onHit(PlayerMoveEvent e){
|
||||
Player p = e.getPlayer();
|
||||
@ -126,6 +126,7 @@ public class stuhl implements Listener {
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
@EventHandler
|
||||
public void onInteract(PlayerInteractAtEntityEvent e){
|
||||
|
@ -12,7 +12,6 @@ import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.block.BlockFromToEvent;
|
||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||
import org.bukkit.event.player.PlayerInteractAtEntityEvent;
|
||||
import org.bukkit.event.player.PlayerMoveEvent;
|
||||
@ -32,13 +31,12 @@ public class tisch implements Listener {
|
||||
public tisch(Location loc, Plugin plugin){
|
||||
Location middle1 = Utils.getCenter(loc);
|
||||
Location middle2 = Utils.getCenter(loc);
|
||||
this.loc = middle1.getBlock().getLocation().add(1,0,0);
|
||||
ArmorStand as = (ArmorStand) loc.getWorld().spawnEntity(middle1.add(1,-2.1,0), EntityType.ARMOR_STAND);
|
||||
ArmorStand as = (ArmorStand) loc.getWorld().spawnEntity(middle1.add(0,-2.1,0), EntityType.ARMOR_STAND);
|
||||
as.setHelmet(new ItemStack(Material.WOOD_PLATE));
|
||||
as.setVisible(false);
|
||||
as.setGravity(false);
|
||||
armorList.add(as);
|
||||
as = (ArmorStand) loc.getWorld().spawnEntity(middle2.add(1,-1.05,0), EntityType.ARMOR_STAND);
|
||||
as = (ArmorStand) loc.getWorld().spawnEntity(middle2.add(0,-1.05,0), EntityType.ARMOR_STAND);
|
||||
as.setHelmet(new ItemStack(Material.TRAP_DOOR));
|
||||
as.setVisible(false);
|
||||
as.setGravity(false);
|
||||
@ -66,14 +64,14 @@ public class tisch implements Listener {
|
||||
return this.loc;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
@EventHandler
|
||||
public void onWaterFlow(BlockFromToEvent e){
|
||||
Location locTo = e.getToBlock().getLocation();
|
||||
if(loc!=null && locTo.equals(loc)){
|
||||
e.setCancelled(true);
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
@EventHandler
|
||||
public void onHit(PlayerMoveEvent e){
|
||||
|
Loading…
Reference in New Issue
Block a user