diff --git a/Plugins/BuildFiles/common.xml b/Plugins/BuildFiles/common.xml index ddad3caf4..1941653ef 100644 --- a/Plugins/BuildFiles/common.xml +++ b/Plugins/BuildFiles/common.xml @@ -37,6 +37,7 @@ + @@ -78,6 +79,7 @@ + diff --git a/Plugins/Classpath.Dummy/src/net/minecraft/server/v1_7_R4/PacketPlayOutChat.java b/Plugins/Classpath.Dummy/src/net/minecraft/server/v1_7_R4/PacketPlayOutChat.java new file mode 100644 index 000000000..07537a12f --- /dev/null +++ b/Plugins/Classpath.Dummy/src/net/minecraft/server/v1_7_R4/PacketPlayOutChat.java @@ -0,0 +1,73 @@ +package net.minecraft.server.v1_7_R4; + +import java.io.IOException; + +public class PacketPlayOutChat + extends Packet +{ + private IChatBaseComponent a; + private boolean b; + private byte _chatType = 0; + + public PacketPlayOutChat() + { + this.b = true; + } + + public PacketPlayOutChat(IChatBaseComponent ichatbasecomponent) + { + this(ichatbasecomponent, true); + } + + public PacketPlayOutChat(IChatBaseComponent ichatbasecomponent, boolean flag) + { + this.b = true; + this.a = ichatbasecomponent; + this.b = flag; + } + + public PacketPlayOutChat(String text) + { + this(ChatSerializer.a(text)); + } + + public void a(PacketDataSerializer packetdataserializer) + throws IOException + { + this.a = ChatSerializer.a(packetdataserializer.c(32767)); + } + + public void b(PacketDataSerializer packetdataserializer) + throws IOException + { + packetdataserializer.a(ChatSerializer.a(this.a)); + if (packetdataserializer.version >= 16) { + packetdataserializer.writeByte(_chatType); + } + } + + public void setChatType(byte chatType) + { + _chatType = chatType; + } + + public void a(PacketPlayOutListener packetplayoutlistener) + { + packetplayoutlistener.a(this); + } + + public String b() + { + return String.format("message='%s'", new Object[] { this.a }); + } + + public boolean d() + { + return this.b; + } + + public void handle(PacketListener packetlistener) + { + a((PacketPlayOutListener)packetlistener); + } +} diff --git a/Plugins/Libraries/craftbukkit.jar b/Plugins/Libraries/craftbukkit.jar index 4000ffea7..6e642eb14 100644 Binary files a/Plugins/Libraries/craftbukkit.jar and b/Plugins/Libraries/craftbukkit.jar differ diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/jsonchat/JsonMessage.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/jsonchat/JsonMessage.java index 428d3344e..a42d080fb 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/jsonchat/JsonMessage.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/jsonchat/JsonMessage.java @@ -1,7 +1,11 @@ package mineplex.core.common.jsonchat; +import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer; import org.bukkit.entity.Player; +import net.minecraft.server.v1_7_R4.ChatSerializer; +import net.minecraft.server.v1_7_R4.PacketPlayOutChat; +import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; public class JsonMessage @@ -63,4 +67,53 @@ public class JsonMessage { UtilServer.getServer().dispatchCommand(UtilServer.getServer().getConsoleSender(), "tellraw " + player.getName() + " " + toString()); } + + /** + * Send a message to players using the new 1.8 message types + * + * @param messageType Message type to send + * @param players Players to send to + */ + public void send(MessageType messageType, Player... players) + { + send(messageType, false, players); + } + + /** + * Send a message to players using the new 1.8 message types + * + * @param messageType Message type to send + * @param defaultToChat Only applies to MessageType.ABOVE_HOTBAR. If true, it will send this to chat for 1.7 clients + * @param players Players to send to + */ + public void send(MessageType messageType, boolean defaultToChat, Player... players) + { + PacketPlayOutChat chatPacket = new PacketPlayOutChat(ChatSerializer.a(toString())); + chatPacket.setChatType(messageType.getId()); + + for (Player player : players) + { + if (defaultToChat || messageType != MessageType.ABOVE_HOTBAR || UtilPlayer.is1_8(player)) + ((CraftPlayer) player).getHandle().playerConnection.sendPacket(chatPacket); + } + } + + public static enum MessageType + { + CHAT_BOX((byte) 0), // Inside Chat Box + SYSTEM_MESSAGE((byte) 1), // Inside Chat Box - This is used for the client to identify difference between chat message and server messages + ABOVE_HOTBAR((byte) 2); // Shows above hotbar + + private byte _id; + + MessageType(byte id) + { + _id = id; + } + + public byte getId() + { + return _id; + } + } } diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/C.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/C.java index d4b4f6101..0407bf4ab 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/C.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/C.java @@ -7,6 +7,7 @@ public class C public static String Scramble = "§k"; public static String Bold = "§l"; public static String Strike = "§m"; + public static String BoldStrike = "§l§m"; public static String Line = "§n"; public static String Italics = "§o"; diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/MapUtil.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/MapUtil.java index 369489ef2..b327bf32e 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/MapUtil.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/MapUtil.java @@ -150,6 +150,11 @@ public class MapUtil ((CraftWorld) world).getHandle().notify(x, y, z); } } + + public static void ChunkBlockSet(World world, int x, int y, int z, int id, byte data, boolean notifyPlayers) + { + world.getBlockAt(x, y, z).setTypeIdAndData(id, data, notifyPlayers); + } private static boolean changeChunkBlock(int x, int y, int z, net.minecraft.server.v1_7_R4.Chunk chunk, Block block, byte data) diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilEnt.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilEnt.java index 520b2be73..eca5842fd 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilEnt.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilEnt.java @@ -515,6 +515,7 @@ public class UtilEnt Material beneath = player.getLocation().add(x, -1.5, z).getBlock().getType(); if (player.getLocation().getY() % 0.5 == 0 && (beneath == Material.FENCE || + beneath == Material.FENCE_GATE || beneath == Material.NETHER_FENCE || beneath == Material.COBBLE_WALL)) return true; diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilText.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilText.java index dd06cc17e..0b8c1ef9b 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilText.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilText.java @@ -139,21 +139,21 @@ public class UtilText if (align == TextAlign.CENTER) for (int i=-64 ; i<=64 ; i++) { - MapUtil.ChunkBlockChange(world, bX + i * face.getModX(), bY + i * face.getModY(), bZ + i * face.getModZ(), 0, (byte)0, true); + MapUtil.ChunkBlockSet(world, bX + i * face.getModX(), bY + i * face.getModY(), bZ + i * face.getModZ(), 0, (byte)0, true); } if (align == TextAlign.LEFT) for (int i=0 ; i<=128 ; i++) { - MapUtil.ChunkBlockChange(world, bX + i * face.getModX(), bY + i * face.getModY(), bZ + i * face.getModZ(), 0, (byte)0, true); + MapUtil.ChunkBlockSet(world, bX + i * face.getModX(), bY + i * face.getModY(), bZ + i * face.getModZ(), 0, (byte)0, true); } if (align == TextAlign.RIGHT) for (int i=-128 ; i<=0 ; i++) { - MapUtil.ChunkBlockChange(world, bX + i * face.getModX(), bY + i * face.getModY(), bZ + i * face.getModZ(), 0, (byte)0, true); + MapUtil.ChunkBlockSet(world, bX + i * face.getModX(), bY + i * face.getModY(), bZ + i * face.getModZ(), 0, (byte)0, true); } @@ -181,7 +181,7 @@ public class UtilText if (letter[x][y] == 1) { changes.add(world.getBlockAt(bX, bY, bZ)); - MapUtil.ChunkBlockChange(world, bX, bY, bZ, id, data, true); + MapUtil.ChunkBlockSet(world, bX, bY, bZ, id, data, true); } //Forward diff --git a/Plugins/Mineplex.Core/src/mineplex/core/achievement/Achievement.java b/Plugins/Mineplex.Core/src/mineplex/core/achievement/Achievement.java index 8992165fe..19decd705 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/achievement/Achievement.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/achievement/Achievement.java @@ -11,8 +11,8 @@ public enum Achievement //Bridges BRIDGES_WINS("Bridge Champion", 600, new String[]{"The Bridges.Wins"}, - new String[]{"Win 50 games of The Bridges"}, - new int[]{50}, + new String[]{"Win 30 games of The Bridges"}, + new int[]{30}, AchievementCategory.BRIDGES), BRIDGES_FOOD("Food for the Masses", 600, @@ -48,8 +48,8 @@ public enum Achievement //Survival Games SURVIVAL_GAMES_WINS("Katniss Everdeen", 600, new String[]{"Survival Games.Wins"}, - new String[]{"Win 50 games of Survival Games"}, - new int[]{50}, + new String[]{"Win 30 games of Survival Games"}, + new int[]{30}, AchievementCategory.SURVIVAL_GAMES), SURVIVAL_GAMES_LIGHT_WEIGHT("Light Weight", 1000, @@ -79,8 +79,8 @@ public enum Achievement //Survival Games UHC_WINS("Ultimate Winner", 600, new String[]{"Ultra Hardcore.Wins"}, - new String[]{"Win 20 games of Ultra Hardcore"}, - new int[]{20}, + new String[]{"Win 10 games of Ultra Hardcore"}, + new int[]{10}, AchievementCategory.UHC), //Smash Mobs @@ -486,7 +486,7 @@ public enum Achievement SNEAK_ASSASSINS_THE_MASTERS_MASTER("The Master's Master", 700, new String[]{"Sneaky Assassins.TheMastersMaster"}, - new String[]{"Kill a Master Assassin without having a single power-up."}, + new String[]{"Kill a Master Assassin without", "having a single power-up."}, new int[]{1}, AchievementCategory.SNEAKY_ASSASSINS), @@ -524,7 +524,7 @@ public enum Achievement MINE_STRIKE_BOOM_HEADSHOT("BOOM! HEADSHOT!", 0, new String[]{"MineStrike.BoomHeadshot"}, - new String[]{"Win 500 people with headshots"}, + new String[]{"Kill 500 people with headshots"}, new int[]{500}, AchievementCategory.MINE_STRIKE), @@ -536,7 +536,7 @@ public enum Achievement MINE_STRIKE_KABOOM("Kaboom!", 0, new String[]{"MineStrike.Kaboom"}, - new String[]{"Kill two people with a single High Explosive Grenade"}, + new String[]{"Kill two people with a single", "High Explosive Grenade"}, new int[]{1}, AchievementCategory.MINE_STRIKE), @@ -548,19 +548,19 @@ public enum Achievement MINE_STRIKE_CLUTCH_OR_KICK("Clutch or Kick", 0, new String[]{"MineStrike.ClutchOrKick"}, - new String[]{"Be the last one alive, and kill 3+ enemies to achieve victory"}, + new String[]{"Be the last one alive, and kill", "3 or more enemies to achieve victory"}, new int[]{1}, AchievementCategory.MINE_STRIKE), MINE_STRIKE_KILLING_SPREE("Killing Spree", 0, new String[]{"MineStrike.KillingSpree"}, - new String[]{"Kill 4 enemies in a row with no more than 5 seconds between each kill"}, + new String[]{"Kill 4 enemies in a row with no more", "than 5 seconds between each kill"}, new int[]{1}, AchievementCategory.MINE_STRIKE), MINE_STRIKE_BLINDFOLDED("Blindfolded", 0, new String[]{"MineStrike.Blindfolded"}, - new String[]{"Kill 2 enemies while blinded from a single flashbang"}, + new String[]{"Kill 2 enemies while blinded from", "a single flashbang"}, new int[]{1}, AchievementCategory.MINE_STRIKE), ; 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 edeb31240..53e92f4ef 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 @@ -9,6 +9,7 @@ import net.minecraft.server.v1_7_R4.Items; import net.minecraft.server.v1_7_R4.PacketPlayOutOpenWindow; import net.minecraft.server.v1_7_R4.PacketPlayOutSetSlot; +import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer; import org.bukkit.entity.Creature; @@ -54,25 +55,45 @@ public class PetPage extends ShopPageBase { List itemLore = new ArrayList(); - itemLore.add(C.cYellow + pet.GetCost(CurrencyType.Coins) + " Coins"); - itemLore.add(C.cBlack); + //Halloween Name + if (pet.GetCost(CurrencyType.Coins) == -1) + { + itemLore.add(C.cBlack); + itemLore.add(ChatColor.RESET + C.cYellow + "Earned by defeating the Pumpkin King"); + itemLore.add(ChatColor.RESET + C.cYellow + "in the 2014 Halloween Horror Event."); + } + //Owned if (DonationManager.Get(Player.getName()).OwnsUnknownPackage(pet.GetPetName())) { if (Plugin.getPetManager().hasActivePet(Player.getName()) && Plugin.getPetManager().getActivePet(Player.getName()).getType() == pet.GetPetType()) { - AddButton(slot, new ShopItem(Material.MONSTER_EGG, (byte)pet.GetPetType().getTypeId(), "Deactivate " + Plugin.getPetManager().Get(Player).GetPets().get(pet.GetPetType()), new String[] {}, 1, false, false), new DeactivatePetButton(this, Plugin.getPetManager())); + AddButton(slot, new ShopItem(Material.MONSTER_EGG, (byte)pet.GetPetType().getTypeId(), + "Deactivate " + pet.GetPetName() + " (" + C.cWhite + Plugin.getPetManager().Get(Player).GetPets().get(pet.GetPetType()) + C.cGreen + ")", + itemLore.toArray(new String[itemLore.size()]), 1, false, false), new DeactivatePetButton(this, Plugin.getPetManager())); addGlow(slot); } else { - AddButton(slot, new ShopItem(Material.MONSTER_EGG, (byte)pet.GetPetType().getTypeId(), "Activate " + Plugin.getPetManager().Get(Player).GetPets().get(pet.GetPetType()), new String[] {}, 1, false, false), new ActivatePetButton(pet, this)); + AddButton(slot, new ShopItem(Material.MONSTER_EGG, (byte)pet.GetPetType().getTypeId(), + "Activate " + pet.GetPetName() + " (" + C.cWhite + Plugin.getPetManager().Get(Player).GetPets().get(pet.GetPetType()) + C.cGreen + ")", + itemLore.toArray(new String[itemLore.size()]), 1, false, false), new ActivatePetButton(pet, this)); } } + //Not Owned else { - if (DonationManager.Get(Player.getName()).GetBalance(CurrencyType.Coins) >= pet.GetCost(CurrencyType.Coins)) + //Cost Lore + if (pet.GetCost(CurrencyType.Coins) > 0) + { + itemLore.add(C.cYellow + pet.GetCost(CurrencyType.Coins) + " Coins"); + itemLore.add(C.cBlack); + } + + if (pet.GetCost(CurrencyType.Coins) == -1) + setItem(slot, new ShopItem(Material.INK_SACK, (byte)8, pet.GetPetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false)); + else if (DonationManager.Get(Player.getName()).GetBalance(CurrencyType.Coins) >= pet.GetCost(CurrencyType.Coins)) AddButton(slot, new ShopItem(Material.INK_SACK, (byte)8, "Purchase " + pet.GetPetName(), itemLore.toArray(new String[itemLore.size()]), 1, false, false), new PetButton(pet, this)); else setItem(slot, new ShopItem(Material.INK_SACK, (byte)8, "Purchase " + pet.GetPetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false)); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/donation/CoinCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/donation/CoinCommand.java new file mode 100644 index 000000000..3f151a3ac --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/donation/CoinCommand.java @@ -0,0 +1,51 @@ +package mineplex.core.donation; + +import org.bukkit.entity.Player; + +import mineplex.core.command.CommandBase; +import mineplex.core.common.Rank; +import mineplex.core.common.util.Callback; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; + +public class CoinCommand extends CommandBase +{ + public CoinCommand(DonationManager plugin) + { + super(plugin, Rank.ADMIN, "coin"); + } + + @Override + public void Execute(final Player caller, String[] args) + { + if (args.length < 2) + { + UtilPlayer.message(caller, F.main("Coin", "Missing Args")); + return; + } + + //Try Online + final Player target = UtilPlayer.searchOnline(caller, args[0], true); + + if (target == null) + return; + + //Give Coins to Target + try + { + final int coins = Integer.parseInt(args[1]); + Plugin.RewardCoins(new Callback() + { + public void run(Boolean completed) + { + UtilPlayer.message(caller, F.main("Coin", "You gave " + F.elem(coins + " Coins") + " to " + F.name(target.getName()) + ".")); + UtilPlayer.message(target, F.main("Coin", F.name(caller.getName()) + " gave you " + F.elem(coins + " Coins") + ".")); + } + }, caller.getName(), target.getName(), target.getUniqueId(), coins); + } + catch (Exception e) + { + UtilPlayer.message(caller, F.main("Coin", "Invalid Coins Amount")); + } + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/donation/DonationManager.java b/Plugins/Mineplex.Core/src/mineplex/core/donation/DonationManager.java index b9dc22e31..2d9f69b77 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/donation/DonationManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/donation/DonationManager.java @@ -2,6 +2,11 @@ package mineplex.core.donation; import java.util.UUID; +import org.bukkit.craftbukkit.libs.com.google.gson.Gson; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.plugin.java.JavaPlugin; + import mineplex.core.MiniPlugin; import mineplex.core.account.event.ClientUnloadEvent; import mineplex.core.account.event.ClientWebResponseEvent; @@ -14,11 +19,6 @@ import mineplex.core.server.util.TransactionResponse; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; -import org.bukkit.craftbukkit.libs.com.google.gson.Gson; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.plugin.java.JavaPlugin; - public class DonationManager extends MiniPlugin { private DonationRepository _repository; @@ -42,6 +42,7 @@ public class DonationManager extends MiniPlugin public void AddCommands() { AddCommand(new GemCommand(this)); + AddCommand(new CoinCommand(this)); } @EventHandler diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphBlock.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphBlock.java index 43443e9bd..dd5e22071 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphBlock.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphBlock.java @@ -5,28 +5,21 @@ import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; -import org.bukkit.Bukkit; import org.bukkit.Material; -import org.bukkit.entity.Entity; import org.bukkit.entity.FallingBlock; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; -import org.bukkit.event.block.Action; import org.bukkit.event.entity.EntityChangeBlockEvent; import org.bukkit.event.entity.ItemSpawnEvent; import org.bukkit.event.player.PlayerInteractEvent; -import org.bukkit.util.BlockIterator; import mineplex.core.common.util.C; import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilEvent; import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilEvent.ActionType; -import mineplex.core.disguise.disguises.DisguiseBlock; import mineplex.core.event.StackerEvent; import mineplex.core.gadget.GadgetManager; -import mineplex.core.gadget.event.GadgetActivateEvent; -import mineplex.core.gadget.event.GadgetBlockEvent; import mineplex.core.gadget.types.MorphGadget; import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphEnderman.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphEnderman.java index fe610502b..ddb00c582 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphEnderman.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphEnderman.java @@ -55,6 +55,9 @@ public class MorphEnderman extends MorphGadget { this.RemoveArmor(player); Manager.getDisguiseManager().undisguise(player); + + player.setAllowFlight(false); + player.setFlying(false); } @EventHandler diff --git a/Plugins/Mineplex.Core/src/mineplex/core/npc/NpcManager.java b/Plugins/Mineplex.Core/src/mineplex/core/npc/NpcManager.java index 8c3541573..818c4841e 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/npc/NpcManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/npc/NpcManager.java @@ -117,7 +117,7 @@ public class NpcManager extends MiniPlugin _plugin.getServer().getPluginManager().registerEvents(this, _plugin); try - { + { loadNpcs(); } catch (SQLException e) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/pet/PetFactory.java b/Plugins/Mineplex.Core/src/mineplex/core/pet/PetFactory.java index 6f5b3e096..2d0edf308 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/pet/PetFactory.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/pet/PetFactory.java @@ -8,6 +8,7 @@ import mineplex.core.common.util.NautHashMap; import mineplex.core.pet.repository.PetRepository; import mineplex.core.pet.repository.token.PetExtraToken; import mineplex.core.pet.repository.token.PetSalesToken; +import mineplex.core.pet.types.Pumpkin; import org.bukkit.Material; import org.bukkit.entity.EntityType; @@ -30,13 +31,14 @@ public class PetFactory private void CreatePets() { + _pets.put(EntityType.ZOMBIE, new Pumpkin()); _pets.put(EntityType.PIG, new Pet("Pig", EntityType.PIG, 5000)); _pets.put(EntityType.SHEEP, new Pet("Sheep", EntityType.SHEEP, 3000)); _pets.put(EntityType.COW, new Pet("Cow", EntityType.COW, 2000)); _pets.put(EntityType.CHICKEN, new Pet("Chicken", EntityType.CHICKEN, 7000)); _pets.put(EntityType.WOLF, new Pet("Dog", EntityType.WOLF, 8000)); _pets.put(EntityType.OCELOT, new Pet("Cat", EntityType.OCELOT, 6000)); - _pets.put(EntityType.MUSHROOM_COW, new Pet("Mooshroom", EntityType.MUSHROOM_COW, 5000)); + _pets.put(EntityType.MUSHROOM_COW, new Pet("Mooshroom", EntityType.MUSHROOM_COW, 5000)); List petTokens = new ArrayList(); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/pet/PetManager.java b/Plugins/Mineplex.Core/src/mineplex/core/pet/PetManager.java index 699740c71..60b9b1b6a 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/pet/PetManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/pet/PetManager.java @@ -14,6 +14,7 @@ import mineplex.core.account.event.ClientWebResponseEvent; import mineplex.core.account.event.RetrieveClientInformationEvent; import mineplex.core.common.util.C; import mineplex.core.common.util.NautHashMap; +import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilInv; import mineplex.core.common.util.UtilServer; import mineplex.core.donation.DonationManager; @@ -45,6 +46,8 @@ import org.bukkit.entity.Ageable; import org.bukkit.entity.Creature; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; +import org.bukkit.entity.Skeleton; +import org.bukkit.entity.Zombie; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.entity.EntityDamageEvent; @@ -56,7 +59,10 @@ import org.bukkit.event.player.PlayerInteractEntityEvent; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerQuitEvent; +import org.bukkit.inventory.ItemStack; import org.bukkit.plugin.java.JavaPlugin; +import org.bukkit.potion.PotionEffect; +import org.bukkit.potion.PotionEffectType; public class PetManager extends MiniClientPlugin { @@ -158,6 +164,14 @@ public class PetManager extends MiniClientPlugin pet.setCustomNameVisible(true); pet.setCustomName(Get(player).GetPets().get(entityType)); + if (pet instanceof Zombie) + { + ((Zombie) pet).setBaby(true); + pet.getEquipment().setHelmet(new ItemStack(Material.PUMPKIN)); + pet.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, 99999999, 0)); + UtilEnt.silence(pet, true); + } + _activePetOwners.put(player.getName(), pet); _failedAttempts.put(player.getName(), 0); @@ -295,7 +309,7 @@ public class PetManager extends MiniClientPlugin pet.teleport(owner); _failedAttempts.put(playerName, 0); } - else if (!nav.a(targetBlock.getX(), targetBlock.getY() + 1, targetBlock.getZ(), 1.5f)) + else if (!nav.a(targetBlock.getX(), targetBlock.getY() + 1, targetBlock.getZ(), 0.9f)) { if (pet.getFallDistance() == 0) { diff --git a/Plugins/Mineplex.Core/src/mineplex/core/shop/item/ShopItem.java b/Plugins/Mineplex.Core/src/mineplex/core/shop/item/ShopItem.java index b10c32986..8acf464c1 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/shop/item/ShopItem.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/shop/item/ShopItem.java @@ -1,13 +1,13 @@ package mineplex.core.shop.item; -import mineplex.core.common.util.UtilInv; -import net.minecraft.server.v1_7_R4.NBTTagList; -import net.minecraft.server.v1_7_R4.NBTTagString; - import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.craftbukkit.v1_7_R4.inventory.CraftItemStack; import org.bukkit.inventory.ItemStack; +import net.minecraft.server.v1_7_R4.NBTTagList; +import net.minecraft.server.v1_7_R4.NBTTagString; + +import mineplex.core.common.util.UtilInv; public class ShopItem extends CraftItemStack { @@ -27,7 +27,8 @@ public class ShopItem extends CraftItemStack _displayItem = displayItem; _deliveryAmount = deliveryAmount; - getHandle().tag = ((CraftItemStack)itemStack).getHandle().tag; + CraftItemStack craftItem = CraftItemStack.asCraftCopy(itemStack); + getHandle().tag = craftItem.getHandle().tag; UpdateVisual(true); getHandle().tag.set("AttributeModifiers", new NBTTagList()); diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java index 4368f9ebc..5b0793915 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java @@ -62,10 +62,12 @@ import mineplex.core.disguise.DisguiseManager; import mineplex.core.disguise.disguises.DisguiseSlime; import mineplex.core.donation.DonationManager; import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.event.GadgetActivateEvent; import mineplex.core.gadget.event.GadgetCollideEntityEvent; import mineplex.core.inventory.InventoryManager; import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.mount.MountManager; +import mineplex.core.mount.event.MountActivateEvent; import mineplex.core.pet.PetManager; import mineplex.core.portal.Portal; import mineplex.core.preferences.PreferencesManager; @@ -76,6 +78,7 @@ import mineplex.core.treasure.TreasureManager; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.hub.commands.ForcefieldRadius; +import mineplex.hub.commands.GadgetToggle; import mineplex.hub.commands.GameModeCommand; import mineplex.hub.commands.NewsCommand; import mineplex.hub.modules.ForcefieldManager; @@ -99,7 +102,7 @@ import mineplex.minecraft.game.core.damage.CustomDamageEvent; public class HubManager extends MiniClientPlugin { - public String Mode = "Normal"; + public HubType Type = HubType.Halloween; private BlockRestore _blockRestore; private CoreClientManager _clientManager; @@ -107,7 +110,7 @@ public class HubManager extends MiniClientPlugin private DonationManager _donationManager; private DisguiseManager _disguiseManager; private PartyManager _partyManager; - private ForcefieldManager _forcefieldManager; + private ForcefieldManager _forcefieldManager; private Portal _portal; private StatsManager _statsManager; private GadgetManager _gadgetManager; @@ -160,7 +163,7 @@ public class HubManager extends MiniClientPlugin new JumpManager(this); new UHCManager(this); //new TournamentInviter(this); - + _news = new NewsManager(this); _mountManager = new MountManager(_plugin, clientManager, donationManager, blockRestore, _disguiseManager); @@ -318,6 +321,7 @@ public class HubManager extends MiniClientPlugin @Override public void AddCommands() { + AddCommand(new GadgetToggle(this)); AddCommand(new NewsCommand(this)); AddCommand(new GameModeCommand(this)); } @@ -348,7 +352,7 @@ public class HubManager extends MiniClientPlugin @EventHandler public void SnowballPickup(BlockDamageEvent event) { - if (!Mode.equals("Christmas")) + if (Type != HubType.Christmas) return; if (event.getBlock().getType() != Material.SNOW) @@ -364,7 +368,7 @@ public class HubManager extends MiniClientPlugin @EventHandler public void SnowballHit(CustomDamageEvent event) { - if (!Mode.equals("Christmas")) + if (Type != HubType.Christmas) return; Projectile proj = event.GetProjectile(); @@ -940,10 +944,6 @@ public class HubManager extends MiniClientPlugin return _gadgetsEnabled; } - public void SetGadgetEnabled(boolean _enabled) - { - this._gadgetsEnabled = _enabled; - } public NewsManager GetNewsManager() { @@ -964,4 +964,32 @@ public class HubManager extends MiniClientPlugin event.setCancelled(true); } } + + public void ToggleGadget(Player caller) + { + _gadgetsEnabled = !_gadgetsEnabled; + + if (!_gadgetsEnabled) + { + GetMount().DisableAll(); + GetGadget().DisableAll(); + } + + for (Player player : UtilServer.getPlayers()) + player.sendMessage(C.cWhite + C.Bold + "Gadgets/Mounts are now " + F.elem(_gadgetsEnabled ? C.cGreen + C.Bold + "Enabled" : C.cRed + C.Bold + "Disabled")); + } + + @EventHandler + public void GadgetActivate(GadgetActivateEvent event) + { + if (!_gadgetsEnabled) + event.setCancelled(true); + } + + @EventHandler + public void MountActivate(MountActivateEvent event) + { + if (!_gadgetsEnabled) + event.setCancelled(true); + } } diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/NewsManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/NewsManager.java index 38793e994..fa1789a09 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/NewsManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/NewsManager.java @@ -8,7 +8,6 @@ import org.bukkit.ChatColor; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.player.PlayerJoinEvent; -import org.bukkit.event.server.ServerListPingEvent; import mineplex.core.MiniPlugin; import mineplex.core.common.Rank; @@ -240,7 +239,10 @@ public class NewsManager extends MiniPlugin { _newsIndex = (_newsIndex + 1)%_news.length; _newsTime = System.currentTimeMillis(); - } + +// JsonMessage jsonMessage = new JsonMessage(_news[_newsIndex]); +// jsonMessage.send(JsonMessage.MessageType.ABOVE_HOTBAR, UtilServer.getPlayers()); + } if (_newsIndex >= _news.length) { // Resets newsIndex if outside of bounds of news array after RefreshNews but before UtilTime.elapsed above diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/TextManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/TextManager.java index 0a3259fa9..3368d5ca6 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/TextManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/TextManager.java @@ -6,6 +6,7 @@ import mineplex.core.common.util.UtilText.TextAlign; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.hub.HubManager; +import mineplex.hub.HubType; import org.bukkit.Location; import org.bukkit.block.BlockFace; @@ -29,7 +30,7 @@ public class TextManager extends MiniPlugin int arcadeIndex = 0; int smashIndex = 0; - + public TextManager(HubManager manager) { super("Text Creator", manager.GetPlugin()); @@ -55,55 +56,55 @@ public class TextManager extends MiniPlugin { //Comp UtilText.MakeText("CHAMPIONS", locComp, faceComp, 159, (byte)5, TextAlign.CENTER); - UtilText.MakeText("CHAMPIONS", locComp.clone().add(1, 0, 0), faceComp, 159, (byte)15, TextAlign.CENTER); + UtilText.MakeText("CHAMPIONS", locComp.clone().add(1, 0, 0), faceComp, (Manager.Type == HubType.Halloween) ? 89 : 159, (Manager.Type == HubType.Halloween) ? (byte)0 : (byte)15, TextAlign.CENTER); UtilText.MakeText("DOMINATE", locComp.clone().add(15, 14, 0), faceComp, 159, (byte)4, TextAlign.CENTER); - UtilText.MakeText("DOMINATE", locComp.clone().add(16, 14, 0), faceComp, 159, (byte)15, TextAlign.CENTER); + UtilText.MakeText("DOMINATE", locComp.clone().add(16, 14, 0), faceComp, (Manager.Type == HubType.Halloween) ? 89 : 159, (Manager.Type == HubType.Halloween) ? (byte)0 : (byte)15, TextAlign.CENTER); UtilText.MakeText("TEAM DEATHMATCH", locComp.clone().add(15, 21, 0), faceComp, 159, (byte)1, TextAlign.CENTER); - UtilText.MakeText("TEAM DEATHMATCH", locComp.clone().add(16, 21, 0), faceComp, 159, (byte)15, TextAlign.CENTER); + UtilText.MakeText("TEAM DEATHMATCH", locComp.clone().add(16, 21, 0), faceComp, (Manager.Type == HubType.Halloween) ? 89 : 159, (Manager.Type == HubType.Halloween) ? (byte)0 : (byte)15, TextAlign.CENTER); //UtilText.MakeText("CAPTURE THE PIG", locComp.clone().add(15, 28, 0), faceComp, 159, (byte)14, TextAlign.CENTER); - //UtilText.MakeText("CAPTURE THE PIG", locComp.clone().add(16, 28, 0), faceComp, 159, (byte)15, TextAlign.CENTER); + //UtilText.MakeText("CAPTURE THE PIG", locComp.clone().add(16, 28, 0), faceComp, (Manager.Type == HubType.Halloween) ? 89 : 159, (Manager.Type == HubType.Halloween) ? (byte)0 : (byte)15, TextAlign.CENTER); //Arcade UtilText.MakeText("ARCADE", locArcade, faceArcade, 159, (byte)5, TextAlign.CENTER); - UtilText.MakeText("ARCADE", locArcade.clone().add(0, 0, 1), faceArcade, 159, (byte)15, TextAlign.CENTER); + UtilText.MakeText("ARCADE", locArcade.clone().add(0, 0, 1), faceArcade, (Manager.Type == HubType.Halloween) ? 89 : 159, (Manager.Type == HubType.Halloween) ? (byte)0 : (byte)15, TextAlign.CENTER); UtilText.MakeText(GetArcadeText(0), locArcade.clone().add(0, 14, 15), faceArcade, 159, (byte)4, TextAlign.CENTER); - UtilText.MakeText(GetArcadeText(0), locArcade.clone().add(0, 14, 16), faceArcade, 159, (byte)15, TextAlign.CENTER); + UtilText.MakeText(GetArcadeText(0), locArcade.clone().add(0, 14, 16), faceArcade, (Manager.Type == HubType.Halloween) ? 89 : 159, (Manager.Type == HubType.Halloween) ? (byte)0 : (byte)15, TextAlign.CENTER); UtilText.MakeText(GetArcadeText(1), locArcade.clone().add(0, 21, 15), faceArcade, 159, (byte)1, TextAlign.CENTER); - UtilText.MakeText(GetArcadeText(1), locArcade.clone().add(0, 21, 16), faceArcade, 159, (byte)15, TextAlign.CENTER); + UtilText.MakeText(GetArcadeText(1), locArcade.clone().add(0, 21, 16), faceArcade, (Manager.Type == HubType.Halloween) ? 89 : 159, (Manager.Type == HubType.Halloween) ? (byte)0 : (byte)15, TextAlign.CENTER); UtilText.MakeText(GetArcadeText(2), locArcade.clone().add(0, 28, 15), faceArcade, 159, (byte)14, TextAlign.CENTER); - UtilText.MakeText(GetArcadeText(2), locArcade.clone().add(0, 28, 16), faceArcade, 159, (byte)15, TextAlign.CENTER); + UtilText.MakeText(GetArcadeText(2), locArcade.clone().add(0, 28, 16), faceArcade, (Manager.Type == HubType.Halloween) ? 89 : 159, (Manager.Type == HubType.Halloween) ? (byte)0 : (byte)15, TextAlign.CENTER); //Survival UtilText.MakeText("SURVIVAL", locSurvival, faceSurvival, 159, (byte)5, TextAlign.CENTER); - UtilText.MakeText("SURVIVAL", locSurvival.clone().add(-1, 0, 0), faceSurvival, 159, (byte)15, TextAlign.CENTER); + UtilText.MakeText("SURVIVAL", locSurvival.clone().add(-1, 0, 0), faceSurvival, (Manager.Type == HubType.Halloween) ? 89 : 159, (Manager.Type == HubType.Halloween) ? (byte)0 : (byte)15, TextAlign.CENTER); UtilText.MakeText("THE BRIDGES", locSurvival.clone().add(-15, 14, 0), faceSurvival, 159, (byte)4, TextAlign.CENTER); - UtilText.MakeText("THE BRIDGES", locSurvival.clone().add(-16, 14, 0), faceSurvival, 159, (byte)15, TextAlign.CENTER); + UtilText.MakeText("THE BRIDGES", locSurvival.clone().add(-16, 14, 0), faceSurvival, (Manager.Type == HubType.Halloween) ? 89 : 159, (Manager.Type == HubType.Halloween) ? (byte)0 : (byte)15, TextAlign.CENTER); UtilText.MakeText("SURVIVAL GAMES", locSurvival.clone().add(-15, 21, 0), faceSurvival, 159, (byte)1, TextAlign.CENTER); - UtilText.MakeText("SURVIVAL GAMES", locSurvival.clone().add(-16, 21, 0), faceSurvival, 159, (byte)15, TextAlign.CENTER); + UtilText.MakeText("SURVIVAL GAMES", locSurvival.clone().add(-16, 21, 0), faceSurvival, (Manager.Type == HubType.Halloween) ? 89 : 159, (Manager.Type == HubType.Halloween) ? (byte)0 : (byte)15, TextAlign.CENTER); UtilText.MakeText("ULTRA HARDCORE", locSurvival.clone().add(-15, 28, 0), faceSurvival, 159, (byte)14, TextAlign.CENTER); - UtilText.MakeText("ULTRA HARDCORE", locSurvival.clone().add(-16, 28, 0), faceSurvival, 159, (byte)15, TextAlign.CENTER); + UtilText.MakeText("ULTRA HARDCORE", locSurvival.clone().add(-16, 28, 0), faceSurvival, (Manager.Type == HubType.Halloween) ? 89 : 159, (Manager.Type == HubType.Halloween) ? (byte)0 : (byte)15, TextAlign.CENTER); //Other UtilText.MakeText("CLASSICS", locClassics, faceOther, 159, (byte)5, TextAlign.CENTER); - UtilText.MakeText("CLASSICS", locClassics.add(0, 0, -1), faceOther, 159, (byte)15, TextAlign.CENTER); + UtilText.MakeText("CLASSICS", locClassics.add(0, 0, -1), faceOther, (Manager.Type == HubType.Halloween) ? 89 : 159, (Manager.Type == HubType.Halloween) ? (byte)0 : (byte)15, TextAlign.CENTER); UtilText.MakeText("SUPER SMASH MOBS", locClassics.clone().add(0, 14, -15), faceOther, 159, (byte)4, TextAlign.CENTER); - UtilText.MakeText("SUPER SMASH MOBS", locClassics.clone().add(0, 14, -16), faceOther, 159, (byte)15, TextAlign.CENTER); + UtilText.MakeText("SUPER SMASH MOBS", locClassics.clone().add(0, 14, -16), faceOther, (Manager.Type == HubType.Halloween) ? 89 : 159, (Manager.Type == HubType.Halloween) ? (byte)0 : (byte)15, TextAlign.CENTER); UtilText.MakeText("MINE STRIKE", locClassics.clone().add(0, 21, -15), faceOther, 159, (byte)1, TextAlign.CENTER); - UtilText.MakeText("MINE STRIKE", locClassics.clone().add(0, 21, -16), faceOther, 159, (byte)15, TextAlign.CENTER); + UtilText.MakeText("MINE STRIKE", locClassics.clone().add(0, 21, -16), faceOther, (Manager.Type == HubType.Halloween) ? 89 : 159, (Manager.Type == HubType.Halloween) ? (byte)0 : (byte)15, TextAlign.CENTER); UtilText.MakeText("BLOCK HUNT", locClassics.clone().add(0, 28, -15), faceOther, 159, (byte)14, TextAlign.CENTER); - UtilText.MakeText("BLOCK HUNT", locClassics.clone().add(0, 28, -16), faceOther, 159, (byte)15, TextAlign.CENTER); + UtilText.MakeText("BLOCK HUNT", locClassics.clone().add(0, 28, -16), faceOther, (Manager.Type == HubType.Halloween) ? 89 : 159, (Manager.Type == HubType.Halloween) ? (byte)0 : (byte)15, TextAlign.CENTER); } /* @@ -114,13 +115,13 @@ public class TextManager extends MiniPlugin return; UtilText.MakeText(GetArcadeText(0), locArcade.clone().add(0, 14, 15), faceArcade, 159, (byte)4, TextAlign.CENTER); - UtilText.MakeText(GetArcadeText(0), locArcade.clone().add(0, 14, 16), faceArcade, 159, (byte)15, TextAlign.CENTER); + UtilText.MakeText(GetArcadeText(0), locArcade.clone().add(0, 14, 16), faceArcade, (Manager.Type == HubType.Halloween) ? 89 : 159, (Manager.Type == HubType.Halloween) ? (byte)0 : (byte)15, TextAlign.CENTER); UtilText.MakeText(GetArcadeText(1), locArcade.clone().add(0, 21, 15), faceArcade, 159, (byte)1, TextAlign.CENTER); - UtilText.MakeText(GetArcadeText(1), locArcade.clone().add(0, 21, 16), faceArcade, 159, (byte)15, TextAlign.CENTER); + UtilText.MakeText(GetArcadeText(1), locArcade.clone().add(0, 21, 16), faceArcade, (Manager.Type == HubType.Halloween) ? 89 : 159, (Manager.Type == HubType.Halloween) ? (byte)0 : (byte)15, TextAlign.CENTER); UtilText.MakeText(GetArcadeText(2), locArcade.clone().add(0, 28, 15), faceArcade, 159, (byte)14, TextAlign.CENTER); - UtilText.MakeText(GetArcadeText(2), locArcade.clone().add(0, 28, 16), faceArcade, 159, (byte)15, TextAlign.CENTER); + UtilText.MakeText(GetArcadeText(2), locArcade.clone().add(0, 28, 16), faceArcade, (Manager.Type == HubType.Halloween) ? 89 : 159, (Manager.Type == HubType.Halloween) ? (byte)0 : (byte)15, TextAlign.CENTER); arcadeIndex = (arcadeIndex + 3)%arcadeGames.length; } @@ -148,13 +149,13 @@ public class TextManager extends MiniPlugin if (smashIndex == 1) color = 0; //UtilText.MakeText("SUPER SMASH MOBS", locOther, faceOther, 159, color, TextAlign.CENTER); - //UtilText.MakeText("SUPER SMASH MOBS", locOther.clone().add(0, 0, -1), faceOther, 159, (byte)15, TextAlign.CENTER); + //UtilText.MakeText("SUPER SMASH MOBS", locOther.clone().add(0, 0, -1), faceOther, (Manager.Type == HubType.Halloween) ? 89 : 159, (Manager.Type == HubType.Halloween) ? (byte)0 : (byte)15, TextAlign.CENTER); UtilText.MakeText("SUPER SMASH MOBS", locClassics.clone().add(0, 14, -15), faceOther, 159, color, TextAlign.CENTER); - UtilText.MakeText("SUPER SMASH MOBS", locClassics.clone().add(0, 14, -16), faceOther, 159, (byte)15, TextAlign.CENTER); + UtilText.MakeText("SUPER SMASH MOBS", locClassics.clone().add(0, 14, -16), faceOther, (Manager.Type == HubType.Halloween) ? 89 : 159, (Manager.Type == HubType.Halloween) ? (byte)0 : (byte)15, TextAlign.CENTER); UtilText.MakeText("DOMINATE", locComp.clone().add(15, 14, 0), faceComp, 159, color, TextAlign.CENTER); - UtilText.MakeText("DOMINATE", locComp.clone().add(16, 14, 0), faceComp, 159, (byte)15, TextAlign.CENTER); + UtilText.MakeText("DOMINATE", locComp.clone().add(16, 14, 0), faceComp, (Manager.Type == HubType.Halloween) ? 89 : 159, (Manager.Type == HubType.Halloween) ? (byte)0 : (byte)15, TextAlign.CENTER); //System.out.println("TextCreator : " + (System.currentTimeMillis() - startTime) + "ms"); } */ diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/WorldManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/WorldManager.java index f06c2c2a4..551f146f0 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/WorldManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/WorldManager.java @@ -19,11 +19,13 @@ import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.hub.HubManager; +import mineplex.hub.HubType; import mineplex.minecraft.game.core.damage.CustomDamageEvent; import org.bukkit.GameMode; import org.bukkit.Location; import org.bukkit.Material; +import org.bukkit.Sound; import org.bukkit.World; import org.bukkit.block.Block; import org.bukkit.entity.Boat; @@ -105,7 +107,7 @@ public class WorldManager extends MiniPlugin else loc = new Location(Manager.GetSpawn().getWorld(), 43, 72, 5); //Spawn - if (Manager.Mode.equals("Halloween")) + if (Manager.Type == HubType.Halloween) { Skeleton ent = loc.getWorld().spawn(loc, Skeleton.class); @@ -115,13 +117,14 @@ public class WorldManager extends MiniPlugin ent.getEquipment().setHelmet(ItemStackFactory.Instance.CreateStack(Material.PUMPKIN)); ent.setCustomName(C.cYellow + "Pumpkin Minion"); + ent.setCustomNameVisible(false); _mobs.add(ent); Manager.GetCondition().Factory().Invisible("Perm", ent, ent, 999999999, 0, false, false, true); Manager.GetCondition().Factory().Slow("Perm", ent, ent, 999999999, 1, false, false, false, true); } - else if (Manager.Mode.equals("Christmas")) + else if (Manager.Type == HubType.Christmas) { _mobs.add(loc.getWorld().spawn(loc, Snowman.class)); } @@ -230,7 +233,7 @@ public class WorldManager extends MiniPlugin World world = UtilWorld.getWorld("world"); - if (Manager.Mode.equals("Halloween")) + if (Manager.Type == HubType.Halloween) world.setTime(16000); else world.setTime(6000); @@ -244,7 +247,7 @@ public class WorldManager extends MiniPlugin if (event.getType() != UpdateType.FAST) return; - if (!Manager.Mode.equals("Halloween")) + if (Manager.Type != HubType.Halloween) return; //Block Lightup @@ -276,6 +279,22 @@ public class WorldManager extends MiniPlugin } } + @EventHandler + public void SoundUpdate(UpdateEvent event) + { + if (Manager.Type != HubType.Halloween) + return; + + if (event.getType() != UpdateType.SLOW) + return; + + if (Math.random() > 0.1) + return; + + for (Player player : UtilServer.getPlayers()) + player.playSound(player.getLocation(), Sound.AMBIENCE_CAVE, 3f, 1f); + } + @EventHandler public void BlockForm(BlockFormEvent event) { @@ -285,7 +304,7 @@ public class WorldManager extends MiniPlugin @EventHandler public void CreatureTarget(EntityTargetEvent event) { - if (Manager.Mode.equals("Christmas")) + if (Manager.Type == HubType.Christmas) { event.setCancelled(true); } diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerNpcPage.java b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerNpcPage.java index d35743540..ba35f2d1c 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerNpcPage.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerNpcPage.java @@ -88,7 +88,7 @@ public class ServerNpcPage extends ShopPageBase im ChatColor.RESET + C.cGreen + timeLeft + " Remaining...", ChatColor.RESET + "", ChatColor.RESET + C.cYellow + "Free players must wait a " + (beta ? "long" : "short") + " time", - ChatColor.RESET + C.cYellow + "to help lighten the load on our " + (beta ? "Beta" : "") + " servers.", + ChatColor.RESET + C.cYellow + "to help lighten the load on our" + (beta ? " Beta" : "") + " servers.", ChatColor.RESET + "", ChatColor.RESET + C.cAqua + "Ultra and Hero players have", ChatColor.RESET + C.cAqua + "instant access to our servers!", diff --git a/Plugins/Mineplex.MapParser/src/mineplex/mapparser/BackupTask.java b/Plugins/Mineplex.MapParser/src/mineplex/mapparser/BackupTask.java new file mode 100644 index 000000000..43052a30e --- /dev/null +++ b/Plugins/Mineplex.MapParser/src/mineplex/mapparser/BackupTask.java @@ -0,0 +1,90 @@ +package mineplex.mapparser; + +import java.io.File; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +import org.bukkit.plugin.java.JavaPlugin; + +import mineplex.core.common.util.Callback; +import mineplex.core.common.util.ZipUtil; + +/** + * Created by shaun on 14-09-23. + */ +public class BackupTask implements Runnable +{ + private final String _worldName; + private final Callback _callback; + private final JavaPlugin _plugin; + + public BackupTask(JavaPlugin plugin, String worldName, Callback callback) + { + _plugin = plugin; + _worldName = worldName; + _callback = callback; + + plugin.getServer().getScheduler().runTaskAsynchronously(plugin, this); + } + + @Override + public void run() + { + Date date = new Date(); + SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH-mm-ss"); + List fileList = new ArrayList(); + List folderList = new ArrayList(); + String dest = "backup" + _worldName.substring(3) + "/" + format.format(date) + ".zip"; + File srcFile = new File(_worldName); + + // Create backup folder if it doesnt already exist + File folder = new File(dest.substring(0, dest.lastIndexOf('/'))); + if (!folder.exists()) + folder.mkdirs(); + + // Get all files to backup + for (File file : srcFile.listFiles()) + { + if (file.isFile()) + fileList.add(_worldName + File.separator + file.getName()); + else if (file.isDirectory()) + folderList.add(_worldName + File.separator + file.getName()); + } + + // Delete old folders if more than 20 backups exist + if (folder.listFiles().length > 20) + { + File[] files = folder.listFiles(); + File oldestFile = files[0]; + + for (int i = 1; i < files.length; i++) + { + File file = files[i]; + if (file.getName().endsWith(".zip") && file.lastModified() < oldestFile.lastModified()) + { + oldestFile = file; + } + } + + System.out.println("Deleting oldest file: " + oldestFile.getName()); + oldestFile.delete(); + } + + + ZipUtil.ZipFolders(srcFile.getAbsolutePath(), dest, folderList, fileList); + + if (_callback != null) + { + _plugin.getServer().getScheduler().runTask(_plugin, new Runnable() + { + @Override + public void run() + { + _callback.run(true); + } + }); + } + } +} diff --git a/Plugins/Mineplex.MapParser/src/mineplex/mapparser/MapParser.java b/Plugins/Mineplex.MapParser/src/mineplex/mapparser/MapParser.java index 36010f749..077d353fd 100644 --- a/Plugins/Mineplex.MapParser/src/mineplex/mapparser/MapParser.java +++ b/Plugins/Mineplex.MapParser/src/mineplex/mapparser/MapParser.java @@ -3,6 +3,7 @@ package mineplex.mapparser; import java.io.File; import java.util.ArrayList; import java.util.HashMap; +import java.util.HashSet; import java.util.Iterator; import java.util.LinkedList; import java.util.List; @@ -30,19 +31,19 @@ import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerMoveEvent; import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.inventory.ItemStack; -import org.bukkit.permissions.PermissionAttachmentInfo; import org.bukkit.plugin.Plugin; import org.bukkit.plugin.java.JavaPlugin; import mineplex.core.common.util.C; +import mineplex.core.common.util.Callback; import mineplex.core.common.util.F; import mineplex.core.common.util.MapUtil; import mineplex.core.common.util.UtilInv; import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; +import mineplex.mapparser.command.AdminCommand; import mineplex.mapparser.command.AuthorCommand; import mineplex.mapparser.command.BaseCommand; -import mineplex.mapparser.command.AdminCommand; import mineplex.mapparser.command.CopyCommand; import mineplex.mapparser.command.CopySchematicsCommand; import mineplex.mapparser.command.CreateCommand; @@ -63,6 +64,7 @@ public class MapParser extends JavaPlugin implements Listener private Parse _curParse = null; private HashMap _mapData = new HashMap(); + private HashSet _mapsBeingZipped = new HashSet(); private List _commands = new ArrayList(); private Location _spawnLocation; @@ -142,7 +144,7 @@ public class MapParser extends JavaPlugin implements Listener @EventHandler public void Command(PlayerCommandPreprocessEvent event) - { + { Player player = event.getPlayer(); String[] parts = event.getMessage().split(" "); @@ -257,7 +259,10 @@ public class MapParser extends JavaPlugin implements Listener { for (World world : this.getServer().getWorlds()) { - world.setTime(8000); + if (world.getName().toLowerCase().contains("halloween")) + world.setTime(16000); + else + world.setTime(8000); world.setStorm(false); } @@ -269,35 +274,47 @@ public class MapParser extends JavaPlugin implements Listener @EventHandler public void SaveUnloadWorlds(TickEvent event) { - for (World world : getServer().getWorlds()) + for (final World world : getServer().getWorlds()) { if (world.getName().equalsIgnoreCase("world")) continue; - + if (world.getName().startsWith("parse_")) continue; - + if (!world.getName().startsWith("map")) continue; - + if (world.getPlayers().isEmpty()) { Announce("Saving & Closing World: " + F.elem(world.getName())); MapUtil.UnloadWorld(this, world, true); + + _mapsBeingZipped.add(world.getName()); + System.out.println("Starting backup of " + world); + BackupTask backupTask = new BackupTask(this, world.getName(), new Callback() + { + @Override + public void run(Boolean data) + { + System.out.println("Finished backup of " + world); + _mapsBeingZipped.remove(world.getName()); + } + }); } } } - + public void Announce(String msg) { for (Player player : UtilServer.getPlayers()) { player.sendMessage(C.cGold + msg); } - + System.out.println("[Announce] " + msg); } - + public boolean DoesMapExist(String mapName, GameType gameType) { return DoesMapExist(getWorldString(mapName, gameType)); @@ -390,16 +407,16 @@ public class MapParser extends JavaPlugin implements Listener return maps; } - + public MapData GetData(String mapName) { if (_mapData.containsKey(mapName)) return _mapData.get(mapName); - + MapData data = new MapData(mapName); - + _mapData.put(mapName, data); - + return data; } @@ -407,11 +424,11 @@ public class MapParser extends JavaPlugin implements Listener { return _spawnLocation; } - + public void ResetInventory(Player player) { UtilInv.Clear(player); - + player.getInventory().addItem(new ItemStack(Material.STONE_SWORD)); player.getInventory().addItem(new ItemStack(Material.STONE_SPADE)); player.getInventory().addItem(new ItemStack(Material.STONE_PICKAXE)); @@ -428,7 +445,7 @@ public class MapParser extends JavaPlugin implements Listener { _curParse = parse; } - + @EventHandler public void Chat(AsyncPlayerChatEvent event) { @@ -437,14 +454,14 @@ public class MapParser extends JavaPlugin implements Listener String world = C.cDGreen + C.Bold + getShortWorldName(event.getPlayer().getWorld().getName()); - + String name = C.cYellow + event.getPlayer().getName(); if (GetData(event.getPlayer().getWorld().getName()).HasAccess(event.getPlayer())) name = C.cGreen + event.getPlayer().getName(); - + String grayName = C.cBlue + event.getPlayer().getName(); String grayWorld = C.cBlue + C.Bold + event.getPlayer().getWorld().getName(); - + for (Player player : UtilServer.getPlayers()) { if (player.getWorld().equals(event.getPlayer().getWorld())) @@ -455,12 +472,12 @@ public class MapParser extends JavaPlugin implements Listener { player.sendMessage(grayWorld + ChatColor.RESET + " " + grayName + ChatColor.RESET + " " + C.cGray + event.getMessage()); } - + } - + System.out.println(world + ChatColor.RESET + " " + name + ChatColor.RESET + " " + event.getMessage()); } - + @EventHandler public void InteractCancel(PlayerInteractEvent event) { @@ -470,7 +487,7 @@ public class MapParser extends JavaPlugin implements Listener event.setCancelled(true); } } - + @EventHandler public void WorldeditCancel(PlayerCommandPreprocessEvent event) { @@ -484,13 +501,18 @@ public class MapParser extends JavaPlugin implements Listener } } } - + + public HashSet getMapsBeingZipped() + { + return _mapsBeingZipped; + } + @EventHandler public void Join(PlayerJoinEvent event) { event.setJoinMessage(F.sys("Player Join", event.getPlayer().getName())); } - + @EventHandler public void Join(PlayerQuitEvent event) { diff --git a/Plugins/Mineplex.MapParser/src/mineplex/mapparser/command/MapCommand.java b/Plugins/Mineplex.MapParser/src/mineplex/mapparser/command/MapCommand.java index 9bb845b1b..490f4b8cf 100644 --- a/Plugins/Mineplex.MapParser/src/mineplex/mapparser/command/MapCommand.java +++ b/Plugins/Mineplex.MapParser/src/mineplex/mapparser/command/MapCommand.java @@ -72,6 +72,12 @@ public class MapCommand extends BaseCommand worldName = getPlugin().getWorldString(args[0], gameType); } + if (getPlugin().getMapsBeingZipped().contains(worldName)) + { + message(player, "That map is being backed up now. Try again soon"); + return true; + } + World world = getPlugin().GetMapWorld(worldName); if (world == null) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/Halloween.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/Halloween.java index f6022addc..f72f02b09 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/Halloween.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/Halloween.java @@ -1,8 +1,5 @@ package nautilus.game.arcade.game.games.halloween; -import java.io.BufferedWriter; -import java.io.FileWriter; -import java.io.IOException; import java.util.ArrayList; import java.util.Collection; import java.util.HashSet; @@ -14,6 +11,7 @@ import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.block.Block; +import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer; import org.bukkit.entity.*; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; @@ -21,13 +19,14 @@ import org.bukkit.event.entity.EntityDeathEvent; import org.bukkit.event.entity.EntityExplodeEvent; import org.bukkit.event.entity.EntityTargetEvent; import org.bukkit.event.entity.ItemSpawnEvent; +import org.bukkit.event.player.PlayerCommandPreprocessEvent; import mineplex.core.common.util.C; import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilTime; -import mineplex.core.common.util.UtilWorld; import mineplex.core.common.util.UtilTime.TimeUnit; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; @@ -41,6 +40,7 @@ import nautilus.game.arcade.game.games.halloween.creatures.*; import nautilus.game.arcade.game.games.halloween.kits.*; import nautilus.game.arcade.game.games.halloween.waves.*; import nautilus.game.arcade.kit.Kit; +import net.minecraft.server.v1_7_R4.PacketPlayOutNamedSoundEffect; public class Halloween extends SoloGame { @@ -53,6 +53,8 @@ public class Halloween extends SoloGame private int _maxMobs = 80; private ArrayList _mobs = new ArrayList(); + private HashSet _soundOff = new HashSet(); + public long total = 0; public long move = 0; public int moves = 0; @@ -138,6 +140,15 @@ public class Halloween extends SoloGame GetTeamList().add(new GameTeam(this, "Pumpkin King", ChatColor.RED, WorldData.GetDataLocs("RED"))); } + + @EventHandler(priority = EventPriority.MONITOR) + public void VoiceCommand(GameStateChangeEvent event) + { + if (event.GetState() != GameState.Live) + return; + + Announce(C.Bold + "Type " + C.cGreen + C.Bold + "/voice" + C.cWhite + C.Bold + " to disable voice audio."); + } @EventHandler(priority = EventPriority.MONITOR) public void TimeReport(UpdateEvent event) @@ -183,7 +194,7 @@ public class Halloween extends SoloGame if (!IsLive()) return; - if (Math.random() > 0.85) + if (Math.random() > 0.6) return; for (Player player : UtilServer.getPlayers()) @@ -321,24 +332,24 @@ public class Halloween extends SoloGame return; if (_wave >= _waves.size()) - { - - + { for (Player player : GetPlayers(false)) { - Manager.GetDonation().PurchaseUnknownSalesPackage(null, player.getName(), player.getUniqueId(), "Pumpkin Kings Head", false, 0, true); + Manager.GetDonation().PurchaseUnknownSalesPackage(null, player.getName(), player.getUniqueId(), "Pumpling", false, 0, true); Manager.GetGame().AddGems(player, 30, "Killing the Pumpkin King", false); Manager.GetGame().AddGems(player, 10, "Participation", false); } - SetCustomWinLine("You earned Pumpkin Kings Head!"); + SetCustomWinLine("You earned Pumpling Pet!"); AnnounceEnd(this.GetTeamList().get(0)); - SetState(GameState.End); + SetState(GameState.End); } else if (GetPlayers(true).size() == 0) { + playSound(HalloweenAudio.BOSS_WIN); + for (Player player : GetPlayers(false)) { Manager.GetGame().AddGems(player, 10, "Participation", false); @@ -436,7 +447,7 @@ public class Halloween extends SoloGame //Rounds Scoreboard.WriteBlank(); Scoreboard.Write(C.cYellow + "Wave"); - Scoreboard.Write(_wave + " of 6"); + Scoreboard.Write((_wave+1) + " of 6"); Scoreboard.WriteBlank(); Scoreboard.Write(C.cYellow + "Monsters"); @@ -460,4 +471,37 @@ public class Halloween extends SoloGame Scoreboard.Draw(); } + + @EventHandler + public void soundOff(PlayerCommandPreprocessEvent event) + { + if (event.getMessage().equalsIgnoreCase("/voice")) + { + if (_soundOff.remove(event.getPlayer())) + { + UtilPlayer.message(event.getPlayer(), C.Bold + "Voice Audio: " + C.cGreen + "Enabled"); + } + else + { + _soundOff.add(event.getPlayer()); + + UtilPlayer.message(event.getPlayer(), C.Bold + "Voice Audio: " + C.cRed + "Disabled"); + } + + event.setCancelled(true); + } + } + + public void playSound(HalloweenAudio audio) + { + for (Player player : UtilServer.getPlayers()) + if (!_soundOff.contains(player)) + { + PacketPlayOutNamedSoundEffect packet = new PacketPlayOutNamedSoundEffect(audio.getName(), + player.getLocation().getBlockX(), player.getLocation().getBlockY(), player.getLocation().getBlockZ(), + 3f, 1F); + + ((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet); + } + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/HalloweenAudio.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/HalloweenAudio.java new file mode 100644 index 000000000..c737a3a68 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/HalloweenAudio.java @@ -0,0 +1,32 @@ +package nautilus.game.arcade.game.games.halloween; + +public enum HalloweenAudio +{ + WAVE_1("halloween.wave1"), + WAVE_2("halloween.wave2"), + WAVE_3("halloween.wave3"), + WAVE_4("halloween.wave4"), + WAVE_5("halloween.wave5"), + WAVE_6("halloween.wave6"), + + BOSS_SPAWN("halloween.boss_spawn"), + BOSS_LOSE("halloween.boss_lose"), + BOSS_WIN("halloween.boss_win"), + + BOSS_STAGE_MINION_ATTACK("halloween.boss_minion"), + BOSS_STAGE_SHIELD_RESTORE("halloween.boss_shield"), + BOSS_STAGE_FINAL("halloween.boss_final"), + BOSS_STAGE_FINAL_HALF_DEAD("halloween.boss_final_taunt"); + + private String _name; + + HalloweenAudio(String name) + { + _name = name; + } + + public String getName() + { + return _name; + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/creatures/MobSpiderLeaper.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/creatures/MobSpiderLeaper.java index 4d54b9b98..4d99e2678 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/creatures/MobSpiderLeaper.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/creatures/MobSpiderLeaper.java @@ -11,6 +11,7 @@ import nautilus.game.arcade.game.games.halloween.Halloween; import org.bukkit.Location; import org.bukkit.entity.CaveSpider; import org.bukkit.event.entity.EntityTargetEvent; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; public class MobSpiderLeaper extends CreatureBase implements InterfaceMove { @@ -30,7 +31,8 @@ public class MobSpiderLeaper extends CreatureBase implements Interfa @Override public void Damage(CustomDamageEvent event) { - + if (event.GetCause() == DamageCause.FALL) + event.SetCancelled("Fall Immunity"); } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/creatures/PumpkinKing.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/creatures/PumpkinKing.java index 735339b2a..df8133dbd 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/creatures/PumpkinKing.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/creatures/PumpkinKing.java @@ -23,6 +23,7 @@ import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent; import nautilus.game.arcade.game.games.halloween.Halloween; +import nautilus.game.arcade.game.games.halloween.HalloweenAudio; import net.minecraft.server.v1_7_R4.EntityArrow; import net.minecraft.server.v1_7_R4.EntityCreature; import net.minecraft.server.v1_7_R4.Navigation; @@ -70,6 +71,8 @@ public class PumpkinKing extends CreatureBase private HashSet _arrows = new HashSet(); + private boolean _announcedHalfHealth = false; + public PumpkinKing(Halloween game, Location loc) { super(game, null, Skeleton.class, loc); @@ -401,10 +404,10 @@ public class PumpkinKing extends CreatureBase { if (GetState() != 3) return; - + if (_minions.isEmpty()) return; - + Skeleton minion = _minions.remove(0); LivingEntity target = _minionTargets.get(minion); @@ -568,7 +571,7 @@ public class PumpkinKing extends CreatureBase { if (GetState() == 3 || GetState() == 4) return; - + Iterator shieldIterator = _shields.iterator(); while (shieldIterator.hasNext()) { @@ -664,6 +667,7 @@ public class PumpkinKing extends CreatureBase _state = state; _stateTime = System.currentTimeMillis(); + if (state == 3) { //Update Gear @@ -677,7 +681,7 @@ public class PumpkinKing extends CreatureBase Host.Manager.GetCondition().Factory().Speed("Minion Speed", minion, minion, 15, 0, false, false, false); //Sound - GetEntity().getWorld().playSound(GetEntity().getLocation(), Sound.WITHER_SPAWN, 10f, 1.5f); + //GetEntity().getWorld().playSound(GetEntity().getLocation(), Sound.WITHER_SPAWN, 1f, 1.5f); //Target _minionTargets.put(minion, GetRandomPlayer()); @@ -687,6 +691,13 @@ public class PumpkinKing extends CreatureBase Host.Announce(C.cAqua + C.Bold + "Kill the Pumpkin Minions!"); MinionAttack(); + + Host.playSound(HalloweenAudio.BOSS_STAGE_MINION_ATTACK); + } + + if (state == 4) + { + Host.playSound(HalloweenAudio.BOSS_STAGE_FINAL); } } @@ -737,10 +748,24 @@ public class PumpkinKing extends CreatureBase } ShieldSpawn(); + + Host.playSound(HalloweenAudio.BOSS_STAGE_SHIELD_RESTORE); _minionTargets.clear(); } } + else if (GetState() == 4) + { + if (!_announcedHalfHealth) + { + if (GetEntity().getHealth() < GetEntity().getMaxHealth()/2) + { + Host.playSound(HalloweenAudio.BOSS_STAGE_FINAL_HALF_DEAD); + _announcedHalfHealth = true; + } + + } + } //Skeleton Scatter if (GetState() != 3 && UtilTime.elapsed(_stateTime, 2000)) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/kits/KitFinn.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/kits/KitFinn.java index 70216612b..eb6f0442c 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/kits/KitFinn.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/kits/KitFinn.java @@ -36,7 +36,7 @@ public class KitFinn extends SmashKit new PerkFlameSlam(), new PerkBlizzardFinn(), - new PerkFletcher(1, 4, true), + new PerkFletcher(2, 2, true), }, EntityType.ZOMBIE, new ItemStack(Material.GOLD_SWORD)); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/kits/KitThor.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/kits/KitThor.java index c7a3495b9..7fbb64109 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/kits/KitThor.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/kits/KitThor.java @@ -35,7 +35,7 @@ public class KitThor extends SmashKit new Perk[] { new PerkKnockbackAttack(2), - new PerkFletcher(1, 4, true), + new PerkFletcher(2, 2, true), new PerkSeismicHammer(), new PerkHammerThrow(), }, diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/waves/Wave1.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/waves/Wave1.java index e9b044dfd..e8c00e8d7 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/waves/Wave1.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/waves/Wave1.java @@ -2,6 +2,7 @@ package nautilus.game.arcade.game.games.halloween.waves; import mineplex.core.common.util.UtilTime; import nautilus.game.arcade.game.games.halloween.Halloween; +import nautilus.game.arcade.game.games.halloween.HalloweenAudio; import nautilus.game.arcade.game.games.halloween.creatures.MobSkeletonArcher; import nautilus.game.arcade.game.games.halloween.creatures.MobSkeletonWarrior; @@ -9,7 +10,7 @@ public class Wave1 extends WaveBase { public Wave1(Halloween host) { - super(host, "Skeletons? Farmers? FARMER SKELETONS!!!", 60000, host.GetSpawnSet(1)); + super(host, "Skeletons? Farmers? FARMER SKELETONS!!!", 60000, host.GetSpawnSet(1), HalloweenAudio.WAVE_1); } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/waves/Wave2.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/waves/Wave2.java index e3ab4dddb..afdbacb29 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/waves/Wave2.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/waves/Wave2.java @@ -2,6 +2,7 @@ package nautilus.game.arcade.game.games.halloween.waves; import mineplex.core.common.util.UtilTime; import nautilus.game.arcade.game.games.halloween.Halloween; +import nautilus.game.arcade.game.games.halloween.HalloweenAudio; import nautilus.game.arcade.game.games.halloween.creatures.MobCreeper; import nautilus.game.arcade.game.games.halloween.creatures.MobGiant; import nautilus.game.arcade.game.games.halloween.creatures.MobZombie; @@ -10,7 +11,7 @@ public class Wave2 extends WaveBase { public Wave2(Halloween host) { - super(host, "A GIANT!? Better kill that guy fast!", 65000, host.GetSpawnSet(0)); + super(host, "Giant Zombie is here to smash your brains!", 65000, host.GetSpawnSet(0), HalloweenAudio.WAVE_2); } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/waves/Wave3.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/waves/Wave3.java index c61d138bc..e89907951 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/waves/Wave3.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/waves/Wave3.java @@ -2,6 +2,7 @@ package nautilus.game.arcade.game.games.halloween.waves; import mineplex.core.common.util.UtilTime; import nautilus.game.arcade.game.games.halloween.Halloween; +import nautilus.game.arcade.game.games.halloween.HalloweenAudio; import nautilus.game.arcade.game.games.halloween.creatures.MobSpiderLeaper; import nautilus.game.arcade.game.games.halloween.creatures.MobSpiderSmasher; @@ -9,7 +10,7 @@ public class Wave3 extends WaveBase { public Wave3(Halloween host) { - super(host, "Spiders Spiders Spiders!", 70000, host.GetSpawnSet(2)); + super(host, "Spiders, Spiders and even more Spiders!", 70000, host.GetSpawnSet(2), HalloweenAudio.WAVE_3); } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/waves/Wave4.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/waves/Wave4.java index 243a6d396..0ea7212a7 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/waves/Wave4.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/waves/Wave4.java @@ -4,6 +4,7 @@ import org.bukkit.Location; import mineplex.core.common.util.UtilTime; import nautilus.game.arcade.game.games.halloween.Halloween; +import nautilus.game.arcade.game.games.halloween.HalloweenAudio; import nautilus.game.arcade.game.games.halloween.creatures.MobGhast; import nautilus.game.arcade.game.games.halloween.creatures.MobPigZombie; @@ -11,7 +12,7 @@ public class Wave4 extends WaveBase { public Wave4(Halloween host) { - super(host, "Ghasts and friends!", 80000, host.GetSpawnSet(3)); + super(host, "Look up! Its the Ghasts and Ghouls!", 80000, host.GetSpawnSet(3), HalloweenAudio.WAVE_4); } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/waves/Wave5.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/waves/Wave5.java index d7b5200aa..6feaad4a5 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/waves/Wave5.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/waves/Wave5.java @@ -3,13 +3,14 @@ package nautilus.game.arcade.game.games.halloween.waves; import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilTime; import nautilus.game.arcade.game.games.halloween.Halloween; +import nautilus.game.arcade.game.games.halloween.HalloweenAudio; import nautilus.game.arcade.game.games.halloween.creatures.*; public class Wave5 extends WaveBase { public Wave5(Halloween host) { - super(host, "Double the Giants! Double the fun!", 80000, host.GetSpawnSet(1)); + super(host, "Double the Giants! Double the fun!", 80000, host.GetSpawnSet(1), HalloweenAudio.WAVE_5); } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/waves/WaveBase.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/waves/WaveBase.java index e769bc57a..c20a9f27f 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/waves/WaveBase.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/waves/WaveBase.java @@ -11,6 +11,7 @@ import org.bukkit.entity.Player; import org.bukkit.util.Vector; import nautilus.game.arcade.game.games.halloween.Halloween; +import nautilus.game.arcade.game.games.halloween.HalloweenAudio; import mineplex.core.common.util.C; import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilServer; @@ -23,6 +24,7 @@ public abstract class WaveBase protected Halloween Host; protected String _name; + protected HalloweenAudio _audio; protected long _start; protected long _duration; @@ -31,11 +33,12 @@ public abstract class WaveBase protected ArrayList _spawns; - public WaveBase(Halloween host, String name, long duration, ArrayList spawns) + public WaveBase(Halloween host, String name, long duration, ArrayList spawns, HalloweenAudio audio) { Host = host; _name = name; + _audio = audio; _start = System.currentTimeMillis(); _duration = duration; @@ -69,8 +72,10 @@ public abstract class WaveBase UtilTitle.display(C.cYellow + "Wave " + wave, _name, 10, 100, 20); - for (Player player : UtilServer.getPlayers()) - player.playSound(player.getLocation(), Sound.ENDERDRAGON_GROWL, 2f, 1f); + if (_audio != null) + { + Host.playSound(_audio); + } } //Display @@ -105,9 +110,6 @@ public abstract class WaveBase for (int z=-1 ; z<=1 ; z++) Host.Manager.GetBlockRestore().Add(block.getRelative(x, -1, z), 42, (byte)0, _duration); - //Lightning - block.getWorld().strikeLightningEffect(block.getLocation()); - //Clear Laser while (block.getY() < 250) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/waves/WaveBoss.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/waves/WaveBoss.java index 8301ed33e..6d9cef0bf 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/waves/WaveBoss.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/waves/WaveBoss.java @@ -1,6 +1,7 @@ package nautilus.game.arcade.game.games.halloween.waves; import nautilus.game.arcade.game.games.halloween.Halloween; +import nautilus.game.arcade.game.games.halloween.HalloweenAudio; import nautilus.game.arcade.game.games.halloween.creatures.MobCreeper; import nautilus.game.arcade.game.games.halloween.creatures.MobGiant; import nautilus.game.arcade.game.games.halloween.creatures.MobZombie; @@ -10,22 +11,28 @@ public class WaveBoss extends WaveBase { private PumpkinKing _king; + private boolean _canEnd = false; + public WaveBoss(Halloween host) { - super(host, "The Pumpkin King", 0, host.GetSpawnSet(0)); + super(host, "The Pumpkin King", 0, host.GetSpawnSet(0), HalloweenAudio.WAVE_6); } @Override public void Spawn(int tick) { - if (tick == 0) + if (tick == 100) { _king = new PumpkinKing(Host, Host.WorldData.GetDataLocs("BLACK").get(0)); Host.AddCreature(_king); + + Host.playSound(HalloweenAudio.BOSS_SPAWN); + + _canEnd = true; } //Increasing difficulty of mobs - if (Host.GetCreatures().size() < 20 + (tick/200) && !_king.IsFinal()) + if (Host.GetCreatures().size() < 20 + (tick/200) && (_king == null || !_king.IsFinal())) { if (tick % Math.max(5, 15 - tick/400) == 0) if (Math.random() > 0.10) @@ -35,7 +42,7 @@ public class WaveBoss extends WaveBase } //Giant every 2.5 minutes - if (tick % 3000 == 0 && !_king.IsFinal()) + if (tick % 3000 == 0 && (_king == null || !_king.IsFinal())) { Host.AddCreature(new MobGiant(Host, GetSpawn())); } @@ -44,6 +51,12 @@ public class WaveBoss extends WaveBase @Override public boolean CanEnd() { - return _king == null || !_king.GetEntity().isValid(); + if (_canEnd && (_king == null || !_king.GetEntity().isValid())) + { + _king.Host.playSound(HalloweenAudio.BOSS_LOSE); + return true; + } + + return false; } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/waves/WaveVictory.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/waves/WaveVictory.java index c2e74e690..618658947 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/waves/WaveVictory.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/waves/WaveVictory.java @@ -13,7 +13,7 @@ public class WaveVictory extends WaveBase { public WaveVictory(Halloween host) { - super(host, "Celebration!", 15000, host.GetSpawnSet(3)); + super(host, "Celebration!", 15000, host.GetSpawnSet(3), null); } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/UHC.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/UHC.java index b9dcc1e53..b7668d650 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/UHC.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/UHC.java @@ -1389,7 +1389,10 @@ public class UHC extends TeamGame //Ended if (GetState() == GameState.End || GetState() == GameState.Dead) { - return ChatColor.RED + "Finished"; + if (_ended) + return ChatColor.RED + "Finished"; + else + return ChatColor.YELLOW + "In Progress"; } //Not Joinable Yet diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBlizzardFinn.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBlizzardFinn.java index e9146d2f4..71e1ad758 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBlizzardFinn.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBlizzardFinn.java @@ -1,6 +1,7 @@ package nautilus.game.arcade.kit.perks; import java.util.HashMap; +import java.util.Iterator; import java.util.WeakHashMap; import org.bukkit.Sound; @@ -107,6 +108,26 @@ public class PerkBlizzardFinn extends Perk } } + @EventHandler + public void RemoveSnowball(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + Iterator projIterator = _snowball.keySet().iterator(); + + while (projIterator.hasNext()) + { + Projectile proj = projIterator.next(); + + if (proj.getTicksLived() > 20) + { + proj.remove(); + projIterator.remove(); + } + } + } + @EventHandler(priority = EventPriority.LOW) public void Snowball(CustomDamageEvent event) { @@ -130,21 +151,9 @@ public class PerkBlizzardFinn extends Perk event.SetCancelled("Player Cancel"); return; } - + damagee.setVelocity(proj.getVelocity().multiply(0.15).add(new Vector(0, 0.15, 0))); - + event.AddMod(GetName(), GetName(), 0.6, false); } - - @EventHandler - public void SnowballForm(ProjectileHitEvent event) - { - if (!(event.getEntity() instanceof Snowball)) - return; - - if (_snowball.remove(event.getEntity()) == null) - return; - - Manager.GetBlockRestore().Snow(event.getEntity().getLocation().getBlock(), (byte)1, (byte)7, 2000, 250, 0); - } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkFlameSlam.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkFlameSlam.java index b71cdf398..1b338b855 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkFlameSlam.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkFlameSlam.java @@ -66,16 +66,10 @@ public class PerkFlameSlam extends Perk if (!Kit.HasKit(player)) return; - if (UtilEnt.isGrounded(player)) - { - UtilPlayer.message(player, F.main("Skill", "You cannot use " + F.skill(GetName()) + " while grounded.")); - return; - } - if (!Recharge.Instance.use(player, GetName(), 8000, true, true)) return; - UtilAction.velocity(player, player.getLocation().getDirection(), 1.2, false, 0, 0.2, 0.4, true); + //UtilAction.velocity(player, player.getLocation().getDirection(), 1.2, false, 0, 0.2, 0.4, true); //Record _live.put(player, System.currentTimeMillis()); @@ -95,9 +89,13 @@ public class PerkFlameSlam extends Perk while (liveIterator.hasNext()) { Player player = liveIterator.next(); + Vector vel = player.getLocation().getDirection(); + vel.setY(0); + UtilAlg.Normalize(vel); + player.setVelocity(vel.multiply(0.8)); //Particle - UtilParticle.PlayParticle(ParticleType.FLAME, player.getLocation().add(0, 1, 0), 0.1f, 0.1f, 0.1f, 0, 3); + UtilParticle.PlayParticle(ParticleType.FLAME, player.getLocation().add(0, 1, 0), 0.2f, 0.2f, 0.2f, 0, 5); for (Entity other : player.getWorld().getEntities()) { @@ -107,7 +105,7 @@ public class PerkFlameSlam extends Perk if (other instanceof Player) continue; - if (UtilMath.offset(player, other) > 2) + if (UtilMath.offset(player, other) > 1.5) continue; DoSlam(player, (LivingEntity)other); @@ -122,14 +120,14 @@ public class PerkFlameSlam extends Perk if (!_live.containsKey(player)) continue; - if (UtilEnt.isGrounded(player) || UtilTime.elapsed(_live.get(player), 1000)) + if (UtilTime.elapsed(_live.get(player), 800)) _live.remove(player); } } public void DoSlam(Player damager, LivingEntity damagee) { - UtilAction.velocity(damager, UtilAlg.getTrajectory2d(damagee, damager), 1, true, 0.4, 0, 0.4, false); + UtilAction.velocity(damager, UtilAlg.getTrajectory2d(damagee, damager), 1, true, 0.4, 0, 0.4, true); for (Entity other : damagee.getWorld().getEntities()) {