diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilText.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilText.java index 0867db6d4..8a2d3d371 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilText.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilText.java @@ -1,8 +1,5 @@ package mineplex.core.common.util; -import org.apache.commons.lang.WordUtils; -import org.bukkit.ChatColor; - import javax.imageio.ImageIO; import java.awt.image.BufferedImage; import java.io.IOException; @@ -11,6 +8,9 @@ import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; +import org.apache.commons.lang.WordUtils; +import org.bukkit.ChatColor; + public class UtilText { private static HashMap _characters = new HashMap<>(); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementCategory.java b/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementCategory.java index 18cb30863..56115f236 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementCategory.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementCategory.java @@ -176,8 +176,12 @@ public enum AchievementCategory Material.EXPLOSIVE_MINECART, 0, GameCategory.CLASSICS, "Sky Warrior Kit", false, GameDisplay.QuiverPayload.getGameId()), SKYFALL("Skyfall", null, - new StatDisplay[] {StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.GEMS_EARNED, null, new StatDisplay("Booster Rings", "Rings")}, - Material.BOW, 0, GameCategory.SURVIVAL, null, false, GameDisplay.Skyfall.getGameId()); + new StatDisplay[] {StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED, null, new StatDisplay("Booster Rings", "Rings"), + null, null, new StatDisplay(C.Bold + "Team Stats", true), null, + StatDisplay.fromGame("Wins", GameDisplay.SkyfallTeams, "Wins"), StatDisplay.fromGame("Games Played", GameDisplay.SkyfallTeams, "Wins", "Losses"), + StatDisplay.fromGame("Kills", GameDisplay.SkyfallTeams, "Kills"), StatDisplay.fromGame("Deaths", GameDisplay.SkyfallTeams, "Deaths"), + StatDisplay.fromGame("Gems Earned", GameDisplay.SkyfallTeams, "GemsEarned"), null, StatDisplay.fromGame("Booster Rings", GameDisplay.SkyfallTeams, "Rings")}, + Material.BOW, 0, GameCategory.SURVIVAL, null, false, GameDisplay.Skyfall.getGameId(), GameDisplay.SkyfallTeams.getGameId()); private String _name; private String[] _statsToPull; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/game/GameDisplay.java b/Plugins/Mineplex.Core/src/mineplex/core/game/GameDisplay.java index 787e73a59..9ef25145e 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/game/GameDisplay.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/game/GameDisplay.java @@ -85,6 +85,7 @@ public enum GameDisplay Valentines("Valentines Vendetta", Material.LEATHER, (byte)0, GameCategory.EXTRA, 61), Skyfall("Skyfall", Material.DIAMOND_BOOTS, (byte)0, GameCategory.SURVIVAL, 62), + SkyfallTeams("Skyfall Teams", Material.DIAMOND_BOOTS, (byte)0, GameCategory.SURVIVAL, 65), Basketball("Hoops", Material.SLIME_BALL, (byte)0, GameCategory.EXTRA, 63), diff --git a/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardManager.java b/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardManager.java index 01e9cde68..ee76e8f53 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardManager.java @@ -252,16 +252,16 @@ public class RewardManager //Music Discs - addMusicReward(Type.NORMAL, "Blocks Disk", rarity, 25); - addMusicReward(Type.NORMAL, "Cat Disk", rarity, 25); - addMusicReward(Type.NORMAL, "Chirp Disk", rarity, 25); - addMusicReward(Type.NORMAL, "Far Disk", rarity, 25); - addMusicReward(Type.NORMAL, "Mall Disk", rarity, 25); - addMusicReward(Type.NORMAL, "Mellohi Disk", rarity, 25); - addMusicReward(Type.NORMAL, "Stal Disk", rarity, 25); - addMusicReward(Type.NORMAL, "Strad Disk", rarity, 25); - addMusicReward(Type.NORMAL, "Wait Disk", rarity, 25); - addMusicReward(Type.NORMAL, "Ward Disk", rarity, 25); + addMusicReward(Type.NORMAL, "Blocks Disc", rarity, 25); + addMusicReward(Type.NORMAL, "Cat Disc", rarity, 25); + addMusicReward(Type.NORMAL, "Chirp Disc", rarity, 25); + addMusicReward(Type.NORMAL, "Far Disc", rarity, 25); + addMusicReward(Type.NORMAL, "Mall Disc", rarity, 25); + addMusicReward(Type.NORMAL, "Mellohi Disc", rarity, 25); + addMusicReward(Type.NORMAL, "Stal Disc", rarity, 25); + addMusicReward(Type.NORMAL, "Strad Disc", rarity, 25); + addMusicReward(Type.NORMAL, "Wait Disc", rarity, 25); + addMusicReward(Type.NORMAL, "Ward Disc", rarity, 25); // VALENTINES Gadgets @@ -275,17 +275,20 @@ public class RewardManager addHat(Type.WINTER_HOLIDAY, HatType.SNOWMAN, rarity, 5); // Omega items - addMusicReward(Type.OMEGA, "Block Disk", rarity, 25); - addMusicReward(Type.OMEGA, "Cat Disk", rarity, 25); - addMusicReward(Type.OMEGA, "Chirp Disk", rarity, 25); - addMusicReward(Type.OMEGA, "Far Disk", rarity, 25); - addMusicReward(Type.OMEGA, "Mall Disk", rarity, 25); - addMusicReward(Type.OMEGA, "Mellohi Disk", rarity, 25); - addMusicReward(Type.OMEGA, "Stal Disk", rarity, 25); - addMusicReward(Type.OMEGA, "Stard Disk", rarity, 25); - addMusicReward(Type.OMEGA, "Wait Disk", rarity, 25); - addMusicReward(Type.OMEGA, "Ward Disk", rarity, 25); + addMusicReward(Type.OMEGA, "Blocks Disc", rarity, 25); + addMusicReward(Type.OMEGA, "Cat Disc", rarity, 25); + addMusicReward(Type.OMEGA, "Chirp Disc", rarity, 25); + addMusicReward(Type.OMEGA, "Far Disc", rarity, 25); + addMusicReward(Type.OMEGA, "Mall Disc", rarity, 25); + addMusicReward(Type.OMEGA, "Mellohi Disc", rarity, 25); + addMusicReward(Type.OMEGA, "Stal Disc", rarity, 25); + addMusicReward(Type.OMEGA, "Strad Disc", rarity, 25); + addMusicReward(Type.OMEGA, "Wait Disc", rarity, 25); + addMusicReward(Type.OMEGA, "Ward Disc", rarity, 25); + addGadget(Type.OMEGA, getGadget(ArrowTrailHalloween.class), rarity, 50); + + addHat(Type.OMEGA, HatType.PUMPKIN, rarity, 75); addHat(Type.OMEGA, HatType.PRESENT, rarity, 5); addHat(Type.OMEGA, HatType.SNOWMAN, rarity, 5); @@ -393,6 +396,7 @@ public class RewardManager addGadget(Type.OMEGA, getGadget(DoubleJumpShadow.class), rarity, 15); addGadget(Type.OMEGA, getGadget(DoubleJumpStorm.class), rarity, 30); addGadget(Type.OMEGA, getGadget(DoubleJumpCandyCane.class), rarity, 20); + addGadget(Type.OMEGA, getGadget(DoubleJumpHalloween.class), rarity, 50); addGadget(Type.OMEGA, getGadget(DeathFreedom.class), rarity, 15); addGadget(Type.OMEGA, getGadget(DeathStorm.class), rarity, 30); @@ -514,9 +518,7 @@ public class RewardManager addMineStrikeSkin(Type.NORMAL, MineStrikeSkin.FAMAS_Pulse, rarity, 33); addMineStrikeSkin(Type.NORMAL, MineStrikeSkin.SG553_Pulse, rarity, 33); addMineStrikeSkin(Type.NORMAL, MineStrikeSkin.AK_47_Vulcan, rarity, 5); - - - + //WINTER //Arrow Trails @@ -527,10 +529,7 @@ public class RewardManager addHat(Type.WINTER_HOLIDAY, HatType.GRINCH, rarity, 5); addGadget(Type.WINTER_HOLIDAY, getGadget(MorphSnowman.class), rarity, 5); addMount(Type.WINTER_HOLIDAY, getMount(MountBabyReindeer.class), rarity, 5); - - - - + //VALENTINES //Cupid Set @@ -539,16 +538,17 @@ public class RewardManager addGadget(Type.VALENTINES_GIFT, getGadget(DoubleJumpCupidsWings.class), rarity, 100); addGadget(Type.VALENTINES_GIFT, getGadget(ParticleHeart.class), rarity, 100, 0); - // FREEDOM addMount(Type.FREEDOM, getMount(MountFreedomHorse.class), rarity, 1); addGadget(Type.FREEDOM, getGadget(MorphUncleSam.class), rarity, 5); addGadget(Type.FREEDOM, getGadget(ParticleFreedom.class), rarity, 50); - // Omega items + // OMEGA addPetReward(Type.OMEGA, EntityType.VILLAGER, rarity, 1); addPetReward(Type.OMEGA, EntityType.ZOMBIE, rarity, 10); addPetReward(Type.OMEGA, EntityType.PIG_ZOMBIE, rarity, 1); + addPetReward(Type.OMEGA, EntityType.RABBIT, rarity, 10); + addPetReward(Type.OMEGA, EntityType.BLAZE, rarity, 2); addGadget(Type.OMEGA, getGadget(MorphBunny.class), rarity, 1); addGadget(Type.OMEGA, getGadget(MorphUncleSam.class), rarity, 5); @@ -557,6 +557,7 @@ public class RewardManager addGadget(Type.OMEGA, getGadget(MorphSlime.class), rarity, 10); addGadget(Type.OMEGA, getGadget(MorphBlock.class), rarity, 20); addGadget(Type.OMEGA, getGadget(MorphSnowman.class), rarity, 10); + addGadget(Type.OMEGA, getGadget(MorphGrimReaper.class), rarity, 25); addGadget(Type.OMEGA, getGadget(ParticleFreedom.class), rarity, 15); addGadget(Type.OMEGA, getGadget(ParticleWingsAngel.class), rarity, 15); @@ -583,12 +584,14 @@ public class RewardManager addMount(Type.OMEGA, getMount(MountUndead.class), rarity, 1); addMount(Type.OMEGA, getMount(MountValentinesSheep.class), rarity, 33); addMount(Type.OMEGA, getMount(MountBabyReindeer.class), rarity, 1); + addMount(Type.OMEGA, getMount(MountNightmareSteed.class), rarity, 10); addGadget(Type.OMEGA, getGadget(WinEffectBabyChicken.class), rarity, 10); addGadget(Type.OMEGA, getGadget(WinEffectLavaTrap.class), rarity, 20); addGadget(Type.OMEGA, getGadget(WinEffectRiseOfTheElderGuardian.class), rarity, 4); addGadget(Type.OMEGA, getGadget(WinEffectLightningStrike.class), rarity, 20); addGadget(Type.OMEGA, getGadget(WinEffectMrPunchMan.class), rarity, 33); + addGadget(Type.OMEGA, getGadget(WinEffectHalloween.class), rarity, 75); addGadget(Type.OMEGA, getGadget(DeathEnchant.class), rarity, 10); addGadget(Type.OMEGA, getGadget(DeathCupidsBrokenHeart.class), rarity, 25); @@ -614,7 +617,7 @@ public class RewardManager addReward(Type.TRICK_OR_TREAT, new ChestReward(_inventoryManager, TreasureType.MYTHICAL, 1, 3, rarity, 50, 0)); addReward(Type.TRICK_OR_TREAT, new ChestReward(_inventoryManager, TreasureType.ILLUMINATED, 1, 1, rarity, 30, 0)); addMount(Type.TRICK_OR_TREAT, getMount(MountZombie.class), rarity, 25); - addPetReward(Type.HAUNTED, EntityType.ZOMBIE, rarity, 10); + addPetReward(Type.TRICK_OR_TREAT, EntityType.ZOMBIE, rarity, 10); addGadget(Type.TRICK_OR_TREAT, getGadget(MorphPumpkinKing.class), rarity, 5); } @@ -640,7 +643,7 @@ public class RewardManager { for(Gadget gadget : _gadgetManager.getGadgets(GadgetType.MUSIC_DISC)) { - if(gadget.getName().equals(musicDisk) || gadget.getName().equals(musicDisk + " Disk")) + if(gadget.getName().equals(musicDisk) || gadget.getName().equals(musicDisk + " Disc")) { return addGadget(type, gadget, rarity, weight, shards); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardType.java b/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardType.java index 9c6550cb9..3d673f360 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardType.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardType.java @@ -14,7 +14,7 @@ public enum RewardType ILLUMINATED_CHEST( 0, 2, 16, 72), FREEDOM_CHEST( 0, 5, 18, 0), HAUNTED_CHEST( 0, 5, 18, 0), - OMEGA_CHEST( 0, 2, 16, 32), + OMEGA_CHEST( 0, 32, 16, 2), TRICK_OR_TREAT_CHEST(0.1, 2, 16, 0), VALENTINES_GIFT( 0, 7, 20, 20), diff --git a/Plugins/Mineplex.Core/src/mineplex/core/treasure/gui/BuyChestButton.java b/Plugins/Mineplex.Core/src/mineplex/core/treasure/gui/BuyChestButton.java index 8194799c8..70d8c926d 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/gui/BuyChestButton.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/gui/BuyChestButton.java @@ -57,7 +57,7 @@ public class BuyChestButton implements IButton return; } } - if (_chestType == TreasureType.FREEDOM) + if (_chestType == TreasureType.FREEDOM || _chestType == TreasureType.HAUNTED) { if (!_page.getPlugin().hasItemsToGivePlayer(_chestType.getRewardPool(), player)) { diff --git a/Plugins/Mineplex.Core/src/mineplex/core/treasure/gui/TreasurePage.java b/Plugins/Mineplex.Core/src/mineplex/core/treasure/gui/TreasurePage.java index 9121bc794..a4124c3a9 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/gui/TreasurePage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/gui/TreasurePage.java @@ -204,15 +204,13 @@ public class TreasurePage extends ShopPageBase hauntedLore.add(C.cGray + "during the month of October when the"); hauntedLore.add(C.cGray + "veil between this world and the shadow is thin..."); hauntedLore.add(" "); - if (hauntedCount > 0) + if (hauntedCount > 0 && !hasAllHauntedItems(getPlayer())) { hauntedLore.add(ChatColor.RESET + C.cGreen + "Click to Open!"); } else { - hauntedLore.add(ChatColor.RESET + "Click to craft for " + C.cAqua + "35000 Treasure Shards"); - hauntedLore.add(" "); - hauntedLore.add(ChatColor.RESET + "or Purchase at: " + C.cYellow + "www.mineplex.com/shop"); + hauntedLore.add(C.cRed + "This item is no longer available!"); } List trickLore = Lists.newArrayList(); @@ -278,6 +276,16 @@ public class TreasurePage extends ShopPageBase return !getPlugin().hasItemsToGivePlayer(TreasureType.FREEDOM.getRewardPool(), player); } + /** + * Checks if the player has all the items for the halloween chest + * @param player + * @return + */ + public boolean hasAllHauntedItems(Player player) + { + return !getPlugin().hasItemsToGivePlayer(TreasureType.HAUNTED.getRewardPool(), player); + } + public int getFreedomUnlockedAmount(Player player) { if (hasAllFreedomItems(player)) diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java index ccbaa8acd..fdba4cb6c 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java @@ -1,4 +1,46 @@ package mineplex.hub; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; +import java.util.UUID; + +import net.md_5.bungee.api.chat.ComponentBuilder; +import net.md_5.bungee.api.chat.HoverEvent; +import net.md_5.bungee.api.chat.HoverEvent.Action; +import net.md_5.bungee.api.chat.TextComponent; +import net.minecraft.server.v1_8_R3.EntityInsentient; +import net.minecraft.server.v1_8_R3.EntityPlayer; + +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.GameMode; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.craftbukkit.v1_8_R3.CraftWorld; +import org.bukkit.entity.Egg; +import org.bukkit.entity.Entity; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.entity.EntityDamageEvent; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.event.entity.EntityTargetEvent.TargetReason; +import org.bukkit.event.entity.ItemSpawnEvent; +import org.bukkit.event.entity.PlayerDeathEvent; +import org.bukkit.event.inventory.InventoryClickEvent; +import org.bukkit.event.player.AsyncPlayerChatEvent; +import org.bukkit.event.player.PlayerCommandPreprocessEvent; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.event.player.PlayerJoinEvent; +import org.bukkit.event.player.PlayerLoginEvent; +import org.bukkit.event.player.PlayerQuitEvent; +import org.bukkit.event.player.PlayerRespawnEvent; +import org.bukkit.event.player.PlayerVelocityEvent; +import org.bukkit.event.server.ServerListPingEvent; +import org.bukkit.event.world.ChunkLoadEvent; +import org.bukkit.plugin.java.JavaPlugin; + import mineplex.core.Managers; import mineplex.core.MiniClientPlugin; import mineplex.core.TimingsFix; @@ -16,7 +58,13 @@ import mineplex.core.chat.ChatFormat; import mineplex.core.chat.IChatMessageFormatter; import mineplex.core.common.Rank; import mineplex.core.common.currency.GlobalCurrency; -import mineplex.core.common.util.*; +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +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.UtilTime; import mineplex.core.cosmetic.CosmeticManager; import mineplex.core.customdata.CustomDataManager; import mineplex.core.disguise.DisguiseManager; @@ -36,12 +84,7 @@ import mineplex.core.locations.LocationConstants; import mineplex.core.menu.MenuManager; import mineplex.core.message.PrivateMessageEvent; import mineplex.core.mount.MountManager; -import mineplex.core.noteblock.INoteVerifier; import mineplex.core.noteblock.MusicManager; -import mineplex.core.noteblock.NBSReader; -import mineplex.core.noteblock.NotePlayer; -import mineplex.core.noteblock.NoteSong; -import mineplex.core.noteblock.event.SongFinishEvent; import mineplex.core.notifier.NotificationManager; import mineplex.core.npc.NpcManager; import mineplex.core.packethandler.PacketHandler; @@ -72,7 +115,16 @@ import mineplex.hub.commands.ForcefieldRadius; import mineplex.hub.commands.GadgetToggle; import mineplex.hub.commands.GameModeCommand; import mineplex.hub.commands.NewsCommand; -import mineplex.hub.modules.*; +import mineplex.hub.modules.ForcefieldManager; +import mineplex.hub.modules.HubVisibilityManager; +import mineplex.hub.modules.JumpManager; +import mineplex.hub.modules.KothManager; +import mineplex.hub.modules.MavericksManager; +import mineplex.hub.modules.NewsManager; +import mineplex.hub.modules.ParkourManager; +import mineplex.hub.modules.SoccerManager; +import mineplex.hub.modules.ValentinesManager; +import mineplex.hub.modules.WorldManager; import mineplex.hub.modules.nonpremium.NonPremiumManager; import mineplex.hub.profile.gui.GUIProfile; import mineplex.minecraft.game.classcombat.Skill.event.SkillTriggerEvent; @@ -80,41 +132,11 @@ import mineplex.minecraft.game.classcombat.item.event.ItemTriggerEvent; import mineplex.minecraft.game.core.combat.DeathMessageType; import mineplex.minecraft.game.core.combat.event.CombatDeathEvent; import mineplex.minecraft.game.core.condition.ConditionManager; -import net.md_5.bungee.api.chat.ComponentBuilder; -import net.md_5.bungee.api.chat.HoverEvent; -import net.md_5.bungee.api.chat.HoverEvent.Action; -import net.md_5.bungee.api.chat.TextComponent; -import net.minecraft.server.v1_8_R3.EntityInsentient; -import net.minecraft.server.v1_8_R3.EntityPlayer; -import org.bukkit.*; -import org.bukkit.craftbukkit.v1_8_R3.CraftWorld; -import org.bukkit.entity.Egg; -import org.bukkit.entity.Entity; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.EventPriority; -import org.bukkit.event.entity.EntityDamageEvent; -import org.bukkit.event.entity.EntityDamageEvent.DamageCause; -import org.bukkit.event.entity.EntityTargetEvent.TargetReason; -import org.bukkit.event.entity.ItemSpawnEvent; -import org.bukkit.event.entity.PlayerDeathEvent; -import org.bukkit.event.inventory.InventoryClickEvent; -import org.bukkit.event.player.*; -import org.bukkit.event.server.ServerListPingEvent; -import org.bukkit.event.world.ChunkLoadEvent; -import org.bukkit.plugin.java.JavaPlugin; - -import java.io.DataInputStream; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.util.*; public class HubManager extends MiniClientPlugin implements IChatMessageFormatter { // ☃❅ Snowman! - public HubType Type = HubType.Halloween; + public HubType Type = HubType.Normal; private BlockRestore _blockRestore; private CoreClientManager _clientManager; diff --git a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/customerSupport/CustomerSupport.java b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/customerSupport/CustomerSupport.java index fa2d4c7bf..8c5ee0d7c 100644 --- a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/customerSupport/CustomerSupport.java +++ b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/customerSupport/CustomerSupport.java @@ -263,9 +263,9 @@ public class CustomerSupport extends MiniPlugin implements ResultSetCallable { if (transaction.Coins == 0 && transaction.Gems == 0) { - if (transaction.SalesPackageName.split(" ").length == 3) - trickOrTreatChestsReceived += Integer.parseInt(transaction.SalesPackageName.split(" ")[2]); - else if (transaction.SalesPackageName.split(" ").length == 2) + if (transaction.SalesPackageName.split(" ").length == 5) + trickOrTreatChestsReceived += Integer.parseInt(transaction.SalesPackageName.split(" ")[4]); + else if (transaction.SalesPackageName.split(" ").length == 4) trickOrTreatChestsReceived += 1; } 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 bcfe2768d..c6d0ad0fb 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java @@ -152,7 +152,6 @@ import nautilus.game.arcade.managers.GameStatManager; import nautilus.game.arcade.managers.GameTestingManager; import nautilus.game.arcade.managers.GameTournamentManager; import nautilus.game.arcade.managers.GameWorldManager; -import nautilus.game.arcade.managers.HolidayManager; import nautilus.game.arcade.managers.IdleManager; import nautilus.game.arcade.managers.MiscManager; import nautilus.game.arcade.managers.NextBestGameManager; @@ -345,8 +344,8 @@ public class ArcadeManager extends MiniPlugin implements IRelation _idleManager = new IdleManager(this); TitanGiveawayManager titanGiveaway = new TitanGiveawayManager(getPlugin(), clientManager, serverStatusManager); - new HolidayManager(this, titanGiveaway); - IsHolidayEnabled = true; + //new HolidayManager(this, titanGiveaway); + IsHolidayEnabled = false; new ValentinesGiftManager(plugin, clientManager, _bonusManager.getRewardManager(), inventoryManager, _cosmeticManager.getGadgetManager(), statsManager); new GameTestingManager(this); 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 90f50857e..cfd9c9785 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/GameType.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/GameType.java @@ -14,9 +14,12 @@ import nautilus.game.arcade.game.games.basketball.Basketball; import nautilus.game.arcade.game.games.bossbattles.BossBattles; import nautilus.game.arcade.game.games.bouncyballs.BouncyBalls; import nautilus.game.arcade.game.games.bridge.Bridge; +import nautilus.game.arcade.game.games.bridge.modes.AppleAttack; +import nautilus.game.arcade.game.games.bridge.modes.InsaneBridges; import nautilus.game.arcade.game.games.bridge.modes.LuckyBridges; import nautilus.game.arcade.game.games.bridge.modes.OverpoweredBridge; import nautilus.game.arcade.game.games.bridge.modes.SpeedBridges; +import nautilus.game.arcade.game.games.bridge.modes.UHCBridges; import nautilus.game.arcade.game.games.build.Build; import nautilus.game.arcade.game.games.build.modes.DukesOfDecoration; import nautilus.game.arcade.game.games.build.modes.TeamBuild; @@ -57,6 +60,7 @@ import nautilus.game.arcade.game.games.micro.modes.TinyWinners; import nautilus.game.arcade.game.games.milkcow.MilkCow; import nautilus.game.arcade.game.games.minecraftleague.MinecraftLeague; import nautilus.game.arcade.game.games.minestrike.Minestrike; +import nautilus.game.arcade.game.games.minestrike.modes.SuperPaintstrike; import nautilus.game.arcade.game.games.mineware.BawkBawkBattles; import nautilus.game.arcade.game.games.monsterleague.MonsterLeague; import nautilus.game.arcade.game.games.monstermaze.MonsterMaze; @@ -66,6 +70,7 @@ import nautilus.game.arcade.game.games.quiver.Quiver; import nautilus.game.arcade.game.games.quiver.QuiverTeamBase; import nautilus.game.arcade.game.games.quiver.QuiverTeams; import nautilus.game.arcade.game.games.quiver.modes.BunnyHop; +import nautilus.game.arcade.game.games.quiver.modes.UltimateOITQ; import nautilus.game.arcade.game.games.rings.ElytraRings; import nautilus.game.arcade.game.games.runner.Runner; import nautilus.game.arcade.game.games.runner.modes.FasterThanLight; @@ -73,10 +78,13 @@ import nautilus.game.arcade.game.games.searchanddestroy.SearchAndDestroy; import nautilus.game.arcade.game.games.sheep.SheepGame; import nautilus.game.arcade.game.games.sheep.modes.EweHeroes; import nautilus.game.arcade.game.games.sheep.modes.OverpoweredSheepQuest; +import nautilus.game.arcade.game.games.sheep.modes.SheepMania; import nautilus.game.arcade.game.games.sheep.modes.SmashSheep; -import nautilus.game.arcade.game.games.skyfall.Skyfall; +import nautilus.game.arcade.game.games.skyfall.SoloSkyfall; +import nautilus.game.arcade.game.games.skyfall.TeamSkyfall; import nautilus.game.arcade.game.games.skywars.SoloSkywars; import nautilus.game.arcade.game.games.skywars.TeamSkywars; +import nautilus.game.arcade.game.games.skywars.modes.Elementalist; import nautilus.game.arcade.game.games.skywars.modes.OverpoweredSkywars; import nautilus.game.arcade.game.games.skywars.modes.SkySmash; import nautilus.game.arcade.game.games.skywars.modes.UHCSkywars; @@ -200,7 +208,8 @@ public enum GameType MonsterMaze(MonsterMaze.class, GameDisplay.MonsterMaze), MonsterLeague(MonsterLeague.class, GameDisplay.MonsterLeague), Gladiators(Gladiators.class, GameDisplay.Gladiators), - Skyfall(Skyfall.class, GameDisplay.Skyfall), + Skyfall(SoloSkyfall.class, GameDisplay.Skyfall), + SkyfallTeams(TeamSkyfall.class, GameDisplay.SkyfallTeams, new GameType[]{GameType.Skyfall}, false), BouncyBalls(BouncyBalls.class, GameDisplay.BouncyBalls), @@ -221,13 +230,17 @@ public enum GameType Brawl(null, new GameMode[]{ new GameMode(OverpoweredBridge.class, GameType.Bridge, "OP Bridges"), new GameMode(SpeedBridges.class, GameType.Bridge, "Speed Bridges"), - new GameMode(LuckyBridges.class, GameType.Bridge, "Lucky Bridges"), + new GameMode(LuckyBridges.class, GameType.Bridge, "Lucky Bridges"), + new GameMode(AppleAttack.class, GameType.Bridge, "Apple Attack"), + new GameMode(UHCBridges.class, GameType.Bridge, "UHC Bridges"), + new GameMode(InsaneBridges.class, GameType.Bridge, "Insane Bridges"), new GameMode(OverpoweredGladiators.class, GameType.Gladiators, "OP Gladiators"), new GameMode(ChampionsGladiators.class, GameType.Gladiators, "Champions Gladiators"), new GameMode(SmashGladiators.class, GameType.Gladiators, "Smash Gladiators"), new GameMode(OverpoweredSkywars.class, GameType.Skywars, "OP Skywars"), new GameMode(UHCSkywars.class, GameType.Skywars, "UHC Skywars"), new GameMode(SkySmash.class, GameType.Skywars, "Sky Smash"), + new GameMode(Elementalist.class, GameType.Skywars, "Elementalist"), new GameMode(TeamBuild.class, GameType.Build, "Team Master Builders"), new GameMode(DukesOfDecoration.class, GameType.Build, "Dukes Of Decoration"), new GameMode(GodBattles.class, GameType.UHC, "God Battles"), @@ -248,12 +261,19 @@ public enum GameType new GameMode(UltraSpleef.class, GameType.Spleef, "Ultra Spleef"), new GameMode(RandomKitSSM.class, GameType.Smash, "Random Kit SSM"), new GameMode(EweHeroes.class, GameType.Sheep, "Heroes Of The Ewe"), + new GameMode(SheepMania.class, GameType.Sheep, "Sheep Mania"), new GameMode(SmashSheep.class, GameType.Sheep, "Smash Sheep"), new GameMode(OverpoweredSheepQuest.class, GameType.Sheep, "OP Sheep Quest"), new GameMode(FasterThanLight.class, GameType.Runner, "Faster Than Light"), - new GameMode(BunnyHop.class, GameType.Quiver, "Bunny Hop"), + new GameMode(BunnyHop.class, GameType.Quiver, "Bunny Hop"), + new GameMode(UltimateOITQ.class, GameType.Quiver, "Ultimate OITQ"), new GameMode(Countdown.class, GameType.HideSeek, "Countdown"), - new GameMode(SmashDom.class, GameType.ChampionsDominate, "Smash Dominate"), + new GameMode(SmashDom.class, GameType.ChampionsDominate, "Smash Dominate"), + new GameMode(SuperPaintstrike.class, GameType.MineStrike, "Super Paintstrike", new Pair[] + { + Pair.create(MinecraftVersion.Version1_8, "http://file.mineplex.com/ResMinestrike.zip"), + Pair.create(MinecraftVersion.Version1_9, "http://file.mineplex.com/ResMinestrike19.zip") + }, true), }, GameDisplay.Brawl, null, false, null, false, true); GameDisplay _display; 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 19dab9f47..0a5827448 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 @@ -884,11 +884,43 @@ public abstract class Game implements Listener HandlerList.unregisterAll(kit); - for (Perk perk : kit.GetPerks()) + if (kit instanceof ProgressingKit) { - HandlerList.unregisterAll(perk); - perk.unregisteredEvents(); + if (((ProgressingKit) kit).hasUpgrades()) + { + ProgressingKit pKit = (ProgressingKit) kit; + for (Perk[] perks : pKit.getPerks()) + { + for (Perk perk : perks) + { + if (perk == null) + { + continue; + } + HandlerList.unregisterAll(perk); + perk.unregisteredEvents(); + } + } + } + else + { + for (Perk perk : kit.GetPerks()) + { + HandlerList.unregisterAll(perk); + perk.unregisteredEvents(); + } + } } + else + { + for (Perk perk : kit.GetPerks()) + { + HandlerList.unregisterAll(perk); + perk.unregisteredEvents(); + } + } + + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/Bridge.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/Bridge.java index e5c60d5c2..f88e6da0c 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/Bridge.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/Bridge.java @@ -130,19 +130,22 @@ public class Bridge extends TeamGame implements OreObsfucation public Bridge(ArcadeManager manager, GameType type) { - super(manager, type, - - new Kit[] - { - new KitApple(manager), - new KitBerserker(manager), - new KitBrawler(manager), - new KitMammoth(manager), - new KitArcher(manager), - new KitMiner(manager), - new KitBomber(manager), - new KitDestructor(manager), - }, + this(manager, new Kit[] + { + new KitApple(manager), + new KitBerserker(manager), + new KitBrawler(manager), + new KitMammoth(manager), + new KitArcher(manager), + new KitMiner(manager), + new KitBomber(manager), + new KitDestructor(manager), + }, type); + } + + public Bridge(ArcadeManager manager, Kit[] kitarray, GameType type) + { + super(manager, type, kitarray, new String[] { "Gather resources and prepare for combat.", diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/kits/KitApple.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/kits/KitApple.java index ac42a517e..78fc4acae 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/kits/KitApple.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/kits/KitApple.java @@ -21,7 +21,7 @@ public class KitApple extends ProgressingKit }; private static final Perk[] PERKS = { - new PerkApple() + new PerkApple(10000) }; private static final ItemStack IN_HAND = new ItemStack(Material.APPLE); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/modes/AppleAttack.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/modes/AppleAttack.java new file mode 100644 index 000000000..fec90dae2 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/modes/AppleAttack.java @@ -0,0 +1,28 @@ +package nautilus.game.arcade.game.games.bridge.modes; + +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.GameType; +import nautilus.game.arcade.game.games.bridge.Bridge; +import nautilus.game.arcade.game.games.bridge.modes.kits.KitBrawlAppler; +import nautilus.game.arcade.kit.Kit; + +/** + * AppleAttack is a mode for [{@link Bridge} which will remove all kits except for a custom appler {@link KitBrawlAppler} + * + * @author xXVevzZXx + */ +public class AppleAttack extends Bridge +{ + + public AppleAttack(ArcadeManager manager) + { + super(manager, new Kit[]{new KitBrawlAppler(manager)}, GameType.Brawl); + } + + @Override + public String GetMode() + { + return "Apple Attack"; + } + +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/modes/InsaneBridges.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/modes/InsaneBridges.java new file mode 100644 index 000000000..b3c655d27 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/modes/InsaneBridges.java @@ -0,0 +1,197 @@ +package nautilus.game.arcade.game.games.bridge.modes; + +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.block.Chest; +import org.bukkit.enchantments.Enchantment; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.meta.EnchantmentStorageMeta; +import org.bukkit.potion.Potion; +import org.bukkit.potion.PotionType; + +import mineplex.core.common.util.UtilMath; +import mineplex.core.itemstack.ItemStackFactory; + +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.GameType; +import nautilus.game.arcade.events.GameStateChangeEvent; +import nautilus.game.arcade.game.games.AbsorptionFix; +import nautilus.game.arcade.game.games.bridge.Bridge; + +/** + * InsaneBridges is a mode of {@link Bridge} which provides players with starting equipement, better loot and shorter bridge time + * + * @author xXVevzZXx + */ +public class InsaneBridges extends Bridge +{ + private int _untilBridges; + + public InsaneBridges(ArcadeManager manager) + { + super(manager, GameType.Brawl); + + new AbsorptionFix(this); + + Manager.GetDamage().SetEnabled(false); + + _untilBridges = 60000; // 60 Seconds + + WorldBoundaryKill = true; + } + + @EventHandler + public void fallBridges(GameStateChangeEvent event) + { + if (event.GetState() == GameState.Live) + { + setBridgeTime(_untilBridges); + + for (Player player : GetPlayers(true)) + { + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.DIAMOND_SWORD, 4, Enchantment.DAMAGE_ALL)); + + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_HELMET, 2, Enchantment.PROTECTION_ENVIRONMENTAL)); + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_CHESTPLATE, 2, Enchantment.PROTECTION_ENVIRONMENTAL)); + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_LEGGINGS, 2, Enchantment.PROTECTION_ENVIRONMENTAL)); + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_BOOTS, 2, Enchantment.PROTECTION_ENVIRONMENTAL)); + + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.BOW, 2, Enchantment.ARROW_DAMAGE)); + player.getInventory().addItem(new ItemStack(Material.ARROW, 64)); + + player.getInventory().addItem(new ItemStack(Material.GOLDEN_APPLE, 5)); + player.getInventory().addItem(new ItemStack(Material.FISHING_ROD)); + player.getInventory().addItem(new ItemStack(Material.COOKED_BEEF, 32)); + + + player.getInventory().addItem(new ItemStack(Material.IRON_PICKAXE)); + player.getInventory().addItem(new ItemStack(Material.COBBLESTONE, 32)); + } + } + } + + @Override + protected void ParseChests() + { + for (Location loc : WorldData.GetCustomLocs("54")) + { + if (loc.getBlock().getType() != Material.CHEST) + loc.getBlock().setType(Material.CHEST); + + Chest chest = (Chest) loc.getBlock().getState(); + + chest.getBlockInventory().clear(); + + int count = 22 + UtilMath.r(4); + for (int i = 0; i < count; i++) + { + chest.getBlockInventory().addItem(GetChestItem()); + } + } + } + + @Override + protected ItemStack GetChestItem() + { + if (getChestLoot().isEmpty()) + { + for (int i = 0; i < 2; i++) + getChestLoot().add(new ItemStack(Material.DIAMOND_HELMET)); + for (int i = 0; i < 2; i++) + getChestLoot().add(new ItemStack(Material.DIAMOND_CHESTPLATE)); + for (int i = 0; i < 2; i++) + getChestLoot().add(new ItemStack(Material.DIAMOND_LEGGINGS)); + for (int i = 0; i < 2; i++) + getChestLoot().add(new ItemStack(Material.DIAMOND_BOOTS)); + for (int i = 0; i < 2; i++) + getChestLoot().add(new ItemStack(Material.DIAMOND_SWORD)); + for (int i = 0; i < 2; i++) + getChestLoot().add(new ItemStack(Material.DIAMOND_AXE)); + for (int i = 0; i < 2; i++) + getChestLoot().add(new ItemStack(Material.DIAMOND_PICKAXE)); + + for (int i = 0; i < 13; i++) + { + getChestLoot().add(new ItemStack(Material.GOLDEN_APPLE)); + getChestLoot().add(new ItemStack(Material.ANVIL)); + } + + for (int i = 0; i < 5; i++) + { + Potion potionHealth = new Potion(PotionType.INSTANT_HEAL); + potionHealth.setLevel(2); + potionHealth.setSplash(true); + getChestLoot().add(potionHealth.toItemStack(1)); + + Potion potionDamage = new Potion(PotionType.INSTANT_DAMAGE); + potionDamage.setLevel(2); + potionDamage.setSplash(true); + getChestLoot().add(potionDamage.toItemStack(1)); + + Potion potionStrenght = new Potion(PotionType.STRENGTH); + potionStrenght.setLevel(1); + potionStrenght.setSplash(true); + getChestLoot().add(potionStrenght.toItemStack(1)); + } + + for (int i = 0; i < 5; i++) + { + + ItemStack sharpness = new ItemStack(Material.ENCHANTED_BOOK); + EnchantmentStorageMeta sharpnessMeta = (EnchantmentStorageMeta) sharpness + .getItemMeta(); + sharpnessMeta.addStoredEnchant(Enchantment.DAMAGE_ALL, 1 + UtilMath.r(5), true); + sharpness.setItemMeta(sharpnessMeta); + getChestLoot().add(sharpness); + + ItemStack protection = new ItemStack(Material.ENCHANTED_BOOK); + EnchantmentStorageMeta protectionMeta = (EnchantmentStorageMeta) protection + .getItemMeta(); + protectionMeta.addStoredEnchant(Enchantment.PROTECTION_ENVIRONMENTAL, + 1 + UtilMath.r(4), true); + protection.setItemMeta(protectionMeta); + getChestLoot().add(protection); + + ItemStack power = new ItemStack(Material.ENCHANTED_BOOK); + EnchantmentStorageMeta powerMeta = (EnchantmentStorageMeta) power.getItemMeta(); + powerMeta.addStoredEnchant(Enchantment.ARROW_DAMAGE, 1 + UtilMath.r(5), true); + power.setItemMeta(powerMeta); + getChestLoot().add(power); + } + + for (int i = 0; i < 10; i++) + getChestLoot().add(new ItemStack(Material.EXP_BOTTLE, 10)); + + for (int i = 0; i < 6; i++) + getChestLoot().add(new ItemStack(Material.BOW)); + for (int i = 0; i < 8; i++) + getChestLoot().add(new ItemStack(Material.ARROW, 8)); + + for (int i = 0; i < 12; i++) + getChestLoot().add(new ItemStack(Material.MUSHROOM_SOUP)); + for (int i = 0; i < 12; i++) + getChestLoot().add(new ItemStack(Material.COOKED_CHICKEN, 2)); + } + + ItemStack stack = getChestLoot().get(UtilMath.r(getChestLoot().size())); + + int amount = 1; + + if (stack.getType().getMaxStackSize() > 1) + amount = stack.getAmount() + UtilMath.r(stack.getAmount()); + + ItemStack item = stack.clone(); + item.setAmount(amount); + + return item; + } + + @Override + public String GetMode() + { + return "Insane Bridges"; + } + +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/modes/SpeedBridges.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/modes/SpeedBridges.java index 7e826c85a..18906b3c0 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/modes/SpeedBridges.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/modes/SpeedBridges.java @@ -5,6 +5,8 @@ import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.inventory.ItemStack; +import mineplex.minecraft.game.core.condition.ConditionManager; + import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.GameType; import nautilus.game.arcade.events.GameStateChangeEvent; @@ -24,7 +26,7 @@ public class SpeedBridges extends Bridge { super(manager, GameType.Brawl); - _untilBridges = 20000; + _untilBridges = 10000; } @EventHandler @@ -36,11 +38,15 @@ public class SpeedBridges extends Bridge for (Player player : GetPlayers(true)) { - player.getInventory().addItem(new ItemStack(Material.WOOD_SWORD)); - player.getInventory().addItem(new ItemStack(Material.LEATHER_HELMET)); - player.getInventory().addItem(new ItemStack(Material.LEATHER_CHESTPLATE)); - player.getInventory().addItem(new ItemStack(Material.LEATHER_LEGGINGS)); - player.getInventory().addItem(new ItemStack(Material.LEATHER_BOOTS)); + player.getInventory().addItem(new ItemStack(Material.IRON_SWORD)); + player.getInventory().addItem(new ItemStack(Material.IRON_HELMET)); + player.getInventory().addItem(new ItemStack(Material.IRON_CHESTPLATE)); + player.getInventory().addItem(new ItemStack(Material.IRON_LEGGINGS)); + player.getInventory().addItem(new ItemStack(Material.IRON_BOOTS)); + + player.getInventory().addItem(new ItemStack(Material.COOKED_BEEF, 10)); + + Manager.GetCondition().Factory().Speed("Game", player, player, GameTimeout, 2, true, true, true); } } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/modes/UHCBridges.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/modes/UHCBridges.java new file mode 100644 index 000000000..076133a39 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/modes/UHCBridges.java @@ -0,0 +1,146 @@ +package nautilus.game.arcade.game.games.bridge.modes; + +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.block.BlockPlaceEvent; +import org.bukkit.event.entity.EntityDeathEvent; +import org.bukkit.event.entity.EntityRegainHealthEvent; +import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason; +import org.bukkit.event.inventory.PrepareItemCraftEvent; +import org.bukkit.event.player.PlayerPickupItemEvent; +import org.bukkit.inventory.CraftingInventory; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.ShapedRecipe; +import org.bukkit.material.MaterialData; +import org.bukkit.scoreboard.DisplaySlot; +import org.bukkit.scoreboard.Objective; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; + +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.GameType; +import nautilus.game.arcade.events.GameStateChangeEvent; +import nautilus.game.arcade.game.games.AbsorptionFix; +import nautilus.game.arcade.game.games.bridge.Bridge; + +/** + * UHCBridges is a mode of {@link Bridge} which is a UHC like gamemode + * + * @author xXVevzZXx + */ +public class UHCBridges extends Bridge +{ + + public UHCBridges(ArcadeManager manager) + { + super(manager, GameType.Brawl); + + SoupEnabled = false; + + new AbsorptionFix(this); + + ShapedRecipe headApple = new ShapedRecipe(new ItemStack(Material.GOLDEN_APPLE, 1)); + headApple.shape("GGG", "GHG", "GGG"); + headApple.setIngredient('G', Material.GOLD_INGOT); + headApple.setIngredient('H', new MaterialData(Material.SKULL_ITEM, (byte) 3)); + UtilServer.getServer().addRecipe(headApple); + } + + @EventHandler + public void registerObj(GameStateChangeEvent event) + { + if (event.GetState() != GameState.Prepare) + return; + + Objective objective = Scoreboard.getScoreboard().registerNewObjective("Health", "health"); + objective.setDisplaySlot(DisplaySlot.PLAYER_LIST); + } + + @EventHandler + public void regenHealth(EntityRegainHealthEvent event) + { + if (event.getRegainReason() == RegainReason.SATIATED) + event.setCancelled(true); + } + + @EventHandler + public void gappleDrop(EntityDeathEvent event) + { + if (event.getEntity() instanceof Player) + { + event.getDrops().add(new ItemStack(Material.GOLDEN_APPLE, 1)); + } + } + + @EventHandler + public void giveItems(GameStateChangeEvent event) + { + if (event.GetState() == GameState.Live) + { + for (Player player : GetPlayers(true)) + { + player.getInventory().addItem(new ItemStack(Material.GOLDEN_APPLE, 3)); + } + } + } + + @EventHandler + public void headPlaceCancel(BlockPlaceEvent event) + { + if (event.getItemInHand().getType() == Material.SKULL || event.getItemInHand().getType() == Material.SKULL_ITEM) + event.setCancelled(true); + } + + @EventHandler(priority = EventPriority.MONITOR) + public void headPickup(PlayerPickupItemEvent event) + { + if (!IsLive()) + return; + + if (event.isCancelled()) + return; + + if (event.getItem().getItemStack().getType() == Material.SKULL_ITEM) + { + UtilPlayer.message(event.getPlayer(), " "); + UtilPlayer.message(event.getPlayer(), C.cGreen + C.Bold + "You picked up a Player Head!"); + UtilPlayer.message(event.getPlayer(), C.cWhite + "Use the recipe for Golden Apple, but Head replaces Apple."); + UtilPlayer.message(event.getPlayer(), " "); + } + } + + @EventHandler(priority = EventPriority.HIGH) + public void craftGoldenAppleDeny(PrepareItemCraftEvent event) + { + if (event.getRecipe().getResult() == null) + return; + + Material type = event.getRecipe().getResult().getType(); + + if (type != Material.GOLDEN_APPLE) + return; + + if (!(event.getInventory() instanceof CraftingInventory)) + return; + + CraftingInventory inv = (CraftingInventory) event.getInventory(); + + for (ItemStack item : inv.getMatrix()) + if (item != null && item.getType() != Material.AIR) + if (item.getType() == Material.GOLD_INGOT) + return; + + inv.setResult(null); + } + + @Override + public String GetMode() + { + return "UHC Bridges"; + } + +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/modes/kits/KitBrawlAppler.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/modes/kits/KitBrawlAppler.java new file mode 100644 index 000000000..88443d4fe --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/modes/kits/KitBrawlAppler.java @@ -0,0 +1,46 @@ +package nautilus.game.arcade.game.games.bridge.modes.kits; + +import org.bukkit.Material; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; + +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.game.games.bridge.kits.KitApple; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.ProgressingKit; +import nautilus.game.arcade.kit.perks.PerkApple; + +/** + * KitBrawlAppler is a variation of the Kit [{@link KitApple} which has a shorter delay of spawning apples + * + * @author xXVevzZXx + */ +public class KitBrawlAppler extends ProgressingKit +{ + private static final String[] DESCRIPTION = + { + "Possess the rare skill of finding apples frequently!", + "", + receiveItem("apple", 1, 3, 0), click(true, "the apple to throw it") + }; + + private static final Perk[] PERKS = + { + new PerkApple(3000) + }; + + private static final ItemStack IN_HAND = new ItemStack(Material.APPLE); + + public KitBrawlAppler(ArcadeManager manager) + { + super(manager, "Apple", "bridgeapple", KitAvailability.Free, DESCRIPTION, PERKS, EntityType.ZOMBIE, IN_HAND); + } + + @Override + public void GiveItems(Player player) + { + + } +} 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 4ef07344b..e9a7cec4a 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 @@ -130,7 +130,7 @@ public class Build extends Game protected String[] _christmasWords; protected String[] _halloweenWords; protected boolean _useChristmasWords = false; - protected boolean _useHalloweenWords = true; + protected boolean _useHalloweenWords = false; protected String _word = "?"; 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 3171f1920..0033b5a6d 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 @@ -8,7 +8,6 @@ import java.util.HashSet; import java.util.Iterator; import java.util.List; -import mineplex.core.common.Pair; import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.GameMode; @@ -27,6 +26,7 @@ import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerMoveEvent; import org.bukkit.event.player.PlayerQuitEvent; +import mineplex.core.common.Pair; import mineplex.core.common.util.C; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilAlg; @@ -44,6 +44,7 @@ import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; + import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.GameType; import nautilus.game.arcade.events.GameStateChangeEvent; @@ -94,7 +95,7 @@ public class Draw extends SoloGame private String[] _christmasWords; private String[] _halloweenWords; private boolean _useChristmasWords = false; - private boolean _useHalloweenWords = true; + private boolean _useHalloweenWords = false; private HashSet _usedWords = new HashSet(); public Draw(ArcadeManager manager) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/HideSeek.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/HideSeek.java index b8161cbb7..0eea12d3a 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/HideSeek.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/HideSeek.java @@ -17,6 +17,7 @@ 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.itemstack.ItemStackFactory; import mineplex.core.packethandler.IPacketHandler; import mineplex.core.packethandler.PacketInfo; @@ -111,100 +112,100 @@ import java.util.Map.Entry; @SuppressWarnings("deprecation") public class HideSeek extends TeamGame { - public static class MeowEvent extends PlayerEvent - { - private static final HandlerList handlers = new HandlerList(); + public static class MeowEvent extends PlayerEvent + { + private static final HandlerList handlers = new HandlerList(); - public static HandlerList getHandlerList() - { - return handlers; - } + public static HandlerList getHandlerList() + { + return handlers; + } - @Override - public HandlerList getHandlers() - { - return getHandlerList(); - } + @Override + public HandlerList getHandlers() + { + return getHandlerList(); + } - public MeowEvent(Player who) - { - super(who); - } - } + public MeowEvent(Player who) + { + super(who); + } + } - public static class PlayerChangeFormEvent extends PlayerEvent - { - private static final HandlerList handlers = new HandlerList(); + public static class PlayerChangeFormEvent extends PlayerEvent + { + private static final HandlerList handlers = new HandlerList(); - public static HandlerList getHandlerList() - { - return handlers; - } + public static HandlerList getHandlerList() + { + return handlers; + } - @Override - public HandlerList getHandlers() - { - return getHandlerList(); - } + @Override + public HandlerList getHandlers() + { + return getHandlerList(); + } - private final Form _form; + private final Form _form; - public PlayerChangeFormEvent(Player who, Form form) - { - super(who); + public PlayerChangeFormEvent(Player who, Form form) + { + super(who); - _form = form; - } + _form = form; + } - public Form getForm() - { - return _form; - } - } + public Form getForm() + { + return _form; + } + } - public static class PlayerSolidifyEvent extends PlayerEvent - { - private static final HandlerList handlers = new HandlerList(); + public static class PlayerSolidifyEvent extends PlayerEvent + { + private static final HandlerList handlers = new HandlerList(); - public static HandlerList getHandlerList() - { - return handlers; - } + public static HandlerList getHandlerList() + { + return handlers; + } - @Override - public HandlerList getHandlers() - { - return getHandlerList(); - } + @Override + public HandlerList getHandlers() + { + return getHandlerList(); + } - public PlayerSolidifyEvent(Player who) - { - super(who); - } - } + public PlayerSolidifyEvent(Player who) + { + super(who); + } + } - private GameTeam _hiders; - private GameTeam _seekers; + private GameTeam _hiders; + private GameTeam _seekers; - private long _hideTime = 20000; - private long _gameTime = 360000; - - private boolean _bowGiven = false; - private long _bowGiveTime = 0; - - private boolean _started = false; + private long _hideTime = 20000; + private long _gameTime = 360000; - private HashMap _arrowHits = new HashMap(); + private boolean _bowGiven = false; + private long _bowGiveTime = 0; - private HashMap _forms = new HashMap(); - private HashMap _infested = new HashMap(); - private HashSet _infestDeny = new HashSet(); + private boolean _started = false; - private HashMap _mobs = new HashMap(); + private HashMap _arrowHits = new HashMap(); + + private HashMap _forms = new HashMap(); + private HashMap _infested = new HashMap(); + private HashSet _infestDeny = new HashSet(); + + private HashMap _mobs = new HashMap(); + + private ArrayList _allowedBlocks; + private ArrayList _allowedEnts; - private ArrayList _allowedBlocks; - private ArrayList _allowedEnts; - private IPacketHandler _useEntity = new IPacketHandler() { @Override @@ -264,8 +265,7 @@ public class HideSeek extends TeamGame break; } - } - else if (packetInfo.getPacket() instanceof PacketPlayOutEntityDestroy) + } else if (packetInfo.getPacket() instanceof PacketPlayOutEntityDestroy) { for (int i : ((PacketPlayOutEntityDestroy) packetInfo.getPacket()).a) { @@ -280,9 +280,9 @@ public class HideSeek extends TeamGame continue; UtilPlayer.sendPacket(packetInfo.getPlayer(), new PacketPlayOutEntityDestroy(new int[] - { - blockForm.getBlockId() - })); + { + blockForm.getBlockId() + })); } } } @@ -290,1394 +290,1389 @@ public class HideSeek extends TeamGame }; public HideSeek(ArcadeManager manager) - { - this(manager, - new Kit[] - { - new KitHiderQuick(manager), new KitHiderSwapper(manager), new KitHiderInfestor(manager), - new KitHiderShocker(manager), new NullKit(manager), new KitSeekerLeaper(manager), - new KitSeekerTNT(manager), new KitSeekerRadar(manager), - }); - } - - public HideSeek(ArcadeManager manager, Kit[] kits) - { - super(manager, GameType.HideSeek, kits, + { + this(manager, + new Kit[] + { + new KitHiderQuick(manager), new KitHiderSwapper(manager), new KitHiderInfestor(manager), + new KitHiderShocker(manager), new NullKit(manager), new KitSeekerLeaper(manager), + new KitSeekerTNT(manager), new KitSeekerRadar(manager), + }); + } - new String[] - { - C.cAqua + "Hiders" + C.cWhite + " Run and Hide from Seekers", - C.cAqua + "Hiders" + C.cWhite + " Disguise as Blocks or Animals", - C.cAqua + "Hiders" + C.cWhite + " Shoot Seekers for Axe Upgrades", - C.cAqua + "Hiders" + C.cWhite + " Right-Click with Axe for Speed Boost", - C.cRed + "Seekers" + C.cWhite + " Find and kill the Hiders!", - }); + public HideSeek(ArcadeManager manager, Kit[] kits) + { + super(manager, GameType.HideSeek, kits, - this.DamageSelf = false; - this.DeathOut = false; - this.HungerSet = 20; - this.PrepareFreeze = false; + new String[] + { + C.cAqua + "Hiders" + C.cWhite + " Run and Hide from Seekers", + C.cAqua + "Hiders" + C.cWhite + " Disguise as Blocks or Animals", + C.cAqua + "Hiders" + C.cWhite + " Shoot Seekers for Axe Upgrades", + C.cAqua + "Hiders" + C.cWhite + " Right-Click with Axe for Speed Boost", + C.cRed + "Seekers" + C.cWhite + " Find and kill the Hiders!", + }); - _allowedBlocks = new ArrayList(); - _allowedBlocks.add(Material.TNT); - _allowedBlocks.add(Material.BOOKSHELF); - _allowedBlocks.add(Material.WORKBENCH); - _allowedBlocks.add(Material.FURNACE); - _allowedBlocks.add(Material.MELON_BLOCK); - _allowedBlocks.add(Material.CAULDRON); - _allowedBlocks.add(Material.FLOWER_POT); - _allowedBlocks.add(Material.ANVIL); - _allowedBlocks.add(Material.HAY_BLOCK); - _allowedBlocks.add(Material.CAKE_BLOCK); + this.DamageSelf = false; + this.DeathOut = false; + this.HungerSet = 20; + this.PrepareFreeze = false; - _allowedEnts = new ArrayList(); - _allowedEnts.add(EntityType.PIG); - _allowedEnts.add(EntityType.COW); - _allowedEnts.add(EntityType.CHICKEN); - _allowedEnts.add(EntityType.SHEEP); + _allowedBlocks = new ArrayList(); + _allowedBlocks.add(Material.TNT); + _allowedBlocks.add(Material.BOOKSHELF); + _allowedBlocks.add(Material.WORKBENCH); + _allowedBlocks.add(Material.FURNACE); + _allowedBlocks.add(Material.MELON_BLOCK); + _allowedBlocks.add(Material.CAULDRON); + _allowedBlocks.add(Material.FLOWER_POT); + _allowedBlocks.add(Material.ANVIL); + _allowedBlocks.add(Material.HAY_BLOCK); + _allowedBlocks.add(Material.CAKE_BLOCK); - Manager.GetExplosion().SetRegenerate(true); - Manager.GetExplosion().SetTNTSpread(false); - Manager.getCosmeticManager().setHideParticles(true); + _allowedEnts = new ArrayList(); + _allowedEnts.add(EntityType.PIG); + _allowedEnts.add(EntityType.COW); + _allowedEnts.add(EntityType.CHICKEN); + _allowedEnts.add(EntityType.SHEEP); - registerStatTrackers( + Manager.GetExplosion().SetRegenerate(true); + Manager.GetExplosion().SetTNTSpread(false); + Manager.getCosmeticManager().setHideParticles(true); + + registerStatTrackers( new HunterKillerStatTracker(this), new MeowStatTracker(this), new HunterKillerStatTracker(this), - new HunterOfTheYearStatTracker(this), + new HunterOfTheYearStatTracker(this), new BadHiderStatTracker(this) ); //Need ideas for this one registerChatStats(); - } - - @EventHandler - public void onGameEndStart(GameStateChangeEvent event) - { - if (event.GetState() == GameState.Prepare) - { - System.out.println("prep"); - this.getArcadeManager().getPacketHandler().addPacketHandler(_blockDisguise, PacketPlayOutSpawnEntityLiving.class, PacketPlayOutEntityDestroy.class); - this.getArcadeManager().getPacketHandler().addPacketHandler(_useEntity, true, PacketPlayInUseEntity.class); - } - else if (event.GetState() == GameState.Dead) - { - this.getArcadeManager().getPacketHandler().removePacketHandler(_blockDisguise); - this.getArcadeManager().getPacketHandler().removePacketHandler(_useEntity); - } - } - - public Material GetItemEquivilent(Material mat) - { - if (mat == Material.CAULDRON) - return Material.CAULDRON_ITEM; - if (mat == Material.FLOWER_POT) - return Material.FLOWER_POT_ITEM; - if (mat == Material.CAKE_BLOCK) - return Material.CAKE; - - return mat; - } - - @Override - public void ParseData() - { - int i = 0; - - for (ArrayList locs : WorldData.GetAllCustomLocs().values()) - { - for (Location loc : locs) - { - if (Math.random() > 0.25) - continue; - - if (loc.getBlock().getRelative(BlockFace.UP).getType() != Material.AIR) - continue; - - loc.getBlock().setType(Material.AIR); - i++; - } - } - - System.out.println("Removed " + i + " Random Blocks."); - - for (Location loc : WorldData.GetDataLocs("BLACK")) - loc.getBlock().setType(Material.FENCE); - - } - - @EventHandler - public void CustomTeamGeneration(GameStateChangeEvent event) - { - if (event.GetState() != GameState.Recruit) - return; - - _hiders = GetTeamList().stream().filter(team -> team.GetName().toUpperCase().contains("BLUE")).toArray(size -> new GameTeam[size])[0]; - _hiders.SetColor(ChatColor.AQUA); - _hiders.SetName("Hiders"); - - _seekers = GetTeamList().stream().filter(team -> team.GetName().toUpperCase().contains("RED")).toArray(size -> new GameTeam[size])[0]; - _seekers.SetColor(ChatColor.RED); - _seekers.SetName("Hunters"); - - RestrictKits(); - } - - @Override - public void RestrictKits() - { - for (Kit kit : GetKits()) - { - for (GameTeam team : GetTeamList()) - { - if (team.GetColor() == ChatColor.RED) - { - if (kit.GetName().contains("Hider")) - team.GetRestrictedKits().add(kit); - } - else - { - if (kit.GetName().contains("Hunter")) - team.GetRestrictedKits().add(kit); - } - } - } - } - - @EventHandler - public void MoveKits(GameStateChangeEvent event) - { - if (event.GetState() != GameState.Prepare) - return; - - for (int i = 0; i < WorldData.GetDataLocs("RED").size() && i < 3; i++) - { - if (GetKits().length <= 5 + i) - continue; - - this.CreatureAllowOverride = true; - Entity ent = GetKits()[5 + i].SpawnEntity(WorldData.GetDataLocs("RED").get(i)); - this.CreatureAllowOverride = false; - - Manager.GetLobby().addKitLocation(ent, GetKits()[5 + i], WorldData.GetDataLocs("RED").get(i)); - } - } - - public void GiveItems(boolean bowOnly) - { - for (Player player : _hiders.GetPlayers(true)) - { - if (bowOnly) - { - // Bow - ItemStack bow = ItemStackFactory.Instance.CreateStack(Material.BOW, (byte) 0, 1, C.cYellow + C.Bold + "Shoot Hunters" - + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Upgrades Axe"); - bow.addEnchantment(Enchantment.ARROW_INFINITE, 1); - player.getInventory().setItem(1, bow); - player.getInventory().setItem(28, ItemStackFactory.Instance.CreateStack(Material.ARROW)); - } - else - { - // Axe - player.getInventory().setItem(0, - ItemStackFactory.Instance.CreateStack(Material.WOOD_AXE, (byte) 0, 1, C.cGreen + "Speed Axe")); - - // Meower - player.getInventory().setItem( - 4, - ItemStackFactory.Instance.CreateStack(Material.SUGAR, (byte) 0, 1, C.cYellow + C.Bold + "Meow" + C.cWhite - + C.Bold + " - " + C.cGreen + C.Bold + "+0.25 Gems")); - - // Firework - ItemStack firework = ItemStackFactory.Instance.CreateStack(Material.FIREWORK, (byte) 0, 5, C.cYellow + C.Bold - + "Firework" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "+2 Gems"); - FireworkMeta metaData = (FireworkMeta) firework.getItemMeta(); - metaData.setPower(1); - metaData.addEffect(FireworkEffect.builder().flicker(true).withColor(Color.AQUA).with(Type.BALL_LARGE).trail(true) - .build()); - firework.setItemMeta(metaData); - player.getInventory().setItem(5, firework); - - // Recharges - Recharge.Instance.useForce(player, "Meow", 15000); - Recharge.Instance.useForce(player, "Firework", 15000); - } - - player.playSound(player.getLocation(), Sound.HORSE_ARMOR, 1f, 1f); - } - } - - @EventHandler - public void InitialDisguise(PlayerPrepareTeleportEvent event) - { - if (_hiders.HasPlayer(event.GetPlayer().getName(), true)) - { - if (GetKit(event.GetPlayer()) instanceof KitHider) - { - Form form = new BlockForm(this, event.GetPlayer(), _allowedBlocks.get(UtilMath.r(_allowedBlocks.size()))); - - _forms.put(event.GetPlayer(), form); - - form.Apply(); - - Bukkit.getPluginManager().callEvent(new PlayerChangeFormEvent(event.GetPlayer(), form)); - } - } - } - - @EventHandler - public void ChangeDisguise(PlayerInteractEvent event) - { - if (event.getClickedBlock() == null) - return; - - Player player = event.getPlayer(); - - if (!UtilGear.isMat(player.getItemInHand(), Material.SLIME_BALL)) - return; - - if (!_allowedBlocks.contains(event.getClickedBlock().getType())) - { - UtilPlayer.message( - player, - F.main("Game", - "You cannot morph into " - + F.elem(ItemStackFactory.Instance - .GetName(event.getClickedBlock().getType(), (byte) 0, false) + " Block") + ".")); - return; - } - - if (!Recharge.Instance.use(player, "Change Form", 6000, true, false)) - return; - - if (!(GetKit(player) instanceof KitHiderSwapper)) - UtilInv.remove(player, Material.SLIME_BALL, (byte) 0, 1); - - // Remove Old - _forms.get(player).Remove(); - - Form form = new BlockForm(this, player, event.getClickedBlock().getType()); - - // Set New - _forms.put(player, form); - - form.Apply(); - - Bukkit.getPluginManager().callEvent(new PlayerChangeFormEvent(player, form)); - } - - @EventHandler - public void ChangeDisguise(PlayerInteractEntityEvent event) - { - if (event.getRightClicked() == null) - return; - - Player player = event.getPlayer(); - - if (!UtilGear.isMat(player.getItemInHand(), Material.SLIME_BALL)) - return; - - if (!_allowedEnts.contains(event.getRightClicked().getType())) - { - UtilPlayer.message(player, - F.main("Game", "You cannot morph into " + F.elem(UtilEnt.getName(event.getRightClicked())) + ".")); - return; - } - - if (!Recharge.Instance.use(player, "Change Form", 6000, true, false)) - return; - - if (!(GetKit(player) instanceof KitHiderSwapper)) - UtilInv.remove(player, Material.SLIME_BALL, (byte) 0, 1); - - // Remove Old - _forms.get(player).Remove(); - - Form form = new CreatureForm(this, player, event.getRightClicked().getType()); - - // Set New - _forms.put(player, form); - - Bukkit.getPluginManager().callEvent(new PlayerChangeFormEvent(player, form)); - } - - @EventHandler - public void ChangeDisguise(CustomDamageEvent event) - { - Player player = event.GetDamagerPlayer(false); - if (player == null) - return; - - if (!UtilGear.isMat(player.getItemInHand(), Material.SLIME_BALL)) - return; - - if (!_allowedEnts.contains(event.GetDamageeEntity().getType())) - { - UtilPlayer.message(player, - F.main("Game", "You cannot morph into " + F.elem(UtilEnt.getName(event.GetDamageeEntity())) + ".")); - return; - } - - if (!Recharge.Instance.use(player, "Change Form", 6000, true, false)) - return; - - if (!(GetKit(player) instanceof KitHiderSwapper)) - UtilInv.remove(player, Material.SLIME_BALL, (byte) 0, 1); - - // Remove Old - _forms.get(player).Remove(); - - Form form = new CreatureForm(this, player, event.GetDamageeEntity().getType()); - - // Set New - _forms.put(player, form); + } + + @EventHandler + public void onGameEndStart(GameStateChangeEvent event) + { + if (event.GetState() == GameState.Prepare) + { + System.out.println("prep"); + this.getArcadeManager().getPacketHandler().addPacketHandler(_blockDisguise, PacketPlayOutSpawnEntityLiving.class, PacketPlayOutEntityDestroy.class); + this.getArcadeManager().getPacketHandler().addPacketHandler(_useEntity, true, PacketPlayInUseEntity.class); + } else if (event.GetState() == GameState.Dead) + { + this.getArcadeManager().getPacketHandler().removePacketHandler(_blockDisguise); + this.getArcadeManager().getPacketHandler().removePacketHandler(_useEntity); + } + } + + public Material GetItemEquivilent(Material mat) + { + if (mat == Material.CAULDRON) + return Material.CAULDRON_ITEM; + if (mat == Material.FLOWER_POT) + return Material.FLOWER_POT_ITEM; + if (mat == Material.CAKE_BLOCK) + return Material.CAKE; + + return mat; + } + + @Override + public void ParseData() + { + int i = 0; + + for (ArrayList locs : WorldData.GetAllCustomLocs().values()) + { + for (Location loc : locs) + { + if (Math.random() > 0.25) + continue; + + if (loc.getBlock().getRelative(BlockFace.UP).getType() != Material.AIR) + continue; + + loc.getBlock().setType(Material.AIR); + i++; + } + } + + System.out.println("Removed " + i + " Random Blocks."); + + for (Location loc : WorldData.GetDataLocs("BLACK")) + loc.getBlock().setType(Material.FENCE); + + } + + @EventHandler + public void CustomTeamGeneration(GameStateChangeEvent event) + { + if (event.GetState() != GameState.Recruit) + return; + + _hiders = GetTeamList().stream().filter(team -> team.GetName().toUpperCase().contains("BLUE")).toArray(size -> new GameTeam[size])[0]; + _hiders.SetColor(ChatColor.AQUA); + _hiders.SetName("Hiders"); + + _seekers = GetTeamList().stream().filter(team -> team.GetName().toUpperCase().contains("RED")).toArray(size -> new GameTeam[size])[0]; + _seekers.SetColor(ChatColor.RED); + _seekers.SetName("Hunters"); + + RestrictKits(); + } + + @Override + public void RestrictKits() + { + for (Kit kit : GetKits()) + { + for (GameTeam team : GetTeamList()) + { + if (team.GetColor() == ChatColor.RED) + { + if (kit.GetName().contains("Hider")) + team.GetRestrictedKits().add(kit); + } else + { + if (kit.GetName().contains("Hunter")) + team.GetRestrictedKits().add(kit); + } + } + } + } + + @EventHandler + public void MoveKits(GameStateChangeEvent event) + { + if (event.GetState() != GameState.Prepare) + return; + + for (int i = 0; i < WorldData.GetDataLocs("RED").size() && i < 3; i++) + { + if (GetKits().length <= 5 + i) + continue; + + this.CreatureAllowOverride = true; + Entity ent = GetKits()[5 + i].SpawnEntity(WorldData.GetDataLocs("RED").get(i)); + this.CreatureAllowOverride = false; + + Manager.GetLobby().addKitLocation(ent, GetKits()[5 + i], WorldData.GetDataLocs("RED").get(i)); + } + } + + public void GiveItems(boolean bowOnly) + { + for (Player player : _hiders.GetPlayers(true)) + { + if (bowOnly) + { + // Bow + ItemStack bow = ItemStackFactory.Instance.CreateStack(Material.BOW, (byte) 0, 1, C.cYellow + C.Bold + "Shoot Hunters" + + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Upgrades Axe"); + bow.addEnchantment(Enchantment.ARROW_INFINITE, 1); + player.getInventory().setItem(1, bow); + player.getInventory().setItem(28, ItemStackFactory.Instance.CreateStack(Material.ARROW)); + } else + { + // Axe + player.getInventory().setItem(0, + ItemStackFactory.Instance.CreateStack(Material.WOOD_AXE, (byte) 0, 1, C.cGreen + "Speed Axe")); + + // Meower + player.getInventory().setItem( + 4, + ItemStackFactory.Instance.CreateStack(Material.SUGAR, (byte) 0, 1, C.cYellow + C.Bold + "Meow" + C.cWhite + + C.Bold + " - " + C.cGreen + C.Bold + "+0.25 Gems")); + + // Firework + ItemStack firework = ItemStackFactory.Instance.CreateStack(Material.FIREWORK, (byte) 0, 5, C.cYellow + C.Bold + + "Firework" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "+2 Gems"); + FireworkMeta metaData = (FireworkMeta) firework.getItemMeta(); + metaData.setPower(1); + metaData.addEffect(FireworkEffect.builder().flicker(true).withColor(Color.AQUA).with(Type.BALL_LARGE).trail(true) + .build()); + firework.setItemMeta(metaData); + player.getInventory().setItem(5, firework); + + // Recharges + Recharge.Instance.useForce(player, "Meow", 15000); + Recharge.Instance.useForce(player, "Firework", 15000); + } + + player.playSound(player.getLocation(), Sound.HORSE_ARMOR, 1f, 1f); + } + } + + @EventHandler + public void InitialDisguise(PlayerPrepareTeleportEvent event) + { + if (_hiders.HasPlayer(event.GetPlayer().getName(), true)) + { + Kit kit = GetKit(event.GetPlayer()); + if (kit instanceof KitHider && !(kit instanceof KitHiderInfestor)) + { + Form form = new BlockForm(this, event.GetPlayer(), _allowedBlocks.get(UtilMath.r(_allowedBlocks.size()))); + + _forms.put(event.GetPlayer(), form); + + form.Apply(); + + Bukkit.getPluginManager().callEvent(new PlayerChangeFormEvent(event.GetPlayer(), form)); + } + } + } + + @EventHandler + public void ChangeDisguise(PlayerInteractEvent event) + { + if (event.getClickedBlock() == null) + return; + + Player player = event.getPlayer(); + + if (!UtilGear.isMat(player.getItemInHand(), Material.SLIME_BALL)) + return; + + if (!_allowedBlocks.contains(event.getClickedBlock().getType())) + { + UtilPlayer.message( + player, + F.main("Game", + "You cannot morph into " + + F.elem(ItemStackFactory.Instance + .GetName(event.getClickedBlock().getType(), (byte) 0, false) + " Block") + ".")); + return; + } + + if (!Recharge.Instance.use(player, "Change Form", 6000, true, false)) + return; + + if (!(GetKit(player) instanceof KitHiderSwapper)) + UtilInv.remove(player, Material.SLIME_BALL, (byte) 0, 1); + + // Remove Old + _forms.get(player).Remove(); + + Form form = new BlockForm(this, player, event.getClickedBlock().getType()); + + // Set New + _forms.put(player, form); + + form.Apply(); + + Bukkit.getPluginManager().callEvent(new PlayerChangeFormEvent(player, form)); + } + + @EventHandler + public void ChangeDisguise(PlayerInteractEntityEvent event) + { + if (event.getRightClicked() == null) + return; + + Player player = event.getPlayer(); + + if (!UtilGear.isMat(player.getItemInHand(), Material.SLIME_BALL)) + return; + + if (!_allowedEnts.contains(event.getRightClicked().getType())) + { + UtilPlayer.message(player, + F.main("Game", "You cannot morph into " + F.elem(UtilEnt.getName(event.getRightClicked())) + ".")); + return; + } + + if (!Recharge.Instance.use(player, "Change Form", 6000, true, false)) + return; + + if (!(GetKit(player) instanceof KitHiderSwapper)) + UtilInv.remove(player, Material.SLIME_BALL, (byte) 0, 1); + + // Remove Old + _forms.get(player).Remove(); + + Form form = new CreatureForm(this, player, event.getRightClicked().getType()); + + // Set New + _forms.put(player, form); + + Bukkit.getPluginManager().callEvent(new PlayerChangeFormEvent(player, form)); + } + + @EventHandler + public void ChangeDisguise(CustomDamageEvent event) + { + Player player = event.GetDamagerPlayer(false); + if (player == null) + return; + + if (!UtilGear.isMat(player.getItemInHand(), Material.SLIME_BALL)) + return; - Bukkit.getPluginManager().callEvent(new PlayerChangeFormEvent(player, form)); - } + if (!_allowedEnts.contains(event.GetDamageeEntity().getType())) + { + UtilPlayer.message(player, + F.main("Game", "You cannot morph into " + F.elem(UtilEnt.getName(event.GetDamageeEntity())) + ".")); + return; + } - @EventHandler - public void FallingBlockBreak(ItemSpawnEvent event) - { - if (event.getEntity().getItemStack().getType() == Material.getMaterial(175) || (Manager.IsHolidayEnabled && (event.getEntity().getItemStack().getType() == Material.PRISMARINE_SHARD || event.getEntity().getItemStack().getType() == Material.EMERALD))) - return; - - event.setCancelled(true); + if (!Recharge.Instance.use(player, "Change Form", 6000, true, false)) + return; + + if (!(GetKit(player) instanceof KitHiderSwapper)) + UtilInv.remove(player, Material.SLIME_BALL, (byte) 0, 1); - for (Form form : _forms.values()) - if (form instanceof BlockForm) - ((BlockForm) form).FallingBlockCheck(); - } + // Remove Old + _forms.get(player).Remove(); - @EventHandler - public void FallingBlockLand(EntityChangeBlockEvent event) - { - if (event.getEntity() instanceof FallingBlock) - { - event.setCancelled(true); - event.getEntity().remove(); + Form form = new CreatureForm(this, player, event.GetDamageeEntity().getType()); - for (Form form : _forms.values()) - if (form instanceof BlockForm) - ((BlockForm) form).FallingBlockCheck(); - } - } - - @EventHandler - public void FallingBlockUpdate(UpdateEvent event) - { - if (event.getType() != UpdateType.TICK) - return; - - if (!InProgress()) - return; + // Set New + _forms.put(player, form); - for (Form form : _forms.values()) - if (form instanceof BlockForm) - ((BlockForm) form).FallingBlockCheck(); - } - - @EventHandler - public void SolidifyUpdate(UpdateEvent event) - { - if (!IsLive()) - return; - - if (event.getType() != UpdateType.TICK) - return; - - for (Form form : _forms.values()) - if (form instanceof BlockForm) - ((BlockForm) form).SolidifyUpdate(); - } - - @EventHandler - public void SolidBlockDamage(BlockDamageEvent event) - { - if (!_seekers.HasPlayer(event.getPlayer())) - return; - - for (Form form : _forms.values()) - { - if (!(form instanceof BlockForm)) - continue; - - if (((BlockForm) form).GetBlock() == null) - continue; - - if (!((BlockForm) form).GetBlock().equals(event.getBlock())) - continue; - - // Damage Event - Manager.GetDamage().NewDamageEvent(form.Player, event.getPlayer(), null, DamageCause.CUSTOM, 4, true, true, false, - event.getPlayer().getName(), null); - - ((BlockForm) form).SolidifyRemove(); - } - } - - @EventHandler - public void FallingBlockDamage(EntityDamageEvent event) - { - if (!(event instanceof EntityDamageByEntityEvent)) - return; - - if (!(event.getEntity() instanceof FallingSand)) - return; - - if (event.getEntity().getVehicle() == null) - return; - - if (!(event.getEntity().getVehicle() instanceof LivingEntity)) - return; - - LivingEntity damagee = (LivingEntity) event.getEntity().getVehicle(); - - EntityDamageByEntityEvent eventEE = (EntityDamageByEntityEvent) event; - - LivingEntity damager = null; - Projectile proj = null; - - if (eventEE.getDamager() instanceof Projectile) - { - proj = (Projectile) eventEE.getDamager(); - damager = (LivingEntity) proj.getShooter(); - } - else if (eventEE.getDamager() instanceof LivingEntity) - { - damager = (LivingEntity) eventEE.getDamager(); - } - - // Damage Event - Manager.GetDamage().NewDamageEvent(damagee, damager, proj, event.getCause(), event.getDamage(), true, false, false, null, - null); - - event.setCancelled(true); - } - - @EventHandler - public void AnimalSpawn(GameStateChangeEvent event) - { - if (event.GetState() != GameState.Prepare) - return; - - this.CreatureAllowOverride = true; + Bukkit.getPluginManager().callEvent(new PlayerChangeFormEvent(player, form)); + } - for (Location loc : WorldData.GetDataLocs("WHITE")) - _mobs.put(loc.getWorld().spawn(loc, Sheep.class), loc); + @EventHandler + public void FallingBlockBreak(ItemSpawnEvent event) + { + if (event.getEntity().getItemStack().getType() == Material.getMaterial(175) || (Manager.IsHolidayEnabled && (event.getEntity().getItemStack().getType() == Material.PRISMARINE_SHARD || event.getEntity().getItemStack().getType() == Material.EMERALD))) + return; - for (Location loc : WorldData.GetDataLocs("PINK")) - _mobs.put(loc.getWorld().spawn(loc, Pig.class), loc); + event.setCancelled(true); - for (Location loc : WorldData.GetDataLocs("YELLOW")) - _mobs.put(loc.getWorld().spawn(loc, Chicken.class), loc); + for (Form form : _forms.values()) + if (form instanceof BlockForm) + ((BlockForm) form).FallingBlockCheck(); + } - for (Location loc : WorldData.GetDataLocs("BROWN")) - _mobs.put(loc.getWorld().spawn(loc, Cow.class), loc); + @EventHandler + public void FallingBlockLand(EntityChangeBlockEvent event) + { + if (event.getEntity() instanceof FallingBlock) + { + event.setCancelled(true); + event.getEntity().remove(); - this.CreatureAllowOverride = false; - } - - @EventHandler(priority = EventPriority.LOW) - public void AnimalDamage(CustomDamageEvent event) - { - if (event.GetDamageePlayer() == null && !(event.GetDamageeEntity() instanceof Slime)) - event.SetCancelled("Animal Damage"); + for (Form form : _forms.values()) + if (form instanceof BlockForm) + ((BlockForm) form).FallingBlockCheck(); + } + } - if (event.GetDamagerEntity(false) != null && event.GetDamagerEntity(false) instanceof Slime) - event.SetCancelled("Slime Attack"); - } + @EventHandler + public void FallingBlockUpdate(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; - @EventHandler - public void AnimalReturn(UpdateEvent event) - { - if (event.getType() != UpdateType.SEC) - return; + if (!InProgress()) + return; - for (Creature ent : _mobs.keySet()) - { - if (UtilMath.offset(ent.getLocation(), _mobs.get(ent)) < 5) - continue; + for (Form form : _forms.values()) + if (form instanceof BlockForm) + ((BlockForm) form).FallingBlockCheck(); + } - Location loc = _mobs.get(ent).add( - UtilAlg.getTrajectory(_mobs.get(ent), ent.getLocation()).multiply(Math.random() * 3)); + @EventHandler + public void SolidifyUpdate(UpdateEvent event) + { + if (!IsLive()) + return; - EntityCreature ec = ((CraftCreature) ent).getHandle(); - NavigationAbstract nav = ec.getNavigation(); - nav.a(loc.getX(), loc.getY(), loc.getZ(), 1f); - } - } - - @EventHandler - public void AttackSeeker(CustomDamageEvent event) - { - if (event.GetDamagerPlayer(true) == null) - return; - - if (!_hiders.HasPlayer(event.GetDamagerPlayer(true))) - return; - - if (event.GetDamageInitial() > 1) - return; - - event.AddMod("H&S", "Negate", -event.GetDamageInitial(), false); - event.AddMod("H&S", "Attack", event.GetDamageInitial(), true); - } - - @EventHandler - public void ArrowShoot(EntityShootBowEvent event) - { - if (!(event.getEntity() instanceof Player)) - return; - - Player shooter = (Player) event.getEntity(); - - if (!_hiders.HasPlayer(shooter)) - return; - - Arrow arrow = shooter.getWorld().spawnArrow( - shooter.getEyeLocation().add(shooter.getLocation().getDirection().multiply(1.5)), - shooter.getLocation().getDirection(), (float) event.getProjectile().getVelocity().length(), 0f); - arrow.setShooter(shooter); - - event.setCancelled(true); - } - - @EventHandler - public void ArrowHit(CustomDamageEvent event) - { - if (event.IsCancelled()) - return; - - if (event.GetProjectile() == null) - return; - - Player damagee = event.GetDamageePlayer(); - if (damagee == null) - return; - - if (!_seekers.HasPlayer(damagee)) - return; - - Player damager = event.GetDamagerPlayer(true); - if (damager == null) - return; - - if (!_hiders.HasPlayer(damager)) - return; - - event.AddMod("Hide & Seek", "Negate", -event.GetDamageInitial(), false); - event.AddMod("Hide & Seek", "Damage Set", 2, false); - event.AddKnockback("Hide & Seek", 2); - - Powerup(damager); - } - - public void Powerup(Player player) - { - int count = 1; - if (_arrowHits.containsKey(player)) - count += _arrowHits.get(player); - - _arrowHits.put(player, count); - - if (count == 4) - { - player.getInventory().remove(Material.WOOD_AXE); - player.getInventory().addItem( - ItemStackFactory.Instance.CreateStack(Material.STONE_AXE, (byte) 0, 1, C.cGreen + "Super Axe")); - - // Sound - player.playSound(player.getLocation(), Sound.LEVEL_UP, 1f, 1f); - - // Inform - UtilPlayer.message(player, F.main("Game", "You upgraded to " + F.elem("Super Axe") + "!")); - } - else if (count == 8) - { - player.getInventory().remove(Material.STONE_AXE); - player.getInventory().addItem( - ItemStackFactory.Instance.CreateStack(Material.IRON_AXE, (byte) 0, 1, C.cGreen + "Ultra Axe")); - - // Sound - player.playSound(player.getLocation(), Sound.LEVEL_UP, 1f, 1f); - - // Inform - UtilPlayer.message(player, F.main("Game", "You upgraded to " + F.elem("Ultra Axe") + "!")); - } - else if (count == 12) - { - player.getInventory().remove(Material.IRON_AXE); - player.getInventory().addItem( - ItemStackFactory.Instance.CreateStack(Material.DIAMOND_AXE, (byte) 0, 1, C.cGreen + "Hyper Axe")); - - // Sound - player.playSound(player.getLocation(), Sound.LEVEL_UP, 1f, 1f); - - // Inform - UtilPlayer.message(player, F.main("Game", "You upgraded to " + F.elem("Hyper Axe") + "!")); - } - else if (count < 12) - { - // Sound - player.playSound(player.getLocation(), Sound.ORB_PICKUP, 1f, 1f); - } - } - - @EventHandler - public void UseBoost(PlayerInteractEvent event) - { - if (!IsLive()) - return; - - Player player = event.getPlayer(); - - if (!UtilEvent.isAction(event, ActionType.R)) - return; - - if (player.getItemInHand() == null) - return; - - if (!player.getItemInHand().getType().toString().contains("_AXE")) - return; - - if (!_hiders.HasPlayer(player)) - return; - - if (!Recharge.Instance.use(player, "Axe Boost", 16000, inform(), true)) - return; - - if (UtilGear.isMat(player.getItemInHand(), Material.WOOD_AXE)) - { - Manager.GetCondition().Factory().Speed("Boost", player, player, 4, 0, false, false, false); - - // Inform - UtilPlayer.message(player, F.main("Game", "You used " + F.elem("Basic Boost") + "!")); - - // Sound - player.getWorld().playSound(player.getLocation(), Sound.BLAZE_BREATH, 1f, 1f); - } - else if (UtilGear.isMat(player.getItemInHand(), Material.STONE_AXE)) - { - Manager.GetCondition().Factory().Speed("Boost", player, player, 4, 1, false, false, false); - - // Inform - UtilPlayer.message(player, F.main("Game", "You used " + F.elem("Ultra Boost") + "!")); - - // Sound - player.getWorld().playSound(player.getLocation(), Sound.BLAZE_BREATH, 1f, 1f); - } - else if (UtilGear.isMat(player.getItemInHand(), Material.IRON_AXE)) - { - Manager.GetCondition().Factory().Speed("Boost", player, player, 4, 1, false, false, false); - Manager.GetCondition().Factory().Regen("Boost", player, player, 4, 0, false, false, false); - - // Inform - UtilPlayer.message(player, F.main("Game", "You used " + F.elem("Mega Boost") + "!")); - - // Sound - player.getWorld().playSound(player.getLocation(), Sound.BLAZE_BREATH, 1f, 1f); - } - else if (UtilGear.isMat(player.getItemInHand(), Material.DIAMOND_AXE)) - { - Manager.GetCondition().Factory().Speed("Boost", player, player, 4, 2, false, false, false); - Manager.GetCondition().Factory().Regen("Boost", player, player, 4, 1, false, false, false); - - // Inform - UtilPlayer.message(player, F.main("Game", "You used " + F.elem("Hyper Boost") + "!")); - - // Sound - player.getWorld().playSound(player.getLocation(), Sound.BLAZE_BREATH, 1f, 1f); - } - } - - @EventHandler - public void UseMeow(PlayerInteractEvent event) - { - if (!IsLive()) - return; - - Player player = event.getPlayer(); - - if (!UtilEvent.isAction(event, ActionType.R)) - return; - - if (!UtilGear.isMat(player.getItemInHand(), Material.SUGAR)) - return; - - event.setCancelled(true); - - if (!Recharge.Instance.use(player, "Meow", 5000, inform(), true)) - return; - - player.getWorld().playSound(player.getLocation(), Sound.CAT_MEOW, 1f, 1f); - - this.AddGems(player, 0.25, "Meows", true, true); - - UtilParticle.PlayParticle(ParticleType.NOTE, player.getLocation().add(0, 0.75, 0), 0.4f, 0.4f, 0.4f, 0, 6, + if (event.getType() != UpdateType.TICK) + return; + + for (Form form : _forms.values()) + if (form instanceof BlockForm) + ((BlockForm) form).SolidifyUpdate(); + } + + @EventHandler + public void SolidBlockDamage(BlockDamageEvent event) + { + if (!_seekers.HasPlayer(event.getPlayer())) + return; + + for (Form form : _forms.values()) + { + if (!(form instanceof BlockForm)) + continue; + + if (((BlockForm) form).GetBlock() == null) + continue; + + if (!((BlockForm) form).GetBlock().equals(event.getBlock())) + continue; + + // Damage Event + Manager.GetDamage().NewDamageEvent(form.Player, event.getPlayer(), null, DamageCause.CUSTOM, 4, true, true, false, + event.getPlayer().getName(), null); + + ((BlockForm) form).SolidifyRemove(); + } + } + + @EventHandler + public void FallingBlockDamage(EntityDamageEvent event) + { + if (!(event instanceof EntityDamageByEntityEvent)) + return; + + if (!(event.getEntity() instanceof FallingSand)) + return; + + if (event.getEntity().getVehicle() == null) + return; + + if (!(event.getEntity().getVehicle() instanceof LivingEntity)) + return; + + LivingEntity damagee = (LivingEntity) event.getEntity().getVehicle(); + + EntityDamageByEntityEvent eventEE = (EntityDamageByEntityEvent) event; + + LivingEntity damager = null; + Projectile proj = null; + + if (eventEE.getDamager() instanceof Projectile) + { + proj = (Projectile) eventEE.getDamager(); + damager = (LivingEntity) proj.getShooter(); + } else if (eventEE.getDamager() instanceof LivingEntity) + { + damager = (LivingEntity) eventEE.getDamager(); + } + + // Damage Event + Manager.GetDamage().NewDamageEvent(damagee, damager, proj, event.getCause(), event.getDamage(), true, false, false, null, + null); + + event.setCancelled(true); + } + + @EventHandler + public void AnimalSpawn(GameStateChangeEvent event) + { + if (event.GetState() != GameState.Prepare) + return; + + this.CreatureAllowOverride = true; + + for (Location loc : WorldData.GetDataLocs("WHITE")) + _mobs.put(loc.getWorld().spawn(loc, Sheep.class), loc); + + for (Location loc : WorldData.GetDataLocs("PINK")) + _mobs.put(loc.getWorld().spawn(loc, Pig.class), loc); + + for (Location loc : WorldData.GetDataLocs("YELLOW")) + _mobs.put(loc.getWorld().spawn(loc, Chicken.class), loc); + + for (Location loc : WorldData.GetDataLocs("BROWN")) + _mobs.put(loc.getWorld().spawn(loc, Cow.class), loc); + + this.CreatureAllowOverride = false; + } + + @EventHandler(priority = EventPriority.LOW) + public void AnimalDamage(CustomDamageEvent event) + { + if (event.GetDamageePlayer() == null && !(event.GetDamageeEntity() instanceof Slime)) + event.SetCancelled("Animal Damage"); + + if (event.GetDamagerEntity(false) != null && event.GetDamagerEntity(false) instanceof Slime) + event.SetCancelled("Slime Attack"); + } + + @EventHandler + public void AnimalReturn(UpdateEvent event) + { + if (event.getType() != UpdateType.SEC) + return; + + for (Creature ent : _mobs.keySet()) + { + if (UtilMath.offset(ent.getLocation(), _mobs.get(ent)) < 5) + continue; + + Location loc = _mobs.get(ent).add( + UtilAlg.getTrajectory(_mobs.get(ent), ent.getLocation()).multiply(Math.random() * 3)); + + EntityCreature ec = ((CraftCreature) ent).getHandle(); + NavigationAbstract nav = ec.getNavigation(); + nav.a(loc.getX(), loc.getY(), loc.getZ(), 1f); + } + } + + @EventHandler + public void AttackSeeker(CustomDamageEvent event) + { + if (event.GetDamagerPlayer(true) == null) + return; + + if (!_hiders.HasPlayer(event.GetDamagerPlayer(true))) + return; + + if (event.GetDamageInitial() > 1) + return; + + event.AddMod("H&S", "Negate", -event.GetDamageInitial(), false); + event.AddMod("H&S", "Attack", event.GetDamageInitial(), true); + } + + @EventHandler + public void ArrowShoot(EntityShootBowEvent event) + { + if (!(event.getEntity() instanceof Player)) + return; + + Player shooter = (Player) event.getEntity(); + + if (!_hiders.HasPlayer(shooter)) + return; + + Arrow arrow = shooter.getWorld().spawnArrow( + shooter.getEyeLocation().add(shooter.getLocation().getDirection().multiply(1.5)), + shooter.getLocation().getDirection(), (float) event.getProjectile().getVelocity().length(), 0f); + arrow.setShooter(shooter); + + event.setCancelled(true); + } + + @EventHandler + public void ArrowHit(CustomDamageEvent event) + { + if (event.IsCancelled()) + return; + + if (event.GetProjectile() == null) + return; + + Player damagee = event.GetDamageePlayer(); + if (damagee == null) + return; + + if (!_seekers.HasPlayer(damagee)) + return; + + Player damager = event.GetDamagerPlayer(true); + if (damager == null) + return; + + if (!_hiders.HasPlayer(damager)) + return; + + event.AddMod("Hide & Seek", "Negate", -event.GetDamageInitial(), false); + event.AddMod("Hide & Seek", "Damage Set", 2, false); + event.AddKnockback("Hide & Seek", 2); + + Powerup(damager); + } + + public void Powerup(Player player) + { + int count = 1; + if (_arrowHits.containsKey(player)) + count += _arrowHits.get(player); + + _arrowHits.put(player, count); + + if (count == 4) + { + player.getInventory().remove(Material.WOOD_AXE); + player.getInventory().addItem( + ItemStackFactory.Instance.CreateStack(Material.STONE_AXE, (byte) 0, 1, C.cGreen + "Super Axe")); + + // Sound + player.playSound(player.getLocation(), Sound.LEVEL_UP, 1f, 1f); + + // Inform + UtilPlayer.message(player, F.main("Game", "You upgraded to " + F.elem("Super Axe") + "!")); + } else if (count == 8) + { + player.getInventory().remove(Material.STONE_AXE); + player.getInventory().addItem( + ItemStackFactory.Instance.CreateStack(Material.IRON_AXE, (byte) 0, 1, C.cGreen + "Ultra Axe")); + + // Sound + player.playSound(player.getLocation(), Sound.LEVEL_UP, 1f, 1f); + + // Inform + UtilPlayer.message(player, F.main("Game", "You upgraded to " + F.elem("Ultra Axe") + "!")); + } else if (count == 12) + { + player.getInventory().remove(Material.IRON_AXE); + player.getInventory().addItem( + ItemStackFactory.Instance.CreateStack(Material.DIAMOND_AXE, (byte) 0, 1, C.cGreen + "Hyper Axe")); + + // Sound + player.playSound(player.getLocation(), Sound.LEVEL_UP, 1f, 1f); + + // Inform + UtilPlayer.message(player, F.main("Game", "You upgraded to " + F.elem("Hyper Axe") + "!")); + } else if (count < 12) + { + // Sound + player.playSound(player.getLocation(), Sound.ORB_PICKUP, 1f, 1f); + } + } + + @EventHandler + public void UseBoost(PlayerInteractEvent event) + { + if (!IsLive()) + return; + + Player player = event.getPlayer(); + + if (!UtilEvent.isAction(event, ActionType.R)) + return; + + if (player.getItemInHand() == null) + return; + + if (!player.getItemInHand().getType().toString().contains("_AXE")) + return; + + if (!_hiders.HasPlayer(player)) + return; + + if (!Recharge.Instance.use(player, "Axe Boost", 16000, inform(), true)) + return; + + if (UtilGear.isMat(player.getItemInHand(), Material.WOOD_AXE)) + { + Manager.GetCondition().Factory().Speed("Boost", player, player, 4, 0, false, false, false); + + // Inform + UtilPlayer.message(player, F.main("Game", "You used " + F.elem("Basic Boost") + "!")); + + // Sound + player.getWorld().playSound(player.getLocation(), Sound.BLAZE_BREATH, 1f, 1f); + } else if (UtilGear.isMat(player.getItemInHand(), Material.STONE_AXE)) + { + Manager.GetCondition().Factory().Speed("Boost", player, player, 4, 1, false, false, false); + + // Inform + UtilPlayer.message(player, F.main("Game", "You used " + F.elem("Ultra Boost") + "!")); + + // Sound + player.getWorld().playSound(player.getLocation(), Sound.BLAZE_BREATH, 1f, 1f); + } else if (UtilGear.isMat(player.getItemInHand(), Material.IRON_AXE)) + { + Manager.GetCondition().Factory().Speed("Boost", player, player, 4, 1, false, false, false); + Manager.GetCondition().Factory().Regen("Boost", player, player, 4, 0, false, false, false); + + // Inform + UtilPlayer.message(player, F.main("Game", "You used " + F.elem("Mega Boost") + "!")); + + // Sound + player.getWorld().playSound(player.getLocation(), Sound.BLAZE_BREATH, 1f, 1f); + } else if (UtilGear.isMat(player.getItemInHand(), Material.DIAMOND_AXE)) + { + Manager.GetCondition().Factory().Speed("Boost", player, player, 4, 2, false, false, false); + Manager.GetCondition().Factory().Regen("Boost", player, player, 4, 1, false, false, false); + + // Inform + UtilPlayer.message(player, F.main("Game", "You used " + F.elem("Hyper Boost") + "!")); + + // Sound + player.getWorld().playSound(player.getLocation(), Sound.BLAZE_BREATH, 1f, 1f); + } + } + + @EventHandler + public void UseMeow(PlayerInteractEvent event) + { + if (!IsLive()) + return; + + Player player = event.getPlayer(); + + if (!UtilEvent.isAction(event, ActionType.R)) + return; + + if (!UtilGear.isMat(player.getItemInHand(), Material.SUGAR)) + return; + + event.setCancelled(true); + + if (!Recharge.Instance.use(player, "Meow", 5000, inform(), true)) + return; + + player.getWorld().playSound(player.getLocation(), Sound.CAT_MEOW, 1f, 1f); + + this.AddGems(player, 0.25, "Meows", true, true); + + UtilParticle.PlayParticle(ParticleType.NOTE, player.getLocation().add(0, 0.75, 0), 0.4f, 0.4f, 0.4f, 0, 6, ViewDist.MAX, UtilServer.getPlayers()); - Bukkit.getPluginManager().callEvent(new MeowEvent(event.getPlayer())); - } - - @EventHandler - public void UseFirework(PlayerInteractEvent event) - { - if (!IsLive()) - return; - - Player player = event.getPlayer(); - - if (!UtilEvent.isAction(event, ActionType.R)) - return; - - if (!UtilGear.isMat(player.getItemInHand(), Material.FIREWORK)) - return; - - event.setCancelled(true); - - if (!Recharge.Instance.use(player, "Firework", 15000, inform(), true)) - return; - - this.AddGems(player, 2, "Fireworks", true, true); - - UtilInv.remove(player, Material.FIREWORK, (byte)0, 1); - UtilInv.Update(player); - - UtilFirework.launchFirework(player.getEyeLocation(), - FireworkEffect.builder().flicker(Math.random() > 0.5).withColor(Color.YELLOW).with(Type.BALL_LARGE).trail(true).flicker(true).build(), - new Vector(0,0,0), 2); - } - - @EventHandler - public void HiderTimeGems(UpdateEvent event) - { - if (GetState() != GameState.Live) - return; - - if (event.getType() != UpdateType.SEC) - return; - - for (Player player : _hiders.GetPlayers(true)) - { - this.AddGems(player, 0.05, "Seconds Alive", true, true); - } - } - - @EventHandler - public void UpdateSeekers(UpdateEvent event) - { - if (!IsLive()) - return; - - if (event.getType() != UpdateType.FAST) - return; - - int req = Math.max(1, GetPlayers(true).size() / 5); - - while (_seekers.GetPlayers(true).size() < req && _hiders.GetPlayers(true).size() > 0) - { - Player player = _hiders.GetPlayers(true).get(UtilMath.r(_hiders.GetPlayers(true).size())); - SetSeeker(player, true); - } - } - - @EventHandler - public void WaterDamage(UpdateEvent event) - { - if (!IsLive()) - return; - - if (event.getType() != UpdateType.FAST) - return; - } - - @EventHandler - public void WorldWaterDamage(UpdateEvent event) - { - if (!IsLive()) - return; - - if (event.getType() != UpdateType.SEC) - return; - - for (Player player : _hiders.GetPlayers(true)) - if (player.getLocation().getBlock().getTypeId() == 8 || player.getLocation().getBlock().getTypeId() == 9) - { - // Damage Event - Manager.GetDamage().NewDamageEvent(player, null, null, DamageCause.DROWNING, 2, false, false, false, "Water", - "Water Damage"); - - player.getWorld().playSound(player.getLocation(), Sound.SPLASH, 0.8f, 1f + (float) Math.random() / 2); - } - } - - @EventHandler - public void PlayerDeath(PlayerQuitEvent event) - { - Form form = _forms.remove(event.getPlayer()); - if (form != null) - form.Remove(); - } - - @EventHandler - public void PlayerDeath(PlayerDeathEvent event) - { - if (_hiders.HasPlayer(event.getEntity())) - SetSeeker(event.getEntity(), false); - } - - public void SetSeeker(Player player, boolean forced) - { - GameTeam pastTeam = GetTeam(player); - if (pastTeam != null && pastTeam.equals(_hiders)) - pastTeam.SetPlacement(player, PlayerState.OUT); - - SetPlayerTeam(player, _seekers, true); - - // Remove Form - Form form = _forms.remove(player); - if (form != null) - form.Remove(); - - // Kit - SetKit(player, GetKits()[5], false); - GetKits()[5].ApplyKit(player); - - // Refresh - VisibilityManager.Instance.refreshPlayerToAll(player); - - if (forced) - { - AddGems(player, 10, "Forced Seeker", false, false); - - Announce(F.main("Game", - F.elem(_hiders.GetColor() + player.getName()) + " was moved to " + F.elem(C.cRed + C.Bold + "Hunters") + ".")); - - player.getWorld().strikeLightningEffect(player.getLocation()); - - player.damage(1000); - } - - UtilPlayer.message(player, C.cRed + C.Bold + "You are now a Hunter!"); - - player.eject(); - player.leaveVehicle(); - player.teleport(_seekers.GetSpawn()); - } - - @Override - public void EndCheck() - { - if (!IsLive()) - return; - - if (GetPlayers(true).isEmpty()) - { - SetState(GameState.End); - return; - } - - if (_hiders.GetPlayers(true).isEmpty()) - { - ArrayList places = _hiders.GetPlacements(true); - - AnnounceEnd(_hiders.GetPlacements(true)); - - // Gems - if (places.size() >= 1) - AddGems(places.get(0), 20, "1st Place", false, false); - - if (places.size() >= 2) - AddGems(places.get(1), 15, "2nd Place", false, false); - - if (places.size() >= 3) - AddGems(places.get(2), 10, "3rd Place", false, false); - - for (Player player : GetPlayers(false)) - if (player.isOnline()) - AddGems(player, 10, "Participation", false, false); - - SetState(GameState.End); - } - } - - @Override - public double GetKillsGems(Player killer, Player killed, boolean assist) - { - if (_hiders.HasPlayer(killed)) - { - if (!assist) - return 4; - else - return 1; - } - - if (!assist) - return 1; - - return 0; - } - - @EventHandler - public void AnnounceHideTime(GameStateChangeEvent event) - { - if (event.GetState() != GameState.Live) - return; - - Announce(C.cAqua + C.Bold + "Hiders have 20 Seconds to hide!"); - } - - @EventHandler - public void Timer(UpdateEvent event) - { - if (GetState() != GameState.Live) - return; - - if (event.getType() != UpdateType.TICK) - return; - - - - // Hide Time - if (!_started) - { - long timeLeft = _hideTime - (System.currentTimeMillis() - GetStateTime()); - - if (timeLeft <= 0) - { - _started = true; - - // Hider Items - GiveItems(false); - _bowGiveTime = System.currentTimeMillis(); - - // Remove Barrier - for (Location loc : WorldData.GetDataLocs("BLACK")) - loc.getBlock().setType(Material.AIR); - - Announce(C.cRed + C.Bold + "The Hunters have been released!"); - } - } - // Seek Time - else - { - //Give Bow - if (!_bowGiven && UtilTime.elapsed(_bowGiveTime, 10000)) - { - GiveItems(true); - _bowGiven = true; - } - - long timeLeft = _gameTime - (System.currentTimeMillis() - GetStateTime() - _hideTime); - - if (timeLeft <= 0) - { - WriteScoreboard(); - - AnnounceEnd(_hiders); - - for (Player player : _hiders.GetPlayers(true)) - AddGems(player, 10, "Winning Team", false, false); - - for (Player player : GetPlayers(false)) - if (player.isOnline()) - AddGems(player, 10, "Participation", false, false); - - SetState(GameState.End); - } - } - } - - @Override - @EventHandler - public void ScoreboardUpdate(UpdateEvent event) - { - if (event.getType() != UpdateType.FAST) - return; - - WriteScoreboard(); - } - - private void WriteScoreboard() - { - // Wipe Last - Scoreboard.reset(); - - for (GameTeam team : this.GetTeamList()) - { - Scoreboard.writeNewLine(); - Scoreboard.write(team.GetPlayers(true).size() + " " + team.GetColor() + team.GetName()); - } - - if (!_started) - { - long timeLeft = _hideTime - (System.currentTimeMillis() - GetStateTime()); - - Scoreboard.writeNewLine(); - Scoreboard.write(C.cYellow + C.Bold + "Hide Time"); - Scoreboard.write(UtilTime.MakeStr(Math.max(0, timeLeft), 0)); - } - else - { - long timeLeft = _gameTime - (System.currentTimeMillis() - GetStateTime() - _hideTime); - - Scoreboard.writeNewLine(); - Scoreboard.write(C.cYellow + C.Bold + "Seek Time"); - Scoreboard.write(UtilTime.MakeStr(Math.max(0, timeLeft), 0)); - } - - Scoreboard.draw(); - } - - @Override - public GameTeam ChooseTeam(Player player) - { - if (CanJoinTeam(_seekers)) - return _seekers; - - return _hiders; - } - - @Override - public boolean CanJoinTeam(GameTeam team) - { - if (team.GetColor() == ChatColor.RED) - { - return team.GetSize() < Math.max(1, GetPlayers(true).size() / 5); - } - - return true; - } - - @Override - public boolean CanThrowTNT(Location location) - { - for (Location loc : _seekers.GetSpawns()) - if (UtilMath.offset(loc, location) < 24) - return false; - - return true; - } - - @Override - public DeathMessageType GetDeathMessageType() - { - return DeathMessageType.Detailed; - } - - @EventHandler - public void UsableCancel(PlayerInteractEvent event) - { - if (event.getClickedBlock() == null) - return; - - if (UtilBlock.usable(event.getClickedBlock())) - event.setCancelled(true); - - if (event.getClickedBlock().getType() == Material.WOODEN_DOOR) - { - event.setCancelled(false); - } - } - - public GameTeam getHiders() - { - return _hiders; - } - - public GameTeam getSeekers() - { - return _seekers; - } - - @EventHandler - public void InfestDisguise(PlayerInteractEvent event) - { - if (event.getClickedBlock() == null) - return; - - final Player player = event.getPlayer(); - - final Block block = event.getClickedBlock(); - - if (!UtilGear.isMat(player.getItemInHand(), Material.MAGMA_CREAM)) - return; - - if (!_allowedBlocks.contains(block.getType())) - { - UtilPlayer.message( - player, - F.main("Game", - "You cannot infest " - + F.elem(ItemStackFactory.Instance.GetName(block.getType(), (byte) 0, false) + " Block") - + ".")); - return; - } - - if (block.getRelative(BlockFace.UP).getType() != Material.AIR - || _infested.values().contains(block.getRelative(BlockFace.UP))) - { - UtilPlayer.message(player, F.main("Game", "You can only infest blocks with air above them.")); - return; - } - - if (IsInfesting(player) || _infestDeny.contains(player)) - { - UtilPlayer.message(player, F.main("Game", "You are already infesting something.")); - return; - } - - if (!Recharge.Instance.use(player, "Infest", 8000, true, true)) - return; - - // Cloak - InfestStart(player); - - // Data - final InfestedData data = new InfestedData(block); - - // Teleport - player.teleport(block.getLocation().add(0.5, 0, 0.5)); - - // Fake Block - UtilServer.getServer().getScheduler().runTaskLater(Manager.getPlugin(), new Runnable() - { - @Override - public void run() - { - if (block.getType() == Material.AIR) - { - player.sendBlockChange(block.getLocation(), 36, (byte) 0); - for (Player other : UtilServer.getPlayers()) - if (!other.equals(player)) - other.sendBlockChange(block.getLocation(), data.Material, data.Data); - } - } - - }, 5); - - _infested.put(player, data); - } - - @EventHandler - public void InfestDisguise(PlayerInteractEntityEvent event) - { - if (event.getRightClicked() == null) - return; - - Player player = event.getPlayer(); - - if (!UtilGear.isMat(player.getItemInHand(), Material.MAGMA_CREAM)) - return; - - if (!_allowedEnts.contains(event.getRightClicked().getType())) - { - UtilPlayer.message(player, - F.main("Game", "You cannot infest " + F.elem(UtilEnt.getName(event.getRightClicked())) + ".")); - return; - } - - if (IsInfesting(player) || _infestDeny.contains(player)) - { - UtilPlayer.message(player, F.main("Game", "You are already infesting something.")); - return; - } - - if (!Recharge.Instance.use(player, "Infest", 8000, inform(), true)) - return; - - // Cloak - InfestStart(player); - - // Infest - event.getRightClicked().setPassenger(player); - } - - @EventHandler - public void InfestDisguise(CustomDamageEvent event) - { - Player player = event.GetDamagerPlayer(false); - if (player == null) - return; - - if (!UtilGear.isMat(player.getItemInHand(), Material.MAGMA_CREAM)) - return; - - if (!_allowedEnts.contains(event.GetDamageeEntity().getType())) - { - UtilPlayer.message(player, - F.main("Game", "You cannot morph into " + F.elem(UtilEnt.getName(event.GetDamageeEntity())) + ".")); - return; - } - - if (IsInfesting(player) || _infestDeny.contains(player)) - { - UtilPlayer.message(player, F.main("Game", "You are already infesting something.")); - return; - } - - if (!Recharge.Instance.use(player, "Infest", 8000, inform(), true)) - return; - - // Cloak - InfestStart(player); - - // Infest - event.GetDamageeEntity().setPassenger(player); - } - - @EventHandler(priority = EventPriority.LOW) - public void InfectDamageShuffleUp(CustomDamageEvent event) - { - if (event.GetDamageePlayer() == null) - { - if (event.GetDamageeEntity().getPassenger() != null - && event.GetDamageeEntity().getPassenger() instanceof LivingEntity) - { - LivingEntity passenger = (LivingEntity) event.GetDamageeEntity().getPassenger(); - - // Leave - event.GetDamageeEntity().eject(); - passenger.leaveVehicle(); - - // End - InfestEnd(passenger); - - // Damage Event - Manager.GetDamage().NewDamageEvent(passenger, event.GetDamagerEntity(true), null, DamageCause.CUSTOM, 4, true, - true, false, UtilEnt.getName(event.GetDamagerEntity(true)), null); - } - } - } - - @EventHandler - public void InfestBlockDamage(BlockDamageEvent event) - { - if (!_seekers.HasPlayer(event.getPlayer())) - return; - - for (Player player : _infested.keySet()) - { - if (!_infested.get(player).Block.equals(event.getBlock())) - continue; - - // Damage Event - Manager.GetDamage().NewDamageEvent(player, event.getPlayer(), null, DamageCause.CUSTOM, 4, true, true, false, - event.getPlayer().getName(), null); - - // Remove - _infested.remove(player).restore(); - - // End - InfestEnd(player); - } - } - - @EventHandler - public void InfestLeave(VehicleExitEvent event) - { - if (!IsLive()) - return; - - InfestEnd(event.getExited()); - } - - @EventHandler - public void InfestLeave(UpdateEvent event) - { - if (event.getType() != UpdateType.TICK) - return; - - // Block Leave - Iterator infestIterator = _infested.keySet().iterator(); - while (infestIterator.hasNext()) - { - Player player = infestIterator.next(); - - InfestedData data = _infested.get(player); - - // Update - if (data.Block.getType() == Material.AIR) - { - player.sendBlockChange(data.Block.getLocation(), 36, (byte) 0); - for (Player other : UtilServer.getPlayers()) - if (!other.equals(player)) - other.sendBlockChange(data.Block.getLocation(), data.Material, data.Data); - } - - if (!player.getLocation().getBlock().equals(data.Block)) - { - // End - InfestEnd(player); - - // Restore Block - data.restore(); - - infestIterator.remove(); - } - } - - // Invisible - for (Player player : GetPlayers(true)) - { - if (!(GetKit(player) instanceof KitHiderInfestor)) - continue; - - if (_infested.containsKey(player) || player.getVehicle() != null) - Manager.GetCondition().Factory().Cloak("Infest", player, player, 1.9, false, false); - } - } - - public void InfestStart(LivingEntity ent) - { - UtilParticle.PlayParticle(ParticleType.SLIME, ent.getLocation().add(0, 0.6, 0), 0.3f, 0.3f, 0.3f, 0, 24, + Bukkit.getPluginManager().callEvent(new MeowEvent(event.getPlayer())); + } + + @EventHandler + public void UseFirework(PlayerInteractEvent event) + { + if (!IsLive()) + return; + + Player player = event.getPlayer(); + + if (!UtilEvent.isAction(event, ActionType.R)) + return; + + if (!UtilGear.isMat(player.getItemInHand(), Material.FIREWORK)) + return; + + event.setCancelled(true); + + if (!Recharge.Instance.use(player, "Firework", 15000, inform(), true)) + return; + + this.AddGems(player, 2, "Fireworks", true, true); + + UtilInv.remove(player, Material.FIREWORK, (byte) 0, 1); + UtilInv.Update(player); + + UtilFirework.launchFirework(player.getEyeLocation(), + FireworkEffect.builder().flicker(Math.random() > 0.5).withColor(Color.YELLOW).with(Type.BALL_LARGE).trail(true).flicker(true).build(), + new Vector(0, 0, 0), 2); + } + + @EventHandler + public void HiderTimeGems(UpdateEvent event) + { + if (GetState() != GameState.Live) + return; + + if (event.getType() != UpdateType.SEC) + return; + + for (Player player : _hiders.GetPlayers(true)) + { + this.AddGems(player, 0.05, "Seconds Alive", true, true); + } + } + + @EventHandler + public void UpdateSeekers(UpdateEvent event) + { + if (!IsLive()) + return; + + if (event.getType() != UpdateType.FAST) + return; + + int req = Math.max(1, GetPlayers(true).size() / 5); + + while (_seekers.GetPlayers(true).size() < req && _hiders.GetPlayers(true).size() > 0) + { + Player player = _hiders.GetPlayers(true).get(UtilMath.r(_hiders.GetPlayers(true).size())); + SetSeeker(player, true); + } + } + + @EventHandler + public void WaterDamage(UpdateEvent event) + { + if (!IsLive()) + return; + + if (event.getType() != UpdateType.FAST) + return; + } + + @EventHandler + public void WorldWaterDamage(UpdateEvent event) + { + if (!IsLive()) + return; + + if (event.getType() != UpdateType.SEC) + return; + + for (Player player : _hiders.GetPlayers(true)) + if (player.getLocation().getBlock().getTypeId() == 8 || player.getLocation().getBlock().getTypeId() == 9) + { + // Damage Event + Manager.GetDamage().NewDamageEvent(player, null, null, DamageCause.DROWNING, 2, false, false, false, "Water", + "Water Damage"); + + player.getWorld().playSound(player.getLocation(), Sound.SPLASH, 0.8f, 1f + (float) Math.random() / 2); + } + } + + @EventHandler + public void PlayerDeath(PlayerQuitEvent event) + { + Form form = _forms.remove(event.getPlayer()); + if (form != null) + form.Remove(); + } + + @EventHandler + public void PlayerDeath(PlayerDeathEvent event) + { + if (_hiders.HasPlayer(event.getEntity())) + SetSeeker(event.getEntity(), false); + } + + public void SetSeeker(Player player, boolean forced) + { + GameTeam pastTeam = GetTeam(player); + if (pastTeam != null && pastTeam.equals(_hiders)) + pastTeam.SetPlacement(player, PlayerState.OUT); + + SetPlayerTeam(player, _seekers, true); + + // Remove Form + Form form = _forms.remove(player); + if (form != null) + form.Remove(); + + // Remove Disguise + DisguiseBase disguise = Manager.GetDisguise().getActiveDisguise(player); + if (disguise != null) + { + Manager.GetDisguise().undisguise(disguise); + } + // Kit + SetKit(player, GetKits()[5], false); + GetKits()[5].ApplyKit(player); + + // Refresh + VisibilityManager.Instance.refreshPlayerToAll(player); + + if (forced) + { + AddGems(player, 10, "Forced Seeker", false, false); + + Announce(F.main("Game", + F.elem(_hiders.GetColor() + player.getName()) + " was moved to " + F.elem(C.cRed + C.Bold + "Hunters") + ".")); + + player.getWorld().strikeLightningEffect(player.getLocation()); + + player.damage(1000); + } + + UtilPlayer.message(player, C.cRed + C.Bold + "You are now a Hunter!"); + + player.eject(); + player.leaveVehicle(); + player.teleport(_seekers.GetSpawn()); + } + + @Override + public void EndCheck() + { + if (!IsLive()) + return; + + if (GetPlayers(true).isEmpty()) + { + SetState(GameState.End); + return; + } + + if (_hiders.GetPlayers(true).isEmpty()) + { + ArrayList places = _hiders.GetPlacements(true); + + AnnounceEnd(_hiders.GetPlacements(true)); + + // Gems + if (places.size() >= 1) + AddGems(places.get(0), 20, "1st Place", false, false); + + if (places.size() >= 2) + AddGems(places.get(1), 15, "2nd Place", false, false); + + if (places.size() >= 3) + AddGems(places.get(2), 10, "3rd Place", false, false); + + for (Player player : GetPlayers(false)) + if (player.isOnline()) + AddGems(player, 10, "Participation", false, false); + + SetState(GameState.End); + } + } + + @Override + public double GetKillsGems(Player killer, Player killed, boolean assist) + { + if (_hiders.HasPlayer(killed)) + { + if (!assist) + return 4; + else + return 1; + } + + if (!assist) + return 1; + + return 0; + } + + @EventHandler + public void AnnounceHideTime(GameStateChangeEvent event) + { + if (event.GetState() != GameState.Live) + return; + + Announce(C.cAqua + C.Bold + "Hiders have 20 Seconds to hide!"); + } + + @EventHandler + public void Timer(UpdateEvent event) + { + if (GetState() != GameState.Live) + return; + + if (event.getType() != UpdateType.TICK) + return; + + + // Hide Time + if (!_started) + { + long timeLeft = _hideTime - (System.currentTimeMillis() - GetStateTime()); + + if (timeLeft <= 0) + { + _started = true; + + // Hider Items + GiveItems(false); + _bowGiveTime = System.currentTimeMillis(); + + // Remove Barrier + for (Location loc : WorldData.GetDataLocs("BLACK")) + loc.getBlock().setType(Material.AIR); + + Announce(C.cRed + C.Bold + "The Hunters have been released!"); + } + } + // Seek Time + else + { + //Give Bow + if (!_bowGiven && UtilTime.elapsed(_bowGiveTime, 10000)) + { + GiveItems(true); + _bowGiven = true; + } + + long timeLeft = _gameTime - (System.currentTimeMillis() - GetStateTime() - _hideTime); + + if (timeLeft <= 0) + { + WriteScoreboard(); + + AnnounceEnd(_hiders); + + for (Player player : _hiders.GetPlayers(true)) + AddGems(player, 10, "Winning Team", false, false); + + for (Player player : GetPlayers(false)) + if (player.isOnline()) + AddGems(player, 10, "Participation", false, false); + + SetState(GameState.End); + } + } + } + + @Override + @EventHandler + public void ScoreboardUpdate(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + return; + + WriteScoreboard(); + } + + private void WriteScoreboard() + { + // Wipe Last + Scoreboard.reset(); + + for (GameTeam team : this.GetTeamList()) + { + Scoreboard.writeNewLine(); + Scoreboard.write(team.GetPlayers(true).size() + " " + team.GetColor() + team.GetName()); + } + + if (!_started) + { + long timeLeft = _hideTime - (System.currentTimeMillis() - GetStateTime()); + + Scoreboard.writeNewLine(); + Scoreboard.write(C.cYellow + C.Bold + "Hide Time"); + Scoreboard.write(UtilTime.MakeStr(Math.max(0, timeLeft), 0)); + } else + { + long timeLeft = _gameTime - (System.currentTimeMillis() - GetStateTime() - _hideTime); + + Scoreboard.writeNewLine(); + Scoreboard.write(C.cYellow + C.Bold + "Seek Time"); + Scoreboard.write(UtilTime.MakeStr(Math.max(0, timeLeft), 0)); + } + + Scoreboard.draw(); + } + + @Override + public GameTeam ChooseTeam(Player player) + { + if (CanJoinTeam(_seekers)) + return _seekers; + + return _hiders; + } + + @Override + public boolean CanJoinTeam(GameTeam team) + { + if (team.GetColor() == ChatColor.RED) + { + return team.GetSize() < Math.max(1, GetPlayers(true).size() / 5); + } + + return true; + } + + @Override + public boolean CanThrowTNT(Location location) + { + for (Location loc : _seekers.GetSpawns()) + if (UtilMath.offset(loc, location) < 24) + return false; + + return true; + } + + @Override + public DeathMessageType GetDeathMessageType() + { + return DeathMessageType.Detailed; + } + + @EventHandler + public void UsableCancel(PlayerInteractEvent event) + { + if (event.getClickedBlock() == null) + return; + + if (UtilBlock.usable(event.getClickedBlock())) + event.setCancelled(true); + + if (event.getClickedBlock().getType() == Material.WOODEN_DOOR) + { + event.setCancelled(false); + } + } + + public GameTeam getHiders() + { + return _hiders; + } + + public GameTeam getSeekers() + { + return _seekers; + } + + @EventHandler + public void InfestDisguise(PlayerInteractEvent event) + { + if (event.getClickedBlock() == null) + return; + + final Player player = event.getPlayer(); + + final Block block = event.getClickedBlock(); + + if (!UtilGear.isMat(player.getItemInHand(), Material.MAGMA_CREAM)) + return; + + if (!_allowedBlocks.contains(block.getType())) + { + UtilPlayer.message( + player, + F.main("Game", + "You cannot infest " + + F.elem(ItemStackFactory.Instance.GetName(block.getType(), (byte) 0, false) + " Block") + + ".")); + return; + } + + if (block.getRelative(BlockFace.UP).getType() != Material.AIR + || _infested.values().contains(block.getRelative(BlockFace.UP))) + { + UtilPlayer.message(player, F.main("Game", "You can only infest blocks with air above them.")); + return; + } + + if (IsInfesting(player) || _infestDeny.contains(player)) + { + UtilPlayer.message(player, F.main("Game", "You are already infesting something.")); + return; + } + + if (!Recharge.Instance.use(player, "Infest", 8000, true, true)) + return; + + // Cloak + InfestStart(player); + + // Data + final InfestedData data = new InfestedData(block); + + // Teleport + player.teleport(block.getLocation().add(0.5, 0, 0.5)); + + // Fake Block + UtilServer.getServer().getScheduler().runTaskLater(Manager.getPlugin(), new Runnable() + { + @Override + public void run() + { + if (block.getType() == Material.AIR) + { + player.sendBlockChange(block.getLocation(), 36, (byte) 0); + for (Player other : UtilServer.getPlayers()) + if (!other.equals(player)) + other.sendBlockChange(block.getLocation(), data.Material, data.Data); + } + } + + }, 5); + + _infested.put(player, data); + } + + @EventHandler + public void InfestDisguise(PlayerInteractEntityEvent event) + { + if (event.getRightClicked() == null) + return; + + Player player = event.getPlayer(); + + if (!UtilGear.isMat(player.getItemInHand(), Material.MAGMA_CREAM)) + return; + + if (!_allowedEnts.contains(event.getRightClicked().getType())) + { + UtilPlayer.message(player, + F.main("Game", "You cannot infest " + F.elem(UtilEnt.getName(event.getRightClicked())) + ".")); + return; + } + + if (IsInfesting(player) || _infestDeny.contains(player)) + { + UtilPlayer.message(player, F.main("Game", "You are already infesting something.")); + return; + } + + if (!Recharge.Instance.use(player, "Infest", 8000, inform(), true)) + return; + + // Cloak + InfestStart(player); + + // Infest + event.getRightClicked().setPassenger(player); + } + + @EventHandler + public void InfestDisguise(CustomDamageEvent event) + { + Player player = event.GetDamagerPlayer(false); + if (player == null) + return; + + if (!UtilGear.isMat(player.getItemInHand(), Material.MAGMA_CREAM)) + return; + + if (!_allowedEnts.contains(event.GetDamageeEntity().getType())) + { + UtilPlayer.message(player, + F.main("Game", "You cannot morph into " + F.elem(UtilEnt.getName(event.GetDamageeEntity())) + ".")); + return; + } + + if (IsInfesting(player) || _infestDeny.contains(player)) + { + UtilPlayer.message(player, F.main("Game", "You are already infesting something.")); + return; + } + + if (!Recharge.Instance.use(player, "Infest", 8000, inform(), true)) + return; + + // Cloak + InfestStart(player); + + // Infest + event.GetDamageeEntity().setPassenger(player); + } + + @EventHandler(priority = EventPriority.LOW) + public void InfectDamageShuffleUp(CustomDamageEvent event) + { + if (event.GetDamageePlayer() == null) + { + if (event.GetDamageeEntity().getPassenger() != null + && event.GetDamageeEntity().getPassenger() instanceof LivingEntity) + { + LivingEntity passenger = (LivingEntity) event.GetDamageeEntity().getPassenger(); + + // Leave + event.GetDamageeEntity().eject(); + passenger.leaveVehicle(); + + // End + InfestEnd(passenger); + + // Damage Event + Manager.GetDamage().NewDamageEvent(passenger, event.GetDamagerEntity(true), null, DamageCause.CUSTOM, 4, true, + true, false, UtilEnt.getName(event.GetDamagerEntity(true)), null); + } + } + } + + @EventHandler + public void InfestBlockDamage(BlockDamageEvent event) + { + if (!_seekers.HasPlayer(event.getPlayer())) + return; + + for (Player player : _infested.keySet()) + { + if (!_infested.get(player).Block.equals(event.getBlock())) + continue; + + // Damage Event + Manager.GetDamage().NewDamageEvent(player, event.getPlayer(), null, DamageCause.CUSTOM, 4, true, true, false, + event.getPlayer().getName(), null); + + // Remove + _infested.remove(player).restore(); + + // End + InfestEnd(player); + } + } + + @EventHandler + public void InfestLeave(VehicleExitEvent event) + { + if (!IsLive()) + return; + + InfestEnd(event.getExited()); + } + + @EventHandler + public void InfestLeave(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + // Block Leave + Iterator infestIterator = _infested.keySet().iterator(); + while (infestIterator.hasNext()) + { + Player player = infestIterator.next(); + + InfestedData data = _infested.get(player); + + // Update + if (data.Block.getType() == Material.AIR) + { + player.sendBlockChange(data.Block.getLocation(), 36, (byte) 0); + for (Player other : UtilServer.getPlayers()) + if (!other.equals(player)) + other.sendBlockChange(data.Block.getLocation(), data.Material, data.Data); + } + + if (!player.getLocation().getBlock().equals(data.Block)) + { + // End + InfestEnd(player); + + // Restore Block + data.restore(); + + infestIterator.remove(); + } + } + + // Invisible + for (Player player : GetPlayers(true)) + { + if (!(GetKit(player) instanceof KitHiderInfestor)) + continue; + + if (_infested.containsKey(player) || player.getVehicle() != null) + Manager.GetCondition().Factory().Cloak("Infest", player, player, 1.9, false, false); + } + } + + public void InfestStart(LivingEntity ent) + { + UtilParticle.PlayParticle(ParticleType.SLIME, ent.getLocation().add(0, 0.6, 0), 0.3f, 0.3f, 0.3f, 0, 24, ViewDist.MAX, UtilServer.getPlayers()); - ent.getWorld().playSound(ent.getLocation(), Sound.SLIME_ATTACK, 2f, 1f); - ent.getWorld().playSound(ent.getLocation(), Sound.SLIME_ATTACK, 2f, 1f); + ent.getWorld().playSound(ent.getLocation(), Sound.SLIME_ATTACK, 2f, 1f); + ent.getWorld().playSound(ent.getLocation(), Sound.SLIME_ATTACK, 2f, 1f); - Manager.GetCondition().Factory().Cloak("Infest", ent, ent, 1.9, false, false); + Manager.GetCondition().Factory().Cloak("Infest", ent, ent, 1.9, false, false); - // Gets rid of timer, not needed until end - Recharge.Instance.recharge((Player) ent, "Infest"); + // Gets rid of timer, not needed until end + Recharge.Instance.recharge((Player) ent, "Infest"); - _infestDeny.add(ent); - } + _infestDeny.add(ent); + } - public void InfestEnd(LivingEntity ent) - { - Manager.GetCondition().EndCondition(ent, null, "Infest"); + public void InfestEnd(LivingEntity ent) + { + Manager.GetCondition().EndCondition(ent, null, "Infest"); - ent.getWorld().playSound(ent.getLocation(), Sound.SLIME_ATTACK, 2f, 0.6f); + ent.getWorld().playSound(ent.getLocation(), Sound.SLIME_ATTACK, 2f, 0.6f); - if (ent instanceof Player) - { - Recharge.Instance.recharge((Player) ent, "Infest"); - Recharge.Instance.use((Player) ent, "Infest", 8000, true, true); - _infestDeny.remove(ent); - } - } + if (ent instanceof Player) + { + Recharge.Instance.recharge((Player) ent, "Infest"); + Recharge.Instance.use((Player) ent, "Infest", 8000, true, true); + _infestDeny.remove(ent); + } + } - public boolean IsInfesting(LivingEntity ent) - { - if (_infested.containsKey(ent)) - return true; + public boolean IsInfesting(LivingEntity ent) + { + if (_infested.containsKey(ent)) + return true; - return ent.getVehicle() != null; - } - - public HashMap getForms() - { - return _forms; - } - - public ArrayList getAllowedBlocks() - { - return _allowedBlocks; - } - - public boolean inform() - { - return true; - } + return ent.getVehicle() != null; + } + + public HashMap getForms() + { + return _forms; + } + + public ArrayList getAllowedBlocks() + { + return _allowedBlocks; + } + + public boolean inform() + { + return true; + } } 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 5cb098b4e..ae6606a81 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 @@ -5,6 +5,8 @@ import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; +import net.minecraft.server.v1_8_R3.EntityArrow; + import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.Effect; @@ -76,8 +78,8 @@ import mineplex.core.recharge.RechargedEvent; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.combat.event.CombatDeathEvent; -import mineplex.minecraft.game.core.condition.Condition.ConditionType; import mineplex.minecraft.game.core.damage.CustomDamageEvent; + import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.events.GameStateChangeEvent; import nautilus.game.arcade.game.Game; @@ -91,7 +93,6 @@ import nautilus.game.arcade.game.games.minestrike.items.equipment.armor.Armor; import nautilus.game.arcade.game.games.minestrike.items.grenades.Grenade; import nautilus.game.arcade.game.games.minestrike.items.guns.Gun; import nautilus.game.arcade.game.games.minestrike.items.guns.GunType; -import net.minecraft.server.v1_8_R3.EntityArrow; public class GunModule implements Listener { @@ -141,6 +142,7 @@ public class GunModule implements Listener public boolean EnablePickup = true; public boolean EnableDrop = true; public boolean EnableCleaning = true; + private boolean _disableDamage; private long _freezeTime = -1; @@ -878,6 +880,9 @@ public class GunModule implements Listener @EventHandler(priority=EventPriority.HIGH) public void damage(CustomDamageEvent event) { + if (_disableDamage) + return; + if (event.GetDamageePlayer() == null) return; @@ -2068,4 +2073,9 @@ public class GunModule implements Listener { return _scoped; } + + public void setDisableDamage(boolean disabled) + { + _disableDamage = disabled; + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/Minestrike.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/Minestrike.java index 4538271f4..17ddcab9f 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/Minestrike.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/Minestrike.java @@ -57,6 +57,7 @@ import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.combat.event.CombatDeathEvent; import mineplex.minecraft.game.core.condition.Condition.ConditionType; import mineplex.minecraft.game.core.damage.CustomDamageEvent; + import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.GameType; import nautilus.game.arcade.events.GameStateChangeEvent; @@ -121,25 +122,18 @@ public class Minestrike extends TeamGame //Scoreboard private Objective _scoreObj; - public Minestrike(ArcadeManager manager) + public Minestrike(ArcadeManager manager, Kit[] kits, GameType type) { - super(manager, GameType.MineStrike, - - new Kit[] - { - new KitPlayer(manager), - }, - + super(manager, type, kits, new String[] - { - C.cAqua + "SWAT" + C.cWhite + " Defend the Bomb Sites", - C.cAqua + "SWAT" + C.cWhite + " Kill the Bombers", - " ", - C.cRed + "Bombers" + C.cWhite + " Plant the Bomb at Bomb Site", - C.cRed + "Bombers" + C.cWhite + " Kill the SWAT Team", - }); + { + C.cAqua + "SWAT" + C.cWhite + " Defend the Bomb Sites", + C.cAqua + "SWAT" + C.cWhite + " Kill the Bombers", + " ", + C.cRed + "Bombers" + C.cWhite + " Plant the Bomb at Bomb Site", + C.cRed + "Bombers" + C.cWhite + " Kill the SWAT Team", + }); - _shopManager = new ShopManager(this); Manager.getCosmeticManager().setHideParticles(true); this.StrictAntiHack = true; @@ -181,6 +175,14 @@ public class Minestrike extends TeamGame "Pick up better weapons from dead players" }; + _gunModule = new GunModule(this); + _shopManager = new ShopManager(this); + } + + public Minestrike(ArcadeManager manager) + { + this(manager, new Kit[]{new KitPlayer(manager)}, GameType.MineStrike); + registerStatTrackers( new KillReasonStatTracker(this, "Headshot", "BoomHeadshot", true), new KillAllOpposingMineStrikeRoundStatTracker(this), @@ -204,8 +206,6 @@ public class Minestrike extends TeamGame new ChatStatData("BoomHeadshot", "Headshots", true), Assists ); - - _gunModule = new GunModule(this); } @EventHandler @@ -313,6 +313,15 @@ public class Minestrike extends TeamGame public void giveTeamArmor(Player player, Color color) { + if (_shopManager.isDisabled()) + { + ItemStack armor = new ItemStack(Material.LEATHER_HELMET); + LeatherArmorMeta meta = (LeatherArmorMeta)armor.getItemMeta(); + meta.setColor(color); + armor.setItemMeta(meta); + player.getInventory().setHelmet(armor); + } + ItemStack armor = new ItemStack(Material.LEATHER_CHESTPLATE); LeatherArmorMeta meta = (LeatherArmorMeta)armor.getItemMeta(); meta.setColor(color); @@ -934,9 +943,13 @@ public class Minestrike extends TeamGame { player.playSound(player.getLocation(), Sound.HORSE_ARMOR, 1f, 2f); Manager.GetCondition().Factory().Blind("Respawn", player, null, 2, 0, false, false, false); - UtilPlayer.message(player, F.main("Game", "You have " + F.elem(C.cGreen + "$" + _shopManager.getMoney(player)) + ". Open your Inventory to spend it.")); + + if (!_shopManager.isDisabled()) + { + UtilPlayer.message(player, F.main("Game", "You have " + F.elem(C.cGreen + "$" + _shopManager.getMoney(player)) + ". Open your Inventory to spend it.")); - UtilTextMiddle.display(C.cGreen + "$" + _shopManager.getMoney(player), "Open your Inventory to buy new equipment", 10, 120, 10, player); + UtilTextMiddle.display(C.cGreen + "$" + _shopManager.getMoney(player), "Open your Inventory to buy new equipment", 10, 120, 10, player); + } } //Reset grenades @@ -1362,4 +1375,9 @@ public class Minestrike extends TeamGame { return _gunModule; } + + public ShopManager getShopManager() + { + return _shopManager; + } } \ No newline at end of file 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 972035245..98535da59 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 @@ -50,6 +50,8 @@ public class ShopManager private HashSet _inShop = new HashSet(); private Map _boughtGrenades = new HashMap<>(); + + private boolean _disabled; public ShopManager(Minestrike minestrike) { @@ -58,6 +60,9 @@ public class ShopManager public void enterShop(Player player) { + if (_disabled) + return; + GameTeam team = Host.GetTeam(player); if (team == null) return; @@ -174,6 +179,9 @@ public class ShopManager public int getMoney(Player player) { + if (_disabled) + return 0; + if (!_money.containsKey(player)) _money.put(player, 800); @@ -182,6 +190,9 @@ public class ShopManager public void addMoney(Player player, int amount, String reason) { + if (_disabled) + return; + _money.put(player, Math.min(16000, getMoney(player) + amount)); UtilPlayer.message(player, F.main("Game", "Received " + F.elem(C.cDGreen + "$" + amount) + " for " + reason + ".")); @@ -189,6 +200,9 @@ public class ShopManager public void inventoryClick(InventoryClickEvent event) { + if (_disabled) + return; + event.setCancelled(true); Player player = UtilPlayer.searchExact(event.getWhoClicked().getName()); @@ -282,6 +296,9 @@ public class ShopManager public void leaveShop(Player player, boolean showShopItem, boolean wipeMoney) { + if (_disabled) + return; + _shop.remove(player); _inShop.remove(player); @@ -310,7 +327,10 @@ public class ShopManager } public void update() - { + { + if (_disabled) + return; + for (Player player : Host.GetPlayers(false)) { GameTeam team = Host.GetTeam(player); @@ -345,8 +365,18 @@ public class ShopManager } } + public void setDisabled(boolean disabled) + { + _disabled = disabled; + } + public void resetGrenades() { _boughtGrenades.clear(); } + + public boolean isDisabled() + { + return _disabled; + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/modes/SuperPaintstrike.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/modes/SuperPaintstrike.java new file mode 100644 index 000000000..7318ef6a6 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/modes/SuperPaintstrike.java @@ -0,0 +1,657 @@ +package nautilus.game.arcade.game.games.minestrike.modes; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; + +import net.minecraft.server.v1_8_R3.PacketPlayOutEntityDestroy; + +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.Color; +import org.bukkit.Effect; +import org.bukkit.GameMode; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.block.Block; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; +import org.bukkit.entity.Arrow; +import org.bukkit.entity.EnderPearl; +import org.bukkit.entity.Player; +import org.bukkit.entity.Snowball; +import org.bukkit.entity.ThrownPotion; +import org.bukkit.event.Cancellable; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.event.entity.EntityRegainHealthEvent; +import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason; +import org.bukkit.event.entity.ProjectileHitEvent; +import org.bukkit.event.inventory.InventoryClickEvent; +import org.bukkit.event.player.PlayerInteractAtEntityEvent; +import org.bukkit.event.player.PlayerInteractEntityEvent; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.event.player.PlayerQuitEvent; +import org.bukkit.event.player.PlayerTeleportEvent; +import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.meta.LeatherArmorMeta; +import org.bukkit.potion.PotionEffect; +import org.bukkit.potion.PotionEffectType; +import org.bukkit.scoreboard.NameTagVisibility; +import org.bukkit.scoreboard.Team; +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.UtilBlock; +import mineplex.core.common.util.UtilEvent; +import mineplex.core.common.util.UtilEvent.ActionType; +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.common.util.UtilServer; +import mineplex.core.hologram.Hologram.HologramTarget; +import mineplex.core.recharge.Recharge; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.minecraft.game.core.condition.Condition.ConditionType; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; + +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.GameType; +import nautilus.game.arcade.events.GameStateChangeEvent; +import nautilus.game.arcade.events.PlayerKitGiveEvent; +import nautilus.game.arcade.events.PlayerPrepareTeleportEvent; +import nautilus.game.arcade.game.GameTeam; +import nautilus.game.arcade.game.GameTeam.PlayerState; +import nautilus.game.arcade.game.games.minestrike.Minestrike; +import nautilus.game.arcade.game.games.paintball.Paintball; +import nautilus.game.arcade.game.games.paintball.PlayerCopyPaintball; +import nautilus.game.arcade.game.games.paintball.events.PaintballEvent; +import nautilus.game.arcade.game.games.paintball.events.ReviveEvent; +import nautilus.game.arcade.game.games.paintball.kits.KitMachineGun; +import nautilus.game.arcade.game.games.paintball.kits.KitRifle; +import nautilus.game.arcade.game.games.paintball.kits.KitShotgun; +import nautilus.game.arcade.game.games.paintball.kits.KitSniper; +import nautilus.game.arcade.kit.Kit; + +/** + * SuperPaintstrike is a mode of {@link Minestrike} which implements {@link Paintball} kits + * + * @author xXVevzZXx + */ +public class SuperPaintstrike extends Minestrike +{ + private HashMap _doubles = new HashMap(); + + public SuperPaintstrike(ArcadeManager manager) + { + super(manager, new Kit[] + { + new KitRifle(manager), + new KitShotgun(manager), + new KitMachineGun(manager), + new KitSniper(manager), + + }, GameType.Brawl); + + getShopManager().setDisabled(true); + getGunModule().setDisableDamage(true); + getGunModule().setEnableCleaning(false); + } + + @Override + @EventHandler + public void giveStartEquipment(PlayerKitGiveEvent event) + { + GameTeam team = GetTeam(event.getPlayer()); + if (team == null) + return; + + if (team.GetColor() == ChatColor.RED) + { + if (IsAlive(event.getPlayer())) + { + //Armor + giveTeamArmor(event.getPlayer(), Color.RED); + } + } + else if (team.GetColor() == ChatColor.AQUA) + { + if (IsAlive(event.getPlayer())) + { + //Armor + giveTeamArmor(event.getPlayer(), Color.AQUA); + } + } + } + + @EventHandler + public void onHeal(PlayerInteractEvent event) + { + if (!UtilEvent.isAction(event, ActionType.R)) + return; + + LaunchPotion(event.getPlayer(), event); + } + + @EventHandler + public void onHeal(PlayerInteractEntityEvent event) + { + LaunchPotion(event.getPlayer(), event); + } + + @EventHandler(ignoreCancelled = false) + public void onHeal(PlayerInteractAtEntityEvent event) + { + LaunchPotion(event.getPlayer(), event); + } + + public void LaunchPotion(Player player, Cancellable event) + { + if (!IsLive()) + return; + + if (!UtilGear.isMat(player.getItemInHand(), Material.POTION)) + return; + + event.setCancelled(true); + + if (!IsAlive(player) || UtilPlayer.isSpectator(player)) + return; + + if (!Recharge.Instance.use(player, "Water Potion", 250, false, false)) + return; + + UtilInv.UseItemInHand(player); + + ThrownPotion potion = player.launchProjectile(ThrownPotion.class); + potion.getEffects().clear(); + potion.getEffects().add(new PotionEffect(PotionEffectType.WATER_BREATHING, 100, 100)); + + Manager.runAsync(new Runnable() + { + @Override + public void run() + { + UtilInv.Update(player); + } + }); + } + + @EventHandler + public void removePotionEffect(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + for (Player player : GetPlayers(true)) + player.removePotionEffect(PotionEffectType.WATER_BREATHING); + } + + public void cleanColorArmor(Player player) + { + Color color = Color.RED; + if (Manager.GetColor(player) != ChatColor.RED) + color = Color.AQUA; + + for (ItemStack stack : player.getEquipment().getArmorContents()) + { + if (!(stack.getItemMeta() instanceof LeatherArmorMeta)) + continue; + + LeatherArmorMeta meta = (LeatherArmorMeta)stack.getItemMeta(); + meta.setColor(color); + stack.setItemMeta(meta); + } + } + + @EventHandler + public void cleanHit(ProjectileHitEvent event) + { + if (!IsLive()) + return; + + if (!(event.getEntity() instanceof ThrownPotion)) + return; + + if (event.getEntity().getShooter() == null) + return; + + if (!(event.getEntity().getShooter() instanceof Player)) + return; + + Player thrower = (Player)event.getEntity().getShooter(); + if (!IsAlive(thrower)) + return; + + GameTeam throwerTeam = GetTeam(thrower); + if (throwerTeam == null) return; + + //Revive + Iterator copyIterator = _doubles.values().iterator(); + while (copyIterator.hasNext()) + { + PlayerCopyPaintball copy = copyIterator.next(); + + GameTeam otherTeam = GetTeam(copy.GetPlayer()); + if (otherTeam == null || !otherTeam.equals(throwerTeam)) + continue; + + if (UtilMath.offset(copy.GetEntity().getLocation().add(0,1,0), event.getEntity().getLocation()) > 3) + continue; + + playerIn(copy.GetPlayer(), copy); + + copyIterator.remove(); + + AddGems(thrower, 3, "Revived Ally", true, true); + + Bukkit.getPluginManager().callEvent(new ReviveEvent(thrower, copy.GetPlayer())); + } + + //Clean + for (Player player : GetPlayers(true)) + { + GameTeam otherTeam = GetTeam(player); + if (otherTeam == null || !otherTeam.equals(throwerTeam)) + continue; + + if (UtilMath.offset(player.getLocation().add(0,1,0), event.getEntity().getLocation()) > 3) + continue; + + playerIn(player, null); + } + } + + public void playerIn(final Player player, final PlayerCopyPaintball copy) + { + //State + SetPlayerState(player, PlayerState.IN); + player.setHealth(20); + + //Teleport + if (copy != null) + { + Location loc = player.getLocation(); + loc.setX(copy.GetEntity().getLocation().getX()); + loc.setY(copy.GetEntity().getLocation().getY()); + loc.setZ(copy.GetEntity().getLocation().getZ()); + player.teleport(loc); + } + + //Settings + if (player.getGameMode() == GameMode.SPECTATOR) + player.setSpectatorTarget(null); + + player.setGameMode(GameMode.SURVIVAL); + player.setAllowFlight(false); + player.setFlying(false); + ((CraftPlayer)player).getHandle().spectating = false; + ((CraftPlayer)player).getHandle().k = true; + + //Items + player.getInventory().remove(Material.WATCH); + player.getInventory().remove(Material.COMPASS); + + //Clean Armor + cleanColorArmor(player); + + //Inform + UtilPlayer.message(player, F.main("Game", "You have been cleaned!")); + + //Delayed Visibility + if (copy != null) + { + UtilServer.getServer().getScheduler().scheduleSyncDelayedTask(Manager.getPlugin(), new Runnable() + { + public void run() + { + //Remove Invis + if (IsAlive(player)) + Manager.GetCondition().EndCondition(player, ConditionType.CLOAK, null); + + //Remove Copy + copy.GetEntity().remove(); + copy.GetHolo().stop(); + copy.GetSaveMe().stop(); + } + }, 4); + } + } + + @EventHandler + public void updateCloneHolograms(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + return; + + for (PlayerCopyPaintball clone : _doubles.values()) + { + if (clone.GetHolo().getHologramTarget() == HologramTarget.WHITELIST) + { + //Other team blacklist + clone.GetHolo().setHologramTarget(HologramTarget.BLACKLIST); + + for (Player cur : GetPlayers(false)) + { + if (!IsAlive(cur)) + { + if (clone.GetHolo().containsPlayer(cur)) + clone.GetHolo().removePlayer(cur); + } + } + clone.GetHolo().start(); + } + + clone.setSaveMeFlop(!clone.getSaveMeFlop()); + clone.GetSaveMe().setText((clone.getSaveMeFlop() ? C.cRedB : C.cWhiteB) + "SAVE ME!"); + + for (Player player : GetTeam(clone.GetPlayer()).GetPlayers(false)) + { + if (!IsAlive(player)) // Remove if it's not alive + { + if (clone.GetSaveMe().containsPlayer(player)) + clone.GetSaveMe().removePlayer(player); + } + else + { + boolean hasPotion = UtilInv.contains(player, Material.POTION, (byte) -1, 1); + if (clone.GetSaveMe().containsPlayer(player)) + { + if (!hasPotion) // No potions left + { + clone.GetSaveMe().removePlayer(player); + } + } + else if (hasPotion) + { + clone.GetSaveMe().addPlayer(player); + } + } + } + } + } + + @EventHandler + public void CustomTeamGeneration(GameStateChangeEvent event) + { + if (event.GetState() != GameState.Recruit) + return; + + this.GetTeamList().get(0).SetColor(ChatColor.AQUA); + this.GetTeamList().get(0).SetName("Frost"); + + this.GetTeamList().get(1).SetColor(ChatColor.RED); + this.GetTeamList().get(1).SetName("Nether"); + } + + @EventHandler + public void onNameTag(GameStateChangeEvent event) + { + if (event.GetState() == GameState.Prepare) + for (Team team : Scoreboard.getScoreboard().getTeams()) + team.setNameTagVisibility(NameTagVisibility.HIDE_FOR_OTHER_TEAMS); + } + + @EventHandler(priority = EventPriority.HIGHEST) + public void colorArmor(PlayerPrepareTeleportEvent event) + { + cleanColorArmor(event.GetPlayer()); + } + + @EventHandler + public void healthRegen(EntityRegainHealthEvent event) + { + if (event.getRegainReason() == RegainReason.SATIATED) + event.setCancelled(true); + } + + @EventHandler + public void teleport(PlayerTeleportEvent event) + { + if (event.getCause() == TeleportCause.ENDER_PEARL) + event.setCancelled(true); + } + + @SuppressWarnings("deprecation") + @EventHandler + public void paint(final ProjectileHitEvent event) + { + if (IsLive() || GetState() == GameState.End) + { + if (event.getEntity() instanceof ThrownPotion) + return; + + final byte color = (byte) (event.getEntity() instanceof EnderPearl || (event.getEntity() instanceof Arrow && event.getEntity().hasMetadata("color") && ChatColor.values()[event.getEntity().getMetadata("color").get(0).asInt()] == ChatColor.RED) ? 14 : 3); + + event.getEntity().setVelocity(event.getEntity().getVelocity().normalize().multiply(1.2)); + + PacketPlayOutEntityDestroy destroy = new PacketPlayOutEntityDestroy(new int[]{event.getEntity().getEntityId()}); + for (Player player : UtilServer.getPlayers()) + UtilPlayer.sendPacket(player, destroy); + + Manager.runSyncLater(new Runnable() // Stupid thing I have to do to make sure the arrow's location is accounted for. Stupid mojang. - Myst + { + @Override + public void run() + { + Location loc = event.getEntity().getLocation(); + // loc.add(event.getEntity().getVelocity().clone().normalize().multiply(.5)); + + for (Block block : UtilBlock.getInRadius(loc, 1.5d).keySet()) + { + if (block.getType() != Material.WOOL && block.getType() != Material.STAINED_CLAY && block.getType() != Material.HARD_CLAY) + continue; + + if (block.getType() == Material.HARD_CLAY) + block.setType(Material.STAINED_CLAY); + + block.setData(color); + } + + if (color == 3) loc.getWorld().playEffect(loc, Effect.STEP_SOUND, 8); + else loc.getWorld().playEffect(loc, Effect.STEP_SOUND, 10); + + event.getEntity().remove(); + } + }, 0); + } + } + + @EventHandler + public void onQuit(PlayerQuitEvent event) + { + Player player = event.getPlayer(); + + if (_doubles.containsKey(player)) + { + PlayerCopyPaintball copy = _doubles.remove(player); + copy.GetEntity().remove(); + copy.GetHolo().stop(); + copy.GetSaveMe().stop(); + } + } + + @EventHandler + public void damageCancel(CustomDamageEvent event) + { + if (event.GetDamageePlayer() == null) + event.SetCancelled("Not Player"); + + // Fixed void damage being blocked from this check. + + if (event.GetProjectile() == null && event.GetCause() != DamageCause.VOID) + event.SetCancelled("No Projectile"); + } + + @EventHandler(priority = EventPriority.LOW) + public void paintballDamage(CustomDamageEvent event) + { + if (!IsLive()) + return; + + if (event.GetProjectile() == null) + return; + + if (!(event.GetProjectile() instanceof Snowball) && !(event.GetProjectile() instanceof EnderPearl) && !(event.GetProjectile() instanceof Arrow)) + return; + + //Negate + + event.AddMod("Negate", "Negate", -event.GetDamageInitial(), false); + + event.AddMod("Paintball", "Paintball", 2, true); + event.AddKnockback("Paintball", 2); + + event.setShowArrows(false); + + Player damagee = event.GetDamageePlayer(); + if (damagee == null) + return; + + Player damager = event.GetDamagerPlayer(true); + if (damager == null) + return; + + GameTeam damageeTeam = GetTeam(damagee); + if (damageeTeam == null) + return; + + GameTeam damagerTeam = GetTeam(damager); + if (damagerTeam == null) + return; + + if (damagerTeam.equals(damageeTeam)) + return; + + //Count + int count = 1; + if (GetKit(damager) != null) + { + if (GetKit(damager) instanceof KitRifle) + { + count = 3; + } + if (GetKit(damager) instanceof KitSniper && event.GetProjectile() instanceof Arrow) + { + count = ((KitSniper) GetKit(damager)).getPaintDamage((Arrow) event.GetProjectile()); + + if (count == -1) + count = 1; + } + } + + //Out + if (color(damagee, count)) + { + for (Player player : UtilServer.getPlayers()) + UtilPlayer.message(player, damageeTeam.GetColor() + damagee.getName() + ChatColor.RESET + " was painted by " + + damagerTeam.GetColor() + damager.getName() + ChatColor.RESET + "!"); + + playerOut(damagee, damager); + + AddGems(damager, 2, "Kills", true, true); + + AddStat(damager, "Kills", 1, false, false); + AddStat(damagee, "Deaths", 1, false, false); + + Bukkit.getPluginManager().callEvent(new PaintballEvent(damagee, damager)); + } + + //Hit Sound + Player player = event.GetDamagerPlayer(true); + if (player != null) + player.playSound(player.getLocation(), Sound.ORB_PICKUP, 1f, 3f); + } + + @EventHandler + public void armorRemoveCancel(InventoryClickEvent event) + { + if (IsLive()) + event.setCancelled(true); + } + + public boolean color(Player player, int amount) + { + //Get Non-Coloured + ArrayList nonColored = new ArrayList(); + for (ItemStack stack : player.getInventory().getArmorContents()) + { + if (!(stack.getItemMeta() instanceof LeatherArmorMeta)) + continue; + + LeatherArmorMeta meta = (LeatherArmorMeta)stack.getItemMeta(); + + if (meta.getColor().equals(Color.RED) || meta.getColor().equals(Color.AQUA)) + nonColored.add(stack); + } + + //Color Piece + for (int i=0 ; i copyIterator = _doubles.values().iterator(); + while (copyIterator.hasNext()) + { + PlayerCopyPaintball copy = copyIterator.next(); + + copy.GetEntity().remove(); + copy.GetHolo().stop(); + copy.GetSaveMe().stop(); + + copyIterator.remove(); + } + } + + @Override + public String GetMode() + { + return "Super Paintstrike"; + } + +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/modes/UltimateOITQ.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/modes/UltimateOITQ.java new file mode 100644 index 000000000..86722cffa --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/modes/UltimateOITQ.java @@ -0,0 +1,81 @@ +package nautilus.game.arcade.game.games.quiver.modes; + +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.inventory.ItemStack; + +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.game.games.quiver.Quiver; +import nautilus.game.arcade.game.games.quiver.QuiverTeamBase; +import nautilus.game.arcade.game.games.quiver.kits.KitBarrage; +import nautilus.game.arcade.game.games.quiver.kits.KitBeserker; +import nautilus.game.arcade.game.games.quiver.kits.KitNecromancer; +import nautilus.game.arcade.game.games.quiver.kits.KitNewNinja; +import nautilus.game.arcade.game.games.quiver.kits.KitPyromancer; +import nautilus.game.arcade.game.games.quiver.kits.KitSkyWarrior; +import nautilus.game.arcade.game.games.quiver.modes.module.ModuleStandaloneUltimate; +import nautilus.game.arcade.kit.Kit; + +/** + * UltimateOITQ is a mode of {@link Quiver} which implements the ultimate kits from {@link QuiverTeamBase} + * + * @author xXVevzZXx + */ +public class UltimateOITQ extends Quiver +{ + + public UltimateOITQ(ArcadeManager manager) + { + super(manager, new Kit[] + { + new KitBeserker(manager), + new KitNewNinja(manager), + new KitBarrage(manager), + new KitSkyWarrior(manager), + new KitPyromancer(manager), + new KitNecromancer(manager) + }, GameType.Brawl); + + registerModule(new ModuleStandaloneUltimate(30F)); + } + + @EventHandler + public void clearArmor(UpdateEvent event) + { + if (!IsLive()) + return; + + if (Manager.GetGame() == null) + return; + + if (event.getType() != UpdateType.FASTER) + return; + + for (Player player : GetPlayers(true)) + { + if (player.getInventory().getBoots() != null && player.getInventory().getBoots().getType() == Material.LEATHER_BOOTS) + player.getInventory().setBoots(null); + + if (player.getInventory().getLeggings() != null && player.getInventory().getLeggings().getType() == Material.LEATHER_LEGGINGS) + player.getInventory().setLeggings(null); + + if (player.getInventory().getChestplate() != null && player.getInventory().getChestplate().getType() == Material.LEATHER_CHESTPLATE) + player.getInventory().setChestplate(null); + + if (player.getInventory().getHelmet() != null && player.getInventory().getHelmet().getType() == Material.LEATHER_HELMET) + player.getInventory().setHelmet(null); + } + } + + @Override + public String GetMode() + { + return "Ultimate OITQ"; + } + +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/modes/module/ModuleStandaloneUltimate.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/modes/module/ModuleStandaloneUltimate.java new file mode 100644 index 000000000..e32953d3f --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/modes/module/ModuleStandaloneUltimate.java @@ -0,0 +1,247 @@ +package nautilus.game.arcade.game.games.quiver.modes.module; + +import java.text.DecimalFormat; +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.player.PlayerToggleSneakEvent; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilTextBottom; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.minecraft.game.core.combat.CombatComponent; +import mineplex.minecraft.game.core.combat.event.CombatDeathEvent; + +import nautilus.game.arcade.game.games.quiver.QuiverTeamBase; +import nautilus.game.arcade.game.games.quiver.module.ModuleUltimate; +import nautilus.game.arcade.game.games.quiver.ultimates.UltimatePerk; +import nautilus.game.arcade.game.modules.Module; +import nautilus.game.arcade.kit.Kit; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.ProgressingKit; + +/** + * Stanalone version of the QuiverTeamBase Module {@link ModuleUltimate} + * This needed to be done because the {@link QuiverTeamBase} Module + * is made for QuiverTeamBase only + * + * @author xXVevzZXx + */ +public class ModuleStandaloneUltimate extends Module +{ + private static final int ULTIMATE_PERCENTAGE_INCREASE_KILL = 5; + private static final int ULTIMATE_PERCENTAGE_INCREASE_ASSIST = 2; + + private float _percentage; + + private Map _ultimatePercentage = new HashMap<>(); + + private boolean _colouredMessage; + + public ModuleStandaloneUltimate(float percentage) + { + _percentage = percentage; + } + + @EventHandler + public void update(UpdateEvent event) + { + if (event.getType() != UpdateType.SEC) + { + return; + } + + _colouredMessage = !_colouredMessage; + + for (Player player : getGame().GetPlayers(true)) + { + Kit kit = getGame().GetKit(player); + + if (kit == null || UtilPlayer.isSpectator(player)) + { + continue; + } + + if (!_ultimatePercentage.containsKey(player.getUniqueId())) + { + _ultimatePercentage.put(player.getUniqueId(), 0F); + } + + double percentage = _ultimatePercentage.get(player.getUniqueId()); + + if (percentage >= _percentage) + { + UtilTextBottom.display((_colouredMessage ? C.cWhiteB : C.cAquaB) + "ULTIMATE READY (PRESS SNEAK)", player); + player.setExp(0.999F); + player.setLevel(100); + continue; + } + + String percentageFormatted = new DecimalFormat("0.0").format(percentage/_percentage*100); + + UtilTextBottom.displayProgress("Ultimate", percentage / _percentage, percentageFormatted + "%", player); + player.setExp((float) percentage / _percentage); + player.setLevel((int) Math.round(percentage/_percentage*100)); + + for (Perk perk : kit.GetPerks()) + { + if (perk instanceof UltimatePerk) + { + UltimatePerk ultimate = (UltimatePerk) perk; + + if (ultimate.isUsingUltimate(player)) + { + continue; + } + + incrementUltimate(player, ultimate.getChargePassive()); + } + } + } + } + + @EventHandler + public void onCombatDeath(CombatDeathEvent event) + { + if (event.GetEvent().getEntity() == null || event.GetLog().GetKiller() == null) + { + return; + } + + if (!(event.GetEvent().getEntity() instanceof Player)) + { + return; + } + + Player player = UtilPlayer.searchExact(event.GetLog().GetKiller().GetName()); + + if (player == null) + { + return; + } + + incrementUltimate(player, ULTIMATE_PERCENTAGE_INCREASE_KILL); + + for (CombatComponent combatComponent : event.GetLog().GetAttackers()) + { + if (event.GetLog().GetKiller() != null && combatComponent.equals(event.GetLog().GetKiller())) + { + continue; + } + + if (combatComponent.IsPlayer()) + { + Player assitedPlayer = UtilPlayer.searchExact(event.GetLog().GetKiller().GetName()); + + if (assitedPlayer != null) + { + incrementUltimate(assitedPlayer, ULTIMATE_PERCENTAGE_INCREASE_ASSIST); + } + } + } + } + + public void incrementUltimate(Player player, float percentage) + { + ProgressingKit kit = (ProgressingKit) getGame().GetKit(player); + + for (Perk perk : kit.getPerks()[kit.getUpgradeLevel(player.getUniqueId())]) + { + if (perk instanceof UltimatePerk) + { + UltimatePerk ultimate = (UltimatePerk) perk; + + if (ultimate.isUsingUltimate(player)) + { + return; + } + } + } + + _ultimatePercentage.put(player.getUniqueId(), _ultimatePercentage.get(player.getUniqueId()) + percentage); + } + + public void resetUltimate(Player player, boolean inform) + { + if (inform) + { + player.sendMessage(F.main("Game", "Your Ultimate charge has been reset!")); + } + + _ultimatePercentage.put(player.getUniqueId(), 0F); + } + + @EventHandler + public void onPlayerToggleSneak(PlayerToggleSneakEvent event) + { + if (!getGame().IsLive()) + { + return; + } + + Player player = event.getPlayer(); + ProgressingKit kit = (ProgressingKit) getGame().GetKit(player); + + if (!event.isSneaking()) + { + return; + } + + if (kit == null || UtilPlayer.isSpectator(player)) + { + return; + } + + if (_ultimatePercentage.get(player.getUniqueId()) < _percentage) + { + return; + } + + for (Perk perk : kit.getPerks()[kit.getUpgradeLevel(player.getUniqueId())]) + { + if (perk instanceof UltimatePerk) + { + UltimatePerk ultimate = (UltimatePerk) perk; + + if (ultimate.isUsable(player)) + { + ultimate.activate(player); + resetUltimate(player, false); + } + } + } + } + + @Override + public void cleanup() + { + UtilServer.Unregister(this); + + for (UUID uuid : _ultimatePercentage.keySet()) + { + Player player = UtilPlayer.searchExact(uuid); + + for (Perk perk : getGame().GetKit(player).GetPerks()) + { + if (!(perk instanceof UltimatePerk)) + { + continue; + } + + UltimatePerk ultimate = (UltimatePerk) perk; + + if (ultimate.isUsingUltimate(player)) + { + ultimate.cancel(player); + } + } + } + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/ultimates/UltimateNecromancer.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/ultimates/UltimateNecromancer.java index 4ef413fe2..af94f966a 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/ultimates/UltimateNecromancer.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/ultimates/UltimateNecromancer.java @@ -1,5 +1,6 @@ package nautilus.game.arcade.game.games.quiver.ultimates; +import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; import java.util.Map; @@ -122,7 +123,13 @@ public class UltimateNecromancer extends UltimatePerk entities.add(livingEntity); UtilParticle.PlayParticleToAll(ParticleType.LARGE_SMOKE, livingEntity.getEyeLocation(), 1F, 1F, 1F, 0.1F, 20, ViewDist.NORMAL); - ((Creature) livingEntity).setTarget(UtilPlayer.getClosest(livingEntity.getLocation(), Manager.GetGame().GetTeam(player).GetPlayers(true))); + ArrayList players = Manager.GetGame().GetTeam(player).GetPlayers(true); + if (Manager.GetGame().GetTeamList().size() == 1) + { + players.clear(); + players.add(player); + } + ((Creature) livingEntity).setTarget(UtilPlayer.getClosest(livingEntity.getLocation(), players)); } Manager.GetGame().CreatureAllowOverride = false; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sheep/SheepGame.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sheep/SheepGame.java index 5274a0fc1..4cfcbd4cc 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sheep/SheepGame.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sheep/SheepGame.java @@ -4,16 +4,15 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; -import mineplex.core.common.Pair; import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.Color; import org.bukkit.Effect; import org.bukkit.FireworkEffect; +import org.bukkit.FireworkEffect.Type; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.Sound; -import org.bukkit.FireworkEffect.Type; import org.bukkit.block.Block; import org.bukkit.entity.Entity; import org.bukkit.entity.LivingEntity; @@ -22,37 +21,41 @@ import org.bukkit.entity.Sheep; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.HandlerList; -import org.bukkit.event.entity.PlayerDeathEvent; import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.event.entity.PlayerDeathEvent; import org.bukkit.event.player.PlayerDropItemEvent; import org.bukkit.event.player.PlayerEvent; import org.bukkit.event.player.PlayerInteractEntityEvent; import org.bukkit.event.player.PlayerItemHeldEvent; +import mineplex.core.common.Pair; import mineplex.core.common.util.C; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilAlg; import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilFirework; import mineplex.core.common.util.UtilGear; import mineplex.core.common.util.UtilInv; -import mineplex.core.common.util.UtilFirework; import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilTextTop; import mineplex.core.common.util.UtilTime; -import mineplex.minecraft.game.core.condition.Condition.ConditionType; 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.condition.Condition.ConditionType; import mineplex.minecraft.game.core.damage.CustomDamageEvent; + 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.game.GameTeam; import nautilus.game.arcade.game.TeamGame; -import nautilus.game.arcade.game.games.sheep.kits.*; +import nautilus.game.arcade.game.games.sheep.kits.KitArcher; +import nautilus.game.arcade.game.games.sheep.kits.KitBeserker; +import nautilus.game.arcade.game.games.sheep.kits.KitBrute; import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.managers.chat.ChatStatData; import nautilus.game.arcade.stats.SheepDropStatTracker; @@ -149,6 +152,16 @@ public class SheepGame extends TeamGame ); } + public SheepGame(ArcadeManager manager, GameType type) + { + this(manager, new Kit[] + { + new KitBeserker(manager), + new KitArcher(manager), + new KitBrute(manager) + }, type); + } + public SheepGame(ArcadeManager manager, Kit[] kits, GameType type) { super(manager, type, kits, @@ -752,6 +765,11 @@ public class SheepGame extends TeamGame { event.SetCancelled("True"); }*/ + + public void setSheepDelay(long delay) + { + _sheepDelay = delay; + } public int getSheepCount(GameTeam team) { @@ -765,4 +783,19 @@ public class SheepGame extends TeamGame return score; } + + public HashMap> getSheepPens() + { + return _sheepPens; + } + + public long getGameTime() + { + return _gameTime; + } + + public HashMap getTeamScores() + { + return _teamScore; + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sheep/modes/SheepMania.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sheep/modes/SheepMania.java new file mode 100644 index 000000000..13492b04f --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sheep/modes/SheepMania.java @@ -0,0 +1,77 @@ +package nautilus.game.arcade.game.games.sheep.modes; + +import org.bukkit.event.EventHandler; + +import mineplex.core.common.Pair; +import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilTime; +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.games.sheep.SheepGame; + +/** + * SheepMania is a mode of {@link SheepGame} in which only one Sheep will spawn + * + * @author xXVevzZXx + */ +public class SheepMania extends SheepGame +{ + + public SheepMania(ArcadeManager manager) + { + super(manager, GameType.Brawl); + + setSheepDelay(GameTimeout); + } + + @Override + @EventHandler + public void ScoreboardUpdate(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + return; + + if (!InProgress()) + return; + + Scoreboard.reset(); + Scoreboard.writeNewLine(); + + Scoreboard.writeGroup(getSheepPens().keySet(), team -> + { + getTeamScores().put(team, getSheepCount(team)); + return Pair.create(team.GetColor() + team.GetName(), getSheepCount(team)); + }, true); + + if (!IsLive()) + return; + + long time = getGameTime() + - (System.currentTimeMillis() - this.GetStateTime()); + + Scoreboard.writeNewLine(); + Scoreboard.write(C.cYellow + C.Bold + "Time Left"); + Scoreboard.write(UtilTime.MakeStr(Math.max(0, time), 0)); + + Scoreboard.draw(); + } + + @Override + @EventHandler + public void SheepSpawnStart(GameStateChangeEvent event) + { + if (event.GetState() == GameState.Live) + SheepSpawn(); + } + + @Override + public String GetMode() + { + return "Sheep Mania"; + } + +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skyfall/BoosterRing.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skyfall/BoosterRing.java index 2778cd34d..0dbd22383 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skyfall/BoosterRing.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skyfall/BoosterRing.java @@ -27,6 +27,7 @@ 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.events.GameStateChangeEvent; import nautilus.game.arcade.game.Game; import nautilus.game.arcade.game.Game.GameState; @@ -353,7 +354,12 @@ public class BoosterRing extends Crumbleable implements Listener if (i >= _sortedBorder.size()) return; - _sortedBorder.get(i).getBlock().setTypeIdAndData(_material.getType().getId(), _material.getData().getData(), true); + Block block = _sortedBorder.get(i).getBlock(); + + if (block.getType() == _material.getType() && block.getData() == _material.getData().getData()) + continue; + + block.setTypeIdAndData(_material.getType().getId(), _material.getData().getData(), true); } } @@ -469,6 +475,11 @@ public class BoosterRing extends Crumbleable implements Listener return false; } + public Material getType() + { + return _material.getType(); + } + @Override public void crumbledAway() { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skyfall/HomingArrow.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skyfall/HomingArrow.java index 4018a7c90..9131c9c0e 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skyfall/HomingArrow.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skyfall/HomingArrow.java @@ -68,6 +68,9 @@ public class HomingArrow { if (_shooter == player) continue; + + if (_host.TeamMode && _host.GetTeam(_shooter) == _host.GetTeam(player)) + continue; if (!UtilPlayer.isGliding(player)) continue; @@ -111,6 +114,7 @@ public class HomingArrow arrowToPlayer.multiply(1.9); UtilAction.velocity(_arrow, arrowToPlayer); + if (_updates % firework == 0) UtilFirework.playFirework(_arrow.getLocation(), Type.BALL, Color.RED, true, false); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skyfall/LootTable.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skyfall/LootTable.java index b4c15a185..5958180b9 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skyfall/LootTable.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skyfall/LootTable.java @@ -25,30 +25,30 @@ public class LootTable new RandomItem(Material.PORK, 30, 1, 4), new RandomItem(Material.ROTTEN_FLESH, 40, 1, 6), - new RandomItem(Material.WOOD_AXE, 80), - new RandomItem(Material.WOOD_SWORD, 70), - new RandomItem(Material.STONE_AXE, 60), - new RandomItem(Material.STONE_SWORD, 30), + new RandomItem(Material.WOOD_AXE, 100), + new RandomItem(Material.WOOD_SWORD, 80), + new RandomItem(Material.STONE_AXE, 70), + new RandomItem(Material.STONE_SWORD, 50), + new RandomItem(Material.IRON_AXE, 40), - new RandomItem(Material.LEATHER_BOOTS, 30), - new RandomItem(Material.LEATHER_HELMET, 30), - new RandomItem(Material.LEATHER_LEGGINGS, 30), + new RandomItem(Material.LEATHER_BOOTS, 40), + new RandomItem(Material.LEATHER_HELMET, 40), + new RandomItem(Material.LEATHER_LEGGINGS, 40), - new RandomItem(Material.GOLD_BOOTS, 25), - new RandomItem(Material.GOLD_HELMET, 25), - new RandomItem(Material.GOLD_LEGGINGS, 25), + new RandomItem(Material.GOLD_BOOTS, 35), + new RandomItem(Material.GOLD_HELMET, 35), + new RandomItem(Material.GOLD_LEGGINGS, 35), - new RandomItem(Material.CHAINMAIL_BOOTS, 20), - new RandomItem(Material.CHAINMAIL_HELMET, 20), - new RandomItem(Material.CHAINMAIL_LEGGINGS, 20), + new RandomItem(Material.CHAINMAIL_BOOTS, 30), + new RandomItem(Material.CHAINMAIL_HELMET, 30), + new RandomItem(Material.CHAINMAIL_LEGGINGS, 30), new RandomItem(Material.FISHING_ROD, 30), - new RandomItem(Material.BOW, 20), - new RandomItem(Material.ARROW, 20, 1, 3), + new RandomItem(Material.BOW, 50), + new RandomItem(Material.ARROW, 50, 1, 3), new RandomItem(Material.SNOW_BALL, 30, 1, 2), new RandomItem(Material.EGG, 30, 1, 2), - new RandomItem(Material.COMPASS, 20), new RandomItem(Material.STICK, 30, 1, 2), new RandomItem(Material.FLINT, 30, 1, 2), new RandomItem(Material.FEATHER, 30, 1, 2), @@ -57,33 +57,26 @@ public class LootTable Material.TNT, (byte) 0, 1, F.item("Throwing TNT")), 15), new RandomItem(Material.MUSHROOM_SOUP, 15), - new RandomItem(Material.BAKED_POTATO, 30, 1, 5), - new RandomItem(Material.MUSHROOM_SOUP, 30, 1, 1), + new RandomItem(Material.BAKED_POTATO, 20, 1, 5), + new RandomItem(Material.MUSHROOM_SOUP, 20, 1, 1), new RandomItem(Material.COOKED_BEEF, 30, 1, 3), new RandomItem(Material.COOKED_CHICKEN, 30, 1, 3), new RandomItem(Material.COOKED_FISH, 30, 1, 6), - new RandomItem(Material.GRILLED_PORK, 30, 1, 3), + new RandomItem(Material.GRILLED_PORK, 20, 1, 3), new RandomItem(Material.COOKIE, 30), - new RandomItem(Material.PUMPKIN_PIE, 30, 1, 3), - new RandomItem(Material.APPLE, 30, 2, 6), + new RandomItem(Material.PUMPKIN_PIE, 20, 1, 3), + new RandomItem(Material.APPLE, 20, 2, 6), - new RandomItem(Material.STONE_SWORD, 30), - new RandomItem(Material.IRON_AXE, 30), new RandomItem(Material.IRON_INGOT, 30, 1, 2), new RandomItem(Material.DIAMOND, 30) ); - public final static LootTable SUPPLY_DROP = new LootTable( - new RandomItem(Material.DIAMOND_HELMET, 10), - new RandomItem(Material.DIAMOND_LEGGINGS, 8), - new RandomItem(Material.DIAMOND_BOOTS, 10), - - new RandomItem(Material.IRON_HELMET, 30), - new RandomItem(Material.IRON_LEGGINGS, 27), - new RandomItem(Material.IRON_BOOTS, 30), - new RandomItem(Material.IRON_SWORD, 24), - new RandomItem(Material.DIAMOND_SWORD, 8), - new RandomItem(Material.DIAMOND_AXE, 16) + public final static LootTable SUPPLY_DROP = new LootTable( + new RandomItem(Material.DIAMOND_HELMET, 30), + new RandomItem(Material.DIAMOND_LEGGINGS, 27), + new RandomItem(Material.DIAMOND_BOOTS, 30), + new RandomItem(Material.DIAMOND_SWORD, 16), + new RandomItem(Material.DIAMOND_AXE, 24) // new RandomItem(ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD, 1, Enchantment.DAMAGE_ALL), 8), // new RandomItem(ItemStackFactory.Instance.CreateStack(Material.DIAMOND_SWORD, 1, Enchantment.DAMAGE_ALL), 4), // diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skyfall/Skyfall.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skyfall/Skyfall.java index a4fd60d67..fea965ebd 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skyfall/Skyfall.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skyfall/Skyfall.java @@ -8,11 +8,8 @@ import java.util.Iterator; import java.util.TreeMap; import java.util.UUID; -import com.mineplex.anticheat.checks.move.Glide; -import com.mineplex.anticheat.checks.move.HeadRoll; -import com.mineplex.anticheat.checks.move.Speed; -import mineplex.core.Managers; -import mineplex.core.antihack.AntiHack; +import net.md_5.bungee.api.ChatColor; + import org.bukkit.Color; import org.bukkit.FireworkEffect; import org.bukkit.FireworkEffect.Type; @@ -36,7 +33,14 @@ import org.bukkit.event.inventory.InventoryClickEvent; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerMoveEvent; import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.meta.ItemMeta; +import com.mineplex.anticheat.checks.move.Glide; +import com.mineplex.anticheat.checks.move.HeadRoll; +import com.mineplex.anticheat.checks.move.Speed; + +import mineplex.core.Managers; +import mineplex.core.antihack.AntiHack; import mineplex.core.common.MinecraftVersion; import mineplex.core.common.util.C; import mineplex.core.common.util.F; @@ -54,18 +58,16 @@ 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.common.util.UtilTime.TimeUnit; 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.ArcadeManager; import nautilus.game.arcade.GameType; import nautilus.game.arcade.events.GameStateChangeEvent; -import nautilus.game.arcade.game.GameTeam; -import nautilus.game.arcade.game.SoloGame; +import nautilus.game.arcade.game.Game; import nautilus.game.arcade.game.games.skyfall.kits.KitAeronaught; -import nautilus.game.arcade.game.games.skyfall.kits.KitBooster; import nautilus.game.arcade.game.games.skyfall.kits.KitDeadeye; import nautilus.game.arcade.game.games.skyfall.kits.KitJouster; import nautilus.game.arcade.game.games.skyfall.kits.KitSpeeder; @@ -79,17 +81,16 @@ import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.stats.FirstSupplyDropOpenStatTracker; import nautilus.game.arcade.stats.KillsWithinTimeLimitStatTracker; import nautilus.game.arcade.stats.WinWithoutWearingArmorStatTracker; -import net.md_5.bungee.api.ChatColor; /** * GameObject of the game Skyfall * * @author xXVevzZXx */ -public class Skyfall extends SoloGame +public abstract class Skyfall extends Game { private static final long MAP_CRUMBLE_DELAY = 1000*30; // 30 Seconds - private static final long CHEST_REFILL_TIME = 1000*60*6; // 5 minutes + private static final long CHEST_REFILL_TIME = 1000*60*3; // 3 minutes private static final long CHEST_REFILL_ANNOUNCE_TIME = 1000*60*3; // 3 minutes private static final int BIG_ISLAND_BOUNDS = 30; private static final int BIG_ISLAND_HEIGHT = 40; @@ -103,9 +104,11 @@ public class Skyfall extends SoloGame private static final long BOOSTER_COOLDOWN_TIME = 1000*20; // 20 Seconds - private static final long SUPPLY_DROP_TIME = 1000*60*4; // 5 Minutes + private static final long SUPPLY_DROP_TIME = 1000*60*5; // 5 Minutes private static final long DEATHMATCH_START_TIME = 1000*30; // 30 Seconds private static final long DEATHMATCH_WAIT_TIME = 1000*10; // 10 Seconds + + private static final int TNT_EXPLOSION_RADIUS = 14; private static final long EAT_RECHARGE = 500; // 0.5 Second @@ -137,15 +140,14 @@ public class Skyfall extends SoloGame private boolean _teleportedDeathmatch; private long _deathMatchStartTime; - private boolean _crumbleRings; private boolean _refillAnnounced; private int _currentCrumble = 300; private boolean _supplyOpened; - public Skyfall(ArcadeManager manager) + public Skyfall(ArcadeManager manager, GameType type) { - super(manager, GameType.Skyfall, + super(manager, type, new Kit[] { @@ -198,7 +200,6 @@ public class Skyfall extends SoloGame PrepareFreeze = true; AnnounceStay = false; - HideTeamSheep = true; DeathDropItems = true; QuitDropItems = true; DamageSelf = true; @@ -213,10 +214,14 @@ public class Skyfall extends SoloGame InventoryOpenChest = true; DamageFall = false; SoupEnabled = true; - ReplaceTeamsWithKits = true; StrictAntiHack = false; +<<<<<<< HEAD new CompassModule().register(this); +======= + CompassEnabled = true; + CompassGiveItem = false; +>>>>>>> refs/remotes/origin/develop SpeedMeasurement = true; @@ -224,63 +229,6 @@ public class Skyfall extends SoloGame _islandHeight = 15; } - @Override - @EventHandler - public void ScoreboardUpdate(UpdateEvent event) - { - if (event.getType() != UpdateType.FAST) - return; - - if (GetTeamList().isEmpty()) - return; - - Scoreboard.reset(); - - GameTeam team = GetTeamList().get(0); - - if (IsLive()) - { - Scoreboard.writeNewLine(); - Scoreboard.write(C.cGreen + C.Bold + "Time"); - Scoreboard.write(UtilTime.convertString(System.currentTimeMillis() - GetStateTime(), 0, TimeUnit.FIT)); - Scoreboard.writeNewLine(); - } - - Scoreboard.write(C.cYellow + C.Bold + "Players"); - if (team.GetPlayers(true).size() > 7) - { - Scoreboard.write("" + team.GetPlayers(true).size()); - } - else - { - for (Player player : team.GetPlayers(true)) - { - Scoreboard.write(C.cWhite + player.getName()); - } - } - - if (IsLive() && !_deathmatch) - { - Scoreboard.writeNewLine(); - Scoreboard.write(C.cGold + C.Bold + "Chest Refill"); - Scoreboard.write(C.cWhite + UtilTime.MakeStr((_chestsRefilled + CHEST_REFILL_TIME) - System.currentTimeMillis())); - } - else if (_deathmatch && !_deathMatchStarted) - { - Scoreboard.writeNewLine(); - Scoreboard.write(C.cRed + C.Bold + "Deathmatch"); - Scoreboard.write(F.time(UtilTime.MakeStr(_teleportedDeathmatch ? (_deathMatchStartTime + DEATHMATCH_START_TIME + DEATHMATCH_WAIT_TIME) - System.currentTimeMillis() : (_deathMatchStartTime + DEATHMATCH_START_TIME) - System.currentTimeMillis()))); - } - else if (_deathMatchStarted) - { - Scoreboard.writeNewLine(); - Scoreboard.write(C.cRed + C.Bold + "Game End"); - Scoreboard.write(UtilTime.convertString(Math.max(0, (GetStateTime() + GameTimeout) - System.currentTimeMillis()), 0, TimeUnit.FIT)); - } - - Scoreboard.draw(); - } - @EventHandler public void gameStart(GameStateChangeEvent event) { @@ -292,6 +240,17 @@ public class Skyfall extends SoloGame { spawn.clone().subtract(0, 1, 0).getBlock().setType(Material.AIR); } + + for (Player player : GetPlayers(true)) + { + ItemStack stack = new ItemStack(Material.COMPASS); + + ItemMeta itemMeta = stack.getItemMeta(); + itemMeta.setDisplayName(C.cGreen + C.Bold + "Tracking Compass"); + stack.setItemMeta(itemMeta); + + player.getInventory().addItem(stack); + } } } @@ -366,7 +325,6 @@ public class Skyfall extends SoloGame { Announce(C.cGreenB + "As time passes, the world begins to rot...", true); _crumbleAnnounced = true; - _crumbleRings = true; } for (Island island : islandCrumble()) @@ -521,7 +479,6 @@ public class Skyfall extends SoloGame Location loc = UtilAlg.getLocationNearPlayers(_deathMatchSpawns, GetPlayers(true), GetPlayers(true)); player.teleport(loc); } - _crumbleRings = true; } @EventHandler @@ -530,9 +487,6 @@ public class Skyfall extends SoloGame if (event.getType() != UpdateType.FASTER) return; - if (!_crumbleRings) - return; - for (BoosterRing ring : _boosterRings) { if (ring.getMiddle().getBlockY() < _currentCrumble) @@ -580,6 +534,7 @@ public class Skyfall extends SoloGame Announce(C.cYellow + C.Bold + "Supply Drop Incoming"); _supplyEffect = _supplyDrop.clone(); _supplyEffect.setY(250); + _supplyDrop.getBlock().getRelative(BlockFace.DOWN).setType(Material.GLASS); _supplyDrop.getBlock().getRelative(BlockFace.DOWN).getRelative(BlockFace.DOWN).setType(Material.BEACON); for (int x = -1; x <= 1; x++) for (int z = -1; z <= 1; z++) @@ -910,6 +865,9 @@ public class Skyfall extends SoloGame { if (!IsLive()) UtilPlayer.removeWorldBorder(player); + + if (!IsAlive(player)) + UtilPlayer.removeWorldBorder(player); if (player.getInventory().getChestplate() == null) continue; @@ -942,18 +900,16 @@ public class Skyfall extends SoloGame @EventHandler public void TNTExplosion(ExplosionPrimeEvent event) - { + { if (!_tntMap.containsKey(event.getEntity())) return; Player player = _tntMap.remove(event.getEntity()); - for (Player other : UtilPlayer.getNearby(event.getEntity() - .getLocation(), 14)) - Manager.GetCondition() - .Factory() - .Explosion("Throwing TNT", other, player, 50, 0.1, false, - false); + for (Player other : UtilPlayer.getNearby(event.getEntity().getLocation(), TNT_EXPLOSION_RADIUS)) + Manager.GetCondition().Factory().Explosion("Throwing TNT", other, player, 50, 0.1, false, false); + + event.setCancelled(true); } @EventHandler @@ -1064,7 +1020,7 @@ public class Skyfall extends SoloGame { if (player.getInventory().getChestplate() != null) { - UtilPlayer.message(player, F.main("Game", C.cRed + "You're Elytra is disabled!")); + UtilPlayer.message(player, F.main("Game", C.cRed + "Your Elytra is disabled!")); } player.getInventory().setChestplate(null); } @@ -1072,6 +1028,46 @@ public class Skyfall extends SoloGame } } + public boolean isDeathMatch() + { + return _deathmatch; + } + + public boolean isDeathMatchStarted() + { + return _deathMatchStarted; + } + + public boolean isTeleportedDeathmatch() + { + return _teleportedDeathmatch; + } + + public long getDeathmatchStartTime() + { + return _deathMatchStartTime; + } + + public long getChestsRefilled() + { + return _chestsRefilled; + } + + public long getChestRefillTime() + { + return CHEST_REFILL_TIME; + } + + public long getDeathmatchStartingTime() + { + return DEATHMATCH_START_TIME; + } + + public long getDeathmatchWaitTime() + { + return DEATHMATCH_WAIT_TIME; + } + private class IslandSorter implements Comparator { private HashMap _map; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skyfall/SoloSkyfall.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skyfall/SoloSkyfall.java new file mode 100644 index 000000000..9d26f1c34 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skyfall/SoloSkyfall.java @@ -0,0 +1,178 @@ +package nautilus.game.arcade.game.games.skyfall; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import org.bukkit.ChatColor; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilTime; +import mineplex.core.common.util.UtilTime.TimeUnit; +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.Game.GameState; + +/** + * SoloSkyfall + * + * @author xXVevzZXx + */ +public class SoloSkyfall extends Skyfall +{ + private GameTeam _players; + + public SoloSkyfall(ArcadeManager manager) + { + super(manager, GameType.Skyfall); + + this.DamageTeamSelf = true; + } + + @EventHandler + public void CustomTeamGeneration(GameStateChangeEvent event) + { + if (event.GetState() != GameState.Recruit) + return; + + _players = GetTeamList().get(0); + _players.SetColor(ChatColor.YELLOW); + _players.SetName("Players"); + _players.setDisplayName(C.cYellow + C.Bold + "Players"); + } + + @Override + @EventHandler + public void ScoreboardUpdate(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + return; + + if (GetTeamList().isEmpty()) + return; + + Scoreboard.reset(); + + GameTeam team = GetTeamList().get(0); + + if (IsLive()) + { + Scoreboard.writeNewLine(); + Scoreboard.write(C.cGreen + C.Bold + "Time"); + Scoreboard.write(UtilTime.convertString(System.currentTimeMillis() - GetStateTime(), 0, TimeUnit.FIT)); + Scoreboard.writeNewLine(); + } + + Scoreboard.write(C.cYellow + C.Bold + "Players"); + if (team.GetPlayers(true).size() > 7) + { + Scoreboard.write("" + team.GetPlayers(true).size()); + } + else + { + for (Player player : team.GetPlayers(true)) + { + Scoreboard.write(C.cWhite + player.getName()); + } + } + + if (IsLive() && !isDeathMatch()) + { + Scoreboard.writeNewLine(); + Scoreboard.write(C.cGold + C.Bold + "Chest Refill"); + Scoreboard.write(C.cWhite + UtilTime.MakeStr((getChestsRefilled() + getChestRefillTime()) - System.currentTimeMillis())); + } + else if (isDeathMatch() && !isDeathMatchStarted()) + { + Scoreboard.writeNewLine(); + Scoreboard.write(C.cRed + C.Bold + "Deathmatch"); + Scoreboard.write(F.time(UtilTime.MakeStr(isTeleportedDeathmatch() ? (getDeathmatchStartTime() + getDeathmatchStartingTime() + getDeathmatchWaitTime()) - System.currentTimeMillis() : (getDeathmatchStartTime() + getDeathmatchStartingTime()) - System.currentTimeMillis()))); + } + else if (isDeathMatchStarted()) + { + Scoreboard.writeNewLine(); + Scoreboard.write(C.cRed + C.Bold + "Game End"); + Scoreboard.write(UtilTime.convertString(Math.max(0, (GetStateTime() + GameTimeout) - System.currentTimeMillis()), 0, TimeUnit.FIT)); + } + + Scoreboard.draw(); + } + + @Override + public void EndCheck() + { + if (!IsLive()) + return; + + if (GetPlayers(true).size() <= 1) + { + ArrayList places = GetTeamList().get(0).GetPlacements(true); + + //Announce + AnnounceEnd(places); + + //Gems + if (places.size() >= 1) + AddGems(places.get(0), 20, "1st Place", false, false); + + if (places.size() >= 2) + AddGems(places.get(1), 15, "2nd Place", false, false); + + if (places.size() >= 3) + AddGems(places.get(2), 10, "3rd Place", false, false); + + for (Player player : GetPlayers(false)) + if (player.isOnline()) + AddGems(player, 10, "Participation", false, false); + + //End + SetState(GameState.End); + } + } + + @Override + public List getWinners() + { + if (GetState().ordinal() >= GameState.End.ordinal()) + { + List places = GetTeamList().get(0).GetPlacements(true); + + if (places.isEmpty() || !places.get(0).isOnline()) + return Arrays.asList(); + else + return Arrays.asList(places.get(0)); + } + else + return null; + } + + @Override + public List getLosers() + { + List winners = getWinners(); + + if (winners == null) + return null; + + List losers = GetTeamList().get(0).GetPlayers(false); + + losers.removeAll(winners); + + return losers; + } + + @Override + public String GetMode() + { + return "Solo Mode"; + } + +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skyfall/TeamSkyfall.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skyfall/TeamSkyfall.java new file mode 100644 index 000000000..ef02c6deb --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skyfall/TeamSkyfall.java @@ -0,0 +1,190 @@ +package nautilus.game.arcade.game.games.skyfall; + +import java.util.ArrayList; +import java.util.List; + +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilTime; +import mineplex.core.common.util.UtilTime.TimeUnit; +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.game.GameTeam; +import nautilus.game.arcade.game.modules.TeamModule; + +/** + * TeamSkyfall + * + * @author xXVevzZXx + */ +public class TeamSkyfall extends Skyfall +{ + + public TeamSkyfall(ArcadeManager manager) + { + super(manager, GameType.SkyfallTeams); + + PlayersPerTeam = 2; + FillTeamsInOrderToCount = 2; + + SpawnNearAllies = true; + SpawnNearEnemies = true; + + DamageTeamSelf = false; + + DontAllowOverfill = true; + TeamMode = true; + + HideTeamSheep = true; + + registerModule(new TeamModule()); + } + + @Override + @EventHandler + public void ScoreboardUpdate(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + return; + + if (GetTeamList().isEmpty()) + return; + + Scoreboard.reset(); + + if (IsLive()) + { + Scoreboard.writeNewLine(); + Scoreboard.write(C.cGreen + C.Bold + "Time"); + Scoreboard.write(UtilTime.convertString(System.currentTimeMillis() - GetStateTime(), 0, TimeUnit.FIT)); + Scoreboard.writeNewLine(); + } + + Scoreboard.write(C.cYellow + C.Bold + "Teams"); + + ArrayList alive = new ArrayList(); + for (GameTeam team : GetTeamList()) + { + if (team.IsTeamAlive()) + alive.add(team); + } + + if (GetPlayers(true).size() <= 7) + { + for (GameTeam team : GetTeamList()) + { + for (Player player : team.GetPlayers(true)) + { + Scoreboard.write(team.GetColor() + player.getName()); + } + } + } + else if (alive.size() <= 7) + { + for (GameTeam team : alive) + { + Scoreboard.write(C.cWhite + team.GetPlayers(true).size() + " " + team.GetColor() + team.GetName()); + } + } + else + { + Scoreboard.write(C.cWhite + alive.size() + " Alive"); + } + + if (IsLive() && !isDeathMatch()) + { + Scoreboard.writeNewLine(); + Scoreboard.write(C.cGold + C.Bold + "Chest Refill"); + Scoreboard.write(C.cWhite + UtilTime.MakeStr((getChestsRefilled() + getChestRefillTime()) - System.currentTimeMillis())); + } + else if (isDeathMatch() && !isDeathMatchStarted()) + { + Scoreboard.writeNewLine(); + Scoreboard.write(C.cRed + C.Bold + "Deathmatch"); + Scoreboard.write(F.time(UtilTime.MakeStr(isTeleportedDeathmatch() ? (getDeathmatchStartTime() + getDeathmatchStartingTime() + getDeathmatchWaitTime()) - System.currentTimeMillis() : (getDeathmatchStartTime() + getDeathmatchStartingTime()) - System.currentTimeMillis()))); + } + else if (isDeathMatchStarted()) + { + Scoreboard.writeNewLine(); + Scoreboard.write(C.cRed + C.Bold + "Game End"); + Scoreboard.write(UtilTime.convertString(Math.max(0, (GetStateTime() + GameTimeout) - System.currentTimeMillis()), 0, TimeUnit.FIT)); + } + + Scoreboard.draw(); + } + + @Override + public void EndCheck() + { + if (!IsLive()) + return; + + ArrayList teamsAlive = new ArrayList(); + + for (GameTeam team : GetTeamList()) + if (team.GetPlayers(true).size() > 0) + teamsAlive.add(team); + + if (teamsAlive.size() <= 1) + { + //Announce + if (teamsAlive.size() > 0) + AnnounceEnd(teamsAlive.get(0)); + + for (GameTeam team : GetTeamList()) + { + if (WinnerTeam != null && team.equals(WinnerTeam)) + { + for (Player player : team.GetPlayers(false)) + AddGems(player, 10, "Winning Team", false, false); + } + + for (Player player : team.GetPlayers(false)) + if (player.isOnline()) + AddGems(player, 10, "Participation", false, false); + } + + //End + SetState(GameState.End); + } + } + + @Override + public List getWinners() + { + if (WinnerTeam == null) + return null; + + return WinnerTeam.GetPlayers(false); + } + + @Override + public List getLosers() + { + if (WinnerTeam == null) + return null; + + List players = new ArrayList<>(); + + for (GameTeam team : GetTeamList()) + { + if (team != WinnerTeam) + players.addAll(team.GetPlayers(false)); + } + + return players; + } + + @Override + public String GetMode() + { + return "Team Mode"; + } + +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skyfall/kits/perks/PerkAeronaught.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skyfall/kits/perks/PerkAeronaught.java index 3a12689ab..bce38d3de 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skyfall/kits/perks/PerkAeronaught.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skyfall/kits/perks/PerkAeronaught.java @@ -6,6 +6,7 @@ import org.bukkit.event.EventHandler; import mineplex.core.common.util.C; import mineplex.core.common.util.UtilPlayer; import mineplex.minecraft.game.core.damage.CustomDamageEvent; + import nautilus.game.arcade.kit.Perk; /** diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skyfall/kits/perks/PerkDeadeye.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skyfall/kits/perks/PerkDeadeye.java index 4876a6506..3c205e87c 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skyfall/kits/perks/PerkDeadeye.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skyfall/kits/perks/PerkDeadeye.java @@ -13,6 +13,7 @@ import mineplex.core.common.util.F; import mineplex.core.common.util.UtilPlayer; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; + import nautilus.game.arcade.game.games.skyfall.HomingArrow; import nautilus.game.arcade.kit.Perk; @@ -53,7 +54,7 @@ public class PerkDeadeye extends Perk return; Player shooter = (Player) event.getEntity(); - + if (!hasPerk(shooter)) return; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skyfall/kits/perks/PerkElytraKnockback.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skyfall/kits/perks/PerkElytraKnockback.java index 3e9b02494..0398f438d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skyfall/kits/perks/PerkElytraKnockback.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skyfall/kits/perks/PerkElytraKnockback.java @@ -45,6 +45,9 @@ public class PerkElytraKnockback extends Perk if (!UtilPlayer.isGliding(player)) return; + if (Manager.GetGame().TeamMode && Manager.GetGame().GetTeam(player) == Manager.GetGame().GetTeam(event.GetDamageePlayer())) + return; + event.AddKnockback("Kit Effect", event.getKnockbackValue()*2); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skyfall/kits/perks/PerkIncreaseBoosters.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skyfall/kits/perks/PerkIncreaseBoosters.java index 391277b7d..a4fe39dff 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skyfall/kits/perks/PerkIncreaseBoosters.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skyfall/kits/perks/PerkIncreaseBoosters.java @@ -4,6 +4,7 @@ import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import mineplex.core.common.util.C; + import nautilus.game.arcade.game.games.skyfall.BoosterRing; import nautilus.game.arcade.game.games.skyfall.PlayerBoostRingEvent; import nautilus.game.arcade.kit.Perk; @@ -36,6 +37,8 @@ public class PerkIncreaseBoosters extends Perk if (!hasPerk(player)) return; + player.sendMessage("Increasing strength of booster ring to " + _strength + " for " + player.getName()); + event.multiplyStrength(_strength); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skyfall/kits/perks/PerkRemoveElytra.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skyfall/kits/perks/PerkRemoveElytra.java index 8ee1863fe..a14655a2d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skyfall/kits/perks/PerkRemoveElytra.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skyfall/kits/perks/PerkRemoveElytra.java @@ -15,6 +15,7 @@ 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.kit.Perk; /** @@ -59,7 +60,10 @@ public class PerkRemoveElytra extends Perk if (!hasPerk(player)) return; - Recharge.Instance.useForce(player, "Elytra Removal", _duration, true); + if (Manager.GetGame().TeamMode && Manager.GetGame().GetTeam(player) == Manager.GetGame().GetTeam(event.GetDamageePlayer())) + return; + + Recharge.Instance.useForce(event.GetDamageePlayer(), "Elytra Removal", _duration, true); _disabled.put(event.GetDamageePlayer().getUniqueId(), System.currentTimeMillis() + _duration); } @@ -84,7 +88,7 @@ public class PerkRemoveElytra extends Perk { if (player.getInventory().getChestplate() != null) { - UtilPlayer.message(player, F.main("Game", C.cRed + "You're Elytra is disabled!")); + UtilPlayer.message(player, F.main("Game", C.cRed + "Your Elytra is disabled!")); } player.getInventory().setChestplate(null); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skywars/Skywars.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skywars/Skywars.java index e73065e86..dd54fccfa 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skywars/Skywars.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skywars/Skywars.java @@ -73,6 +73,7 @@ import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.combat.CombatComponent; import mineplex.minecraft.game.core.combat.event.CombatDeathEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent; + import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.GameType; import nautilus.game.arcade.events.GameStateChangeEvent; @@ -85,7 +86,11 @@ import nautilus.game.arcade.game.games.skywars.kits.KitEarth; import nautilus.game.arcade.game.games.skywars.kits.KitFire; import nautilus.game.arcade.game.games.skywars.kits.KitIce; import nautilus.game.arcade.game.games.skywars.kits.KitMetal; +<<<<<<< HEAD import nautilus.game.arcade.game.modules.compass.CompassModule; +======= +import nautilus.game.arcade.game.games.skywars.modes.kits.KitElementalist; +>>>>>>> refs/remotes/origin/develop import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.ore.OreHider; @@ -520,7 +525,7 @@ public abstract class Skywars extends Game for (Player player : GetPlayers(true)) { - if (GetKit(player) instanceof KitAir) + if (GetKit(player) instanceof KitAir || GetKit(player) instanceof KitElementalist) { player.sendMessage(F.main("Game", "Your " + F.skill("Leap") + " is on a 30 second cooldown.")); Recharge.Instance.use(player, "Leap", 30000, true, false); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skywars/modes/Elementalist.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skywars/modes/Elementalist.java new file mode 100644 index 000000000..6b54fe488 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skywars/modes/Elementalist.java @@ -0,0 +1,29 @@ +package nautilus.game.arcade.game.games.skywars.modes; + +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.GameType; +import nautilus.game.arcade.game.games.skywars.Skywars; +import nautilus.game.arcade.game.games.skywars.SoloSkywars; +import nautilus.game.arcade.game.games.skywars.modes.kits.KitElementalist; +import nautilus.game.arcade.kit.Kit; + +/** + * Elementalist is a mode of {@link Skywars} which combines all kits to one + * + * @author xXVevzZXx + */ +public class Elementalist extends SoloSkywars +{ + + public Elementalist(ArcadeManager manager) + { + super(manager, new Kit[]{new KitElementalist(manager)}, GameType.Brawl); + } + + @Override + public String GetMode() + { + return "Elementalist"; + } + +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skywars/modes/kits/KitElementalist.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skywars/modes/kits/KitElementalist.java new file mode 100644 index 000000000..8f63e93ab --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skywars/modes/kits/KitElementalist.java @@ -0,0 +1,72 @@ +package nautilus.game.arcade.game.games.skywars.modes.kits; + +import org.bukkit.Material; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; + +import mineplex.core.common.util.C; +import mineplex.core.itemstack.ItemBuilder; + +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.game.games.skywars.Skywars; +import nautilus.game.arcade.game.games.skywars.modes.Elementalist; +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.kit.perks.PerkDirtCannon; +import nautilus.game.arcade.kit.perks.PerkDoubleJump; +import nautilus.game.arcade.kit.perks.PerkFireBurst; +import nautilus.game.arcade.kit.perks.PerkIceBridge; +import nautilus.game.arcade.kit.perks.PerkKnockback; +import nautilus.game.arcade.kit.perks.PerkMagnetism; +import nautilus.game.arcade.kit.perks.PerkVoidSaver; + +/** + * KitElementalist is a kit for the Brawl mode {@link Elementalist} which combines all {@link Skywars} kits + * + * @author xXVevzZXx + */ +public class KitElementalist extends ProgressingKit +{ + private static final String DOUBLE_JUMP = "Leap"; + + private static final String[] DESCRIPTION = { + "You have the power of a true Elementalist which can", + "use all sorts of Elements for their own use" + }; + + private static final Perk[] PERKS = + { + new PerkVoidSaver(), + new PerkDoubleJump(DOUBLE_JUMP, 1.2, 1, true, 27000, true), + new PerkDirtCannon(1.5), + new PerkKnockback(0.75, true), + new PerkFireBurst(35000, 4, 6), + new PerkIceBridge(25000, 6000), + //new PerkMagnetism(15000, 10, 1.5) + }; + + private static final ItemStack[] PLAYER_ITEMS = + { + new ItemStack(Material.WOOD_SWORD), new ItemBuilder(Material.EYE_OF_ENDER).setTitle(C.cGreen + "Eye of Ender").build(), + //new ItemStack(Material.WOOD_SPADE), + new ItemBuilder(Material.BLAZE_ROD).setTitle(C.cGreen + "Fire Burst").build(), + new ItemBuilder(Material.ICE).setTitle(C.cGreen + "Ice Bridge").build(), + }; + + private static final ItemStack IN_HAND = new ItemStack(Material.EYE_OF_ENDER); + + public KitElementalist(ArcadeManager manager) + { + super(manager, "Avatar", "avatar", KitAvailability.Free, DESCRIPTION, PERKS, EntityType.SKELETON, IN_HAND); + } + + @Override + public void GiveItems(Player player) + { + player.getInventory().addItem(PLAYER_ITEMS); + } + +} 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 4c980e69b..d8089da13 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 @@ -330,7 +330,7 @@ public class PerkBarrage extends SmashPerk { if (_remove) { - if (_arrows.remove(event.getEntity().getUniqueId())) + if (_arrows.remove(event.getEntity())) { event.getEntity().remove(); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkApple.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkApple.java index 21af9546c..10547e0d8 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkApple.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkApple.java @@ -26,13 +26,17 @@ import org.bukkit.event.player.PlayerInteractEvent; public class PerkApple extends Perk implements IThrown { - public PerkApple() + private long _spawnDelay; + + public PerkApple(long delay) { super("Apple Thrower", new String[] { C.cGray + "Receive 1 Apple every 10 seconds", C.cYellow + "Left-Click" + C.cGray + " with Apple to " + C.cGreen + "Throw Apple", }); + + _spawnDelay = delay; } @EventHandler @@ -52,7 +56,7 @@ public class PerkApple extends Perk implements IThrown if (!Manager.GetGame().IsAlive(player)) continue; - if (!Recharge.Instance.use(player, getMessage(player), 10000, false, false)) + if (!Recharge.Instance.use(player, getMessage(player), _spawnDelay, false, false)) continue; player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(getMaterial(player))); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkHorsePet.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkHorsePet.java index 49a85e0a5..22eb53950 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkHorsePet.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkHorsePet.java @@ -8,6 +8,8 @@ import mineplex.core.gadget.gadgets.gamemodifiers.kits.KitModifierType; 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.kit.Perk; import org.bukkit.Material; import org.bukkit.Sound; @@ -98,6 +100,20 @@ public class PerkHorsePet extends Perk horse.getWorld().playSound(horse.getLocation(), Sound.HORSE_ANGRY, 2f, 1f); } + @EventHandler + public void onGameEnd(GameStateChangeEvent event) + { + if (event.GetState() == Game.GameState.End) + { + // Players alive at the end of the game don't die, so their horse sticks around. + // We need to iterate through them just in case they have a horse to kill. + for(Player player : event.GetGame().GetPlayers(true)) + { + this.despawnHorse(player); + } + } + } + @EventHandler public void horseUpdate(UpdateEvent event) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GamePlayerManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GamePlayerManager.java index d1615871b..6c3b07cd6 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GamePlayerManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GamePlayerManager.java @@ -69,7 +69,7 @@ public class GamePlayerManager implements Listener } for (Player player : Manager.GetGame().GetPlayers(true)) { - if (!Manager.GetCondition().HasCondition(player, ConditionType.INVISIBILITY) && Manager.GetGame().IsAlive(player) && !UtilPlayer.isSpectator(player)) + if (!Manager.GetCondition().HasCondition(player, ConditionType.INVISIBILITY) && !Manager.GetCondition().HasCondition(player, ConditionType.CLOAK) && Manager.GetGame().IsAlive(player) && !UtilPlayer.isSpectator(player)) { for (Player viewer : Bukkit.getOnlinePlayers()) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/WinWithoutWearingArmorStatTracker.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/WinWithoutWearingArmorStatTracker.java index 5f2626d06..a5e66c3f7 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/WinWithoutWearingArmorStatTracker.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/WinWithoutWearingArmorStatTracker.java @@ -4,17 +4,18 @@ import java.util.HashSet; import java.util.List; import java.util.Set; -import mineplex.core.updater.UpdateType; -import mineplex.core.updater.event.UpdateEvent; -import nautilus.game.arcade.events.GameStateChangeEvent; -import nautilus.game.arcade.game.Game; - import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.inventory.ItemStack; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; + +import nautilus.game.arcade.events.GameStateChangeEvent; +import nautilus.game.arcade.game.Game; + public class WinWithoutWearingArmorStatTracker extends StatTracker { private final Set _wearing = new HashSet(); @@ -41,7 +42,7 @@ public class WinWithoutWearingArmorStatTracker extends StatTracker for (ItemStack armor : player.getInventory().getArmorContents()) { - if (armor != null && armor.getType() != Material.AIR) + if (armor != null && armor.getType() != Material.AIR && armor.getType() != Material.ELYTRA) { _wearing.add(player.getUniqueId().toString()); break;