diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilEnt.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilEnt.java index 635bedba2..580b337f5 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilEnt.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilEnt.java @@ -694,9 +694,9 @@ public class UtilEnt return ent.isOnGround(); } - AxisAlignedBB box = ((CraftEntity)ent).getHandle().getBoundingBox().shrink(0.05, 0, 0.05); - Location bottom_corner_1 = new Location(ent.getWorld(), box.a, ent.getLocation().getY()-0.05, box.c); - Location bottom_corner_2 = new Location(ent.getWorld(), box.d, ent.getLocation().getY()-0.05, box.f); + AxisAlignedBB box = ((CraftEntity)ent).getHandle().getBoundingBox(); + Location bottom_corner_1 = new Location(ent.getWorld(), box.a, ent.getLocation().getY()-0.1, box.c); + Location bottom_corner_2 = new Location(ent.getWorld(), box.d, ent.getLocation().getY()-0.1, box.f); for(Block b : UtilBlock.getInBoundingBox(bottom_corner_1, bottom_corner_2)){ if(UtilBlock.solid(b)) return true; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/antihack/AntiHack.java b/Plugins/Mineplex.Core/src/mineplex/core/antihack/AntiHack.java index 525351b5a..ea10db00a 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/antihack/AntiHack.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/antihack/AntiHack.java @@ -68,7 +68,6 @@ import mineplex.core.antihack.commands.AnticheatOnCommand; import mineplex.core.antihack.commands.DetailedMessagesCommand; import mineplex.core.antihack.commands.GetVlsCommand; import mineplex.core.antihack.commands.TestBanCommand; -import mineplex.core.antihack.compedaccount.CompromisedAccountManager; import mineplex.core.antihack.gep.GwenExtremePrejudice; import mineplex.core.antihack.guardians.GuardianManager; import mineplex.core.antihack.logging.AntihackLogger; @@ -150,8 +149,6 @@ public class AntiHack extends MiniPlugin private BanWaveManager _banWaveManager; - private final CompromisedAccountManager _compromisedAccountManager; - private AntiHack() { super("AntiHack"); @@ -160,7 +157,6 @@ public class AntiHack extends MiniPlugin require(GuardianManager.class); _banWaveManager = require(BanWaveManager.class); - _compromisedAccountManager = require(CompromisedAccountManager.class); Bukkit.getServicesManager().register(MineplexLink.class, new MineplexLinkImpl(), this._plugin, ServicePriority.Normal); @@ -205,7 +201,7 @@ public class AntiHack extends MiniPlugin runSync(() -> _banned.remove(uuid)); } - public void doBan(Player player, Class cause, boolean gep) + public void doBan(Player player, Class cause, boolean gep, int hoursBanned) { runSync(() -> { @@ -214,7 +210,7 @@ public class AntiHack extends MiniPlugin CoreClient coreClient = _clientManager.Get(player); String id = generateId(); - String finalMessage = "[GWEN Cheat Detection]\n\nToken: " + id; + String finalMessage = "[GWEN Cheat Detection]\n\nBan Token:\n" + org.bukkit.ChatColor.GRAY + id; JsonObject custom = new JsonObject(); custom.addProperty("ban-reason", CheckManager.getCheckSimpleName(cause)); if (gep) @@ -231,9 +227,7 @@ public class AntiHack extends MiniPlugin new GwenBanNotification(_thisServer, player.getName(), player.getUniqueId().toString(), coreClient.GetRank().name(), CheckManager.getCheckSimpleName(cause), id, gep).publish(); }); - _compromisedAccountManager.submitImmediateBan(player); - - _punish.AddPunishment(coreClient.getName(), Category.Hacking, finalMessage, AntiHack.NAME, 3, true, getDaysBanned(player, cause), true, after); + _punish.AddPunishment(coreClient.getName(), Category.Hacking, finalMessage, AntiHack.NAME, 3, true, hoursBanned, true, after); }; if (coreClient.GetRank().has(Rank.TWITCH)) @@ -272,7 +266,7 @@ public class AntiHack extends MiniPlugin Consumer> doPunish = after -> { - _punish.AddPunishment(coreClient.getName(), Category.Hacking, info.getMessage(), AntiHack.NAME, 3, true, getDaysBanned(player, CheckManager.getCheckBySimpleName(info.getHackType())), true, after); + _punish.AddPunishment(coreClient.getName(), Category.Hacking, info.getMessage(), AntiHack.NAME, 3, true, getHoursBanned(player), true, after); }; if (coreClient.GetRank().has(Rank.TWITCH)) @@ -352,13 +346,18 @@ public class AntiHack extends MiniPlugin { PunishClient punishClient = require(Punish.class).GetClient(player.getName()); + if (punishClient == null) + { + return -1; + } + int totalPunishments = 0; if (punishClient.GetPunishments().containsKey(Category.Hacking)) { for (Punishment punishment : punishClient.GetPunishments().get(Category.Hacking)) { - if (punishment.GetAdmin().equalsIgnoreCase(NAME) && punishment.GetReason().contains("[GWEN]")) + if (punishment.GetAdmin().equalsIgnoreCase(NAME) && punishment.GetReason().contains("[GWEN")) { totalPunishments++; } @@ -368,37 +367,18 @@ public class AntiHack extends MiniPlugin return totalPunishments; } - public int getDaysBanned(Player player, Class check) + public int getHoursBanned(Player player) { - if (check == null) // old banwaves - { - switch (getPunishments(player)) - { - case 0: - return 5; - case 1: - return 14; - case 2: - return 30; - default: - return -1; - } - } - - switch (check.getSimpleName()) + switch (getPunishments(player)) { + case 0: + return 5 * 24; + case 1: + return 14 * 24; + case 2: + return 30 * 24; default: - switch (getPunishments(player)) - { - case 0: - return 5; - case 1: - return 14; - case 2: - return 30; - default: - return -1; - } + return -1; } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/antihack/actions/BanwaveAction.java b/Plugins/Mineplex.Core/src/mineplex/core/antihack/actions/BanwaveAction.java index 6840ec600..1deaf4a35 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/antihack/actions/BanwaveAction.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/antihack/actions/BanwaveAction.java @@ -12,6 +12,7 @@ import mineplex.core.common.util.UtilServer; public class BanwaveAction extends AntiHackAction { + private final AntiHack _antiHack = Managers.require(AntiHack.class); private static final int BAN_DELAY_MINIMUM_MINUTES = 30; private static final int BAN_DELAY_MAXIMUM_MINUTES = (int) TimeUnit.MINUTES.convert(2, TimeUnit.HOURS); @@ -25,7 +26,7 @@ public class BanwaveAction extends AntiHackAction { if (event.getViolations() >= (Math.floor(getMinVl() * .9)) && event.getPlayer().getMetadata("GWENEXTREMEPREJUDICE").get(0).asBoolean()) { - Managers.get(AntiHack.class).doBan(event.getPlayer(), event.getCheckClass(), true); + _antiHack.doBan(event.getPlayer(), event.getCheckClass(), true, _antiHack.getHoursBanned(event.getPlayer())); return; } if (event.getViolations() >= this.getMinVl()) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/antihack/actions/GEPBanAction.java b/Plugins/Mineplex.Core/src/mineplex/core/antihack/actions/GEPBanAction.java index 0fbaa3377..6c109e68c 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/antihack/actions/GEPBanAction.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/antihack/actions/GEPBanAction.java @@ -7,6 +7,8 @@ import mineplex.core.antihack.AntiHack; public class GEPBanAction extends AntiHackAction { + private final AntiHack _antiHack = Managers.require(AntiHack.class); + public GEPBanAction(int vl) { super(vl); @@ -17,7 +19,7 @@ public class GEPBanAction extends AntiHackAction { if (event.getViolations() >= this.getMinVl() && event.getPlayer().getMetadata("GWENEXTREMEPREJUDICE").get(0).asBoolean()) { - Managers.get(AntiHack.class).doBan(event.getPlayer(), event.getCheckClass(), true); + _antiHack.doBan(event.getPlayer(), event.getCheckClass(), true, _antiHack.getHoursBanned(event.getPlayer())); } } } \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/antihack/actions/ImmediateBanAction.java b/Plugins/Mineplex.Core/src/mineplex/core/antihack/actions/ImmediateBanAction.java index 1016ba9c5..2f86d524d 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/antihack/actions/ImmediateBanAction.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/antihack/actions/ImmediateBanAction.java @@ -7,6 +7,8 @@ import mineplex.core.antihack.AntiHack; public class ImmediateBanAction extends AntiHackAction { + private final AntiHack _antiHack = Managers.require(AntiHack.class); + public ImmediateBanAction(int vl) { super(vl); @@ -17,12 +19,12 @@ public class ImmediateBanAction extends AntiHackAction { if (event.getViolations() >= (Math.floor(getMinVl() * .9)) && event.getPlayer().getMetadata("GWENEXTREMEPREJUDICE").get(0).asBoolean()) { - Managers.get(AntiHack.class).doBan(event.getPlayer(), event.getCheckClass(), true); + _antiHack.doBan(event.getPlayer(), event.getCheckClass(), true, _antiHack.getHoursBanned(event.getPlayer())); return; } if (event.getViolations() >= this.getMinVl()) { - Managers.get(AntiHack.class).doBan(event.getPlayer(), event.getCheckClass(), false); + _antiHack.doBan(event.getPlayer(), event.getCheckClass(), false, _antiHack.getHoursBanned(event.getPlayer())); } } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/antihack/banwave/BanWaveManager.java b/Plugins/Mineplex.Core/src/mineplex/core/antihack/banwave/BanWaveManager.java index 3eb4506b0..7123a383c 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/antihack/banwave/BanWaveManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/antihack/banwave/BanWaveManager.java @@ -1,17 +1,5 @@ package mineplex.core.antihack.banwave; -import mineplex.core.MiniPlugin; -import mineplex.core.ReflectivelyCreateMiniPlugin; -import mineplex.core.account.CoreClient; -import mineplex.core.account.CoreClientManager; -import mineplex.core.antihack.AntiHack; -import mineplex.core.antihack.compedaccount.CompromisedAccountManager; -import mineplex.core.antihack.logging.AntihackLogger; -import mineplex.core.antihack.redisnotifications.GwenBanwaveNotification; -import mineplex.core.common.util.UtilServer; -import mineplex.serverdata.commands.ServerCommandManager; - -import org.bukkit.Bukkit; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.player.PlayerJoinEvent; @@ -20,6 +8,15 @@ import com.google.gson.JsonObject; import com.mineplex.anticheat.checks.Check; import com.mineplex.anticheat.checks.CheckManager; +import mineplex.core.MiniPlugin; +import mineplex.core.ReflectivelyCreateMiniPlugin; +import mineplex.core.account.CoreClient; +import mineplex.core.account.CoreClientManager; +import mineplex.core.antihack.AntiHack; +import mineplex.core.antihack.logging.AntihackLogger; +import mineplex.core.antihack.redisnotifications.GwenBanwaveNotification; +import mineplex.core.common.util.UtilServer; + @ReflectivelyCreateMiniPlugin public class BanWaveManager extends MiniPlugin { @@ -75,7 +72,6 @@ public class BanWaveManager extends MiniPlugin JsonObject custom = new JsonObject(); custom.addProperty("is-banwave", true); - require(CompromisedAccountManager.class).submitPendingDelayedBan(player); require(AntihackLogger.class).saveMetadata(player, id, after, custom); } }); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/explosion/Explosion.java b/Plugins/Mineplex.Core/src/mineplex/core/explosion/Explosion.java index dedb8c37b..02601d751 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/explosion/Explosion.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/explosion/Explosion.java @@ -7,6 +7,7 @@ import java.util.HashSet; import java.util.Iterator; import java.util.Map.Entry; import java.util.UUID; +import java.util.concurrent.TimeUnit; import mineplex.core.MiniPlugin; import mineplex.core.blockrestore.BlockRestore; @@ -38,10 +39,11 @@ import org.bukkit.util.Vector; public class Explosion extends MiniPlugin { - private boolean _regenerateGround = false; + private boolean _regenerateGround; + private long _regenerateTime; private boolean _temporaryDebris = true; private boolean _enableDebris = false; - private boolean _tntSpread = true; + private boolean _tntSpread; private boolean _liquidDamage = true; private HashSet _explosionBlocks = new HashSet(); @@ -52,6 +54,8 @@ public class Explosion extends MiniPlugin super("Block Restore", plugin); _blockRestore = blockRestore; + + resetConfiguration(); } @EventHandler @@ -134,7 +138,7 @@ public class Explosion extends MiniPlugin else { int heightDiff = cur.getLocation().getBlockY() - event.getEntity().getLocation().getBlockY(); - _blockRestore.add(cur, 0, (byte) 0, (long) (20000 + (heightDiff * 3000) + Math.random() * 2900)); + _blockRestore.add(cur, 0, (byte) 0, (long) (_regenerateTime + (heightDiff * 3000) + Math.random() * 2900)); } } @@ -276,6 +280,11 @@ public class Explosion extends MiniPlugin _regenerateGround = regenerate; } + public void setRegenerateTime(long time) + { + _regenerateTime = time; + } + public void SetDebris(boolean value) { _enableDebris = value; @@ -296,6 +305,13 @@ public class Explosion extends MiniPlugin _temporaryDebris = value; } + public void resetConfiguration() + { + _regenerateGround = false; + _regenerateTime = TimeUnit.SECONDS.toMillis(20); + _tntSpread = true; + } + public HashSet GetExplosionBlocks() { return _explosionBlocks; @@ -326,7 +342,14 @@ public class Explosion extends MiniPlugin if (removeBlock) { - cur.setType(Material.AIR); + if (_regenerateGround) + { + _blockRestore.add(cur, 0, (byte) 0, (long) (_regenerateTime + (cur.getLocation().getBlockY() * 3000) + (Math.random() * 1500))); + } + else + { + cur.setType(Material.AIR); + } } } @@ -356,12 +379,16 @@ public class Explosion extends MiniPlugin _explosionBlocks.add(fall); } - } } }, 1); } - + + private void addToRegenerate(Block block) + { + + } + public void setEnabled(boolean var) { if (var) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/game/GameDisplay.java b/Plugins/Mineplex.Core/src/mineplex/core/game/GameDisplay.java index cbeadcc64..159124422 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/game/GameDisplay.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/game/GameDisplay.java @@ -51,6 +51,7 @@ public enum GameDisplay Smash("Super Smash Mobs", Material.SKULL_ITEM, (byte)4, GameCategory.CLASSICS, 34, true), SmashDomination("Super Smash Mobs Domination", "Super Smash Mobs", Material.SKULL_ITEM, (byte)4, GameCategory.EXTRA, 36, false), SmashTeams("Super Smash Mobs Teams", "Super Smash Mobs", Material.SKULL_ITEM, (byte)4, GameCategory.TEAM_VARIANT, 35, false), + SmashTraining("Super Smash Mobs Training", "Super Smash Mobs", Material.SKULL_ITEM, (byte)4, GameCategory.EXTRA, 34, false), Snake("Snake", Material.WOOL, (byte)0, GameCategory.ARCADE, 37, true), SneakyAssassins("Sneaky Assassins", Material.INK_SACK, (byte)0, GameCategory.ARCADE, 38, true), SnowFight("Snow Fight", Material.SNOW_BALL, (byte)0, GameCategory.EXTRA, 39, false), diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ServerManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ServerManager.java index f72c95a65..cc37b55a6 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ServerManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ServerManager.java @@ -792,6 +792,11 @@ public class ServerManager extends MiniPlugin implements BrawlShopProvider { return _serverNpcShopMap.get("Castle Assault"); } + + public ShopBase getCastleAssaultTDMShop() + { + return _serverNpcShopMap.get("Castle Assault TDM"); + } public ShopBase getCastleSiegeShop() { diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerGameMenu.java b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerGameMenu.java index 00498e1d3..07e52532f 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerGameMenu.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerGameMenu.java @@ -22,6 +22,7 @@ import mineplex.hub.server.ui.button.SelectBLDButton; import mineplex.hub.server.ui.button.SelectBRButton; import mineplex.hub.server.ui.button.SelectBawkButton; import mineplex.hub.server.ui.button.SelectCAButton; +import mineplex.hub.server.ui.button.SelectCATDMButton; import mineplex.hub.server.ui.button.SelectCLANSButton; import mineplex.hub.server.ui.button.SelectCSButton; import mineplex.hub.server.ui.button.SelectCTFButton; @@ -62,7 +63,7 @@ public class ServerGameMenu extends ShopPageBase @Override protected void buildPage() { - add(1, Material.EGG, C.cYellowB + "Bawk Bawk Battles " + C.cGray + "Challenges", new String[] + add(0, Material.EGG, C.cYellowB + "Bawk Bawk Battles " + C.cGray + "Challenges", new String[] { C.Reset + "", C.Reset + "Follow Bawk Bawk's instructions", @@ -70,16 +71,25 @@ public class ServerGameMenu extends ShopPageBase C.Reset + "If you lose, chickens will devour you!" }, "BBB", "Bawk_Bawk_Battles", new SelectBawkButton(this)); - add(3, Material.DIAMOND_CHESTPLATE, C.cYellowB + "Castle Assault " + C.cGray + "Fast Paced PvP", new String[] + add(2, Material.DIAMOND_CHESTPLATE, C.cYellowB + "Castle Assault " + C.cGray + "Fast Paced PvP", new String[] { - (_extraValue ? C.cAquaB : C.cWhiteB) + "NEW GAME", + (_extraValue ? C.cAquaB : C.cWhiteB) + "NEW UPDATES", C.Reset + "", C.Reset + "Combatants must battle to", C.Reset + "win the day for their king", C.Reset + "at all costs!", }, "CA", "Castle_Assault", new SelectCAButton(this)); + + add(4, Material.DIAMOND_CHESTPLATE, C.cYellowB + "Castle Assault TDM " + C.cGray + "Team PvP", new String[] + { + (_extraValue ? C.cAquaB : C.cWhiteB) + "NEW GAME", + C.Reset + "", + C.Reset + "Combatants must battle to", + C.Reset + "win glory for their team", + C.Reset + "by slaying the enemy!", + }, "CATDM", "Castle_Assault_TDM", new SelectCATDMButton(this)); - add(5, Material.QUARTZ_BLOCK, C.cYellowB + "Speed Builders " + C.cGray + "Competitive Building", new String[] + add(6, Material.QUARTZ_BLOCK, C.cYellowB + "Speed Builders " + C.cGray + "Competitive Building", new String[] { C.Reset + "", C.Reset + "Memorize Gwen the Guardian's builds", @@ -87,7 +97,7 @@ public class ServerGameMenu extends ShopPageBase C.Reset + "The least correct builder is eliminated.", }, "SB", "Speed_Builders", new SelectSBButton(this)); - add(7, Material.TNT, C.cYellowB + "Dragon Escape " + C.cGray + "Fast Paced Parkour", new String[] + add(8, Material.TNT, C.cYellowB + "Dragon Escape " + C.cGray + "Fast Paced Parkour", new String[] { (_extraValue ? C.cAquaB : C.cWhiteB) + "FEATURED ARCADE GAME", C.Reset + "", @@ -645,6 +655,11 @@ public class ServerGameMenu extends ShopPageBase { getPlugin().getCastleAssaultShop().attemptShopOpen(player); } + + public void openCATDM(Player player) + { + getPlugin().getCastleAssaultTDMShop().attemptShopOpen(player); + } public void openCS(Player player) { diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerNpcShop.java b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerNpcShop.java index eb087afa5..4bda13c2c 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerNpcShop.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerNpcShop.java @@ -25,7 +25,6 @@ public class ServerNpcShop extends ShopBase { switch (_serverGroup.getPrefix().toUpperCase()) { - case "SSM": case "SKY": case "HG": return new ServerTypePage(getPlugin(), this, getClientManager(), getDonationManager(), player, _serverGroup); @@ -39,6 +38,9 @@ public class ServerNpcShop extends ShopBase case "SF": return new SkyfallServerTypePage(getPlugin(), this, getClientManager(), getDonationManager(), player); + case "SSM": + return new SuperSmashMobsServerTypePage(getPlugin(), this, getClientManager(), getDonationManager(), player, _serverGroup); + default: return new ServerNpcPage(getPlugin(), this, getClientManager(), getDonationManager(), _serverGroup.getServerNpcName(), player, _serverGroup.getPrefix()); } diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/SuperSmashMobsServerTypePage.java b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/SuperSmashMobsServerTypePage.java new file mode 100644 index 000000000..f2c611800 --- /dev/null +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/SuperSmashMobsServerTypePage.java @@ -0,0 +1,54 @@ +package mineplex.hub.server.ui; + +import org.bukkit.Material; +import org.bukkit.entity.Player; + +import mineplex.core.account.CoreClientManager; +import mineplex.core.common.util.C; +import mineplex.core.donation.DonationManager; +import mineplex.core.itemstack.ItemBuilder; +import mineplex.core.shop.page.ShopPageBase; +import mineplex.hub.server.ServerManager; +import mineplex.serverdata.data.ServerGroup; + +public class SuperSmashMobsServerTypePage extends ShopPageBase + +{ + private final ServerGroup _serverGroup; + + public SuperSmashMobsServerTypePage(ServerManager plugin, ServerNpcShop shop, CoreClientManager clientManager, + DonationManager donationManager, Player player, ServerGroup group) + { + super(plugin, shop, clientManager, donationManager, "Super Smash Mobs ", player, 27); + _serverGroup = group; + + buildPage(); + } + + @Override + protected void buildPage() + { + setItem(12, new ItemBuilder(Material.SKULL_ITEM, 1, (byte) 4).setTitle(C.Reset + C.cGold + "Play " + C.cYellow + "Super Smash Mobs") + .addLore(new String[] + { + C.Reset + "", + C.Reset + C.cGreen + "Click to Play", + }).build()); + + setItem(14, new ItemBuilder(Material.SKULL_ITEM, 1, (byte) 3).setTitle(C.Reset + C.cYellow + "Super Smash Mobs " + C.cGold + "Training") + .addLore(new String[] + { + C.Reset + "", + C.Reset + C.cGreen + "Click to Play", + }).build()); + + getButtonMap().put(12, (player, __) -> getShop().openPageForPlayer(player, new ServerTypePage(getPlugin(), getShop(), getClientManager(), getDonationManager(), player, _serverGroup))); + getButtonMap().put(14, (player, __) -> getShop().openPageForPlayer(player, new ServerNpcPage(getPlugin(), getShop(), getClientManager(), getDonationManager(), "SSM Training", player, "SSMT"))); + } + + public void Update() + { + getButtonMap().clear(); + buildPage(); + } +} diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/button/SelectCATDMButton.java b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/button/SelectCATDMButton.java new file mode 100644 index 000000000..409d0c4b4 --- /dev/null +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/button/SelectCATDMButton.java @@ -0,0 +1,23 @@ +package mineplex.hub.server.ui.button; + +import org.bukkit.entity.Player; +import org.bukkit.event.inventory.ClickType; + +import mineplex.core.shop.item.IButton; +import mineplex.hub.server.ui.ServerGameMenu; + +public class SelectCATDMButton implements IButton +{ + private ServerGameMenu _menu; + + public SelectCATDMButton(ServerGameMenu menu) + { + _menu = menu; + } + + @Override + public void onClick(Player player, ClickType clickType) + { + _menu.openCATDM(player); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java index 0f8926b18..53e2887de 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java @@ -4,6 +4,7 @@ import java.io.File; import java.util.ArrayList; import java.util.HashSet; +import mineplex.core.google.GoogleSheetsManager; import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.GameMode; @@ -37,7 +38,6 @@ import mineplex.core.MiniPlugin; import mineplex.core.account.CoreClient; import mineplex.core.account.CoreClientManager; import mineplex.core.achievement.AchievementManager; -import mineplex.core.antihack.compedaccount.CompromisedAccountManager; import mineplex.core.antihack.compedaccount.PriorityCause; import mineplex.core.blockrestore.BlockRestore; import mineplex.core.blood.Blood; @@ -233,6 +233,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation private ScoreboardManager _scoreboardManager; private NextBestGameManager _nextBestGameManager; private TrackManager _trackManager; + private GoogleSheetsManager _sheetsManager; private IncognitoManager _incognitoManager; @@ -262,14 +263,13 @@ public class ArcadeManager extends MiniPlugin implements IRelation public final boolean IsHolidayEnabled; private final Titles _titles; - private final CompromisedAccountManager _compromisedAccountManager = require(CompromisedAccountManager.class); public ArcadeManager(Arcade plugin, ServerStatusManager serverStatusManager, GameServerConfig serverConfig, - CoreClientManager clientManager, DonationManager donationManager, DamageManager damageManager, - StatsManager statsManager, IncognitoManager incognitoManager, AchievementManager achievementManager, DisguiseManager disguiseManager, Creature creature, Teleport teleport, Blood blood, Chat chat, - Portal portal, PreferencesManager preferences, InventoryManager inventoryManager, PacketHandler packetHandler, - CosmeticManager cosmeticManager, ProjectileManager projectileManager, PetManager petManager, HologramManager hologramManager, PollManager pollManager, - NpcManager npcManager, CustomDataManager customDataManager, Punish punish, EloManager eloManager, ThankManager thankManager, BoosterManager boosterManager) + CoreClientManager clientManager, DonationManager donationManager, DamageManager damageManager, + StatsManager statsManager, IncognitoManager incognitoManager, AchievementManager achievementManager, DisguiseManager disguiseManager, Creature creature, Teleport teleport, Blood blood, Chat chat, + Portal portal, PreferencesManager preferences, InventoryManager inventoryManager, PacketHandler packetHandler, + CosmeticManager cosmeticManager, ProjectileManager projectileManager, PetManager petManager, HologramManager hologramManager, PollManager pollManager, + NpcManager npcManager, CustomDataManager customDataManager, Punish punish, EloManager eloManager, ThankManager thankManager, BoosterManager boosterManager) { super("Game Manager", plugin); @@ -592,6 +592,8 @@ public class ArcadeManager extends MiniPlugin implements IRelation _trackManager = require(TrackManager.class); _titles = require(Titles.class); Titles.BOOK_SLOT = 4; + + _sheetsManager = require(GoogleSheetsManager.class); } @Override @@ -957,21 +959,21 @@ public class ArcadeManager extends MiniPlugin implements IRelation } //Recruiting else */if (_game == null || _game.GetState() == GameState.Recruit) + { + if (_game != null && _game.GetCountdown() != -1) { - if (_game != null && _game.GetCountdown() != -1) - { - event.setMotd(ChatColor.GREEN + "Starting in " + _game.GetCountdown() + " Seconds" + extrainformation); - } - else - { - event.setMotd(ChatColor.GREEN + "Recruiting" + extrainformation); - } + event.setMotd(ChatColor.GREEN + "Starting in " + _game.GetCountdown() + " Seconds" + extrainformation); } - //In Progress else { - event.setMotd(ChatColor.YELLOW + "In Progress" + extrainformation); + event.setMotd(ChatColor.GREEN + "Recruiting" + extrainformation); } + } + //In Progress + else + { + event.setMotd(ChatColor.YELLOW + "In Progress" + extrainformation); + } if (UtilServer.isTestServer(false)) event.setMotd(ChatColor.GOLD + "Private Mineplex Test Server"); @@ -986,8 +988,6 @@ public class ArcadeManager extends MiniPlugin implements IRelation @EventHandler public void MessageJoin(PlayerJoinEvent event) { - _compromisedAccountManager.triggerPriorityBan(event.getPlayer(), PriorityCause.JOIN_GAME); - if (_incognitoManager.Get(event.getPlayer()).Status) { event.setJoinMessage(null); @@ -2081,8 +2081,8 @@ public class ArcadeManager extends MiniPlugin implements IRelation return this._titles; } - public CompromisedAccountManager getCompromisedAccountManager() + public GoogleSheetsManager getSheetsManager() { - return _compromisedAccountManager; + return _sheetsManager; } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/GameType.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/GameType.java index 301541dba..d24483811 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/GameType.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/GameType.java @@ -1,6 +1,7 @@ package nautilus.game.arcade; import nautilus.game.arcade.game.games.moba.Moba; +import nautilus.game.arcade.game.games.smash.SuperSmashTraining; import org.bukkit.Material; import mineplex.core.common.MinecraftVersion; @@ -186,6 +187,7 @@ public enum GameType Smash(SoloSuperSmash.class, GameDisplay.Smash), SmashDomination(SuperSmashDominate.class, GameDisplay.SmashDomination), SmashTeams(TeamSuperSmash.class, GameDisplay.SmashTeams, new GameType[]{GameType.Smash}, false), + SmashTraining(SuperSmashTraining.class, GameDisplay.SmashTraining), Snake(Snake.class, GameDisplay.Snake), SneakyAssassins(SneakyAssassins.class, GameDisplay.SneakyAssassins), SnowFight(SnowFight.class, GameDisplay.SnowFight), diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java index 70cc48c37..a1cb59f09 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java @@ -1,27 +1,52 @@ package nautilus.game.arcade.game; -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Optional; -import java.util.Set; -import java.util.UUID; - +import com.google.common.collect.Lists; +import com.mojang.authlib.GameProfile; +import mineplex.core.Managers; +import mineplex.core.antihack.AntiHack; +import mineplex.core.arcadeevents.CoreGameStartEvent; +import mineplex.core.arcadeevents.CoreGameStopEvent; +import mineplex.core.command.CommandCenter; +import mineplex.core.common.Rank; +import mineplex.core.common.util.*; +import mineplex.core.disguise.disguises.DisguisePlayer; +import mineplex.core.elo.EloPlayer; +import mineplex.core.elo.EloTeam; +import mineplex.core.itemstack.ItemBuilder; +import mineplex.core.lifetimes.Lifetimed; +import mineplex.core.lifetimes.ListenerComponent; +import mineplex.core.lifetimes.PhasedLifetime; +import mineplex.core.packethandler.IPacketHandler; +import mineplex.core.packethandler.PacketInfo; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.utils.UtilGameProfile; +import mineplex.minecraft.game.classcombat.event.ClassCombatCreatureAllowSpawnEvent; +import mineplex.minecraft.game.core.combat.DeathMessageType; +import mineplex.minecraft.game.core.combat.event.CombatDeathEvent; +import nautilus.game.arcade.ArcadeFormat; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.GameType; +import nautilus.game.arcade.events.GameStateChangeEvent; +import nautilus.game.arcade.events.PlayerGameRespawnEvent; +import nautilus.game.arcade.events.PlayerStateChangeEvent; +import nautilus.game.arcade.game.GameTeam.PlayerState; +import nautilus.game.arcade.game.games.build.Build; +import nautilus.game.arcade.game.games.draw.Draw; +import nautilus.game.arcade.game.games.speedbuilders.SpeedBuilders; +import nautilus.game.arcade.game.modules.AntiExpOrbModule; +import nautilus.game.arcade.game.modules.Module; +import nautilus.game.arcade.kit.*; +import nautilus.game.arcade.managers.chat.ChatStatData; +import nautilus.game.arcade.managers.lobby.LobbyManager; +import nautilus.game.arcade.scoreboard.GameScoreboard; +import nautilus.game.arcade.stats.*; +import nautilus.game.arcade.wineffect.WinEffectManager; +import nautilus.game.arcade.world.WorldData; import net.minecraft.server.v1_8_R3.EntityItem; import net.minecraft.server.v1_8_R3.PacketPlayInUseEntity; - import org.apache.commons.lang3.tuple.Triple; -import org.bukkit.Bukkit; -import org.bukkit.ChatColor; -import org.bukkit.Location; -import org.bukkit.Material; -import org.bukkit.Sound; +import org.bukkit.*; import org.bukkit.block.Block; import org.bukkit.block.BlockFace; import org.bukkit.craftbukkit.v1_8_R3.CraftWorld; @@ -41,79 +66,12 @@ import org.bukkit.event.hanging.HangingPlaceEvent; import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.event.world.WorldLoadEvent; -import org.bukkit.inventory.PlayerInventory; import org.bukkit.scoreboard.NameTagVisibility; import org.bukkit.scoreboard.Team; import org.bukkit.util.Vector; -import com.google.common.collect.Lists; -import com.mojang.authlib.GameProfile; - -import mineplex.core.Managers; -import mineplex.core.antihack.AntiHack; -import mineplex.core.arcadeevents.CoreGameStartEvent; -import mineplex.core.arcadeevents.CoreGameStopEvent; -import mineplex.core.command.CommandCenter; -import mineplex.core.common.Rank; -import mineplex.core.common.util.C; -import mineplex.core.common.util.F; -import mineplex.core.common.util.NautHashMap; -import mineplex.core.common.util.UtilBlock; -import mineplex.core.common.util.UtilEnt; -import mineplex.core.common.util.UtilMath; -import mineplex.core.common.util.UtilPlayer; -import mineplex.core.common.util.UtilServer; -import mineplex.core.common.util.UtilTabTitle; -import mineplex.core.common.util.UtilTextMiddle; -import mineplex.core.common.util.UtilTime; -import mineplex.core.disguise.disguises.DisguisePlayer; -import mineplex.core.elo.EloPlayer; -import mineplex.core.elo.EloTeam; -import mineplex.core.itemstack.ItemBuilder; -import mineplex.core.lifetimes.Lifetimed; -import mineplex.core.lifetimes.ListenerComponent; -import mineplex.core.lifetimes.PhasedLifetime; -import mineplex.core.packethandler.IPacketHandler; -import mineplex.core.packethandler.PacketInfo; -import mineplex.core.updater.UpdateType; -import mineplex.core.updater.event.UpdateEvent; -import mineplex.core.utils.UtilGameProfile; -import mineplex.minecraft.game.classcombat.event.ClassCombatCreatureAllowSpawnEvent; -import mineplex.minecraft.game.core.combat.DeathMessageType; -import mineplex.minecraft.game.core.combat.event.CombatDeathEvent; - -import nautilus.game.arcade.ArcadeFormat; -import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.GameType; -import nautilus.game.arcade.events.GameStateChangeEvent; -import nautilus.game.arcade.events.PlayerGameRespawnEvent; -import nautilus.game.arcade.events.PlayerStateChangeEvent; -import nautilus.game.arcade.game.GameTeam.PlayerState; -import nautilus.game.arcade.game.games.build.Build; -import nautilus.game.arcade.game.games.draw.Draw; -import nautilus.game.arcade.game.games.speedbuilders.SpeedBuilders; -import nautilus.game.arcade.game.modules.AntiExpOrbModule; -import nautilus.game.arcade.game.modules.Module; -import nautilus.game.arcade.kit.ChampionsKit; -import nautilus.game.arcade.kit.Kit; -import nautilus.game.arcade.kit.KitAvailability; -import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.ProgressingKit; -import nautilus.game.arcade.managers.chat.ChatStatData; -import nautilus.game.arcade.managers.lobby.LobbyManager; -import nautilus.game.arcade.scoreboard.GameScoreboard; -import nautilus.game.arcade.stats.AssistsStatTracker; -import nautilus.game.arcade.stats.DamageDealtStatTracker; -import nautilus.game.arcade.stats.DamageTakenStatTracker; -import nautilus.game.arcade.stats.DeathsStatTracker; -import nautilus.game.arcade.stats.ExperienceStatTracker; -import nautilus.game.arcade.stats.GamesPlayedStatTracker; -import nautilus.game.arcade.stats.KillsStatTracker; -import nautilus.game.arcade.stats.LoseStatTracker; -import nautilus.game.arcade.stats.StatTracker; -import nautilus.game.arcade.stats.WinStatTracker; -import nautilus.game.arcade.wineffect.WinEffectManager; -import nautilus.game.arcade.world.WorldData; +import java.util.*; +import java.util.Map.Entry; public abstract class Game extends ListenerComponent implements Lifetimed { @@ -2467,8 +2425,8 @@ public abstract class Game extends ListenerComponent implements Lifetimed public void cleanupCommands() { - this._debugCommands.forEach(command -> CommandCenter.Instance.removeCommand(command)); - this._debugCommands.clear(); + _debugCommands.forEach(command -> CommandCenter.Instance.removeCommand(command)); + _debugCommands.clear(); } public T getModule(Class clazz) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/build/Build.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/build/Build.java index 1a0458b5d..1a9bb27c5 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/build/Build.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/build/Build.java @@ -239,7 +239,38 @@ public class Build extends Game "Clown", "Windmill", "Alligator", "Police", "Igloo", "Gift", "Bumblebee", "Jellyfish", "Speedboat", "Fall", "Summer", "Autumn", "Winter", "Disco", "Moose", - "Water Gun", "Astronaut", "Wither", "Meteor" + "Water Gun", "Astronaut", "Wither", "Meteor", + "Airplane", "Alarm clock", "Alien", "Alligator", "Ant", "Apple", "Arm", "Autumn", "Baby", "Ball", + "Balloon", "Banana", "Barn", "Base", "Baseball", "Basketball", "Bat", "Bathroom", "Battery", "Beach", + "Bear", "Beaver", "Bed", "Beehive", "Bell", "Bicycle", "Bike", "Bird", "Birthday cake", "Blocks", + "Boat", "Bone", "Book", "Boot", "Bottle", "Bowtie", "Boy", "Bracelet", "Brain", "Branch", + "Bread", "Bridge", "Bubble", "Bug", "Bunny", "Bus", "Cage", "Cake", "Camera", "Cape", + "Carrot", "Castle", "Cat", "Cave", "Chair", "Chalk", "Cheek", "Cheese", "Cheeseburger", "Cherry", + "Chess", "Chicken", "Chin", "Christmas", "Circle", "Circus", "Clock", "Cloud", "Coal", "Coat", + "Coconut", "Computer", "Cone", "Cookie", "Corn", "Cow", "Crab", "Crib", "Cup", "Cupcake", + "Desert", "Desk", "Dinosaur", "Dog", "Doll", "Dominoes", "Door", "Doormat", "Drum", "Duck", + "Ear", "Ears", "Egg", "Electricity", "Elephant", "Eraser", "Eyes", "Face", "Farm", "Fishing pole", + "Fist", "Flamingo", "Flashlight", "Flower", "Flute", "Fly", "Football", "Forest", "Fountain", "Frenchfries", + "Frog", "Garbage", "Garden", "Gate", "Ghost", "Gingerbread man", "Giraffe", "Girl", "Glasses", "Grapes", + "Grass", "Graveyard", "Hair dryer", "Halloween", "Hat", "Head", "Heart", "Hippo", "Hockey", "Hook", + "Hopscotch", "Horse", "Hospital", "House", "Hula hoop", "Ice", "Icecream", "Jacket", "Jar", "Jellyfish", + "Jungle", "Kangaroo", "Key", "Kitchen", "Kite", "Knot", "Lamp", "Lawnmower", "Leaf", "Light", + "Lightbulb", "Lighthouse", "Lightsaber", "Lips", "Lipstick", "Lobster", "Lollipop", "Mail", "Mailman", "Mattress", + "Milk", "Money", "Monkey", "Moon", "Mosquito", "Mouse", "Mouth", "Muffin", "Mushroom", "Music", + "Nail", "Newspaper", "Nightmare", "Nose", "Ocean", "Orange", "Owl", "Pajamas", "Palace", "Park", + "Party", "Peach", "Peanut", "Pen", "Pencil", "Penguin", "Person", "Photograph", "Piano", "Pie", + "Pig", "Pillow", "Pineapple", "Ping pong", "Pinwheel", "Pirate", "Pizza", "Plate", "Pool Party", "Popcorn", + "Popsicle", "Potato", "Pretzel", "Prison", "Puppet", "Purse", "Queen", "Rain", "Rainbow", "Restaurant", + "Rhinoceros", "Ring", "River", "Road", "Robot", "Rocket", "Rocking chair", "Roof", "Round", "Rug", + "Ruins", "Saddle", "Sailboat", "Salt and pepper", "Scale", "School", "Scissors", "Seahorse", "Seashell", "Seesaw", + "Shark", "Sheep", "Shirt", "Shoe", "Shopping cart", "Shovel", "Skate", "Skateboard", "Ski", "Skirt", + "Slide", "Smile", "Snail", "Snake", "Snowball", "Snowflake", "Snowman", "Soap", "Socks", "Soda", + "Song", "Spaceship", "Spider", "Spider web", "Spoon", "Spring", "Stage", "Stairs", "Star", "State", + "Statue", "Stingray", "Stoplight", "Storm", "Suitcase", "Summer", "Sun", "Sunflower", "Swimming pool", "Swing", + "Swordfish", "Tail", "Taxi", "Teapot", "Telephone", "Thief", "Toast", "Toothbrush", "Torch", "Treasure", + "Tree", "Truck", "Trumpet", "Turtle", "TV", "Vest", "Violin", "Volcano", "Washing machine", "Water", + "Waterfall", "Watering can", "Whale", "Whisk", "Whistle", "Windmill", "Winter", "Worm", "Wrench", "Yo-yo", + "Zoo", }; _christmasWords = new String[] diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castleassault/CastleAssault.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castleassault/CastleAssault.java index f4ed36446..9d651ad84 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castleassault/CastleAssault.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castleassault/CastleAssault.java @@ -131,9 +131,12 @@ public class CastleAssault extends TeamGame private ChestLoot _miscGear = new ChestLoot(); private ObjectiveTNTSpawner _tntSpawner; + private Map _teamKills = new HashMap<>(); private boolean _writeScoreboard = true; + private boolean _killsAreObjective = false; + @SuppressWarnings("deprecation") public CastleAssault(ArcadeManager manager) { @@ -186,6 +189,7 @@ public class CastleAssault extends TeamGame this.CrownsEnabled = true; this.FirstKillReward = 20; this.GemKillDeathRespawn = 1; + this.GameTimeout = -1; new CompassModule() .setGiveCompass(true) @@ -237,7 +241,7 @@ public class CastleAssault extends TeamGame _rodsAndGaps.addLoot(new ItemBuilder(Material.GOLDEN_APPLE).setTitle(C.cPurple + "Golden Applegate").build(), 3); } { - _potionGearCommon.addLoot(new ItemBuilder(Material.POTION).setData((short)16418).build(), 2); + _potionGearCommon.addLoot(new ItemBuilder(Material.POTION).setData((short)8194).build(), 2); _potionGearCommon.addLoot(new ItemBuilder(Material.POTION).setData((short)16417).build(), 2); } { @@ -634,6 +638,13 @@ public class CastleAssault extends TeamGame } _tntSpawner.update(); + if (!_killsAreObjective) + { + if (_tntSpawner.isSpawned()) + { + _killsAreObjective = true; + } + } } if (InProgress()) { @@ -862,6 +873,58 @@ public class CastleAssault extends TeamGame } AddStat(player, GetKit(player).GetName() + "KitKills", 1, false, false); + if (_killsAreObjective) + { + _teamKills.merge(GetTeam(player), 1, Integer::sum); + if (GetTeam(player).GetColor() == ChatColor.RED) + { + GameTeam enemy = GetTeam(ChatColor.AQUA); + TeamCrystal[] crystals = _crystals.get(enemy).stream().filter(TeamCrystal::isActive).toArray(size -> new TeamCrystal[size]); + if (crystals.length > 0) + { + if (_teamKills.getOrDefault(GetTeam(player), 0) % 20 == 0) + { + crystals[UtilMath.r(crystals.length)].destroy(); + if (crystals.length > 1) + { + Bukkit.broadcastMessage(F.main("Game", "One of " + F.elem(enemy.GetFormattedName() + "'s Crystals") + " has been destroyed!")); + } + else + { + Bukkit.broadcastMessage(F.main("Game", "All of " + F.elem(enemy.GetFormattedName() + "'s Crystals") + " have been destroyed and " + F.elem(_kings.get(enemy).getName(false)) + " is now vulnerable!")); + } + } + } + else + { + _kings.get(enemy).handleDamage(player.getName(), 10, true); + } + } + else + { + GameTeam enemy = GetTeam(ChatColor.RED); + TeamCrystal[] crystals = _crystals.get(enemy).stream().filter(TeamCrystal::isActive).toArray(size -> new TeamCrystal[size]); + if (crystals.length > 0) + { + if (_teamKills.getOrDefault(GetTeam(player), 0) % 20 == 0) + { + crystals[UtilMath.r(crystals.length)].destroy(); + if (crystals.length > 1) + { + Bukkit.broadcastMessage(F.main("Game", "One of " + F.elem(enemy.GetFormattedName() + "'s Crystals") + " has been destroyed!")); + } + else + { + Bukkit.broadcastMessage(F.main("Game", "All of " + F.elem(enemy.GetFormattedName() + "'s Crystals") + " have been destroyed and " + F.elem(_kings.get(enemy).getName(false)) + " is now vulnerable!")); + } + } + } + else + { + _kings.get(enemy).handleDamage(player.getName(), 10, true); + } + } + } if (UtilPlayer.isSpectator(player)) { @@ -970,7 +1033,7 @@ public class CastleAssault extends TeamGame } else { - Bukkit.broadcastMessage(F.main("Game", "All of " + F.elem(crystal.getOwner().GetFormattedName() + "'s Crystals") + " has been destroyed and " + F.elem(_kings.get(crystal.getOwner()).getName(false)) + " is now vulnerable!")); + Bukkit.broadcastMessage(F.main("Game", "All of " + F.elem(crystal.getOwner().GetFormattedName() + "'s Crystals") + " have been destroyed and " + F.elem(_kings.get(crystal.getOwner()).getName(false)) + " is now vulnerable!")); } } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castleassault/CastleAssaultTDM.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castleassault/CastleAssaultTDM.java index e83f12804..959288efe 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castleassault/CastleAssaultTDM.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castleassault/CastleAssaultTDM.java @@ -4,6 +4,7 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Map.Entry; import java.util.WeakHashMap; import org.bukkit.Bukkit; @@ -48,6 +49,7 @@ import org.bukkit.material.MaterialData; import org.bukkit.metadata.MetadataValue; import mineplex.core.Managers; +import mineplex.core.common.Pair; import mineplex.core.common.util.C; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilAction; @@ -60,7 +62,9 @@ import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilTime; import mineplex.core.itemstack.ItemBuilder; +import mineplex.core.leaderboard.Leaderboard; import mineplex.core.leaderboard.LeaderboardManager; +import mineplex.core.leaderboard.LeaderboardRepository.LeaderboardSQLType; import mineplex.core.loot.ChestLoot; import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; @@ -83,12 +87,14 @@ import nautilus.game.arcade.game.games.castleassault.kits.KitPlayer; import nautilus.game.arcade.game.games.castleassault.kits.KitTank; import nautilus.game.arcade.game.modules.compass.CompassModule; import nautilus.game.arcade.kit.Kit; +import nautilus.game.arcade.managers.lobby.current.NewGameLobbyManager; public class CastleAssaultTDM extends TeamGame { private static final int MAX_FLINT_AND_STEEL_USES = 4; private static final int ITEMS_PER_CHEST = 5; private static final long TIME_TILL_REFILL = 2 * 60 * 1000; + private static final int KILLS_TO_WIN = 50; private long _lastRefill; @@ -122,7 +128,22 @@ public class CastleAssaultTDM extends TeamGame //new KitNinja(manager), new KitTank(manager) }, - new String[] {"AlexTheCoder is awesome!"}); + new String[] + { + "Work with your team", + "To slay the enemy.", + "First team to 50 kills", + "Wins the game and glory!" + } + ); + + _help = new String[] + { + "Purchase kit upgrades by earning and spending crowns from games", + "Each kit has special starter items, be sure to use them to your advantage in fights", + "Go on Kill Streaks to earn Kill Streak Rewards to obtain better armor & weapons!", + "Chests refill every 2 minutes with potions, golden applegates, fishing rods, and other useful PvP items!" + }; this.StrictAntiHack = true; this.HungerSet = 20; @@ -143,6 +164,7 @@ public class CastleAssaultTDM extends TeamGame this.CrownsEnabled = true; this.FirstKillReward = 20; this.GemKillDeathRespawn = 1; + this.GameTimeout = -1; new CompassModule() .setGiveCompass(true) @@ -153,33 +175,33 @@ public class CastleAssaultTDM extends TeamGame _flintAndSteel = new ItemBuilder(Material.FLINT_AND_STEEL).setData((short) (Material.FLINT_AND_STEEL.getMaxDurability() - MAX_FLINT_AND_STEEL_USES)); generateLoot(); -// if (manager.IsRewardStats()) -// { -// if (manager.GetLobby() instanceof NewGameLobbyManager) -// { -// Map> lobbyCustomLocs = ((NewGameLobbyManager)manager.GetLobby()).getCustomLocs(); -// if (lobbyCustomLocs.containsKey("TOP_DAILY_WINS")) -// { -// Location loc = lobbyCustomLocs.get("TOP_DAILY_WINS").get(0); -// Managers.get(LeaderboardManager.class).registerLeaderboard("TOP_CASTLEASSAULT_DAILY_WINS", new Leaderboard("Top Daily Wins", Pair.create("Win", "Wins"), new String[] {"Castle Assault TDM.Wins"}, LeaderboardSQLType.DAILY_SEASON, loc, 10)); -// } -// if (lobbyCustomLocs.containsKey("TOP_DAILY_KILLS")) -// { -// Location loc = lobbyCustomLocs.get("TOP_DAILY_KILLS").get(0); -// Managers.get(LeaderboardManager.class).registerLeaderboard("TOP_CASTLEASSAULT_DAILY_KILLS", new Leaderboard("Top Daily Kills", Pair.create("Kill", "Kills"), new String[] {"Castle Assault TDM.Kills"}, LeaderboardSQLType.DAILY_SEASON, loc, 10)); -// } -// if (lobbyCustomLocs.containsKey("TOP_WINS")) -// { -// Location loc = lobbyCustomLocs.get("TOP_WINS").get(0); -// Managers.get(LeaderboardManager.class).registerLeaderboard("TOP_CASTLEASSAULT_WINS", new Leaderboard("Top Wins", Pair.create("Win", "Wins"), new String[] {"Castle Assault TDM.Wins"}, LeaderboardSQLType.ALL_SEASON, loc, 10)); -// } -// if (lobbyCustomLocs.containsKey("TOP_KILLS")) -// { -// Location loc = lobbyCustomLocs.get("TOP_KILLS").get(0); -// Managers.get(LeaderboardManager.class).registerLeaderboard("TOP_CASTLEASSAULT_KILLS", new Leaderboard("Top Kills", Pair.create("Kill", "Kills"), new String[] {"Castle Assault TDM.Kills"}, LeaderboardSQLType.ALL_SEASON, loc, 10)); -// } -// } -// } + if (manager.IsRewardStats()) + { + if (manager.GetLobby() instanceof NewGameLobbyManager) + { + Map> lobbyCustomLocs = ((NewGameLobbyManager)manager.GetLobby()).getCustomLocs(); + if (lobbyCustomLocs.containsKey("TOP_DAILY_WINS")) + { + Location loc = lobbyCustomLocs.get("TOP_DAILY_WINS").get(0); + Managers.get(LeaderboardManager.class).registerLeaderboard("TOP_CASTLEASSAULTTDM_DAILY_WINS", new Leaderboard("Top Daily Wins", Pair.create("Win", "Wins"), new String[] {"Castle Assault TDM.Wins"}, LeaderboardSQLType.DAILY, loc, 10)); + } + if (lobbyCustomLocs.containsKey("TOP_DAILY_KILLS")) + { + Location loc = lobbyCustomLocs.get("TOP_DAILY_KILLS").get(0); + Managers.get(LeaderboardManager.class).registerLeaderboard("TOP_CASTLEASSAULTTDM_DAILY_KILLS", new Leaderboard("Top Daily Kills", Pair.create("Kill", "Kills"), new String[] {"Castle Assault TDM.Kills"}, LeaderboardSQLType.DAILY, loc, 10)); + } + if (lobbyCustomLocs.containsKey("TOP_WINS")) + { + Location loc = lobbyCustomLocs.get("TOP_WINS").get(0); + Managers.get(LeaderboardManager.class).registerLeaderboard("TOP_CASTLEASSAULTTDM_WINS", new Leaderboard("Top Wins", Pair.create("Win", "Wins"), new String[] {"Castle Assault TDM.Wins"}, LeaderboardSQLType.ALL_SEASON, loc, 10)); + } + if (lobbyCustomLocs.containsKey("TOP_KILLS")) + { + Location loc = lobbyCustomLocs.get("TOP_KILLS").get(0); + Managers.get(LeaderboardManager.class).registerLeaderboard("TOP_CASTLEASSAULTTDM_KILLS", new Leaderboard("Top Kills", Pair.create("Kill", "Kills"), new String[] {"Castle Assault TDM.Kills"}, LeaderboardSQLType.ALL_SEASON, loc, 10)); + } + } + } } private void generateLoot() @@ -193,7 +215,7 @@ public class CastleAssaultTDM extends TeamGame _rodsAndGaps.addLoot(new ItemBuilder(Material.GOLDEN_APPLE).setTitle(C.cPurple + "Golden Applegate").build(), 3); } { - _potionGearCommon.addLoot(new ItemBuilder(Material.POTION).setData((short)16418).build(), 2); + _potionGearCommon.addLoot(new ItemBuilder(Material.POTION).setData((short)8194).build(), 2); _potionGearCommon.addLoot(new ItemBuilder(Material.POTION).setData((short)16417).build(), 2); } { @@ -274,10 +296,10 @@ public class CastleAssaultTDM extends TeamGame GameTeam red = GetTeam(ChatColor.RED); GameTeam blue = GetTeam(ChatColor.AQUA); Scoreboard.write(red.GetFormattedName() + " Team Kills"); - Scoreboard.write(_teamKills.get(red) + "/50"); + Scoreboard.write(_teamKills.get(red) + "/" + KILLS_TO_WIN); Scoreboard.writeNewLine(); Scoreboard.write(blue.GetFormattedName() + " Team Kills"); - Scoreboard.write(_teamKills.get(blue) + "/50"); + Scoreboard.write(_teamKills.get(blue) + "/" + KILLS_TO_WIN); Scoreboard.draw(); } @@ -363,12 +385,16 @@ public class CastleAssaultTDM extends TeamGame AddGems(player, 10, "Participation", false, false); } + int crowns = 0; + for (Entry data : GetGems(player).entrySet()) { - int crowns = 0; - for (GemData data : GetGems(player).values()) + if (data.getKey().equals("Kills")) { - crowns += data.Gems; + crowns += data.getValue().Gems; } + } + + { int streak = _streakData.getOrDefault(player, new KillStreakData()).getBestStreak(); if (streak >= 2 && streak < 4) { @@ -376,7 +402,7 @@ public class CastleAssaultTDM extends TeamGame } else if (streak >= 4 && streak < 6) { - AddGems(player, crowns, streak + " Player Kill Streak", false, false); + AddGems(player, 1 * crowns, streak + " Player Kill Streak", false, false); } else if (streak >= 6 && streak < 8) { @@ -387,22 +413,6 @@ public class CastleAssaultTDM extends TeamGame AddGems(player, 2 * crowns, streak + " Player Kill Streak", false, false); } } - - if (GetKit(player) != null) - { - KitPlayer kit = (KitPlayer) GetKit(player); - int kitLevel = kit.getUpgradeLevel(player.getUniqueId()); - if (kitLevel > 0) - { - int crowns = 0; - for (GemData data : GetGems(player).values()) - { - crowns += data.Gems; - } - - AddGems(player, (0.5 * kitLevel) * crowns, kit.GetName() + " Kit Level Bonus", false, false); - } - } } } SetState(GameState.End); @@ -433,7 +443,7 @@ public class CastleAssaultTDM extends TeamGame GameTeam red = GetTeam(ChatColor.RED); GameTeam blue = GetTeam(ChatColor.AQUA); - if (_teamKills.get(blue).intValue() >= 50) + if (_teamKills.get(blue).intValue() >= KILLS_TO_WIN) { AnnounceEnd(blue); writeFinalScoreboard(blue.GetColor() + blue.GetName(), _teamKills.get(blue)); @@ -454,12 +464,16 @@ public class CastleAssaultTDM extends TeamGame AddGems(player, 10, "Participation", false, false); } + int crowns = 0; + for (Entry data : GetGems(player).entrySet()) { - int crowns = 0; - for (GemData data : GetGems(player).values()) + if (data.getKey().equals("Kills")) { - crowns += data.Gems; + crowns += data.getValue().Gems; } + } + + { int streak = _streakData.getOrDefault(player, new KillStreakData()).getBestStreak(); if (streak >= 2 && streak < 4) { @@ -467,7 +481,7 @@ public class CastleAssaultTDM extends TeamGame } else if (streak >= 4 && streak < 6) { - AddGems(player, crowns, streak + " Player Kill Streak", false, false); + AddGems(player, 1 * crowns, streak + " Player Kill Streak", false, false); } else if (streak >= 6 && streak < 8) { @@ -478,25 +492,12 @@ public class CastleAssaultTDM extends TeamGame AddGems(player, 2 * crowns, streak + " Player Kill Streak", false, false); } } - - KitPlayer kit = (KitPlayer) GetKit(player); - int kitLevel = kit.getUpgradeLevel(player.getUniqueId()); - if (kitLevel > 0) - { - int crowns = 0; - for (GemData data : GetGems(player).values()) - { - crowns += data.Gems; - } - - AddGems(player, (0.5 * kitLevel) * crowns, kit.GetName() + " Kit Level Bonus", false, false); - } } } SetState(GameState.End); return; } - if (_teamKills.get(red).intValue() >= 50) + if (_teamKills.get(red).intValue() >= KILLS_TO_WIN) { AnnounceEnd(red); writeFinalScoreboard(red.GetColor() + red.GetName(), _teamKills.get(red)); @@ -517,12 +518,16 @@ public class CastleAssaultTDM extends TeamGame AddGems(player, 10, "Participation", false, false); } + int crowns = 0; + for (Entry data : GetGems(player).entrySet()) { - int crowns = 0; - for (GemData data : GetGems(player).values()) + if (data.getKey().equals("Kills")) { - crowns += data.Gems; + crowns += data.getValue().Gems; } + } + + { int streak = _streakData.getOrDefault(player, new KillStreakData()).getBestStreak(); if (streak >= 2 && streak < 4) { @@ -530,7 +535,7 @@ public class CastleAssaultTDM extends TeamGame } else if (streak >= 4 && streak < 6) { - AddGems(player, crowns, streak + " Player Kill Streak", false, false); + AddGems(player, 1 * crowns, streak + " Player Kill Streak", false, false); } else if (streak >= 6 && streak < 8) { @@ -541,19 +546,6 @@ public class CastleAssaultTDM extends TeamGame AddGems(player, 2 * crowns, streak + " Player Kill Streak", false, false); } } - - KitPlayer kit = (KitPlayer) GetKit(player); - int kitLevel = kit.getUpgradeLevel(player.getUniqueId()); - if (kitLevel > 0) - { - int crowns = 0; - for (GemData data : GetGems(player).values()) - { - crowns += data.Gems; - } - - AddGems(player, (0.5 * kitLevel) * crowns, kit.GetName() + " Kit Level Bonus", false, false); - } } } SetState(GameState.End); @@ -587,10 +579,10 @@ public class CastleAssaultTDM extends TeamGame Manager.GetDamage().SetEnabled(true); Manager.GetExplosion().setEnabled(true); Manager.GetCreature().SetDisableCustomDrops(false); - Managers.get(LeaderboardManager.class).unregisterLeaderboard("TOP_CASTLEASSAULT_DAILY_WINS"); - Managers.get(LeaderboardManager.class).unregisterLeaderboard("TOP_CASTLEASSAULT_DAILY_KILLS"); - Managers.get(LeaderboardManager.class).unregisterLeaderboard("TOP_CASTLEASSAULT_WINS"); - Managers.get(LeaderboardManager.class).unregisterLeaderboard("TOP_CASTLEASSAULT_KILLS"); + Managers.get(LeaderboardManager.class).unregisterLeaderboard("TOP_CASTLEASSAULTTDM_DAILY_WINS"); + Managers.get(LeaderboardManager.class).unregisterLeaderboard("TOP_CASTLEASSAULTTDM_DAILY_KILLS"); + Managers.get(LeaderboardManager.class).unregisterLeaderboard("TOP_CASTLEASSAULTTDM_WINS"); + Managers.get(LeaderboardManager.class).unregisterLeaderboard("TOP_CASTLEASSAULTTDM_KILLS"); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castleassault/data/TeamKing.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castleassault/data/TeamKing.java index af9fad64a..c12c1dd5b 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castleassault/data/TeamKing.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castleassault/data/TeamKing.java @@ -104,10 +104,16 @@ public class TeamKing public boolean handleDamage(String player, double damage) { - if (!UtilTime.elapsed(_lastDamage, 400)) + return handleDamage(player, damage, false); + } + + public boolean handleDamage(String player, double damage, boolean force) + { + if (!UtilTime.elapsed(_lastDamage, 400) && !force) { return false; } + _lastDamager = player; _lastDamage = System.currentTimeMillis(); @@ -119,4 +125,4 @@ public class TeamKing return true; } -} \ No newline at end of file +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castleassault/kits/KitFighter.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castleassault/kits/KitFighter.java index d5b49974d..986bfb915 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castleassault/kits/KitFighter.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castleassault/kits/KitFighter.java @@ -65,36 +65,36 @@ public class KitFighter extends KitPlayer if (level == 0) { player.getInventory().setItem(0, new ItemBuilder(Material.DIAMOND_SWORD).setLore(C.cGold + "Kit Item").setUnbreakable(true).build()); - player.getInventory().setItem(1, new ItemBuilder(Material.GOLDEN_APPLE).setAmount(1).setTitle(C.cPurple + "Golden Applegate").setLore(C.cGold + "Kit Item").build()); + player.getInventory().setItem(1, new ItemBuilder(Material.GOLDEN_APPLE).setAmount(1).setTitle(C.cPurple + "Golden Applegate").build()); } else if (level == 1) { player.getInventory().setItem(0, new ItemBuilder(Material.DIAMOND_SWORD).setLore(C.cGold + "Kit Item").setUnbreakable(true).build()); - player.getInventory().setItem(1, new ItemBuilder(Material.GOLDEN_APPLE).setAmount(2).setTitle(C.cPurple + "Golden Applegate").setLore(C.cGold + "Kit Item").build()); + player.getInventory().setItem(1, new ItemBuilder(Material.GOLDEN_APPLE).setAmount(2).setTitle(C.cPurple + "Golden Applegate").build()); } else if (level == 2) { player.getInventory().setItem(0, new ItemBuilder(Material.DIAMOND_SWORD).setLore(C.cGold + "Kit Item").setUnbreakable(true).build()); player.getInventory().setItem(1, new ItemBuilder(Material.FISHING_ROD).setLore(C.cGold + "Kit Item").setUnbreakable(true).build()); - player.getInventory().setItem(2, new ItemBuilder(Material.GOLDEN_APPLE).setAmount(2).setTitle(C.cPurple + "Golden Applegate").setLore(C.cGold + "Kit Item").build()); + player.getInventory().setItem(2, new ItemBuilder(Material.GOLDEN_APPLE).setAmount(2).setTitle(C.cPurple + "Golden Applegate").build()); } else if (level == 3) { player.getInventory().setItem(0, new ItemBuilder(Material.DIAMOND_SWORD).addEnchantment(Enchantment.DAMAGE_ALL, 1).setLore(C.cGold + "Kit Item").setUnbreakable(true).build()); player.getInventory().setItem(1, new ItemBuilder(Material.FISHING_ROD).setLore(C.cGold + "Kit Item").setUnbreakable(true).build()); - player.getInventory().setItem(2, new ItemBuilder(Material.GOLDEN_APPLE).setAmount(2).setTitle(C.cPurple + "Golden Applegate").setLore(C.cGold + "Kit Item").build()); + player.getInventory().setItem(2, new ItemBuilder(Material.GOLDEN_APPLE).setAmount(2).setTitle(C.cPurple + "Golden Applegate").build()); } else if (level == 4) { player.getInventory().setItem(0, new ItemBuilder(Material.DIAMOND_SWORD).addEnchantment(Enchantment.DAMAGE_ALL, 1).setLore(C.cGold + "Kit Item").setUnbreakable(true).build()); player.getInventory().setItem(1, new ItemBuilder(Material.FISHING_ROD).addEnchantment(Enchantment.KNOCKBACK, 2).setLore(C.cGold + "Kit Item").setUnbreakable(true).build()); - player.getInventory().setItem(2, new ItemBuilder(Material.GOLDEN_APPLE).setAmount(3).setTitle(C.cPurple + "Golden Applegate").setLore(C.cGold + "Kit Item").build()); + player.getInventory().setItem(2, new ItemBuilder(Material.GOLDEN_APPLE).setAmount(3).setTitle(C.cPurple + "Golden Applegate").build()); } else if (level == 5) { player.getInventory().setItem(0, new ItemBuilder(Material.DIAMOND_SWORD).addEnchantment(Enchantment.DAMAGE_ALL, 2).setLore(C.cGold + "Kit Item").setUnbreakable(true).build()); player.getInventory().setItem(1, new ItemBuilder(Material.FISHING_ROD).addEnchantment(Enchantment.KNOCKBACK, 2).setLore(C.cGold + "Kit Item").setUnbreakable(true).build()); - player.getInventory().setItem(2, new ItemBuilder(Material.GOLDEN_APPLE).setAmount(3).setTitle(C.cPurple + "Golden Applegate").setLore(C.cGold + "Kit Item").build()); + player.getInventory().setItem(2, new ItemBuilder(Material.GOLDEN_APPLE).setAmount(3).setTitle(C.cPurple + "Golden Applegate").build()); } player.getInventory().setHelmet(new ItemBuilder(Material.DIAMOND_HELMET).setLore(C.cGold + "Kit Item").setUnbreakable(true).build()); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castleassault/kits/KitPlayer.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castleassault/kits/KitPlayer.java index 1b90a1793..ac445dd49 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castleassault/kits/KitPlayer.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castleassault/kits/KitPlayer.java @@ -39,7 +39,7 @@ public abstract class KitPlayer extends ProgressingKit protected void giveRegeneration(Player player) { - player.addPotionEffect(new PotionEffect(PotionEffectType.REGENERATION, 20 * 3, 3)); + player.addPotionEffect(new PotionEffect(PotionEffectType.REGENERATION, 20 * 5, 3)); } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/draw/Draw.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/draw/Draw.java index 457fcb5ce..b2f2ba4e7 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/draw/Draw.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/draw/Draw.java @@ -188,7 +188,38 @@ public class Draw extends SoloGame "Piano", "Guitar", "Trumpet", "Drums", "Flute", "Helicopter", "Plane", "Football", "Tennis", "Hockey", "Water", "Ocean", "Microsoft", "Twitter", "Godzilla", "Building", "House", "Rainbow", "Barbie", "Girl", "Boy", "Children", "Bomb", "Explosion", "Gun", "Tank", "Penguin", "Eagle", "America", "Kangaroo", "Sea", "Raspberry", - "Strawberry", "Jam", "Sandwich", "Owl", "Watermelon", "Australia", "Canada", "United States", "Diary" + "Strawberry", "Jam", "Sandwich", "Owl", "Watermelon", "Australia", "Canada", "United States", "Diary", + "Airplane", "Alarm clock", "Alien", "Alligator", "Ant", "Apple", "Arm", "Autumn", "Baby", "Ball", + "Balloon", "Banana", "Barn", "Base", "Baseball", "Basketball", "Bat", "Bathroom", "Battery", "Beach", + "Bear", "Beaver", "Bed", "Beehive", "Bell", "Bicycle", "Bike", "Bird", "Birthday cake", "Blocks", + "Boat", "Bone", "Book", "Boot", "Bottle", "Bowtie", "Boy", "Bracelet", "Brain", "Branch", + "Bread", "Bridge", "Bubble", "Bug", "Bunny", "Bus", "Cage", "Cake", "Camera", "Cape", + "Carrot", "Castle", "Cat", "Cave", "Chair", "Chalk", "Cheek", "Cheese", "Cheeseburger", "Cherry", + "Chess", "Chicken", "Chin", "Christmas", "Circle", "Circus", "Clock", "Cloud", "Coal", "Coat", + "Coconut", "Computer", "Cone", "Cookie", "Corn", "Cow", "Crab", "Crib", "Cup", "Cupcake", + "Desert", "Desk", "Dinosaur", "Dog", "Doll", "Dominoes", "Door", "Doormat", "Drum", "Duck", + "Ear", "Ears", "Egg", "Electricity", "Elephant", "Eraser", "Eyes", "Face", "Farm", "Fishing pole", + "Fist", "Flamingo", "Flashlight", "Flower", "Flute", "Fly", "Football", "Forest", "Fountain", "Frenchfries", + "Frog", "Garbage", "Garden", "Gate", "Ghost", "Gingerbread man", "Giraffe", "Girl", "Glasses", "Grapes", + "Grass", "Graveyard", "Hair dryer", "Halloween", "Hat", "Head", "Heart", "Hippo", "Hockey", "Hook", + "Hopscotch", "Horse", "Hospital", "House", "Hula hoop", "Ice", "Icecream", "Jacket", "Jar", "Jellyfish", + "Jungle", "Kangaroo", "Key", "Kitchen", "Kite", "Knot", "Lamp", "Lawnmower", "Leaf", "Light", + "Lightbulb", "Lighthouse", "Lightsaber", "Lips", "Lipstick", "Lobster", "Lollipop", "Mail", "Mailman", "Mattress", + "Milk", "Money", "Monkey", "Moon", "Mosquito", "Mouse", "Mouth", "Muffin", "Mushroom", "Music", + "Nail", "Newspaper", "Nightmare", "Nose", "Ocean", "Orange", "Owl", "Pajamas", "Palace", "Park", + "Party", "Peach", "Peanut", "Pen", "Pencil", "Penguin", "Person", "Photograph", "Piano", "Pie", + "Pig", "Pillow", "Pineapple", "Ping pong", "Pinwheel", "Pirate", "Pizza", "Plate", "Pool Party", "Popcorn", + "Popsicle", "Potato", "Pretzel", "Prison", "Puppet", "Purse", "Queen", "Rain", "Rainbow", "Restaurant", + "Rhinoceros", "Ring", "River", "Road", "Robot", "Rocket", "Rocking chair", "Roof", "Round", "Rug", + "Ruins", "Saddle", "Sailboat", "Salt and pepper", "Scale", "School", "Scissors", "Seahorse", "Seashell", "Seesaw", + "Shark", "Sheep", "Shirt", "Shoe", "Shopping cart", "Shovel", "Skate", "Skateboard", "Ski", "Skirt", + "Slide", "Smile", "Snail", "Snake", "Snowball", "Snowflake", "Snowman", "Soap", "Socks", "Soda", + "Song", "Spaceship", "Spider", "Spider web", "Spoon", "Spring", "Stage", "Stairs", "Star", "State", + "Statue", "Stingray", "Stoplight", "Storm", "Suitcase", "Summer", "Sun", "Sunflower", "Swimming pool", "Swing", + "Swordfish", "Tail", "Taxi", "Teapot", "Telephone", "Thief", "Toast", "Toothbrush", "Torch", "Treasure", + "Tree", "Truck", "Trumpet", "Turtle", "TV", "Vest", "Violin", "Volcano", "Washing machine", "Water", + "Waterfall", "Watering can", "Whale", "Whisk", "Whistle", "Windmill", "Winter", "Worm", "Wrench", "Yo-yo", + "Zoo" }; _christmasWords = new String[] diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/SuperSmash.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/SuperSmash.java index 6dd3ab954..ecf16a805 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/SuperSmash.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/SuperSmash.java @@ -1,16 +1,36 @@ package nautilus.game.arcade.game.games.smash; -import java.util.HashMap; -import java.util.Map; -import java.util.Set; -import java.util.concurrent.TimeUnit; - -import org.bukkit.ChatColor; -import org.bukkit.Color; +import com.google.common.collect.Sets; +import mineplex.core.blockrestore.BlockRestore; +import mineplex.core.common.Rank; +import mineplex.core.common.util.*; +import mineplex.core.disguise.disguises.DisguiseBase; +import mineplex.core.gadget.types.Gadget; +import mineplex.core.gadget.types.GadgetType; +import mineplex.core.hologram.Hologram; +import mineplex.core.itemstack.ItemStackFactory; +import mineplex.core.mount.Mount; +import mineplex.core.recharge.Recharge; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.ArcadeFormat; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.GameType; +import nautilus.game.arcade.events.GameStateChangeEvent; +import nautilus.game.arcade.game.DebugCommand; +import nautilus.game.arcade.game.Game; +import nautilus.game.arcade.game.GameTeam; +import nautilus.game.arcade.game.GameTeam.PlayerState; +import nautilus.game.arcade.game.games.smash.events.SmashActivateEvent; +import nautilus.game.arcade.game.games.smash.kits.*; +import nautilus.game.arcade.game.games.smash.perks.SmashUltimate; +import nautilus.game.arcade.game.modules.compass.CompassModule; +import nautilus.game.arcade.kit.Kit; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.managers.PerkSpreadsheetModule; +import org.bukkit.*; import org.bukkit.FireworkEffect.Type; -import org.bukkit.Location; -import org.bukkit.Material; -import org.bukkit.Sound; import org.bukkit.block.Block; import org.bukkit.entity.EnderCrystal; import org.bukkit.entity.LivingEntity; @@ -18,70 +38,18 @@ import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.block.BlockFadeEvent; -import org.bukkit.event.entity.EntityDamageEvent; +import org.bukkit.event.entity.*; import org.bukkit.event.entity.EntityDamageEvent.DamageCause; -import org.bukkit.event.entity.EntityDeathEvent; -import org.bukkit.event.entity.EntityRegainHealthEvent; import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason; -import org.bukkit.event.entity.ItemSpawnEvent; -import org.bukkit.event.entity.PlayerDeathEvent; -import org.bukkit.event.player.PlayerCommandPreprocessEvent; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.inventory.ItemStack; -import org.bukkit.inventory.meta.ItemMeta; import org.bukkit.scheduler.BukkitRunnable; -import com.google.common.collect.Sets; - -import mineplex.core.blockrestore.BlockRestore; -import mineplex.core.common.util.C; -import mineplex.core.common.util.F; -import mineplex.core.common.util.UtilAlg; -import mineplex.core.common.util.UtilFirework; -import mineplex.core.common.util.UtilInv; -import mineplex.core.common.util.UtilMath; -import mineplex.core.common.util.UtilPlayer; -import mineplex.core.common.util.UtilServer; -import mineplex.core.common.util.UtilTextMiddle; -import mineplex.core.hologram.Hologram; -import mineplex.core.itemstack.ItemStackFactory; -import mineplex.core.recharge.Recharge; -import mineplex.core.updater.UpdateType; -import mineplex.core.updater.event.UpdateEvent; -import mineplex.minecraft.game.core.damage.CustomDamageEvent; - -import nautilus.game.arcade.ArcadeFormat; -import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.GameType; -import nautilus.game.arcade.events.GameStateChangeEvent; -import nautilus.game.arcade.game.Game; -import nautilus.game.arcade.game.GameTeam; -import nautilus.game.arcade.game.GameTeam.PlayerState; -import nautilus.game.arcade.game.games.smash.kits.KitBlaze; -import nautilus.game.arcade.game.games.smash.kits.KitChicken; -import nautilus.game.arcade.game.games.smash.kits.KitCow; -import nautilus.game.arcade.game.games.smash.kits.KitCreeper; -import nautilus.game.arcade.game.games.smash.kits.KitEnderman; -import nautilus.game.arcade.game.games.smash.kits.KitGolem; -import nautilus.game.arcade.game.games.smash.kits.KitGuardian; -import nautilus.game.arcade.game.games.smash.kits.KitMagmaCube; -import nautilus.game.arcade.game.games.smash.kits.KitPig; -import nautilus.game.arcade.game.games.smash.kits.KitSheep; -import nautilus.game.arcade.game.games.smash.kits.KitSkeletalHorse; -import nautilus.game.arcade.game.games.smash.kits.KitSkeleton; -import nautilus.game.arcade.game.games.smash.kits.KitSkySquid; -import nautilus.game.arcade.game.games.smash.kits.KitSlime; -import nautilus.game.arcade.game.games.smash.kits.KitSnowman; -import nautilus.game.arcade.game.games.smash.kits.KitSpider; -import nautilus.game.arcade.game.games.smash.kits.KitWitch; -import nautilus.game.arcade.game.games.smash.kits.KitWitherSkeleton; -import nautilus.game.arcade.game.games.smash.kits.KitWolf; -import nautilus.game.arcade.game.games.smash.kits.KitZombie; -import nautilus.game.arcade.game.games.smash.perks.SmashUltimate; -import nautilus.game.arcade.game.modules.compass.CompassModule; -import nautilus.game.arcade.kit.Kit; -import nautilus.game.arcade.kit.Perk; +import java.util.HashMap; +import java.util.Map; +import java.util.Set; +import java.util.concurrent.TimeUnit; public abstract class SuperSmash extends Game { @@ -125,9 +93,89 @@ public abstract class SuperSmash extends Game WorldWaterDamage = 1000; HideTeamSheep = true; ReplaceTeamsWithKits = true; + + manager.GetExplosion().SetRegenerate(true); + manager.GetExplosion().setRegenerateTime(TimeUnit.SECONDS.toMillis(30)); + new CompassModule() .setGiveCompassToAlive(true) .register(this); + + new PerkSpreadsheetModule(this, "SMASH_KITS"); + + registerDebugCommand(new DebugCommand("cooldown", Rank.ADMIN) + { + @Override + public void Execute(Player caller, String[] args) + { + for (Player other : UtilServer.getPlayers()) + { + Recharge.Instance.Reset(other); + } + + Announce(C.cWhiteB + caller.getName() + C.cAquaB + " reset cooldowns!"); + } + }); + registerDebugCommand(new DebugCommand("nextsmash", Rank.ADMIN) + { + @Override + public void Execute(Player caller, String[] args) + { + _nextPowerup = System.currentTimeMillis() + 1000; + Announce(C.cWhiteB + caller.getName() + C.cAquaB + " spawned a smash crystal!"); + } + }); + registerDebugCommand(new DebugCommand("smash", Rank.ADMIN) + { + @Override + public void Execute(Player caller, String[] args) + { + giveSmashItem(caller); + } + }); + registerDebugCommand(new DebugCommand("kit", Rank.ADMIN) + { + @Override + public void Execute(Player caller, String[] args) + { + String kit = ""; + + for (int i = 0; i < args.length; i++) + { + kit += args[i] + " "; + } + + kit = kit.trim(); + + for (Kit kits : GetKits()) + { + if (kit.equalsIgnoreCase(kits.GetName())) + { + SetKit(caller, kits, true); + return; + } + } + + caller.sendMessage(F.main("Kit", "Sorry that is not a kit!")); + } + }); + registerDebugCommand(new DebugCommand("lives", Rank.ADMIN) + { + @Override + public void Execute(Player caller, String[] args) + { + Announce(C.cWhiteB + caller.getName() + C.cAquaB + " reset their lives!"); + + if (!IsAlive(caller)) + { + SetPlayerState(caller, PlayerState.IN); + RespawnPlayer(caller); + caller.sendMessage(F.main("Revive", "You are back in the game!")); + } + + _lives.put(caller, MAX_LIVES); + } + }); } @EventHandler(priority = EventPriority.HIGH) @@ -153,18 +201,6 @@ public abstract class SuperSmash extends Game { SetPlayerState(event.getEntity(), PlayerState.OUT); } - - // I think this causes players to sometimes be invisible - // DisguiseManager disguiseManager = Manager.GetDisguise(); - // DisguiseBase disguise = - // disguiseManager.getActiveDisguise(event.getEntity()); - // - // if (disguise == null) - // { - // return; - // } - // - // disguiseManager.undisguise(disguise); } @EventHandler @@ -227,12 +263,12 @@ public abstract class SuperSmash extends Game @EventHandler public void triggerSuper(PlayerInteractEvent event) { - if (!IsLive()) + if (!IsLive() || !UtilEvent.isAction(event, UtilEvent.ActionType.R)) { return; } - if (event.getMaterial() != Material.NETHER_STAR) + if (event.getMaterial() != null && event.getMaterial() != Material.NETHER_STAR) { return; } @@ -251,6 +287,15 @@ public abstract class SuperSmash extends Game continue; } + SmashActivateEvent smashActivateEvent = new SmashActivateEvent(player); + + UtilServer.CallEvent(smashActivateEvent); + + if (smashActivateEvent.isCancelled()) + { + return; + } + UtilInv.remove(player, Material.NETHER_STAR, (byte) 0, 1); player.setHealth(player.getMaxHealth()); @@ -507,6 +552,13 @@ public abstract class SuperSmash extends Game } } + // Deactivate morph if active + Gadget gadget = Manager.getCosmeticManager().getGadgetManager().getActive(player, GadgetType.MORPH); + if (gadget != null) + { + gadget.disable(player); + } + _playerKit.put(player, kit); if (announce) @@ -522,37 +574,15 @@ public abstract class SuperSmash extends Game @EventHandler(priority = EventPriority.LOWEST) public void abilityDescription(PlayerInteractEvent event) { - if (event.isCancelled()) - { - return; - } - Player player = event.getPlayer(); ItemStack itemStack = player.getItemInHand(); - if (itemStack == null) + if (itemStack == null || itemStack.getItemMeta() == null || itemStack.getItemMeta().getDisplayName() == null || itemStack.getItemMeta().getLore() == null || !displayKitInfo(player)) { return; } - if (itemStack.getItemMeta() == null) - { - return; - } - - ItemMeta itemMeta = itemStack.getItemMeta(); - - if (itemMeta.getDisplayName() == null) - { - return; - } - - if (itemMeta.getLore() == null) - { - return; - } - - if (GetState() != GameState.Recruit) + if (itemStack.getType() == Material.WATCH || itemStack.getType() == Material.BED) { return; } @@ -697,81 +727,9 @@ public abstract class SuperSmash extends Game return _lives; } - @EventHandler - public void debugCommands(PlayerCommandPreprocessEvent event) + protected boolean displayKitInfo(Player player) { - if (!UtilServer.isTestServer()) - { - return; - } - - String message = event.getMessage(); - Player player = event.getPlayer(); - - if (message.startsWith("/cooldown")) - { - event.setCancelled(true); - - for (Player other : UtilServer.getPlayers()) - { - Recharge.Instance.Reset(other); - } - - Announce(C.cWhiteB + player.getName() + C.cAquaB + " reset cooldowns!"); - } - else if (message.startsWith("/nextsmash")) - { - event.setCancelled(true); - - _nextPowerup = System.currentTimeMillis() + 1000; - Announce(C.cWhiteB + player.getName() + C.cAquaB + " spawned a smash crystal!"); - } - else if (message.startsWith("/smash")) - { - event.setCancelled(true); - - giveSmashItem(player); - } - else if (message.startsWith("/kit")) - { - event.setCancelled(true); - - String[] args = message.split(" "); - String kit = ""; - - for (int i = 1; i < args.length; i++) - { - kit += args[i] + " "; - } - - kit = kit.trim(); - - for (Kit kits : GetKits()) - { - if (kit.equalsIgnoreCase(kits.GetName())) - { - SetKit(player, kits, true); - return; - } - } - - player.sendMessage(F.main("Kit", "Sorry that is not a kit!")); - } - else if (message.startsWith("/lives")) - { - event.setCancelled(true); - - Announce(C.cWhiteB + player.getName() + C.cAquaB + " reset their lives!"); - - if (!IsAlive(player)) - { - SetPlayerState(player, PlayerState.IN); - RespawnPlayer(player); - player.sendMessage(F.main("Revive", "You are back in the game!")); - } - - _lives.put(player, MAX_LIVES); - } + return GetState() == GameState.Recruit; } public void setNextPowerupTime(long time) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/SuperSmashTraining.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/SuperSmashTraining.java new file mode 100644 index 000000000..064ce150a --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/SuperSmashTraining.java @@ -0,0 +1,233 @@ +package nautilus.game.arcade.game.games.smash; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilTime; +import mineplex.core.hologram.Hologram; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.GameType; +import nautilus.game.arcade.events.GameStateChangeEvent; +import nautilus.game.arcade.game.GameTeam; +import nautilus.game.arcade.game.games.smash.events.SmashActivateEvent; +import nautilus.game.arcade.game.modules.TrainingGameModule; +import org.bukkit.ChatColor; +import org.bukkit.Location; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.entity.PlayerDeathEvent; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.UUID; +import java.util.concurrent.TimeUnit; +import java.util.function.Function; + +public class SuperSmashTraining extends SuperSmash +{ + + private static final long GAME_TIME = TimeUnit.HOURS.toMillis(3); + private static final long GAME_WARN_TIME = GAME_TIME - TimeUnit.MINUTES.toMillis(5); + private static final String[] INFO_HOLOGRAM = { + C.cYellow + "Select a " + C.cGreen + "Kit", + C.cYellow + "Jump off the island to use your abilities", + C.cYellow + "You can then " + C.cGreen + "PVP" + C.cYellow + " other players", + C.cYellow + "Click the " + C.cGreen + "Bed" + C.cYellow + " to return to this island" + }; + + private Location _borderA; + private Location _borderB; + private Function _safeFunction = player -> !UtilAlg.inBoundingBox(player.getLocation(), _borderA, _borderB); + private Map _lastDeath; + + private boolean _announceEnd; + + public SuperSmashTraining(ArcadeManager manager) + { + super(manager, GameType.SmashTraining, new String[]{ + "Super Smash Mobs Training Ground" + }); + + DamageTeamSelf = true; + DeathSpectateSecs = 0; + PrepareTime = 500; + GiveClock = false; + HungerSet = 20; + + _lastDeath = new HashMap<>(); + + new TrainingGameModule() + .setSkillFunction(_safeFunction) + .setDamageFunction(_safeFunction) + .register(this); + } + + @Override + public void ParseData() + { + List locations = WorldData.GetDataLocs("BROWN"); + + _borderA = locations.get(0); + _borderB = locations.get(1); + } + + @EventHandler + public void customTeamGeneration(GameStateChangeEvent event) + { + if (event.GetState() != GameState.Recruit) + { + return; + } + + GameTeam players = GetTeamList().get(0); + players.SetColor(ChatColor.YELLOW); + players.SetName("Players"); + players.setDisplayName(C.cYellowB + "Players"); + } + + @EventHandler + public void live(GameStateChangeEvent event) + { + if (event.GetState() != GameState.Live) + { + return; + } + + List locations = WorldData.GetDataLocs("BLUE"); + + for (Location location : locations) + { + spawnInfoHologram(location); + } + } + + @Override + @EventHandler + public void ScoreboardUpdate(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + { + return; + } + + Scoreboard.writeNewLine(); + + List alive = GetPlayers(true); + + Scoreboard.write(C.cYellowB + "Players"); + + if (alive.size() > 9) + { + Scoreboard.write(alive.size() + " Alive"); + } + else + { + for (Player player : alive) + { + Scoreboard.write(player.getName()); + } + } + + Scoreboard.writeNewLine(); + + Scoreboard.write(C.cYellowB + "Time"); + Scoreboard.write(UtilTime.MakeStr(System.currentTimeMillis() - GetStateTime())); + + Scoreboard.writeNewLine(); + + Scoreboard.draw(); + } + + @Override + public List getWinners() + { + return null; + } + + @Override + public List getLosers() + { + return null; + } + + @Override + @EventHandler + public void playerDeath(PlayerDeathEvent event) + { + _lastDeath.put(event.getEntity().getUniqueId(), System.currentTimeMillis()); + } + + @EventHandler + public void cleanlastDeath(UpdateEvent event) + { + if (!IsLive() || event.getType() != UpdateType.FAST) + { + return; + } + + for (Player player : GetPlayers(true)) + { + if (_safeFunction.apply(player)) + { + _lastDeath.remove(player.getUniqueId()); + } + } + } + + @EventHandler + public void smashActivate(SmashActivateEvent event) + { + if (!_safeFunction.apply(event.getPlayer())) + { + event.setCancelled(true); + } + } + + @Override + public void EndCheck() + { + if (!IsLive()) + { + return; + } + + if (UtilTime.elapsed(GetStateTime(), GAME_TIME)) + { + SetState(GameState.Dead); + Announce(C.cRedB + "Game Over! Resetting the map, you will be able to play again."); + } + else if (UtilTime.elapsed(GetStateTime(), GAME_WARN_TIME) && !_announceEnd) + { + _announceEnd = true; + Announce(C.cRedB + "The Game Will End In 5 Minutes."); + } + } + + @Override + public long getNewSmashTime() + { + return (long) (System.currentTimeMillis() + TimeUnit.MINUTES.toMillis(2) + TimeUnit.MINUTES.toMillis(2) * Math.random()); + } + + @Override + protected boolean displayKitInfo(Player player) + { + if (_lastDeath.containsKey(player.getUniqueId())) + { + return UtilTime.elapsed(_lastDeath.get(player.getUniqueId()), 4000); + } + + return super.displayKitInfo(player) || !_safeFunction.apply(player); + } + + private void spawnInfoHologram(Location location) + { + CreatureAllowOverride = true; + + new Hologram(getArcadeManager().getHologramManager(), location, true, INFO_HOLOGRAM).start(); + + CreatureAllowOverride = false; + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/events/SmashActivateEvent.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/events/SmashActivateEvent.java new file mode 100644 index 000000000..44b89f7ef --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/events/SmashActivateEvent.java @@ -0,0 +1,42 @@ +package nautilus.game.arcade.game.games.smash.events; + +import org.bukkit.entity.Player; +import org.bukkit.event.Cancellable; +import org.bukkit.event.HandlerList; +import org.bukkit.event.player.PlayerEvent; + +public class SmashActivateEvent extends PlayerEvent implements Cancellable +{ + + private static final HandlerList HANDLERS = new HandlerList(); + + private boolean _cancelled; + + public SmashActivateEvent(Player who) + { + super(who); + } + + @Override + public boolean isCancelled() + { + return _cancelled; + } + + @Override + public void setCancelled(boolean b) + { + _cancelled = b; + } + + public HandlerList getHandlers() + { + return HANDLERS; + } + + public static HandlerList getHandlerList() + { + return HANDLERS; + } + +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitBlaze.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitBlaze.java index 37399886a..b248334df 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitBlaze.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitBlaze.java @@ -29,9 +29,9 @@ import nautilus.game.arcade.kit.perks.PerkSpeed; public class KitBlaze extends SmashKit { private static final Perk[] PERKS = { - new PerkSmashStats(6, 1.5, 0.25, 5), - new PerkDoubleJump("Double Jump", 1, 1, false), - new PerkKnockbackFire(1.50), + new PerkSmashStats(), + new PerkDoubleJump("Double Jump"), + new PerkKnockbackFire(), new PerkSpeed(0), new PerkInferno(), new PerkFirefly(), @@ -70,6 +70,7 @@ public class KitBlaze extends SmashKit new ItemStack(Material.CHAINMAIL_BOOTS), new ItemStack(Material.CHAINMAIL_LEGGINGS), new ItemStack(Material.CHAINMAIL_CHESTPLATE), + new ItemStack(Material.CHAINMAIL_HELMET) }; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitChicken.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitChicken.java index 6e4f0b442..434bef8f3 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitChicken.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitChicken.java @@ -25,8 +25,8 @@ public class KitChicken extends SmashKit { private static final Perk[] PERKS = { - new PerkSmashStats(4.5, 2.0, 0.2, 2), - new PerkFlap(0.8, 0.8, false), + new PerkSmashStats(), + new PerkFlap(), new PerkEggGun(), new PerkChickenRocket(), new SmashChicken() diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitCow.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitCow.java index 33b49741d..7d9c1bf3f 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitCow.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitCow.java @@ -26,8 +26,8 @@ public class KitCow extends SmashKit { private static final Perk[] PERKS = { - new PerkSmashStats(6, 1.1, 0.25, 6.5), - new PerkDoubleJump("Double Jump", 0.9, 0.9, false), + new PerkSmashStats(), + new PerkDoubleJump("Double Jump"), new PerkCowStampede(), new PerkCowAngryHerd(), new PerkCowMilkSpiral(), diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitCreeper.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitCreeper.java index 9503a5c9f..6d56a56ad 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitCreeper.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitCreeper.java @@ -25,8 +25,8 @@ import nautilus.game.arcade.kit.perks.PerkDoubleJump; public class KitCreeper extends SmashKit { private static final Perk[] PERKS = { - new PerkSmashStats(6, 1.65, 0.4, 3.5), - new PerkDoubleJump("Double Jump", 0.9, 0.9, false), + new PerkSmashStats(), + new PerkDoubleJump("Double Jump"), new PerkCreeperElectricity(), new PerkCreeperSulphurBomb(), new PerkCreeperExplode(), diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitEnderman.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitEnderman.java index 0b2307689..cb1e1d08d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitEnderman.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitEnderman.java @@ -1,23 +1,11 @@ package nautilus.game.arcade.game.games.smash.kits; -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map.Entry; - -import org.bukkit.ChatColor; -import org.bukkit.Material; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.entity.PlayerDeathEvent; -import org.bukkit.inventory.ItemStack; - import mineplex.core.common.util.C; import mineplex.core.common.util.UtilInv; +import mineplex.core.disguise.disguises.DisguiseBase; import mineplex.core.disguise.disguises.DisguiseEnderman; import mineplex.core.itemstack.ItemStackFactory; -import mineplex.core.updater.UpdateType; -import mineplex.core.updater.event.UpdateEvent; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.game.Game.GameState; import nautilus.game.arcade.game.games.smash.perks.PerkSmashStats; @@ -31,14 +19,21 @@ import nautilus.game.arcade.kit.Perk; import nautilus.game.arcade.kit.perks.PerkDoubleJump; import nautilus.game.arcade.kit.perks.event.PerkBlockGrabEvent; import nautilus.game.arcade.kit.perks.event.PerkBlockThrowEvent; +import org.bukkit.ChatColor; +import org.bukkit.Material; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.entity.PlayerDeathEvent; +import org.bukkit.inventory.ItemStack; public class KitEnderman extends SmashKit { private static final Perk[] PERKS = { - new PerkSmashStats(7, 1.3, 0.25, 6), - new PerkDoubleJump("Double Jump", 0.9, 0.9, false), - new PerkBlink("Blink", 16, 6000), + new PerkSmashStats(), + new PerkDoubleJump("Double Jump"), + new PerkBlink("Blink"), new PerkBlockToss(), new PerkEndermanTeleport(), new SmashEnderman() @@ -82,8 +77,6 @@ public class KitEnderman extends SmashKit }; - public HashMap _disguises = new HashMap(); - public KitEnderman(ArcadeManager manager) { super(manager, "Enderman", KitAvailability.Gem, 3000, PERKS, EntityType.ENDERMAN, IN_HAND, DisguiseEnderman.class); @@ -93,9 +86,7 @@ public class KitEnderman extends SmashKit public void GiveItems(Player player) { disguise(player); - - _disguises.put(player, (DisguiseEnderman) Manager.GetDisguise().getActiveDisguise(player)); - + UtilInv.Clear(player); player.getInventory().addItem(PLAYER_ITEMS[0], PLAYER_ITEMS[1]); @@ -111,54 +102,51 @@ public class KitEnderman extends SmashKit @EventHandler public void BlockGrab(PerkBlockGrabEvent event) { - SetBlock(_disguises.get(event.GetPlayer()), event.GetId(), event.GetData()); + setBlock(event.GetPlayer(), event.GetId(), event.GetData()); } @EventHandler public void BlockThrow(PerkBlockThrowEvent event) { - SetBlock(_disguises.get(event.GetPlayer()), 0, (byte) 0); + setBlock(event.GetPlayer(), 0, (byte) 0); } @EventHandler public void Death(PlayerDeathEvent event) { - SetBlock(_disguises.get(event.getEntity()), 0, (byte) 0); - } - - public void SetBlock(DisguiseEnderman disguise, int id, byte data) - { - if (disguise == null) - { - return; - } - - disguise.SetCarriedId(id); - disguise.SetCarriedData(data); - - Manager.GetDisguise().updateDisguise(disguise); + setBlock(event.getEntity(), 0, (byte) 0); } @EventHandler - public void cleanDisguises(UpdateEvent event) + public void damage(CustomDamageEvent event) { - if (event.getType() != UpdateType.FAST) + Player player = event.GetDamageePlayer(); + + if (player == null) { return; } - - for (Iterator> iterator = _disguises.entrySet().iterator(); iterator.hasNext();) - { - Entry current = iterator.next(); - if (!Manager.GetDisguise().isDisguised(current.getKey())) - { - iterator.remove(); - } - else if (Manager.GetDisguise().getActiveDisguise(current.getKey()) != current.getValue()) - { - iterator.remove(); - } + DisguiseBase disguise = Manager.GetDisguise().getActiveDisguise(player); + + if (player != null && disguise != null && disguise instanceof DisguiseEnderman) + { + // Endermen drop their held block when damaged. This means the client renders it this way, so we need to resend the correct data on the next tick. + Manager.runSyncLater(() -> Manager.GetDisguise().updateDisguise(disguise), 1); + } + } + + public void setBlock(Player player, int id, byte data) + { + DisguiseBase disguise = Manager.GetDisguise().getActiveDisguise(player); + + if (player != null && disguise != null && disguise instanceof DisguiseEnderman) + { + DisguiseEnderman disguiseEnderman = (DisguiseEnderman) disguise; + disguiseEnderman.SetCarriedId(id); + disguiseEnderman.SetCarriedData(data); + + Manager.GetDisguise().updateDisguise(disguiseEnderman); } } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitGolem.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitGolem.java index 00c38f95f..649a3c072 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitGolem.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitGolem.java @@ -27,8 +27,8 @@ public class KitGolem extends SmashKit { private static final Perk[] PERKS = { - new PerkSmashStats(7, 1.0, 0.2, 8), - new PerkDoubleJump("Double Jump", 0.9, 0.9, false), + new PerkSmashStats(), + new PerkDoubleJump("Double Jump"), new PerkSlow(0), new PerkFissure(), new PerkIronHook(), diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitGuardian.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitGuardian.java index 45129c462..6d81d90b6 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitGuardian.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitGuardian.java @@ -26,8 +26,8 @@ public class KitGuardian extends SmashKit { private static final Perk[] PERKS = { - new PerkSmashStats(4, 1.25, 0.25, 4.5), - new PerkDoubleJump("Double Jump", 0.9, 0.9, false), + new PerkSmashStats(), + new PerkDoubleJump("Double Jump"), new PerkWhirlpoolBlade(), new PerkWaterSplash(), new PerkTargetLazer(), diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitMagmaCube.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitMagmaCube.java index e252a2e64..745f725a6 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitMagmaCube.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitMagmaCube.java @@ -30,8 +30,8 @@ public class KitMagmaCube extends SmashKit { private static final Perk[] PERKS = { - new PerkSmashStats(5, 1.75, 0.35, 5), - new PerkDoubleJump("Double Jump", 1.2, 1, false), + new PerkSmashStats(), + new PerkDoubleJump("Double Jump"), new PerkMagmaBoost(), new PerkMagmaBlast(), new PerkFlameDash(), @@ -63,6 +63,14 @@ public class KitMagmaCube extends SmashKit ChatColor.RESET + "", ChatColor.RESET + "Right-Click again to end Flame Dash early.", }), + ItemStackFactory.Instance.CreateStack(Material.BLAZE_POWDER, (byte) 0, 1, + C.cYellow + C.Bold + "Passive" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Fuel the Fire", + new String[] + { + ChatColor.RESET + "Each kill increases your size, damage", + ChatColor.RESET + "armor and decreases your knockback taken.", + ChatColor.RESET + "Resets on death.", + }), ItemStackFactory.Instance.CreateStack(Material.NETHER_STAR, (byte) 0, 1, C.cYellow + C.Bold + "Smash Crystal" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Meteor Shower", new String[] @@ -89,21 +97,21 @@ public class KitMagmaCube extends SmashKit public void GiveItems(Player player) { disguise(player); - + DisguiseMagmaCube disguise = (DisguiseMagmaCube) Manager.GetDisguise().getActiveDisguise(player); - + disguise.SetSize(1); - + UtilInv.Clear(player); player.getInventory().addItem(PLAYER_ITEMS[0], PLAYER_ITEMS[1]); if (Manager.GetGame().GetState() == GameState.Recruit) - player.getInventory().addItem(PLAYER_ITEMS[2]); + player.getInventory().addItem(PLAYER_ITEMS[2], PLAYER_ITEMS[3]); - player.getInventory().setArmorContents(PLAYER_ARMOR);; + player.getInventory().setArmorContents(PLAYER_ARMOR); } - + @EventHandler public void fireResistance(UpdateEvent event) { @@ -111,19 +119,19 @@ public class KitMagmaCube extends SmashKit { return; } - + if (Manager.GetGame() == null) { return; } - + for (Player player : Manager.GetGame().GetPlayers(true)) { if (!HasKit(player)) { continue; } - + player.setFireTicks(0); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitPig.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitPig.java index c97306a50..fb92a55d0 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitPig.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitPig.java @@ -33,8 +33,8 @@ public class KitPig extends SmashKit private static final float ENERGY_PER_TICK_SMASH = 0.02F; private static final Perk[] PERKS = { - new PerkSmashStats(5, 1.5, 0.25, 5), - new PerkDoubleJump("Double Jump", 0.9, 0.9, false), + new PerkSmashStats(), + new PerkDoubleJump("Double Jump"), new PerkPigBaconBounce(), new PerkPigBaconBomb(), new PerkPigZombie(), diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSheep.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSheep.java index 00dd730ee..7d6c3403d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSheep.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSheep.java @@ -27,9 +27,9 @@ public class KitSheep extends SmashKit { private static final Perk[] PERKS = { - new PerkSmashStats(5, 1.7, 0.25, 5), - new PerkDoubleJump("Double Jump", 1, 1, false), - new PerkLazer(40, 7000), + new PerkSmashStats(), + new PerkDoubleJump("Double Jump"), + new PerkLazer(), new PerkWoolBomb(), new PerkWoolCloud(), new SmashSheep() diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSkeletalHorse.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSkeletalHorse.java index 0872b37ce..e034fe899 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSkeletalHorse.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSkeletalHorse.java @@ -32,8 +32,8 @@ public class KitSkeletalHorse extends SmashKit { private static final Perk[] PERKS = { - new PerkSmashStats(6, 1.4, 0.3, 6.5), - new PerkDoubleJump("Double Jump", 1, 1, false), + new PerkSmashStats(), + new PerkDoubleJump("Double Jump"), new PerkHorseKick(), new PerkBoneRush(), new PerkDeadlyBones(), diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSkeleton.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSkeleton.java index 07f123e5b..8237cf19a 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSkeleton.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSkeleton.java @@ -35,13 +35,13 @@ public class KitSkeleton extends SmashKit private static double ARROW_DAMAGE = 6; private static final Perk[] PERKS = { - new PerkSmashStats(5, 1.25, 0.2, 6), - new PerkDoubleJump("Double Jump", 0.9, 0.9, false), - new PerkFletcher(3, 3, false), - new PerkKnockbackArrow(1.5), + new PerkSmashStats(), + new PerkDoubleJump("Double Jump"), + new PerkFletcher(), + new PerkKnockbackArrow(), new PerkBoneExplosion(), - new PerkRopedArrow("Roped Arrow", 1, 5000), - new PerkBarrage(5, 300, true, false, true), + new PerkRopedArrow("Roped Arrow"), + new PerkBarrage(), new SmashSkeleton() }; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSkySquid.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSkySquid.java index 7e0c0bf36..a831fa700 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSkySquid.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSkySquid.java @@ -26,10 +26,10 @@ public class KitSkySquid extends SmashKit { private static final Perk[] PERKS = { - new PerkSmashStats(6, 1.5, 0.25, 5), - new PerkDoubleJump("Double Jump", 0.9, 0.9, false), + new PerkSmashStats(), + new PerkDoubleJump("Double Jump"), new PerkSuperSquid(), - new PerkInkBlast(7, 2), + new PerkInkBlast(), new PerkFishFlurry(), new SmashSquid() }; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSlime.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSlime.java index f439afb7c..0a5c66d2c 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSlime.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSlime.java @@ -25,8 +25,8 @@ public class KitSlime extends SmashKit { private static final Perk[] PERKS = { - new PerkSmashStats(6, 1.75, 0.35, 3), - new PerkDoubleJump("Double Jump", 1.2, 1, false), + new PerkSmashStats(), + new PerkDoubleJump("Double Jump"), new PerkSlimeSlam(), new PerkSlimeRocket(), new SmashSlime() @@ -66,7 +66,7 @@ public class KitSlime extends SmashKit }; private static final ItemStack[] PLAYER_ARMOR = { - null, + new ItemStack(Material.CHAINMAIL_BOOTS), null, new ItemStack(Material.CHAINMAIL_CHESTPLATE), new ItemStack(Material.CHAINMAIL_HELMET), diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSnowman.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSnowman.java index c8af47cc9..adfb1ce7b 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSnowman.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSnowman.java @@ -26,16 +26,6 @@ import nautilus.game.arcade.kit.perks.PerkDoubleJump; public class KitSnowman extends SmashKit { - private static final Perk[] PERKS = { - new PerkSmashStats(6, 1.4, 0.3, 6), - new PerkDoubleJump("Double Jump", 0.9, 0.9, false), - new PerkDamageSnow(1, 0.4), - new PerkArcticAura(), - new PerkBlizzard(), - new PerkIcePath(), - new SmashSnowman() - }; - private static final ItemStack IN_HAND = new ItemStack(Material.SNOW_BALL); private static final ItemStack[] PLAYER_ITEMS = { @@ -80,7 +70,15 @@ public class KitSnowman extends SmashKit public KitSnowman(ArcadeManager manager) { - super(manager, "Snowman", KitAvailability.Gem, 5000, PERKS, EntityType.SNOWMAN, IN_HAND, DisguiseSnowman.class); + super(manager, "Snowman", KitAvailability.Gem, 5000, new Perk[] { + new PerkSmashStats(), + new PerkDoubleJump("Double Jump"), + new PerkDamageSnow(), + new PerkArcticAura(), + new PerkBlizzard(), + new PerkIcePath(), + new SmashSnowman() }, + EntityType.SNOWMAN, IN_HAND, DisguiseSnowman.class); } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSpider.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSpider.java index 67cac165b..343ad990b 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSpider.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSpider.java @@ -26,7 +26,7 @@ public class KitSpider extends SmashKit { private static final Perk[] PERKS = { - new PerkSmashStats(6, 1.5, 0.25, 6), + new PerkSmashStats(), new PerkSpiderLeap(), new PerkNeedler(), new PerkWebShot(), diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitWitch.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitWitch.java index 34657771c..72a7f2c85 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitWitch.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitWitch.java @@ -25,8 +25,8 @@ public class KitWitch extends SmashKit { private static final Perk[] PERKS = { - new PerkSmashStats(6, 1.5, 0.3, 5), - new PerkDoubleJump("Double Jump", 0.9, 0.9, false), + new PerkSmashStats(), + new PerkDoubleJump("Double Jump"), new PerkWitchPotion(), new PerkBatWave(), new SmashWitch() diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitWitherSkeleton.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitWitherSkeleton.java index 8efef7fe6..5c9587963 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitWitherSkeleton.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitWitherSkeleton.java @@ -27,8 +27,8 @@ public class KitWitherSkeleton extends SmashKit { private static final Perk[] PERKS = { - new PerkSmashStats(6, 1.2, 0.3, 6), - new PerkDoubleJump("Double Jump", 0.9, 0.9, false), + new PerkSmashStats(), + new PerkDoubleJump("Double Jump"), new PerkWitherSkull(), new PerkWitherImage(), new SmashWitherSkeleton() diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitWolf.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitWolf.java index 0de6382fa..7e758f379 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitWolf.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitWolf.java @@ -24,8 +24,8 @@ public class KitWolf extends SmashKit { private static final Perk[] PERKS = { - new PerkSmashStats(5, 1.6, 0.25, 5), - new PerkDoubleJump("Wolf Jump", 1.0, 1.0, true), + new PerkSmashStats(), + new PerkDoubleJump("Wolf Jump"), new PerkWolf(), new SmashWolf() }; @@ -68,7 +68,7 @@ public class KitWolf extends SmashKit private static final ItemStack[] PLAYER_ARMOR = { null, new ItemStack(Material.CHAINMAIL_LEGGINGS), - new ItemStack(Material.IRON_CHESTPLATE), + new ItemStack(Material.CHAINMAIL_CHESTPLATE), null }; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitZombie.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitZombie.java index 62ea7dc0a..5fd207064 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitZombie.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitZombie.java @@ -32,11 +32,11 @@ public class KitZombie extends SmashKit { private static final Perk[] PERKS = { - new PerkSmashStats(6, 1.25, 0.25, 5), - new PerkDoubleJump("Double Jump", 0.9, 0.9, false), - new PerkFletcher(2, 2, false), - new PerkKnockbackArrow(1.5), - new PerkOvercharge(6, 250, true), + new PerkSmashStats(), + new PerkDoubleJump("Double Jump"), + new PerkFletcher(), + new PerkKnockbackArrow(), + new PerkOvercharge(), new PerkZombieBile(), new PerkDeathsGrasp(), new SmashZombie() diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/PerkSmashStats.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/PerkSmashStats.java index 2b5d00808..534ab5f3b 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/PerkSmashStats.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/PerkSmashStats.java @@ -17,68 +17,95 @@ public class PerkSmashStats extends Perk private double _damage; private double _knockbackTaken; private double _regen; - - public PerkSmashStats(double damage, double knockbackTaken, double regen, double armor) + private double _armor; + + public PerkSmashStats() { - super("Smash Stats", new String[] - { - - (C.cAqua + "Damage: " + C.cWhite + damage) + C.cWhite + " " + (C.cAqua + "Knockback Taken: " + C.cWhite + (int)(knockbackTaken*100) + "%"), - (C.cAqua + "Armor: " + C.cWhite + armor) + C.cWhite + " " + (C.cAqua + "Health Regeneration: " + C.cWhite + regen + " per Second"), - }); - - _damage = damage; - _knockbackTaken = knockbackTaken; - _regen = regen; - } - + super("Smash Stats"); + } + + @Override + public void setupValues() + { + _damage = getPerkDouble("Damage", _damage); + _knockbackTaken = getPerkPercentage("Knockback Taken", _knockbackTaken); + _regen = getPerkDouble("Regeneration", _regen); + _armor = getPerkDouble("Armor", _armor); + + setDesc( + (C.cAqua + "Damage: " + C.cWhite + _damage) + C.cWhite + " " + (C.cAqua + "Knockback Taken: " + C.cWhite + (int) (_knockbackTaken * 100) + "%"), + (C.cAqua + "Armor: " + C.cWhite + _armor) + C.cWhite + " " + (C.cAqua + "Health Regeneration: " + C.cWhite + _regen + " per Second") + ); + } + @EventHandler(priority = EventPriority.HIGH) public void Damage(CustomDamageEvent event) { if (event.GetCause() != DamageCause.ENTITY_ATTACK) + { return; - + } + Player damager = event.GetDamagerPlayer(false); - if (damager == null) return; - - if (!Kit.HasKit(damager)) + + if (damager == null || !Kit.HasKit(damager) || !Manager.IsAlive(damager)) + { return; - - if (!Manager.IsAlive(damager)) - return; - + } + double mod = _damage - event.GetDamageInitial(); - + event.AddMod(damager.getName(), "Attack", mod, true); } - + @EventHandler(priority = EventPriority.HIGH) public void Knockback(CustomDamageEvent event) { Player damagee = event.GetDamageePlayer(); - if (damagee == null) return; - + if (damagee == null) + { + return; + } + if (!Kit.HasKit(damagee)) + { return; - + } + if (!Manager.IsAlive(damagee)) + { return; - + } + event.AddKnockback("Knockback Multiplier", _knockbackTaken); } - + @EventHandler public void Regeneration(UpdateEvent event) { if (event.getType() != UpdateType.SEC) + { return; - + } + for (Player player : Manager.GetGame().GetPlayers(true)) { if (!Kit.HasKit(player)) + { continue; - + } + UtilPlayer.health(player, _regen); } } + + public double getArmour() + { + return _armor; + } + + public void setArmor(double armor) + { + _armor = armor; + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/SmashUltimate.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/SmashUltimate.java index 8bddb995c..cb0c4f566 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/SmashUltimate.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/SmashUltimate.java @@ -1,15 +1,5 @@ package nautilus.game.arcade.game.games.smash.perks; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.UUID; - -import org.bukkit.Sound; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; - import mineplex.core.common.util.F; import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilTime; @@ -17,10 +7,14 @@ import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.combat.event.CombatDeathEvent; - import nautilus.game.arcade.events.GameStateChangeEvent; import nautilus.game.arcade.game.Game.GameState; import nautilus.game.arcade.kit.Perk; +import org.bukkit.Sound; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; + +import java.util.*; public class SmashUltimate extends Perk { @@ -40,6 +34,12 @@ public class SmashUltimate extends Perk _length = length; } + @Override + public void setupValues() + { + _length = getPerkTime("Duration", _length); + } + public void activate(Player player) { _lastUltimate.put(player.getUniqueId(), System.currentTimeMillis()); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/blaze/PerkFirefly.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/blaze/PerkFirefly.java index 29cd6d704..811fbae19 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/blaze/PerkFirefly.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/blaze/PerkFirefly.java @@ -34,29 +34,45 @@ import nautilus.game.arcade.kit.perks.data.FireflyData; public class PerkFirefly extends SmashPerk { - - private static final int COOLDOWN = 12000; - private static final int DURATION = 2750; - private static final int DAMAGE = 7; - - private static final int RADIUS_NORMAL = 4; - private static final float VELOCITY_NORMAL = 0.7F; - - private static final int RADIUS_SMASH = 7; - private static final float VELOCITY_SMASH = 0.79F; - - private static final int HIT_FREQUENCY = 2000; - private static final int WARMUP_TIME = 1500; - private static final int MIN_CANCEL_DAMAGE = 4; - private static final int KNOCKBACK_MAGNITUDE = 2; - private Set _data = new HashSet(); - + private int _cooldown; + private int _duration ; + private int _damage; + + private int _radiusNormal; + private float _velocityNormal; + + private int _radiusSmash; + private float _velocitySmash; + + private int _hitFrequency; + private int _warmupTime; + private int _minCancelDamage; + private int _knockbackMagnitude; + + private Set _data = new HashSet<>(); + private int _tick = 0; - + public PerkFirefly() { - super("Firefly", new String[] { C.cYellow + "Right-Click" + C.cGray + " with Axe to use " + C.cGreen + "Firefly" }); + super("Firefly", new String[]{C.cYellow + "Right-Click" + C.cGray + " with Axe to use " + C.cGreen + "Firefly"}); + } + + @Override + public void setupValues() + { + _cooldown = getPerkTime("Cooldown"); + _duration = getPerkInt("Duration (ms)"); + _damage = getPerkInt("Damage"); + _radiusNormal = getPerkInt("Radius Normal"); + _velocityNormal = getPerkFloat("Velocity Normal"); + _radiusSmash = getPerkInt("Radius Smash"); + _velocitySmash = getPerkFloat("Velocity Smash"); + _hitFrequency = getPerkInt("Hit Frequency (ms)"); + _warmupTime = getPerkInt("Warmup Time (ms)"); + _minCancelDamage = getPerkInt("Min Cancel Damage"); + _knockbackMagnitude = getPerkInt("Knockback Magnitude"); } @EventHandler @@ -94,7 +110,7 @@ public class PerkFirefly extends SmashPerk return; } - if (!Recharge.Instance.use(player, GetName(), COOLDOWN, true, true)) + if (!Recharge.Instance.use(player, GetName(), _cooldown, true, true)) { return; } @@ -126,7 +142,7 @@ public class PerkFirefly extends SmashPerk Iterator dataIterator = _data.iterator(); //There are a lot of magic numbers here, they are all arbitrary sound and particle values. - + while (dataIterator.hasNext()) { FireflyData data = dataIterator.next(); @@ -134,15 +150,15 @@ public class PerkFirefly extends SmashPerk Player player = data.Player; boolean superActive = isSuperActive(data.Player); String skillName = superActive ? "Phoenix" : GetName(); - + if (UtilPlayer.isSpectator(player)) { dataIterator.remove(); continue; } - + // Warmup - if (!UtilTime.elapsed(data.Time, WARMUP_TIME) && !superActive) + if (!UtilTime.elapsed(data.Time, _warmupTime) && !superActive) { UtilAction.zeroVelocity(player); player.getWorld().playSound(player.getLocation(), Sound.EXPLODE, 0.2f, 0.6f); @@ -151,14 +167,14 @@ public class PerkFirefly extends SmashPerk // Sound and Effect UtilParticle.PlayParticleToAll(ParticleType.FIREWORKS_SPARK, player.getLocation().add(0, 1, 0), 0.6f, 0.6f, 0.6f, 0, 10, ViewDist.LONG); - float progress = (float) (System.currentTimeMillis() - data.Time) / WARMUP_TIME; + float progress = (float) (System.currentTimeMillis() - data.Time) / _warmupTime; player.getWorld().playSound(player.getLocation(), Sound.BLAZE_BREATH, 0.5f, 1f + progress); } // Velocity - else if (!UtilTime.elapsed(data.Time, DURATION) || superActive) + else if (!UtilTime.elapsed(data.Time, _duration) || superActive) { - UtilAction.velocity(player, player.getLocation().getDirection().multiply(superActive ? VELOCITY_SMASH : VELOCITY_NORMAL).add(new Vector(0, 0.15, 0))); + UtilAction.velocity(player, player.getLocation().getDirection().multiply(superActive ? _velocitySmash : _velocityNormal).add(new Vector(0, 0.15, 0))); player.getWorld().playSound(player.getLocation(), Sound.EXPLODE, 0.6f, 1.2f); // Sound and Effect @@ -176,7 +192,7 @@ public class PerkFirefly extends SmashPerk player.getWorld().playSound(player.getLocation(), Sound.EXPLODE, 0.75f, 0.75f); } - for (Player other : UtilPlayer.getNearby(player.getLocation(), superActive ? RADIUS_SMASH : RADIUS_NORMAL)) + for (Player other : UtilPlayer.getNearby(player.getLocation(), superActive ? _radiusSmash : _radiusNormal)) { if (other.equals(player)) { @@ -192,10 +208,10 @@ public class PerkFirefly extends SmashPerk if (_tick % 12 == 0) { - if (Recharge.Instance.use(other, GetName() + " hit by " + player.getName(), HIT_FREQUENCY, false, false)) - { + if (Recharge.Instance.use(other, GetName() + " hit by " + player.getName(), _hitFrequency, false, false)) + { // Damage Event - Manager.GetDamage().NewDamageEvent(other, player, null, DamageCause.CUSTOM, DAMAGE, true, true, false, player.getName(), skillName); + Manager.GetDamage().NewDamageEvent(other, player, null, DamageCause.CUSTOM, _damage, true, true, false, player.getName(), skillName); UtilPlayer.message(other, F.main("Game", F.elem(Manager.GetColor(player) + player.getName()) + " hit you with " + F.elem(skillName) + ".")); } @@ -212,11 +228,11 @@ public class PerkFirefly extends SmashPerk @EventHandler public void FireflyDamage(CustomDamageEvent event) { - if (event.GetDamage() < MIN_CANCEL_DAMAGE) + if (event.GetDamage() < _minCancelDamage) { return; } - + if (!(event.GetDamagerEntity(true) instanceof Player)) { return; @@ -232,7 +248,7 @@ public class PerkFirefly extends SmashPerk { continue; } - + if (!UtilTime.elapsed(data.Time, 1250) && !isSuperActive(data.Player)) { if (isTeamDamage(data.Player, event.GetDamagerPlayer(true))) @@ -256,7 +272,7 @@ public class PerkFirefly extends SmashPerk { return; } - - event.AddKnockback(GetName(), KNOCKBACK_MAGNITUDE); + + event.AddKnockback(GetName(), _knockbackMagnitude); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/blaze/PerkInferno.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/blaze/PerkInferno.java index 7eb44eca3..2099330c5 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/blaze/PerkInferno.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/blaze/PerkInferno.java @@ -30,13 +30,14 @@ public class PerkInferno extends SmashPerk { private static final float MAX_ENERGY = 0.999F; - private static final float ENERGY_PER_TICK = 0.025F; - private static final float ENERGY_PER_ITEM = 0.035F; + + private float _energyTick = 0.025F; + private float _energyItem = 0.035F; - private static final double ITEM_EXPIRE_TIME = 0.7; - private static final double ITEM_BURN_TIME = 0.5; - private static final double ITEM_DAMAGE = 0.25; - private static final float ITEM_VELOCITY_MAGNITUDE = 1.6F; + private double _itemExpireTime = 0.7; + private double _itemBurnTime = 0.5; + private double _itemDamage = 0.25; + private float _itemVelocityMagnitude = 1.6F; private Map _active = new HashMap<>(); @@ -45,6 +46,17 @@ public class PerkInferno extends SmashPerk super("Inferno", new String[] { C.cYellow + "Hold Block" + C.cGray + " to use " + C.cGreen + "Inferno" }); } + @Override + public void setupValues() + { + _energyTick = getPerkFloat("Energy Tick"); + _energyItem = getPerkFloat("Energy Item"); + _itemExpireTime = getPerkDouble("Expire Time"); + _itemBurnTime = getPerkDouble("Burn Time"); + _itemDamage = getPerkDouble("Damage"); + _itemVelocityMagnitude = getPerkFloat("Velocity Magnitude"); + } + @EventHandler public void EnergyUpdate(UpdateEvent event) { @@ -62,7 +74,7 @@ public class PerkInferno extends SmashPerk if (!player.isBlocking()) { - player.setExp(Math.min(MAX_ENERGY, player.getExp() + ENERGY_PER_TICK)); + player.setExp(Math.min(MAX_ENERGY, player.getExp() + _energyTick)); } } } @@ -130,7 +142,7 @@ public class PerkInferno extends SmashPerk continue; } - cur.setExp(cur.getExp() - ENERGY_PER_ITEM); + cur.setExp(cur.getExp() - _energyItem); if (cur.getExp() <= 0) { @@ -140,10 +152,10 @@ public class PerkInferno extends SmashPerk // Fire Item fire = cur.getWorld().dropItem(cur.getEyeLocation(), new ItemStack(Material.BLAZE_POWDER)); - Manager.GetFire().Add(fire, cur, ITEM_EXPIRE_TIME, 0, ITEM_BURN_TIME, ITEM_DAMAGE, GetName(), false); + Manager.GetFire().Add(fire, cur, _itemExpireTime, 0, _itemBurnTime, _itemDamage, GetName(), false); fire.teleport(cur.getEyeLocation()); - fire.setVelocity(cur.getLocation().getDirection().add(getRandomVector()).multiply(ITEM_VELOCITY_MAGNITUDE)); + fire.setVelocity(cur.getLocation().getDirection().add(getRandomVector()).multiply(_itemVelocityMagnitude)); // Effect cur.getWorld().playSound(cur.getLocation(), Sound.GHAST_FIREBALL, 0.1f, 1f); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/blaze/SmashBlaze.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/blaze/SmashBlaze.java index 6fba264a3..26e91f7b1 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/blaze/SmashBlaze.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/blaze/SmashBlaze.java @@ -10,13 +10,11 @@ import nautilus.game.arcade.kit.Perk; public class SmashBlaze extends SmashUltimate { - private static final int DURATION = 18000; - public SmashBlaze() { - super("Phoenix", new String[] {}, Sound.BLAZE_DEATH, DURATION); + super("Phoenix", new String[] {}, Sound.BLAZE_DEATH, 0); } - + @Override public void activate(Player player) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/chicken/PerkChickenRocket.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/chicken/PerkChickenRocket.java index a671bd243..5669de319 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/chicken/PerkChickenRocket.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/chicken/PerkChickenRocket.java @@ -44,12 +44,12 @@ import nautilus.game.arcade.kit.perks.data.ChickenMissileData; public class PerkChickenRocket extends SmashPerk { - private static final int COOLDOWN = 7000; - private static final int MIN_TIME = 200; - private static final int MAX_TIME = 4000; - private static final int HIT_BOX_RADIUS = 2; - private static final int DAMAGE_RADIUS = 3; - private static final int DAMAGE = 8; + private int _cooldown; + private int _minTime; + private int _maxTime; + private int _hitBoxRadius; + private int _damageRadius; + private int _damage; private Set _data = new HashSet<>(); @@ -59,6 +59,17 @@ public class PerkChickenRocket extends SmashPerk + " instantly recharges if you hit a player." }); } + @Override + public void setupValues() + { + _cooldown = getPerkTime("Cooldown"); + _minTime = getPerkInt("Min Time (ms)"); + _maxTime = getPerkTime("Max Time (ms)"); + _hitBoxRadius = getPerkInt("Hit Box Radius"); + _damageRadius = getPerkInt("Damage Radius"); + _damage = getPerkInt("Damage"); + } + @EventHandler public void Missile(PlayerInteractEvent event) { @@ -94,7 +105,7 @@ public class PerkChickenRocket extends SmashPerk return; } - if (!Recharge.Instance.use(player, GetName(), COOLDOWN, true, true)) + if (!Recharge.Instance.use(player, GetName(), _cooldown, true, true)) { return; } @@ -131,14 +142,14 @@ public class PerkChickenRocket extends SmashPerk data.Chicken.setVelocity(data.Direction); data.Chicken.getWorld().playSound(data.Chicken.getLocation(), Sound.CHICKEN_HURT, 0.3f, 1.5f); - if (!UtilTime.elapsed(data.Time, MIN_TIME)) + if (!UtilTime.elapsed(data.Time, _minTime)) { continue; } boolean detonate = false; - if (UtilTime.elapsed(data.Time, MAX_TIME)) + if (UtilTime.elapsed(data.Time, _maxTime)) { detonate = true; } @@ -146,11 +157,11 @@ public class PerkChickenRocket extends SmashPerk { List team = TeamSuperSmash.getTeam(Manager, data.Player, true); // Hit Entity - for (Entity ent : UtilEnt.getInRadius(data.Chicken.getLocation(), HIT_BOX_RADIUS).keySet()) + for (Entity ent : UtilEnt.getInRadius(data.Chicken.getLocation(), _hitBoxRadius).keySet()) { if (ent instanceof Arrow) { - if (((Arrow) ent).isOnGround()) + if (ent.isOnGround()) { continue; } @@ -192,7 +203,7 @@ public class PerkChickenRocket extends SmashPerk { List team = TeamSuperSmash.getTeam(Manager, data.Player, true); // Damage - for (LivingEntity ent : UtilEnt.getInRadius(data.Chicken.getLocation(), DAMAGE_RADIUS).keySet()) + for (LivingEntity ent : UtilEnt.getInRadius(data.Chicken.getLocation(), _damageRadius).keySet()) { if (ent.equals(data.Player)) { @@ -212,7 +223,7 @@ public class PerkChickenRocket extends SmashPerk } // Damage Event - Manager.GetDamage().NewDamageEvent(ent, data.Player, null, DamageCause.PROJECTILE, DAMAGE, false, true, false, data.Player.getName(), GetName()); + Manager.GetDamage().NewDamageEvent(ent, data.Player, null, DamageCause.PROJECTILE, _damage, false, true, false, data.Player.getName(), GetName()); UtilAction.velocity(ent, UtilAlg.getTrajectory2d(data.Chicken, ent), 1.6, true, 0.8, 0, 10, true); } @@ -226,7 +237,6 @@ public class PerkChickenRocket extends SmashPerk data.Chicken.remove(); dataIterator.remove(); - continue; } } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/chicken/PerkEggGun.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/chicken/PerkEggGun.java index df35fda05..6162c7276 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/chicken/PerkEggGun.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/chicken/PerkEggGun.java @@ -33,9 +33,9 @@ import nautilus.game.arcade.game.games.smash.perks.SmashPerk; public class PerkEggGun extends SmashPerk { - private static final int COOLDOWN = 2500; - private static final int DURATION = 750; - private static final int DAMAGE = 1; + private int _cooldown; + private int _duration; + private int _damage; private Map _active = new HashMap<>(); @@ -44,6 +44,14 @@ public class PerkEggGun extends SmashPerk super("Egg Blaster", new String[] { C.cYellow + "Hold Block" + C.cGray + " to use " + C.cGreen + "Egg Blaster" }); } + @Override + public void setupValues() + { + _cooldown = getPerkInt("Cooldown (ms)"); + _duration = getPerkInt("Duration (ms)"); + _damage = getPerkInt("Damage"); + } + @EventHandler public void Activate(PlayerInteractEvent event) { @@ -79,7 +87,7 @@ public class PerkEggGun extends SmashPerk return; } - if (!Recharge.Instance.use(player, GetName(), COOLDOWN, true, true)) + if (!Recharge.Instance.use(player, GetName(), _cooldown, true, true)) { return; } @@ -114,7 +122,7 @@ public class PerkEggGun extends SmashPerk continue; } - if (UtilTime.elapsed(_active.get(key), DURATION)) + if (UtilTime.elapsed(_active.get(key), _duration)) { _active.remove(key); continue; @@ -150,7 +158,7 @@ public class PerkEggGun extends SmashPerk return; } - if (event.GetDamage() >= DAMAGE) + if (event.GetDamage() >= _damage) { return; } @@ -160,7 +168,7 @@ public class PerkEggGun extends SmashPerk Egg egg = (Egg) event.GetProjectile(); // Damage Event - Manager.GetDamage().NewDamageEvent(event.GetDamageeEntity(), (LivingEntity) egg.getShooter(), egg, DamageCause.PROJECTILE, DAMAGE, true, true, false, UtilEnt.getName((LivingEntity) egg + Manager.GetDamage().NewDamageEvent(event.GetDamageeEntity(), (LivingEntity) egg.getShooter(), egg, DamageCause.PROJECTILE, _damage, true, true, false, UtilEnt.getName((LivingEntity) egg .getShooter()), GetName()); UtilAction.zeroVelocity(event.GetDamageeEntity()); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/chicken/PerkFlap.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/chicken/PerkFlap.java index 6464c22d1..507104549 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/chicken/PerkFlap.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/chicken/PerkFlap.java @@ -21,19 +21,26 @@ public class PerkFlap extends SmashPerk { private static final float MAX_ENERGY = 0.999F; - private static final float ENERGY_PER_TICK = 0.03F; - private static final float ENERGY_PER_FLAP = 0.17F; - private static final int COOLDOWN = 80; - + + private int _cooldown; + private float _energyPerTick; + private float _energyPerFlap; private double _power; private boolean _control; - public PerkFlap(double power, double heightLimit, boolean control) + public PerkFlap() { super("Flap", new String[] { C.cYellow + "Tap Jump Twice" + C.cGray + " to " + C.cGreen + "Flap" }); + } - _power = power; - _control = control; + @Override + public void setupValues() + { + _cooldown = getPerkInt("Cooldown (ms)"); + _energyPerTick = getPerkFloat("Energy Per Tick"); + _energyPerFlap = getPerkFloat("Energy Per Flap"); + _power = getPerkDouble("Power"); + _control = getPerkBoolean("Control"); } @EventHandler @@ -78,12 +85,12 @@ public class PerkFlap extends SmashPerk player.getWorld().playSound(player.getLocation(), Sound.BAT_TAKEOFF, (float) (0.3 + player.getExp()), (float) (Math.random() / 2 + 1)); // Set Recharge - Recharge.Instance.use(player, GetName(), COOLDOWN, false, false); + Recharge.Instance.use(player, GetName(), _cooldown, false, false); // Energy if (!isSuperActive(player)) { - player.setExp(Math.max(0f, player.getExp() - ENERGY_PER_FLAP)); + player.setExp(Math.max(0f, player.getExp() - _energyPerFlap)); } } @@ -109,7 +116,7 @@ public class PerkFlap extends SmashPerk if (UtilEnt.isGrounded(player) || UtilBlock.solid(player.getLocation().subtract(0, 2, 0).getBlock())) { - player.setExp(Math.min(MAX_ENERGY, player.getExp() + ENERGY_PER_TICK)); + player.setExp(Math.min(MAX_ENERGY, player.getExp() + _energyPerTick)); player.setAllowFlight(true); } else if (Recharge.Instance.usable(player, GetName()) && player.getExp() > 0) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/chicken/SmashChicken.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/chicken/SmashChicken.java index 605499efc..baad365ac 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/chicken/SmashChicken.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/chicken/SmashChicken.java @@ -9,11 +9,9 @@ import nautilus.game.arcade.game.games.smash.perks.SmashUltimate; public class SmashChicken extends SmashUltimate { - private static final int DURATION = 20000; - public SmashChicken() { - super("Aerial Gunner", new String[] {}, Sound.CHICKEN_IDLE, DURATION); + super("Aerial Gunner", new String[] {}, Sound.CHICKEN_IDLE, 0); } /** diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/cow/PerkCowAngryHerd.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/cow/PerkCowAngryHerd.java index 18ea1df4e..b653ee985 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/cow/PerkCowAngryHerd.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/cow/PerkCowAngryHerd.java @@ -37,14 +37,14 @@ import nautilus.game.arcade.game.games.smash.perks.SmashPerk; public class PerkCowAngryHerd extends SmashPerk { - private static final int COOLDOWN_NORMAL = 13000; - private static final int COOLDOWN_SMASH = 6000; - private static final int MAX_TIME = 2500; - private static final int STUCK_TIME = 300; - private static final int FORCE_MOVE = 350; - private static final float HIT_BOX_RADIUS = 2.2F; - private static final int HIT_FREQUENCY = 600; - private static final int DAMAGE = 5; + private int _cooldownNormal; + private int _cooldownSmash; + private int _maxTime; + private int _stuckTime; + private int _forceMove; + private float _hitBoxRadius; + private int _hitFrequency; + private int _damage; private List _active = new ArrayList<>(); @@ -53,6 +53,19 @@ public class PerkCowAngryHerd extends SmashPerk super("Angry Herd", new String[] { C.cYellow + "Right-Click" + C.cGray + " with Axe to use " + C.cGreen + "Angry Herd" }); } + @Override + public void setupValues() + { + _cooldownNormal = getPerkTime("Cooldown Normal"); + _cooldownSmash = getPerkTime("Cooldown Smash"); + _maxTime = getPerkInt("Max Time (ms)"); + _stuckTime = getPerkInt("Stuck Time (ms)"); + _forceMove = getPerkInt("Force Move (ms)"); + _hitBoxRadius = getPerkFloat("Hit Box Radius"); + _hitFrequency = getPerkInt("Hit Frequency (ms)"); + _damage = getPerkInt("Damage"); + } + @EventHandler public void shoot(PlayerInteractEvent event) { @@ -83,7 +96,7 @@ public class PerkCowAngryHerd extends SmashPerk return; } - if (!Recharge.Instance.use(player, GetName(), isSuperActive(player) ? COOLDOWN_SMASH : COOLDOWN_NORMAL, true, true)) + if (!Recharge.Instance.use(player, GetName(), isSuperActive(player) ? _cooldownSmash : _cooldownNormal, true, true)) { return; } @@ -129,7 +142,7 @@ public class PerkCowAngryHerd extends SmashPerk DataCowCharge data = activeIter.next(); // Expire - if (UtilTime.elapsed(data.Time, MAX_TIME)) + if (UtilTime.elapsed(data.Time, _maxTime)) { if (data.Cow.isValid()) { @@ -149,7 +162,7 @@ public class PerkCowAngryHerd extends SmashPerk } // Stuck Remove - if (UtilTime.elapsed(data.LastMoveTime, STUCK_TIME)) + if (UtilTime.elapsed(data.LastMoveTime, _stuckTime)) { if (data.Cow.isValid()) { @@ -172,7 +185,7 @@ public class PerkCowAngryHerd extends SmashPerk } // Move - if (UtilTime.elapsed(data.LastMoveTime, FORCE_MOVE) && UtilEnt.isGrounded(data.Cow)) + if (UtilTime.elapsed(data.LastMoveTime, _forceMove) && UtilEnt.isGrounded(data.Cow)) { data.Cow.setVelocity(data.Direction.clone().add(new Vector(0, 0.75, 0))); } @@ -199,12 +212,12 @@ public class PerkCowAngryHerd extends SmashPerk continue; } - if (UtilMath.offset(player, data.Cow) < HIT_BOX_RADIUS) + if (UtilMath.offset(player, data.Cow) < _hitBoxRadius) { - if (Recharge.Instance.use(player, "Hit by " + data.Player.getName(), HIT_FREQUENCY, false, false)) + if (Recharge.Instance.use(player, "Hit by " + data.Player.getName(), _hitFrequency, false, false)) { // Damage Event - Manager.GetDamage().NewDamageEvent(player, data.Player, null, data.Cow.getLocation(), DamageCause.CUSTOM, DAMAGE, true, true, false, UtilEnt.getName(data.Player), GetName()); + Manager.GetDamage().NewDamageEvent(player, data.Player, null, data.Cow.getLocation(), DamageCause.CUSTOM, _damage, true, true, false, UtilEnt.getName(data.Player), GetName()); UtilParticle.PlayParticleToAll(ParticleType.LARGE_EXPLODE, data.Cow.getLocation().add(0, 1, 0), 1f, 1f, 1f, 0, 12, ViewDist.LONG); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/cow/PerkCowMilkSpiral.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/cow/PerkCowMilkSpiral.java index e909decf2..c373de9fb 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/cow/PerkCowMilkSpiral.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/cow/PerkCowMilkSpiral.java @@ -30,10 +30,10 @@ import nautilus.game.arcade.game.games.smash.perks.SmashPerk; public class PerkCowMilkSpiral extends SmashPerk { - private static final int COOLDOWN_NORMAL = 11000; - private static final int COOLDOWN_SMASH = 6000; - private static final int HIT_BOX_RADIUS = 2; - private static final int DAMAGE = 6; + private int _cooldownNormal; + private int _cooldownSmash; + private int _hitBoxRadius; + private int _damage; private Set _active = new HashSet<>(); @@ -42,6 +42,15 @@ public class PerkCowMilkSpiral extends SmashPerk super("Milk Spiral", new String[] { C.cYellow + "Right Click" + C.cGray + " with Spade to " + C.cGreen + "Milk Spiral", C.cGray + "Crouch to cancel movement for Milk Spiral" }); } + @Override + public void setupValues() + { + _cooldownNormal = getPerkTime("Cooldown Normal"); + _cooldownSmash = getPerkTime("Cooldown Smash"); + _hitBoxRadius = getPerkInt("Hit Box Radius"); + _damage = getPerkInt("Damage"); + } + @EventHandler public void activate(PlayerInteractEvent event) { @@ -72,7 +81,7 @@ public class PerkCowMilkSpiral extends SmashPerk return; } - if (!Recharge.Instance.use(player, GetName(), isSuperActive(player) ? COOLDOWN_SMASH : COOLDOWN_NORMAL, true, true)) + if (!Recharge.Instance.use(player, GetName(), isSuperActive(player) ? _cooldownSmash : _cooldownNormal, true, true)) { return; } @@ -104,14 +113,14 @@ public class PerkCowMilkSpiral extends SmashPerk for (Player player : Manager.GetGame().GetPlayers(true)) { - if (player.equals(data.Player)) + if (player.equals(data.Player) || !Recharge.Instance.use(player, GetName() + " Rate", 3000, false, false)) { continue; } - if (UtilMath.offset(player.getLocation().add(0, 1, 0), data.Spiral) < HIT_BOX_RADIUS) + if (UtilMath.offset(player.getLocation().add(0, 1, 0), data.Spiral) < _hitBoxRadius) { - Manager.GetDamage().NewDamageEvent(player, data.Player, null, DamageCause.CUSTOM, DAMAGE, true, false, false, player.getName(), GetName()); + Manager.GetDamage().NewDamageEvent(player, data.Player, null, DamageCause.CUSTOM, _damage, true, false, false, player.getName(), GetName()); UtilParticle.PlayParticle(isSuperActive(player) ? ParticleType.RED_DUST : ParticleType.FIREWORKS_SPARK, player.getLocation().add(0, 1, 0), 0.2f, 0.2f, 0.2f, 0.3f, 30, ViewDist.LONG, UtilServer.getPlayers()); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/cow/PerkCowStampede.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/cow/PerkCowStampede.java index 5b7a16647..b95f1d738 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/cow/PerkCowStampede.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/cow/PerkCowStampede.java @@ -30,6 +30,9 @@ import nautilus.game.arcade.game.games.smash.perks.SmashPerk; public class PerkCowStampede extends SmashPerk { + + private long _speedTime; + private Map _sprintTime = new HashMap<>(); private Map _sprintStr = new HashMap<>(); @@ -38,6 +41,12 @@ public class PerkCowStampede extends SmashPerk super("Stampede", new String[] { C.cGray + "Build up Speed Levels as you sprint.", C.cGray + "+1 damage for each Speed Level.", }); } + @Override + public void setupValues() + { + _speedTime = getPerkTime("Speed Time"); + } + @EventHandler public void update(UpdateEvent event) { @@ -77,7 +86,7 @@ public class PerkCowStampede extends SmashPerk } // Upgrade Speed - if (!UtilTime.elapsed(time, 3000)) + if (!UtilTime.elapsed(time, _speedTime)) { continue; } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/cow/SmashCow.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/cow/SmashCow.java index d3aaa527d..70da2c10e 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/cow/SmashCow.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/cow/SmashCow.java @@ -14,13 +14,21 @@ import nautilus.game.arcade.game.games.smash.perks.SmashUltimate; public class SmashCow extends SmashUltimate { - private static final int DURATION = 30000; - private static final int DAMAGE_BUFF = 1; - private static final int HEALTH = 30; + private int _damageBuff; + private int _health; public SmashCow() { - super("Mooshroom Madness", new String[] {}, Sound.COW_IDLE, DURATION); + super("Mooshroom Madness", new String[] {}, Sound.COW_IDLE, 0); + } + + @Override + public void setupValues() + { + super.setupValues(); + + _damageBuff = getPerkInt("Damage Buff"); + _health = getPerkInt("Health"); } @Override @@ -33,8 +41,8 @@ public class SmashCow extends SmashUltimate kit.disguise(player, DisguiseMooshroom.class); // Health - player.setMaxHealth(HEALTH); - player.setHealth(HEALTH); + player.setMaxHealth(_health); + player.setHealth(_health); // Sound player.getWorld().playSound(player.getLocation(), Sound.COW_HURT, 5f, 0.25f); @@ -67,7 +75,7 @@ public class SmashCow extends SmashUltimate if (isUsingUltimate(player)) { - event.AddMod(player.getName(), GetName(), DAMAGE_BUFF, false); + event.AddMod(player.getName(), GetName(), _damageBuff, false); } } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/creeper/PerkCreeperElectricity.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/creeper/PerkCreeperElectricity.java index a92cb53b5..476e3eca9 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/creeper/PerkCreeperElectricity.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/creeper/PerkCreeperElectricity.java @@ -25,10 +25,10 @@ import nautilus.game.arcade.kit.Perk; public class PerkCreeperElectricity extends Perk { - private static final int DURATION = 2000; - private static final int SHOCK = 1; - private static final int DAMAGE = 4; - private static final float KNOCKBACK_MAGNITUDE = 2.5F; + private int _duration; + private int _shock; + private int _damage; + private float _knockbackMagnitude; private Map _active = new HashMap<>(); @@ -37,6 +37,15 @@ public class PerkCreeperElectricity extends Perk super("Lightning Shield", new String[] { "When hit by a non-melee attack, you gain " + C.cGreen + "Lightning Shield" }); } + @Override + public void setupValues() + { + _duration = getPerkTime("Duration"); + _shock = getPerkInt("Shock"); + _damage = getPerkInt("Damage"); + _knockbackMagnitude = getPerkFloat("Knockback Magnitude"); + } + @EventHandler public void Shield(CustomDamageEvent event) { @@ -103,7 +112,7 @@ public class PerkCreeperElectricity extends Perk continue; } - if (UtilTime.elapsed(_active.get(key), DURATION)) + if (UtilTime.elapsed(_active.get(key), _duration)) { shieldIterator.remove(); @@ -152,12 +161,12 @@ public class PerkCreeperElectricity extends Perk // Elec damagee.getWorld().strikeLightningEffect(damagee.getLocation()); - Manager.GetCondition().Factory().Shock(GetName(), event.GetDamagerEntity(false), event.GetDamageeEntity(), SHOCK, false, false); + Manager.GetCondition().Factory().Shock(GetName(), event.GetDamagerEntity(false), event.GetDamageeEntity(), _shock, false, false); SetPowered(damagee, false); // Damage Event - Manager.GetDamage().NewDamageEvent(event.GetDamagerEntity(false), damagee, null, DamageCause.LIGHTNING, DAMAGE, true, true, false, damagee.getName(), GetName()); + Manager.GetDamage().NewDamageEvent(event.GetDamagerEntity(false), damagee, null, DamageCause.LIGHTNING, _damage, true, true, false, damagee.getName(), GetName()); } public DisguiseCreeper GetDisguise(Player player) @@ -211,6 +220,6 @@ public class PerkCreeperElectricity extends Perk return; } - event.AddKnockback(GetName(), KNOCKBACK_MAGNITUDE); + event.AddKnockback(GetName(), _knockbackMagnitude); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/creeper/PerkCreeperExplode.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/creeper/PerkCreeperExplode.java index e07b996fa..911b45a06 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/creeper/PerkCreeperExplode.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/creeper/PerkCreeperExplode.java @@ -1,36 +1,9 @@ package nautilus.game.arcade.game.games.smash.perks.creeper; -import java.util.Collection; -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map; -import java.util.UUID; - -import org.bukkit.Location; -import org.bukkit.Material; -import org.bukkit.Sound; -import org.bukkit.block.Block; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.entity.EntityDamageEvent.DamageCause; -import org.bukkit.event.player.PlayerInteractEvent; - -import mineplex.core.common.util.C; -import mineplex.core.common.util.F; -import mineplex.core.common.util.UtilAction; -import mineplex.core.common.util.UtilBlock; -import mineplex.core.common.util.UtilEnt; -import mineplex.core.common.util.UtilEvent; +import mineplex.core.common.util.*; import mineplex.core.common.util.UtilEvent.ActionType; -import mineplex.core.common.util.UtilItem; -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.UtilPlayer; -import mineplex.core.common.util.UtilServer; -import mineplex.core.common.util.UtilTime; import mineplex.core.disguise.disguises.DisguiseBase; import mineplex.core.disguise.disguises.DisguiseCreeper; import mineplex.core.recharge.Recharge; @@ -40,24 +13,56 @@ import mineplex.minecraft.game.core.combat.event.CombatDeathEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent; import nautilus.game.arcade.game.GameTeam; import nautilus.game.arcade.game.games.smash.perks.SmashPerk; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.block.Block; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.event.player.PlayerToggleSneakEvent; + +import java.util.*; public class PerkCreeperExplode extends SmashPerk { - private static final int COOLDOWN = 8000; - private static final int WARMUP = 1500; - private static final int RADIUS_NORMAL = 8; - private static final int RADIUS_SMASH = 24; - private static final int DAMAGE_NORMAL = 20; - private static final int DAMAGE_SMASH = 30; - private static final int SPAWN_REMOVAL_RADIUS = 14; - private static final float KNOCKBACK_MAGNITUDE = 2.5F; + private int _cooldown; + private int _warmup; + private int _radiusNormal; + private int _radiusSmash; + private int _damageNormal; + private int _damageSmash; + private double _damageReduction; + private int _spawnRemovalRadius; + private float _knockbackMagnitude; + private int _blockDestroyRadius; + private int _blockRegeneration; private Map _active = new HashMap<>(); + private Map _removedSpawns = new HashMap<>(); public PerkCreeperExplode() { - super("Explode", new String[] { C.cYellow + "Right-Click" + C.cGray + " with Shovel use " + C.cGreen + "Explosive Leap" }); + super("Explode", new String[]{C.cYellow + "Right-Click" + C.cGray + " with Shovel use " + C.cGreen + "Explosive Leap"}); + } + + @Override + public void setupValues() + { + _cooldown = getPerkTime("Cooldown"); + _warmup = getPerkInt("Warmup (ms)"); + _radiusNormal = getPerkInt("Radius Normal"); + _radiusSmash = getPerkInt("Radius Smash"); + _damageNormal = getPerkInt("Damage Normal"); + _damageSmash = getPerkInt("Damage Smash"); + _damageReduction = getPerkPercentage("Damage Reduction"); + _spawnRemovalRadius = (int) Math.pow(getPerkInt("Spawn Removal Radius"), 2); + _knockbackMagnitude = getPerkFloat("Knockback Magnitude"); + _blockDestroyRadius = getPerkInt("Block Destroy Radius"); + _blockRegeneration = getPerkTime("Block Regeneration Time"); } @EventHandler @@ -95,7 +100,7 @@ public class PerkCreeperExplode extends SmashPerk return; } - if (!Recharge.Instance.use(player, GetName(), COOLDOWN, true, true)) + if (!Recharge.Instance.use(player, GetName(), _cooldown, true, true)) { return; } @@ -134,18 +139,19 @@ public class PerkCreeperExplode extends SmashPerk UtilAction.zeroVelocity(player); // Sound - player.getWorld().playSound(player.getLocation(), Sound.CREEPER_HISS, (float) (0.5 + elapsed), (float) (0.5 + elapsed)); + float volume = (float) 0.5F + elapsed / 1000F; + player.getWorld().playSound(player.getLocation(), Sound.CREEPER_HISS, volume, volume); IncreaseSize(player); - player.setExp(Math.min(0.999f, elapsed / (float) WARMUP)); + player.setExp(Math.min(0.999f, elapsed / (float) _warmup)); // Not Detonated - if (!UtilTime.elapsed(_active.get(key), WARMUP)) + if (!UtilTime.elapsed(_active.get(key), _warmup)) { continue; } - + player.setExp(0); chargeIterator.remove(); @@ -172,29 +178,23 @@ public class PerkCreeperExplode extends SmashPerk } // Blocks - Collection blocks = UtilBlock.getInRadius(player.getLocation(), 12).keySet(); - Iterator iter = blocks.iterator(); + Collection blocks = UtilBlock.getInRadius(player.getLocation(), _blockDestroyRadius).keySet(); - while (iter.hasNext()) - { - Block b = iter.next(); + blocks.removeIf(b -> b.getType() == Material.STATIONARY_LAVA || b.getType() == Material.LAVA || b.getType() == Material.BEDROCK); - if (b.getType() == Material.STATIONARY_LAVA || b.getType() == Material.LAVA || b.getType() == Material.BEDROCK) - { - iter.remove(); - } - } Manager.GetExplosion().BlockExplosion(blocks, player.getLocation(), false); // Remove Spawns - Iterator spawnIterator = Manager.GetGame().GetTeam(player).GetSpawns().iterator(); - while (spawnIterator.hasNext()) - { - Location spawn = spawnIterator.next(); + Iterator iterator = Manager.GetGame().GetTeam(player).GetSpawns().iterator(); - if (UtilMath.offset(player.getLocation(), spawn) < SPAWN_REMOVAL_RADIUS) + while (iterator.hasNext()) + { + Location spawn = iterator.next(); + + if (UtilMath.offsetSquared(player.getLocation(), spawn) < _spawnRemovalRadius) { - spawnIterator.remove(); + _removedSpawns.put(spawn, System.currentTimeMillis()); + iterator.remove(); } } @@ -209,8 +209,8 @@ public class PerkCreeperExplode extends SmashPerk } } - double maxRange = isSuperActive(player) ? RADIUS_SMASH : RADIUS_NORMAL; - double damage = isSuperActive(player) ? DAMAGE_SMASH : DAMAGE_NORMAL; + double maxRange = isSuperActive(player) ? _radiusSmash : _radiusNormal; + double damage = isSuperActive(player) ? _damageSmash : _damageNormal; // Damage for (LivingEntity ent : UtilEnt.getInRadius(player.getLocation(), maxRange).keySet()) @@ -245,7 +245,22 @@ public class PerkCreeperExplode extends SmashPerk } } } - + + @EventHandler + public void toggleSneak(PlayerToggleSneakEvent event) + { + Player player = event.getPlayer(); + + if (!_active.containsKey(player.getUniqueId()) || isSuperActive(player)) + { + return; + } + + _active.remove(player.getUniqueId()); + DecreaseSize(player); + UtilPlayer.message(player, F.main("Skill", "You cancelled " + F.skill(GetName()) + ".")); + } + public void activate(Player player) { _active.put(player.getUniqueId(), System.currentTimeMillis()); @@ -316,7 +331,8 @@ public class PerkCreeperExplode extends SmashPerk return; } - event.AddKnockback(GetName(), KNOCKBACK_MAGNITUDE); + event.AddMod(GetName(), event.GetDamage() * -0.25); + event.AddKnockback(GetName(), _knockbackMagnitude); } @EventHandler @@ -338,4 +354,43 @@ public class PerkCreeperExplode extends SmashPerk DecreaseSize(player); } + + @EventHandler + public void damageReduction(CustomDamageEvent event) + { + Player player = event.GetDamageePlayer(); + + if (player == null) + { + return; + } + + if (_active.containsKey(player.getUniqueId())) + { + event.AddMod("Damage Reduction", -event.GetDamage() * _damageReduction); + } + } + + @EventHandler + public void addDestroyedSpawns(UpdateEvent event) + { + if (event.getType() != UpdateType.SLOW) + { + return; + } + + GameTeam team = Manager.GetGame().GetTeamList().get(0); + Iterator iterator = _removedSpawns.keySet().iterator(); + + while (iterator.hasNext()) + { + Location spawn = iterator.next(); + + if (UtilTime.elapsed(_removedSpawns.get(spawn), _blockRegeneration)) + { + team.GetSpawns().add(spawn); + iterator.remove(); + } + } + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/creeper/PerkCreeperSulphurBomb.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/creeper/PerkCreeperSulphurBomb.java index 111271be2..df921ff65 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/creeper/PerkCreeperSulphurBomb.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/creeper/PerkCreeperSulphurBomb.java @@ -1,5 +1,17 @@ package nautilus.game.arcade.game.games.smash.perks.creeper; +import mineplex.core.common.util.*; +import mineplex.core.common.util.UtilEvent.ActionType; +import mineplex.core.common.util.UtilParticle.ParticleType; +import mineplex.core.common.util.UtilParticle.ViewDist; +import mineplex.core.itemstack.ItemStackFactory; +import mineplex.core.projectile.IThrown; +import mineplex.core.projectile.ProjectileUser; +import mineplex.core.recharge.Recharge; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.game.games.smash.perks.SmashPerk; import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.block.Block; @@ -9,41 +21,110 @@ import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.entity.EntityDamageEvent.DamageCause; 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.UtilBlock; -import mineplex.core.common.util.UtilEnt; -import mineplex.core.common.util.UtilEvent; -import mineplex.core.common.util.UtilEvent.ActionType; -import mineplex.core.common.util.UtilInv; -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.itemstack.ItemStackFactory; -import mineplex.core.projectile.IThrown; -import mineplex.core.projectile.ProjectileUser; -import mineplex.core.recharge.Recharge; -import mineplex.core.updater.UpdateType; -import mineplex.minecraft.game.core.damage.CustomDamageEvent; -import nautilus.game.arcade.game.games.smash.perks.SmashPerk; +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; -public class PerkCreeperSulphurBomb extends SmashPerk implements IThrown +public class PerkCreeperSulphurBomb extends SmashPerk { - - private static final int COOLDOWN = 3000; - private static final float DAMAGE = 6.5F; - private static final float KNOCKBACK_MAGNITUDE = 2.5F; + + private static ItemStack POWDER = new ItemStack(Material.SULPHUR); + + private int _cooldown; + private float _damage; + private float _knockbackMagnitude; + private float _damagePowder; + + private final IThrown _sulphurThrown = new IThrown() + { + @Override + public void Collide(LivingEntity target, Block block, ProjectileUser data) + { + Explode(data); + + if (target == null) + { + return; + } + + // Damage Event + Manager.GetDamage().NewDamageEvent(target, data.getThrower(), null, DamageCause.PROJECTILE, _damage, true, true, false, UtilEnt.getName(data.getThrower()), GetName()); + } + + @Override + public void Idle(ProjectileUser data) + { + Explode(data); + } + + @Override + public void Expire(ProjectileUser data) + { + Explode(data); + } + + private void Explode(ProjectileUser data) + { + UtilParticle.PlayParticle(ParticleType.LARGE_EXPLODE, data.getThrown().getLocation(), 0, 0, 0, 0, 1, ViewDist.MAX, UtilServer.getPlayers()); + data.getThrown().getWorld().playSound(data.getThrown().getLocation(), Sound.EXPLODE, 1f, 1.5f); + data.getThrown().remove(); + } + }; + private final IThrown _powderThrown = new IThrown() + { + @Override + public void Collide(LivingEntity target, Block block, ProjectileUser data) + { + Explode(data); + + if (target == null) + { + return; + } + + // Damage Event + Manager.GetDamage().NewDamageEvent(target, data.getThrower(), null, DamageCause.PROJECTILE, _damagePowder, false, true, false, UtilEnt.getName(data.getThrower()), GetName()); + } + + @Override + public void Idle(ProjectileUser data) + { + Explode(data); + } + + @Override + public void Expire(ProjectileUser data) + { + Explode(data); + } + + private void Explode(ProjectileUser data) + { + UtilParticle.PlayParticleToAll(ParticleType.EXPLODE, data.getThrown().getLocation(), 0, 0, 0, 0, 1, ViewDist.LONG); + data.getThrown().getWorld().playSound(data.getThrown().getLocation(), Sound.EXPLODE, 1f, 2f); + data.getThrown().remove(); + _sulphur.remove(data.getThrower().getUniqueId()); + } + }; + + private Map _sulphur = new HashMap<>(); public PerkCreeperSulphurBomb() { super("Sulphur Bomb", new String[] { C.cYellow + "Right-Click" + C.cGray + " with Axe to use " + C.cGreen + "Sulphur Bomb" }); } + @Override + public void setupValues() + { + _cooldown = getPerkTime("Cooldown"); + _damage = getPerkFloat("Damage"); + _knockbackMagnitude = getPerkFloat("Knockback Magnitude"); + _damagePowder = getPerkFloat("Damage Powder"); + } + @EventHandler public void ShootWeb(PlayerInteractEvent event) { @@ -79,7 +160,7 @@ public class PerkCreeperSulphurBomb extends SmashPerk implements IThrown return; } - if (!Recharge.Instance.use(player, GetName(), COOLDOWN, true, true)) + if (!Recharge.Instance.use(player, GetName(), _cooldown, true, true)) { return; } @@ -90,9 +171,10 @@ public class PerkCreeperSulphurBomb extends SmashPerk implements IThrown Item ent = player.getWorld().dropItem(player.getEyeLocation(), ItemStackFactory.Instance.CreateStack(Material.COAL, (byte) 0)); - UtilAction.velocity(ent, player.getLocation().getDirection(), 1.2, false, 0, 0.2, 10, false); + _sulphur.put(player.getUniqueId(), ent); - Manager.GetProjectile().AddThrow(ent, player, this, -1, true, true, true, true, null, 1f, 1f, null, 1, UpdateType.SLOW, 0.6f); + UtilAction.velocity(ent, player.getLocation().getDirection(), 1.2, false, 0, 0.2, 10, false); + Manager.GetProjectile().AddThrow(ent, player, _sulphurThrown, -1, true, true, true, true, null, 1f, 1f, null, 1, UpdateType.SLOW, 0.6f); // Inform UtilPlayer.message(player, F.main("Game", "You used " + F.skill(GetName()) + ".")); @@ -101,37 +183,27 @@ public class PerkCreeperSulphurBomb extends SmashPerk implements IThrown player.getWorld().playSound(player.getLocation(), Sound.CREEPER_DEATH, 2f, 1.5f); } - @Override - public void Collide(LivingEntity target, Block block, ProjectileUser data) + @EventHandler + public void dropPowder(UpdateEvent event) { - Explode(data); - - if (target == null) + if (event.getType() != UpdateType.FASTER) { return; } - - // Damage Event - Manager.GetDamage().NewDamageEvent(target, data.getThrower(), null, DamageCause.PROJECTILE, DAMAGE, true, true, false, UtilEnt.getName(data.getThrower()), GetName()); - } - @Override - public void Idle(ProjectileUser data) - { - Explode(data); - } + for (Map.Entry entry : _sulphur.entrySet()) + { + Player player = UtilPlayer.searchExact(entry.getKey()); - @Override - public void Expire(ProjectileUser data) - { - Explode(data); - } + if (player == null) + { + continue; + } - public void Explode(ProjectileUser data) - { - UtilParticle.PlayParticle(ParticleType.LARGE_EXPLODE, data.getThrown().getLocation(), 0, 0, 0, 0, 1, ViewDist.MAX, UtilServer.getPlayers()); - data.getThrown().getWorld().playSound(data.getThrown().getLocation(), Sound.EXPLODE, 1f, 1.5f); - data.getThrown().remove(); + Item item = entry.getValue(); + Item powder = item.getWorld().dropItem(item.getLocation(), POWDER); + Manager.GetProjectile().AddThrow(powder, player, _powderThrown, -1, true, true, true, true, 1F); + } } @EventHandler @@ -142,6 +214,6 @@ public class PerkCreeperSulphurBomb extends SmashPerk implements IThrown return; } - event.AddKnockback(GetName(), KNOCKBACK_MAGNITUDE); + event.AddKnockback(GetName(), _knockbackMagnitude); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/creeper/SmashCreeper.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/creeper/SmashCreeper.java index b20752818..2792d9577 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/creeper/SmashCreeper.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/creeper/SmashCreeper.java @@ -11,7 +11,7 @@ public class SmashCreeper extends SmashUltimate public SmashCreeper() { - super("Atomic Blast", new String[] {}, Sound.CREEPER_HISS, 1600); + super("Atomic Blast", new String[] {}, Sound.CREEPER_HISS, 0); } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/enderman/PerkBlink.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/enderman/PerkBlink.java index c7f8c30ff..486149217 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/enderman/PerkBlink.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/enderman/PerkBlink.java @@ -24,12 +24,17 @@ import nautilus.game.arcade.game.games.smash.perks.SmashPerk; public class PerkBlink extends SmashPerk { - private static final float INCREMENTAITON = 0.2F; + private static final float INCREMENTATION = 0.2F; private String _name; private double _range; private int _recharge; + public PerkBlink(String name) + { + this(name, 0, 0); + } + public PerkBlink(String name, double range, int recharge) { super(name, new String[] { C.cYellow + "Right-Click" + C.cGray + " with Axe to " + C.cGreen + name }); @@ -39,6 +44,13 @@ public class PerkBlink extends SmashPerk _recharge = recharge; } + @Override + public void setupValues() + { + _range = getPerkDouble("Range"); + _recharge = getPerkTime("Cooldown"); + } + @EventHandler public void Blink(PlayerInteractEvent event) { @@ -79,7 +91,7 @@ public class PerkBlink extends SmashPerk return; } - LineParticle lineParticle = new LineParticle(player.getEyeLocation(), player.getLocation().getDirection(), INCREMENTAITON, _range, null, ParticleType.SMOKE, UtilServer.getPlayers()); + LineParticle lineParticle = new LineParticle(player.getEyeLocation(), player.getLocation().getDirection(), INCREMENTATION, _range, null, ParticleType.SMOKE, UtilServer.getPlayers()); while (!lineParticle.update()) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/enderman/PerkBlockToss.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/enderman/PerkBlockToss.java index afa59acd8..3e48a23da 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/enderman/PerkBlockToss.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/enderman/PerkBlockToss.java @@ -42,10 +42,11 @@ import nautilus.game.arcade.kit.perks.event.PerkBlockThrowEvent; public class PerkBlockToss extends SmashPerk implements IThrown { - private static final int COOLDOWN = 2000; - private static final int CHARGE_TIME = 1200; - private static final int DAMAGE = 9; - private static final float KNOCKBACK_MAGNITUDE = 2.5F; + private int _cooldown; + private int _chargeTime; + private int _damage; + private int _maxDamage; + private float _knockbackMagnitude; private Map _hold = new HashMap<>(); private Set _charged = new HashSet<>(); @@ -56,6 +57,16 @@ public class PerkBlockToss extends SmashPerk implements IThrown super("Block Toss", new String[] { C.cYellow + "Hold Block" + C.cGray + " to " + C.cGreen + "Grab Block", C.cYellow + "Release Block" + C.cGray + " to " + C.cGreen + "Throw Block" }); } + @Override + public void setupValues() + { + _cooldown = getPerkInt("Cooldown (ms)"); + _chargeTime = getPerkInt("Charge Time (ms)"); + _damage = getPerkInt("Damage"); + _maxDamage = getPerkInt("Max Damage"); + _knockbackMagnitude = getPerkFloat("Knockback Magnitude"); + } + @EventHandler public void Grab(PlayerInteractEvent event) { @@ -154,7 +165,7 @@ public class PerkBlockToss extends SmashPerk implements IThrown // Charged Tick if (!_charged.contains(key)) { - if (System.currentTimeMillis() - _hold.get(key).Time > CHARGE_TIME) + if (System.currentTimeMillis() - _hold.get(key).Time > _chargeTime) { _charged.add(key); player.getWorld().playEffect(player.getLocation(), Effect.CLICK1, 0); @@ -167,7 +178,7 @@ public class PerkBlockToss extends SmashPerk implements IThrown UUID key = cur.getUniqueId(); Recharge.Instance.recharge(cur, GetName()); - Recharge.Instance.use(cur, GetName(), COOLDOWN, false, true); + Recharge.Instance.use(cur, GetName(), _cooldown, false, true); BlockTossData data = _hold.remove(key); @@ -180,7 +191,7 @@ public class PerkBlockToss extends SmashPerk implements IThrown long charge = System.currentTimeMillis() - data.Time; // Throw - double mult = Math.min(1.4, 1.4 * ((double) charge / CHARGE_TIME)); + double mult = Math.min(1.4, 1.4 * ((double) charge / _chargeTime)); // Action UtilAction.velocity(block, cur.getLocation().getDirection(), mult, false, 0.2, 0, 1, true); @@ -201,7 +212,7 @@ public class PerkBlockToss extends SmashPerk implements IThrown } // Damage Event - Manager.GetDamage().NewDamageEvent(target, data.getThrower(), null, DamageCause.PROJECTILE, data.getThrown().getVelocity().length() * DAMAGE, true, true, false, UtilEnt.getName(data + Manager.GetDamage().NewDamageEvent(target, data.getThrower(), null, DamageCause.PROJECTILE, Math.min(_maxDamage, data.getThrown().getVelocity().length() * _damage), true, true, false, UtilEnt.getName(data .getThrower()), GetName()); // Block to Item @@ -260,6 +271,6 @@ public class PerkBlockToss extends SmashPerk implements IThrown return; } - event.AddKnockback(GetName(), KNOCKBACK_MAGNITUDE); + event.AddKnockback(GetName(), _knockbackMagnitude); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/enderman/PerkEndermanTeleport.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/enderman/PerkEndermanTeleport.java index 5fcc81787..c8a116dee 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/enderman/PerkEndermanTeleport.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/enderman/PerkEndermanTeleport.java @@ -28,8 +28,8 @@ import nautilus.game.arcade.game.games.smash.perks.SmashPerk; public class PerkEndermanTeleport extends SmashPerk { - private static final int COOLDOWN = 5000; - private static final float CHARGE_PER_TICK = 0.015F; + private int _cooldown = 5000; + private float _chargeTick = 0.015F; private Map _target = new HashMap<>(); private Map _charge = new HashMap<>(); @@ -39,6 +39,13 @@ public class PerkEndermanTeleport extends SmashPerk super("Teleport", new String[] { C.cYellow + "Hold Sneak" + C.cGray + " to " + C.cGreen + "Teleport" }); } + @Override + public void setupValues() + { + _cooldown = getPerkTime("Cooldown"); + _chargeTick = getPerkFloat("Charge Per Tick"); + } + @EventHandler public void update(UpdateEvent event) { @@ -86,14 +93,14 @@ public class PerkEndermanTeleport extends SmashPerk // Same Block - Increase Charge else if (block.equals(_target.get(key))) { - _charge.put(key, _charge.get(key) + CHARGE_PER_TICK); + _charge.put(key, _charge.get(key) + _chargeTick); UtilTextMiddle.display(null, UtilTextMiddle.progress(_charge.get(key)), 0, 10, 10, player); if (_charge.get(key) >= 1) { UtilTextMiddle.display(null, C.cGreen + "Teleported", 0, 10, 10, player); - Recharge.Instance.useForce(player, GetName(), COOLDOWN); + Recharge.Instance.useForce(player, GetName(), _cooldown); while (block.getRelative(BlockFace.UP).getType() != Material.AIR) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/enderman/SmashEnderman.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/enderman/SmashEnderman.java index ec4d33f6b..8f99fed1b 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/enderman/SmashEnderman.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/enderman/SmashEnderman.java @@ -33,18 +33,29 @@ import nautilus.game.arcade.game.games.smash.perks.SmashUltimate; public class SmashEnderman extends SmashUltimate { - private static final int DURATION = 30000; - private static final int DRAGON_VELOCITY_MAGNITUDE = 40; - private static final int HIT_COOLDOWN = 1000; - private static final int DAMAGE_RADIUS = 6; - private static final int DAMAGE = 20; - private static final int KNOCKBACK_MAGNITUDE = 4; + private int _dragonVelocity; + private int _hitCooldown; + private int _damageRadius; + private int _damage; + private int _knockbackMagnitude; private Map _dragons = new HashMap<>(); public SmashEnderman() { - super("Ender Dragon", new String[] {}, Sound.ENDERDRAGON_GROWL, DURATION); + super("Ender Dragon", new String[] {}, Sound.ENDERDRAGON_GROWL, 0); + } + + @Override + public void setupValues() + { + super.setupValues(); + + _dragonVelocity = getPerkInt("Dragon Velocity"); + _hitCooldown = getPerkTime("Hit Cooldown"); + _damageRadius = getPerkInt("Damage Radius"); + _damage = getPerkInt("Damage"); + _knockbackMagnitude = getPerkInt("Knockback Magnitude"); } @Override @@ -105,7 +116,7 @@ public class SmashEnderman extends SmashUltimate } // Move - Location target = player.getLocation().add(player.getLocation().getDirection().multiply(DRAGON_VELOCITY_MAGNITUDE)); + Location target = player.getLocation().add(player.getLocation().getDirection().multiply(_dragonVelocity)); ((CraftEnderDragon) dragon).getHandle().setTargetBlock(target.getBlockX(), target.getBlockY(), target.getBlockZ()); } } @@ -179,10 +190,10 @@ public class SmashEnderman extends SmashUltimate continue; } - if (UtilMath.offset(dragon.getLocation().add(0, 4, 0), other.getLocation()) < DAMAGE_RADIUS && Recharge.Instance.use(other, "Hit By Dragon", HIT_COOLDOWN, false, false)) + if (UtilMath.offset(dragon.getLocation().add(0, 4, 0), other.getLocation()) < _damageRadius && Recharge.Instance.use(other, "Hit By Dragon", _hitCooldown, false, false)) { // Damage Event - Manager.GetDamage().NewDamageEvent(other, player, null, DamageCause.CUSTOM, DAMAGE, true, true, false, player.getName(), GetName()); + Manager.GetDamage().NewDamageEvent(other, player, null, DamageCause.CUSTOM, _damage, true, true, false, player.getName(), GetName()); } } } @@ -196,7 +207,7 @@ public class SmashEnderman extends SmashUltimate return; } - event.AddKnockback(GetName(), KNOCKBACK_MAGNITUDE); + event.AddKnockback(GetName(), _knockbackMagnitude); } @EventHandler(priority = EventPriority.LOW) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/golem/PerkFissure.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/golem/PerkFissure.java index ad8cd2688..e625809ba 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/golem/PerkFissure.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/golem/PerkFissure.java @@ -24,7 +24,7 @@ import nautilus.game.arcade.kit.perks.data.FissureData; public class PerkFissure extends Perk { - private static final int COOLDOWN = 8000; + private int _cooldown; private Set _active = new HashSet<>(); @@ -33,6 +33,12 @@ public class PerkFissure extends Perk super("Fissure", new String[] { C.cYellow + "Right-Click" + C.cGray + " with Axe to " + C.cGreen + "Fissure" }); } + @Override + public void setupValues() + { + _cooldown = getPerkTime("Cooldown"); + } + @EventHandler public void Leap(PlayerInteractEvent event) { @@ -69,7 +75,7 @@ public class PerkFissure extends Perk return; } - if (!Recharge.Instance.use(player, GetName(), COOLDOWN, true, true)) + if (!Recharge.Instance.use(player, GetName(), _cooldown, true, true)) { return; } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/golem/SmashGolem.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/golem/SmashGolem.java index a92739364..0cfd4b163 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/golem/SmashGolem.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/golem/SmashGolem.java @@ -25,14 +25,23 @@ import nautilus.game.arcade.game.games.smash.perks.SmashUltimate; public class SmashGolem extends SmashUltimate { - private static final int DURATION = 16000; - private static final int HIT_FREQUENCY = 400; - private static final int DAMAGE_RADIUS = 2; - private static final int EFFECT_RADIUS = 5; + private int _hitFrequency; + private int _damageRadius; + private int _effectRadius; public SmashGolem() { - super("Earthquake", new String[] {}, Sound.IRONGOLEM_HIT, DURATION); + super("Earthquake", new String[] {}, Sound.IRONGOLEM_HIT, 0); + } + + @Override + public void setupValues() + { + super.setupValues(); + + _hitFrequency = getPerkInt("Hit Frequency (ms)"); + _damageRadius = getPerkInt("Damage Radius"); + _effectRadius = getPerkInt("Effect Radius"); } @Override @@ -71,7 +80,7 @@ public class SmashGolem extends SmashUltimate boolean grounded = false; - for (Block block : UtilBlock.getInRadius(other.getLocation(), DAMAGE_RADIUS).keySet()) + for (Block block : UtilBlock.getInRadius(other.getLocation(), _damageRadius).keySet()) { if (block.getType() != Material.AIR) { @@ -89,13 +98,13 @@ public class SmashGolem extends SmashUltimate Manager.GetDamage().NewDamageEvent(other, player, null, DamageCause.CUSTOM, 1 + 2 * Math.random(), false, false, false, other.getName(), GetName()); // Velocity - if (Recharge.Instance.use(other, GetName() + " Hit", HIT_FREQUENCY, false, false)) + if (Recharge.Instance.use(other, GetName() + " Hit", _hitFrequency, false, false)) { UtilAction.velocity(other, new Vector(Math.random() - 0.5, Math.random() * 0.2, Math.random() - 0.5), Math.random() * 1 + 1, false, 0, 0.1 + Math.random() * 0.2, 2, true); } // Effect - for (Block block : UtilBlock.getInRadius(other.getLocation(), EFFECT_RADIUS).keySet()) + for (Block block : UtilBlock.getInRadius(other.getLocation(), _effectRadius).keySet()) { if (Math.random() < 0.98) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/PerkTargetLazer.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/PerkTargetLazer.java index b90cdfd24..3930d138f 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/PerkTargetLazer.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/PerkTargetLazer.java @@ -37,11 +37,11 @@ import nautilus.game.arcade.game.games.smash.perks.SmashPerk; public class PerkTargetLazer extends SmashPerk { - private static final int COOLDOWN = 15000; - private static final int MAX_RANGE = 11; - private static final int MAX_TIME = 8000; - private static final int DAMAGE_INCREASE = 3; - private static final int KNOCKBACK_INCREASE = 1; + private int _cooldown; + private int _maxRange; + private int _maxTime; + private int _damageIncrease; + private int _knockbackIncrease; private Set _data = new HashSet<>(); @@ -49,7 +49,17 @@ public class PerkTargetLazer extends SmashPerk { super("Target Laser", new String[] { C.cYellow + "Right-Click" + C.cGray + " with Pickaxe to use " + C.cGreen + "Target Laser" }); } - + + @Override + public void setupValues() + { + _cooldown = getPerkTime("Cooldown"); + _maxRange = getPerkInt("Max Range"); + _maxTime = getPerkTime("Max Time"); + _damageIncrease = getPerkInt("Damage Increase"); + _knockbackIncrease = getPerkInt("Knockback Increase"); + } + @EventHandler public void activate(PlayerInteractEvent event) { @@ -103,7 +113,7 @@ public class PerkTargetLazer extends SmashPerk double d = UtilMath.offset(player, other); - if (d > MAX_RANGE) + if (d > _maxRange) { continue; } @@ -121,7 +131,7 @@ public class PerkTargetLazer extends SmashPerk { if (data.getAttacker().equals(player)) { - if (data.getTimeElapsed() < MAX_TIME) + if (data.getTimeElapsed() < _maxTime) { return; } @@ -180,7 +190,7 @@ public class PerkTargetLazer extends SmashPerk UtilParticle.PlayParticle(ParticleType.MAGIC_CRIT, data.getTarget().getLocation().add(0, 0.5, 0.5), 1F, 0.5F, 1F, 0.1F, 10, ViewDist.LONG, data.getAttacker()); - if (UtilMath.offset(data.getTarget(), data.getAttacker()) > MAX_RANGE || data.getTimeElapsed() > MAX_TIME) + if (UtilMath.offset(data.getTarget(), data.getAttacker()) > _maxRange || data.getTimeElapsed() > _maxTime) { long time = data.getTimeElapsed() / 1000; double damage = 0.5 * time; @@ -192,7 +202,7 @@ public class PerkTargetLazer extends SmashPerk data.getAttacker().sendMessage(F.main("Game", "Your laser broke, dealing damage to " + F.name(data.getTarget().getName())) + "."); Manager.GetDamage().NewDamageEvent(data.getTarget(), data.getAttacker(), null, DamageCause.CUSTOM, damage, false, true, false, data.getAttacker().getName(), GetName()); - Recharge.Instance.use(data.getAttacker(), GetName(), COOLDOWN, true, true); + Recharge.Instance.use(data.getAttacker(), GetName(), _cooldown, true, true); iterator.remove(); } @@ -219,8 +229,8 @@ public class PerkTargetLazer extends SmashPerk if (data.getAttacker().equals(damager) && data.getTarget().equals(damagee)) { - event.AddMod(GetName(), DAMAGE_INCREASE); - event.AddKnockback(GetName(), KNOCKBACK_INCREASE); + event.AddMod(GetName(), _damageIncrease); + event.AddKnockback(GetName(), _knockbackIncrease); data.getAttacker().playEffect(damagee.getLocation().add(0, 0.5, 0), Effect.STEP_SOUND, Material.REDSTONE_BLOCK); } } @@ -230,18 +240,8 @@ public class PerkTargetLazer extends SmashPerk public void death(PlayerDeathEvent event) { Player player = event.getEntity(); - - Iterator iterator = _data.iterator(); - - while (iterator.hasNext()) - { - TargetLazerData data = iterator.next(); - - if (data.getTarget().equals(player) || data.getAttacker().equals(player)) - { - iterator.remove(); - } - } + + _data.removeIf(data -> data.getTarget().equals(player) || data.getAttacker().equals(player)); } private void setLazerTarget(Player disguised, Player target) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/PerkThorns.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/PerkThorns.java index 4e1e99010..a590a3f83 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/PerkThorns.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/PerkThorns.java @@ -13,15 +13,23 @@ import nautilus.game.arcade.kit.Perk; public class PerkThorns extends Perk { - private static final int MAX_HEALTH = 10; - private static final float DAMAGE_DECREASE = 0.66F; - private static final float KNOCKBACK_DECREASE = 0.66F; + private int _maxHealth; + private double _damageDecrease; + private double _knockbackDecrease; public PerkThorns() { super("Thorns", new String[] { C.cGray + "Takes 66% less damage and knockback from projectiles", C.cGray + "when under 10 health."}); } + @Override + public void setupValues() + { + _maxHealth = getPerkInt("Max Health"); + _damageDecrease = getPerkPercentage("Damage Decrease"); + _knockbackDecrease = getPerkPercentage("Knockback Decrease"); + } + @EventHandler(priority = EventPriority.HIGHEST) public void damage(CustomDamageEvent event) { @@ -38,10 +46,10 @@ public class PerkThorns extends Perk return; } - if (player.getHealth() < MAX_HEALTH) + if (player.getHealth() < _maxHealth) { - event.AddMult(GetName(), null, DAMAGE_DECREASE, false); - event.AddKnockback(GetName(), KNOCKBACK_DECREASE); + event.AddMult(GetName(), null, _damageDecrease, false); + event.AddKnockback(GetName(), _knockbackDecrease); } } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/PerkWaterSplash.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/PerkWaterSplash.java index 653344a77..c233cebf0 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/PerkWaterSplash.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/PerkWaterSplash.java @@ -1,13 +1,15 @@ package nautilus.game.arcade.game.games.smash.perks.guardian; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.UUID; - +import mineplex.core.common.util.*; +import mineplex.core.common.util.UtilEvent.ActionType; +import mineplex.core.common.util.UtilParticle.ParticleType; +import mineplex.core.common.util.UtilParticle.ViewDist; +import mineplex.core.recharge.Recharge; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.game.games.smash.TeamSuperSmash; +import nautilus.game.arcade.kit.Perk; import org.bukkit.Effect; import org.bukkit.Sound; import org.bukkit.block.Block; @@ -17,36 +19,18 @@ import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.util.Vector; -import mineplex.core.common.util.C; -import mineplex.core.common.util.UtilAction; -import mineplex.core.common.util.UtilAlg; -import mineplex.core.common.util.UtilBlock; -import mineplex.core.common.util.UtilEnt; -import mineplex.core.common.util.UtilEvent; -import mineplex.core.common.util.UtilEvent.ActionType; -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.UtilTime; -import mineplex.core.recharge.Recharge; -import mineplex.core.updater.UpdateType; -import mineplex.core.updater.event.UpdateEvent; -import mineplex.minecraft.game.core.damage.CustomDamageEvent; - -import nautilus.game.arcade.game.games.smash.TeamSuperSmash; -import nautilus.game.arcade.kit.Perk; +import java.util.*; public class PerkWaterSplash extends Perk { - private static final int COOLDOWN = 12000; - private static final int VELOCITY_Y = 1; - private static final int RADIUS = 5; - private static final int MIN_AIR_TIME = 750; - private static final int SECOND_BOOST_TIME = 800; - private static final int DAMAGE = 12; + private int _cooldown; + private float _velocityY; + private int _radius; + private int _minAirTime; + private int _secondBoostTime; + private float _secondBoostVelocity; + private int _damage; private Map _active = new HashMap<>(); private Set _usedSecondBoost = new HashSet<>(); @@ -55,7 +39,19 @@ public class PerkWaterSplash extends Perk { super("Water Splash", new String[] { C.cYellow + "Right-Click" + C.cGray + " with Sword to use " + C.cGreen + "Water Splash", C.cYellow + "Hold Block" + C.cGray + " to " + C.cGreen + "Bounce higher with Water Splash" }); } - + + @Override + public void setupValues() + { + _cooldown = getPerkTime("Cooldown"); + _velocityY = getPerkFloat("Y Velocity"); + _radius = getPerkInt("Radius"); + _minAirTime = getPerkInt("Min Air Time (ms)"); + _secondBoostTime = getPerkInt("Second Boost Time (ms)"); + _secondBoostVelocity = getPerkFloat("Second Boost Velocity"); + _damage = getPerkInt("Damage"); + } + @EventHandler public void activate(PlayerInteractEvent event) { @@ -86,16 +82,16 @@ public class PerkWaterSplash extends Perk return; } - if (!Recharge.Instance.use(player, GetName(), COOLDOWN, true, true)) + if (!Recharge.Instance.use(player, GetName(), _cooldown, true, true)) { return; } - UtilAction.velocity(player, new Vector(0, VELOCITY_Y, 0)); + UtilAction.velocity(player, new Vector(0, _velocityY, 0)); _active.put(player.getUniqueId(), System.currentTimeMillis()); List team = TeamSuperSmash.getTeam(Manager, player, true); - for (Player other : UtilPlayer.getNearby(player.getLocation(), RADIUS)) + for (Player other : UtilPlayer.getNearby(player.getLocation(), _radius)) { if (team.contains(other)) { @@ -144,14 +140,14 @@ public class PerkWaterSplash extends Perk UtilParticle.PlayParticleToAll(ParticleType.DRIP_WATER, player.getLocation(), 0.5F, 0.5F, 0.5F, 0.01F, 10, ViewDist.LONG); - if (UtilEnt.isGrounded(player) && UtilTime.elapsed(_active.get(uuid), MIN_AIR_TIME)) + if (UtilEnt.isGrounded(player) && UtilTime.elapsed(_active.get(uuid), _minAirTime)) { iterator.remove(); _usedSecondBoost.remove(uuid); UtilParticle.PlayParticleToAll(ParticleType.FIREWORKS_SPARK, player.getEyeLocation(), 0, 0, 0, 0.5F, 50, ViewDist.LONG); - for (Block block : UtilBlock.getInRadius(player.getLocation(), RADIUS).keySet()) + for (Block block : UtilBlock.getInRadius(player.getLocation(), _radius).keySet()) { if (Math.random() > 0.5) { @@ -163,7 +159,7 @@ public class PerkWaterSplash extends Perk player.getWorld().playSound(player.getLocation(), Sound.SPLASH2, 2, 0); - Map nearby = UtilPlayer.getInRadius(player.getLocation(), RADIUS); + Map nearby = UtilPlayer.getInRadius(player.getLocation(), _radius); List team = TeamSuperSmash.getTeam(Manager, player, true); for (Player other : nearby.keySet()) @@ -175,15 +171,15 @@ public class PerkWaterSplash extends Perk double power = nearby.get(other); - Manager.GetDamage().NewDamageEvent(other, player, null, DamageCause.CUSTOM, DAMAGE * power, true, true, false, player.getName(), GetName()); - Manager.GetCondition().Factory().Falling(GetName(), other, player, DAMAGE, false, true); + Manager.GetDamage().NewDamageEvent(other, player, null, DamageCause.CUSTOM, _damage * power, true, true, false, player.getName(), GetName()); + Manager.GetCondition().Factory().Falling(GetName(), other, player, _damage, false, true); } } - else if (UtilTime.elapsed(_active.get(uuid), SECOND_BOOST_TIME) && !_usedSecondBoost.contains(uuid) && player.isBlocking()) + else if (UtilTime.elapsed(_active.get(uuid), _secondBoostTime) && !_usedSecondBoost.contains(uuid) && player.isBlocking()) { _usedSecondBoost.add(uuid); - Vector direction = player.getLocation().getDirection().setY(0.2); + Vector direction = player.getLocation().getDirection().multiply(_secondBoostVelocity); UtilAction.velocity(player, direction); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/PerkWhirlpoolBlade.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/PerkWhirlpoolBlade.java index e738a721a..337655ec7 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/PerkWhirlpoolBlade.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/PerkWhirlpoolBlade.java @@ -37,11 +37,11 @@ import nautilus.game.arcade.kit.Perk; public class PerkWhirlpoolBlade extends Perk implements IThrown { - private static final int COOLDOWN = 5000; - private static final int EXPIRE_TIME = 3000; - private static final float VELOCITY = 1.6F; - private static final float HIT_BOX = 0.5F; - private static final int DAMAGE = 5; + private int _cooldown; + private int _expireTime; + private float _velocity; + private float _hitBox; + private int _damage; private Set _items = new HashSet<>(); @@ -49,7 +49,17 @@ public class PerkWhirlpoolBlade extends Perk implements IThrown { super("Whirlpool Axe", new String[] { C.cYellow + "Right-Click" + C.cGray + " with Axe to use " + C.cGreen + "Whirlpool Axe" }); } - + + @Override + public void setupValues() + { + _cooldown = getPerkTime("Cooldown"); + _expireTime = getPerkTime("Expire Time"); + _velocity = getPerkFloat("Velocity"); + _hitBox = getPerkFloat("Hit Box"); + _damage = getPerkInt("Damage"); + } + @EventHandler public void activate(PlayerInteractEvent event) { @@ -80,7 +90,7 @@ public class PerkWhirlpoolBlade extends Perk implements IThrown return; } - if (!Recharge.Instance.use(player, GetName(), COOLDOWN, true, true)) + if (!Recharge.Instance.use(player, GetName(), _cooldown, true, true)) { return; } @@ -89,8 +99,8 @@ public class PerkWhirlpoolBlade extends Perk implements IThrown Item item = player.getWorld().dropItem(player.getEyeLocation(), new ItemStack(Material.PRISMARINE_SHARD)); - item.setVelocity(player.getLocation().getDirection().multiply(VELOCITY)); - Manager.GetProjectile().AddThrow(item, player, this, EXPIRE_TIME, true, true, true, false, false, HIT_BOX); + item.setVelocity(player.getLocation().getDirection().multiply(_velocity)); + Manager.GetProjectile().AddThrow(item, player, this, _expireTime, true, true, true, false, false, _hitBox); _items.add(item); } @@ -131,7 +141,7 @@ public class PerkWhirlpoolBlade extends Perk implements IThrown return; } - CustomDamageEvent event = Manager.GetDamage().NewDamageEvent(target, data.getThrower(), null, DamageCause.CUSTOM, DAMAGE, false, true, true, data.getThrower().getName(), GetName()); + CustomDamageEvent event = Manager.GetDamage().NewDamageEvent(target, data.getThrower(), null, DamageCause.CUSTOM, _damage, false, true, true, data.getThrower().getName(), GetName()); if(event.IsCancelled()) { return; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/SmashAnimationData.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/SmashAnimationData.java index e891ca5cf..1e5a8d420 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/SmashAnimationData.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/SmashAnimationData.java @@ -98,7 +98,7 @@ public class SmashAnimationData { _ticks++; - if (_ticks % 10 == 0) + if (_ticks % 5 == 0) { _blockRadius++; @@ -133,13 +133,13 @@ public class SmashAnimationData } LineParticle lineParticle = new LineParticle(player.getEyeLocation(), _target.getEyeLocation(), vector, 0.2, offset, null, ParticleType.WITCH_MAGIC, UtilServer.getPlayers()); - + while (!lineParticle.update()) { } player.getWorld().playSound(player.getLocation(), Sound.ZOMBIE_REMEDY, 1, 0.75F); - UtilAction.velocity(player, vector.setY(player.getLocation().getY() - 3 > _target.getLocation().getY() ? 0 : 0.5).multiply(0.5)); + UtilAction.velocity(player, vector.setY(player.getLocation().getY() - 3 > _target.getLocation().getY() ? 0 : 0.5).multiply(0.7)); _manager.GetDamage().NewDamageEvent(player, _player, null, DamageCause.CUSTOM, VELOCITY_DAMAGE, false, true, false, _player.getName(), "Mini Guardian"); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/SmashGuardian.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/SmashGuardian.java index 78e133ba2..952490cf2 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/SmashGuardian.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/SmashGuardian.java @@ -27,16 +27,25 @@ import nautilus.game.arcade.game.games.smash.perks.SmashUltimate; public class SmashGuardian extends SmashUltimate { - private static final int DURATION = 10000; private static final int GUARDIANS = 4; - private static final int RADIUS = 15; - private static final int DAMAGE = 40; + + private int _radius; + private int _damage; private Set _data = new HashSet<>(); public SmashGuardian() { - super("Rise of the Guardian", new String[] {}, Sound.AMBIENCE_THUNDER, DURATION); + super("Rise of the Guardian", new String[] {}, Sound.AMBIENCE_THUNDER, 0); + } + + @Override + public void setupValues() + { + super.setupValues(); + + _radius = getPerkInt("Radius"); + _damage = getPerkInt("Damage"); } @Override @@ -46,7 +55,7 @@ public class SmashGuardian extends SmashUltimate Manager.GetGame().CreatureAllowOverride = true; - _data.add(new SmashAnimationData(Manager, player, GUARDIANS, DURATION)); + _data.add(new SmashAnimationData(Manager, player, GUARDIANS, getLength())); Manager.GetGame().CreatureAllowOverride = false; } @@ -64,7 +73,7 @@ public class SmashGuardian extends SmashUltimate if (data.getPlayer().equals(player)) { - Map inRadius = UtilPlayer.getInRadius(data.getTarget().getLocation(), RADIUS); + Map inRadius = UtilPlayer.getInRadius(data.getTarget().getLocation(), _radius); List team = TeamSuperSmash.getTeam(Manager, player, true); for (Player other : inRadius.keySet()) { @@ -73,11 +82,11 @@ public class SmashGuardian extends SmashUltimate continue; } - Manager.GetDamage().NewDamageEvent(other, player, null, DamageCause.CUSTOM, DAMAGE * inRadius.get(other), true, true, false, player.getName(), GetName()); + Manager.GetDamage().NewDamageEvent(other, player, null, DamageCause.CUSTOM, _damage * inRadius.get(other), true, true, false, player.getName(), GetName()); } data.getTarget().getWorld().strikeLightningEffect(data.getTarget().getLocation()); - UtilParticle.PlayParticleToAll(ParticleType.HUGE_EXPLOSION, data.getTarget().getLocation().add(0, 2, 0), RADIUS, 1, RADIUS, 1F, 30, ViewDist.MAX); + UtilParticle.PlayParticleToAll(ParticleType.HUGE_EXPLOSION, data.getTarget().getLocation().add(0, 2, 0), _radius, 1, _radius, 1F, 30, ViewDist.MAX); player.getWorld().playSound(data.getTarget().getLocation(), Sound.EXPLODE, 5, 0.5F); data.getElder().remove(); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/magmacube/PerkFlameDash.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/magmacube/PerkFlameDash.java index f8030aaeb..45fe2b378 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/magmacube/PerkFlameDash.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/magmacube/PerkFlameDash.java @@ -35,10 +35,10 @@ import nautilus.game.arcade.kit.perks.data.FireflyData; public class PerkFlameDash extends Perk { - private static final int COOLDOWN = 8000; - private static final int TIME = 800; - private static final int DAMAGE_RADIUS = 3; - private static final int KNOCKBACK_MAGNITUDE = 2; + private int _cooldown; + private int _time; + private int _damageRadius; + private int _knockbackMagnitude; private Set _data = new HashSet(); @@ -47,6 +47,15 @@ public class PerkFlameDash extends Perk super("Flame Dash", new String[] { C.cYellow + "Right-Click" + C.cGray + " with Spade to use " + C.cGreen + "Flame Dash" }); } + @Override + public void setupValues() + { + _cooldown = getPerkTime("Cooldown"); + _time = getPerkInt("Time (ms)"); + _damageRadius = getPerkInt("Damage Radius"); + _knockbackMagnitude = getPerkInt("Knockback Magnitude"); + } + @EventHandler public void Skill(PlayerInteractEvent event) { @@ -96,14 +105,14 @@ public class PerkFlameDash extends Perk } else { - Recharge.Instance.use(player, GetName(), COOLDOWN, true, true); + Recharge.Instance.use(player, GetName(), _cooldown, true, true); } return; } Recharge.Instance.recharge(player, GetName()); - Recharge.Instance.use(player, GetName(), COOLDOWN, true, true); + Recharge.Instance.use(player, GetName(), _cooldown, true, true); _data.add(new FireflyData(player)); @@ -130,7 +139,7 @@ public class PerkFlameDash extends Perk FireflyData data = dataIterator.next(); // Move - if (!UtilTime.elapsed(data.Time, TIME)) + if (!UtilTime.elapsed(data.Time, _time)) { Vector vel = data.Location.getDirection(); vel.setY(0); @@ -148,7 +157,7 @@ public class PerkFlameDash extends Perk // End else { - for (Player other : UtilPlayer.getNearby(data.Player.getLocation(), DAMAGE_RADIUS)) + for (Player other : UtilPlayer.getNearby(data.Player.getLocation(), _damageRadius)) { if (other.equals(data.Player)) { @@ -191,6 +200,6 @@ public class PerkFlameDash extends Perk return; } - event.AddKnockback(GetName(), KNOCKBACK_MAGNITUDE); + event.AddKnockback(GetName(), _knockbackMagnitude); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/magmacube/PerkMagmaBlast.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/magmacube/PerkMagmaBlast.java index 036734ecd..a5ea688f4 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/magmacube/PerkMagmaBlast.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/magmacube/PerkMagmaBlast.java @@ -43,13 +43,12 @@ import nautilus.game.arcade.kit.Perk; public class PerkMagmaBlast extends Perk { - private static final int COOLDOWN = 6000; - private static final float FIREBALL_VELOCITY = 0.2F; - private static final int FIRE_TICKS = 40; - private static final int VELOCITY_RADIUS = 8; - private static final int FIRE_RADIUS = 2; - private static final int DAMAGE = 8; - + private int _cooldown; + private float _velocity; + private int _fireTicks; + private int _velocityRadius; + private int _fireRadius; + private int _damage; private Map _proj = new HashMap<>(); @@ -58,6 +57,17 @@ public class PerkMagmaBlast extends Perk super("Magma Blast", new String[] { C.cYellow + "Right-Click" + C.cGray + " with Axe to use " + C.cGreen + "Magma Blast" }); } + @Override + public void setupValues() + { + _cooldown = getPerkTime("Cooldown"); + _velocity = getPerkFloat("Velocity"); + _fireTicks = getPerkInt("Fire Ticks"); + _velocityRadius = getPerkInt("Velocity Radius"); + _fireRadius = getPerkInt("Fire Radius"); + _damage = getPerkInt("Damage"); + } + @EventHandler public void Shoot(PlayerInteractEvent event) { @@ -88,7 +98,7 @@ public class PerkMagmaBlast extends Perk return; } - if (!Recharge.Instance.use(player, GetName(), COOLDOWN, true, true)) + if (!Recharge.Instance.use(player, GetName(), _cooldown, true, true)) { return; } @@ -103,7 +113,7 @@ public class PerkMagmaBlast extends Perk ball.setBounce(false); ball.teleport(player.getEyeLocation().add(player.getLocation().getDirection().multiply(1))); - Vector dir = player.getLocation().getDirection().multiply(FIREBALL_VELOCITY); + Vector dir = player.getLocation().getDirection().multiply(_velocity); EntityLargeFireball eFireball = ((CraftLargeFireball) ball).getHandle(); eFireball.dirX = dir.getX(); @@ -165,24 +175,29 @@ public class PerkMagmaBlast extends Perk { return; } - + + proj.remove(); + Player shooter = (Player) proj.getShooter(); // Velocity Players - Map hitMap = UtilPlayer.getInRadius(proj.getLocation(), VELOCITY_RADIUS); + Map hitMap = UtilPlayer.getInRadius(proj.getLocation(), _velocityRadius); List team = TeamSuperSmash.getTeam(Manager, shooter, false); for (Player cur : hitMap.keySet()) { if(team.contains(cur)) { - { - continue; - } + continue; } double range = hitMap.get(cur); - Manager.GetDamage().NewDamageEvent(cur, shooter, proj, DamageCause.PROJECTILE, range * DAMAGE, false, true, false, shooter.getName(), GetName()); + if (range > 0.8) + { + range = 1; + } + + Manager.GetDamage().NewDamageEvent(cur, shooter, proj, DamageCause.PROJECTILE, range * _damage, false, true, false, shooter.getName(), GetName()); // Velocity UtilAction.velocity(cur, UtilAlg.getTrajectory(proj.getLocation().add(0, -0.5, 0), cur.getEyeLocation()), 1 + 2 * range, false, 0, 0.2 + 0.4 * range, 1.2, true); @@ -222,9 +237,9 @@ public class PerkMagmaBlast extends Perk } } - if (UtilMath.offset(player, proj) < FIRE_RADIUS) + if (UtilMath.offset(player, proj) < _fireRadius) { - player.setFireTicks(FIRE_TICKS); + player.setFireTicks(_fireTicks); } } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/magmacube/PerkMagmaBoost.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/magmacube/PerkMagmaBoost.java index 3b06175aa..49256518c 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/magmacube/PerkMagmaBoost.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/magmacube/PerkMagmaBoost.java @@ -1,14 +1,5 @@ package nautilus.game.arcade.game.games.smash.perks.magmacube; -import java.util.HashMap; -import java.util.Map; -import java.util.UUID; - -import org.bukkit.entity.Player; -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.core.common.util.UtilParticle; import mineplex.core.common.util.UtilParticle.ParticleType; @@ -20,21 +11,42 @@ import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.combat.event.CombatDeathEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent; - import nautilus.game.arcade.events.GameStateChangeEvent; import nautilus.game.arcade.game.Game; import nautilus.game.arcade.kit.Perk; +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.inventory.ItemStack; + +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; public class PerkMagmaBoost extends Perk { - private static final int MAX_STACKS = 3; + private static final ItemStack BOOTS = new ItemStack(Material.IRON_BOOTS); + private static final ItemStack CHESTPLATE = new ItemStack(Material.IRON_CHESTPLATE); + private static final ItemStack HELMET = new ItemStack(Material.IRON_HELMET); + + private int _maxStacks; private Map _kills = new HashMap<>(); public PerkMagmaBoost() { - super("Fuel the Fire", new String[] { C.cGray + "Kills give +1 Damage, -15% Knockback Taken and +1 Size.", C.cGray + "Kill bonuses can stack " + MAX_STACKS + " times, and reset on death.", }); + super("Fuel the Fire", new String[0]); + } + + @Override + public void setupValues() + { + _maxStacks = getPerkInt("Max Stacks"); + + setDesc(C.cGray + "Kills give +1 Damage, -15% Knockback Taken and +1 Size.", C.cGray + "Kill bonuses can stack " + _maxStacks + " times, and reset on death."); } @EventHandler @@ -50,7 +62,7 @@ public class PerkMagmaBoost extends Perk public void kill(CombatDeathEvent event) { Player killed = (Player) event.GetEvent().getEntity(); - + _kills.remove(killed.getUniqueId()); if (event.GetLog().GetKiller() == null) @@ -80,14 +92,28 @@ public class PerkMagmaBoost extends Perk size += _kills.get(key); } - size = Math.min(MAX_STACKS, size); + size = Math.min(_maxStacks, size); + + // Adjust armour + if (size == 1) + { + killer.getInventory().setBoots(BOOTS); + } + else if (size == 2) + { + killer.getInventory().setChestplate(CHESTPLATE); + } + else if (size == 3) + { + killer.getInventory().setHelmet(HELMET); + } _kills.put(key, size); slime.SetSize(size + 1); Manager.GetDisguise().updateDisguise(slime); - - killer.setExp(0.99F * (size / (float) MAX_STACKS)); + + killer.setExp(0.99F * (size / (float) _maxStacks)); } @EventHandler(priority = EventPriority.HIGHEST) @@ -104,7 +130,7 @@ public class PerkMagmaBoost extends Perk } Player damager = event.GetDamagerPlayer(false); - + if (damager == null) { return; @@ -116,12 +142,12 @@ public class PerkMagmaBoost extends Perk } UUID key = damager.getUniqueId(); - + if (!_kills.containsKey(key)) { return; } - + event.AddMod(damager.getName(), GetName(), _kills.get(key), false); } @@ -132,12 +158,12 @@ public class PerkMagmaBoost extends Perk { return; } - + if (event.GetCause() != DamageCause.ENTITY_ATTACK) { return; } - + Player damagee = event.GetDamageePlayer(); if (damagee == null) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/magmacube/SmashMagmacube.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/magmacube/SmashMagmacube.java index 5f2a61ba2..12a35888b 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/magmacube/SmashMagmacube.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/magmacube/SmashMagmacube.java @@ -17,9 +17,7 @@ import nautilus.game.arcade.kit.perks.data.MeteorShowerData; public class SmashMagmacube extends SmashUltimate { - - private static final int DURATION = 12000; - + private List _meteors = new ArrayList<>(); public SmashMagmacube() @@ -30,7 +28,7 @@ public class SmashMagmacube extends SmashUltimate @Override public void activate(Player player) { - _meteors.add(new MeteorShowerData(player, UtilPlayer.getTarget(player, UtilBlock.blockPassSet, 128).getLocation(), DURATION)); + _meteors.add(new MeteorShowerData(player, UtilPlayer.getTarget(player, UtilBlock.blockPassSet, 128).getLocation(), getLength())); } @EventHandler @@ -40,17 +38,7 @@ public class SmashMagmacube extends SmashUltimate { return; } - - Iterator meteorIter = _meteors.iterator(); - while (meteorIter.hasNext()) - { - MeteorShowerData data = meteorIter.next(); - - if (data.update()) - { - meteorIter.remove(); - } - } + _meteors.removeIf(MeteorShowerData::update); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/pig/PerkPigBaconBomb.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/pig/PerkPigBaconBomb.java index c14f70a82..2160c60a5 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/pig/PerkPigBaconBomb.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/pig/PerkPigBaconBomb.java @@ -40,14 +40,14 @@ import nautilus.game.arcade.game.games.smash.perks.SmashPerk; public class PerkPigBaconBomb extends SmashPerk { - private static final float ENERGY_PER_PIG = 0.35F; - private static final float ENERGY_PER_PIG_DISGUISED_FACTOR = 0.7F; - private static final int COOLDOWN = 100; - private static final int PIG_MAX_TICKS = 80; - private static final float PIG_SPEED = 1.2F; - private static final int PIG_EXPLODE_RADIUS = 2; - private static final int PIG_EXPLODE_DAMAGE = 4; - private static final int PIG_EXPLODE_DAMAGE_RADIUS = 4; + private float _energyPig; + private float _energyPigDisguiseFactor; + private int _cooldown; + private int _maxTicks; + private float _pigSpeed; + private int _explodeRadius; + private int _explodeDamage; + private int _explodeDamageRadius; private Map> _pigs = new HashMap>(); @@ -56,6 +56,19 @@ public class PerkPigBaconBomb extends SmashPerk super("Baby Bacon Bomb", new String[] { C.cYellow + "Right-Click" + C.cGray + " with Spade to " + C.cGreen + "Baby Bacon Bomb" }); } + @Override + public void setupValues() + { + _energyPig = getPerkFloat("Energy Per Pig"); + _energyPigDisguiseFactor = getPerkFloat("Energy Per Pig Disguise Factor"); + _cooldown = getPerkInt("Cooldown (ms)"); + _maxTicks = getPerkInt("Pig Max Ticks"); + _pigSpeed = getPerkFloat("Pig Speed"); + _explodeRadius = getPerkInt("Pig Explode Radius"); + _explodeDamage = getPerkInt("Pig Explode Damage"); + _explodeDamageRadius = getPerkInt("Pig Explode Damage Radius"); + } + @EventHandler public void Skill(PlayerInteractEvent event) { @@ -86,13 +99,13 @@ public class PerkPigBaconBomb extends SmashPerk return; } - float energy = ENERGY_PER_PIG; + float energy = _energyPig; DisguiseBase disguise = Manager.GetDisguise().getActiveDisguise(player); if (disguise != null && disguise instanceof DisguisePigZombie) { - energy = energy * ENERGY_PER_PIG_DISGUISED_FACTOR; + energy = energy * _energyPigDisguiseFactor; } // Energy @@ -103,7 +116,7 @@ public class PerkPigBaconBomb extends SmashPerk } // Recharge - if (!Recharge.Instance.use(player, GetName(), COOLDOWN, false, false)) + if (!Recharge.Instance.use(player, GetName(), _cooldown, false, false)) { return; } @@ -112,7 +125,7 @@ public class PerkPigBaconBomb extends SmashPerk player.setExp(Math.max(0f, player.getExp() - energy)); // Velocity - UtilAction.velocity(player, player.getLocation().getDirection(), 0.8, true, 0.9, 0, 1, true); + UtilAction.velocity(player, player.getLocation().getDirection(), 0.8, true, 1.2, 0, 1, true); // Sound player.getWorld().playSound(player.getLocation(), Sound.PIG_IDLE, 2f, 0.75f); @@ -163,7 +176,7 @@ public class PerkPigBaconBomb extends SmashPerk { Pig pig = pigIterator.next(); - if (!pig.isValid() || pig.getTicksLived() > PIG_MAX_TICKS) + if (!pig.isValid() || pig.getTicksLived() > _maxTicks) { PigExplode(pigIterator, pig, player); continue; @@ -176,9 +189,9 @@ public class PerkPigBaconBomb extends SmashPerk continue; } - UtilEnt.CreatureMoveFast(pig, target.getLocation(), PIG_SPEED); + UtilEnt.CreatureMoveFast(pig, target.getLocation(), _pigSpeed); - if (UtilMath.offset(target, pig) < PIG_EXPLODE_RADIUS) + if (UtilMath.offset(target, pig) < _explodeRadius) { PigExplode(pigIterator, pig, player); } @@ -196,7 +209,7 @@ public class PerkPigBaconBomb extends SmashPerk pig.getWorld().playSound(pig.getLocation(), Sound.PIG_DEATH, 1f, 2f); // Damage - Map targets = UtilEnt.getInRadius(pig.getLocation(), PIG_EXPLODE_DAMAGE_RADIUS); + Map targets = UtilEnt.getInRadius(pig.getLocation(), _explodeDamageRadius); for (LivingEntity cur : targets.keySet()) { @@ -206,7 +219,7 @@ public class PerkPigBaconBomb extends SmashPerk } // Damage Event - Manager.GetDamage().NewDamageEvent(cur, owner, null, DamageCause.CUSTOM, PIG_EXPLODE_DAMAGE, false, true, false, owner.getName(), GetName()); + Manager.GetDamage().NewDamageEvent(cur, owner, null, DamageCause.CUSTOM, _explodeDamage, false, true, false, owner.getName(), GetName()); } // Remove diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/pig/PerkPigBaconBounce.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/pig/PerkPigBaconBounce.java index 87e993d45..720dc9145 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/pig/PerkPigBaconBounce.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/pig/PerkPigBaconBounce.java @@ -40,17 +40,29 @@ import nautilus.game.arcade.game.games.smash.perks.SmashPerk; public class PerkPigBaconBounce extends SmashPerk implements IThrown { - private static final float ENERGY_PER_BACON = 0.2F; - private static final float ENERGY_PER_BACON_DISGUISED_FACTOR = 0.7F; - private static final int COOLDOWN = 100; - private static final int HEALTH_PER_BACON = 1; - private static final int BACON_DAMAGE = 4; + private float _energyBacon; + private float _energyBaconDisgtuiseFactor; + private float _energyBaconBack; + private int _cooldown; + private int _healthBacon; + private int _damageBacon; public PerkPigBaconBounce() { super("Bouncy Bacon", new String[] { C.cYellow + "Right-Click" + C.cGray + " with Axe to " + C.cGreen + "Bouncy Bacon", }); } + @Override + public void setupValues() + { + _energyBacon = getPerkFloat("Energy Per Bacon"); + _energyBaconDisgtuiseFactor = getPerkFloat("Energy Per Bacon Disguise Factor"); + _energyBaconBack = getPerkFloat("Energy Per Bacon Back"); + _cooldown = getPerkInt("Cooldown (ms)"); + _healthBacon = getPerkInt("Health Per Bacon"); + _damageBacon = getPerkInt("Bacon Damage"); + } + @EventHandler public void Skill(PlayerInteractEvent event) { @@ -81,13 +93,13 @@ public class PerkPigBaconBounce extends SmashPerk implements IThrown return; } - float energy = ENERGY_PER_BACON; + float energy = _energyBacon; DisguiseBase disguise = Manager.GetDisguise().getActiveDisguise(player); if (disguise != null && disguise instanceof DisguisePigZombie) { - energy = energy * ENERGY_PER_BACON_DISGUISED_FACTOR; + energy = energy * _energyBaconDisgtuiseFactor; } // Energy @@ -98,7 +110,7 @@ public class PerkPigBaconBounce extends SmashPerk implements IThrown } // Recharge - if (!Recharge.Instance.use(player, GetName(), COOLDOWN, false, false)) + if (!Recharge.Instance.use(player, GetName(), _cooldown, false, false)) { return; } @@ -109,7 +121,7 @@ public class PerkPigBaconBounce extends SmashPerk implements IThrown // Launch Item ent = player.getWorld().dropItem(player.getEyeLocation(), ItemStackFactory.Instance.CreateStack(Material.PORK, (byte) 0, 1, "Bacon" + System.currentTimeMillis())); UtilAction.velocity(ent, player.getLocation().getDirection(), 1.2, false, 0, 0.2, 10, false); - Manager.GetProjectile().AddThrow(ent, player, this, -1, true, true, true, false, 0.4f); + Manager.GetProjectile().AddThrow(ent, player, this, -1, true, true, true, false, .8F); ent.setPickupDelay(9999); // Sound @@ -130,7 +142,7 @@ public class PerkPigBaconBounce extends SmashPerk implements IThrown } // Damage Event - Manager.GetDamage().NewDamageEvent(target, data.getThrower(), null, DamageCause.CUSTOM, BACON_DAMAGE, true, true, false, UtilEnt.getName(data.getThrower()), GetName()); + Manager.GetDamage().NewDamageEvent(target, data.getThrower(), null, DamageCause.CUSTOM, _damageBacon, true, true, false, UtilEnt.getName(data.getThrower()), GetName()); Item item = (Item) data.getThrown(); item.setItemStack(new ItemStack(Material.GRILLED_PORK)); @@ -181,7 +193,7 @@ public class PerkPigBaconBounce extends SmashPerk implements IThrown event.getItem().remove(); // Restore Energy - event.getPlayer().setExp(Math.min(0.999f, event.getPlayer().getExp() + 0.05f)); + event.getPlayer().setExp(Math.min(0.999f, event.getPlayer().getExp() + _energyBaconBack)); // Sound event.getPlayer().getWorld().playSound(event.getPlayer().getLocation(), Sound.EAT, 2f, 1f); @@ -189,7 +201,7 @@ public class PerkPigBaconBounce extends SmashPerk implements IThrown // Heal if (event.getItem().getItemStack().getType() == Material.GRILLED_PORK) { - UtilPlayer.health(event.getPlayer(), HEALTH_PER_BACON); + UtilPlayer.health(event.getPlayer(), _healthBacon); UtilParticle.PlayParticle(ParticleType.HEART, event.getPlayer().getLocation().add(0, 0.5, 0), 0.2f, 0.2f, 0.2f, 0, 4, ViewDist.LONG, UtilServer.getPlayers()); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/pig/PerkPigZombie.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/pig/PerkPigZombie.java index 306f0ed3b..d3dff4e75 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/pig/PerkPigZombie.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/pig/PerkPigZombie.java @@ -24,7 +24,7 @@ import nautilus.game.arcade.game.games.smash.perks.SmashPerk; public class PerkPigZombie extends SmashPerk { - private static final int MIN_HEALTH = 6; + private int _minHealth; public Set _active = new HashSet<>(); @@ -33,6 +33,12 @@ public class PerkPigZombie extends SmashPerk super("Nether Pig", new String[] { C.cGray + "Become Nether Pig when HP is below 6.", C.cGray + "Return to Pig when HP is 10 or higher." }); } + @Override + public void setupValues() + { + _minHealth = getPerkInt("Min Health"); + } + @EventHandler public void Check(UpdateEvent event) { @@ -86,7 +92,7 @@ public class PerkPigZombie extends SmashPerk // Not Active else { - if (player.getHealth() <= 0 || (!isSuperActive(player) && player.getHealth() > MIN_HEALTH)) + if (player.getHealth() <= 0 || (!isSuperActive(player) && player.getHealth() > _minHealth)) { continue; } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/pig/SmashPig.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/pig/SmashPig.java index e8300adde..7bbbc05f6 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/pig/SmashPig.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/pig/SmashPig.java @@ -8,11 +8,9 @@ import nautilus.game.arcade.game.games.smash.perks.SmashUltimate; public class SmashPig extends SmashUltimate { - private static final int DURATION = 40000; - public SmashPig() { - super("Pig Stink", new String[] {}, Sound.PIG_IDLE, DURATION); + super("Pig Stink", new String[] {}, Sound.PIG_IDLE, 0); } @Override @@ -24,7 +22,7 @@ public class SmashPig extends SmashUltimate { if (!player.equals(other)) { - Manager.GetCondition().Factory().Confuse(GetName() + " " + player.getName(), other, player, DURATION / 1000, 0, false, false, false); + Manager.GetCondition().Factory().Confuse(GetName() + " " + player.getName(), other, player, getLength() / 1000, 0, false, false, false); } } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/sheep/SmashSheep.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/sheep/SmashSheep.java index 61e49baba..520123ea9 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/sheep/SmashSheep.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/sheep/SmashSheep.java @@ -26,9 +26,9 @@ import nautilus.game.arcade.kit.perks.data.HomingSheepData; public class SmashSheep extends SmashUltimate { - private static final int DAMAGE_RADIUS = 10; - private static final int DAMAGE = 20; - private static final int KNOCKBACK_MAGNITUDE = 3; + private int _damageRadius; + private int _damage; + private int _knockbackMagnitude; private List _sheep = new ArrayList<>(); @@ -37,6 +37,14 @@ public class SmashSheep extends SmashUltimate super("Homing Sheeples", new String[] {}, Sound.SHEEP_IDLE, 0); } + @Override + public void setupValues() + { + _damageRadius = getPerkInt("Damage Radius"); + _damage = getPerkInt("Damage"); + _knockbackMagnitude = getPerkInt("Knockback Magnitude"); + } + @Override public void activate(Player player) { @@ -91,7 +99,7 @@ public class SmashSheep extends SmashUltimate double scale = 0.4 + 0.6 * Math.min(1, data.Sheep.getTicksLived() / 60d); // Players - Map players = UtilPlayer.getInRadius(data.Sheep.getLocation(), DAMAGE_RADIUS); + Map players = UtilPlayer.getInRadius(data.Sheep.getLocation(), _damageRadius); for (Player player : players.keySet()) { @@ -101,7 +109,7 @@ public class SmashSheep extends SmashUltimate } // Damage Event - Manager.GetDamage().NewDamageEvent(player, data.Shooter, null, DamageCause.CUSTOM, DAMAGE * scale, true, true, false, data.Shooter.getName(), GetName()); + Manager.GetDamage().NewDamageEvent(player, data.Shooter, null, DamageCause.CUSTOM, _damage * scale, true, true, false, data.Shooter.getName(), GetName()); } UtilParticle.PlayParticle(ParticleType.HUGE_EXPLOSION, data.Sheep.getLocation(), 0, 0, 0, 0, 1, ViewDist.MAX, UtilServer.getPlayers()); @@ -118,6 +126,6 @@ public class SmashSheep extends SmashUltimate return; } - event.AddKnockback(GetName(), KNOCKBACK_MAGNITUDE); + event.AddKnockback(GetName(), _knockbackMagnitude); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/skeletalhorse/PerkBoneRush.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/skeletalhorse/PerkBoneRush.java index f1d281713..1f09e42d9 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/skeletalhorse/PerkBoneRush.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/skeletalhorse/PerkBoneRush.java @@ -39,13 +39,13 @@ import nautilus.game.arcade.game.games.smash.perks.SmashPerk; public class PerkBoneRush extends SmashPerk implements IThrown { - private static final int COOLDOWN = 10000; - private static final float DAMAGE_NORMAL = 0.7F; - private static final int DAMAGE_SMASH = 3; - private static final int KNOCKBACK_NORMAL = 10; - private static final int KNOCKBACK_SMASH = 6; - private static final int EXPIRE_TIME = 2000; - private static final float Y_LIMIT = 0.25F; + private int _cooldown; + private float _damageNormal; + private int _damageSmash; + private int _knockbackNormal; + private int _knockbackSmash; + private int _expireTime; + private float _yLimit; private Map _active = new HashMap<>(); @@ -54,6 +54,18 @@ public class PerkBoneRush extends SmashPerk implements IThrown super("Bone Rush", new String[] { C.cYellow + "Right-Click" + C.cGray + " with Spade to use " + C.cGreen + "Bone Rush", C.cGray + "Crouch to avoid movement with " + C.cGreen + "Bone Rush" }); } + @Override + public void setupValues() + { + _cooldown = getPerkTime("Cooldown"); + _damageNormal = getPerkFloat("Damage Normal"); + _damageSmash = getPerkInt("Damage Smash"); + _knockbackNormal = getPerkInt("Knockback Normal"); + _knockbackSmash = getPerkInt("Knockback Smash"); + _expireTime = getPerkTime("Expire Time"); + _yLimit = getPerkFloat("Y Limit"); + } + @EventHandler public void Skill(PlayerInteractEvent event) { @@ -89,7 +101,7 @@ public class PerkBoneRush extends SmashPerk implements IThrown return; } - if (!Recharge.Instance.use(player, GetName(), COOLDOWN, true, true)) + if (!Recharge.Instance.use(player, GetName(), _cooldown, true, true)) { return; } @@ -141,7 +153,7 @@ public class PerkBoneRush extends SmashPerk implements IThrown // Velocity Vector dir = player.getLocation().getDirection(); - double limit = isSuperActive(player) ? Y_LIMIT + 0.1 : Y_LIMIT; + double limit = isSuperActive(player) ? _yLimit + 0.1 : _yLimit; if (dir.getY() > limit) { @@ -159,7 +171,7 @@ public class PerkBoneRush extends SmashPerk implements IThrown { Item bone = player.getWorld().dropItem(player.getLocation().add(Math.random() * 5 - 2.5, Math.random() * 3, Math.random() * 5 - 2.5), new ItemStack(Material.BONE)); UtilAction.velocity(bone, dir, 0.6 + 0.3 * Math.random(), false, 0, 0.1 + Math.random() * 0.05, 0.3, false); - Manager.GetProjectile().AddThrow(bone, player, this, EXPIRE_TIME, true, true, true, true, 0.5f); + Manager.GetProjectile().AddThrow(bone, player, this, _expireTime, true, true, true, true, 0.5f); } } } @@ -174,12 +186,12 @@ public class PerkBoneRush extends SmashPerk implements IThrown if (event.GetReason().contains(GetName())) { - event.AddKnockback(GetName(), KNOCKBACK_NORMAL); + event.AddKnockback(GetName(), _knockbackNormal); } if (event.GetReason().contains("Bone Storm")) { - event.AddKnockback(GetName(), KNOCKBACK_SMASH); + event.AddKnockback(GetName(), _knockbackSmash); } } @@ -216,7 +228,7 @@ public class PerkBoneRush extends SmashPerk implements IThrown } // Damage Event - Manager.GetDamage().NewDamageEvent(target, data.getThrower(), null, DamageCause.CUSTOM, isSuperActive(damager) ? DAMAGE_SMASH : DAMAGE_NORMAL, false, true, false, UtilEnt.getName(data.getThrower()), reason); + Manager.GetDamage().NewDamageEvent(target, data.getThrower(), null, DamageCause.CUSTOM, isSuperActive(damager) ? _damageSmash : _damageNormal, false, true, false, UtilEnt.getName(data.getThrower()), reason); UtilAction.velocity(target, data.getThrown().getVelocity()); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/skeletalhorse/PerkDeadlyBones.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/skeletalhorse/PerkDeadlyBones.java index ca13e82ac..0708471b7 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/skeletalhorse/PerkDeadlyBones.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/skeletalhorse/PerkDeadlyBones.java @@ -1,11 +1,14 @@ package nautilus.game.arcade.game.games.smash.perks.skeletalhorse; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.UUID; - +import mineplex.core.common.util.*; +import mineplex.core.common.util.UtilParticle.ParticleType; +import mineplex.core.common.util.UtilParticle.ViewDist; +import mineplex.core.itemstack.ItemStackFactory; +import mineplex.core.recharge.Recharge; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.game.games.smash.perks.SmashPerk; import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.entity.Item; @@ -14,28 +17,16 @@ import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.entity.EntityDamageEvent.DamageCause; -import mineplex.core.common.util.C; -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.common.util.UtilPlayer; -import mineplex.core.common.util.UtilServer; -import mineplex.core.itemstack.ItemStackFactory; -import mineplex.core.recharge.Recharge; -import mineplex.core.updater.UpdateType; -import mineplex.core.updater.event.UpdateEvent; -import mineplex.minecraft.game.core.damage.CustomDamageEvent; -import nautilus.game.arcade.game.games.smash.perks.SmashPerk; +import java.util.*; public class PerkDeadlyBones extends SmashPerk { - private static final int RATE = 400; - private static final int TICKS = 50; - private static final int DAMAGE_RADIUS = 4; - private static final int DAMAGE = 4; - private static final float KNOCKBACK_MAGNITUDE = 2.5F; + private int _rate; + private int _ticks ; + private int _damageRadius; + private int _damage; + private float _knockbackMagnitude; private Map _active = new HashMap<>(); @@ -44,6 +35,16 @@ public class PerkDeadlyBones extends SmashPerk super("Deadly Bones", new String[] { C.cGray + "Drop explosive bones when you take damage." }); } + @Override + public void setupValues() + { + _rate = getPerkInt("Rate (ms)"); + _ticks = getPerkInt("Ticks"); + _damageRadius = getPerkInt("Damage Radius"); + _damage = getPerkInt("Damage"); + _knockbackMagnitude = getPerkFloat("Knockback Magnitude"); + } + @EventHandler public void damageActivate(CustomDamageEvent event) { @@ -64,7 +65,7 @@ public class PerkDeadlyBones extends SmashPerk return; } - if (!Recharge.Instance.use(player, GetName(), RATE, false, false)) + if (!Recharge.Instance.use(player, GetName(), _rate, false, false)) { return; } @@ -91,7 +92,7 @@ public class PerkDeadlyBones extends SmashPerk for (Item item : itemListCopy) { // Not Ready - if (item.isValid() && item.getTicksLived() < TICKS) + if (item.isValid() && item.getTicksLived() < _ticks) { continue; } @@ -109,7 +110,7 @@ public class PerkDeadlyBones extends SmashPerk } // Damage - Map targets = UtilEnt.getInRadius(item.getLocation(), DAMAGE_RADIUS); + Map targets = UtilEnt.getInRadius(item.getLocation(), _damageRadius); for (LivingEntity cur : targets.keySet()) { @@ -118,7 +119,7 @@ public class PerkDeadlyBones extends SmashPerk continue; } - Manager.GetDamage().NewDamageEvent(cur, player, null, DamageCause.CUSTOM, DAMAGE * targets.get(cur) + 1, true, true, false, player.getName(), GetName()); + Manager.GetDamage().NewDamageEvent(cur, player, null, DamageCause.CUSTOM, _damage * targets.get(cur) + 1, true, true, false, player.getName(), GetName()); } // Remove @@ -135,6 +136,6 @@ public class PerkDeadlyBones extends SmashPerk return; } - event.AddKnockback(GetName(), KNOCKBACK_MAGNITUDE); + event.AddKnockback(GetName(), _knockbackMagnitude); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/skeletalhorse/PerkHorseKick.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/skeletalhorse/PerkHorseKick.java index a343c4a12..130eec05e 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/skeletalhorse/PerkHorseKick.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/skeletalhorse/PerkHorseKick.java @@ -37,10 +37,10 @@ import nautilus.game.arcade.game.games.smash.perks.SmashPerk; public class PerkHorseKick extends SmashPerk { - private static final int COOLDOWN = 6000; - private static final float DAMAGE = 6.5F; - private static final int KICK_TIME = 1000; - private static final int KNOCKBACK_MAGNITUDE = 4; + private int _cooldown; + private float _damage; + private int _kickTime; + private float _knockbackMagnitude; private Map _active = new HashMap<>(); @@ -49,6 +49,15 @@ public class PerkHorseKick extends SmashPerk super("Bone Kick", new String[] { C.cYellow + "Right-Click" + C.cGray + " with Axe to use " + C.cGreen + "Bone Kick" }); } + @Override + public void setupValues() + { + _cooldown = getPerkTime("Cooldown"); + _damage = getPerkFloat("Damage"); + _kickTime = getPerkInt("Kick Time (ms)"); + _knockbackMagnitude = getPerkFloat("Knockback Magnitude"); + } + @EventHandler public void Activate(PlayerInteractEvent event) { @@ -84,7 +93,7 @@ public class PerkHorseKick extends SmashPerk return; } - if (!Recharge.Instance.use(player, GetName(), COOLDOWN, true, true)) + if (!Recharge.Instance.use(player, GetName(), _cooldown, true, true)) { return; } @@ -119,7 +128,7 @@ public class PerkHorseKick extends SmashPerk } // Damage Event - Manager.GetDamage().NewDamageEvent(other, player, null, DamageCause.CUSTOM, DAMAGE, true, true, false, player.getName(), GetName()); + Manager.GetDamage().NewDamageEvent(other, player, null, DamageCause.CUSTOM, _damage, true, true, false, player.getName(), GetName()); // Sound player.getWorld().playSound(player.getLocation(), Sound.SKELETON_HURT, 4f, 0.6f); @@ -158,7 +167,7 @@ public class PerkHorseKick extends SmashPerk continue; } - if (!player.isValid() || player.getHealth() <= 0 || UtilTime.elapsed(_active.get(key), KICK_TIME)) + if (!player.isValid() || player.getHealth() <= 0 || UtilTime.elapsed(_active.get(key), _kickTime)) { playerIterator.remove(); @@ -192,6 +201,6 @@ public class PerkHorseKick extends SmashPerk return; } - event.AddKnockback(GetName(), KNOCKBACK_MAGNITUDE); + event.AddKnockback(GetName(), _knockbackMagnitude); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/skeletalhorse/SmashSkeletalHorse.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/skeletalhorse/SmashSkeletalHorse.java index 058c4c3d8..a66b39c55 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/skeletalhorse/SmashSkeletalHorse.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/skeletalhorse/SmashSkeletalHorse.java @@ -10,11 +10,9 @@ import nautilus.game.arcade.kit.Perk; public class SmashSkeletalHorse extends SmashUltimate { - private static final int DURATION = 20000; - public SmashSkeletalHorse() { - super("Bone Storm", new String[] {}, Sound.HORSE_SKELETON_DEATH, DURATION); + super("Bone Storm", new String[] {}, Sound.HORSE_SKELETON_DEATH, 0); } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/skeleton/PerkBarrage.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/skeleton/PerkBarrage.java index d8089da13..8dc18f5ad 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/skeleton/PerkBarrage.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/skeleton/PerkBarrage.java @@ -33,6 +33,7 @@ import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent; import nautilus.game.arcade.game.games.smash.perks.SmashPerk; +import org.jooq.util.derby.sys.Sys; public class PerkBarrage extends SmashPerk { @@ -48,6 +49,11 @@ public class PerkBarrage extends SmashPerk private boolean _noDelay; private boolean _useExp; + public PerkBarrage() + { + this(0, 0, false, false); + } + public PerkBarrage(int max, int tick, boolean remove, boolean noDelay) { this(max, tick, remove, noDelay, false); @@ -63,6 +69,16 @@ public class PerkBarrage extends SmashPerk _noDelay = noDelay; } + @Override + public void setupValues() + { + _max = getPerkInt("Max", _max); + _tick = getPerkInt("Tick", _tick); + _remove = getPerkBoolean("Remove", _remove); + _noDelay = getPerkBoolean("No Delay", _noDelay); + _useExp = getPerkBoolean("Exp Bar", _useExp); + } + @EventHandler public void BarrageDrawBow(PlayerInteractEvent event) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/skeleton/PerkBoneExplosion.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/skeleton/PerkBoneExplosion.java index 5fe9a20db..37f301290 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/skeleton/PerkBoneExplosion.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/skeleton/PerkBoneExplosion.java @@ -23,16 +23,25 @@ import nautilus.game.arcade.game.games.smash.perks.SmashPerk; public class PerkBoneExplosion extends SmashPerk { - private static final int COOLDOWN = 10000; - private static final int DAMAGE_RADIUS = 7; - private static final int DAMAGE = 6; - private static final float KNOCKBACK_MAGNITUDE = 2.5F; + private int _cooldown; + private int _damageRadius; + private int _damage; + private float _knockbackMagnitude; public PerkBoneExplosion() { super("Bone Explosion", new String[] { C.cYellow + "Right-Click" + C.cGray + " with Axe to " + C.cGreen + "Bone Explosion" }); } + @Override + public void setupValues() + { + _cooldown = getPerkTime("Cooldown"); + _damageRadius = getPerkInt("Damage Radius"); + _damage = getPerkInt("Damage"); + _knockbackMagnitude = getPerkFloat("Knockback Magnitude"); + } + @EventHandler public void Skill(PlayerInteractEvent event) { @@ -68,12 +77,12 @@ public class PerkBoneExplosion extends SmashPerk return; } - if (!Recharge.Instance.use(player, GetName(), COOLDOWN, true, true)) + if (!Recharge.Instance.use(player, GetName(), _cooldown, true, true)) { return; } - Map nearby = UtilPlayer.getInRadius(player.getLocation(), DAMAGE_RADIUS); + Map nearby = UtilPlayer.getInRadius(player.getLocation(), _damageRadius); for (Player other : nearby.keySet()) { @@ -86,7 +95,7 @@ public class PerkBoneExplosion extends SmashPerk UtilPlayer.message(other, F.main("Game", F.elem(Manager.GetColor(player) + player.getName()) + " used " + F.skill(GetName()) + ".")); // Damage Event - Manager.GetDamage().NewDamageEvent(other, player, null, DamageCause.CUSTOM, DAMAGE * nearby.get(other), true, true, false, player.getName(), GetName()); + Manager.GetDamage().NewDamageEvent(other, player, null, DamageCause.CUSTOM, _damage * nearby.get(other), true, true, false, player.getName(), GetName()); } // Inform @@ -104,6 +113,6 @@ public class PerkBoneExplosion extends SmashPerk return; } - event.AddKnockback(GetName(), KNOCKBACK_MAGNITUDE); + event.AddKnockback(GetName(), _knockbackMagnitude); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/skeleton/SmashSkeleton.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/skeleton/SmashSkeleton.java index bb86fdbcf..1e5e9c635 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/skeleton/SmashSkeleton.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/skeleton/SmashSkeleton.java @@ -20,14 +20,12 @@ import nautilus.game.arcade.game.games.smash.perks.SmashUltimate; public class SmashSkeleton extends SmashUltimate { - - private static final int DURATION = 10000; - - private Set _arrows = new HashSet(); + + private Set _arrows = new HashSet<>(); public SmashSkeleton() { - super("Arrow Storm", new String[] {}, Sound.SKELETON_HURT, DURATION); + super("Arrow Storm", new String[] {}, Sound.SKELETON_HURT, 0); } @EventHandler @@ -71,15 +69,7 @@ public class SmashSkeleton extends SmashUltimate { return; } - - for (Iterator arrowIterator = _arrows.iterator(); arrowIterator.hasNext();) - { - Projectile arrow = arrowIterator.next(); - if (arrow.isDead() || !arrow.isValid()) - { - arrowIterator.remove(); - } - } + _arrows.removeIf(arrow -> arrow.isDead() || !arrow.isValid()); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/slime/PerkSlimeRocket.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/slime/PerkSlimeRocket.java index a9994d4a1..c8659cd43 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/slime/PerkSlimeRocket.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/slime/PerkSlimeRocket.java @@ -43,11 +43,11 @@ import nautilus.game.arcade.game.games.smash.perks.SmashPerk; public class PerkSlimeRocket extends SmashPerk implements IThrown { - private static final int COOLDOWN = 6000; - private static final float ENERGY_PER_TICK = 0.004F; - private static final int KNOCKBACK_MAGNITUDE = 3; - private static final int MAX_ENERGY_TIME = 3000; - private static final int MAX_HOLD_TIME = 5000; + private int _cooldown = 6000; + private float _energyTick = 0.004F; + private int _knockbackMagnitude = 3; + private int _maxEnergyTime = 3000; + private int _maxHoldTime = 5000; private Map _charge = new HashMap<>(); private Map _owner = new HashMap<>(); @@ -58,6 +58,16 @@ public class PerkSlimeRocket extends SmashPerk implements IThrown super("Slime Rocket", new String[] { C.cYellow + "Hold/Release Block" + C.cGray + " to use " + C.cGreen + "Slime Rocket" }); } + @Override + public void setupValues() + { + _cooldown = getPerkTime("Cooldown"); + _energyTick = getPerkFloat("Energy Per Tick"); + _knockbackMagnitude = getPerkInt("Knockback Magnitude"); + _maxEnergyTime = getPerkTime("Max Energy Time"); + _maxHoldTime = getPerkTime("Max Hold Time"); + } + @EventHandler public void EnergyUpdate(UpdateEvent event) { @@ -101,7 +111,7 @@ public class PerkSlimeRocket extends SmashPerk implements IThrown continue; } - player.setExp((float) Math.min(0.999, player.getExp() + ENERGY_PER_TICK)); + player.setExp((float) Math.min(0.999, player.getExp() + _energyTick)); } } @@ -140,7 +150,7 @@ public class PerkSlimeRocket extends SmashPerk implements IThrown return; } - if (!Recharge.Instance.use(player, GetName(), COOLDOWN, true, true)) + if (!Recharge.Instance.use(player, GetName(), _cooldown, true, true)) { return; } @@ -187,13 +197,13 @@ public class PerkSlimeRocket extends SmashPerk implements IThrown double elapsed = Math.min(3, (double) (System.currentTimeMillis() - time) / 1000d); // Use Energy - if (!UtilTime.elapsed(time, MAX_ENERGY_TIME)) + if (!UtilTime.elapsed(time, _maxEnergyTime)) { player.setExp((float) Math.max(0, player.getExp() - 0.01f)); } // AutoFire - if (UtilTime.elapsed(time, MAX_HOLD_TIME)) + if (UtilTime.elapsed(time, _maxHoldTime)) { FireRocket(player); chargeIterator.remove(); @@ -310,7 +320,7 @@ public class PerkSlimeRocket extends SmashPerk implements IThrown return; } - event.AddKnockback(GetName(), KNOCKBACK_MAGNITUDE); + event.AddKnockback(GetName(), _knockbackMagnitude); } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/slime/PerkSlimeSlam.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/slime/PerkSlimeSlam.java index 6d27af729..fc36d01bb 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/slime/PerkSlimeSlam.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/slime/PerkSlimeSlam.java @@ -1,42 +1,32 @@ package nautilus.game.arcade.game.games.smash.perks.slime; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.UUID; - +import mineplex.core.common.util.*; +import mineplex.core.common.util.UtilEvent.ActionType; +import mineplex.core.recharge.Recharge; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.game.games.smash.perks.SmashPerk; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.player.PlayerInteractEvent; -import mineplex.core.common.util.C; -import mineplex.core.common.util.F; -import mineplex.core.common.util.UtilAction; -import mineplex.core.common.util.UtilBlock; -import mineplex.core.common.util.UtilEnt; -import mineplex.core.common.util.UtilEvent; -import mineplex.core.common.util.UtilEvent.ActionType; -import mineplex.core.common.util.UtilItem; -import mineplex.core.common.util.UtilMath; -import mineplex.core.common.util.UtilPlayer; -import mineplex.core.common.util.UtilTime; -import mineplex.core.recharge.Recharge; -import mineplex.core.updater.UpdateType; -import mineplex.core.updater.event.UpdateEvent; -import mineplex.minecraft.game.core.damage.CustomDamageEvent; -import nautilus.game.arcade.game.games.smash.perks.SmashPerk; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.UUID; public class PerkSlimeSlam extends SmashPerk { - private static final int COOLDOWN = 6000; - private static final int HIT_BOX = 2; - private static final int START_TIME = 1000; - private static final int DAMAGE_RATE_LIMIT = 500; - private static final int DAMAGE = 7; - private static final int KNOCKBACK_MAGNITUDE = 2; + private int _cooldown; + private int _hitBox; + private int _startTime; + private int _damageRateLimit; + private int _damage; + private int _knockbackMagnitude; private Map _live = new HashMap<>(); @@ -45,6 +35,17 @@ public class PerkSlimeSlam extends SmashPerk super("Slime Slam", new String[] { C.cYellow + "Right-Click" + C.cGray + " with Axe to " + C.cGreen + "Slime Slam" }); } + @Override + public void setupValues() + { + _cooldown = getPerkTime("Cooldown"); + _hitBox = getPerkInt("Hit Box"); + _startTime = getPerkTime("Start Time"); + _damageRateLimit = getPerkInt("Damage Rate Limit (ms)"); + _damage = getPerkInt("Damage"); + _knockbackMagnitude = getPerkInt("Knockback Magnitude"); + } + @EventHandler public void Leap(PlayerInteractEvent event) { @@ -75,7 +76,7 @@ public class PerkSlimeSlam extends SmashPerk return; } - if (!Recharge.Instance.use(player, GetName(), COOLDOWN, true, true)) + if (!Recharge.Instance.use(player, GetName(), _cooldown, true, true)) { return; } @@ -114,7 +115,7 @@ public class PerkSlimeSlam extends SmashPerk continue; } - if (UtilMath.offset(player, other) < HIT_BOX) + if (UtilMath.offset(player, other) < _hitBox) { doSlam(player, other); _live.remove(player.getUniqueId()); @@ -138,7 +139,7 @@ public class PerkSlimeSlam extends SmashPerk continue; } - if (!UtilTime.elapsed(_live.get(key), START_TIME)) + if (!UtilTime.elapsed(_live.get(key), _startTime)) { continue; } @@ -151,7 +152,7 @@ public class PerkSlimeSlam extends SmashPerk { if (damagee instanceof Player) { - if (!Recharge.Instance.use((Player) damagee, GetName() + " Hit", DAMAGE_RATE_LIMIT, false, false)) + if (!Recharge.Instance.use((Player) damagee, GetName() + " Hit", _damageRateLimit, false, false)) { return; } @@ -160,10 +161,10 @@ public class PerkSlimeSlam extends SmashPerk // Recoil Event if (!isSuperActive(damager)) { - Manager.GetDamage().NewDamageEvent(damager, damagee, null, DamageCause.CUSTOM, DAMAGE / 4, true, true, false, damager.getName(), GetName() + " Recoil"); + Manager.GetDamage().NewDamageEvent(damager, damagee, null, DamageCause.CUSTOM, _damage / 4, true, true, false, damager.getName(), GetName() + " Recoil"); // Damage Event - Manager.GetDamage().NewDamageEvent(damagee, damager, null, DamageCause.CUSTOM, DAMAGE, true, true, false, damager.getName(), GetName()); + Manager.GetDamage().NewDamageEvent(damagee, damager, null, DamageCause.CUSTOM, _damage, true, true, false, damager.getName(), GetName()); } // Inform @@ -179,6 +180,6 @@ public class PerkSlimeSlam extends SmashPerk return; } - event.AddKnockback(GetName(), KNOCKBACK_MAGNITUDE); + event.AddKnockback(GetName(), _knockbackMagnitude); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/slime/SmashSlime.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/slime/SmashSlime.java index 16bfccd4e..c88f97ffd 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/slime/SmashSlime.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/slime/SmashSlime.java @@ -26,13 +26,21 @@ import nautilus.game.arcade.game.games.smash.perks.SmashUltimate; public class SmashSlime extends SmashUltimate { - private static final int DURATION = 19000; - private static final int HIT_BOX = 5; - private static final int DAMAGE = 8; + private int _hitBox; + private int _damage; public SmashSlime() { - super("Giga Slime", new String[] {}, Sound.SLIME_ATTACK, DURATION); + super("Giga Slime", new String[] {}, Sound.SLIME_ATTACK, 0); + } + + @Override + public void setupValues() + { + super.setupValues(); + + _hitBox = getPerkInt("Hit Box"); + _damage = getPerkInt("Damage"); } @Override @@ -53,7 +61,7 @@ public class SmashSlime extends SmashUltimate player.setExp(0.99f); - Manager.GetCondition().Factory().Speed(GetName(), player, player, DURATION / 1000, 2, false, false, false); + Manager.GetCondition().Factory().Speed(GetName(), player, player, getLength() / 1000, 2, false, false, false); } @@ -128,9 +136,9 @@ public class SmashSlime extends SmashUltimate continue; } - if (UtilMath.offset(player.getLocation().add(0, 3, 0), other.getLocation()) < HIT_BOX) + if (UtilMath.offset(player.getLocation().add(0, 3, 0), other.getLocation()) < _hitBox) { - Manager.GetDamage().NewDamageEvent(other, player, null, DamageCause.CUSTOM, DAMAGE, true, false, false, player.getName(), GetName()); + Manager.GetDamage().NewDamageEvent(other, player, null, DamageCause.CUSTOM, _damage, true, false, false, player.getName(), GetName()); UtilParticle.PlayParticle(ParticleType.SLIME, other.getLocation().add(0, 0.6, 0), 1f, 1f, 1f, 0, 20, ViewDist.LONG, UtilServer.getPlayers()); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/snowman/PerkArcticAura.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/snowman/PerkArcticAura.java index aa0ed0242..766b6aa89 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/snowman/PerkArcticAura.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/snowman/PerkArcticAura.java @@ -2,6 +2,7 @@ package nautilus.game.arcade.game.games.smash.perks.snowman; import java.util.Map; +import org.bukkit.Material; import org.bukkit.block.Block; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; @@ -15,14 +16,21 @@ import nautilus.game.arcade.kit.Perk; public class PerkArcticAura extends Perk { - private static final int DURATION = 2000; - private static final int RANGE = 5; + private int _duration; + private int _range; public PerkArcticAura() { super("Arctic Aura", new String[] { "You freeze things around you, slowing enemies." }); } + @Override + public void setupValues() + { + _duration = getPerkTime("Duration"); + _range = getPerkInt("Range"); + } + @EventHandler public void SnowAura(UpdateEvent event) { @@ -43,13 +51,18 @@ public class PerkArcticAura extends Perk continue; } - double range = RANGE * player.getExp(); + double range = _range * player.getExp(); Map blocks = UtilBlock.getInRadius(player.getLocation(), range); for (Block block : blocks.keySet()) { - Manager.GetBlockRestore().snow(block, (byte) 1, (byte) 1, (int) (DURATION * (1 + blocks.get(block))), 250, 0); + if (block.getType() == Material.SNOW_BLOCK) + { + continue; + } + + Manager.GetBlockRestore().snow(block, (byte) 1, (byte) 1, (int) (_duration * (1 + blocks.get(block))), 250, 0); } } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/snowman/PerkIcePath.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/snowman/PerkIcePath.java index 3916424a9..e48443b28 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/snowman/PerkIcePath.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/snowman/PerkIcePath.java @@ -28,8 +28,8 @@ import nautilus.game.arcade.kit.perks.data.IcePathData; public class PerkIcePath extends Perk { - private static final int COOLDOWN = 12000; - private static final int MELT_TIME = 6000; + private int _cooldown; + private int _meltTime; private Set _data = new HashSet<>(); @@ -38,6 +38,13 @@ public class PerkIcePath extends Perk super("Ice Path", new String[] { C.cYellow + "Right-Click" + C.cGray + " with Axe to " + C.cGreen + "Ice Path" }); } + @Override + public void setupValues() + { + _cooldown = getPerkTime("Cooldown"); + _meltTime = getPerkTime("Melt Time"); + } + @EventHandler public void Skill(PlayerInteractEvent event) { @@ -68,7 +75,7 @@ public class PerkIcePath extends Perk return; } - if (!Recharge.Instance.use(player, GetName(), COOLDOWN, true, true)) + if (!Recharge.Instance.use(player, GetName(), _cooldown, true, true)) { return; } @@ -105,7 +112,7 @@ public class PerkIcePath extends Perk else { block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, 79); - Manager.GetBlockRestore().add(block, 79, (byte) 0, MELT_TIME); + Manager.GetBlockRestore().add(block, 79, (byte) 0, _meltTime); } } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/snowman/SmashSnowman.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/snowman/SmashSnowman.java index d63314583..bcff8ef4b 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/snowman/SmashSnowman.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/snowman/SmashSnowman.java @@ -40,19 +40,29 @@ import nautilus.game.arcade.game.games.smash.perks.SmashUltimate; public class SmashSnowman extends SmashUltimate { - private static final int DURATION = 20000; - private static final int TURRET_HEALTH = 40; - private static final int RATE = 250; - private static final float KNOCKBACK_MAGNITUDE = 2.5F; private static final int COOLDOWN = 1000; + private int _duration; + private int _turretHealth; + private int _rate; + private float _knockbackMagnitude; + private Map _snowball = new HashMap<>(); private Map _turret = new HashMap<>(); public SmashSnowman() { - super("Snow Turret", new String[] {}, Sound.STEP_SNOW, DURATION); + super("Snow Turret", new String[] {}, Sound.STEP_SNOW, 0); + } + + @Override + public void setupValues() + { + _duration = getPerkTime("Duration"); + _turretHealth = getPerkInt("Turret Health"); + _rate = getPerkInt("Rate"); + _knockbackMagnitude = getPerkFloat("Knockback Magnitude"); } @Override @@ -72,8 +82,8 @@ public class SmashSnowman extends SmashUltimate UtilEnt.vegetate(ent); UtilEnt.ghost(ent, true, false); - ent.setMaxHealth(TURRET_HEALTH); - ent.setHealth(TURRET_HEALTH); + ent.setMaxHealth(_turretHealth); + ent.setHealth(_turretHealth); UtilAction.velocity(ent, player.getLocation().getDirection(), 1, false, 0, 0.2, 1, false); @@ -122,7 +132,7 @@ public class SmashSnowman extends SmashUltimate { Snowman snowman = turretIter.next(); - if(snowman.getTicksLived() >= (DURATION/50.0)) + if(snowman.getTicksLived() >= (_duration /50.0)) { UtilParticle.PlayParticle(ParticleType.SNOWBALL_POOF, snowman.getLocation().add(0, 1, 0), 0.4f, 0.4f, 0.4f, 0, 12, ViewDist.LONG, UtilServer.getPlayers()); snowman.remove(); @@ -131,7 +141,7 @@ public class SmashSnowman extends SmashUltimate } else { - double amount = 1 - snowman.getTicksLived() / (DURATION/50.0); + double amount = 1 - snowman.getTicksLived() / (_duration /50.0); snowman.setCustomName(UtilText.getProgress(C.cGreen, amount, C.cRed, false)); snowman.setCustomNameVisible(true); } @@ -205,13 +215,7 @@ public class SmashSnowman extends SmashUltimate UtilAction.velocity(damagee, proj.getVelocity().multiply(0.3).add(new Vector(0, 0.3, 0))); - // Damage Event - if (!(damagee instanceof LivingEntity)) - { - return; - } - - if (!Recharge.Instance.use((Player) damagee, GetName() + " Hit", RATE, false, false)) + if (!Recharge.Instance.use((Player) damagee, GetName() + " Hit", _rate, false, false)) { return; } @@ -242,7 +246,7 @@ public class SmashSnowman extends SmashUltimate return; } - event.AddKnockback(GetName(), KNOCKBACK_MAGNITUDE); + event.AddKnockback(GetName(), _knockbackMagnitude); } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/spider/PerkNeedler.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/spider/PerkNeedler.java index d65af9d03..40101f6ab 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/spider/PerkNeedler.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/spider/PerkNeedler.java @@ -31,10 +31,10 @@ import nautilus.game.arcade.game.games.smash.perks.SmashPerk; public class PerkNeedler extends SmashPerk { - private static final int COOLDOWN_NORMAL = 2000; - private static final int COOLDOWN_SMASH = 600; - private static final float DAMAGE = 1.1F; - private static final int MAX_TICKS = 300; + private long _cooldownNormal; + private long _cooldownSmash; + private double _damage; + private int _maxTicks; private Map _active = new HashMap<>(); private Set _arrows = new HashSet<>(); @@ -44,6 +44,15 @@ public class PerkNeedler extends SmashPerk super("Needler", new String[] { C.cYellow + "Hold Block" + C.cGray + " to use " + C.cGreen + "Needler" }); } + @Override + public void setupValues() + { + _cooldownNormal = getPerkInt("Cooldown Normal (ms)"); + _cooldownSmash = getPerkInt("Cooldown Smash (ms)"); + _damage = getPerkDouble("Damage"); + _maxTicks = getPerkInt("Max Ticks"); + } + @EventHandler public void Activate(PlayerInteractEvent event) { @@ -74,12 +83,12 @@ public class PerkNeedler extends SmashPerk return; } - if (!Recharge.Instance.use(player, GetName(), isSuperActive(player) ? COOLDOWN_SMASH : COOLDOWN_NORMAL, !isSuperActive(player), !isSuperActive(player))) + if (!Recharge.Instance.use(player, GetName(), isSuperActive(player) ? _cooldownSmash : _cooldownNormal, !isSuperActive(player), !isSuperActive(player))) { return; } - _active.put(player.getUniqueId(), 8); + _active.put(player.getUniqueId(), 7); UtilPlayer.message(player, F.main("Skill", "You used " + F.skill(GetName()) + ".")); } @@ -156,7 +165,7 @@ public class PerkNeedler extends SmashPerk event.GetProjectile().remove(); // Damage Event - Manager.GetDamage().NewDamageEvent(event.GetDamageeEntity(), damager, null, DamageCause.THORNS, DAMAGE, true, true, false, damager.getName(), GetName()); + Manager.GetDamage().NewDamageEvent(event.GetDamageeEntity(), damager, null, DamageCause.THORNS, _damage, true, true, false, damager.getName(), GetName()); if (!isTeamDamage(damager, event.GetDamageePlayer())) { @@ -176,7 +185,7 @@ public class PerkNeedler extends SmashPerk { Arrow arrow = arrowIterator.next(); - if (arrow.isOnGround() || !arrow.isValid() || arrow.getTicksLived() > MAX_TICKS) + if (arrow.isOnGround() || !arrow.isValid() || arrow.getTicksLived() > _maxTicks) { arrowIterator.remove(); arrow.remove(); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/spider/PerkSpiderLeap.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/spider/PerkSpiderLeap.java index dc62b516e..7db5d925c 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/spider/PerkSpiderLeap.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/spider/PerkSpiderLeap.java @@ -26,8 +26,8 @@ import nautilus.game.arcade.kit.Perk; public class PerkSpiderLeap extends Perk { - private static final float ENERGY_PER_TICK = 0.005F; - private static final float ENERGY_PER_LEAP = 0.17F; + private float _energyTick; + private float _energyJump; private Set _secondJump = new HashSet<>(); private Set _finalJump = new HashSet<>(); @@ -38,6 +38,13 @@ public class PerkSpiderLeap extends Perk + "Wall Climb requires Energy (Experience Bar)." }); } + @Override + public void setupValues() + { + _energyTick = getPerkFloat("Energy Per Tick"); + _energyJump = getPerkFloat("Energy Per Jump"); + } + @EventHandler public void WallClimb(UpdateEvent event) { @@ -62,19 +69,19 @@ public class PerkSpiderLeap extends Perk _secondJump.remove(player.getUniqueId()); } - player.setExp(Math.min(0.999F, player.getExp() + (grounded ? ENERGY_PER_TICK * 2 : ENERGY_PER_TICK))); + player.setExp(Math.min(0.999F, player.getExp() + (grounded ? _energyTick * 2 : _energyTick))); continue; } - player.setExp(Math.max(0, player.getExp() - ENERGY_PER_TICK)); + player.setExp(Math.max(0, player.getExp() - _energyTick)); if (player.getExp() <= 0) { continue; } - if (player.getExp() >= ENERGY_PER_LEAP) + if (player.getExp() >= _energyJump) { _finalJump.remove(player.getUniqueId()); } @@ -116,7 +123,7 @@ public class PerkSpiderLeap extends Perk // Disable Flight player.setAllowFlight(false); - if (player.getExp() < ENERGY_PER_LEAP) + if (player.getExp() < _energyJump) { if (!_finalJump.contains(player.getUniqueId())) { @@ -132,7 +139,7 @@ public class PerkSpiderLeap extends Perk UtilAction.velocity(player, 1.0, 0.2, 1.0, true); // Energy - player.setExp(Math.max(0, player.getExp() - ENERGY_PER_LEAP)); + //player.setExp(Math.max(0, player.getExp() - _energyJump)); // Sound player.getWorld().playSound(player.getLocation(), Sound.SPIDER_IDLE, 1f, 1.5f); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/spider/PerkWebShot.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/spider/PerkWebShot.java index 1fdd08267..ec2bb90fa 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/spider/PerkWebShot.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/spider/PerkWebShot.java @@ -30,15 +30,23 @@ import nautilus.game.arcade.game.games.smash.perks.SmashPerk; public class PerkWebShot extends SmashPerk implements IThrown { - private static final int COOLDOWN_NORMAL = 10000; - private static final int COOLDOWN_SMASH = 1000; - private static final int WEBS = 20; + private int _cooldownNormal = 10000; + private int _cooldownSmash = 1000; + private int _webs = 20; public PerkWebShot() { super("Spin Web", new String[] { C.cYellow + "Right-Click" + C.cGray + " with Axe to use " + C.cGreen + "Spin Web" }); } + @Override + public void setupValues() + { + _cooldownNormal = getPerkTime("Cooldown Normal"); + _cooldownSmash = getPerkTime("Cooldown Smash"); + _webs = getPerkInt("Webs"); + } + @EventHandler public void ShootWeb(PlayerInteractEvent event) { @@ -69,7 +77,7 @@ public class PerkWebShot extends SmashPerk implements IThrown return; } - if (!Recharge.Instance.use(player, GetName(), isSuperActive(player) ? COOLDOWN_SMASH : COOLDOWN_NORMAL, !isSuperActive(player), !isSuperActive(player))) + if (!Recharge.Instance.use(player, GetName(), isSuperActive(player) ? _cooldownSmash : _cooldownNormal, !isSuperActive(player), !isSuperActive(player))) { return; } @@ -79,7 +87,7 @@ public class PerkWebShot extends SmashPerk implements IThrown // Boost UtilAction.velocity(player, 1.2, 0.2, 1.2, true); - for (int i = 0; i < WEBS; i++) + for (int i = 0; i < _webs; i++) { Item ent = player.getWorld().dropItem(player.getLocation().add(0, 0.5, 0), ItemStackFactory.Instance.CreateStack(Material.WEB, (byte) 0, 1, "Web " + player.getName() + " " + i)); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/spider/SmashSpider.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/spider/SmashSpider.java index 3ffcf8635..b0ed1055e 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/spider/SmashSpider.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/spider/SmashSpider.java @@ -22,13 +22,11 @@ import nautilus.game.arcade.game.games.smash.perks.SmashUltimate; public class SmashSpider extends SmashUltimate { - private static final int DURATION = 30000; - private Map _preHealth = new HashMap<>(); public SmashSpider() { - super("Spider Nest", new String[] {}, Sound.SPIDER_DEATH, DURATION); + super("Spider Nest", new String[] {}, Sound.SPIDER_DEATH, 0); } @Override @@ -61,11 +59,11 @@ public class SmashSpider extends SmashUltimate continue; } - Manager.GetBlockRestore().add(block, 30, (byte) 0, (int) (DURATION + 5000 * Math.random())); + Manager.GetBlockRestore().add(block, 30, (byte) 0, (int) (getLength() + 5000 * Math.random())); } // Regen - Manager.GetCondition().Factory().Regen(GetName(), player, player, DURATION / 1000, 2, false, false, false); + Manager.GetCondition().Factory().Regen(GetName(), player, player, getLength() / 1000, 2, false, false, false); } @EventHandler(priority = EventPriority.HIGH) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/squid/PerkFishFlurry.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/squid/PerkFishFlurry.java index 184f1b135..276650c3e 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/squid/PerkFishFlurry.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/squid/PerkFishFlurry.java @@ -1,11 +1,17 @@ package nautilus.game.arcade.game.games.smash.perks.squid; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; -import java.util.Set; - +import mineplex.core.common.util.*; +import mineplex.core.common.util.UtilEvent.ActionType; +import mineplex.core.common.util.UtilParticle.ParticleType; +import mineplex.core.common.util.UtilParticle.ViewDist; +import mineplex.core.itemstack.ItemStackFactory; +import mineplex.core.projectile.IThrown; +import mineplex.core.projectile.ProjectileUser; +import mineplex.core.recharge.Recharge; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.game.games.smash.perks.SmashPerk; import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.block.Block; @@ -18,39 +24,16 @@ import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.player.PlayerInteractEvent; 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.UtilAlg; -import mineplex.core.common.util.UtilBlock; -import mineplex.core.common.util.UtilEnt; -import mineplex.core.common.util.UtilEvent; -import mineplex.core.common.util.UtilEvent.ActionType; -import mineplex.core.common.util.UtilItem; -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.UtilPlayer; -import mineplex.core.common.util.UtilServer; -import mineplex.core.common.util.UtilTime; -import mineplex.core.itemstack.ItemStackFactory; -import mineplex.core.projectile.IThrown; -import mineplex.core.projectile.ProjectileUser; -import mineplex.core.recharge.Recharge; -import mineplex.core.updater.UpdateType; -import mineplex.core.updater.event.UpdateEvent; -import mineplex.minecraft.game.core.damage.CustomDamageEvent; -import nautilus.game.arcade.game.games.smash.perks.SmashPerk; +import java.util.*; public class PerkFishFlurry extends SmashPerk implements IThrown { - private static final int COOLDOWN = 24000; - private static final float DAMAGE = 2.6F; - private static final int START_TIME = 2000; - private static final int END_TIME = 6000; - private static final float KNOCKBACK_MAGNITUDE = 1.5F; + private int _cooldown; + private float _damage; + private int _startTime; + private int _endTime; + private float _knockbackMagnitude; private List _active = new ArrayList<>(); @@ -59,6 +42,16 @@ public class PerkFishFlurry extends SmashPerk implements IThrown super("Fish Flurry", new String[] { C.cYellow + "Right-Click" + C.cGray + " with Spade to use " + C.cGreen + "Fish Flurry" }); } + @Override + public void setupValues() + { + _cooldown = getPerkTime("Cooldown"); + _damage = getPerkFloat("Damage"); + _startTime = getPerkTime("Start Time"); + _endTime = getPerkTime("End Time"); + _knockbackMagnitude = getPerkFloat("Knockback Magnitude"); + } + @EventHandler public void shoot(PlayerInteractEvent event) { @@ -128,7 +121,7 @@ public class PerkFishFlurry extends SmashPerk implements IThrown if (!blocks.isEmpty()) { - if (!Recharge.Instance.use(player, GetName(), COOLDOWN, true, true)) + if (!Recharge.Instance.use(player, GetName(), _cooldown, true, true)) { return; } @@ -157,7 +150,7 @@ public class PerkFishFlurry extends SmashPerk implements IThrown // particles for (Block block : data.Blocks) { - UtilParticle.PlayParticle(ParticleType.SPLASH, block.getLocation().add(0.5, 1, 0.5), 0.25f, 0, 0.25f, 0, 3, ViewDist.LONG, UtilServer.getPlayers()); + UtilParticle.PlayParticleToAll(ParticleType.SPLASH, block.getLocation().add(0.5, 1, 0.5), 0.25f, 0, 0.25f, 0, 1, ViewDist.LONG); } // sound @@ -167,12 +160,12 @@ public class PerkFishFlurry extends SmashPerk implements IThrown block.getWorld().playSound(block.getLocation(), Math.random() > 0.5 ? Sound.SPLASH : Sound.SPLASH2, 0.5f, 1f); } - if (!UtilTime.elapsed(data.StartTime, START_TIME)) + if (!UtilTime.elapsed(data.StartTime, _startTime)) { continue; } - if (!UtilTime.elapsed(data.StartTime, END_TIME)) + if (!UtilTime.elapsed(data.StartTime, _endTime)) { Item fish = block.getWorld().dropItem(block.getLocation().add(0.5, 1.5, 0.5), ItemStackFactory.Instance.CreateStack(Material.RAW_FISH, (byte) UtilMath.r(4), 1, "Fish" + Math.random())); @@ -195,7 +188,7 @@ public class PerkFishFlurry extends SmashPerk implements IThrown if (target != null) { // Damage Event - Manager.GetDamage().NewDamageEvent(target, data.getThrower(), null, DamageCause.PROJECTILE, DAMAGE, false, true, false, UtilEnt.getName(data.getThrower()), GetName()); + Manager.GetDamage().NewDamageEvent(target, data.getThrower(), null, DamageCause.PROJECTILE, _damage, false, true, false, UtilEnt.getName(data.getThrower()), GetName()); UtilParticle.PlayParticle(ParticleType.EXPLODE, target.getLocation().add(0, 1, 0), 1f, 1f, 1f, 0, 12, ViewDist.LONG, UtilServer.getPlayers()); } @@ -223,7 +216,7 @@ public class PerkFishFlurry extends SmashPerk implements IThrown return; } - event.AddKnockback(GetName(), KNOCKBACK_MAGNITUDE); + event.AddKnockback(GetName(), _knockbackMagnitude); event.setKnockbackOrigin(event.GetDamageeEntity().getLocation().add(Math.random() - 0.5, -0.1, Math.random() - 0.5)); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/squid/PerkInkBlast.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/squid/PerkInkBlast.java index 80f6d91a5..b2e1a00fc 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/squid/PerkInkBlast.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/squid/PerkInkBlast.java @@ -36,19 +36,27 @@ import nautilus.game.arcade.game.games.smash.perks.SmashPerk; public class PerkInkBlast extends SmashPerk implements IThrown { - private static final int COOLDOWN = 6000; - private static final float PROJECTILE_VELOCITY = 0.15F; - private static final int KNOCKBACK_MAGNITUDE = 3; - + private int _cooldown; + private float _spread; + private float _projectileVelocity; + private int _knockbackMagnitude; private int _bullets; private double _damagePerBullet; - public PerkInkBlast(int bullets, double damagePerBullet) + public PerkInkBlast() { super("Ink Shotgun", new String[] { C.cYellow + "Right-Click" + C.cGray + " with Axe to use " + C.cGreen + "Ink Shotgun" }); + } - _bullets = bullets; - _damagePerBullet = damagePerBullet; + @Override + public void setupValues() + { + _cooldown = getPerkTime("Cooldown"); + _spread = getPerkFloat("Spread"); + _projectileVelocity = getPerkFloat("Projectile Velocity"); + _knockbackMagnitude = getPerkInt("Knockback Magnitude"); + _bullets = getPerkInt("Bullets"); + _damagePerBullet = getPerkDouble("Damage Per Bullet"); } @EventHandler @@ -86,7 +94,7 @@ public class PerkInkBlast extends SmashPerk implements IThrown return; } - if (!Recharge.Instance.use(player, GetName(), COOLDOWN, true, true)) + if (!Recharge.Instance.use(player, GetName(), _cooldown, true, true)) { return; } @@ -100,9 +108,9 @@ public class PerkInkBlast extends SmashPerk implements IThrown Item ent = player.getWorld().dropItem(player.getEyeLocation().add(player.getLocation().getDirection()), ItemStackFactory.Instance.CreateStack(Material.INK_SACK, (byte) 0, 1, "Ink" + Math .random())); - Vector random = new Vector(Math.random() - 0.5, Math.random() - 0.5, Math.random() - 0.5); + Vector random = new Vector((Math.random() - 0.5) * _spread, (Math.random() - 0.5) * _spread, (Math.random() - 0.5) * _spread); random.normalize(); - random.multiply(PROJECTILE_VELOCITY); + random.multiply(_projectileVelocity); if (i == 0) { @@ -164,6 +172,6 @@ public class PerkInkBlast extends SmashPerk implements IThrown return; } - event.AddKnockback(GetName(), KNOCKBACK_MAGNITUDE); + event.AddKnockback(GetName(), _knockbackMagnitude); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/squid/PerkSuperSquid.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/squid/PerkSuperSquid.java index dc203d554..13dff7e65 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/squid/PerkSuperSquid.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/squid/PerkSuperSquid.java @@ -31,8 +31,8 @@ import nautilus.game.arcade.game.games.smash.perks.SmashPerk; public class PerkSuperSquid extends SmashPerk { - private static final int COOLDOWN = 8000; - private static final int VELOCITY_TIME = 1100; + private int _cooldown; + private int _velocityTime; private Map _active = new HashMap<>(); @@ -41,6 +41,13 @@ public class PerkSuperSquid extends SmashPerk super("Super Squid", new String[] { C.cYellow + "Hold Block" + C.cGray + " to use " + C.cGreen + "Super Squid", }); } + @Override + public void setupValues() + { + _cooldown = getPerkTime("Cooldown"); + _velocityTime = getPerkInt("Velocity Time (ms)"); + } + @EventHandler public void Activate(PlayerInteractEvent event) { @@ -76,7 +83,7 @@ public class PerkSuperSquid extends SmashPerk return; } - if (!Recharge.Instance.use(player, GetName(), COOLDOWN, true, true)) + if (!Recharge.Instance.use(player, GetName(), _cooldown, true, true)) { return; } @@ -112,7 +119,7 @@ public class PerkSuperSquid extends SmashPerk continue; } - if (UtilTime.elapsed(_active.get(cur.getUniqueId()), VELOCITY_TIME)) + if (UtilTime.elapsed(_active.get(cur.getUniqueId()), _velocityTime)) { _active.remove(cur.getUniqueId()); continue; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/squid/SmashSquid.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/squid/SmashSquid.java index 118449e13..f7cc4b4e5 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/squid/SmashSquid.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/squid/SmashSquid.java @@ -38,18 +38,29 @@ import nautilus.game.arcade.game.games.smash.perks.SmashUltimate; public class SmashSquid extends SmashUltimate { - private static final int DURATION = 24000; - private static final int RATE = 1600; - private static final int MAX_RANGE = 100; - private static final int DAMAGE = 16; - private static final int DAMAGE_RADIUS = 8; - private static final int KNOCKBACK_MAGNITUDE = 3; + private int _rate; + private int _maxRange; + private int _damage; + private int _damageRadius; + private int _knockbackMagnitude; public SmashSquid() { - super("Storm Squid", new String[] {}, Sound.SPLASH2, DURATION); + super("Storm Squid", new String[] {}, Sound.SPLASH2, 0); } - + + @Override + public void setupValues() + { + super.setupValues(); + + _rate = getPerkInt("Rate (ms)"); + _maxRange = getPerkInt("Max Range"); + _damage = getPerkInt("Damage"); + _damageRadius = getPerkInt("Damage Radius"); + _knockbackMagnitude = getPerkInt("Knockback Magnitude"); + } + @Override public void activate(Player player) { @@ -98,7 +109,7 @@ public class SmashSquid extends SmashUltimate return; } - Block block = UtilPlayer.getTarget(player, UtilBlock.blockAirFoliageSet, MAX_RANGE); + Block block = UtilPlayer.getTarget(player, UtilBlock.blockAirFoliageSet, _maxRange); if (block == null) { @@ -107,7 +118,7 @@ public class SmashSquid extends SmashUltimate final Location loc = block.getLocation().add(0.5, 0.5, 0.5); - if (!Recharge.Instance.use(player, GetName() + " Strike", RATE, false, false)) + if (!Recharge.Instance.use(player, GetName() + " Strike", _rate, false, false)) { return; } @@ -124,7 +135,7 @@ public class SmashSquid extends SmashUltimate // Warning player.getWorld().spigot().strikeLightningEffect(loc, false); - Map targets = UtilEnt.getInRadius(loc, DAMAGE_RADIUS); + Map targets = UtilEnt.getInRadius(loc, _damageRadius); for (LivingEntity cur : targets.keySet()) { @@ -134,7 +145,7 @@ public class SmashSquid extends SmashUltimate } // Damage Event - Manager.GetDamage().NewDamageEvent(cur, player, null, DamageCause.CUSTOM, DAMAGE * targets.get(cur), false, true, false, player.getName(), GetName()); + Manager.GetDamage().NewDamageEvent(cur, player, null, DamageCause.CUSTOM, _damage * targets.get(cur), false, true, false, player.getName(), GetName()); // Velocity UtilAction.velocity(cur, UtilAlg.getTrajectory(loc, cur.getLocation()), 3 * targets.get(cur), false, 0, 1 * targets.get(cur), 2, true); @@ -245,6 +256,6 @@ public class SmashSquid extends SmashUltimate return; } - event.AddKnockback(GetName(), KNOCKBACK_MAGNITUDE); + event.AddKnockback(GetName(), _knockbackMagnitude); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witch/PerkBatWave.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witch/PerkBatWave.java index 6433024c5..298f58edf 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witch/PerkBatWave.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witch/PerkBatWave.java @@ -44,14 +44,15 @@ import nautilus.game.arcade.game.games.smash.perks.SmashPerk; public class PerkBatWave extends SmashPerk { - - private static final int COOLDOWN = 8000; + private static final int LEASH_COOLDOWN = 500; - private static final int HIT_COOLDOWN = 200; - private static final int HIT_BOX = 2; - private static final int DAMAGE = 3; - private static final int DISABLE_DAMAGE = 20; - private static final float KNOCKBACK_MAGNITUDE = 1.75F; + + private int _cooldown; + private int _hitCooldown; + private int _hitBox; + private int _damage; + private int _disableDamage; + private float _knockbackMagnitude; private static final String LEASH = "Leash Bats"; private static final String HIT = "Hit By Bat"; @@ -69,6 +70,17 @@ public class PerkBatWave extends SmashPerk + C.cGreen + "Bat Leash" }); } + @Override + public void setupValues() + { + _cooldown = getPerkTime("Cooldown"); + _hitCooldown = getPerkInt("Hit Cooldown (ms)"); + _hitBox = getPerkInt("Hit Box"); + _damage = getPerkInt("Damage"); + _disableDamage = getPerkInt("Disable Damage"); + _knockbackMagnitude = getPerkFloat("Knockback Magnitude"); + } + @EventHandler public void Activate(PlayerInteractEvent event) { @@ -106,7 +118,7 @@ public class PerkBatWave extends SmashPerk UUID key = player.getUniqueId(); - if (!Recharge.Instance.use(player, GetName(), COOLDOWN, false, true)) + if (!Recharge.Instance.use(player, GetName(), _cooldown, false, true)) { if (_active.containsKey(key)) { @@ -138,7 +150,7 @@ public class PerkBatWave extends SmashPerk else { // Inform - Recharge.Instance.use(player, GetName(), COOLDOWN, true, true); + Recharge.Instance.use(player, GetName(), _cooldown, true, true); } } else @@ -219,10 +231,10 @@ public class PerkBatWave extends SmashPerk continue; } - if (UtilEnt.hitBox(bat.getLocation(), other, HIT_BOX, null)) + if (UtilEnt.hitBox(bat.getLocation(), other, _hitBox, null)) { // Damage Event - Manager.GetDamage().NewDamageEvent(other, cur, null, DamageCause.CUSTOM, DAMAGE, true, true, false, cur.getName(), GetName()); + Manager.GetDamage().NewDamageEvent(other, cur, null, DamageCause.CUSTOM, _damage, true, true, false, cur.getName(), GetName()); // Effect bat.getWorld().playSound(bat.getLocation(), Sound.BAT_HURT, 1f, 1f); @@ -231,7 +243,7 @@ public class PerkBatWave extends SmashPerk bat.remove(); // Recharge on hit - Recharge.Instance.useForce(other, HIT, HIT_COOLDOWN); + Recharge.Instance.useForce(other, HIT, _hitCooldown); } } } @@ -281,7 +293,7 @@ public class PerkBatWave extends SmashPerk bat.remove(); } - _bats.remove(player); + _bats.remove(player.getUniqueId()); } } @@ -299,7 +311,7 @@ public class PerkBatWave extends SmashPerk { _damageTaken.put(key, (_damageTaken.get(key) + event.GetDamage())); - if (_damageTaken.get(key) >= DISABLE_DAMAGE) + if (event.GetCause() == DamageCause.ENTITY_ATTACK || _damageTaken.get(key) >= _disableDamage) { Clear(player); } @@ -311,6 +323,6 @@ public class PerkBatWave extends SmashPerk return; } - event.AddKnockback(GetName(), KNOCKBACK_MAGNITUDE); + event.AddKnockback(GetName(), _knockbackMagnitude); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witch/PerkWitchPotion.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witch/PerkWitchPotion.java index 02dd04394..217f01b77 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witch/PerkWitchPotion.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witch/PerkWitchPotion.java @@ -40,11 +40,11 @@ import nautilus.game.arcade.game.games.smash.perks.SmashPerk; public class PerkWitchPotion extends SmashPerk implements IThrown { - private static final int COOLDOWN = 2000; - private static final int RANGE_NOMRAL = 3; - private static final int DAMAGE_DIRECT = 7; - private static final int DAMAGE_DISTANCE = 6; - private static final int KNOCKBACK_MAGNITUDE = 2; + private int _cooldown; + private int _range; + private int _damageDirect; + private int _damageDistance; + private int _knockbackMagnitude; private List _proj = new ArrayList<>(); @@ -53,6 +53,16 @@ public class PerkWitchPotion extends SmashPerk implements IThrown super("Daze Potion", new String[] { C.cYellow + "Right-Click" + C.cGray + " with Axe to use " + C.cGreen + "Daze Potion" }); } + @Override + public void setupValues() + { + _cooldown = getPerkTime("Cooldown"); + _range = getPerkInt( "Range"); + _damageDirect = getPerkInt("Damage Direct"); + _damageDistance = getPerkInt("Damage Distance"); + _knockbackMagnitude = getPerkInt("Knockback Magnitude"); + } + @EventHandler public void Activate(PlayerInteractEvent event) { @@ -88,7 +98,7 @@ public class PerkWitchPotion extends SmashPerk implements IThrown return; } - if (!Recharge.Instance.use(player, GetName(), COOLDOWN, true, true)) + if (!Recharge.Instance.use(player, GetName(), _cooldown, true, true)) { return; } @@ -137,7 +147,7 @@ public class PerkWitchPotion extends SmashPerk implements IThrown return; } - event.AddKnockback(GetName(), KNOCKBACK_MAGNITUDE); + event.AddKnockback(GetName(), _knockbackMagnitude); } @Override @@ -153,18 +163,20 @@ public class PerkWitchPotion extends SmashPerk implements IThrown for (Player player : directHit) { - Manager.GetDamage().NewDamageEvent(player, thrower, null, DamageCause.CUSTOM, DAMAGE_DIRECT, true, true, false, thrower.getName(), GetName()); + Manager.GetDamage().NewDamageEvent(player, thrower, null, DamageCause.CUSTOM, _damageDirect, true, true, false, thrower.getName(), GetName()); + Manager.GetCondition().Factory().Slow(GetName(), target, thrower, 2, 1, true, true, false, false); } players.removeAll(directHit); - Vector a = data.getThrown().getLocation().subtract(RANGE_NOMRAL, RANGE_NOMRAL, RANGE_NOMRAL).toVector(); - Vector b = data.getThrown().getLocation().add(RANGE_NOMRAL, RANGE_NOMRAL, RANGE_NOMRAL).toVector(); + Vector a = data.getThrown().getLocation().subtract(_range, _range, _range).toVector(); + Vector b = data.getThrown().getLocation().add(_range, _range, _range).toVector(); for (Player player : players) { if(!UtilEnt.isInsideBoundingBox(player, a, b)) continue; - Manager.GetDamage().NewDamageEvent(player, thrower, null, DamageCause.CUSTOM, DAMAGE_DISTANCE, true, true, false, thrower.getName(), GetName()); + Manager.GetDamage().NewDamageEvent(player, thrower, null, DamageCause.CUSTOM, _damageDistance, true, true, false, thrower.getName(), GetName()); + Manager.GetCondition().Factory().Slow(GetName(), target, thrower, 2, 0, true, true, false, false); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witch/SmashWitch.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witch/SmashWitch.java index c8c048c3b..560a09453 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witch/SmashWitch.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witch/SmashWitch.java @@ -43,20 +43,33 @@ import nautilus.game.arcade.kit.perks.data.SonicBoomData; public class SmashWitch extends SmashUltimate { - private static final int DURATION = 20000; - private static final int COOLDOWN = 1200; - private static final int MAX_TIME = 12000; - private static final int HIT_BOX = 4; - private static final int DAMAGE_RADIUS = 10; - private static final int DAMAGE = 12; - private static final int FLAP_COOLDOWN = 40; - private static final int KNOCKBACK_MAGNITUDE = 2; + private int _cooldown; + private int _maxTime; + private int _hitBox; + private int _damageRadius; + private int _damage; + private int _flapCooldown; + private int _knockbackMagnitude; private List _sonic = new ArrayList<>(); public SmashWitch() { - super("Bat Form", new String[] {}, Sound.BAT_HURT, DURATION); + super("Bat Form", new String[] {}, Sound.BAT_HURT, 0); + } + + @Override + public void setupValues() + { + super.setupValues(); + + _cooldown = getPerkInt("Cooldown (ms)"); + _maxTime = getPerkTime("Max Time"); + _hitBox = getPerkInt("Hit Box"); + _damageRadius = getPerkInt("Damage Radius"); + _damage = getPerkInt("Damage"); + _flapCooldown = getPerkInt("Flap Cooldown (ms)"); + _knockbackMagnitude = getPerkInt("Knockback Magnitude"); } @Override @@ -148,7 +161,7 @@ public class SmashWitch extends SmashUltimate return; } - if (!Recharge.Instance.use(player, GetName() + " Screech", COOLDOWN, false, false)) + if (!Recharge.Instance.use(player, GetName() + " Screech", _cooldown, false, false)) { return; } @@ -174,7 +187,7 @@ public class SmashWitch extends SmashUltimate SonicBoomData data = sonicIter.next(); // Time Boom - if (UtilTime.elapsed(data.Time, MAX_TIME)) + if (UtilTime.elapsed(data.Time, _maxTime)) { sonicIter.remove(); explode(data); @@ -202,7 +215,7 @@ public class SmashWitch extends SmashUltimate continue; } - if (UtilMath.offset(player.getLocation().add(0, 1, 0), data.Location) < HIT_BOX) + if (UtilMath.offset(player.getLocation().add(0, 1, 0), data.Location) < _hitBox) { sonicIter.remove(); explode(data); @@ -226,7 +239,7 @@ public class SmashWitch extends SmashUltimate data.Location.getWorld().playSound(data.Location, Sound.EXPLODE, 1f, 1.5f); // Damage - Map targets = UtilEnt.getInRadius(data.Location, DAMAGE_RADIUS); + Map targets = UtilEnt.getInRadius(data.Location, _damageRadius); for (LivingEntity cur : targets.keySet()) { @@ -235,7 +248,7 @@ public class SmashWitch extends SmashUltimate continue; } - Manager.GetDamage().NewDamageEvent(cur, data.Shooter, null, DamageCause.CUSTOM, DAMAGE * targets.get(cur) + 0.5, true, false, false, data.Shooter.getName(), GetName()); + Manager.GetDamage().NewDamageEvent(cur, data.Shooter, null, DamageCause.CUSTOM, _damage * targets.get(cur) + 0.5, true, false, false, data.Shooter.getName(), GetName()); } } @@ -272,7 +285,7 @@ public class SmashWitch extends SmashUltimate player.getWorld().playSound(player.getLocation(), Sound.BAT_TAKEOFF, (float) (0.3 + player.getExp()), (float) (Math.random() / 2 + 0.5)); // Set Recharge - Recharge.Instance.use(player, GetName() + " Flap", FLAP_COOLDOWN, false, false); + Recharge.Instance.use(player, GetName() + " Flap", _flapCooldown, false, false); } @EventHandler @@ -316,6 +329,6 @@ public class SmashWitch extends SmashUltimate return; } - event.AddKnockback(GetName(), KNOCKBACK_MAGNITUDE); + event.AddKnockback(GetName(), _knockbackMagnitude); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witherskeleton/PerkWitherImage.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witherskeleton/PerkWitherImage.java index ba5a90767..605ea110c 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witherskeleton/PerkWitherImage.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witherskeleton/PerkWitherImage.java @@ -5,6 +5,7 @@ import java.util.Iterator; import java.util.Map; import java.util.UUID; +import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.Sound; @@ -32,13 +33,14 @@ import mineplex.core.utils.UtilVariant; import mineplex.minecraft.game.core.damage.CustomDamageEvent; import nautilus.game.arcade.game.games.smash.perks.SmashPerk; +import org.bukkit.util.Vector; public class PerkWitherImage extends SmashPerk { - private static final int COOLDOWN = 12000; - private static final int SWAP_COOLDOWN = 2000; - private static final int TARGET_RADIUS = 15; + private int _cooldown; + private int _swapCooldown; + private int _targetRadius; private Map _skeletons = new HashMap<>(); @@ -48,6 +50,14 @@ public class PerkWitherImage extends SmashPerk + "Wither Swap" }); } + @Override + public void setupValues() + { + _cooldown = getPerkTime("Cooldown"); + _swapCooldown = getPerkTime("Swap Cooldown"); + _targetRadius = getPerkInt("Target Radius"); + } + @EventHandler public void activate(PlayerInteractEvent event) { @@ -85,7 +95,7 @@ public class PerkWitherImage extends SmashPerk if (!_skeletons.containsKey(player.getUniqueId())) { - if (!Recharge.Instance.use(player, GetName(), COOLDOWN, true, true)) + if (!Recharge.Instance.use(player, GetName(), _cooldown, true, true)) { return; } @@ -101,7 +111,7 @@ public class PerkWitherImage extends SmashPerk skel.setMaxHealth(20); skel.setHealth(skel.getMaxHealth()); - for (Player other : UtilPlayer.getNearby(skel.getLocation(), TARGET_RADIUS)) + for (Player other : UtilPlayer.getNearby(skel.getLocation(), _targetRadius)) { if (player.equals(other) || UtilPlayer.isSpectator(other) || isTeamDamage(player, other)) { @@ -127,7 +137,7 @@ public class PerkWitherImage extends SmashPerk _skeletons.put(player.getUniqueId(), skel); - Recharge.Instance.use(player, "Wither Swap", SWAP_COOLDOWN / 4, false, false); + Recharge.Instance.use(player, "Wither Swap", _swapCooldown / 4, false, false); // Sound player.getWorld().playSound(player.getLocation(), Sound.WITHER_SPAWN, 1f, 1f); @@ -137,16 +147,20 @@ public class PerkWitherImage extends SmashPerk } else { - if (!Recharge.Instance.use(player, "Wither Swap", SWAP_COOLDOWN, true, false)) + if (!Recharge.Instance.use(player, "Wither Swap", _swapCooldown, true, false)) { return; } Skeleton skel = _skeletons.get(player.getUniqueId()); + Vector oldSkeletonVector = skel.getVelocity().clone(); + Vector oldPlayerVector = player.getVelocity().clone(); Location loc = skel.getLocation(); skel.teleport(player.getLocation()); + UtilAction.velocity(skel, oldPlayerVector); player.teleport(loc); + UtilAction.velocity(player, oldSkeletonVector); // Sound player.getWorld().playSound(player.getLocation(), Sound.WITHER_SPAWN, 1f, 2f); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witherskeleton/PerkWitherSkull.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witherskeleton/PerkWitherSkull.java index 8f6845044..bd2c99b0e 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witherskeleton/PerkWitherSkull.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witherskeleton/PerkWitherSkull.java @@ -40,10 +40,10 @@ import nautilus.game.arcade.game.games.smash.perks.SmashPerk; public class PerkWitherSkull extends SmashPerk { - private static final int COOLDOWN_NORMAL = 6000; - private static final int COOLDOWN_SMASH = 1000; - private static final int DAMAGE = 12; - private static final float KNOCKBACK_MAGNITUDE = 1.5F; + private int _cooldownNormal; + private int _cooldownSmash; + private int _damage; + private float _knockbackMagnitude; private Map _active = new HashMap<>(); private Set _ignoreControl = new HashSet<>(); @@ -53,6 +53,15 @@ public class PerkWitherSkull extends SmashPerk super("Wither Skull", new String[] { C.cYellow + "Hold Block" + C.cGray + " to use " + C.cGreen + "Wither Skull" }); } + @Override + public void setupValues() + { + _cooldownNormal = getPerkTime("Cooldown Normal"); + _cooldownSmash = getPerkTime("Cooldown Smash"); + _damage = getPerkInt("Damage"); + _knockbackMagnitude = getPerkFloat("Knockback Magnitude"); + } + @EventHandler(priority = EventPriority.LOW) // Happen BEFORE super is // triggered public void activate(PlayerInteractEvent event) @@ -88,7 +97,7 @@ public class PerkWitherSkull extends SmashPerk return; } - if (!Recharge.Instance.use(player, GetName(), smash ? COOLDOWN_SMASH : COOLDOWN_NORMAL, !smash, !smash)) + if (!Recharge.Instance.use(player, GetName(), smash ? _cooldownSmash : _cooldownNormal, !smash, !smash)) { return; } @@ -211,7 +220,7 @@ public class PerkWitherSkull extends SmashPerk } // Damage Event - Manager.GetDamage().NewDamageEvent(player, (LivingEntity) skull.getShooter(), null, DamageCause.CUSTOM, DAMAGE * players.get(player) * scale, true, true, false, UtilEnt.getName( + Manager.GetDamage().NewDamageEvent(player, (LivingEntity) skull.getShooter(), null, DamageCause.CUSTOM, _damage * players.get(player) * scale, true, true, false, UtilEnt.getName( (LivingEntity) skull.getShooter()), GetName()); } } @@ -224,6 +233,6 @@ public class PerkWitherSkull extends SmashPerk return; } - event.AddKnockback(GetName(), KNOCKBACK_MAGNITUDE); + event.AddKnockback(GetName(), _knockbackMagnitude); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witherskeleton/SmashWitherSkeleton.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witherskeleton/SmashWitherSkeleton.java index 717328a64..59d232b8b 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witherskeleton/SmashWitherSkeleton.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witherskeleton/SmashWitherSkeleton.java @@ -28,11 +28,9 @@ import nautilus.game.arcade.game.games.smash.perks.SmashUltimate; public class SmashWitherSkeleton extends SmashUltimate { - private static final int DURAITON = 18000; - public SmashWitherSkeleton() { - super("Wither Form", new String[] {}, Sound.WITHER_SPAWN, DURAITON); + super("Wither Form", new String[] {}, Sound.WITHER_SPAWN, 0); } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/wolf/PerkWolf.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/wolf/PerkWolf.java index a5968ac4e..dfc79d277 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/wolf/PerkWolf.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/wolf/PerkWolf.java @@ -41,13 +41,13 @@ import nautilus.game.arcade.game.games.smash.perks.SmashPerk; public class PerkWolf extends SmashPerk { - private static final int TACKLE_COOLDOWN_NORMAL = 8000; - private static final int TACKLE_COOLDOWN_SMASH = 1600; - private static final int WOLF_HEALTH = 30; - private static final float WOLF_HIT_BOX = 2.5F; - private static final int WOLF_MAX_TICKS = 70; - private static final int TACKLE_DAMAGE = 5; - private static final int STRIKE_DAMAGE = 7; + private int _cooldownNormal; + private int _cooldownSmash; + private int _wolfHealth; + private float _hitBox; + private int _maxTicks; + private int _tackleDamage; + private int _strikeDamage; private static final String CUB_TACKLE = "Cub Tackle"; private static final String WOLF_STRIKE = "Wolf Strike"; @@ -67,6 +67,18 @@ public class PerkWolf extends SmashPerk + "Right-Click" + C.cGray + " with Spade to use " + C.cGreen + WOLF_STRIKE, C.cGray + "Wolf Strike deals 300% Knockback to tackled opponents.", }); } + @Override + public void setupValues() + { + _cooldownNormal = getPerkTime("Cooldown Normal"); + _cooldownSmash = getPerkInt("Cooldown Smash (ms)"); + _wolfHealth = getPerkInt("Wolf Health"); + _hitBox = getPerkFloat("Hit Box"); + _maxTicks = getPerkInt("Max Ticks"); + _tackleDamage = getPerkInt("Tackle Damage"); + _strikeDamage = getPerkInt("Strike Damage"); + } + @EventHandler public void tackleTrigger(PlayerInteractEvent event) { @@ -99,7 +111,7 @@ public class PerkWolf extends SmashPerk boolean smash = isSuperActive(player); - if (!Recharge.Instance.use(player, CUB_TACKLE, smash ? TACKLE_COOLDOWN_SMASH : TACKLE_COOLDOWN_NORMAL, !smash, !smash)) + if (!Recharge.Instance.use(player, CUB_TACKLE, smash ? _cooldownSmash : _cooldownNormal, !smash, !smash)) { return; } @@ -115,7 +127,7 @@ public class PerkWolf extends SmashPerk UtilEnt.vegetate(wolf); - wolf.setMaxHealth(WOLF_HEALTH); + wolf.setMaxHealth(_wolfHealth); wolf.setHealth(wolf.getMaxHealth()); UtilAction.velocity(wolf, player.getLocation().getDirection(), 1.8, false, 0, 0.2, 1.2, true); @@ -152,7 +164,7 @@ public class PerkWolf extends SmashPerk continue; } - if (UtilEnt.hitBox(wolf.getLocation(), other, WOLF_HIT_BOX, null)) + if (UtilEnt.hitBox(wolf.getLocation(), other, _hitBox, null)) { if (other.equals(tackleGetOwner(wolf))) { @@ -166,7 +178,7 @@ public class PerkWolf extends SmashPerk } } - if (!wolf.isValid() || (UtilEnt.isGrounded(wolf) && wolf.getTicksLived() > WOLF_MAX_TICKS)) + if (!wolf.isValid() || (UtilEnt.isGrounded(wolf) && wolf.getTicksLived() > _maxTicks)) { wolf.remove(); wolfIterator.remove(); @@ -195,7 +207,7 @@ public class PerkWolf extends SmashPerk UtilAction.zeroVelocity(damagee); // Damage - Manager.GetDamage().NewDamageEvent(damagee, damager, null, DamageCause.CUSTOM, TACKLE_DAMAGE, false, true, false, damager.getName(), CUB_TACKLE); + Manager.GetDamage().NewDamageEvent(damagee, damager, null, DamageCause.CUSTOM, _tackleDamage, false, true, false, damager.getName(), CUB_TACKLE); // Sound damagee.getWorld().playSound(damagee.getLocation(), Sound.WOLF_GROWL, 1.5f, 1.5f); @@ -220,14 +232,14 @@ public class PerkWolf extends SmashPerk Wolf wolf = wolfIterator.next(); LivingEntity ent = _tackle.get(wolf); - if (!wolf.isValid() || !ent.isValid() || wolf.getTicksLived() > WOLF_MAX_TICKS) + if (!wolf.isValid() || !ent.isValid() || wolf.getTicksLived() > _maxTicks) { wolf.remove(); wolfIterator.remove(); continue; } - if (UtilMath.offset(wolf, ent) < WOLF_HIT_BOX) + if (UtilMath.offset(wolf, ent) < _hitBox) { Manager.GetCondition().Factory().Slow(CUB_TACKLE, ent, wolf, 0.9, 1, false, false, false, false); UtilAction.velocity(ent, new Vector(0, -0.3, 0)); @@ -362,7 +374,7 @@ public class PerkWolf extends SmashPerk continue; } - if (UtilEnt.hitBox(player.getLocation().add(0, 1, 0), other, WOLF_HIT_BOX, null)) + if (UtilEnt.hitBox(player.getLocation().add(0, 1, 0), other, _hitBox, null)) { strikeHit(player, other); playerIterator.remove(); @@ -404,7 +416,7 @@ public class PerkWolf extends SmashPerk } } - Manager.GetDamage().NewDamageEvent(damagee, damager, null, DamageCause.CUSTOM, STRIKE_DAMAGE, true, true, false, damager.getName(), WOLF_STRIKE); + Manager.GetDamage().NewDamageEvent(damagee, damager, null, DamageCause.CUSTOM, _strikeDamage, true, true, false, damager.getName(), WOLF_STRIKE); // Sound damagee.getWorld().playSound(damagee.getLocation(), Sound.WOLF_BARK, 1.5f, 1f); @@ -476,7 +488,7 @@ public class PerkWolf extends SmashPerk if (count > 0) { - event.AddMod(damager.getName(), "Ravage", Math.min(2, count), false); + event.AddMod(damager.getName(), "Ravage", Math.min(3, count), false); // Sound damager.getWorld().playSound(damager.getLocation(), Sound.WOLF_BARK, (float) (0.5 + count * 0.25), (float) (1 + count * 0.25)); @@ -509,17 +521,7 @@ public class PerkWolf extends SmashPerk continue; } - Iterator timeIterator = _repeat.get(uuid).iterator(); - - while (timeIterator.hasNext()) - { - long time = timeIterator.next(); - - if (UtilTime.elapsed(time, 3000)) - { - timeIterator.remove(); - } - } + _repeat.get(uuid).removeIf(time -> UtilTime.elapsed(time, 3000)); // Exp player.setExp(Math.min(0.999f, _repeat.get(uuid).size() / 9f)); @@ -527,7 +529,6 @@ public class PerkWolf extends SmashPerk if(_repeat.get(uuid).isEmpty()) { playerIterator.remove(); - continue; } } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/wolf/SmashWolf.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/wolf/SmashWolf.java index eee6b9ca7..52d88a686 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/wolf/SmashWolf.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/wolf/SmashWolf.java @@ -13,11 +13,9 @@ import nautilus.game.arcade.game.games.smash.perks.SmashUltimate; public class SmashWolf extends SmashUltimate { - private static final int DURATION = 30000; - public SmashWolf() { - super("Frenzy", new String[] {}, Sound.WOLF_HOWL, DURATION); + super("Frenzy", new String[] {}, Sound.WOLF_HOWL, 0); } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/zombie/PerkOvercharge.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/zombie/PerkOvercharge.java index 92edcd250..e73c127fe 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/zombie/PerkOvercharge.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/zombie/PerkOvercharge.java @@ -40,13 +40,17 @@ public class PerkOvercharge extends SmashPerk private int _tick; private boolean _useExp; - public PerkOvercharge(int max, int tick, boolean useExpBar) + public PerkOvercharge() { super("Corrupted Arrow", new String[] { C.cYellow + "Charge" + C.cGray + " your Bow to use " + C.cGreen + "Corrupted Arrow" }); + } - _useExp = useExpBar; - _max = max; - _tick = tick; + @Override + public void setupValues() + { + _max = getPerkInt("Max"); + _tick = getPerkInt("Tick"); + _useExp = getPerkBoolean("Use Exp"); } @EventHandler diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/zombie/PerkZombieBile.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/zombie/PerkZombieBile.java index cea58d3c1..7fb954e14 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/zombie/PerkZombieBile.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/zombie/PerkZombieBile.java @@ -39,10 +39,10 @@ import nautilus.game.arcade.game.games.smash.perks.SmashPerk; public class PerkZombieBile extends SmashPerk implements IThrown { - private static final int COOLDOWN = 10000; - private static final int ITEMS = 3; - private static final int DAMAGE = 3; - private static final int KNOCKBACK_MAGNITUDE = 1; + private int _cooldown; + private int _items; + private int _damage; + private int _knockbackMagnitude; private Map _active = new HashMap<>(); @@ -51,6 +51,15 @@ public class PerkZombieBile extends SmashPerk implements IThrown super("Spew Bile", new String[] { C.cYellow + "Hold Block" + C.cGray + " to use " + C.cGreen + "Spew Bile" }); } + @Override + public void setupValues() + { + _cooldown = getPerkTime("Cooldown"); + _items = getPerkInt("Items"); + _damage = getPerkInt("Damage"); + _knockbackMagnitude = getPerkInt("Knockback Magnitude"); + } + @EventHandler public void activate(PlayerInteractEvent event) { @@ -81,7 +90,7 @@ public class PerkZombieBile extends SmashPerk implements IThrown return; } - if (!Recharge.Instance.use(player, GetName(), COOLDOWN, true, true)) + if (!Recharge.Instance.use(player, GetName(), _cooldown, true, true)) { return; } @@ -131,7 +140,7 @@ public class PerkZombieBile extends SmashPerk implements IThrown } // Projectiles - for (int i = 0; i < ITEMS; i++) + for (int i = 0; i < _items; i++) { Vector rand = new Vector((Math.random() - 0.5) * 0.525, (Math.random() - 0.5) * 0.525, (Math.random() - 0.5) * 0.525); @@ -164,7 +173,7 @@ public class PerkZombieBile extends SmashPerk implements IThrown } // Damage Event - Manager.GetDamage().NewDamageEvent(target, data.getThrower(), null, DamageCause.CUSTOM, DAMAGE, true, false, false, UtilEnt.getName(data.getThrower()), GetName()); + Manager.GetDamage().NewDamageEvent(target, data.getThrower(), null, DamageCause.CUSTOM, _damage, true, false, false, UtilEnt.getName(data.getThrower()), GetName()); data.getThrown().remove(); } @@ -189,6 +198,6 @@ public class PerkZombieBile extends SmashPerk implements IThrown return; } - event.AddKnockback(GetName(), KNOCKBACK_MAGNITUDE); + event.AddKnockback(GetName(), _knockbackMagnitude); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/modules/TrainingGameModule.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/modules/TrainingGameModule.java new file mode 100644 index 000000000..3305ba089 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/modules/TrainingGameModule.java @@ -0,0 +1,358 @@ +package nautilus.game.arcade.game.modules; + +import mineplex.core.common.events.EntityVelocityChangeEvent; +import mineplex.core.common.util.*; +import mineplex.core.itemstack.ItemBuilder; +import mineplex.core.recharge.Recharge; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.events.GameStateChangeEvent; +import nautilus.game.arcade.game.Game; +import nautilus.game.arcade.game.GameTeam; +import nautilus.game.arcade.kit.Kit; +import nautilus.game.arcade.kit.ProgressingKit; +import nautilus.game.arcade.managers.LobbyEnt; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; +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.EntityCombustEvent; +import org.bukkit.event.entity.EntityDamageEvent; +import org.bukkit.event.player.PlayerInteractEntityEvent; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.event.player.PlayerJoinEvent; +import org.bukkit.event.player.PlayerLoginEvent; +import org.bukkit.inventory.ItemStack; + +import java.util.*; +import java.util.function.Function; + +public class TrainingGameModule extends Module +{ + + private static final String RETURN_TO_SPAWN_RECHARGE = "Return To Select A Kit"; + private static final int RETURN_TO_SPAWN_COOLDOWN = 8000; + private static final ItemStack RETURN_TO_SPAWN_ITEM = new ItemBuilder(Material.BED) + .setTitle(C.cGreenB + RETURN_TO_SPAWN_RECHARGE) + .addLore("Click to return to the spawn island", "where you can select a new kit.") + .build(); + + private final Set _kits; + private Function _teamFunction; + private Function _skillFunction; + private Function _damageFunction; + + public TrainingGameModule() + { + _kits = new HashSet<>(); + } + + @EventHandler + public void live(GameStateChangeEvent event) + { + if (event.GetState() != Game.GameState.Live) + { + return; + } + + List locations = getGame().WorldData.GetDataLocs("PURPLE"); + int i = 0; + getGame().CreatureAllowOverride = true; + + for (Kit kit : getGame().GetKits()) + { + Location location = locations.get(i++); + Entity entity = kit.SpawnEntity(location); + + _kits.add(new LobbyEnt(entity, location, kit)); + } + + Location average = UtilAlg.getAverageLocation(locations); + + for (LobbyEnt entity : _kits) + { + UtilEnt.CreatureLook(entity.GetEnt(), average); + } + + getGame().CreatureAllowOverride = false; + } + + @Override + public void cleanup() + { + for (LobbyEnt lobbyEnt : _kits) + { + lobbyEnt.GetEnt().remove(); + } + + _kits.clear(); + } + + @EventHandler + public void kitMove(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + { + return; + } + + for (LobbyEnt ent : _kits) + { + Location location = ent.GetLocation(); + + ((CraftEntity) ent.GetEnt()).getHandle().setPosition(location.getX(), location.getY(), location.getZ()); + } + } + + @EventHandler + public void kitInteract(PlayerInteractEntityEvent event) + { + Player player = event.getPlayer(); + Entity entity = event.getRightClicked(); + LobbyEnt lobbyEnt = getFromEntity(entity); + + if (UtilPlayer.isSpectator(player)) + { + return; + } + + if (lobbyEnt != null) + { + getGame().getArcadeManager().Clear(player); + getGame().SetKit(event.getPlayer(), lobbyEnt.GetKit(), true); + event.setCancelled(true); + } + } + + @EventHandler + public void kitCombust(EntityCombustEvent event) + { + if (getFromEntity(event.getEntity()) != null) + { + event.setCancelled(true); + } + } + + @EventHandler + public void kitDamage(CustomDamageEvent event) + { + if (getFromEntity(event.GetDamageeEntity()) != null) + { + event.SetCancelled("Kit NPC"); + } + } + + @EventHandler(priority = EventPriority.LOWEST) + public void playerLogin(PlayerLoginEvent event) + { + Player player = event.getPlayer(); + Game game = getGame(); + GameTeam team = _teamFunction == null ? game.GetTeamList().get(0) : _teamFunction.apply(player); + + team.AddPlayer(player, true); + } + + @EventHandler(priority = EventPriority.MONITOR) + public void playerJoin(PlayerJoinEvent event) + { + Player player = event.getPlayer(); + + if (UtilPlayer.isSpectator(player)) + { + return; + } + + GameTeam team = getGame().GetTeam(player); + + team.SpawnTeleport(player); + + getGame().getArcadeManager().runSyncLater(() -> + { + Kit kit = null; + + for (Kit otherKit : getGame().GetKits()) + { + if (otherKit instanceof ProgressingKit) + { + ProgressingKit progressingKit = (ProgressingKit) otherKit; + + if (progressingKit.isDefault(player.getUniqueId())) + { + kit = progressingKit; + break; + } + } + } + + if (kit == null) + { + kit = getGame().GetKits()[0]; + } + + getGame().SetKit(player, kit, true); + }, 1); + } + + + @EventHandler(priority = EventPriority.LOWEST) + public void playerInteract(PlayerInteractEvent event) + { + if (_skillFunction == null) + { + return; + } + + Player player = event.getPlayer(); + + if (!_skillFunction.apply(player)) + { + event.setCancelled(true); + } + } + + @EventHandler(priority = EventPriority.LOWEST) + public void playerInteract(EntityDamageEvent event) + { + if (_skillFunction == null || !(event.getEntity() instanceof Player)) + { + return; + } + + Player player = (Player) event.getEntity(); + + if (!_skillFunction.apply(player)) + { + event.setCancelled(true); + } + } + + @EventHandler(priority = EventPriority.HIGHEST) + public void entityDamage(CustomDamageEvent event) + { + if (!(event.GetDamageeEntity() instanceof Player)) + { + return; + } + + Player player = event.GetDamageePlayer(); + + if (!event.isCancelled()) + { + Recharge.Instance.useForce(player, RETURN_TO_SPAWN_RECHARGE, RETURN_TO_SPAWN_COOLDOWN); + + if (event.GetDamagerEntity(true) instanceof Player) + { + Recharge.Instance.useForce(event.GetDamagerPlayer(true), RETURN_TO_SPAWN_RECHARGE, RETURN_TO_SPAWN_COOLDOWN); + } + } + + if (_damageFunction == null) + { + return; + } + + if (!_damageFunction.apply(player)) + { + event.SetCancelled("Training Area"); + } + } + + @EventHandler + public void entityVelocity(EntityVelocityChangeEvent event) + { + Entity entity = event.getEntity(); + + if (!(entity instanceof Player)) + { + return; + } + + Player player = (Player) entity; + + if (!_damageFunction.apply(player)) + { + event.setCancelled(true); + } + } + + @EventHandler + public void giveReturnToSpawn(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + { + return; + } + + for (Player player : getGame().GetPlayers(true)) + { + if (player.getInventory().contains(RETURN_TO_SPAWN_ITEM)) + { + continue; + } + + player.getInventory().setItem(8, RETURN_TO_SPAWN_ITEM); + } + } + + @EventHandler + public void interactReturnToSpawn(PlayerInteractEvent event) + { + Player player = event.getPlayer(); + ItemStack itemStack = player.getItemInHand(); + + if (itemStack == null || !itemStack.isSimilar(RETURN_TO_SPAWN_ITEM)) + { + return; + } + + if (event.isCancelled()) + { + player.sendMessage(F.main("Game", "You are already at the " + F.greenElem("Kit Selection Island") + ".")); + return; + } + + if (Recharge.Instance.usable(player, RETURN_TO_SPAWN_RECHARGE)) + { + getGame().RespawnPlayer(player); + } + else + { + player.sendMessage(F.main("Game", "You can't return to the " + F.greenElem("Kit Selection Island") + " if you are in " + F.greenElem("PVP") + ".")); + } + } + + public TrainingGameModule setTeamFunction(Function function) + { + _teamFunction = function; + return this; + } + + public TrainingGameModule setSkillFunction(Function function) + { + _skillFunction = function; + return this; + } + + public TrainingGameModule setDamageFunction(Function function) + { + _damageFunction = function; + return this; + } + + private LobbyEnt getFromEntity(Entity entity) + { + for (LobbyEnt lobbyEnt : _kits) + { + if (lobbyEnt.GetEnt().equals(entity)) + { + return lobbyEnt; + } + } + + return null; + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/Perk.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/Perk.java index 18a51d276..a727a304a 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/Perk.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/Perk.java @@ -1,9 +1,7 @@ package nautilus.game.arcade.kit; import nautilus.game.arcade.ArcadeManager; - -import org.bukkit.Bukkit; -import org.bukkit.Material; +import nautilus.game.arcade.managers.PerkSpreadsheetModule; import org.bukkit.entity.Player; import org.bukkit.event.Listener; @@ -17,57 +15,79 @@ public abstract class Perk implements Listener private boolean _display; private int _upgradeLevel; - + + protected PerkSpreadsheetModule _spreadsheet; + + public Perk(String name) + { + this(name, new String[0], true); + } + public Perk(String name, String[] perkDesc) { this(name, perkDesc, true); } - + public Perk(String name, String[] perkDesc, boolean display) { _perkName = name; _perkDesc = perkDesc; _display = display; } - + public boolean hasPerk(Player player) - { + { if (Manager.GetGame() == null) { return false; } - + if (!Manager.GetGame().IsLive()) { return false; } - + 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; Kit = kit; } + public final void setSpreadsheet(PerkSpreadsheetModule spreadsheet) + { + _spreadsheet = spreadsheet; + setupValues(); + } + + public void setupValues() + { + } + public String GetName() - { + { return _perkName; } - + + public void setDesc(String... desc) + { + _perkDesc = desc; + } + public String[] GetDesc() { return _perkDesc; @@ -77,8 +97,8 @@ public abstract class Perk implements Listener { return _display; } - - public void Apply(Player player) + + public void Apply(Player player) { //Null Default } @@ -93,8 +113,92 @@ public abstract class Perk implements Listener // When listener has been registered } - public Material getIcon() + private String getPerkObject(String id) { - return Material.SLIME_BALL; + String key = _spreadsheet.getKey(Kit, this, id); + + if (!_spreadsheet.getDataMap().containsKey(key)) + { + return null; + } + + return _spreadsheet.getDataMap().get(key); } -} + + protected boolean getPerkBoolean(String id) + { + return Boolean.valueOf(getPerkObject(id)); + } + + protected int getPerkInt(String id) + { + return Integer.parseInt(getPerkObject(id)); + } + + protected double getPerkDouble(String id) + { + return Double.parseDouble(getPerkObject(id)); + } + + protected float getPerkFloat(String id) + { + return Float.parseFloat(getPerkObject(id)); + } + + protected double getPerkPercentage(String id) + { + String value = getPerkObject(id); + value = value.substring(0, value.length() - 1); + double doubleValue = Double.parseDouble(value); + return doubleValue / 100; + } + + protected int getPerkTime(String id) + { + return getPerkInt(id) * 1000; + } + + protected boolean getPerkBoolean(String id, boolean defaultV) + { + String v = getPerkObject(id); + return v != null ? Boolean.valueOf(v) : defaultV; + } + + protected int getPerkInt(String id, int defaultV) + { + String v = getPerkObject(id); + return v != null ? Integer.valueOf(v) : defaultV; + } + + protected double getPerkDouble(String id, double defaultV) + { + String v = getPerkObject(id); + return v != null ? Double.valueOf(v) : defaultV; + } + + protected double getPerkFloat(String id, float defaultV) + { + String v = getPerkObject(id); + return v != null ? Float.valueOf(v) : defaultV; + } + + protected double getPerkPercentage(String id, double defaultV) + { + String value = getPerkObject(id); + + if (value == null) + { + return defaultV; + } + + value = value.substring(0, value.length() - 1); + double doubleValue = Double.parseDouble(value); + return doubleValue / 100; + } + + protected int getPerkTime(String id, int defaultV) + { + int v = getPerkInt(id, Integer.MIN_VALUE); + return v == Integer.MIN_VALUE ? defaultV : v * 1000; + } +} \ No newline at end of file diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBlizzard.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBlizzard.java index 68a30fba8..f96d40048 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBlizzard.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBlizzard.java @@ -1,5 +1,6 @@ package nautilus.game.arcade.kit.perks; +import java.util.Map; import java.util.WeakHashMap; import org.bukkit.Sound; @@ -26,7 +27,11 @@ import nautilus.game.arcade.kit.Perk; public class PerkBlizzard extends Perk { - private WeakHashMap _snowball = new WeakHashMap(); + + private float _energyTick; + private float _energyPerBall; + + private Map _snowball = new WeakHashMap<>(); public PerkBlizzard() { @@ -36,6 +41,13 @@ public class PerkBlizzard extends Perk }); } + @Override + public void setupValues() + { + _energyTick = getPerkFloat("Energy Per Tick"); + _energyPerBall = getPerkFloat("Energy Per Ball"); + } + @EventHandler public void EnergyUpdate(UpdateEvent event) { @@ -50,7 +62,7 @@ public class PerkBlizzard extends Perk if (player.isBlocking()) continue; - player.setExp((float) Math.min(0.999, player.getExp()+(1f/60f))); + player.setExp((float) Math.min(0.999, player.getExp()+ _energyTick)); } } @@ -72,7 +84,7 @@ public class PerkBlizzard extends Perk if (player.getExp() < 0.1) continue; - player.setExp((float) Math.max(0, player.getExp()-(1f/9f))); + player.setExp(Math.max(0, player.getExp() - _energyPerBall)); for (int i=0 ; i<4 ; i++) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkDamageSnow.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkDamageSnow.java index 1c97ba2fd..5c8d642b6 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkDamageSnow.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkDamageSnow.java @@ -12,7 +12,12 @@ public class PerkDamageSnow extends Perk { private int _damage; private double _knockback; - + + public PerkDamageSnow() + { + this(0, 0); + } + public PerkDamageSnow(int damage, double knockback) { super("Snow Attack", new String[] @@ -23,7 +28,14 @@ public class PerkDamageSnow extends Perk _damage = damage; _knockback = knockback; } - + + @Override + public void setupValues() + { + _damage = getPerkInt("Damage"); + _knockback = getPerkDouble("Knockback"); + } + @EventHandler(priority = EventPriority.HIGH) public void Knockback(CustomDamageEvent event) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkDeathsGrasp.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkDeathsGrasp.java index 3bcbf1db5..5b2cfef50 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkDeathsGrasp.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkDeathsGrasp.java @@ -41,10 +41,12 @@ import nautilus.game.arcade.kit.Perk; public class PerkDeathsGrasp extends Perk { private Map _live = new HashMap<>(); - private HashMap _weakness = new HashMap(); - - private static final long LEAP_DURATION = 1000; - private static final long WEAKNESS_DURATION = 1000; + private HashMap _weakness = new HashMap<>(); + + private int _cooldown; + private int _damage; + private int _leapDuration; + private int _weaknessDuration; public PerkDeathsGrasp() { @@ -55,6 +57,15 @@ public class PerkDeathsGrasp extends Perk }); } + @Override + public void setupValues() + { + _cooldown = getPerkTime("Cooldown"); + _damage = getPerkInt("Damage"); + _leapDuration = getPerkInt("Leap Duration (ms)"); + _weaknessDuration = getPerkInt("Weakness Duration (ms)"); + } + @EventHandler public void leap(PlayerInteractEvent event) { @@ -75,7 +86,7 @@ public class PerkDeathsGrasp extends Perk if (!Kit.HasKit(player)) return; - if (!Recharge.Instance.use(player, GetName(), 12000, true, true)) + if (!Recharge.Instance.use(player, GetName(), _cooldown, true, true)) return; UtilAction.velocity(player, player.getLocation().getDirection(), 1.4, false, 0, 0.2, 1.2, true); @@ -97,7 +108,6 @@ public class PerkDeathsGrasp extends Perk { return; } - //Leap End & Collide for(Iterator> it = _live.entrySet().iterator(); it.hasNext();) @@ -110,7 +120,7 @@ public class PerkDeathsGrasp extends Perk return; } - if (UtilEnt.isGrounded(player) && UtilTime.elapsed(e.getValue(), LEAP_DURATION)) + if (UtilEnt.isGrounded(player) && UtilTime.elapsed(e.getValue(), _leapDuration)) { it.remove(); return; @@ -119,7 +129,7 @@ public class PerkDeathsGrasp extends Perk List team = TeamSuperSmash.getTeam(Manager, player, true); for (Player other : Manager.GetGame().GetPlayers(true)) { - if(team.contains(other)) + if(UtilPlayer.isSpectator(player) || team.contains(other)) { continue; } @@ -142,7 +152,7 @@ public class PerkDeathsGrasp extends Perk continue; } - if (!UtilTime.elapsed(_weakness.get(ent), WEAKNESS_DURATION)) + if (!UtilTime.elapsed(_weakness.get(ent), _weaknessDuration)) { continue; } @@ -155,7 +165,7 @@ public class PerkDeathsGrasp extends Perk { //Damage Event Manager.GetDamage().NewDamageEvent(damagee, damager, null, - DamageCause.CUSTOM, 6, false, true, false, + DamageCause.CUSTOM, _damage, false, true, false, damager.getName(), GetName()); UtilAction.velocity(damagee, UtilAlg.getTrajectory2d(damagee, damager), 1.6, false, 0, 1.2, 1.8, true); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkDoubleJump.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkDoubleJump.java index 1af48f4f8..164794a2e 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkDoubleJump.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkDoubleJump.java @@ -29,7 +29,12 @@ public class PerkDoubleJump extends Perk private boolean _displayForce; private HashSet _disabled = new HashSet(); - + + public PerkDoubleJump(String name) + { + this(name, 0, 0, false); + } + public PerkDoubleJump(String name, double power, double heightLimit, boolean control) { super(name, new String[] @@ -70,6 +75,14 @@ public class PerkDoubleJump extends Perk _displayForce = displayForce; } + @Override + public void setupValues() + { + _power = getPerkDouble("Power", _power); + _heightMax = getPerkDouble("Height Limit", _heightMax); + _control = getPerkBoolean("Control", _control); + } + @EventHandler public void FlightHop(PlayerToggleFlightEvent event) { @@ -114,7 +127,7 @@ public class PerkDoubleJump extends Perk } } - Recharge.Instance.useForce(player, "Double Jump", 500); + //Recharge.Instance.useForce(player, "Double Jump", 500); } @EventHandler @@ -134,8 +147,8 @@ public class PerkDoubleJump extends Perk if (_recharge > 0 && !Recharge.Instance.usable(player, GetName())) continue; - if (!Recharge.Instance.usable(player, "Double Jump")) - continue; +// if (!Recharge.Instance.usable(player, "Double Jump")) +// continue; if (player.isOnGround() || (UtilBlock.solid(player.getLocation().getBlock().getRelative(BlockFace.DOWN)) && UtilBlock.solid(player.getLocation().getBlock()))) player.setAllowFlight(true); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkFletcher.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkFletcher.java index 1b2e54207..ee99aa27a 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkFletcher.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkFletcher.java @@ -39,7 +39,12 @@ public class PerkFletcher extends Perk private int _slot; private boolean _instant = true; private String _name; - + + public PerkFletcher() + { + this(0, 0, false); + } + public PerkFletcher(int time, int max, boolean remove) { this(time, max, remove, -1); @@ -75,6 +80,16 @@ public class PerkFletcher extends Perk _name = name; } + @Override + public void setupValues() + { + _time = getPerkInt("Time", _time); + _max = getPerkInt("Max", _max); + _remove = getPerkBoolean("Remove", _remove); + + setDesc("Receive 1 Arrow every " + _time + " seconds. Maximum of " + _max + "."); + } + public boolean isFletchedArrow(ItemStack stack) { if (!UtilGear.isMat(stack, Material.ARROW)) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkIronHook.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkIronHook.java index 1f9f786f4..1b86acc73 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkIronHook.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkIronHook.java @@ -31,14 +31,21 @@ import nautilus.game.arcade.kit.Perk; public class PerkIronHook extends Perk implements IThrown { - private static final long COOLDOWN = 8000; - private static final int DAMAGE = 4; + private long _cooldown; + private int _damage; public PerkIronHook() { super("Iron Hook", new String[] { C.cYellow + "Right-Click" + C.cGray + " with Pickaxe to " + C.cGreen + "Iron Hook" }); } + @Override + public void setupValues() + { + _cooldown = getPerkTime("Cooldown"); + _damage = getPerkInt("Damage"); + } + @EventHandler public void Activate(PlayerInteractEvent event) { @@ -69,7 +76,7 @@ public class PerkIronHook extends Perk implements IThrown return; } - if (!Recharge.Instance.use(player, GetName(), COOLDOWN, true, true)) + if (!Recharge.Instance.use(player, GetName(), _cooldown, true, true)) { return; } @@ -118,7 +125,7 @@ public class PerkIronHook extends Perk implements IThrown Manager.GetCondition().Factory().Falling(GetName(), target, player, 10, false, true); // Damage Event - Manager.GetDamage().NewDamageEvent(target, player, null, DamageCause.CUSTOM, velocity * DAMAGE, false, true, false, player.getName(), GetName()); + Manager.GetDamage().NewDamageEvent(target, player, null, DamageCause.CUSTOM, velocity * _damage, false, true, false, player.getName(), GetName()); // Inform UtilPlayer.message(target, F.main("Skill", F.name(player.getName()) + " hit you with " + F.skill(GetName()) + ".")); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkKnockbackArrow.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkKnockbackArrow.java index 26f9979a0..b873bbab7 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkKnockbackArrow.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkKnockbackArrow.java @@ -12,17 +12,27 @@ import nautilus.game.arcade.kit.Perk; public class PerkKnockbackArrow extends Perk { private double _power; - + + public PerkKnockbackArrow() + { + this(0); + } + public PerkKnockbackArrow(double power) { - super("Arrow Knockback", new String[] - { - C.cGray + "Arrows deal " + (int)(power*100) + "% Knockback.", - }); + super("Knockback Arrow"); _power = power; } - + + @Override + public void setupValues() + { + _power = getPerkPercentage("Power", _power); + + setDesc(C.cGray + "Arrows deal " + (int)(_power * 100) + "% Knockback."); + } + @EventHandler(priority = EventPriority.HIGH) public void Knockback(CustomDamageEvent event) { @@ -41,6 +51,6 @@ public class PerkKnockbackArrow extends Perk if (!Manager.IsAlive(damager)) return; - event.AddKnockback("Knockback Arrow", _power); + event.AddKnockback(GetName(), _power); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkKnockbackFire.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkKnockbackFire.java index ab071b021..ee6bd4338 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkKnockbackFire.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkKnockbackFire.java @@ -11,7 +11,12 @@ import nautilus.game.arcade.kit.Perk; public class PerkKnockbackFire extends Perk { private double _power; - + + public PerkKnockbackFire() + { + this(0); + } + public PerkKnockbackFire(double power) { super("Flaming Knockback", new String[] @@ -21,7 +26,13 @@ public class PerkKnockbackFire extends Perk _power = power; } - + + @Override + public void setupValues() + { + _power = getPerkDouble("Power"); + } + @EventHandler(priority = EventPriority.HIGH) public void Knockback(CustomDamageEvent event) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkLazer.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkLazer.java index 3d416b319..cb967b8ce 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkLazer.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkLazer.java @@ -42,24 +42,33 @@ public class PerkLazer extends Perk { private static final float MAX_CHARGE = 0.99F; - private static final float CHARGE_PER_TICK = 0.035F; private static final float INCREMENTATION = 0.2F; - private static final float HIT_BOX_RADIUS = 2.5F; - private static final int DAMAGE_RADIUS = 3; - private static final int DAMAGE = 7; - private static final int KNOCKBACK_MAGNITUDE = 3; - private double _range; private long _recharge; + private float _chargePerTick; + private float _hitBoxRadius; + private int _damageRadius; + private int _damage; + private int _knockbackMagnitude; + private double _range; private Set _active = new HashSet<>(); - public PerkLazer(double range, long recharge) + public PerkLazer() { super("Static Laser", new String[] { C.cYellow + "Hold Block" + C.cGray + " with Sword to use " + C.cGreen + "Static Laser" }); + } - _range = range; - _recharge = recharge; + @Override + public void setupValues() + { + _recharge = getPerkTime("Cooldown"); + _chargePerTick = getPerkFloat("Charge Per Tick"); + _hitBoxRadius = getPerkFloat("Hit Box Radius"); + _damageRadius = getPerkInt("Damage Radius"); + _damage = getPerkInt("Damage"); + _knockbackMagnitude = getPerkInt("Knockback Magnitude"); + _range = getPerkInt("Range"); } @EventHandler @@ -122,7 +131,7 @@ public class PerkLazer extends Perk if (player.isBlocking()) { - player.setExp(Math.min(MAX_CHARGE, player.getExp() + CHARGE_PER_TICK)); + player.setExp(Math.min(MAX_CHARGE, player.getExp() + _chargePerTick)); player.getWorld().playSound(player.getLocation(), Sound.FIZZ, 0.25f + player.getExp(), 0.75f + player.getExp()); @@ -175,7 +184,7 @@ public class PerkLazer extends Perk particleLoop: while (!lineParticle.update()) { - for (Player other : UtilPlayer.getNearby(lineParticle.getLastLocation(), HIT_BOX_RADIUS)) + for (Player other : UtilPlayer.getNearby(lineParticle.getLastLocation(), _hitBoxRadius)) { if (player.equals(other)) { @@ -193,7 +202,7 @@ public class PerkLazer extends Perk // Firework UtilFirework.playFirework(target, Type.BURST, Color.YELLOW, false, false); - for (LivingEntity other : UtilEnt.getInRadius(target, DAMAGE_RADIUS).keySet()) + for (LivingEntity other : UtilEnt.getInRadius(target, _damageRadius).keySet()) { if (other.equals(player)) { @@ -201,7 +210,7 @@ public class PerkLazer extends Perk } // Damage Event - Manager.GetDamage().NewDamageEvent(other, player, null, DamageCause.CUSTOM, player.getExp() * DAMAGE, true, true, false, player.getName(), GetName()); + Manager.GetDamage().NewDamageEvent(other, player, null, DamageCause.CUSTOM, player.getExp() * _damage, true, true, false, player.getName(), GetName()); } // Inform @@ -224,7 +233,7 @@ public class PerkLazer extends Perk return; } - event.AddKnockback(GetName(), KNOCKBACK_MAGNITUDE); + event.AddKnockback(GetName(), _knockbackMagnitude); } public void setWoolColor(Player player, DyeColor color) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkRopedArrow.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkRopedArrow.java index 3d0d4b759..2a206a065 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkRopedArrow.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkRopedArrow.java @@ -1,7 +1,6 @@ package nautilus.game.arcade.kit.perks; import java.util.HashSet; -import java.util.Iterator; import org.bukkit.Material; import org.bukkit.Sound; @@ -32,9 +31,14 @@ public class PerkRopedArrow extends SmashPerk private String _name; private double _power; - private long _recharge; + private int _recharge; - public PerkRopedArrow(String name, double power, long recharge) + public PerkRopedArrow(String name) + { + this(name, 0, 0); + } + + public PerkRopedArrow(String name, double power, int recharge) { super(name, new String[] { @@ -46,9 +50,21 @@ public class PerkRopedArrow extends SmashPerk _recharge = recharge; } + @Override + public void setupValues() + { + _power = getPerkDouble("Power", _power); + _recharge = getPerkTime("Cooldown", _recharge); + } + @EventHandler public void Fire(PlayerInteractEvent event) { + if (event.isCancelled()) + { + return; + } + if (event.getAction() != Action.LEFT_CLICK_AIR && event.getAction() != Action.LEFT_CLICK_BLOCK) return; @@ -106,12 +122,6 @@ public class PerkRopedArrow extends SmashPerk if (event.getType() != UpdateType.SEC) return; - for (Iterator arrowIterator = _arrows.iterator(); arrowIterator.hasNext();) - { - Entity arrow = arrowIterator.next(); - - if (!arrow.isValid()) - arrowIterator.remove(); - } + _arrows.removeIf(arrow -> !arrow.isValid()); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSeismicSlam.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSeismicSlam.java index 9b93d6fe8..db45b760e 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSeismicSlam.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSeismicSlam.java @@ -34,11 +34,11 @@ import nautilus.game.arcade.kit.Perk; public class PerkSeismicSlam extends Perk { - private static final long COOLDOWN = 7000; - private static final long TIME = 1000; - private static final int DAMAGE = 10; - private static final int RADIUS = 8; - private static final float KNOCKBACK_MAGNITUDE = 2.4F; + private long _cooldown; + private long _time; + private int _damage; + private int _radius; + private float _knockbackMagnitude; private Map _live = new HashMap<>(); @@ -47,6 +47,16 @@ public class PerkSeismicSlam extends Perk super("Seismic Slam", new String[] { C.cYellow + "Right-Click" + C.cGray + " with Spade to " + C.cGreen + "Seismic Slam" }); } + @Override + public void setupValues() + { + _cooldown = getPerkTime("Cooldown"); + _time = getPerkTime("Time"); + _damage = getPerkInt("Damage"); + _radius = getPerkInt("Radius"); + _knockbackMagnitude = getPerkFloat("Knockback Magnitude"); + } + @EventHandler public void deactivateDeath(PlayerDeathEvent event) { @@ -93,7 +103,7 @@ public class PerkSeismicSlam extends Perk return; } - if (!Recharge.Instance.use(player, GetName(), COOLDOWN, true, true)) + if (!Recharge.Instance.use(player, GetName(), _cooldown, true, true)) return; // Action @@ -132,7 +142,7 @@ public class PerkSeismicSlam extends Perk continue; } - if (!UtilTime.elapsed(_live.get(player), TIME)) + if (!UtilTime.elapsed(_live.get(player), _time)) { continue; } @@ -141,7 +151,7 @@ public class PerkSeismicSlam extends Perk // Action - Map targets = UtilEnt.getInRadius(player.getLocation(), RADIUS); + Map targets = UtilEnt.getInRadius(player.getLocation(), _radius); for (LivingEntity cur : targets.keySet()) { @@ -156,7 +166,7 @@ public class PerkSeismicSlam extends Perk } // Damage Event - Manager.GetDamage().NewDamageEvent(cur, player, null, DamageCause.CUSTOM, DAMAGE * targets.get(cur) + 0.5, true, true, false, player.getName(), GetName()); + Manager.GetDamage().NewDamageEvent(cur, player, null, DamageCause.CUSTOM, _damage * targets.get(cur) + 0.5, true, true, false, player.getName(), GetName()); // Condition Manager.GetCondition().Factory().Falling(GetName(), cur, player, 10, false, true); @@ -187,6 +197,6 @@ public class PerkSeismicSlam extends Perk return; } - event.AddKnockback(GetName(), KNOCKBACK_MAGNITUDE); + event.AddKnockback(GetName(), _knockbackMagnitude); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWoolBomb.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWoolBomb.java index 2a2ec4083..073500018 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWoolBomb.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWoolBomb.java @@ -52,13 +52,13 @@ import nautilus.game.arcade.kit.perks.data.WoolBombData; public class PerkWoolBomb extends Perk implements IThrown { - - private static final long RATE = 800; - private static final long COOLDOWN = 8000; - private static final int DAMAGE_RADIUS = 9; - private static final int DAMAGE_EXPLODE = 14; - private static final int DAMAGE_COLLIDE = 4; - private static final int KNOCKBACK_MAGNITUDE = 2; + + private long _cooldown; + private long _rate; + private int _damageRadius; + private int _damageExplode; + private int _damageCollide; + private int _knockbackMagnitude; private Map _thrown = new HashMap<>(); private Map _active = new HashMap<>(); @@ -68,6 +68,17 @@ public class PerkWoolBomb extends Perk implements IThrown super("Wool Mine", new String[] { C.cYellow + "Right-Click" + C.cGray + " with Axe to " + C.cGreen + "Wool Mine" }); } + @Override + public void setupValues() + { + _cooldown = getPerkTime("Cooldown"); + _rate = getPerkInt("Rate (ms)"); + _damageRadius = getPerkInt("Damage Radius"); + _damageExplode = getPerkInt("Damage Explode"); + _damageCollide = getPerkInt("Damage Collide"); + _knockbackMagnitude = getPerkInt("Knockback Magnitude"); + } + @EventHandler public void skill(PlayerInteractEvent event) { @@ -148,7 +159,7 @@ public class PerkWoolBomb extends Perk implements IThrown player.getWorld().playSound(player.getLocation(), Sound.SHEEP_IDLE, 2f, 1.5f); // Rate - Recharge.Instance.useForce(player, GetName() + " Rate", RATE); + Recharge.Instance.useForce(player, GetName() + " Rate", _rate); // Disguise DisguiseBase disguise = Manager.GetDisguise().getActiveDisguise(player); @@ -211,7 +222,7 @@ public class PerkWoolBomb extends Perk implements IThrown thrown.remove(); // Rate - Recharge.Instance.useForce(player, GetName() + " Rate", RATE); + Recharge.Instance.useForce(player, GetName() + " Rate", _rate); // Inform if (inform) @@ -233,7 +244,7 @@ public class PerkWoolBomb extends Perk implements IThrown return false; } - if (!Recharge.Instance.use(player, GetName(), COOLDOWN, true, true)) + if (!Recharge.Instance.use(player, GetName(), _cooldown, true, true)) { return false; } @@ -246,21 +257,18 @@ public class PerkWoolBomb extends Perk implements IThrown data.Block.getWorld().playSound(data.Block.getLocation(), Sound.EXPLODE, 3f, 0.8f); // Damage - Map targets = UtilEnt.getInRadius(data.Block.getLocation().add(0.5, 0.5, 0.5), DAMAGE_RADIUS); + Map targets = UtilEnt.getInRadius(data.Block.getLocation().add(0.5, 0.5, 0.5), _damageRadius); List team = TeamSuperSmash.getTeam(Manager, player, false); for (LivingEntity cur : targets.keySet()) { - if(cur instanceof Player) + if (cur instanceof Player && team.contains(cur)) { - if(team.contains(cur)) - { - continue; - } + continue; } // Damage Event - Manager.GetDamage().NewDamageEvent(cur, player, null, DamageCause.CUSTOM, DAMAGE_EXPLODE * targets.get(cur) + 0.5, false, true, false, player.getName(), GetName()); + Manager.GetDamage().NewDamageEvent(cur, player, null, DamageCause.CUSTOM, _damageExplode * targets.get(cur) + 0.5, false, true, false, player.getName(), GetName()); // Condition Manager.GetCondition().Factory().Falling(GetName(), cur, player, 10, false, true); @@ -277,7 +285,7 @@ public class PerkWoolBomb extends Perk implements IThrown } // Rate - Recharge.Instance.useForce(player, GetName() + " Rate", RATE); + Recharge.Instance.useForce(player, GetName() + " Rate", _rate); // Inform if (inform) @@ -327,7 +335,7 @@ public class PerkWoolBomb extends Perk implements IThrown } // Damage Event - Manager.GetDamage().NewDamageEvent(target, data.getThrower(), null, DamageCause.PROJECTILE, DAMAGE_COLLIDE, true, true, false, UtilEnt.getName(data.getThrower()), GetName()); + Manager.GetDamage().NewDamageEvent(target, data.getThrower(), null, DamageCause.PROJECTILE, _damageCollide, true, true, false, UtilEnt.getName(data.getThrower()), GetName()); } @Override @@ -367,7 +375,7 @@ public class PerkWoolBomb extends Perk implements IThrown WoolBombData data = _active.get(key); - if (UtilTime.elapsed(data.Time, COOLDOWN)) + if (UtilTime.elapsed(data.Time, _cooldown)) { detonate.add(player); continue; @@ -400,6 +408,6 @@ public class PerkWoolBomb extends Perk implements IThrown return; } - event.AddKnockback(GetName(), KNOCKBACK_MAGNITUDE); + event.AddKnockback(GetName(), _knockbackMagnitude); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWoolCloud.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWoolCloud.java index 77a9a7740..167606014 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWoolCloud.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWoolCloud.java @@ -39,12 +39,12 @@ import nautilus.game.arcade.kit.Perk; public class PerkWoolCloud extends Perk { - private static final long COOLDOWN = 10000; - private static final long MIN_VELOCITY_TIME = 200; - private static final long MAX_VELOCITY_TIME = 1200; - private static final int DAMAGE_RADIUS = 2; - private static final int DAMAGE = 8; - private static final float KNOCKBACK_MAGNITUDE = 2.5F; + private long _cooldown; + private long _minVelocityTime; + private long _maxVelocityTime; + private int _damageRadius; + private int _damage; + private float _knockbackMangitude; private Map _active = new HashMap<>(); @@ -53,6 +53,17 @@ public class PerkWoolCloud extends Perk super("Wooly Rocket", new String[] { C.cYellow + "Right-Click" + C.cGray + " with Spade to " + C.cGreen + "Wooly Rocket" }); } + @Override + public void setupValues() + { + _cooldown = getPerkTime("Cooldown"); + _minVelocityTime = getPerkInt("Min Velocity Time (ms)"); + _maxVelocityTime = getPerkInt("Max Velocity Time (ms)"); + _damageRadius = getPerkInt("Damage Radius"); + _damage = getPerkInt("Damage"); + _knockbackMangitude = getPerkFloat("Knockback Magnitude"); + } + @EventHandler public void Leap(PlayerInteractEvent event) { @@ -84,7 +95,7 @@ public class PerkWoolCloud extends Perk } // Recharge - if (!Recharge.Instance.use(player, GetName(), COOLDOWN, true, true)) + if (!Recharge.Instance.use(player, GetName(), _cooldown, true, true)) { return; } @@ -131,7 +142,7 @@ public class PerkWoolCloud extends Perk UtilParticle.PlayParticle(ParticleType.FLAME, player.getLocation(), 0.2f, 0.2f, 0.2f, 0, 4, ViewDist.LONGER, UtilServer.getPlayers()); - if (!UtilTime.elapsed(_active.get(key), MIN_VELOCITY_TIME)) + if (!UtilTime.elapsed(_active.get(key), _minVelocityTime)) { continue; } @@ -143,17 +154,17 @@ public class PerkWoolCloud extends Perk continue; } - if (UtilMath.offset(player, other) < DAMAGE_RADIUS) + if (UtilMath.offset(player, other) < _damageRadius) { // Damage Event - Manager.GetDamage().NewDamageEvent(other, player, null, DamageCause.CUSTOM, DAMAGE, true, false, false, player.getName(), GetName()); + Manager.GetDamage().NewDamageEvent(other, player, null, DamageCause.CUSTOM, _damage, true, false, false, player.getName(), GetName()); UtilParticle.PlayParticle(ParticleType.EXPLODE, other.getLocation(), 0f, 0f, 0f, 0, 1, ViewDist.MAX, UtilServer.getPlayers()); UtilParticle.PlayParticle(ParticleType.LAVA, player.getLocation(), 0.2f, 0.2f, 0.2f, 0, 10, ViewDist.MAX, UtilServer.getPlayers()); } } - if (UtilEnt.isGrounded(player) || UtilTime.elapsed(_active.get(key), MAX_VELOCITY_TIME)) + if (UtilEnt.isGrounded(player) || UtilTime.elapsed(_active.get(key), _maxVelocityTime)) { playerIterator.remove(); setWoolColor(player, DyeColor.WHITE); @@ -184,6 +195,6 @@ public class PerkWoolCloud extends Perk return; } - event.AddKnockback(GetName(), KNOCKBACK_MAGNITUDE); + event.AddKnockback(GetName(), _knockbackMangitude); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/data/FireflyData.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/data/FireflyData.java index c04f9b167..ad8772b88 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/data/FireflyData.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/data/FireflyData.java @@ -1,10 +1,6 @@ package nautilus.game.arcade.kit.perks.data; -import java.util.HashSet; - -import org.bukkit.entity.Entity; - -public class FireflyData +public class FireflyData { public org.bukkit.entity.Player Player; public org.bukkit.Location Location; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/data/FissureData.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/data/FissureData.java index 3830cdf9a..0d97a9437 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/data/FissureData.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/data/FissureData.java @@ -3,8 +3,10 @@ package nautilus.game.arcade.kit.perks.data; import java.util.ArrayList; import java.util.HashSet; +import org.bukkit.Bukkit; import org.bukkit.Effect; import org.bukkit.Location; +import org.bukkit.Material; import org.bukkit.block.Block; import org.bukkit.block.BlockFace; import org.bukkit.entity.Player; @@ -69,12 +71,12 @@ public class FissureData continue; //Move up 1, cant go 2 up - if (UtilBlock.solid(block.getRelative(BlockFace.UP))) + if (isSolid(block.getRelative(BlockFace.UP))) { _loc.add(0, 1, 0); block = _loc.getBlock(); - if (UtilBlock.solid(block.getRelative(BlockFace.UP))) + if (isSolid(block.getRelative(BlockFace.UP))) { return; } @@ -82,12 +84,12 @@ public class FissureData } //Move down 1, cant go 2 down - else if (!UtilBlock.solid(block)) + else if (!isSolid(block)) { _loc.add(0, -1, 0); block = _loc.getBlock(); - if (!UtilBlock.solid(block)) + if (!isSolid(block)) { return; } @@ -139,7 +141,15 @@ public class FissureData if (block.getTypeId() == 2) Host.Manager.GetBlockRestore().add(block, 3, block.getData(), 14000); if (block.getTypeId() == 98) Host.Manager.GetBlockRestore().add(block, 98, (byte) 2, 14000); - Host.Manager.GetBlockRestore().add(up, block.getTypeId(), block.getData(), 10000 - (1000 * _height)); + if (block.getType() == Material.SNOW) + { + Host.Manager.GetBlockRestore().add(block, Material.SNOW_BLOCK.getId(), (byte) 0, 10000 - (1000 * _height)); + Host.Manager.GetBlockRestore().add(up, Material.SNOW_BLOCK.getId(), (byte) 0, 10000 - (1000 * _height)); + } + else + { + Host.Manager.GetBlockRestore().add(up, block.getTypeId(), block.getData(), 10000 - (1000 * _height)); + } _height++; //Effect @@ -212,4 +222,9 @@ public class FissureData _loc = null; _startLoc = null; } + + private boolean isSolid(Block block) + { + return UtilBlock.solid(block) || block.getType() == Material.SNOW; + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameCreationManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameCreationManager.java index 0c9cf5759..58048fb34 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameCreationManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameCreationManager.java @@ -158,8 +158,7 @@ public class GameCreationManager implements Listener Manager.GetDamage().DisableDamageChanges = false; Manager.GetCreature().SetDisableCustomDrops(false); Manager.GetDamage().SetEnabled(true); - Manager.GetExplosion().SetRegenerate(false); - Manager.GetExplosion().SetTNTSpread(true); + Manager.GetExplosion().resetConfiguration(); // Manager.GetAntiStack().SetEnabled(true); Manager.getCosmeticManager().setHideParticles(false); Manager.GetDamage().GetCombatManager().setUseWeaponName(AttackReason.CustomWeaponName); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameFlagManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameFlagManager.java index 68791ddff..a2819e252 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameFlagManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameFlagManager.java @@ -1085,41 +1085,40 @@ public class GameFlagManager implements Listener @EventHandler public void WorldWaterDamage(UpdateEvent event) { - if (event.getType() != UpdateType.FAST) - return; - - Game game = Manager.GetGame(); - if (game == null) return; - - if (!game.IsLive()) - return; - - if (game.WorldWaterDamage <= 0) + if (event.getType() != UpdateType.FASTER) { - if (!game.WorldData.GetCustomLocs("WATER_DAMAGE").isEmpty()) - { - game.WorldWaterDamage = 4; - } - else - { - return; - } + return; } - for (GameTeam team : game.GetTeamList()) - for (Player player : team.GetPlayers(true)) - if (player.getLocation().getBlock().getTypeId() == 8 || player.getLocation().getBlock().getRelative(BlockFace.UP).getTypeId() == 8 || - player.getLocation().getBlock().getTypeId() == 9 || player.getLocation().getBlock().getRelative(BlockFace.UP).getTypeId() == 9) - { - //Damage Event - Manager.GetDamage().NewDamageEvent(player, null, null, - DamageCause.DROWNING, game.WorldWaterDamage, true, false, false, - "Water", "Water Damage"); + Game game = Manager.GetGame(); + if (game == null || !game.IsLive()) + { + return; + } - player.getWorld().playSound(player.getLocation(), - Sound.SPLASH, 0.8f, - 1f + (float) Math.random() / 2); - } + if (game.WorldWaterDamage <= 0 && !game.WorldData.GetCustomLocs("WATER_DAMAGE").isEmpty()) + { + game.WorldWaterDamage = 4; + } + + for (Player player : game.GetPlayers(true)) + { + if (!Recharge.Instance.use(player, "Water Damage", 500, false, false)) + { + continue; + } + + Block block = player.getLocation().getBlock(); + Material lower = block.getType(); + Material upper = block.getRelative(BlockFace.UP).getType(); + + if (lower == Material.WATER || lower == Material.STATIONARY_WATER || upper == Material.WATER || upper == Material.STATIONARY_WATER) + { + //Damage Event + Manager.GetDamage().NewDamageEvent(player, null, null, DamageCause.DROWNING, game.WorldWaterDamage, true, false, false, "Water", "Water Damage"); + player.getWorld().playSound(player.getLocation(), Sound.SPLASH, 0.8f, 1f + (float) Math.random() / 2); + } + } } @EventHandler(priority = EventPriority.LOWEST) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/PerkSpreadsheetModule.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/PerkSpreadsheetModule.java new file mode 100644 index 000000000..63e90d8d6 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/PerkSpreadsheetModule.java @@ -0,0 +1,152 @@ +package nautilus.game.arcade.managers; + +import mineplex.core.common.Pair; +import mineplex.core.common.util.UtilServer; +import mineplex.core.google.GoogleSheetsManager; +import mineplex.core.google.SheetObjectDeserialiser; +import mineplex.core.slack.SlackAPI; +import mineplex.core.slack.SlackMessage; +import mineplex.core.slack.SlackTeam; +import nautilus.game.arcade.events.GameStateChangeEvent; +import nautilus.game.arcade.game.Game; +import nautilus.game.arcade.kit.Kit; +import nautilus.game.arcade.kit.Perk; +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; + +import java.net.MalformedURLException; +import java.net.URL; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +public class PerkSpreadsheetModule implements Listener +{ + + private static final SheetObjectDeserialiser> DESERIALISER = values -> Pair.create(values[0], values.length == 1 ? "" : values[1]); + + private final Game _game; + private final Map _dataMap; + private final String _fileName; + + public PerkSpreadsheetModule(Game game, String fileName) + { + _game = game; + _fileName = fileName; + + _dataMap = new HashMap<>(); + + UtilServer.RegisterEvents(this); + + setup(); + } + + @EventHandler + public void cleanup(GameStateChangeEvent event) + { + if (event.GetState() != Game.GameState.End) + { + return; + } + + UtilServer.Unregister(this); + } + + private void setup() + { + // File Name must not be null + Objects.requireNonNull(_fileName); + + GoogleSheetsManager manager = _game.getArcadeManager().getSheetsManager(); + + Map>> map = manager.getSheetData(_fileName); + + for (Map.Entry>> entry : map.entrySet()) + { + String key = entry.getKey(); + List> value = entry.getValue(); + + Kit kit = getFromName(key); + + if (kit == null) + { + manager.log("No kit found for the name " + key); + continue; + } + + Perk currentPerk = null; + + for (List rows : value) + { + try + { + Pair pair = DESERIALISER.deserialise(rows.toArray(new String[0])); + + Perk perk = getFromName(kit, pair.getLeft()); + + if (perk != null) + { + currentPerk = perk; + continue; + } + + if (currentPerk != null) + { + String id = getKey(kit, currentPerk, pair.getLeft()); + _dataMap.put(id, pair.getRight()); + } + } + catch (Exception e) + { + // Continue the loop + } + } + } + + for (Kit kit : _game.GetKits()) + { + for (Perk perk : kit.GetPerks()) + { + perk.setSpreadsheet(this); + } + } + } + + private Kit getFromName(String name) + { + for (Kit kit : _game.GetKits()) + { + if (kit.GetName().equalsIgnoreCase(name)) + { + return kit; + } + } + + return null; + } + + private Perk getFromName(Kit kit, String name) + { + for (Perk perk : kit.GetPerks()) + { + if (perk.GetName().equalsIgnoreCase(name)) + { + return perk; + } + } + + return null; + } + + public String getKey(Kit kit, Perk perk, String value) + { + return kit.GetName() + "." + perk.GetName() + "." + value; + } + + public Map getDataMap() + { + return _dataMap; + } + +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/chat/GameChatManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/chat/GameChatManager.java index a65ffd6cf..69e9958d2 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/chat/GameChatManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/chat/GameChatManager.java @@ -15,7 +15,6 @@ import org.bukkit.event.player.AsyncPlayerChatEvent; import org.bukkit.event.player.PlayerCommandPreprocessEvent; import org.jooq.tools.json.JSONObject; -import mineplex.core.antihack.compedaccount.PriorityCause; import mineplex.core.common.Rank; import mineplex.core.common.jsonchat.JsonMessage; import mineplex.core.common.util.C; @@ -68,8 +67,6 @@ public class GameChatManager implements Listener if (event.getMessage().trim().length() == 0) return; - _manager.getCompromisedAccountManager().triggerPriorityBan(event.getPlayer(), PriorityCause.CHAT); - Player sender = event.getPlayer(); String senderName = sender.getName(); diff --git a/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/death/quitnpc/QuitNPC.java b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/death/quitnpc/QuitNPC.java index 5a860af08..0c79be7ef 100644 --- a/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/death/quitnpc/QuitNPC.java +++ b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/death/quitnpc/QuitNPC.java @@ -26,15 +26,10 @@ import mineplex.core.updater.event.UpdateEvent; import mineplex.core.utils.UtilGameProfile; import mineplex.gemhunters.death.event.QuitNPCDespawnEvent; import mineplex.gemhunters.economy.EconomyModule; -import mineplex.gemhunters.loot.InventoryModule; -import mineplex.gemhunters.quest.QuestModule; -import mineplex.gemhunters.quest.QuestPlayerData; public class QuitNPC implements Listener { - // Managers - private final QuitNPCModule _npc; private final DisguiseManager _disguise; // Time @@ -52,10 +47,9 @@ public class QuitNPC implements Listener private final int _gems; - public QuitNPC(QuitNPCModule npc, Player player, long quitMills) + public QuitNPC(Player player, long quitMills) { // Managers - _npc = npc; _disguise = Managers.get(DisguiseManager.class); // Time @@ -162,7 +156,6 @@ public class QuitNPC implements Listener if (killer != null) { - _npc.setKilledBy(_uuid, killer.getName()); Managers.get(EconomyModule.class).addToStore(killer, "Killing " + F.name(_name + "'s") + " NPC", (int) (_gems * EconomyModule.GEM_KILL_FACTOR)); } @@ -192,4 +185,4 @@ public class QuitNPC implements Listener { return _uuid; } -} +} \ No newline at end of file diff --git a/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/death/quitnpc/QuitNPCModule.java b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/death/quitnpc/QuitNPCModule.java index 1576c696e..109e1039f 100644 --- a/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/death/quitnpc/QuitNPCModule.java +++ b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/death/quitnpc/QuitNPCModule.java @@ -1,40 +1,38 @@ package mineplex.gemhunters.death.quitnpc; import java.util.HashMap; -import java.util.HashSet; import java.util.Map; -import java.util.Set; import java.util.UUID; import java.util.concurrent.TimeUnit; -import mineplex.core.common.util.UtilPlayer; -import mineplex.gemhunters.economy.CashOutModule; import org.bukkit.GameMode; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; -import org.bukkit.event.player.PlayerJoinEvent; +import org.bukkit.event.player.AsyncPlayerPreLoginEvent; +import org.bukkit.event.player.AsyncPlayerPreLoginEvent.Result; import org.bukkit.event.player.PlayerQuitEvent; import mineplex.core.MiniPlugin; import mineplex.core.ReflectivelyCreateMiniPlugin; -import mineplex.core.common.util.F; +import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; -import mineplex.core.texttutorial.TextTutorialManager; import mineplex.gemhunters.death.event.QuitNPCDespawnEvent; import mineplex.gemhunters.death.event.QuitNPCSpawnEvent; -import mineplex.gemhunters.economy.event.PlayerCashOutCompleteEvent; +import mineplex.gemhunters.economy.CashOutModule; @ReflectivelyCreateMiniPlugin public class QuitNPCModule extends MiniPlugin { - private static final long LOG_OUT_TIME = TimeUnit.SECONDS.toMillis(60); private final CashOutModule _cashOut; private final Map _npcs; - private final Map _killedBy; + + private final String _serverName; + private final QuitNPCRepository _repo; private QuitNPCModule() { @@ -43,7 +41,8 @@ public class QuitNPCModule extends MiniPlugin _cashOut = require(CashOutModule.class); _npcs = new HashMap<>(); - _killedBy = new HashMap<>(); + _serverName = UtilServer.getRegion().name() + ":" + UtilServer.getServerName(); + _repo = new QuitNPCRepository(); } public void spawnNpc(Player player) @@ -73,7 +72,8 @@ public class QuitNPCModule extends MiniPlugin return; } - _npcs.put(player.getUniqueId(), new QuitNPC(this, player, LOG_OUT_TIME)); + _npcs.put(player.getUniqueId(), new QuitNPC(player, LOG_OUT_TIME)); + _repo.insertNpc(player.getUniqueId(), _serverName); } @EventHandler(priority = EventPriority.LOWEST) @@ -93,23 +93,30 @@ public class QuitNPCModule extends MiniPlugin public void npcDespawn(QuitNPCDespawnEvent event) { log("Despawning npc for " + _npcs.remove(event.getNpc().getUniqueId()).getName()); + _repo.deleteNpc(event.getNpc().getUniqueId()); } - @EventHandler - public void playerJoin(PlayerJoinEvent event) + @EventHandler(priority = EventPriority.HIGHEST) + public void onLogin(AsyncPlayerPreLoginEvent event) { - Player player = event.getPlayer(); - UUID key = player.getUniqueId(); - - if (_killedBy.containsKey(key)) + try { - player.sendMessage(F.main("Game", "You were killed while you were logged out. You were killed by " + F.name(_killedBy.remove(key)) + ".")); + String npcServer = _repo.loadNpcServer(event.getUniqueId()).get(); + if (npcServer == null || npcServer.isEmpty()) + { + return; + } + if (npcServer.equals(_serverName)) + { + return; + } + + event.disallow(Result.KICK_OTHER, C.cRed + "You have a combat logger alive on " + npcServer + "! Either wait for it to despawn or join that server directly!"); + } + catch (Exception ex) + { + ex.printStackTrace(); } - } - - public void setKilledBy(UUID dead, String killedBy) - { - _killedBy.put(dead, killedBy); } public QuitNPC getNPC(Player player) @@ -121,5 +128,4 @@ public class QuitNPCModule extends MiniPlugin { return _npcs.containsKey(player.getUniqueId()); } - -} +} \ No newline at end of file diff --git a/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/death/quitnpc/QuitNPCRepository.java b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/death/quitnpc/QuitNPCRepository.java new file mode 100644 index 000000000..6db02ac7f --- /dev/null +++ b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/death/quitnpc/QuitNPCRepository.java @@ -0,0 +1,69 @@ +package mineplex.gemhunters.death.quitnpc; + +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.util.UUID; +import java.util.concurrent.CompletableFuture; + +import mineplex.core.common.util.UtilServer; +import mineplex.serverdata.database.DBPool; +import mineplex.serverdata.database.RepositoryBase; +import mineplex.serverdata.database.column.ColumnVarChar; + +public class QuitNPCRepository extends RepositoryBase +{ + private static final String GET_DATA = "SELECT serverName FROM gemHuntersQuitNpcs WHERE uuid=?;"; + private static final String INSERT_DATA = "INSERT INTO gemHuntersQuitNpcs (uuid, serverName) VALUES (?, ?);"; + private static final String DELETE_DATA = "DELETE FROM gemHuntersQuitNpcs WHERE uuid=?;"; + + public QuitNPCRepository() + { + super(DBPool.getAccount()); + } + + public CompletableFuture loadNpcServer(UUID uuid) + { + return CompletableFuture.supplyAsync(() -> + { + try (Connection conn = getConnection()) + { + PreparedStatement stmt = conn.prepareStatement(GET_DATA); + stmt.setString(1, uuid.toString()); + + String serverName = null; + + ResultSet resultSet = stmt.executeQuery(); + if (resultSet.next()) + { + serverName = resultSet.getString("serverName"); + } + + return serverName; + } + catch (Exception e) + { + e.printStackTrace(); + return null; + } + }); + } + + public void deleteNpc(UUID uuid) + { + final String uuidStr = uuid.toString(); + UtilServer.runAsync(() -> + { + executeUpdate(DELETE_DATA, new ColumnVarChar("uuid", uuidStr.length(), uuidStr)); + }); + } + + public void insertNpc(UUID uuid, String serverName) + { + final String uuidStr = uuid.toString(); + UtilServer.runAsync(() -> + { + executeInsert(INSERT_DATA, null, new ColumnVarChar("uuid", uuidStr.length(), uuidStr), new ColumnVarChar("serverName", serverName.length(), serverName)); + }); + } +} \ No newline at end of file diff --git a/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/economy/CashOutModule.java b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/economy/CashOutModule.java index 88a603396..c4d3b75d8 100644 --- a/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/economy/CashOutModule.java +++ b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/economy/CashOutModule.java @@ -14,6 +14,7 @@ import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.gemhunters.economy.command.CashOutItemCommand; +import mineplex.gemhunters.economy.command.ResetCooldownCommand; import mineplex.gemhunters.economy.event.PlayerCashOutCompleteEvent; import mineplex.gemhunters.spawn.event.PlayerTeleportIntoMapEvent; import org.bukkit.Material; @@ -61,6 +62,7 @@ public class CashOutModule extends MiniPlugin public void addCommands() { addCommand(new CashOutItemCommand(this)); + addCommand(new ResetCooldownCommand(this)); } @EventHandler @@ -164,7 +166,7 @@ public class CashOutModule extends MiniPlugin { kickPlayer(player); } - }, 20); + }, 50); } } } diff --git a/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/economy/command/ResetCooldownCommand.java b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/economy/command/ResetCooldownCommand.java new file mode 100644 index 000000000..f95a82f8f --- /dev/null +++ b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/economy/command/ResetCooldownCommand.java @@ -0,0 +1,23 @@ +package mineplex.gemhunters.economy.command; + +import mineplex.core.command.CommandBase; +import mineplex.core.common.Rank; +import mineplex.core.recharge.Recharge; +import mineplex.gemhunters.economy.CashOutModule; +import org.bukkit.entity.Player; + +public class ResetCooldownCommand extends CommandBase +{ + + public ResetCooldownCommand(CashOutModule plugin) + { + super(plugin, Rank.DEVELOPER, "resetcashout"); + } + + @Override + public void Execute(Player caller, String[] args) + { + Recharge.Instance.useForce(caller, "Cash Out", 0); + } + +} diff --git a/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/join/JoinModule.java b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/join/JoinModule.java index deb3644d7..e7bd8f00a 100644 --- a/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/join/JoinModule.java +++ b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/join/JoinModule.java @@ -1,32 +1,38 @@ package mineplex.gemhunters.join; +import java.util.concurrent.TimeUnit; +import java.util.function.Consumer; + +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.player.PlayerJoinEvent; + import mineplex.core.MiniPlugin; import mineplex.core.ReflectivelyCreateMiniPlugin; import mineplex.core.account.CoreClient; import mineplex.core.account.CoreClientManager; -import mineplex.core.inventory.InventoryManager; +import mineplex.core.common.util.UtilItem; +import mineplex.core.recharge.Recharge; import mineplex.gemhunters.death.quitnpc.QuitNPC; import mineplex.gemhunters.death.quitnpc.QuitNPCModule; import mineplex.gemhunters.economy.EconomyModule; import mineplex.gemhunters.loot.InventoryModule; -import mineplex.gemhunters.map.ItemMapModule; +import mineplex.gemhunters.loot.LootModule; import mineplex.gemhunters.persistence.PersistenceData; import mineplex.gemhunters.persistence.PersistenceModule; import mineplex.gemhunters.persistence.PersistenceRepository; import mineplex.gemhunters.quest.QuestModule; import mineplex.gemhunters.spawn.SpawnModule; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.player.PlayerJoinEvent; - -import java.util.function.Consumer; +import org.bukkit.inventory.ItemStack; @ReflectivelyCreateMiniPlugin public class JoinModule extends MiniPlugin { + private static final double MAXIMUM_DURABILITY_LOSS = 0.85; private final CoreClientManager _client; private final EconomyModule _economy; + private final LootModule _loot; private final QuestModule _quest; private final PersistenceModule _persistence; private final QuitNPCModule _npc; @@ -39,6 +45,7 @@ public class JoinModule extends MiniPlugin _client = require(CoreClientManager.class); _economy = require(EconomyModule.class); + _loot = require(LootModule.class); _quest = require(QuestModule.class); _persistence = require(PersistenceModule.class); _npc = require(QuitNPCModule.class); @@ -60,9 +67,16 @@ public class JoinModule extends MiniPlugin player.setHealth(data.getHealth()); player.setMaxHealth(data.getMaxHealth()); player.setFoodLevel(data.getHunger()); + loseDurability(data.getItems(), data.getSaveTime()); + for (ItemStack itemStack : data.getItems()) + { + _loot.handleRewardItem(player, itemStack); + } player.getInventory().addItem(data.getItems()); + loseDurability(data.getArmour(), data.getSaveTime()); player.getInventory().setArmorContents(data.getArmour()); _inventory.unlockSlots(player, data.getSlots(), false); + Recharge.Instance.useForce(player, "Cash Out", data.getCashOutTime()); }); player.getInventory().clear(); @@ -81,9 +95,33 @@ public class JoinModule extends MiniPlugin if (!repository.exists(client)) { - _spawn.teleportToSpawn(player); + runSync(() -> _spawn.teleportToSpawn(player)); } }); } + private void loseDurability(ItemStack[] items, long time) + { + long diff = System.currentTimeMillis() - time; + long hours = TimeUnit.MILLISECONDS.toHours(diff); + + for (ItemStack item : items) + { + if (!UtilItem.isSword(item) && !UtilItem.isArmor(item)) + { + continue; + } + + short max = item.getType().getMaxDurability(); + short change = (short) (((double) max / 100D) * hours); + short apply = (short) (item.getDurability() + change); + + if (apply > max * MAXIMUM_DURABILITY_LOSS) + { + apply = (short) (max * MAXIMUM_DURABILITY_LOSS); + } + + item.setDurability(apply); + } + } } diff --git a/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/loot/LootModule.java b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/loot/LootModule.java index a60f1e7f0..ea7dc1d4d 100644 --- a/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/loot/LootModule.java +++ b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/loot/LootModule.java @@ -1,14 +1,23 @@ package mineplex.gemhunters.loot; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.UUID; -import java.util.concurrent.TimeUnit; - +import mineplex.core.MiniPlugin; +import mineplex.core.ReflectivelyCreateMiniPlugin; +import mineplex.core.common.util.*; +import mineplex.core.common.util.UtilEvent.ActionType; +import mineplex.core.google.GoogleSheetsManager; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.gemhunters.economy.EconomyModule; +import mineplex.gemhunters.economy.event.PlayerCashOutCompleteEvent; +import mineplex.gemhunters.loot.command.SpawnChestCommand; +import mineplex.gemhunters.loot.command.UpdateLootCommand; +import mineplex.gemhunters.loot.deserialisers.ChestPropertiesDeserialiser; +import mineplex.gemhunters.loot.deserialisers.LootItemDeserialiser; +import mineplex.gemhunters.loot.event.PlayerChestOpenEvent; +import mineplex.gemhunters.loot.rewards.*; +import mineplex.gemhunters.safezone.SafezoneModule; +import mineplex.gemhunters.spawn.event.PlayerTeleportIntoMapEvent; +import mineplex.gemhunters.world.WorldDataModule; import org.bukkit.Bukkit; import org.bukkit.Effect; import org.bukkit.Location; @@ -25,35 +34,8 @@ import org.bukkit.event.player.PlayerPickupItemEvent; import org.bukkit.inventory.Inventory; import org.bukkit.inventory.ItemStack; -import mineplex.core.MiniPlugin; -import mineplex.core.ReflectivelyCreateMiniPlugin; -import mineplex.core.common.util.UtilAlg; -import mineplex.core.common.util.UtilBlock; -import mineplex.core.common.util.UtilEvent; -import mineplex.core.common.util.UtilEvent.ActionType; -import mineplex.core.common.util.UtilInv; -import mineplex.core.common.util.UtilMath; -import mineplex.core.common.util.UtilServer; -import mineplex.core.common.util.UtilTime; -import mineplex.core.google.GoogleSheetsManager; -import mineplex.core.updater.UpdateType; -import mineplex.core.updater.event.UpdateEvent; -import mineplex.gemhunters.economy.EconomyModule; -import mineplex.gemhunters.economy.event.PlayerCashOutCompleteEvent; -import mineplex.gemhunters.loot.command.SpawnChestCommand; -import mineplex.gemhunters.loot.command.UpdateLootCommand; -import mineplex.gemhunters.loot.deserialisers.ChestPropertiesDeserialiser; -import mineplex.gemhunters.loot.deserialisers.LootItemDeserialiser; -import mineplex.gemhunters.loot.event.PlayerChestOpenEvent; -import mineplex.gemhunters.loot.rewards.LootChestReward; -import mineplex.gemhunters.loot.rewards.LootGadgetReward; -import mineplex.gemhunters.loot.rewards.LootItemReward; -import mineplex.gemhunters.loot.rewards.LootRankReward; -import mineplex.gemhunters.loot.rewards.LootShardReward; -import mineplex.gemhunters.safezone.SafezoneModule; -import mineplex.gemhunters.spawn.event.PlayerTeleportIntoMapEvent; -import mineplex.gemhunters.util.SlackSheetsBot; -import mineplex.gemhunters.world.WorldDataModule; +import java.util.*; +import java.util.concurrent.TimeUnit; @ReflectivelyCreateMiniPlugin public class LootModule extends MiniPlugin @@ -200,12 +182,6 @@ public class LootModule extends MiniPlugin } catch (Exception e) { - if (row != 1) - { - SlackSheetsBot.reportParsingError(e, "Chest Loot", key, row); - } - - continue; } } @@ -224,12 +200,6 @@ public class LootModule extends MiniPlugin } catch (Exception e) { - if (row != 1) - { - SlackSheetsBot.reportParsingError(e, "Chest Loot", key, row); - } - - continue; } } @@ -659,7 +629,7 @@ public class LootModule extends MiniPlugin } } } - + public final Set getShownPlayers() { return _shownPlayers; diff --git a/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/map/ItemMapRenderer.java b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/map/ItemMapRenderer.java index 8c1e4f865..09d4aca84 100644 --- a/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/map/ItemMapRenderer.java +++ b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/map/ItemMapRenderer.java @@ -279,8 +279,8 @@ public class ItemMapRenderer extends MapRenderer continue; } - byte b0 = (byte) (int) Math.min(127, (double) (mapX * 2.0F) + 0.5D); - byte b1 = (byte) (int) Math.max(-127, (double) (mapZ * 2.0F) + 0.5D); + byte b0 = (byte) (int) Math.min(127, (mapX * 2.0F) + 0.5D); + byte b1 = (byte) (int) Math.max(-127, (mapZ * 2.0F) + 0.5D); byte rotation = (byte) (int) ((l.getYaw() * 16D) / 360D); diff --git a/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/persistence/PersistenceData.java b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/persistence/PersistenceData.java index dc8fe78ed..fed987d21 100644 --- a/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/persistence/PersistenceData.java +++ b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/persistence/PersistenceData.java @@ -16,8 +16,10 @@ public class PersistenceData private final int _slots; private final ItemStack[] _items; private final ItemStack[] _armour; + private final long _saveTime; + private final int _cashOutTime; - public PersistenceData(int gems, Location location, QuestPlayerData questData, int health, int maxHealth, int hunger, int slots, ItemStack[] items, ItemStack[] armour) + public PersistenceData(int gems, Location location, QuestPlayerData questData, int health, int maxHealth, int hunger, int slots, ItemStack[] items, ItemStack[] armour, long saveTime, int cashOutTime) { _gems = gems; _location = location; @@ -28,6 +30,8 @@ public class PersistenceData _items = items; _slots = slots; _armour = armour; + _saveTime = saveTime; + _cashOutTime = cashOutTime; } public int getGems() @@ -75,4 +79,13 @@ public class PersistenceData return _armour; } + public long getSaveTime() + { + return _saveTime; + } + + public int getCashOutTime() + { + return _cashOutTime; + } } diff --git a/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/persistence/PersistenceModule.java b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/persistence/PersistenceModule.java index dcf2afde9..322f25d54 100644 --- a/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/persistence/PersistenceModule.java +++ b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/persistence/PersistenceModule.java @@ -1,35 +1,33 @@ package mineplex.gemhunters.persistence; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +import org.bukkit.Location; +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.AsyncPlayerPreLoginEvent; +import org.bukkit.event.player.AsyncPlayerPreLoginEvent.Result; +import org.bukkit.event.player.PlayerQuitEvent; +import org.bukkit.inventory.ItemStack; + import mineplex.core.MiniPlugin; import mineplex.core.ReflectivelyCreateMiniPlugin; import mineplex.core.account.CoreClient; import mineplex.core.account.CoreClientManager; import mineplex.core.common.util.F; import mineplex.core.portal.events.ServerTransferEvent; +import mineplex.core.recharge.Recharge; +import mineplex.core.recharge.RechargeData; import mineplex.gemhunters.death.event.QuitNPCDespawnEvent; import mineplex.gemhunters.economy.CashOutModule; import mineplex.gemhunters.economy.EconomyModule; import mineplex.gemhunters.loot.InventoryModule; import mineplex.gemhunters.quest.QuestModule; import mineplex.gemhunters.quest.QuestPlayerData; -import mineplex.serverdata.commands.ServerTransfer; -import net.minecraft.server.v1_8_R3.EntityItemFrame; -import org.bukkit.Bukkit; -import org.bukkit.Location; -import org.bukkit.Material; -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.AsyncPlayerPreLoginEvent; -import org.bukkit.event.player.AsyncPlayerPreLoginEvent.Result; -import org.bukkit.event.player.PlayerJoinEvent; -import org.bukkit.event.player.PlayerQuitEvent; -import org.bukkit.inventory.ItemStack; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; @ReflectivelyCreateMiniPlugin public class PersistenceModule extends MiniPlugin @@ -95,8 +93,20 @@ public class PersistenceModule extends MiniPlugin int slots = _inventory.getSlots(player); ItemStack[] items = player.getInventory().getContents(); ItemStack[] armour = player.getInventory().getArmorContents(); + long saveTime = System.currentTimeMillis(); + int cashOutTime; + RechargeData rechargeData = Recharge.Instance.Get(player).get("Cash Out"); - PersistenceData data = new PersistenceData(gems, location, quest, health, maxHealth, hunger, slots, items, armour); + if (rechargeData == null) + { + cashOutTime = 0; + } + else + { + cashOutTime = (int) rechargeData.GetRemaining(); + } + + PersistenceData data = new PersistenceData(gems, location, quest, health, maxHealth, hunger, slots, items, armour, saveTime, cashOutTime); runAsync(() -> { diff --git a/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/persistence/PersistenceRepository.java b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/persistence/PersistenceRepository.java index ab34b4bab..cab1e644a 100644 --- a/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/persistence/PersistenceRepository.java +++ b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/persistence/PersistenceRepository.java @@ -6,8 +6,8 @@ import mineplex.gemhunters.quest.QuestPlayerData; import mineplex.serverdata.database.DBPool; import mineplex.serverdata.database.RepositoryBase; import mineplex.serverdata.database.column.ColumnInt; +import mineplex.serverdata.database.column.ColumnTimestamp; import mineplex.serverdata.database.column.ColumnVarChar; -import net.minecraft.server.v1_8_R3.ItemMapEmpty; import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.Material; @@ -16,6 +16,7 @@ import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.ItemMeta; import java.lang.reflect.Constructor; +import java.sql.Timestamp; import java.util.ArrayList; import java.util.List; import java.util.Map; @@ -25,8 +26,8 @@ public class PersistenceRepository extends RepositoryBase { private static final String GET_DATA = "SELECT * FROM gemHunters WHERE accountId=?;"; - private static final String INSERT_DATA = "INSERT INTO gemHunters VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?);"; - private static final String UPDATE_DATA = "UPDATE gemHunters SET gems=?,health=?,maxHealth=?,hunger=?,x=?,y=?,z=?,yaw=?,pitch=?,quests=?,slots=?,items=?,armour=? WHERE accountId=?;"; + private static final String INSERT_DATA = "INSERT INTO gemHunters VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?);"; + private static final String UPDATE_DATA = "UPDATE gemHunters SET gems=?,health=?,maxHealth=?,hunger=?,x=?,y=?,z=?,yaw=?,pitch=?,quests=?,slots=?,items=?,armour=?,saveTime=?,cashOutTime=? WHERE accountId=?;"; private static final String DELETE_DATA = "DELETE FROM gemHunters WHERE accountId=?;"; private static final Gson GSON; private static final ItemStack AIR = new ItemStack(Material.AIR); @@ -98,10 +99,19 @@ public class PersistenceRepository extends RepositoryBase armourList.add(CraftItemStack.deserialize(map)); } + Timestamp saveTime = resultSet.getTimestamp("saveTime"); + + if (saveTime == null) + { + saveTime = new Timestamp(System.currentTimeMillis()); + } + + int cashOutTime = resultSet.getInt("cashOutTime"); + _exists.add(accountId); Location location = new Location(Bukkit.getWorlds().get(0), x, y, z, yaw, pitch); - PersistenceData data = new PersistenceData(gems, location, questData, health, maxHealth, hunger, slots, itemsList.toArray(new ItemStack[0]), armourList.toArray(new ItemStack[0])); + PersistenceData data = new PersistenceData(gems, location, questData, health, maxHealth, hunger, slots, itemsList.toArray(new ItemStack[0]), armourList.toArray(new ItemStack[0]), saveTime.getTime(), cashOutTime); response.accept(data); } }, new ColumnInt("accountId", accountId)); @@ -125,6 +135,8 @@ public class PersistenceRepository extends RepositoryBase ItemStack[] armour = data.getArmour(); List> itemsMap = new ArrayList<>(items.length); List> armourMap = new ArrayList<>(armour.length); + Timestamp saveTime = new Timestamp(data.getSaveTime()); + int cashOutTime = data.getCashOutTime(); for (ItemStack itemStack : items) { @@ -162,6 +174,8 @@ public class PersistenceRepository extends RepositoryBase new ColumnInt("slots", slots), new ColumnVarChar("items", 10000, GSON.toJson(itemsMap)), new ColumnVarChar("armour", 1000, GSON.toJson(armourMap)), + new ColumnTimestamp("saveTime", saveTime), + new ColumnInt("cashOutTime", cashOutTime), new ColumnInt("accountId", accountId) ); } @@ -181,7 +195,9 @@ public class PersistenceRepository extends RepositoryBase new ColumnVarChar("quests", 500, GSON.toJson(data.getQuestData())), new ColumnInt("slots", slots), new ColumnVarChar("items", 10000, GSON.toJson(itemsMap)), - new ColumnVarChar("armour", 1000, GSON.toJson(armourMap)) + new ColumnVarChar("armour", 1000, GSON.toJson(armourMap)), + new ColumnTimestamp("saveTime", saveTime), + new ColumnInt("cashOutTime", cashOutTime) ); } diff --git a/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/quest/QuestNPC.java b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/quest/QuestNPC.java index 6594d1517..7c377c06d 100644 --- a/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/quest/QuestNPC.java +++ b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/quest/QuestNPC.java @@ -1,5 +1,8 @@ package mineplex.gemhunters.quest; +import mineplex.core.common.util.C; +import mineplex.core.menu.Menu; +import mineplex.gemhunters.util.SimpleNPC; import org.bukkit.Location; import org.bukkit.entity.Villager; import org.bukkit.entity.Villager.Profession; @@ -8,10 +11,6 @@ import org.bukkit.event.EventPriority; import org.bukkit.event.player.PlayerInteractEntityEvent; import org.bukkit.metadata.FixedMetadataValue; -import mineplex.core.common.util.C; -import mineplex.core.menu.Menu; -import mineplex.gemhunters.util.SimpleNPC; - public class QuestNPC extends SimpleNPC { @@ -19,7 +18,7 @@ public class QuestNPC extends SimpleNPC public QuestNPC(QuestModule quest, Location spawn, Menu menu) { - super(quest.getPlugin(), spawn, Villager.class, C.cGreenB + "NEW - " + C.cYellowB + "Quest Master" + C.cGreenB + " - NEW", null); + super(quest.getPlugin(), spawn, Villager.class, C.cYellowB + "Quest Master", null); _questMenu = menu; _entity.setMetadata("quest_npc", new FixedMetadataValue(quest.getPlugin(), true)); @@ -40,7 +39,6 @@ public class QuestNPC extends SimpleNPC event.setCancelled(true); - //event.getPlayer().sendMessage(F.main("Quest", "The Quest Master is currently disabled but will be available to all players shortly.")); _questMenu.open(event.getPlayer()); } diff --git a/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/safezone/SafezoneModule.java b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/safezone/SafezoneModule.java index b9e1ce380..627581b5b 100644 --- a/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/safezone/SafezoneModule.java +++ b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/safezone/SafezoneModule.java @@ -6,6 +6,7 @@ import java.util.Map; import java.util.UUID; import mineplex.core.recharge.Recharge; +import mineplex.gemhunters.death.event.QuitNPCSpawnEvent; import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.entity.HumanEntity; @@ -130,6 +131,17 @@ public class SafezoneModule extends MiniPlugin _currentSafezone.remove(player.getUniqueId()); } + @EventHandler + public void quitNpcSpawn(QuitNPCSpawnEvent event) + { + String safezone = getSafezone(event.getPlayer().getLocation()); + + if (safezone != null && safezone.contains(SAFEZONE_DATA_IGNORE)) + { + event.setCancelled(true); + } + } + @EventHandler(priority = EventPriority.HIGHEST) public void entityDamage(EntityDamageEvent event) { diff --git a/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/shop/SellingNPC.java b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/shop/SellingNPC.java new file mode 100644 index 000000000..4e6ff2416 --- /dev/null +++ b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/shop/SellingNPC.java @@ -0,0 +1,223 @@ +package mineplex.gemhunters.shop; + +import mineplex.core.Managers; +import mineplex.core.common.currency.GlobalCurrency; +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilServer; +import mineplex.core.itemstack.ItemBuilder; +import mineplex.gemhunters.economy.EconomyModule; +import mineplex.gemhunters.util.SimpleNPC; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.inventory.InventoryClickEvent; +import org.bukkit.event.inventory.InventoryCloseEvent; +import org.bukkit.event.player.PlayerInteractEntityEvent; +import org.bukkit.inventory.Inventory; +import org.bukkit.inventory.ItemStack; +import org.bukkit.plugin.java.JavaPlugin; + +import java.util.HashMap; +import java.util.Map; +import java.util.Set; + +public class SellingNPC extends SimpleNPC +{ + + private static final ItemStack CANCEL = new ItemBuilder(Material.REDSTONE_BLOCK) + .setTitle(C.cRedB + "Cancel") + .addLore("", "Click to cancel and return your items.") + .build(); + private static final ItemStack BUFFER = new ItemBuilder(Material.STAINED_GLASS_PANE, (byte) 15) + .setTitle(" ") + .build(); + + private final EconomyModule _economy; + + private final Set _selling; + private final Map _inv; + + private int _total; + + public SellingNPC(JavaPlugin plugin, Location spawn, Class type, String name, boolean vegetated, Set selling) + { + super(plugin, spawn, type, name, null, vegetated); + + _economy = Managers.require(EconomyModule.class); + + _selling = selling; + _inv = new HashMap<>(); + } + + @Override + @EventHandler + public void npcClick(PlayerInteractEntityEvent event) + { + super.npcClick(event); + + if (event.getRightClicked().equals(_entity)) + { + event.setCancelled(true); + + Player player = event.getPlayer(); + Inventory inv = UtilServer.getServer().createInventory(null, 54, _entity.getCustomName()); + + inv.setItem(0, CANCEL); + inv.setItem(8, getConfirm()); + + for (int i = 9; i < 18; i++) + { + inv.setItem(i, BUFFER); + } + + _inv.put(player, inv); + player.openInventory(inv); + } + } + + + @EventHandler + public void inventoryClick(InventoryClickEvent event) + { + if (event.getInventory() == null) + { + return; + } + + Player player = (Player) event.getWhoClicked(); + Inventory inv = _inv.get(player); + + if (inv == null | !event.getInventory().equals(inv)) + { + return; + } + + ItemStack itemStack = event.getCurrentItem(); + ItemStack cursor = event.getCursor(); + + if (itemStack == null || cursor == null) + { + return; + } + + Material type = itemStack.getType(); + + if (type == Material.EMERALD_BLOCK || type == Material.REDSTONE_BLOCK || type == Material.STAINED_GLASS_PANE) + { + if (type == Material.EMERALD_BLOCK) + { + finalise(player); + } + else if (type == Material.REDSTONE_BLOCK) + { + cancel(player); + } + + event.setCancelled(true); + return; + } + + TradeableItem currentItem = fromItemStack(itemStack); + TradeableItem cursorItem = fromItemStack(cursor); + + if (currentItem == null && cursorItem == null) + { + event.setCancelled(true); + player.playSound(player.getLocation(), Sound.VILLAGER_NO, 1, 0.7F); + player.sendMessage(F.main("Shop", "You cannot sell that item.")); + return; + } + + UtilServer.runSyncLater(() -> recalculatePrice(inv), 1); + } + + @EventHandler + public void inventoryClose(InventoryCloseEvent event) + { + Player player = (Player) event.getPlayer(); + + if (_inv.containsKey(player)) + { + cancel(player); + } + } + + private void recalculatePrice(Inventory inv) + { + int price = 0; + + for (ItemStack itemStack : inv.getContents()) + { + TradeableItem tradeableItem = fromItemStack(itemStack); + + if (tradeableItem == null) + { + continue; + } + + price += tradeableItem.getCost() * itemStack.getAmount(); + } + + _total = price; + inv.setItem(8, getConfirm()); + } + + private void finalise(Player player) + { + recalculatePrice(_inv.remove(player)); + player.closeInventory(); + player.playSound(player.getLocation(), Sound.VILLAGER_YES, 1, 0.7F); + _economy.addToStore(player, "Sold Items", _total); + } + + private void cancel(Player player) + { + Inventory inv = _inv.remove(player); + + for (ItemStack itemStack : inv.getContents()) + { + TradeableItem tradeableItem = fromItemStack(itemStack); + + if (tradeableItem == null) + { + continue; + } + + player.getInventory().addItem(itemStack); + } + + player.closeInventory(); + } + + private TradeableItem fromItemStack(ItemStack itemStack) + { + if (itemStack == null) + { + return null; + } + + for (TradeableItem item : _selling) + { + ItemStack itemStack2 = item.getLootItem().getItemStack(); + + if (itemStack.getType() == itemStack2.getType()) + { + return item; + } + } + + return null; + } + + private ItemStack getConfirm() + { + return new ItemBuilder(Material.EMERALD_BLOCK) + .setTitle(C.cGreenB + "Confirm") + .addLore("", "Click to sell these current items", "at a price of " + F.currency(GlobalCurrency.GEM, _total) + ".") + .build(); + } +} diff --git a/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/shop/ShopModule.java b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/shop/ShopModule.java index cfe5b13cb..2f8725d8d 100644 --- a/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/shop/ShopModule.java +++ b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/shop/ShopModule.java @@ -1,19 +1,8 @@ package mineplex.gemhunters.shop; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.bukkit.Location; -import org.bukkit.entity.Villager; -import org.bukkit.event.EventHandler; - import mineplex.core.MiniPlugin; import mineplex.core.ReflectivelyCreateMiniPlugin; +import mineplex.core.common.util.C; import mineplex.core.common.util.UtilAlg; import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilTime; @@ -24,8 +13,13 @@ import mineplex.core.updater.event.UpdateEvent; import mineplex.gemhunters.loot.deserialisers.LootItemDeserialiser; import mineplex.gemhunters.safezone.SafezoneModule; import mineplex.gemhunters.shop.deserialisers.VillagerPropertiesDeserialiser; -import mineplex.gemhunters.util.SlackSheetsBot; +import mineplex.gemhunters.util.SlackRewardBot; import mineplex.gemhunters.world.WorldDataModule; +import org.bukkit.Location; +import org.bukkit.entity.Villager; +import org.bukkit.event.EventHandler; + +import java.util.*; @ReflectivelyCreateMiniPlugin public class ShopModule extends MiniPlugin @@ -35,16 +29,7 @@ public class ShopModule extends MiniPlugin private static final String VILLAGER_MASTER_SHEET_NAME = "VILLAGER_MASTER"; private static final VillagerPropertiesDeserialiser VILLAGER_PROPERTIES_DESERIALISER = new VillagerPropertiesDeserialiser(); private static final LootItemDeserialiser DESERIALISER = new LootItemDeserialiser(); - private static final SheetObjectDeserialiser COST_DESERIALISER = new SheetObjectDeserialiser() - { - - @Override - public Integer deserialise(String[] values) throws ArrayIndexOutOfBoundsException, NumberFormatException - { - return Integer.parseInt(values[10]); - } - - }; + private static final SheetObjectDeserialiser COST_DESERIALISER = values -> Integer.parseInt(values[10]); private static final int MINIMUM_ITEMS = 1; private static final int MAXIMUM_ITEMS = 5; @@ -77,7 +62,7 @@ public class ShopModule extends MiniPlugin _npcs = new ArrayList<>(); _spawnedIndexes = new HashMap<>(); - runSyncLater(() -> updateVillagerTrades(), 20); + runSyncLater(this::updateVillagerTrades, 20); } public void updateVillagerTrades() @@ -107,12 +92,6 @@ public class ShopModule extends MiniPlugin } catch (Exception e) { - if (row != 1) - { - SlackSheetsBot.reportParsingError(e, "Villager Trades", key, row); - } - - continue; } } continue; @@ -131,12 +110,6 @@ public class ShopModule extends MiniPlugin } catch (Exception e) { - if (row != 1) - { - SlackSheetsBot.reportParsingError(e, "Villager Trades", key, row); - } - - continue; } } @@ -212,20 +185,31 @@ public class ShopModule extends MiniPlugin } int index = getFreeIndex(locations.size(), usedIndexes); - + if (index == -1) { return; } - + Location randomLocation = locations.get(index); randomLocation.setYaw(UtilMath.r(360)); - + usedIndexes.add(index); + String name = NAMES[UtilMath.r(NAMES.length)]; + + name = (properties.isSelling() ? C.cGold + "Buying" : C.cGreen + "Selling") + C.cGray + " - " + C.cWhite + name; + //DebugModule.getInstance().d("Trader at " + UtilWorld.locToStrClean(randomLocation) + " with key=" + key + " and index=" + index + " and max=" + spawned + "/" + max); - _npcs.add(new TraderNPC(_plugin, randomLocation, Villager.class, NAMES[UtilMath.r(NAMES.length)], _safezone.isInSafeZone(randomLocation), properties, getRandomItemSet(_trades.get(key)))); + if (properties.isSelling()) + { + _npcs.add(new TraderNPC(_plugin, randomLocation, Villager.class, name, _safezone.isInSafeZone(randomLocation), properties, getRandomItemSet(_trades.get(key)))); + } + else + { + new SellingNPC(_plugin, randomLocation, Villager.class, name, _safezone.isInSafeZone(randomLocation), _trades.get(key)); + } } } @@ -256,7 +240,7 @@ public class ShopModule extends MiniPlugin return items2; } - private final String capitalise(String s) + private String capitalise(String s) { String right = s.toLowerCase().substring(1); char left = Character.toUpperCase(s.charAt(0)); diff --git a/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/shop/TraderNPC.java b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/shop/TraderNPC.java index 0c3572803..dbd7c1668 100644 --- a/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/shop/TraderNPC.java +++ b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/shop/TraderNPC.java @@ -100,14 +100,14 @@ public class TraderNPC extends SimpleNPC if (cost > gems) { - player.sendMessage(F.main(_entity.getCustomName(), "I'm sorry you don't have enough gems to purchase this.")); + player.sendMessage(F.main("Shop", "I'm sorry you don't have enough gems to purchase this.")); player.playSound(player.getLocation(), Sound.ITEM_BREAK, 1, 0.6F); return; } if (!UtilInv.HasSpace(player, itemStack.getType(), itemStack.getAmount())) { - player.sendMessage(F.main(_entity.getCustomName(), "I'm sorry you don't have enough space to hold that.")); + player.sendMessage(F.main("Shop", "I'm sorry you don't have enough space to hold that.")); player.playSound(player.getLocation(), Sound.ITEM_BREAK, 1, 0.6F); return; } @@ -125,7 +125,7 @@ public class TraderNPC extends SimpleNPC String itemName = ItemStackFactory.Instance.GetName(itemStack, true); - player.sendMessage(F.main(_entity.getCustomName(), "Purchased " + F.elem(itemName) + "!")); + player.sendMessage(F.main("Shop", "Purchased " + F.elem(itemName) + "!")); player.playSound(player.getLocation(), Sound.NOTE_PLING, 1, 1.2F); player.getInventory().addItem(itemStack); } diff --git a/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/shop/VillagerProperties.java b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/shop/VillagerProperties.java index bb94751ea..db5ed3495 100644 --- a/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/shop/VillagerProperties.java +++ b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/shop/VillagerProperties.java @@ -5,16 +5,18 @@ public class VillagerProperties private final String _name; private final String _dataKey; + private final boolean _selling; private final int _spawnRate; private final int _expireRate; private final int _max; private long _lastSpawn; - public VillagerProperties(String name, String dataKey, int spawnRate, int expireRate, int max) + public VillagerProperties(String name, String dataKey, boolean selling, int spawnRate, int expireRate, int max) { _name = name; _dataKey = dataKey; + _selling = selling; _spawnRate = spawnRate; _expireRate = expireRate; _max = max; @@ -32,6 +34,11 @@ public class VillagerProperties return _dataKey; } + public boolean isSelling() + { + return _selling; + } + public final int getSpawnRate() { return _spawnRate; diff --git a/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/shop/deserialisers/VillagerPropertiesDeserialiser.java b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/shop/deserialisers/VillagerPropertiesDeserialiser.java index 8d37883a9..423be658c 100644 --- a/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/shop/deserialisers/VillagerPropertiesDeserialiser.java +++ b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/shop/deserialisers/VillagerPropertiesDeserialiser.java @@ -1,5 +1,6 @@ package mineplex.gemhunters.shop.deserialisers; +import com.sun.org.apache.xpath.internal.operations.Bool; import mineplex.core.google.SheetObjectDeserialiser; import mineplex.gemhunters.shop.VillagerProperties; @@ -11,13 +12,15 @@ public class VillagerPropertiesDeserialiser implements SheetObjectDeserialiser + { + + if (_status.Get(clicker).getStatusType() == PlayerStatusType.COMBAT || !Recharge.Instance.usable(clicker, "Cash Out")) + { + clicker.sendMessage(F.main(_moduleName, "You can not do this right now.")); + return; + } + + Location toTeleport = getRandomLocation(); + + if (toTeleport == null) + { + clicker.sendMessage(F.main(_moduleName, "A suitable teleport location could not be found. Please try again in a few seconds.")); + return; + } + + clicker.teleport(toTeleport); + }); + } + } } @EventHandler @@ -174,7 +197,7 @@ public class SpawnModule extends MiniPlugin Block up = block.getRelative(BlockFace.UP); Block down = block.getRelative(BlockFace.DOWN); - if (block.getType() != Material.AIR || down.getType() == Material.AIR || UtilBlock.liquid(down) || UtilBlock.liquid(up) || UtilBlock.liquid(block) || _safezone.isInSafeZone(block.getLocation()) || block.getLocation().getBlockY() > MAX_SPAWNING_Y) + if (block.getType() != Material.AIR || down.getType() == Material.AIR || down.getType() == Material.LEAVES || up.getType() == Material.LEAVES || UtilBlock.liquid(down) || UtilBlock.liquid(up) || UtilBlock.liquid(block) || _safezone.isInSafeZone(block.getLocation()) || block.getLocation().getBlockY() > MAX_SPAWNING_Y) { return false; } diff --git a/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/util/SlackRewardBot.java b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/util/SlackRewardBot.java index 8544e411b..9ae99966a 100644 --- a/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/util/SlackRewardBot.java +++ b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/util/SlackRewardBot.java @@ -46,4 +46,4 @@ public class SlackRewardBot } } -} \ No newline at end of file +} diff --git a/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/util/SlackSheetsBot.java b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/util/SlackSheetsBot.java deleted file mode 100644 index 4523e1642..000000000 --- a/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/util/SlackSheetsBot.java +++ /dev/null @@ -1,25 +0,0 @@ -package mineplex.gemhunters.util; - -public class SlackSheetsBot -{ - - private static final String SLACK_CHANNEL_NAME = "#google-sheet-errors"; - private static final String SLACK_USERNAME = "Google Sheets"; - private static final String SLACK_ICON = "http://moppletop.github.io/mineplex/google-sheets-image.png"; - - public static final void reportParsingError(Exception exception, String spreadsheetName, String sheetName, int row) - { - String message = "A parsing error has occured on spreadsheet *" + spreadsheetName + "* sheet *" + sheetName + "* at row *" + row + "*.\n Details: " + exception.getMessage(); - - System.out.println(message); -// try -// { -// SlackAPI.getInstance().sendMessage(SlackTeam.DEVELOPER, SLACK_CHANNEL_NAME, new SlackMessage(SLACK_USERNAME, new URL(SLACK_ICON), message), true); -// } -// catch (MalformedURLException e) -// { -// e.printStackTrace(); -// } - } - -} diff --git a/Plugins/mineplex-google-sheets/src/mineplex/googlesheets/GoogleSheetController.java b/Plugins/mineplex-google-sheets/src/mineplex/googlesheets/GoogleSheetController.java index f6244df65..0c96d03b8 100644 --- a/Plugins/mineplex-google-sheets/src/mineplex/googlesheets/GoogleSheetController.java +++ b/Plugins/mineplex-google-sheets/src/mineplex/googlesheets/GoogleSheetController.java @@ -14,11 +14,23 @@ public class GoogleSheetController public static void main(String[] args) throws InterruptedException { + String sheetToRead = System.getProperty("sheet"); + SpreadsheetType[] types; + + if (sheetToRead == null) + { + types = SpreadsheetType.values(); + } + else + { + types = new SpreadsheetType[]{SpreadsheetType.valueOf(sheetToRead)}; + } + System.out.println("Loading Sheet Provider"); SheetProvider provider = new SheetProvider(); System.out.println("Loaded Sheet Provider"); - for (SpreadsheetType type : SpreadsheetType.values()) + for (SpreadsheetType type : types) { System.out.println("Sleeping..."); Thread.sleep(SLEEP_TIME); @@ -28,10 +40,10 @@ public class GoogleSheetController System.out.println("Done"); System.out.println("Saving to file..."); - + File dir = new File(DATA_STORE_DIR); File file = new File(dir + File.separator + type.name() + ".json"); - + if (!dir.exists()) { System.out.println("mkdir"); @@ -44,12 +56,12 @@ public class GoogleSheetController file.delete(); System.out.println("new File"); file.createNewFile(); - + FileWriter writer = new FileWriter(file); System.out.println("Writing"); writer.write(object.toString()); - + System.out.println("Closing..."); writer.close(); } diff --git a/Plugins/mineplex-google-sheets/src/mineplex/googlesheets/SpreadsheetType.java b/Plugins/mineplex-google-sheets/src/mineplex/googlesheets/SpreadsheetType.java index af2acf11c..953d4be08 100644 --- a/Plugins/mineplex-google-sheets/src/mineplex/googlesheets/SpreadsheetType.java +++ b/Plugins/mineplex-google-sheets/src/mineplex/googlesheets/SpreadsheetType.java @@ -8,11 +8,12 @@ public enum SpreadsheetType GEM_HUNTERS_CHESTS("11Noztgbpu_gUKkc5F4evKKfyxS-Jv1coE0IrBToX_gg"), GEM_HUNTERS_SHOP("1OcYktxVZaW6Fm29Zh6w4Lb-UVyuN8r1x-TFb_3USYYI"), + SMASH_KITS("1Z_SLBzjiIVqu25PMGw9TwNKR3wd9Y9sX7rSDBl_rpxk") ; private String _id; - private SpreadsheetType(String id) + SpreadsheetType(String id) { _id = id; }