catapult rotatyyyy
This commit is contained in:
parent
50c2da2a95
commit
fa460dbd45
@ -1,6 +1,5 @@
|
|||||||
package mineplex.core.common.util;
|
package mineplex.core.common.util;
|
||||||
|
|
||||||
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import net.minecraft.server.v1_8_R3.ChatMessage;
|
import net.minecraft.server.v1_8_R3.ChatMessage;
|
||||||
@ -28,6 +27,11 @@ public class UtilTextMiddle
|
|||||||
|
|
||||||
public static void display(String text, String subtitle, int fadeInTicks, int stayTicks, int fadeOutTicks, Player... players)
|
public static void display(String text, String subtitle, int fadeInTicks, int stayTicks, int fadeOutTicks, Player... players)
|
||||||
{
|
{
|
||||||
|
if (players.length == 1 && players[0] == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
setTimings(fadeInTicks, stayTicks, fadeOutTicks, players);
|
setTimings(fadeInTicks, stayTicks, fadeOutTicks, players);
|
||||||
|
|
||||||
display(text, subtitle, players);
|
display(text, subtitle, players);
|
||||||
|
@ -137,16 +137,4 @@ public class SiegeManager extends MiniPlugin
|
|||||||
LiveSiegeWeapons.remove(weapon);
|
LiveSiegeWeapons.remove(weapon);
|
||||||
}
|
}
|
||||||
|
|
||||||
public SiegeWeapon close(Block block)
|
|
||||||
{
|
|
||||||
for (SiegeWeapon weapon : LiveSiegeWeapons)
|
|
||||||
{
|
|
||||||
if (weapon.getLocation().distance(block.getLocation()) <= weapon.getSize() + 3.d)
|
|
||||||
{
|
|
||||||
return weapon;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -4,15 +4,18 @@ import org.bukkit.Location;
|
|||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.Sound;
|
import org.bukkit.Sound;
|
||||||
import org.bukkit.entity.ArmorStand;
|
import org.bukkit.entity.ArmorStand;
|
||||||
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.Slime;
|
import org.bukkit.entity.Slime;
|
||||||
import org.bukkit.event.inventory.InventoryType;
|
import org.bukkit.event.inventory.InventoryType;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.potion.PotionEffect;
|
import org.bukkit.potion.PotionEffect;
|
||||||
import org.bukkit.potion.PotionEffectType;
|
import org.bukkit.potion.PotionEffectType;
|
||||||
|
import org.bukkit.util.EulerAngle;
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
import mineplex.core.common.util.C;
|
import mineplex.core.common.util.C;
|
||||||
import mineplex.core.common.util.F;
|
import mineplex.core.common.util.F;
|
||||||
|
import mineplex.core.common.util.UtilAlg;
|
||||||
import mineplex.core.common.util.UtilEnt;
|
import mineplex.core.common.util.UtilEnt;
|
||||||
import mineplex.core.common.util.UtilParticle;
|
import mineplex.core.common.util.UtilParticle;
|
||||||
import mineplex.core.common.util.UtilParticle.ParticleType;
|
import mineplex.core.common.util.UtilParticle.ParticleType;
|
||||||
@ -37,9 +40,7 @@ public class Catapult extends SiegeWeapon
|
|||||||
{
|
{
|
||||||
super(location, 1600.d, "Catapult", clan, clan.Clans, siegeManager);
|
super(location, 1600.d, "Catapult", clan, clan.Clans, siegeManager);
|
||||||
|
|
||||||
location.add(.5, 0, .5);
|
setBoundingBox(3, 0);
|
||||||
|
|
||||||
setBoundingBox(1);
|
|
||||||
|
|
||||||
setStateInfo("Unloaded", new WeaponStateInfo(Material.PACKED_ICE, (byte) 0));
|
setStateInfo("Unloaded", new WeaponStateInfo(Material.PACKED_ICE, (byte) 0));
|
||||||
setStateInfo("Loaded", new WeaponStateInfo(Material.ENDER_PORTAL_FRAME, (byte) 0));
|
setStateInfo("Loaded", new WeaponStateInfo(Material.ENDER_PORTAL_FRAME, (byte) 0));
|
||||||
@ -60,7 +61,7 @@ public class Catapult extends SiegeWeapon
|
|||||||
|
|
||||||
_invertRotation = true;
|
_invertRotation = true;
|
||||||
|
|
||||||
_rotSpeed = 40.0f;
|
_rotSpeed = 60.0f;
|
||||||
|
|
||||||
setFireRule(new AccessRule(AccessType.LCLICK_BB, player -> {
|
setFireRule(new AccessRule(AccessType.LCLICK_BB, player -> {
|
||||||
if (!isRiding(player))
|
if (!isRiding(player))
|
||||||
@ -110,43 +111,38 @@ public class Catapult extends SiegeWeapon
|
|||||||
|
|
||||||
private void loadEntities()
|
private void loadEntities()
|
||||||
{
|
{
|
||||||
Slime slime = _location.getWorld().spawn(_location, Slime.class);
|
ArmorStand armorStand = _location.getWorld().spawn(_location.clone().add(.5, .1, .5), ArmorStand.class);
|
||||||
|
|
||||||
UtilEnt.silence(slime, true);
|
|
||||||
UtilEnt.Vegetate(slime);
|
|
||||||
|
|
||||||
slime.setSize(-1);
|
|
||||||
slime.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, 99999999, 1, true, false));
|
|
||||||
|
|
||||||
addEntity(slime, "Filler");
|
|
||||||
|
|
||||||
slime = _location.getWorld().spawn(_location, Slime.class);
|
|
||||||
|
|
||||||
UtilEnt.silence(slime, true);
|
|
||||||
UtilEnt.Vegetate(slime);
|
|
||||||
|
|
||||||
slime.setSize(-1);
|
|
||||||
slime.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, 99999999, 1, true, false));
|
|
||||||
|
|
||||||
getEntity("Filler").setPassenger(slime);
|
|
||||||
addEntity(slime, "PLAYERMOUNT");
|
|
||||||
|
|
||||||
ArmorStand armorStand = _location.getWorld().spawn(_location, ArmorStand.class);
|
|
||||||
|
|
||||||
UtilEnt.setFakeHead(armorStand, true);
|
UtilEnt.setFakeHead(armorStand, true);
|
||||||
armorStand.teleport(_location);
|
|
||||||
armorStand.setVisible(false);
|
armorStand.setVisible(false);
|
||||||
armorStand.setGravity(false);
|
armorStand.setGravity(false);
|
||||||
|
|
||||||
armorStand.setPassenger(getEntity("Filler"));
|
|
||||||
|
|
||||||
addEntity(armorStand, "WEAPON");
|
addEntity(armorStand, "WEAPON");
|
||||||
|
|
||||||
|
ArmorStand customRot = _location.getWorld().spawn(_location, ArmorStand.class);
|
||||||
|
|
||||||
|
customRot.setVisible(false);
|
||||||
|
customRot.setGravity(false);
|
||||||
|
|
||||||
|
addEntity(customRot, "PLAYERMOUNT");
|
||||||
|
|
||||||
|
for (int i = 0; i < 24; i++)
|
||||||
|
{
|
||||||
|
float yaw = (360.f / ((float) 24)) * i;
|
||||||
|
|
||||||
|
ArmorStand point = _location.getWorld().spawn(UtilAlg.moveForward(_location.clone().subtract(0, 1, 0), .5, yaw, false), ArmorStand.class);
|
||||||
|
|
||||||
|
point.setVisible(false);
|
||||||
|
point.setGravity(false);
|
||||||
|
|
||||||
|
addEntity(point, "Point_" + i);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void Fire(WeaponProjectile projectile)
|
public void Fire(WeaponProjectile projectile)
|
||||||
{
|
{
|
||||||
projectile.setLocation(projectile.getLocation().add(.0, 3.2, .0));
|
projectile.setLocation(projectile.getLocation().add(.0, 2.7, .0));
|
||||||
|
|
||||||
UtilServer.getServer().getOnlinePlayers().forEach(player -> player.playSound(projectile.getLocation(), Sound.BAT_TAKEOFF, 2.f, .45f));
|
UtilServer.getServer().getOnlinePlayers().forEach(player -> player.playSound(projectile.getLocation(), Sound.BAT_TAKEOFF, 2.f, .45f));
|
||||||
}
|
}
|
||||||
@ -174,6 +170,20 @@ public class Catapult extends SiegeWeapon
|
|||||||
{
|
{
|
||||||
UtilParticle.PlayParticleToAll(ParticleType.LARGE_SMOKE, getProjectile().getLocation().add(0, .5, 0), new Vector(0, 0, 0), .1f, 3, ViewDist.MAX);
|
UtilParticle.PlayParticleToAll(ParticleType.LARGE_SMOKE, getProjectile().getLocation().add(0, .5, 0), new Vector(0, 0, 0), .1f, 3, ViewDist.MAX);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (getRider() == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
ArmorStand stand = (ArmorStand) getEntity("Point_" + (_yaw / (360.d / 24.d)));
|
||||||
|
|
||||||
|
stand.setPassenger(getRider());
|
||||||
|
}
|
||||||
|
|
||||||
|
protected double PreRotate(double yaw)
|
||||||
|
{
|
||||||
|
return yaw / (360.d / 24.d);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -2,13 +2,11 @@ package mineplex.game.clans.clans.siege.weapon;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.function.Function;
|
|
||||||
|
|
||||||
import org.apache.commons.lang.Validate;
|
import org.apache.commons.lang.Validate;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.block.BlockFace;
|
|
||||||
import org.bukkit.entity.ArmorStand;
|
import org.bukkit.entity.ArmorStand;
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -17,6 +15,7 @@ import org.bukkit.event.EventPriority;
|
|||||||
import org.bukkit.event.HandlerList;
|
import org.bukkit.event.HandlerList;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.event.block.BlockBreakEvent;
|
import org.bukkit.event.block.BlockBreakEvent;
|
||||||
|
import org.bukkit.event.block.BlockPlaceEvent;
|
||||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||||
import org.bukkit.event.entity.EntityDamageEvent;
|
import org.bukkit.event.entity.EntityDamageEvent;
|
||||||
import org.bukkit.event.inventory.InventoryCloseEvent;
|
import org.bukkit.event.inventory.InventoryCloseEvent;
|
||||||
@ -33,8 +32,7 @@ import com.google.common.collect.Maps;
|
|||||||
|
|
||||||
import mineplex.core.common.util.C;
|
import mineplex.core.common.util.C;
|
||||||
import mineplex.core.common.util.F;
|
import mineplex.core.common.util.F;
|
||||||
import mineplex.core.common.util.UtilBlock;
|
import mineplex.core.common.util.UtilAlg;
|
||||||
import mineplex.core.common.util.UtilItem;
|
|
||||||
import mineplex.core.common.util.UtilMath;
|
import mineplex.core.common.util.UtilMath;
|
||||||
import mineplex.core.common.util.UtilPlayer;
|
import mineplex.core.common.util.UtilPlayer;
|
||||||
import mineplex.core.common.util.UtilServer;
|
import mineplex.core.common.util.UtilServer;
|
||||||
@ -46,6 +44,7 @@ import mineplex.core.updater.event.UpdateEvent;
|
|||||||
import mineplex.game.clans.clans.ClanInfo;
|
import mineplex.game.clans.clans.ClanInfo;
|
||||||
import mineplex.game.clans.clans.ClansManager;
|
import mineplex.game.clans.clans.ClansManager;
|
||||||
import mineplex.game.clans.clans.siege.SiegeManager;
|
import mineplex.game.clans.clans.siege.SiegeManager;
|
||||||
|
import mineplex.game.clans.clans.siege.events.SiegeWeaponExplodeEvent;
|
||||||
import mineplex.game.clans.clans.siege.weapon.projectile.ProjectileAttributes;
|
import mineplex.game.clans.clans.siege.weapon.projectile.ProjectileAttributes;
|
||||||
import mineplex.game.clans.clans.siege.weapon.projectile.WeaponProjectile;
|
import mineplex.game.clans.clans.siege.weapon.projectile.WeaponProjectile;
|
||||||
import mineplex.game.clans.clans.siege.weapon.util.AccessRule;
|
import mineplex.game.clans.clans.siege.weapon.util.AccessRule;
|
||||||
@ -107,6 +106,8 @@ public abstract class SiegeWeapon implements Listener
|
|||||||
private long _lastRight = -1;
|
private long _lastRight = -1;
|
||||||
private long _lastLeft = -1;
|
private long _lastLeft = -1;
|
||||||
|
|
||||||
|
protected double _yaw;
|
||||||
|
|
||||||
protected long _lastFired;
|
protected long _lastFired;
|
||||||
|
|
||||||
public SiegeWeapon(Location location, double maxHealth, String name, ClanInfo owner, ClansManager clansManager, SiegeManager siegeManager)
|
public SiegeWeapon(Location location, double maxHealth, String name, ClanInfo owner, ClansManager clansManager, SiegeManager siegeManager)
|
||||||
@ -129,6 +130,11 @@ public abstract class SiegeWeapon implements Listener
|
|||||||
_clans = clansManager;
|
_clans = clansManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private ClanInfo getOwner()
|
||||||
|
{
|
||||||
|
return _owner;
|
||||||
|
}
|
||||||
|
|
||||||
public ClansManager getClans()
|
public ClansManager getClans()
|
||||||
{
|
{
|
||||||
return _clans;
|
return _clans;
|
||||||
@ -162,6 +168,19 @@ public abstract class SiegeWeapon implements Listener
|
|||||||
_collisionBox.registerLeft((block, player) -> handleLeftClick(player));
|
_collisionBox.registerLeft((block, player) -> handleLeftClick(player));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void setBoundingBox(int size, int y)
|
||||||
|
{
|
||||||
|
Validate.isTrue(size > 0, "Size must be a positive number.");
|
||||||
|
Validate.isTrue(UtilMath.isOdd(size), "Size must be an odd number.");
|
||||||
|
|
||||||
|
_boundingBoxSize = size;
|
||||||
|
|
||||||
|
_collisionBox = size == 1 ? BarrierCollisionBox.single(_location.clone()) : BarrierCollisionBox.all(_location.clone().subtract((size - 1) / 2, 0, (size - 1) / 2), _location.clone().add(((size - 1) / 2) + .2, y, ((size - 1) / 2) + .2));
|
||||||
|
_collisionBox.Construct();
|
||||||
|
_collisionBox.registerRight((block, player) -> handleRightClick(player));
|
||||||
|
_collisionBox.registerLeft((block, player) -> handleLeftClick(player));
|
||||||
|
}
|
||||||
|
|
||||||
private void updateWeapon()
|
private void updateWeapon()
|
||||||
{
|
{
|
||||||
if (_inventory != null)
|
if (_inventory != null)
|
||||||
@ -182,6 +201,9 @@ public abstract class SiegeWeapon implements Listener
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ArmorStand armorStand = (ArmorStand) getEntity("WEAPON");
|
||||||
|
double standYaw = _yaw % 360;
|
||||||
|
|
||||||
if (getEntity("PLAYERMOUNT").getPassenger() == null)
|
if (getEntity("PLAYERMOUNT").getPassenger() == null)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
@ -189,8 +211,6 @@ public abstract class SiegeWeapon implements Listener
|
|||||||
|
|
||||||
if (getRider() != null)
|
if (getRider() != null)
|
||||||
{
|
{
|
||||||
ArmorStand armorStand = (ArmorStand) getEntity("WEAPON");
|
|
||||||
double standYaw = Math.toDegrees(armorStand.getHeadPose().getY()) % 360;
|
|
||||||
double riderYaw = (getRider().getLocation().getYaw() + (_invertRotation ? 180 : 0)) % 360;
|
double riderYaw = (getRider().getLocation().getYaw() + (_invertRotation ? 180 : 0)) % 360;
|
||||||
|
|
||||||
// riderYaw = 350 and standYaw = 20
|
// riderYaw = 350 and standYaw = 20
|
||||||
@ -200,8 +220,10 @@ public abstract class SiegeWeapon implements Listener
|
|||||||
if (dif < -180) dif += 360;
|
if (dif < -180) dif += 360;
|
||||||
|
|
||||||
double yaw = (float) ((float)standYaw + Math.min(dif / _rotSpeed, 4f));
|
double yaw = (float) ((float)standYaw + Math.min(dif / _rotSpeed, 4f));
|
||||||
|
|
||||||
armorStand.setHeadPose(new EulerAngle(0, Math.toRadians(yaw), 0));
|
_yaw = yaw;
|
||||||
|
|
||||||
|
armorStand.setHeadPose(new EulerAngle(0, Math.toRadians(PreRotate(_yaw)), 0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -393,47 +415,7 @@ public abstract class SiegeWeapon implements Listener
|
|||||||
|
|
||||||
private void dismount(Player player)
|
private void dismount(Player player)
|
||||||
{
|
{
|
||||||
//2 in ecah
|
player.teleport(player.getLocation().add(0, 1, 0));
|
||||||
|
|
||||||
Block origin = player.getLocation().getBlock();
|
|
||||||
|
|
||||||
BlockFace[] faces = { BlockFace.NORTH, BlockFace.EAST, BlockFace.SOUTH, BlockFace.WEST };
|
|
||||||
|
|
||||||
Block suitable = null;
|
|
||||||
|
|
||||||
findAir: for (int yTests = 0; yTests < _boundingBoxSize; yTests++)
|
|
||||||
{
|
|
||||||
final int fyt = yTests;
|
|
||||||
|
|
||||||
Function<Block, Block> function = block -> {
|
|
||||||
Block up = block;
|
|
||||||
|
|
||||||
for (int x = 0; x < fyt; x++)
|
|
||||||
{
|
|
||||||
up = up.getRelative(BlockFace.UP);
|
|
||||||
}
|
|
||||||
|
|
||||||
return up;
|
|
||||||
};
|
|
||||||
|
|
||||||
for (BlockFace face : faces)
|
|
||||||
{
|
|
||||||
Block testFor = origin.getRelative(face).getRelative(face);
|
|
||||||
|
|
||||||
if (UtilItem.isBoundless(function.apply(testFor).getType()))
|
|
||||||
{
|
|
||||||
suitable = function.apply(testFor);
|
|
||||||
break findAir;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (suitable == null)
|
|
||||||
{
|
|
||||||
suitable = UtilBlock.getHighest(origin.getWorld(), origin).getRelative(BlockFace.UP);
|
|
||||||
}
|
|
||||||
|
|
||||||
player.teleport(suitable.getRelative(BlockFace.UP).getLocation());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handleLeftClick(Player player)
|
private void handleLeftClick(Player player)
|
||||||
@ -495,7 +477,12 @@ public abstract class SiegeWeapon implements Listener
|
|||||||
protected void RightClick(Player player)
|
protected void RightClick(Player player)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected double PreRotate(double yaw)
|
||||||
|
{
|
||||||
|
return yaw;
|
||||||
|
}
|
||||||
|
|
||||||
protected void Cleanup()
|
protected void Cleanup()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -517,6 +504,11 @@ public abstract class SiegeWeapon implements Listener
|
|||||||
_entityMapping.put(uniqueName, entity);
|
_entityMapping.put(uniqueName, entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected final void removeEntity(String uniqueName)
|
||||||
|
{
|
||||||
|
_comprisedOf.remove(_entityMapping.remove(getEntity(uniqueName)));
|
||||||
|
}
|
||||||
|
|
||||||
protected final Entity getEntity(String uniqueName)
|
protected final Entity getEntity(String uniqueName)
|
||||||
{
|
{
|
||||||
return _entityMapping.get(uniqueName);
|
return _entityMapping.get(uniqueName);
|
||||||
@ -682,6 +674,31 @@ public abstract class SiegeWeapon implements Listener
|
|||||||
|
|
||||||
// Events
|
// Events
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onSiegeWeaponExplode(SiegeWeaponExplodeEvent event)
|
||||||
|
{
|
||||||
|
if (UtilAlg.inBoundingBox(event.getProjectile().getLocation(), _location.clone().subtract(4, 2, 4), _location.clone().add(4, 2, 4)))
|
||||||
|
{
|
||||||
|
if (getHealth() > 750)
|
||||||
|
{
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
int hprem = 600 + (UtilMath.random.nextInt(250));
|
||||||
|
|
||||||
|
removeHealth(hprem);
|
||||||
|
|
||||||
|
if (getHealth() > 0)
|
||||||
|
{
|
||||||
|
UtilTextMiddle.display("Damage", "You damaged " + F.elem(getOwner().getName()) + "'s " + _name + " for " + C.cRed + "-" + hprem + C.mBody + " health. (Current health: " + C.cGreen + getHealth() + C.cGray + ")", 10, 60, 10, event.getWeapon().getRider());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
UtilTextMiddle.display("Damage", "You destroyed " + F.elem(getOwner().getName()) + "'s " + _name + ".", 10, 60, 10, event.getWeapon().getRider());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onDamage(EntityDamageEvent event)
|
public void onDamage(EntityDamageEvent event)
|
||||||
{
|
{
|
||||||
@ -760,11 +777,20 @@ public abstract class SiegeWeapon implements Listener
|
|||||||
{
|
{
|
||||||
if (event.getBlock().getLocation().distance(_location) < _boundingBoxSize + 1.65 && event.getBlock().getLocation().getY() <= _location.getY())
|
if (event.getBlock().getLocation().distance(_location) < _boundingBoxSize + 1.65 && event.getBlock().getLocation().getY() <= _location.getY())
|
||||||
{
|
{
|
||||||
UtilPlayer.message(event.getPlayer(), F.main("Clans", "You may not break blocks under a Siege Weapon"));
|
UtilPlayer.message(event.getPlayer(), F.main("Clans", "You may not break blocks near a Siege Weapon"));
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onBlockPlace(BlockPlaceEvent event)
|
||||||
|
{
|
||||||
|
if (event.getBlock().getLocation().distance(_location) < _boundingBoxSize + 1.65 && event.getBlock().getLocation().getY() <= _location.getY())
|
||||||
|
{
|
||||||
|
UtilPlayer.message(event.getPlayer(), F.main("Clans", "You may not place blocks near a Siege Weapon"));
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public boolean inProtection(Block block)
|
public boolean inProtection(Block block)
|
||||||
{
|
{
|
||||||
|
@ -103,7 +103,6 @@ public class Crater implements Listener
|
|||||||
HashMap<Block, Double> blockList = new HashMap<Block, Double>();
|
HashMap<Block, Double> blockList = new HashMap<Block, Double>();
|
||||||
int iR = (int) _size + 1;
|
int iR = (int) _size + 1;
|
||||||
|
|
||||||
loop:
|
|
||||||
for (int x = -iR; x <= iR; x++)
|
for (int x = -iR; x <= iR; x++)
|
||||||
{
|
{
|
||||||
for (int z = -iR; z <= iR; z++)
|
for (int z = -iR; z <= iR; z++)
|
||||||
@ -116,13 +115,6 @@ public class Crater implements Listener
|
|||||||
|
|
||||||
if (offset <= _size)
|
if (offset <= _size)
|
||||||
{
|
{
|
||||||
SiegeWeapon weapon = SiegeManager.Instance.close(curBlock);
|
|
||||||
if (weapon != null)
|
|
||||||
{
|
|
||||||
weapon.removeHealth(453);
|
|
||||||
break loop;
|
|
||||||
}
|
|
||||||
|
|
||||||
blockList.put(curBlock, Double.valueOf(offset));
|
blockList.put(curBlock, Double.valueOf(offset));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user