private void setStatus(boolean b) { if (b) { stand1.setHeadPose(getLutil().degresstoRad(new EulerAngle(0, 0, 0))); stand2.setHeadPose(getLutil().degresstoRad(new EulerAngle(0, 0, 0))); getWorld().playSound(getLocation(), Sound.ITEM_BREAK, 5, 1); } else { stand1.setHeadPose(getLutil().degresstoRad(new EulerAngle(90, 0, 0))); stand2.setHeadPose(getLutil().degresstoRad(new EulerAngle(-90, 0, 0))); } this.b = b; update(); }
public BearTrap(ObjectID id) { super(id); if (isFinish()) { for (fArmorStand stand : getfAsList()) { if (stand.getName().equalsIgnoreCase("#IRON1#")) { stand1 = stand; } else if (stand.getName().equalsIgnoreCase("#IRON2#")) { stand2 = stand; } } setStatus(false); Bukkit.getPluginManager().registerEvents(this, main.getInstance()); return; } spawn(id.getStartLocation()); }
@Override public void spawn(Location loc) { List<fArmorStand> asList = new ArrayList<fArmorStand>(); fArmorStand stand = spawnArmorStand(getRelative(getCenter(), 0, 0).add(0, -1.9, 0)); stand.setHelmet(new ItemStack(Material.IRON_TRAPDOOR)); asList.add(stand); Location location = getRelative(getCenter(), 0, .04).add(0, -1.8, 0); location.setYaw(getYaw() + 90); stand = spawnArmorStand(location); stand.setHeadPose(getLutil().degresstoRad(new EulerAngle(90, 0, 0))); stand.setHelmet(new ItemStack(Material.IRON_FENCE)); stand.setName("#IRON1#"); stand1 = stand; asList.add(stand); location = getRelative(getCenter(), 0, -.04).add(0, -1.8, 0); location.setYaw(getYaw() + 90); stand = spawnArmorStand(location); stand.setHeadPose(getLutil().degresstoRad(new EulerAngle(-90, 0, 0))); stand.setHelmet(new ItemStack(Material.IRON_FENCE)); stand.setName("#IRON2#"); stand2 = stand; asList.add(stand); for (fArmorStand packet : asList) { packet.setInvisible(true); packet.setGravity(false); } send(); Bukkit.getPluginManager().registerEvents(this, getPlugin()); }