From 3ebe1a837f340f6cf607d33fd0049db8d06fe775 Mon Sep 17 00:00:00 2001 From: xXVevzZXx Date: Sun, 16 Oct 2016 14:30:11 +0200 Subject: [PATCH 01/98] Fix some bugs, improve Skyfall and add Skyfall Teams --- .../src/mineplex/core/game/GameDisplay.java | 1 + .../src/nautilus/game/arcade/GameType.java | 11 +- .../game/games/skyfall/BoosterRing.java | 13 +- .../game/games/skyfall/HomingArrow.java | 3 + .../arcade/game/games/skyfall/LootTable.java | 61 +++--- .../arcade/game/games/skyfall/Skyfall.java | 168 ++++++++-------- .../game/games/skyfall/SoloSkyfall.java | 178 ++++++++++++++++ .../game/games/skyfall/TeamSkyfall.java | 190 ++++++++++++++++++ .../skyfall/kits/perks/PerkAeronaught.java | 1 + .../kits/perks/PerkElytraKnockback.java | 3 + .../kits/perks/PerkIncreaseBoosters.java | 3 + .../skyfall/kits/perks/PerkRemoveElytra.java | 8 +- .../WinWithoutWearingArmorStatTracker.java | 13 +- 13 files changed, 526 insertions(+), 127 deletions(-) create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skyfall/SoloSkyfall.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skyfall/TeamSkyfall.java diff --git a/Plugins/Mineplex.Core/src/mineplex/core/game/GameDisplay.java b/Plugins/Mineplex.Core/src/mineplex/core/game/GameDisplay.java index aef40f7c1..c7ae4e7e3 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/game/GameDisplay.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/game/GameDisplay.java @@ -83,6 +83,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/Nautilus.Game.Arcade/src/nautilus/game/arcade/GameType.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/GameType.java index 517358bd0..f47271c0f 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/GameType.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/GameType.java @@ -1,9 +1,12 @@ package nautilus.game.arcade; +import org.bukkit.Material; + import mineplex.core.common.MinecraftVersion; import mineplex.core.common.Pair; import mineplex.core.game.GameCategory; import mineplex.core.game.GameDisplay; + import nautilus.game.arcade.game.Game; import nautilus.game.arcade.game.games.baconbrawl.BaconBrawl; import nautilus.game.arcade.game.games.barbarians.Barbarians; @@ -70,7 +73,8 @@ 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.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.OverpoweredSkywars; @@ -108,8 +112,6 @@ import nautilus.game.arcade.game.games.wither.WitherGame; import nautilus.game.arcade.game.games.wizards.Wizards; import nautilus.game.arcade.game.games.zombiesurvival.ZombieSurvival; -import org.bukkit.Material; - public enum GameType { //Mini @@ -196,7 +198,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), 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..c91eb303c 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; 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 374fa3cc0..b47bea0bd 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,12 +33,21 @@ 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 org.bukkit.scoreboard.Scoreboard; +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; import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilEvent; import mineplex.core.common.util.UtilEvent.ActionType; import mineplex.core.common.util.UtilFirework; @@ -59,13 +65,14 @@ 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.Game; +import nautilus.game.arcade.game.Game.GameState; import nautilus.game.arcade.game.GameTeam; -import nautilus.game.arcade.game.SoloGame; 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; @@ -78,17 +85,17 @@ 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; +import nautilus.game.arcade.world.WorldData; /** * 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; @@ -102,7 +109,7 @@ 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 @@ -136,15 +143,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[] { @@ -197,7 +203,6 @@ public class Skyfall extends SoloGame PrepareFreeze = true; AnnounceStay = false; - HideTeamSheep = true; DeathDropItems = true; QuitDropItems = true; DamageSelf = true; @@ -212,9 +217,9 @@ public class Skyfall extends SoloGame InventoryOpenChest = true; DamageFall = false; SoupEnabled = true; - ReplaceTeamsWithKits = true; StrictAntiHack = false; CompassEnabled = true; + CompassGiveItem = false; SpeedMeasurement = true; @@ -222,63 +227,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) { @@ -290,6 +238,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); + } } } @@ -364,7 +323,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()) @@ -519,7 +477,6 @@ public class Skyfall extends SoloGame Location loc = UtilAlg.getLocationNearPlayers(_deathMatchSpawns, GetPlayers(true), GetPlayers(true)); player.teleport(loc); } - _crumbleRings = true; } @EventHandler @@ -528,9 +485,6 @@ public class Skyfall extends SoloGame if (event.getType() != UpdateType.FASTER) return; - if (!_crumbleRings) - return; - for (BoosterRing ring : _boosterRings) { if (ring.getMiddle().getBlockY() < _currentCrumble) @@ -578,6 +532,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++) @@ -908,6 +863,9 @@ public class Skyfall extends SoloGame { if (!IsLive()) UtilPlayer.removeWorldBorder(player); + + if (!IsAlive(player)) + UtilPlayer.removeWorldBorder(player); if (player.getInventory().getChestplate() == null) continue; @@ -940,7 +898,7 @@ public class Skyfall extends SoloGame @EventHandler public void TNTExplosion(ExplosionPrimeEvent event) - { + { if (!_tntMap.containsKey(event.getEntity())) return; @@ -952,6 +910,16 @@ public class Skyfall extends SoloGame .Factory() .Explosion("Throwing TNT", other, player, 50, 0.1, false, false); + + Location loc = event.getEntity().getLocation(); + for (Block block : UtilBlock.getSurrounding(loc.getBlock(), true)) + { + if (block.getType() == _boosterRings.get(0).getType()) + { + event.setCancelled(true); + return; + } + } } @EventHandler @@ -1062,7 +1030,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); } @@ -1070,6 +1038,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/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..43ce0a4fe 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; + // Bukkit.broadcastMessage("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/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; From 8068e1acf5be39b11c3299357497077326c11fbe Mon Sep 17 00:00:00 2001 From: xXVevzZXx Date: Sat, 22 Oct 2016 18:09:13 +0200 Subject: [PATCH 02/98] re-enable debug --- .../game/games/skyfall/kits/perks/PerkIncreaseBoosters.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 43ce0a4fe..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 @@ -37,7 +37,7 @@ public class PerkIncreaseBoosters extends Perk if (!hasPerk(player)) return; - // Bukkit.broadcastMessage("Increasing strength of booster ring to " + _strength + " for " + player.getName()); + player.sendMessage("Increasing strength of booster ring to " + _strength + " for " + player.getName()); event.multiplyStrength(_strength); } From 89efc22208e82eff8c1418b87a51490b9caec9e5 Mon Sep 17 00:00:00 2001 From: xXVevzZXx Date: Fri, 28 Oct 2016 18:53:48 +0200 Subject: [PATCH 03/98] Fix Perks not being unregistered from the EventHandler --- .../src/nautilus/game/arcade/game/Game.java | 30 +++++++++++++++++-- .../game/games/skyfall/HomingArrow.java | 1 + .../arcade/game/games/skyfall/Skyfall.java | 20 ++++--------- .../games/skyfall/kits/perks/PerkDeadeye.java | 3 +- 4 files changed, 35 insertions(+), 19 deletions(-) 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 f1739e81a..43b77f75c 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 @@ -813,11 +813,35 @@ 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(); + } + } + + } } 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 c91eb303c..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 @@ -114,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/Skyfall.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skyfall/Skyfall.java index b47bea0bd..2d19258a7 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 @@ -112,6 +112,8 @@ public abstract class Skyfall extends Game 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 @@ -904,22 +906,10 @@ public abstract class Skyfall extends Game 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); - Location loc = event.getEntity().getLocation(); - for (Block block : UtilBlock.getSurrounding(loc.getBlock(), true)) - { - if (block.getType() == _boosterRings.get(0).getType()) - { - event.setCancelled(true); - return; - } - } + event.setCancelled(true); } @EventHandler 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..7fecc9b30 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 @@ -15,6 +15,7 @@ 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; +import nautilus.game.arcade.kit.ProgressingKit; /** * Perk that lets Players shot @@ -53,7 +54,7 @@ public class PerkDeadeye extends Perk return; Player shooter = (Player) event.getEntity(); - + if (!hasPerk(shooter)) return; From 2479829370e21d6516f63de469fd66852884d47a Mon Sep 17 00:00:00 2001 From: xXVevzZXx Date: Sat, 29 Oct 2016 05:58:56 +0200 Subject: [PATCH 04/98] Remove unused import --- .../game/arcade/game/games/skyfall/kits/perks/PerkDeadeye.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 7fecc9b30..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,9 +13,9 @@ 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; -import nautilus.game.arcade.kit.ProgressingKit; /** * Perk that lets Players shot From 3b47a74a92ccc4c13de63dbf9cfda4c03673fc04 Mon Sep 17 00:00:00 2001 From: xXVevzZXx Date: Mon, 31 Oct 2016 14:24:44 +0100 Subject: [PATCH 05/98] Remove unused imports --- .../nautilus/game/arcade/game/games/skyfall/Skyfall.java | 6 ------ 1 file changed, 6 deletions(-) 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 2d19258a7..5a82b318a 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 @@ -34,7 +34,6 @@ import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerMoveEvent; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.ItemMeta; -import org.bukkit.scoreboard.Scoreboard; import com.mineplex.anticheat.checks.move.Glide; import com.mineplex.anticheat.checks.move.HeadRoll; @@ -47,7 +46,6 @@ import mineplex.core.common.util.C; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilAlg; -import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilEvent; import mineplex.core.common.util.UtilEvent.ActionType; import mineplex.core.common.util.UtilFirework; @@ -60,7 +58,6 @@ 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; @@ -70,8 +67,6 @@ import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.GameType; import nautilus.game.arcade.events.GameStateChangeEvent; import nautilus.game.arcade.game.Game; -import nautilus.game.arcade.game.Game.GameState; -import nautilus.game.arcade.game.GameTeam; import nautilus.game.arcade.game.games.skyfall.kits.KitAeronaught; import nautilus.game.arcade.game.games.skyfall.kits.KitDeadeye; import nautilus.game.arcade.game.games.skyfall.kits.KitJouster; @@ -85,7 +80,6 @@ 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 nautilus.game.arcade.world.WorldData; /** * GameObject of the game Skyfall From e3e22383f6c35241e9056ac74467840cd8cbc3ba Mon Sep 17 00:00:00 2001 From: xXVevzZXx Date: Thu, 3 Nov 2016 03:21:04 +0100 Subject: [PATCH 06/98] Add Team stats display for Skyfall --- .../mineplex/core/achievement/AchievementCategory.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) 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; From 9ec6a0719e85f7c1cc4a4a186c4cbd86c7d50559 Mon Sep 17 00:00:00 2001 From: xXVevzZXx Date: Thu, 3 Nov 2016 17:14:01 +0100 Subject: [PATCH 07/98] Fix non upgradeable perks being not unregistered --- .../src/nautilus/game/arcade/game/Game.java | 8 ++++++++ 1 file changed, 8 insertions(+) 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 43b77f75c..153a260f0 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 @@ -831,6 +831,14 @@ public abstract class Game implements Listener } } } + else + { + for (Perk perk : kit.GetPerks()) + { + HandlerList.unregisterAll(perk); + perk.unregisteredEvents(); + } + } } else { From a74bc7101895c62e541353b8915fa63c858e466a Mon Sep 17 00:00:00 2001 From: xXVevzZXx Date: Tue, 15 Nov 2016 17:04:38 +0100 Subject: [PATCH 08/98] fix bugs and make some improvements --- .../arcade/addons/compass/CompassAddon.java | 35 +++++++- .../game/games/skyfall/BoosterRing.java | 85 ++++++++++++++++++- .../arcade/game/games/skyfall/Island.java | 2 +- .../arcade/game/games/skyfall/LootTable.java | 12 +-- .../arcade/game/games/skyfall/Skyfall.java | 36 +++++++- .../game/games/skyfall/TeamSkyfall.java | 11 ++- 6 files changed, 165 insertions(+), 16 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/addons/compass/CompassAddon.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/addons/compass/CompassAddon.java index eb003303f..a941648c9 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/addons/compass/CompassAddon.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/addons/compass/CompassAddon.java @@ -11,6 +11,7 @@ import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilTextBottom; +import mineplex.core.common.util.UtilTime; import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; @@ -34,9 +35,14 @@ import org.bukkit.plugin.java.JavaPlugin; public class CompassAddon extends MiniPlugin { + private static final long MODE_SWITCH_TIME = 3000; + public ArcadeManager Manager; private SpectatorShop _spectatorShop; + + private boolean _showTeam; + private long _lastChanged; public CompassAddon(JavaPlugin plugin, ArcadeManager manager) { @@ -77,10 +83,33 @@ public class CompassAddon extends MiniPlugin GameTeam otherTeam = Manager.GetGame().GetTeam(other); - //Same Team (Not Solo Game) && Alive - if (Manager.GetGame().GetTeamList().size() > 1 && (team != null && team.equals(otherTeam)) && Manager.GetGame().IsAlive(player)) - continue; + if (!Manager.GetGame().TeamMode) + { + //Same Team (Not Solo Game) && Alive + if (Manager.GetGame().GetTeamList().size() > 1 && (team != null && team.equals(otherTeam)) && Manager.GetGame().IsAlive(player)) + continue; + } + else + { + if (UtilTime.elapsed(_lastChanged, MODE_SWITCH_TIME)) + { + _lastChanged = System.currentTimeMillis(); + _showTeam = !_showTeam; + } + + if (_showTeam) + { + if (!team.equals(otherTeam)) + continue; + } + else + { + if (team.equals(otherTeam)) + continue; + } + } + double dist = UtilMath.offset(player, other); if (target == null || dist < bestDist) 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 0dbd22383..0d93a5846 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 @@ -16,6 +16,7 @@ import org.bukkit.event.HandlerList; import org.bukkit.event.Listener; import org.bukkit.inventory.ItemStack; import org.bukkit.util.Vector; +import org.omg.DynamicAny._DynUnionStub; import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilBlock; @@ -63,6 +64,11 @@ public class BoosterRing extends Crumbleable implements Listener private long _disabledSince; private long _disabledFor; + private long _disableDelay; + private long _disableDelayStarted; + + private CooldownData _delayedData; + private Hologram _hologram; private boolean _timer; @@ -89,6 +95,8 @@ public class BoosterRing extends Crumbleable implements Listener _boostStrength = boostStrength; _disabledSince = System.currentTimeMillis(); + _disableDelayStarted = 0; + System.out.println("Registering Ring"); setupRing(); @@ -305,7 +313,7 @@ public class BoosterRing extends Crumbleable implements Listener if (event.getType() != UpdateType.TICK) return; - for (Player player : _host.GetPlayers(true)) + for (Player player : UtilServer.getPlayers()) { if (!UtilPlayer.isGliding(player)) continue; @@ -331,7 +339,8 @@ public class BoosterRing extends Crumbleable implements Listener Vector vec = player.getEyeLocation().getDirection(); UtilAction.velocity(player, vec.multiply(event.getStrength())); - UtilFirework.playFirework(player.getEyeLocation(), Type.BALL_LARGE, Color.BLUE, true, false); + if (_host.IsAlive(player)) + UtilFirework.playFirework(player.getEyeLocation(), Type.BALL_LARGE, Color.BLUE, true, false); } @EventHandler @@ -391,6 +400,42 @@ public class BoosterRing extends Crumbleable implements Listener enable(); } + @EventHandler + public void disableUpdate(UpdateEvent event) + { + if (event.getType() != UpdateType.FASTER) + return; + + if (_delayedData == null) + return; + + if (UtilTime.elapsed(_disableDelayStarted, _disableDelay)) + { + disable(_delayedData.getTime(), _delayedData.getMaterial(), _delayedData.getData(), _delayedData.showTimer()); + _delayedData = null; + } + } + + public void disableLater(long delay, long time, Material mat, byte data, boolean showTimer) + { + if (_delayedData != null) + return; + + _delayedData = new CooldownData(time, mat, data, showTimer); + _disableDelayStarted = System.currentTimeMillis(); + _disableDelay = delay; + } + + public void disableLater(long delay, long time, boolean showTimer) + { + disableLater(delay, time, Material.STAINED_CLAY, (byte) 14, showTimer); + } + + public void disableLater(long delay) + { + disableLater(delay, Long.MAX_VALUE, Material.STAINED_CLAY, (byte) 14, false); + } + public void disable() { disable(Long.MAX_VALUE, false); @@ -493,4 +538,40 @@ public class BoosterRing extends Crumbleable implements Listener return _ring; } + private class CooldownData + { + private long _time; + private Material _mat; + private byte _data; + private boolean _showTimer; + + public CooldownData(long time, Material mat, byte data, boolean showTimer) + { + _time = time; + _mat = mat; + _data = data; + _showTimer = showTimer; + } + + public long getTime() + { + return _time; + } + + public Material getMaterial() + { + return _mat; + } + + public byte getData() + { + return _data; + } + + public boolean showTimer() + { + return _showTimer; + } + } + } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skyfall/Island.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skyfall/Island.java index 057f5e795..ba54fc98d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skyfall/Island.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skyfall/Island.java @@ -91,7 +91,7 @@ public class Island extends Crumbleable Inventory inventory = chest.getBlockInventory(); inventory.clear(); - int items = 3; + int items = 6; if (Math.random() > 0.50) items++; if (Math.random() > 0.65) 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 5958180b9..b3752875e 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 @@ -57,12 +57,12 @@ public class LootTable Material.TNT, (byte) 0, 1, F.item("Throwing TNT")), 15), new RandomItem(Material.MUSHROOM_SOUP, 15), - 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, 20, 1, 3), + new RandomItem(Material.BAKED_POTATO, 25, 1, 5), + new RandomItem(Material.MUSHROOM_SOUP, 25, 1, 1), + new RandomItem(Material.COOKED_BEEF, 35, 1, 3), + new RandomItem(Material.COOKED_CHICKEN, 35, 1, 3), + new RandomItem(Material.COOKED_FISH, 35, 1, 6), + new RandomItem(Material.GRILLED_PORK, 25, 1, 3), new RandomItem(Material.COOKIE, 30), new RandomItem(Material.PUMPKIN_PIE, 20, 1, 3), new RandomItem(Material.APPLE, 20, 2, 6), 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 5a82b318a..6cd6ed77c 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 @@ -11,10 +11,12 @@ import java.util.UUID; import net.md_5.bungee.api.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.block.Block; import org.bukkit.block.BlockFace; import org.bukkit.block.Chest; @@ -59,6 +61,7 @@ import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilTime; import mineplex.core.recharge.Recharge; +import mineplex.core.shop.item.ISalesPackage; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent; @@ -68,6 +71,7 @@ import nautilus.game.arcade.GameType; import nautilus.game.arcade.events.GameStateChangeEvent; 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; @@ -151,7 +155,7 @@ public abstract class Skyfall extends Game new Kit[] { new KitSpeeder(manager), - //new KitBooster(manager), // Broken? :( + new KitBooster(manager), // Broken? :( new KitJouster(manager), new KitStunner(manager), //new KitSurefoot(manager), @@ -568,6 +572,9 @@ public abstract class Skyfall extends Game if (!IsLive()) return; + if (!IsAlive(event.getPlayer())) + return; + if (event.getAction() != Action.RIGHT_CLICK_BLOCK) return; @@ -696,8 +703,9 @@ public abstract class Skyfall extends Game @EventHandler public void ringBoost(PlayerBoostRingEvent event) - { - event.getRing().disable(BOOSTER_COOLDOWN_TIME, Material.STAINED_CLAY, (byte) 14, true); + { + if (IsAlive(event.getPlayer())) + event.getRing().disable(BOOSTER_COOLDOWN_TIME, Material.STAINED_CLAY, (byte) 14, true); } public void registerBoosters() @@ -901,7 +909,13 @@ public abstract class Skyfall extends Game Player player = _tntMap.remove(event.getEntity()); for (Player other : UtilPlayer.getNearby(event.getEntity().getLocation(), TNT_EXPLOSION_RADIUS)) + { Manager.GetCondition().Factory().Explosion("Throwing TNT", other, player, 50, 0.1, false, false); + Manager.GetDamage().NewDamageEvent(other, player, null, DamageCause.ENTITY_EXPLOSION, 6, true, true, true, player.getName(), "Throwing TNT"); + } + + event.getEntity().getLocation().getWorld().playEffect(event.getEntity().getLocation(), Effect.EXPLOSION_LARGE, 100); + event.getEntity().getLocation().getWorld().playSound(event.getEntity().getLocation(), Sound.EXPLODE, 100, 1); event.setCancelled(true); } @@ -1022,6 +1036,22 @@ public abstract class Skyfall extends Game } } + @EventHandler + public void updateSpecs(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + return; + + if (!IsLive()) + return; + + for (Player player : UtilServer.getPlayers()) + { + if (!IsAlive(player)) + player.getInventory().setChestplate(new ItemStack(Material.ELYTRA)); + } + } + public boolean isDeathMatch() { return _deathmatch; 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 index ef02c6deb..6f1f84cdb 100644 --- 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 @@ -3,6 +3,7 @@ package nautilus.game.arcade.game.games.skyfall; import java.util.ArrayList; import java.util.List; +import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; @@ -25,6 +26,7 @@ import nautilus.game.arcade.game.modules.TeamModule; */ public class TeamSkyfall extends Skyfall { + private static final long BOOSTER_COOLDOWN_TIME = 1000*20; // 20 Seconds public TeamSkyfall(ArcadeManager manager) { @@ -34,7 +36,6 @@ public class TeamSkyfall extends Skyfall FillTeamsInOrderToCount = 2; SpawnNearAllies = true; - SpawnNearEnemies = true; DamageTeamSelf = false; @@ -154,6 +155,14 @@ public class TeamSkyfall extends Skyfall SetState(GameState.End); } } + + @EventHandler + @Override + public void ringBoost(PlayerBoostRingEvent event) + { + if (IsAlive(event.getPlayer())) + event.getRing().disableLater(3000, BOOSTER_COOLDOWN_TIME, Material.STAINED_CLAY, (byte) 14, true); + } @Override public List getWinners() From b42f3eb5fde1c29e756099cf02ffdf1f1f155885 Mon Sep 17 00:00:00 2001 From: xXVevzZXx Date: Wed, 23 Nov 2016 19:56:46 +0100 Subject: [PATCH 09/98] Fix final bugs and improve island system --- .../arcade/game/games/skyfall/Island.java | 2 +- .../arcade/game/games/skyfall/LootTable.java | 31 +++++- .../arcade/game/games/skyfall/Skyfall.java | 95 +++++++++++++++---- .../skyfall/kits/perks/PerkElytraBoost.java | 7 +- .../kits/perks/PerkIncreaseBoosters.java | 2 - .../games/skyfall/stats/RingStatTracker.java | 3 + 6 files changed, 108 insertions(+), 32 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skyfall/Island.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skyfall/Island.java index ba54fc98d..2afa9bed2 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skyfall/Island.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skyfall/Island.java @@ -142,7 +142,7 @@ public class Island extends Crumbleable public boolean isOnIsland(Location location) { - if (UtilMath.offset(location, _location) > _bounds) + if (UtilMath.offset(location, _location) > _bounds + 1) return false; for (int y = ((int) (Math.round(_location.getY()) - _height)); y <= _location.getBlockY(); y++) 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 b3752875e..444ed1bd2 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 @@ -14,7 +14,9 @@ import mineplex.core.loot.RandomItem; */ public class LootTable { - public final static LootTable BASIC = new LootTable( + // Survival Loot + + public final static LootTable BASIC = new LootTable(true, new RandomItem(Material.BAKED_POTATO, 30, 1, 3), new RandomItem(Material.COOKED_BEEF, 30, 1, 2), new RandomItem(Material.COOKED_CHICKEN, 30, 1, 2), @@ -71,7 +73,7 @@ public class LootTable new RandomItem(Material.DIAMOND, 30) ); - public final static LootTable SUPPLY_DROP = new LootTable( + public final static LootTable SUPPLY_DROP = new LootTable(true, new RandomItem(Material.DIAMOND_HELMET, 30), new RandomItem(Material.DIAMOND_LEGGINGS, 27), new RandomItem(Material.DIAMOND_BOOTS, 30), @@ -86,10 +88,26 @@ public class LootTable // new RandomItem(new Potion(PotionType.STRENGTH, 2, false).toItemStack(1), 3) ); + public final static LootTable ALL = new LootTable(BASIC.includes(SUPPLY_DROP)); + private RandomItem[] _items; + private boolean _unbreakable; + + private LootTable(LootTable table) + { + _unbreakable = table.isUnbreakable(); + _items = table.getItems(); + } private LootTable(RandomItem... items) { + _unbreakable = false; + _items = items; + } + + private LootTable(boolean unbreakable, RandomItem... items) + { + _unbreakable = unbreakable; _items = items; } @@ -98,9 +116,14 @@ public class LootTable return _items; } + public boolean isUnbreakable() + { + return _unbreakable; + } + public ChestLoot getloot() { - ChestLoot loot = new ChestLoot(); + ChestLoot loot = new ChestLoot(_unbreakable); for (RandomItem item : _items) { loot.addLoot(item); @@ -127,6 +150,6 @@ public class LootTable i++; } - return new LootTable(items); + return new LootTable(_unbreakable, items); } } 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 6cd6ed77c..d8183188f 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 @@ -31,6 +31,7 @@ import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.entity.EntityShootBowEvent; import org.bukkit.event.entity.ExplosionPrimeEvent; import org.bukkit.event.entity.PlayerDeathEvent; +import org.bukkit.event.inventory.CraftItemEvent; import org.bukkit.event.inventory.InventoryClickEvent; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerMoveEvent; @@ -57,6 +58,7 @@ import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilParticle; import mineplex.core.common.util.UtilParticle.ParticleType; import mineplex.core.common.util.UtilParticle.ViewDist; +import mineplex.core.loot.ChestLoot; import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilTime; @@ -115,8 +117,8 @@ public abstract class Skyfall extends Game private static final long EAT_RECHARGE = 500; // 0.5 Second - private int _islandBounds; - private int _islandHeight; + private int _bigIslandBounds; + private int _bigIslandHeight; private Island _upperIsland; private Island _lowerIsland; @@ -223,8 +225,8 @@ public abstract class Skyfall extends Game SpeedMeasurement = true; - _islandBounds = 25; - _islandHeight = 15; + _bigIslandBounds = 25; + _bigIslandHeight = 15; } @EventHandler @@ -558,9 +560,10 @@ public abstract class Skyfall extends Game block.setType(Material.CHEST); Chest chest = (Chest) block.getState(); + ChestLoot loot = LootTable.SUPPLY_DROP.getloot(); for (int i = 0; i < UtilMath.rRange(5, 8); i++) { - chest.getInventory().setItem(UtilMath.r(27), LootTable.SUPPLY_DROP.getloot().getLoot()); + chest.getInventory().setItem(UtilMath.r(27), loot.getLoot()); } _supplyDropOver = true; } @@ -680,21 +683,21 @@ public abstract class Skyfall extends Game _supplyDrop = WorldData.GetDataLocs("PINK").get(0); _deathMatchSpawns = (ArrayList) WorldData.GetDataLocs("BROWN").clone(); - _upperIsland = new Island(WorldData.GetDataLocs("GREEN").get(0), LootTable.BASIC, BIG_ISLAND_BOUNDS, BIG_ISLAND_HEIGHT); - _lowerIsland = new Island(WorldData.GetDataLocs("YELLOW").get(0), LootTable.BASIC, BIG_ISLAND_BOUNDS, BIG_ISLAND_HEIGHT); - for (String name : WorldData.GetAllCustomLocs().keySet()) { - if (name.split(" ")[0].equalsIgnoreCase("HEIGHT")) + if (name.split(" ")[0].equalsIgnoreCase("BIG_HEIGHT")) { - _islandHeight = Integer.parseInt(name.split(" ")[1]); + _bigIslandHeight = Integer.parseInt(name.split(" ")[1]); } - else if (name.split(" ")[0].equalsIgnoreCase("BOUNDS")) + else if (name.split(" ")[0].equalsIgnoreCase("BIG_BOUNDS")) { - _islandBounds = Integer.parseInt(name.split(" ")[1]); + _bigIslandBounds = Integer.parseInt(name.split(" ")[1]); } } + _upperIsland = new Island(WorldData.GetDataLocs("GREEN").get(0), LootTable.BASIC, _bigIslandBounds, _bigIslandHeight); + _lowerIsland = new Island(WorldData.GetDataLocs("YELLOW").get(0), LootTable.BASIC, _bigIslandBounds, _bigIslandHeight); + registerIslands(); registerBoosters(); @@ -735,21 +738,62 @@ public abstract class Skyfall extends Game { HashMap upperIslandMap = new HashMap<>(); - HashMap lowerIslandMap = new HashMap<>(); + HashMap lowerIslandMap = new HashMap<>(); + - ArrayList islands = WorldData.GetDataLocs("RED"); - - for (Location islandMid : islands) + for (String string : WorldData.GetAllDataLocs().keySet()) { - if (islandMid.getBlockY() >= _lowerIsland.getLocation().getBlockY()) + if (string.equalsIgnoreCase("ORANGE") || + string.equalsIgnoreCase("PINK") || + string.equalsIgnoreCase("BROWN") || + string.equalsIgnoreCase("GREEN") || + string.equalsIgnoreCase("YELLOW")) + continue; + + ArrayList islands = WorldData.GetDataLocs(string); + + int islandHeight = _bigIslandHeight; + int islandBounds = _bigIslandBounds; + String loot = "BASIC"; + + for (String name : WorldData.GetAllCustomLocs().keySet()) { - upperIslandMap.put(new Island(islandMid, LootTable.BASIC, _islandBounds, _islandHeight), islandMid.getBlockY()); + if (name.split(" ")[0].equalsIgnoreCase(string)) + { + if (name.split(" ")[1].equalsIgnoreCase("H")) + { + islandHeight = Integer.parseInt(name.split(" ")[2]); + } + if (name.split(" ")[1].equalsIgnoreCase("B")) + { + islandBounds = Integer.parseInt(name.split(" ")[2]); + } + if (name.split(" ")[1].equalsIgnoreCase("L")) + { + islandBounds = Integer.parseInt(name.split(" ")[2]); + } + } } - else + + for (Location islandMid : islands) { - lowerIslandMap.put(new Island(islandMid, LootTable.BASIC, _islandBounds, _islandHeight), islandMid.getBlockY()); + try + { + if (islandMid.getBlockY() >= _lowerIsland.getLocation().getBlockY()) + { + upperIslandMap.put(new Island(islandMid, (LootTable) LootTable.class.getField(loot).get(null), islandBounds, islandHeight), islandMid.getBlockY()); + } + else + { + lowerIslandMap.put(new Island(islandMid, (LootTable) LootTable.class.getField(loot).get(null), islandBounds, islandHeight), islandMid.getBlockY()); + } + } + catch (Exception e) + { + e.printStackTrace(); + } } - } + } IslandSorter upperSorter = new IslandSorter(upperIslandMap); IslandSorter lowerSorter = new IslandSorter(lowerIslandMap); @@ -1051,6 +1095,15 @@ public abstract class Skyfall extends Game player.getInventory().setChestplate(new ItemStack(Material.ELYTRA)); } } + + @EventHandler + public void craftedItems(CraftItemEvent event) + { + if (UtilItem.isWeapon(event.getCurrentItem()) || UtilItem.isArmor(event.getCurrentItem())) + { + UtilItem.makeUnbreakable(event.getCurrentItem()); + } + } public boolean isDeathMatch() { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skyfall/kits/perks/PerkElytraBoost.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skyfall/kits/perks/PerkElytraBoost.java index 4ad40b859..33b30aaa4 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skyfall/kits/perks/PerkElytraBoost.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skyfall/kits/perks/PerkElytraBoost.java @@ -92,13 +92,12 @@ public class PerkElytraBoost extends Perk while (i < 10 && !UtilPlayer.isGliding(player)) { UtilPlayer.setGliding(player, true); - - Vector vec = player.getEyeLocation().getDirection(); - UtilAction.velocity(player, vec.multiply(2.5)); - i++; } + Vector vec = player.getEyeLocation().getDirection(); + UtilAction.velocity(player, vec.multiply(2.5)); + UtilFirework.playFirework(player.getEyeLocation(), Type.BALL_LARGE, Color.BLUE, true, false); } }, 4); 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 a4fe39dff..85e374d9f 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 @@ -37,8 +37,6 @@ 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/stats/RingStatTracker.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skyfall/stats/RingStatTracker.java index 8eaec3ee2..1260222a6 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skyfall/stats/RingStatTracker.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skyfall/stats/RingStatTracker.java @@ -29,6 +29,9 @@ public class RingStatTracker extends StatTracker if (event.isCancelled()) return; + if (!getGame().IsAlive(event.getPlayer())) + return; + addStat(event.getPlayer(), "Rings", 1, false, false); } From 4f9cf987bd16fe5a7a79795cc6516a61c5ca3fb2 Mon Sep 17 00:00:00 2001 From: Sarah Date: Wed, 15 Mar 2017 21:30:48 +0100 Subject: [PATCH 10/98] Change block rates and add Rate command --- .../game/games/skyfall/BoosterRing.java | 3 + .../arcade/game/games/skyfall/Skyfall.java | 61 +++++++++++++------ 2 files changed, 46 insertions(+), 18 deletions(-) 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 0d93a5846..fe248ae2b 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 @@ -355,6 +355,9 @@ public class BoosterRing extends Crumbleable implements Listener if (!_disabled) return; + if (isCrumbling()) + return; + double blocks = (double) _ring.size() / (double)(_disabledFor/1000); _blocksToFill += blocks; 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 ccdfed785..8910b4a3d 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 @@ -33,6 +33,7 @@ import org.bukkit.event.entity.ExplosionPrimeEvent; import org.bukkit.event.entity.PlayerDeathEvent; import org.bukkit.event.inventory.CraftItemEvent; import org.bukkit.event.inventory.InventoryClickEvent; +import org.bukkit.event.player.PlayerCommandPreprocessEvent; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerMoveEvent; import org.bukkit.inventory.ItemStack; @@ -45,6 +46,7 @@ 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.Rank; import mineplex.core.common.util.C; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilAction; @@ -71,6 +73,8 @@ import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.GameType; import nautilus.game.arcade.events.GameStateChangeEvent; import nautilus.game.arcade.game.Game; +import nautilus.game.arcade.game.GameTeam; +import nautilus.game.arcade.game.Game.GameState; 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; @@ -80,6 +84,8 @@ import nautilus.game.arcade.game.games.skyfall.kits.KitStunner; import nautilus.game.arcade.game.games.skyfall.stats.AeronaughtStatTracker; import nautilus.game.arcade.game.games.skyfall.stats.RingStatTracker; import nautilus.game.arcade.game.games.survivalgames.SupplyChestOpenEvent; +import nautilus.game.arcade.game.games.typewars.Minion; +import nautilus.game.arcade.game.games.typewars.MinionSize; import nautilus.game.arcade.game.modules.VersionModule; import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.stats.FirstSupplyDropOpenStatTracker; @@ -100,8 +106,9 @@ public abstract class Skyfall extends Game private static final long RING_ROT_TIME = 1000*60*3; // 3 Minutes - private static final int ISLAND_CRUMBLE_RATE = 7; - private static final int BIG_ISLAND_CRUMBLE_RATE = 5; + private static int ISLAND_CRUMBLE_RATE = 20; + private static int BIG_ISLAND_CRUMBLE_RATE = 20; + private static final int RING_CRUMBLE_RATE = 3; private static final float RING_BOOST_STRENGTH = 2.5F; private static final float BIG_RING_BOOST_STRENGTH = 3.5F; @@ -149,7 +156,7 @@ public abstract class Skyfall extends Game private int _currentCrumble = 300; private boolean _supplyOpened; - private int _ringCrumbleRate; + //private int _ringCrumbleRate; public Skyfall(ArcadeManager manager, GameType type) { @@ -228,6 +235,24 @@ public abstract class Skyfall extends Game _bigIslandHeight = 15; } + @EventHandler + public void testCommands(PlayerCommandPreprocessEvent event) + { + if(GetState() != GameState.Live) + return; + + if(event.getMessage().contains("/Rate")) + { + int rate = Integer.parseInt(event.getMessage().split(" ")[1]); + ISLAND_CRUMBLE_RATE = rate; + BIG_ISLAND_CRUMBLE_RATE = rate; + UtilPlayer.message(event.getPlayer(), "Crumble rate changed to " + rate); + event.setCancelled(true); + return; + } + + } + @EventHandler public void gameStart(GameStateChangeEvent event) { @@ -380,14 +405,14 @@ public abstract class Skyfall extends Game if (!_upperIsland.crumble(BIG_ISLAND_CRUMBLE_RATE, Material.COAL_BLOCK, Material.ENDER_STONE)) { - _currentCrumble = _upperIsland.getLocation().getBlockY(); + _currentCrumble = (_upperIsland.getLocation().getBlockY() - _upperIsland.getHeight()); return islands; } else { while (!_upperIsland.getBoosterRing().isCrumbledAway()) { - _upperIsland.getBoosterRing().crumble(_ringCrumbleRate, Material.COAL_BLOCK, Material.ENDER_STONE); + _upperIsland.getBoosterRing().crumble(RING_CRUMBLE_RATE, Material.COAL_BLOCK, Material.ENDER_STONE); } } for (Island island : _islands.get(_lowerIsland).keySet()) @@ -403,12 +428,12 @@ public abstract class Skyfall extends Game if (_lowerIsland.crumblePercentage() <= 0.5) islands.add(_lowerIsland); - _currentCrumble = _lowerIsland.getLocation().getBlockY(); + _currentCrumble = (_lowerIsland.getLocation().getBlockY() - _lowerIsland.getHeight()); if (_lowerIsland.crumble(BIG_ISLAND_CRUMBLE_RATE, Material.COAL_BLOCK, Material.ENDER_STONE)) { while (!_lowerIsland.getBoosterRing().isCrumbledAway()) { - _lowerIsland.getBoosterRing().crumble(_ringCrumbleRate, Material.COAL_BLOCK, Material.ENDER_STONE); + _lowerIsland.getBoosterRing().crumble(RING_CRUMBLE_RATE, Material.COAL_BLOCK, Material.ENDER_STONE); } _currentCrumble = 0; } @@ -483,7 +508,7 @@ public abstract class Skyfall extends Game @EventHandler public void ringCrumble(UpdateEvent event) { - if (event.getType() != UpdateType.SEC) + if (event.getType() != UpdateType.FAST) return; if (!UtilTime.elapsed(GetStateTime(), MAP_CRUMBLE_DELAY)) @@ -491,10 +516,10 @@ public abstract class Skyfall extends Game for (BoosterRing ring : _boosterRings) { -// if (ring.getMiddle().getBlockY() < _currentCrumble) -// continue; + if (ring.getMiddle().getBlockY() < _currentCrumble) + continue; - if (!ring.crumble(_ringCrumbleRate, Material.COAL_BLOCK, Material.ENDER_STONE)) + if (!ring.crumble(RING_CRUMBLE_RATE, Material.COAL_BLOCK, Material.ENDER_STONE)) break; } } @@ -715,7 +740,7 @@ public abstract class Skyfall extends Game public void registerBoosters() { - int blocks = 0; + //int blocks = 0; ArrayList boosters = WorldData.GetDataLocs("ORANGE"); for (Location boosterMid : boosters) { @@ -733,12 +758,12 @@ public abstract class Skyfall extends Game ring.setBoostStrength(BIG_RING_BOOST_STRENGTH); } - blocks += ring.getBlocks().size(); - int secs = (int) (RING_ROT_TIME / 1000); - _ringCrumbleRate = blocks / secs; - - if (_ringCrumbleRate < 1) - _ringCrumbleRate = 1; +// blocks += ring.getBlocks().size(); +// int secs = (int) (RING_ROT_TIME / 1000); +// _ringCrumbleRate = blocks / secs; +// +// if (_ringCrumbleRate < 1) +// _ringCrumbleRate = 1; _boosterRings.add(ring); } From 92f5214c91a27e98a214e910b7c2606fe06b88c0 Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Fri, 17 Mar 2017 19:39:41 -0300 Subject: [PATCH 11/98] Added spring halo particle --- .../mineplex/core/gadget/GadgetManager.java | 2 + .../gadgets/particle/ParticleSpringHalo.java | 63 +++++++++++++++++++ .../core/gadget/types/ParticleGadget.java | 9 ++- .../core/particleeffects/CircleEffect.java | 19 +++++- 4 files changed, 90 insertions(+), 3 deletions(-) create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleSpringHalo.java diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java index d2acbf740..242017566 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java @@ -164,6 +164,7 @@ import mineplex.core.gadget.gadgets.particle.ParticleCoalFumes; import mineplex.core.gadget.gadgets.particle.ParticleFairy; import mineplex.core.gadget.gadgets.particle.ParticleFireRings; import mineplex.core.gadget.gadgets.particle.ParticleLegend; +import mineplex.core.gadget.gadgets.particle.ParticleSpringHalo; import mineplex.core.gadget.gadgets.particle.ParticleWingsAngel; import mineplex.core.gadget.gadgets.particle.ParticleWingsDemons; import mineplex.core.gadget.gadgets.particle.ParticleWingsInfernal; @@ -447,6 +448,7 @@ public class GadgetManager extends MiniPlugin addGadget(new ParticleFreedom(this)); addGadget(new ParticleChristmasTree(this)); addGadget(new ParticleWingsLove(this)); + addGadget(new ParticleSpringHalo(this)); // Arrow Trails addGadget(new ArrowTrailFrostLord(this)); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleSpringHalo.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleSpringHalo.java new file mode 100644 index 000000000..c39203a27 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleSpringHalo.java @@ -0,0 +1,63 @@ +package mineplex.core.gadget.gadgets.particle; + +import java.awt.Color; +import java.time.Month; +import java.time.YearMonth; +import java.util.HashMap; +import java.util.Map; + +import org.bukkit.Material; +import org.bukkit.entity.Player; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.LineFormat; +import mineplex.core.common.util.UtilText; +import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.types.ParticleGadget; +import mineplex.core.particleeffects.CircleEffect; +import mineplex.core.updater.event.UpdateEvent; + +public class ParticleSpringHalo extends ParticleGadget +{ + + private Map _effects = new HashMap<>(); + + public ParticleSpringHalo(GadgetManager manager) + { + // TODO CHANGE LORE BEFORE RELEASE + super(manager, "Spring Halo", UtilText.splitLinesToArray(new String[]{C.cGray + "Placeholder"}, LineFormat.LORE), -14, Material.GLASS, (byte) 0, YearMonth.of(2017, Month.APRIL)); + } + + @Override + public void enableCustom(Player player, boolean message) + { + super.enableCustom(player, message); + CircleEffect circleEffect = new CircleEffect(Manager.getPlugin(), player, 0.7d, Color.RED, false); + circleEffect.addRandomColor(Color.YELLOW); + circleEffect.addRandomColor(Color.BLUE); + circleEffect.addRandomColor(Color.GREEN); + circleEffect.setYOffset(2.3d); + circleEffect.start(); + _effects.put(player, circleEffect); + } + + @Override + public void disableCustom(Player player, boolean message) + { + super.disableCustom(player, message); + if (_effects.containsKey(player)) + { + CircleEffect circleEffect = _effects.get(player); + if (circleEffect != null) + { + circleEffect.stop(); + } + } + _effects.remove(player); + } + + @Override + public void playParticle(Player player, UpdateEvent event) + {} + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/ParticleGadget.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/ParticleGadget.java index 06af3908b..e04db2a61 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/ParticleGadget.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/ParticleGadget.java @@ -1,5 +1,7 @@ package mineplex.core.gadget.types; +import java.time.YearMonth; + import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; @@ -28,7 +30,12 @@ public abstract class ParticleGadget extends Gadget public ParticleGadget(GadgetManager manager, String name, String[] desc, int cost, Material mat, byte data, String...altNames) { super(manager, GadgetType.PARTICLE, name, desc, cost, mat, data, 1, altNames); - } + } + + public ParticleGadget(GadgetManager manager, String name, String[] desc, int cost, Material mat, byte data, YearMonth yearMonth, String... altNames) + { + super(manager, GadgetType.PARTICLE, name, desc, cost, mat, data, yearMonth, 1, altNames); + } @Override public void enableCustom(Player player, boolean message) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/particleeffects/CircleEffect.java b/Plugins/Mineplex.Core/src/mineplex/core/particleeffects/CircleEffect.java index 8d1ae23d1..f9ff7b3a3 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/particleeffects/CircleEffect.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/particleeffects/CircleEffect.java @@ -5,6 +5,7 @@ import java.util.ArrayList; import java.util.List; import org.bukkit.Location; +import org.bukkit.entity.Entity; import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.util.Vector; @@ -23,6 +24,7 @@ public class CircleEffect extends Effect private List _randomColors = new ArrayList<>(); private int _maxCircles = -1; private int _totalCircles = 0; + private double _yOffset = 0.0; private static final double RANDOM_COLOR_CHANCE = 0.5; private static final int PARTICLES_PER_CIRCLE = 20; @@ -40,6 +42,14 @@ public class CircleEffect extends Effect _instantly = instantly; } + public CircleEffect(JavaPlugin plugin, Entity entity, double radius, Color color, boolean instantly) + { + super(-1, new EffectLocation(entity), plugin); + _radius = radius; + _color = color; + _instantly = instantly; + } + public void addRandomColor(Color color) { _randomColors.add(color); @@ -50,6 +60,11 @@ public class CircleEffect extends Effect _maxCircles = circles; } + public void setYOffset(double yOffset) + { + _yOffset = yOffset; + } + @Override public void runEffect() { @@ -57,7 +72,7 @@ public class CircleEffect extends Effect { for (int i = 0; i < PARTICLES_PER_CIRCLE; i++) { - Location location = getEffectLocation().getFixedLocation(); + Location location = getEffectLocation().getLocation().add(0, _yOffset, 0); double increment = (2 * Math.PI) / PARTICLES_PER_CIRCLE; double angle = _steps * increment; Vector vector = new Vector(Math.cos(angle) * _radius, 0, Math.sin(angle) * _radius); @@ -86,7 +101,7 @@ public class CircleEffect extends Effect return; } } - Location location = getEffectLocation().getFixedLocation(); + Location location = getEffectLocation().getLocation().add(0, _yOffset, 0); double increment = (2 * Math.PI) / PARTICLES_PER_CIRCLE; double angle = _steps * increment; Vector vector = new Vector(Math.cos(angle) * _radius, 0, Math.sin(angle) * _radius); From d8b68e4716d5eaa2a6f3ab73d5aa293276c05fa5 Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Fri, 17 Mar 2017 20:01:48 -0300 Subject: [PATCH 12/98] Multi colored circle --- .../gadgets/particle/ParticleSpringHalo.java | 12 +-- .../particleeffects/ColoredCircleEffect.java | 94 +++++++++++++++++++ 2 files changed, 99 insertions(+), 7 deletions(-) create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/particleeffects/ColoredCircleEffect.java diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleSpringHalo.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleSpringHalo.java index c39203a27..bc7d54980 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleSpringHalo.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleSpringHalo.java @@ -14,13 +14,13 @@ import mineplex.core.common.util.LineFormat; import mineplex.core.common.util.UtilText; import mineplex.core.gadget.GadgetManager; import mineplex.core.gadget.types.ParticleGadget; -import mineplex.core.particleeffects.CircleEffect; +import mineplex.core.particleeffects.ColoredCircleEffect; import mineplex.core.updater.event.UpdateEvent; public class ParticleSpringHalo extends ParticleGadget { - private Map _effects = new HashMap<>(); + private Map _effects = new HashMap<>(); public ParticleSpringHalo(GadgetManager manager) { @@ -32,10 +32,8 @@ public class ParticleSpringHalo extends ParticleGadget public void enableCustom(Player player, boolean message) { super.enableCustom(player, message); - CircleEffect circleEffect = new CircleEffect(Manager.getPlugin(), player, 0.7d, Color.RED, false); - circleEffect.addRandomColor(Color.YELLOW); - circleEffect.addRandomColor(Color.BLUE); - circleEffect.addRandomColor(Color.GREEN); + ColoredCircleEffect circleEffect = new ColoredCircleEffect(Manager.getPlugin(), player, 0.7d, false, + Color.RED, Color.GREEN, Color.BLUE, Color.YELLOW); circleEffect.setYOffset(2.3d); circleEffect.start(); _effects.put(player, circleEffect); @@ -47,7 +45,7 @@ public class ParticleSpringHalo extends ParticleGadget super.disableCustom(player, message); if (_effects.containsKey(player)) { - CircleEffect circleEffect = _effects.get(player); + ColoredCircleEffect circleEffect = _effects.get(player); if (circleEffect != null) { circleEffect.stop(); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/particleeffects/ColoredCircleEffect.java b/Plugins/Mineplex.Core/src/mineplex/core/particleeffects/ColoredCircleEffect.java new file mode 100644 index 000000000..2218cba9c --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/particleeffects/ColoredCircleEffect.java @@ -0,0 +1,94 @@ +package mineplex.core.particleeffects; + +import java.awt.Color; + +import org.bukkit.Location; +import org.bukkit.entity.Entity; +import org.bukkit.plugin.java.JavaPlugin; +import org.bukkit.util.Vector; + +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.particles.ColoredParticle; +import mineplex.core.common.util.particles.DustSpellColor; + +public class ColoredCircleEffect extends Effect +{ + + private double _radius; + private Color[] _colors; + private int _steps = 0; + private boolean _instantly = true; + private int _maxCircles = -1; + private int _totalCircles = 0; + private double _yOffset = 0.0; + + private static final int PARTICLES_PER_CIRCLE = 20; + + public ColoredCircleEffect(JavaPlugin plugin, Entity entity, double radius, boolean instantly, Color... colors) + { + super(-1, new EffectLocation(entity), plugin); + _radius = radius; + _colors = colors; + _instantly = instantly; + } + + public void setMaxCircles(int circles) + { + _maxCircles = circles; + } + + public void setYOffset(double yOffset) + { + _yOffset = yOffset; + } + + @Override + public void runEffect() + { + if (_instantly) + { + for (int i = 0; i < PARTICLES_PER_CIRCLE; i++) + { + Location location = getEffectLocation().getLocation().add(0, _yOffset, 0); + double increment = (2 * Math.PI) / PARTICLES_PER_CIRCLE; + double angle = _steps * increment; + Vector vector = new Vector(Math.cos(angle) * _radius, 0, Math.sin(angle) * _radius); + ColoredParticle coloredParticle = new ColoredParticle(UtilParticle.ParticleType.RED_DUST, new DustSpellColor(getNextColor()), location.add(vector)); + coloredParticle.display(); + _steps++; + } + stop(); + } + else + { + if (_maxCircles != -1) + { + if (_totalCircles >= _maxCircles) + { + stop(); + return; + } + } + Location location = getEffectLocation().getLocation().add(0, _yOffset, 0); + double increment = (2 * Math.PI) / PARTICLES_PER_CIRCLE; + double angle = _steps * increment; + Vector vector = new Vector(Math.cos(angle) * _radius, 0, Math.sin(angle) * _radius); + ColoredParticle coloredParticle = new ColoredParticle(UtilParticle.ParticleType.RED_DUST, new DustSpellColor(getNextColor()), location.add(vector)); + coloredParticle.display(); + _steps++; + if (_steps >= PARTICLES_PER_CIRCLE) + { + _totalCircles++; + _steps = 0; + } + } + } + + private Color getNextColor() + { + int r = UtilMath.random.nextInt(_colors.length - 1); + return _colors[r]; + } + +} From e1d9a568c953146edf245c0657771d719b61a610 Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Sat, 18 Mar 2017 00:49:12 -0300 Subject: [PATCH 13/98] Added flower as a hat --- .../core/gadget/gadgets/particle/ParticleSpringHalo.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleSpringHalo.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleSpringHalo.java index bc7d54980..e47574e7e 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleSpringHalo.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleSpringHalo.java @@ -8,11 +8,14 @@ import java.util.Map; import org.bukkit.Material; import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; import mineplex.core.common.util.C; import mineplex.core.common.util.LineFormat; import mineplex.core.common.util.UtilText; import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.types.GadgetType; +import mineplex.core.gadget.types.OutfitGadget; import mineplex.core.gadget.types.ParticleGadget; import mineplex.core.particleeffects.ColoredCircleEffect; import mineplex.core.updater.event.UpdateEvent; @@ -32,11 +35,14 @@ public class ParticleSpringHalo extends ParticleGadget public void enableCustom(Player player, boolean message) { super.enableCustom(player, message); + Manager.removeGadgetType(player, GadgetType.MORPH, this); + Manager.removeOutfit(player, OutfitGadget.ArmorSlot.HELMET); ColoredCircleEffect circleEffect = new ColoredCircleEffect(Manager.getPlugin(), player, 0.7d, false, Color.RED, Color.GREEN, Color.BLUE, Color.YELLOW); circleEffect.setYOffset(2.3d); circleEffect.start(); _effects.put(player, circleEffect); + player.getEquipment().setHelmet(new ItemStack(Material.RED_ROSE, 1, (byte) 8)); } @Override @@ -52,6 +58,7 @@ public class ParticleSpringHalo extends ParticleGadget } } _effects.remove(player); + player.getInventory().setHelmet(null); } @Override From 75ad5b9d513a93b28209ce016643341e3fd754f1 Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Mon, 20 Mar 2017 08:23:32 -0300 Subject: [PATCH 14/98] Flowers where player walks --- .../mineplex/core/common/util/UtilBlock.java | 31 ++-- .../mineplex/core/gadget/GadgetManager.java | 2 +- .../gadgets/particle/ParticleSpringHalo.java | 68 -------- .../particle/spring/ParticleSpringHalo.java | 161 ++++++++++++++++++ .../particle/spring/SpringHaloData.java | 34 ++++ 5 files changed, 217 insertions(+), 79 deletions(-) delete mode 100644 Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleSpringHalo.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/spring/ParticleSpringHalo.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/spring/SpringHaloData.java diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilBlock.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilBlock.java index 6a43363de..91c93c620 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilBlock.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilBlock.java @@ -7,6 +7,16 @@ import java.util.HashSet; import java.util.Set; import java.util.UUID; +import net.minecraft.server.v1_8_R3.BlockPosition; +import net.minecraft.server.v1_8_R3.Blocks; +import net.minecraft.server.v1_8_R3.IBlockData; +import net.minecraft.server.v1_8_R3.Item; +import net.minecraft.server.v1_8_R3.MathHelper; +import net.minecraft.server.v1_8_R3.MinecraftKey; +import net.minecraft.server.v1_8_R3.NBTTagCompound; +import net.minecraft.server.v1_8_R3.TileEntityFlowerPot; +import net.minecraft.server.v1_8_R3.WorldServer; + import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.SkullType; @@ -35,15 +45,6 @@ import com.mojang.authlib.GameProfile; import mineplex.core.common.Pair; import mineplex.core.common.block.MultiBlockUpdaterAgent; import mineplex.core.common.skin.SkinData; -import net.minecraft.server.v1_8_R3.BlockPosition; -import net.minecraft.server.v1_8_R3.Blocks; -import net.minecraft.server.v1_8_R3.IBlockData; -import net.minecraft.server.v1_8_R3.Item; -import net.minecraft.server.v1_8_R3.MathHelper; -import net.minecraft.server.v1_8_R3.MinecraftKey; -import net.minecraft.server.v1_8_R3.NBTTagCompound; -import net.minecraft.server.v1_8_R3.TileEntityFlowerPot; -import net.minecraft.server.v1_8_R3.WorldServer; public class UtilBlock { @@ -394,7 +395,17 @@ public class UtilBlock { return blockUseSet.contains(block); } - + + public static Set getBlocksInRadius(Location loc, double radius) + { + return getInRadius(loc, radius).keySet(); + } + + public static Set getBlocksInRadius(Location loc, double radius, int maxHeight) + { + return getInRadius(loc, radius, maxHeight).keySet(); + } + public static HashMap getInRadius(Location loc, double dR) { return getInRadius(loc, dR, 9999); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java index 242017566..35ae1e96c 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java @@ -164,7 +164,7 @@ import mineplex.core.gadget.gadgets.particle.ParticleCoalFumes; import mineplex.core.gadget.gadgets.particle.ParticleFairy; import mineplex.core.gadget.gadgets.particle.ParticleFireRings; import mineplex.core.gadget.gadgets.particle.ParticleLegend; -import mineplex.core.gadget.gadgets.particle.ParticleSpringHalo; +import mineplex.core.gadget.gadgets.particle.spring.ParticleSpringHalo; import mineplex.core.gadget.gadgets.particle.ParticleWingsAngel; import mineplex.core.gadget.gadgets.particle.ParticleWingsDemons; import mineplex.core.gadget.gadgets.particle.ParticleWingsInfernal; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleSpringHalo.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleSpringHalo.java deleted file mode 100644 index e47574e7e..000000000 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleSpringHalo.java +++ /dev/null @@ -1,68 +0,0 @@ -package mineplex.core.gadget.gadgets.particle; - -import java.awt.Color; -import java.time.Month; -import java.time.YearMonth; -import java.util.HashMap; -import java.util.Map; - -import org.bukkit.Material; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; - -import mineplex.core.common.util.C; -import mineplex.core.common.util.LineFormat; -import mineplex.core.common.util.UtilText; -import mineplex.core.gadget.GadgetManager; -import mineplex.core.gadget.types.GadgetType; -import mineplex.core.gadget.types.OutfitGadget; -import mineplex.core.gadget.types.ParticleGadget; -import mineplex.core.particleeffects.ColoredCircleEffect; -import mineplex.core.updater.event.UpdateEvent; - -public class ParticleSpringHalo extends ParticleGadget -{ - - private Map _effects = new HashMap<>(); - - public ParticleSpringHalo(GadgetManager manager) - { - // TODO CHANGE LORE BEFORE RELEASE - super(manager, "Spring Halo", UtilText.splitLinesToArray(new String[]{C.cGray + "Placeholder"}, LineFormat.LORE), -14, Material.GLASS, (byte) 0, YearMonth.of(2017, Month.APRIL)); - } - - @Override - public void enableCustom(Player player, boolean message) - { - super.enableCustom(player, message); - Manager.removeGadgetType(player, GadgetType.MORPH, this); - Manager.removeOutfit(player, OutfitGadget.ArmorSlot.HELMET); - ColoredCircleEffect circleEffect = new ColoredCircleEffect(Manager.getPlugin(), player, 0.7d, false, - Color.RED, Color.GREEN, Color.BLUE, Color.YELLOW); - circleEffect.setYOffset(2.3d); - circleEffect.start(); - _effects.put(player, circleEffect); - player.getEquipment().setHelmet(new ItemStack(Material.RED_ROSE, 1, (byte) 8)); - } - - @Override - public void disableCustom(Player player, boolean message) - { - super.disableCustom(player, message); - if (_effects.containsKey(player)) - { - ColoredCircleEffect circleEffect = _effects.get(player); - if (circleEffect != null) - { - circleEffect.stop(); - } - } - _effects.remove(player); - player.getInventory().setHelmet(null); - } - - @Override - public void playParticle(Player player, UpdateEvent event) - {} - -} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/spring/ParticleSpringHalo.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/spring/ParticleSpringHalo.java new file mode 100644 index 000000000..0b995504d --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/spring/ParticleSpringHalo.java @@ -0,0 +1,161 @@ +package mineplex.core.gadget.gadgets.particle.spring; + +import java.awt.Color; +import java.time.Month; +import java.time.YearMonth; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +import org.bukkit.Material; +import org.bukkit.block.Block; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.player.PlayerMoveEvent; +import org.bukkit.inventory.ItemStack; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.LineFormat; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilText; +import mineplex.core.common.util.UtilTime; +import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.types.GadgetType; +import mineplex.core.gadget.types.OutfitGadget; +import mineplex.core.gadget.types.ParticleGadget; +import mineplex.core.particleeffects.ColoredCircleEffect; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; + +public class ParticleSpringHalo extends ParticleGadget +{ + + private Map _effects = new HashMap<>(); + private List _springHaloData = new ArrayList<>(); + private Map> _playerSpringHaloData = new HashMap<>(); + + public ParticleSpringHalo(GadgetManager manager) + { + // TODO CHANGE LORE BEFORE RELEASE + super(manager, "Spring Halo", UtilText.splitLinesToArray(new String[]{C.cGray + "Placeholder"}, LineFormat.LORE), -14, Material.GLASS, (byte) 0, YearMonth.of(2017, Month.APRIL)); + } + + @Override + public void enableCustom(Player player, boolean message) + { + super.enableCustom(player, message); + Manager.removeGadgetType(player, GadgetType.MORPH, this); + Manager.removeOutfit(player, OutfitGadget.ArmorSlot.HELMET); + ColoredCircleEffect circleEffect = new ColoredCircleEffect(Manager.getPlugin(), player, 0.7d, false, + Color.RED, Color.GREEN, Color.BLUE, Color.YELLOW); + circleEffect.setYOffset(2.3d); + circleEffect.start(); + _effects.put(player, circleEffect); + player.getEquipment().setHelmet(new ItemStack(Material.RED_ROSE, 1, (byte) 8)); + } + + @Override + public void disableCustom(Player player, boolean message) + { + super.disableCustom(player, message); + if (_effects.containsKey(player)) + { + ColoredCircleEffect circleEffect = _effects.get(player); + if (circleEffect != null) + { + circleEffect.stop(); + } + } + _effects.remove(player); + player.getInventory().setHelmet(null); + if (_playerSpringHaloData.containsKey(player)) + { + Iterator iterator = _playerSpringHaloData.get(player).iterator(); + while (iterator.hasNext()) + { + SpringHaloData springHaloData = iterator.next(); + springHaloData.getBlock().setType(Material.AIR); + springHaloData.getBlock().setData((byte) 0); + removeSpringHalo(springHaloData); + } + _playerSpringHaloData.get(player).clear(); + _playerSpringHaloData.remove(player); + } + } + + @Override + public void playParticle(Player player, UpdateEvent event) + { + } + + @EventHandler + public void spawnFlowers(PlayerMoveEvent event) + { + if (!isActive(event.getPlayer())) + return; + + Player player = event.getPlayer(); + + Block block = event.getFrom().getBlock(); + if (block.getType() != Material.AIR) + return; + + if (block.getLocation().subtract(0, 1, 0).getBlock().getType() != Material.GRASS + && block.getLocation().subtract(0, 1, 0).getBlock().getType() != Material.DIRT) + return; + + block.setType(Material.RED_ROSE); + block.setData((byte) UtilMath.random.nextInt(8)); + SpringHaloData springHaloData = new SpringHaloData(player, block, System.currentTimeMillis()); + addFlower(player, springHaloData); + } + + @EventHandler + public void onUpdate(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + Iterator iterator = _springHaloData.iterator(); + while (iterator.hasNext()) + { + SpringHaloData springHaloData = iterator.next(); + if (UtilTime.elapsed(springHaloData.getSpawned(), 1500)) + { + springHaloData.getBlock().setType(Material.AIR); + springHaloData.getBlock().setData((byte) 0); + removeSpringHalo(springHaloData); + iterator.remove(); + } + } + } + + private void addFlower(Player player, SpringHaloData springHaloData) + { + _springHaloData.add(springHaloData); + if (_playerSpringHaloData.containsKey(player)) + { + List list = _playerSpringHaloData.get(player); + list.add(springHaloData); + } + else + { + List list = new ArrayList<>(); + list.add(springHaloData); + _playerSpringHaloData.put(player, list); + } + } + + private void removeSpringHalo(SpringHaloData springHaloData) + { + Player player = springHaloData.getPlayer(); + List list = _playerSpringHaloData.get(player); + if (list != null) + { + list.remove(springHaloData); + } + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/spring/SpringHaloData.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/spring/SpringHaloData.java new file mode 100644 index 000000000..c497b99a9 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/spring/SpringHaloData.java @@ -0,0 +1,34 @@ +package mineplex.core.gadget.gadgets.particle.spring; + +import org.bukkit.block.Block; +import org.bukkit.entity.Player; + +public class SpringHaloData +{ + + private Player _player; + private Block _block; + private long _spawned; + + public SpringHaloData(Player player, Block block, long spawned) + { + _player = player; + _block = block; + _spawned = spawned; + } + + public Player getPlayer() + { + return _player; + } + + public Block getBlock() + { + return _block; + } + + public long getSpawned() + { + return _spawned; + } +} From afad64bec3126fbc8ddf4ecec5ee40756980b30c Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Mon, 20 Mar 2017 08:49:20 -0300 Subject: [PATCH 15/98] Fixed CME --- .../core/gadget/gadgets/particle/spring/ParticleSpringHalo.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/spring/ParticleSpringHalo.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/spring/ParticleSpringHalo.java index 0b995504d..8aa34525b 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/spring/ParticleSpringHalo.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/spring/ParticleSpringHalo.java @@ -78,7 +78,7 @@ public class ParticleSpringHalo extends ParticleGadget SpringHaloData springHaloData = iterator.next(); springHaloData.getBlock().setType(Material.AIR); springHaloData.getBlock().setData((byte) 0); - removeSpringHalo(springHaloData); + iterator.remove(); } _playerSpringHaloData.get(player).clear(); _playerSpringHaloData.remove(player); From f8f7c04f58825c93ada2993990d287d631d8ef40 Mon Sep 17 00:00:00 2001 From: Sarah Date: Mon, 20 Mar 2017 19:18:33 +0100 Subject: [PATCH 16/98] Improve Performance, add dynamic rot rate, change some loot and islands only rot on the top --- .../src/mineplex/core/loot/ChestLoot.java | 28 +++++- .../src/mineplex/core/loot/RandomItem.java | 11 +++ .../game/games/skyfall/BoosterRing.java | 2 + .../game/games/skyfall/Crumbleable.java | 89 ++++++++++++++++--- .../arcade/game/games/skyfall/Island.java | 24 +++-- .../arcade/game/games/skyfall/LootTable.java | 34 ++++++- .../arcade/game/games/skyfall/Skyfall.java | 45 ++++++---- 7 files changed, 193 insertions(+), 40 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/loot/ChestLoot.java b/Plugins/Mineplex.Core/src/mineplex/core/loot/ChestLoot.java index 4dcf4eab3..39b89cfa2 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/loot/ChestLoot.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/loot/ChestLoot.java @@ -1,6 +1,7 @@ package mineplex.core.loot; import java.util.ArrayList; +import java.util.Iterator; import mineplex.core.common.util.UtilMath; @@ -32,9 +33,32 @@ public class ChestLoot public ItemStack getLoot() { - int no = UtilMath.r(_totalLoot); + return getLoot(new ArrayList<>()); + } + + public ItemStack getLoot(ArrayList exclude) + { + int totalLoot = _totalLoot; + ArrayList items = (ArrayList) _randomItems.clone(); + + Iterator rItems = items.iterator(); + while (rItems.hasNext()) + { + RandomItem item = rItems.next(); + + for (Material mat : exclude) + { + if (item.getItemStack().getType() == mat) + { + totalLoot -= item.getAmount(); + rItems.remove(); + } + } + } + + int no = UtilMath.r(totalLoot); - for (RandomItem item : _randomItems) + for (RandomItem item : items) { no -= item.getAmount(); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/loot/RandomItem.java b/Plugins/Mineplex.Core/src/mineplex/core/loot/RandomItem.java index c903c6fa3..7e7eef062 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/loot/RandomItem.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/loot/RandomItem.java @@ -48,4 +48,15 @@ public class RandomItem return _item; } + + @Override + public boolean equals(Object obj) + { + if (!(obj instanceof RandomItem)) + return false; + + RandomItem item = (RandomItem) obj; + + return _item.getType() == item.getItemStack().getType(); + } } \ No newline at end of file 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 fe248ae2b..0607c8cae 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 @@ -108,6 +108,8 @@ public class BoosterRing extends Crumbleable implements Listener _hologram = new Hologram(host.getArcadeManager().getHologramManager(), _ringMiddle, ""); _hologram.setViewDistance(300); + + init(); } @EventHandler diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skyfall/Crumbleable.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skyfall/Crumbleable.java index 35c60e998..e50a6bb09 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skyfall/Crumbleable.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skyfall/Crumbleable.java @@ -4,6 +4,8 @@ import java.util.ArrayList; import org.bukkit.Location; import org.bukkit.Material; +import org.bukkit.block.Block; +import org.bukkit.block.BlockFace; import mineplex.core.common.util.MapUtil; import mineplex.core.common.util.UtilMath; @@ -18,6 +20,69 @@ public abstract class Crumbleable private boolean _crumble; private ArrayList _initBlocks; + private ArrayList _realBlocks; + + private boolean _onlyTop; + private int _height; + + public Crumbleable() + { + this(false, 0); + } + + public Crumbleable(boolean onlyTop, int height) + { + _onlyTop = onlyTop; + _height = height; + + _realBlocks = new ArrayList<>(); + } + + /** + * Must be called when getBlocks is set + */ + public void init() + { + if (_onlyTop) + { + ArrayList flatMap = new ArrayList<>(); + ArrayList locs = getBlocks(); + int y = Integer.MIN_VALUE; + for (Location loc : locs) + { + if (loc.getBlockY() > y) + y = loc.getBlockY(); + } + + for (Location loc : locs) + { + if (loc.getBlockY() == y) + flatMap.add(loc.clone()); + } + + for (Location loc : flatMap) + { + Block block = loc.getBlock(); + + int i = 0; + + while (block.getType() == Material.AIR && i <= _height) + { + block = block.getRelative(BlockFace.DOWN); + i++; + } + + _realBlocks.add(block.getLocation()); + } + _initBlocks = (ArrayList) _realBlocks.clone(); + } + else + { + _realBlocks = (ArrayList) getBlocks().clone(); + _initBlocks = (ArrayList) getBlocks().clone(); + } + + } /** * @see #crumble(int, Material...) @@ -46,7 +111,7 @@ public abstract class Crumbleable Material material = replacements[UtilMath.r(replacements.length)]; - if (getBlocks().isEmpty()) + if (_realBlocks.isEmpty()) { crumbledAway(); return true; @@ -54,16 +119,16 @@ public abstract class Crumbleable for (int i = 0; i < blocks; i++) { - if (getBlocks().isEmpty()) + if (_realBlocks.isEmpty()) { crumbledAway(); return true; } - Location toRemove = getBlocks().remove(UtilMath.r(getBlocks().size())); - if (toRemove.getBlock().getType() == Material.CHEST && getBlocks().size() > 25) + Location toRemove = _realBlocks.remove(UtilMath.r(_realBlocks.size())); + if (toRemove.getBlock().getType() == Material.CHEST && _realBlocks.size() > 25) { - getBlocks().add(toRemove); + _realBlocks.add(toRemove); continue; } @@ -86,7 +151,7 @@ public abstract class Crumbleable public boolean isCrumbledAway() { - return getBlocks().isEmpty(); + return _realBlocks.isEmpty(); } /** @@ -94,19 +159,21 @@ public abstract class Crumbleable */ public double crumblePercentage() { - if (_initBlocks == null) - _initBlocks = (ArrayList) getBlocks().clone(); - try { - return (getBlocks().size()/(_initBlocks.size()/100))/100; + return (_realBlocks.size()/(_initBlocks.size())); } catch (Exception e) { - return 100; + return 1; } } + public ArrayList getRealBlocks() + { + return _realBlocks; + } + /** * Overrideable method which is called by * {@link #crumble(int, Material...)} or {@link #crumble(int)} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skyfall/Island.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skyfall/Island.java index 5b91b7cad..8f4498362 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skyfall/Island.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skyfall/Island.java @@ -8,15 +8,11 @@ import org.bukkit.block.Block; import org.bukkit.block.Chest; import org.bukkit.entity.Player; import org.bukkit.inventory.Inventory; +import org.bukkit.inventory.ItemStack; -import mineplex.core.Managers; import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilMath; import mineplex.core.loot.ChestLoot; -import mineplex.core.titles.tracks.LuckyTrack; -import mineplex.core.titles.tracks.UnluckyTrack; - -import nautilus.game.arcade.ArcadeManager; /** * The Island Object represents a flying Island
@@ -70,6 +66,8 @@ public class Island extends Crumbleable */ public Island(Location location, ChestLoot loot, int bounds, int height) { + super(true, height); + _location = location; _bounds = bounds; _height = height; @@ -79,6 +77,7 @@ public class Island extends Crumbleable _loot = loot; registerBlocks(); + init(); } public void fillLoot(Block block) @@ -106,6 +105,7 @@ public class Island extends Crumbleable if (Math.random() > 0.95) items++; + ArrayList exclude = new ArrayList<>(); for (int i = 0; i < items; i++) { int trys = 0; @@ -116,7 +116,17 @@ public class Island extends Crumbleable slot = UtilMath.r(27); } - inventory.setItem(slot, _loot.getLoot()); + ItemStack item = _loot.getLoot(exclude); + exclude.add(item.getType()); + inventory.setItem(slot, item); + if (item.getType() == Material.DIAMOND) + { + inventory.setItem(slot + 1, new ItemStack(Material.STICK, 2)); + } + if (item.getType() == Material.BOW) + { + inventory.setItem(slot + 1, new ItemStack(Material.ARROW, UtilMath.r(6) + 1)); + } } } @@ -170,7 +180,7 @@ public class Island extends Crumbleable public void registerBlocks() { - for (Block block : UtilBlock.getInBoundingBox(_location.clone().add(_bounds, 0, _bounds), _location.clone().subtract(_bounds, _height, _bounds))) + for (Block block : UtilBlock.getInBoundingBox(_location.clone().add(_bounds, 0, _bounds), _location.clone().subtract(_bounds, _height, _bounds), false)) { if (block.getType() == Material.CHEST || block.getType() == Material.TRAPPED_CHEST) getChests().add(block.getLocation()); 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 444ed1bd2..5a2579dfa 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 @@ -1,6 +1,9 @@ package nautilus.game.arcade.game.games.skyfall; +import java.util.ArrayList; + import org.bukkit.Material; +import org.bukkit.inventory.ItemStack; import mineplex.core.common.util.F; import mineplex.core.itemstack.ItemStackFactory; @@ -24,7 +27,6 @@ public class LootTable new RandomItem(Material.MUSHROOM_SOUP, 15, 1, 1), new RandomItem(Material.WHEAT, 30, 1, 6), new RandomItem(Material.APPLE, 30, 1, 4), - new RandomItem(Material.PORK, 30, 1, 4), new RandomItem(Material.ROTTEN_FLESH, 40, 1, 6), new RandomItem(Material.WOOD_AXE, 100), @@ -69,7 +71,6 @@ public class LootTable new RandomItem(Material.PUMPKIN_PIE, 20, 1, 3), new RandomItem(Material.APPLE, 20, 2, 6), - new RandomItem(Material.IRON_INGOT, 30, 1, 2), new RandomItem(Material.DIAMOND, 30) ); @@ -152,4 +153,33 @@ public class LootTable return new LootTable(_unbreakable, items); } + + public LootTable excludes(ArrayList randomItems) + { + int size = _items.length - randomItems.size(); + RandomItem[] items = new RandomItem[size]; + + int i = 0; + + for (RandomItem item : _items) + { + boolean cont = false; + + for (Material other : randomItems) + { + if (item.getItemStack().getType() == other) + { + cont = true; + } + } + + if (cont) + continue; + + items[i] = item; + i++; + } + + return new LootTable(_unbreakable, items); + } } 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 8910b4a3d..edb873abe 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 @@ -104,10 +104,8 @@ public abstract class Skyfall extends Game private static final long CHEST_REFILL_ANNOUNCE_TIME = 1000*60*3; // 3 minutes private static final long ELYTRA_TAKEAWAY = 1000; - private static final long RING_ROT_TIME = 1000*60*3; // 3 Minutes + private static final long ISLAND_ROT_TIME = 1000*60*5; // 3 Minutes - private static int ISLAND_CRUMBLE_RATE = 20; - private static int BIG_ISLAND_CRUMBLE_RATE = 20; private static final int RING_CRUMBLE_RATE = 3; private static final float RING_BOOST_STRENGTH = 2.5F; @@ -123,6 +121,8 @@ public abstract class Skyfall extends Game private static final long EAT_RECHARGE = 500; // 0.5 Second + private int _islandCrumbleRate; + private int _bigIslandBounds; private int _bigIslandHeight; @@ -244,8 +244,7 @@ public abstract class Skyfall extends Game if(event.getMessage().contains("/Rate")) { int rate = Integer.parseInt(event.getMessage().split(" ")[1]); - ISLAND_CRUMBLE_RATE = rate; - BIG_ISLAND_CRUMBLE_RATE = rate; + _islandCrumbleRate = rate; UtilPlayer.message(event.getPlayer(), "Crumble rate changed to " + rate); event.setCancelled(true); return; @@ -395,7 +394,7 @@ public abstract class Skyfall extends Game // if (island.getLocation().getBlockY() >= GetTeamList().get(0).GetSpawns().get(0).getBlockY()) // mats = new Material[] {Material.AIR}; - if (!island.crumble(ISLAND_CRUMBLE_RATE, mats)) + if (!island.crumble(_islandCrumbleRate, mats)) { return islands; } @@ -403,7 +402,7 @@ public abstract class Skyfall extends Game if (_upperIsland.crumblePercentage() <= 0.5) islands.add(_upperIsland); - if (!_upperIsland.crumble(BIG_ISLAND_CRUMBLE_RATE, Material.COAL_BLOCK, Material.ENDER_STONE)) + if (!_upperIsland.crumble(_islandCrumbleRate, Material.COAL_BLOCK, Material.ENDER_STONE)) { _currentCrumble = (_upperIsland.getLocation().getBlockY() - _upperIsland.getHeight()); return islands; @@ -420,7 +419,7 @@ public abstract class Skyfall extends Game if (island.crumblePercentage() <= 0.5) islands.add(island); - if (!island.crumble(ISLAND_CRUMBLE_RATE, Material.COAL_BLOCK, Material.ENDER_STONE)) + if (!island.crumble(_islandCrumbleRate, Material.COAL_BLOCK, Material.ENDER_STONE)) { return islands; } @@ -429,7 +428,7 @@ public abstract class Skyfall extends Game islands.add(_lowerIsland); _currentCrumble = (_lowerIsland.getLocation().getBlockY() - _lowerIsland.getHeight()); - if (_lowerIsland.crumble(BIG_ISLAND_CRUMBLE_RATE, Material.COAL_BLOCK, Material.ENDER_STONE)) + if (_lowerIsland.crumble(_islandCrumbleRate, Material.COAL_BLOCK, Material.ENDER_STONE)) { while (!_lowerIsland.getBoosterRing().isCrumbledAway()) { @@ -740,7 +739,6 @@ public abstract class Skyfall extends Game public void registerBoosters() { - //int blocks = 0; ArrayList boosters = WorldData.GetDataLocs("ORANGE"); for (Location boosterMid : boosters) { @@ -758,13 +756,6 @@ public abstract class Skyfall extends Game ring.setBoostStrength(BIG_RING_BOOST_STRENGTH); } -// blocks += ring.getBlocks().size(); -// int secs = (int) (RING_ROT_TIME / 1000); -// _ringCrumbleRate = blocks / secs; -// -// if (_ringCrumbleRate < 1) -// _ringCrumbleRate = 1; - _boosterRings.add(ring); } } @@ -828,7 +819,7 @@ public abstract class Skyfall extends Game e.printStackTrace(); } } - } + } IslandSorter upperSorter = new IslandSorter(upperIslandMap); IslandSorter lowerSorter = new IslandSorter(lowerIslandMap); @@ -838,6 +829,24 @@ public abstract class Skyfall extends Game _islands.put(_lowerIsland, new TreeMap<>(lowerSorter)); _islands.get(_lowerIsland).putAll(lowerIslandMap); + + int blocks = 0; + + for (Island island : _islands.get(_upperIsland).keySet()) + blocks += island.getRealBlocks().size(); + + for (Island island : _islands.get(_lowerIsland).keySet()) + blocks += island.getRealBlocks().size(); + + blocks += _upperIsland.getRealBlocks().size(); + blocks += _lowerIsland.getRealBlocks().size(); + + + int ticks = (int) (((ISLAND_ROT_TIME / 1000) *20) / 3); + _islandCrumbleRate = blocks / ticks; + + if (_islandCrumbleRate < 1) + _islandCrumbleRate = 1; } public Island getCurrentIsland(Player player) From 137220d58fb9d2cab2fad500b149e9f068eec405 Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Mon, 13 Mar 2017 10:33:23 -0300 Subject: [PATCH 17/98] Custom pets --- .../core/cosmetic/ui/page/PetPage.java | 21 ++- .../ui/page/custompet/CustomPetAge.java | 62 +++++++++ .../ui/page/custompet/CustomPetBase.java | 56 ++++++++ .../mineplex/core/gadget/GadgetManager.java | 4 + .../mineplex/core/pet/custom/CustomPet.java | 124 ++++++++++++++++++ .../core/pet/custom/CustomPetAgeable.java | 25 ++++ .../core/pet/custom/CustomPetEquipment.java | 59 +++++++++ .../core/pet/custom/CustomPetZombie.java | 71 ++++++++++ 8 files changed, 411 insertions(+), 11 deletions(-) create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/CustomPetAge.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/CustomPetBase.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/pet/custom/CustomPet.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/pet/custom/CustomPetAgeable.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/pet/custom/CustomPetEquipment.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/pet/custom/CustomPetZombie.java diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/PetPage.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/PetPage.java index f7b831eca..d23abb7e8 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/PetPage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/PetPage.java @@ -21,7 +21,6 @@ import org.bukkit.Material; import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; -import org.bukkit.event.inventory.ClickType; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.ItemMeta; @@ -37,10 +36,10 @@ import mineplex.core.cosmetic.ui.button.PetButton; import mineplex.core.cosmetic.ui.button.RenamePetButton; import mineplex.core.cosmetic.ui.button.activate.ActivatePetButton; import mineplex.core.cosmetic.ui.button.deactivate.DeactivatePetButton; +import mineplex.core.cosmetic.ui.page.custompet.CustomPetBase; import mineplex.core.donation.DonationManager; import mineplex.core.pet.PetExtra; import mineplex.core.pet.PetType; -import mineplex.core.shop.item.IButton; import mineplex.core.shop.item.ShopItem; import mineplex.core.shop.page.AnvilContainer; import mineplex.core.shop.page.ShopPageBase; @@ -63,7 +62,7 @@ public class PetPage extends ShopPageBase for (PetType pet : pets) { - List itemLore = new ArrayList(); + List itemLore = new ArrayList<>(); itemLore.add(C.cBlack); if (pet.getLore().isPresent()) @@ -232,7 +231,7 @@ public class PetPage extends ShopPageBase slot += 2; } - slot = 49; + slot = 48; for (PetExtra petExtra : PetExtra.values()) { List itemLore = new ArrayList(); @@ -254,14 +253,14 @@ public class PetPage extends ShopPageBase slot++; } + + // Custom pet + addButton(50, new ShopItem(Material.GLASS, C.cGreen + "Custom", new String[]{}, 1, false), (player, clickType) -> + getShop().openPageForPlayer(getPlayer(), new CustomPetBase(getPlugin(), getShop(), getClientManager(), getDonationManager(), "Custom Pet", player))); + - addButton(4, new ShopItem(Material.BED, C.cGray + " \u21FD Go Back", new String[]{}, 1, false), new IButton() - { - public void onClick(Player player, ClickType clickType) - { - getShop().openPageForPlayer(getPlayer(), new Menu(getPlugin(), getShop(), getClientManager(), getDonationManager(), player)); - } - }); + addButton(4, new ShopItem(Material.BED, C.cGray + " \u21FD Go Back", new String[]{}, 1, false), (player, clickType) -> + getShop().openPageForPlayer(getPlayer(), new Menu(getPlugin(), getShop(), getClientManager(), getDonationManager(), player))); } public void purchasePet(final Player player, final PetType petType) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/CustomPetAge.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/CustomPetAge.java new file mode 100644 index 000000000..0c7903643 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/CustomPetAge.java @@ -0,0 +1,62 @@ +package mineplex.core.cosmetic.ui.page.custompet; + +import org.bukkit.Material; +import org.bukkit.entity.Player; + +import mineplex.core.account.CoreClientManager; +import mineplex.core.common.util.C; +import mineplex.core.cosmetic.CosmeticManager; +import mineplex.core.cosmetic.ui.CosmeticShop; +import mineplex.core.cosmetic.ui.page.GadgetPage; +import mineplex.core.cosmetic.ui.page.Menu; +import mineplex.core.donation.DonationManager; +import mineplex.core.pet.custom.CustomPet; +import mineplex.core.pet.custom.CustomPetAgeable; +import mineplex.core.shop.item.ShopItem; + +public class CustomPetAge extends GadgetPage +{ + + public CustomPetAge(CosmeticManager plugin, CosmeticShop shop, CoreClientManager clientManager, DonationManager donationManager, String name, Player player) + { + super(plugin, shop, clientManager, donationManager, name, player); + } + + @Override + protected void buildPage() + { + + // 20 + // 24 + CustomPet customPet = CustomPet.getCustomPet(getPlayer()); + if (customPet == null) + { + CustomPet.removeCustomPet(getPlayer()); + getPlayer().closeInventory(); + return; + } + + if (!(customPet instanceof CustomPetAgeable)) + { + CustomPet.removeCustomPet(getPlayer()); + getPlayer().closeInventory(); + return; + } + + CustomPetAgeable customPetAgeable = (CustomPetAgeable) customPet; + + addButton(20, new ShopItem(Material.SEEDS, "Baby", 1, false), (player, clickType) -> + { + customPetAgeable.setBaby(true); + getShop().openPageForPlayer(getPlayer(), customPet.createNextStep(getPlugin(), getShop(), getClientManager(), getDonationManager())); + }); + + + addButton(4, new ShopItem(Material.BED, C.cGray + " \u21FD Go Back", new String[]{}, 1, false), (player, clickType) -> + { + getShop().openPageForPlayer(getPlayer(), new Menu(getPlugin(), getShop(), getClientManager(), getDonationManager(), player)); + CustomPet.removeCustomPet(player); + }); + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/CustomPetBase.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/CustomPetBase.java new file mode 100644 index 000000000..dc2019f46 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/CustomPetBase.java @@ -0,0 +1,56 @@ +package mineplex.core.cosmetic.ui.page.custompet; + +import org.bukkit.Material; +import org.bukkit.entity.Player; + +import mineplex.core.account.CoreClientManager; +import mineplex.core.common.util.C; +import mineplex.core.cosmetic.CosmeticManager; +import mineplex.core.cosmetic.ui.CosmeticShop; +import mineplex.core.cosmetic.ui.page.GadgetPage; +import mineplex.core.cosmetic.ui.page.Menu; +import mineplex.core.donation.DonationManager; +import mineplex.core.pet.custom.CustomPet; +import mineplex.core.shop.item.ShopItem; + +public class CustomPetBase extends GadgetPage +{ + + public CustomPetBase(CosmeticManager plugin, CosmeticShop shop, CoreClientManager clientManager, DonationManager donationManager, String name, Player player) + { + super(plugin, shop, clientManager, donationManager, name, player); + } + + @Override + protected void buildPage() + { + + int slot = 10; + + for (CustomPet.CustomPetType customPetType : CustomPet.CustomPetType.values()) + { + + addButton(slot, new ShopItem(customPetType.getMaterial(), customPetType.getData(), customPetType.getName(), new String[]{}, 1, false, false), (player, clickType) -> + { + CustomPet customPet = CustomPet.getCustomPet(player); + if (customPet == null) + { + customPet = customPetType.getCustomPet(player); + } + getShop().openPageForPlayer(getPlayer(), customPet.createNextStep(getPlugin(), getShop(), getClientManager(), getDonationManager())); + }); + + slot++; + + if (slot == 17) + slot += 2; + } + + addButton(4, new ShopItem(Material.BED, C.cGray + " \u21FD Go Back", new String[]{}, 1, false), (player, clickType) -> + { + getShop().openPageForPlayer(getPlayer(), new Menu(getPlugin(), getShop(), getClientManager(), getDonationManager(), player)); + CustomPet.removeCustomPet(player); + }); + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java index d2acbf740..ce661ae21 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java @@ -237,6 +237,7 @@ import mineplex.core.mount.MountManager; import mineplex.core.mount.event.MountActivateEvent; import mineplex.core.packethandler.PacketHandler; import mineplex.core.pet.PetManager; +import mineplex.core.pet.custom.CustomPet; import mineplex.core.preferences.PreferencesManager; import mineplex.core.projectile.ProjectileManager; import mineplex.core.treasure.TreasureManager; @@ -1000,6 +1001,9 @@ public class GadgetManager extends MiniPlugin event.getPlayer().setWalkSpeed(0.2f); event.getPlayer().setFlySpeed(0.1f); _soulManager.giveSoul(event.getPlayer()); + + // Removes custom pet + CustomPet.removeCustomPet(event.getPlayer()); } @EventHandler diff --git a/Plugins/Mineplex.Core/src/mineplex/core/pet/custom/CustomPet.java b/Plugins/Mineplex.Core/src/mineplex/core/pet/custom/CustomPet.java new file mode 100644 index 000000000..8636cbfce --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/pet/custom/CustomPet.java @@ -0,0 +1,124 @@ +package mineplex.core.pet.custom; + +import java.util.HashMap; +import java.util.Map; + +import org.bukkit.Material; +import org.bukkit.entity.Entity; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; + +import mineplex.core.account.CoreClientManager; +import mineplex.core.cosmetic.CosmeticManager; +import mineplex.core.cosmetic.ui.CosmeticShop; +import mineplex.core.cosmetic.ui.page.GadgetPage; +import mineplex.core.disguise.disguises.DisguiseBase; +import mineplex.core.donation.DonationManager; + +public abstract class CustomPet +{ + + private static Map _customPet = new HashMap<>(); + + protected Player _player; + protected EntityType _entityType; + protected DisguiseBase _disguiseBase; + protected int _step = 0; + private String _name; + + public CustomPet(Player player, EntityType entityType) + { + _player = player; + _entityType = entityType; + _customPet.put(player, this); + } + + public void spawn(Entity entity) + { + // TODO + onSpawn(entity); + } + + public abstract void onSpawn(Entity entity); + + public abstract GadgetPage createNextStep(CosmeticManager plugin, CosmeticShop shop, CoreClientManager clientManager, DonationManager donationManager); + + public DisguiseBase getDisguiseBase() + { + return _disguiseBase; + } + + public void setName(String name) + { + _name = name; + } + + public String getName() + { + return _name; + } + + public static CustomPet getCustomPet(Player player) + { + if (_customPet.containsKey(player)) + { + return _customPet.get(player); + } + return null; + } + + public static void removeCustomPet(Player player) + { + if (_customPet.containsKey(player)) + { + _customPet.remove(player); + } + } + + public enum CustomPetType + { + ZOMBIE("Zombie", Material.GLASS); + + private String _name; + private Material _material; + private byte _data; + + CustomPetType(String name, Material material, byte data) + { + _name = name; + _material = material; + _data = data; + } + + CustomPetType(String name, Material material) + { + this(name, material, (byte) 0); + } + + public String getName() + { + return _name; + } + + public Material getMaterial() + { + return _material; + } + + public byte getData() + { + return _data; + } + + public CustomPet getCustomPet(Player player) + { + switch (this) + { + case ZOMBIE: + return new CustomPetZombie(player); + default: + return new CustomPetZombie(player); + } + } + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/pet/custom/CustomPetAgeable.java b/Plugins/Mineplex.Core/src/mineplex/core/pet/custom/CustomPetAgeable.java new file mode 100644 index 000000000..218bd52f1 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/pet/custom/CustomPetAgeable.java @@ -0,0 +1,25 @@ +package mineplex.core.pet.custom; + +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; + +public abstract class CustomPetAgeable extends CustomPet +{ + + private boolean _baby = false; + + public CustomPetAgeable(Player player, EntityType entityType) + { + super(player, entityType); + } + + public void setBaby(boolean baby) + { + _baby = baby; + } + + protected boolean isBaby() + { + return _baby; + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/pet/custom/CustomPetEquipment.java b/Plugins/Mineplex.Core/src/mineplex/core/pet/custom/CustomPetEquipment.java new file mode 100644 index 000000000..73bc69fc4 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/pet/custom/CustomPetEquipment.java @@ -0,0 +1,59 @@ +package mineplex.core.pet.custom; + +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; + +public abstract class CustomPetEquipment extends CustomPetAgeable +{ + + private ItemStack _helmet; + private ItemStack _chestplate; + private ItemStack _leggings; + private ItemStack _boots; + + public CustomPetEquipment(Player player, EntityType entityType) + { + super(player, entityType); + } + + public void setHelmet(ItemStack helmet) + { + _helmet = helmet; + } + + public void setChestplate(ItemStack chestplate) + { + _chestplate = chestplate; + } + + public void setLeggings(ItemStack leggings) + { + _leggings = leggings; + } + + public void setBoots(ItemStack boots) + { + _boots = boots; + } + + public ItemStack getHelmet() + { + return _helmet; + } + + public ItemStack getChestplate() + { + return _chestplate; + } + + public ItemStack getLeggings() + { + return _leggings; + } + + public ItemStack getBoots() + { + return _boots; + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/pet/custom/CustomPetZombie.java b/Plugins/Mineplex.Core/src/mineplex/core/pet/custom/CustomPetZombie.java new file mode 100644 index 000000000..669be3c0b --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/pet/custom/CustomPetZombie.java @@ -0,0 +1,71 @@ +package mineplex.core.pet.custom; + +import org.bukkit.entity.Entity; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; + +import mineplex.core.account.CoreClientManager; +import mineplex.core.cosmetic.CosmeticManager; +import mineplex.core.cosmetic.ui.CosmeticShop; +import mineplex.core.cosmetic.ui.page.GadgetPage; +import mineplex.core.cosmetic.ui.page.custompet.CustomPetAge; +import mineplex.core.disguise.DisguiseFactory; +import mineplex.core.disguise.disguises.DisguiseZombie; +import mineplex.core.donation.DonationManager; + +public class CustomPetZombie extends CustomPetEquipment +{ + + public CustomPetZombie(Player player) + { + super(player, EntityType.ZOMBIE); + } + + @Override + public void onSpawn(Entity entity) + { + // TODO + _disguiseBase = DisguiseFactory.createDisguise(entity, _entityType); + DisguiseZombie disguiseZombie = (DisguiseZombie) _disguiseBase; + disguiseZombie.setBaby(isBaby()); + if (getHelmet() != null) + { + disguiseZombie.setHelmet(getHelmet()); + } + if (getChestplate() != null) + { + disguiseZombie.setChestplate(getChestplate()); + } + if (getLeggings() != null) + { + disguiseZombie.setLeggings(getLeggings()); + } + if (getBoots() != null) + { + disguiseZombie.setBoots(getBoots()); + } + if (getName() != null) + { + disguiseZombie.setCustomNameVisible(true); + disguiseZombie.setName(getName()); + } + else + { + disguiseZombie.setCustomNameVisible(false); + } + } + + @Override + public GadgetPage createNextStep(CosmeticManager plugin, CosmeticShop shop, CoreClientManager clientManager, DonationManager donationManager) + { + switch (_step) + { + case 0: + _step++; + return new CustomPetAge(plugin, shop, clientManager, donationManager, "Zombie Age", _player); + default: + _step++; + return new CustomPetAge(plugin, shop, clientManager, donationManager, "Zombie Age", _player); + } + } +} From e297f844e69d66f29037718d614fe19488205d5e Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Mon, 13 Mar 2017 10:59:19 -0300 Subject: [PATCH 18/98] Renamed classes --- .../src/mineplex/core/cosmetic/ui/page/PetPage.java | 4 ++-- .../custompet/{CustomPetAge.java => CustomPetAgePage.java} | 4 ++-- .../{CustomPetBase.java => CustomPetBasePage.java} | 4 ++-- .../src/mineplex/core/pet/custom/CustomPetZombie.java | 6 +++--- 4 files changed, 9 insertions(+), 9 deletions(-) rename Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/{CustomPetAge.java => CustomPetAgePage.java} (88%) rename Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/{CustomPetBase.java => CustomPetBasePage.java} (88%) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/PetPage.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/PetPage.java index d23abb7e8..fae5fe884 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/PetPage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/PetPage.java @@ -36,7 +36,7 @@ import mineplex.core.cosmetic.ui.button.PetButton; import mineplex.core.cosmetic.ui.button.RenamePetButton; import mineplex.core.cosmetic.ui.button.activate.ActivatePetButton; import mineplex.core.cosmetic.ui.button.deactivate.DeactivatePetButton; -import mineplex.core.cosmetic.ui.page.custompet.CustomPetBase; +import mineplex.core.cosmetic.ui.page.custompet.CustomPetBasePage; import mineplex.core.donation.DonationManager; import mineplex.core.pet.PetExtra; import mineplex.core.pet.PetType; @@ -256,7 +256,7 @@ public class PetPage extends ShopPageBase // Custom pet addButton(50, new ShopItem(Material.GLASS, C.cGreen + "Custom", new String[]{}, 1, false), (player, clickType) -> - getShop().openPageForPlayer(getPlayer(), new CustomPetBase(getPlugin(), getShop(), getClientManager(), getDonationManager(), "Custom Pet", player))); + getShop().openPageForPlayer(getPlayer(), new CustomPetBasePage(getPlugin(), getShop(), getClientManager(), getDonationManager(), "Custom Pet", player))); addButton(4, new ShopItem(Material.BED, C.cGray + " \u21FD Go Back", new String[]{}, 1, false), (player, clickType) -> diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/CustomPetAge.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/CustomPetAgePage.java similarity index 88% rename from Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/CustomPetAge.java rename to Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/CustomPetAgePage.java index 0c7903643..12d8d1c82 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/CustomPetAge.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/CustomPetAgePage.java @@ -14,10 +14,10 @@ import mineplex.core.pet.custom.CustomPet; import mineplex.core.pet.custom.CustomPetAgeable; import mineplex.core.shop.item.ShopItem; -public class CustomPetAge extends GadgetPage +public class CustomPetAgePage extends GadgetPage { - public CustomPetAge(CosmeticManager plugin, CosmeticShop shop, CoreClientManager clientManager, DonationManager donationManager, String name, Player player) + public CustomPetAgePage(CosmeticManager plugin, CosmeticShop shop, CoreClientManager clientManager, DonationManager donationManager, String name, Player player) { super(plugin, shop, clientManager, donationManager, name, player); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/CustomPetBase.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/CustomPetBasePage.java similarity index 88% rename from Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/CustomPetBase.java rename to Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/CustomPetBasePage.java index dc2019f46..d5906f1d6 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/CustomPetBase.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/CustomPetBasePage.java @@ -13,10 +13,10 @@ import mineplex.core.donation.DonationManager; import mineplex.core.pet.custom.CustomPet; import mineplex.core.shop.item.ShopItem; -public class CustomPetBase extends GadgetPage +public class CustomPetBasePage extends GadgetPage { - public CustomPetBase(CosmeticManager plugin, CosmeticShop shop, CoreClientManager clientManager, DonationManager donationManager, String name, Player player) + public CustomPetBasePage(CosmeticManager plugin, CosmeticShop shop, CoreClientManager clientManager, DonationManager donationManager, String name, Player player) { super(plugin, shop, clientManager, donationManager, name, player); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/pet/custom/CustomPetZombie.java b/Plugins/Mineplex.Core/src/mineplex/core/pet/custom/CustomPetZombie.java index 669be3c0b..4d217109d 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/pet/custom/CustomPetZombie.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/pet/custom/CustomPetZombie.java @@ -8,7 +8,7 @@ import mineplex.core.account.CoreClientManager; import mineplex.core.cosmetic.CosmeticManager; import mineplex.core.cosmetic.ui.CosmeticShop; import mineplex.core.cosmetic.ui.page.GadgetPage; -import mineplex.core.cosmetic.ui.page.custompet.CustomPetAge; +import mineplex.core.cosmetic.ui.page.custompet.CustomPetAgePage; import mineplex.core.disguise.DisguiseFactory; import mineplex.core.disguise.disguises.DisguiseZombie; import mineplex.core.donation.DonationManager; @@ -62,10 +62,10 @@ public class CustomPetZombie extends CustomPetEquipment { case 0: _step++; - return new CustomPetAge(plugin, shop, clientManager, donationManager, "Zombie Age", _player); + return new CustomPetAgePage(plugin, shop, clientManager, donationManager, "Zombie Age", _player); default: _step++; - return new CustomPetAge(plugin, shop, clientManager, donationManager, "Zombie Age", _player); + return new CustomPetAgePage(plugin, shop, clientManager, donationManager, "Zombie Age", _player); } } } From 13238eb4ad570b8193677f237b3f5db4e27052d4 Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Tue, 14 Mar 2017 09:40:11 -0300 Subject: [PATCH 19/98] Added equipment pages --- .../ui/page/custompet/CustomPetBasePage.java | 2 +- .../page/custompet/CustomPetConfirmPage.java | 61 ++++++++++++ .../custompet/{ => age}/CustomPetAgePage.java | 25 +++-- .../equipment/CustomPetBootsPage.java | 89 +++++++++++++++++ .../equipment/CustomPetChestplatePage.java | 88 +++++++++++++++++ .../equipment/CustomPetHelmetPage.java | 88 +++++++++++++++++ .../equipment/CustomPetLeggingsPage.java | 88 +++++++++++++++++ .../custompet/name/CloseCustomPetButton.java | 16 +++ .../custompet/name/CustomPetNamePage.java | 63 ++++++++++++ .../page/custompet/name/CustomPetTagPage.java | 98 +++++++++++++++++++ .../name/SelectCustomPetTagButton.java | 21 ++++ .../zombie/CustomPetZombieTypePage.java | 61 ++++++++++++ .../mineplex/core/pet/custom/CustomPet.java | 49 +++++++++- .../core/pet/custom/CustomPetAgeable.java | 1 + .../core/pet/custom/CustomPetEquipment.java | 5 + .../core/pet/custom/CustomPetZombie.java | 84 +++++++++++++++- 16 files changed, 821 insertions(+), 18 deletions(-) create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/CustomPetConfirmPage.java rename Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/{ => age}/CustomPetAgePage.java (65%) create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/equipment/CustomPetBootsPage.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/equipment/CustomPetChestplatePage.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/equipment/CustomPetHelmetPage.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/equipment/CustomPetLeggingsPage.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/name/CloseCustomPetButton.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/name/CustomPetNamePage.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/name/CustomPetTagPage.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/name/SelectCustomPetTagButton.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/zombie/CustomPetZombieTypePage.java diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/CustomPetBasePage.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/CustomPetBasePage.java index d5906f1d6..64d55c75c 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/CustomPetBasePage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/CustomPetBasePage.java @@ -37,7 +37,7 @@ public class CustomPetBasePage extends GadgetPage { customPet = customPetType.getCustomPet(player); } - getShop().openPageForPlayer(getPlayer(), customPet.createNextStep(getPlugin(), getShop(), getClientManager(), getDonationManager())); + getShop().openPageForPlayer(getPlayer(), customPet.getNextStep(getPlugin(), getShop(), getClientManager(), getDonationManager())); }); slot++; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/CustomPetConfirmPage.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/CustomPetConfirmPage.java new file mode 100644 index 000000000..73c381bde --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/CustomPetConfirmPage.java @@ -0,0 +1,61 @@ +package mineplex.core.cosmetic.ui.page.custompet; + +import org.bukkit.Material; +import org.bukkit.entity.Player; + +import mineplex.core.account.CoreClientManager; +import mineplex.core.common.util.C; +import mineplex.core.cosmetic.CosmeticManager; +import mineplex.core.cosmetic.ui.CosmeticShop; +import mineplex.core.cosmetic.ui.page.GadgetPage; +import mineplex.core.donation.DonationManager; +import mineplex.core.pet.custom.CustomPet; +import mineplex.core.shop.item.ShopItem; + +public class CustomPetConfirmPage extends GadgetPage +{ + + public CustomPetConfirmPage(CosmeticManager plugin, CosmeticShop shop, CoreClientManager clientManager, DonationManager donationManager, String name, Player player) + { + super(plugin, shop, clientManager, donationManager, name, player); + } + + @Override + protected void buildPage() + { + + CustomPet customPet = CustomPet.getCustomPet(getPlayer()); + if (customPet == null) + { + CustomPet.removeCustomPet(getPlayer()); + getPlayer().closeInventory(); + return; + } + + int[] confirm = {19, 20, 21, 28, 29, 30, 37, 38, 39}; + int[] cancel = {23, 24, 25, 32, 33, 34, 41, 42, 43}; + + ShopItem confirmItem = new ShopItem(Material.WOOL, (byte) 5, "Confirm", new String[]{}, 1, false, false); + ShopItem cancelItem = new ShopItem(Material.WOOL, (byte) 14, "Cancel", new String[]{}, 1, false, false); + + for (int aConfirm : confirm) + { + addButton(aConfirm, confirmItem, (player, clickType) -> + { + // TODO + }); + } + + for (int aCancel : cancel) + { + addButton(aCancel, cancelItem, (player, clickType) -> + { + // TODO + }); + } + + addButton(4, new ShopItem(Material.BED, C.cGray + " \u21FD Go Back", new String[]{}, 1, false), (player, clickType) -> + getShop().openPageForPlayer(getPlayer(), customPet.getPreviousStep(getPlugin(), getShop(), getClientManager(), getDonationManager()))); + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/CustomPetAgePage.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/age/CustomPetAgePage.java similarity index 65% rename from Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/CustomPetAgePage.java rename to Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/age/CustomPetAgePage.java index 12d8d1c82..70feb8529 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/CustomPetAgePage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/age/CustomPetAgePage.java @@ -1,4 +1,4 @@ -package mineplex.core.cosmetic.ui.page.custompet; +package mineplex.core.cosmetic.ui.page.custompet.age; import org.bukkit.Material; import org.bukkit.entity.Player; @@ -8,7 +8,6 @@ import mineplex.core.common.util.C; import mineplex.core.cosmetic.CosmeticManager; import mineplex.core.cosmetic.ui.CosmeticShop; import mineplex.core.cosmetic.ui.page.GadgetPage; -import mineplex.core.cosmetic.ui.page.Menu; import mineplex.core.donation.DonationManager; import mineplex.core.pet.custom.CustomPet; import mineplex.core.pet.custom.CustomPetAgeable; @@ -26,8 +25,6 @@ public class CustomPetAgePage extends GadgetPage protected void buildPage() { - // 20 - // 24 CustomPet customPet = CustomPet.getCustomPet(getPlayer()); if (customPet == null) { @@ -45,18 +42,20 @@ public class CustomPetAgePage extends GadgetPage CustomPetAgeable customPetAgeable = (CustomPetAgeable) customPet; - addButton(20, new ShopItem(Material.SEEDS, "Baby", 1, false), (player, clickType) -> - { - customPetAgeable.setBaby(true); - getShop().openPageForPlayer(getPlayer(), customPet.createNextStep(getPlugin(), getShop(), getClientManager(), getDonationManager())); - }); + addButton(29, new ShopItem(Material.SEEDS, "Baby", 1, false), (player, clickType) -> + { + customPetAgeable.setBaby(true); + getShop().openPageForPlayer(getPlayer(), customPet.getNextStep(getPlugin(), getShop(), getClientManager(), getDonationManager())); + }); + addButton(33, new ShopItem(Material.WHEAT, "Adult", 1, false), (player, clickType) -> + { + customPetAgeable.setBaby(false); + getShop().openPageForPlayer(getPlayer(), customPet.getNextStep(getPlugin(), getShop(), getClientManager(), getDonationManager())); + }); addButton(4, new ShopItem(Material.BED, C.cGray + " \u21FD Go Back", new String[]{}, 1, false), (player, clickType) -> - { - getShop().openPageForPlayer(getPlayer(), new Menu(getPlugin(), getShop(), getClientManager(), getDonationManager(), player)); - CustomPet.removeCustomPet(player); - }); + getShop().openPageForPlayer(getPlayer(), customPet.getPreviousStep(getPlugin(), getShop(), getClientManager(), getDonationManager()))); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/equipment/CustomPetBootsPage.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/equipment/CustomPetBootsPage.java new file mode 100644 index 000000000..edfc55ece --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/equipment/CustomPetBootsPage.java @@ -0,0 +1,89 @@ +package mineplex.core.cosmetic.ui.page.custompet.equipment; + +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; + +import mineplex.core.account.CoreClientManager; +import mineplex.core.common.util.C; +import mineplex.core.cosmetic.CosmeticManager; +import mineplex.core.cosmetic.ui.CosmeticShop; +import mineplex.core.cosmetic.ui.page.GadgetPage; +import mineplex.core.donation.DonationManager; +import mineplex.core.pet.custom.CustomPet; +import mineplex.core.pet.custom.CustomPetEquipment; +import mineplex.core.shop.item.ShopItem; + +public class CustomPetBootsPage extends GadgetPage +{ + + public CustomPetBootsPage(CosmeticManager plugin, CosmeticShop shop, CoreClientManager clientManager, DonationManager donationManager, String name, Player player) + { + super(plugin, shop, clientManager, donationManager, name, player); + } + + @Override + protected void buildPage() + { + + CustomPet customPet = CustomPet.getCustomPet(getPlayer()); + if (customPet == null) + { + CustomPet.removeCustomPet(getPlayer()); + getPlayer().closeInventory(); + return; + } + + if (!(customPet instanceof CustomPetEquipment)) + { + CustomPet.removeCustomPet(getPlayer()); + getPlayer().closeInventory(); + return; + } + + CustomPetEquipment customPetEquipment = (CustomPetEquipment) customPet; + + // Leather helmet + addButton(19, new ShopItem(Material.LEATHER_BOOTS, "Leather", 1, false), (player, clickType) -> + { + // TODO COLORED ARMOR + customPetEquipment.setBoots(new ItemStack(Material.LEATHER_BOOTS)); + getShop().openPageForPlayer(getPlayer(), customPet.getNextStep(getPlugin(), getShop(), getClientManager(), getDonationManager())); + }); + + addButton(22, new ShopItem(Material.CHAINMAIL_BOOTS, "Chain", 1, false), (player, clickType) -> + { + customPetEquipment.setBoots(new ItemStack(Material.CHAINMAIL_BOOTS)); + getShop().openPageForPlayer(getPlayer(), customPet.getNextStep(getPlugin(), getShop(), getClientManager(), getDonationManager())); + }); + + addButton(25, new ShopItem(Material.IRON_BOOTS, "Iron", 1, false), (player, clickType) -> + { + customPetEquipment.setBoots(new ItemStack(Material.IRON_HELMET)); + getShop().openPageForPlayer(getPlayer(), customPet.getNextStep(getPlugin(), getShop(), getClientManager(), getDonationManager())); + }); + + addButton(38, new ShopItem(Material.GOLD_BOOTS, "Gold", 1, false), (player, clickType) -> + { + customPetEquipment.setBoots(new ItemStack(Material.GOLD_BOOTS)); + getShop().openPageForPlayer(getPlayer(), customPet.getNextStep(getPlugin(), getShop(), getClientManager(), getDonationManager())); + }); + + addButton(40, new ShopItem(Material.BARRIER, "None", 1, false), (player, clickType) -> + { + customPetEquipment.setBoots(new ItemStack(Material.AIR)); + getShop().openPageForPlayer(getPlayer(), customPet.getNextStep(getPlugin(), getShop(), getClientManager(), getDonationManager())); + }); + + addButton(42, new ShopItem(Material.DIAMOND_BOOTS, "Diamond", 1, false), (player, clickType) -> + { + customPetEquipment.setBoots(new ItemStack(Material.DIAMOND_BOOTS)); + getShop().openPageForPlayer(getPlayer(), customPet.getNextStep(getPlugin(), getShop(), getClientManager(), getDonationManager())); + }); + + addButton(4, new ShopItem(Material.BED, C.cGray + " \u21FD Go Back", new String[]{}, 1, false), (player, clickType) -> + getShop().openPageForPlayer(getPlayer(), customPet.getPreviousStep(getPlugin(), getShop(), getClientManager(), getDonationManager()))); + } + + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/equipment/CustomPetChestplatePage.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/equipment/CustomPetChestplatePage.java new file mode 100644 index 000000000..d9da369f4 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/equipment/CustomPetChestplatePage.java @@ -0,0 +1,88 @@ +package mineplex.core.cosmetic.ui.page.custompet.equipment; + +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; + +import mineplex.core.account.CoreClientManager; +import mineplex.core.common.util.C; +import mineplex.core.cosmetic.CosmeticManager; +import mineplex.core.cosmetic.ui.CosmeticShop; +import mineplex.core.cosmetic.ui.page.GadgetPage; +import mineplex.core.donation.DonationManager; +import mineplex.core.pet.custom.CustomPet; +import mineplex.core.pet.custom.CustomPetEquipment; +import mineplex.core.shop.item.ShopItem; + +public class CustomPetChestplatePage extends GadgetPage +{ + + public CustomPetChestplatePage(CosmeticManager plugin, CosmeticShop shop, CoreClientManager clientManager, DonationManager donationManager, String name, Player player) + { + super(plugin, shop, clientManager, donationManager, name, player); + } + + @Override + protected void buildPage() + { + + CustomPet customPet = CustomPet.getCustomPet(getPlayer()); + if (customPet == null) + { + CustomPet.removeCustomPet(getPlayer()); + getPlayer().closeInventory(); + return; + } + + if (!(customPet instanceof CustomPetEquipment)) + { + CustomPet.removeCustomPet(getPlayer()); + getPlayer().closeInventory(); + return; + } + + CustomPetEquipment customPetEquipment = (CustomPetEquipment) customPet; + + // Leather helmet + addButton(19, new ShopItem(Material.LEATHER_CHESTPLATE, "Leather", 1, false), (player, clickType) -> + { + // TODO COLORED ARMOR + customPetEquipment.setChestplate(new ItemStack(Material.LEATHER_CHESTPLATE)); + getShop().openPageForPlayer(getPlayer(), customPet.getNextStep(getPlugin(), getShop(), getClientManager(), getDonationManager())); + }); + + addButton(22, new ShopItem(Material.CHAINMAIL_CHESTPLATE, "Chain", 1, false), (player, clickType) -> + { + customPetEquipment.setChestplate(new ItemStack(Material.CHAINMAIL_CHESTPLATE)); + getShop().openPageForPlayer(getPlayer(), customPet.getNextStep(getPlugin(), getShop(), getClientManager(), getDonationManager())); + }); + + addButton(25, new ShopItem(Material.IRON_CHESTPLATE, "Iron", 1, false), (player, clickType) -> + { + customPetEquipment.setChestplate(new ItemStack(Material.IRON_HELMET)); + getShop().openPageForPlayer(getPlayer(), customPet.getNextStep(getPlugin(), getShop(), getClientManager(), getDonationManager())); + }); + + addButton(38, new ShopItem(Material.GOLD_CHESTPLATE, "Gold", 1, false), (player, clickType) -> + { + customPetEquipment.setChestplate(new ItemStack(Material.GOLD_CHESTPLATE)); + getShop().openPageForPlayer(getPlayer(), customPet.getNextStep(getPlugin(), getShop(), getClientManager(), getDonationManager())); + }); + + addButton(40, new ShopItem(Material.BARRIER, "None", 1, false), (player, clickType) -> + { + customPetEquipment.setChestplate(new ItemStack(Material.AIR)); + getShop().openPageForPlayer(getPlayer(), customPet.getNextStep(getPlugin(), getShop(), getClientManager(), getDonationManager())); + }); + + addButton(42, new ShopItem(Material.DIAMOND_CHESTPLATE, "Diamond", 1, false), (player, clickType) -> + { + customPetEquipment.setChestplate(new ItemStack(Material.DIAMOND_CHESTPLATE)); + getShop().openPageForPlayer(getPlayer(), customPet.getNextStep(getPlugin(), getShop(), getClientManager(), getDonationManager())); + }); + + addButton(4, new ShopItem(Material.BED, C.cGray + " \u21FD Go Back", new String[]{}, 1, false), (player, clickType) -> + getShop().openPageForPlayer(getPlayer(), customPet.getPreviousStep(getPlugin(), getShop(), getClientManager(), getDonationManager()))); + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/equipment/CustomPetHelmetPage.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/equipment/CustomPetHelmetPage.java new file mode 100644 index 000000000..dc90f4c9c --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/equipment/CustomPetHelmetPage.java @@ -0,0 +1,88 @@ +package mineplex.core.cosmetic.ui.page.custompet.equipment; + +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; + +import mineplex.core.account.CoreClientManager; +import mineplex.core.common.util.C; +import mineplex.core.cosmetic.CosmeticManager; +import mineplex.core.cosmetic.ui.CosmeticShop; +import mineplex.core.cosmetic.ui.page.GadgetPage; +import mineplex.core.donation.DonationManager; +import mineplex.core.pet.custom.CustomPet; +import mineplex.core.pet.custom.CustomPetEquipment; +import mineplex.core.shop.item.ShopItem; + +public class CustomPetHelmetPage extends GadgetPage +{ + + public CustomPetHelmetPage(CosmeticManager plugin, CosmeticShop shop, CoreClientManager clientManager, DonationManager donationManager, String name, Player player) + { + super(plugin, shop, clientManager, donationManager, name, player); + } + + @Override + protected void buildPage() + { + + CustomPet customPet = CustomPet.getCustomPet(getPlayer()); + if (customPet == null) + { + CustomPet.removeCustomPet(getPlayer()); + getPlayer().closeInventory(); + return; + } + + if (!(customPet instanceof CustomPetEquipment)) + { + CustomPet.removeCustomPet(getPlayer()); + getPlayer().closeInventory(); + return; + } + + CustomPetEquipment customPetEquipment = (CustomPetEquipment) customPet; + + // Leather helmet + addButton(19, new ShopItem(Material.LEATHER_HELMET, "Leather", 1, false), (player, clickType) -> + { + // TODO COLORED ARMOR + customPetEquipment.setHelmet(new ItemStack(Material.LEATHER_HELMET)); + getShop().openPageForPlayer(getPlayer(), customPet.getNextStep(getPlugin(), getShop(), getClientManager(), getDonationManager())); + }); + + addButton(22, new ShopItem(Material.CHAINMAIL_HELMET, "Chain", 1, false), (player, clickType) -> + { + customPetEquipment.setHelmet(new ItemStack(Material.CHAINMAIL_HELMET)); + getShop().openPageForPlayer(getPlayer(), customPet.getNextStep(getPlugin(), getShop(), getClientManager(), getDonationManager())); + }); + + addButton(25, new ShopItem(Material.IRON_HELMET, "Iron", 1, false), (player, clickType) -> + { + customPetEquipment.setHelmet(new ItemStack(Material.IRON_HELMET)); + getShop().openPageForPlayer(getPlayer(), customPet.getNextStep(getPlugin(), getShop(), getClientManager(), getDonationManager())); + }); + + addButton(38, new ShopItem(Material.GOLD_HELMET, "Gold", 1, false), (player, clickType) -> + { + customPetEquipment.setHelmet(new ItemStack(Material.GOLD_HELMET)); + getShop().openPageForPlayer(getPlayer(), customPet.getNextStep(getPlugin(), getShop(), getClientManager(), getDonationManager())); + }); + + addButton(40, new ShopItem(Material.BARRIER, "None", 1, false), (player, clickType) -> + { + customPetEquipment.setHelmet(new ItemStack(Material.AIR)); + getShop().openPageForPlayer(getPlayer(), customPet.getNextStep(getPlugin(), getShop(), getClientManager(), getDonationManager())); + }); + + addButton(42, new ShopItem(Material.DIAMOND_HELMET, "Diamond", 1, false), (player, clickType) -> + { + customPetEquipment.setHelmet(new ItemStack(Material.DIAMOND_HELMET)); + getShop().openPageForPlayer(getPlayer(), customPet.getNextStep(getPlugin(), getShop(), getClientManager(), getDonationManager())); + }); + + addButton(4, new ShopItem(Material.BED, C.cGray + " \u21FD Go Back", new String[]{}, 1, false), (player, clickType) -> + getShop().openPageForPlayer(getPlayer(), customPet.getPreviousStep(getPlugin(), getShop(), getClientManager(), getDonationManager()))); + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/equipment/CustomPetLeggingsPage.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/equipment/CustomPetLeggingsPage.java new file mode 100644 index 000000000..eaa0fdf9a --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/equipment/CustomPetLeggingsPage.java @@ -0,0 +1,88 @@ +package mineplex.core.cosmetic.ui.page.custompet.equipment; + +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; + +import mineplex.core.account.CoreClientManager; +import mineplex.core.common.util.C; +import mineplex.core.cosmetic.CosmeticManager; +import mineplex.core.cosmetic.ui.CosmeticShop; +import mineplex.core.cosmetic.ui.page.GadgetPage; +import mineplex.core.donation.DonationManager; +import mineplex.core.pet.custom.CustomPet; +import mineplex.core.pet.custom.CustomPetEquipment; +import mineplex.core.shop.item.ShopItem; + +public class CustomPetLeggingsPage extends GadgetPage +{ + + public CustomPetLeggingsPage(CosmeticManager plugin, CosmeticShop shop, CoreClientManager clientManager, DonationManager donationManager, String name, Player player) + { + super(plugin, shop, clientManager, donationManager, name, player); + } + + @Override + protected void buildPage() + { + + CustomPet customPet = CustomPet.getCustomPet(getPlayer()); + if (customPet == null) + { + CustomPet.removeCustomPet(getPlayer()); + getPlayer().closeInventory(); + return; + } + + if (!(customPet instanceof CustomPetEquipment)) + { + CustomPet.removeCustomPet(getPlayer()); + getPlayer().closeInventory(); + return; + } + + CustomPetEquipment customPetEquipment = (CustomPetEquipment) customPet; + + // Leather helmet + addButton(19, new ShopItem(Material.LEATHER_LEGGINGS, "Leather", 1, false), (player, clickType) -> + { + // TODO COLORED ARMOR + customPetEquipment.setLeggings(new ItemStack(Material.LEATHER_LEGGINGS)); + getShop().openPageForPlayer(getPlayer(), customPet.getNextStep(getPlugin(), getShop(), getClientManager(), getDonationManager())); + }); + + addButton(22, new ShopItem(Material.CHAINMAIL_LEGGINGS, "Chain", 1, false), (player, clickType) -> + { + customPetEquipment.setLeggings(new ItemStack(Material.CHAINMAIL_LEGGINGS)); + getShop().openPageForPlayer(getPlayer(), customPet.getNextStep(getPlugin(), getShop(), getClientManager(), getDonationManager())); + }); + + addButton(25, new ShopItem(Material.IRON_LEGGINGS, "Iron", 1, false), (player, clickType) -> + { + customPetEquipment.setLeggings(new ItemStack(Material.IRON_HELMET)); + getShop().openPageForPlayer(getPlayer(), customPet.getNextStep(getPlugin(), getShop(), getClientManager(), getDonationManager())); + }); + + addButton(38, new ShopItem(Material.GOLD_LEGGINGS, "Gold", 1, false), (player, clickType) -> + { + customPetEquipment.setLeggings(new ItemStack(Material.GOLD_LEGGINGS)); + getShop().openPageForPlayer(getPlayer(), customPet.getNextStep(getPlugin(), getShop(), getClientManager(), getDonationManager())); + }); + + addButton(40, new ShopItem(Material.BARRIER, "None", 1, false), (player, clickType) -> + { + customPetEquipment.setLeggings(new ItemStack(Material.AIR)); + getShop().openPageForPlayer(getPlayer(), customPet.getNextStep(getPlugin(), getShop(), getClientManager(), getDonationManager())); + }); + + addButton(42, new ShopItem(Material.DIAMOND_LEGGINGS, "Diamond", 1, false), (player, clickType) -> + { + customPetEquipment.setLeggings(new ItemStack(Material.DIAMOND_LEGGINGS)); + getShop().openPageForPlayer(getPlayer(), customPet.getNextStep(getPlugin(), getShop(), getClientManager(), getDonationManager())); + }); + + addButton(4, new ShopItem(Material.BED, C.cGray + " \u21FD Go Back", new String[]{}, 1, false), (player, clickType) -> + getShop().openPageForPlayer(getPlayer(), customPet.getPreviousStep(getPlugin(), getShop(), getClientManager(), getDonationManager()))); + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/name/CloseCustomPetButton.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/name/CloseCustomPetButton.java new file mode 100644 index 000000000..d2bef0f22 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/name/CloseCustomPetButton.java @@ -0,0 +1,16 @@ +package mineplex.core.cosmetic.ui.page.custompet.name; + +import org.bukkit.entity.Player; +import org.bukkit.event.inventory.ClickType; + +import mineplex.core.pet.custom.CustomPet; +import mineplex.core.shop.item.IButton; + +public class CloseCustomPetButton implements IButton +{ + public void onClick(Player player, ClickType clickType) + { + player.closeInventory(); + CustomPet.removeCustomPet(player); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/name/CustomPetNamePage.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/name/CustomPetNamePage.java new file mode 100644 index 000000000..60d71a10d --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/name/CustomPetNamePage.java @@ -0,0 +1,63 @@ +package mineplex.core.cosmetic.ui.page.custompet.name; + +import net.minecraft.server.v1_8_R3.Blocks; +import net.minecraft.server.v1_8_R3.ChatMessage; +import net.minecraft.server.v1_8_R3.EntityPlayer; +import net.minecraft.server.v1_8_R3.Items; +import net.minecraft.server.v1_8_R3.PacketPlayOutOpenWindow; +import net.minecraft.server.v1_8_R3.PacketPlayOutSetSlot; + +import org.bukkit.Material; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; +import org.bukkit.entity.Player; + +import mineplex.core.account.CoreClientManager; +import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.cosmetic.CosmeticManager; +import mineplex.core.cosmetic.ui.CosmeticShop; +import mineplex.core.cosmetic.ui.page.GadgetPage; +import mineplex.core.donation.DonationManager; +import mineplex.core.pet.custom.CustomPet; +import mineplex.core.shop.item.ShopItem; +import mineplex.core.shop.page.AnvilContainer; + +public class CustomPetNamePage extends GadgetPage +{ + + public CustomPetNamePage(CosmeticManager plugin, CosmeticShop shop, CoreClientManager clientManager, DonationManager donationManager, String name, Player player) + { + super(plugin, shop, clientManager, donationManager, name, player); + } + + @Override + protected void buildPage() + { + + CustomPet customPet = CustomPet.getCustomPet(getPlayer()); + if (customPet == null) + { + CustomPet.removeCustomPet(getPlayer()); + getPlayer().closeInventory(); + return; + } + + addButton(31, new ShopItem(Material.NAME_TAG, "Name", 1, false), (player, clickType) -> + { + CustomPetTagPage customPetTagPage = new CustomPetTagPage(getPlugin(), getShop(), getClientManager(), getDonationManager(), "Pet Name", getPlayer()); + EntityPlayer entityPlayer = ((CraftPlayer) getPlayer()).getHandle(); + int containerCounter = entityPlayer.nextContainerCounter(); + UtilPlayer.sendPacket(player, new PacketPlayOutOpenWindow(containerCounter, "minecraft:anvil", new ChatMessage(Blocks.ANVIL.a() + ".name", new Object[0]))); + entityPlayer.activeContainer = new AnvilContainer(entityPlayer.inventory, customPetTagPage.getInventory()); + entityPlayer.activeContainer.windowId = containerCounter; + entityPlayer.activeContainer.addSlotListener(entityPlayer); + UtilPlayer.sendPacket(player, new PacketPlayOutSetSlot(containerCounter, 0, new net.minecraft.server.v1_8_R3.ItemStack(Items.NAME_TAG))); + + getShop().setCurrentPageForPlayer(getPlayer(), customPetTagPage); + }); + + addButton(4, new ShopItem(Material.BED, C.cGray + " \u21FD Go Back", new String[]{}, 1, false), (player, clickType) -> + getShop().openPageForPlayer(getPlayer(), customPet.getPreviousStep(getPlugin(), getShop(), getClientManager(), getDonationManager()))); + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/name/CustomPetTagPage.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/name/CustomPetTagPage.java new file mode 100644 index 000000000..a011d3ece --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/name/CustomPetTagPage.java @@ -0,0 +1,98 @@ +package mineplex.core.cosmetic.ui.page.custompet.name; + +import net.minecraft.server.v1_8_R3.ItemStack; +import net.minecraft.server.v1_8_R3.Items; + +import org.bukkit.ChatColor; +import org.bukkit.entity.Player; + +import mineplex.core.account.CoreClientManager; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.cosmetic.CosmeticManager; +import mineplex.core.cosmetic.ui.CosmeticShop; +import mineplex.core.donation.DonationManager; +import mineplex.core.pet.custom.CustomPet; +import mineplex.core.shop.page.ShopPageBase; + +public class CustomPetTagPage extends ShopPageBase +{ + private String _tagName = "Pet Name"; + + public CustomPetTagPage(CosmeticManager plugin, CosmeticShop shop, CoreClientManager clientManager, DonationManager donationManager, String name, Player player) + { + super(plugin, shop, clientManager, donationManager, name, player, 3); + + buildPage(); + } + + @Override + protected void buildPage() + { + inventory.setItem(0, new ItemStack(Items.NAME_TAG)); + + getButtonMap().put(0, new CloseCustomPetButton()); + getButtonMap().put(1, new CloseCustomPetButton()); + getButtonMap().put(2, new SelectCustomPetTagButton(this)); + } + + @Override + public void playerClosed() + { + super.playerClosed(); + + getPlayer().setLevel(0); + CustomPet.removeCustomPet(_player); + } + + public void selectTag() + { + CustomPet customPet = CustomPet.getCustomPet(_player); + if (customPet == null) + { + _player.closeInventory(); + CustomPet.removeCustomPet(_player); + return; + } + + _tagName = ChatColor.stripColor(_tagName); + _tagName = _tagName.replaceAll("[^A-Za-z0-9]", ""); + System.out.println("Pet name: " + _tagName + "."); + if (_tagName.length() == 0) + { + UtilPlayer.message(getPlayer(), F.main(getPlugin().getName(), ChatColor.RED + "Supplied pet name contains invalid characters.")); + playDenySound(getPlayer()); + + getShop().openPageForPlayer(getPlayer(), customPet.getPreviousStep(getPlugin(), getShop(), getClientManager(), getDonationManager())); + return; + } + + if (_tagName.length() > 16) + { + UtilPlayer.message(getPlayer(), F.main(getPlugin().getName(), ChatColor.RED + "Pet name cannot be longer than 16 characters.")); + playDenySound(getPlayer()); + + getShop().openPageForPlayer(getPlayer(), customPet.getPreviousStep(getPlugin(), getShop(), getClientManager(), getDonationManager())); + return; + } + + if (_tagName.toLowerCase().contains("ultra")) + { + UtilPlayer.message(getPlayer(), F.main(getPlugin().getName(), ChatColor.RED + _tagName + " is a restricted name.")); + playDenySound(getPlayer()); + + getShop().openPageForPlayer(getPlayer(), customPet.getPreviousStep(getPlugin(), getShop(), getClientManager(), getDonationManager())); + return; + } + + customPet.setName(_tagName); + getShop().openPageForPlayer(getPlayer(), customPet.getNextStep(getPlugin(), getShop(), getClientManager(), getDonationManager())); + + } + + public void setTagName(String tagName) + { + _tagName = tagName; + } +} + diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/name/SelectCustomPetTagButton.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/name/SelectCustomPetTagButton.java new file mode 100644 index 000000000..c934f7648 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/name/SelectCustomPetTagButton.java @@ -0,0 +1,21 @@ +package mineplex.core.cosmetic.ui.page.custompet.name; + +import org.bukkit.entity.Player; +import org.bukkit.event.inventory.ClickType; + +import mineplex.core.shop.item.IButton; + +public class SelectCustomPetTagButton implements IButton +{ + private CustomPetTagPage _page; + + public SelectCustomPetTagButton(CustomPetTagPage page) + { + _page = page; + } + + public void onClick(Player player, ClickType clickType) + { + _page.selectTag(); + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/zombie/CustomPetZombieTypePage.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/zombie/CustomPetZombieTypePage.java new file mode 100644 index 000000000..70f017744 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/zombie/CustomPetZombieTypePage.java @@ -0,0 +1,61 @@ +package mineplex.core.cosmetic.ui.page.custompet.zombie; + +import org.bukkit.Material; +import org.bukkit.entity.Player; + +import mineplex.core.account.CoreClientManager; +import mineplex.core.common.util.C; +import mineplex.core.cosmetic.CosmeticManager; +import mineplex.core.cosmetic.ui.CosmeticShop; +import mineplex.core.cosmetic.ui.page.GadgetPage; +import mineplex.core.donation.DonationManager; +import mineplex.core.pet.custom.CustomPet; +import mineplex.core.pet.custom.CustomPetZombie; +import mineplex.core.shop.item.ShopItem; + +public class CustomPetZombieTypePage extends GadgetPage +{ + + public CustomPetZombieTypePage(CosmeticManager plugin, CosmeticShop shop, CoreClientManager clientManager, DonationManager donationManager, String name, Player player) + { + super(plugin, shop, clientManager, donationManager, name, player); + } + + @Override + protected void buildPage() + { + + CustomPet customPet = CustomPet.getCustomPet(getPlayer()); + if (customPet == null) + { + CustomPet.removeCustomPet(getPlayer()); + getPlayer().closeInventory(); + return; + } + + if (!(customPet instanceof CustomPetZombie)) + { + CustomPet.removeCustomPet(getPlayer()); + getPlayer().closeInventory(); + return; + } + + CustomPetZombie customPetZombie = (CustomPetZombie) customPet; + + addButton(29, new ShopItem(Material.BARRIER, "Zombie", 1, false), (player, clickType) -> + { + customPetZombie.setVillager(false); + getShop().openPageForPlayer(getPlayer(), customPet.getNextStep(getPlugin(), getShop(), getClientManager(), getDonationManager())); + }); + + addButton(33, new ShopItem(Material.WHEAT, "Zombie Villager", 1, false), (player, clickType) -> + { + customPetZombie.setVillager(true); + getShop().openPageForPlayer(getPlayer(), customPet.getNextStep(getPlugin(), getShop(), getClientManager(), getDonationManager())); + }); + + addButton(4, new ShopItem(Material.BED, C.cGray + " \u21FD Go Back", new String[]{}, 1, false), (player, clickType) -> + getShop().openPageForPlayer(getPlayer(), customPet.getPreviousStep(getPlugin(), getShop(), getClientManager(), getDonationManager()))); + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/pet/custom/CustomPet.java b/Plugins/Mineplex.Core/src/mineplex/core/pet/custom/CustomPet.java index 8636cbfce..7a6b7feb6 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/pet/custom/CustomPet.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/pet/custom/CustomPet.java @@ -1,14 +1,21 @@ package mineplex.core.pet.custom; +import java.util.ArrayList; import java.util.HashMap; +import java.util.List; import java.util.Map; +import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.entity.Entity; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.meta.ItemMeta; import mineplex.core.account.CoreClientManager; +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; import mineplex.core.cosmetic.CosmeticManager; import mineplex.core.cosmetic.ui.CosmeticShop; import mineplex.core.cosmetic.ui.page.GadgetPage; @@ -25,6 +32,7 @@ public abstract class CustomPet protected DisguiseBase _disguiseBase; protected int _step = 0; private String _name; + private List _lines = new ArrayList<>(); public CustomPet(Player player, EntityType entityType) { @@ -41,7 +49,9 @@ public abstract class CustomPet public abstract void onSpawn(Entity entity); - public abstract GadgetPage createNextStep(CosmeticManager plugin, CosmeticShop shop, CoreClientManager clientManager, DonationManager donationManager); + public abstract GadgetPage getNextStep(CosmeticManager plugin, CosmeticShop shop, CoreClientManager clientManager, DonationManager donationManager); + + public abstract GadgetPage getPreviousStep(CosmeticManager plugin, CosmeticShop shop, CoreClientManager clientManager, DonationManager donationManager); public DisguiseBase getDisguiseBase() { @@ -58,6 +68,43 @@ public abstract class CustomPet return _name; } + public void addLine(String lineKey, String lineValue) + { + _lines.add(C.cGray + lineKey + ": " + F.name(lineValue)); + } + + public void addLine(String lineKey, String lineValue, int i) + { + _lines.add(i, C.cGray + lineKey + ": " + F.name(lineValue)); + } + + protected void addTypeLine(String type) + { + addLine("Type", type); + } + + public List getLines() + { + return _lines; + } + + public ItemStack getCustomPetDescription() + { + ItemStack itemStack = new ItemStack(Material.PAPER); + ItemMeta meta = itemStack.getItemMeta(); + if (_name != null) + { + meta.setDisplayName(ChatColor.translateAlternateColorCodes('&', _name)); + } + else + { + meta.setDisplayName("Custom Pet"); + } + meta.setLore(_lines); + itemStack.setItemMeta(meta); + return itemStack; + } + public static CustomPet getCustomPet(Player player) { if (_customPet.containsKey(player)) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/pet/custom/CustomPetAgeable.java b/Plugins/Mineplex.Core/src/mineplex/core/pet/custom/CustomPetAgeable.java index 218bd52f1..5691aba57 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/pet/custom/CustomPetAgeable.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/pet/custom/CustomPetAgeable.java @@ -16,6 +16,7 @@ public abstract class CustomPetAgeable extends CustomPet public void setBaby(boolean baby) { _baby = baby; + addLine("Age", (baby) ? "Baby" : "Adult"); } protected boolean isBaby() diff --git a/Plugins/Mineplex.Core/src/mineplex/core/pet/custom/CustomPetEquipment.java b/Plugins/Mineplex.Core/src/mineplex/core/pet/custom/CustomPetEquipment.java index 73bc69fc4..b67211a80 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/pet/custom/CustomPetEquipment.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/pet/custom/CustomPetEquipment.java @@ -1,5 +1,6 @@ package mineplex.core.pet.custom; +import org.bukkit.Material; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; @@ -20,21 +21,25 @@ public abstract class CustomPetEquipment extends CustomPetAgeable public void setHelmet(ItemStack helmet) { _helmet = helmet; + addLine("Helmet", (helmet.getType() == Material.AIR) ? "None" : helmet.getItemMeta().getDisplayName()); } public void setChestplate(ItemStack chestplate) { _chestplate = chestplate; + addLine("Chestplate", (chestplate.getType() == Material.AIR) ? "None" : chestplate.getItemMeta().getDisplayName()); } public void setLeggings(ItemStack leggings) { _leggings = leggings; + addLine("Leggings", (leggings.getType() == Material.AIR) ? "None" : leggings.getItemMeta().getDisplayName()); } public void setBoots(ItemStack boots) { _boots = boots; + addLine("Boots", (boots.getType() == Material.AIR) ? "None" : boots.getItemMeta().getDisplayName()); } public ItemStack getHelmet() diff --git a/Plugins/Mineplex.Core/src/mineplex/core/pet/custom/CustomPetZombie.java b/Plugins/Mineplex.Core/src/mineplex/core/pet/custom/CustomPetZombie.java index 4d217109d..0b36d629c 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/pet/custom/CustomPetZombie.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/pet/custom/CustomPetZombie.java @@ -1,5 +1,6 @@ package mineplex.core.pet.custom; +import org.bukkit.ChatColor; import org.bukkit.entity.Entity; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; @@ -8,7 +9,15 @@ import mineplex.core.account.CoreClientManager; import mineplex.core.cosmetic.CosmeticManager; import mineplex.core.cosmetic.ui.CosmeticShop; import mineplex.core.cosmetic.ui.page.GadgetPage; -import mineplex.core.cosmetic.ui.page.custompet.CustomPetAgePage; +import mineplex.core.cosmetic.ui.page.custompet.CustomPetBasePage; +import mineplex.core.cosmetic.ui.page.custompet.CustomPetConfirmPage; +import mineplex.core.cosmetic.ui.page.custompet.age.CustomPetAgePage; +import mineplex.core.cosmetic.ui.page.custompet.equipment.CustomPetBootsPage; +import mineplex.core.cosmetic.ui.page.custompet.equipment.CustomPetChestplatePage; +import mineplex.core.cosmetic.ui.page.custompet.equipment.CustomPetHelmetPage; +import mineplex.core.cosmetic.ui.page.custompet.equipment.CustomPetLeggingsPage; +import mineplex.core.cosmetic.ui.page.custompet.name.CustomPetNamePage; +import mineplex.core.cosmetic.ui.page.custompet.zombie.CustomPetZombieTypePage; import mineplex.core.disguise.DisguiseFactory; import mineplex.core.disguise.disguises.DisguiseZombie; import mineplex.core.donation.DonationManager; @@ -16,9 +25,12 @@ import mineplex.core.donation.DonationManager; public class CustomPetZombie extends CustomPetEquipment { + private boolean _villager = false; + public CustomPetZombie(Player player) { super(player, EntityType.ZOMBIE); + addTypeLine("Zombie"); } @Override @@ -47,7 +59,7 @@ public class CustomPetZombie extends CustomPetEquipment if (getName() != null) { disguiseZombie.setCustomNameVisible(true); - disguiseZombie.setName(getName()); + disguiseZombie.setName(ChatColor.translateAlternateColorCodes('&', getName())); } else { @@ -56,16 +68,82 @@ public class CustomPetZombie extends CustomPetEquipment } @Override - public GadgetPage createNextStep(CosmeticManager plugin, CosmeticShop shop, CoreClientManager clientManager, DonationManager donationManager) + public GadgetPage getNextStep(CosmeticManager plugin, CosmeticShop shop, CoreClientManager clientManager, DonationManager donationManager) { switch (_step) { case 0: + _step++; + return new CustomPetNamePage(plugin, shop, clientManager, donationManager, "Zombie Name", _player); + case 1: _step++; return new CustomPetAgePage(plugin, shop, clientManager, donationManager, "Zombie Age", _player); + case 2: + _step++; + return new CustomPetHelmetPage(plugin, shop, clientManager, donationManager, "Zombie Helmet", _player); + case 3: + _step++; + return new CustomPetChestplatePage(plugin, shop, clientManager, donationManager, "Zombie Chestplate", _player); + case 4: + _step++; + return new CustomPetLeggingsPage(plugin, shop, clientManager, donationManager, "Zombie Leggings", _player); + case 5: + _step++; + return new CustomPetBootsPage(plugin, shop, clientManager, donationManager, "Zombie Boots", _player); + case 6: + _step++; + return new CustomPetZombieTypePage(plugin, shop, clientManager, donationManager, "Zombie Type", _player); + case 7: + _step++; + return new CustomPetConfirmPage(plugin, shop, clientManager, donationManager, "Confirm", _player); default: _step++; return new CustomPetAgePage(plugin, shop, clientManager, donationManager, "Zombie Age", _player); } } + + @Override + public GadgetPage getPreviousStep(CosmeticManager plugin, CosmeticShop shop, CoreClientManager clientManager, DonationManager donationManager) + { + switch (_step) + { + case 1: + _step--; + return new CustomPetBasePage(plugin, shop, clientManager, donationManager, "Custom Pet", _player); + case 2: + _step--; + return new CustomPetNamePage(plugin, shop, clientManager, donationManager, "Zombie Name", _player); + case 3: + _step--; + return new CustomPetAgePage(plugin, shop, clientManager, donationManager, "Zombie Age", _player); + case 4: + _step--; + return new CustomPetHelmetPage(plugin, shop, clientManager, donationManager, "Zombie Helmet", _player); + case 5: + _step--; + return new CustomPetChestplatePage(plugin, shop, clientManager, donationManager, "Zombie Chestplate", _player); + case 6: + _step--; + return new CustomPetLeggingsPage(plugin, shop, clientManager, donationManager, "Zombie Leggings", _player); + case 7: + _step--; + return new CustomPetBootsPage(plugin, shop, clientManager, donationManager, "Zombie Boots", _player); + case 8: + _step--; + return new CustomPetZombieTypePage(plugin, shop, clientManager, donationManager, "Zombie Type", _player); + default: + _step--; + return new CustomPetBasePage(plugin, shop, clientManager, donationManager, "Custom Pet", _player); + } + } + + public void setVillager(boolean villager) + { + _villager = villager; + } + + public boolean isVillager() + { + return _villager; + } } From f5a85f2a54867a8b7156794e19bf716ffa913882 Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Tue, 14 Mar 2017 09:57:34 -0300 Subject: [PATCH 20/98] Spawns pet --- .../custompet/ActivateCustomPetButton.java | 27 ++++++++++ .../ui/page/custompet/CustomPetBasePage.java | 6 +++ .../page/custompet/CustomPetConfirmPage.java | 9 ++-- .../src/mineplex/core/pet/PetManager.java | 52 ++++++++++--------- .../mineplex/core/pet/custom/CustomPet.java | 10 +--- .../core/pet/custom/CustomPetZombie.java | 6 +-- 6 files changed, 68 insertions(+), 42 deletions(-) create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/ActivateCustomPetButton.java diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/ActivateCustomPetButton.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/ActivateCustomPetButton.java new file mode 100644 index 000000000..f0c0a6845 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/ActivateCustomPetButton.java @@ -0,0 +1,27 @@ +package mineplex.core.cosmetic.ui.page.custompet; + +import org.bukkit.entity.Player; +import org.bukkit.event.inventory.ClickType; + +import mineplex.core.cosmetic.ui.page.GadgetPage; +import mineplex.core.cosmetic.ui.page.Menu; +import mineplex.core.pet.PetType; +import mineplex.core.shop.item.IButton; + +public class ActivateCustomPetButton implements IButton +{ + private GadgetPage _page; + + public ActivateCustomPetButton(GadgetPage page) + { + _page = page; + } + + @Override + public void onClick(Player player, ClickType clickType) + { + _page.playAcceptSound(player); + _page.getPlugin().getPetManager().addPetOwner(player, PetType.CUSTOM, player.getLocation()); + _page.getShop().openPageForPlayer(player, new Menu(_page.getPlugin(), _page.getShop(), _page.getClientManager(), _page.getDonationManager(), player)); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/CustomPetBasePage.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/CustomPetBasePage.java index 64d55c75c..9f86874cd 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/CustomPetBasePage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/CustomPetBasePage.java @@ -25,6 +25,12 @@ public class CustomPetBasePage extends GadgetPage protected void buildPage() { + // TODO + // EDIT PET + // DISABLE PET + // RENAME PET + // RESET PET + int slot = 10; for (CustomPet.CustomPetType customPetType : CustomPet.CustomPetType.values()) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/CustomPetConfirmPage.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/CustomPetConfirmPage.java index 73c381bde..02ee84191 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/CustomPetConfirmPage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/CustomPetConfirmPage.java @@ -7,6 +7,7 @@ import mineplex.core.account.CoreClientManager; import mineplex.core.common.util.C; import mineplex.core.cosmetic.CosmeticManager; import mineplex.core.cosmetic.ui.CosmeticShop; +import mineplex.core.cosmetic.ui.button.activate.ActivatePetButton; import mineplex.core.cosmetic.ui.page.GadgetPage; import mineplex.core.donation.DonationManager; import mineplex.core.pet.custom.CustomPet; @@ -40,17 +41,15 @@ public class CustomPetConfirmPage extends GadgetPage for (int aConfirm : confirm) { - addButton(aConfirm, confirmItem, (player, clickType) -> - { - // TODO - }); + addButton(aConfirm, confirmItem, new ActivateCustomPetButton(this)); } for (int aCancel : cancel) { addButton(aCancel, cancelItem, (player, clickType) -> { - // TODO + player.closeInventory(); + CustomPet.removeCustomPet(player); }); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/pet/PetManager.java b/Plugins/Mineplex.Core/src/mineplex/core/pet/PetManager.java index 9eae213a0..cf5dda656 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/pet/PetManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/pet/PetManager.java @@ -22,6 +22,8 @@ import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPigZombie; import org.bukkit.entity.Ageable; import org.bukkit.entity.Blaze; import org.bukkit.entity.Creature; +import org.bukkit.entity.Creeper; +import org.bukkit.entity.Entity; import org.bukkit.entity.EntityType; import org.bukkit.entity.PigZombie; import org.bukkit.entity.Player; @@ -54,7 +56,6 @@ import mineplex.core.common.Rank; import mineplex.core.common.shape.ShapeWings; import mineplex.core.common.skin.SkinData; import mineplex.core.common.util.F; -import mineplex.core.common.util.NautHashMap; import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilAlg; import mineplex.core.common.util.UtilEnt; @@ -72,6 +73,7 @@ import mineplex.core.disguise.disguises.DisguiseZombie; import mineplex.core.donation.DonationManager; import mineplex.core.inventory.InventoryManager; import mineplex.core.itemstack.ItemStackFactory; +import mineplex.core.pet.custom.CustomPet; import mineplex.core.pet.repository.PetRepository; import mineplex.core.pet.repository.token.ClientPetTokenWrapper; import mineplex.core.updater.UpdateType; @@ -88,11 +90,11 @@ public class PetManager extends MiniClientPlugin private BlockRestore _blockRestore; private Map _activePetOwnerTypes = new HashMap<>(); - private NautHashMap _activePetOwners; - private NautHashMap _failedAttempts; + private Map _activePetOwners; + private Map _failedAttempts; private Map _petOwnerQueue = new HashMap<>(); - private NautHashMap _petRenameQueue = new NautHashMap(); + private Map _petRenameQueue = new HashMap<>(); private DonationManager _donationManager; private CoreClientManager _clientManager; private InventoryManager _inventoryManager; @@ -120,8 +122,8 @@ public class PetManager extends MiniClientPlugin _clientManager = clientManager; _inventoryManager = inventoryManager; - _activePetOwners = new NautHashMap(); - _failedAttempts = new NautHashMap(); + _activePetOwners = new HashMap<>(); + _failedAttempts = new HashMap<>(); } public void addPetOwnerToQueue(String playerName, PetType petType) @@ -169,7 +171,7 @@ public class PetManager extends MiniClientPlugin if (player != null && player.isOnline()) { - Creature activePet = getActivePet(playerName); + Entity activePet = getActivePet(playerName); if (activePet != null) { activePet.setCustomNameVisible(true); @@ -424,7 +426,7 @@ public class PetManager extends MiniClientPlugin UtilEnt.vegetate(pet); } - public Creature getPet(Player player) + public Entity getPet(Player player) { return _activePetOwners.get(player.getName()); } @@ -433,7 +435,7 @@ public class PetManager extends MiniClientPlugin { if (_activePetOwners.containsKey(player.getName())) { - final Creature pet = _activePetOwners.get(player.getName()); + final Entity pet = _activePetOwners.get(player.getName()); //Wither Silverfish if (pet.getPassenger() != null) @@ -494,7 +496,7 @@ public class PetManager extends MiniClientPlugin { String playerName = null; - for (Entry entry : _activePetOwners.entrySet()) + for (Entry entry : _activePetOwners.entrySet()) { if (entry.getValue() == event.getEntity()) playerName = entry.getKey(); @@ -518,28 +520,28 @@ public class PetManager extends MiniClientPlugin public void onUpdate(UpdateEvent event) { - for (Entry entry : _activePetOwners.entrySet()) + for (Entry entry : _activePetOwners.entrySet()) { String playerName = entry.getKey(); - Creature creature = entry.getValue(); + Entity entity = entry.getValue(); if (event.getType() == UpdateType.TICK) { - if (creature instanceof PigZombie) + if (entity instanceof PigZombie) { - UtilParticle.PlayParticleToAll(ParticleType.LARGE_SMOKE, creature.getLocation(), 0.2f, 0.0f, 0.2f, 0.0f, 4, ViewDist.NORMAL); - if(event.getTick() % 3 == 0) creature.getWorld().playSound(creature.getLocation(), Sound.BLAZE_BREATH, 0.03f, 0f); - if(!((CraftPigZombie) creature).getHandle().isSilent()) + UtilParticle.PlayParticleToAll(ParticleType.LARGE_SMOKE, entity.getLocation(), 0.2f, 0.0f, 0.2f, 0.0f, 4, ViewDist.NORMAL); + if(event.getTick() % 3 == 0) entity.getWorld().playSound(entity.getLocation(), Sound.BLAZE_BREATH, 0.03f, 0f); + if(!((CraftPigZombie) entity).getHandle().isSilent()) { - ((CraftPigZombie) creature).getHandle().setSilent(true); + ((CraftPigZombie) entity).getHandle().setSilent(true); } } } else if (event.getType() == UpdateType.FAST) { - if (creature instanceof Blaze) + if (entity instanceof Blaze) { - Location loc = creature.getLocation().clone().add(0, .5, 0).add(creature.getLocation().getDirection().multiply(-0.2)); + Location loc = entity.getLocation().clone().add(0, .5, 0).add(entity.getLocation().getDirection().multiply(-0.2)); _grimReaperWings.display(loc); _grimReaperWingsEdge.display(loc); } @@ -548,7 +550,7 @@ public class PetManager extends MiniClientPlugin PetType petType = getActivePetType(playerName); if (petType == PetType.CUPID_PET) { - Location loc = creature.getLocation().clone().add(0, .5, 0).add(creature.getLocation().getDirection().multiply(-0.2)); + Location loc = entity.getLocation().clone().add(0, .5, 0).add(entity.getLocation().getDirection().multiply(-0.2)); _cupidWings.displayColored(loc, Color.PINK); _cupidWingsWhite.displayColored(loc, Color.WHITE); @@ -561,7 +563,7 @@ public class PetManager extends MiniClientPlugin PetType petType = getActivePetType(playerName); if (petType == PetType.CUPID_PET) { - Location loc = creature.getLocation().clone().add(0, .5, 0); + Location loc = entity.getLocation().clone().add(0, .5, 0); UtilParticle.PlayParticle(ParticleType.HEART, loc, 0.25f, 0.25f, 0.25f, 0.25f, 3, ViewDist.NORMAL); } } @@ -581,7 +583,7 @@ public class PetManager extends MiniClientPlugin String playerName = ownerIterator.next(); Player owner = Bukkit.getPlayer(playerName); - Creature pet = _activePetOwners.get(playerName); + Entity pet = _activePetOwners.get(playerName); Location petSpot = pet.getLocation(); Location ownerSpot = owner.getLocation(); xDiff = Math.abs(petSpot.getBlockX() - ownerSpot.getBlockX()); @@ -690,7 +692,7 @@ public class PetManager extends MiniClientPlugin { if (event.getEntity() instanceof Zombie) { - if (_activePetOwners.containsValue((Creature) event.getEntity())) + if (_activePetOwners.containsValue(event.getEntity())) { event.setCancelled(true); } @@ -718,7 +720,7 @@ public class PetManager extends MiniClientPlugin return _activePetOwnerTypes.get(name); } - public Creature getActivePet(String name) + public Entity getActivePet(String name) { return _activePetOwners.get(name); } @@ -734,7 +736,7 @@ public class PetManager extends MiniClientPlugin removePet(player, true); } - public Collection getPets() + public Collection getPets() { return _activePetOwners.values(); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/pet/custom/CustomPet.java b/Plugins/Mineplex.Core/src/mineplex/core/pet/custom/CustomPet.java index 7a6b7feb6..4113bb39d 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/pet/custom/CustomPet.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/pet/custom/CustomPet.java @@ -16,10 +16,10 @@ import org.bukkit.inventory.meta.ItemMeta; import mineplex.core.account.CoreClientManager; import mineplex.core.common.util.C; import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilEnt; import mineplex.core.cosmetic.CosmeticManager; import mineplex.core.cosmetic.ui.CosmeticShop; import mineplex.core.cosmetic.ui.page.GadgetPage; -import mineplex.core.disguise.disguises.DisguiseBase; import mineplex.core.donation.DonationManager; public abstract class CustomPet @@ -29,7 +29,6 @@ public abstract class CustomPet protected Player _player; protected EntityType _entityType; - protected DisguiseBase _disguiseBase; protected int _step = 0; private String _name; private List _lines = new ArrayList<>(); @@ -43,7 +42,7 @@ public abstract class CustomPet public void spawn(Entity entity) { - // TODO + UtilEnt.silence(entity, true); onSpawn(entity); } @@ -53,11 +52,6 @@ public abstract class CustomPet public abstract GadgetPage getPreviousStep(CosmeticManager plugin, CosmeticShop shop, CoreClientManager clientManager, DonationManager donationManager); - public DisguiseBase getDisguiseBase() - { - return _disguiseBase; - } - public void setName(String name) { _name = name; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/pet/custom/CustomPetZombie.java b/Plugins/Mineplex.Core/src/mineplex/core/pet/custom/CustomPetZombie.java index 0b36d629c..172474d18 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/pet/custom/CustomPetZombie.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/pet/custom/CustomPetZombie.java @@ -18,7 +18,6 @@ import mineplex.core.cosmetic.ui.page.custompet.equipment.CustomPetHelmetPage; import mineplex.core.cosmetic.ui.page.custompet.equipment.CustomPetLeggingsPage; import mineplex.core.cosmetic.ui.page.custompet.name.CustomPetNamePage; import mineplex.core.cosmetic.ui.page.custompet.zombie.CustomPetZombieTypePage; -import mineplex.core.disguise.DisguiseFactory; import mineplex.core.disguise.disguises.DisguiseZombie; import mineplex.core.donation.DonationManager; @@ -36,10 +35,9 @@ public class CustomPetZombie extends CustomPetEquipment @Override public void onSpawn(Entity entity) { - // TODO - _disguiseBase = DisguiseFactory.createDisguise(entity, _entityType); - DisguiseZombie disguiseZombie = (DisguiseZombie) _disguiseBase; + DisguiseZombie disguiseZombie = new DisguiseZombie(entity); disguiseZombie.setBaby(isBaby()); + disguiseZombie.setVillager(_villager); if (getHelmet() != null) { disguiseZombie.setHelmet(getHelmet()); From df4d0b117b2906600ae5ed62a8511fb2d77eb7c9 Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Tue, 14 Mar 2017 09:59:38 -0300 Subject: [PATCH 21/98] Possible fix for pet names not showing --- .../src/mineplex/core/pet/PetManager.java | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/pet/PetManager.java b/Plugins/Mineplex.Core/src/mineplex/core/pet/PetManager.java index cf5dda656..a694c78f9 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/pet/PetManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/pet/PetManager.java @@ -271,7 +271,7 @@ public class PetManager extends MiniClientPlugin //Named Pet if (Get(player).getPets().get(petType) != null && Get(player).getPets().get(petType).length() > 0) { - //pet.setCustomNameVisible(true); + pet.setCustomNameVisible(true); pet.setCustomName(Get(player).getPets().get(petType)); } @@ -300,9 +300,9 @@ public class PetManager extends MiniClientPlugin DisguiseGuardian disguise = new DisguiseGuardian(pet); - if (Get(player).getPets().get(entityType) != null && Get(player).getPets().get(entityType).length() > 0) + if (Get(player).getPets().get(petType) != null && Get(player).getPets().get(petType).length() > 0) { - disguise.setName(Get(player).getPets().get(entityType)); + disguise.setName(Get(player).getPets().get(petType)); disguise.setCustomNameVisible(true); } @@ -317,9 +317,9 @@ public class PetManager extends MiniClientPlugin Zombie zombie = pet.getWorld().spawn(pet.getLocation(), Zombie.class); zombie.setBaby(true); zombie.getEquipment().setHelmet(new ItemStack(Material.PUMPKIN)); - if (Get(player).getPets().get(entityType) != null && Get(player).getPets().get(entityType).length() > 0) + if (Get(player).getPets().get(petType) != null && Get(player).getPets().get(petType).length() > 0) { - zombie.setCustomName(Get(player).getPets().get(entityType)); + zombie.setCustomName(Get(player).getPets().get(petType)); zombie.setCustomNameVisible(true); } disguise.getEntity().getBukkitEntity().setPassenger(zombie); @@ -332,9 +332,9 @@ public class PetManager extends MiniClientPlugin disguiseZombie.setChestplate(new ItemStack(Material.BANNER)); disguiseZombie.setHeldItem(new ItemStack(Material.WOOD_HOE)); - if (Get(player).getPets().get(entityType) != null && Get(player).getPets().get(entityType).length() > 0) + if (Get(player).getPets().get(petType) != null && Get(player).getPets().get(petType).length() > 0) { - disguiseZombie.setName(Get(player).getPets().get(entityType)); + disguiseZombie.setName(Get(player).getPets().get(petType)); disguiseZombie.setCustomNameVisible(true); } @@ -354,9 +354,9 @@ public class PetManager extends MiniClientPlugin UtilEnt.silence(zombie, true); - if (Get(player).getPets().get(entityType) != null && Get(player).getPets().get(entityType).length() > 0) + if (Get(player).getPets().get(petType) != null && Get(player).getPets().get(petType).length() > 0) { - zombie.setCustomName(Get(player).getPets().get(entityType)); + zombie.setCustomName(Get(player).getPets().get(petType)); zombie.setCustomNameVisible(true); } } @@ -369,9 +369,9 @@ public class PetManager extends MiniClientPlugin disguiseVillager.setBaby(); disguiseVillager.setHeldItem(new ItemStack(Material.BOW)); - if (Get(player).getPets().get(entityType) != null && Get(player).getPets().get(entityType).length() > 0) + if (Get(player).getPets().get(petType) != null && Get(player).getPets().get(petType).length() > 0) { - disguiseVillager.setName(Get(player).getPets().get(entityType)); + disguiseVillager.setName(Get(player).getPets().get(petType)); disguiseVillager.setCustomNameVisible(true); } @@ -386,9 +386,9 @@ public class PetManager extends MiniClientPlugin UtilEnt.silence(zombie, true); - if (Get(player).getPets().get(entityType) != null && Get(player).getPets().get(entityType).length() > 0) + if (Get(player).getPets().get(petType) != null && Get(player).getPets().get(petType).length() > 0) { - zombie.setCustomName(Get(player).getPets().get(entityType)); + zombie.setCustomName(Get(player).getPets().get(petType)); zombie.setCustomNameVisible(true); } From defece04a981f5b1e448c5d6586424b7eaa08cb8 Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Tue, 14 Mar 2017 13:30:51 -0300 Subject: [PATCH 22/98] Fixed some issues changing Creature to Entity --- .../mineplex/core/cosmetic/ui/page/Menu.java | 4 +-- .../equipment/CustomPetHelmetPage.java | 11 +++++++ .../src/mineplex/clanshub/HubManager.java | 17 ++++++----- .../src/mineplex/hub/modules/NewsManager.java | 30 +++++++++++-------- .../game/arcade/managers/GameManager.java | 22 ++++++++------ 5 files changed, 53 insertions(+), 31 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/Menu.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/Menu.java index 3152a8fd0..37d7190f4 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/Menu.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/Menu.java @@ -6,7 +6,7 @@ import java.util.List; import java.util.Map; import org.bukkit.Material; -import org.bukkit.entity.Creature; +import org.bukkit.entity.Entity; import org.bukkit.entity.Player; import mineplex.core.account.CoreClientManager; @@ -142,7 +142,7 @@ public class Menu extends ShopPageBase petMax++; } - Creature petActive = getPlugin().getPetManager().getPet(getPlayer()); + Entity petActive = getPlugin().getPetManager().getPet(getPlayer()); GadgetType type = GadgetType.PARTICLE; String[] lore = getLore(ownedCount.get(type), maxCount.get(type), "Show everyone how cool you are with swirly particles that follow you when you walk!", VISIBILITY_EVERYWHERE, enabled.get(type)); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/equipment/CustomPetHelmetPage.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/equipment/CustomPetHelmetPage.java index dc90f4c9c..0e26f95a9 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/equipment/CustomPetHelmetPage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/equipment/CustomPetHelmetPage.java @@ -1,5 +1,6 @@ package mineplex.core.cosmetic.ui.page.custompet.equipment; +import org.bukkit.Bukkit; import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; @@ -26,21 +27,29 @@ public class CustomPetHelmetPage extends GadgetPage protected void buildPage() { + Bukkit.broadcastMessage("A"); + CustomPet customPet = CustomPet.getCustomPet(getPlayer()); if (customPet == null) { + Bukkit.broadcastMessage("A1"); CustomPet.removeCustomPet(getPlayer()); getPlayer().closeInventory(); return; } + Bukkit.broadcastMessage("B"); + if (!(customPet instanceof CustomPetEquipment)) { + Bukkit.broadcastMessage("B1"); CustomPet.removeCustomPet(getPlayer()); getPlayer().closeInventory(); return; } + Bukkit.broadcastMessage("A"); + CustomPetEquipment customPetEquipment = (CustomPetEquipment) customPet; // Leather helmet @@ -51,6 +60,8 @@ public class CustomPetHelmetPage extends GadgetPage getShop().openPageForPlayer(getPlayer(), customPet.getNextStep(getPlugin(), getShop(), getClientManager(), getDonationManager())); }); + Bukkit.broadcastMessage("B"); + addButton(22, new ShopItem(Material.CHAINMAIL_HELMET, "Chain", 1, false), (player, clickType) -> { customPetEquipment.setHelmet(new ItemStack(Material.CHAINMAIL_HELMET)); diff --git a/Plugins/Mineplex.Hub.Clans/src/mineplex/clanshub/HubManager.java b/Plugins/Mineplex.Hub.Clans/src/mineplex/clanshub/HubManager.java index 565300ef3..4ce00640d 100644 --- a/Plugins/Mineplex.Hub.Clans/src/mineplex/clanshub/HubManager.java +++ b/Plugins/Mineplex.Hub.Clans/src/mineplex/clanshub/HubManager.java @@ -19,9 +19,9 @@ import org.bukkit.Material; import org.bukkit.World; import org.bukkit.block.Block; import org.bukkit.craftbukkit.v1_8_R3.CraftWorld; -import org.bukkit.entity.Creature; 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; @@ -1005,14 +1005,17 @@ public class HubManager extends MiniPlugin implements IChatMessageFormatter UtilTextTop.display(text, UtilServer.getPlayers()); //Fix Entity Names - for (Creature pet : _petManager.getPets()) + for (Entity pet : _petManager.getPets()) { - DisguiseBase disguise = _disguiseManager.getDisguise(pet); - - if (disguise instanceof DisguiseWither) + if (pet instanceof LivingEntity) { - ((DisguiseWither) disguise).setName(text); - disguise.resendMetadata(); + DisguiseBase disguise = _disguiseManager.getDisguise((LivingEntity) pet); + + if (disguise instanceof DisguiseWither) + { + ((DisguiseWither) disguise).setName(text); + disguise.resendMetadata(); + } } } diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/NewsManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/NewsManager.java index 0679e29ba..74febb1a9 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/NewsManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/NewsManager.java @@ -3,6 +3,14 @@ package mineplex.hub.modules; import java.util.HashMap; import java.util.Iterator; +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.entity.Entity; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.player.PlayerJoinEvent; + import mineplex.core.MiniPlugin; import mineplex.core.common.Rank; import mineplex.core.common.util.C; @@ -26,13 +34,6 @@ import mineplex.hub.HubManager; import mineplex.hub.HubRepository; import mineplex.hub.HubType; -import org.bukkit.Bukkit; -import org.bukkit.ChatColor; -import org.bukkit.entity.Creature; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.player.PlayerJoinEvent; - public class NewsManager extends MiniPlugin { public HubManager Manager; @@ -347,14 +348,17 @@ public class NewsManager extends MiniPlugin UtilTextTop.display(text, UtilServer.getPlayers()); //Fix Entity Names - for (Creature pet : Manager.getPetManager().getPets()) + for (Entity pet : Manager.getPetManager().getPets()) { - DisguiseBase disguise = Manager.GetDisguise().getDisguise(pet); - - if (disguise instanceof DisguiseWither) + if (pet instanceof LivingEntity) { - ((DisguiseWither) disguise).setName(text); - disguise.resendMetadata(); + DisguiseBase disguise = Manager.GetDisguise().getDisguise((LivingEntity) pet); + + if (disguise instanceof DisguiseWither) + { + ((DisguiseWither) disguise).setName(text); + disguise.resendMetadata(); + } } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameManager.java index d87447cc1..6d3c8e18b 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameManager.java @@ -9,7 +9,8 @@ import org.bukkit.Color; import org.bukkit.FireworkEffect.Type; import org.bukkit.Location; import org.bukkit.Sound; -import org.bukkit.entity.Creature; +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; @@ -94,16 +95,19 @@ public class GameManager implements Listener //Display IP UtilTextTop.displayProgress(text, health, UtilServer.getPlayers()); - for (Creature pet : Manager.getCosmeticManager().getPetManager().getPets()) + for (Entity pet : Manager.getCosmeticManager().getPetManager().getPets()) { - DisguiseBase disguise = Manager.GetDisguise().getDisguise(pet); - - if (disguise instanceof DisguiseWither) + if (pet instanceof LivingEntity) { - ((DisguiseWither) disguise).setName(text); - ((DisguiseLiving) disguise).setHealth((float) Math.max(0.1, - 300 * health)); - disguise.resendMetadata(); + DisguiseBase disguise = Manager.GetDisguise().getDisguise((LivingEntity) pet); + + if (disguise instanceof DisguiseWither) + { + ((DisguiseWither) disguise).setName(text); + ((DisguiseLiving) disguise).setHealth((float) Math.max(0.1, + 300 * health)); + disguise.resendMetadata(); + } } } From 5d2681ec97480598b5f456722751d9c9179d049b Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Tue, 14 Mar 2017 16:12:54 -0300 Subject: [PATCH 23/98] Fixed some issues with menus! --- .../core/cosmetic/ui/CosmeticShop.java | 18 +++++++++++++++--- .../ui/page/custompet/CustomPetBasePage.java | 2 +- .../page/custompet/CustomPetConfirmPage.java | 1 - .../equipment/CustomPetHelmetPage.java | 11 ----------- .../page/custompet/name/CustomPetTagPage.java | 3 --- .../src/mineplex/core/pet/PetManager.java | 5 +++++ .../mineplex/core/pet/custom/CustomPet.java | 11 +++++++---- .../core/pet/custom/CustomPetAgeable.java | 6 ++++-- .../core/pet/custom/CustomPetEquipment.java | 6 ++++-- .../core/pet/custom/CustomPetZombie.java | 6 ++++-- 10 files changed, 40 insertions(+), 29 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/CosmeticShop.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/CosmeticShop.java index 9c0138469..7a47b9aa2 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/CosmeticShop.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/CosmeticShop.java @@ -1,17 +1,19 @@ package mineplex.core.cosmetic.ui; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.plugin.messaging.PluginMessageListener; + import mineplex.core.account.CoreClientManager; import mineplex.core.cosmetic.CosmeticManager; import mineplex.core.cosmetic.ui.page.GadgetPage; import mineplex.core.cosmetic.ui.page.Menu; import mineplex.core.cosmetic.ui.page.PetTagPage; +import mineplex.core.cosmetic.ui.page.custompet.name.CustomPetTagPage; import mineplex.core.donation.DonationManager; import mineplex.core.gadget.event.ItemGadgetOutOfAmmoEvent; import mineplex.core.shop.ShopBase; import mineplex.core.shop.page.ShopPageBase; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.plugin.messaging.PluginMessageListener; public class CosmeticShop extends ShopBase implements PluginMessageListener { @@ -43,6 +45,16 @@ public class CosmeticShop extends ShopBase implements PluginMes ((PetTagPage) getPlayerPageMap().get(player.getUniqueId())).SetTagName(tagName); } } + + if (getPlayerPageMap().containsKey(player.getUniqueId()) && getPlayerPageMap().get(player.getUniqueId()) instanceof CustomPetTagPage) + { + if (message != null && message.length >= 1) + { + String tagName = new String(message); + + ((CustomPetTagPage) getPlayerPageMap().get(player.getUniqueId())).setTagName(tagName); + } + } } @EventHandler diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/CustomPetBasePage.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/CustomPetBasePage.java index 9f86874cd..8b52b34a8 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/CustomPetBasePage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/CustomPetBasePage.java @@ -41,7 +41,7 @@ public class CustomPetBasePage extends GadgetPage CustomPet customPet = CustomPet.getCustomPet(player); if (customPet == null) { - customPet = customPetType.getCustomPet(player); + customPet = customPetType.getCustomPet(getPlugin().getPetManager(), player); } getShop().openPageForPlayer(getPlayer(), customPet.getNextStep(getPlugin(), getShop(), getClientManager(), getDonationManager())); }); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/CustomPetConfirmPage.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/CustomPetConfirmPage.java index 02ee84191..965a1d6ef 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/CustomPetConfirmPage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/CustomPetConfirmPage.java @@ -7,7 +7,6 @@ import mineplex.core.account.CoreClientManager; import mineplex.core.common.util.C; import mineplex.core.cosmetic.CosmeticManager; import mineplex.core.cosmetic.ui.CosmeticShop; -import mineplex.core.cosmetic.ui.button.activate.ActivatePetButton; import mineplex.core.cosmetic.ui.page.GadgetPage; import mineplex.core.donation.DonationManager; import mineplex.core.pet.custom.CustomPet; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/equipment/CustomPetHelmetPage.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/equipment/CustomPetHelmetPage.java index 0e26f95a9..dc90f4c9c 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/equipment/CustomPetHelmetPage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/equipment/CustomPetHelmetPage.java @@ -1,6 +1,5 @@ package mineplex.core.cosmetic.ui.page.custompet.equipment; -import org.bukkit.Bukkit; import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; @@ -27,29 +26,21 @@ public class CustomPetHelmetPage extends GadgetPage protected void buildPage() { - Bukkit.broadcastMessage("A"); - CustomPet customPet = CustomPet.getCustomPet(getPlayer()); if (customPet == null) { - Bukkit.broadcastMessage("A1"); CustomPet.removeCustomPet(getPlayer()); getPlayer().closeInventory(); return; } - Bukkit.broadcastMessage("B"); - if (!(customPet instanceof CustomPetEquipment)) { - Bukkit.broadcastMessage("B1"); CustomPet.removeCustomPet(getPlayer()); getPlayer().closeInventory(); return; } - Bukkit.broadcastMessage("A"); - CustomPetEquipment customPetEquipment = (CustomPetEquipment) customPet; // Leather helmet @@ -60,8 +51,6 @@ public class CustomPetHelmetPage extends GadgetPage getShop().openPageForPlayer(getPlayer(), customPet.getNextStep(getPlugin(), getShop(), getClientManager(), getDonationManager())); }); - Bukkit.broadcastMessage("B"); - addButton(22, new ShopItem(Material.CHAINMAIL_HELMET, "Chain", 1, false), (player, clickType) -> { customPetEquipment.setHelmet(new ItemStack(Material.CHAINMAIL_HELMET)); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/name/CustomPetTagPage.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/name/CustomPetTagPage.java index a011d3ece..774ecf2d0 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/name/CustomPetTagPage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/name/CustomPetTagPage.java @@ -40,9 +40,6 @@ public class CustomPetTagPage extends ShopPageBase return _creatureModule; } + public DisguiseManager getDisguiseManager() + { + return _disguiseManager; + } + } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/pet/custom/CustomPet.java b/Plugins/Mineplex.Core/src/mineplex/core/pet/custom/CustomPet.java index 4113bb39d..d46290c2f 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/pet/custom/CustomPet.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/pet/custom/CustomPet.java @@ -21,20 +21,23 @@ import mineplex.core.cosmetic.CosmeticManager; import mineplex.core.cosmetic.ui.CosmeticShop; import mineplex.core.cosmetic.ui.page.GadgetPage; import mineplex.core.donation.DonationManager; +import mineplex.core.pet.PetManager; public abstract class CustomPet { private static Map _customPet = new HashMap<>(); + protected PetManager _petManager; protected Player _player; protected EntityType _entityType; protected int _step = 0; private String _name; private List _lines = new ArrayList<>(); - public CustomPet(Player player, EntityType entityType) + public CustomPet(PetManager petManager, Player player, EntityType entityType) { + _petManager = petManager; _player = player; _entityType = entityType; _customPet.put(player, this); @@ -151,14 +154,14 @@ public abstract class CustomPet return _data; } - public CustomPet getCustomPet(Player player) + public CustomPet getCustomPet(PetManager petManager, Player player) { switch (this) { case ZOMBIE: - return new CustomPetZombie(player); + return new CustomPetZombie(petManager, player); default: - return new CustomPetZombie(player); + return new CustomPetZombie(petManager, player); } } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/pet/custom/CustomPetAgeable.java b/Plugins/Mineplex.Core/src/mineplex/core/pet/custom/CustomPetAgeable.java index 5691aba57..9744b784b 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/pet/custom/CustomPetAgeable.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/pet/custom/CustomPetAgeable.java @@ -3,14 +3,16 @@ package mineplex.core.pet.custom; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; +import mineplex.core.pet.PetManager; + public abstract class CustomPetAgeable extends CustomPet { private boolean _baby = false; - public CustomPetAgeable(Player player, EntityType entityType) + public CustomPetAgeable(PetManager petManager, Player player, EntityType entityType) { - super(player, entityType); + super(petManager, player, entityType); } public void setBaby(boolean baby) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/pet/custom/CustomPetEquipment.java b/Plugins/Mineplex.Core/src/mineplex/core/pet/custom/CustomPetEquipment.java index b67211a80..60ea7224b 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/pet/custom/CustomPetEquipment.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/pet/custom/CustomPetEquipment.java @@ -5,6 +5,8 @@ import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; +import mineplex.core.pet.PetManager; + public abstract class CustomPetEquipment extends CustomPetAgeable { @@ -13,9 +15,9 @@ public abstract class CustomPetEquipment extends CustomPetAgeable private ItemStack _leggings; private ItemStack _boots; - public CustomPetEquipment(Player player, EntityType entityType) + public CustomPetEquipment(PetManager petManager, Player player, EntityType entityType) { - super(player, entityType); + super(petManager, player, entityType); } public void setHelmet(ItemStack helmet) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/pet/custom/CustomPetZombie.java b/Plugins/Mineplex.Core/src/mineplex/core/pet/custom/CustomPetZombie.java index 172474d18..b45c57f6d 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/pet/custom/CustomPetZombie.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/pet/custom/CustomPetZombie.java @@ -20,15 +20,16 @@ import mineplex.core.cosmetic.ui.page.custompet.name.CustomPetNamePage; import mineplex.core.cosmetic.ui.page.custompet.zombie.CustomPetZombieTypePage; import mineplex.core.disguise.disguises.DisguiseZombie; import mineplex.core.donation.DonationManager; +import mineplex.core.pet.PetManager; public class CustomPetZombie extends CustomPetEquipment { private boolean _villager = false; - public CustomPetZombie(Player player) + public CustomPetZombie(PetManager petManager, Player player) { - super(player, EntityType.ZOMBIE); + super(petManager, player, EntityType.ZOMBIE); addTypeLine("Zombie"); } @@ -63,6 +64,7 @@ public class CustomPetZombie extends CustomPetEquipment { disguiseZombie.setCustomNameVisible(false); } + _petManager.getDisguiseManager().disguise(disguiseZombie); } @Override From 5ad0bdcab14142daeb21c0e369c9cf274cdd7ec5 Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Mon, 20 Mar 2017 16:29:30 -0300 Subject: [PATCH 24/98] Added Spring Arrow Trail, added Spring Death Effect, moved each gadget to it's own package, added Spring Double Jump --- .../mineplex/core/gadget/GadgetManager.java | 4 +- .../{ => halloween}/ArrowTrailHalloween.java | 2 +- .../arrowtrail/spring/ArrowTrailSpring.java | 74 +++++++++++++ .../gadgets/death/spring/DeathSpring.java | 104 ++++++++++++++++++ .../{ => halloween}/DoubleJumpHalloween.java | 2 +- .../doublejump/spring/DoubleJumpSpring.java | 77 +++++++++++++ .../mineplex/core/reward/RewardManager.java | 4 +- 7 files changed, 261 insertions(+), 6 deletions(-) rename Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/{ => halloween}/ArrowTrailHalloween.java (96%) create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/spring/ArrowTrailSpring.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/spring/DeathSpring.java rename Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/{ => halloween}/DoubleJumpHalloween.java (97%) create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/spring/DoubleJumpSpring.java diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java index ce661ae21..2a02225d6 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java @@ -45,7 +45,7 @@ import mineplex.core.gadget.event.GadgetCollideEntityEvent; import mineplex.core.gadget.event.GadgetEnableEvent; import mineplex.core.gadget.event.PlayerToggleSwimEvent; import mineplex.core.gadget.event.TauntCommandEvent; -import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailHalloween; +import mineplex.core.gadget.gadgets.arrowtrail.halloween.ArrowTrailHalloween; import mineplex.core.gadget.gadgets.arrowtrail.candycane.ArrowTrailCandyCane; import mineplex.core.gadget.gadgets.arrowtrail.cupidslove.ArrowTrailCupid; import mineplex.core.gadget.gadgets.arrowtrail.emerald.ArrowTrailEmerald; @@ -73,7 +73,7 @@ import mineplex.core.gadget.gadgets.death.shadow.DeathShadow; import mineplex.core.gadget.gadgets.death.titan.DeathTitan; import mineplex.core.gadget.gadgets.death.vampire.DeathBlood; import mineplex.core.gadget.gadgets.death.wisdom.DeathEnchant; -import mineplex.core.gadget.gadgets.doublejump.DoubleJumpHalloween; +import mineplex.core.gadget.gadgets.doublejump.halloween.DoubleJumpHalloween; import mineplex.core.gadget.gadgets.doublejump.candycane.DoubleJumpCandyCane; import mineplex.core.gadget.gadgets.doublejump.cupidslove.DoubleJumpCupidsWings; import mineplex.core.gadget.gadgets.doublejump.emerald.DoubleJumpEmerald; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/ArrowTrailHalloween.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/halloween/ArrowTrailHalloween.java similarity index 96% rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/ArrowTrailHalloween.java rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/halloween/ArrowTrailHalloween.java index bd5b62563..112f272ad 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/ArrowTrailHalloween.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/halloween/ArrowTrailHalloween.java @@ -1,4 +1,4 @@ -package mineplex.core.gadget.gadgets.arrowtrail; +package mineplex.core.gadget.gadgets.arrowtrail.halloween; import java.awt.Color; import java.util.HashMap; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/spring/ArrowTrailSpring.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/spring/ArrowTrailSpring.java new file mode 100644 index 000000000..48bf64a9e --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/spring/ArrowTrailSpring.java @@ -0,0 +1,74 @@ +package mineplex.core.gadget.gadgets.arrowtrail.spring; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +import org.bukkit.Material; +import org.bukkit.entity.Arrow; +import org.bukkit.entity.Item; +import org.bukkit.event.EventHandler; +import org.bukkit.event.player.PlayerPickupItemEvent; +import org.bukkit.inventory.ItemStack; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.LineFormat; +import mineplex.core.common.util.UtilText; +import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.types.ArrowEffectGadget; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; + +public class ArrowTrailSpring extends ArrowEffectGadget +{ + + private List _items = new ArrayList<>(); + + public ArrowTrailSpring(GadgetManager manager) + { + // TODO NAME, LORE AND ICON + super(manager, "Flower Arrows", UtilText.splitLineToArray(C.cGray + "Placeholder", LineFormat.LORE), + -9, Material.GLASS, (byte) 0); + } + + @Override + public void doTrail(Arrow arrow) + { + Item sunflower = arrow.getWorld().dropItem(arrow.getLocation(), new ItemStack(Material.DOUBLE_PLANT)); + _items.add(sunflower); + } + + @Override + public void doHitEffect(Arrow arrow) + { + + } + + @EventHandler + public void onPickup(PlayerPickupItemEvent event) + { + if (_items.contains(event.getItem())) + { + event.setCancelled(true); + } + } + + @EventHandler + public void removeFlowers(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + Iterator iterator = _items.iterator(); + while (iterator.hasNext()) + { + Item item = iterator.next(); + if (item.getTicksLived() >= 20) + { + item.remove(); + iterator.remove(); + } + } + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/spring/DeathSpring.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/spring/DeathSpring.java new file mode 100644 index 000000000..bfdb922b4 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/spring/DeathSpring.java @@ -0,0 +1,104 @@ +package mineplex.core.gadget.gadgets.death.spring; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +import org.bukkit.Bukkit; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.entity.Item; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.player.PlayerPickupItemEvent; +import org.bukkit.util.Vector; + +import mineplex.core.blood.BloodEvent; +import mineplex.core.common.util.C; +import mineplex.core.common.util.LineFormat; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilText; +import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.types.DeathEffectGadget; +import mineplex.core.itemstack.ItemStackFactory; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; + +public class DeathSpring extends DeathEffectGadget +{ + + private List _items = new ArrayList<>(); + + public DeathSpring(GadgetManager manager) + { + // TODO NAME, LORE AND ICON + super(manager, "Flower Bouquet", + UtilText.splitLineToArray(C.cGray + "Placeholder", LineFormat.LORE), + -3, + Material.INK_SACK, (byte)1); + } + + @Override + public void onBlood(Player player, BloodEvent event) + { + event.setCancelled(true); + + final Location location = event.getLocation(); + while (location.getBlock().getType() != Material.AIR + && location.clone().add(0, 1, 0).getBlock().getType() != Material.AIR) + { + location.add(0, 1, 0); + } + + location.getBlock().setType(Material.DOUBLE_PLANT); + location.getBlock().setData((byte) 4); + + Bukkit.getScheduler().scheduleSyncDelayedTask(Manager.getPlugin(), new Runnable() + { + @Override + public void run() + { + location.getBlock().setType(Material.AIR); + + // Creates red rose explosion + for (int i = 50; i < 60; i++) + { + Item rose = location.getWorld().dropItem(location.add(0.5, 1.5, 0.5), ItemStackFactory.Instance.CreateStack(Material.RED_ROSE, (byte) 0, 1, " " + i)); + _items.add(rose); + + Vector vel = new Vector(Math.sin(i * 9/5d), 0, Math.cos(i * 9/5d)); + UtilAction.velocity(rose, vel, Math.abs(Math.sin(i * 12/3000d)), false, 0, 0.2 + Math.abs(Math.cos(i * 12/3000d))*0.6, 1, false); + + } + } + }, 60L); + } + + @EventHandler + public void onPickup(PlayerPickupItemEvent event) + { + if (_items.contains(event.getItem())) + { + event.setCancelled(true); + } + } + + @EventHandler + public void removeFlowers(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + Iterator iterator = _items.iterator(); + while (iterator.hasNext()) + { + Item item = iterator.next(); + if (item.getTicksLived() >= 20) + { + item.remove(); + iterator.remove(); + } + } + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/DoubleJumpHalloween.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/halloween/DoubleJumpHalloween.java similarity index 97% rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/DoubleJumpHalloween.java rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/halloween/DoubleJumpHalloween.java index 0f2cc13e8..10155afbd 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/DoubleJumpHalloween.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/halloween/DoubleJumpHalloween.java @@ -1,4 +1,4 @@ -package mineplex.core.gadget.gadgets.doublejump; +package mineplex.core.gadget.gadgets.doublejump.halloween; import java.awt.Color; import java.util.HashMap; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/spring/DoubleJumpSpring.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/spring/DoubleJumpSpring.java new file mode 100644 index 000000000..64e2647e6 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/spring/DoubleJumpSpring.java @@ -0,0 +1,77 @@ +package mineplex.core.gadget.gadgets.doublejump.spring; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +import org.bukkit.Material; +import org.bukkit.entity.Item; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.player.PlayerPickupItemEvent; +import org.bukkit.util.Vector; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.LineFormat; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilText; +import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.types.DoubleJumpEffectGadget; +import mineplex.core.itemstack.ItemStackFactory; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; + +public class DoubleJumpSpring extends DoubleJumpEffectGadget +{ + + private List _items = new ArrayList<>(); + + public DoubleJumpSpring(GadgetManager manager) + { + // TODO NAME LORE ICON + super(manager, "Flower Power", UtilText.splitLineToArray(C.cGray + "Placeholder", LineFormat.LORE), -9, + Material.GLASS, (byte) 0); + } + + @Override + public void doEffect(Player player) + { + for (int i = 50; i < 60; i++) + { + Item sunflower = player.getWorld().dropItem(player.getLocation().add(0.5, 1.5, 0.5), ItemStackFactory.Instance.CreateStack(Material.DOUBLE_PLANT, (byte) 0, 1, " " + i)); + _items.add(sunflower); + + Vector vel = new Vector(Math.sin(i * 9/5d), 0, Math.cos(i * 9/5d)); + UtilAction.velocity(sunflower, vel, Math.abs(Math.sin(i * 12/3000d)), false, 0, 0.2 + Math.abs(Math.cos(i * 12/3000d))*0.6, 1, false); + + } + } + + @EventHandler + public void onPickup(PlayerPickupItemEvent event) + { + if (_items.contains(event.getItem())) + { + event.setCancelled(true); + } + } + + @EventHandler + public void removeFlowers(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + Iterator iterator = _items.iterator(); + while (iterator.hasNext()) + { + Item item = iterator.next(); + if (item.getTicksLived() >= 20) + { + item.remove(); + iterator.remove(); + } + } + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardManager.java b/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardManager.java index 855d747d7..dc4551670 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardManager.java @@ -15,7 +15,7 @@ import mineplex.core.common.Rank; import mineplex.core.common.util.banner.CountryFlag; import mineplex.core.donation.DonationManager; import mineplex.core.gadget.GadgetManager; -import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailHalloween; +import mineplex.core.gadget.gadgets.arrowtrail.halloween.ArrowTrailHalloween; import mineplex.core.gadget.gadgets.arrowtrail.candycane.ArrowTrailCandyCane; import mineplex.core.gadget.gadgets.arrowtrail.cupidslove.ArrowTrailCupid; import mineplex.core.gadget.gadgets.arrowtrail.emerald.ArrowTrailEmerald; @@ -40,7 +40,7 @@ import mineplex.core.gadget.gadgets.death.party.DeathPinataBurst; import mineplex.core.gadget.gadgets.death.shadow.DeathShadow; import mineplex.core.gadget.gadgets.death.vampire.DeathBlood; import mineplex.core.gadget.gadgets.death.wisdom.DeathEnchant; -import mineplex.core.gadget.gadgets.doublejump.DoubleJumpHalloween; +import mineplex.core.gadget.gadgets.doublejump.halloween.DoubleJumpHalloween; import mineplex.core.gadget.gadgets.doublejump.candycane.DoubleJumpCandyCane; import mineplex.core.gadget.gadgets.doublejump.cupidslove.DoubleJumpCupidsWings; import mineplex.core.gadget.gadgets.doublejump.emerald.DoubleJumpEmerald; From 16f02d5bd4844ef8c51fa997b48e22e042752896 Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Mon, 20 Mar 2017 16:38:31 -0300 Subject: [PATCH 25/98] Added killer bunny pet --- .../src/mineplex/core/pet/PetManager.java | 14 ++++++++++++-- .../src/mineplex/core/pet/PetType.java | 3 ++- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/pet/PetManager.java b/Plugins/Mineplex.Core/src/mineplex/core/pet/PetManager.java index 10c656ca2..1e208d98a 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/pet/PetManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/pet/PetManager.java @@ -22,7 +22,6 @@ import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPigZombie; import org.bukkit.entity.Ageable; import org.bukkit.entity.Blaze; import org.bukkit.entity.Creature; -import org.bukkit.entity.Creeper; import org.bukkit.entity.Entity; import org.bukkit.entity.EntityType; import org.bukkit.entity.PigZombie; @@ -67,13 +66,13 @@ import mineplex.core.common.util.UtilServer; import mineplex.core.disguise.DisguiseManager; import mineplex.core.disguise.disguises.DisguiseChicken; import mineplex.core.disguise.disguises.DisguiseGuardian; +import mineplex.core.disguise.disguises.DisguiseRabbit; import mineplex.core.disguise.disguises.DisguiseVillager; import mineplex.core.disguise.disguises.DisguiseWither; import mineplex.core.disguise.disguises.DisguiseZombie; import mineplex.core.donation.DonationManager; import mineplex.core.inventory.InventoryManager; import mineplex.core.itemstack.ItemStackFactory; -import mineplex.core.pet.custom.CustomPet; import mineplex.core.pet.repository.PetRepository; import mineplex.core.pet.repository.token.ClientPetTokenWrapper; import mineplex.core.updater.UpdateType; @@ -412,6 +411,17 @@ public class PetManager extends MiniClientPlugin zombie.getEquipment().setLeggings(ItemStackFactory.Instance.createColoredLeatherArmor(2, org.bukkit.Color.fromRGB(0, 153, 0))); zombie.getEquipment().setBoots(ItemStackFactory.Instance.createColoredLeatherArmor(3, org.bukkit.Color.fromRGB(0, 153, 0))); } + else if (petType.equals(PetType.KILLER_BUNNY)) + { + Zombie zombie = (Zombie) pet; + UtilEnt.silence(zombie, true); + + DisguiseRabbit disguiseRabbit = new DisguiseRabbit(zombie); + + Rabbit rabbit = (Rabbit) disguiseRabbit.getEntity().getBukkitEntity(); + rabbit.setRabbitType(Rabbit.Type.THE_KILLER_BUNNY); + _disguiseManager.disguise(disguiseRabbit); + } _activePetOwnerTypes.put(player.getName(), petType); _activePetOwners.put(player.getName(), pet); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/pet/PetType.java b/Plugins/Mineplex.Core/src/mineplex/core/pet/PetType.java index e5453d7fe..6995910ec 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/pet/PetType.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/pet/PetType.java @@ -33,7 +33,8 @@ public enum PetType GINGERBREAD_MAN("Gingerbread Man", EntityType.ZOMBIE, -16, "Looks like you can catch him after all."), CUPID_PET("Cupid", EntityType.ZOMBIE, -17, "Sometimes you need a little extra help finding true Love. Why not have Cupid help you out?", Material.BOW, (byte) 0), TRUE_LOVE_PET("True Love", EntityType.ZOMBIE, -14, "Sometimes love means chasing the person of your dreams until you catch them.", Material.APPLE, YearMonth.of(2017, Month.FEBRUARY)), - LEPRECHAUN("Leprechaun", EntityType.ZOMBIE, -18, "Apparently this little guy lost his Pot of Gold in the war.", SkinData.LEPRECHAUN.getSkull()) + LEPRECHAUN("Leprechaun", EntityType.ZOMBIE, -18, "Apparently this little guy lost his Pot of Gold in the war.", SkinData.LEPRECHAUN.getSkull()), + KILLER_BUNNY("Killer Bunny", EntityType.ZOMBIE, -19, "Placeholder") // TODO CHECK IF LOBBY IS 1.9+ // Not in this update //SHULKER("Shulker Pet", EntityType.BAT, 0, "Is it a turtle or an alien? Either way its shot can be really UPLIFTING.") From 540a0189b4e49781f39c7ca5fd5ae21496696f48 Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Mon, 20 Mar 2017 16:49:20 -0300 Subject: [PATCH 26/98] Added lore and icon for Flower Arrow --- .../gadget/gadgets/arrowtrail/spring/ArrowTrailSpring.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/spring/ArrowTrailSpring.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/spring/ArrowTrailSpring.java index 48bf64a9e..a6e4b1321 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/spring/ArrowTrailSpring.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/spring/ArrowTrailSpring.java @@ -26,9 +26,8 @@ public class ArrowTrailSpring extends ArrowEffectGadget public ArrowTrailSpring(GadgetManager manager) { - // TODO NAME, LORE AND ICON - super(manager, "Flower Arrows", UtilText.splitLineToArray(C.cGray + "Placeholder", LineFormat.LORE), - -9, Material.GLASS, (byte) 0); + super(manager, "Flower Arrows", UtilText.splitLineToArray(C.cGray + "Send the power of Spring flying at your foes!", LineFormat.LORE), + -9, Material.YELLOW_FLOWER, (byte) 0); } @Override From 33b933f465787aa3459b84b7ce9c186f926d85c2 Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Mon, 20 Mar 2017 16:50:44 -0300 Subject: [PATCH 27/98] Added lore and icon for Flower Power --- .../gadget/gadgets/doublejump/spring/DoubleJumpSpring.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/spring/DoubleJumpSpring.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/spring/DoubleJumpSpring.java index 64e2647e6..f5563bba6 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/spring/DoubleJumpSpring.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/spring/DoubleJumpSpring.java @@ -29,8 +29,8 @@ public class DoubleJumpSpring extends DoubleJumpEffectGadget public DoubleJumpSpring(GadgetManager manager) { // TODO NAME LORE ICON - super(manager, "Flower Power", UtilText.splitLineToArray(C.cGray + "Placeholder", LineFormat.LORE), -9, - Material.GLASS, (byte) 0); + super(manager, "Flower Power", UtilText.splitLineToArray(C.cGray + "Be like a bouncing bee and pollinate everywhere you go!", LineFormat.LORE), -9, + Material.YELLOW_FLOWER, (byte) 0); } @Override From 8f7f52e222b81c9a1790b21c5691633473ff90c7 Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Mon, 20 Mar 2017 16:52:27 -0300 Subject: [PATCH 28/98] Added lore and icon for Funeral Bouquet and corrected the price for spring items --- .../gadgets/arrowtrail/spring/ArrowTrailSpring.java | 2 +- .../core/gadget/gadgets/death/spring/DeathSpring.java | 8 ++++---- .../gadgets/doublejump/spring/DoubleJumpSpring.java | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/spring/ArrowTrailSpring.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/spring/ArrowTrailSpring.java index a6e4b1321..c335ce062 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/spring/ArrowTrailSpring.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/spring/ArrowTrailSpring.java @@ -27,7 +27,7 @@ public class ArrowTrailSpring extends ArrowEffectGadget public ArrowTrailSpring(GadgetManager manager) { super(manager, "Flower Arrows", UtilText.splitLineToArray(C.cGray + "Send the power of Spring flying at your foes!", LineFormat.LORE), - -9, Material.YELLOW_FLOWER, (byte) 0); + -19, Material.YELLOW_FLOWER, (byte) 0); } @Override diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/spring/DeathSpring.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/spring/DeathSpring.java index bfdb922b4..31b7bbf94 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/spring/DeathSpring.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/spring/DeathSpring.java @@ -32,10 +32,10 @@ public class DeathSpring extends DeathEffectGadget public DeathSpring(GadgetManager manager) { // TODO NAME, LORE AND ICON - super(manager, "Flower Bouquet", - UtilText.splitLineToArray(C.cGray + "Placeholder", LineFormat.LORE), - -3, - Material.INK_SACK, (byte)1); + super(manager, "Funeral Bouquet", + UtilText.splitLineToArray(C.cGray + "Leave a rose to pay respects", LineFormat.LORE), + -19, + Material.RED_ROSE, (byte) 0); } @Override diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/spring/DoubleJumpSpring.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/spring/DoubleJumpSpring.java index f5563bba6..63dabdaf9 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/spring/DoubleJumpSpring.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/spring/DoubleJumpSpring.java @@ -29,7 +29,7 @@ public class DoubleJumpSpring extends DoubleJumpEffectGadget public DoubleJumpSpring(GadgetManager manager) { // TODO NAME LORE ICON - super(manager, "Flower Power", UtilText.splitLineToArray(C.cGray + "Be like a bouncing bee and pollinate everywhere you go!", LineFormat.LORE), -9, + super(manager, "Flower Power", UtilText.splitLineToArray(C.cGray + "Be like a bouncing bee and pollinate everywhere you go!", LineFormat.LORE), -19, Material.YELLOW_FLOWER, (byte) 0); } From d55690f9047a3608a65506d819d6cdb1f913e7bd Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Mon, 20 Mar 2017 19:22:50 -0300 Subject: [PATCH 29/98] Changed colors --- .../particle/spring/ParticleSpringHalo.java | 13 +++++-- .../particleeffects/ColoredCircleEffect.java | 36 ++++++++++++++++--- 2 files changed, 42 insertions(+), 7 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/spring/ParticleSpringHalo.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/spring/ParticleSpringHalo.java index 8aa34525b..4b24315ca 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/spring/ParticleSpringHalo.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/spring/ParticleSpringHalo.java @@ -1,6 +1,5 @@ package mineplex.core.gadget.gadgets.particle.spring; -import java.awt.Color; import java.time.Month; import java.time.YearMonth; import java.util.ArrayList; @@ -18,6 +17,8 @@ import org.bukkit.inventory.ItemStack; import mineplex.core.common.util.C; import mineplex.core.common.util.LineFormat; +import mineplex.core.common.util.RGBData; +import mineplex.core.common.util.UtilColor; import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilText; import mineplex.core.common.util.UtilTime; @@ -48,8 +49,14 @@ public class ParticleSpringHalo extends ParticleGadget super.enableCustom(player, message); Manager.removeGadgetType(player, GadgetType.MORPH, this); Manager.removeOutfit(player, OutfitGadget.ArmorSlot.HELMET); - ColoredCircleEffect circleEffect = new ColoredCircleEffect(Manager.getPlugin(), player, 0.7d, false, - Color.RED, Color.GREEN, Color.BLUE, Color.YELLOW); + ColoredCircleEffect circleEffect = new ColoredCircleEffect(Manager.getPlugin(), player, 0.7d, false); + RGBData colorA = UtilColor.hexToRgb(0x5a92ed); + RGBData colorB = UtilColor.hexToRgb(0xdb5aed); + RGBData colorC = UtilColor.hexToRgb(0xd2cdf2); + RGBData colorD = UtilColor.hexToRgb(0x7c6df2); + RGBData colorE = UtilColor.hexToRgb(0xedeb97); + RGBData colorF = UtilColor.hexToRgb(0xeac07c); + circleEffect.addColors(colorA, colorB, colorC, colorD, colorE, colorF); circleEffect.setYOffset(2.3d); circleEffect.start(); _effects.put(player, circleEffect); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/particleeffects/ColoredCircleEffect.java b/Plugins/Mineplex.Core/src/mineplex/core/particleeffects/ColoredCircleEffect.java index 2218cba9c..51851e40b 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/particleeffects/ColoredCircleEffect.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/particleeffects/ColoredCircleEffect.java @@ -1,12 +1,16 @@ package mineplex.core.particleeffects; import java.awt.Color; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; import org.bukkit.Location; import org.bukkit.entity.Entity; import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.util.Vector; +import mineplex.core.common.util.RGBData; import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilParticle; import mineplex.core.common.util.particles.ColoredParticle; @@ -16,7 +20,7 @@ public class ColoredCircleEffect extends Effect { private double _radius; - private Color[] _colors; + private List _colors; private int _steps = 0; private boolean _instantly = true; private int _maxCircles = -1; @@ -29,8 +33,9 @@ public class ColoredCircleEffect extends Effect { super(-1, new EffectLocation(entity), plugin); _radius = radius; - _colors = colors; + _colors = new ArrayList<>(); _instantly = instantly; + Collections.addAll(_colors, colors); } public void setMaxCircles(int circles) @@ -43,6 +48,29 @@ public class ColoredCircleEffect extends Effect _yOffset = yOffset; } + public void addColor(Color color) + { + _colors.add(color); + } + + public void addColors(Color... colors) + { + Collections.addAll(_colors, colors); + } + + public void addColor(RGBData rgbData) + { + _colors.add(new Color(rgbData.getFullRed(), rgbData.getFullGreen(), rgbData.getFullBlue())); + } + + public void addColors(RGBData... rgbDatas) + { + for (RGBData rgbData : rgbDatas) + { + addColor(rgbData); + } + } + @Override public void runEffect() { @@ -87,8 +115,8 @@ public class ColoredCircleEffect extends Effect private Color getNextColor() { - int r = UtilMath.random.nextInt(_colors.length - 1); - return _colors[r]; + int r = UtilMath.random.nextInt(_colors.size()); + return _colors.get(r); } } From 47b88b7734560bccc33c995928a65c3f6025017b Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Wed, 22 Mar 2017 14:37:42 -0300 Subject: [PATCH 30/98] Added Spring set, added awkward bunny morph, added items to menus --- .../mineplex/core/gadget/GadgetManager.java | 10 +++ .../gadgets/morph/MorphAwkwardRabbit.java | 68 +++++++++++++++++++ .../mineplex/core/gadget/set/SetSpring.java | 23 +++++++ .../tracks/standard/HolidayCheerTrack.java | 2 + 4 files changed, 103 insertions(+) create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphAwkwardRabbit.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetSpring.java diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java index b7d46fd03..37b574468 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java @@ -55,6 +55,7 @@ import mineplex.core.gadget.gadgets.arrowtrail.howlingwinds.ArrowTrailStorm; import mineplex.core.gadget.gadgets.arrowtrail.music.ArrowTrailMusic; import mineplex.core.gadget.gadgets.arrowtrail.party.ArrowTrailConfetti; import mineplex.core.gadget.gadgets.arrowtrail.shadow.ArrowTrailShadow; +import mineplex.core.gadget.gadgets.arrowtrail.spring.ArrowTrailSpring; import mineplex.core.gadget.gadgets.arrowtrail.titan.ArrowTrailTitan; import mineplex.core.gadget.gadgets.arrowtrail.vampire.ArrowTrailBlood; import mineplex.core.gadget.gadgets.arrowtrail.wisdom.ArrowTrailEnchant; @@ -70,6 +71,7 @@ import mineplex.core.gadget.gadgets.death.howlingwinds.DeathStorm; import mineplex.core.gadget.gadgets.death.music.DeathMusic; import mineplex.core.gadget.gadgets.death.party.DeathPinataBurst; import mineplex.core.gadget.gadgets.death.shadow.DeathShadow; +import mineplex.core.gadget.gadgets.death.spring.DeathSpring; import mineplex.core.gadget.gadgets.death.titan.DeathTitan; import mineplex.core.gadget.gadgets.death.vampire.DeathBlood; import mineplex.core.gadget.gadgets.death.wisdom.DeathEnchant; @@ -83,6 +85,7 @@ import mineplex.core.gadget.gadgets.doublejump.howlingwinds.DoubleJumpStorm; import mineplex.core.gadget.gadgets.doublejump.music.DoubleJumpMusic; import mineplex.core.gadget.gadgets.doublejump.party.DoubleJumpFirecracker; import mineplex.core.gadget.gadgets.doublejump.shadow.DoubleJumpShadow; +import mineplex.core.gadget.gadgets.doublejump.spring.DoubleJumpSpring; import mineplex.core.gadget.gadgets.doublejump.titan.DoubleJumpTitan; import mineplex.core.gadget.gadgets.doublejump.vampire.DoubleJumpBlood; import mineplex.core.gadget.gadgets.doublejump.wisdom.DoubleJumpEnchant; @@ -113,6 +116,7 @@ import mineplex.core.gadget.gadgets.item.ItemPaintbrush; import mineplex.core.gadget.gadgets.item.ItemPartyPopper; import mineplex.core.gadget.gadgets.item.ItemSnowball; import mineplex.core.gadget.gadgets.item.ItemTNT; +import mineplex.core.gadget.gadgets.morph.MorphAwkwardRabbit; import mineplex.core.gadget.gadgets.morph.MorphBat; import mineplex.core.gadget.gadgets.morph.MorphBlaze; import mineplex.core.gadget.gadgets.morph.MorphBlock; @@ -207,6 +211,7 @@ import mineplex.core.gadget.set.SetHowlingWinds; import mineplex.core.gadget.set.SetMusic; import mineplex.core.gadget.set.SetParty; import mineplex.core.gadget.set.SetShadow; +import mineplex.core.gadget.set.SetSpring; import mineplex.core.gadget.set.SetTitan; import mineplex.core.gadget.set.SetVampire; import mineplex.core.gadget.set.SetWisdom; @@ -338,6 +343,7 @@ public class GadgetManager extends MiniPlugin addSet(new SetVampire(this)); addSet(new SetMusic(this)); addSet(new SetFreedom(this)); + addSet(new SetSpring(this)); } private void createGadgets() @@ -424,6 +430,7 @@ public class GadgetManager extends MiniPlugin addGadget(new MorphDinnerbone(this)); addGadget(new MorphLoveDoctor(this)); addGadget(new MorphGoldPot(this)); + addGadget(new MorphAwkwardRabbit(this)); // Particles addGadget(new ParticleFoot(this)); @@ -465,6 +472,7 @@ public class GadgetManager extends MiniPlugin addGadget(new ArrowTrailMusic(this)); addGadget(new ArrowTrailFreedom(this)); addGadget(new ArrowTrailHalloween(this)); + addGadget(new ArrowTrailSpring(this)); // Death Effect addGadget(new DeathFrostLord(this)); @@ -480,6 +488,7 @@ public class GadgetManager extends MiniPlugin addGadget(new DeathMusic(this)); addGadget(new DeathFreedom(this)); addGadget(new DeathPresentDanger(this)); + addGadget(new DeathSpring(this)); // Double Jump addGadget(new DoubleJumpFrostLord(this)); @@ -495,6 +504,7 @@ public class GadgetManager extends MiniPlugin addGadget(new DoubleJumpMusic(this)); addGadget(new DoubleJumpFreedom(this)); addGadget(new DoubleJumpHalloween(this)); + addGadget(new DoubleJumpSpring(this)); // Hat for (HatType hatType : HatType.values()) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphAwkwardRabbit.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphAwkwardRabbit.java new file mode 100644 index 000000000..ed09b4a54 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphAwkwardRabbit.java @@ -0,0 +1,68 @@ +package mineplex.core.gadget.gadgets.morph; + +import java.util.HashMap; +import java.util.Map; + +import org.bukkit.Material; +import org.bukkit.entity.Entity; +import org.bukkit.entity.Player; +import org.bukkit.entity.Skeleton; +import org.bukkit.event.EventHandler; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.LineFormat; +import mineplex.core.common.util.UtilText; +import mineplex.core.disguise.disguises.DisguiseSkeleton; +import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.gadgets.morph.managers.UtilMorph; +import mineplex.core.gadget.types.MorphGadget; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; + +public class MorphAwkwardRabbit extends MorphGadget +{ + + private Map _skeletons = new HashMap<>(); + + public MorphAwkwardRabbit(GadgetManager manager) + { + super(manager, "Awkward Rabbit Morph", UtilText.splitLinesToArray(new String[]{C.cGray + "Dale was the most awkward of Rabbits"}, LineFormat.LORE), + -19, Material.GLASS, (byte) 0); + } + + @Override + public void enableCustom(Player player, boolean message) + { + applyArmor(player, message); + Skeleton dinnerbone = player.getWorld().spawn(player.getLocation(), Skeleton.class); + dinnerbone.setCustomName("Dinnerbone"); + dinnerbone.setCustomNameVisible(false); + + _skeletons.put(player, dinnerbone); + + DisguiseSkeleton disguiseSkeleton = new DisguiseSkeleton(player); + UtilMorph.disguise(player, disguiseSkeleton, Manager); + } + + @Override + public void disableCustom(Player player, boolean message) + { + removeArmor(player); + UtilMorph.undisguise(player, Manager.getDisguiseManager()); + } + + @EventHandler + public void teleportSkeletons(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + for (Map.Entry entry : _skeletons.entrySet()) + { + Player player = entry.getKey(); + Entity entity = entry.getValue(); + entity.teleport(player.getLocation().clone().add(0, 0.3, 0)); + } + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetSpring.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetSpring.java new file mode 100644 index 000000000..ea2f26dbe --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetSpring.java @@ -0,0 +1,23 @@ +package mineplex.core.gadget.set; + +import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.gadgets.arrowtrail.spring.ArrowTrailSpring; +import mineplex.core.gadget.gadgets.death.spring.DeathSpring; +import mineplex.core.gadget.gadgets.doublejump.spring.DoubleJumpSpring; +import mineplex.core.gadget.gadgets.particle.spring.ParticleSpringHalo; +import mineplex.core.gadget.types.GadgetSet; + +public class SetSpring extends GadgetSet +{ + + public SetSpring(GadgetManager manager) + { + // TODO LORE + super(manager, "Spring", "Double Holiday Points while active", + manager.getGadget(ArrowTrailSpring.class), + manager.getGadget(DeathSpring.class), + manager.getGadget(DoubleJumpSpring.class), + manager.getGadget(ParticleSpringHalo.class)); + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/standard/HolidayCheerTrack.java b/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/standard/HolidayCheerTrack.java index ecfc2ba3c..5f5b40058 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/standard/HolidayCheerTrack.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/standard/HolidayCheerTrack.java @@ -22,6 +22,7 @@ import mineplex.core.gadget.gadgets.item.ItemSnowball; import mineplex.core.gadget.set.SetCupidsLove; import mineplex.core.gadget.set.SetFreedom; import mineplex.core.gadget.set.SetFrostLord; +import mineplex.core.gadget.set.SetSpring; import mineplex.core.gadget.types.Gadget; import mineplex.core.gadget.types.GadgetSet; import mineplex.core.titles.tracks.Track; @@ -56,6 +57,7 @@ public class HolidayCheerTrack extends Track HOLIDAY_SETS.add(SetFreedom.class); HOLIDAY_SETS.add(SetCupidsLove.class); HOLIDAY_SETS.add(SetFrostLord.class); + HOLIDAY_SETS.add(SetSpring.class); } private final GadgetManager _gadgetManager = Managers.require(GadgetManager.class); From b389041392114fde9b93076a4ae2848df9751b3f Mon Sep 17 00:00:00 2001 From: Sarah Date: Fri, 24 Mar 2017 18:04:44 +0100 Subject: [PATCH 31/98] Change some more loot, not weapon doubles, 25% more boost from booster rings, fixed decay times for rings, let the complete surface of islands rot at once, specific items come with another item and a dynamic rot rate --- .../game/games/skyfall/Crumbleable.java | 32 +++++++++- .../arcade/game/games/skyfall/Island.java | 58 +++++++++++++++++-- .../arcade/game/games/skyfall/LootTable.java | 1 - .../arcade/game/games/skyfall/Skyfall.java | 51 +++++++++------- 4 files changed, 116 insertions(+), 26 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skyfall/Crumbleable.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skyfall/Crumbleable.java index e50a6bb09..e2d4a95d3 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skyfall/Crumbleable.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skyfall/Crumbleable.java @@ -1,14 +1,21 @@ package nautilus.game.arcade.game.games.skyfall; import java.util.ArrayList; +import java.util.HashSet; + +import net.minecraft.server.v1_8_R3.Chunk; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.block.Block; import org.bukkit.block.BlockFace; +import org.bukkit.craftbukkit.v1_8_R3.CraftChunk; +import org.bukkit.entity.Player; import mineplex.core.common.util.MapUtil; import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilTime; /** * Crumbleable is a Superclass to create decayable/crumleable Objects like Sky Islands @@ -17,14 +24,19 @@ import mineplex.core.common.util.UtilMath; */ public abstract class Crumbleable { + private static final long CHUNK_CRUMBLE_DELAY = 1000; + private boolean _crumble; private ArrayList _initBlocks; private ArrayList _realBlocks; + private HashSet _chunksToUpdate; private boolean _onlyTop; private int _height; + private long _lastChunk; + public Crumbleable() { this(false, 0); @@ -36,6 +48,9 @@ public abstract class Crumbleable _height = height; _realBlocks = new ArrayList<>(); + _chunksToUpdate = new HashSet<>(); + + _lastChunk = System.currentTimeMillis(); } /** @@ -114,6 +129,19 @@ public abstract class Crumbleable if (_realBlocks.isEmpty()) { crumbledAway(); + if (!_chunksToUpdate.isEmpty()) + { + if (UtilTime.elapsed(_lastChunk, CHUNK_CRUMBLE_DELAY)) + { + Chunk chunk = _chunksToUpdate.iterator().next(); + _chunksToUpdate.remove(chunk); + for (Player player : UtilServer.getPlayers()) + { + MapUtil.SendChunkForPlayer(chunk, player); + } + _lastChunk = System.currentTimeMillis(); + } + } return true; } @@ -139,8 +167,10 @@ public abstract class Crumbleable || toRemove.getBlock().getType() == Material.STATIONARY_LAVA) continue; - MapUtil.QuickChangeBlockAt(toRemove, material); + MapUtil.ChunkBlockChange(toRemove, material.getId(), (byte) 0, false); + _chunksToUpdate.add(((CraftChunk) toRemove.getChunk()).getHandle()); } + return false; } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skyfall/Island.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skyfall/Island.java index 8f4498362..3ff4d7f3d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skyfall/Island.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skyfall/Island.java @@ -11,6 +11,7 @@ import org.bukkit.inventory.Inventory; import org.bukkit.inventory.ItemStack; import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilItem; import mineplex.core.common.util.UtilMath; import mineplex.core.loot.ChestLoot; @@ -95,7 +96,7 @@ public class Island extends Crumbleable Inventory inventory = chest.getBlockInventory(); inventory.clear(); - int items = 6; + int items = 5; if (Math.random() > 0.50) items++; if (Math.random() > 0.65) @@ -109,15 +110,14 @@ public class Island extends Crumbleable for (int i = 0; i < items; i++) { int trys = 0; - int slot = UtilMath.r(27); + int slot = UtilMath.r(26); while (inventory.getItem(slot) != null && trys <= 5) { trys++; - slot = UtilMath.r(27); + slot = UtilMath.r(26); } ItemStack item = _loot.getLoot(exclude); - exclude.add(item.getType()); inventory.setItem(slot, item); if (item.getType() == Material.DIAMOND) { @@ -127,6 +127,56 @@ public class Island extends Crumbleable { inventory.setItem(slot + 1, new ItemStack(Material.ARROW, UtilMath.r(6) + 1)); } + + if (UtilItem.isHelmet(item)) + { + exclude.add(Material.CHAINMAIL_HELMET); + exclude.add(Material.GOLD_HELMET); + exclude.add(Material.IRON_HELMET); + exclude.add(Material.LEATHER_HELMET); + exclude.add(Material.DIAMOND_HELMET); + } + if (UtilItem.isChestplate(item)) + { + exclude.add(Material.CHAINMAIL_CHESTPLATE); + exclude.add(Material.GOLD_CHESTPLATE); + exclude.add(Material.IRON_CHESTPLATE); + exclude.add(Material.LEATHER_CHESTPLATE); + exclude.add(Material.DIAMOND_CHESTPLATE); + } + if (UtilItem.isLeggings(item)) + { + exclude.add(Material.CHAINMAIL_LEGGINGS); + exclude.add(Material.GOLD_LEGGINGS); + exclude.add(Material.IRON_LEGGINGS); + exclude.add(Material.LEATHER_LEGGINGS); + exclude.add(Material.DIAMOND_LEGGINGS); + } + if (UtilItem.isBoots(item)) + { + exclude.add(Material.CHAINMAIL_BOOTS); + exclude.add(Material.GOLD_BOOTS); + exclude.add(Material.IRON_BOOTS); + exclude.add(Material.LEATHER_BOOTS); + exclude.add(Material.DIAMOND_BOOTS); + } + if (UtilItem.isSword(item)) + { + exclude.add(Material.WOOD_SWORD); + exclude.add(Material.STONE_SWORD); + exclude.add(Material.IRON_SWORD); + exclude.add(Material.DIAMOND_SWORD); + } + if (UtilItem.isAxe(item)) + { + exclude.add(Material.WOOD_AXE); + exclude.add(Material.STONE_AXE); + exclude.add(Material.IRON_AXE); + exclude.add(Material.DIAMOND_AXE); + } + if (item.getType() == Material.BOW) + exclude.add(Material.BOW); + } } 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 5a2579dfa..dea426b00 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,7 +25,6 @@ public class LootTable new RandomItem(Material.COOKED_CHICKEN, 30, 1, 2), new RandomItem(Material.CARROT_ITEM, 30, 1, 3), new RandomItem(Material.MUSHROOM_SOUP, 15, 1, 1), - new RandomItem(Material.WHEAT, 30, 1, 6), new RandomItem(Material.APPLE, 30, 1, 4), new RandomItem(Material.ROTTEN_FLESH, 40, 1, 6), 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 edb873abe..37ea15dbb 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 @@ -46,7 +46,6 @@ 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.Rank; import mineplex.core.common.util.C; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilAction; @@ -73,8 +72,6 @@ import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.GameType; import nautilus.game.arcade.events.GameStateChangeEvent; import nautilus.game.arcade.game.Game; -import nautilus.game.arcade.game.GameTeam; -import nautilus.game.arcade.game.Game.GameState; 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; @@ -84,8 +81,6 @@ import nautilus.game.arcade.game.games.skyfall.kits.KitStunner; import nautilus.game.arcade.game.games.skyfall.stats.AeronaughtStatTracker; import nautilus.game.arcade.game.games.skyfall.stats.RingStatTracker; import nautilus.game.arcade.game.games.survivalgames.SupplyChestOpenEvent; -import nautilus.game.arcade.game.games.typewars.Minion; -import nautilus.game.arcade.game.games.typewars.MinionSize; import nautilus.game.arcade.game.modules.VersionModule; import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.stats.FirstSupplyDropOpenStatTracker; @@ -99,17 +94,18 @@ import nautilus.game.arcade.stats.WinWithoutWearingArmorStatTracker; */ public abstract class Skyfall extends Game { - private static final long MAP_CRUMBLE_DELAY = 1000*60*2; // 2 Minutes + private static final long MAP_CRUMBLE_DELAY = 1000*20; // 2 Minutes + private static final long RING_CRUMBLE_DELAY = 1000*60*2; // 2 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 long ELYTRA_TAKEAWAY = 1000; private static final long ISLAND_ROT_TIME = 1000*60*5; // 3 Minutes - private static final int RING_CRUMBLE_RATE = 3; + private static final int RING_CRUMBLE_RATE = 10; - private static final float RING_BOOST_STRENGTH = 2.5F; - private static final float BIG_RING_BOOST_STRENGTH = 3.5F; + private static final float RING_BOOST_STRENGTH = 3.25F; + private static final float BIG_RING_BOOST_STRENGTH = 4.3F; private static final long BOOSTER_COOLDOWN_TIME = 1000*20; // 20 Seconds @@ -295,10 +291,9 @@ public abstract class Skyfall extends Game _chestsRefilled = System.currentTimeMillis(); _refillAnnounced = false; - _upperIsland.refillChests(); _lowerIsland.refillChests(); - Announce(ChatColor.AQUA + "" + ChatColor.BOLD + "Chests on the middle Islands have been refilled!", true); + Announce(ChatColor.AQUA + "" + ChatColor.BOLD + "Chests on the lower middle Island have been refilled!", true); } @EventHandler @@ -387,7 +382,7 @@ public abstract class Skyfall extends Game ArrayList islands = new ArrayList<>(); for (Island island : _islands.get(_upperIsland).keySet()) { - if (island.crumblePercentage() <= 0.5) + if (island.isCrumbledAway()) islands.add(island); Material[] mats = new Material[]{Material.COAL_BLOCK, Material.ENDER_STONE}; @@ -399,7 +394,7 @@ public abstract class Skyfall extends Game return islands; } } - if (_upperIsland.crumblePercentage() <= 0.5) + if (_upperIsland.isCrumbledAway()) islands.add(_upperIsland); if (!_upperIsland.crumble(_islandCrumbleRate, Material.COAL_BLOCK, Material.ENDER_STONE)) @@ -416,7 +411,7 @@ public abstract class Skyfall extends Game } for (Island island : _islands.get(_lowerIsland).keySet()) { - if (island.crumblePercentage() <= 0.5) + if (island.isCrumbledAway()) islands.add(island); if (!island.crumble(_islandCrumbleRate, Material.COAL_BLOCK, Material.ENDER_STONE)) @@ -424,7 +419,7 @@ public abstract class Skyfall extends Game return islands; } } - if (_lowerIsland.crumblePercentage() <= 0.5) + if (_lowerIsland.isCrumbledAway()) islands.add(_lowerIsland); _currentCrumble = (_lowerIsland.getLocation().getBlockY() - _lowerIsland.getHeight()); @@ -507,19 +502,35 @@ public abstract class Skyfall extends Game @EventHandler public void ringCrumble(UpdateEvent event) { - if (event.getType() != UpdateType.FAST) - return; - - if (!UtilTime.elapsed(GetStateTime(), MAP_CRUMBLE_DELAY)) + if (event.getType() != UpdateType.TICK) return; for (BoosterRing ring : _boosterRings) { - if (ring.getMiddle().getBlockY() < _currentCrumble) + if (!UtilTime.elapsed(GetStateTime(), RING_CRUMBLE_DELAY)) + return; + + if (ring.getMiddle().getBlockY() > (_upperIsland.getLocation().getBlockY() - (_upperIsland.getHeight()*2))) + { + if (!ring.crumble(RING_CRUMBLE_RATE, Material.COAL_BLOCK, Material.ENDER_STONE)) + break; + } + + if (!UtilTime.elapsed(GetStateTime(), (RING_CRUMBLE_DELAY*2))) + continue; + + if (ring.getMiddle().getBlockY() > (_lowerIsland.getLocation().getBlockY() - (_lowerIsland.getHeight()*2))) + { + if (!ring.crumble(RING_CRUMBLE_RATE, Material.COAL_BLOCK, Material.ENDER_STONE)) + break; + } + + if (!UtilTime.elapsed(GetStateTime(), (RING_CRUMBLE_DELAY*3))) continue; if (!ring.crumble(RING_CRUMBLE_RATE, Material.COAL_BLOCK, Material.ENDER_STONE)) break; + } } From 5464a74d2cae08548b7684c25bdb5a87127e78ae Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Fri, 24 Mar 2017 14:17:15 -0300 Subject: [PATCH 32/98] Added spring chest --- .../mineplex/core/reward/RewardManager.java | 14 ++++++++ .../src/mineplex/core/reward/RewardPool.java | 1 + .../src/mineplex/core/reward/RewardType.java | 1 + .../mineplex/core/treasure/TreasureStyle.java | 7 ++++ .../mineplex/core/treasure/TreasureType.java | 4 ++- .../core/treasure/gui/TreasurePage.java | 36 ++++++++++++++++++- 6 files changed, 61 insertions(+), 2 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardManager.java b/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardManager.java index dc4551670..2aa0f309e 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardManager.java @@ -25,6 +25,7 @@ import mineplex.core.gadget.gadgets.arrowtrail.howlingwinds.ArrowTrailStorm; import mineplex.core.gadget.gadgets.arrowtrail.music.ArrowTrailMusic; import mineplex.core.gadget.gadgets.arrowtrail.party.ArrowTrailConfetti; import mineplex.core.gadget.gadgets.arrowtrail.shadow.ArrowTrailShadow; +import mineplex.core.gadget.gadgets.arrowtrail.spring.ArrowTrailSpring; import mineplex.core.gadget.gadgets.arrowtrail.vampire.ArrowTrailBlood; import mineplex.core.gadget.gadgets.arrowtrail.wisdom.ArrowTrailEnchant; import mineplex.core.gadget.gadgets.balloons.BalloonType; @@ -38,6 +39,7 @@ import mineplex.core.gadget.gadgets.death.howlingwinds.DeathStorm; import mineplex.core.gadget.gadgets.death.music.DeathMusic; import mineplex.core.gadget.gadgets.death.party.DeathPinataBurst; import mineplex.core.gadget.gadgets.death.shadow.DeathShadow; +import mineplex.core.gadget.gadgets.death.spring.DeathSpring; import mineplex.core.gadget.gadgets.death.vampire.DeathBlood; import mineplex.core.gadget.gadgets.death.wisdom.DeathEnchant; import mineplex.core.gadget.gadgets.doublejump.halloween.DoubleJumpHalloween; @@ -50,6 +52,7 @@ import mineplex.core.gadget.gadgets.doublejump.howlingwinds.DoubleJumpStorm; import mineplex.core.gadget.gadgets.doublejump.music.DoubleJumpMusic; import mineplex.core.gadget.gadgets.doublejump.party.DoubleJumpFirecracker; import mineplex.core.gadget.gadgets.doublejump.shadow.DoubleJumpShadow; +import mineplex.core.gadget.gadgets.doublejump.spring.DoubleJumpSpring; import mineplex.core.gadget.gadgets.doublejump.vampire.DoubleJumpBlood; import mineplex.core.gadget.gadgets.doublejump.wisdom.DoubleJumpEnchant; import mineplex.core.gadget.gadgets.gamemodifiers.minestrike.MineStrikeSkin; @@ -115,6 +118,7 @@ import mineplex.core.gadget.gadgets.particle.howlingwinds.ParticleRain; import mineplex.core.gadget.gadgets.particle.music.ParticleMusic; import mineplex.core.gadget.gadgets.particle.party.ParticlePartyTime; import mineplex.core.gadget.gadgets.particle.shadow.ParticleFoot; +import mineplex.core.gadget.gadgets.particle.spring.ParticleSpringHalo; import mineplex.core.gadget.gadgets.particle.vampire.ParticleBlood; import mineplex.core.gadget.gadgets.particle.wisdom.ParticleEnchant; import mineplex.core.gadget.gadgets.taunts.BlowAKissTaunt; @@ -599,6 +603,11 @@ public class RewardManager addGadget(Type.STPATRICKS, getGadget(OutfitStPatricksChestplate.class), rarity, 50); addGadget(Type.STPATRICKS, getGadget(OutfitStPatricksLeggings.class), rarity, 50); addGadget(Type.STPATRICKS, getGadget(OutfitStPatricksBoots.class), rarity, 50); + + // SPRING + addGadget(Type.SPRING, getGadget(ArrowTrailSpring.class), rarity, 100); + addGadget(Type.SPRING, getGadget(DeathSpring.class), rarity, 100); + addGadget(Type.SPRING, getGadget(DoubleJumpSpring.class), rarity, 100); } public void addLegendary() @@ -856,6 +865,11 @@ public class RewardManager addPetReward(Type.STPATRICKS, PetType.LEPRECHAUN, rarity, 30); addMount(Type.STPATRICKS, getMount(MountStPatricksHorse.class), rarity, 30); + + // SPRING + addGadget(Type.SPRING, getGadget(ParticleSpringHalo.class), rarity, 100); + + addPetReward(Type.SPRING, PetType.KILLER_BUNNY, rarity, 50); } public UnknownPackageReward addMount(Type type, Mount mount, RewardRarity rarity, int weight) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardPool.java b/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardPool.java index 623552350..50b237313 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardPool.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardPool.java @@ -65,6 +65,7 @@ public class RewardPool MINESTRIKE(true, 2), LOVECHEST(false, 1), STPATRICKS(false, 1), + SPRING(false, 1), CARL_SPINNER(true); private boolean _useDuplicates; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardType.java b/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardType.java index 33381f37e..3442977b6 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardType.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardType.java @@ -22,6 +22,7 @@ public enum RewardType LOVE_CHEST( 0, 6, 18, 0), VALENTINES_GIFT( 0, 7, 20, 20), ST_PATRICKS( 0, 6, 18, 0), + SPRING( 0, 6, 18, 0), SPINNER_FILLER( 0.1, 1, 4, 20), SPINNER_REAL( 0.000001, 0.05, 0.4, 5); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureStyle.java b/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureStyle.java index b29622c3d..581ce9b47 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureStyle.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureStyle.java @@ -97,6 +97,13 @@ public enum TreasureStyle ParticleType.HAPPY_VILLAGER, Sound.VILLAGER_YES, Sound.VILLAGER_YES + ), + SPRING( + ParticleType.RED_DUST, + ParticleType.RED_DUST, + ParticleType.RED_DUST, + Sound.STEP_GRASS, + Sound.STEP_GRASS ); private ParticleType _secondaryParticle; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureType.java b/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureType.java index c81c578c6..a9d3bf5c1 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureType.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureType.java @@ -34,7 +34,9 @@ public enum TreasureType LOVE_CHEST(C.cRed + "Love Treasure", "Love Chest", "LoveChest", RewardType.LOVE_CHEST, Material.CHEST, TreasureStyle.LOVECHEST, RewardPool.Type.LOVECHEST, true, 20000), - ST_PATRICKS(C.cGreen + "St Patrick's Treasure", "St Patricks Chest", "StPatricksChest", RewardType.ST_PATRICKS, Material.CHEST, TreasureStyle.STPATRICKS,RewardPool.Type.STPATRICKS, true, 20000); + ST_PATRICKS(C.cGreen + "St Patrick's Treasure", "St Patricks Chest", "StPatricksChest", RewardType.ST_PATRICKS, Material.CHEST, TreasureStyle.STPATRICKS,RewardPool.Type.STPATRICKS, true, 20000), + + SPRING(C.cGreen + "Spring Treasure", "Spring Chest", "SpringChest", RewardType.SPRING, Material.CHEST, TreasureStyle.SPRING, RewardPool.Type.SPRING, true, 20000); private final String _name; private final RewardType _rewardType; 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 ac82b4b25..030e3dc1d 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/gui/TreasurePage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/gui/TreasurePage.java @@ -138,6 +138,7 @@ public class TreasurePage extends ShopPageBase int minestrikeCount = _inventoryManager.Get(getPlayer()).getItemCount(TreasureType.MINESTRIKE.getItemName()); int loveCount = _inventoryManager.Get(getPlayer()).getItemCount(TreasureType.LOVE_CHEST.getItemName()); int stpatricksCount = _inventoryManager.Get(getPlayer()).getItemCount(TreasureType.ST_PATRICKS.getItemName()); + int springCount = _inventoryManager.Get(getPlayer()).getItemCount(TreasureType.SPRING.getItemName()); boolean availableChristmas = false; boolean availableFreedom = false; @@ -147,6 +148,7 @@ public class TreasurePage extends ShopPageBase boolean availableGingerbread = false; boolean availableLove = false; boolean availableStPatricks = new File("../../update/files/EnableStPatricksChest.dat").exists(); + boolean availableSpring = new File("../../update/files/EnableSpringChest.dat").exists(); List shardLore = new ArrayList<>(); shardLore.add(" "); @@ -427,12 +429,36 @@ public class TreasurePage extends ShopPageBase } else { - stpatricksLore.add(ChatColor.RESET + "Click to craft for " + C.cAqua + TreasureType.LOVE_CHEST.getPurchasePrice() + " Treasure Shards"); + stpatricksLore.add(ChatColor.RESET + "Click to craft for " + C.cAqua + TreasureType.ST_PATRICKS.getPurchasePrice() + " Treasure Shards"); stpatricksLore.add(" "); stpatricksLore.add(ChatColor.RESET + "or Purchase at: " + C.cYellow + "www.mineplex.com/shop"); } } + List springLore = Lists.newArrayList(); + springLore.add(" "); + springLore.add(F.value("Spring Chests Owned", "" + springCount)); + springLore.add(" "); + springLore.addAll(UtilText.splitLines(new String[]{C.cGray + "Spring is here! Find 6 limited edition Spring Cosmetics in the Spring Chest! Only available for a limited time. Guaranteed no Duplicate items!"}, LineFormat.LORE)); + springLore.add(" "); + if (springCount > 0) + { + springLore.add(C.cGreen + "Click to Open!"); + } + else + { + if (!availableSpring) + { + springLore.add(C.cRed + "This item is no longer available"); + } + else + { + springLore.add(ChatColor.RESET + "Click to craft for " + C.cAqua + TreasureType.SPRING.getPurchasePrice() + " Treasure Shards"); + springLore.add(" "); + springLore.add(ChatColor.RESET + "or Purchase at: " + C.cYellow + "www.mineplex.com/shop"); + } + } + ShopItem shards = new ShopItem(Material.PRISMARINE_SHARD, C.cAqua + C.Bold + treasureShards + " Treasure Shards", shardLore.toArray(new String[0]), 0, false); // Normal chests @@ -452,6 +478,7 @@ public class TreasurePage extends ShopPageBase ItemStack gingerbread = SkinData.GINGERBREAD.getSkull(C.cRedB + "Gingerbread" + C.cGreenB + " Treasure", gingerbreadLore); ItemStack lovechest = new ShopItem(Material.WOOL, (byte) 6, C.cRedB + "Love Chest", lovechestLore.toArray(new String[0]), 0, false, false); ItemStack stpatricks = SkinData.LEPRECHAUN.getSkull(C.cGreenB + "St Patrick's Treasure", stpatricksLore); + ItemStack spring = new ShopItem(Material.DOUBLE_PLANT, (byte) 4, C.cGreenB + "Spring Treasure", springLore.toArray(new String[0]), 1, false, false); // Adds shard item addItem(49, shards); @@ -475,6 +502,7 @@ public class TreasurePage extends ShopPageBase TreasurePageItem gingerbreadTreasureItem = new TreasurePageItem(gingerbread, gingerbreadCount, TreasureType.GINGERBREAD); TreasurePageItem loveChestItem = new TreasurePageItem(lovechest, loveCount, TreasureType.LOVE_CHEST); TreasurePageItem stPatricksItem = new TreasurePageItem(stpatricks, stpatricksCount, TreasureType.ST_PATRICKS); + TreasurePageItem springItem = new TreasurePageItem(spring, springCount, TreasureType.SPRING); _normalTreasures.add(oldTreasureItem); _normalTreasures.add(ancientTreasureItem); @@ -483,6 +511,12 @@ public class TreasurePage extends ShopPageBase _normalTreasures.add(omegaTreasureItem); _normalTreasures.add(minestrikeTreasureItem); + + if (availableSpring) + _specialTreasures.add(springItem); + else + _seasonalTreasures.add(springItem); + if (availableStPatricks) _specialTreasures.add(stPatricksItem); else From 8a7f221bc62da4d206f5e1b3ffbc49367f83c661 Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Fri, 24 Mar 2017 14:20:10 -0300 Subject: [PATCH 33/98] Added spring chest to cust server --- .../customerSupport/CustomerSupport.java | 11 ++++++++++ .../salespackage/SalesPackageManager.java | 5 ++++- .../salespackages/SpringChest.java | 21 +++++++++++++++++++ 3 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/salespackages/SpringChest.java diff --git a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/customerSupport/CustomerSupport.java b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/customerSupport/CustomerSupport.java index c5b819fcf..d735896a8 100644 --- a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/customerSupport/CustomerSupport.java +++ b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/customerSupport/CustomerSupport.java @@ -167,6 +167,7 @@ public class CustomerSupport extends MiniPlugin implements ResultSetCallable int minestrikeChestsReceived = 0; int loveChestsReceived = 0; int stPatricksChestReceived = 0; + int springChestsReceived = 0; for (CoinTransactionToken transaction : donor.getCoinTransactions()) { @@ -330,6 +331,16 @@ public class CustomerSupport extends MiniPlugin implements ResultSetCallable stPatricksChestReceived += 1; } } + if (transaction.SalesPackageName.startsWith("Spring Chest")) + { + if (transaction.Coins == 0 && transaction.Gems == 0) + { + if (transaction.SalesPackageName.split(" ").length == 4) + springChestsReceived += Integer.parseInt(transaction.SalesPackageName.split(" ")[3]); + else if (transaction.SalesPackageName.split(" ").length == 3) + springChestsReceived += 1; + } + } if (transaction.SalesPackageName.startsWith("Valentines Gift")) { if (transaction.Coins == 0 && transaction.Gems == 0) diff --git a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/SalesPackageManager.java b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/SalesPackageManager.java index c1809951d..2f8d3f15f 100644 --- a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/SalesPackageManager.java +++ b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/SalesPackageManager.java @@ -39,6 +39,7 @@ import mineplex.staffServer.salespackage.salespackages.Pet; import mineplex.staffServer.salespackage.salespackages.PowerPlayClub; import mineplex.staffServer.salespackage.salespackages.RuneAmplifier; import mineplex.staffServer.salespackage.salespackages.SalesPackageBase; +import mineplex.staffServer.salespackage.salespackages.SpringChest; import mineplex.staffServer.salespackage.salespackages.StPatricksChest; import mineplex.staffServer.salespackage.salespackages.ThankfulChest; import mineplex.staffServer.salespackage.salespackages.TrickOrTreatChest; @@ -102,6 +103,7 @@ public class SalesPackageManager extends MiniPlugin AddSalesPackage(new MinestrikeChest(this)); AddSalesPackage(new LoveChest(this)); AddSalesPackage(new StPatricksChest(this)); + AddSalesPackage(new SpringChest(this)); AddSalesPackage(new TrickOrTreatChest(this)); AddSalesPackage(new ThankfulChest(this)); @@ -173,7 +175,8 @@ public class SalesPackageManager extends MiniPlugin coinBuilder = coinBuilder.extra("[").color("gray").extra(salesPackage.getName()).color("green").click("run_command", "/display " + playerName + " " + salesPackage.getName()).extra("] ").color("gray"); } else if (salesPackage instanceof MythicalChest || salesPackage instanceof AncientChest || salesPackage instanceof OldChest || salesPackage instanceof IlluminatedChest || salesPackage instanceof FreedomChest || salesPackage instanceof HauntedChest || salesPackage instanceof TrickOrTreatChest - || salesPackage instanceof ThankfulChest || salesPackage instanceof GingerbreadChest || salesPackage instanceof MinestrikeChest || salesPackage instanceof LoveChest || salesPackage instanceof StPatricksChest) + || salesPackage instanceof ThankfulChest || salesPackage instanceof GingerbreadChest || salesPackage instanceof MinestrikeChest || salesPackage instanceof LoveChest || salesPackage instanceof StPatricksChest + || salesPackage instanceof SpringChest) { chestBuilder = chestBuilder.extra("[").color("gray").extra(salesPackage.getName()).color("green").click("run_command", "/display " + playerName + " " + salesPackage.getName()).extra("] ").color("gray"); } diff --git a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/salespackages/SpringChest.java b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/salespackages/SpringChest.java new file mode 100644 index 000000000..181fe34e6 --- /dev/null +++ b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/salespackages/SpringChest.java @@ -0,0 +1,21 @@ +package mineplex.staffServer.salespackage.salespackages; + +import org.bukkit.entity.Player; + +import mineplex.staffServer.salespackage.SalesPackageManager; + +public class SpringChest extends SalesPackageBase +{ + public SpringChest(SalesPackageManager manager) + { + super(manager, "1 Spring Chest"); + } + + public void displayToAgent(Player agent, String playerName) + { + addButton(agent, "/sales item " + playerName + " 1 Item Spring Chest", "Give 1 Spring Chest."); + agent.sendMessage(" "); + addBackButton(agent, playerName); + } +} + From 6875287b6d2333248335a8efe4e874a442dfd799 Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Fri, 24 Mar 2017 16:52:37 -0300 Subject: [PATCH 34/98] Changed pets to Entities instead of Creatures --- .../custompet/ActivateCustomPetButton.java | 6 +-- .../mineplex/core/pet/FlyingPetManager.java | 6 +-- .../src/mineplex/core/pet/PetManager.java | 48 +++++++++---------- .../src/mineplex/core/pet/PetType.java | 2 +- 4 files changed, 28 insertions(+), 34 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/ActivateCustomPetButton.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/ActivateCustomPetButton.java index f0c0a6845..7a090129e 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/ActivateCustomPetButton.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/ActivateCustomPetButton.java @@ -4,8 +4,6 @@ import org.bukkit.entity.Player; import org.bukkit.event.inventory.ClickType; import mineplex.core.cosmetic.ui.page.GadgetPage; -import mineplex.core.cosmetic.ui.page.Menu; -import mineplex.core.pet.PetType; import mineplex.core.shop.item.IButton; public class ActivateCustomPetButton implements IButton @@ -20,8 +18,8 @@ public class ActivateCustomPetButton implements IButton @Override public void onClick(Player player, ClickType clickType) { - _page.playAcceptSound(player); + /*_page.playAcceptSound(player); _page.getPlugin().getPetManager().addPetOwner(player, PetType.CUSTOM, player.getLocation()); - _page.getShop().openPageForPlayer(player, new Menu(_page.getPlugin(), _page.getShop(), _page.getClientManager(), _page.getDonationManager(), player)); + _page.getShop().openPageForPlayer(player, new Menu(_page.getPlugin(), _page.getShop(), _page.getClientManager(), _page.getDonationManager(), player));*/ } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/pet/FlyingPetManager.java b/Plugins/Mineplex.Core/src/mineplex/core/pet/FlyingPetManager.java index 1779e723c..c144a93ab 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/pet/FlyingPetManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/pet/FlyingPetManager.java @@ -1,7 +1,7 @@ package mineplex.core.pet; import org.bukkit.Location; -import org.bukkit.entity.Creature; +import org.bukkit.entity.Entity; import org.bukkit.entity.Player; import org.bukkit.util.Vector; @@ -17,13 +17,13 @@ public class FlyingPetManager */ private Player _player; - private Creature _pet; + private Entity _pet; private Location _grimReaperLoc, _target; private Vector _direction; private double _speed; private long _idleTime; - public FlyingPetManager(Player player, Creature pet) + public FlyingPetManager(Player player, Entity pet) { _player = player; _pet = pet; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/pet/PetManager.java b/Plugins/Mineplex.Core/src/mineplex/core/pet/PetManager.java index 1e208d98a..1f68bed86 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/pet/PetManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/pet/PetManager.java @@ -66,7 +66,6 @@ import mineplex.core.common.util.UtilServer; import mineplex.core.disguise.DisguiseManager; import mineplex.core.disguise.disguises.DisguiseChicken; import mineplex.core.disguise.disguises.DisguiseGuardian; -import mineplex.core.disguise.disguises.DisguiseRabbit; import mineplex.core.disguise.disguises.DisguiseVillager; import mineplex.core.disguise.disguises.DisguiseWither; import mineplex.core.disguise.disguises.DisguiseZombie; @@ -98,8 +97,8 @@ public class PetManager extends MiniClientPlugin private CoreClientManager _clientManager; private InventoryManager _inventoryManager; - private Map _flyingPets = new HashMap<>(); - private Map _trueLovePets = new HashMap<>(); + private Map _flyingPets = new HashMap<>(); + private Map _trueLovePets = new HashMap<>(); private ShapeWings _grimReaperWings = new ShapeWings(ParticleType.RED_DUST.particleName, new org.bukkit.util.Vector(0.2, 0.2, 0.2), 1, 0, false, ShapeWings.DEFAULT_ROTATION, ShapeWings.SMALL_ANGEL_WING_PATTERN); private ShapeWings _grimReaperWingsEdge = new ShapeWings(ParticleType.RED_DUST.particleName, new org.bukkit.util.Vector(0.1, 0.1, 0.1), 1, 0, true, ShapeWings.DEFAULT_ROTATION, ShapeWings.SMALL_ANGEL_WING_PATTERN); @@ -214,7 +213,7 @@ public class PetManager extends MiniClientPlugin return; } - Creature pet; + Entity pet; EntityType entityType = petType.getEntityType(); //Wither Spawn @@ -222,7 +221,7 @@ public class PetManager extends MiniClientPlugin { _creatureModule.SetForce(true); - pet = (Creature) location.getWorld().spawnEntity(location, EntityType.SILVERFISH); + pet = location.getWorld().spawnEntity(location, EntityType.SILVERFISH); UtilEnt.silence(pet, true); DisguiseWither witherDisguise = new DisguiseWither(pet); @@ -259,12 +258,12 @@ public class PetManager extends MiniClientPlugin } } } - pet = (Creature)_creatureModule.SpawnEntity(location, petType.getEntityType()); + pet = _creatureModule.SpawnEntity(location, petType.getEntityType()); } //Default Spawn else { - pet = (Creature)_creatureModule.SpawnEntity(location, petType.getEntityType()); + pet = _creatureModule.SpawnEntity(location, petType.getEntityType()); } //Named Pet @@ -276,16 +275,18 @@ public class PetManager extends MiniClientPlugin if (petType.equals(PetType.ZOMBIE)) { - ((Zombie) pet).setBaby(true); - pet.getEquipment().setHelmet(new ItemStack(Material.PUMPKIN)); - pet.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, 99999999, 0)); + Zombie zombie = (Zombie) pet; + zombie.setBaby(true); + zombie.getEquipment().setHelmet(new ItemStack(Material.PUMPKIN)); + zombie.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, 99999999, 0)); UtilEnt.silence(pet, true); } if (pet instanceof PigZombie) { - ((PigZombie)pet).setBaby(true); - pet.getEquipment().setHelmet(new ItemStack(Material.SKULL_ITEM, 1, (short)0, (byte) 1)); - pet.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, 99999999, 0)); + PigZombie pigZombie = (PigZombie) pet; + pigZombie.setBaby(true); + pigZombie.getEquipment().setHelmet(new ItemStack(Material.SKULL_ITEM, 1, (short)0, (byte) 1)); + pigZombie.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, 99999999, 0)); } else if (pet instanceof Villager) { @@ -294,10 +295,11 @@ public class PetManager extends MiniClientPlugin } else if (pet instanceof Skeleton) { - pet.getEquipment().setHelmet(new ItemStack(Material.PUMPKIN)); //stop burning + Skeleton skeleton = (Skeleton) pet; + skeleton.getEquipment().setHelmet(new ItemStack(Material.PUMPKIN)); //stop burning UtilEnt.silence(pet, true); - DisguiseGuardian disguise = new DisguiseGuardian(pet); + DisguiseGuardian disguise = new DisguiseGuardian(skeleton); if (Get(player).getPets().get(petType) != null && Get(player).getPets().get(petType).length() > 0) { @@ -413,14 +415,8 @@ public class PetManager extends MiniClientPlugin } else if (petType.equals(PetType.KILLER_BUNNY)) { - Zombie zombie = (Zombie) pet; - UtilEnt.silence(zombie, true); - - DisguiseRabbit disguiseRabbit = new DisguiseRabbit(zombie); - - Rabbit rabbit = (Rabbit) disguiseRabbit.getEntity().getBukkitEntity(); + Rabbit rabbit = (Rabbit) pet; rabbit.setRabbitType(Rabbit.Type.THE_KILLER_BUNNY); - _disguiseManager.disguise(disguiseRabbit); } _activePetOwnerTypes.put(player.getName(), petType); @@ -669,7 +665,7 @@ public class PetManager extends MiniClientPlugin @EventHandler public void grimReaperFly(UpdateEvent event) { - for (Entry entry : _flyingPets.entrySet()) + for (Entry entry : _flyingPets.entrySet()) { FlyingPetManager flyingPetManager = entry.getValue(); flyingPetManager.update(); @@ -682,11 +678,11 @@ public class PetManager extends MiniClientPlugin if (event.getType() != UpdateType.FASTEST) return; - Iterator> iterator = _trueLovePets.entrySet().iterator(); + Iterator> iterator = _trueLovePets.entrySet().iterator(); while (iterator.hasNext()) { - Entry entry = iterator.next(); - Creature zombie = entry.getKey(); + Entry entry = iterator.next(); + Entity zombie = entry.getKey(); UtilParticle.PlayParticle(ParticleType.HEART, zombie.getLocation().add(0, 0.25, 0), 0.25f, 0.25f, 0.25f, 0, 1, ViewDist.NORMAL); TrueLoveData trueLoveData = entry.getValue(); trueLoveData.update(); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/pet/PetType.java b/Plugins/Mineplex.Core/src/mineplex/core/pet/PetType.java index 6995910ec..ee15e57ac 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/pet/PetType.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/pet/PetType.java @@ -34,7 +34,7 @@ public enum PetType CUPID_PET("Cupid", EntityType.ZOMBIE, -17, "Sometimes you need a little extra help finding true Love. Why not have Cupid help you out?", Material.BOW, (byte) 0), TRUE_LOVE_PET("True Love", EntityType.ZOMBIE, -14, "Sometimes love means chasing the person of your dreams until you catch them.", Material.APPLE, YearMonth.of(2017, Month.FEBRUARY)), LEPRECHAUN("Leprechaun", EntityType.ZOMBIE, -18, "Apparently this little guy lost his Pot of Gold in the war.", SkinData.LEPRECHAUN.getSkull()), - KILLER_BUNNY("Killer Bunny", EntityType.ZOMBIE, -19, "Placeholder") + KILLER_BUNNY("Killer Bunny", EntityType.RABBIT, -19, "Placeholder") // TODO CHECK IF LOBBY IS 1.9+ // Not in this update //SHULKER("Shulker Pet", EntityType.BAT, 0, "Is it a turtle or an alien? Either way its shot can be really UPLIFTING.") From bff837ca9bd3a30f3fbe0f74a5fc7ceabb840400 Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Sat, 25 Mar 2017 18:36:12 -0300 Subject: [PATCH 35/98] Fixed morph and possible fix for balloons, added lore and icon for particle effect --- .../mineplex/core/common/skin/SkinData.java | 2 + .../cupidslove/ArrowTrailCupid.java | 1 - .../gadgets/death/spring/DeathSpring.java | 1 - .../gadgets/morph/MorphAwkwardRabbit.java | 94 ++++++++++++++----- .../core/gadget/types/BalloonGadget.java | 14 +++ .../core/gadget/util/BalloonData.java | 6 ++ .../src/mineplex/core/pet/PetManager.java | 2 +- .../src/mineplex/core/pet/PetType.java | 2 +- .../animation/BlockChangeAnimation.java | 46 +++++++++ 9 files changed, 143 insertions(+), 25 deletions(-) diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/skin/SkinData.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/skin/SkinData.java index 3e4c49575..55d6fd4ab 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/skin/SkinData.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/skin/SkinData.java @@ -65,6 +65,8 @@ public class SkinData public final static SkinData GINGERBREAD = new SkinData("eyJ0aW1lc3RhbXAiOjE0ODAxOTk5MjM0NTUsInByb2ZpbGVJZCI6IjRjOGQ1NjllZWZlMTRkOGE4YzJmMmM4ODA3ODA3ODRmIiwicHJvZmlsZU5hbWUiOiJHaW5nZXJicmVhZE1hbiIsInNpZ25hdHVyZVJlcXVpcmVkIjp0cnVlLCJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvMzAyM2IxZGQ5MWQyYjM2Y2FkZTU2NjVjM2Y3ODk3ZmNiOGRlMWFlNjE5YTRlOTYxODU2MzdiMTliZGNmZjQ3In19fQ==", "lND5lQCzd5DKdn+ps82zn55hrSDr12bBLFoSbxetOj7MaYAuHCkJPQQOXdcMh3TLLSgxmQzEWkIHSUo760/2Qfd2uDDOTVfZZqiFjiOwDQ7YQjkokqNaC3U9gEq+LBJ+IgEkwaCsluXYMIK0Wvqx1DFa82pg8bSYGczJfTw/1kQsUUTpmao6ChZw3yrHTPow38onD95f9i6yVcnhSpPfM/JTQuL4N6Jdcql6VRJNSvCHJvEgh6R2p0w7DJhEGIzkFaF3lPdBqw+Mm97fBPvznscd4s6gpH07gUl/T+vlyHyRBLm85Pgm70r4MQ+c/nGOQOXzFMNpO8RIot/uhd7t3bvSi6yFzZQm7P9QLCLm/0C84x0sCugjeN/hVA347FWnuRPcya5xPzlpTWAW7pCjheAz0mvnPUMYT6Wp4CJx6bPdePnaiLFSeK8EyQIU9IUQJgXqMA3cOwqMBdh/0r71fTInPdgXsVxabmGbCgIuK3A2hSgxpcZv9412T0NIJYSTi0s2B3dyAaZJrdF5wa1hIr8au63SWFJww3GEEOF5YObEyVvKj2yS40iaHaRrfn1DeALT0eD0oN1zzK66FKbFuDmZmm4Thel9gKt+QcnR2uHlFLEBUogpIXyeC8zca7SOppANloOpO4mBbf22dXBJogenVd425JWaXOHJ6NVqIBw="); public final static SkinData LOVE_DOCTOR = new SkinData("eyJ0aW1lc3RhbXAiOjE0ODQ0MzM1MjQxMjAsInByb2ZpbGVJZCI6IjlmY2FlZDhiMTRiNTRmN2ZhNjRjYjYwNDBlNzA1MjcyIiwicHJvZmlsZU5hbWUiOiJMQ2FzdHIxIiwic2lnbmF0dXJlUmVxdWlyZWQiOnRydWUsInRleHR1cmVzIjp7IlNLSU4iOnsidXJsIjoiaHR0cDovL3RleHR1cmVzLm1pbmVjcmFmdC5uZXQvdGV4dHVyZS9iY2RiZTM2OTM1NGZjMzUxY2RhNGRmY2Y2OWM0MzY3ODcwYjI4ZWE3NDUzYWVjM2IzMjgyM2YyMWMzNTJlNTUifX19", "KD0NsKFlS+9/JpPQdT0Lq2jo942WeHpFevJPR3T9JO/5NVmNprupsWuTgepw14iHoax8/xyP8S4XksYq8hJ30e+gRKXVReqtq4l8JetXJILI7JTL6EHj/Flg4t0O6ASIm3Hr+w86IKrPb0NwHTjHJHvbf0r7k3E/TMLbq0/c7Xgi+JgC0uQd+wIPZhQe92P3O7eGH858X0vsxG0FVzgnEAlHVLmqBCwqxMU5CsBp0JCTVIbtp+JNmveCsfLagP6mi39rUudbueXJQgqLv7H7Zw+ZNINLLaKPNVO6Od8sX3c+CSUQ+Bm9bakYr628k/z0krTdNpLG7OGXWoT3XShW6HXB/z7o7hpuDXJW7HdyvmWv9GVyWLm2USNe7/3Ugs2zWZI1f+t6t+V3EVr3T+nR4zpY/ISdlTsLtV/Daebr0v/V0YlaM0UaASzz16ob3p1cfao7C7BZwKqOBKoSyHpnuLhd70wOtNrhhPDU9dWQBC/l6uojcMJ9lQMsxFmHj4JFqJYl7p/UXnq1vnYBo1P3A//IGl4gL1Hv8U0I14LT77/AMYH57mItgD0/VnE4bvPIFML/4cX7L9qpdLoOAAyfa5P9cAfzhUnVnRRLM016MpGtvY8SfbZ68Of1Xjz/dZ9/fBEcObXPHGX2QNuJRFiWJjRVKjO7ok0qfiVUEmuZr6I="); public final static SkinData LEPRECHAUN = new SkinData("eyJ0aW1lc3RhbXAiOjE0ODc4NzI5Mjg1ODIsInByb2ZpbGVJZCI6IjlmY2FlZDhiMTRiNTRmN2ZhNjRjYjYwNDBlNzA1MjcyIiwicHJvZmlsZU5hbWUiOiJMQ2FzdHIxIiwic2lnbmF0dXJlUmVxdWlyZWQiOnRydWUsInRleHR1cmVzIjp7IlNLSU4iOnsidXJsIjoiaHR0cDovL3RleHR1cmVzLm1pbmVjcmFmdC5uZXQvdGV4dHVyZS80ZTBkZjZhZGNiNzkzMzM5ZjFhOGNkM2E0ZGQ2ZThjNGQ2ZWFjYmU5NWMzZDA5OTI4NDMyMWFiZGI5MTgwOSJ9fX0=", "cyIYHTdzvVBOyYoiJZTvNS8Et5pzqBNxuz6GQspE2lBkW2Bj82JNv5oczsf3oxYAG4zxdb96G8+7UKBmoJdvx0x6UD7Dk0dnKrwpXfOhe+jRxtwMGMsdYCb8URWaoIoeKpxdCmAtjgV6FI8zDy2Yzi+MF4O9e4VqH0tMBoD2/CZScQwNEzc4YXf2M2fglKn9uK2+xrgLV+XS+SNdIn7BRiNlQf96u6N2G0lO+eb09LbIfIgAgfnyLiARccWa+VNo6gwlCFyRMnwOlgqxL5XA5Um4kkx2ZReRRCDFQ4NV5eLBktLd5wpECyOuY7v7S3zLqwbhwG47gS8hnXqmtHG5RW0RUQZEryg638Cw7hwr2k09iStfok8WeZUIJ+fuUWgdArvbtN36a2pCXyFdqzp+E8xzSF4E9SQv0K+1lNj+w4L58dh8pddeKK8m5bpjINj4xZ6nf7reWYQAX/imVNYTXTW8JqYnF+++xViBwmfeeM3PmEg+wyTduh+M25nyhGcqn5l+UyQ9aMzzdNs2aEdx12fOm1sOFXjHrHWeo6ciEm7sY1SDjiJ99VVXuGHCJWBtxq/B+c+vC/Cj8itEYOetwe5NKrgI99pZjG+KiRr4L0n8/NA3Px7SbKUUpHse80pNMjGfFW4pAOyFXJaKHrObWT2iL2AnTe+yfdY4sf/JZT4="); + public final static SkinData BUGS_BUNNY = new SkinData("eyJ0aW1lc3RhbXAiOjE0OTA0NzE5MDU2MTgsInByb2ZpbGVJZCI6IjlmY2FlZDhiMTRiNTRmN2ZhNjRjYjYwNDBlNzA1MjcyIiwicHJvZmlsZU5hbWUiOiJMQ2FzdHIxIiwic2lnbmF0dXJlUmVxdWlyZWQiOnRydWUsInRleHR1cmVzIjp7IlNLSU4iOnsidXJsIjoiaHR0cDovL3RleHR1cmVzLm1pbmVjcmFmdC5uZXQvdGV4dHVyZS84MmUyMjRkMGJkZGJmNjRiODIzMmUxNWRhNGRkN2NjN2NiYTYzM2NiODkyMTFhYjVjNDRhODU0ZjM1NDhlZWRiIn19fQ==", "QtM7YGNpqGcTnlUCTtQsQIEc8VGvL8cxWzAvN4LjYZrY4Fv15ysEVSPWPmRL/FJTRyUFCrJFO/0miVbuIEsGyUnsgHJAr9qkeyMvfD3+pZtKU1FkS58VNQkL/YaPDms7XPy1BPNo+ynQnVevdVCNDOvs2244Px3UljtuReBteKqL8QGMR1K6FFCQuKKvcvYsljdM8RV91r2yuT9UDxnzMRghWyRZuthvCeGL85g1LQxCnzJ0NUqIqCDrTWa8jeuncLnmRooKZYGsQjCAVOSFRk4KytD+fv8xgNK2igqBgVcqAINl5IjrFt7yyPQ2FVBbshETsjewusa6eZSBoy1Lc17G7bcndoOdwGMuztLjHPMzxFpIV1RkbZrngjcSTE/IQdSw79NlzMOEMKjE/34M7xcSnSZA1xwW33g+/xq+pNbqcXu85e7VXkziWDhHREp9ITT4YjrVdrss1yfYBzZgRmmLyaMpVmVsecKB9adpuZkhGzKIVrQHDGYEHoqoRnsRGJREdZQPxaSWp4+DSxpV/0oJXJWDz+XFztbcVbBcjBOD9kpFP0s+R5t1WA2B+jsf9J3LdsUUDbBiWikBwbAXKhHxTWWKv6OZLZovhgvGnW2lXQsHglEKuD7jE/mnFj4SF2qRO2N37AUjaG8AGQtTVhxW5JneIiBA0dbKIk06yoY="); + public final static SkinData SLENDERMAN = new SkinData("eyJ0aW1lc3RhbXAiOjE0OTA0NzUyNzk4NTUsInByb2ZpbGVJZCI6IjlmY2FlZDhiMTRiNTRmN2ZhNjRjYjYwNDBlNzA1MjcyIiwicHJvZmlsZU5hbWUiOiJMQ2FzdHIxIiwic2lnbmF0dXJlUmVxdWlyZWQiOnRydWUsInRleHR1cmVzIjp7IlNLSU4iOnsidXJsIjoiaHR0cDovL3RleHR1cmVzLm1pbmVjcmFmdC5uZXQvdGV4dHVyZS9hMWNkOTI5OTFmYTRjZGQ2MGVlZDNhZTM3ZmI5NWRmZjFkNWNkOGNiZmYwYWFjMzE4MmQ0ODU2NDU5NTIzYyJ9fX0=", "OVqWFLCekyZcdGli6kPBKNh8/VYPhKZGNqlAvSOKc3RLgh4pIkI6TDPr/Y+VQdhz1wZozARFYSeoDJJJ4nZTi7gi3rVPG2rL1ZnKo7so5hdT8caEzSTRmgwPKzo03ZhEEsW9AEJo9mpiUxGSJdBlgEb9UgodpYFW1IjRC09CcBUqzRWP8QGZTSFSN5x9emQ97DyiFmt0NFWubHCKHdb7CExhchPRtbahL3hOEzPY8/Y+Irl9OZjx7jONE7O/sYItCuZoXc3FaTgCV0riiXHCgH2eA54s5TQVWumtp3FU7VIcKR6pm/o61+GusvqhNgdFNk9XSHWMUyp+HNU0R8sConZQN/eaVx9laJmUUb4zNZ7hX/hLYV+r9LFU1NXOeIZWJPShD+bYfZgEorIpD+EAL4BHht/f5e6a1IZUDBWb001PFibby2t9WWjoDVKz4McbxZ2Xui7EHKFG1K3biPibhWx6fvnOeJ2xW6UDIZcD+TCXwlW/knkFt44Xpyv3oNHk3UNkyrQgghd6qkc3gZHxP8PQCNvKIyK1I+pHR6JMZvSStp7ZQRDpvsvIUyOJvq+7Bs7lFYs8hcJHMzEB+8PYlH2k7P7iLuA6ZYFUmvOW1LLq0+hvxK96ZdNEsJdmMkVVTZBRw7vsZ4GPbkdp2cMOFH2lHcQj80xKqVbd43IqFDA="); // Comments this out for now, so it doesn't load the player profile // A better way to do this would check for the properties when getting the skull or the skin diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/cupidslove/ArrowTrailCupid.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/cupidslove/ArrowTrailCupid.java index 813147704..c10562f6d 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/cupidslove/ArrowTrailCupid.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/cupidslove/ArrowTrailCupid.java @@ -27,7 +27,6 @@ public class ArrowTrailCupid extends ArrowEffectGadget @Override public void doTrail(Arrow arrow) { - arrow.setCritical(false); Vector color = arrow.getTicksLived()%2 == 0? UtilColor.colorToVector(Color.RED) : UtilColor.colorToVector(Color.fromRGB(16738740)); UtilParticle.PlayParticleToAll(ParticleType.RED_DUST, arrow.getLocation(), color, 1, 0, ViewDist.LONG); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/spring/DeathSpring.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/spring/DeathSpring.java index 31b7bbf94..ca75793ba 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/spring/DeathSpring.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/spring/DeathSpring.java @@ -31,7 +31,6 @@ public class DeathSpring extends DeathEffectGadget public DeathSpring(GadgetManager manager) { - // TODO NAME, LORE AND ICON super(manager, "Funeral Bouquet", UtilText.splitLineToArray(C.cGray + "Leave a rose to pay respects", LineFormat.LORE), -19, diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphAwkwardRabbit.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphAwkwardRabbit.java index ed09b4a54..762fff510 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphAwkwardRabbit.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphAwkwardRabbit.java @@ -4,44 +4,81 @@ import java.util.HashMap; import java.util.Map; import org.bukkit.Material; -import org.bukkit.entity.Entity; +import org.bukkit.entity.Bat; import org.bukkit.entity.Player; import org.bukkit.entity.Skeleton; +import org.bukkit.entity.Slime; import org.bukkit.event.EventHandler; +import org.bukkit.potion.PotionEffect; +import org.bukkit.potion.PotionEffectType; +import org.spigotmc.event.entity.EntityDismountEvent; +import com.mojang.authlib.GameProfile; + +import mineplex.core.common.skin.SkinData; import mineplex.core.common.util.C; import mineplex.core.common.util.LineFormat; +import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilText; -import mineplex.core.disguise.disguises.DisguiseSkeleton; +import mineplex.core.disguise.disguises.DisguisePlayer; import mineplex.core.gadget.GadgetManager; import mineplex.core.gadget.gadgets.morph.managers.UtilMorph; import mineplex.core.gadget.types.MorphGadget; -import mineplex.core.updater.UpdateType; -import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.utils.UtilGameProfile; public class MorphAwkwardRabbit extends MorphGadget { - private Map _skeletons = new HashMap<>(); + private Map _skeletons = new HashMap<>(); + private Map _slimes = new HashMap<>(); + private Map _bats = new HashMap<>(); public MorphAwkwardRabbit(GadgetManager manager) { - super(manager, "Awkward Rabbit Morph", UtilText.splitLinesToArray(new String[]{C.cGray + "Dale was the most awkward of Rabbits"}, LineFormat.LORE), - -19, Material.GLASS, (byte) 0); + super(manager, "Awkward Rabbit Morph", UtilText.splitLinesToArray(new String[]{C.cGray + "Dale was the most awkward of Rabbits."}, LineFormat.LORE), + -19, Material.SKULL_ITEM, (byte) 0); } @Override public void enableCustom(Player player, boolean message) { applyArmor(player, message); - Skeleton dinnerbone = player.getWorld().spawn(player.getLocation(), Skeleton.class); - dinnerbone.setCustomName("Dinnerbone"); - dinnerbone.setCustomNameVisible(false); - _skeletons.put(player, dinnerbone); + Manager.getPetManager().getCreatureModule().SetForce(true); - DisguiseSkeleton disguiseSkeleton = new DisguiseSkeleton(player); - UtilMorph.disguise(player, disguiseSkeleton, Manager); + Slime slime = player.getWorld().spawn(player.getLocation(), Slime.class); + UtilEnt.silence(slime, true); + slime.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, Integer.MAX_VALUE, 1, false, false)); + slime.setSize(-1); + + Skeleton skeleton = player.getWorld().spawn(player.getLocation(), Skeleton.class); + UtilEnt.silence(skeleton, true); + skeleton.setCustomName("Dinnerbone"); + skeleton.setCustomNameVisible(false); + skeleton.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, Integer.MAX_VALUE, 1, false, false)); + skeleton.getEquipment().setHelmet(SkinData.SLENDERMAN.getSkull()); + + Bat bat = player.getWorld().spawn(player.getLocation(), Bat.class); + UtilEnt.silence(bat, true); + bat.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, Integer.MAX_VALUE, 1, false, false)); + + Manager.getPetManager().getCreatureModule().SetForce(false); + + GameProfile gameProfile = UtilGameProfile.getGameProfile(player); + gameProfile.getProperties().clear(); + gameProfile.getProperties().put("textures", SkinData.BUGS_BUNNY.getProperty()); + + DisguisePlayer disguisePlayer = new DisguisePlayer(player, gameProfile); + disguisePlayer.showInTabList(true, 0); + UtilMorph.disguise(player, disguisePlayer, Manager); + + _skeletons.put(player, skeleton); + _slimes.put(player, slime); + _bats.put(player, bat); + + skeleton.setPassenger(bat); + slime.setPassenger(skeleton); + disguisePlayer.getEntity().getBukkitEntity().setPassenger(slime); } @Override @@ -49,19 +86,34 @@ public class MorphAwkwardRabbit extends MorphGadget { removeArmor(player); UtilMorph.undisguise(player, Manager.getDisguiseManager()); + _skeletons.get(player).remove(); + _slimes.get(player).remove(); + _bats.get(player).remove(); } @EventHandler - public void teleportSkeletons(UpdateEvent event) + public void dismount(EntityDismountEvent event) { - if (event.getType() != UpdateType.TICK) - return; - - for (Map.Entry entry : _skeletons.entrySet()) + if (event.getDismounted() instanceof Skeleton) { - Player player = entry.getKey(); - Entity entity = entry.getValue(); - entity.teleport(player.getLocation().clone().add(0, 0.3, 0)); + if (_skeletons.containsValue(event.getDismounted())) + { + event.setCancelled(true); + } + } + if (event.getDismounted() instanceof Slime) + { + if (_slimes.containsValue(event.getDismounted())) + { + event.setCancelled(true); + } + } + if (event.getDismounted() instanceof Bat) + { + if (_bats.containsValue(event.getDismounted())) + { + event.setCancelled(true); + } } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/BalloonGadget.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/BalloonGadget.java index 4a5ad6f60..feb632597 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/BalloonGadget.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/BalloonGadget.java @@ -10,6 +10,7 @@ import org.bukkit.entity.Entity; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; +import org.bukkit.event.player.PlayerMoveEvent; import org.bukkit.event.player.PlayerTeleportEvent; import mineplex.core.common.util.F; @@ -114,6 +115,19 @@ public abstract class BalloonGadget extends Gadget { Map.Entry> entry = iterator.next(); for (BalloonData balloonData : entry.getValue().values()) + { + balloonData.teleport(); + } + } + } + + @EventHandler + public void onPlayerMove(PlayerMoveEvent event) + { + if (PLAYER_BALLOONS.containsKey(event.getPlayer().getUniqueId())) + { + Map balloons = PLAYER_BALLOONS.get(event.getPlayer().getUniqueId()); + for (BalloonData balloonData : balloons.values()) { balloonData.update(); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/util/BalloonData.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/util/BalloonData.java index fe81e2d15..8ac58de85 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/util/BalloonData.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/util/BalloonData.java @@ -50,6 +50,12 @@ public class BalloonData ((LivingEntity) _balloon).setLeashHolder(_player); } + public void teleport() + { + _balloon.teleport(_balloonLoc); + _balloon.setVelocity(new Vector(0, 3, 0)); + } + public void update() { if (_leash == null) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/pet/PetManager.java b/Plugins/Mineplex.Core/src/mineplex/core/pet/PetManager.java index 1f68bed86..3e1cbaf4f 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/pet/PetManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/pet/PetManager.java @@ -309,7 +309,7 @@ public class PetManager extends MiniClientPlugin _disguiseManager.disguise(disguise); } - else if (pet instanceof Rabbit) + else if (petType.equals(PetType.RABBIT)) { UtilEnt.silence(pet, true); DisguiseChicken disguise = new DisguiseChicken(pet); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/pet/PetType.java b/Plugins/Mineplex.Core/src/mineplex/core/pet/PetType.java index ee15e57ac..d92a14687 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/pet/PetType.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/pet/PetType.java @@ -34,7 +34,7 @@ public enum PetType CUPID_PET("Cupid", EntityType.ZOMBIE, -17, "Sometimes you need a little extra help finding true Love. Why not have Cupid help you out?", Material.BOW, (byte) 0), TRUE_LOVE_PET("True Love", EntityType.ZOMBIE, -14, "Sometimes love means chasing the person of your dreams until you catch them.", Material.APPLE, YearMonth.of(2017, Month.FEBRUARY)), LEPRECHAUN("Leprechaun", EntityType.ZOMBIE, -18, "Apparently this little guy lost his Pot of Gold in the war.", SkinData.LEPRECHAUN.getSkull()), - KILLER_BUNNY("Killer Bunny", EntityType.RABBIT, -19, "Placeholder") + KILLER_BUNNY("Killer Bunny", EntityType.RABBIT, -19, "The Eater Bunny's less talked about brother Devin was a bit less fun to hang out with.") // TODO CHECK IF LOBBY IS 1.9+ // Not in this update //SHULKER("Shulker Pet", EntityType.BAT, 0, "Is it a turtle or an alien? Either way its shot can be really UPLIFTING.") diff --git a/Plugins/Mineplex.Core/src/mineplex/core/treasure/animation/BlockChangeAnimation.java b/Plugins/Mineplex.Core/src/mineplex/core/treasure/animation/BlockChangeAnimation.java index f2629eb1f..54585d493 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/animation/BlockChangeAnimation.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/animation/BlockChangeAnimation.java @@ -1,5 +1,6 @@ package mineplex.core.treasure.animation; +import java.util.ArrayList; import java.util.List; import org.bukkit.Material; @@ -7,8 +8,10 @@ import org.bukkit.block.Block; import org.bukkit.block.BlockFace; import org.bukkit.block.Skull; +import mineplex.core.common.MaterialData; import mineplex.core.common.skin.SkinData; import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilMath; import mineplex.core.treasure.BlockInfo; import mineplex.core.treasure.Treasure; import mineplex.core.treasure.TreasureType; @@ -99,6 +102,10 @@ public class BlockChangeAnimation extends Animation mat = Material.WOOL; data = 13; } + else if (getTreasure().getTreasureType() == TreasureType.SPRING) + { + mat = Material.GRASS; + } else continue; @@ -151,6 +158,11 @@ public class BlockChangeAnimation extends Animation mat = Material.GOLD_BLOCK; data = 0; } + else if (getTreasure().getTreasureType() == TreasureType.SPRING) + { + mat = Material.DIRT; + data = 2; + } else continue; @@ -245,6 +257,40 @@ public class BlockChangeAnimation extends Animation } } } + else if (getTreasure().getTreasureType() == TreasureType.SPRING) + { + List materials = new ArrayList<>(); + materials.add(MaterialData.of(Material.LONG_GRASS, (byte) 1)); + materials.add(MaterialData.of(Material.LONG_GRASS, (byte) 2)); + materials.add(MaterialData.of(Material.DEAD_BUSH, (byte) 0)); + materials.add(MaterialData.of(Material.YELLOW_FLOWER, (byte) 0)); + materials.add(MaterialData.of(Material.RED_ROSE, (byte) 0)); + materials.add(MaterialData.of(Material.RED_ROSE, (byte) 1)); + materials.add(MaterialData.of(Material.RED_ROSE, (byte) 2)); + materials.add(MaterialData.of(Material.RED_ROSE, (byte) 3)); + materials.add(MaterialData.of(Material.RED_ROSE, (byte) 4)); + materials.add(MaterialData.of(Material.RED_ROSE, (byte) 5)); + materials.add(MaterialData.of(Material.RED_ROSE, (byte) 6)); + materials.add(MaterialData.of(Material.RED_ROSE, (byte) 7)); + materials.add(MaterialData.of(Material.RED_ROSE, (byte) 8)); + materials.add(MaterialData.of(Material.DOUBLE_PLANT, (byte) 0)); + materials.add(MaterialData.of(Material.DOUBLE_PLANT, (byte) 1)); + materials.add(MaterialData.of(Material.DOUBLE_PLANT, (byte) 2)); + materials.add(MaterialData.of(Material.DOUBLE_PLANT, (byte) 3)); + materials.add(MaterialData.of(Material.DOUBLE_PLANT, (byte) 4)); + materials.add(MaterialData.of(Material.DOUBLE_PLANT, (byte) 5)); + for (Block c : _chests) + { + if (c.equals(b)) + { + int r = UtilMath.random.nextInt(materials.size()); + MaterialData materialData = materials.get(r); + _blockInfoList.add(new BlockInfo(b)); + b.setType(materialData.getMaterial()); + b.setData(materialData.getData()); + } + } + } } } From 3837d9fbda4fe9a884ba885069bd6f14b37c5676 Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Sat, 25 Mar 2017 18:38:43 -0300 Subject: [PATCH 36/98] This should have been added in the last commit... --- .../gadget/gadgets/particle/spring/ParticleSpringHalo.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/spring/ParticleSpringHalo.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/spring/ParticleSpringHalo.java index 4b24315ca..ecc285418 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/spring/ParticleSpringHalo.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/spring/ParticleSpringHalo.java @@ -39,8 +39,8 @@ public class ParticleSpringHalo extends ParticleGadget public ParticleSpringHalo(GadgetManager manager) { - // TODO CHANGE LORE BEFORE RELEASE - super(manager, "Spring Halo", UtilText.splitLinesToArray(new String[]{C.cGray + "Placeholder"}, LineFormat.LORE), -14, Material.GLASS, (byte) 0, YearMonth.of(2017, Month.APRIL)); + super(manager, "Spring Halo", UtilText.splitLinesToArray(new String[]{C.cGray + "Spring is everywhere, if you look hard enough."}, LineFormat.LORE), + -14, Material.YELLOW_FLOWER, (byte) 0, YearMonth.of(2017, Month.APRIL)); } @Override From 32bb2515f7325a15a3094fa4191332166e224187 Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Sun, 26 Mar 2017 01:26:43 -0300 Subject: [PATCH 37/98] Changed height of skeleton --- .../mineplex/core/gadget/gadgets/morph/MorphAwkwardRabbit.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphAwkwardRabbit.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphAwkwardRabbit.java index 762fff510..c636beaad 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphAwkwardRabbit.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphAwkwardRabbit.java @@ -49,7 +49,7 @@ public class MorphAwkwardRabbit extends MorphGadget Slime slime = player.getWorld().spawn(player.getLocation(), Slime.class); UtilEnt.silence(slime, true); slime.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, Integer.MAX_VALUE, 1, false, false)); - slime.setSize(-1); + slime.setSize(-2); Skeleton skeleton = player.getWorld().spawn(player.getLocation(), Skeleton.class); UtilEnt.silence(skeleton, true); From 3c241c48bc7769c3c3600c11cdf2546a6ec6f4e8 Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Mon, 27 Mar 2017 17:26:18 -0300 Subject: [PATCH 38/98] Changed rabbit morph to spawn holograms --- .../gadgets/morph/MorphAwkwardRabbit.java | 76 +++---------------- 1 file changed, 9 insertions(+), 67 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphAwkwardRabbit.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphAwkwardRabbit.java index c636beaad..217d2513e 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphAwkwardRabbit.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphAwkwardRabbit.java @@ -1,24 +1,15 @@ package mineplex.core.gadget.gadgets.morph; -import java.util.HashMap; -import java.util.Map; - import org.bukkit.Material; -import org.bukkit.entity.Bat; import org.bukkit.entity.Player; -import org.bukkit.entity.Skeleton; -import org.bukkit.entity.Slime; import org.bukkit.event.EventHandler; -import org.bukkit.potion.PotionEffect; -import org.bukkit.potion.PotionEffectType; -import org.spigotmc.event.entity.EntityDismountEvent; +import org.bukkit.event.player.PlayerToggleSneakEvent; import com.mojang.authlib.GameProfile; import mineplex.core.common.skin.SkinData; import mineplex.core.common.util.C; import mineplex.core.common.util.LineFormat; -import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilText; import mineplex.core.disguise.disguises.DisguisePlayer; import mineplex.core.gadget.GadgetManager; @@ -29,10 +20,6 @@ import mineplex.core.utils.UtilGameProfile; public class MorphAwkwardRabbit extends MorphGadget { - private Map _skeletons = new HashMap<>(); - private Map _slimes = new HashMap<>(); - private Map _bats = new HashMap<>(); - public MorphAwkwardRabbit(GadgetManager manager) { super(manager, "Awkward Rabbit Morph", UtilText.splitLinesToArray(new String[]{C.cGray + "Dale was the most awkward of Rabbits."}, LineFormat.LORE), @@ -44,26 +31,6 @@ public class MorphAwkwardRabbit extends MorphGadget { applyArmor(player, message); - Manager.getPetManager().getCreatureModule().SetForce(true); - - Slime slime = player.getWorld().spawn(player.getLocation(), Slime.class); - UtilEnt.silence(slime, true); - slime.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, Integer.MAX_VALUE, 1, false, false)); - slime.setSize(-2); - - Skeleton skeleton = player.getWorld().spawn(player.getLocation(), Skeleton.class); - UtilEnt.silence(skeleton, true); - skeleton.setCustomName("Dinnerbone"); - skeleton.setCustomNameVisible(false); - skeleton.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, Integer.MAX_VALUE, 1, false, false)); - skeleton.getEquipment().setHelmet(SkinData.SLENDERMAN.getSkull()); - - Bat bat = player.getWorld().spawn(player.getLocation(), Bat.class); - UtilEnt.silence(bat, true); - bat.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, Integer.MAX_VALUE, 1, false, false)); - - Manager.getPetManager().getCreatureModule().SetForce(false); - GameProfile gameProfile = UtilGameProfile.getGameProfile(player); gameProfile.getProperties().clear(); gameProfile.getProperties().put("textures", SkinData.BUGS_BUNNY.getProperty()); @@ -71,14 +38,6 @@ public class MorphAwkwardRabbit extends MorphGadget DisguisePlayer disguisePlayer = new DisguisePlayer(player, gameProfile); disguisePlayer.showInTabList(true, 0); UtilMorph.disguise(player, disguisePlayer, Manager); - - _skeletons.put(player, skeleton); - _slimes.put(player, slime); - _bats.put(player, bat); - - skeleton.setPassenger(bat); - slime.setPassenger(skeleton); - disguisePlayer.getEntity().getBukkitEntity().setPassenger(slime); } @Override @@ -86,35 +45,18 @@ public class MorphAwkwardRabbit extends MorphGadget { removeArmor(player); UtilMorph.undisguise(player, Manager.getDisguiseManager()); - _skeletons.get(player).remove(); - _slimes.get(player).remove(); - _bats.get(player).remove(); } @EventHandler - public void dismount(EntityDismountEvent event) + public void spawnHolograms(PlayerToggleSneakEvent event) { - if (event.getDismounted() instanceof Skeleton) - { - if (_skeletons.containsValue(event.getDismounted())) - { - event.setCancelled(true); - } - } - if (event.getDismounted() instanceof Slime) - { - if (_slimes.containsValue(event.getDismounted())) - { - event.setCancelled(true); - } - } - if (event.getDismounted() instanceof Bat) - { - if (_bats.containsValue(event.getDismounted())) - { - event.setCancelled(true); - } - } + if (!isActive(event.getPlayer())) + return; + + if (event.isSneaking()) + return; + + } } From 8da2431415b8047478cbc36e1a85bc6c144d2970 Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Mon, 27 Mar 2017 22:39:50 -0300 Subject: [PATCH 39/98] Added bugs bunny quotes --- .../gadgets/morph/MorphAwkwardRabbit.java | 36 ++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphAwkwardRabbit.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphAwkwardRabbit.java index 217d2513e..65a5e3b02 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphAwkwardRabbit.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphAwkwardRabbit.java @@ -1,5 +1,10 @@ package mineplex.core.gadget.gadgets.morph; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; @@ -10,20 +15,32 @@ import com.mojang.authlib.GameProfile; import mineplex.core.common.skin.SkinData; import mineplex.core.common.util.C; import mineplex.core.common.util.LineFormat; +import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilText; import mineplex.core.disguise.disguises.DisguisePlayer; import mineplex.core.gadget.GadgetManager; import mineplex.core.gadget.gadgets.morph.managers.UtilMorph; import mineplex.core.gadget.types.MorphGadget; +import mineplex.core.hologram.Hologram; import mineplex.core.utils.UtilGameProfile; public class MorphAwkwardRabbit extends MorphGadget { + private List _quotes = new ArrayList<>(); + public MorphAwkwardRabbit(GadgetManager manager) { super(manager, "Awkward Rabbit Morph", UtilText.splitLinesToArray(new String[]{C.cGray + "Dale was the most awkward of Rabbits."}, LineFormat.LORE), -19, Material.SKULL_ITEM, (byte) 0); + _quotes.addAll(Arrays.asList( + "Eh, what's up, doc?", + "That's all, folks.", + "Gee, ain't I a stinker?", + "Carrots are devine...", + "I know this defies the\n law of gravity,\n but I never studied law!", + "I don’t ask questions,\n I just have fun", + "Hey, just a minute you!\n Them’s fightin’ words!")); } @Override @@ -56,7 +73,24 @@ public class MorphAwkwardRabbit extends MorphGadget if (event.isSneaking()) return; - + Location randomLoc = event.getPlayer().getLocation().clone(); + int[] rPos = new int[]{-2, -1, 0, 1, 2}; + int rX = rPos[UtilMath.random.nextInt(rPos.length)], rZ = rPos[UtilMath.random.nextInt(rPos.length)]; + + randomLoc.add(rX, 1, rZ); + + String quote = _quotes.get(UtilMath.random.nextInt(_quotes.size())); + Hologram hologram; + if (quote.contains("*nl*")) + { + String[] lines = quote.split("\n"); + hologram = new Hologram(Manager.getHologramManager(), randomLoc, true, 2000, lines); + } + else + { + hologram = new Hologram(Manager.getHologramManager(), randomLoc, true, 2000, quote); + } + hologram.start(); } } From ae2768d35486a2aa6c75de58e209d7ba71896141 Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Mon, 27 Mar 2017 23:58:01 -0300 Subject: [PATCH 40/98] Changed name, lore, icon and cooldown --- .../gadgets/morph/MorphAwkwardRabbit.java | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphAwkwardRabbit.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphAwkwardRabbit.java index 65a5e3b02..dc2b7446b 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphAwkwardRabbit.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphAwkwardRabbit.java @@ -22,6 +22,7 @@ import mineplex.core.gadget.GadgetManager; import mineplex.core.gadget.gadgets.morph.managers.UtilMorph; import mineplex.core.gadget.types.MorphGadget; import mineplex.core.hologram.Hologram; +import mineplex.core.recharge.Recharge; import mineplex.core.utils.UtilGameProfile; public class MorphAwkwardRabbit extends MorphGadget @@ -29,9 +30,13 @@ public class MorphAwkwardRabbit extends MorphGadget private List _quotes = new ArrayList<>(); + private static final long COOLDOWN = 10000; + private static final long HOLOGRAM_TIME = 3000; + public MorphAwkwardRabbit(GadgetManager manager) { - super(manager, "Awkward Rabbit Morph", UtilText.splitLinesToArray(new String[]{C.cGray + "Dale was the most awkward of Rabbits."}, LineFormat.LORE), + super(manager, "Wascally Wabbit Morph", + UtilText.splitLinesToArray(new String[]{C.cGray + "Be absolutely silent my friends we are searching for rabbits currently!"}, LineFormat.LORE), -19, Material.SKULL_ITEM, (byte) 0); _quotes.addAll(Arrays.asList( "Eh, what's up, doc?", @@ -41,6 +46,7 @@ public class MorphAwkwardRabbit extends MorphGadget "I know this defies the\n law of gravity,\n but I never studied law!", "I don’t ask questions,\n I just have fun", "Hey, just a minute you!\n Them’s fightin’ words!")); + setDisplayItem(SkinData.BUGS_BUNNY.getSkull()); } @Override @@ -73,6 +79,9 @@ public class MorphAwkwardRabbit extends MorphGadget if (event.isSneaking()) return; + if (!Recharge.Instance.use(event.getPlayer(), getName(), COOLDOWN, true, false, "Cosmetics")) + return; + Location randomLoc = event.getPlayer().getLocation().clone(); int[] rPos = new int[]{-2, -1, 0, 1, 2}; int rX = rPos[UtilMath.random.nextInt(rPos.length)], rZ = rPos[UtilMath.random.nextInt(rPos.length)]; @@ -81,14 +90,14 @@ public class MorphAwkwardRabbit extends MorphGadget String quote = _quotes.get(UtilMath.random.nextInt(_quotes.size())); Hologram hologram; - if (quote.contains("*nl*")) + if (quote.contains("\n")) { String[] lines = quote.split("\n"); - hologram = new Hologram(Manager.getHologramManager(), randomLoc, true, 2000, lines); + hologram = new Hologram(Manager.getHologramManager(), randomLoc, true, HOLOGRAM_TIME, lines); } else { - hologram = new Hologram(Manager.getHologramManager(), randomLoc, true, 2000, quote); + hologram = new Hologram(Manager.getHologramManager(), randomLoc, true, HOLOGRAM_TIME, quote); } hologram.start(); } From 88db9c2913401af9d6bb33698c97c2b8cfe9aae4 Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Tue, 28 Mar 2017 17:26:50 -0300 Subject: [PATCH 41/98] Added Bugs Bunny to spring chest --- .../Mineplex.Core/src/mineplex/core/reward/RewardManager.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardManager.java b/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardManager.java index 2aa0f309e..fb9891e27 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardManager.java @@ -70,6 +70,7 @@ import mineplex.core.gadget.gadgets.item.ItemPaintballGun; import mineplex.core.gadget.gadgets.item.ItemPartyPopper; import mineplex.core.gadget.gadgets.item.ItemSnowball; import mineplex.core.gadget.gadgets.item.ItemTNT; +import mineplex.core.gadget.gadgets.morph.MorphAwkwardRabbit; import mineplex.core.gadget.gadgets.morph.MorphBat; import mineplex.core.gadget.gadgets.morph.MorphBlock; import mineplex.core.gadget.gadgets.morph.MorphBunny; @@ -868,6 +869,7 @@ public class RewardManager // SPRING addGadget(Type.SPRING, getGadget(ParticleSpringHalo.class), rarity, 100); + addGadget(Type.SPRING, getGadget(MorphAwkwardRabbit.class), rarity, 25); addPetReward(Type.SPRING, PetType.KILLER_BUNNY, rarity, 50); } From 3bc4125b76f100e7c70767265e046944c11261e2 Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Tue, 4 Apr 2017 15:47:02 -0300 Subject: [PATCH 42/98] Removed custom pet from this update --- .../src/mineplex/core/cosmetic/ui/page/PetPage.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/PetPage.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/PetPage.java index fae5fe884..3501af878 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/PetPage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/PetPage.java @@ -36,7 +36,6 @@ import mineplex.core.cosmetic.ui.button.PetButton; import mineplex.core.cosmetic.ui.button.RenamePetButton; import mineplex.core.cosmetic.ui.button.activate.ActivatePetButton; import mineplex.core.cosmetic.ui.button.deactivate.DeactivatePetButton; -import mineplex.core.cosmetic.ui.page.custompet.CustomPetBasePage; import mineplex.core.donation.DonationManager; import mineplex.core.pet.PetExtra; import mineplex.core.pet.PetType; @@ -231,7 +230,7 @@ public class PetPage extends ShopPageBase slot += 2; } - slot = 48; + slot = 49; for (PetExtra petExtra : PetExtra.values()) { List itemLore = new ArrayList(); @@ -255,8 +254,8 @@ public class PetPage extends ShopPageBase } // Custom pet - addButton(50, new ShopItem(Material.GLASS, C.cGreen + "Custom", new String[]{}, 1, false), (player, clickType) -> - getShop().openPageForPlayer(getPlayer(), new CustomPetBasePage(getPlugin(), getShop(), getClientManager(), getDonationManager(), "Custom Pet", player))); + /*addButton(50, new ShopItem(Material.GLASS, C.cGreen + "Custom", new String[]{}, 1, false), (player, clickType) -> + getShop().openPageForPlayer(getPlayer(), new CustomPetBasePage(getPlugin(), getShop(), getClientManager(), getDonationManager(), "Custom Pet", player)));*/ addButton(4, new ShopItem(Material.BED, C.cGray + " \u21FD Go Back", new String[]{}, 1, false), (player, clickType) -> From a7be020c9db281d538c72d5e9a99e8caf7e70e74 Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Tue, 4 Apr 2017 17:23:43 -0300 Subject: [PATCH 43/98] Locked rabbit as adult --- Plugins/Mineplex.Core/src/mineplex/core/pet/PetManager.java | 1 + 1 file changed, 1 insertion(+) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/pet/PetManager.java b/Plugins/Mineplex.Core/src/mineplex/core/pet/PetManager.java index 3e1cbaf4f..47c79138d 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/pet/PetManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/pet/PetManager.java @@ -416,6 +416,7 @@ public class PetManager extends MiniClientPlugin else if (petType.equals(PetType.KILLER_BUNNY)) { Rabbit rabbit = (Rabbit) pet; + rabbit.setAdult(); rabbit.setRabbitType(Rabbit.Type.THE_KILLER_BUNNY); } From 83d141eddc4a357c96867fe3b938501fe51c72ba Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Tue, 4 Apr 2017 17:25:16 -0300 Subject: [PATCH 44/98] Changed price of Spring Halo particle --- .../gadget/gadgets/particle/spring/ParticleSpringHalo.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/spring/ParticleSpringHalo.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/spring/ParticleSpringHalo.java index ecc285418..713df4199 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/spring/ParticleSpringHalo.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/spring/ParticleSpringHalo.java @@ -1,7 +1,5 @@ package mineplex.core.gadget.gadgets.particle.spring; -import java.time.Month; -import java.time.YearMonth; import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; @@ -40,7 +38,7 @@ public class ParticleSpringHalo extends ParticleGadget public ParticleSpringHalo(GadgetManager manager) { super(manager, "Spring Halo", UtilText.splitLinesToArray(new String[]{C.cGray + "Spring is everywhere, if you look hard enough."}, LineFormat.LORE), - -14, Material.YELLOW_FLOWER, (byte) 0, YearMonth.of(2017, Month.APRIL)); + -19, Material.YELLOW_FLOWER, (byte) 0); } @Override From 957004f97a47d9463787b6194dad824fb830a8d7 Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Tue, 4 Apr 2017 17:28:11 -0300 Subject: [PATCH 45/98] Added 'Found in X' lore --- .../src/mineplex/core/cosmetic/ui/page/GadgetPage.java | 5 +++++ .../src/mineplex/core/cosmetic/ui/page/PetPage.java | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/GadgetPage.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/GadgetPage.java index 713429dc6..3d8aedbb7 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/GadgetPage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/GadgetPage.java @@ -180,6 +180,11 @@ public class GadgetPage extends ShopPageBase itemLore.add(C.cBlack); itemLore.add(C.cBlue + "Found in St Patrick's Chests"); } + else if (gadget.getCost(GlobalCurrency.TREASURE_SHARD) == -19) + { + itemLore.add(C.cBlack); + itemLore.add(C.cBlue + "Found in Spring Chests"); + } //Rank Unlocks else if (gadget.getCost(GlobalCurrency.TREASURE_SHARD) == -10) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/PetPage.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/PetPage.java index 3501af878..e7bf684cb 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/PetPage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/PetPage.java @@ -116,6 +116,11 @@ public class PetPage extends ShopPageBase itemLore.add(C.cBlack); itemLore.add(C.cBlue + "Found in St Patrick's Chests"); } + else if (pet.getPrice() == -19) + { + itemLore.add(C.cBlack); + itemLore.add(C.cBlue + "Found in Spring Chests"); + } else if (pet.getPrice() == -14) { itemLore.add(C.cBlack); From 424e0fe0a44f145156dc7dd2703da81dc7a49386 Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Tue, 4 Apr 2017 17:29:45 -0300 Subject: [PATCH 46/98] Fixed spring chests being purchasable even if locked or if player had all the items --- .../mineplex/core/treasure/gui/BuyChestButton.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) 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 087374d5d..cdcdb4055 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/gui/BuyChestButton.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/gui/BuyChestButton.java @@ -83,6 +83,19 @@ public class BuyChestButton implements IButton return; } } + if (_chestType == TreasureType.SPRING) + { + if (!new File("../../update/files/EnableSpringChest.dat").exists()) + { + player.sendMessage(F.main("Treasure", "That chest is no longer available for purchase!")); + return; + } + if (!_page.getPlugin().hasItemsToGivePlayer(_chestType.getRewardPool(), player)) + { + player.sendMessage(F.main("Treasure", "You seem to have all treasures for this chest unlocked already!")); + return; + } + } if (_chestType == TreasureType.FREEDOM || _chestType == TreasureType.HAUNTED) { if (!_page.getPlugin().hasItemsToGivePlayer(_chestType.getRewardPool(), player)) From 2c09bb584aa66573a1dc21ae374b4aeb54ba0687 Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Tue, 4 Apr 2017 17:33:02 -0300 Subject: [PATCH 47/98] Fixed Spring Set lore --- .../Mineplex.Core/src/mineplex/core/gadget/set/SetSpring.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetSpring.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetSpring.java index ea2f26dbe..77727b480 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetSpring.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetSpring.java @@ -13,7 +13,7 @@ public class SetSpring extends GadgetSet public SetSpring(GadgetManager manager) { // TODO LORE - super(manager, "Spring", "Double Holiday Points while active", + super(manager, "Spring", "2x Holiday Points while active (Titles)", manager.getGadget(ArrowTrailSpring.class), manager.getGadget(DeathSpring.class), manager.getGadget(DoubleJumpSpring.class), From cb5b0a3c83513454364673950c221c82c16ddf61 Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Tue, 4 Apr 2017 18:00:47 -0300 Subject: [PATCH 48/98] Changed the icon of the death effect --- .../mineplex/core/gadget/gadgets/death/spring/DeathSpring.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/spring/DeathSpring.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/spring/DeathSpring.java index ca75793ba..eb15f5986 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/spring/DeathSpring.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/spring/DeathSpring.java @@ -34,7 +34,7 @@ public class DeathSpring extends DeathEffectGadget super(manager, "Funeral Bouquet", UtilText.splitLineToArray(C.cGray + "Leave a rose to pay respects", LineFormat.LORE), -19, - Material.RED_ROSE, (byte) 0); + Material.YELLOW_FLOWER, (byte) 0); } @Override From 27d7226712a094f90b576e5815419fd2184440ab Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Tue, 4 Apr 2017 22:58:43 -0300 Subject: [PATCH 49/98] Fixed flowers dropping after chest is opened --- .../animation/BlockChangeAnimation.java | 24 +++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/treasure/animation/BlockChangeAnimation.java b/Plugins/Mineplex.Core/src/mineplex/core/treasure/animation/BlockChangeAnimation.java index 54585d493..8dc08b025 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/animation/BlockChangeAnimation.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/animation/BlockChangeAnimation.java @@ -3,10 +3,15 @@ package mineplex.core.treasure.animation; import java.util.ArrayList; import java.util.List; +import org.bukkit.Bukkit; import org.bukkit.Material; import org.bukkit.block.Block; import org.bukkit.block.BlockFace; import org.bukkit.block.Skull; +import org.bukkit.event.EventHandler; +import org.bukkit.event.HandlerList; +import org.bukkit.event.Listener; +import org.bukkit.event.block.BlockPhysicsEvent; import mineplex.core.common.MaterialData; import mineplex.core.common.skin.SkinData; @@ -16,7 +21,7 @@ import mineplex.core.treasure.BlockInfo; import mineplex.core.treasure.Treasure; import mineplex.core.treasure.TreasureType; -public class BlockChangeAnimation extends Animation +public class BlockChangeAnimation extends Animation implements Listener { private static final int MAX_RADIUS = 4; @@ -31,6 +36,7 @@ public class BlockChangeAnimation extends Animation _currentRadius = 0; _blockInfoList = blockInfoList; _chests = chests; + Bukkit.getPluginManager().registerEvents(this, treasure.getTreasureManager().getPlugin()); } @Override @@ -302,7 +308,7 @@ public class BlockChangeAnimation extends Animation @Override protected void onFinish() { - + HandlerList.unregisterAll(this); } private byte getDirection(Block block) @@ -344,4 +350,18 @@ public class BlockChangeAnimation extends Animation return BlockFace.SOUTH; } } + + @EventHandler + public void onFlowerDrop(BlockPhysicsEvent event) + { + for (Block block : _chests) + { + if (event.getBlock().equals(block)) + { + event.setCancelled(true); + event.getBlock().setType(Material.AIR); + return; + } + } + } } From 616e2dad0f1207f114fead7c1381c83355ac647e Mon Sep 17 00:00:00 2001 From: Sarah Date: Wed, 5 Apr 2017 04:15:48 +0200 Subject: [PATCH 50/98] Fix selection of air blocks when searching for top layer blocks add some Supply Drop loot dd /Boost command, fix AntiCheat don't put duplicates in supply drop don't crumble rings before the game begins don't crumble middle rings --- .../game/games/skyfall/Crumbleable.java | 7 +- .../arcade/game/games/skyfall/Island.java | 2 +- .../arcade/game/games/skyfall/LootTable.java | 5 +- .../arcade/game/games/skyfall/Skyfall.java | 71 ++++++++++++++++++- 4 files changed, 77 insertions(+), 8 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skyfall/Crumbleable.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skyfall/Crumbleable.java index e2d4a95d3..ef9ef539c 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skyfall/Crumbleable.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skyfall/Crumbleable.java @@ -81,13 +81,14 @@ public abstract class Crumbleable int i = 0; - while (block.getType() == Material.AIR && i <= _height) + while (i <= _height) { + if (block.getType() != Material.AIR && block.getRelative(BlockFace.UP).getType() == Material.AIR) + _realBlocks.add(block.getLocation()); + block = block.getRelative(BlockFace.DOWN); i++; } - - _realBlocks.add(block.getLocation()); } _initBlocks = (ArrayList) _realBlocks.clone(); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skyfall/Island.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skyfall/Island.java index 3ff4d7f3d..fbad85f14 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skyfall/Island.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skyfall/Island.java @@ -207,7 +207,7 @@ public class Island extends Crumbleable public boolean isOnIsland(Location location) { - if (UtilMath.offset(location, _location) > _bounds + 1) + if (UtilMath.offset2d(location, _location) > _bounds + 1) return false; for (int y = ((int) (Math.round(_location.getY()) - _height)); y <= _location.getBlockY(); y++) 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 dea426b00..ff32dcd77 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 @@ -78,7 +78,10 @@ public class LootTable 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(Material.DIAMOND_AXE, 24), + new RandomItem(Material.GOLDEN_APPLE, 4), + new RandomItem(Material.BOW, 4), + new RandomItem(Material.ARROW, 2) // 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 37ea15dbb..a948f40d9 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 @@ -36,6 +36,9 @@ import org.bukkit.event.inventory.InventoryClickEvent; import org.bukkit.event.player.PlayerCommandPreprocessEvent; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerMoveEvent; +import org.bukkit.event.player.PlayerTeleportEvent; +import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause; +import org.bukkit.inventory.Inventory; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.ItemMeta; @@ -246,6 +249,18 @@ public abstract class Skyfall extends Game return; } + if(event.getMessage().contains("/Boost")) + { + float rate = Float.parseFloat(event.getMessage().split(" ")[1]); + for (BoosterRing ring : _boosterRings) + { + ring.setBoostStrength(rate); + } + UtilPlayer.message(event.getPlayer(), "Boost changed to " + rate); + event.setCancelled(true); + return; + } + } @EventHandler @@ -434,6 +449,16 @@ public abstract class Skyfall extends Game return islands; } + @EventHandler + public void disableAC(PlayerTeleportEvent event) + { + if (!IsLive()) + return; + + if (event.getCause() == TeleportCause.UNKNOWN) + event.setCancelled(true); + } + //@EventHandler public void deathMatch(UpdateEvent event) { @@ -502,11 +527,17 @@ public abstract class Skyfall extends Game @EventHandler public void ringCrumble(UpdateEvent event) { + if (!IsLive()) + return; + if (event.getType() != UpdateType.TICK) return; for (BoosterRing ring : _boosterRings) { + if (ring == _upperIsland.getBoosterRing() || ring == _lowerIsland.getBoosterRing()) + continue; + if (!UtilTime.elapsed(GetStateTime(), RING_CRUMBLE_DELAY)) return; @@ -598,9 +629,43 @@ public abstract class Skyfall extends Game Chest chest = (Chest) block.getState(); ChestLoot loot = LootTable.SUPPLY_DROP.getloot(); - for (int i = 0; i < UtilMath.rRange(5, 8); i++) - { - chest.getInventory().setItem(UtilMath.r(27), loot.getLoot()); + ArrayList exclude = new ArrayList<>(); + for (int i = 0; i < UtilMath.rRange(3, 5); i++) + { + int slot = UtilMath.r(26); + ItemStack item = loot.getLoot(exclude); + Inventory inventory = chest.getInventory(); + inventory.setItem(slot, item); + if (item.getType() == Material.BOW) + { + inventory.setItem(slot + 1, new ItemStack(Material.ARROW, UtilMath.r(6) + 1)); + } + if (UtilItem.isHelmet(item)) + { + exclude.add(Material.DIAMOND_HELMET); + } + if (UtilItem.isChestplate(item)) + { + exclude.add(Material.DIAMOND_CHESTPLATE); + } + if (UtilItem.isLeggings(item)) + { + exclude.add(Material.DIAMOND_LEGGINGS); + } + if (UtilItem.isBoots(item)) + { + exclude.add(Material.DIAMOND_BOOTS); + } + if (UtilItem.isSword(item)) + { + exclude.add(Material.DIAMOND_SWORD); + } + if (UtilItem.isAxe(item)) + { + exclude.add(Material.DIAMOND_AXE); + } + if (item.getType() == Material.BOW) + exclude.add(Material.BOW); } _supplyDropOver = true; } From acd588ff1a6d5054dfdba3cff49eb8f08445a1dc Mon Sep 17 00:00:00 2001 From: Sarah Date: Wed, 5 Apr 2017 04:40:52 +0200 Subject: [PATCH 51/98] Add lucky/unlucky tracks to Skyfall --- .../game/arcade/game/games/skyfall/Island.java | 5 ----- .../game/arcade/game/games/skyfall/Skyfall.java | 13 +++++++++++++ 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skyfall/Island.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skyfall/Island.java index a1901ee2c..e2d37b93e 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skyfall/Island.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skyfall/Island.java @@ -14,13 +14,8 @@ import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilItem; import mineplex.core.common.util.UtilMath; import mineplex.core.loot.ChestLoot; -<<<<<<< .mine - - -======= import mineplex.core.titles.tracks.standard.LuckyTrack; import mineplex.core.titles.tracks.standard.UnluckyTrack; ->>>>>>> .theirs /** * The Island Object represents a flying Island
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 f92eeffe2..b1d270fa1 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 @@ -67,6 +67,8 @@ import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilTime; import mineplex.core.loot.ChestLoot; import mineplex.core.recharge.Recharge; +import mineplex.core.titles.tracks.standard.LuckyTrack; +import mineplex.core.titles.tracks.standard.UnluckyTrack; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent; @@ -85,6 +87,7 @@ import nautilus.game.arcade.game.games.skyfall.stats.AeronaughtStatTracker; import nautilus.game.arcade.game.games.skyfall.stats.RingStatTracker; import nautilus.game.arcade.game.games.survivalgames.SupplyChestOpenEvent; import nautilus.game.arcade.game.modules.VersionModule; +import nautilus.game.arcade.game.modules.compass.CompassModule; import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.stats.FirstSupplyDropOpenStatTracker; import nautilus.game.arcade.stats.KillsWithinTimeLimitStatTracker; @@ -227,6 +230,10 @@ public abstract class Skyfall extends Game SoupEnabled = true; StrictAntiHack = false; + new CompassModule() + .setGiveCompassToAlive(true) + .register(this); + SpeedMeasurement = true; _bigIslandBounds = 25; @@ -704,6 +711,12 @@ public abstract class Skyfall extends Game } island.fillLoot(event.getClickedBlock()); + + if (event.getPlayer() != null && Manager != null && Manager.GetServerConfig().RewardStats) + { + Manager.getTrackManager().getTrack(LuckyTrack.class).handleLoot(event.getPlayer(), ((Chest) event.getClickedBlock().getState()).getBlockInventory()); + Manager.getTrackManager().getTrack(UnluckyTrack.class).handleLoot(event.getPlayer(), ((Chest) event.getClickedBlock().getState()).getBlockInventory()); + } } // I have no clue why, but this is fixing all food issues From 888c26c12df75ddbce1f3cc568e25ae0f59ba109 Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Wed, 5 Apr 2017 18:51:21 -0300 Subject: [PATCH 52/98] Changed icon of bunny pet --- Plugins/Mineplex.Core/src/mineplex/core/pet/PetType.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/pet/PetType.java b/Plugins/Mineplex.Core/src/mineplex/core/pet/PetType.java index d92a14687..3f54bc966 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/pet/PetType.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/pet/PetType.java @@ -34,7 +34,7 @@ public enum PetType CUPID_PET("Cupid", EntityType.ZOMBIE, -17, "Sometimes you need a little extra help finding true Love. Why not have Cupid help you out?", Material.BOW, (byte) 0), TRUE_LOVE_PET("True Love", EntityType.ZOMBIE, -14, "Sometimes love means chasing the person of your dreams until you catch them.", Material.APPLE, YearMonth.of(2017, Month.FEBRUARY)), LEPRECHAUN("Leprechaun", EntityType.ZOMBIE, -18, "Apparently this little guy lost his Pot of Gold in the war.", SkinData.LEPRECHAUN.getSkull()), - KILLER_BUNNY("Killer Bunny", EntityType.RABBIT, -19, "The Eater Bunny's less talked about brother Devin was a bit less fun to hang out with.") + KILLER_BUNNY("Killer Bunny", EntityType.RABBIT, -19, "The Eater Bunny's less talked about brother Devin was a bit less fun to hang out with.", Material.RABBIT_FOOT, (byte) 0) // TODO CHECK IF LOBBY IS 1.9+ // Not in this update //SHULKER("Shulker Pet", EntityType.BAT, 0, "Is it a turtle or an alien? Either way its shot can be really UPLIFTING.") From daaea03be7bac71dcb84afb691a484d6e431cfc9 Mon Sep 17 00:00:00 2001 From: samczsun Date: Thu, 6 Apr 2017 14:33:03 -0400 Subject: [PATCH 53/98] Strict username validation --- .../playerdisguise/DisguiseCommand.java | 9 +- .../playerdisguise/PlayerDisguiseManager.java | 165 ++++++++++++++---- .../mineplex/core/utils/UtilGameProfile.java | 2 +- 3 files changed, 143 insertions(+), 33 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/disguise/playerdisguise/DisguiseCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/disguise/playerdisguise/DisguiseCommand.java index ac7443d69..e0c544659 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/disguise/playerdisguise/DisguiseCommand.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/disguise/playerdisguise/DisguiseCommand.java @@ -1,5 +1,7 @@ package mineplex.core.disguise.playerdisguise; +import java.util.UUID; + import mineplex.core.command.CommandBase; import mineplex.core.common.Rank; import mineplex.core.common.util.F; @@ -17,11 +19,14 @@ public class DisguiseCommand extends CommandBase implemen @Override public void Execute(final Player caller, final String[] args) { + String realName = Plugin.getRealName(caller); + String currentName = caller.getName(); + UUID currentUUID = caller.getUniqueId(); if (args == null || args.length == 0) { Plugin.runAsync(() -> { - new PlayerDisguiseNotification(Plugin.getRealName(caller), caller.getUniqueId(), caller.getName()).publish(); + new PlayerDisguiseNotification(realName, currentUUID, currentName).publish(); }); Plugin.undisguise(caller); return; @@ -34,7 +39,7 @@ public class DisguiseCommand extends CommandBase implemen Plugin.runAsync(() -> { - new PlayerDisguiseNotification(Plugin.getRealName(caller), caller.getUniqueId(), args[0], args.length > 1 ? args[1] : args[0]).publish(); + new PlayerDisguiseNotification(realName, currentUUID, args[0], args.length > 1 ? args[1] : args[0]).publish(); }); Plugin.disguise(caller, args[0], args.length > 1 ? args[1] : args[0]); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/disguise/playerdisguise/PlayerDisguiseManager.java b/Plugins/Mineplex.Core/src/mineplex/core/disguise/playerdisguise/PlayerDisguiseManager.java index caf2b5b1d..a650df7ec 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/disguise/playerdisguise/PlayerDisguiseManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/disguise/playerdisguise/PlayerDisguiseManager.java @@ -1,7 +1,36 @@ package mineplex.core.disguise.playerdisguise; +import java.lang.reflect.Field; +import java.util.Arrays; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.Map; +import java.util.Set; +import java.util.UUID; +import java.util.function.Consumer; + +import net.minecraft.server.v1_8_R3.MinecraftServer; +import net.minecraft.server.v1_8_R3.PacketPlayOutNamedEntitySpawn; +import net.minecraft.server.v1_8_R3.PacketPlayOutPlayerInfo; +import net.minecraft.server.v1_8_R3.PlayerList; + +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.player.PlayerJoinEvent; +import org.bukkit.event.player.PlayerLoginEvent; +import org.bukkit.event.player.PlayerQuitEvent; + +import com.google.common.collect.ImmutableSet; import com.mojang.authlib.GameProfile; +import com.mojang.authlib.minecraft.MinecraftProfileTexture; import com.mojang.authlib.properties.Property; + import mineplex.core.MiniPlugin; import mineplex.core.ReflectivelyCreateMiniPlugin; import mineplex.core.account.CoreClient; @@ -33,33 +62,60 @@ import mineplex.serverdata.Region; import mineplex.serverdata.data.PlayerStatus; import mineplex.serverdata.redis.RedisDataRepository; import mineplex.serverdata.servers.ServerManager; -import net.minecraft.server.v1_8_R3.MinecraftServer; -import net.minecraft.server.v1_8_R3.PacketPlayOutNamedEntitySpawn; -import net.minecraft.server.v1_8_R3.PacketPlayOutPlayerInfo; -import net.minecraft.server.v1_8_R3.PlayerList; -import org.bukkit.Bukkit; -import org.bukkit.ChatColor; -import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.EventPriority; -import org.bukkit.event.player.PlayerJoinEvent; -import org.bukkit.event.player.PlayerLoginEvent; -import org.bukkit.event.player.PlayerQuitEvent; - -import java.lang.reflect.Field; -import java.util.Collections; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Iterator; -import java.util.Map; -import java.util.Set; -import java.util.UUID; -import java.util.function.Consumer; @ReflectivelyCreateMiniPlugin public class PlayerDisguiseManager extends MiniPlugin implements IPacketHandler { + private static final Set MOJANG; + private static final Set ILLEGAL_USERNAMES; + private static final Set ILLEGAL_CAPES; + + private static final Set VERY_SPECIAL_PEOPLE; + + static + { + MOJANG = ImmutableSet.copyOf(Arrays.asList("____fox____", "_tommo_", "aeplh", "amir343", "angryem", "ashrafi", + "binni", "blurpi", "bopogamel", "c418", "carlmanneh", "carnalizer", "darngeek", "dinnerbone", "eldrone", + "elevenen", "engst", "excitedze", "frukthamster", "geuder", "grumm", "hampus", "helloiammarsh", "hey", + "hoodad", "jeb_", "jonkagstrom", "kappe", "klumpig", "krisjelbring", "ladyagnes", "lisa", "mahuldur", + "mansolson", "marc", "marc_irl", "masseffect", "midnightenforcer", "minecraftchick", "modhelius", + "mojangjonas", "mojangsta", "mollstam", "neonmaster", "notch", "olle", "olofcarlson", "phreakholm", + "poipoichen", "pretto", "profmobius", "razzleberryfox", "searge", "searge_dp", "shoghicp", "slicedlime", + "sockerpappan", "themogminer", "vaktis", "vubui", "xlson", "xsson", "yoloswag4lyfe", "zeeraw") + ); + + ILLEGAL_USERNAMES = ImmutableSet.copyOf(Arrays.asList("hypixel", "chiss", "dctr", "blondebug", "dooskee", + "tomcallister", "jessiemarcia", "spu_", "sp614x", "deadmau5", "gwen", "mineplex", "samczsun", "sethbling", + "xisuma", "cubehamster", "natet_bird", "qwertyuiopthepie" + )); + + VERY_SPECIAL_PEOPLE = ImmutableSet.copyOf(Arrays.asList( + "5399b615-3440-4c66-939d-ab1375952ac3", // Drullkus (Prismarine Cape) + "7f0eda55-7034-4dc8-886d-d94321cdedcf", // MrMessiah (Personal Cape) + "d90b68bc-8172-4329-a047-f1186dcd4336", // akronman1 (Millionth Customer) + "144ad5f0-e879-4141-a489-8ed5d496cab9", // JulianClark (Personal Cape) + "1c063715-395b-4db9-bc2a-d5dfd20366f7", // dannyBstyle (Personal Cape) + "5797c479-ad5a-43b0-87ca-8852d65ac639" // cheapsh0t (Personal Cape) + )); + + ILLEGAL_CAPES = ImmutableSet.copyOf(Arrays.asList( + "http://textures.minecraft.net/texture/eec3cabfaeed5dafe61c6546297e853a547c39ec238d7c44bf4eb4a49dc1f2c0", // Mojang + "http://textures.minecraft.net/texture/43a51d34b076f9ada555dca562206bd942e46a3c4d5f83c2c29e5b9c3d7dbcb", // Realms + "http://textures.minecraft.net/texture/2ffda25cf1a4ed8996b767c8d16d450ba22fee7b5e416299f88a65ec5a", // Translator + "http://textures.minecraft.net/texture/f8b55ca322e64a381b6484dac2d8aa42c78c6129336ea3ef4596f1d31b27ef", // Mojira Mod + "http://textures.minecraft.net/texture/1672c9f13ece9c4f39a96fe22638ecd513fbe7099ca4354d3176d3793d8e9c7", // Cobalt + "http://textures.minecraft.net/texture/86e841dcb6465d1f95a56270243d23c596da4721acd9ca2d95927b1b8535dc54", // Scrolls + "http://textures.minecraft.net/texture/c9c058adf4a2526aa5493cf6fe37f5dbdfde7b3d4fe4df982b7bee8329e64bd", // Translator (Chinese) + "http://textures.minecraft.net/texture/eec3cabfaeed5dafe61c6546297e853a547c39ec238d7c44bf4eb4a49dc1f2c0", // Mojang (Old) + "http://textures.minecraft.net/texture/2897938eb320cfd8eed6fd75d42db7a9f8e2e4a3c8da1c91f6f8e1ff18c5f4", // cheapsh0t + "http://textures.minecraft.net/texture/1658fd5989db3caffdeae2a5a70b2d0a531a7fae7401e7caef7645bccf3c", // dannyBstyle + "http://textures.minecraft.net/texture/3d991748ae6e1cfe10f34d532748b1911b1e82b5a110ae89c34f9a2295902e", // JulianClark + "http://textures.minecraft.net/texture/ec80a225b145c812a6ef1ca29af0f3ebf02163874d1a66e53bac99965225e0", // Millionth Customer + "http://textures.minecraft.net/texture/b8ff4a34df87fc7d8bf1bb77bd88ac34d16c3ff52985c128e71dbc3ccd19a028" // MrMessiah + // "//textures.minecraft.net/texture/?", // Drullkus?? + )); + } + public static final String ORIGINAL_UUID_KEY = "originalUUID"; private CoreClientManager _clients = require(CoreClientManager.class); @@ -161,7 +217,7 @@ public class PlayerDisguiseManager extends MiniPlugin implements IPacketHandler { CoreClient client = _clients.Get(event.getPlayer()); - if (!client.GetRank().has(event.getPlayer(), Rank.ADMIN, new Rank[] {Rank.YOUTUBE, Rank.TWITCH}, false)) + if (!client.GetRank().has(event.getPlayer(), Rank.ADMIN, new Rank[]{Rank.YOUTUBE, Rank.YOUTUBE_SMALL, Rank.TWITCH}, false)) return; if (_redis.elementExists(client.getAccountId() + client.getName())) @@ -578,13 +634,23 @@ public class PlayerDisguiseManager extends MiniPlugin implements IPacketHandler public void disguise(Player caller, String requestedUsername, String requestedSkin) { - if (!validateUsername(caller, requestedUsername)) return; - if (!validateUsername(caller, requestedSkin)) return; + if (!validateUsername(caller, requestedUsername, true)) return; + if (!validateUsername(caller, requestedSkin, false)) return; UtilGameProfile.getProfileByName(requestedUsername, true, requestedProfile -> { + if (VERY_SPECIAL_PEOPLE.contains(requestedProfile.getId().toString().toLowerCase())) + { + UtilPlayer.message(caller, F.main("Disguise", "The chosen username of " + F.elem(requestedUsername) + " is not valid")); + return; + } + + if (!verifyProfile(caller, requestedProfile)) return; + Consumer skinConsumer = requestedProfileSkin -> { + if (!verifyProfile(caller, requestedProfileSkin)) return; + SkinData skinData = SkinData.constructFromGameProfile(requestedProfileSkin, true, true); requestedProfile.getProperties().clear(); requestedProfile.getProperties().put("textures", skinData.getProperty()); @@ -603,27 +669,66 @@ public class PlayerDisguiseManager extends MiniPlugin implements IPacketHandler }); } - private boolean validateUsername(Player caller, String username) + private boolean validateUsername(Player caller, String username, boolean isUsername) { String replaced = UtilGameProfile.legalize(username); if (!replaced.equals(username)) { - UtilPlayer.message(caller, F.main(getName(), "The chosen username of '" + username + "' is not valid")); + UtilPlayer.message(caller, F.main("Disguise", "The chosen username of " + F.elem(username) + " is not valid")); return false; } if (username.length() > 16) { - UtilPlayer.message(caller, F.main("Disguise", "The chosen username of '" + username + "' is " + F.count(String.valueOf(username.length() - 16)) + " characters too long!")); + UtilPlayer.message(caller, F.main("Disguise", "The chosen username of " + F.elem(username) + " is " + F.count(String.valueOf(username.length() - 16)) + " characters too long!")); return false; } if (username.length() <= 0) { - UtilPlayer.message(caller, F.main("Disguise", "The chosen username of '" + username + "' must be longer than 0 characters")); + UtilPlayer.message(caller, F.main("Disguise", "The chosen username of " + F.elem(username) + " must be longer than " + F.count("0") + " characters")); return false; } + if (isUsername) + { + if (ILLEGAL_USERNAMES.contains(username.toLowerCase()) || MOJANG.contains(username.toLowerCase())) + { + if (!UtilServer.isTestServer()) + { + UtilPlayer.message(caller, F.main("Disguise", "The chosen username of " + F.elem(username) + " is not valid")); + return false; + } + } + if (username.length() < 3) + { + if (!_clients.Get(caller).GetRank().has(Rank.ADMIN)) + { + UtilPlayer.message(caller, F.main("Disguise", "The chosen username of " + F.elem(username) + " must be longer than " + F.count("2") + " letters")); + return false; + } + } + } + + return true; + } + + private boolean verifyProfile(Player caller, GameProfile requestedProfile) + { + Map map = MinecraftServer.getServer().aD().getTextures(requestedProfile, false); + + if (map.containsKey(MinecraftProfileTexture.Type.CAPE)) + { + MinecraftProfileTexture texture = map.get(MinecraftProfileTexture.Type.CAPE); + if (ILLEGAL_CAPES.contains(texture.getUrl().toLowerCase())) + { + if (!UtilServer.isTestServer()) + { + UtilPlayer.message(caller, F.main("Disguise", "The chosen username of " + F.elem(requestedProfile.getName()) + " is not valid")); + return false; + } + } + } return true; } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/utils/UtilGameProfile.java b/Plugins/Mineplex.Core/src/mineplex/core/utils/UtilGameProfile.java index 5ee0a41ce..17a6bc447 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/utils/UtilGameProfile.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/utils/UtilGameProfile.java @@ -110,7 +110,7 @@ public class UtilGameProfile } // Pattern to remove all non alphanumeric + underscore letters - private static final Pattern LEGAL_USERNAME = Pattern.compile("[^A-Za-z0-9_]"); + private static final Pattern LEGAL_USERNAME = Pattern.compile("[^a-z0-9_]", Pattern.CASE_INSENSITIVE); /** * Convert a string to a legal username equivalent From 45e3223962c907ebbacbd14967896a3060745268 Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Fri, 7 Apr 2017 14:02:30 -0300 Subject: [PATCH 54/98] Added effects to chets opening and changed flowers to leaves so they don't drop any items when removed --- .../src/mineplex/core/treasure/Treasure.java | 9 ++ .../animation/BlockChangeAnimation.java | 50 ++--------- .../animation/ChestSpawnAnimation.java | 89 +++++++++++++++++-- .../animation/TreasureRemoveAnimation.java | 40 +++++++++ 4 files changed, 139 insertions(+), 49 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/treasure/Treasure.java b/Plugins/Mineplex.Core/src/mineplex/core/treasure/Treasure.java index f1e489390..cb408fd84 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/Treasure.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/Treasure.java @@ -224,6 +224,15 @@ public class Treasure block.getLocation().add(.5 + rX, .7, .5 + rZ)); coloredParticle.display(); } + else if (_treasureType == TreasureType.SPRING) + { + int r = (int) (Math.random() * 2); + double rX = Math.random() * 2 - 1, rZ = Math.random() * 2 - 1; + ColoredParticle coloredParticle = new ColoredParticle(UtilParticle.ParticleType.RED_DUST, + new DustSpellColor((r == 0) ? Color.RED : Color.YELLOW), + block.getLocation().add(.5 + rX, .7, .5 + rZ)); + coloredParticle.display(); + } else { UtilParticle.PlayParticle(type, block.getLocation().add(0.5, 0.5, 0.5), 0.5F, 0.5F, 0.5F, 0.2F, 0, diff --git a/Plugins/Mineplex.Core/src/mineplex/core/treasure/animation/BlockChangeAnimation.java b/Plugins/Mineplex.Core/src/mineplex/core/treasure/animation/BlockChangeAnimation.java index 8dc08b025..066f34b48 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/animation/BlockChangeAnimation.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/animation/BlockChangeAnimation.java @@ -3,15 +3,10 @@ package mineplex.core.treasure.animation; import java.util.ArrayList; import java.util.List; -import org.bukkit.Bukkit; import org.bukkit.Material; import org.bukkit.block.Block; import org.bukkit.block.BlockFace; import org.bukkit.block.Skull; -import org.bukkit.event.EventHandler; -import org.bukkit.event.HandlerList; -import org.bukkit.event.Listener; -import org.bukkit.event.block.BlockPhysicsEvent; import mineplex.core.common.MaterialData; import mineplex.core.common.skin.SkinData; @@ -21,7 +16,7 @@ import mineplex.core.treasure.BlockInfo; import mineplex.core.treasure.Treasure; import mineplex.core.treasure.TreasureType; -public class BlockChangeAnimation extends Animation implements Listener +public class BlockChangeAnimation extends Animation { private static final int MAX_RADIUS = 4; @@ -36,7 +31,6 @@ public class BlockChangeAnimation extends Animation implements Listener _currentRadius = 0; _blockInfoList = blockInfoList; _chests = chests; - Bukkit.getPluginManager().registerEvents(this, treasure.getTreasureManager().getPlugin()); } @Override @@ -266,32 +260,19 @@ public class BlockChangeAnimation extends Animation implements Listener else if (getTreasure().getTreasureType() == TreasureType.SPRING) { List materials = new ArrayList<>(); - materials.add(MaterialData.of(Material.LONG_GRASS, (byte) 1)); - materials.add(MaterialData.of(Material.LONG_GRASS, (byte) 2)); - materials.add(MaterialData.of(Material.DEAD_BUSH, (byte) 0)); - materials.add(MaterialData.of(Material.YELLOW_FLOWER, (byte) 0)); - materials.add(MaterialData.of(Material.RED_ROSE, (byte) 0)); - materials.add(MaterialData.of(Material.RED_ROSE, (byte) 1)); - materials.add(MaterialData.of(Material.RED_ROSE, (byte) 2)); - materials.add(MaterialData.of(Material.RED_ROSE, (byte) 3)); - materials.add(MaterialData.of(Material.RED_ROSE, (byte) 4)); - materials.add(MaterialData.of(Material.RED_ROSE, (byte) 5)); - materials.add(MaterialData.of(Material.RED_ROSE, (byte) 6)); - materials.add(MaterialData.of(Material.RED_ROSE, (byte) 7)); - materials.add(MaterialData.of(Material.RED_ROSE, (byte) 8)); - materials.add(MaterialData.of(Material.DOUBLE_PLANT, (byte) 0)); - materials.add(MaterialData.of(Material.DOUBLE_PLANT, (byte) 1)); - materials.add(MaterialData.of(Material.DOUBLE_PLANT, (byte) 2)); - materials.add(MaterialData.of(Material.DOUBLE_PLANT, (byte) 3)); - materials.add(MaterialData.of(Material.DOUBLE_PLANT, (byte) 4)); - materials.add(MaterialData.of(Material.DOUBLE_PLANT, (byte) 5)); + materials.add(MaterialData.of(Material.LEAVES, (byte) 0)); + materials.add(MaterialData.of(Material.LEAVES, (byte) 1)); + materials.add(MaterialData.of(Material.LEAVES, (byte) 2)); + materials.add(MaterialData.of(Material.LEAVES, (byte) 3)); + materials.add(MaterialData.of(Material.LEAVES_2, (byte) 0)); + materials.add(MaterialData.of(Material.LEAVES_2, (byte) 1)); for (Block c : _chests) { if (c.equals(b)) { + _blockInfoList.add(new BlockInfo(b)); int r = UtilMath.random.nextInt(materials.size()); MaterialData materialData = materials.get(r); - _blockInfoList.add(new BlockInfo(b)); b.setType(materialData.getMaterial()); b.setData(materialData.getData()); } @@ -308,7 +289,6 @@ public class BlockChangeAnimation extends Animation implements Listener @Override protected void onFinish() { - HandlerList.unregisterAll(this); } private byte getDirection(Block block) @@ -350,18 +330,4 @@ public class BlockChangeAnimation extends Animation implements Listener return BlockFace.SOUTH; } } - - @EventHandler - public void onFlowerDrop(BlockPhysicsEvent event) - { - for (Block block : _chests) - { - if (event.getBlock().equals(block)) - { - event.setCancelled(true); - event.getBlock().setType(Material.AIR); - return; - } - } - } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/treasure/animation/ChestSpawnAnimation.java b/Plugins/Mineplex.Core/src/mineplex/core/treasure/animation/ChestSpawnAnimation.java index 80eab149e..5a4378a48 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/animation/ChestSpawnAnimation.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/animation/ChestSpawnAnimation.java @@ -1,22 +1,32 @@ package mineplex.core.treasure.animation; import java.awt.Color; +import java.util.ArrayList; +import java.util.Iterator; import java.util.List; import net.minecraft.server.v1_8_R3.BlockPosition; import net.minecraft.server.v1_8_R3.MathHelper; +import org.bukkit.Bukkit; import org.bukkit.Location; +import org.bukkit.Material; import org.bukkit.block.Block; import org.bukkit.craftbukkit.v1_8_R3.CraftWorld; import org.bukkit.entity.ArmorStand; import org.bukkit.entity.EntityType; +import org.bukkit.entity.Item; +import org.bukkit.event.EventHandler; +import org.bukkit.event.HandlerList; +import org.bukkit.event.Listener; +import org.bukkit.event.player.PlayerPickupItemEvent; import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.util.Vector; import com.google.common.collect.Lists; import mineplex.core.Managers; +import mineplex.core.common.MaterialData; import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilAlg; import mineplex.core.common.util.UtilBlock; @@ -30,13 +40,14 @@ import mineplex.core.common.util.particles.ColoredParticle; import mineplex.core.common.util.particles.DustSpellColor; import mineplex.core.disguise.DisguiseManager; import mineplex.core.disguise.disguises.DisguiseBat; +import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.particleeffects.BabyFireworkEffect; import mineplex.core.particleeffects.CircleEffect; import mineplex.core.treasure.BlockInfo; import mineplex.core.treasure.Treasure; import mineplex.core.treasure.TreasureType; -public class ChestSpawnAnimation extends Animation +public class ChestSpawnAnimation extends Animation implements Listener { private static final int ANIMATION_DURATION = 80; @@ -47,6 +58,8 @@ public class ChestSpawnAnimation extends Animation private Location _particleLocation; private Vector _particleDirection; + private Location _openingCenter; + private List _chestBlockInfo; private double _radialOffset; @@ -58,6 +71,8 @@ public class ChestSpawnAnimation extends Animation private int _currentHauntedColor = 0; private List _bats = Lists.newArrayList(); + private List _flowers = new ArrayList<>(); + private List _droppedFlowers = new ArrayList<>(); public ChestSpawnAnimation(Treasure treasure, Block block, List chestBlockInfo, Block openingCenter, double radialOffset, JavaPlugin javaPlugin) { @@ -83,8 +98,10 @@ public class ChestSpawnAnimation extends Animation _centerLocation = block.getLocation().clone().add(0.5, 0.5, 0.5); _chestBlockInfo = chestBlockInfo; - _particleLocation = openingCenter.getLocation().add(0.5, 4, 0.5); - + _particleLocation = openingCenter.getLocation().clone().add(0.5, 4, 0.5); + + _openingCenter = openingCenter.getLocation(); + _particleDirection = UtilAlg.getTrajectory(_particleLocation, _centerLocation); _particleDirection.multiply(UtilMath.offset(_particleLocation, _centerLocation) / (double)ANIMATION_DURATION); @@ -103,6 +120,8 @@ public class ChestSpawnAnimation extends Animation _radialOffset = radialOffset; _javaPlugin = javaPlugin; + + Bukkit.getPluginManager().registerEvents(this, javaPlugin); } @Override @@ -112,7 +131,18 @@ public class ChestSpawnAnimation extends Animation //Move Particle Forwards _particleLocation.add(_particleDirection); - + + Iterator droppedFlowersIterator = _droppedFlowers.iterator(); + while (droppedFlowersIterator.hasNext()) + { + Item flower = droppedFlowersIterator.next(); + if (flower.getTicksLived() >= 20) + { + flower.remove(); + droppedFlowersIterator.remove(); + } + } + //Play Particles if (getTreasure().getTreasureType() == TreasureType.OLD || getTreasure().getTreasureType() == TreasureType.LOVE_CHEST) { @@ -246,10 +276,20 @@ public class ChestSpawnAnimation extends Animation doBats(true, _centerLocation.clone().add(0, 6, 0), _bats); } } - else if (getTreasure().getTreasureType() == TreasureType.ST_PATRICKS) + else if (getTreasure().getTreasureType() == TreasureType.SPRING) { - Location location = _centerLocation.clone().add(0, 5, 0); + if (getTicks() % 5 == 0) + { + if (_flowers.size() == 0) + generateFlowerList(); + int r = UtilMath.random.nextInt(_flowers.size()); + MaterialData materialData = _flowers.get(r); + Item flower = _openingCenter.getWorld().dropItem(_openingCenter.clone().add(0.5, 0, 0.5), ItemStackFactory.Instance.CreateStack(materialData.getMaterial(), materialData.getData(), 1, "Flower" + getTicks())); + Vector vel = new Vector(_openingCenter.getX() - _centerLocation.getX(), 0, _openingCenter.getZ() - _centerLocation.getZ()); + UtilAction.velocity(flower, vel, 0.1, false, 0, 0.2 + 1 * 0.4, 1, false); + _droppedFlowers.add(flower); + } } //Spawn Chest @@ -338,7 +378,12 @@ public class ChestSpawnAnimation extends Animation @Override protected void onFinish() { - + HandlerList.unregisterAll(this); + for (Item item : _droppedFlowers) + { + item.remove(); + } + _droppedFlowers.clear(); } private void doBats(boolean initial, Location center, List bats) @@ -372,4 +417,34 @@ public class ChestSpawnAnimation extends Animation } } } + + private void generateFlowerList() + { + _flowers.add(MaterialData.of(Material.LONG_GRASS, (byte) 1)); + _flowers.add(MaterialData.of(Material.LONG_GRASS, (byte) 2)); + _flowers.add(MaterialData.of(Material.DEAD_BUSH, (byte) 0)); + _flowers.add(MaterialData.of(Material.YELLOW_FLOWER, (byte) 0)); + _flowers.add(MaterialData.of(Material.RED_ROSE, (byte) 0)); + _flowers.add(MaterialData.of(Material.RED_ROSE, (byte) 1)); + _flowers.add(MaterialData.of(Material.RED_ROSE, (byte) 2)); + _flowers.add(MaterialData.of(Material.RED_ROSE, (byte) 3)); + _flowers.add(MaterialData.of(Material.RED_ROSE, (byte) 4)); + _flowers.add(MaterialData.of(Material.RED_ROSE, (byte) 5)); + _flowers.add(MaterialData.of(Material.RED_ROSE, (byte) 6)); + _flowers.add(MaterialData.of(Material.RED_ROSE, (byte) 7)); + _flowers.add(MaterialData.of(Material.RED_ROSE, (byte) 8)); + _flowers.add(MaterialData.of(Material.DOUBLE_PLANT, (byte) 0)); + _flowers.add(MaterialData.of(Material.DOUBLE_PLANT, (byte) 1)); + _flowers.add(MaterialData.of(Material.DOUBLE_PLANT, (byte) 2)); + _flowers.add(MaterialData.of(Material.DOUBLE_PLANT, (byte) 3)); + _flowers.add(MaterialData.of(Material.DOUBLE_PLANT, (byte) 4)); + _flowers.add(MaterialData.of(Material.DOUBLE_PLANT, (byte) 5)); + } + + @EventHandler + public void onPickup(PlayerPickupItemEvent event) + { + if (_droppedFlowers.contains(event.getItem())) + event.setCancelled(true); + } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/treasure/animation/TreasureRemoveAnimation.java b/Plugins/Mineplex.Core/src/mineplex/core/treasure/animation/TreasureRemoveAnimation.java index c0ada9705..21bbad471 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/animation/TreasureRemoveAnimation.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/animation/TreasureRemoveAnimation.java @@ -1,5 +1,6 @@ package mineplex.core.treasure.animation; +import java.util.ArrayList; import java.util.List; import java.util.Random; @@ -9,7 +10,9 @@ import org.bukkit.entity.Item; import org.bukkit.inventory.ItemStack; import org.bukkit.util.Vector; +import mineplex.core.common.MaterialData; import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilMath; import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.treasure.BlockInfo; import mineplex.core.treasure.Treasure; @@ -20,6 +23,7 @@ public class TreasureRemoveAnimation extends Animation private Random _random = new Random(); private List _otherChests; private int _count = 0; + private List _flowers = new ArrayList<>(); public TreasureRemoveAnimation(Treasure treasure, List otherChests) { @@ -42,6 +46,19 @@ public class TreasureRemoveAnimation extends Animation dropItem(ItemStackFactory.Instance.CreateStack(Material.GOLD_NUGGET, (byte) 0, 1, "DroppedNugget" + _count), info); _count++; } + else if (getTreasure().getTreasureType() == TreasureType.SPRING) + { + // Drops random flower + if (_flowers.size() == 0) + generateFlowerList(); + + int r = UtilMath.random.nextInt(_flowers.size()); + MaterialData materialData = _flowers.get(r); + dropItem(ItemStackFactory.Instance.CreateStack(materialData.getMaterial(), materialData.getData(), 1, "Flower" + _count), info); + _count++; + info.getBlock().setType(Material.AIR); + info.getBlock().setData((byte) 0); + } } else { @@ -60,6 +77,29 @@ public class TreasureRemoveAnimation extends Animation getTreasure().getTreasureManager().addItem(item); } + private void generateFlowerList() + { + _flowers.add(MaterialData.of(Material.LONG_GRASS, (byte) 1)); + _flowers.add(MaterialData.of(Material.LONG_GRASS, (byte) 2)); + _flowers.add(MaterialData.of(Material.DEAD_BUSH, (byte) 0)); + _flowers.add(MaterialData.of(Material.YELLOW_FLOWER, (byte) 0)); + _flowers.add(MaterialData.of(Material.RED_ROSE, (byte) 0)); + _flowers.add(MaterialData.of(Material.RED_ROSE, (byte) 1)); + _flowers.add(MaterialData.of(Material.RED_ROSE, (byte) 2)); + _flowers.add(MaterialData.of(Material.RED_ROSE, (byte) 3)); + _flowers.add(MaterialData.of(Material.RED_ROSE, (byte) 4)); + _flowers.add(MaterialData.of(Material.RED_ROSE, (byte) 5)); + _flowers.add(MaterialData.of(Material.RED_ROSE, (byte) 6)); + _flowers.add(MaterialData.of(Material.RED_ROSE, (byte) 7)); + _flowers.add(MaterialData.of(Material.RED_ROSE, (byte) 8)); + _flowers.add(MaterialData.of(Material.DOUBLE_PLANT, (byte) 0)); + _flowers.add(MaterialData.of(Material.DOUBLE_PLANT, (byte) 1)); + _flowers.add(MaterialData.of(Material.DOUBLE_PLANT, (byte) 2)); + _flowers.add(MaterialData.of(Material.DOUBLE_PLANT, (byte) 3)); + _flowers.add(MaterialData.of(Material.DOUBLE_PLANT, (byte) 4)); + _flowers.add(MaterialData.of(Material.DOUBLE_PLANT, (byte) 5)); + } + @Override protected void onFinish() { From 6a668004e072a8761ffd1df54f69179fc1572a4c Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Fri, 7 Apr 2017 14:06:44 -0300 Subject: [PATCH 55/98] Added game start event to core, to be called inside arcade and handled inside core --- .../core/arcadeevents/CoreGameStartEvent.java | 33 +++++++++++++++++++ .../taunts => arcadeevents}/GameType.java | 2 +- .../core/gadget/event/TauntCommandEvent.java | 2 +- .../gadget/gadgets/taunts/EternalTaunt.java | 1 + .../core/gadget/types/TauntGadget.java | 2 +- .../game/arcade/command/TauntCommand.java | 2 +- 6 files changed, 38 insertions(+), 4 deletions(-) create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/arcadeevents/CoreGameStartEvent.java rename Plugins/Mineplex.Core/src/mineplex/core/{gadget/gadgets/taunts => arcadeevents}/GameType.java (95%) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/arcadeevents/CoreGameStartEvent.java b/Plugins/Mineplex.Core/src/mineplex/core/arcadeevents/CoreGameStartEvent.java new file mode 100644 index 000000000..c9ca0757c --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/arcadeevents/CoreGameStartEvent.java @@ -0,0 +1,33 @@ +package mineplex.core.arcadeevents; + +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; + +public class CoreGameStartEvent extends Event +{ + + private static final HandlerList handlers = new HandlerList(); + + private GameType _gameType; + + public CoreGameStartEvent(GameType gameType) + { + _gameType = gameType; + } + + public GameType getGameType() + { + return _gameType; + } + + public HandlerList getHandlers() + { + return handlers; + } + + public static HandlerList getHandlerList() + { + return handlers; + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/taunts/GameType.java b/Plugins/Mineplex.Core/src/mineplex/core/arcadeevents/GameType.java similarity index 95% rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/taunts/GameType.java rename to Plugins/Mineplex.Core/src/mineplex/core/arcadeevents/GameType.java index a0fe9230b..2bd7e1ed4 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/taunts/GameType.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/arcadeevents/GameType.java @@ -1,4 +1,4 @@ -package mineplex.core.gadget.gadgets.taunts; +package mineplex.core.arcadeevents; public enum GameType { diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/event/TauntCommandEvent.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/event/TauntCommandEvent.java index e803d54e2..00ef321e2 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/event/TauntCommandEvent.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/event/TauntCommandEvent.java @@ -5,7 +5,7 @@ import org.bukkit.event.Event; import org.bukkit.event.HandlerList; import mineplex.core.common.util.UtilTime; -import mineplex.core.gadget.gadgets.taunts.GameType; +import mineplex.core.arcadeevents.GameType; public class TauntCommandEvent extends Event { diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/taunts/EternalTaunt.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/taunts/EternalTaunt.java index 53e6a7793..f7fa1d10f 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/taunts/EternalTaunt.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/taunts/EternalTaunt.java @@ -18,6 +18,7 @@ import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerPickupItemEvent; import org.bukkit.util.Vector; +import mineplex.core.arcadeevents.GameType; import mineplex.core.common.Rank; import mineplex.core.common.util.C; import mineplex.core.common.util.F; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/TauntGadget.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/TauntGadget.java index 0cca83b9f..85074ed29 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/TauntGadget.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/TauntGadget.java @@ -13,7 +13,7 @@ import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import mineplex.core.gadget.GadgetManager; -import mineplex.core.gadget.gadgets.taunts.GameType; +import mineplex.core.arcadeevents.GameType; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/command/TauntCommand.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/command/TauntCommand.java index bc17eb83d..cd3a1a3ff 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/command/TauntCommand.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/command/TauntCommand.java @@ -9,7 +9,7 @@ import mineplex.core.common.Rank; import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilTime; import mineplex.core.gadget.event.TauntCommandEvent; -import mineplex.core.gadget.gadgets.taunts.GameType; +import mineplex.core.arcadeevents.GameType; import mineplex.minecraft.game.core.combat.CombatManager; import nautilus.game.arcade.ArcadeManager; From 30215aea40a495f7d66b701000cbae9615419f9c Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Fri, 7 Apr 2017 14:08:12 -0300 Subject: [PATCH 56/98] Added docs --- .../mineplex/core/arcadeevents/CoreGameStartEvent.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/arcadeevents/CoreGameStartEvent.java b/Plugins/Mineplex.Core/src/mineplex/core/arcadeevents/CoreGameStartEvent.java index c9ca0757c..4564bb3e8 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/arcadeevents/CoreGameStartEvent.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/arcadeevents/CoreGameStartEvent.java @@ -3,6 +3,11 @@ package mineplex.core.arcadeevents; import org.bukkit.event.Event; import org.bukkit.event.HandlerList; +/** + * This event is called when a game starts in arcade + * It's called inside Arcade and handled inside Core, + * so we can track game events in core + */ public class CoreGameStartEvent extends Event { @@ -10,6 +15,9 @@ public class CoreGameStartEvent extends Event private GameType _gameType; + /** + * @param gameType the type of the game + */ public CoreGameStartEvent(GameType gameType) { _gameType = gameType; From b441dc5edf197c621c85de858a0421ebc1f846e3 Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Fri, 7 Apr 2017 14:12:23 -0300 Subject: [PATCH 57/98] Calls event when arcade game starts --- .../src/nautilus/game/arcade/game/Game.java | 22 ++++++++++++------- 1 file changed, 14 insertions(+), 8 deletions(-) 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 c9f13d3ef..89181251c 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 @@ -13,9 +13,9 @@ import java.util.Optional; import java.util.Set; import java.util.UUID; -import mineplex.core.lifetimes.Lifetimed; -import mineplex.core.lifetimes.ListenerComponent; -import mineplex.core.lifetimes.PhasedLifetime; +import net.minecraft.server.v1_8_R3.EntityItem; +import net.minecraft.server.v1_8_R3.PacketPlayInUseEntity; + import org.apache.commons.lang3.tuple.Triple; import org.bukkit.Bukkit; import org.bukkit.ChatColor; @@ -33,7 +33,6 @@ import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.HandlerList; -import org.bukkit.event.Listener; import org.bukkit.event.entity.EntityDamageEvent; import org.bukkit.event.entity.FoodLevelChangeEvent; import org.bukkit.event.entity.ItemSpawnEvent; @@ -51,6 +50,7 @@ import com.mojang.authlib.GameProfile; import mineplex.core.Managers; import mineplex.core.antihack.AntiHack; +import mineplex.core.arcadeevents.CoreGameStartEvent; import mineplex.core.command.CommandCenter; import mineplex.core.common.Rank; import mineplex.core.common.util.C; @@ -67,8 +67,10 @@ import mineplex.core.common.util.UtilTime; import mineplex.core.disguise.disguises.DisguisePlayer; import mineplex.core.elo.EloPlayer; import mineplex.core.elo.EloTeam; -import mineplex.core.gadget.types.GadgetType; import mineplex.core.itemstack.ItemBuilder; +import mineplex.core.lifetimes.Lifetimed; +import mineplex.core.lifetimes.ListenerComponent; +import mineplex.core.lifetimes.PhasedLifetime; import mineplex.core.packethandler.IPacketHandler; import mineplex.core.packethandler.PacketInfo; import mineplex.core.updater.UpdateType; @@ -89,7 +91,6 @@ import nautilus.game.arcade.game.games.build.Build; import nautilus.game.arcade.game.games.draw.Draw; import nautilus.game.arcade.game.games.speedbuilders.SpeedBuilders; import nautilus.game.arcade.game.modules.Module; -import nautilus.game.arcade.game.modules.compass.CompassModule; import nautilus.game.arcade.kit.ChampionsKit; import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.KitAvailability; @@ -110,8 +111,6 @@ import nautilus.game.arcade.stats.StatTracker; import nautilus.game.arcade.stats.WinStatTracker; import nautilus.game.arcade.wineffect.WinEffectManager; import nautilus.game.arcade.world.WorldData; -import net.minecraft.server.v1_8_R3.EntityItem; -import net.minecraft.server.v1_8_R3.PacketPlayInUseEntity; public abstract class Game extends ListenerComponent implements Lifetimed { @@ -746,6 +745,13 @@ public abstract class Game extends ListenerComponent implements Lifetimed UtilServer.getServer().getPluginManager().callEvent(stateEvent); System.out.println(GetName() + " state set to " + state.toString()); + + if (state.equals(GameState.Prepare)) + { + mineplex.core.arcadeevents.GameType gameType = mineplex.core.arcadeevents.GameType.valueOf(GetType().toString().toUpperCase());; + CoreGameStartEvent coreGameStartEvent = new CoreGameStartEvent(gameType); + UtilServer.getServer().getPluginManager().callEvent(coreGameStartEvent); + } } public void SetStateTime(long time) From 8bcb5bc94859bf91e9fbb44e91a6d286fa7abf97 Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Fri, 7 Apr 2017 14:13:53 -0300 Subject: [PATCH 58/98] Added event to be called when game stops --- .../core/arcadeevents/CoreGameStopEvent.java | 41 +++++++++++++++++++ .../src/nautilus/game/arcade/game/Game.java | 9 +++- 2 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/arcadeevents/CoreGameStopEvent.java diff --git a/Plugins/Mineplex.Core/src/mineplex/core/arcadeevents/CoreGameStopEvent.java b/Plugins/Mineplex.Core/src/mineplex/core/arcadeevents/CoreGameStopEvent.java new file mode 100644 index 000000000..2548d055e --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/arcadeevents/CoreGameStopEvent.java @@ -0,0 +1,41 @@ +package mineplex.core.arcadeevents; + +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; + +/** + * This event is called when a game stops in arcade + * It's called inside Arcade and handled inside Core, + * so we can track game events in core + */ +public class CoreGameStopEvent extends Event +{ + + private static final HandlerList handlers = new HandlerList(); + + private GameType _gameType; + + /** + * @param gameType the type of the game + */ + public CoreGameStopEvent(GameType gameType) + { + _gameType = gameType; + } + + public GameType getGameType() + { + return _gameType; + } + + public HandlerList getHandlers() + { + return handlers; + } + + public static HandlerList getHandlerList() + { + return handlers; + } + +} 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 89181251c..8b49df9d8 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 @@ -51,6 +51,7 @@ import com.mojang.authlib.GameProfile; import mineplex.core.Managers; import mineplex.core.antihack.AntiHack; import mineplex.core.arcadeevents.CoreGameStartEvent; +import mineplex.core.arcadeevents.CoreGameStopEvent; import mineplex.core.command.CommandCenter; import mineplex.core.common.Rank; import mineplex.core.common.util.C; @@ -745,13 +746,19 @@ public abstract class Game extends ListenerComponent implements Lifetimed UtilServer.getServer().getPluginManager().callEvent(stateEvent); System.out.println(GetName() + " state set to " + state.toString()); - + if (state.equals(GameState.Prepare)) { mineplex.core.arcadeevents.GameType gameType = mineplex.core.arcadeevents.GameType.valueOf(GetType().toString().toUpperCase());; CoreGameStartEvent coreGameStartEvent = new CoreGameStartEvent(gameType); UtilServer.getServer().getPluginManager().callEvent(coreGameStartEvent); } + else if (state.equals(GameState.End)) + { + mineplex.core.arcadeevents.GameType gameType = mineplex.core.arcadeevents.GameType.valueOf(GetType().toString().toUpperCase());; + CoreGameStopEvent coreGameStopEvent = new CoreGameStopEvent(gameType); + UtilServer.getServer().getPluginManager().callEvent(coreGameStopEvent); + } } public void SetStateTime(long time) From e4fc53d5cef9893b1ebb00f8828fa40606e5d044 Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Fri, 7 Apr 2017 17:46:53 -0300 Subject: [PATCH 59/98] Removed flower trail from games --- .../particle/spring/ParticleSpringHalo.java | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/spring/ParticleSpringHalo.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/spring/ParticleSpringHalo.java index 713df4199..cab1f0ac1 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/spring/ParticleSpringHalo.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/spring/ParticleSpringHalo.java @@ -13,6 +13,8 @@ import org.bukkit.event.EventHandler; import org.bukkit.event.player.PlayerMoveEvent; import org.bukkit.inventory.ItemStack; +import mineplex.core.arcadeevents.CoreGameStartEvent; +import mineplex.core.arcadeevents.CoreGameStopEvent; import mineplex.core.common.util.C; import mineplex.core.common.util.LineFormat; import mineplex.core.common.util.RGBData; @@ -34,6 +36,7 @@ public class ParticleSpringHalo extends ParticleGadget private Map _effects = new HashMap<>(); private List _springHaloData = new ArrayList<>(); private Map> _playerSpringHaloData = new HashMap<>(); + private boolean _enableTrail = true; public ParticleSpringHalo(GadgetManager manager) { @@ -101,6 +104,9 @@ public class ParticleSpringHalo extends ParticleGadget if (!isActive(event.getPlayer())) return; + if (!_enableTrail) + return; + Player player = event.getPlayer(); Block block = event.getFrom().getBlock(); @@ -163,4 +169,16 @@ public class ParticleSpringHalo extends ParticleGadget } } + @EventHandler + public void onGameStart(CoreGameStartEvent event) + { + _enableTrail = false; + } + + @EventHandler + public void onGameEnd(CoreGameStopEvent event) + { + _enableTrail = true; + } + } From 1f0a22eb9424a8ef2783a10a511be7ee3e426792 Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Sat, 8 Apr 2017 22:58:14 -0300 Subject: [PATCH 60/98] Stops balloons from 'growing up' --- .../mineplex/core/gadget/gadgets/balloons/BalloonItem.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/balloons/BalloonItem.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/balloons/BalloonItem.java index be3382dc6..8f4530c2b 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/balloons/BalloonItem.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/balloons/BalloonItem.java @@ -58,6 +58,7 @@ public class BalloonItem extends BalloonGadget { Zombie zombie = player.getWorld().spawn(player.getLocation(), Zombie.class); zombie.setBaby(true); + ((Ageable) zombie).setAgeLock(true); UtilEnt.vegetate(zombie); UtilEnt.silence(zombie, true); addEntity(player, zombie); @@ -68,7 +69,10 @@ public class BalloonItem extends BalloonGadget Entity entity = player.getWorld().spawnEntity(player.getLocation(), _balloonType.getEntityType()); if (_balloonType.isBaby() && entity instanceof Ageable) + { ((Ageable) entity).setBaby(); + ((Ageable) entity).setAgeLock(true); + } UtilEnt.vegetate(entity); UtilEnt.silence(entity, true); addEntity(player, entity); From 6f1c06218284ecb8e92a2cbda3ff2491ed884a71 Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Sat, 8 Apr 2017 23:06:55 -0300 Subject: [PATCH 61/98] Removed GameType, using GameDisplay instead --- .../core/arcadeevents/CoreGameStartEvent.java | 14 ++-- .../core/arcadeevents/CoreGameStopEvent.java | 14 ++-- .../mineplex/core/arcadeevents/GameType.java | 84 ------------------- .../core/gadget/event/TauntCommandEvent.java | 12 +-- .../gadget/gadgets/taunts/EternalTaunt.java | 4 +- .../core/gadget/types/TauntGadget.java | 10 +-- .../game/arcade/command/TauntCommand.java | 14 +--- .../src/nautilus/game/arcade/game/Game.java | 6 +- 8 files changed, 35 insertions(+), 123 deletions(-) delete mode 100644 Plugins/Mineplex.Core/src/mineplex/core/arcadeevents/GameType.java diff --git a/Plugins/Mineplex.Core/src/mineplex/core/arcadeevents/CoreGameStartEvent.java b/Plugins/Mineplex.Core/src/mineplex/core/arcadeevents/CoreGameStartEvent.java index 4564bb3e8..2a6fd4fc6 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/arcadeevents/CoreGameStartEvent.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/arcadeevents/CoreGameStartEvent.java @@ -3,6 +3,8 @@ package mineplex.core.arcadeevents; import org.bukkit.event.Event; import org.bukkit.event.HandlerList; +import mineplex.core.game.GameDisplay; + /** * This event is called when a game starts in arcade * It's called inside Arcade and handled inside Core, @@ -13,19 +15,19 @@ public class CoreGameStartEvent extends Event private static final HandlerList handlers = new HandlerList(); - private GameType _gameType; + private GameDisplay _gameDisplay; /** - * @param gameType the type of the game + * @param gameDisplay the type of the game */ - public CoreGameStartEvent(GameType gameType) + public CoreGameStartEvent(GameDisplay gameDisplay) { - _gameType = gameType; + _gameDisplay = gameDisplay; } - public GameType getGameType() + public GameDisplay getGameDisplay() { - return _gameType; + return _gameDisplay; } public HandlerList getHandlers() diff --git a/Plugins/Mineplex.Core/src/mineplex/core/arcadeevents/CoreGameStopEvent.java b/Plugins/Mineplex.Core/src/mineplex/core/arcadeevents/CoreGameStopEvent.java index 2548d055e..6c4729ca5 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/arcadeevents/CoreGameStopEvent.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/arcadeevents/CoreGameStopEvent.java @@ -3,6 +3,8 @@ package mineplex.core.arcadeevents; import org.bukkit.event.Event; import org.bukkit.event.HandlerList; +import mineplex.core.game.GameDisplay; + /** * This event is called when a game stops in arcade * It's called inside Arcade and handled inside Core, @@ -13,19 +15,19 @@ public class CoreGameStopEvent extends Event private static final HandlerList handlers = new HandlerList(); - private GameType _gameType; + private GameDisplay _gameDisplay; /** - * @param gameType the type of the game + * @param gameDisplay the type of the game */ - public CoreGameStopEvent(GameType gameType) + public CoreGameStopEvent(GameDisplay gameDisplay) { - _gameType = gameType; + _gameDisplay = gameDisplay; } - public GameType getGameType() + public GameDisplay getGameDisplay() { - return _gameType; + return _gameDisplay; } public HandlerList getHandlers() diff --git a/Plugins/Mineplex.Core/src/mineplex/core/arcadeevents/GameType.java b/Plugins/Mineplex.Core/src/mineplex/core/arcadeevents/GameType.java deleted file mode 100644 index 2bd7e1ed4..000000000 --- a/Plugins/Mineplex.Core/src/mineplex/core/arcadeevents/GameType.java +++ /dev/null @@ -1,84 +0,0 @@ -package mineplex.core.arcadeevents; - -public enum GameType -{ - - BACONBRAWL, - BARBARIANS, - BASKETBALL, - BOSSBATTLES, - BRIDGE, - CASTLESIEGE, - CHAMPIONSCTF, - CHAMPIONSDOMINATE, - CHAMPIONSTDM, - CHRISTMAS, - DEATHTAG, - DRAGONESCAPE, - DRAGONESCAPETEAMS, - DRAGONRIDERS, - DRAGONS, - DRAGONSTEAMS, - DRAW, - ELYTRARINGS, - EVOLUTION, - GRAVITY, - HALLOWEEN, - HALLOWEEN2016, - HIDESEEK, - HOLEINTHEWALL, - HORSE, - LOBBERS, - MICRO, - MILKCOW, - MINESTRIKE, - BAWKBAWKBATTLES, - MINECRAFTLEAGUE, - OLDMINEWARE, - PAINTBALL, - QUIVER, - QUIVERPAYLOAD, - QUIVERTEAMS, - RUNNER, - SEARCHANDDESTROY, - SHEEP, - TYPEWARS, - SMASH, - SMASHDOMINATION, - SMASHTEAMS, - SNAKE, - SNEAKYASSASSINS, - SNOWFIGHT, - SPEEDBUILDERS, - SPLEEF, - SPLEEFTEAMS, - SQUIDSHOOTER, - STACKER, - SURVIVALGAMES, - SURVIVALGAMESTEAMS, - TUG, - TURFWARS, - UHC, - UHCSOLO, - UHCSOLOSPEED, - UHCTEAMSSPEED, - WITHERASSAULT, - WIZARDS, - ZOMBIESURVIVAL, - BUILD, - BUILDMAVERICKS, - CARDS, - SKYWARS, - SKYWARSTEAMS, - MONSTERMAZE, - MONSTERLEAGUE, - GLADIATORS, - SKYFALL, - SKYFALLTEAMS, - BOUNCYBALLS, - VALENTINES, - EVENT, - BRAWL, - NONE - -} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/event/TauntCommandEvent.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/event/TauntCommandEvent.java index 00ef321e2..ef6624b46 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/event/TauntCommandEvent.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/event/TauntCommandEvent.java @@ -5,7 +5,7 @@ import org.bukkit.event.Event; import org.bukkit.event.HandlerList; import mineplex.core.common.util.UtilTime; -import mineplex.core.arcadeevents.GameType; +import mineplex.core.game.GameDisplay; public class TauntCommandEvent extends Event { @@ -18,16 +18,16 @@ public class TauntCommandEvent extends Event private boolean _spectator; private long _lastPvp; private TauntState _state = TauntState.NONE; - private GameType _gameType; + private GameDisplay _gameDisplay; - public TauntCommandEvent(Player player, boolean gameInProgress, boolean alive, boolean spectator, long lastPvp, GameType gameType) + public TauntCommandEvent(Player player, boolean gameInProgress, boolean alive, boolean spectator, long lastPvp, GameDisplay gameDisplay) { _player = player; _gameInProgress = gameInProgress; _alive = alive; _spectator = spectator; _lastPvp = lastPvp; - _gameType = gameType; + _gameDisplay = gameDisplay; } public Player getPlayer() @@ -60,9 +60,9 @@ public class TauntCommandEvent extends Event return _state; } - public GameType getGameType() + public GameDisplay getGameDisplay() { - return _gameType; + return _gameDisplay; } public void setState(TauntState state) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/taunts/EternalTaunt.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/taunts/EternalTaunt.java index f7fa1d10f..103efacd2 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/taunts/EternalTaunt.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/taunts/EternalTaunt.java @@ -18,7 +18,6 @@ import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerPickupItemEvent; import org.bukkit.util.Vector; -import mineplex.core.arcadeevents.GameType; import mineplex.core.common.Rank; import mineplex.core.common.util.C; import mineplex.core.common.util.F; @@ -31,6 +30,7 @@ import mineplex.core.events.EnableArcadeSpawnEvent; import mineplex.core.gadget.GadgetManager; import mineplex.core.gadget.gadgets.morph.managers.UtilMorph; import mineplex.core.gadget.types.TauntGadget; +import mineplex.core.game.GameDisplay; import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; @@ -54,7 +54,7 @@ public class EternalTaunt extends TauntGadget setPvpCooldown(PVP_COOLDOWN); setShouldPlay(true); setEventType(UpdateType.FAST); - addDisabledGames(GameType.SMASH, GameType.SMASHTEAMS, GameType.SMASHDOMINATION); + addDisabledGames(GameDisplay.Smash, GameDisplay.SmashTeams, GameDisplay.SmashDomination); } @Override diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/TauntGadget.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/TauntGadget.java index 85074ed29..991a7425b 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/TauntGadget.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/TauntGadget.java @@ -13,7 +13,7 @@ import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import mineplex.core.gadget.GadgetManager; -import mineplex.core.arcadeevents.GameType; +import mineplex.core.game.GameDisplay; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; @@ -32,7 +32,7 @@ public abstract class TauntGadget extends Gadget /** Sets when the taunt will run, if set above */ private UpdateType _updateType = UpdateType.TICK; /** List of games where this item is disabled */ - private List _disabledGames = new ArrayList<>(); + private List _disabledGames = new ArrayList<>(); /** The ticks that passed since the player started the effect */ private Map _ticksPerPlayer = new HashMap<>(); @@ -119,7 +119,7 @@ public abstract class TauntGadget extends Gadget _updateType = updateType; } - public void addDisabledGames(GameType... disabledGames) + public void addDisabledGames(GameDisplay... disabledGames) { _disabledGames.addAll(Arrays.asList(disabledGames)); } @@ -129,9 +129,9 @@ public abstract class TauntGadget extends Gadget return _canPlayWithPvp; } - public boolean isGameDisabled(GameType gameType) + public boolean isGameDisabled(GameDisplay gameDisplay) { - return _disabledGames.contains(gameType); + return _disabledGames.contains(gameDisplay); } public long getPvpCooldown() diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/command/TauntCommand.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/command/TauntCommand.java index cd3a1a3ff..af64ce746 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/command/TauntCommand.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/command/TauntCommand.java @@ -7,9 +7,8 @@ import mineplex.core.Managers; import mineplex.core.command.CommandBase; import mineplex.core.common.Rank; import mineplex.core.common.util.UtilPlayer; -import mineplex.core.common.util.UtilTime; import mineplex.core.gadget.event.TauntCommandEvent; -import mineplex.core.arcadeevents.GameType; +import mineplex.core.game.GameDisplay; import mineplex.minecraft.game.core.combat.CombatManager; import nautilus.game.arcade.ArcadeManager; @@ -29,21 +28,16 @@ public class TauntCommand extends CommandBase @Override public void Execute(Player player, String[] args) { - boolean pvp = false; CombatManager combatManager = Managers.get(CombatManager.class); - if (combatManager != null) - { - pvp = UtilTime.elapsed(combatManager.Get(player).GetLastCombatEngaged(), 5000 * 60); - } Game game = _arcadeManager.GetGame(); - GameType gameType = GameType.NONE; + GameDisplay gameDisplay = null; if (game != null) { - gameType = GameType.valueOf(game.GetType().toString().toUpperCase()); + gameDisplay = game.GetType().getDisplay(); } TauntCommandEvent event = new TauntCommandEvent(player, _arcadeManager.isGameInProgress(), _arcadeManager.GetGame().IsAlive(player), UtilPlayer.isSpectator(player), combatManager.Get(player).GetLastCombatEngaged(), - gameType); + gameDisplay); Bukkit.getPluginManager().callEvent(event); } 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 8b49df9d8..076e12136 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 @@ -749,14 +749,12 @@ public abstract class Game extends ListenerComponent implements Lifetimed if (state.equals(GameState.Prepare)) { - mineplex.core.arcadeevents.GameType gameType = mineplex.core.arcadeevents.GameType.valueOf(GetType().toString().toUpperCase());; - CoreGameStartEvent coreGameStartEvent = new CoreGameStartEvent(gameType); + CoreGameStartEvent coreGameStartEvent = new CoreGameStartEvent(GetType().getDisplay()); UtilServer.getServer().getPluginManager().callEvent(coreGameStartEvent); } else if (state.equals(GameState.End)) { - mineplex.core.arcadeevents.GameType gameType = mineplex.core.arcadeevents.GameType.valueOf(GetType().toString().toUpperCase());; - CoreGameStopEvent coreGameStopEvent = new CoreGameStopEvent(gameType); + CoreGameStopEvent coreGameStopEvent = new CoreGameStopEvent(GetType().getDisplay()); UtilServer.getServer().getPluginManager().callEvent(coreGameStopEvent); } } From de46f2db70f4883043ad3bbeef5c200b1d2eeabf Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Sat, 8 Apr 2017 23:09:10 -0300 Subject: [PATCH 62/98] Should have been added in the last commit --- .../Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java index 37b574468..7d454b5cd 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java @@ -1381,7 +1381,7 @@ public class GadgetManager extends MiniPlugin if (!event.isGameInProgress() && event.getState().equals(TauntCommandEvent.TauntState.NONE)) event.setState(TauntCommandEvent.TauntState.NOT_IN_GAME); - if (taunt.isGameDisabled(event.getGameType()) && event.getState().equals(TauntCommandEvent.TauntState.NONE)) + if (taunt.isGameDisabled(event.getGameDisplay()) && event.getState().equals(TauntCommandEvent.TauntState.NONE)) event.setState(TauntCommandEvent.TauntState.GAME_DISABLED); if (!event.isAlive() && event.getState().equals(TauntCommandEvent.TauntState.NONE)) From 7db5805f166cea05b7944e900b43a91bf2a4f2e2 Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Sat, 8 Apr 2017 23:11:41 -0300 Subject: [PATCH 63/98] Fixed lenght --- .../mineplex/staffServer/customerSupport/CustomerSupport.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/customerSupport/CustomerSupport.java b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/customerSupport/CustomerSupport.java index d735896a8..17cc91293 100644 --- a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/customerSupport/CustomerSupport.java +++ b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/customerSupport/CustomerSupport.java @@ -335,9 +335,9 @@ public class CustomerSupport extends MiniPlugin implements ResultSetCallable { if (transaction.Coins == 0 && transaction.Gems == 0) { - if (transaction.SalesPackageName.split(" ").length == 4) + if (transaction.SalesPackageName.split(" ").length == 3) springChestsReceived += Integer.parseInt(transaction.SalesPackageName.split(" ")[3]); - else if (transaction.SalesPackageName.split(" ").length == 3) + else if (transaction.SalesPackageName.split(" ").length == 2) springChestsReceived += 1; } } From 4388a7f70e1330521f73179bf2a70cb8dbe7c4de Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Sat, 8 Apr 2017 23:17:39 -0300 Subject: [PATCH 64/98] Changed lenght (missed one thing) --- .../mineplex/staffServer/customerSupport/CustomerSupport.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/customerSupport/CustomerSupport.java b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/customerSupport/CustomerSupport.java index 17cc91293..9bb7990de 100644 --- a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/customerSupport/CustomerSupport.java +++ b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/customerSupport/CustomerSupport.java @@ -336,7 +336,7 @@ public class CustomerSupport extends MiniPlugin implements ResultSetCallable if (transaction.Coins == 0 && transaction.Gems == 0) { if (transaction.SalesPackageName.split(" ").length == 3) - springChestsReceived += Integer.parseInt(transaction.SalesPackageName.split(" ")[3]); + springChestsReceived += Integer.parseInt(transaction.SalesPackageName.split(" ")[2]); else if (transaction.SalesPackageName.split(" ").length == 2) springChestsReceived += 1; } From 0a51bcd60714112a8243d66ee37813616d6bbf06 Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Tue, 11 Apr 2017 16:10:59 -0300 Subject: [PATCH 65/98] Easter, not eater --- Plugins/Mineplex.Core/src/mineplex/core/pet/PetType.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/pet/PetType.java b/Plugins/Mineplex.Core/src/mineplex/core/pet/PetType.java index 3f54bc966..6503db11e 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/pet/PetType.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/pet/PetType.java @@ -34,7 +34,7 @@ public enum PetType CUPID_PET("Cupid", EntityType.ZOMBIE, -17, "Sometimes you need a little extra help finding true Love. Why not have Cupid help you out?", Material.BOW, (byte) 0), TRUE_LOVE_PET("True Love", EntityType.ZOMBIE, -14, "Sometimes love means chasing the person of your dreams until you catch them.", Material.APPLE, YearMonth.of(2017, Month.FEBRUARY)), LEPRECHAUN("Leprechaun", EntityType.ZOMBIE, -18, "Apparently this little guy lost his Pot of Gold in the war.", SkinData.LEPRECHAUN.getSkull()), - KILLER_BUNNY("Killer Bunny", EntityType.RABBIT, -19, "The Eater Bunny's less talked about brother Devin was a bit less fun to hang out with.", Material.RABBIT_FOOT, (byte) 0) + KILLER_BUNNY("Killer Bunny", EntityType.RABBIT, -19, "The Easter Bunny's less talked about brother Devin was a bit less fun to hang out with.", Material.RABBIT_FOOT, (byte) 0) // TODO CHECK IF LOBBY IS 1.9+ // Not in this update //SHULKER("Shulker Pet", EntityType.BAT, 0, "Is it a turtle or an alien? Either way its shot can be really UPLIFTING.") From 2d61dffaeae2c702cf8f9aeb98ff59323893ece1 Mon Sep 17 00:00:00 2001 From: AlexTheCoder Date: Tue, 11 Apr 2017 19:57:10 -0400 Subject: [PATCH 66/98] Implement an easter egg hunt of epic proportions --- .../src/mineplex/core/common/util/F.java | 5 + .../src/mineplex/hub/HubManager.java | 26 +- .../mineplex/hub/commands/EggAddCommand.java | 27 ++ .../mineplex/hub/modules/EasterEggHunt.java | 347 ++++++++++++++++++ 4 files changed, 397 insertions(+), 8 deletions(-) create mode 100644 Plugins/Mineplex.Hub/src/mineplex/hub/commands/EggAddCommand.java create mode 100644 Plugins/Mineplex.Hub/src/mineplex/hub/modules/EasterEggHunt.java diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/F.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/F.java index 49da7d9cf..4240b9a9b 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/F.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/F.java @@ -57,6 +57,11 @@ public class F { return C.mElem + elem + C.mBody; } + + public static String count(int elem) + { + return count(String.valueOf(elem)); + } public static String count(String elem) { diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java index c01ec5d2b..1e7dfd060 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java @@ -4,13 +4,6 @@ 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; @@ -48,7 +41,6 @@ import mineplex.core.account.CoreClient; import mineplex.core.account.CoreClientManager; import mineplex.core.achievement.AchievementManager; import mineplex.core.antispam.AntiSpamManager; -import mineplex.core.aprilfools.AprilFoolsManager; import mineplex.core.benefit.BenefitManager; import mineplex.core.blockrestore.BlockRestore; import mineplex.core.bonuses.BonusManager; @@ -121,6 +113,7 @@ import mineplex.hub.commands.ForcefieldRadius; import mineplex.hub.commands.GadgetToggle; import mineplex.hub.commands.GameModeCommand; import mineplex.hub.commands.NewsCommand; +import mineplex.hub.modules.EasterEggHunt; import mineplex.hub.modules.ForcefieldManager; import mineplex.hub.modules.HubVisibilityManager; import mineplex.hub.modules.JumpManager; @@ -138,6 +131,12 @@ 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; public class HubManager extends MiniClientPlugin implements IChatMessageFormatter { @@ -177,6 +176,8 @@ public class HubManager extends MiniClientPlugin implements IChatMess // private TrickOrTreatManager _trickOrTreatManager; private MavericksManager _mavericksManager; private final TwoFactorAuth _twofactor = Managers.require(TwoFactorAuth.class); + + private HologramManager _hologramManager; private Location _spawn; @@ -283,6 +284,10 @@ public class HubManager extends MiniClientPlugin implements IChatMess new SalesAnnouncementManager(plugin); new CommunityManager(plugin, _clientManager); + + _hologramManager = hologramManager; + + new EasterEggHunt(plugin, _clientManager); ScoreboardManager scoreboardManager = new ScoreboardManager(plugin) { @@ -781,6 +786,11 @@ public class HubManager extends MiniClientPlugin implements IChatMess { return _disguiseManager; } + + public HologramManager getHologram() + { + return _hologramManager; + } public GadgetManager GetGadget() { diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/commands/EggAddCommand.java b/Plugins/Mineplex.Hub/src/mineplex/hub/commands/EggAddCommand.java new file mode 100644 index 000000000..df33b562b --- /dev/null +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/commands/EggAddCommand.java @@ -0,0 +1,27 @@ +package mineplex.hub.commands; + +import org.bukkit.entity.Player; + +import mineplex.core.command.CommandBase; +import mineplex.core.common.Rank; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import mineplex.hub.modules.EasterEggHunt; + +public class EggAddCommand extends CommandBase +{ + public EggAddCommand(EasterEggHunt plugin) + { + super(plugin, Rank.ADMIN, "addegg"); + } + + @Override + public void Execute(Player caller, String[] args) + { + if (args.length < 1) + { + UtilPlayer.message(caller, F.main(Plugin.getName(), "Usage: /addegg ")); + } + Plugin.addEgg(caller, args[0]); + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/EasterEggHunt.java b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/EasterEggHunt.java new file mode 100644 index 000000000..bc92b49cf --- /dev/null +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/EasterEggHunt.java @@ -0,0 +1,347 @@ +package mineplex.hub.modules; + +import java.sql.Connection; +import java.sql.Date; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.time.LocalDate; +import java.time.ZoneId; +import java.util.ArrayList; +import java.util.List; +import java.util.UUID; + +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.ArmorStand; +import org.bukkit.entity.Entity; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.player.PlayerInteractAtEntityEvent; +import org.bukkit.inventory.ItemStack; +import org.bukkit.plugin.java.JavaPlugin; +import org.bukkit.util.Vector; + +import mineplex.core.Managers; +import mineplex.core.MiniDbClientPlugin; +import mineplex.core.account.CoreClientManager; +import mineplex.core.common.currency.GlobalCurrency; +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.donation.DonationManager; +import mineplex.core.hologram.Hologram; +import mineplex.core.inventory.InventoryManager; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.hub.HubManager; +import mineplex.hub.commands.EggAddCommand; +import mineplex.hub.modules.EasterEggHunt.EasterEggHunter; +import mineplex.serverdata.database.DBPool; + +public class EasterEggHunt extends MiniDbClientPlugin +{ + private static final int SHARD_REWARD = 500; + private static final String ITEM_REWARD = "Omega Chest"; + private static final int EGGS_PER_DAY = 30; + + private final DonationManager _donationManager; + private final InventoryManager _inventoryManager; + private final List _possibleEggs; + + public EasterEggHunt(JavaPlugin plugin, CoreClientManager clientManager) + { + super("Egg Hunt", plugin, clientManager); + + _donationManager = Managers.get(DonationManager.class); + _inventoryManager = Managers.get(InventoryManager.class); + + _possibleEggs = new ArrayList<>(); + runAsync(() -> + { + final List fetch = new ArrayList<>(); + loadEggs(fetch); + runSync(() -> + { + fetch.stream().peek(EasterEgg::setup).forEach(_possibleEggs::add); + }); + }); + + addCommand(new EggAddCommand(this)); + } + + private String vecToStr(Vector vec) + { + return vec.getX() + "," + vec.getY() + "," + vec.getZ(); + } + + private Vector strToVec(String str) + { + String[] coords = str.split(","); + double x = Double.parseDouble(coords[0]); + double y = Double.parseDouble(coords[0]); + double z = Double.parseDouble(coords[0]); + + return new Vector(x, y, z); + } + + private void loadEggs(List eggs) + { + try (Connection c = DBPool.getAccount().getConnection()) + { + ResultSet rs = c.prepareStatement("SELECT * FROM easterEggs;").executeQuery(); + while (rs.next()) + { + EasterEgg egg = new EasterEgg(rs.getInt("id"), strToVec(rs.getString("eggLocation")), rs.getDate("eggDate")); + eggs.add(egg); + } + } + catch (SQLException e) + { + e.printStackTrace(); + } + } + + private void addEggToInventory(int accountId, int eggId) + { + runAsync(() -> + { + try (Connection c = DBPool.getAccount().getConnection()) + { + PreparedStatement ps = c.prepareStatement("INSERT INTO accountEggs (accountId, eggId) VALUES (?, ?);"); + ps.setInt(1, accountId); + ps.setInt(2, eggId); + ps.execute(); + } + catch (SQLException e) + { + e.printStackTrace(); + } + }); + } + + @EventHandler + public void interactBlock(PlayerInteractAtEntityEvent event) + { + if (event.getRightClicked() == null) + { + return; + } + + Player player = event.getPlayer(); + + for (EasterEgg egg : _possibleEggs) + { + if (egg.isMe(event.getRightClicked())) + { + findEgg(player, egg.getId()); + break; + } + } + } + + @EventHandler + public void refreshEggs(UpdateEvent event) + { + if (event.getType() == UpdateType.SEC) + { + LocalDate currentDate = LocalDate.now(ZoneId.of("UTC")); + + _possibleEggs.stream().filter(EasterEgg::isSpawned).filter(egg -> + { + LocalDate eggDate = egg.getDate().toLocalDate(); + + return eggDate.getDayOfYear() != currentDate.getDayOfYear(); + }).forEach(egg -> + { + egg.despawn(); + GetValues().forEach(hunter -> hunter.getEggs().remove(egg.getId())); + }); + _possibleEggs.stream().filter(egg -> !egg.isSpawned()).filter(egg -> + { + LocalDate eggDate = egg.getDate().toLocalDate(); + + return eggDate.getDayOfYear() == currentDate.getDayOfYear(); + }).forEach(EasterEgg::spawn); + } + } + + public void addEgg(Player player, String date) + { + final Date parsed = Date.valueOf(date); + final Vector loc = player.getLocation().toVector(); + runAsync(() -> + { + try (Connection c = DBPool.getAccount().getConnection()) + { + PreparedStatement ps = c.prepareStatement("INSERT INTO easterEggs (eggLocation, eggDate) VALUES (?, ?);"); + ps.setString(1, vecToStr(loc)); + ps.setDate(2, parsed); + ps.execute(); + } + catch (SQLException e) + { + e.printStackTrace(); + } + }); + } + + private void findEgg(Player player, Integer eggId) + { + if (Get(player).getEggs().contains(eggId)) + { + UtilPlayer.message(player, F.main(getName(), "You have already found this egg!")); + return; + } + player.playSound(player.getLocation(), Sound.CAT_MEOW, 1, 0.7F); + Get(player).findEgg(eggId); + UtilPlayer.message(player, F.main(getName(), "Found " + F.count(Get(player).getEggs().size()) + "/" + F.count(EGGS_PER_DAY) + " Easter Eggs +" + F.currency(GlobalCurrency.TREASURE_SHARD, SHARD_REWARD) + ".")); + _donationManager.rewardCurrencyUntilSuccess(GlobalCurrency.TREASURE_SHARD, player, "", SHARD_REWARD); + addEggToInventory(ClientManager.getAccountId(player), eggId); + + if (Get(player).getEggs().size() == 1) + { + UtilPlayer.message(player, F.main(getName(), "There are " + F.count(EGGS_PER_DAY) + " hidden " + F.elem("Easter Eggs") + " to find through the lobby each day.")); + UtilPlayer.message(player, F.main(getName(), "Each one is worth " + F.currency(GlobalCurrency.TREASURE_SHARD, SHARD_REWARD) + ".")); + UtilPlayer.message(player, F.main(getName(), "If you find all " + F.count(EGGS_PER_DAY) + " you will receive an " + C.cAqua + "Omega Chest for that day!")); + } + else if (Get(player).getEggs().size() == EGGS_PER_DAY) + { + UtilPlayer.message(player, F.main(getName(), "You have found all the eggs available today!")); + + _inventoryManager.addItemToInventory(success -> + { + if (success) + { + UtilPlayer.message(player, F.main(getName(), "+1 " + C.cAqua + ITEM_REWARD + C.mBody + "!")); + } + else + { + UtilPlayer.message(player, F.main(getName(), "Oh no! An error occurred while trying to give you your chest! Go find a staff member ASAP!")); + } + }, player, ITEM_REWARD, 1); + } + } + + public static class EasterEggHunter + { + private List _found; + + public EasterEggHunter() + { + this(new ArrayList<>()); + } + + public EasterEggHunter(List foundEggs) + { + _found = foundEggs; + } + + public List getEggs() + { + return _found; + } + + public void findEgg(Integer id) + { + _found.add(id); + } + } + + public static class EasterEgg + { + private final Integer _id; + private final Vector _loc; + private final Date _date; + private Location _spawn; + private ArmorStand _stand; + private Hologram _holo; + + public EasterEgg(Integer id, Vector loc, Date date) + { + _id = id; + _loc = loc; + _date = date; + } + + public Integer getId() + { + return _id; + } + + public Date getDate() + { + return _date; + } + + public boolean isSpawned() + { + return _stand != null; + } + + public boolean isMe(Entity e) + { + return isSpawned() && e.getEntityId() == _stand.getEntityId(); + } + + public void setup() + { + _spawn = _loc.toLocation(Managers.get(HubManager.class).GetSpawn().getWorld()); + _stand = null; + _holo = new Hologram(Managers.get(HubManager.class).getHologram(), _spawn.clone().add(0, 1.5, 0), C.cDPurple + C.Scramble + "ABC " + C.cPurpleB + "Easter Egg Hunt" + C.cDPurple + C.Scramble + " ABC"); + _holo.stop(); + } + + public void spawn() + { + if (isSpawned()) + { + return; + } + _stand = (ArmorStand)_spawn.getWorld().spawnEntity(_spawn, EntityType.ARMOR_STAND); + _stand.setItemInHand(new ItemStack(Material.EGG)); + _stand.setVisible(false); + _stand.setBasePlate(false); + _holo.start(); + } + + public void despawn() + { + if (isSpawned()) + { + _stand.remove(); + _stand = null; + _holo.stop(); + } + } + } + + @Override + public String getQuery(int accountId, String uuid, String name) + { + return "SELECT ae.eggId, ee.eggDate FROM accountEggs AS ae INNER JOIN easterEggs AS ee ON ae.eggId=ee.id WHERE ae.accountId=" + accountId + ";"; + } + + @Override + public void processLoginResultSet(String playerName, UUID uuid, int accountId, ResultSet resultSet) throws SQLException + { + List found = new ArrayList<>(); + while (resultSet.next()) + { + if (resultSet.getDate("eggDate").toLocalDate().getDayOfYear() == LocalDate.now(ZoneId.of("UTC")).getDayOfYear()) + { + found.add(resultSet.getInt("eggId")); + } + } + + Set(uuid, new EasterEggHunter(found)); + } + + @Override + protected EasterEggHunter addPlayer(UUID uuid) + { + return new EasterEggHunter(); + } +} \ No newline at end of file From 9a58cd792e23033965bff4bd5dab2795cc0151d4 Mon Sep 17 00:00:00 2001 From: AlexTheCoder Date: Tue, 11 Apr 2017 20:18:09 -0400 Subject: [PATCH 67/98] Implement easter egg baskets in games which can give fantastic rewards --- .../core/achievement/Achievement.java | 7 +++ .../core/achievement/AchievementManager.java | 6 -- .../redis/GiveawayMessageHandler.java | 2 +- .../nautilus/game/arcade/ArcadeManager.java | 2 +- .../game/arcade/managers/HolidayManager.java | 60 ++++++++++++------- 5 files changed, 46 insertions(+), 31 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/achievement/Achievement.java b/Plugins/Mineplex.Core/src/mineplex/core/achievement/Achievement.java index 745df2fee..419b8b977 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/achievement/Achievement.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/achievement/Achievement.java @@ -56,6 +56,13 @@ public enum Achievement "during Thanksgiving 2016!"}, new int[]{200}, AchievementCategory.HOLIDAY), + + GLOBAL_EGG_HUNTER_2017("2017 Egg Hunter", 4000, + new String[]{"Global.Easter Eggs 2017"}, + new String[]{"Find 200 Easter Egg Baskets,", + "during Easter 2017"}, + new int[]{200}, + AchievementCategory.HOLIDAY), //Bridges BRIDGES_WINS("Bridge Champion", 600, diff --git a/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementManager.java b/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementManager.java index 1c2ac0f69..0be8e250e 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementManager.java @@ -208,9 +208,6 @@ public class AchievementManager extends MiniPlugin return level; } - if (sender.getName().equalsIgnoreCase("B2_mp")) - return 101; - if (rank.has(Rank.MODERATOR)) level = Math.max(level, 5); if (rank.has(Rank.SNR_MODERATOR)) @@ -221,9 +218,6 @@ public class AchievementManager extends MiniPlugin level = Math.max(level, 30 + get(sender, Achievement.GLOBAL_GEM_HUNTER).getLevel()); if (rank.has(Rank.OWNER)) level = Math.max(level, 50 + get(sender, Achievement.GLOBAL_GEM_HUNTER).getLevel()); - - if (sender.getName().equalsIgnoreCase("Phinary")) - level = 0; return level; } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/rankGiveaway/redis/GiveawayMessageHandler.java b/Plugins/Mineplex.Core/src/mineplex/core/rankGiveaway/redis/GiveawayMessageHandler.java index ccea12e19..8bf01da12 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/rankGiveaway/redis/GiveawayMessageHandler.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/rankGiveaway/redis/GiveawayMessageHandler.java @@ -50,7 +50,7 @@ public class GiveawayMessageHandler implements CommandCallback String playerName = message.getPlayerName(); int count = message.getEternalCount(); String countString = count + UtilTime.getDayOfMonthSuffix(count); - String chatMessage = C.cPurple + playerName + C.cWhite + " found Eternal Rank in a " + C.cPurple + "Thanksgiving Chicken"; + String chatMessage = C.cPurple + playerName + C.cWhite + " found Eternal Rank in an " + C.cPurple + "Easter Egg Basket"; UtilTextMiddle.display(C.cDPurple + C.Bold + "ETERNAL", chatMessage, 20, 80, 20, UtilServer.getPlayers()); World world = UtilServer.getPlayers().length > 0 ? UtilServer.getPlayers()[0].getWorld() : Bukkit.getWorlds().get(0); LightFlicker lightFlicker = new LightFlicker(world); 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 af4d8cea5..9c6f65117 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java @@ -353,7 +353,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation TitanGiveawayManager titanGiveaway = new TitanGiveawayManager(getPlugin(), clientManager, serverStatusManager); EternalGiveawayManager eternalGiveawayManager = new EternalGiveawayManager(getPlugin(), clientManager, serverStatusManager); - IsHolidayEnabled = false; + IsHolidayEnabled = true; if (IsHolidayEnabled) new HolidayManager(this, titanGiveaway, eternalGiveawayManager); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/HolidayManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/HolidayManager.java index 234e44f46..ce6140e22 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/HolidayManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/HolidayManager.java @@ -97,8 +97,8 @@ public class HolidayManager implements Listener } } - private HolidayType _type = HolidayType.THANKSGIVING; - private String _statName = "Thanksgiving Chickens 2016"; + private HolidayType _type = HolidayType.EASTER; + private String _statName = "Easter Eggs 2017"; private ArcadeManager _arcadeManager; private TitanGiveawayManager _titanManager; @@ -109,7 +109,7 @@ public class HolidayManager implements Listener private HashSet _items = new HashSet<>(); - private HashSet _coins = new HashSet<>(); + private HashSet _shards = new HashSet<>(); private HashSet _gems = new HashSet<>(); private static final double CHEST_CHANCE = 0.001; @@ -478,25 +478,25 @@ public class HolidayManager implements Listener if (player != null && _arcadeManager.GetGame() != null) { _arcadeManager.GetGame().AddStat(player, _statName, 1, false, true); - System.out.println("Recording Pumpkin Break for " + player.getName()); + System.out.println("Recording Holiday Block Break for " + player.getName()); } - //Coins + //Shards for (int i = 0; i < 4 + Math.random() * 8; i++) { - Item coin = block.getWorld().dropItem(block.getLocation().add(0.5, 1, 0.5), - ItemStackFactory.Instance.CreateStack(Material.PRISMARINE_SHARD, (byte) 0, 1, UtilMath.r(999999) + "Coin")); + Item shard = block.getWorld().dropItem(block.getLocation().add(0.5, 1, 0.5), + ItemStackFactory.Instance.CreateStack(Material.PRISMARINE_SHARD, (byte) 0, 1, UtilMath.r(999999) + "Shard")); Vector vel = new Vector( (Math.random() - 0.5) * 0.5, 0.1 + Math.random() * 0.3, (Math.random() - 0.5) * 0.5); - coin.setVelocity(vel); + shard.setVelocity(vel); - coin.setPickupDelay(20); + shard.setPickupDelay(20); - _coins.add(coin); + _shards.add(shard); } //Gems @@ -530,6 +530,20 @@ public class HolidayManager implements Listener } }); }*/ + + // Eternal Giveaway + if (player != null) + { + _eternalGiveawayManager.openPumpkin(player, new Runnable() + { + @Override + public void run() + { + Location location = block.getLocation().add(0.5, 0.5, 0.5); + new EternalGiveawayAnimation(_eternalGiveawayManager, location, 3000L); + } + }); + } if (player != null) { @@ -540,9 +554,9 @@ public class HolidayManager implements Listener if (hasItemsToGivePlayer(TreasureType.HAUNTED.getRewardPool(), player)) { FireworkEffect fireworkEffect = FireworkEffect.builder().with(FireworkEffect.Type.BALL_LARGE) - .withColor(Color.ORANGE).withColor(Color.BLACK).withFade(Color.ORANGE) - .withFade(Color.BLACK).flicker(true).build(); - manager.addItemToInventory(player, "Haunted Chest", 1); + .withColor(Color.LIME).withColor(Color.WHITE).withFade(Color.YELLOW) + .withFade(Color.WHITE).flicker(true).build(); + manager.addItemToInventory(player, "Spring Chest", 1); HalloweenSmashedEffect halloweenSmashedEffect = new HalloweenSmashedEffect(block.getLocation() .add(.5, .5, .5), fireworkEffect, _arcadeManager.getPlugin()); halloweenSmashedEffect.start(); @@ -569,25 +583,25 @@ public class HolidayManager implements Listener if (player != null && _arcadeManager.GetGame() != null) { _arcadeManager.GetGame().AddStat(player, _statName, 1, false, true); - System.out.println("Recording Entity Killong for " + player.getName()); + System.out.println("Recording Entity Killing for " + player.getName()); } //Coins for (int i=0 ; i < 4 + Math.random()*8 ; i++) { - Item coin = entity.getWorld().dropItem(entity.getLocation().add(0.5, 1, 0.5), - ItemStackFactory.Instance.CreateStack(Material.PRISMARINE_SHARD, (byte)0, 1, UtilMath.r(999999) + "Coin")); + Item shard = entity.getWorld().dropItem(entity.getLocation().add(0.5, 1, 0.5), + ItemStackFactory.Instance.CreateStack(Material.PRISMARINE_SHARD, (byte)0, 1, UtilMath.r(999999) + "Shard")); Vector vel = new Vector( (Math.random() - 0.5) * 0.5, 0.1 + Math.random() * 0.3, (Math.random() - 0.5) * 0.5); - coin.setVelocity(vel); + shard.setVelocity(vel); - coin.setPickupDelay(20); + shard.setPickupDelay(20); - _coins.add(coin); + _shards.add(shard); } //Gems @@ -629,12 +643,12 @@ public class HolidayManager implements Listener if (UtilPlayer.isSpectator(event.getPlayer())) return; - if (_coins.contains(event.getItem())) + if (_shards.contains(event.getItem())) { event.setCancelled(true); event.getItem().remove(); - _arcadeManager.GetDonation().rewardCurrency(GlobalCurrency.TREASURE_SHARD, event.getPlayer(), _type + " Coins", 4 * event.getItem().getItemStack().getAmount()); + _arcadeManager.GetDonation().rewardCurrency(GlobalCurrency.TREASURE_SHARD, event.getPlayer(), _type + " Shards", 4 * event.getItem().getItemStack().getAmount()); event.getPlayer().getWorld().playSound(event.getPlayer().getLocation(), Sound.ORB_PICKUP, 1f, 2f); } @@ -660,7 +674,7 @@ public class HolidayManager implements Listener if (event.getType() != UpdateType.FAST) return; - Iterator coinIterator = _coins.iterator(); + Iterator coinIterator = _shards.iterator(); while (coinIterator.hasNext()) { @@ -703,7 +717,7 @@ public class HolidayManager implements Listener @EventHandler public void spawnDebug(PlayerCommandPreprocessEvent event) { - if (event.getPlayer().isOp() && event.getMessage().toLowerCase().startsWith("/pumpkin")) + if (event.getPlayer().isOp() && event.getMessage().toLowerCase().startsWith("/holidayblock")) { spawnSpecialBlock(event.getPlayer().getLocation().getBlock()); event.setCancelled(true); From b511546b363c1f58b214dedf6885eca6f841f02e Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Tue, 11 Apr 2017 22:44:56 -0300 Subject: [PATCH 68/98] Removed age lock from zombie --- .../src/mineplex/core/gadget/gadgets/balloons/BalloonItem.java | 1 - 1 file changed, 1 deletion(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/balloons/BalloonItem.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/balloons/BalloonItem.java index 8f4530c2b..67ea7e618 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/balloons/BalloonItem.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/balloons/BalloonItem.java @@ -58,7 +58,6 @@ public class BalloonItem extends BalloonGadget { Zombie zombie = player.getWorld().spawn(player.getLocation(), Zombie.class); zombie.setBaby(true); - ((Ageable) zombie).setAgeLock(true); UtilEnt.vegetate(zombie); UtilEnt.silence(zombie, true); addEntity(player, zombie); From f3e6c44d9b013ca9a477ce9fa1d46c305071f530 Mon Sep 17 00:00:00 2001 From: AlexTheCoder Date: Tue, 11 Apr 2017 22:24:50 -0400 Subject: [PATCH 69/98] Fix a bunch of bugs and switch to a block based egg hunt. Additionally, move some location constants to match the Easter Lobby. --- .../core/locations/LocationConstants.java | 6 +- .../mineplex/hub/commands/EggAddCommand.java | 1 + .../mineplex/hub/modules/EasterEggHunt.java | 58 ++++++++++--------- 3 files changed, 36 insertions(+), 29 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/locations/LocationConstants.java b/Plugins/Mineplex.Core/src/mineplex/core/locations/LocationConstants.java index 554be4a57..db103c12c 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/locations/LocationConstants.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/locations/LocationConstants.java @@ -25,15 +25,15 @@ public class LocationConstants public static final Location[] CHEST_LOCATIONS = { new Location(WORLD, 34, 72, -15), - new Location(WORLD, 23, 72, -31), + new Location(WORLD, 26, 72, -35), new Location(WORLD, -23, 72, -31), new Location(WORLD, -34, 72, -15) }; //new Location(world, -25.5, 73, 19.5), new Location(world, -35.5, 69, 1.5) - public static final Location FOUNTAIN_SCHEMATIC = new Location(WORLD, -35.5, 68, 1.5); - public static final Location FOUNTAIN_LOCATION = new Location(WORLD, -24.5, 72, 24.5); + public static final Location FOUNTAIN_SCHEMATIC = new Location(WORLD, -41.5, 68, 5.5); + public static final Location FOUNTAIN_LOCATION = new Location(WORLD, -30.5, 72, 28.5); public static Location getResetLocation(Location chestLocation) { diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/commands/EggAddCommand.java b/Plugins/Mineplex.Hub/src/mineplex/hub/commands/EggAddCommand.java index df33b562b..277136334 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/commands/EggAddCommand.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/commands/EggAddCommand.java @@ -21,6 +21,7 @@ public class EggAddCommand extends CommandBase if (args.length < 1) { UtilPlayer.message(caller, F.main(Plugin.getName(), "Usage: /addegg ")); + return; } Plugin.addEgg(caller, args[0]); } diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/EasterEggHunt.java b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/EasterEggHunt.java index bc92b49cf..fb5314051 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/EasterEggHunt.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/EasterEggHunt.java @@ -6,7 +6,6 @@ import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.time.LocalDate; -import java.time.ZoneId; import java.util.ArrayList; import java.util.List; import java.util.UUID; @@ -14,13 +13,10 @@ import java.util.UUID; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.Sound; -import org.bukkit.entity.ArmorStand; -import org.bukkit.entity.Entity; -import org.bukkit.entity.EntityType; +import org.bukkit.block.Block; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; -import org.bukkit.event.player.PlayerInteractAtEntityEvent; -import org.bukkit.inventory.ItemStack; +import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.util.Vector; @@ -31,6 +27,7 @@ import mineplex.core.common.currency.GlobalCurrency; import mineplex.core.common.util.C; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilWorld; import mineplex.core.donation.DonationManager; import mineplex.core.hologram.Hologram; import mineplex.core.inventory.InventoryManager; @@ -81,8 +78,8 @@ public class EasterEggHunt extends MiniDbClientPlugin { String[] coords = str.split(","); double x = Double.parseDouble(coords[0]); - double y = Double.parseDouble(coords[0]); - double z = Double.parseDouble(coords[0]); + double y = Double.parseDouble(coords[1]); + double z = Double.parseDouble(coords[2]); return new Vector(x, y, z); } @@ -123,9 +120,9 @@ public class EasterEggHunt extends MiniDbClientPlugin } @EventHandler - public void interactBlock(PlayerInteractAtEntityEvent event) + public void interactBlock(PlayerInteractEvent event) { - if (event.getRightClicked() == null) + if (event.getClickedBlock() == null) { return; } @@ -134,9 +131,10 @@ public class EasterEggHunt extends MiniDbClientPlugin for (EasterEgg egg : _possibleEggs) { - if (egg.isMe(event.getRightClicked())) + if (egg.isMe(event.getClickedBlock())) { findEgg(player, egg.getId()); + event.setCancelled(true); break; } } @@ -147,7 +145,7 @@ public class EasterEggHunt extends MiniDbClientPlugin { if (event.getType() == UpdateType.SEC) { - LocalDate currentDate = LocalDate.now(ZoneId.of("UTC")); + LocalDate currentDate = LocalDate.now(); _possibleEggs.stream().filter(EasterEgg::isSpawned).filter(egg -> { @@ -180,6 +178,14 @@ public class EasterEggHunt extends MiniDbClientPlugin ps.setString(1, vecToStr(loc)); ps.setDate(2, parsed); ps.execute(); + + PreparedStatement ret = c.prepareStatement("SELECT COUNT(id) FROM easterEggs WHERE eggDate=?;"); + ret.setDate(1, parsed); + ResultSet rs = ret.executeQuery(); + if (rs.next()) + { + UtilPlayer.message(player, F.main(getName(), "There are " + rs.getInt(1) + " eggs saved for " + date + "!")); + } } catch (SQLException e) { @@ -192,7 +198,7 @@ public class EasterEggHunt extends MiniDbClientPlugin { if (Get(player).getEggs().contains(eggId)) { - UtilPlayer.message(player, F.main(getName(), "You have already found this egg!")); + UtilPlayer.message(player, F.main(getName(), "You have already found this egg! There are " + F.count(EGGS_PER_DAY - Get(player).getEggs().size()) + " more eggs to find today!")); return; } player.playSound(player.getLocation(), Sound.CAT_MEOW, 1, 0.7F); @@ -255,8 +261,8 @@ public class EasterEggHunt extends MiniDbClientPlugin private final Integer _id; private final Vector _loc; private final Date _date; + private boolean _spawned; private Location _spawn; - private ArmorStand _stand; private Hologram _holo; public EasterEgg(Integer id, Vector loc, Date date) @@ -264,6 +270,7 @@ public class EasterEggHunt extends MiniDbClientPlugin _id = id; _loc = loc; _date = date; + _spawned = false; } public Integer getId() @@ -278,19 +285,20 @@ public class EasterEggHunt extends MiniDbClientPlugin public boolean isSpawned() { - return _stand != null; + return _spawned; } - public boolean isMe(Entity e) + public boolean isMe(Block block) { - return isSpawned() && e.getEntityId() == _stand.getEntityId(); + return isSpawned() && UtilWorld.locToStr(block.getLocation()).equals(UtilWorld.locToStr(_spawn.getBlock().getLocation())); } public void setup() { _spawn = _loc.toLocation(Managers.get(HubManager.class).GetSpawn().getWorld()); - _stand = null; - _holo = new Hologram(Managers.get(HubManager.class).getHologram(), _spawn.clone().add(0, 1.5, 0), C.cDPurple + C.Scramble + "ABC " + C.cPurpleB + "Easter Egg Hunt" + C.cDPurple + C.Scramble + " ABC"); + _spawned = false; + _holo = new Hologram(Managers.get(HubManager.class).getHologram(), _spawn.clone().add(0, 2, 0), C.cDPurple + C.Scramble + "ABC " + C.cPurpleB + "Easter Egg Hunt" + C.cDPurple + C.Scramble + " ABC"); + _holo.setViewDistance(4); _holo.stop(); } @@ -300,19 +308,17 @@ public class EasterEggHunt extends MiniDbClientPlugin { return; } - _stand = (ArmorStand)_spawn.getWorld().spawnEntity(_spawn, EntityType.ARMOR_STAND); - _stand.setItemInHand(new ItemStack(Material.EGG)); - _stand.setVisible(false); - _stand.setBasePlate(false); + _spawn.getBlock().setType(Material.DRAGON_EGG); _holo.start(); + _spawned = true; } public void despawn() { if (isSpawned()) { - _stand.remove(); - _stand = null; + _spawn.getBlock().setType(Material.AIR); + _spawned = false; _holo.stop(); } } @@ -330,7 +336,7 @@ public class EasterEggHunt extends MiniDbClientPlugin List found = new ArrayList<>(); while (resultSet.next()) { - if (resultSet.getDate("eggDate").toLocalDate().getDayOfYear() == LocalDate.now(ZoneId.of("UTC")).getDayOfYear()) + if (resultSet.getDate("eggDate").toLocalDate().getDayOfYear() == LocalDate.now().getDayOfYear()) { found.add(resultSet.getInt("eggId")); } From c3ff494f94ce0bec05e5e9f2e48fe1f5baa4a3cc Mon Sep 17 00:00:00 2001 From: AlexTheCoder Date: Wed, 12 Apr 2017 03:06:32 -0400 Subject: [PATCH 70/98] Update Arcade and Hub to use skinned easter eggs --- .../mineplex/hub/modules/EasterEggHunt.java | 41 ++++++++++++++++- .../game/arcade/managers/HolidayManager.java | 44 +++++++++++++++++-- 2 files changed, 79 insertions(+), 6 deletions(-) diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/EasterEggHunt.java b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/EasterEggHunt.java index fb5314051..29db6d3fc 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/EasterEggHunt.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/EasterEggHunt.java @@ -12,10 +12,14 @@ import java.util.UUID; import org.bukkit.Location; import org.bukkit.Material; +import org.bukkit.SkullType; import org.bukkit.Sound; import org.bukkit.block.Block; +import org.bukkit.block.BlockFace; +import org.bukkit.block.Skull; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; +import org.bukkit.event.inventory.ClickType; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.util.Vector; @@ -26,10 +30,12 @@ import mineplex.core.account.CoreClientManager; import mineplex.core.common.currency.GlobalCurrency; import mineplex.core.common.util.C; import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilWorld; import mineplex.core.donation.DonationManager; import mineplex.core.hologram.Hologram; +import mineplex.core.hologram.HologramInteraction; import mineplex.core.inventory.InventoryManager; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; @@ -43,6 +49,22 @@ public class EasterEggHunt extends MiniDbClientPlugin private static final int SHARD_REWARD = 500; private static final String ITEM_REWARD = "Omega Chest"; private static final int EGGS_PER_DAY = 30; + + private static final BlockFace[] BLOCK_FACES = { + BlockFace.NORTH, + BlockFace.EAST, + BlockFace.SOUTH, + BlockFace.WEST, + BlockFace.NORTH_EAST, + BlockFace.SOUTH_EAST, + BlockFace.SOUTH_WEST, + BlockFace.NORTH_WEST + }; + + private static final String[] EGG_SKINS = { + "KingCrazy_", + "Trajectories" + }; private final DonationManager _donationManager; private final InventoryManager _inventoryManager; @@ -297,18 +319,33 @@ public class EasterEggHunt extends MiniDbClientPlugin { _spawn = _loc.toLocation(Managers.get(HubManager.class).GetSpawn().getWorld()); _spawned = false; - _holo = new Hologram(Managers.get(HubManager.class).getHologram(), _spawn.clone().add(0, 2, 0), C.cDPurple + C.Scramble + "ABC " + C.cPurpleB + "Easter Egg Hunt" + C.cDPurple + C.Scramble + " ABC"); + _holo = new Hologram(Managers.get(HubManager.class).getHologram(), _spawn.clone().add(0, 1.5, 0), C.cDPurple + C.Scramble + "ABC " + C.cPurpleB + "Easter Egg Hunt" + C.cDPurple + C.Scramble + " ABC"); _holo.setViewDistance(4); + _holo.setInteraction(new HologramInteraction() + { + @Override + public void onClick(Player player, ClickType clickType) + { + Managers.get(EasterEggHunt.class).findEgg(player, getId()); + } + }); _holo.stop(); } + @SuppressWarnings("deprecation") public void spawn() { if (isSpawned()) { return; } - _spawn.getBlock().setType(Material.DRAGON_EGG); + _spawn.getBlock().setType(Material.SKULL); + _spawn.getBlock().setData((byte) 1); + Skull skull = (Skull) _spawn.getBlock().getState(); + skull.setSkullType(SkullType.PLAYER); + skull.setOwner(EGG_SKINS[UtilMath.r(EGG_SKINS.length)]); + skull.setRotation(BLOCK_FACES[UtilMath.r(BLOCK_FACES.length)]); + skull.update(); _holo.start(); _spawned = true; } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/HolidayManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/HolidayManager.java index ce6140e22..63e62bb37 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/HolidayManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/HolidayManager.java @@ -10,9 +10,11 @@ import org.bukkit.Effect; import org.bukkit.FireworkEffect; import org.bukkit.Location; import org.bukkit.Material; +import org.bukkit.SkullType; import org.bukkit.Sound; import org.bukkit.block.Block; import org.bukkit.block.BlockFace; +import org.bukkit.block.Skull; import org.bukkit.craftbukkit.v1_8_R3.util.CraftMagicNumbers; import org.bukkit.entity.Chicken; import org.bukkit.entity.Entity; @@ -29,6 +31,7 @@ import org.bukkit.util.Vector; import mineplex.core.common.currency.GlobalCurrency; import mineplex.core.common.util.C; +import mineplex.core.common.util.F; import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilEvent; import mineplex.core.common.util.UtilEvent.ActionType; @@ -63,11 +66,27 @@ import net.minecraft.server.v1_8_R3.PacketPlayOutBlockAction; public class HolidayManager implements Listener { + private static final BlockFace[] BLOCK_FACES = { + BlockFace.NORTH, + BlockFace.EAST, + BlockFace.SOUTH, + BlockFace.WEST, + BlockFace.NORTH_EAST, + BlockFace.SOUTH_EAST, + BlockFace.SOUTH_WEST, + BlockFace.NORTH_WEST + }; + + private static final String[] EGG_SKINS = { + "KingCrazy_", + "Trajectories" + }; + public enum HolidayType { CHRISTMAS(Material.CHEST, "Present", Sound.CAT_MEOW), HALLOWEEN(Material.PUMPKIN, "Pumpkin", Sound.ZOMBIE_REMEDY), - EASTER(Material.CHEST, "Egg Basket", Sound.CAT_MEOW), + EASTER(Material.SKULL, "Easter Egg", Sound.CAT_MEOW), THANKSGIVING(null, C.cGoldB + "Thanksgiving Chicken", null); private Material _blockType; @@ -160,7 +179,8 @@ public class HolidayManager implements Listener //Break if (block.getType() != Material.PUMPKIN && block.getType() != Material.JACK_O_LANTERN && - block.getType() != Material.CHEST) + block.getType() != Material.CHEST && + block.getType() != Material.SKULL) { specialBlockBreak(null, block); blockIterator.remove(); @@ -199,10 +219,10 @@ public class HolidayManager implements Listener block.getWorld().playSound(block.getLocation(), Sound.CHICKEN_EGG_POP, 0.25f + (float) Math.random() * 0.75f, 0.75f + (float) Math.random() * 0.5f); } - if (Math.random() > 0.95) + /*if (Math.random() > 0.95) { sendChestPackets(block); - } + }*/ } else if (_type.equals(HolidayType.CHRISTMAS)) { @@ -313,6 +333,16 @@ public class HolidayManager implements Listener { sendChestPackets(block); } + + if (_type.getBlockType() == Material.SKULL) + { + block.setData((byte) 1); + Skull skull = (Skull) block.getState(); + skull.setSkullType(SkullType.PLAYER); + skull.setOwner(EGG_SKINS[UtilMath.r(EGG_SKINS.length)]); + skull.setRotation(BLOCK_FACES[UtilMath.r(BLOCK_FACES.length)]); + skull.update(); + } _active.add(block); @@ -560,6 +590,7 @@ public class HolidayManager implements Listener HalloweenSmashedEffect halloweenSmashedEffect = new HalloweenSmashedEffect(block.getLocation() .add(.5, .5, .5), fireworkEffect, _arcadeManager.getPlugin()); halloweenSmashedEffect.start(); + UtilPlayer.message(player, F.main("Holiday Rewards", "You found a Spring Chest in a " + _type.getBlockName() + "!")); } else { @@ -570,8 +601,13 @@ public class HolidayManager implements Listener HalloweenSmashedEffect halloweenSmashedEffect = new HalloweenSmashedEffect(block.getLocation() .add(.5, .5, .5), fireworkEffect, _arcadeManager.getPlugin()); halloweenSmashedEffect.start(); + UtilPlayer.message(player, F.main("Holiday Rewards", "You found an Omega Chest in a " + _type.getBlockName() + "!")); } } + else + { + UtilPlayer.message(player, F.main("Holiday Rewards", "You found a " + _type.getBlockName())); + } } //Effect From 5a225b93326177a40e51af03da5b2608c1701b48 Mon Sep 17 00:00:00 2001 From: AlexTheCoder Date: Wed, 12 Apr 2017 16:01:24 -0400 Subject: [PATCH 71/98] Properly check the spring chest rewards --- .../src/nautilus/game/arcade/managers/HolidayManager.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/HolidayManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/HolidayManager.java index 63e62bb37..058b9e68d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/HolidayManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/HolidayManager.java @@ -581,7 +581,7 @@ public class HolidayManager implements Listener double rand = UtilMath.random.nextDouble(); if (rand < CHEST_CHANCE) { - if (hasItemsToGivePlayer(TreasureType.HAUNTED.getRewardPool(), player)) + if (hasItemsToGivePlayer(TreasureType.SPRING.getRewardPool(), player)) { FireworkEffect fireworkEffect = FireworkEffect.builder().with(FireworkEffect.Type.BALL_LARGE) .withColor(Color.LIME).withColor(Color.WHITE).withFade(Color.YELLOW) From 4775fccb9a981c73865c44d670e692bf509f304c Mon Sep 17 00:00:00 2001 From: Sarah Date: Wed, 12 Apr 2017 22:35:33 +0200 Subject: [PATCH 72/98] Improve Island rot and misc fixes --- .../game/games/skyfall/BoosterRing.java | 4 +- .../game/games/skyfall/Crumbleable.java | 15 ++- .../arcade/game/games/skyfall/Island.java | 2 +- .../arcade/game/games/skyfall/Skyfall.java | 97 ++++++++++++++----- 4 files changed, 89 insertions(+), 29 deletions(-) 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 0607c8cae..c73449e2e 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 @@ -41,8 +41,8 @@ import nautilus.game.arcade.game.Game.GameState; */ public class BoosterRing extends Crumbleable implements Listener { - private static int MAX_RING_BOUNDS = 15; - private static int SEARCH_OUTER_RING_RANGE = 10; + private static int MAX_RING_BOUNDS = 18; + private static int SEARCH_OUTER_RING_RANGE = 12; private Game _host; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skyfall/Crumbleable.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skyfall/Crumbleable.java index ef9ef539c..eb1f5d2b9 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skyfall/Crumbleable.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skyfall/Crumbleable.java @@ -5,6 +5,7 @@ import java.util.HashSet; import net.minecraft.server.v1_8_R3.Chunk; +import org.bukkit.DyeColor; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.block.Block; @@ -125,8 +126,6 @@ public abstract class Crumbleable crumblePercentage(); - Material material = replacements[UtilMath.r(replacements.length)]; - if (_realBlocks.isEmpty()) { crumbledAway(); @@ -148,6 +147,7 @@ public abstract class Crumbleable for (int i = 0; i < blocks; i++) { + Material material = replacements[UtilMath.r(replacements.length)]; if (_realBlocks.isEmpty()) { crumbledAway(); @@ -168,7 +168,16 @@ public abstract class Crumbleable || toRemove.getBlock().getType() == Material.STATIONARY_LAVA) continue; - MapUtil.ChunkBlockChange(toRemove, material.getId(), (byte) 0, false); + byte id = 0; + + if (toRemove.getBlock().getType() == Material.STAINED_GLASS || + toRemove.getBlock().getType() == Material.GLASS) + { + material = Material.STAINED_GLASS; + id = DyeColor.BLACK.getData(); + } + + MapUtil.ChunkBlockChange(toRemove, material.getId(), id, false); _chunksToUpdate.add(((CraftChunk) toRemove.getChunk()).getHandle()); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skyfall/Island.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skyfall/Island.java index e2d37b93e..55d3f74ed 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skyfall/Island.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skyfall/Island.java @@ -212,7 +212,7 @@ public class Island extends Crumbleable if (UtilMath.offset2d(location, _location) > _bounds + 1) return false; - for (int y = ((int) (Math.round(_location.getY()) - _height)); y <= _location.getBlockY(); y++) + for (int y = (_location.getBlockY() - _height); y <= _location.getBlockY(); y++) { if (location.getBlockY() == y) return true; 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 b1d270fa1..d2f9223e6 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 @@ -42,6 +42,7 @@ import org.bukkit.inventory.Inventory; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.ItemMeta; +import com.avaje.ebeaninternal.server.persist.dml.UpdatePlan; import com.mineplex.anticheat.checks.move.Glide; import com.mineplex.anticheat.checks.move.HeadRoll; import com.mineplex.anticheat.checks.move.Speed; @@ -105,8 +106,10 @@ public abstract class Skyfall extends Game 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 long ELYTRA_TAKEAWAY = 1000; + private static final int ROT_START = 256; + private static final int ROT_Y_OFFSET = 25; - private static final long ISLAND_ROT_TIME = 1000*60*5; // 3 Minutes + private static final long ISLAND_ROT_TIME = 1000*60*5; // 5 Minutes private static final int RING_CRUMBLE_RATE = 10; @@ -157,6 +160,8 @@ public abstract class Skyfall extends Game private boolean _supplyOpened; + private double _rotY; + //private int _ringCrumbleRate; public Skyfall(ArcadeManager manager, GameType type) @@ -238,6 +243,8 @@ public abstract class Skyfall extends Game _bigIslandBounds = 25; _bigIslandHeight = 15; + + _rotY = ROT_START; } @EventHandler @@ -246,6 +253,9 @@ public abstract class Skyfall extends Game if(GetState() != GameState.Live) return; + if (!UtilServer.isTestServer()) + return; + if(event.getMessage().contains("/Rate")) { int rate = Integer.parseInt(event.getMessage().split(" ")[1]); @@ -255,6 +265,13 @@ public abstract class Skyfall extends Game return; } + if(event.getMessage().contains("/Rot")) + { + UtilPlayer.message(event.getPlayer(), "Current Rot value " + _rotY); + event.setCancelled(true); + return; + } + if(event.getMessage().contains("/Boost")) { float rate = Float.parseFloat(event.getMessage().split(" ")[1]); @@ -398,55 +415,87 @@ public abstract class Skyfall extends Game } } + @EventHandler + public void lowerRot(UpdateEvent event) + { + if (event.getType() != UpdateType.SEC_05) + return; + + if (!IsLive()) + return; + + if (_rotY <= (0 - ROT_Y_OFFSET)) + return; + + long startTime = GetStateTime() + MAP_CRUMBLE_DELAY; + //System.out.println("starttime " + startTime); + double current = System.currentTimeMillis() - startTime; + //System.out.println("current " + current); + + double percentage = current/((double) ISLAND_ROT_TIME); + //System.out.println("precentage " + percentage); + double value = ROT_START * percentage; + //System.out.println("value " + value); + + _rotY = (ROT_START - value); + } + public ArrayList islandCrumble() { ArrayList islands = new ArrayList<>(); + + for (Island island : _islands.get(_upperIsland).keySet()) { if (island.isCrumbledAway()) islands.add(island); - Material[] mats = new Material[]{Material.COAL_BLOCK, Material.ENDER_STONE}; -// if (island.getLocation().getBlockY() >= GetTeamList().get(0).GetSpawns().get(0).getBlockY()) -// mats = new Material[] {Material.AIR}; + if (island.getLocation().getBlockY() < (_rotY + ROT_Y_OFFSET)) + continue; - if (!island.crumble(_islandCrumbleRate, mats)) - { - return islands; - } + island.crumble(_islandCrumbleRate, Material.COAL_BLOCK, Material.ENDER_STONE); } + + if (_upperIsland.isCrumbledAway()) islands.add(_upperIsland); - if (!_upperIsland.crumble(_islandCrumbleRate, Material.COAL_BLOCK, Material.ENDER_STONE)) + + if (_upperIsland.getLocation().getBlockY() > (_rotY + ROT_Y_OFFSET)) { - return islands; - } - else - { - while (!_upperIsland.getBoosterRing().isCrumbledAway()) + if (_upperIsland.crumble(_islandCrumbleRate, Material.COAL_BLOCK, Material.ENDER_STONE)) { - _upperIsland.getBoosterRing().crumble(RING_CRUMBLE_RATE, Material.COAL_BLOCK, Material.ENDER_STONE); + while (!_upperIsland.getBoosterRing().isCrumbledAway()) + { + _upperIsland.getBoosterRing().crumble(RING_CRUMBLE_RATE, Material.COAL_BLOCK, Material.ENDER_STONE); + } } } + + for (Island island : _islands.get(_lowerIsland).keySet()) { if (island.isCrumbledAway()) islands.add(island); - if (!island.crumble(_islandCrumbleRate, Material.COAL_BLOCK, Material.ENDER_STONE)) - { - return islands; - } + if (island.getLocation().getBlockY() < (_rotY + ROT_Y_OFFSET)) + continue; + + island.crumble(_islandCrumbleRate, Material.COAL_BLOCK, Material.ENDER_STONE); } + + if (_lowerIsland.isCrumbledAway()) islands.add(_lowerIsland); - - if (_lowerIsland.crumble(_islandCrumbleRate, Material.COAL_BLOCK, Material.ENDER_STONE)) + + if (_lowerIsland.getLocation().getBlockY() > (_rotY + ROT_Y_OFFSET)) { - while (!_lowerIsland.getBoosterRing().isCrumbledAway()) + if (_lowerIsland.crumble(_islandCrumbleRate, Material.COAL_BLOCK, Material.ENDER_STONE)) { - _lowerIsland.getBoosterRing().crumble(RING_CRUMBLE_RATE, Material.COAL_BLOCK, Material.ENDER_STONE); + while (!_lowerIsland.getBoosterRing().isCrumbledAway()) + { + _lowerIsland.getBoosterRing().crumble(RING_CRUMBLE_RATE, Material.COAL_BLOCK, Material.ENDER_STONE); + } } } return islands; @@ -932,6 +981,8 @@ public abstract class Skyfall extends Game if (_islandCrumbleRate < 1) _islandCrumbleRate = 1; + + _islandCrumbleRate = _islandCrumbleRate * 3; } public Island getCurrentIsland(Player player) From cd7948c039e6bb4f8696e55291d13dd4a3d71a29 Mon Sep 17 00:00:00 2001 From: Kenny Date: Sun, 9 Apr 2017 23:30:30 -0400 Subject: [PATCH 73/98] Report server TPS average to ServerMonitor rather than what it happens to be at that moment This (should) fix instances of servermonitor flagging a server as lagging and killing it for short bursts of high CPU usage --- .../Mineplex.Core/src/mineplex/core/monitor/LagMeter.java | 5 +++++ .../src/mineplex/core/status/ServerStatusManager.java | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/monitor/LagMeter.java b/Plugins/Mineplex.Core/src/mineplex/core/monitor/LagMeter.java index 802b3d643..e9f920567 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/monitor/LagMeter.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/monitor/LagMeter.java @@ -123,6 +123,11 @@ public class LagMeter extends MiniPlugin return _ticksPerSecond; } + public double getRecentTicksPercentageAverage() + { + return _ticksPerSecondAverage; + } + private void sendUpdates() { for (Player player : _monitoring) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/status/ServerStatusManager.java b/Plugins/Mineplex.Core/src/mineplex/core/status/ServerStatusManager.java index 596ab3aa5..1b218e9cf 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/status/ServerStatusManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/status/ServerStatusManager.java @@ -166,7 +166,7 @@ public class ServerStatusManager extends MiniPlugin String motd = _enabled ? event.getMotd() : "Restarting"; int playerCount = _clientManager.getPlayerCountIncludingConnecting(); int maxPlayerCount = event.getMaxPlayers(); - int tps = (int) _lagMeter.getTicksPerSecond(); + int tps = (int) _lagMeter.getRecentTicksPercentageAverage(); String address = Bukkit.getServer().getIp().isEmpty() ? "localhost" : Bukkit.getServer().getIp(); int port = _plugin.getServer().getPort(); String group = _plugin.getConfig().getString("serverstatus.group") + ""; From 176107c8485eee66924800bf8a2a2b237943bd57 Mon Sep 17 00:00:00 2001 From: Alexander Meech Date: Wed, 12 Apr 2017 23:31:32 -0400 Subject: [PATCH 74/98] Update the setup of CUST-1 Should probably make this dynamic at some point...... --- .../src/mineplex/staffServer/StaffServer.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/StaffServer.java b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/StaffServer.java index 78526833a..c6597f877 100644 --- a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/StaffServer.java +++ b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/StaffServer.java @@ -92,12 +92,12 @@ public class StaffServer extends JavaPlugin ((CraftServer)getServer()).getHandle().addWhitelist(new GameProfile(UUID.fromString("377bdea3-badc-448d-81c1-65db43b17ea4"), "Strutt20")); ((CraftServer)getServer()).getHandle().addWhitelist(new GameProfile(UUID.fromString("cf1b629c-cc55-4eb4-be9e-3ca86dfc7b9d"), "mannalou")); ((CraftServer)getServer()).getHandle().addWhitelist(new GameProfile(UUID.fromString("adaa7613-6683-400f-baf8-7272c04b2cb4"), "Tmmy")); - ((CraftServer)getServer()).getHandle().addWhitelist(new GameProfile(UUID.fromString("231fb752-9556-489b-8428-f47c7598e061"), "Nuclear_Poptart")); - ((CraftServer)getServer()).getHandle().addWhitelist(new GameProfile(UUID.fromString("492ff708-fe76-4c5a-b9ed-a747b5fa20a0"), "Cherdy8s")); + ((CraftServer)getServer()).getHandle().addWhitelist(new GameProfile(UUID.fromString("492ff708-fe76-4c5a-b9ed-a747b5fa20a0"), "cherdy")); ((CraftServer)getServer()).getHandle().addWhitelist(new GameProfile(UUID.fromString("6edf17d5-6bb2-4ed9-92e9-bed8e96fff68"), "BlueBeetleHD")); ((CraftServer)getServer()).getHandle().addWhitelist(new GameProfile(UUID.fromString("a47a4d04-9f51-44ba-9d35-8de6053e9289"), "AlexTheCoder")); ((CraftServer)getServer()).getHandle().addWhitelist(new GameProfile(UUID.fromString("63ad2db3-7c62-4a10-ac58-d267973190ce"), "Crumplex")); + ((CraftServer)getServer()).getHandle().addOp(new GameProfile(UUID.fromString("a47a4d04-9f51-44ba-9d35-8de6053e9289"), "AlexTheCoder")); ((CraftServer)getServer()).getHandle().addOp(new GameProfile(UUID.fromString("cf1b629c-cc55-4eb4-be9e-3ca86dfc7b9d"), "mannalou")); ((CraftServer)getServer()).getHandle().addOp(new GameProfile(UUID.fromString("377bdea3-badc-448d-81c1-65db43b17ea4"), "Strutt20")); ((CraftServer)getServer()).getHandle().addOp(new GameProfile(UUID.fromString("6edf17d5-6bb2-4ed9-92e9-bed8e96fff68"), "BlueBeetleHD")); From e1fee19affd331a4a90571d543e30ad2bc1f732a Mon Sep 17 00:00:00 2001 From: samczsun Date: Thu, 13 Apr 2017 01:09:03 -0400 Subject: [PATCH 75/98] Optimize chunk updating and fix invis players --- .../game/games/skyfall/Crumbleable.java | 29 +++++++++++++++---- 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skyfall/Crumbleable.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skyfall/Crumbleable.java index eb1f5d2b9..35d61e3d4 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skyfall/Crumbleable.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skyfall/Crumbleable.java @@ -1,9 +1,13 @@ package nautilus.game.arcade.game.games.skyfall; import java.util.ArrayList; +import java.util.BitSet; +import java.util.HashMap; import java.util.HashSet; +import java.util.Map; import net.minecraft.server.v1_8_R3.Chunk; +import net.minecraft.server.v1_8_R3.PacketPlayOutMapChunk; import org.bukkit.DyeColor; import org.bukkit.Location; @@ -15,6 +19,7 @@ import org.bukkit.entity.Player; import mineplex.core.common.util.MapUtil; import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilTime; @@ -31,7 +36,7 @@ public abstract class Crumbleable private ArrayList _initBlocks; private ArrayList _realBlocks; - private HashSet _chunksToUpdate; + private Map _chunksToUpdate; private boolean _onlyTop; private int _height; @@ -49,7 +54,7 @@ public abstract class Crumbleable _height = height; _realBlocks = new ArrayList<>(); - _chunksToUpdate = new HashSet<>(); + _chunksToUpdate = new HashMap<>(); _lastChunk = System.currentTimeMillis(); } @@ -133,12 +138,24 @@ public abstract class Crumbleable { if (UtilTime.elapsed(_lastChunk, CHUNK_CRUMBLE_DELAY)) { - Chunk chunk = _chunksToUpdate.iterator().next(); - _chunksToUpdate.remove(chunk); + Chunk chunk = _chunksToUpdate.keySet().iterator().next(); + BitSet bitSet = _chunksToUpdate.remove(chunk); + + int mask = 0; + + for (int i = 0; i < bitSet.length(); i++) + { + if (bitSet.get(i)) + { + mask |= 1 << i; + } + } + for (Player player : UtilServer.getPlayers()) { - MapUtil.SendChunkForPlayer(chunk, player); + UtilPlayer.sendPacket(player, new PacketPlayOutMapChunk(chunk, false, mask)); } + _lastChunk = System.currentTimeMillis(); } } @@ -178,7 +195,7 @@ public abstract class Crumbleable } MapUtil.ChunkBlockChange(toRemove, material.getId(), id, false); - _chunksToUpdate.add(((CraftChunk) toRemove.getChunk()).getHandle()); + _chunksToUpdate.computeIfAbsent(((CraftChunk) toRemove.getChunk()).getHandle(), key -> new BitSet()).set(((int) toRemove.getY()) >> 4); } return false; From 0dae58a0a73e4da3e12732d428ca95b34107abdf Mon Sep 17 00:00:00 2001 From: cnr Date: Wed, 12 Apr 2017 23:18:44 -0600 Subject: [PATCH 76/98] Bump anticheat dependency version --- Plugins/Mineplex.Core/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Plugins/Mineplex.Core/pom.xml b/Plugins/Mineplex.Core/pom.xml index afbd561ec..a59a05b9b 100644 --- a/Plugins/Mineplex.Core/pom.xml +++ b/Plugins/Mineplex.Core/pom.xml @@ -43,7 +43,7 @@ com.mineplex anticheat - 1.3 + 1.5 org.tukaani From 87f9fe609342a20e9af519ecf1680e810a4abad4 Mon Sep 17 00:00:00 2001 From: cnr Date: Wed, 12 Apr 2017 23:36:55 -0600 Subject: [PATCH 77/98] Implement anticheat VL and banwave changes --- .../src/mineplex/core/antihack/AntiHack.java | 56 +++++++++---------- .../core/antihack/actions/BanwaveAction.java | 10 ++-- 2 files changed, 34 insertions(+), 32 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/antihack/AntiHack.java b/Plugins/Mineplex.Core/src/mineplex/core/antihack/AntiHack.java index 96af06514..97dc81702 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/antihack/AntiHack.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/antihack/AntiHack.java @@ -1,5 +1,6 @@ package mineplex.core.antihack; +import javax.xml.bind.DatatypeConverter; import java.util.Collections; import java.util.HashSet; import java.util.Map; @@ -9,7 +10,11 @@ import java.util.concurrent.ThreadLocalRandom; import java.util.concurrent.TimeUnit; import java.util.function.Consumer; -import javax.xml.bind.DatatypeConverter; +import net.md_5.bungee.api.ChatColor; +import net.md_5.bungee.api.chat.BaseComponent; +import net.md_5.bungee.api.chat.ClickEvent; +import net.md_5.bungee.api.chat.ComponentBuilder; +import net.md_5.bungee.api.chat.HoverEvent; import org.bukkit.Bukkit; import org.bukkit.entity.Player; @@ -43,6 +48,7 @@ import com.mineplex.anticheat.checks.combat.KillauraTypeF; import com.mineplex.anticheat.checks.move.Glide; import com.mineplex.anticheat.checks.move.HeadRoll; import com.mineplex.anticheat.checks.move.Speed; +import com.mineplex.anticheat.checks.move.Toggle; import com.mineplex.anticheat.checks.player.BadPackets; import mineplex.core.MiniPlugin; @@ -76,11 +82,6 @@ import mineplex.core.punish.Category; import mineplex.core.punish.Punish; import mineplex.core.punish.PunishmentResponse; import mineplex.serverdata.commands.ServerCommandManager; -import net.md_5.bungee.api.ChatColor; -import net.md_5.bungee.api.chat.BaseComponent; -import net.md_5.bungee.api.chat.ClickEvent; -import net.md_5.bungee.api.chat.ComponentBuilder; -import net.md_5.bungee.api.chat.HoverEvent; @ReflectivelyCreateMiniPlugin public class AntiHack extends MiniPlugin @@ -90,12 +91,13 @@ public class AntiHack extends MiniPlugin .put(KillauraTypeB.class, new CheckThresholds("High CPS", 0, 0, Integer.MAX_VALUE)) .put(KillauraTypeC.class, new CheckThresholds("Reach", 0, Integer.MAX_VALUE, Integer.MAX_VALUE)) .put(KillauraTypeD.class, new CheckThresholds("Kill Aura", 500, 1000, 1500)) - .put(KillauraTypeE.class, new CheckThresholds("Kill Aura", 300, 700, 2000)) - .put(KillauraTypeF.class, new CheckThresholds("Kill Aura", 150, 250, 350)) + .put(KillauraTypeE.class, new CheckThresholds("Kill Aura", 1000, 2000, 5000)) + .put(KillauraTypeF.class, new CheckThresholds("Kill Aura", 200, 300, 400)) .put(BadPackets.class, new CheckThresholds("Regen", 500, 1000, 2000)) - .put(Glide.class, new CheckThresholds("Flying", 150, 250, 500)) - .put(Speed.class, new CheckThresholds("Speed", 150, 250, 500)) - .put(HeadRoll.class, new CheckThresholds("Illegal Movement", 0, 0, 0)) + .put(Glide.class, new CheckThresholds("Flying", 1000, 2000, 3500)) + .put(Speed.class, new CheckThresholds("Speed", 1000, 2000, 3500)) + .put(HeadRoll.class, new CheckThresholds("Illegal Movement", 0, 0, 1000)) + .put(Toggle.class, new CheckThresholds("AutoSneak", 100, 200, 300)) .build(); private static final CheckThresholds NOOP_THRESHOLD = new CheckThresholds("Unknown", 0, Integer.MAX_VALUE, Integer.MAX_VALUE); @@ -103,9 +105,10 @@ public class AntiHack extends MiniPlugin private static final Map, AntiHackAction> ACTIONS = ImmutableMap., AntiHackAction>builder() .put(KillauraTypeA.class, new ImmediateBanAction(200)) .put(KillauraTypeD.class, new BanwaveAction(1500)) + .put(KillauraTypeF.class, new BanwaveAction(600)) .put(Glide.class, new ImmediateBanAction(10000)) .put(Speed.class, new ImmediateBanAction(10000)) -// .put(HeadRoll.class, new ImmediateBanAction(200)) + .put(HeadRoll.class, new ImmediateBanAction(2000)) .put(HeadRoll.class, new GEPBanAction(1)) .put(BadPackets.class, new GEPBanAction(300)) .put(KillauraTypeB.class, new GEPBanAction(100)) @@ -368,26 +371,23 @@ public class AntiHack extends MiniPlugin ACTIONS.getOrDefault(event.getCheckClass(), NOOP_ACTION).handle(event); - if (event.shouldTellStaff()) + CheckThresholds thresholds = CHECKS.getOrDefault(event.getCheckClass(), NOOP_THRESHOLD); + CheckThresholds.Severity severity = thresholds.getSeverity(event.getViolations()); + + if (severity == CheckThresholds.Severity.NONE) { - CheckThresholds thresholds = CHECKS.getOrDefault(event.getCheckClass(), NOOP_THRESHOLD); - CheckThresholds.Severity severity = thresholds.getSeverity(event.getViolations()); + return; + } - if (severity == CheckThresholds.Severity.NONE) - { - return; - } + String key = event.getPlayer().getName() + "." + event.getHackType() + "." + severity.toString(); - String key = event.getPlayer().getName() + "." + event.getHackType() + "." + severity.toString(); + Integer pastVl = this._cooldown.getIfPresent(key); + if (pastVl == null) + { + MajorViolationCommand command = new MajorViolationCommand(_thisServer, event.getPlayer().getName(), CheckManager.getCheckSimpleName(event.getCheckClass()), event.getViolations(), event.getMessage()); + ServerCommandManager.getInstance().publishCommand(command); - Integer pastVl = this._cooldown.getIfPresent(key); - if (pastVl == null) - { - MajorViolationCommand command = new MajorViolationCommand(_thisServer, event.getPlayer().getName(), CheckManager.getCheckSimpleName(event.getCheckClass()), event.getViolations(), event.getMessage()); - ServerCommandManager.getInstance().publishCommand(command); - - this._cooldown.put(key, event.getViolations()); - } + this._cooldown.put(key, event.getViolations()); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/antihack/actions/BanwaveAction.java b/Plugins/Mineplex.Core/src/mineplex/core/antihack/actions/BanwaveAction.java index 694c75488..643f223d7 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/antihack/actions/BanwaveAction.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/antihack/actions/BanwaveAction.java @@ -1,5 +1,7 @@ package mineplex.core.antihack.actions; +import java.util.concurrent.TimeUnit; + import com.mineplex.anticheat.api.PlayerViolationEvent; import mineplex.core.Managers; @@ -10,8 +12,8 @@ import mineplex.core.common.util.UtilServer; public class BanwaveAction extends AntiHackAction { - private static final int BAN_DELAY_AVERAGE = 6 * 60 * 60 * 1000; // 6 hours - private static final int BAN_DELAY_VARIANCE_SPAN = 4 * 60 * 60 * 1000; // 4 hours total; 2 on either side + private static final long BAN_DELAY_AVERAGE = TimeUnit.HOURS.convert(1, TimeUnit.MILLISECONDS) + TimeUnit.MINUTES.convert(15, TimeUnit.MILLISECONDS); + private static final long BAN_DELAY_VARIANCE_SPAN = TimeUnit.HOURS.convert(1, TimeUnit.HOURS) + TimeUnit.MINUTES.convert(45, TimeUnit.MILLISECONDS); // 45 minutes on either side public BanwaveAction(int vl) { @@ -28,8 +30,8 @@ public class BanwaveAction extends AntiHackAction } if (event.getViolations() >= this.getMinVl()) { - // Delay bans by 6 hours +/- 2 hours for fuzzing - long banTime = System.currentTimeMillis() + BAN_DELAY_AVERAGE + (UtilMath.r(BAN_DELAY_VARIANCE_SPAN) - (BAN_DELAY_VARIANCE_SPAN / 2)); + // Delay bans by 1.25 hours +/- .75 hours for fuzzing + long banTime = System.currentTimeMillis() + BAN_DELAY_AVERAGE + (UtilMath.r((int)BAN_DELAY_VARIANCE_SPAN) - (BAN_DELAY_VARIANCE_SPAN / 2)); Managers.get(BanWaveManager.class).insertBanWaveInfo( event.getPlayer(), banTime, From 0735b415cf046c4206ad1866070708f8f97cb611 Mon Sep 17 00:00:00 2001 From: cnr Date: Thu, 13 Apr 2017 00:00:17 -0600 Subject: [PATCH 78/98] Implement new MineplexLink methods --- .../core/antihack/MineplexLinkImpl.java | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/antihack/MineplexLinkImpl.java b/Plugins/Mineplex.Core/src/mineplex/core/antihack/MineplexLinkImpl.java index 6195a3fd2..f2e450e7f 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/antihack/MineplexLinkImpl.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/antihack/MineplexLinkImpl.java @@ -1,14 +1,18 @@ package mineplex.core.antihack; import net.minecraft.server.v1_8_R3.MinecraftServer; +import net.minecraft.server.v1_8_R3.MobEffect; import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; +import org.bukkit.entity.Entity; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; +import org.bukkit.potion.PotionEffectType; import com.mineplex.anticheat.api.MineplexLink; import mineplex.core.Managers; +import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilPlayer; import mineplex.core.disguise.DisguiseManager; import mineplex.core.disguise.disguises.DisguiseBase; @@ -47,4 +51,29 @@ public class MineplexLinkImpl implements MineplexLink { return ((CraftPlayer) player).getHandle().bS(); // See Anticheat javadoc } + + @Override + public int allocateNewEntityID() + { + return UtilEnt.getNewEntityId(); + } + + @Override + public boolean isUsingElytra(Player player) + { + return ((CraftPlayer) player).getHandle().isGliding(); + } + + @Override + public int getLevitationAmplifier(Player player) + { + MobEffect effect = ((CraftPlayer) player).getHandle().effects.get(PotionEffectType.LEVITATION.getId()); + return effect == null ? -1 : effect.getAmplifier(); + } + + @Override + public boolean canDamage(Player attacker, Entity target) + { + return true; + } } From 498df70a1fbf30ae45d7da5179de7b6be2556278 Mon Sep 17 00:00:00 2001 From: samczsun Date: Thu, 9 Mar 2017 17:56:53 -0500 Subject: [PATCH 79/98] Implement basic canDamage --- .../core/antihack/MineplexLinkImpl.java | 6 ++++- .../core/antihack/RelationProvider.java | 9 +++++++ .../src/nautilus/game/arcade/Arcade.java | 25 +++++++++++++++++++ 3 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/antihack/RelationProvider.java diff --git a/Plugins/Mineplex.Core/src/mineplex/core/antihack/MineplexLinkImpl.java b/Plugins/Mineplex.Core/src/mineplex/core/antihack/MineplexLinkImpl.java index f2e450e7f..4294d1988 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/antihack/MineplexLinkImpl.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/antihack/MineplexLinkImpl.java @@ -3,10 +3,12 @@ package mineplex.core.antihack; import net.minecraft.server.v1_8_R3.MinecraftServer; import net.minecraft.server.v1_8_R3.MobEffect; +import org.bukkit.Bukkit; import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; import org.bukkit.entity.Entity; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; +import org.bukkit.plugin.RegisteredServiceProvider; import org.bukkit.potion.PotionEffectType; import com.mineplex.anticheat.api.MineplexLink; @@ -21,6 +23,8 @@ public class MineplexLinkImpl implements MineplexLink { private final DisguiseManager _disguiseManager = Managers.require(DisguiseManager.class); + private final RegisteredServiceProvider _relationProvider = Bukkit.getServicesManager().getRegistration(RelationProvider.class); + @Override public EntityType getActiveDisguise(Player player) { @@ -74,6 +78,6 @@ public class MineplexLinkImpl implements MineplexLink @Override public boolean canDamage(Player attacker, Entity target) { - return true; + return _relationProvider != null && _relationProvider.getProvider().canDamage(attacker, target); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/antihack/RelationProvider.java b/Plugins/Mineplex.Core/src/mineplex/core/antihack/RelationProvider.java new file mode 100644 index 000000000..0a4b741d1 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/antihack/RelationProvider.java @@ -0,0 +1,9 @@ +package mineplex.core.antihack; + +import org.bukkit.entity.Entity; +import org.bukkit.entity.Player; + +public interface RelationProvider +{ + boolean canDamage(Player player, Entity target); +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/Arcade.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/Arcade.java index 68e92af90..26a762345 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/Arcade.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/Arcade.java @@ -7,7 +7,10 @@ import mineplex.core.aprilfools.AprilFoolsManager; import net.minecraft.server.v1_8_R3.MinecraftServer; import org.bukkit.Bukkit; +import org.bukkit.entity.Entity; +import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; +import org.bukkit.plugin.ServicePriority; import org.bukkit.plugin.java.JavaPlugin; import org.spigotmc.SpigotConfig; @@ -19,6 +22,7 @@ import mineplex.core.TwitchIntegrationFix; import mineplex.core.account.CoreClientManager; import mineplex.core.achievement.AchievementManager; import mineplex.core.antihack.AntiHack; +import mineplex.core.antihack.RelationProvider; import mineplex.core.antihack.logging.AntihackLogger; import mineplex.core.blockrestore.BlockRestore; import mineplex.core.blood.Blood; @@ -80,6 +84,7 @@ import mineplex.minecraft.game.core.combat.CombatManager; import mineplex.minecraft.game.core.damage.DamageManager; import nautilus.game.arcade.anticheatmetadata.GameInfoMetadata; +import nautilus.game.arcade.game.Game; import nautilus.game.arcade.game.GameServerConfig; import static mineplex.core.Managers.require; @@ -97,6 +102,26 @@ public class Arcade extends JavaPlugin @Override public void onEnable() { + getServer().getServicesManager().register(RelationProvider.class, new RelationProvider() + { + @Override + public boolean canDamage(Player player, Entity target) + { + if (target instanceof Player) + { + return _gameManager.canHurt(player, (Player) target); + } + else if (target instanceof LivingEntity) + { + return _gameManager.GetGame() != null && _gameManager.GetGame().GetState() == Game.GameState.Live; + } + else + { + return false; + } + } + }, this, ServicePriority.Normal); + Bukkit.setSpawnRadius(0); //Delete Old Games Folders DeleteFolders(); From ac7492152a0c8d0d56816249e9de4a04f5984208 Mon Sep 17 00:00:00 2001 From: Kenny Date: Sun, 9 Apr 2017 23:30:30 -0400 Subject: [PATCH 80/98] Fix average TPS reporting --- .../src/mineplex/core/status/ServerStatusManager.java | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/status/ServerStatusManager.java b/Plugins/Mineplex.Core/src/mineplex/core/status/ServerStatusManager.java index 1b218e9cf..69a8a4e65 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/status/ServerStatusManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/status/ServerStatusManager.java @@ -1,9 +1,7 @@ package mineplex.core.status; import java.io.File; -import java.lang.reflect.Constructor; import java.util.Collection; -import java.util.UUID; import org.bukkit.Bukkit; import org.bukkit.entity.Player; @@ -11,12 +9,6 @@ import org.bukkit.event.EventHandler; import org.bukkit.event.server.ServerListPingEvent; import org.bukkit.plugin.java.JavaPlugin; -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.mojang.authlib.GameProfile; -import com.mojang.authlib.properties.PropertyMap; -import com.mojang.util.UUIDTypeAdapter; - import mineplex.core.MiniPlugin; import mineplex.core.account.CoreClientManager; import mineplex.core.common.Constants; @@ -166,7 +158,7 @@ public class ServerStatusManager extends MiniPlugin String motd = _enabled ? event.getMotd() : "Restarting"; int playerCount = _clientManager.getPlayerCountIncludingConnecting(); int maxPlayerCount = event.getMaxPlayers(); - int tps = (int) _lagMeter.getRecentTicksPercentageAverage(); + int tps = (int) Math.max(_lagMeter.getRecentTicksPercentageAverage(), _lagMeter.getTicksPerSecond()); String address = Bukkit.getServer().getIp().isEmpty() ? "localhost" : Bukkit.getServer().getIp(); int port = _plugin.getServer().getPort(); String group = _plugin.getConfig().getString("serverstatus.group") + ""; From 5c5a368ebebe783ede46bae3737c563f97c8e9e3 Mon Sep 17 00:00:00 2001 From: cnr Date: Thu, 13 Apr 2017 01:19:30 -0600 Subject: [PATCH 81/98] Only register HeadRoll action once --- Plugins/Mineplex.Core/src/mineplex/core/antihack/AntiHack.java | 1 - 1 file changed, 1 deletion(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/antihack/AntiHack.java b/Plugins/Mineplex.Core/src/mineplex/core/antihack/AntiHack.java index 97dc81702..5c7205fd3 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/antihack/AntiHack.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/antihack/AntiHack.java @@ -109,7 +109,6 @@ public class AntiHack extends MiniPlugin .put(Glide.class, new ImmediateBanAction(10000)) .put(Speed.class, new ImmediateBanAction(10000)) .put(HeadRoll.class, new ImmediateBanAction(2000)) - .put(HeadRoll.class, new GEPBanAction(1)) .put(BadPackets.class, new GEPBanAction(300)) .put(KillauraTypeB.class, new GEPBanAction(100)) .build(); From 4e82233871a3ab119368ba65887443ba62700efb Mon Sep 17 00:00:00 2001 From: cnr Date: Thu, 13 Apr 2017 02:42:35 -0600 Subject: [PATCH 82/98] Make no-op thresholds a true no-op --- Plugins/Mineplex.Core/src/mineplex/core/antihack/AntiHack.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/antihack/AntiHack.java b/Plugins/Mineplex.Core/src/mineplex/core/antihack/AntiHack.java index 5c7205fd3..3e4d9ee7a 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/antihack/AntiHack.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/antihack/AntiHack.java @@ -100,7 +100,7 @@ public class AntiHack extends MiniPlugin .put(Toggle.class, new CheckThresholds("AutoSneak", 100, 200, 300)) .build(); - private static final CheckThresholds NOOP_THRESHOLD = new CheckThresholds("Unknown", 0, Integer.MAX_VALUE, Integer.MAX_VALUE); + private static final CheckThresholds NOOP_THRESHOLD = new CheckThresholds("Unknown", Integer.MAX_VALUE, Integer.MAX_VALUE, Integer.MAX_VALUE); private static final Map, AntiHackAction> ACTIONS = ImmutableMap., AntiHackAction>builder() .put(KillauraTypeA.class, new ImmediateBanAction(200)) From ff3dbe5d934642fb23c3eac37bb3e432f8d8951d Mon Sep 17 00:00:00 2001 From: cnr Date: Thu, 13 Apr 2017 13:30:53 -0600 Subject: [PATCH 83/98] Add missing AutoSneak ban --- Plugins/Mineplex.Core/src/mineplex/core/antihack/AntiHack.java | 1 + 1 file changed, 1 insertion(+) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/antihack/AntiHack.java b/Plugins/Mineplex.Core/src/mineplex/core/antihack/AntiHack.java index 3e4d9ee7a..ef94f4b76 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/antihack/AntiHack.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/antihack/AntiHack.java @@ -109,6 +109,7 @@ public class AntiHack extends MiniPlugin .put(Glide.class, new ImmediateBanAction(10000)) .put(Speed.class, new ImmediateBanAction(10000)) .put(HeadRoll.class, new ImmediateBanAction(2000)) + .put(Toggle.class, new ImmediateBanAction(500)) .put(BadPackets.class, new GEPBanAction(300)) .put(KillauraTypeB.class, new GEPBanAction(100)) .build(); From 8cbf8e8f1e81f76b8e2352c20ec879cdf5c65cf5 Mon Sep 17 00:00:00 2001 From: cnr Date: Thu, 13 Apr 2017 14:41:38 -0600 Subject: [PATCH 84/98] Bump lower bound for Reach VL --- Plugins/Mineplex.Core/src/mineplex/core/antihack/AntiHack.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/antihack/AntiHack.java b/Plugins/Mineplex.Core/src/mineplex/core/antihack/AntiHack.java index ef94f4b76..a0c547320 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/antihack/AntiHack.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/antihack/AntiHack.java @@ -89,7 +89,7 @@ public class AntiHack extends MiniPlugin private static final Map, CheckThresholds> CHECKS = ImmutableMap., CheckThresholds>builder() .put(KillauraTypeA.class, new CheckThresholds("Kill Aura", 0, 25, 50)) .put(KillauraTypeB.class, new CheckThresholds("High CPS", 0, 0, Integer.MAX_VALUE)) - .put(KillauraTypeC.class, new CheckThresholds("Reach", 0, Integer.MAX_VALUE, Integer.MAX_VALUE)) + .put(KillauraTypeC.class, new CheckThresholds("Reach", 25, Integer.MAX_VALUE, Integer.MAX_VALUE)) .put(KillauraTypeD.class, new CheckThresholds("Kill Aura", 500, 1000, 1500)) .put(KillauraTypeE.class, new CheckThresholds("Kill Aura", 1000, 2000, 5000)) .put(KillauraTypeF.class, new CheckThresholds("Kill Aura", 200, 300, 400)) From 732d2cbeb85d22ed92cb8df590e2d482b6e2f5d6 Mon Sep 17 00:00:00 2001 From: cnr Date: Thu, 13 Apr 2017 17:43:21 -0600 Subject: [PATCH 85/98] Bump VL bounds for KillAura type A --- Plugins/Mineplex.Core/src/mineplex/core/antihack/AntiHack.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/antihack/AntiHack.java b/Plugins/Mineplex.Core/src/mineplex/core/antihack/AntiHack.java index a0c547320..b59982c6f 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/antihack/AntiHack.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/antihack/AntiHack.java @@ -87,7 +87,7 @@ import mineplex.serverdata.commands.ServerCommandManager; public class AntiHack extends MiniPlugin { private static final Map, CheckThresholds> CHECKS = ImmutableMap., CheckThresholds>builder() - .put(KillauraTypeA.class, new CheckThresholds("Kill Aura", 0, 25, 50)) + .put(KillauraTypeA.class, new CheckThresholds("Kill Aura", 25, 45, 60)) .put(KillauraTypeB.class, new CheckThresholds("High CPS", 0, 0, Integer.MAX_VALUE)) .put(KillauraTypeC.class, new CheckThresholds("Reach", 25, Integer.MAX_VALUE, Integer.MAX_VALUE)) .put(KillauraTypeD.class, new CheckThresholds("Kill Aura", 500, 1000, 1500)) From bc80b2137216af45cc024821386a10bb02d0ca27 Mon Sep 17 00:00:00 2001 From: cnr Date: Thu, 13 Apr 2017 20:44:33 -0600 Subject: [PATCH 86/98] Update skyfall in the game selector --- .../mineplex/hub/server/ServerManager.java | 2 +- .../hub/server/ui/ServerGameMenu.java | 31 +++++++++++++++---- 2 files changed, 26 insertions(+), 7 deletions(-) diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ServerManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ServerManager.java index 97e5c11a0..a305c124b 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ServerManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ServerManager.java @@ -747,7 +747,7 @@ public class ServerManager extends MiniPlugin implements BrawlShopProvider public ServerNpcShop getBetaShop() { - return _serverNpcShopMap.get("Skyfall BETA"); + return _serverNpcShopMap.get("Skyfall"); } public ServerNpcShop getUHCShop() diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerGameMenu.java b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerGameMenu.java index 33c41236a..7c8b65b8b 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerGameMenu.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerGameMenu.java @@ -3,20 +3,40 @@ package mineplex.hub.server.ui; import java.util.ArrayList; import java.util.List; -import mineplex.core.boosters.Booster; -import mineplex.core.shop.item.IButton; import org.bukkit.ChatColor; import org.bukkit.Color; import org.bukkit.Material; import org.bukkit.entity.Player; import mineplex.core.account.CoreClientManager; +import mineplex.core.boosters.Booster; import mineplex.core.common.util.C; import mineplex.core.donation.DonationManager; import mineplex.core.itemstack.ItemBuilder; +import mineplex.core.shop.item.IButton; import mineplex.core.shop.page.ShopPageBase; import mineplex.hub.server.ServerManager; -import mineplex.hub.server.ui.button.*; +import mineplex.hub.server.ui.button.SelectBETAButton; +import mineplex.hub.server.ui.button.SelectBHButton; +import mineplex.hub.server.ui.button.SelectBLDButton; +import mineplex.hub.server.ui.button.SelectBRButton; +import mineplex.hub.server.ui.button.SelectBawkButton; +import mineplex.hub.server.ui.button.SelectCLANSButton; +import mineplex.hub.server.ui.button.SelectCSButton; +import mineplex.hub.server.ui.button.SelectCTFButton; +import mineplex.hub.server.ui.button.SelectDMTButton; +import mineplex.hub.server.ui.button.SelectDOMButton; +import mineplex.hub.server.ui.button.SelectFEATButton; +import mineplex.hub.server.ui.button.SelectMINButton; +import mineplex.hub.server.ui.button.SelectMSButton; +import mineplex.hub.server.ui.button.SelectPLAYERButton; +import mineplex.hub.server.ui.button.SelectSBButton; +import mineplex.hub.server.ui.button.SelectSGButton; +import mineplex.hub.server.ui.button.SelectSKYButton; +import mineplex.hub.server.ui.button.SelectSSMButton; +import mineplex.hub.server.ui.button.SelectTDMButton; +import mineplex.hub.server.ui.button.SelectUHCButton; +import mineplex.hub.server.ui.button.SelectWIZButton; public class ServerGameMenu extends ShopPageBase { @@ -197,15 +217,14 @@ public class ServerGameMenu extends ShopPageBase C.Reset + "and raid others!", }, "Clans", null, new SelectCLANSButton(this)); - add(41, Material.BREWING_STAND_ITEM, C.cYellowB + "Skyfall " + C.cGray + "Elytra Game", new String[] + add(41, Material.DIAMOND_BOOTS, C.cYellowB + "Skyfall " + C.cGray + "Elytra Game", new String[] { - (_extraValue ? C.cAquaB : C.cWhiteB) + "BETA GAME", C.Reset + "", C.Reset + "1.9 Game, 1.8 PVP", C.Reset + "Fly through sky islands,", C.Reset + "collect gear and defeat", C.Reset + "all enemies.", - }, "BETA", "Beta_Games", new SelectBETAButton(this)); + }, "SF", "Beta_Games", new SelectBETAButton(this)); } private void add(int slot, Material material, String title, String[] lore, String serverTag, String boosterGroup, IButton button) From 7e7ac95ccbd7cc0adbf8954aea4066603d3d1640 Mon Sep 17 00:00:00 2001 From: cnr Date: Thu, 13 Apr 2017 20:47:19 -0600 Subject: [PATCH 87/98] Change Skyfall stats icon to diamond boots --- .../src/mineplex/core/achievement/AchievementCategory.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementCategory.java b/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementCategory.java index 22cfcc59d..37805a3be 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementCategory.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementCategory.java @@ -209,7 +209,7 @@ public enum AchievementCategory 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()); + Material.DIAMOND_BOOTS, 0, GameCategory.SURVIVAL, null, false, GameDisplay.Skyfall.getGameId(), GameDisplay.SkyfallTeams.getGameId()); private String _name; private String[] _statsToPull; From b30a706543e8ff769d04e64f58f47d4afe328a71 Mon Sep 17 00:00:00 2001 From: cnr Date: Fri, 14 Apr 2017 22:33:54 -0600 Subject: [PATCH 88/98] Disable Skyfall booster kit --- .../src/nautilus/game/arcade/game/games/skyfall/Skyfall.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) 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 d2f9223e6..1043881ad 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 @@ -42,7 +42,6 @@ import org.bukkit.inventory.Inventory; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.ItemMeta; -import com.avaje.ebeaninternal.server.persist.dml.UpdatePlan; import com.mineplex.anticheat.checks.move.Glide; import com.mineplex.anticheat.checks.move.HeadRoll; import com.mineplex.anticheat.checks.move.Speed; @@ -79,7 +78,6 @@ import nautilus.game.arcade.GameType; import nautilus.game.arcade.events.GameStateChangeEvent; 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; @@ -171,7 +169,7 @@ public abstract class Skyfall extends Game new Kit[] { new KitSpeeder(manager), - new KitBooster(manager), // Broken? :( + //new KitBooster(manager), // Broken? :( new KitJouster(manager), new KitStunner(manager), //new KitSurefoot(manager), From 09dc7edaada779b579882daae7f97a799ffd2c79 Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Sat, 15 Apr 2017 01:17:58 -0300 Subject: [PATCH 89/98] Added Spring chest to title trackers --- .../mineplex/core/titles/tracks/standard/HolidayCheerTrack.java | 1 + .../src/mineplex/core/titles/tracks/standard/LuckyTrack.java | 1 + .../core/titles/tracks/standard/TreasureHunterTrack.java | 1 + 3 files changed, 3 insertions(+) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/standard/HolidayCheerTrack.java b/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/standard/HolidayCheerTrack.java index 5f5b40058..7a88cb9f4 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/standard/HolidayCheerTrack.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/standard/HolidayCheerTrack.java @@ -53,6 +53,7 @@ public class HolidayCheerTrack extends Track HOLIDAY_CHESTS.add(TreasureType.GINGERBREAD); HOLIDAY_CHESTS.add(TreasureType.LOVE_CHEST); HOLIDAY_CHESTS.add(TreasureType.ST_PATRICKS); + HOLIDAY_CHESTS.add(TreasureType.SPRING); HOLIDAY_SETS.add(SetFreedom.class); HOLIDAY_SETS.add(SetCupidsLove.class); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/standard/LuckyTrack.java b/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/standard/LuckyTrack.java index 7bbf3bb83..9de427d99 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/standard/LuckyTrack.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/standard/LuckyTrack.java @@ -39,6 +39,7 @@ public class LuckyTrack extends Track MULTIPLIER.put(TreasureType.TRICK_OR_TREAT, 2); MULTIPLIER.put(TreasureType.LOVE_CHEST, 2); MULTIPLIER.put(TreasureType.ST_PATRICKS, 2); + MULTIPLIER.put(TreasureType.SPRING, 2); MULTIPLIER.put(TreasureType.OMEGA, 3); IRON.add(Material.IRON_SPADE); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/standard/TreasureHunterTrack.java b/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/standard/TreasureHunterTrack.java index 30e7d193c..b7faf7d89 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/standard/TreasureHunterTrack.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/standard/TreasureHunterTrack.java @@ -31,6 +31,7 @@ public class TreasureHunterTrack extends Track POINTS.put(TreasureType.GINGERBREAD, 25); POINTS.put(TreasureType.LOVE_CHEST, 25); POINTS.put(TreasureType.ST_PATRICKS, 25); + POINTS.put(TreasureType.SPRING, 25); POINTS.put(TreasureType.OMEGA, 50); POINTS.put(TreasureType.MINESTRIKE, 3); } From 2baaf4664e096adbb5b8c7c98b1fbc94f0064d02 Mon Sep 17 00:00:00 2001 From: cnr Date: Fri, 14 Apr 2017 22:39:06 -0600 Subject: [PATCH 90/98] Fix UHC and Skyfall player counts --- .../src/mineplex/hub/server/ui/ServerGameMenu.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerGameMenu.java b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerGameMenu.java index 7c8b65b8b..0253eaa66 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerGameMenu.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerGameMenu.java @@ -114,13 +114,13 @@ public class ServerGameMenu extends ShopPageBase C.Reset + "Win! Fight! Send enemies flying in Skywars!", }, new String[] {"SKY", "SKY2"}, "Skywars", new SelectSKYButton(this)); - add(15, Material.GOLDEN_APPLE, C.cYellowB + "UHC " + C.cGray + "Ultra Hardcore Mode", new String[] + add(15, Material.GOLDEN_APPLE, (byte) 0, C.cYellowB + "UHC " + C.cGray + "Ultra Hardcore Mode", new String[] { C.Reset + "", C.Reset + "Extremely hard team-based survival ", C.Reset + "Gather materials and fight your way", C.Reset + "to become the last team standing!", - }, "UHC", "UHC", new SelectUHCButton(this)); + }, new String[] {"UHC", "UHC2", "UHCS", "UHCS2"}, "UHC", new SelectUHCButton(this)); add(17, Material.BLAZE_ROD, C.cYellowB + "Wizards " + C.cGray + "Last Man Standing", new String[] { @@ -217,14 +217,14 @@ public class ServerGameMenu extends ShopPageBase C.Reset + "and raid others!", }, "Clans", null, new SelectCLANSButton(this)); - add(41, Material.DIAMOND_BOOTS, C.cYellowB + "Skyfall " + C.cGray + "Elytra Game", new String[] + add(41, Material.DIAMOND_BOOTS, (byte)0, C.cYellowB + "Skyfall " + C.cGray + "Elytra Game", new String[] { C.Reset + "", C.Reset + "1.9 Game, 1.8 PVP", C.Reset + "Fly through sky islands,", C.Reset + "collect gear and defeat", C.Reset + "all enemies.", - }, "SF", "Beta_Games", new SelectBETAButton(this)); + }, new String[]{"SF","SF2"}, "Beta_Games", new SelectBETAButton(this)); } private void add(int slot, Material material, String title, String[] lore, String serverTag, String boosterGroup, IButton button) From 56e15ab2d90f45c8b9a39cd89dff2d93389c4491 Mon Sep 17 00:00:00 2001 From: cnr Date: Fri, 14 Apr 2017 23:11:08 -0600 Subject: [PATCH 91/98] Add Skyfall teams to game menu --- .../mineplex/hub/server/ui/ServerNpcShop.java | 3 ++ .../hub/server/ui/SkyfallServerTypePage.java | 48 +++++++++++++++++++ 2 files changed, 51 insertions(+) create mode 100644 Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/SkyfallServerTypePage.java diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerNpcShop.java b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerNpcShop.java index 107f9fb16..eb087afa5 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerNpcShop.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerNpcShop.java @@ -36,6 +36,9 @@ public class ServerNpcShop extends ShopBase case "UHC": return new UHCServerTypePage(getPlugin(), this, getClientManager(), getDonationManager(), player); + case "SF": + return new SkyfallServerTypePage(getPlugin(), this, getClientManager(), getDonationManager(), player); + default: return new ServerNpcPage(getPlugin(), this, getClientManager(), getDonationManager(), _serverGroup.getServerNpcName(), player, _serverGroup.getPrefix()); } diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/SkyfallServerTypePage.java b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/SkyfallServerTypePage.java new file mode 100644 index 000000000..893437bce --- /dev/null +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/SkyfallServerTypePage.java @@ -0,0 +1,48 @@ +package mineplex.hub.server.ui; + +import org.bukkit.Material; +import org.bukkit.entity.Player; + +import mineplex.core.account.CoreClientManager; +import mineplex.core.common.util.C; +import mineplex.core.donation.DonationManager; +import mineplex.core.itemstack.ItemBuilder; +import mineplex.core.shop.page.ShopPageBase; +import mineplex.hub.server.ServerManager; + +public class SkyfallServerTypePage extends ShopPageBase +{ + public SkyfallServerTypePage(ServerManager plugin, ServerNpcShop shop, CoreClientManager clientManager, DonationManager donationManager, Player player) + { + super(plugin, shop, clientManager, donationManager, "Skyfall", player, 27); + + buildPage(); + } + + @Override + protected void buildPage() + { + setItem(12, new ItemBuilder(Material.SKULL_ITEM, 1, (byte) 3).setTitle(C.Reset + C.cYellow + "Skyfall Solo") + .addLore(new String[] + { + C.Reset + "", + C.Reset + C.cGreen + "Click to Play", + }).build()); + + setItem(14, new ItemBuilder(Material.SKULL_ITEM, 2, (byte) 3).setTitle(C.Reset + C.cYellow + "Skyfall Teams") + .addLore(new String[] + { + C.Reset + "", + C.Reset + C.cGreen + "Click to Play" + }).build()); + + getButtonMap().put(12, (player, __) -> getShop().openPageForPlayer(player, new ServerNpcPage(getPlugin(), getShop(), getClientManager(), getDonationManager(), "Skyfall Solo", player, "SF"))); + getButtonMap().put(14, (player, __) -> getShop().openPageForPlayer(player, new ServerNpcPage(getPlugin(), getShop(), getClientManager(), getDonationManager(), "Skyfall Teams", player, "SF2"))); + } + + public void Update() + { + getButtonMap().clear(); + buildPage(); + } +} From dad00171a7dcb24e42403067a301db7211fcaa7f Mon Sep 17 00:00:00 2001 From: cnr Date: Sun, 16 Apr 2017 00:49:12 -0600 Subject: [PATCH 92/98] Clean up 'banwave' logic --- .../src/mineplex/core/antihack/actions/BanwaveAction.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/antihack/actions/BanwaveAction.java b/Plugins/Mineplex.Core/src/mineplex/core/antihack/actions/BanwaveAction.java index 643f223d7..6840ec600 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/antihack/actions/BanwaveAction.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/antihack/actions/BanwaveAction.java @@ -12,8 +12,8 @@ import mineplex.core.common.util.UtilServer; public class BanwaveAction extends AntiHackAction { - private static final long BAN_DELAY_AVERAGE = TimeUnit.HOURS.convert(1, TimeUnit.MILLISECONDS) + TimeUnit.MINUTES.convert(15, TimeUnit.MILLISECONDS); - private static final long BAN_DELAY_VARIANCE_SPAN = TimeUnit.HOURS.convert(1, TimeUnit.HOURS) + TimeUnit.MINUTES.convert(45, TimeUnit.MILLISECONDS); // 45 minutes on either side + private static final int BAN_DELAY_MINIMUM_MINUTES = 30; + private static final int BAN_DELAY_MAXIMUM_MINUTES = (int) TimeUnit.MINUTES.convert(2, TimeUnit.HOURS); public BanwaveAction(int vl) { @@ -31,7 +31,8 @@ public class BanwaveAction extends AntiHackAction if (event.getViolations() >= this.getMinVl()) { // Delay bans by 1.25 hours +/- .75 hours for fuzzing - long banTime = System.currentTimeMillis() + BAN_DELAY_AVERAGE + (UtilMath.r((int)BAN_DELAY_VARIANCE_SPAN) - (BAN_DELAY_VARIANCE_SPAN / 2)); + long banDelayMinutes = UtilMath.r(BAN_DELAY_MAXIMUM_MINUTES - BAN_DELAY_MINIMUM_MINUTES) + BAN_DELAY_MINIMUM_MINUTES; + long banTime = System.currentTimeMillis() + TimeUnit.MILLISECONDS.convert(banDelayMinutes, TimeUnit.MINUTES); Managers.get(BanWaveManager.class).insertBanWaveInfo( event.getPlayer(), banTime, From 2263e8bfcb15cbfe0de53b839c58bbb5e2667be1 Mon Sep 17 00:00:00 2001 From: cnr Date: Sun, 16 Apr 2017 01:09:12 -0600 Subject: [PATCH 93/98] Ignore movement checks in Runner --- .../game/arcade/game/games/runner/Runner.java | 22 +++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/runner/Runner.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/runner/Runner.java index 28f4b1bf3..53d86ee3d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/runner/Runner.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/runner/Runner.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.Effect; import org.bukkit.Material; import org.bukkit.block.Block; @@ -17,9 +19,15 @@ import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.entity.EntityChangeBlockEvent; -import org.bukkit.event.entity.ProjectileHitEvent; import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.event.entity.ProjectileHitEvent; +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.util.MapUtil; import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilTime; @@ -27,17 +35,18 @@ import mineplex.core.projectile.IThrown; import mineplex.core.projectile.ProjectileUser; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; + import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.GameType; import nautilus.game.arcade.game.SoloGame; -import nautilus.game.arcade.game.games.runner.kits.*; +import nautilus.game.arcade.game.games.runner.kits.KitArcher; +import nautilus.game.arcade.game.games.runner.kits.KitFrosty; +import nautilus.game.arcade.game.games.runner.kits.KitLeaper; import nautilus.game.arcade.game.modules.compass.CompassModule; import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.managers.chat.ChatStatData; import nautilus.game.arcade.stats.DistanceTraveledStatTracker; -import net.minecraft.server.v1_8_R3.EntityArrow; - public class Runner extends SoloGame implements IThrown { private HashMap _blocks = new HashMap(); @@ -85,6 +94,11 @@ public class Runner extends SoloGame implements IThrown .setGiveCompassToSpecs(true) .setGiveCompassToAlive(false) .register(this); + + AntiHack antiHack = Managers.get(AntiHack.class); + antiHack.addIgnoredCheck(Speed.class); + antiHack.addIgnoredCheck(Glide.class); + antiHack.addIgnoredCheck(HeadRoll.class); } @EventHandler From bc38d895a03c38a58dcca97901b6f2b705bfdeaf Mon Sep 17 00:00:00 2001 From: Alexander Meech Date: Sun, 16 Apr 2017 16:53:18 -0400 Subject: [PATCH 94/98] Update CUST-1 to track Spring Chests --- .../mineplex/staffServer/customerSupport/CustomerSupport.java | 1 + 1 file changed, 1 insertion(+) diff --git a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/customerSupport/CustomerSupport.java b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/customerSupport/CustomerSupport.java index 9bb7990de..dceba28ab 100644 --- a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/customerSupport/CustomerSupport.java +++ b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/customerSupport/CustomerSupport.java @@ -414,6 +414,7 @@ public class CustomerSupport extends MiniPlugin implements ResultSetCallable caller.sendMessage(C.cBlue + "Gingerbread Chests Received: " + C.cYellow + gingerbreadChestsReceived + " " + C.cBlue + "Minestrike Chests Received: " + C.cYellow + minestrikeChestsReceived); caller.sendMessage(C.cBlue + "Love Chests Received: " + C.cYellow + loveChestsReceived); caller.sendMessage(C.cBlue + "St Patrick's Chests Received: " + C.cYellow + stPatricksChestReceived); + caller.sendMessage(C.cBlue + "Spring Chests Received: " + C.cYellow + springChestsReceived); caller.sendMessage(C.cBlue + "Game Amplifiers Received: " + C.cYellow + boostersReceived); caller.sendMessage(C.cBlue + "Rune Amplifiers (20 min/60 min) Received: " + C.cYellow + runeAmplifier20 + "/" + runeAmplifier60); caller.sendMessage(C.cBlue + "Clan Banner Usage: " + getLockedFreedomStr(client.getUniqueId(), "Clan Banner Usage") + " " + C.cBlue + "Clan Banner Editor: " + getLockedFreedomStr(client.getUniqueId(), "Clan Banner Editor")); From 61409d0bfeccb6e240d13e3aa37fb8241363ae88 Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Thu, 2 Mar 2017 15:58:30 -0300 Subject: [PATCH 95/98] Possible fix for duplicated items in some chests --- .../mineplex/core/reward/RewardManager.java | 10 ++++----- .../reward/rewards/UnknownPackageReward.java | 21 +++++++++++++++---- 2 files changed, 22 insertions(+), 9 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardManager.java b/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardManager.java index fb9891e27..171bfa55e 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardManager.java @@ -570,7 +570,7 @@ public class RewardManager addReward(Type.TRICK_OR_TREAT, new SpinTicketReward(_clientManager, 1, 3, rarity, 150, 0)); addReward(Type.TRICK_OR_TREAT, new GameAmplifierReward(_inventoryManager, 1, 2, rarity, 150, 0)); addReward(Type.TRICK_OR_TREAT, new RuneAmplifierReward(_inventoryManager, 20, 1, 3, rarity, 120, 0)); - addReward(Type.TRICK_OR_TREAT, new UnknownPackageReward(_donationManager, "Clan Banner Access", "Wear/Place Clan Banner", "Clan Banner Usage", new ItemStack(Material.BANNER), rarity, 110, 0)); + addReward(Type.TRICK_OR_TREAT, new UnknownPackageReward(_donationManager, _inventoryManager, "Clan Banner Access", "Wear/Place Clan Banner", "Clan Banner Usage", new ItemStack(Material.BANNER), rarity, 110, 0)); addReward(Type.TRICK_OR_TREAT, new ChestReward(_inventoryManager, TreasureType.OLD, 1, 5, rarity, 150, 0)); addReward(Type.TRICK_OR_TREAT, new ChestReward(_inventoryManager, TreasureType.ANCIENT, 1, 5, rarity, 80, 0)); @@ -583,7 +583,7 @@ public class RewardManager // THANKFUL addReward(Type.THANKFUL, new SpinTicketReward(_clientManager, 1, 3, rarity, 150, 0)); addReward(Type.THANKFUL, new RuneAmplifierReward(_inventoryManager, 20, 1, 3, rarity, 120, 0)); - addReward(Type.THANKFUL, new UnknownPackageReward(_donationManager, "Clan Banner Access", "Wear/Place Clan Banner", "Clan Banner Usage", new ItemStack(Material.BANNER), rarity, 110, 0)); + addReward(Type.THANKFUL, new UnknownPackageReward(_donationManager, _inventoryManager, "Clan Banner Access", "Wear/Place Clan Banner", "Clan Banner Usage", new ItemStack(Material.BANNER), rarity, 110, 0)); addReward(Type.THANKFUL, new ChestReward(_inventoryManager, TreasureType.OLD, 1, 5, rarity, 150, 0)); addReward(Type.THANKFUL, new ChestReward(_inventoryManager, TreasureType.ANCIENT, 1, 5, rarity, 80, 0)); @@ -881,7 +881,7 @@ public class RewardManager public UnknownPackageReward addMount(Type type, Mount mount, RewardRarity rarity, int weight, int shards) { - UnknownPackageReward reward = new UnknownPackageReward(_donationManager, "Mount", mount.getDisplayName(), mount.getName(), + UnknownPackageReward reward = new UnknownPackageReward(_donationManager, _inventoryManager, "Mount", mount.getDisplayName(), mount.getName(), new ItemStack(mount.getDisplayMaterial(), 1, (short) 0, (byte) mount.getDisplayData()), rarity, weight, shards); addReward(type, reward); return reward; @@ -907,7 +907,7 @@ public class RewardManager public UnknownPackageReward addHatReward(RewardPool.Type type, HatGadget gadget, RewardRarity rarity, int weight) { UnknownPackageReward reward = - new UnknownPackageReward(_donationManager, gadget.getGadgetType().getCategoryType(), gadget.getDisplayName(), + new UnknownPackageReward(_donationManager, _inventoryManager, gadget.getGadgetType().getCategoryType(), gadget.getDisplayName(), gadget.getName(), gadget.getHelmetItem(), rarity, weight, getShards(rarity)); addReward(type, reward); return reward; @@ -934,7 +934,7 @@ public class RewardManager display = gadget.getDisplayItem(); } UnknownPackageReward reward = - new UnknownPackageReward(_donationManager, gadget.getGadgetType().getCategoryType(), displayName, + new UnknownPackageReward(_donationManager, _inventoryManager, gadget.getGadgetType().getCategoryType(), displayName, gadget.getName(), display, rarity, weight, shards, gadget.getAlternativePackageNames()); addReward(type, reward); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/reward/rewards/UnknownPackageReward.java b/Plugins/Mineplex.Core/src/mineplex/core/reward/rewards/UnknownPackageReward.java index 48ce5dc23..c14cbe35d 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/reward/rewards/UnknownPackageReward.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/reward/rewards/UnknownPackageReward.java @@ -1,13 +1,15 @@ package mineplex.core.reward.rewards; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; + import mineplex.core.common.currency.GlobalCurrency; import mineplex.core.donation.DonationManager; +import mineplex.core.inventory.InventoryManager; import mineplex.core.reward.Reward; import mineplex.core.reward.RewardData; import mineplex.core.reward.RewardRarity; import mineplex.core.reward.RewardType; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; /** * Created by shaun on 14-09-12. @@ -15,16 +17,18 @@ import org.bukkit.inventory.ItemStack; public class UnknownPackageReward extends Reward { protected DonationManager _donationManager; + protected InventoryManager _inventoryManager; private ItemStack _itemStack; private String _header; private String _name; private String _packageName; private String[] _alternativeNames; - public UnknownPackageReward(DonationManager donationManager, String header, String name, String packageName, ItemStack itemStack, RewardRarity rarity, int weight, int shardValue) + public UnknownPackageReward(DonationManager donationManager, InventoryManager inventoryManager, String header, String name, String packageName, ItemStack itemStack, RewardRarity rarity, int weight, int shardValue) { super(rarity, weight, shardValue); _donationManager = donationManager; + _inventoryManager = inventoryManager; _header = header; _name = name; _packageName = packageName; @@ -32,10 +36,11 @@ public class UnknownPackageReward extends Reward _alternativeNames = new String[]{}; } - public UnknownPackageReward(DonationManager donationManager, String header, String name, String packageName, ItemStack itemStack, RewardRarity rarity, int weight, int shardValue, String... alternativeNames) + public UnknownPackageReward(DonationManager donationManager, InventoryManager inventoryManager, String header, String name, String packageName, ItemStack itemStack, RewardRarity rarity, int weight, int shardValue, String... alternativeNames) { super(rarity, weight, shardValue); _donationManager = donationManager; + _inventoryManager = inventoryManager; _header = header; _name = name; _packageName = packageName; @@ -64,6 +69,10 @@ public class UnknownPackageReward extends Reward { hasItem = true; } + else if (_inventoryManager.Get(player).getItemCount(_packageName) > 0) + { + hasItem = true; + } else { for (String altName : _alternativeNames) @@ -72,6 +81,10 @@ public class UnknownPackageReward extends Reward { hasItem = true; } + if (_inventoryManager.Get(player).getItemCount(altName) > 0) + { + hasItem = true; + } } } return !hasItem; From 6bf6725616c8bda6773858d0beabbb4aa0579874 Mon Sep 17 00:00:00 2001 From: cnr Date: Tue, 18 Apr 2017 01:40:09 -0700 Subject: [PATCH 96/98] Commit missed conflict resolution --- .../src/mineplex/core/reward/rewards/PetReward.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/reward/rewards/PetReward.java b/Plugins/Mineplex.Core/src/mineplex/core/reward/rewards/PetReward.java index 23e4e179a..0f6839279 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/reward/rewards/PetReward.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/reward/rewards/PetReward.java @@ -26,7 +26,7 @@ public class PetReward extends UnknownPackageReward public PetReward(PetManager petManager, InventoryManager inventoryManager, DonationManager donationManager, String name, String packageName, PetType petType, RewardRarity rarity, int weight, int shardValue) { - super(donationManager, "Pet", name, packageName, new ItemStack(Material.MONSTER_EGG, 1, petType.getEntityType().getTypeId()), rarity, weight, shardValue); + super(donationManager, inventoryManager, "Pet", name, packageName, new ItemStack(Material.MONSTER_EGG, 1, petType.getEntityType().getTypeId()), rarity, weight, shardValue); _petManager = petManager; _inventoryManager = inventoryManager; From ffdbebf3ee5c145da1d04c365c67d7b47d1f3902 Mon Sep 17 00:00:00 2001 From: cnr Date: Wed, 19 Apr 2017 22:32:21 -0700 Subject: [PATCH 97/98] Prevent players from purchasing St Patricks Chests --- .../mineplex/core/treasure/gui/BuyChestButton.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) 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 cdcdb4055..c119b1ae2 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/gui/BuyChestButton.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/gui/BuyChestButton.java @@ -83,6 +83,19 @@ public class BuyChestButton implements IButton return; } } + if (_chestType == TreasureType.ST_PATRICKS) + { + if (!new File("../../update/files/EnableStPatricksChest.dat").exists()) + { + player.sendMessage(F.main("Treasure", "That chest is no longer available for purchase!")); + return; + } + if (!_page.getPlugin().hasItemsToGivePlayer(_chestType.getRewardPool(), player)) + { + player.sendMessage(F.main("Treasure", "You seem to have all treasures for this chest unlocked already!")); + return; + } + } if (_chestType == TreasureType.SPRING) { if (!new File("../../update/files/EnableSpringChest.dat").exists()) From 87b829b41173fbc016850bca805adbdc887315e3 Mon Sep 17 00:00:00 2001 From: cnr Date: Wed, 19 Apr 2017 22:33:32 -0700 Subject: [PATCH 98/98] Disable easter egg baskets in games --- .../src/nautilus/game/arcade/ArcadeManager.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 9c6f65117..af4d8cea5 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java @@ -353,7 +353,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation TitanGiveawayManager titanGiveaway = new TitanGiveawayManager(getPlugin(), clientManager, serverStatusManager); EternalGiveawayManager eternalGiveawayManager = new EternalGiveawayManager(getPlugin(), clientManager, serverStatusManager); - IsHolidayEnabled = true; + IsHolidayEnabled = false; if (IsHolidayEnabled) new HolidayManager(this, titanGiveaway, eternalGiveawayManager);