Made Destructor sexi
This commit is contained in:
parent
92bab25a3f
commit
2cace7419f
@ -1256,7 +1256,7 @@ public abstract class Skywars extends Game
|
||||
|
||||
Player shooter = (Player)event.getEntity().getShooter();
|
||||
|
||||
if (GetKit(shooter) instanceof KitDestructor)
|
||||
if (event.getEntity().hasMetadata("Destructor"))
|
||||
return;
|
||||
|
||||
event.getEntity().setPassenger(shooter);
|
||||
|
@ -1,26 +1,44 @@
|
||||
package nautilus.game.arcade.kit.perks;
|
||||
|
||||
import mineplex.core.common.util.*;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilBlock;
|
||||
import mineplex.core.common.util.UtilEvent;
|
||||
import mineplex.core.common.util.UtilEvent.ActionType;
|
||||
import mineplex.core.common.util.UtilInv;
|
||||
import mineplex.core.common.util.UtilParticle;
|
||||
import mineplex.core.common.util.UtilParticle.ParticleType;
|
||||
import mineplex.core.common.util.UtilParticle.ViewDist;
|
||||
import mineplex.core.itemstack.*;
|
||||
import mineplex.core.recharge.*;
|
||||
import mineplex.core.updater.*;
|
||||
import mineplex.core.updater.event.*;
|
||||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||
import nautilus.game.arcade.kit.*;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.itemstack.ItemStackFactory;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import nautilus.game.arcade.kit.Perk;
|
||||
import nautilus.game.arcade.kit.perks.event.PerkDestructorBlockEvent;
|
||||
|
||||
import org.bukkit.*;
|
||||
import org.bukkit.block.*;
|
||||
import org.bukkit.entity.*;
|
||||
import org.bukkit.event.*;
|
||||
import org.bukkit.event.entity.*;
|
||||
import org.bukkit.event.inventory.*;
|
||||
import org.bukkit.event.player.*;
|
||||
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
|
||||
|
||||
import java.util.*;
|
||||
import org.bukkit.Effect;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.entity.EnderPearl;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.Projectile;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.entity.PlayerDeathEvent;
|
||||
import org.bukkit.event.entity.ProjectileHitEvent;
|
||||
import org.bukkit.event.entity.ProjectileLaunchEvent;
|
||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
import org.bukkit.event.player.PlayerDropItemEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.metadata.FixedMetadataValue;
|
||||
|
||||
public class PerkDestructor extends Perk
|
||||
{
|
||||
@ -31,6 +49,7 @@ public class PerkDestructor extends Perk
|
||||
|
||||
private long _fallTime;
|
||||
|
||||
private HashSet<String> _preparing = new HashSet<String>();
|
||||
private HashMap<Block, Long> _blocks = new HashMap<Block, Long>();
|
||||
|
||||
public PerkDestructor(int spawnRate, int max, long fallTime, boolean enabled)
|
||||
@ -74,7 +93,7 @@ public class PerkDestructor extends Perk
|
||||
if (!Recharge.Instance.use(cur, GetName(), _spawnRate * 1000, false, false))
|
||||
continue;
|
||||
|
||||
if (UtilInv.contains(cur, Material.ENDER_PEARL, (byte) 0, _max))
|
||||
if (UtilInv.contains(cur, "Seismic Charge", Material.ENDER_PEARL, (byte) 0, _max))
|
||||
continue;
|
||||
|
||||
//Add
|
||||
@ -119,7 +138,25 @@ public class PerkDestructor extends Perk
|
||||
UtilInv.DisallowMovementOf(event, "Seismic Charge", Material.ENDER_PEARL, (byte) 0, true);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
public void preThrowItem(PlayerInteractEvent event)
|
||||
{
|
||||
if (!UtilEvent.isAction(event, ActionType.R))
|
||||
return;
|
||||
|
||||
if (!Manager.GetGame().IsLive())
|
||||
return;
|
||||
|
||||
if (!Manager.IsAlive(event.getPlayer()))
|
||||
return;
|
||||
|
||||
if (!UtilInv.IsItem(event.getItem(), "Seismic Charge", Material.ENDER_PEARL, (byte) 0))
|
||||
return;
|
||||
|
||||
_preparing.add(event.getPlayer().getName());
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOW)
|
||||
public void throwItem(ProjectileLaunchEvent event)
|
||||
{
|
||||
if (Manager.GetGame() == null || !Manager.GetGame().IsLive())
|
||||
@ -128,47 +165,112 @@ public class PerkDestructor extends Perk
|
||||
if (!(event.getEntity() instanceof EnderPearl))
|
||||
return;
|
||||
|
||||
event.getEntity().setVelocity(event.getEntity().getVelocity().multiply(0.7));
|
||||
if (!(event.getEntity().getShooter() instanceof Player))
|
||||
return;
|
||||
|
||||
Player player = (Player) event.getEntity().getShooter();
|
||||
|
||||
if (!Manager.IsAlive(player))
|
||||
return;
|
||||
|
||||
if (_preparing.contains(player.getName()))
|
||||
{
|
||||
_preparing.remove(player.getName());
|
||||
event.getEntity().setMetadata("Destructor", new FixedMetadataValue(Manager.getPlugin(), 1));
|
||||
|
||||
event.getEntity().setVelocity(event.getEntity().getVelocity().multiply(0.7));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@EventHandler
|
||||
public void collide(PlayerTeleportEvent event)
|
||||
public void collide(ProjectileHitEvent event)
|
||||
{
|
||||
if (Manager.GetGame() == null || !Manager.GetGame().IsLive())
|
||||
if (!Manager.GetGame().IsLive())
|
||||
return;
|
||||
|
||||
Projectile proj = event.getEntity();
|
||||
|
||||
if (!(proj.getShooter() instanceof Player))
|
||||
return;
|
||||
|
||||
Player player = (Player) proj.getShooter();
|
||||
|
||||
if (!Manager.IsAlive(player))
|
||||
return;
|
||||
|
||||
if (!Kit.HasKit(player))
|
||||
return;
|
||||
|
||||
if (event.getCause() != TeleportCause.ENDER_PEARL)
|
||||
if (!proj.hasMetadata("Destructor"))
|
||||
return;
|
||||
|
||||
if (!Kit.HasKit(event.getPlayer()))
|
||||
return;
|
||||
|
||||
for (Block block : UtilBlock.getInRadius(event.getTo(), 4).keySet())
|
||||
for (Block block : UtilBlock.getInRadius(proj.getLocation(), 4).keySet())
|
||||
{
|
||||
if (block.getType() == Material.AIR || block.getType() == Material.BEDROCK || block.isLiquid())
|
||||
continue;
|
||||
|
||||
//Event
|
||||
PerkDestructorBlockEvent blockEvent = new PerkDestructorBlockEvent(event.getPlayer(), block);
|
||||
PerkDestructorBlockEvent blockEvent = new PerkDestructorBlockEvent(player, block);
|
||||
UtilServer.getServer().getPluginManager().callEvent(blockEvent);
|
||||
|
||||
if (!blockEvent.isCancelled())
|
||||
{
|
||||
_blocks.put(block, System.currentTimeMillis());
|
||||
|
||||
|
||||
block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, block.getType());
|
||||
}
|
||||
}
|
||||
|
||||
UtilParticle.PlayParticle(ParticleType.LARGE_EXPLODE, event.getTo(), 0f, 0f, 0f, 0f, 1,
|
||||
ViewDist.MAX, UtilServer.getPlayers());
|
||||
|
||||
event.getTo().getWorld().playSound(event.getTo(), Sound.EXPLODE, 1f, 0.5f);
|
||||
event.getTo().getWorld().playSound(event.getTo(), Sound.FIREWORK_TWINKLE, 2f, 0.5f);
|
||||
|
||||
event.setCancelled(true);
|
||||
|
||||
UtilParticle.PlayParticle(ParticleType.LARGE_EXPLODE, proj.getLocation(), 0f, 0f, 0f, 0f, 1, ViewDist.MAX, UtilServer.getPlayers());
|
||||
|
||||
proj.getWorld().playSound(proj.getLocation(), Sound.EXPLODE, 1f, 0.5f);
|
||||
proj.getWorld().playSound(proj.getLocation(), Sound.FIREWORK_TWINKLE, 2f, 0.5f);
|
||||
}
|
||||
|
||||
// @EventHandler
|
||||
// public void collide(PlayerTeleportEvent event)
|
||||
// {
|
||||
// if (Manager.GetGame() == null || !Manager.GetGame().IsLive())
|
||||
// return;
|
||||
//
|
||||
// if (event.getCause() != TeleportCause.ENDER_PEARL)
|
||||
// return;
|
||||
//
|
||||
// if (!Manager.IsAlive(event.getPlayer()))
|
||||
// return;
|
||||
//
|
||||
// if (!Kit.HasKit(event.getPlayer()))
|
||||
// return;
|
||||
//
|
||||
//
|
||||
//
|
||||
// for (Block block : UtilBlock.getInRadius(event.getTo(), 4).keySet())
|
||||
// {
|
||||
// if (block.getType() == Material.AIR || block.getType() == Material.BEDROCK || block.isLiquid())
|
||||
// continue;
|
||||
//
|
||||
// //Event
|
||||
// PerkDestructorBlockEvent blockEvent = new PerkDestructorBlockEvent(event.getPlayer(), block);
|
||||
// UtilServer.getServer().getPluginManager().callEvent(blockEvent);
|
||||
//
|
||||
// if (!blockEvent.isCancelled())
|
||||
// {
|
||||
// _blocks.put(block, System.currentTimeMillis());
|
||||
//
|
||||
// block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, block.getType());
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// UtilParticle.PlayParticle(ParticleType.LARGE_EXPLODE, event.getTo(), 0f, 0f, 0f, 0f, 1,
|
||||
// ViewDist.MAX, UtilServer.getPlayers());
|
||||
//
|
||||
// event.getTo().getWorld().playSound(event.getTo(), Sound.EXPLODE, 1f, 0.5f);
|
||||
// event.getTo().getWorld().playSound(event.getTo(), Sound.FIREWORK_TWINKLE, 2f, 0.5f);
|
||||
//
|
||||
// event.setCancelled(true);
|
||||
// }
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@EventHandler
|
||||
public void fall(UpdateEvent event)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user