Merge branches 'develop' and 'feature/lobby-update' of https://github.com/Mineplex-LLC/Minecraft-PC into feature/lobby-update
# Conflicts: # Plugins/Mineplex.Core/src/mineplex/core/progression/ProgressiveKit.java # Plugins/Mineplex.Core/src/mineplex/core/progression/gui/buttons/KitUpgradeDetailsButton.java # Plugins/Mineplex.Core/src/mineplex/core/progression/gui/buttons/KitUpgradeMenuButton.java # Plugins/Mineplex.Core/src/mineplex/core/progression/gui/guis/KitDisplayMenu.java # Plugins/Mineplex.Core/src/mineplex/core/progression/gui/guis/KitInformationTrackerMenu.java # Plugins/Mineplex.Hub/src/mineplex/hub/modules/WorldManager.java # Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/ProgressingKit.java
This commit is contained in:
commit
bca19788db
@ -196,7 +196,7 @@ public class UtilPlayer
|
||||
for (Entity entity : p.getNearbyEntities(range, range, range))
|
||||
{
|
||||
|
||||
if (entity == p || UtilPlayer.isSpectator(entity))
|
||||
if (entity == p || UtilPlayer.isSpectator(entity) || !(entity instanceof Player))
|
||||
continue;
|
||||
|
||||
double theirDist = p.getEyeLocation().distance(entity.getLocation());
|
||||
|
@ -1,77 +0,0 @@
|
||||
package mineplex.core.interactions;
|
||||
|
||||
import mineplex.core.MiniPlugin;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Event.Result;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
import org.bukkit.event.inventory.InventoryType;
|
||||
import org.bukkit.event.player.PlayerArmorStandManipulateEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
|
||||
/**
|
||||
* Manages interactions with Armor stands, paintings, and in the main hub, taking items out of chests.
|
||||
*/
|
||||
public class NewInteractionsManager extends MiniPlugin
|
||||
{
|
||||
|
||||
public NewInteractionsManager()
|
||||
{
|
||||
super("Interactions Manager");
|
||||
registerEvents(this);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onInteract(PlayerArmorStandManipulateEvent event)
|
||||
{
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onClickBrewingStand(PlayerInteractEvent event)
|
||||
{
|
||||
if(event.getClickedBlock() != null && event.getClickedBlock().getType() == Material.BREWING_STAND)
|
||||
{
|
||||
event.setCancelled(true);
|
||||
event.setUseInteractedBlock(Result.DENY);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
public void onChestInteract(InventoryClickEvent event)
|
||||
{
|
||||
Player player = (Player) event.getWhoClicked();
|
||||
Inventory inventory = event.getClickedInventory();
|
||||
|
||||
if(inventory == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if(event.getCurrentItem() == null || event.getCurrentItem().getType() == Material.AIR)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if(inventory.getType() != InventoryType.CHEST)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if(inventory.getSize() != 27 && inventory.getSize() != 54)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if(inventory.getTitle() != null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
event.setCancelled(true);
|
||||
event.setResult(Result.DENY);
|
||||
}
|
||||
}
|
@ -1,30 +1,20 @@
|
||||
package mineplex.core.gadget;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
import mineplex.core.gadget.commands.LockCosmeticsCommand;
|
||||
import mineplex.core.gadget.event.GadgetChangeEvent;
|
||||
import mineplex.core.gadget.event.GadgetEnableEvent;
|
||||
import mineplex.core.gadget.gadgets.arrowtrail.freedom.ArrowTrailFreedom;
|
||||
import mineplex.core.gadget.gadgets.death.freedom.DeathFreedom;
|
||||
import mineplex.core.gadget.gadgets.doublejump.freedom.DoubleJumpFreedom;
|
||||
import mineplex.core.gadget.gadgets.gamemodifiers.kits.KitModifier;
|
||||
import mineplex.core.gadget.gadgets.hat.*;
|
||||
import mineplex.core.gadget.gadgets.morph.*;
|
||||
import mineplex.core.gadget.gadgets.outfit.windupsuit.*;
|
||||
import mineplex.core.gadget.gadgets.particle.*;
|
||||
import mineplex.core.gadget.gadgets.particle.candycane.ParticleCandyCane;
|
||||
import mineplex.core.gadget.gadgets.particle.freedom.ParticleFreedom;
|
||||
import mineplex.core.gadget.gadgets.wineffect.*;
|
||||
import mineplex.core.gadget.persistence.UserGadgetPersistence;
|
||||
import mineplex.core.gadget.set.*;
|
||||
import mineplex.core.gadget.types.*;
|
||||
import mineplex.core.incognito.events.IncognitoHidePlayerEvent;
|
||||
import mineplex.core.incognito.events.IncognitoStatusChangeEvent;
|
||||
import org.bukkit.*;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.entity.PlayerDeathEvent;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.event.player.PlayerMoveEvent;
|
||||
@ -44,46 +34,55 @@ import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.disguise.DisguiseManager;
|
||||
import mineplex.core.donation.DonationManager;
|
||||
import mineplex.core.gadget.commands.AmmoCommand;
|
||||
import mineplex.core.gadget.commands.LockCosmeticsCommand;
|
||||
import mineplex.core.gadget.commands.UnlockCosmeticsCommand;
|
||||
import mineplex.core.gadget.event.GadgetChangeEvent;
|
||||
import mineplex.core.gadget.event.GadgetCollideEntityEvent;
|
||||
import mineplex.core.gadget.gadgets.arrowtrail.vampire.ArrowTrailBlood;
|
||||
import mineplex.core.gadget.event.GadgetEnableEvent;
|
||||
import mineplex.core.gadget.gadgets.arrowtrail.candycane.ArrowTrailCandyCane;
|
||||
import mineplex.core.gadget.gadgets.arrowtrail.party.ArrowTrailConfetti;
|
||||
import mineplex.core.gadget.gadgets.arrowtrail.cupidslove.ArrowTrailCupid;
|
||||
import mineplex.core.gadget.gadgets.arrowtrail.emerald.ArrowTrailEmerald;
|
||||
import mineplex.core.gadget.gadgets.arrowtrail.wisdom.ArrowTrailEnchant;
|
||||
import mineplex.core.gadget.gadgets.arrowtrail.freedom.ArrowTrailFreedom;
|
||||
import mineplex.core.gadget.gadgets.arrowtrail.frostlord.ArrowTrailFrostLord;
|
||||
import mineplex.core.gadget.gadgets.arrowtrail.music.ArrowTrailMusic;
|
||||
import mineplex.core.gadget.gadgets.arrowtrail.shadow.ArrowTrailShadow;
|
||||
import mineplex.core.gadget.gadgets.arrowtrail.howlingwinds.ArrowTrailStorm;
|
||||
import mineplex.core.gadget.gadgets.arrowtrail.music.ArrowTrailMusic;
|
||||
import mineplex.core.gadget.gadgets.arrowtrail.party.ArrowTrailConfetti;
|
||||
import mineplex.core.gadget.gadgets.arrowtrail.shadow.ArrowTrailShadow;
|
||||
import mineplex.core.gadget.gadgets.arrowtrail.titan.ArrowTrailTitan;
|
||||
import mineplex.core.gadget.gadgets.death.vampire.DeathBlood;
|
||||
import mineplex.core.gadget.gadgets.arrowtrail.vampire.ArrowTrailBlood;
|
||||
import mineplex.core.gadget.gadgets.arrowtrail.wisdom.ArrowTrailEnchant;
|
||||
import mineplex.core.gadget.gadgets.death.candycane.DeathCandyCane;
|
||||
import mineplex.core.gadget.gadgets.death.cupidslove.DeathCupidsBrokenHeart;
|
||||
import mineplex.core.gadget.gadgets.death.emerald.DeathEmerald;
|
||||
import mineplex.core.gadget.gadgets.death.wisdom.DeathEnchant;
|
||||
import mineplex.core.gadget.gadgets.death.freedom.DeathFreedom;
|
||||
import mineplex.core.gadget.gadgets.death.frostlord.DeathFrostLord;
|
||||
import mineplex.core.gadget.gadgets.death.howlingwinds.DeathStorm;
|
||||
import mineplex.core.gadget.gadgets.death.music.DeathMusic;
|
||||
import mineplex.core.gadget.gadgets.death.party.DeathPinataBurst;
|
||||
import mineplex.core.gadget.gadgets.death.shadow.DeathShadow;
|
||||
import mineplex.core.gadget.gadgets.death.howlingwinds.DeathStorm;
|
||||
import mineplex.core.gadget.gadgets.death.titan.DeathTitan;
|
||||
import mineplex.core.gadget.gadgets.doublejump.vampire.DoubleJumpBlood;
|
||||
import mineplex.core.gadget.gadgets.death.vampire.DeathBlood;
|
||||
import mineplex.core.gadget.gadgets.death.wisdom.DeathEnchant;
|
||||
import mineplex.core.gadget.gadgets.doublejump.candycane.DoubleJumpCandyCane;
|
||||
import mineplex.core.gadget.gadgets.doublejump.cupidslove.DoubleJumpCupidsWings;
|
||||
import mineplex.core.gadget.gadgets.doublejump.emerald.DoubleJumpEmerald;
|
||||
import mineplex.core.gadget.gadgets.doublejump.wisdom.DoubleJumpEnchant;
|
||||
import mineplex.core.gadget.gadgets.doublejump.party.DoubleJumpFirecracker;
|
||||
import mineplex.core.gadget.gadgets.doublejump.freedom.DoubleJumpFreedom;
|
||||
import mineplex.core.gadget.gadgets.doublejump.frostlord.DoubleJumpFrostLord;
|
||||
import mineplex.core.gadget.gadgets.doublejump.music.DoubleJumpMusic;
|
||||
import mineplex.core.gadget.gadgets.doublejump.shadow.DoubleJumpShadow;
|
||||
import mineplex.core.gadget.gadgets.doublejump.howlingwinds.DoubleJumpStorm;
|
||||
import mineplex.core.gadget.gadgets.doublejump.music.DoubleJumpMusic;
|
||||
import mineplex.core.gadget.gadgets.doublejump.party.DoubleJumpFirecracker;
|
||||
import mineplex.core.gadget.gadgets.doublejump.shadow.DoubleJumpShadow;
|
||||
import mineplex.core.gadget.gadgets.doublejump.titan.DoubleJumpTitan;
|
||||
import mineplex.core.gadget.gadgets.doublejump.vampire.DoubleJumpBlood;
|
||||
import mineplex.core.gadget.gadgets.doublejump.wisdom.DoubleJumpEnchant;
|
||||
import mineplex.core.gadget.gadgets.gamemodifiers.GameModifierType;
|
||||
import mineplex.core.gadget.gadgets.gamemodifiers.kits.KitGameModifier;
|
||||
import mineplex.core.gadget.gadgets.gamemodifiers.kits.KitModifier;
|
||||
import mineplex.core.gadget.gadgets.gamemodifiers.kits.KitModifierType;
|
||||
import mineplex.core.gadget.gadgets.gamemodifiers.minestrike.GameModifierMineStrikeSkin;
|
||||
import mineplex.core.gadget.gadgets.gamemodifiers.minestrike.MineStrikeSkin;
|
||||
import mineplex.core.gadget.gadgets.hat.HatItem;
|
||||
import mineplex.core.gadget.gadgets.hat.HatType;
|
||||
import mineplex.core.gadget.gadgets.item.ItemBatGun;
|
||||
import mineplex.core.gadget.gadgets.item.ItemBow;
|
||||
import mineplex.core.gadget.gadgets.item.ItemCoal;
|
||||
@ -101,6 +100,22 @@ import mineplex.core.gadget.gadgets.item.ItemPaintbrush;
|
||||
import mineplex.core.gadget.gadgets.item.ItemPartyPopper;
|
||||
import mineplex.core.gadget.gadgets.item.ItemSnowball;
|
||||
import mineplex.core.gadget.gadgets.item.ItemTNT;
|
||||
import mineplex.core.gadget.gadgets.morph.MorphBat;
|
||||
import mineplex.core.gadget.gadgets.morph.MorphBlaze;
|
||||
import mineplex.core.gadget.gadgets.morph.MorphBlock;
|
||||
import mineplex.core.gadget.gadgets.morph.MorphBunny;
|
||||
import mineplex.core.gadget.gadgets.morph.MorphChicken;
|
||||
import mineplex.core.gadget.gadgets.morph.MorphCow;
|
||||
import mineplex.core.gadget.gadgets.morph.MorphCreeper;
|
||||
import mineplex.core.gadget.gadgets.morph.MorphEnderman;
|
||||
import mineplex.core.gadget.gadgets.morph.MorphPig;
|
||||
import mineplex.core.gadget.gadgets.morph.MorphPumpkinKing;
|
||||
import mineplex.core.gadget.gadgets.morph.MorphSlime;
|
||||
import mineplex.core.gadget.gadgets.morph.MorphSnowman;
|
||||
import mineplex.core.gadget.gadgets.morph.MorphTitan;
|
||||
import mineplex.core.gadget.gadgets.morph.MorphUncleSam;
|
||||
import mineplex.core.gadget.gadgets.morph.MorphVillager;
|
||||
import mineplex.core.gadget.gadgets.morph.MorphWither;
|
||||
import mineplex.core.gadget.gadgets.outfit.OutfitTeam;
|
||||
import mineplex.core.gadget.gadgets.outfit.ravesuit.OutfitRaveSuitBoots;
|
||||
import mineplex.core.gadget.gadgets.outfit.ravesuit.OutfitRaveSuitChestplate;
|
||||
@ -110,20 +125,67 @@ import mineplex.core.gadget.gadgets.outfit.spacesuit.OutfitSpaceSuitBoots;
|
||||
import mineplex.core.gadget.gadgets.outfit.spacesuit.OutfitSpaceSuitChestplate;
|
||||
import mineplex.core.gadget.gadgets.outfit.spacesuit.OutfitSpaceSuitHelmet;
|
||||
import mineplex.core.gadget.gadgets.outfit.spacesuit.OutfitSpaceSuitLeggings;
|
||||
import mineplex.core.gadget.gadgets.particle.vampire.ParticleBlood;
|
||||
import mineplex.core.gadget.gadgets.particle.emerald.ParticleEmerald;
|
||||
import mineplex.core.gadget.gadgets.particle.wisdom.ParticleEnchant;
|
||||
import mineplex.core.gadget.gadgets.particle.shadow.ParticleFoot;
|
||||
import mineplex.core.gadget.gadgets.particle.frostlord.ParticleFrostLord;
|
||||
import mineplex.core.gadget.gadgets.outfit.windupsuit.OutfitWindUpSuitBoosterManager;
|
||||
import mineplex.core.gadget.gadgets.particle.ParticleCoalFumes;
|
||||
import mineplex.core.gadget.gadgets.particle.ParticleFairy;
|
||||
import mineplex.core.gadget.gadgets.particle.ParticleFireRings;
|
||||
import mineplex.core.gadget.gadgets.particle.ParticleLegend;
|
||||
import mineplex.core.gadget.gadgets.particle.ParticleWingsAngel;
|
||||
import mineplex.core.gadget.gadgets.particle.ParticleWingsDemons;
|
||||
import mineplex.core.gadget.gadgets.particle.ParticleWingsInfernal;
|
||||
import mineplex.core.gadget.gadgets.particle.ParticleWingsPixie;
|
||||
import mineplex.core.gadget.gadgets.particle.ParticleYinYang;
|
||||
import mineplex.core.gadget.gadgets.particle.candycane.ParticleCandyCane;
|
||||
import mineplex.core.gadget.gadgets.particle.cupidslove.ParticleHeart;
|
||||
import mineplex.core.gadget.gadgets.particle.emerald.ParticleEmerald;
|
||||
import mineplex.core.gadget.gadgets.particle.freedom.ParticleFreedom;
|
||||
import mineplex.core.gadget.gadgets.particle.frostlord.ParticleFrostLord;
|
||||
import mineplex.core.gadget.gadgets.particle.howlingwinds.ParticleRain;
|
||||
import mineplex.core.gadget.gadgets.particle.music.ParticleMusic;
|
||||
import mineplex.core.gadget.gadgets.particle.party.ParticlePartyTime;
|
||||
import mineplex.core.gadget.gadgets.particle.howlingwinds.ParticleRain;
|
||||
import mineplex.core.gadget.gadgets.particle.shadow.ParticleFoot;
|
||||
import mineplex.core.gadget.gadgets.particle.titan.ParticleTitan;
|
||||
import mineplex.core.gadget.gadgets.particle.vampire.ParticleBlood;
|
||||
import mineplex.core.gadget.gadgets.particle.wisdom.ParticleEnchant;
|
||||
import mineplex.core.gadget.gadgets.wineffect.WinEffectBabyChicken;
|
||||
import mineplex.core.gadget.gadgets.wineffect.WinEffectFlames;
|
||||
import mineplex.core.gadget.gadgets.wineffect.WinEffectLavaTrap;
|
||||
import mineplex.core.gadget.gadgets.wineffect.WinEffectLightningStrike;
|
||||
import mineplex.core.gadget.gadgets.wineffect.WinEffectMrPunchMan;
|
||||
import mineplex.core.gadget.gadgets.wineffect.WinEffectPodium;
|
||||
import mineplex.core.gadget.gadgets.wineffect.WinEffectRiseOfTheElderGuardian;
|
||||
import mineplex.core.gadget.gadgets.wineffect.WinEffectSnowTrails;
|
||||
import mineplex.core.gadget.persistence.UserGadgetPersistence;
|
||||
import mineplex.core.gadget.set.SetCandyCane;
|
||||
import mineplex.core.gadget.set.SetCupidsLove;
|
||||
import mineplex.core.gadget.set.SetEmerald;
|
||||
import mineplex.core.gadget.set.SetFreedom;
|
||||
import mineplex.core.gadget.set.SetFrostLord;
|
||||
import mineplex.core.gadget.set.SetHowlingWinds;
|
||||
import mineplex.core.gadget.set.SetMusic;
|
||||
import mineplex.core.gadget.set.SetParty;
|
||||
import mineplex.core.gadget.set.SetShadow;
|
||||
import mineplex.core.gadget.set.SetTitan;
|
||||
import mineplex.core.gadget.set.SetVampire;
|
||||
import mineplex.core.gadget.set.SetWisdom;
|
||||
import mineplex.core.gadget.set.suits.SetRaveSuit;
|
||||
import mineplex.core.gadget.set.suits.SetSpaceSuit;
|
||||
import mineplex.core.gadget.types.ArrowEffectGadget;
|
||||
import mineplex.core.gadget.types.DeathEffectGadget;
|
||||
import mineplex.core.gadget.types.DoubleJumpEffectGadget;
|
||||
import mineplex.core.gadget.types.Gadget;
|
||||
import mineplex.core.gadget.types.GadgetSet;
|
||||
import mineplex.core.gadget.types.GadgetType;
|
||||
import mineplex.core.gadget.types.GameModifierGadget;
|
||||
import mineplex.core.gadget.types.HatGadget;
|
||||
import mineplex.core.gadget.types.ItemGadget;
|
||||
import mineplex.core.gadget.types.MusicGadget;
|
||||
import mineplex.core.gadget.types.OutfitGadget;
|
||||
import mineplex.core.gadget.types.OutfitGadget.ArmorSlot;
|
||||
import mineplex.core.gadget.types.ParticleGadget;
|
||||
import mineplex.core.gadget.types.WinEffectGadget;
|
||||
import mineplex.core.hologram.HologramManager;
|
||||
import mineplex.core.incognito.events.IncognitoStatusChangeEvent;
|
||||
import mineplex.core.inventory.InventoryManager;
|
||||
import mineplex.core.mount.MountManager;
|
||||
import mineplex.core.mount.event.MountActivateEvent;
|
||||
@ -160,6 +222,8 @@ public class GadgetManager extends MiniPlugin
|
||||
private boolean _hideParticles = false;
|
||||
private int _activeItemSlot = 3;
|
||||
private boolean _gadgetsEnabled = true;
|
||||
|
||||
private Set<Entity> _gadgetCollideWhitelist = new HashSet<>();
|
||||
|
||||
public GadgetManager(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager, InventoryManager inventoryManager,
|
||||
MountManager mountManager, PetManager petManager, PreferencesManager preferencesManager,
|
||||
@ -740,7 +804,7 @@ public class GadgetManager extends MiniPlugin
|
||||
return _mountManager;
|
||||
}
|
||||
|
||||
public boolean collideEvent(Player shooter, Gadget gadget, Player other)
|
||||
public boolean collideEvent(Player shooter, Gadget gadget, Entity other)
|
||||
{
|
||||
GadgetCollideEntityEvent collideEvent = new GadgetCollideEntityEvent(shooter, gadget, other);
|
||||
|
||||
@ -796,6 +860,46 @@ public class GadgetManager extends MiniPlugin
|
||||
{
|
||||
_lastMove.remove(event.getEntity());
|
||||
}
|
||||
|
||||
|
||||
@EventHandler(priority = EventPriority.LOW)
|
||||
public void onGadgetCollide(GadgetCollideEntityEvent event)
|
||||
{
|
||||
if(event.getOther() instanceof Player)
|
||||
{
|
||||
event.setCancelled(false);
|
||||
return;
|
||||
}
|
||||
if(isAffectedByGadgets(event.getOther()))
|
||||
{
|
||||
event.setCancelled(false);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param e The entity to check
|
||||
* @return Returns true if the entity is affected by gadgets like snowballs, flesh hooks etc
|
||||
*/
|
||||
public boolean isAffectedByGadgets(Entity e)
|
||||
{
|
||||
return _gadgetCollideWhitelist.contains(e);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set whether or not the given entity should be affected by gadgets by snowball, flesh hooks etc
|
||||
* By default only players and naturally spawned entities are affected.
|
||||
*/
|
||||
public void setAffectedByGadgets(Entity e, boolean affected)
|
||||
{
|
||||
if(affected)
|
||||
{
|
||||
_gadgetCollideWhitelist.add(e);
|
||||
}
|
||||
else
|
||||
{
|
||||
_gadgetCollideWhitelist.remove(e);
|
||||
}
|
||||
}
|
||||
|
||||
public void setActive(Player player, Gadget gadget)
|
||||
{
|
||||
|
@ -2,12 +2,16 @@ package mineplex.core.gadget.event;
|
||||
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
import mineplex.core.gadget.types.Gadget;
|
||||
|
||||
public class GadgetCollideEntityEvent extends Event
|
||||
/**
|
||||
* An event called when a gadget used by a player collides with an entity. By default, only players are effected (event is cancelled).
|
||||
*/
|
||||
public class GadgetCollideEntityEvent extends Event implements Cancellable
|
||||
{
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
@ -15,7 +19,7 @@ public class GadgetCollideEntityEvent extends Event
|
||||
private Gadget _gadget;
|
||||
private Entity _other;
|
||||
|
||||
private boolean _cancelled = false;
|
||||
private boolean _cancelled = true;
|
||||
|
||||
public GadgetCollideEntityEvent(Player player, Gadget gadget, Entity other)
|
||||
{
|
||||
|
@ -13,9 +13,9 @@ import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.LineFormat;
|
||||
import mineplex.core.common.util.UtilAction;
|
||||
import mineplex.core.common.util.UtilAlg;
|
||||
import mineplex.core.common.util.UtilParticle.ParticleType;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilText;
|
||||
import mineplex.core.common.util.UtilParticle.ParticleType;
|
||||
import mineplex.core.gadget.GadgetManager;
|
||||
import mineplex.core.gadget.gadgets.Ammo;
|
||||
import mineplex.core.gadget.types.ItemGadget;
|
||||
@ -66,9 +66,8 @@ public class ItemFleshHook extends ItemGadget implements IThrown
|
||||
if (target == null)
|
||||
return;
|
||||
|
||||
if (target instanceof Player)
|
||||
if (Manager.collideEvent(player, this, (Player) target))
|
||||
return;
|
||||
if (Manager.collideEvent(player, this, target))
|
||||
return;
|
||||
|
||||
//Pull
|
||||
UtilAction.velocity(target,
|
||||
|
@ -14,7 +14,6 @@ import mineplex.core.common.util.NautHashMap;
|
||||
import mineplex.core.common.util.UtilAction;
|
||||
import mineplex.core.common.util.UtilText;
|
||||
import mineplex.core.gadget.GadgetManager;
|
||||
import mineplex.core.gadget.event.GadgetCollideEntityEvent;
|
||||
import mineplex.core.gadget.gadgets.Ammo;
|
||||
import mineplex.core.gadget.types.ItemGadget;
|
||||
|
||||
@ -53,9 +52,8 @@ public class ItemSnowball extends ItemGadget
|
||||
|
||||
if(!_snowballs.containsKey(ball)) return;
|
||||
|
||||
GadgetCollideEntityEvent gevent = new GadgetCollideEntityEvent(_snowballs.remove(ball), this, event.getEntity());
|
||||
|
||||
if(gevent.isCancelled()) return;
|
||||
if(Manager.collideEvent(_snowballs.remove(ball), this, event.getEntity())) return;
|
||||
|
||||
|
||||
UtilAction.velocity(event.getEntity(), event.getDamager().getVelocity().normalize().add(new Vector(0,0.5,0)).multiply(0.5));
|
||||
event.getDamager().getWorld().playSound(event.getDamager().getLocation(), Sound.STEP_SNOW, 1, 0.5f);
|
||||
|
@ -19,15 +19,14 @@ import mineplex.core.common.util.NautHashMap;
|
||||
import mineplex.core.common.util.UtilAction;
|
||||
import mineplex.core.common.util.UtilEnt;
|
||||
import mineplex.core.common.util.UtilEvent;
|
||||
import mineplex.core.common.util.UtilText;
|
||||
import mineplex.core.common.util.UtilEvent.ActionType;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.common.util.UtilParticle;
|
||||
import mineplex.core.common.util.UtilParticle.ParticleType;
|
||||
import mineplex.core.common.util.UtilParticle.ViewDist;
|
||||
import mineplex.core.common.util.UtilText;
|
||||
import mineplex.core.disguise.disguises.DisguiseSnowman;
|
||||
import mineplex.core.gadget.GadgetManager;
|
||||
import mineplex.core.gadget.event.GadgetCollideEntityEvent;
|
||||
import mineplex.core.gadget.types.MorphGadget;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
import mineplex.core.recharge.RechargeData;
|
||||
@ -143,10 +142,8 @@ public class MorphSnowman extends MorphGadget
|
||||
if (!_snowball.containsKey(proj))
|
||||
return;
|
||||
|
||||
GadgetCollideEntityEvent gevent = new GadgetCollideEntityEvent(_snowball.remove(proj), this, event.getEntity());
|
||||
|
||||
if(gevent.isCancelled()) return;
|
||||
|
||||
if(Manager.collideEvent(_snowball.remove(proj), this, event.getEntity())) return;
|
||||
|
||||
UtilAction.velocity(event.getEntity(), proj.getVelocity().multiply(0.15).add(new Vector(0, 0.15, 0)));
|
||||
}
|
||||
|
||||
|
@ -266,7 +266,7 @@ public class InventoryManager extends MiniDbClientPlugin<ClientInventory>
|
||||
@EventHandler
|
||||
public void onInventoryClick(final InventoryClickEvent event)
|
||||
{
|
||||
if (event.getView().getTopInventory().getType() != InventoryType.ENCHANTING)
|
||||
if (event.getClickedInventory().getType() != InventoryType.ENCHANTING)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -1,18 +1,18 @@
|
||||
package mineplex.core.progression;
|
||||
|
||||
import mineplex.core.common.util.UtilParticle;
|
||||
import mineplex.core.common.util.UtilParticle.ParticleType;
|
||||
import mineplex.core.common.util.UtilParticle.ViewDist;
|
||||
import mineplex.core.progression.data.KitAbilityDetail;
|
||||
import mineplex.core.progression.math.Calculations;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.common.util.UtilParticle;
|
||||
import mineplex.core.common.util.UtilParticle.ParticleType;
|
||||
import mineplex.core.common.util.UtilParticle.ViewDist;
|
||||
import mineplex.core.progression.math.Calculations;
|
||||
|
||||
/**
|
||||
* The API class all kits with the new system must use
|
||||
*/
|
||||
@ -50,11 +50,10 @@ public interface ProgressiveKit
|
||||
/**
|
||||
* This method gives the GUI information to display about the kit's upgrades and what they do
|
||||
* This information is being directly displayed in a GUI, so make sure it looks good
|
||||
* For more information, see the {@link KitAbilityDetail} class
|
||||
*
|
||||
* @return The map of upgrades and their details
|
||||
* @return The map of upgrade level to a list of upgrade details
|
||||
*/
|
||||
Map<Integer, List<KitAbilityDetail>> getAbilityDetails();
|
||||
Map<Integer, List<String>> getUpgradeDetails();
|
||||
|
||||
/**
|
||||
* Determines whether or not the kit UI is displayed with "Coming Soon" or actual upgrade details.
|
||||
|
@ -1,38 +0,0 @@
|
||||
package mineplex.core.progression.data;
|
||||
|
||||
import org.bukkit.Material;
|
||||
|
||||
/**
|
||||
* General wrapper for Ability Details (The display properties of this kits Abilities) for a GUI
|
||||
* The purpose is to limit the amount of hard coded data Kit's do and make it as flexible as possible.
|
||||
*/
|
||||
public class KitAbilityDetail
|
||||
{
|
||||
|
||||
private Material _icon;
|
||||
private String _displayName;
|
||||
private String[] _description;
|
||||
|
||||
public KitAbilityDetail(Material icon, String displayName, String[] description)
|
||||
{
|
||||
_icon = icon;
|
||||
_displayName = displayName;
|
||||
_description = description;
|
||||
}
|
||||
|
||||
public String getDisplayName()
|
||||
{
|
||||
return _displayName;
|
||||
}
|
||||
|
||||
public Material getIcon()
|
||||
{
|
||||
return _icon;
|
||||
}
|
||||
|
||||
public String[] getDescription()
|
||||
{
|
||||
return _description;
|
||||
}
|
||||
|
||||
}
|
@ -17,13 +17,11 @@ public class KitUpgradeButton extends KitButton
|
||||
{
|
||||
|
||||
private int _upgradeLevel;
|
||||
private String _upggradeName;
|
||||
|
||||
public KitUpgradeButton(ProgressiveKit kit, ItemStack itemStack, int upgradeLevel, String upggradeName)
|
||||
public KitUpgradeButton(ProgressiveKit kit, ItemStack itemStack, int upgradeLevel)
|
||||
{
|
||||
super(kit, itemStack);
|
||||
_upgradeLevel = upgradeLevel;
|
||||
_upggradeName = upggradeName;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -31,7 +29,7 @@ public class KitUpgradeButton extends KitButton
|
||||
{
|
||||
UUID uuid = player.getUniqueId();
|
||||
|
||||
if (!getKit().canPurchaseUpgrade(uuid, _upgradeLevel))
|
||||
if (!getKit().canPurchaseUpgrade(uuid, _upgradeLevel) || getKit().ownsUpgrade(uuid, _upgradeLevel))
|
||||
{
|
||||
player.playSound(player.getLocation(), Sound.ITEM_BREAK, 10.0F, 1.0F);
|
||||
player.sendMessage(F.main("Kit Progression", "You cannot purchase this upgrade!"));
|
||||
@ -42,7 +40,7 @@ public class KitUpgradeButton extends KitButton
|
||||
|
||||
player.playSound(player.getLocation(), Sound.CAT_MEOW, 5.0f, 1.0f);
|
||||
|
||||
player.sendMessage(F.main("Kit Progression", "Purchased " + _upggradeName));
|
||||
player.sendMessage(F.main("Kit Progression", "Purchased upgrades for " + getKit().getDisplayName() + " level " + _upgradeLevel));
|
||||
|
||||
Menu.remove(uuid);
|
||||
|
||||
|
@ -1,6 +1,13 @@
|
||||
package mineplex.core.progression.gui.buttons;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.itemstack.ItemBuilder;
|
||||
import mineplex.core.menu.IconButton;
|
||||
import mineplex.core.progression.data.KitAbilityDetail;
|
||||
@ -8,28 +15,34 @@ import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import mineplex.core.progression.gui.buttons.misc.IconButton;
|
||||
import mineplex.core.progression.math.Calculations;
|
||||
|
||||
/**
|
||||
* Representing this kits Abilities in a GUI
|
||||
*/
|
||||
public class KitAbilityButton extends IconButton
|
||||
public class KitUpgradeDetailsButton extends IconButton
|
||||
{
|
||||
|
||||
private ItemStack _item;
|
||||
|
||||
public KitAbilityButton(KitAbilityDetail detail)
|
||||
public KitUpgradeDetailsButton(int level, List<String> details)
|
||||
{
|
||||
super(null);
|
||||
|
||||
ItemBuilder builder = new ItemBuilder(detail.getIcon());
|
||||
ItemBuilder builder = new ItemBuilder(Material.SLIME_BALL);
|
||||
|
||||
builder.setTitle(detail.getDisplayName());
|
||||
builder.setTitle(C.cYellow + "Level " + level + " upgrades");
|
||||
|
||||
List<String> lore = Lists.newArrayList(" ");
|
||||
|
||||
lore.addAll(Arrays.asList(detail.getDescription()));
|
||||
lore.add(" ");
|
||||
for (String detail : details)
|
||||
{
|
||||
lore.add(C.cGray + detail);
|
||||
}
|
||||
|
||||
lore.add("");
|
||||
lore.add(C.cGray + "Unlocks at kit level " + C.cGreen + Calculations.getLevelRequiredFor(level));
|
||||
builder.setLore(lore.toArray(new String[lore.size()]));
|
||||
|
||||
_item = builder.build();
|
@ -55,6 +55,7 @@ public class KitUpgradeMenuButton extends KitButton
|
||||
if(kit.showUpgrades())
|
||||
{
|
||||
ItemBuilder builder = lore(new ItemBuilder(Material.ENCHANTMENT_TABLE), upgradeLevel, color, diff);
|
||||
builder.setTitle(C.cYellow + "Upgrade Level " + upgradeLevel);
|
||||
_item = builder.build();
|
||||
}
|
||||
|
||||
@ -114,11 +115,11 @@ public class KitUpgradeMenuButton extends KitButton
|
||||
@Override
|
||||
public void onClick(Player player, ClickType clickType)
|
||||
{
|
||||
this._flash = false;
|
||||
_flash = false;
|
||||
|
||||
if (_task != null)
|
||||
{
|
||||
this._task.cancel();
|
||||
_task.cancel();
|
||||
}
|
||||
|
||||
KitMenu menu = new KitInformationTrackerMenu(getKit());
|
||||
|
@ -78,7 +78,6 @@ public class KitDisplayMenu extends KitMenu
|
||||
|
||||
/**
|
||||
* Set up the details (info) regarding the upgrades to this kit
|
||||
* Lines commented out due to waiting to release upgrades
|
||||
*
|
||||
* @param buttons The array of buttons we're modifying
|
||||
*/
|
||||
@ -86,11 +85,11 @@ public class KitDisplayMenu extends KitMenu
|
||||
{
|
||||
if(getKit().showUpgrades())
|
||||
{
|
||||
List<KitAbilityDetail> details = getKit().getAbilityDetails().get(getKit().getUpgradeLevel(player.getUniqueId()));
|
||||
Map<Integer, List<String>> details = getKit().getUpgradeDetails();
|
||||
int index = 0;
|
||||
for(int i : UPGRADE_SLOTS)
|
||||
{
|
||||
buttons[i] = new KitAbilityButton(details.get(index++));
|
||||
buttons[i] = new KitUpgradeDetailsButton(index + 1, details.get(index++));
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -16,6 +16,7 @@ import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.security.acl.Owner;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
@ -140,7 +141,7 @@ public class KitInformationTrackerMenu extends KitMenu
|
||||
}
|
||||
|
||||
/**
|
||||
* Set up the row of Dyes / Music discs symbolizing the players upgrade advancement
|
||||
* Set up the row of items symbolizing the players upgrade advancement
|
||||
*
|
||||
* @param buttons The array of buttons we're modifying
|
||||
* @param player The player whose data we'll be using
|
||||
@ -149,24 +150,33 @@ public class KitInformationTrackerMenu extends KitMenu
|
||||
{
|
||||
if(getKit().showUpgrades())
|
||||
{
|
||||
int upgradeLevel = getKit().getUpgradeLevel(player.getUniqueId());
|
||||
Map<Integer, List<KitAbilityDetail>> details = getKit().getAbilityDetails();
|
||||
List<KitAbilityDetail> list = details.get(upgradeLevel);
|
||||
if(list == null)
|
||||
{
|
||||
throw new IllegalArgumentException("No upgrades for player upgrade level " + upgradeLevel);
|
||||
}
|
||||
Map<Integer, List<String>> details = getKit().getUpgradeDetails();
|
||||
|
||||
int index = 0;
|
||||
for(int i : UPGRADE_SLOTS)
|
||||
{
|
||||
KitAbilityDetail detail = list.get(index++);
|
||||
ItemBuilder itemStack = new ItemBuilder(detail.getIcon()).setTitle(C.cYellow + detail.getDisplayName()).setLore(getKit().getDescription());
|
||||
if(getKit().canPurchaseUpgrade(player.getUniqueId(), upgradeLevel) && !getKit().ownsUpgrade(player.getUniqueId(), upgradeLevel))
|
||||
List<String> list = details.get(index++);
|
||||
KitUpgradeDetailsButton detailsButton = new KitUpgradeDetailsButton(index, list);
|
||||
ItemBuilder itemStack = new ItemBuilder(detailsButton.getItemStack());
|
||||
|
||||
if (getKit().ownsUpgrade(player.getUniqueId(), index))
|
||||
{
|
||||
itemStack.addLore(C.cRed + "You already own this upgrade!");
|
||||
}
|
||||
else if (getKit().canPurchaseUpgrade(player.getUniqueId(), index))
|
||||
{
|
||||
itemStack.setGlow(true);
|
||||
itemStack.addLore("Costs " + C.cGreen + Calculations.getGemsCost(index) + C.cGray + " gems");
|
||||
itemStack.addLore(C.cGreen + "Click to purchase this upgrade!");
|
||||
}
|
||||
KitUpgradeButton button = new KitUpgradeButton(getKit(), itemStack.build(), upgradeLevel, detail.getDisplayName());
|
||||
buttons[i] = button;
|
||||
else
|
||||
{
|
||||
itemStack.addLore("Costs " + C.cGreen + Calculations.getGemsCost(index) + C.cGray + " gems");
|
||||
itemStack.addLore(C.cRed + "You cannot purchase this upgrade!");
|
||||
}
|
||||
|
||||
KitUpgradeButton upgradeButton = new KitUpgradeButton(getKit(), itemStack.build(), index);
|
||||
buttons[i] = upgradeButton;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -186,7 +186,6 @@ public class Calculations
|
||||
return 100;
|
||||
}
|
||||
|
||||
@SuppressWarnings("Duplicates")
|
||||
public static int getLevelRequiredFor(int upgradeLevel)
|
||||
{
|
||||
switch (upgradeLevel)
|
||||
@ -205,4 +204,15 @@ public class Calculations
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the number of gems required to purchase an upgrade from the upgrade level
|
||||
*
|
||||
* @param upgradeLevel The upgrade level (1-5)
|
||||
* @return The integer value of the number of gems required to purchase an upgrade
|
||||
*/
|
||||
public static int getGemsCost(int upgradeLevel)
|
||||
{
|
||||
return GEMS_FOR_UPGRADE.get(getLevelRequiredFor(upgradeLevel));
|
||||
}
|
||||
}
|
||||
|
@ -7,6 +7,7 @@ import mineplex.core.boosters.event.BoosterExpireEvent;
|
||||
import mineplex.core.boosters.tips.BoosterThankManager;
|
||||
import mineplex.core.common.util.*;
|
||||
import mineplex.core.disguise.DisguiseManager;
|
||||
import mineplex.core.gadget.event.GadgetCollideEntityEvent;
|
||||
import mineplex.core.hologram.Hologram;
|
||||
import mineplex.core.hologram.HologramManager;
|
||||
import mineplex.core.itemstack.ItemBuilder;
|
||||
@ -15,6 +16,8 @@ import mineplex.core.npc.NpcManager;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.database.tables.records.NpcsRecord;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Color;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
|
@ -718,10 +718,31 @@ public abstract class Game implements Listener
|
||||
}
|
||||
UtilServer.getServer().getPluginManager().registerEvents(kit, Manager.getPlugin());
|
||||
|
||||
for (Perk perk : kit.GetPerks())
|
||||
if (kit instanceof ProgressingKit)
|
||||
{
|
||||
UtilServer.getServer().getPluginManager().registerEvents(perk, Manager.getPlugin());
|
||||
perk.registeredEvents();
|
||||
ProgressingKit progressingKit = (ProgressingKit) kit;
|
||||
|
||||
for (Perk[] upgradePerks : progressingKit.getPerks())
|
||||
{
|
||||
for (Perk perk : upgradePerks)
|
||||
{
|
||||
if (perk == null)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
UtilServer.RegisterEvents(perk);
|
||||
perk.registeredEvents();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (Perk perk : kit.GetPerks())
|
||||
{
|
||||
UtilServer.getServer().getPluginManager().registerEvents(perk, Manager.getPlugin());
|
||||
perk.registeredEvents();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -29,6 +29,7 @@ public class SoloSkywars extends Skywars
|
||||
|
||||
private GameTeam _players;
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public SoloSkywars(ArcadeManager manager)
|
||||
{
|
||||
this(manager, GameType.Skywars);
|
||||
|
@ -3,6 +3,9 @@ package nautilus.game.arcade.game.games.skywars;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.common.util.UtilTime.TimeUnit;
|
||||
@ -18,12 +21,10 @@ import nautilus.game.arcade.stats.SkywarsTNTStatTracker;
|
||||
import nautilus.game.arcade.stats.WinWithoutOpeningChestStatTracker;
|
||||
import nautilus.game.arcade.stats.WinWithoutWearingArmorStatTracker;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
|
||||
public class TeamSkywars extends Skywars
|
||||
{
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public TeamSkywars(ArcadeManager manager)
|
||||
{
|
||||
this(manager, GameType.SkywarsTeams);
|
||||
|
@ -0,0 +1,100 @@
|
||||
package nautilus.game.arcade.game.games.skywars.kits;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.itemstack.ItemBuilder;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.kit.KitAvailability;
|
||||
import nautilus.game.arcade.kit.Perk;
|
||||
import nautilus.game.arcade.kit.ProgressingKit;
|
||||
import nautilus.game.arcade.kit.perks.PerkDoubleJump;
|
||||
import nautilus.game.arcade.kit.perks.PerkVoidSaver;
|
||||
|
||||
public class KitAir extends ProgressingKit
|
||||
{
|
||||
|
||||
private static final String DOUBLE_JUMP = "Leap";
|
||||
|
||||
private static final String[] DESCRIPTION = {
|
||||
"Start with " + C.cGreen + "Wood Sword" + C.cGray + " and " + C.cGreen + "Eye of Ender",
|
||||
"",
|
||||
"Right Click " + C.cGreen + "Eye of Ender" + C.cWhite + " to teleport back to your",
|
||||
"last safe location",
|
||||
C.cRedB + "ONE" + C.cWhite + " use only.",
|
||||
"",
|
||||
C.cYellow + "Tap Jump Twice" + C.cWhite + " to " + C.cGreen + DOUBLE_JUMP,
|
||||
};
|
||||
|
||||
private static final Perk[][] PERKS =
|
||||
{
|
||||
{
|
||||
new PerkVoidSaver(),
|
||||
new PerkDoubleJump(DOUBLE_JUMP, 1, 1, true, 30000, true)
|
||||
},
|
||||
{
|
||||
new PerkVoidSaver(),
|
||||
new PerkDoubleJump(DOUBLE_JUMP, 1, 1, true, 29000, true)
|
||||
},
|
||||
{
|
||||
new PerkVoidSaver(),
|
||||
new PerkDoubleJump(DOUBLE_JUMP, 1.1, 1, true, 29000, true)
|
||||
},
|
||||
{
|
||||
new PerkVoidSaver(),
|
||||
new PerkDoubleJump(DOUBLE_JUMP, 1.1, 1, true, 28000, true)
|
||||
},
|
||||
{
|
||||
new PerkVoidSaver(),
|
||||
new PerkDoubleJump(DOUBLE_JUMP, 1.2, 1, true, 28000, true)
|
||||
},
|
||||
{
|
||||
new PerkVoidSaver(),
|
||||
new PerkDoubleJump(DOUBLE_JUMP, 1.2, 1, true, 27000, true)
|
||||
},
|
||||
};
|
||||
|
||||
private static final String[][] UPGRADE_DETAILS =
|
||||
{
|
||||
{
|
||||
reduceCooldown(DOUBLE_JUMP, 1)
|
||||
},
|
||||
{
|
||||
increase(DOUBLE_JUMP, "Range", 10)
|
||||
},
|
||||
{
|
||||
reduceCooldown(DOUBLE_JUMP, 1)
|
||||
},
|
||||
{
|
||||
increase(DOUBLE_JUMP, "Range", 10)
|
||||
},
|
||||
{
|
||||
reduceCooldown(DOUBLE_JUMP, 1)
|
||||
},
|
||||
};
|
||||
|
||||
private static final ItemStack[] PLAYER_ITEMS = { new ItemStack(Material.WOOD_SWORD), new ItemBuilder(Material.EYE_OF_ENDER).setTitle(C.cGreen + "Eye of Ender").build() };
|
||||
|
||||
private static final ItemStack IN_HAND = new ItemStack(Material.EYE_OF_ENDER);
|
||||
|
||||
public KitAir(ArcadeManager manager)
|
||||
{
|
||||
super(manager, "Air", "skywarsmadscientist", KitAvailability.Gem, 4000, DESCRIPTION, PERKS, UPGRADE_DETAILS, EntityType.ZOMBIE, IN_HAND);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void GiveItems(Player player)
|
||||
{
|
||||
player.getInventory().addItem(PLAYER_ITEMS);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean showUpgrades()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
@ -1,47 +0,0 @@
|
||||
package nautilus.game.arcade.game.games.skywars.kits;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.itemstack.ItemStackFactory;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.kit.KitAvailability;
|
||||
import nautilus.game.arcade.kit.Perk;
|
||||
import nautilus.game.arcade.kit.ProgressingKit;
|
||||
import nautilus.game.arcade.kit.perks.PerkChicken;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class KitChicken extends ProgressingKit
|
||||
{
|
||||
private static final String[] DESCRIPTION = {
|
||||
"BAWK BAWK. Eggs!",
|
||||
"",
|
||||
"Get a chicken that follows you around",
|
||||
"And lays eggs every " + C.cGreen + 8 + C.cWhite + " seconds!"
|
||||
};
|
||||
|
||||
private static final Perk[] PERKS = {
|
||||
new PerkChicken()
|
||||
};
|
||||
|
||||
private static final ItemStack IN_HAND = new ItemStack(Material.EGG);
|
||||
|
||||
private static final ItemStack[] PLAYER_ITEMS = {
|
||||
ItemStackFactory.Instance.CreateStack(Material.WOOD_AXE),
|
||||
ItemStackFactory.Instance.CreateStack(Material.WOOD_PICKAXE)
|
||||
};
|
||||
|
||||
|
||||
public KitChicken(ArcadeManager manager)
|
||||
{
|
||||
super(manager, "Chicken Farmer", "skywarschickenfarmer", KitAvailability.Free, 0, DESCRIPTION, PERKS, EntityType.ZOMBIE, IN_HAND);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void GiveItems(Player player)
|
||||
{
|
||||
((PerkChicken) PERKS[0]).spawnChicken(player, player.getLocation());
|
||||
player.getInventory().addItem(PLAYER_ITEMS);
|
||||
}
|
||||
}
|
@ -1,58 +0,0 @@
|
||||
package nautilus.game.arcade.game.games.skywars.kits;
|
||||
|
||||
import mineplex.core.achievement.Achievement;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.itemstack.ItemStackFactory;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.kit.KitAvailability;
|
||||
import nautilus.game.arcade.kit.Perk;
|
||||
import nautilus.game.arcade.kit.ProgressingKit;
|
||||
import nautilus.game.arcade.kit.perks.PerkDestructor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class KitDestructor extends ProgressingKit
|
||||
{
|
||||
private static final String[] DESCRIPTION = {
|
||||
"Your Ender Pearls make the world crumble!",
|
||||
"",
|
||||
receiveItem("Seismic Charge", 1, 40, 2),
|
||||
C.cYellow + "Right-Click" + C.cWhite + " with Seismic Charge to " + C.cGreen + "Throw Seismic Charge",
|
||||
};
|
||||
|
||||
private static final Perk[] PERKS = {
|
||||
new PerkDestructor(40, 2, 2500, true)
|
||||
};
|
||||
|
||||
private static final ItemStack IN_HAND = new ItemStack(Material.ENDER_PEARL);
|
||||
|
||||
private static final ItemStack[] PLAYER_ITEMS = {
|
||||
ItemStackFactory.Instance.CreateStack(Material.WOOD_AXE),
|
||||
ItemStackFactory.Instance.CreateStack(Material.WOOD_PICKAXE)
|
||||
};
|
||||
|
||||
private static final Achievement[] ACHIEVEMENTS = {
|
||||
Achievement.SKYWARS_BOMBER,
|
||||
Achievement.SKYWARS_NOARMOR,
|
||||
Achievement.SKYWARS_NOCHEST,
|
||||
Achievement.SKYWARS_PLAYER_KILLS,
|
||||
Achievement.SKYWARS_TNT,
|
||||
Achievement.SKYWARS_WINS,
|
||||
Achievement.SKYWARS_ZOMBIE_KILLS
|
||||
};
|
||||
|
||||
public KitDestructor(ArcadeManager manager)
|
||||
{
|
||||
super(manager, "Destructor", "skywarsdestructor", KitAvailability.Achievement, DESCRIPTION, PERKS, EntityType.ZOMBIE, IN_HAND);
|
||||
|
||||
this.setAchievementRequirements(ACHIEVEMENTS);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void GiveItems(Player player)
|
||||
{
|
||||
player.getInventory().addItem(PLAYER_ITEMS);
|
||||
}
|
||||
}
|
@ -0,0 +1,115 @@
|
||||
package nautilus.game.arcade.game.games.skywars.kits;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import mineplex.core.achievement.Achievement;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.common.util.UtilTime.TimeUnit;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.kit.KitAvailability;
|
||||
import nautilus.game.arcade.kit.Perk;
|
||||
import nautilus.game.arcade.kit.ProgressingKit;
|
||||
import nautilus.game.arcade.kit.perks.PerkDirtCannon;
|
||||
import nautilus.game.arcade.kit.perks.PerkKnockback;
|
||||
|
||||
public class KitEarth extends ProgressingKit
|
||||
{
|
||||
|
||||
private static final String[] DESCRIPTION = {
|
||||
"Start with " + C.cGreen + "Wood Sword" + C.cGray + " and " + C.cGreen + "Wood Shovel",
|
||||
"",
|
||||
C.cYellow + "Right-Click" + C.cWhite + " to fire " + C.cGreen + "Throwable Dirt",
|
||||
"You recieve " + C.cGreen + "1 Throwable Dirt " + C.cWhite + "every",
|
||||
C.cGreen + UtilTime.convertString(20000, 0, TimeUnit.SECONDS) + C.cWhite + ".",
|
||||
"You take " + C.cGreen + "25" + C.cWhite + "% knockback while on the ground."
|
||||
};
|
||||
|
||||
private static final String DIRT_CANNON = "Throwable Dirt";
|
||||
private static final String KNOCKBACK = "Knockback";
|
||||
|
||||
private static final Perk[][] PERKS =
|
||||
{
|
||||
{
|
||||
new PerkDirtCannon(1),
|
||||
new PerkKnockback(0.75, true)
|
||||
},
|
||||
{
|
||||
new PerkDirtCannon(1.1),
|
||||
new PerkKnockback(0.75, true)
|
||||
},
|
||||
{
|
||||
new PerkDirtCannon(1.2),
|
||||
new PerkKnockback(0.75, true)
|
||||
},
|
||||
{
|
||||
new PerkDirtCannon(1.3),
|
||||
new PerkKnockback(0.75, true)
|
||||
},
|
||||
{
|
||||
new PerkDirtCannon(1.4),
|
||||
new PerkKnockback(0.75, true)
|
||||
},
|
||||
{
|
||||
new PerkDirtCannon(1.5),
|
||||
new PerkKnockback(0.75, true)
|
||||
},
|
||||
};
|
||||
|
||||
private static final String[][] UPGRADE_DETAILS =
|
||||
{
|
||||
{
|
||||
increase(DIRT_CANNON, KNOCKBACK, 10)
|
||||
},
|
||||
{
|
||||
increase(DIRT_CANNON, KNOCKBACK, 10)
|
||||
},
|
||||
{
|
||||
increase(DIRT_CANNON, KNOCKBACK, 10)
|
||||
},
|
||||
{
|
||||
increase(DIRT_CANNON, KNOCKBACK, 10)
|
||||
},
|
||||
{
|
||||
increase(DIRT_CANNON, KNOCKBACK, 10)
|
||||
},
|
||||
};
|
||||
|
||||
private static final ItemStack[] PLAYER_ITEMS = { new ItemStack(Material.WOOD_SWORD), new ItemStack(Material.WOOD_SPADE) };
|
||||
|
||||
private static final ItemStack IN_HAND = new ItemStack(Material.DIRT);
|
||||
|
||||
private static final Achievement[] ACHIEVEMENTS =
|
||||
{
|
||||
Achievement.SKYWARS_BOMBER,
|
||||
Achievement.SKYWARS_NOARMOR,
|
||||
Achievement.SKYWARS_NOCHEST,
|
||||
Achievement.SKYWARS_PLAYER_KILLS,
|
||||
Achievement.SKYWARS_TNT,
|
||||
Achievement.SKYWARS_WINS,
|
||||
Achievement.SKYWARS_ZOMBIE_KILLS
|
||||
};
|
||||
|
||||
public KitEarth(ArcadeManager manager)
|
||||
{
|
||||
super(manager, "Earth", "skywarsearth", KitAvailability.Achievement, DESCRIPTION, PERKS, UPGRADE_DETAILS, EntityType.ZOMBIE, IN_HAND);
|
||||
|
||||
setAchievementRequirements(ACHIEVEMENTS);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void GiveItems(Player player)
|
||||
{
|
||||
player.getInventory().addItem(PLAYER_ITEMS);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean showUpgrades()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,97 @@
|
||||
package nautilus.game.arcade.game.games.skywars.kits;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.common.util.UtilTime.TimeUnit;
|
||||
import mineplex.core.itemstack.ItemBuilder;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.kit.KitAvailability;
|
||||
import nautilus.game.arcade.kit.Perk;
|
||||
import nautilus.game.arcade.kit.ProgressingKit;
|
||||
import nautilus.game.arcade.kit.perks.PerkFireBurst;
|
||||
|
||||
public class KitFire extends ProgressingKit
|
||||
{
|
||||
|
||||
private static final String[] DESCRIPTION = {
|
||||
"Start with " + C.cGreen + "Wood Sword" + C.cGray + " and " + C.cGreen + "Blaze Rod",
|
||||
"",
|
||||
C.cYellow + "Right Click" + C.cWhite + " with Blaze Rod to use " + C.cGreen + "Fire Burst",
|
||||
"Sends out a pulse of fire that deals " + C.cGreen + 3 + C.cWhite + " damage to",
|
||||
"all players within " + C.cGreen + 4 + C.cWhite + " blocks.",
|
||||
"Cooldown " + C.cGreen + UtilTime.convertString(45000, 0, TimeUnit.SECONDS) + C.cWhite + "."
|
||||
};
|
||||
|
||||
private static final String FIRE_BURST = "Fire Burst";
|
||||
|
||||
private static final Perk[][] PERKS =
|
||||
{
|
||||
{
|
||||
new PerkFireBurst(45000, 4, 3)
|
||||
},
|
||||
{
|
||||
new PerkFireBurst(44000, 4, 3)
|
||||
},
|
||||
{
|
||||
new PerkFireBurst(43000, 4, 3)
|
||||
},
|
||||
{
|
||||
new PerkFireBurst(42000, 4, 4)
|
||||
},
|
||||
{
|
||||
new PerkFireBurst(41000, 4, 4)
|
||||
},
|
||||
{
|
||||
new PerkFireBurst(40000, 4, 4)
|
||||
},
|
||||
};
|
||||
|
||||
private static final String[][] UPGRADE_DETAILS =
|
||||
{
|
||||
{
|
||||
reduceCooldown(FIRE_BURST, 1)
|
||||
},
|
||||
{
|
||||
reduceCooldown(FIRE_BURST, 1)
|
||||
},
|
||||
{
|
||||
reduceCooldown(FIRE_BURST, 1),
|
||||
increase(FIRE_BURST, "Range", 20)
|
||||
},
|
||||
{
|
||||
reduceCooldown(FIRE_BURST, 1)
|
||||
},
|
||||
{
|
||||
reduceCooldown(FIRE_BURST, 1)
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
private static final ItemStack[] PLAYER_ITEMS = { new ItemStack(Material.WOOD_SWORD), new ItemBuilder(Material.BLAZE_ROD).setTitle(C.cGreen + "Fire Burst").build() };
|
||||
|
||||
private static final ItemStack IN_HAND = new ItemStack(Material.BLAZE_ROD);
|
||||
|
||||
public KitFire(ArcadeManager manager)
|
||||
{
|
||||
super(manager, "Fire", "skywarsminer", KitAvailability.Gem, 4000, DESCRIPTION, PERKS, UPGRADE_DETAILS, EntityType.ZOMBIE, IN_HAND);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void GiveItems(Player player)
|
||||
{
|
||||
player.getInventory().addItem(PLAYER_ITEMS);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean showUpgrades()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,95 @@
|
||||
package nautilus.game.arcade.game.games.skywars.kits;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.common.util.UtilTime.TimeUnit;
|
||||
import mineplex.core.itemstack.ItemBuilder;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.kit.KitAvailability;
|
||||
import nautilus.game.arcade.kit.Perk;
|
||||
import nautilus.game.arcade.kit.ProgressingKit;
|
||||
import nautilus.game.arcade.kit.perks.PerkIceBridge;
|
||||
|
||||
public class KitIce extends ProgressingKit
|
||||
{
|
||||
|
||||
private static final String[] DESCRIPTION = {
|
||||
"Start with " + C.cGreen + "Wood Sword" + C.cGray + " and " + C.cGreen + "Ice",
|
||||
"",
|
||||
C.cYellow + "Right Click" + C.cWhite + " with Ice to create an " + C.cGreen + "Ice Bridge",
|
||||
"Lasts for " + C.cGreen + UtilTime.convertString(4000, 0, TimeUnit.SECONDS) + C.cWhite + ".",
|
||||
"Cooldown " + C.cGreen + UtilTime.convertString(30000, 0, TimeUnit.SECONDS) + C.cWhite + "."
|
||||
};
|
||||
|
||||
private static final String ICE_BRIDGE = "Ice Bridge";
|
||||
|
||||
private static final Perk[][] PERKS =
|
||||
{
|
||||
{
|
||||
new PerkIceBridge(30000, 4000)
|
||||
},
|
||||
{
|
||||
new PerkIceBridge(29000, 4000)
|
||||
},
|
||||
{
|
||||
new PerkIceBridge(28000, 5000)
|
||||
},
|
||||
{
|
||||
new PerkIceBridge(27000, 5000)
|
||||
},
|
||||
{
|
||||
new PerkIceBridge(26000, 6000)
|
||||
},
|
||||
{
|
||||
new PerkIceBridge(25000, 6000)
|
||||
},
|
||||
};
|
||||
|
||||
private static final String[][] UPGRADE_DETAILS =
|
||||
{
|
||||
{
|
||||
reduceCooldown(ICE_BRIDGE, 1)
|
||||
},
|
||||
{
|
||||
reduceCooldown(ICE_BRIDGE, 1),
|
||||
increase(ICE_BRIDGE, "Uptime", 20)
|
||||
},
|
||||
{
|
||||
reduceCooldown(ICE_BRIDGE, 1)
|
||||
},
|
||||
{
|
||||
reduceCooldown(ICE_BRIDGE, 1),
|
||||
increase(ICE_BRIDGE, "Uptime", 20)
|
||||
},
|
||||
{
|
||||
reduceCooldown(ICE_BRIDGE, 1)
|
||||
},
|
||||
};
|
||||
|
||||
private static final ItemStack[] PLAYER_ITEMS = { new ItemStack(Material.WOOD_SWORD), new ItemBuilder(Material.ICE).setTitle(C.cGreen + "Ice Bridge").build() };
|
||||
|
||||
private static final ItemStack IN_HAND = new ItemStack(Material.ICE);
|
||||
|
||||
public KitIce(ArcadeManager manager)
|
||||
{
|
||||
super(manager, "Ice", "skywarschickenfarmer", KitAvailability.Free, DESCRIPTION, PERKS, UPGRADE_DETAILS, EntityType.ZOMBIE, IN_HAND);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void GiveItems(Player player)
|
||||
{
|
||||
player.getInventory().addItem(PLAYER_ITEMS);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean showUpgrades()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
@ -1,45 +0,0 @@
|
||||
package nautilus.game.arcade.game.games.skywars.kits;
|
||||
|
||||
import mineplex.core.itemstack.ItemStackFactory;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.kit.KitAvailability;
|
||||
import nautilus.game.arcade.kit.Perk;
|
||||
import nautilus.game.arcade.kit.ProgressingKit;
|
||||
import nautilus.game.arcade.kit.perks.PerkMadScientist;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class KitMadScientist extends ProgressingKit
|
||||
{
|
||||
private static final String[] DESCRIPTION = {
|
||||
"Spawn crazy animals to fight for you!",
|
||||
"",
|
||||
receiveItem("Egg", 1, 90, 3),
|
||||
"Eggs spawn a loyal minion to fight for you",
|
||||
};
|
||||
|
||||
private static final Perk[] PERKS = {
|
||||
new PerkMadScientist()
|
||||
};
|
||||
|
||||
private static final ItemStack IN_HAND = new ItemStack(Material.MONSTER_EGG);
|
||||
|
||||
private static final ItemStack[] PLAYER_ITEMS = {
|
||||
ItemStackFactory.Instance.CreateStack(Material.WOOD_AXE),
|
||||
ItemStackFactory.Instance.CreateStack(Material.WOOD_PICKAXE)
|
||||
};
|
||||
|
||||
public KitMadScientist(ArcadeManager manager)
|
||||
{
|
||||
super(manager, "Mad Scientist", "skywarsmadscientist", KitAvailability.Gem, DESCRIPTION, PERKS, EntityType.ZOMBIE, IN_HAND);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void GiveItems(Player player)
|
||||
{
|
||||
player.getInventory().addItem(PLAYER_ITEMS);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,102 @@
|
||||
package nautilus.game.arcade.game.games.skywars.kits;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.common.util.UtilTime.TimeUnit;
|
||||
import mineplex.core.itemstack.ItemBuilder;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.kit.KitAvailability;
|
||||
import nautilus.game.arcade.kit.Perk;
|
||||
import nautilus.game.arcade.kit.ProgressingKit;
|
||||
import nautilus.game.arcade.kit.perks.PerkMagnetism;
|
||||
|
||||
public class KitMetal extends ProgressingKit
|
||||
{
|
||||
|
||||
private static final String[] DESCRIPTION = {
|
||||
"Start with " + C.cGreen + "Wood Sword" + C.cGray + ", " + C.cGreen + "Stone Pickaxe" + C.cGray + " and " + C.cGreen + "Redstone Comparator",
|
||||
"",
|
||||
C.cYellow + "Right Click" + C.cWhite + " with Redstone Comparator to activate " + C.cGreen + "Magnet",
|
||||
"",
|
||||
C.cGreen + C.Italics + "Metal" + C.cGray + C.Italics + " means Gold/Chainmail/Iron armor.",
|
||||
"",
|
||||
"Any player in your line of sight is drawn to you.",
|
||||
"The velocity that they are drawn towards you is",
|
||||
"based on how much metal armor they are wearing",
|
||||
"Cooldown " + C.cGreen + UtilTime.convertString(15000, 0, TimeUnit.SECONDS) + C.cWhite + ".",
|
||||
"",
|
||||
"For each piece of metal armor you wear you gain",
|
||||
"a level of " + C.cGreen + "Damage Resistance" + C.cWhite + ".",
|
||||
};
|
||||
|
||||
private static final String MAGNET = "Magnet";
|
||||
private static final String POWER = "Power";
|
||||
|
||||
private static final Perk[][] PERKS =
|
||||
{
|
||||
{
|
||||
new PerkMagnetism(15000, 10, 1)
|
||||
},
|
||||
{
|
||||
new PerkMagnetism(15000, 10, 1.1)
|
||||
},
|
||||
{
|
||||
new PerkMagnetism(15000, 10, 1.2)
|
||||
},
|
||||
{
|
||||
new PerkMagnetism(15000, 10, 1.3)
|
||||
},
|
||||
{
|
||||
new PerkMagnetism(15000, 10, 1.4)
|
||||
},
|
||||
{
|
||||
new PerkMagnetism(15000, 10, 1.5)
|
||||
},
|
||||
};
|
||||
|
||||
private static final String[][] UPGRADE_DETAILS =
|
||||
{
|
||||
{
|
||||
increase(MAGNET, POWER, 10)
|
||||
},
|
||||
{
|
||||
increase(MAGNET, POWER, 10)
|
||||
},
|
||||
{
|
||||
increase(MAGNET, POWER, 10)
|
||||
},
|
||||
{
|
||||
increase(MAGNET, POWER, 10)
|
||||
},
|
||||
{
|
||||
increase(MAGNET, POWER, 10)
|
||||
},
|
||||
};
|
||||
|
||||
private static final ItemStack[] PLAYER_ITEMS = { new ItemStack(Material.WOOD_SWORD), new ItemStack(Material.STONE_PICKAXE), new ItemBuilder(Material.REDSTONE_COMPARATOR).setTitle(C.cGreen + "Magnet").build() };
|
||||
|
||||
private static final ItemStack IN_HAND = new ItemStack(Material.REDSTONE_COMPARATOR);
|
||||
|
||||
public KitMetal(ArcadeManager manager)
|
||||
{
|
||||
super(manager, "Metal", "skywarsdestructor", KitAvailability.Gem, 4000, DESCRIPTION, PERKS, UPGRADE_DETAILS, EntityType.ZOMBIE, IN_HAND);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void GiveItems(Player player)
|
||||
{
|
||||
player.getInventory().addItem(PLAYER_ITEMS);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean showUpgrades()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
@ -1,45 +0,0 @@
|
||||
package nautilus.game.arcade.game.games.skywars.kits;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.itemstack.ItemStackFactory;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.kit.KitAvailability;
|
||||
import nautilus.game.arcade.kit.Perk;
|
||||
import nautilus.game.arcade.kit.ProgressingKit;
|
||||
import nautilus.game.arcade.kit.perks.PerkDigger;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class KitMiner extends ProgressingKit
|
||||
{
|
||||
private static final String[] DESCRIPTION = {
|
||||
"Start with better tools!",
|
||||
"",
|
||||
"Receive " + C.cGreen + "Haste II" + C.cWhite + " the entire game"
|
||||
};
|
||||
|
||||
private static final Perk[] PERKS = {
|
||||
new PerkDigger(),
|
||||
};
|
||||
|
||||
private static final ItemStack IN_HAND = new ItemStack(Material.IRON_PICKAXE);
|
||||
|
||||
private static final ItemStack[] PLAYER_ITEMS = {
|
||||
ItemStackFactory.Instance.CreateStack(Material.STONE_AXE),
|
||||
ItemStackFactory.Instance.CreateStack(Material.IRON_PICKAXE)
|
||||
};
|
||||
|
||||
|
||||
public KitMiner(ArcadeManager manager)
|
||||
{
|
||||
super(manager, "Miner", "skywarsminer", KitAvailability.Gem, 5000, DESCRIPTION, PERKS, EntityType.ZOMBIE, IN_HAND);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void GiveItems(Player player)
|
||||
{
|
||||
player.getInventory().addItem(PLAYER_ITEMS);
|
||||
}
|
||||
}
|
@ -5,6 +5,7 @@ import mineplex.core.common.util.*;
|
||||
import nautilus.game.arcade.ArcadeFormat;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.events.PlayerKitGiveEvent;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.*;
|
||||
@ -44,9 +45,16 @@ public abstract class Kit implements Listener
|
||||
_kitName = name;
|
||||
_kitDesc = kitDesc;
|
||||
_kitPerks = kitPerks;
|
||||
|
||||
|
||||
for (Perk perk : _kitPerks)
|
||||
{
|
||||
if (perk == null)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
perk.SetHost(this);
|
||||
}
|
||||
|
||||
_kitAvailability = kitAvailability;
|
||||
_cost = cost;
|
||||
@ -93,6 +101,11 @@ public abstract class Kit implements Listener
|
||||
{
|
||||
return _kitPerks;
|
||||
}
|
||||
|
||||
public EntityType getEntityType()
|
||||
{
|
||||
return _entityType;
|
||||
}
|
||||
|
||||
public boolean HasKit(Player player)
|
||||
{
|
||||
@ -107,7 +120,14 @@ public abstract class Kit implements Listener
|
||||
UtilInv.Clear(player);
|
||||
|
||||
for (Perk perk : _kitPerks)
|
||||
{
|
||||
if (perk == null)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
perk.Apply(player);
|
||||
}
|
||||
|
||||
GiveItemsCall(player);
|
||||
|
||||
|
@ -1,10 +1,11 @@
|
||||
package nautilus.game.arcade.kit;
|
||||
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Listener;
|
||||
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
|
||||
public abstract class Perk implements Listener
|
||||
{
|
||||
public ArcadeManager Manager;
|
||||
@ -14,12 +15,11 @@ public abstract class Perk implements Listener
|
||||
private String[] _perkDesc;
|
||||
|
||||
private boolean _display;
|
||||
private int _upgradeLevel;
|
||||
|
||||
public Perk(String name, String[] perkDesc)
|
||||
{
|
||||
_perkName = name;
|
||||
_perkDesc = perkDesc;
|
||||
_display = true;
|
||||
this(name, perkDesc, true);
|
||||
}
|
||||
|
||||
public Perk(String name, String[] perkDesc, boolean display)
|
||||
@ -29,6 +29,23 @@ public abstract class Perk implements Listener
|
||||
_display = display;
|
||||
}
|
||||
|
||||
public boolean hasPerk(Player player)
|
||||
{
|
||||
if (!(Kit instanceof ProgressingKit))
|
||||
{
|
||||
return Kit.HasKit(player);
|
||||
}
|
||||
|
||||
ProgressingKit progressingKit = (ProgressingKit) Kit;
|
||||
|
||||
return Kit.HasKit(player) && progressingKit.getUpgradeLevel(player.getUniqueId()) == _upgradeLevel;
|
||||
}
|
||||
|
||||
public void setUpgradeLevel(int upgradeLevel)
|
||||
{
|
||||
_upgradeLevel = upgradeLevel;
|
||||
}
|
||||
|
||||
public void SetHost(Kit kit)
|
||||
{
|
||||
Manager = kit.Manager;
|
||||
|
@ -1,6 +1,14 @@
|
||||
package nautilus.game.arcade.kit;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Maps;
|
||||
|
||||
import mineplex.core.common.Rank;
|
||||
import mineplex.core.common.currency.GlobalCurrency;
|
||||
import mineplex.core.common.util.C;
|
||||
@ -10,7 +18,6 @@ import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.donation.Donor;
|
||||
import mineplex.core.menu.Menu;
|
||||
import mineplex.core.progression.ProgressiveKit;
|
||||
import mineplex.core.progression.data.KitAbilityDetail;
|
||||
import mineplex.core.progression.data.PlayerKit;
|
||||
import mineplex.core.progression.data.PlayerKitDataManager;
|
||||
import mineplex.core.progression.math.Calculations;
|
||||
@ -24,13 +31,8 @@ import nautilus.game.arcade.shop.KitPackage;
|
||||
import net.minecraft.server.v1_8_R3.EntityFireworks;
|
||||
import net.minecraft.server.v1_8_R3.PacketPlayOutEntityStatus;
|
||||
import net.minecraft.server.v1_8_R3.World;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Color;
|
||||
import org.bukkit.FireworkEffect;
|
||||
import org.bukkit.*;
|
||||
import org.bukkit.FireworkEffect.Type;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.CraftWorld;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
|
||||
import org.bukkit.entity.EntityType;
|
||||
@ -42,7 +44,6 @@ import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
@ -58,14 +59,50 @@ public abstract class ProgressingKit extends Kit implements ProgressiveKit
|
||||
|
||||
private String _internalName;
|
||||
private PlayerKitDataManager _dataManager;
|
||||
private Map<Integer, List<KitAbilityDetail>> _kitAbilityDetails;
|
||||
private Map<Integer, List<String>> _kitUpgradeDetails;
|
||||
private Perk[][] _perks;
|
||||
|
||||
public ProgressingKit(ArcadeManager manager, String name, String internalName, KitAvailability kitAvailability, String[] kitDesc, Perk[] kitPerks, EntityType entityType, ItemStack itemInHand)
|
||||
{
|
||||
super(manager, name, kitAvailability, kitDesc, kitPerks, entityType, itemInHand);
|
||||
_internalName = internalName;
|
||||
_dataManager = manager.getKitProgressionManager().getDataManager();
|
||||
_kitAbilityDetails = Maps.newHashMap();
|
||||
_perks = new Perk[kitPerks.length][kitPerks.length];
|
||||
}
|
||||
|
||||
public ProgressingKit(ArcadeManager manager, String name, String internalName, KitAvailability kitAvailability, String[] kitDesc, Perk[][] kitPerks, String[][] upgradeDetails, EntityType entityType, ItemStack itemInHand)
|
||||
{
|
||||
super(manager, name, kitAvailability, kitDesc, kitPerks[0], entityType, itemInHand);
|
||||
_internalName = internalName;
|
||||
_dataManager = manager.getKitProgressionManager().getDataManager();
|
||||
_kitUpgradeDetails = Maps.newHashMap();
|
||||
_perks = new Perk[kitPerks.length][kitPerks.length];
|
||||
|
||||
for (int level = 0; level < kitPerks.length; level++)
|
||||
{
|
||||
if (level > 0)
|
||||
{
|
||||
List<String> details = Lists.newArrayList();
|
||||
String[] kitDetails = upgradeDetails[level - 1];
|
||||
|
||||
for (String detail : kitDetails)
|
||||
{
|
||||
details.add(C.cGray + detail);
|
||||
}
|
||||
|
||||
_kitUpgradeDetails.put(level - 1, details);
|
||||
}
|
||||
|
||||
Perk[] perks = kitPerks[level];
|
||||
int index = 0;
|
||||
|
||||
for (Perk perk : perks)
|
||||
{
|
||||
_perks[level][index++] = perk;
|
||||
perk.setUpgradeLevel(level);
|
||||
perk.SetHost(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public ProgressingKit(ArcadeManager manager, String name, String internalName, KitAvailability kitAvailability, int cost, String[] kitDesc, Perk[] kitPerks, EntityType entityType, ItemStack itemInHand)
|
||||
@ -73,9 +110,43 @@ public abstract class ProgressingKit extends Kit implements ProgressiveKit
|
||||
super(manager, name, kitAvailability, cost, kitDesc, kitPerks, entityType, itemInHand);
|
||||
_internalName = internalName;
|
||||
_dataManager = manager.getKitProgressionManager().getDataManager();
|
||||
_kitAbilityDetails = Maps.newHashMap();
|
||||
_perks = new Perk[kitPerks.length][kitPerks.length];
|
||||
}
|
||||
|
||||
public ProgressingKit(ArcadeManager manager, String name, String internalName, KitAvailability kitAvailability, int cost, String[] kitDesc, Perk[][] kitPerks, String[][] upgradeDetails, EntityType entityType, ItemStack itemInHand)
|
||||
{
|
||||
super(manager, name, kitAvailability, cost, kitDesc, kitPerks[0], entityType, itemInHand);
|
||||
_internalName = internalName;
|
||||
_dataManager = manager.getKitProgressionManager().getDataManager();
|
||||
_kitUpgradeDetails = Maps.newHashMap();
|
||||
_perks = new Perk[kitPerks.length][kitPerks.length];
|
||||
|
||||
for (int level = 0; level < kitPerks.length; level++)
|
||||
{
|
||||
if (level > 0)
|
||||
{
|
||||
List<String> details = Lists.newArrayList();
|
||||
String[] kitDetails = upgradeDetails[level - 1];
|
||||
|
||||
for (String detail : kitDetails)
|
||||
{
|
||||
details.add(C.cGray + detail);
|
||||
}
|
||||
|
||||
_kitUpgradeDetails.put(level - 1, details);
|
||||
}
|
||||
|
||||
Perk[] perks = kitPerks[level];
|
||||
int index = 0;
|
||||
|
||||
for (Perk perk : perks)
|
||||
{
|
||||
_perks[level][index++] = perk;
|
||||
perk.setUpgradeLevel(level);
|
||||
perk.SetHost(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDisplayName()
|
||||
@ -102,9 +173,9 @@ public abstract class ProgressingKit extends Kit implements ProgressiveKit
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<Integer, List<KitAbilityDetail>> getAbilityDetails()
|
||||
public Map<Integer, List<String>> getUpgradeDetails()
|
||||
{
|
||||
return _kitAbilityDetails;
|
||||
return _kitUpgradeDetails;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -242,7 +313,7 @@ public abstract class ProgressingKit extends Kit implements ProgressiveKit
|
||||
{
|
||||
PlayerKit playerKit = _dataManager.get(player);
|
||||
Donor donor = Manager.GetDonation().Get(Bukkit.getPlayer(player));
|
||||
return Calculations.canUpgrade(playerKit.getLevel(getInternalName()), donor.getBalance(GlobalCurrency.GEM));
|
||||
return Calculations.canUpgrade(Calculations.getNextUpgradeLevel(playerKit.getLevel(getInternalName())), donor.getBalance(GlobalCurrency.GEM)) && playerKit.getLevel(getInternalName()) >= Calculations.getLevelRequiredFor(upgradeLevel);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -322,6 +393,11 @@ public abstract class ProgressingKit extends Kit implements ProgressiveKit
|
||||
return false;
|
||||
}
|
||||
|
||||
public Perk[][] getPerks()
|
||||
{
|
||||
return _perks;
|
||||
}
|
||||
|
||||
public static String leap()
|
||||
{
|
||||
return C.cYellow + "Right-Click" + C.cWhite + " with Axe to " + C.cGreen + "Leap";
|
||||
@ -343,6 +419,16 @@ public abstract class ProgressingKit extends Kit implements ProgressiveKit
|
||||
return C.cWhite + "Receive " + C.cGreen + amount + C.cWhite + " arrow" + (amount == 1 ? "" : "s") + " every " + C.cGreen + per + C.cWhite + " seconds. Max " + C.cGreen + max;
|
||||
}
|
||||
|
||||
public static String reduceCooldown(String perk, double time)
|
||||
{
|
||||
return C.cWhite + "Reduce the cooldown of " + C.cGreen + perk + C.cWhite + " by " + C.cGreen + time + C.cWhite + " seconds" + (time == 1 ? "" : "s") + ".";
|
||||
}
|
||||
|
||||
public static String increase(String perk, String increasing, double percentage)
|
||||
{
|
||||
return C.cWhite + "Increase the " + C.cGreen + increasing + C.cWhite + " of " + C.cGreen + perk + C.cWhite + " by " + C.cGreen + percentage + C.cWhite + "%.";
|
||||
}
|
||||
|
||||
public static class CustomFirework extends EntityFireworks
|
||||
{
|
||||
|
||||
@ -407,4 +493,4 @@ public abstract class ProgressingKit extends Kit implements ProgressiveKit
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,213 @@
|
||||
package nautilus.game.arcade.kit.perks;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.FallingBlock;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.block.Action;
|
||||
import org.bukkit.event.block.BlockPlaceEvent;
|
||||
import org.bukkit.event.entity.EntityChangeBlockEvent;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
import org.bukkit.event.entity.PlayerDeathEvent;
|
||||
import org.bukkit.event.player.PlayerDropItemEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilAction;
|
||||
import mineplex.core.common.util.UtilInv;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.itemstack.ItemBuilder;
|
||||
import mineplex.core.projectile.IThrown;
|
||||
import mineplex.core.projectile.ProjectileUser;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import nautilus.game.arcade.game.Game;
|
||||
import nautilus.game.arcade.game.TeamGame;
|
||||
import nautilus.game.arcade.kit.Perk;
|
||||
|
||||
public class PerkDirtCannon extends Perk implements IThrown
|
||||
{
|
||||
|
||||
private static final int GIVE_DELAY = 20000;
|
||||
|
||||
private static final ItemStack DIRT_ITEM = new ItemBuilder(Material.DIRT).setTitle(C.cGreen + "Throwable Dirt").setGlow(true).build();
|
||||
|
||||
private long _lastDirt;
|
||||
private double _targetKnockback;
|
||||
|
||||
public PerkDirtCannon(double targetKnockback)
|
||||
{
|
||||
super("Throwable Dirt", new String[] {
|
||||
});
|
||||
_targetKnockback = targetKnockback;
|
||||
_lastDirt = 0;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerInteract(PlayerInteractEvent event)
|
||||
{
|
||||
if (event.getAction() != Action.RIGHT_CLICK_AIR)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if (player.getItemInHand() == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!DIRT_ITEM.isSimilar(player.getItemInHand()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!hasPerk(player))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
int amount = player.getInventory().getItemInHand().getAmount() - 1;
|
||||
|
||||
if (amount == 0)
|
||||
{
|
||||
player.getInventory().remove(DIRT_ITEM);
|
||||
}
|
||||
else
|
||||
{
|
||||
player.getItemInHand().setAmount(amount);
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
FallingBlock fallingBlock = player.getWorld().spawnFallingBlock(player.getEyeLocation().add(player.getLocation().getDirection()), Material.DIRT, (byte) 0);
|
||||
fallingBlock.setDropItem(false);
|
||||
fallingBlock.setVelocity(player.getLocation().getDirection().multiply(2));
|
||||
Manager.GetProjectile().AddThrow(fallingBlock, player, this, -1, true, true, true, true, false, 1);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onUpdate(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.SEC)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (UtilTime.elapsed(_lastDirt, GIVE_DELAY))
|
||||
{
|
||||
for (Player player : Manager.GetGame().GetPlayers(true))
|
||||
{
|
||||
if (!hasPerk(player) || UtilInv.contains(player, "Throwable", Material.DIRT, (byte) 0, 4))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
player.getInventory().addItem(DIRT_ITEM);
|
||||
}
|
||||
|
||||
_lastDirt = System.currentTimeMillis();
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onEntityChangeBlock(EntityChangeBlockEvent event)
|
||||
{
|
||||
if (event.getBlock().getType() == Material.DIRT)
|
||||
{
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onBlockPlace(BlockPlaceEvent event)
|
||||
{
|
||||
if (!hasPerk(event.getPlayer()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (DIRT_ITEM.isSimilar(event.getItemInHand()))
|
||||
{
|
||||
event.getPlayer().sendMessage(F.main("Game", "You cannot place your skill item."));
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerDropItem(PlayerDropItemEvent event)
|
||||
{
|
||||
if (DIRT_ITEM.isSimilar(event.getItemDrop().getItemStack()))
|
||||
{
|
||||
event.getPlayer().sendMessage(F.main("Game", "You cannot drop this item."));
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerDeath(PlayerDeathEvent event)
|
||||
{
|
||||
if (!hasPerk(event.getEntity()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Iterator<ItemStack> iterator = event.getDrops().iterator();
|
||||
|
||||
while (iterator.hasNext())
|
||||
{
|
||||
ItemStack itemStack = iterator.next();
|
||||
if (DIRT_ITEM.isSimilar(itemStack))
|
||||
{
|
||||
iterator.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Collide(LivingEntity target, Block block, ProjectileUser data)
|
||||
{
|
||||
if (target == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (Manager.GetGame() instanceof TeamGame && target instanceof Player && data.getThrower() instanceof Player)
|
||||
{
|
||||
Game game = Manager.GetGame();
|
||||
|
||||
if (!game.IsAlive(target))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (game.GetTeam((Player) target).equals(game.GetTeam((Player) data.getThrower())))
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Manager.GetDamage().NewDamageEvent(target, data.getThrower(), null, DamageCause.CUSTOM, 2, false, true, true, data.getThrower().getName(), GetName());
|
||||
|
||||
UtilAction.velocity(target, data.getThrown().getVelocity().normalize().setY(0.5).multiply(_targetKnockback));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Idle(ProjectileUser data)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Expire(ProjectileUser data)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -4,7 +4,6 @@ import java.util.HashSet;
|
||||
|
||||
import org.bukkit.Effect;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
@ -13,8 +12,9 @@ import org.bukkit.event.player.PlayerToggleFlightEvent;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.UtilAction;
|
||||
import mineplex.core.common.util.UtilBlock;
|
||||
import mineplex.core.common.util.UtilEnt;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.common.util.UtilTime.TimeUnit;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
@ -34,7 +34,7 @@ public class PerkDoubleJump extends Perk
|
||||
{
|
||||
super(name, new String[]
|
||||
{
|
||||
C.cYellow + "Tap Jump Twice" + C.cGray + " to " + C.cGreen + name
|
||||
C.cYellow + "Tap Jump Twice" + C.cGray + " to " + C.cGreen + name,
|
||||
});
|
||||
|
||||
_power = power;
|
||||
@ -48,7 +48,8 @@ public class PerkDoubleJump extends Perk
|
||||
{
|
||||
super(name, new String[]
|
||||
{
|
||||
C.cYellow + "Tap Jump Twice" + C.cGray + " to " + C.cGreen + name
|
||||
C.cYellow + "Tap Jump Twice" + C.cGray + " to " + C.cGreen + name,
|
||||
"Cooldown " + C.cGreen + UtilTime.convertString(recharge, 0, TimeUnit.SECONDS) + C.cGray + "."
|
||||
});
|
||||
|
||||
_power = power;
|
||||
@ -63,7 +64,7 @@ public class PerkDoubleJump extends Perk
|
||||
{
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if (!Kit.HasKit(player))
|
||||
if (!hasPerk(player))
|
||||
return;
|
||||
|
||||
if (Manager.isSpectator(player))
|
||||
@ -116,7 +117,7 @@ public class PerkDoubleJump extends Perk
|
||||
if (Manager.isSpectator(player))
|
||||
continue;
|
||||
|
||||
if (!Kit.HasKit(player))
|
||||
if (!hasPerk(player))
|
||||
continue;
|
||||
|
||||
if (_recharge > 0 && !Recharge.Instance.usable(player, GetName()))
|
||||
|
@ -0,0 +1,146 @@
|
||||
package nautilus.game.arcade.kit.perks;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.block.Action;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
import org.bukkit.event.entity.PlayerDeathEvent;
|
||||
import org.bukkit.event.player.PlayerDropItemEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilParticle;
|
||||
import mineplex.core.common.util.UtilParticle.ParticleType;
|
||||
import mineplex.core.common.util.UtilParticle.ViewDist;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.common.util.UtilTime.TimeUnit;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
import nautilus.game.arcade.kit.Perk;
|
||||
|
||||
public class PerkFireBurst extends Perk
|
||||
{
|
||||
|
||||
private static final int FIRE_TICKS = 60;
|
||||
private static final double LOCATION_Y_MODIFER = 1;
|
||||
|
||||
private long _cooldown;
|
||||
private double _range;
|
||||
private double _damage;
|
||||
|
||||
public PerkFireBurst(long cooldown, double range, double damage)
|
||||
{
|
||||
super("Fire Burst", new String[] {
|
||||
C.cYellow + "Right Click" + C.cWhite + " with Blaze Rod to use " + C.cGreen + "Fire Burst",
|
||||
"Sends out a pulse of fire that deals " + C.cGreen + damage + C.cWhite + " damage to",
|
||||
"all players within " + C.cGreen + range + C.cWhite + " blocks.",
|
||||
"Cooldown " + C.cGreen + UtilTime.convertString(cooldown, 0, TimeUnit.SECONDS) + C.cWhite + "." });
|
||||
|
||||
_cooldown = cooldown;
|
||||
_range = range;
|
||||
_damage = damage;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerInteract(PlayerInteractEvent event)
|
||||
{
|
||||
if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if (player.getItemInHand() == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (player.getItemInHand().getType() != Material.BLAZE_ROD)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!hasPerk(player))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Recharge.Instance.use(player, GetName(), _cooldown, true, true))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
final Location location = player.getLocation().add(0, LOCATION_Y_MODIFER, 0);
|
||||
|
||||
for (Player other : UtilPlayer.getNearby(location, _range, true))
|
||||
{
|
||||
if (other.equals(player))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
other.setFireTicks(FIRE_TICKS);
|
||||
Manager.GetDamage().NewDamageEvent(other, player, null, DamageCause.CUSTOM, _damage, true, true, true, player.getName(), GetName());
|
||||
}
|
||||
|
||||
for (double radius = 0; radius < _range; radius += 0.5)
|
||||
{
|
||||
for (double theta = 0; theta < 2 * Math.PI; theta += Math.PI / 20)
|
||||
{
|
||||
double x = radius * Math.cos(theta);
|
||||
double z = radius * Math.sin(theta);
|
||||
|
||||
location.add(x, 0, z);
|
||||
|
||||
UtilParticle.PlayParticleToAll(ParticleType.FLAME, location, 0, 0, 0, 0.01F, 1, ViewDist.NORMAL);
|
||||
|
||||
location.subtract(x, 0, z);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerDropItem(PlayerDropItemEvent event)
|
||||
{
|
||||
if (!hasPerk(event.getPlayer()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (event.getItemDrop().getItemStack().getType() == Material.BLAZE_ROD)
|
||||
{
|
||||
event.getPlayer().sendMessage(F.main("Game", "You cannot drop this item."));
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerDeath(PlayerDeathEvent event)
|
||||
{
|
||||
if (!hasPerk(event.getEntity()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Iterator<ItemStack> iterator = event.getDrops().iterator();
|
||||
|
||||
while (iterator.hasNext())
|
||||
{
|
||||
ItemStack itemStack = iterator.next();
|
||||
|
||||
if (itemStack.getType() == Material.BLAZE_ROD)
|
||||
{
|
||||
iterator.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -3,12 +3,12 @@ package nautilus.game.arcade.kit.perks;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilGear;
|
||||
import mineplex.core.common.util.UtilInv;
|
||||
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;
|
||||
@ -37,23 +37,35 @@ public class PerkFletcher extends Perk
|
||||
private int _time = 0;
|
||||
private boolean _remove;
|
||||
private int _slot;
|
||||
private boolean _instant = true;
|
||||
|
||||
public PerkFletcher(int time, int max, boolean remove)
|
||||
{
|
||||
this(time, max, remove, -1);
|
||||
}
|
||||
|
||||
public PerkFletcher(int time, int max, boolean remove, boolean instant)
|
||||
{
|
||||
this(time, max, remove, -1, instant);
|
||||
}
|
||||
|
||||
public PerkFletcher(int time, int max, boolean remove, int slot)
|
||||
{
|
||||
this(time, max, remove, slot, true);
|
||||
}
|
||||
|
||||
public PerkFletcher(int time, int max, boolean remove, int slot, boolean instant)
|
||||
{
|
||||
super("Fletcher", new String[]
|
||||
{
|
||||
C.cGray + "Receive 1 Arrow every " + time + " seconds. Maximum of " + max + ".",
|
||||
"Receive 1 Arrow every " + time + " seconds. Maximum of " + max + ".",
|
||||
});
|
||||
|
||||
_time = time;
|
||||
_max = max;
|
||||
_remove = remove;
|
||||
_slot = slot;
|
||||
_instant = instant;
|
||||
}
|
||||
|
||||
public boolean isFletchedArrow(ItemStack stack)
|
||||
@ -106,7 +118,12 @@ public class PerkFletcher extends Perk
|
||||
{
|
||||
if (event.getType() != UpdateType.FAST)
|
||||
return;
|
||||
|
||||
|
||||
if (!UtilTime.elapsed(Manager.GetGame().getGameLiveTime(), _time * 1000) && !_instant)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for (Player cur : UtilServer.getPlayers())
|
||||
{
|
||||
if (Manager.isSpectator(cur))
|
||||
|
@ -0,0 +1,184 @@
|
||||
package nautilus.game.arcade.kit.perks;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
|
||||
import org.bukkit.Effect;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.block.Action;
|
||||
import org.bukkit.event.block.BlockPlaceEvent;
|
||||
import org.bukkit.event.entity.PlayerDeathEvent;
|
||||
import org.bukkit.event.player.PlayerDropItemEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilAction;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.common.util.UtilTime.TimeUnit;
|
||||
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.data.IcePathData;
|
||||
|
||||
public class PerkIceBridge extends Perk
|
||||
{
|
||||
|
||||
private HashSet<IcePathData> _data = new HashSet<IcePathData>();
|
||||
public long _cooldown;
|
||||
private long _bridgeUpTime;
|
||||
|
||||
public PerkIceBridge(long cooldown, long bridgeUpTime)
|
||||
{
|
||||
super("Ice Bridge", new String[] {
|
||||
C.cYellow + "Right Click" + C.cGray + " with Ice to create an " + C.cGreen + "Ice Bridge",
|
||||
"Lasts for " + C.cGreen + UtilTime.convertString(bridgeUpTime, 0, TimeUnit.SECONDS) + C.cGray + ".",
|
||||
"Cooldown " + C.cGreen + UtilTime.convertString(cooldown, 0, TimeUnit.SECONDS) + C.cGray + "."
|
||||
});
|
||||
|
||||
_cooldown = cooldown;
|
||||
_bridgeUpTime = bridgeUpTime;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerInteract(PlayerInteractEvent event)
|
||||
{
|
||||
if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if (player.getItemInHand() == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (player.getItemInHand().getType() != Material.ICE)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!hasPerk(player))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Recharge.Instance.use(player, GetName(), _cooldown, true, true))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
player.teleport(player.getLocation().add(0, 1, 0));
|
||||
UtilAction.velocity(player, new Vector(0, 0.5, 0));
|
||||
|
||||
_data.add(new IcePathData(player));
|
||||
|
||||
// Inform
|
||||
UtilPlayer.message(player, F.main("Game", "You used " + F.skill(GetName()) + "."));
|
||||
}
|
||||
|
||||
|
||||
@EventHandler
|
||||
public void onUpdate(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.TICK)
|
||||
return;
|
||||
|
||||
Iterator<IcePathData> dataIterator = _data.iterator();
|
||||
|
||||
while (dataIterator.hasNext())
|
||||
{
|
||||
IcePathData data = dataIterator.next();
|
||||
|
||||
Block block = data.GetNextBlock();
|
||||
|
||||
if (block == null)
|
||||
{
|
||||
dataIterator.remove();
|
||||
}
|
||||
else
|
||||
{
|
||||
block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, 79);
|
||||
Manager.GetBlockRestore().add(block, 79, (byte) 0, _bridgeUpTime);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onBlockPlace(BlockPlaceEvent event)
|
||||
{
|
||||
Player player = event.getPlayer();
|
||||
ItemStack itemStack = player.getItemInHand();
|
||||
|
||||
if (!hasPerk(player))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (itemStack == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (itemStack.getItemMeta() == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (itemStack.getItemMeta().getDisplayName() == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (itemStack.getItemMeta().getDisplayName().contains(GetName()))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
player.sendMessage(F.main("Game", "You cannot place this item."));
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerDropItem(PlayerDropItemEvent event)
|
||||
{
|
||||
if (!hasPerk(event.getPlayer()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (event.getItemDrop().getItemStack().getType() == Material.ICE)
|
||||
{
|
||||
event.getPlayer().sendMessage(F.main("Game", "You cannot drop this item."));
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerDeath(PlayerDeathEvent event)
|
||||
{
|
||||
if (!hasPerk(event.getEntity()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Iterator<ItemStack> iterator = event.getDrops().iterator();
|
||||
|
||||
while (iterator.hasNext())
|
||||
{
|
||||
ItemStack itemStack = iterator.next();
|
||||
|
||||
if (itemStack.getType() == Material.ICE)
|
||||
{
|
||||
iterator.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -5,7 +5,6 @@ import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||
import nautilus.game.arcade.kit.Perk;
|
||||
|
||||
@ -17,7 +16,7 @@ public class PerkIronSkin extends Perk
|
||||
{
|
||||
super("Iron Skin", new String[]
|
||||
{
|
||||
C.cGray + "You take " + d + " less damage from attacks",
|
||||
"You take " + d + " less damage from attacks",
|
||||
});
|
||||
|
||||
_reduction = d;
|
||||
|
@ -16,15 +16,23 @@ import nautilus.game.arcade.kit.Perk;
|
||||
public class PerkKnockback extends Perk
|
||||
{
|
||||
private double _power;
|
||||
private boolean _onGround;
|
||||
|
||||
public PerkKnockback(double power)
|
||||
{
|
||||
this(power, false);
|
||||
}
|
||||
|
||||
public PerkKnockback(double power, boolean onGround)
|
||||
{
|
||||
super("Knockback", new String[]
|
||||
{
|
||||
C.cGray + "Attacks gives knockback with " + power + " power.",
|
||||
C.cGray + "Attacks gives knockback with " + C.cGreen + power + C.cGray + " power.",
|
||||
(onGround ? "Only works while you are on the ground." : "Works in the air and on the ground."),
|
||||
});
|
||||
|
||||
_power = power;
|
||||
_onGround = onGround;
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH)
|
||||
@ -33,11 +41,16 @@ public class PerkKnockback extends Perk
|
||||
Player damager = event.GetDamagerPlayer(false);
|
||||
if (damager == null) return;
|
||||
|
||||
if (!Kit.HasKit(damager))
|
||||
if (!hasPerk(damager))
|
||||
return;
|
||||
|
||||
if (!Manager.IsAlive(damager))
|
||||
return;
|
||||
|
||||
if (_onGround && !UtilEnt.isGrounded(event.GetDamageeEntity()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
event.SetKnockback(false);
|
||||
|
||||
|
@ -0,0 +1,268 @@
|
||||
package nautilus.game.arcade.kit.perks;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.block.Action;
|
||||
import org.bukkit.event.block.BlockBreakEvent;
|
||||
import org.bukkit.event.block.BlockPlaceEvent;
|
||||
import org.bukkit.event.entity.PlayerDeathEvent;
|
||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
import org.bukkit.event.player.PlayerDropItemEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.event.player.PlayerPickupItemEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilAction;
|
||||
import mineplex.core.common.util.UtilAlg;
|
||||
import mineplex.core.common.util.UtilItem;
|
||||
import mineplex.core.common.util.UtilParticle;
|
||||
import mineplex.core.common.util.UtilParticle.ParticleType;
|
||||
import mineplex.core.common.util.UtilParticle.ViewDist;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import nautilus.game.arcade.game.Game;
|
||||
import nautilus.game.arcade.game.TeamGame;
|
||||
import nautilus.game.arcade.kit.Perk;
|
||||
|
||||
public class PerkMagnetism extends Perk
|
||||
{
|
||||
|
||||
private static final int RESISTANCE_DURATION = 40;
|
||||
|
||||
private long _cooldown;
|
||||
private int _range;
|
||||
private double _magnituideFactor;
|
||||
|
||||
public PerkMagnetism(long cooldown, int range, double magnitudeFactor)
|
||||
{
|
||||
super("Magnestism", new String[] {
|
||||
});
|
||||
|
||||
_cooldown = cooldown;
|
||||
_range = range;
|
||||
_magnituideFactor = magnitudeFactor;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onUpdate(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.FAST)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for (Player player : UtilServer.getPlayers())
|
||||
{
|
||||
if (!hasPerk(player) || UtilPlayer.isSpectator(player))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
int magnituide = getAmountOfMetalArmor(player);
|
||||
|
||||
if (magnituide == 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
player.removePotionEffect(PotionEffectType.DAMAGE_RESISTANCE);
|
||||
player.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, RESISTANCE_DURATION, magnituide - 1));
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerInteract(PlayerInteractEvent event)
|
||||
{
|
||||
if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if (player.getItemInHand() == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (player.getItemInHand().getType() != Material.REDSTONE_COMPARATOR)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!hasPerk(player))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Player target = UtilPlayer.getPlayerInSight(player, _range, true);
|
||||
|
||||
if (target == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Game game = Manager.GetGame();
|
||||
|
||||
if (game instanceof TeamGame)
|
||||
{
|
||||
if (game.GetTeam(player).equals(game.GetTeam(target)))
|
||||
{
|
||||
player.sendMessage(F.main("Game", "They are on your team!"));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
int magnitude = getAmountOfMetalArmor(target);
|
||||
|
||||
if (magnitude == 0)
|
||||
{
|
||||
player.sendMessage(F.main("Game", "They do not have any metal armor on."));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Recharge.Instance.use(player, GetName(), _cooldown, true, true))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
UtilParticle.PlayParticleToAll(ParticleType.FIREWORKS_SPARK, player.getEyeLocation(), 1, 1, 1, 0.01F, 20, ViewDist.NORMAL);
|
||||
|
||||
Vector vector = UtilAlg.getTrajectory(target, player).multiply((.5 + magnitude / 4) * _magnituideFactor);
|
||||
|
||||
UtilAction.velocity(target, vector.setY(Math.max(.6, vector.getY())));
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerPickupItem(PlayerPickupItemEvent event)
|
||||
{
|
||||
if (!hasPerk(event.getPlayer()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
ItemStack itemStack = event.getItem().getItemStack();
|
||||
|
||||
if (UtilItem.isDiamondProduct(itemStack) && UtilItem.isArmor(itemStack))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onInventoryClick(InventoryClickEvent event)
|
||||
{
|
||||
if (!hasPerk((Player) event.getWhoClicked()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
ItemStack itemStack = event.getCurrentItem();
|
||||
|
||||
if (UtilItem.isDiamondProduct(itemStack) && UtilItem.isArmor(itemStack))
|
||||
{
|
||||
event.getWhoClicked().sendMessage(F.main("Game", "You cannot equip diamond armor."));
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onBlockBreak(BlockBreakEvent event)
|
||||
{
|
||||
if (!hasPerk(event.getPlayer()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Block block = event.getBlock();
|
||||
|
||||
if (block.getType() == Material.IRON_ORE)
|
||||
{
|
||||
block.getWorld().dropItemNaturally(block.getLocation().add(0.5, 0.5, 0.5), new ItemStack(Material.IRON_INGOT));
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onBlockPlace(BlockPlaceEvent event)
|
||||
{
|
||||
Player player = event.getPlayer();
|
||||
ItemStack itemStack = player.getItemInHand();
|
||||
|
||||
if (!hasPerk(player))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (itemStack == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (itemStack.getType() == Material.REDSTONE_COMPARATOR)
|
||||
{
|
||||
event.setCancelled(true);
|
||||
player.sendMessage(F.main("Game", "You cannot place this item."));
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerDropItem(PlayerDropItemEvent event)
|
||||
{
|
||||
if (!hasPerk(event.getPlayer()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (event.getItemDrop().getItemStack().getType() == Material.REDSTONE_COMPARATOR)
|
||||
{
|
||||
event.getPlayer().sendMessage(F.main("Game", "You cannot drop this item."));
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerDeath(PlayerDeathEvent event)
|
||||
{
|
||||
Iterator<ItemStack> iterator = event.getDrops().iterator();
|
||||
|
||||
while (iterator.hasNext())
|
||||
{
|
||||
ItemStack itemStack = iterator.next();
|
||||
|
||||
if (itemStack.getType() == Material.REDSTONE_COMPARATOR)
|
||||
{
|
||||
iterator.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private int getAmountOfMetalArmor(Player player)
|
||||
{
|
||||
int magnitude = 0;
|
||||
|
||||
for (ItemStack itemStack : player.getInventory().getArmorContents())
|
||||
{
|
||||
if (UtilItem.isIronProduct(itemStack) || UtilItem.isGoldProduct(itemStack) || UtilItem.isChainmailProduct(itemStack))
|
||||
{
|
||||
if (UtilItem.isArmor(itemStack))
|
||||
{
|
||||
magnitude++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return magnitude;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,138 @@
|
||||
package nautilus.game.arcade.kit.perks;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.block.Action;
|
||||
import org.bukkit.event.entity.PlayerDeathEvent;
|
||||
import org.bukkit.event.player.PlayerDropItemEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilEnt;
|
||||
import mineplex.core.common.util.UtilParticle;
|
||||
import mineplex.core.common.util.UtilParticle.ParticleType;
|
||||
import mineplex.core.common.util.UtilParticle.ViewDist;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import nautilus.game.arcade.events.GameStateChangeEvent;
|
||||
import nautilus.game.arcade.game.Game.GameState;
|
||||
import nautilus.game.arcade.kit.Perk;
|
||||
|
||||
public class PerkVoidSaver extends Perk
|
||||
{
|
||||
|
||||
private Map<UUID, Location> _safeLocations = new HashMap<>();
|
||||
private List<UUID> _used = new ArrayList<>();
|
||||
|
||||
public PerkVoidSaver()
|
||||
{
|
||||
super("Void Saver", new String[] {
|
||||
});
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerInteract(PlayerInteractEvent event)
|
||||
{
|
||||
if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if (player.getItemInHand() == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (player.getItemInHand().getType() != Material.EYE_OF_ENDER)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
event.setCancelled(true);
|
||||
|
||||
if (!hasPerk(player) || _used.contains(player.getUniqueId()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (_safeLocations.get(player.getUniqueId()) == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
player.teleport(_safeLocations.get(player.getUniqueId()).add(0, 2, 0));
|
||||
player.setFallDistance(0);
|
||||
player.getInventory().remove(Material.EYE_OF_ENDER);
|
||||
player.sendMessage(F.main("Game", "You used your safe teleport."));
|
||||
player.playSound(player.getLocation(), Sound.ENDERMAN_TELEPORT, 1, 0);
|
||||
UtilParticle.PlayParticleToAll(ParticleType.WITCH_MAGIC, player.getEyeLocation(), 0.5F, 0.5F, 0.5F, 0.5F, 10, ViewDist.NORMAL);
|
||||
_used.add(player.getUniqueId());
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onUpdate(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.FAST)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for (Player player : Manager.GetGame().GetPlayers(true))
|
||||
{
|
||||
if (!hasPerk(player) || _used.contains(player.getUniqueId()) || !UtilEnt.isGrounded(player))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
_safeLocations.put(player.getUniqueId(), player.getLocation());
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerDropItem(PlayerDropItemEvent event)
|
||||
{
|
||||
if (event.getItemDrop().getItemStack().getType() == Material.EYE_OF_ENDER)
|
||||
{
|
||||
event.getPlayer().sendMessage(F.main("Game", "You cannot drop this item."));
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerDeath(PlayerDeathEvent event)
|
||||
{
|
||||
Iterator<ItemStack> iterator = event.getDrops().iterator();
|
||||
|
||||
while (iterator.hasNext())
|
||||
{
|
||||
ItemStack itemStack = iterator.next();
|
||||
|
||||
if (itemStack.getType() == Material.EYE_OF_ENDER)
|
||||
{
|
||||
iterator.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onGameStateChange(GameStateChangeEvent event)
|
||||
{
|
||||
if (event.GetState() == GameState.WinRoom)
|
||||
{
|
||||
_used.clear();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -163,19 +163,26 @@ public class ProgressingKitManager implements Listener
|
||||
{
|
||||
//This needs to stay in for testing sakes if the issue arises connor
|
||||
String message = event.getMessage();
|
||||
if(!event.getPlayer().getName().equalsIgnoreCase("TadahTech"))
|
||||
String user = event.getPlayer().getName();
|
||||
|
||||
if(user.equalsIgnoreCase("TadahTech") || user.equalsIgnoreCase("Moppletop"))
|
||||
{
|
||||
return;
|
||||
if(message.startsWith("/kpsetlevel"))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
int level = Integer.parseInt(message.split(" ")[1]);
|
||||
ProgressingKit kit = (ProgressingKit) _manager.GetGame().GetKit(event.getPlayer());
|
||||
kit.setLevel(level, event.getPlayer().getUniqueId());
|
||||
event.getPlayer().sendMessage("Set level for "+ kit.GetName() + " to " + level);
|
||||
}
|
||||
else if (message.startsWith("/kpclearupgrades"))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
ProgressingKit kit = (ProgressingKit) _manager.GetGame().GetKit(event.getPlayer());
|
||||
kit.setUpgradeLevel(0, event.getPlayer().getUniqueId());
|
||||
event.getPlayer().sendMessage("Cleared the upgrades for " + kit.GetName());
|
||||
}
|
||||
}
|
||||
if(!message.startsWith("/kpsetlevel"))
|
||||
{
|
||||
return;
|
||||
}
|
||||
event.setCancelled(true);
|
||||
int level = Integer.parseInt(message.split(" ")[1]);
|
||||
ProgressingKit kit = (ProgressingKit) _manager.GetGame().GetKit(event.getPlayer());
|
||||
kit.setLevel(level, event.getPlayer().getUniqueId());
|
||||
event.getPlayer().sendMessage("Set level for "+ kit.GetName() + " to " + level);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
|
Loading…
Reference in New Issue
Block a user