From 783b20a0dc2524c926342f9d9159ce68c35a6fef Mon Sep 17 00:00:00 2001 From: xXVevzZXx Date: Thu, 7 Jul 2016 15:08:57 +0200 Subject: [PATCH] Disable champions abilities in smash dom and disable supply chests, adjust peace announcement in Strike games, Absorbtion fix in OP MB, Countdown in CHanging Kits, more Arrows in OP MB, regen hunger in skysmash, scoped players drop helmets now, fix stuff with identifiers in GunModule --- .../game/games/champions/modes/SmashDom.java | 5 ++- .../arcade/game/games/common/Domination.java | 18 ++++++++-- .../micro/modes/OverpoweredMicroBattles.java | 3 ++ .../games/micro/modes/kits/KitOverlord.java | 2 +- .../game/games/minestrike/GunModule.java | 10 +++++- .../game/games/minestrike/ShopManager.java | 3 +- .../games/minestrike/items/StrikeItem.java | 19 ++++++++++ .../game/games/minestrike/items/guns/Gun.java | 4 --- .../game/games/skywars/modes/SkySmash.java | 26 ++++++++++++++ .../survivalgames/modes/ChangingKits.java | 35 ++++++++++++++++++- .../survivalgames/modes/StrikeGames.java | 13 ++++--- 11 files changed, 120 insertions(+), 18 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/champions/modes/SmashDom.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/champions/modes/SmashDom.java index 2054e2a84..f5825a5fe 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/champions/modes/SmashDom.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/champions/modes/SmashDom.java @@ -71,10 +71,13 @@ public class SmashDom extends Domination Manager.getCosmeticManager().setHideParticles(true); Manager.getClassManager().GetItemFactory().getProximityManager().setProxyLimit(6); + Manager.getClassManager().deregisterSelf(); - this.StrictAntiHack = true; + StrictAntiHack = true; InventoryOpenChest = true; + + EnableSupply = false; } @EventHandler(priority = EventPriority.LOWEST) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/common/Domination.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/common/Domination.java index e1ec075d2..80fa91b70 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/common/Domination.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/common/Domination.java @@ -48,6 +48,10 @@ import nautilus.game.arcade.kit.Kit; public class Domination extends TeamGame { + //Configuration + public boolean EnableEmerald = true; + public boolean EnableSupply = true; + //Map Data private ArrayList _points = new ArrayList(); private ArrayList _emerald = new ArrayList(); @@ -179,10 +183,20 @@ public class Domination extends TeamGame public void PowerupPickup(PlayerPickupItemEvent event) { for (Emerald cur : _emerald) - cur.Pickup(event.getPlayer(), event.getItem()); + { + if (EnableEmerald) + cur.Pickup(event.getPlayer(), event.getItem()); + else + return; + } for (Resupply cur : _resupply) - cur.Pickup(event.getPlayer(), event.getItem()); + { + if (EnableSupply) + cur.Pickup(event.getPlayer(), event.getItem()); + else + return; + } } @EventHandler diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/micro/modes/OverpoweredMicroBattles.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/micro/modes/OverpoweredMicroBattles.java index d02b74d13..cc6d27444 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/micro/modes/OverpoweredMicroBattles.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/micro/modes/OverpoweredMicroBattles.java @@ -2,6 +2,7 @@ package nautilus.game.arcade.game.games.micro.modes; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.GameType; +import nautilus.game.arcade.game.games.AbsorptionFix; import nautilus.game.arcade.game.games.micro.Micro; import nautilus.game.arcade.game.games.micro.modes.kits.KitOverlord; import nautilus.game.arcade.kit.Kit; @@ -24,6 +25,8 @@ public class OverpoweredMicroBattles extends Micro GameType.Brawl); TeamArmor = false; + + new AbsorptionFix(this); } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/micro/modes/kits/KitOverlord.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/micro/modes/kits/KitOverlord.java index de942c8d7..0bcaeb900 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/micro/modes/kits/KitOverlord.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/micro/modes/kits/KitOverlord.java @@ -19,7 +19,7 @@ public class KitOverlord extends ProgressingKit }; private static final Perk[] PERKS = { - new PerkFletcher(20, 3, true) + new PerkFletcher(4, 10, true) }; private static final ItemStack IN_HAND = new ItemStack(Material.GOLDEN_APPLE); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/GunModule.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/GunModule.java index f9bac4828..a52237f21 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/GunModule.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/GunModule.java @@ -1172,7 +1172,10 @@ public class GunModule implements Listener { if (!_gunsEquipped.get(gun).equals(player)) continue; - + + if (player.getInventory().getItem(slot) == null) + continue; + if (gun.isStack(player.getInventory().getItem(slot))) { gun.drop(this, player, false, false); @@ -2025,4 +2028,9 @@ public class GunModule implements Listener { return _grenadesDropped; } + + public HashMap getScoped() + { + return _scoped; + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/ShopManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/ShopManager.java index 0c2edb818..11ae6c4bf 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/ShopManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/ShopManager.java @@ -203,10 +203,11 @@ public class ShopManager if (item == null) return; - + if (hasItem(player, item)) return; + if (getMoney(player) < item.getCost()) { player.playSound(player.getLocation(), Sound.NOTE_BASS, 1f, 1f); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/items/StrikeItem.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/items/StrikeItem.java index ad4898dd6..35e72fa1b 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/items/StrikeItem.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/items/StrikeItem.java @@ -1,6 +1,7 @@ package nautilus.game.arcade.game.games.minestrike.items; import java.util.ArrayList; +import java.util.Arrays; import org.bukkit.Bukkit; import org.bukkit.ChatColor; @@ -17,6 +18,7 @@ import mineplex.core.common.util.F; import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilGear; import mineplex.core.common.util.UtilInv; +import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilPlayer; import mineplex.core.itemstack.ItemStackFactory; import nautilus.game.arcade.game.games.minestrike.GunModule; @@ -36,6 +38,8 @@ public abstract class StrikeItem private String _ownerName; private ItemStack _stack = null; + + private int _identifier; public StrikeItem(StrikeItemType type, String name, String[] desc, int cost, int gemCost, Material skin) { @@ -48,6 +52,11 @@ public abstract class StrikeItem //Make Stack _stack = new ItemStack(skin); + + _identifier = UtilMath.r(9000) + 1000; + + addID(); + fixStackName(); } @@ -86,12 +95,20 @@ public abstract class StrikeItem return _skinData; } + public void addID() + { + ItemMeta meta = _stack.getItemMeta(); + meta.setLore(Arrays.asList(ChatColor.RED + "" + ChatColor.BOLD + "Identifier: " + _identifier)); + _stack.setItemMeta(meta); + } + public void setSkin(Material skinMaterial, byte skinData) { _skinMaterial = skinMaterial; _skinData = skinData; _stack = new ItemStack(skinMaterial, 1, (short) 0, skinData); + addID(); } public String getOwnerName() @@ -170,6 +187,8 @@ public abstract class StrikeItem { if (UtilGear.isMat(stack, _skinMaterial)) return stack.getItemMeta().getLore().get(0).equalsIgnoreCase(getStack().getItemMeta().getLore().get(0)); + else + return false; } } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/items/guns/Gun.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/items/guns/Gun.java index dea461fff..77228c28c 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/items/guns/Gun.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/items/guns/Gun.java @@ -81,10 +81,6 @@ public class Gun extends StrikeItem _loadedAmmo = gunStats.getClipSize(); _reserveAmmo = gunStats.getClipReserve() * gunStats.getClipSize(); - - ItemMeta meta = getStack().getItemMeta(); - meta.setLore(Arrays.asList(ChatColor.RED + "" + ChatColor.BOLD + "Identifier: " + UtilMath.r(1000) + 1)); - getStack().setItemMeta(meta); updateWeaponName(null, null); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skywars/modes/SkySmash.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skywars/modes/SkySmash.java index d3ca72338..bc3ac34ed 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skywars/modes/SkySmash.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skywars/modes/SkySmash.java @@ -1,9 +1,12 @@ package nautilus.game.arcade.game.games.skywars.modes; +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.UtilPlayer; +import mineplex.core.recharge.Recharge; import mineplex.minecraft.game.core.damage.CustomDamageEvent; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.GameType; @@ -87,6 +90,29 @@ public class SkySmash extends SoloSkywars event.AddKnockback("Smash Knockback", 1 + 0.1 * (20 - event.GetDamageePlayer().getHealth())); } + @EventHandler(priority = EventPriority.MONITOR) + public void hungerOnHit(CustomDamageEvent event) + { + if (event.IsCancelled()) + return; + + Player damager = event.GetDamagerPlayer(true); + if (damager == null) + return; + + if (damager.equals(event.GetDamageeEntity())) + return; + + if (!(event.GetDamageeEntity() instanceof Player)) + return; + + if (!Recharge.Instance.use(damager, "Hunger Restore", 250, false, false)) + return; + + int amount = Math.max(1, (int)(event.GetDamage()/2)); + UtilPlayer.hunger(damager, amount); + } + @Override public String GetMode() { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/modes/ChangingKits.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/modes/ChangingKits.java index 5fc7a7bcd..4397ddd32 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/modes/ChangingKits.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/modes/ChangingKits.java @@ -1,5 +1,6 @@ package nautilus.game.arcade.game.games.survivalgames.modes; +import org.bukkit.Sound; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.HandlerList; @@ -8,6 +9,7 @@ import org.bukkit.event.entity.EntityDeathEvent; import mineplex.core.common.util.UtilItem; import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilTextBottom; import mineplex.core.common.util.UtilTime; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; @@ -40,6 +42,7 @@ public class ChangingKits extends SoloSurvivalGames private Kit[] _kits; private long _lastChanged; + private int _changeInterval; public ChangingKits(ArcadeManager manager) { @@ -72,6 +75,36 @@ public class ChangingKits extends SoloSurvivalGames }; _lastChanged = 0; + _changeInterval = 60; + } + + @EventHandler + public void countdown(UpdateEvent event) + { + if (!IsLive()) + return; + + if (event.getType() == UpdateType.SEC) + { + if (System.currentTimeMillis() > _lastChanged + 25000) + { + for (Player player : UtilServer.getPlayers()) + { + player.playSound(player.getLocation(), Sound.NOTE_PLING, 2F, 2F); + } + } + } + + if (event.getType() != UpdateType.TICK) + return; + + double percentage = (double) (System.currentTimeMillis() - _lastChanged) / (_changeInterval*1000); + + for (Player player : UtilServer.getPlayers()) + { + UtilTextBottom.displayProgress("New Kit", percentage, + UtilTime.MakeStr(Math.max(0, (_changeInterval*1000) - (System.currentTimeMillis() - _lastChanged))), player); + } } @EventHandler @@ -119,7 +152,7 @@ public class ChangingKits extends SoloSurvivalGames if (!IsLive()) return; - if (!UtilTime.elapsed(_lastChanged, 60000)) + if (!UtilTime.elapsed(_lastChanged, _changeInterval*1000)) return; _lastChanged = System.currentTimeMillis(); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/modes/StrikeGames.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/modes/StrikeGames.java index 38581ad8f..c118f06f1 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/modes/StrikeGames.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/modes/StrikeGames.java @@ -113,7 +113,7 @@ public class StrikeGames extends SoloSurvivalGames if (event.GetState() != GameState.Live) return; - Announce(F.main("Game", "A Peace Phase of " + F.time((_peacePhase/1000) + "") + "seconds has started!")); + Announce(F.main("Game", "A Peace Phase of " + F.time((_peacePhase/1000) + "") + " seconds has started!")); } @EventHandler(priority=EventPriority.HIGHEST) @@ -129,6 +129,10 @@ public class StrikeGames extends SoloSurvivalGames itemIterator.remove(); } } + if (_gunModule.getScoped().containsKey(event.getEntity())) + { + event.getDrops().add(_gunModule.getScoped().get(event.getEntity())); + } } @EventHandler @@ -402,14 +406,9 @@ public class StrikeGames extends SoloSurvivalGames if (stat.getSkin() == stack.getType()) { Gun gun = new Gun(stat, _gunModule); - ItemMeta meta = stack.getItemMeta(); - - if (gun.getStack().hasItemMeta() && gun.getStack().getItemMeta().hasLore()) - meta.setLore(gun.getStack().getItemMeta().getLore()); - - stack.setItemMeta(meta); gun.setStack(stack); gun.updateWeaponName(player, null, false); + gun.addID(); _gunModule.registerGun(gun, player); return; }