Merge remote-tracking branch 'origin/master'

This commit is contained in:
CoderTim 2014-10-16 22:15:20 -04:00
commit edb2c4f26a
43 changed files with 692 additions and 170 deletions

View File

@ -37,6 +37,7 @@
<zipfileset src="../Libraries/commons-codec-1.6.jar" /> <zipfileset src="../Libraries/commons-codec-1.6.jar" />
<zipfileset src="../Libraries/jedis-2.4.2.jar" /> <zipfileset src="../Libraries/jedis-2.4.2.jar" />
<zipfileset src="../Libraries/commons-pool2-2.2.jar" /> <zipfileset src="../Libraries/commons-pool2-2.2.jar" />
<zipfileset src="../Libraries/commons-dbcp2-2.0.1.jar" />
</jar> </jar>
<copy file="../bin/Arcade.jar" todir="../../Testing/Arcade/plugins"/> <copy file="../bin/Arcade.jar" todir="../../Testing/Arcade/plugins"/>
</target> </target>
@ -78,6 +79,7 @@
<zipfileset src="../Libraries/jooq-3.4.2.jar" /> <zipfileset src="../Libraries/jooq-3.4.2.jar" />
<zipfileset src="../Libraries/jedis-2.4.2.jar" /> <zipfileset src="../Libraries/jedis-2.4.2.jar" />
<zipfileset src="../Libraries/commons-pool2-2.2.jar" /> <zipfileset src="../Libraries/commons-pool2-2.2.jar" />
<zipfileset src="../Libraries/commons-dbcp2-2.0.1.jar" />
</jar> </jar>
<copy file="../bin/Hub.jar" todir="../../Testing/Hub/plugins"/> <copy file="../bin/Hub.jar" todir="../../Testing/Hub/plugins"/>
</target> </target>

View File

@ -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);
}
}

Binary file not shown.

View File

@ -1,7 +1,11 @@
package mineplex.core.common.jsonchat; package mineplex.core.common.jsonchat;
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
import org.bukkit.entity.Player; 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; import mineplex.core.common.util.UtilServer;
public class JsonMessage public class JsonMessage
@ -63,4 +67,53 @@ public class JsonMessage
{ {
UtilServer.getServer().dispatchCommand(UtilServer.getServer().getConsoleSender(), "tellraw " + player.getName() + " " + toString()); 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;
}
}
} }

View File

@ -7,6 +7,7 @@ public class C
public static String Scramble = "§k"; public static String Scramble = "§k";
public static String Bold = "§l"; public static String Bold = "§l";
public static String Strike = "§m"; public static String Strike = "§m";
public static String BoldStrike = "§l§m";
public static String Line = "§n"; public static String Line = "§n";
public static String Italics = "§o"; public static String Italics = "§o";

View File

@ -151,6 +151,11 @@ public class MapUtil
} }
} }
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, private static boolean changeChunkBlock(int x, int y, int z, net.minecraft.server.v1_7_R4.Chunk chunk, Block block,
byte data) byte data)
{ {

View File

@ -515,6 +515,7 @@ public class UtilEnt
Material beneath = player.getLocation().add(x, -1.5, z).getBlock().getType(); Material beneath = player.getLocation().add(x, -1.5, z).getBlock().getType();
if (player.getLocation().getY() % 0.5 == 0 && if (player.getLocation().getY() % 0.5 == 0 &&
(beneath == Material.FENCE || (beneath == Material.FENCE ||
beneath == Material.FENCE_GATE ||
beneath == Material.NETHER_FENCE || beneath == Material.NETHER_FENCE ||
beneath == Material.COBBLE_WALL)) beneath == Material.COBBLE_WALL))
return true; return true;

View File

@ -139,21 +139,21 @@ public class UtilText
if (align == TextAlign.CENTER) if (align == TextAlign.CENTER)
for (int i=-64 ; i<=64 ; i++) 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) if (align == TextAlign.LEFT)
for (int i=0 ; i<=128 ; i++) 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) if (align == TextAlign.RIGHT)
for (int i=-128 ; i<=0 ; i++) 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) if (letter[x][y] == 1)
{ {
changes.add(world.getBlockAt(bX, bY, bZ)); 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 //Forward

View File

@ -11,8 +11,8 @@ public enum Achievement
//Bridges //Bridges
BRIDGES_WINS("Bridge Champion", 600, BRIDGES_WINS("Bridge Champion", 600,
new String[]{"The Bridges.Wins"}, new String[]{"The Bridges.Wins"},
new String[]{"Win 50 games of The Bridges"}, new String[]{"Win 30 games of The Bridges"},
new int[]{50}, new int[]{30},
AchievementCategory.BRIDGES), AchievementCategory.BRIDGES),
BRIDGES_FOOD("Food for the Masses", 600, BRIDGES_FOOD("Food for the Masses", 600,
@ -48,8 +48,8 @@ public enum Achievement
//Survival Games //Survival Games
SURVIVAL_GAMES_WINS("Katniss Everdeen", 600, SURVIVAL_GAMES_WINS("Katniss Everdeen", 600,
new String[]{"Survival Games.Wins"}, new String[]{"Survival Games.Wins"},
new String[]{"Win 50 games of Survival Games"}, new String[]{"Win 30 games of Survival Games"},
new int[]{50}, new int[]{30},
AchievementCategory.SURVIVAL_GAMES), AchievementCategory.SURVIVAL_GAMES),
SURVIVAL_GAMES_LIGHT_WEIGHT("Light Weight", 1000, SURVIVAL_GAMES_LIGHT_WEIGHT("Light Weight", 1000,
@ -79,8 +79,8 @@ public enum Achievement
//Survival Games //Survival Games
UHC_WINS("Ultimate Winner", 600, UHC_WINS("Ultimate Winner", 600,
new String[]{"Ultra Hardcore.Wins"}, new String[]{"Ultra Hardcore.Wins"},
new String[]{"Win 20 games of Ultra Hardcore"}, new String[]{"Win 10 games of Ultra Hardcore"},
new int[]{20}, new int[]{10},
AchievementCategory.UHC), AchievementCategory.UHC),
//Smash Mobs //Smash Mobs
@ -486,7 +486,7 @@ public enum Achievement
SNEAK_ASSASSINS_THE_MASTERS_MASTER("The Master's Master", 700, SNEAK_ASSASSINS_THE_MASTERS_MASTER("The Master's Master", 700,
new String[]{"Sneaky Assassins.TheMastersMaster"}, 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}, new int[]{1},
AchievementCategory.SNEAKY_ASSASSINS), AchievementCategory.SNEAKY_ASSASSINS),
@ -524,7 +524,7 @@ public enum Achievement
MINE_STRIKE_BOOM_HEADSHOT("BOOM! HEADSHOT!", 0, MINE_STRIKE_BOOM_HEADSHOT("BOOM! HEADSHOT!", 0,
new String[]{"MineStrike.BoomHeadshot"}, new String[]{"MineStrike.BoomHeadshot"},
new String[]{"Win 500 people with headshots"}, new String[]{"Kill 500 people with headshots"},
new int[]{500}, new int[]{500},
AchievementCategory.MINE_STRIKE), AchievementCategory.MINE_STRIKE),
@ -536,7 +536,7 @@ public enum Achievement
MINE_STRIKE_KABOOM("Kaboom!", 0, MINE_STRIKE_KABOOM("Kaboom!", 0,
new String[]{"MineStrike.Kaboom"}, 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}, new int[]{1},
AchievementCategory.MINE_STRIKE), AchievementCategory.MINE_STRIKE),
@ -548,19 +548,19 @@ public enum Achievement
MINE_STRIKE_CLUTCH_OR_KICK("Clutch or Kick", 0, MINE_STRIKE_CLUTCH_OR_KICK("Clutch or Kick", 0,
new String[]{"MineStrike.ClutchOrKick"}, 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}, new int[]{1},
AchievementCategory.MINE_STRIKE), AchievementCategory.MINE_STRIKE),
MINE_STRIKE_KILLING_SPREE("Killing Spree", 0, MINE_STRIKE_KILLING_SPREE("Killing Spree", 0,
new String[]{"MineStrike.KillingSpree"}, 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}, new int[]{1},
AchievementCategory.MINE_STRIKE), AchievementCategory.MINE_STRIKE),
MINE_STRIKE_BLINDFOLDED("Blindfolded", 0, MINE_STRIKE_BLINDFOLDED("Blindfolded", 0,
new String[]{"MineStrike.Blindfolded"}, 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}, new int[]{1},
AchievementCategory.MINE_STRIKE), AchievementCategory.MINE_STRIKE),
; ;

View File

@ -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.PacketPlayOutOpenWindow;
import net.minecraft.server.v1_7_R4.PacketPlayOutSetSlot; import net.minecraft.server.v1_7_R4.PacketPlayOutSetSlot;
import org.bukkit.ChatColor;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer; import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
import org.bukkit.entity.Creature; import org.bukkit.entity.Creature;
@ -54,25 +55,45 @@ public class PetPage extends ShopPageBase<CosmeticManager, CosmeticShop>
{ {
List<String> itemLore = new ArrayList<String>(); List<String> itemLore = new ArrayList<String>();
itemLore.add(C.cYellow + pet.GetCost(CurrencyType.Coins) + " Coins"); //Halloween Name
if (pet.GetCost(CurrencyType.Coins) == -1)
{
itemLore.add(C.cBlack); 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 (DonationManager.Get(Player.getName()).OwnsUnknownPackage(pet.GetPetName()))
{ {
if (Plugin.getPetManager().hasActivePet(Player.getName()) && Plugin.getPetManager().getActivePet(Player.getName()).getType() == pet.GetPetType()) 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); addGlow(slot);
} }
else 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 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)); 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 else
setItem(slot, new ShopItem(Material.INK_SACK, (byte)8, "Purchase " + pet.GetPetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false)); setItem(slot, new ShopItem(Material.INK_SACK, (byte)8, "Purchase " + pet.GetPetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false));

View File

@ -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<DonationManager>
{
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<Boolean>()
{
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"));
}
}
}

View File

@ -2,6 +2,11 @@ package mineplex.core.donation;
import java.util.UUID; 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.MiniPlugin;
import mineplex.core.account.event.ClientUnloadEvent; import mineplex.core.account.event.ClientUnloadEvent;
import mineplex.core.account.event.ClientWebResponseEvent; 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.UpdateType;
import mineplex.core.updater.event.UpdateEvent; 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 public class DonationManager extends MiniPlugin
{ {
private DonationRepository _repository; private DonationRepository _repository;
@ -42,6 +42,7 @@ public class DonationManager extends MiniPlugin
public void AddCommands() public void AddCommands()
{ {
AddCommand(new GemCommand(this)); AddCommand(new GemCommand(this));
AddCommand(new CoinCommand(this));
} }
@EventHandler @EventHandler

View File

@ -5,28 +5,21 @@ import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.Iterator; import java.util.Iterator;
import org.bukkit.Bukkit;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.entity.Entity;
import org.bukkit.entity.FallingBlock; import org.bukkit.entity.FallingBlock;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.block.Action;
import org.bukkit.event.entity.EntityChangeBlockEvent; import org.bukkit.event.entity.EntityChangeBlockEvent;
import org.bukkit.event.entity.ItemSpawnEvent; import org.bukkit.event.entity.ItemSpawnEvent;
import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.util.BlockIterator;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilEvent; import mineplex.core.common.util.UtilEvent;
import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilEvent.ActionType; import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.core.disguise.disguises.DisguiseBlock;
import mineplex.core.event.StackerEvent; import mineplex.core.event.StackerEvent;
import mineplex.core.gadget.GadgetManager; 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.gadget.types.MorphGadget;
import mineplex.core.recharge.Recharge; import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType; import mineplex.core.updater.UpdateType;

View File

@ -55,6 +55,9 @@ public class MorphEnderman extends MorphGadget
{ {
this.RemoveArmor(player); this.RemoveArmor(player);
Manager.getDisguiseManager().undisguise(player); Manager.getDisguiseManager().undisguise(player);
player.setAllowFlight(false);
player.setFlying(false);
} }
@EventHandler @EventHandler

View File

@ -8,6 +8,7 @@ import mineplex.core.common.util.NautHashMap;
import mineplex.core.pet.repository.PetRepository; import mineplex.core.pet.repository.PetRepository;
import mineplex.core.pet.repository.token.PetExtraToken; import mineplex.core.pet.repository.token.PetExtraToken;
import mineplex.core.pet.repository.token.PetSalesToken; import mineplex.core.pet.repository.token.PetSalesToken;
import mineplex.core.pet.types.Pumpkin;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.entity.EntityType; import org.bukkit.entity.EntityType;
@ -30,6 +31,7 @@ public class PetFactory
private void CreatePets() private void CreatePets()
{ {
_pets.put(EntityType.ZOMBIE, new Pumpkin());
_pets.put(EntityType.PIG, new Pet("Pig", EntityType.PIG, 5000)); _pets.put(EntityType.PIG, new Pet("Pig", EntityType.PIG, 5000));
_pets.put(EntityType.SHEEP, new Pet("Sheep", EntityType.SHEEP, 3000)); _pets.put(EntityType.SHEEP, new Pet("Sheep", EntityType.SHEEP, 3000));
_pets.put(EntityType.COW, new Pet("Cow", EntityType.COW, 2000)); _pets.put(EntityType.COW, new Pet("Cow", EntityType.COW, 2000));

View File

@ -14,6 +14,7 @@ import mineplex.core.account.event.ClientWebResponseEvent;
import mineplex.core.account.event.RetrieveClientInformationEvent; import mineplex.core.account.event.RetrieveClientInformationEvent;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
import mineplex.core.common.util.NautHashMap; import mineplex.core.common.util.NautHashMap;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilInv; import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilServer;
import mineplex.core.donation.DonationManager; import mineplex.core.donation.DonationManager;
@ -45,6 +46,8 @@ import org.bukkit.entity.Ageable;
import org.bukkit.entity.Creature; import org.bukkit.entity.Creature;
import org.bukkit.entity.EntityType; import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.entity.Skeleton;
import org.bukkit.entity.Zombie;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority; import org.bukkit.event.EventPriority;
import org.bukkit.event.entity.EntityDamageEvent; 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.PlayerInteractEvent;
import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
public class PetManager extends MiniClientPlugin<PetClient> public class PetManager extends MiniClientPlugin<PetClient>
{ {
@ -158,6 +164,14 @@ public class PetManager extends MiniClientPlugin<PetClient>
pet.setCustomNameVisible(true); pet.setCustomNameVisible(true);
pet.setCustomName(Get(player).GetPets().get(entityType)); 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); _activePetOwners.put(player.getName(), pet);
_failedAttempts.put(player.getName(), 0); _failedAttempts.put(player.getName(), 0);
@ -295,7 +309,7 @@ public class PetManager extends MiniClientPlugin<PetClient>
pet.teleport(owner); pet.teleport(owner);
_failedAttempts.put(playerName, 0); _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) if (pet.getFallDistance() == 0)
{ {

View File

@ -1,13 +1,13 @@
package mineplex.core.shop.item; 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.ChatColor;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.craftbukkit.v1_7_R4.inventory.CraftItemStack; import org.bukkit.craftbukkit.v1_7_R4.inventory.CraftItemStack;
import org.bukkit.inventory.ItemStack; 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 public class ShopItem extends CraftItemStack
{ {
@ -27,7 +27,8 @@ public class ShopItem extends CraftItemStack
_displayItem = displayItem; _displayItem = displayItem;
_deliveryAmount = deliveryAmount; _deliveryAmount = deliveryAmount;
getHandle().tag = ((CraftItemStack)itemStack).getHandle().tag; CraftItemStack craftItem = CraftItemStack.asCraftCopy(itemStack);
getHandle().tag = craftItem.getHandle().tag;
UpdateVisual(true); UpdateVisual(true);
getHandle().tag.set("AttributeModifiers", new NBTTagList()); getHandle().tag.set("AttributeModifiers", new NBTTagList());

View File

@ -62,10 +62,12 @@ import mineplex.core.disguise.DisguiseManager;
import mineplex.core.disguise.disguises.DisguiseSlime; import mineplex.core.disguise.disguises.DisguiseSlime;
import mineplex.core.donation.DonationManager; import mineplex.core.donation.DonationManager;
import mineplex.core.gadget.GadgetManager; import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.event.GadgetActivateEvent;
import mineplex.core.gadget.event.GadgetCollideEntityEvent; import mineplex.core.gadget.event.GadgetCollideEntityEvent;
import mineplex.core.inventory.InventoryManager; import mineplex.core.inventory.InventoryManager;
import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.mount.MountManager; import mineplex.core.mount.MountManager;
import mineplex.core.mount.event.MountActivateEvent;
import mineplex.core.pet.PetManager; import mineplex.core.pet.PetManager;
import mineplex.core.portal.Portal; import mineplex.core.portal.Portal;
import mineplex.core.preferences.PreferencesManager; import mineplex.core.preferences.PreferencesManager;
@ -76,6 +78,7 @@ import mineplex.core.treasure.TreasureManager;
import mineplex.core.updater.UpdateType; import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.event.UpdateEvent;
import mineplex.hub.commands.ForcefieldRadius; import mineplex.hub.commands.ForcefieldRadius;
import mineplex.hub.commands.GadgetToggle;
import mineplex.hub.commands.GameModeCommand; import mineplex.hub.commands.GameModeCommand;
import mineplex.hub.commands.NewsCommand; import mineplex.hub.commands.NewsCommand;
import mineplex.hub.modules.ForcefieldManager; import mineplex.hub.modules.ForcefieldManager;
@ -99,7 +102,7 @@ import mineplex.minecraft.game.core.damage.CustomDamageEvent;
public class HubManager extends MiniClientPlugin<HubClient> public class HubManager extends MiniClientPlugin<HubClient>
{ {
public String Mode = "Normal"; public HubType Type = HubType.Halloween;
private BlockRestore _blockRestore; private BlockRestore _blockRestore;
private CoreClientManager _clientManager; private CoreClientManager _clientManager;
@ -318,6 +321,7 @@ public class HubManager extends MiniClientPlugin<HubClient>
@Override @Override
public void AddCommands() public void AddCommands()
{ {
AddCommand(new GadgetToggle(this));
AddCommand(new NewsCommand(this)); AddCommand(new NewsCommand(this));
AddCommand(new GameModeCommand(this)); AddCommand(new GameModeCommand(this));
} }
@ -348,7 +352,7 @@ public class HubManager extends MiniClientPlugin<HubClient>
@EventHandler @EventHandler
public void SnowballPickup(BlockDamageEvent event) public void SnowballPickup(BlockDamageEvent event)
{ {
if (!Mode.equals("Christmas")) if (Type != HubType.Christmas)
return; return;
if (event.getBlock().getType() != Material.SNOW) if (event.getBlock().getType() != Material.SNOW)
@ -364,7 +368,7 @@ public class HubManager extends MiniClientPlugin<HubClient>
@EventHandler @EventHandler
public void SnowballHit(CustomDamageEvent event) public void SnowballHit(CustomDamageEvent event)
{ {
if (!Mode.equals("Christmas")) if (Type != HubType.Christmas)
return; return;
Projectile proj = event.GetProjectile(); Projectile proj = event.GetProjectile();
@ -940,10 +944,6 @@ public class HubManager extends MiniClientPlugin<HubClient>
return _gadgetsEnabled; return _gadgetsEnabled;
} }
public void SetGadgetEnabled(boolean _enabled)
{
this._gadgetsEnabled = _enabled;
}
public NewsManager GetNewsManager() public NewsManager GetNewsManager()
{ {
@ -964,4 +964,32 @@ public class HubManager extends MiniClientPlugin<HubClient>
event.setCancelled(true); 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);
}
} }

View File

@ -8,7 +8,6 @@ import org.bukkit.ChatColor;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.server.ServerListPingEvent;
import mineplex.core.MiniPlugin; import mineplex.core.MiniPlugin;
import mineplex.core.common.Rank; import mineplex.core.common.Rank;
@ -240,6 +239,9 @@ public class NewsManager extends MiniPlugin
{ {
_newsIndex = (_newsIndex + 1)%_news.length; _newsIndex = (_newsIndex + 1)%_news.length;
_newsTime = System.currentTimeMillis(); _newsTime = System.currentTimeMillis();
// JsonMessage jsonMessage = new JsonMessage(_news[_newsIndex]);
// jsonMessage.send(JsonMessage.MessageType.ABOVE_HOTBAR, UtilServer.getPlayers());
} }
if (_newsIndex >= _news.length) if (_newsIndex >= _news.length)
{ {

View File

@ -6,6 +6,7 @@ import mineplex.core.common.util.UtilText.TextAlign;
import mineplex.core.updater.UpdateType; import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.event.UpdateEvent;
import mineplex.hub.HubManager; import mineplex.hub.HubManager;
import mineplex.hub.HubType;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.block.BlockFace; import org.bukkit.block.BlockFace;
@ -55,55 +56,55 @@ public class TextManager extends MiniPlugin
{ {
//Comp //Comp
UtilText.MakeText("CHAMPIONS", locComp, faceComp, 159, (byte)5, TextAlign.CENTER); 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(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(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(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 //Arcade
UtilText.MakeText("ARCADE", locArcade, faceArcade, 159, (byte)5, TextAlign.CENTER); 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, 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, 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, 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 //Survival
UtilText.MakeText("SURVIVAL", locSurvival, faceSurvival, 159, (byte)5, TextAlign.CENTER); 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(-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(-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(-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 //Other
UtilText.MakeText("CLASSICS", locClassics, faceOther, 159, (byte)5, TextAlign.CENTER); 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, -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, -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, -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; 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, 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, 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, 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; arcadeIndex = (arcadeIndex + 3)%arcadeGames.length;
} }
@ -148,13 +149,13 @@ public class TextManager extends MiniPlugin
if (smashIndex == 1) color = 0; if (smashIndex == 1) color = 0;
//UtilText.MakeText("SUPER SMASH MOBS", locOther, faceOther, 159, color, TextAlign.CENTER); //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, -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(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"); //System.out.println("TextCreator : " + (System.currentTimeMillis() - startTime) + "ms");
} }
*/ */

View File

@ -19,11 +19,13 @@ import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.updater.UpdateType; import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.event.UpdateEvent;
import mineplex.hub.HubManager; import mineplex.hub.HubManager;
import mineplex.hub.HubType;
import mineplex.minecraft.game.core.damage.CustomDamageEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import org.bukkit.GameMode; import org.bukkit.GameMode;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.entity.Boat; import org.bukkit.entity.Boat;
@ -105,7 +107,7 @@ public class WorldManager extends MiniPlugin
else loc = new Location(Manager.GetSpawn().getWorld(), 43, 72, 5); else loc = new Location(Manager.GetSpawn().getWorld(), 43, 72, 5);
//Spawn //Spawn
if (Manager.Mode.equals("Halloween")) if (Manager.Type == HubType.Halloween)
{ {
Skeleton ent = loc.getWorld().spawn(loc, Skeleton.class); 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.getEquipment().setHelmet(ItemStackFactory.Instance.CreateStack(Material.PUMPKIN));
ent.setCustomName(C.cYellow + "Pumpkin Minion"); ent.setCustomName(C.cYellow + "Pumpkin Minion");
ent.setCustomNameVisible(false);
_mobs.add(ent); _mobs.add(ent);
Manager.GetCondition().Factory().Invisible("Perm", ent, ent, 999999999, 0, false, false, true); 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); 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)); _mobs.add(loc.getWorld().spawn(loc, Snowman.class));
} }
@ -230,7 +233,7 @@ public class WorldManager extends MiniPlugin
World world = UtilWorld.getWorld("world"); World world = UtilWorld.getWorld("world");
if (Manager.Mode.equals("Halloween")) if (Manager.Type == HubType.Halloween)
world.setTime(16000); world.setTime(16000);
else else
world.setTime(6000); world.setTime(6000);
@ -244,7 +247,7 @@ public class WorldManager extends MiniPlugin
if (event.getType() != UpdateType.FAST) if (event.getType() != UpdateType.FAST)
return; return;
if (!Manager.Mode.equals("Halloween")) if (Manager.Type != HubType.Halloween)
return; return;
//Block Lightup //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 @EventHandler
public void BlockForm(BlockFormEvent event) public void BlockForm(BlockFormEvent event)
{ {
@ -285,7 +304,7 @@ public class WorldManager extends MiniPlugin
@EventHandler @EventHandler
public void CreatureTarget(EntityTargetEvent event) public void CreatureTarget(EntityTargetEvent event)
{ {
if (Manager.Mode.equals("Christmas")) if (Manager.Type == HubType.Christmas)
{ {
event.setCancelled(true); event.setCancelled(true);
} }

View File

@ -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<Boolean> _callback;
private final JavaPlugin _plugin;
public BackupTask(JavaPlugin plugin, String worldName, Callback<Boolean> 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<String> fileList = new ArrayList<String>();
List<String> folderList = new ArrayList<String>();
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);
}
});
}
}
}

View File

@ -3,6 +3,7 @@ package mineplex.mapparser;
import java.io.File; import java.io.File;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator; import java.util.Iterator;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; 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.PlayerMoveEvent;
import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.bukkit.permissions.PermissionAttachmentInfo;
import org.bukkit.plugin.Plugin; import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
import mineplex.core.common.util.Callback;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
import mineplex.core.common.util.MapUtil; import mineplex.core.common.util.MapUtil;
import mineplex.core.common.util.UtilInv; import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilServer;
import mineplex.mapparser.command.AdminCommand;
import mineplex.mapparser.command.AuthorCommand; import mineplex.mapparser.command.AuthorCommand;
import mineplex.mapparser.command.BaseCommand; import mineplex.mapparser.command.BaseCommand;
import mineplex.mapparser.command.AdminCommand;
import mineplex.mapparser.command.CopyCommand; import mineplex.mapparser.command.CopyCommand;
import mineplex.mapparser.command.CopySchematicsCommand; import mineplex.mapparser.command.CopySchematicsCommand;
import mineplex.mapparser.command.CreateCommand; import mineplex.mapparser.command.CreateCommand;
@ -63,6 +64,7 @@ public class MapParser extends JavaPlugin implements Listener
private Parse _curParse = null; private Parse _curParse = null;
private HashMap<String, MapData> _mapData = new HashMap<String, MapData>(); private HashMap<String, MapData> _mapData = new HashMap<String, MapData>();
private HashSet<String> _mapsBeingZipped = new HashSet<String>();
private List<BaseCommand> _commands = new ArrayList<BaseCommand>(); private List<BaseCommand> _commands = new ArrayList<BaseCommand>();
private Location _spawnLocation; private Location _spawnLocation;
@ -257,6 +259,9 @@ public class MapParser extends JavaPlugin implements Listener
{ {
for (World world : this.getServer().getWorlds()) for (World world : this.getServer().getWorlds())
{ {
if (world.getName().toLowerCase().contains("halloween"))
world.setTime(16000);
else
world.setTime(8000); world.setTime(8000);
world.setStorm(false); world.setStorm(false);
} }
@ -269,7 +274,7 @@ public class MapParser extends JavaPlugin implements Listener
@EventHandler @EventHandler
public void SaveUnloadWorlds(TickEvent event) public void SaveUnloadWorlds(TickEvent event)
{ {
for (World world : getServer().getWorlds()) for (final World world : getServer().getWorlds())
{ {
if (world.getName().equalsIgnoreCase("world")) if (world.getName().equalsIgnoreCase("world"))
continue; continue;
@ -284,6 +289,18 @@ public class MapParser extends JavaPlugin implements Listener
{ {
Announce("Saving & Closing World: " + F.elem(world.getName())); Announce("Saving & Closing World: " + F.elem(world.getName()));
MapUtil.UnloadWorld(this, world, true); 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<Boolean>()
{
@Override
public void run(Boolean data)
{
System.out.println("Finished backup of " + world);
_mapsBeingZipped.remove(world.getName());
}
});
} }
} }
} }
@ -485,6 +502,11 @@ public class MapParser extends JavaPlugin implements Listener
} }
} }
public HashSet<String> getMapsBeingZipped()
{
return _mapsBeingZipped;
}
@EventHandler @EventHandler
public void Join(PlayerJoinEvent event) public void Join(PlayerJoinEvent event)
{ {

View File

@ -72,6 +72,12 @@ public class MapCommand extends BaseCommand
worldName = getPlugin().getWorldString(args[0], gameType); 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); World world = getPlugin().GetMapWorld(worldName);
if (world == null) if (world == null)
{ {

View File

@ -1,8 +1,5 @@
package nautilus.game.arcade.game.games.halloween; 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.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.HashSet; import java.util.HashSet;
@ -14,6 +11,7 @@ import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.Sound; import org.bukkit.Sound;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
import org.bukkit.entity.*; import org.bukkit.entity.*;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority; 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.EntityExplodeEvent;
import org.bukkit.event.entity.EntityTargetEvent; import org.bukkit.event.entity.EntityTargetEvent;
import org.bukkit.event.entity.ItemSpawnEvent; import org.bukkit.event.entity.ItemSpawnEvent;
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilTime; import mineplex.core.common.util.UtilTime;
import mineplex.core.common.util.UtilWorld;
import mineplex.core.common.util.UtilTime.TimeUnit; import mineplex.core.common.util.UtilTime.TimeUnit;
import mineplex.core.updater.UpdateType; import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent; 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.kits.*;
import nautilus.game.arcade.game.games.halloween.waves.*; import nautilus.game.arcade.game.games.halloween.waves.*;
import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.Kit;
import net.minecraft.server.v1_7_R4.PacketPlayOutNamedSoundEffect;
public class Halloween extends SoloGame public class Halloween extends SoloGame
{ {
@ -53,6 +53,8 @@ public class Halloween extends SoloGame
private int _maxMobs = 80; private int _maxMobs = 80;
private ArrayList<CreatureBase> _mobs = new ArrayList<CreatureBase>(); private ArrayList<CreatureBase> _mobs = new ArrayList<CreatureBase>();
private HashSet<Player> _soundOff = new HashSet<Player>();
public long total = 0; public long total = 0;
public long move = 0; public long move = 0;
public int moves = 0; public int moves = 0;
@ -139,6 +141,15 @@ public class Halloween extends SoloGame
GetTeamList().add(new GameTeam(this, "Pumpkin King", ChatColor.RED, WorldData.GetDataLocs("RED"))); 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) @EventHandler(priority = EventPriority.MONITOR)
public void TimeReport(UpdateEvent event) public void TimeReport(UpdateEvent event)
{ {
@ -183,7 +194,7 @@ public class Halloween extends SoloGame
if (!IsLive()) if (!IsLive())
return; return;
if (Math.random() > 0.85) if (Math.random() > 0.6)
return; return;
for (Player player : UtilServer.getPlayers()) for (Player player : UtilServer.getPlayers())
@ -322,16 +333,14 @@ public class Halloween extends SoloGame
if (_wave >= _waves.size()) if (_wave >= _waves.size())
{ {
for (Player player : GetPlayers(false)) 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, 30, "Killing the Pumpkin King", false);
Manager.GetGame().AddGems(player, 10, "Participation", false); Manager.GetGame().AddGems(player, 10, "Participation", false);
} }
SetCustomWinLine("You earned Pumpkin Kings Head!"); SetCustomWinLine("You earned Pumpling Pet!");
AnnounceEnd(this.GetTeamList().get(0)); AnnounceEnd(this.GetTeamList().get(0));
SetState(GameState.End); SetState(GameState.End);
@ -339,6 +348,8 @@ public class Halloween extends SoloGame
else if (GetPlayers(true).size() == 0) else if (GetPlayers(true).size() == 0)
{ {
playSound(HalloweenAudio.BOSS_WIN);
for (Player player : GetPlayers(false)) for (Player player : GetPlayers(false))
{ {
Manager.GetGame().AddGems(player, 10, "Participation", false); Manager.GetGame().AddGems(player, 10, "Participation", false);
@ -436,7 +447,7 @@ public class Halloween extends SoloGame
//Rounds //Rounds
Scoreboard.WriteBlank(); Scoreboard.WriteBlank();
Scoreboard.Write(C.cYellow + "Wave"); Scoreboard.Write(C.cYellow + "Wave");
Scoreboard.Write(_wave + " of 6"); Scoreboard.Write((_wave+1) + " of 6");
Scoreboard.WriteBlank(); Scoreboard.WriteBlank();
Scoreboard.Write(C.cYellow + "Monsters"); Scoreboard.Write(C.cYellow + "Monsters");
@ -460,4 +471,37 @@ public class Halloween extends SoloGame
Scoreboard.Draw(); 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);
}
}
} }

View File

@ -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;
}
}

View File

@ -11,6 +11,7 @@ import nautilus.game.arcade.game.games.halloween.Halloween;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.entity.CaveSpider; import org.bukkit.entity.CaveSpider;
import org.bukkit.event.entity.EntityTargetEvent; import org.bukkit.event.entity.EntityTargetEvent;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
public class MobSpiderLeaper extends CreatureBase<CaveSpider> implements InterfaceMove public class MobSpiderLeaper extends CreatureBase<CaveSpider> implements InterfaceMove
{ {
@ -30,7 +31,8 @@ public class MobSpiderLeaper extends CreatureBase<CaveSpider> implements Interfa
@Override @Override
public void Damage(CustomDamageEvent event) public void Damage(CustomDamageEvent event)
{ {
if (event.GetCause() == DamageCause.FALL)
event.SetCancelled("Fall Immunity");
} }
@Override @Override

View File

@ -23,6 +23,7 @@ import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.core.damage.CustomDamageEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.game.games.halloween.Halloween; 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.EntityArrow;
import net.minecraft.server.v1_7_R4.EntityCreature; import net.minecraft.server.v1_7_R4.EntityCreature;
import net.minecraft.server.v1_7_R4.Navigation; import net.minecraft.server.v1_7_R4.Navigation;
@ -70,6 +71,8 @@ public class PumpkinKing extends CreatureBase<Skeleton>
private HashSet<Arrow> _arrows = new HashSet<Arrow>(); private HashSet<Arrow> _arrows = new HashSet<Arrow>();
private boolean _announcedHalfHealth = false;
public PumpkinKing(Halloween game, Location loc) public PumpkinKing(Halloween game, Location loc)
{ {
super(game, null, Skeleton.class, loc); super(game, null, Skeleton.class, loc);
@ -664,6 +667,7 @@ public class PumpkinKing extends CreatureBase<Skeleton>
_state = state; _state = state;
_stateTime = System.currentTimeMillis(); _stateTime = System.currentTimeMillis();
if (state == 3) if (state == 3)
{ {
//Update Gear //Update Gear
@ -677,7 +681,7 @@ public class PumpkinKing extends CreatureBase<Skeleton>
Host.Manager.GetCondition().Factory().Speed("Minion Speed", minion, minion, 15, 0, false, false, false); Host.Manager.GetCondition().Factory().Speed("Minion Speed", minion, minion, 15, 0, false, false, false);
//Sound //Sound
GetEntity().getWorld().playSound(GetEntity().getLocation(), Sound.WITHER_SPAWN, 10f, 1.5f); //GetEntity().getWorld().playSound(GetEntity().getLocation(), Sound.WITHER_SPAWN, 1f, 1.5f);
//Target //Target
_minionTargets.put(minion, GetRandomPlayer()); _minionTargets.put(minion, GetRandomPlayer());
@ -687,6 +691,13 @@ public class PumpkinKing extends CreatureBase<Skeleton>
Host.Announce(C.cAqua + C.Bold + "Kill the Pumpkin Minions!"); Host.Announce(C.cAqua + C.Bold + "Kill the Pumpkin Minions!");
MinionAttack(); MinionAttack();
Host.playSound(HalloweenAudio.BOSS_STAGE_MINION_ATTACK);
}
if (state == 4)
{
Host.playSound(HalloweenAudio.BOSS_STAGE_FINAL);
} }
} }
@ -738,9 +749,23 @@ public class PumpkinKing extends CreatureBase<Skeleton>
ShieldSpawn(); ShieldSpawn();
Host.playSound(HalloweenAudio.BOSS_STAGE_SHIELD_RESTORE);
_minionTargets.clear(); _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 //Skeleton Scatter
if (GetState() != 3 && UtilTime.elapsed(_stateTime, 2000)) if (GetState() != 3 && UtilTime.elapsed(_stateTime, 2000))

View File

@ -36,7 +36,7 @@ public class KitFinn extends SmashKit
new PerkFlameSlam(), new PerkFlameSlam(),
new PerkBlizzardFinn(), new PerkBlizzardFinn(),
new PerkFletcher(1, 4, true), new PerkFletcher(2, 2, true),
}, },
EntityType.ZOMBIE, new ItemStack(Material.GOLD_SWORD)); EntityType.ZOMBIE, new ItemStack(Material.GOLD_SWORD));

View File

@ -35,7 +35,7 @@ public class KitThor extends SmashKit
new Perk[] new Perk[]
{ {
new PerkKnockbackAttack(2), new PerkKnockbackAttack(2),
new PerkFletcher(1, 4, true), new PerkFletcher(2, 2, true),
new PerkSeismicHammer(), new PerkSeismicHammer(),
new PerkHammerThrow(), new PerkHammerThrow(),
}, },

View File

@ -2,6 +2,7 @@ package nautilus.game.arcade.game.games.halloween.waves;
import mineplex.core.common.util.UtilTime; import mineplex.core.common.util.UtilTime;
import nautilus.game.arcade.game.games.halloween.Halloween; 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.MobSkeletonArcher;
import nautilus.game.arcade.game.games.halloween.creatures.MobSkeletonWarrior; import nautilus.game.arcade.game.games.halloween.creatures.MobSkeletonWarrior;
@ -9,7 +10,7 @@ public class Wave1 extends WaveBase
{ {
public Wave1(Halloween host) 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 @Override

View File

@ -2,6 +2,7 @@ package nautilus.game.arcade.game.games.halloween.waves;
import mineplex.core.common.util.UtilTime; import mineplex.core.common.util.UtilTime;
import nautilus.game.arcade.game.games.halloween.Halloween; 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.MobCreeper;
import nautilus.game.arcade.game.games.halloween.creatures.MobGiant; import nautilus.game.arcade.game.games.halloween.creatures.MobGiant;
import nautilus.game.arcade.game.games.halloween.creatures.MobZombie; import nautilus.game.arcade.game.games.halloween.creatures.MobZombie;
@ -10,7 +11,7 @@ public class Wave2 extends WaveBase
{ {
public Wave2(Halloween host) 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 @Override

View File

@ -2,6 +2,7 @@ package nautilus.game.arcade.game.games.halloween.waves;
import mineplex.core.common.util.UtilTime; import mineplex.core.common.util.UtilTime;
import nautilus.game.arcade.game.games.halloween.Halloween; 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.MobSpiderLeaper;
import nautilus.game.arcade.game.games.halloween.creatures.MobSpiderSmasher; import nautilus.game.arcade.game.games.halloween.creatures.MobSpiderSmasher;
@ -9,7 +10,7 @@ public class Wave3 extends WaveBase
{ {
public Wave3(Halloween host) 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 @Override

View File

@ -4,6 +4,7 @@ import org.bukkit.Location;
import mineplex.core.common.util.UtilTime; import mineplex.core.common.util.UtilTime;
import nautilus.game.arcade.game.games.halloween.Halloween; 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.MobGhast;
import nautilus.game.arcade.game.games.halloween.creatures.MobPigZombie; import nautilus.game.arcade.game.games.halloween.creatures.MobPigZombie;
@ -11,7 +12,7 @@ public class Wave4 extends WaveBase
{ {
public Wave4(Halloween host) 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 @Override

View File

@ -3,13 +3,14 @@ package nautilus.game.arcade.game.games.halloween.waves;
import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilTime; import mineplex.core.common.util.UtilTime;
import nautilus.game.arcade.game.games.halloween.Halloween; import nautilus.game.arcade.game.games.halloween.Halloween;
import nautilus.game.arcade.game.games.halloween.HalloweenAudio;
import nautilus.game.arcade.game.games.halloween.creatures.*; import nautilus.game.arcade.game.games.halloween.creatures.*;
public class Wave5 extends WaveBase public class Wave5 extends WaveBase
{ {
public Wave5(Halloween host) 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 @Override

View File

@ -11,6 +11,7 @@ import org.bukkit.entity.Player;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
import nautilus.game.arcade.game.games.halloween.Halloween; 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.C;
import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilServer;
@ -23,6 +24,7 @@ public abstract class WaveBase
protected Halloween Host; protected Halloween Host;
protected String _name; protected String _name;
protected HalloweenAudio _audio;
protected long _start; protected long _start;
protected long _duration; protected long _duration;
@ -31,11 +33,12 @@ public abstract class WaveBase
protected ArrayList<Location> _spawns; protected ArrayList<Location> _spawns;
public WaveBase(Halloween host, String name, long duration, ArrayList<Location> spawns) public WaveBase(Halloween host, String name, long duration, ArrayList<Location> spawns, HalloweenAudio audio)
{ {
Host = host; Host = host;
_name = name; _name = name;
_audio = audio;
_start = System.currentTimeMillis(); _start = System.currentTimeMillis();
_duration = duration; _duration = duration;
@ -69,8 +72,10 @@ public abstract class WaveBase
UtilTitle.display(C.cYellow + "Wave " + wave, _name, 10, 100, 20); UtilTitle.display(C.cYellow + "Wave " + wave, _name, 10, 100, 20);
for (Player player : UtilServer.getPlayers()) if (_audio != null)
player.playSound(player.getLocation(), Sound.ENDERDRAGON_GROWL, 2f, 1f); {
Host.playSound(_audio);
}
} }
//Display //Display
@ -105,9 +110,6 @@ public abstract class WaveBase
for (int z=-1 ; z<=1 ; z++) for (int z=-1 ; z<=1 ; z++)
Host.Manager.GetBlockRestore().Add(block.getRelative(x, -1, z), 42, (byte)0, _duration); Host.Manager.GetBlockRestore().Add(block.getRelative(x, -1, z), 42, (byte)0, _duration);
//Lightning
block.getWorld().strikeLightningEffect(block.getLocation());
//Clear Laser //Clear Laser
while (block.getY() < 250) while (block.getY() < 250)
{ {

View File

@ -1,6 +1,7 @@
package nautilus.game.arcade.game.games.halloween.waves; package nautilus.game.arcade.game.games.halloween.waves;
import nautilus.game.arcade.game.games.halloween.Halloween; 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.MobCreeper;
import nautilus.game.arcade.game.games.halloween.creatures.MobGiant; import nautilus.game.arcade.game.games.halloween.creatures.MobGiant;
import nautilus.game.arcade.game.games.halloween.creatures.MobZombie; import nautilus.game.arcade.game.games.halloween.creatures.MobZombie;
@ -10,22 +11,28 @@ public class WaveBoss extends WaveBase
{ {
private PumpkinKing _king; private PumpkinKing _king;
private boolean _canEnd = false;
public WaveBoss(Halloween host) 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 @Override
public void Spawn(int tick) public void Spawn(int tick)
{ {
if (tick == 0) if (tick == 100)
{ {
_king = new PumpkinKing(Host, Host.WorldData.GetDataLocs("BLACK").get(0)); _king = new PumpkinKing(Host, Host.WorldData.GetDataLocs("BLACK").get(0));
Host.AddCreature(_king); Host.AddCreature(_king);
Host.playSound(HalloweenAudio.BOSS_SPAWN);
_canEnd = true;
} }
//Increasing difficulty of mobs //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 (tick % Math.max(5, 15 - tick/400) == 0)
if (Math.random() > 0.10) if (Math.random() > 0.10)
@ -35,7 +42,7 @@ public class WaveBoss extends WaveBase
} }
//Giant every 2.5 minutes //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())); Host.AddCreature(new MobGiant(Host, GetSpawn()));
} }
@ -44,6 +51,12 @@ public class WaveBoss extends WaveBase
@Override @Override
public boolean CanEnd() 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;
} }
} }

View File

@ -13,7 +13,7 @@ public class WaveVictory extends WaveBase
{ {
public WaveVictory(Halloween host) public WaveVictory(Halloween host)
{ {
super(host, "Celebration!", 15000, host.GetSpawnSet(3)); super(host, "Celebration!", 15000, host.GetSpawnSet(3), null);
} }
@Override @Override

View File

@ -1389,7 +1389,10 @@ public class UHC extends TeamGame
//Ended //Ended
if (GetState() == GameState.End || GetState() == GameState.Dead) if (GetState() == GameState.End || GetState() == GameState.Dead)
{ {
if (_ended)
return ChatColor.RED + "Finished"; return ChatColor.RED + "Finished";
else
return ChatColor.YELLOW + "In Progress";
} }
//Not Joinable Yet //Not Joinable Yet

View File

@ -1,6 +1,7 @@
package nautilus.game.arcade.kit.perks; package nautilus.game.arcade.kit.perks;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator;
import java.util.WeakHashMap; import java.util.WeakHashMap;
import org.bukkit.Sound; 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<Projectile> projIterator = _snowball.keySet().iterator();
while (projIterator.hasNext())
{
Projectile proj = projIterator.next();
if (proj.getTicksLived() > 20)
{
proj.remove();
projIterator.remove();
}
}
}
@EventHandler(priority = EventPriority.LOW) @EventHandler(priority = EventPriority.LOW)
public void Snowball(CustomDamageEvent event) public void Snowball(CustomDamageEvent event)
{ {
@ -135,16 +156,4 @@ public class PerkBlizzardFinn extends Perk
event.AddMod(GetName(), GetName(), 0.6, false); 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);
}
} }

View File

@ -66,16 +66,10 @@ public class PerkFlameSlam extends Perk
if (!Kit.HasKit(player)) if (!Kit.HasKit(player))
return; 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)) if (!Recharge.Instance.use(player, GetName(), 8000, true, true))
return; 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 //Record
_live.put(player, System.currentTimeMillis()); _live.put(player, System.currentTimeMillis());
@ -95,9 +89,13 @@ public class PerkFlameSlam extends Perk
while (liveIterator.hasNext()) while (liveIterator.hasNext())
{ {
Player player = liveIterator.next(); Player player = liveIterator.next();
Vector vel = player.getLocation().getDirection();
vel.setY(0);
UtilAlg.Normalize(vel);
player.setVelocity(vel.multiply(0.8));
//Particle //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()) for (Entity other : player.getWorld().getEntities())
{ {
@ -107,7 +105,7 @@ public class PerkFlameSlam extends Perk
if (other instanceof Player) if (other instanceof Player)
continue; continue;
if (UtilMath.offset(player, other) > 2) if (UtilMath.offset(player, other) > 1.5)
continue; continue;
DoSlam(player, (LivingEntity)other); DoSlam(player, (LivingEntity)other);
@ -122,14 +120,14 @@ public class PerkFlameSlam extends Perk
if (!_live.containsKey(player)) if (!_live.containsKey(player))
continue; continue;
if (UtilEnt.isGrounded(player) || UtilTime.elapsed(_live.get(player), 1000)) if (UtilTime.elapsed(_live.get(player), 800))
_live.remove(player); _live.remove(player);
} }
} }
public void DoSlam(Player damager, LivingEntity damagee) 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()) for (Entity other : damagee.getWorld().getEntities())
{ {