little tweakers

This commit is contained in:
Ben 2016-03-11 00:58:47 +00:00
parent bcd250cf25
commit 8ce32fcdfa
3 changed files with 69 additions and 21 deletions

View File

@ -264,6 +264,11 @@ public class ClanInfo
public boolean isAlly(ClanInfo other) public boolean isAlly(ClanInfo other)
{ {
if (other == null)
{
return false;
}
return isAlly(other.getName()); return isAlly(other.getName());
} }

View File

@ -422,16 +422,30 @@ public class Gameplay extends MiniPlugin
@EventHandler @EventHandler
public void IronDoor(PlayerInteractEvent event) public void IronDoor(PlayerInteractEvent event)
{ {
if (!UtilEvent.isAction(event, ActionType.R_BLOCK)) return; if (event.isCancelled())
{
return;
}
if (event.getClickedBlock().getTypeId() != 71) return; if (!UtilEvent.isAction(event, ActionType.R_BLOCK))
{
return;
}
if (event.getClickedBlock().getTypeId() != 71)
{
return;
}
Block block = event.getClickedBlock(); Block block = event.getClickedBlock();
// Knock // Knock
if (event.isCancelled()) if (event.isCancelled())
{ {
if (!Recharge.Instance.use(event.getPlayer(), "Door Knock", 500, false, false)) return; if (!Recharge.Instance.use(event.getPlayer(), "Door Knock", 500, false, false))
{
return;
}
block.getWorld().playEffect(block.getLocation(), Effect.ZOMBIE_CHEW_WOODEN_DOOR, 0); block.getWorld().playEffect(block.getLocation(), Effect.ZOMBIE_CHEW_WOODEN_DOOR, 0);
} }

View File

@ -1,5 +1,6 @@
package mineplex.game.clans.items.legendaries; package mineplex.game.clans.items.legendaries;
import org.bukkit.GameMode;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.Sound; import org.bukkit.Sound;
@ -22,6 +23,7 @@ import mineplex.core.common.util.UtilColor;
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;
import mineplex.core.common.util.UtilParticle.ViewDist; import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.incognito.IncognitoManager;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilShapes; import mineplex.core.common.util.UtilShapes;
@ -71,11 +73,11 @@ public class MeridianScepter extends LegendaryItem
} }
} }
private void fire(final Player player) private void fire(final Player shooter)
{ {
final Location projectile = player.getEyeLocation(); final Location projectile = shooter.getEyeLocation();
final Location origin = player.getEyeLocation(); final Location origin = shooter.getEyeLocation();
final Vector direction = player.getEyeLocation().getDirection().normalize().multiply(0.25); final Vector direction = shooter.getEyeLocation().getDirection().normalize().multiply(0.25);
final int maxRange = 50; final int maxRange = 50;
final int maxDings = maxRange * 4; final int maxDings = maxRange * 4;
final int damage = 6; final int damage = 6;
@ -89,27 +91,24 @@ public class MeridianScepter extends LegendaryItem
{ {
for (Entity cur : projectile.getWorld().getEntities()) for (Entity cur : projectile.getWorld().getEntities())
{ {
if (cur == player || !(cur instanceof LivingEntity) || (cur instanceof Player && UtilPlayer.isSpectator(cur))) if (cur == shooter || !(cur instanceof Player) || (cur instanceof Player && UtilPlayer.isSpectator(cur)))
continue; continue;
LivingEntity entity = (LivingEntity) cur; Player player = (Player) cur;
Location eLoc = entity.getLocation(); Location eLoc = player.getLocation();
// If they are less than 0.5 blocks away // If they are less than 0.5 blocks away
if (eLoc.clone().add(0, entity.getEyeHeight() / 2, 0).distance(projectile) <= 0.7) if (eLoc.clone().add(0, player.getEyeHeight() / 2, 0).distance(projectile) <= 0.7)
{ {
ClansManager.getInstance().getDamageManager().NewDamageEvent(entity, player, null, ClansManager.getInstance().getDamageManager().NewDamageEvent(player, player, null,
DamageCause.CUSTOM, damage, true, true, false, DamageCause.CUSTOM, damage, true, true, false,
player.getName(), "Meridian Scepter"); player.getName(), "Meridian Scepter");
entity.addPotionEffect(new PotionEffect(PotionEffectType.WITHER, 20 * 4, 0)); player.addPotionEffect(new PotionEffect(PotionEffectType.WITHER, 20 * 4, 0));
if (entity instanceof Player) UtilPlayer.message(player, F.main("Clans", F.elem(player.getName()) + " hit you with a " + F.elem("Meridian Scepter") + C.mBody + "."));
{ UtilPlayer.message(shooter, F.main("Clans", "You hit " + F.elem(player.getName()) + " with your " + F.elem("Meridian Scepter") + C.mBody + "."));
UtilPlayer.message(entity, F.main("Clans", F.elem(player.getName()) + " hit you with a " + F.elem("Meridian Scepter") + C.mBody + "."));
UtilPlayer.message(player, F.main("Clans", "You hit " + F.elem(entity.getName()) + " with your " + F.elem("Meridian Scepter") + C.mBody + "."));
}
} }
} }
@ -120,7 +119,7 @@ public class MeridianScepter extends LegendaryItem
public void run() public void run()
{ {
if (dingsDone >= maxDings || !player.isOnline()) if (dingsDone >= maxDings || !shooter.isOnline())
{ {
burst(); burst();
} }
@ -138,9 +137,39 @@ public class MeridianScepter extends LegendaryItem
continue; continue;
} }
if (ClansManager.getInstance().getPvpTimer().hasTimer(closest))
{
continue;
}
if (ClansManager.getInstance().getClan(shooter) == ClansManager.getInstance().getClan(closest))
{
continue;
}
if (shooter.getGameMode().equals(GameMode.CREATIVE) || shooter.getGameMode().equals(GameMode.SPECTATOR))
{
continue;
}
if (IncognitoManager.Instance.Get(closest).Status)
{
continue;
}
if (ClansManager.getInstance().getClan(shooter) != null && ClansManager.getInstance().getClan(shooter).isAlly(ClansManager.getInstance().getClan(closest)))
{
continue;
}
if (ClansManager.getInstance().getClanUtility().getClaim(closest.getLocation()) != null && ClansManager.getInstance().getClanUtility().getClaim(closest.getLocation()).isSafe(closest.getLocation()))
{
continue;
}
Location loc = closest.getLocation(); Location loc = closest.getLocation();
if (closest != player) if (closest != shooter)
{ {
double dist1 = loc.distance(origin); double dist1 = loc.distance(origin);
if (dist1 < maxRange + 10) if (dist1 < maxRange + 10)
@ -172,7 +201,7 @@ public class MeridianScepter extends LegendaryItem
for (Entity cur : projectile.getWorld().getEntities()) for (Entity cur : projectile.getWorld().getEntities())
{ {
if (cur == player || !(cur instanceof LivingEntity) if (cur == shooter || !(cur instanceof LivingEntity)
|| (cur instanceof Player && UtilPlayer.isSpectator(cur))) || (cur instanceof Player && UtilPlayer.isSpectator(cur)))
continue; continue;