diff --git a/Art/Halloween Horror.jpg b/Art/Halloween Horror.jpg new file mode 100644 index 000000000..b82bc42a3 Binary files /dev/null and b/Art/Halloween Horror.jpg differ diff --git a/Art/Pumpkin.png b/Art/Pumpkin.png new file mode 100644 index 000000000..81ea7c47e Binary files /dev/null and b/Art/Pumpkin.png differ diff --git a/Art/Spooky Sale.png b/Art/Spooky Sale.png new file mode 100644 index 000000000..75ea457d6 Binary files /dev/null and b/Art/Spooky Sale.png differ diff --git a/Plugins/.idea/dataSources.xml b/Plugins/.idea/dataSources.xml new file mode 100644 index 000000000..16b134887 --- /dev/null +++ b/Plugins/.idea/dataSources.xml @@ -0,0 +1,19 @@ + + + + + mysql + true + com.mysql.jdbc.Driver + jdbc:mysql://db.mineplex.com:3306 + + + + + + + + + + + \ No newline at end of file diff --git a/Plugins/Mineplex.Bungee.Mineplexer/src/mineplex/bungee/motd/MotdManager.java b/Plugins/Mineplex.Bungee.Mineplexer/src/mineplex/bungee/motd/MotdManager.java index 75cf934cf..c1cba124c 100644 --- a/Plugins/Mineplex.Bungee.Mineplexer/src/mineplex/bungee/motd/MotdManager.java +++ b/Plugins/Mineplex.Bungee.Mineplexer/src/mineplex/bungee/motd/MotdManager.java @@ -55,12 +55,12 @@ public class MotdManager implements Listener, Runnable //String motdLine = "§f§l◄ §c§lMaintenance§f§l ►"; //String motdLine = "§f§l◄ §a§lCarl the Creeper§f§l ►"; - String motdLine = " §b§l◄§f§lNEW GAME§b§l► §f§l◄§b§lEVOLUTION§f§l► §b§l◄§f§lNEW GAME§b§l►"; + String motdLine = " §2§l§n M O N S T E R M A Z E B E T A §f"; //String motdLine = " §f§l◄ §a§lCarl the Creeper§f§l ▬ §c§l75% OFF SALE§f§l ►"; //String motdLine = " §d§lRank Sale §a§l40% Off"); //String motdLine = " §f§l◄§c§lMAINTENANCE§f§l►"); - updateMainMotd(" §b§l§m §8§l§m[ §r §9§lMineplex§r §f§lGames§r §8§l§m ]§b§l§m §r", motdLine); + updateMainMotd(" §4§l§m §f§l§m §8§l§m[ §r §4§lMineplex§r §f§lGames§r §8§l§m ]§f§l§m §4§l§m §r", motdLine); System.out.println("Updated Bungee MOTD"); } } diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/Rank.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/Rank.java index 8cab61a15..45fd28921 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/Rank.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/Rank.java @@ -9,15 +9,16 @@ import mineplex.core.common.util.UtilPlayer; public enum Rank { //Staff - LT("LT", ChatColor.DARK_RED), - OWNER("Owner", ChatColor.DARK_RED), - DEVELOPER("Dev", ChatColor.RED), - ADMIN("Admin", ChatColor.RED), - JNR_DEV("Jr.Dev", ChatColor.RED), + LT("Leader", ChatColor.GOLD), + OWNER("Owner", ChatColor.GOLD), + DEVELOPER("Dev", ChatColor.GOLD), + ADMIN("Admin", ChatColor.GOLD), + JNR_DEV("Jr.Dev", ChatColor.GOLD), + SUPPORT("Support", ChatColor.BLUE), SNR_MODERATOR("Sr.Mod", ChatColor.GOLD), MODERATOR("Mod", ChatColor.GOLD), HELPER("Trainee", ChatColor.DARK_AQUA), - MAPLEAD("MapLead", ChatColor.DARK_PURPLE), + MAPLEAD("MapLead", ChatColor.BLUE), MAPDEV("Builder", ChatColor.BLUE), MEDIA("Media", ChatColor.BLUE), @@ -29,6 +30,7 @@ public enum Rank TWITCH("Twitch", ChatColor.DARK_PURPLE), //Player + TITAN("Titan", ChatColor.RED, true), LEGEND("Legend", ChatColor.GREEN, true), HERO("Hero", ChatColor.LIGHT_PURPLE, true), ULTRA("Ultra", ChatColor.AQUA, true), 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 0407bf4ab..136e6b73b 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 @@ -28,6 +28,23 @@ public class C public static String cWhite = "" + ChatColor.WHITE; public static String cYellow = "" + ChatColor.YELLOW; + public static String cAquaB = "" + ChatColor.AQUA + "" + ChatColor.BOLD; + public static String cBlackB = "" + ChatColor.BLACK + "" + ChatColor.BOLD; + public static String cBlueB = "" + ChatColor.BLUE + "" + ChatColor.BOLD; + public static String cDAquaB = "" + ChatColor.DARK_AQUA + "" + ChatColor.BOLD; + public static String cDBlueB = "" + ChatColor.DARK_BLUE + "" + ChatColor.BOLD; + public static String cDGrayB = "" + ChatColor.DARK_GRAY + "" + ChatColor.BOLD; + public static String cDGreenB = "" + ChatColor.DARK_GREEN + "" + ChatColor.BOLD; + public static String cDPurpleB = "" + ChatColor.DARK_PURPLE + "" + ChatColor.BOLD; + public static String cDRedB = "" + ChatColor.DARK_RED + "" + ChatColor.BOLD; + public static String cGoldB = "" + ChatColor.GOLD + "" + ChatColor.BOLD; + public static String cGrayB = "" + ChatColor.GRAY + "" + ChatColor.BOLD; + public static String cGreenB = "" + ChatColor.GREEN + "" + ChatColor.BOLD; + public static String cPurpleB = "" + ChatColor.LIGHT_PURPLE + "" + ChatColor.BOLD; + public static String cRedB = "" + ChatColor.RED + "" + ChatColor.BOLD; + public static String cWhiteB = "" + ChatColor.WHITE + "" + ChatColor.BOLD; + public static String cYellowB = "" + ChatColor.YELLOW + "" + ChatColor.BOLD; + public static String mHead = "" + ChatColor.BLUE; public static String mBody = "" + ChatColor.GRAY; public static String mChat = "" + ChatColor.WHITE; diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/NautHashMap.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/NautHashMap.java index 802a5f763..e6d74c9d5 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/NautHashMap.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/NautHashMap.java @@ -8,7 +8,7 @@ import java.util.Set; public class NautHashMap { private HashMap _wrappedHashMap = new HashMap(); - + public boolean containsKey(KeyType key) { return _wrappedHashMap.containsKey(key); diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/RadarData.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/RadarData.java new file mode 100644 index 000000000..51c4bf21a --- /dev/null +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/RadarData.java @@ -0,0 +1,38 @@ +package mineplex.core.common.util; + +import org.bukkit.Location; + +public class RadarData +{ + public Location Loc; + public String Text; + + private double _bearing = 0; + + public RadarData(Location loc, String text) + { + Loc = loc; + Text = text; + } + + public void print() + { + System.out.println(Text + ": " + _bearing); + } + + public void setBearing(double d) + { + while (d < -180) + d += 360; + + while (d > 180) + d -= 360; + + _bearing = d; + } + + public double getBearing() + { + return _bearing; + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilAlg.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilAlg.java index 807dbccb5..d0b624505 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilAlg.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilAlg.java @@ -423,4 +423,9 @@ public class UtilAlg return UtilAlg.findClosest(near, corners); } + + public static boolean isSimilar(Location a, Location b) + { + return a.getWorld() == b.getWorld() && a.getX() == b.getX() && a.getY() == b.getY() && a.getZ() == b.getZ(); + } } diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilBlock.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilBlock.java index 43cbfb1d2..8299e9e88 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilBlock.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilBlock.java @@ -516,6 +516,11 @@ public class UtilBlock return false; } public static ArrayList getInBoundingBox(Location a, Location b) + { + return getInBoundingBox(a, b, true); + } + + public static ArrayList getInBoundingBox(Location a, Location b, boolean ignoreAir) { ArrayList blocks = new ArrayList(); @@ -525,10 +530,59 @@ public class UtilBlock { Block block = a.getWorld().getBlockAt(x,y,z); - if (block.getType() != Material.AIR) - blocks.add(block); + if(ignoreAir) + { + if (block.getType() != Material.AIR) + blocks.add(block); + } + else blocks.add(block); } return blocks; } + + public static int getStepSoundId(Block block) + { + if (block.getTypeId() != 35 && block.getTypeId() != 159 && block.getTypeId() != 160) + return block.getTypeId(); + + switch (block.getData()) + { + case 0: + return block.getTypeId(); + case 1: + return 172; + case 2: + return 87; + case 3: + return 79; + case 4: + return 41; + case 5: + return 133; + case 6: + return 45; + case 7: + return 16; + case 8: + return 13; + case 9: + return 56; + case 10: + return 110; + case 11: + return 22; + case 12: + return 3; + case 13: + return 31; + case 14: + return 152; + case 15: + return 173; + + default: + return block.getTypeId(); + } + } } diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilInv.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilInv.java index 393922947..bc6443777 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilInv.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilInv.java @@ -352,5 +352,23 @@ public class UtilInv Update(player); } + public static int getAmount(Player player, Material mat) + { + return getAmount(player, mat, true); + } + public static int getAmount(Player player, Material mat, boolean includeArmorAndCursor) + { + int amount = 0; + + for (ItemStack item : getItems(player, true, true)) + { + if (item.getType() == mat) + { + amount += item.getAmount(); + } + } + + return amount; + } } diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilPlayer.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilPlayer.java index 321f16789..f9c997146 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilPlayer.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilPlayer.java @@ -653,4 +653,11 @@ public class UtilPlayer player.setPlayerListName(playerName); } */ + + public static Location getTargetLocation(Player player, double distance) + { + Vector looking = player.getLocation().getDirection().clone(); + looking.multiply(distance); + return player.getEyeLocation().clone().add(looking); + } } diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilRadar.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilRadar.java new file mode 100644 index 000000000..3c8047fd9 --- /dev/null +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilRadar.java @@ -0,0 +1,112 @@ +package mineplex.core.common.util; + +import java.util.List; + +import org.bukkit.ChatColor; +import org.bukkit.entity.Player; + +public class UtilRadar +{ + public static void displayRadar(Player player, List dataList) + { + displayRadar(player, dataList, true); + } + + public static void displayRadar(Player player, List dataList, boolean bossBar) + { + int radarChars = 59; + int radarSpaces = radarChars; + + //get bearings for each element + for (RadarData data : dataList) + { + double pYaw = UtilAlg.GetYaw(player.getLocation().getDirection()); + double relYaw = UtilAlg.GetYaw(UtilAlg.getTrajectory(player.getLocation(), data.Loc)); + + data.setBearing(relYaw - pYaw); + + radarSpaces -= ChatColor.stripColor(data.Text).length(); + } + + //sort + sortScores(dataList); + + //draw + String text = C.cPurple + C.Bold + "Radar [" + ChatColor.RESET; + int radarSpacesDrawn = 0; + int radarCharsDrawn = 0; + + for (RadarData data : dataList) + { + //behind to left + if (data.getBearing() < -90) + { + text += ChatColor.RESET + data.Text; + radarCharsDrawn += ChatColor.stripColor(data.Text).length(); + } + //behind to right + else if (data.getBearing() > 90) + { + //finish spaces + while (radarSpacesDrawn < radarSpaces) + { + text += " "; + radarSpacesDrawn++; + radarCharsDrawn++; + } + + text += ChatColor.RESET + data.Text; + radarCharsDrawn += ChatColor.stripColor(data.Text).length(); + } + //in front + else + { + double percent = (data.getBearing() + 90D) / 180D; + + while (percent >= (double)radarCharsDrawn/(double)radarChars && radarSpacesDrawn dataList) + { + for (int i=0 ; i0 ; j--) + { + if (dataList.get(j).getBearing() < dataList.get(j-1).getBearing()) + { + RadarData temp = dataList.get(j); + dataList.set(j, dataList.get(j-1)); + dataList.set(j-1, temp); + } + } + } + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilTime.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilTime.java index 3a220464a..af77ee996 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilTime.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilTime.java @@ -29,6 +29,19 @@ public class UtilTime return sdf.format(cal.getTime()); } + public static String getDayOfMonthSuffix(final int n) + { + if (n >= 11 && n <= 13) { + return "th"; + } + switch (n % 10) { + case 1: return "st"; + case 2: return "nd"; + case 3: return "rd"; + default: return "th"; + } + } + public enum TimeUnit { FIT, diff --git a/Plugins/Mineplex.Core/src/mineplex/core/account/CoreClient.java b/Plugins/Mineplex.Core/src/mineplex/core/account/CoreClient.java index 156f18867..61ccdc618 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/account/CoreClient.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/account/CoreClient.java @@ -1,8 +1,12 @@ package mineplex.core.account; +import mineplex.core.account.event.OnlineRankUpdateEvent; import mineplex.core.common.Rank; +import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilPlayer; import mineplex.serverdata.Utility; +import org.bukkit.Bukkit; import org.bukkit.entity.Player; public class CoreClient @@ -12,8 +16,9 @@ public class CoreClient private String _name; private String _disguisedAs; private Player _player; - private Rank _rank; + private Rank _rank, _lastRank; private Rank _disguisedRank; + private Rank _tempRank, _lastTemp; private boolean _disguised; public CoreClient(Player player) @@ -58,18 +63,59 @@ public class CoreClient { _accountId = accountId; } - + public Rank GetRank() + { + return GetRank(false); + } + + public Rank GetRank(boolean bypass) { if (_rank == null) _rank = Rank.ALL; - return _rank; + if (bypass || _tempRank == null) + return _rank; + else + return _tempRank; } - public void SetRank(Rank rank) + public Rank GetLastRank(boolean temp) { - _rank = rank; + if (temp) + { + if ((_lastTemp == null) && (_tempRank == null)) + { + return _rank; + } + else if (_lastTemp == null) + { + return _tempRank; + } + return _lastTemp; + } + else + { + if (_lastRank == null) return _rank; + return _lastRank; + } + } + + public void SetRank(Rank rank, boolean temp) + { + if (temp) + { + if (_lastTemp == null) _lastTemp = rank; + else _lastTemp = _tempRank; + _lastRank = _rank; + _tempRank = rank; + } + else + { + if (_rank != null) _lastRank = _rank; + else _lastRank = rank; + _rank = rank; + } } public long getNetworkSessionLoginTime() @@ -111,4 +157,16 @@ public class CoreClient { _networkSessionLoginTime = loginTime; } + + public void resetTemp() + { + if (_tempRank != null) + { + OnlineRankUpdateEvent event = new OnlineRankUpdateEvent(_player, _tempRank, _rank, true); + Bukkit.getPluginManager().callEvent(event); + _lastTemp = _tempRank; + _tempRank = null; + UtilPlayer.message(_player, C.cGold + "Your test rank has been reset!"); + } + } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/account/CoreClientManager.java b/Plugins/Mineplex.Core/src/mineplex/core/account/CoreClientManager.java index 9fbd04fc0..31c2330ec 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/account/CoreClientManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/account/CoreClientManager.java @@ -9,6 +9,7 @@ import java.util.UUID; import java.util.concurrent.atomic.AtomicInteger; import mineplex.core.MiniPlugin; +import mineplex.core.account.command.TestRank; import mineplex.core.account.command.UpdateRank; import mineplex.core.account.event.ClientUnloadEvent; import mineplex.core.account.event.ClientWebResponseEvent; @@ -74,6 +75,7 @@ public class CoreClientManager extends MiniPlugin public void addCommands() { addCommand(new UpdateRank(this)); + addCommand(new TestRank(this)); } public CoreClient Add(String name) @@ -245,7 +247,7 @@ public class CoreClientManager extends MiniPlugin token = gson.fromJson(response, ClientToken.class); CoreClient client = Add(playerName); - client.SetRank(Rank.valueOf(token.Rank)); + client.SetRank(Rank.valueOf(token.Rank), false); client.setAccountId(_repository.login(_loginProcessors, _querylessLoginProcessors, uuid.toString(), client.GetPlayerName())); // JSON sql response @@ -305,7 +307,7 @@ public class CoreClientManager extends MiniPlugin token = gson.fromJson(response, ClientToken.class); - client.SetRank(Rank.valueOf(token.Rank)); + client.SetRank(Rank.valueOf(token.Rank), false); // _repository.updateMysqlRank(uuid.toString(), token.Rank, token.RankPerm, new Timestamp(Date.parse(token.RankExpire)).toString()); @@ -418,7 +420,7 @@ public class CoreClientManager extends MiniPlugin { CoreClient client = Get(name); - client.SetRank(newRank); + client.SetRank(newRank, false); } } }, name, uuid, rank, perm); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/account/command/TestRank.java b/Plugins/Mineplex.Core/src/mineplex/core/account/command/TestRank.java new file mode 100644 index 000000000..0bc3d875f --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/account/command/TestRank.java @@ -0,0 +1,77 @@ +package mineplex.core.account.command; + +import mineplex.core.account.CoreClientManager; +import mineplex.core.account.event.OnlineRankUpdateEvent; +import mineplex.core.command.CommandBase; +import mineplex.core.common.Rank; +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; + +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.entity.Player; + +public class TestRank extends CommandBase +{ + public TestRank(CoreClientManager plugin) + { + super(plugin, Rank.ALL, "testRank"); + } + + @Override + public void Execute(final Player caller, String[] args) + { + if (!Plugin.Get(caller).GetRank(true).has(Rank.JNR_DEV)) + { + UtilPlayer.message(caller, F.main("Permissions", "This requires Permission Rank [" + Rank.JNR_DEV.getTag(false, true) + C.cGray + "].")); + return; + } + + boolean testServer = Plugin.getPlugin().getConfig().getString("serverstatus.group").equalsIgnoreCase("Testing"); + + if (!testServer) + { + UtilPlayer.message(caller, F.main(Plugin.getName(), F.elem("This command can only be used on test servers!"))); + return; + } + + if (args == null) + { + UtilPlayer.message(caller, F.main(Plugin.getName(), "/" + AliasUsed + " MODERATOR")); + } + else + { + if (args.length == 0) + { + UtilPlayer.message(caller, F.main(Plugin.getName(), "Rank argument missing.")); + return; + } + + if (args[0].equalsIgnoreCase("RESET")) + { + Plugin.Get(caller).resetTemp(); + } + else + { + Rank tempRank = null; + + try + { + tempRank = Rank.valueOf(args[0].toUpperCase()); + } + catch (Exception ex) + { + UtilPlayer.message(caller, F.main(Plugin.getName(), ChatColor.RED + "" + ChatColor.BOLD + "Invalid rank!")); + return; + } + + Plugin.Get(caller).SetRank(tempRank, true); + UtilPlayer.message(caller, F.main(Plugin.getName(), "Your rank has been set to " + tempRank.getTag(false, false) + C.cGray + "!")); + UtilPlayer.message(caller, F.main("NOTICE", "This is only to be used for testing purposes. Misuse of this command will result in a demotion.")); + OnlineRankUpdateEvent event = new OnlineRankUpdateEvent(caller, Plugin.Get(caller).GetRank(true), Plugin.Get(caller).GetRank(), true); + Bukkit.getPluginManager().callEvent(event); + } + } + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/account/command/UpdateRank.java b/Plugins/Mineplex.Core/src/mineplex/core/account/command/UpdateRank.java index d0dfbcd93..0b0db5c51 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/account/command/UpdateRank.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/account/command/UpdateRank.java @@ -4,34 +4,36 @@ import java.util.Iterator; import java.util.List; import java.util.UUID; -import org.bukkit.ChatColor; -import org.bukkit.entity.Player; - import mineplex.core.account.CoreClientManager; +import mineplex.core.account.event.OnlineRankUpdateEvent; 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.UUIDFetcher; import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; + +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.entity.Player; public class UpdateRank extends CommandBase { public UpdateRank(CoreClientManager plugin) { - super(plugin, Rank.ADMIN, new Rank[] {Rank.JNR_DEV /*On test servers only*/}, "updateRank"); + super(plugin, Rank.ADMIN, "updateRank"); } @Override public void Execute(final Player caller, String[] args) { - boolean testServer = Plugin.getPlugin().getConfig().getString("serverstatus.group").equalsIgnoreCase("Testing"); - - if (Plugin.Get(caller).GetRank() == Rank.JNR_DEV && !testServer) + if (!Plugin.Get(caller).GetRank(true).has(caller, Rank.ADMIN, true)) { - F.main(Plugin.getName(), F.elem(Rank.JNR_DEV.getTag(true, true)) + "s are only permitted to set ranks on test servers!"); return; } + + boolean testServer = Plugin.getPlugin().getConfig().getString("serverstatus.group").equalsIgnoreCase("Testing"); if (args == null) { @@ -60,7 +62,7 @@ public class UpdateRank extends CommandBase final Rank rank = tempRank; - if (rank == Rank.ADMIN || rank == Rank.YOUTUBE || rank == Rank.TWITCH || rank == Rank.MODERATOR || rank == Rank.JNR_DEV || rank == Rank.HELPER || rank == Rank.ALL || rank == Rank.MAPDEV || rank == Rank.SNR_MODERATOR) + if (rank == Rank.ADMIN || rank == Rank.YOUTUBE || rank == Rank.TWITCH || rank == Rank.MODERATOR || rank == Rank.JNR_DEV || rank == Rank.HELPER || rank == Rank.ALL || rank == Rank.MAPDEV || rank == Rank.SNR_MODERATOR || rank == Rank.SUPPORT) { if (!testServer && rank.has(Rank.ADMIN) && !Plugin.hasRank(caller, Rank.LT)) { @@ -93,6 +95,19 @@ public class UpdateRank extends CommandBase } } + if (UtilPlayer.isOnline(playerName)) + { + Player p = UtilServer.getServer().getPlayer(playerName); + if (Plugin.Get(p).GetRank() != Plugin.Get(p).GetRank(true)) + Plugin.Get(p).resetTemp(); + + OnlineRankUpdateEvent event = new OnlineRankUpdateEvent(caller, Plugin.Get(caller).GetRank(), rank, true); + Plugin.Get(p).SetRank(rank, false); + Bukkit.getPluginManager().callEvent(event); + + UtilPlayer.message(p, F.main(Plugin.getName(), "Your rank has been updated to " + rank.Name + "!")); + } + UtilPlayer.searchOffline(matches, new Callback() { public void run(final String target) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/account/event/OnlineRankUpdateEvent.java b/Plugins/Mineplex.Core/src/mineplex/core/account/event/OnlineRankUpdateEvent.java new file mode 100644 index 000000000..27c4cec25 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/account/event/OnlineRankUpdateEvent.java @@ -0,0 +1,55 @@ +package mineplex.core.account.event; + +import mineplex.core.common.Rank; + +import org.bukkit.entity.Player; +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; + +public class OnlineRankUpdateEvent extends Event +{ + private static final HandlerList handlers = new HandlerList(); + + private Player _player; + private Rank _from, _to; + private boolean _temp; + + public OnlineRankUpdateEvent(Player player, Rank from, Rank to, boolean temp) + { + _player = player; + _from = from; + _to = to; + _temp = temp; + } + + public Player getPlayer() + { + return _player; + } + + public Rank getFrom() + { + return _from; + } + + public Rank getTo() + { + return _to; + } + + public boolean isTemporary() + { + return _temp; + } + + public HandlerList getHandlers() + { + return handlers; + } + + public static HandlerList getHandlerList() + { + return handlers; + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/account/repository/AccountRepository.java b/Plugins/Mineplex.Core/src/mineplex/core/account/repository/AccountRepository.java index cd64cbdfa..b151ba4e7 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/account/repository/AccountRepository.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/account/repository/AccountRepository.java @@ -209,7 +209,7 @@ public class AccountRepository extends RepositoryBase { public void run(final Rank response) { - if (rank == Rank.ULTRA || rank == Rank.HERO || rank == Rank.LEGEND) + if (rank == Rank.ULTRA || rank == Rank.HERO || rank == Rank.LEGEND || rank == Rank.TITAN) { if (perm) executeUpdate(UPDATE_ACCOUNT_RANK_DONOR_PERM, new ColumnVarChar("rank", 100, rank.toString()), new ColumnVarChar("donorRank", 100, rank.toString()), new ColumnVarChar("uuid", 100, uuid.toString())); @@ -229,7 +229,8 @@ public class AccountRepository extends RepositoryBase @Override public void run() { - callback.run(response); + if (callback != null) + callback.run(response); } }); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/achievement/Achievement.java b/Plugins/Mineplex.Core/src/mineplex/core/achievement/Achievement.java index 01925be94..bf874c242 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/achievement/Achievement.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/achievement/Achievement.java @@ -15,6 +15,13 @@ public enum Achievement new String[]{"+1 for every Gem earned in any game."}, new int[]{10000, 15000, 20000, 25000, 30000, 35000, 40000, 45000, 50000, 55000, 60000, 65000}, AchievementCategory.GLOBAL), + + GLOBAL_PUMPKIN_SMASHER_2015("2015 Pumpkin Smasher", 4000, + new String[]{"Global.Halloween Pumpkins 2015"}, + new String[]{"Smash 200 Flaming Pumpkins,", + "during Halloween 2015!"}, + new int[]{200}, + AchievementCategory.HOLIDAY), //Bridges BRIDGES_WINS("Bridge Champion", 600, @@ -708,10 +715,49 @@ public enum Achievement new String[]{"Evolution.EvolveKill"}, new String[]{"Kill 25 people while they", "Are trying to evolve"}, new int[]{25}, - AchievementCategory.EVOLUTION) + AchievementCategory.EVOLUTION), + + MONSTER_MAZE_WINS("Maze Master", 1200, + new String[]{"Monster Maze.Wins"}, + new String[]{"Win 40 games of Monster Maze"}, + new int[]{40}, + AchievementCategory.MONSTER_MAZE), + + MONSTER_MAZE_HARD_MODE("Hard Mode", 1000, + new String[]{"Monster Maze.Hard Mode"}, + new String[]{"Win a game without using", "any kit abilities"}, + new int[]{1}, + AchievementCategory.MONSTER_MAZE), + + MONSTER_MAZE_NINJA("Ninja", 1200, + new String[]{"Monster Maze.Ninja"}, + new String[]{"Win a game without", "touching a monster"}, + new int[]{1}, + AchievementCategory.MONSTER_MAZE), + + MONSTER_MAZE_SPEEDSTER("Speedy McGee", 1000, + new String[]{"Monster Maze.Speed"}, + new String[]{"Be the first to the", "Safe Pad 50 times"}, + new int[]{50}, + AchievementCategory.MONSTER_MAZE), + + MONSTER_MAZE_SURVIVAL("Die Already!", 1200, + new String[]{"Monster Maze.ToughCompetition"}, + new String[]{"Survive past the 10th Safe Pad"}, + new int[]{1}, + AchievementCategory.MONSTER_MAZE), + + MONSTER_MAZE_PILOT("Pilot", 800, //TODO + new String[]{"Monster Maze.Pilot"}, + new String[]{"Get hit by a monster and", "land on the Safe Pad"}, + new int[]{1}, + AchievementCategory.MONSTER_MAZE), ; + private static String[] _colors = { C.cAqua, C.cGreen, C.cDGray, C.cPurple, C.cYellow, C.cGray }; + private static int _negativeCount = 0; + private String _name; private String[] _desc; private String[] _stats; @@ -777,7 +823,10 @@ public enum Achievement public static String getExperienceString(int level) { if (level < 0) - return C.cPurple + level; + { + _negativeCount++; + return _colors[_negativeCount % _colors.length] + level; + } if (level < 20) return C.cGray + level; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementCategory.java b/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementCategory.java index 636176b02..6ce3d8025 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementCategory.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementCategory.java @@ -20,6 +20,10 @@ public enum AchievementCategory new StatDisplay[] { StatDisplay.GEMS_EARNED, null, new StatDisplay("Games Played", "GamesPlayed"), StatDisplay.TIME_IN_GAME, null, new StatDisplay("Daily Rewards", "DailyReward"), new StatDisplay("Times Voted", "DailyVote"), null, new StatDisplay("Chests Opened", "Treasure.Old", "Treasure.Ancient", "Treasure.Mythical") }, Material.EMERALD, 0, GameCategory.GLOBAL, "None"), + + HOLIDAY("Holiday Achievements", null, + new StatDisplay[] {}, + Material.PUMPKIN_PIE, 0, GameCategory.HOLIDAY, "None"), BRIDGES("The Bridges", null, new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED }, @@ -141,7 +145,13 @@ public enum AchievementCategory EVOLUTION("Evolution", null, new StatDisplay[] {StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED}, - Material.MONSTER_EGG, 0, GameCategory.ARCADE, "Harvester Kit"); + Material.MONSTER_EGG, 0, GameCategory.ARCADE, "Harvester Kit"), + + MONSTER_MAZE("Monster Maze", null, + new StatDisplay[] {StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED}, + Material.ROTTEN_FLESH, 0, GameCategory.ARCADE, "SoonTM"), + + ; private String _name; private String[] _statsToPull; @@ -257,6 +267,6 @@ public enum AchievementCategory public enum GameCategory { - GLOBAL, SURVIVAL, CLASSICS, CHAMPIONS, ARCADE + GLOBAL, HOLIDAY, SURVIVAL, CLASSICS, CHAMPIONS, ARCADE } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/achievement/ui/page/AchievementMainPage.java b/Plugins/Mineplex.Core/src/mineplex/core/achievement/ui/page/AchievementMainPage.java index 68d43a09e..7056d8b8e 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/achievement/ui/page/AchievementMainPage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/achievement/ui/page/AchievementMainPage.java @@ -29,7 +29,12 @@ public class AchievementMainPage extends ShopPageBase pageLayout = new ItemLayout( - "XXXXOXXXX", + "XXXXOXXXO", "OXOXOXOXO", "OXOXOXOXO", "XXOXOXOXX").getItemSlots(); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/achievement/ui/page/ArcadeMainPage.java b/Plugins/Mineplex.Core/src/mineplex/core/achievement/ui/page/ArcadeMainPage.java index da96e2cc1..41a3c8bc1 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/achievement/ui/page/ArcadeMainPage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/achievement/ui/page/ArcadeMainPage.java @@ -23,7 +23,9 @@ public class ArcadeMainPage extends AchievementMainPage { public ArcadeMainPage(AchievementManager plugin, StatsManager statsManager, AchievementShop shop, CoreClientManager clientManager, DonationManager donationManager, String name, Player player, Player target) { - super(plugin, statsManager, shop, clientManager, donationManager, name, player, target); + super(plugin, statsManager, shop, clientManager, donationManager, name, 9 * 5, player, target); + + } @Override diff --git a/Plugins/Mineplex.Core/src/mineplex/core/benefit/BenefitManager.java b/Plugins/Mineplex.Core/src/mineplex/core/benefit/BenefitManager.java index 0301e0225..045d6f42f 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/benefit/BenefitManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/benefit/BenefitManager.java @@ -27,11 +27,11 @@ public class BenefitManager extends MiniDbClientPlugin { super("Benefit Manager", plugin, clientManager); - _repository = new BenefitManagerRepository(plugin); + _repository = new BenefitManagerRepository(plugin); //_benefits.add(new Christmas2014(plugin, _repository, inventoryManager)); //_benefits.add(new Thanksgiving2014(plugin, _repository, inventoryManager)); - //_benefits.add(new Players40k(this, _repository, inventoryManager)); + //_benefits.add(new Players43k(this, _repository, inventoryManager)); } @EventHandler(priority = EventPriority.LOWEST) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/benefit/BenefitManagerRepository.java b/Plugins/Mineplex.Core/src/mineplex/core/benefit/BenefitManagerRepository.java index 3cb111d67..39fbfa530 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/benefit/BenefitManagerRepository.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/benefit/BenefitManagerRepository.java @@ -15,6 +15,7 @@ public class BenefitManagerRepository extends RepositoryBase private static String CREATE_BENEFIT_TABLE = "CREATE TABLE IF NOT EXISTS rankBenefits (id INT NOT NULL AUTO_INCREMENT, accountId INT, benefit VARCHAR(100), PRIMARY KEY (id), FOREIGN KEY (accountId) REFERENCES accounts(id));"; private static String INSERT_BENEFIT = "INSERT INTO rankBenefits (accountId, benefit) VALUES (?, ?);"; + private static String DELETE_BENEFIT = "DELETE FROM rankBenefits WHERE accountId = ? AND benefit = ?;"; public BenefitManagerRepository(JavaPlugin plugin) { @@ -24,7 +25,7 @@ public class BenefitManagerRepository extends RepositoryBase @Override protected void initialize() { - executeUpdate(CREATE_BENEFIT_TABLE); + //executeUpdate(CREATE_BENEFIT_TABLE); } @Override @@ -50,4 +51,9 @@ public class BenefitManagerRepository extends RepositoryBase return playerBenefit; } + + public void removeBenefit(int accountId, String benefit) + { + executeUpdate(DELETE_BENEFIT, new ColumnInt("accountId", accountId), new ColumnVarChar("benefit", 100, benefit)); + } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/benefit/benefits/BenefitBase.java b/Plugins/Mineplex.Core/src/mineplex/core/benefit/benefits/BenefitBase.java index 517d95c34..fbed670f4 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/benefit/benefits/BenefitBase.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/benefit/benefits/BenefitBase.java @@ -45,6 +45,11 @@ public abstract class BenefitBase } }); } + + protected void removeBenefit(final Player player) + { + _repository.removeBenefit(_plugin.getClientManager().Get(player).getAccountId(), _name); + } public String getName() { diff --git a/Plugins/Mineplex.Core/src/mineplex/core/benefit/benefits/Christmas2014.java b/Plugins/Mineplex.Core/src/mineplex/core/benefit/benefits/Christmas2014.java index 7d708bcfb..500c15269 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/benefit/benefits/Christmas2014.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/benefit/benefits/Christmas2014.java @@ -38,6 +38,6 @@ public class Christmas2014 extends BenefitBase UtilPlayer.message(player, C.cPurple + C.Strike + "============================================="); } } - }, player, "Treasure", "Treasure Key", 2); + }, player, "Treasure Key", 2); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/benefit/benefits/Players40k.java b/Plugins/Mineplex.Core/src/mineplex/core/benefit/benefits/Players40k.java index 8ce851f96..319f2e07c 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/benefit/benefits/Players40k.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/benefit/benefits/Players40k.java @@ -40,6 +40,6 @@ public class Players40k extends BenefitBase UtilPlayer.message(player, C.cGold + C.Strike + "============================================="); } } - }, player, "Treasure", "Ancient Chest", 1); + }, player, "Ancient Chest", 1); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/benefit/benefits/Players43k.java b/Plugins/Mineplex.Core/src/mineplex/core/benefit/benefits/Players43k.java new file mode 100644 index 000000000..41e40cd9f --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/benefit/benefits/Players43k.java @@ -0,0 +1,49 @@ +package mineplex.core.benefit.benefits; + +import mineplex.core.benefit.BenefitManager; +import mineplex.core.benefit.BenefitManagerRepository; +import mineplex.core.common.util.C; +import mineplex.core.common.util.Callback; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.inventory.InventoryManager; + +import org.bukkit.entity.Player; +import org.bukkit.plugin.java.JavaPlugin; + +public class Players43k extends BenefitBase +{ + private InventoryManager _inventoryManager; + + public Players43k(BenefitManager plugin, BenefitManagerRepository repository, InventoryManager inventoryManager) + { + super(plugin, "Players43k", repository); + + _inventoryManager = inventoryManager; + } + + @Override + public void rewardPlayer(final Player player) + { + _inventoryManager.addItemToInventory(new Callback() + { + public void run(Boolean success) + { + if (success) + { + UtilPlayer.message(player, C.cGold + C.Strike + "============================================="); + UtilPlayer.message(player, ""); + UtilPlayer.message(player, "To celebrate hitting 43,000 players online,"); + UtilPlayer.message(player, "everyone receives a prize! You're awesome!"); + UtilPlayer.message(player, ""); + UtilPlayer.message(player, "You received 3 Ancient Chests!"); + UtilPlayer.message(player, ""); + UtilPlayer.message(player, C.cGold + C.Strike + "============================================="); + } + else + { + removeBenefit(player); + } + } + }, player, "Ancient Chest", 3); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/benefit/benefits/Thanksgiving2014.java b/Plugins/Mineplex.Core/src/mineplex/core/benefit/benefits/Thanksgiving2014.java index fce4aaeb3..2ed504c9e 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/benefit/benefits/Thanksgiving2014.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/benefit/benefits/Thanksgiving2014.java @@ -38,6 +38,6 @@ public class Thanksgiving2014 extends BenefitBase UtilPlayer.message(player, C.cPurple + C.Strike + "============================================="); } } - }, player, "Treasure", "Treasure Key", 1); + }, player, "Treasure Key", 1); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/BonusManager.java b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/BonusManager.java index 943b1eae9..c6188442c 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/BonusManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/BonusManager.java @@ -41,6 +41,7 @@ import mineplex.core.pet.PetManager; import mineplex.core.recharge.Recharge; import mineplex.core.reward.RewardManager; import mineplex.core.stats.StatsManager; +import mineplex.core.status.ServerStatusManager; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.database.Tables; @@ -164,7 +165,7 @@ public class BonusManager extends MiniClientPlugin implements I updateOffSet(); } - public BonusManager(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager, PollManager pollManager, NpcManager npcManager, HologramManager hologramManager, StatsManager statsManager, InventoryManager inventoryManager, PetManager petManager) + public BonusManager(JavaPlugin plugin, CoreClientManager clientManager, ServerStatusManager statusManager, DonationManager donationManager, PollManager pollManager, NpcManager npcManager, HologramManager hologramManager, StatsManager statsManager, InventoryManager inventoryManager, PetManager petManager) { super("Bonus", plugin); _repository = new BonusRepository(plugin, this, donationManager); @@ -173,7 +174,7 @@ public class BonusManager extends MiniClientPlugin implements I _npcManager = npcManager; _hologramManager = hologramManager; - _rewardManager = new RewardManager(clientManager, donationManager, inventoryManager, petManager, statsManager, + _rewardManager = new RewardManager(clientManager, statusManager, donationManager, inventoryManager, petManager, statsManager, 100, 250, 500, 1000, 4000, 6000, diff --git a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/BonusRepository.java b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/BonusRepository.java index ee21b56a0..d2b7613af 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/BonusRepository.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/BonusRepository.java @@ -435,7 +435,7 @@ public class BonusRepository extends RepositoryBase @Override protected void initialize() { - executeUpdate(CREATE_BONUS_TABLE); + //executeUpdate(CREATE_BONUS_TABLE); } @Override diff --git a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/SpinGui.java b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/SpinGui.java index 779c9e431..c111054bf 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/SpinGui.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/SpinGui.java @@ -109,7 +109,7 @@ public class SpinGui extends SimpleGui } } - _rewardData = _reward.giveReward("Carls Spinner", getPlayer()); + _rewardData = _reward.giveReward(RewardType.SpinnerReal, getPlayer()); } private void tick() diff --git a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/buttons/VoteButton.java b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/buttons/VoteButton.java index 0110d5fa0..1b69a3fd9 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/buttons/VoteButton.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/buttons/VoteButton.java @@ -2,6 +2,9 @@ package mineplex.core.bonuses.gui.buttons; import java.util.ArrayList; +import mineplex.core.bonuses.BonusAmount; +import mineplex.core.bonuses.BonusClientData; +import mineplex.core.bonuses.BonusManager; import mineplex.core.common.jsonchat.ClickEvent; import mineplex.core.common.jsonchat.JsonMessage; import mineplex.core.common.util.C; @@ -11,10 +14,6 @@ import mineplex.core.common.util.UtilTime.TimeUnit; import mineplex.core.gui.GuiItem; import mineplex.core.gui.ItemRefresher; import mineplex.core.shop.item.ShopItem; -import mineplex.core.bonuses.BonusAmount; -import mineplex.core.bonuses.BonusClientData; -import mineplex.core.bonuses.BonusManager; -import mineplex.core.bonuses.StreakRecord; import org.bukkit.Bukkit; import org.bukkit.ChatColor; @@ -72,15 +71,15 @@ public class VoteButton implements GuiItem, Listener { getPlayer().playSound(getPlayer().getLocation(), Sound.NOTE_PLING, 1, 1.6f); - UtilPlayer.message(getPlayer(), "----------------------------------------------------"); + UtilPlayer.message(getPlayer(), C.cGold + C.Bold + C.Strike + "============================================="); UtilPlayer.message(getPlayer(), ""); - new JsonMessage("Click to Open in Web Browser").click(ClickEvent.OPEN_URL, _url).sendToPlayer(getPlayer()); - new JsonMessage(C.cGreen + _url).click(ClickEvent.OPEN_URL, _url).sendToPlayer(getPlayer()); + new JsonMessage(" " + C.Bold + "Click to Open in Web Browser").click(ClickEvent.OPEN_URL, _url).sendToPlayer(getPlayer()); + new JsonMessage( " " + C.cGreen + C.Line + _url).click(ClickEvent.OPEN_URL, _url).sendToPlayer(getPlayer()); UtilPlayer.message(getPlayer(), ""); - UtilPlayer.message(getPlayer(), "Please be patient, votes may take a few minutes to register."); + UtilPlayer.message(getPlayer(), " Please be patient. Votes may take a few minutes to register."); UtilPlayer.message(getPlayer(), ""); - UtilPlayer.message(getPlayer(), "----------------------------------------------------"); + UtilPlayer.message(getPlayer(), C.cGold + C.Bold + C.Strike + "============================================="); getPlayer().closeInventory(); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/botspam/BotSpamManager.java b/Plugins/Mineplex.Core/src/mineplex/core/botspam/BotSpamManager.java index a977b3685..29a38932c 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/botspam/BotSpamManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/botspam/BotSpamManager.java @@ -5,6 +5,8 @@ import java.util.List; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.player.AsyncPlayerChatEvent; import org.bukkit.plugin.java.JavaPlugin; import mineplex.core.MiniPlugin; @@ -42,6 +44,10 @@ public class BotSpamManager extends MiniPlugin // Ignore messages sent to staff members if (_clientManager.hasRank(recipient, Rank.HELPER)) return; + + // Ignore messages sent by staff members + if (_clientManager.hasRank(event.getSender(), Rank.HELPER)) + return; for (SpamText spamText : _spam) { @@ -53,6 +59,31 @@ public class BotSpamManager extends MiniPlugin } } } + + @EventHandler(priority = EventPriority.LOWEST) + public void onChat(final AsyncPlayerChatEvent event) + { + // Ignore messages sent by staff members + if (_clientManager.hasRank(event.getPlayer(), Rank.HELPER)) + return; + + for (final SpamText spamText : _spam) + { + if (spamText.isEnabled() && spamText.isSpam(event.getMessage())) + { + runSync(new Runnable() + { + @Override + public void run() + { + punishBot(event.getPlayer(), spamText); + } + }); + event.setCancelled(true); + return; + } + } + } public void punishBot(Player player, final SpamText botText) { diff --git a/Plugins/Mineplex.Core/src/mineplex/core/botspam/SpamText.java b/Plugins/Mineplex.Core/src/mineplex/core/botspam/SpamText.java index a4d466082..4fae3baf8 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/botspam/SpamText.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/botspam/SpamText.java @@ -23,6 +23,7 @@ public class SpamText public boolean isSpam(String message) { + //System.out.println(message.toLowerCase() + " vs " + _text.toLowerCase() + " == " + message.toLowerCase().contains(_text.toLowerCase())); return message.toLowerCase().contains(_text.toLowerCase()); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/botspam/command/BotSpamAddCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/botspam/command/BotSpamAddCommand.java index d662dec7d..224f3506c 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/botspam/command/BotSpamAddCommand.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/botspam/command/BotSpamAddCommand.java @@ -13,7 +13,7 @@ public class BotSpamAddCommand extends CommandBase { public BotSpamAddCommand(BotSpamManager plugin) { - super(plugin, Rank.DEVELOPER, "add"); + super(plugin, Rank.ADMIN, "add"); } @Override diff --git a/Plugins/Mineplex.Core/src/mineplex/core/botspam/command/BotSpamCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/botspam/command/BotSpamCommand.java index 233939e7b..99a3e1bab 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/botspam/command/BotSpamCommand.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/botspam/command/BotSpamCommand.java @@ -12,7 +12,7 @@ public class BotSpamCommand extends MultiCommandBase { public BotSpamCommand(BotSpamManager plugin) { - super(plugin, Rank.DEVELOPER, "botban", "botspam"); + super(plugin, Rank.ADMIN, "botban", "botspam"); AddCommand(new BotSpamAddCommand(Plugin)); AddCommand(new BotSpamEnableCommand(Plugin)); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/botspam/command/BotSpamDisableCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/botspam/command/BotSpamDisableCommand.java index e59f7c84f..4afcb9894 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/botspam/command/BotSpamDisableCommand.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/botspam/command/BotSpamDisableCommand.java @@ -13,7 +13,7 @@ public class BotSpamDisableCommand extends CommandBase { public BotSpamDisableCommand(BotSpamManager plugin) { - super(plugin, Rank.DEVELOPER, "disable"); + super(plugin, Rank.ADMIN, "disable"); } @Override diff --git a/Plugins/Mineplex.Core/src/mineplex/core/botspam/command/BotSpamEnableCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/botspam/command/BotSpamEnableCommand.java index ce0242395..d694e06cc 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/botspam/command/BotSpamEnableCommand.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/botspam/command/BotSpamEnableCommand.java @@ -13,7 +13,7 @@ public class BotSpamEnableCommand extends CommandBase { public BotSpamEnableCommand(BotSpamManager plugin) { - super(plugin, Rank.DEVELOPER, "enable"); + super(plugin, Rank.ADMIN, "enable"); } @Override diff --git a/Plugins/Mineplex.Core/src/mineplex/core/botspam/command/BotSpamListCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/botspam/command/BotSpamListCommand.java index 96e71da64..47e31606c 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/botspam/command/BotSpamListCommand.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/botspam/command/BotSpamListCommand.java @@ -17,7 +17,7 @@ public class BotSpamListCommand extends CommandBase { public BotSpamListCommand(BotSpamManager plugin) { - super(plugin, Rank.DEVELOPER, "list"); + super(plugin, Rank.ADMIN, "list"); } @Override diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/MountButton.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/MountButton.java index 57cad6fce..55d34af4b 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/MountButton.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/MountButton.java @@ -29,7 +29,7 @@ public class MountButton implements IButton { public void run() { - _page.getPlugin().getInventoryManager().addItemToInventory(null, player, "Mount", _mount.GetName(), 1); + _page.getPlugin().getInventoryManager().addItemToInventory(null, player, _mount.GetName(), 1); _page.refresh(); } }, _page, _mount, CurrencyType.Coins, player)); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/GadgetPage.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/GadgetPage.java index 1189a4162..6a75916e6 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/GadgetPage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/GadgetPage.java @@ -109,7 +109,7 @@ public class GadgetPage extends ShopPageBase itemLore.add(C.cWhite + "Your Ammo : " + C.cGreen + getPlugin().getInventoryManager().Get(getPlayer()).getItemCount(gadget.GetName())); } - if (gadget.IsFree() || getDonationManager().Get(getPlayer().getName()).OwnsUnknownPackage(gadget.GetName())) + if (gadget.IsFree() || getDonationManager().Get(getPlayer().getName()).OwnsUnknownPackage(gadget.GetName()) || getPlugin().getInventoryManager().Get(getPlayer()).getItemCount(gadget.GetName()) > 0) { if (gadget.GetActive().contains(getPlayer())) { @@ -140,7 +140,7 @@ public class GadgetPage extends ShopPageBase { public void run() { - getPlugin().getInventoryManager().addItemToInventory(getPlayer(), gadget.getGadgetType().name(), gadget.GetName(), (gadget instanceof ItemGadget ? ((ItemGadget) gadget).getAmmo().getQuantity() : gadget.getQuantity())); + getPlugin().getInventoryManager().addItemToInventory(getPlayer(), gadget.GetName(), (gadget instanceof ItemGadget ? ((ItemGadget) gadget).getAmmo().getQuantity() : gadget.getQuantity())); refresh(); } }, this, (gadget instanceof ItemGadget ? ((ItemGadget) gadget).getAmmo() : gadget), CurrencyType.Coins, getPlayer())); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/Menu.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/Menu.java index 950dc9164..e77751779 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/Menu.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/Menu.java @@ -180,7 +180,7 @@ public class Menu extends ShopPageBase { public void run() { - getPlugin().getInventoryManager().addItemToInventory(getPlayer(), "Treasure", "Treasure Key", 1); + getPlugin().getInventoryManager().addItemToInventory(getPlayer(), "Treasure Key", 1); refresh(); } }, this, new TreasureKey(), CurrencyType.Coins, getPlayer())); 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 c9a544b93..3262033c0 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 @@ -80,7 +80,7 @@ public class PetPage extends ShopPageBase } //Owned - if (getDonationManager().Get(getPlayer().getName()).OwnsUnknownPackage(pet.GetPetName())) + if (getPlugin().getPetManager().Get(getPlayer()).GetPets().containsKey(pet.GetPetType())) { String petName = getPlugin().getPetManager().Get(getPlayer()).GetPets().get(pet.GetPetType()); if (petName == null) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/PetTagPage.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/PetTagPage.java index 9bdcadd54..7477a2492 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/PetTagPage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/PetTagPage.java @@ -16,6 +16,7 @@ import mineplex.core.pet.repository.token.PetChangeToken; import mineplex.core.pet.repository.token.PetToken; import mineplex.core.shop.page.ConfirmationPage; import mineplex.core.shop.page.ShopPageBase; +import mineplex.playerCache.PlayerCache; import net.minecraft.server.v1_7_R4.ItemStack; import net.minecraft.server.v1_7_R4.Items; @@ -85,6 +86,8 @@ public class PetTagPage extends ShopPageBase if (getClientManager().Get(getPlayer()) != null) token.AccountId = getClientManager().Get(getPlayer()).getAccountId(); + else + token.AccountId = PlayerCache.getInstance().getPlayer(getPlayer().getUniqueId()).getAccountId(); token.Name = getPlayer().getName(); token.PetType = _pet.GetPetType().toString(); @@ -107,7 +110,6 @@ public class PetTagPage extends ShopPageBase getPlugin().getPetManager().Get(getPlayer()).GetPets().put(_pet.GetPetType(), token.PetName); - getPlugin().getInventoryManager().addItemToInventory(null, getPlayer(), "Pet", _pet.GetPetType().toString(), 1); getShop().openPageForPlayer(getPlayer(), new Menu(getPlugin(), getShop(), getClientManager(), getDonationManager(), getPlayer())); } }, null, _petPurchase ? _pet : tag, CurrencyType.Coins, getPlayer())); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/database/DBPool.java b/Plugins/Mineplex.Core/src/mineplex/core/database/DBPool.java index f148d31c5..8400fa954 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/database/DBPool.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/database/DBPool.java @@ -22,8 +22,8 @@ public final class DBPool source.setUrl(url); source.setUsername(username); source.setPassword(password); - source.setMaxTotal(4); - source.setMaxIdle(4); + source.setMaxTotal(3); + source.setMaxIdle(3); source.setTimeBetweenEvictionRunsMillis(180 * 1000); source.setSoftMinEvictableIdleTimeMillis(180 * 1000); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/disguise/DisguiseManager.java b/Plugins/Mineplex.Core/src/mineplex/core/disguise/DisguiseManager.java index 0e1a9c9d5..bbc04051a 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/disguise/DisguiseManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/disguise/DisguiseManager.java @@ -9,31 +9,49 @@ import java.util.HashSet; import java.util.Iterator; import java.util.Map.Entry; +import mineplex.core.MiniPlugin; +import mineplex.core.common.util.NautHashMap; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.disguise.disguises.DisguiseArmorStand; +import mineplex.core.disguise.disguises.DisguiseBase; +import mineplex.core.disguise.disguises.DisguiseBlock; +import mineplex.core.disguise.disguises.DisguiseInsentient; +import mineplex.core.disguise.disguises.DisguiseLiving; +import mineplex.core.disguise.disguises.DisguisePlayer; +import mineplex.core.disguise.disguises.DisguiseRabbit; +import mineplex.core.packethandler.IPacketHandler; +import mineplex.core.packethandler.PacketHandler; +import mineplex.core.packethandler.PacketInfo; +import mineplex.core.packethandler.PacketVerifier; +import mineplex.core.timing.TimingManager; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; import net.minecraft.server.v1_7_R4.Block; import net.minecraft.server.v1_7_R4.Chunk; -import net.minecraft.server.v1_7_R4.ChunkSection; -import net.minecraft.server.v1_7_R4.EntityTrackerEntry; -import net.minecraft.server.v1_7_R4.PacketPlayOutAnimation; import net.minecraft.server.v1_7_R4.ChunkAddEntityEvent; +import net.minecraft.server.v1_7_R4.ChunkSection; import net.minecraft.server.v1_7_R4.EntityPlayer; +import net.minecraft.server.v1_7_R4.EntityTrackerEntry; import net.minecraft.server.v1_7_R4.Packet; +import net.minecraft.server.v1_7_R4.PacketPlayOutAnimation; import net.minecraft.server.v1_7_R4.PacketPlayOutBed; +import net.minecraft.server.v1_7_R4.PacketPlayOutEntityDestroy; +import net.minecraft.server.v1_7_R4.PacketPlayOutEntityEquipment; +import net.minecraft.server.v1_7_R4.PacketPlayOutEntityMetadata; import net.minecraft.server.v1_7_R4.PacketPlayOutEntityStatus; +import net.minecraft.server.v1_7_R4.PacketPlayOutEntityTeleport; +import net.minecraft.server.v1_7_R4.PacketPlayOutEntityVelocity; import net.minecraft.server.v1_7_R4.PacketPlayOutMapChunk; import net.minecraft.server.v1_7_R4.PacketPlayOutMapChunkBulk; import net.minecraft.server.v1_7_R4.PacketPlayOutNamedEntitySpawn; +import net.minecraft.server.v1_7_R4.PacketPlayOutNamedSoundEffect; import net.minecraft.server.v1_7_R4.PacketPlayOutPlayerInfo; -import net.minecraft.server.v1_7_R4.PacketPlayOutSpawnEntity; -import net.minecraft.server.v1_7_R4.PacketPlayOutEntityVelocity; -import net.minecraft.server.v1_7_R4.PacketPlayOutEntityDestroy; import net.minecraft.server.v1_7_R4.PacketPlayOutRelEntityMove; import net.minecraft.server.v1_7_R4.PacketPlayOutRelEntityMoveLook; -import net.minecraft.server.v1_7_R4.PacketPlayOutEntityTeleport; -import net.minecraft.server.v1_7_R4.PacketPlayOutEntityMetadata; +import net.minecraft.server.v1_7_R4.PacketPlayOutSpawnEntity; import net.minecraft.server.v1_7_R4.PacketPlayOutSpawnEntityLiving; import net.minecraft.server.v1_7_R4.PacketPlayOutUpdateAttributes; -import net.minecraft.server.v1_7_R4.PacketPlayOutEntityEquipment; -import net.minecraft.server.v1_7_R4.PacketPlayOutNamedSoundEffect; import net.minecraft.server.v1_7_R4.WorldServer; import org.bukkit.Bukkit; @@ -57,24 +75,6 @@ import org.bukkit.event.player.PlayerTeleportEvent; import org.bukkit.event.world.ChunkUnloadEvent; import org.bukkit.plugin.java.JavaPlugin; -import mineplex.core.MiniPlugin; -import mineplex.core.common.util.NautHashMap; -import mineplex.core.common.util.UtilEnt; -import mineplex.core.common.util.UtilPlayer; -import mineplex.core.disguise.disguises.DisguiseBase; -import mineplex.core.disguise.disguises.DisguiseBlock; -import mineplex.core.disguise.disguises.DisguiseInsentient; -import mineplex.core.disguise.disguises.DisguiseLiving; -import mineplex.core.disguise.disguises.DisguisePlayer; -import mineplex.core.disguise.disguises.DisguiseRabbit; -import mineplex.core.packethandler.IPacketHandler; -import mineplex.core.packethandler.PacketHandler; -import mineplex.core.packethandler.PacketVerifier; -import mineplex.core.packethandler.PacketInfo; -import mineplex.core.timing.TimingManager; -import mineplex.core.updater.UpdateType; -import mineplex.core.updater.event.UpdateEvent; - public class DisguiseManager extends MiniPlugin implements IPacketHandler { private NautHashMap _spawnPacketMap = new NautHashMap(); @@ -831,7 +831,7 @@ public class DisguiseManager extends MiniPlugin implements IPacketHandler { final Player player = packetInfo.getPlayer(); - if (!UtilPlayer.is1_8(player) && disguise instanceof DisguiseRabbit) + if (!UtilPlayer.is1_8(player) && (disguise instanceof DisguiseRabbit || disguise instanceof DisguiseArmorStand)) { return; } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/donation/repository/DonationRepository.java b/Plugins/Mineplex.Core/src/mineplex/core/donation/repository/DonationRepository.java index bd7a75a7b..43d5b23b4 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/donation/repository/DonationRepository.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/donation/repository/DonationRepository.java @@ -155,7 +155,7 @@ public class DonationRepository extends RepositoryBase { if (response) { - executeUpdate(UPDATE_ACCOUNT_COINS, new ColumnInt("coins", coins), new ColumnInt("id", accountId)); + //executeUpdate(UPDATE_ACCOUNT_COINS, new ColumnInt("coins", coins), new ColumnInt("id", accountId)); //executeUpdate(INSERT_COIN_TRANSACTION, new ColumnInt("id", accountId), new ColumnVarChar("reason", 100, "Rewarded by " + giver), new ColumnInt("coins", coins)); } @@ -198,8 +198,8 @@ public class DonationRepository extends RepositoryBase @Override protected void initialize() { - executeUpdate(CREATE_COIN_TRANSACTION_TABLE); - executeUpdate(CREATE_GEM_TRANSACTION_TABLE); + //executeUpdate(CREATE_COIN_TRANSACTION_TABLE); + //executeUpdate(CREATE_GEM_TRANSACTION_TABLE); } @Override diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java index 22f60039c..7494e9fa6 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java @@ -3,19 +3,6 @@ package mineplex.core.gadget; import java.util.ArrayList; import java.util.List; -import org.bukkit.Bukkit; -import org.bukkit.Location; -import org.bukkit.Material; -import org.bukkit.Sound; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.entity.PlayerDeathEvent; -import org.bukkit.event.player.PlayerJoinEvent; -import org.bukkit.event.player.PlayerMoveEvent; -import org.bukkit.event.player.PlayerQuitEvent; -import org.bukkit.event.player.PlayerToggleSneakEvent; -import org.bukkit.plugin.java.JavaPlugin; - import mineplex.core.MiniPlugin; import mineplex.core.account.CoreClientManager; import mineplex.core.achievement.AchievementManager; @@ -28,7 +15,44 @@ import mineplex.core.common.util.UtilTime; import mineplex.core.disguise.DisguiseManager; import mineplex.core.donation.DonationManager; import mineplex.core.gadget.event.GadgetCollideEntityEvent; -import mineplex.core.gadget.gadgets.*; +import mineplex.core.gadget.gadgets.ItemBatGun; +import mineplex.core.gadget.gadgets.ItemCoinBomb; +import mineplex.core.gadget.gadgets.ItemDuelingSword; +import mineplex.core.gadget.gadgets.ItemEtherealPearl; +import mineplex.core.gadget.gadgets.ItemFirework; +import mineplex.core.gadget.gadgets.ItemFleshHook; +import mineplex.core.gadget.gadgets.ItemMelonLauncher; +import mineplex.core.gadget.gadgets.ItemPaintballGun; +import mineplex.core.gadget.gadgets.ItemPaintbrush; +import mineplex.core.gadget.gadgets.ItemTNT; +import mineplex.core.gadget.gadgets.MorphBat; +import mineplex.core.gadget.gadgets.MorphBlaze; +import mineplex.core.gadget.gadgets.MorphBlock; +import mineplex.core.gadget.gadgets.MorphBunny; +import mineplex.core.gadget.gadgets.MorphChicken; +import mineplex.core.gadget.gadgets.MorphCow; +import mineplex.core.gadget.gadgets.MorphCreeper; +import mineplex.core.gadget.gadgets.MorphEnderman; +import mineplex.core.gadget.gadgets.MorphPig; +import mineplex.core.gadget.gadgets.MorphPumpkinKing; +import mineplex.core.gadget.gadgets.MorphSlime; +import mineplex.core.gadget.gadgets.MorphTitan; +import mineplex.core.gadget.gadgets.MorphVillager; +import mineplex.core.gadget.gadgets.MorphWither; +import mineplex.core.gadget.gadgets.OutfitRaveSuit; +import mineplex.core.gadget.gadgets.OutfitSpaceSuit; +import mineplex.core.gadget.gadgets.OutfitTeam; +import mineplex.core.gadget.gadgets.ParticleBlizzard; +import mineplex.core.gadget.gadgets.ParticleEnchant; +import mineplex.core.gadget.gadgets.ParticleFairy; +import mineplex.core.gadget.gadgets.ParticleFireRings; +import mineplex.core.gadget.gadgets.ParticleFoot; +import mineplex.core.gadget.gadgets.ParticleGreen; +import mineplex.core.gadget.gadgets.ParticleHeart; +import mineplex.core.gadget.gadgets.ParticleHelix; +import mineplex.core.gadget.gadgets.ParticleLegend; +import mineplex.core.gadget.gadgets.ParticleRain; +import mineplex.core.gadget.gadgets.ParticleTitan; import mineplex.core.gadget.types.Gadget; import mineplex.core.gadget.types.GadgetType; import mineplex.core.gadget.types.ItemGadget; @@ -43,6 +67,19 @@ import mineplex.core.pet.PetManager; import mineplex.core.preferences.PreferencesManager; import mineplex.core.projectile.ProjectileManager; +import org.bukkit.Bukkit; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.entity.PlayerDeathEvent; +import org.bukkit.event.player.PlayerJoinEvent; +import org.bukkit.event.player.PlayerMoveEvent; +import org.bukkit.event.player.PlayerQuitEvent; +import org.bukkit.event.player.PlayerToggleSneakEvent; +import org.bukkit.plugin.java.JavaPlugin; + public class GadgetManager extends MiniPlugin { private CoreClientManager _clientManager; @@ -128,6 +165,7 @@ public class GadgetManager extends MiniPlugin addGadget(new MorphWither(this)); addGadget(new MorphBunny(this)); addGadget(new MorphSlime(this, _achievementManager)); + addGadget(new MorphTitan(this)); // Particles addGadget(new ParticleFoot(this)); @@ -140,6 +178,8 @@ public class GadgetManager extends MiniPlugin addGadget(new ParticleFairy(this)); addGadget(new ParticleLegend(this)); addGadget(new ParticleBlizzard(this)); + addGadget(new ParticleTitan(this)); + //addGadget(new ParticleKronos(this)); // Music addGadget(new MusicGadget(this, "13 Disc", new String[] {""}, -2, 2256, 178000)); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ItemFirework.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ItemFirework.java index 477f140e5..80a89bb76 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ItemFirework.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ItemFirework.java @@ -16,6 +16,7 @@ import mineplex.core.common.util.UtilFirework; import mineplex.core.common.util.UtilPlayer; import mineplex.core.gadget.GadgetManager; import mineplex.core.gadget.types.ItemGadget; +import mineplex.core.recharge.Recharge; public class ItemFirework extends ItemGadget { @@ -29,7 +30,7 @@ public class ItemFirework extends ItemGadget }, -1, Material.FIREWORK, (byte)0, - 100, new Ammo("Fireworks", "50 Fireworks", Material.FIREWORK, (byte)0, new String[] { C.cWhite + "50 Fireworks for you to launch!" }, 500, 50)); + 250, new Ammo("Fireworks", "50 Fireworks", Material.FIREWORK, (byte)0, new String[] { C.cWhite + "50 Fireworks for you to launch!" }, 500, 50)); } @Override diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ItemGemBomb.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ItemGemBomb.java index 0bc53e215..0c2e75b77 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ItemGemBomb.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ItemGemBomb.java @@ -116,7 +116,7 @@ public class ItemGemBomb extends ItemGadget } //Use Stock/Gems - Manager.getInventoryManager().addItemToInventory(player, getGadgetType().name(), GetName(), -1); + Manager.getInventoryManager().addItemToInventory(player, GetName(), -1); Manager.getDonationManager().RewardGems(null, GetName(), event.getPlayer().getName(), event.getPlayer().getUniqueId(), -2000); player.getInventory().setItem(Manager.getActiveItemSlot(), ItemStackFactory.Instance.CreateStack(GetDisplayMaterial(), GetDisplayData(), 1, F.item(GetName()))); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ItemTNT.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ItemTNT.java index 383b46e24..91ac32a93 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ItemTNT.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ItemTNT.java @@ -14,7 +14,11 @@ import mineplex.core.common.util.C; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilParticle; import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilParticle.ParticleType; +import mineplex.core.common.util.UtilParticle.ViewDist; import mineplex.core.gadget.GadgetManager; import mineplex.core.gadget.types.ItemGadget; import mineplex.core.updater.UpdateType; @@ -40,6 +44,7 @@ public class ItemTNT extends ItemGadget public void ActivateCustom(Player player) { TNTPrimed tnt = player.getWorld().spawn(player.getEyeLocation().add(player.getLocation().getDirection()), TNTPrimed.class); + tnt.setYield(0.0F); // Added in order to prevent water from being evaporated. UtilAction.velocity(tnt, player.getLocation().getDirection(), 0.6, false, 0, 0.2, 1, false); _tnt.add(tnt); @@ -58,7 +63,7 @@ public class ItemTNT extends ItemGadget HashMap players = UtilPlayer.getInRadius(event.getLocation(), 10); for (Player player : players.keySet()) - { + { if (Manager.collideEvent(this, player)) continue; @@ -67,6 +72,9 @@ public class ItemTNT extends ItemGadget //Knockback UtilAction.velocity(player, UtilAlg.getTrajectory(event.getLocation(), player.getLocation()), 3 * mult, false, 0, 0.5 + 2 * mult, 10, true); } + + // Simulating explosion to prevent water from being evaporated. + UtilParticle.PlayParticle(ParticleType.HUGE_EXPLOSION, event.getLocation(), 0, 0, 0, 0, 1, ViewDist.NORMAL, UtilServer.getPlayers()); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphTitan.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphTitan.java new file mode 100644 index 000000000..26d1bd925 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphTitan.java @@ -0,0 +1,35 @@ +package mineplex.core.gadget.gadgets; + +import org.bukkit.Material; +import org.bukkit.entity.Player; + +import mineplex.core.common.util.C; +import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.types.MorphGadget; + +public class MorphTitan extends MorphGadget +{ + public MorphTitan(GadgetManager manager) + { + super(manager, "Titanic Morph", new String[] + { + C.cWhite + "Coming Soon...", + " ", + C.cRed + "Unlocked with Titan Rank", + }, + -1, + Material.INK_SACK, (byte)8); + } + + @Override + public void EnableCustom(Player player) + { + + } + + @Override + public void DisableCustom(Player player) + { + + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphWither.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphWither.java index d7e4ba8dc..602868005 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphWither.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphWither.java @@ -4,36 +4,38 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; -import org.bukkit.GameMode; -import org.bukkit.Material; -import org.bukkit.Sound; -import org.bukkit.entity.Player; -import org.bukkit.entity.WitherSkull; -import org.bukkit.event.EventHandler; -import org.bukkit.event.entity.EntityExplodeEvent; -import org.bukkit.event.player.PlayerInteractEvent; -import org.bukkit.event.player.PlayerJoinEvent; -import org.bukkit.util.Vector; - import mineplex.core.common.Rank; import mineplex.core.common.util.C; import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilAlg; import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilEvent; -import mineplex.core.common.util.UtilParticle; -import mineplex.core.common.util.UtilPlayer; -import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilEvent.ActionType; +import mineplex.core.common.util.UtilParticle; import mineplex.core.common.util.UtilParticle.ParticleType; import mineplex.core.common.util.UtilParticle.ViewDist; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; import mineplex.core.disguise.disguises.DisguiseBase; import mineplex.core.disguise.disguises.DisguiseWither; +import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.types.MorphGadget; +import mineplex.core.inventory.ClientItem; +import mineplex.core.inventory.data.Item; import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; -import mineplex.core.gadget.GadgetManager; -import mineplex.core.gadget.types.MorphGadget; + +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.Player; +import org.bukkit.entity.WitherSkull; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.entity.EntityExplodeEvent; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.event.player.PlayerJoinEvent; +import org.bukkit.util.Vector; public class MorphWither extends MorphGadget { @@ -107,7 +109,7 @@ public class MorphWither extends MorphGadget player.getWorld().playSound(player.getLocation(), Sound.WITHER_SHOOT, 0.5f, 1f); } - @EventHandler + @EventHandler(priority = EventPriority.LOWEST) public void explode(EntityExplodeEvent event) { if (!_skulls.contains(event.getEntity())) @@ -115,6 +117,8 @@ public class MorphWither extends MorphGadget event.setCancelled(true); + event.getEntity().remove(); + WitherSkull skull = (WitherSkull)event.getEntity(); UtilParticle.PlayParticle(ParticleType.LARGE_EXPLODE, skull.getLocation(), 0, 0, 0, 0, 1, @@ -177,10 +181,11 @@ public class MorphWither extends MorphGadget @EventHandler public void legendOwner(PlayerJoinEvent event) { + // TODO HARDCODED Wither Morph Database Item Id - 550 if (Manager.getClientManager().Get(event.getPlayer()).GetRank().has(Rank.LEGEND)) { - Manager.getDonationManager().Get(event.getPlayer().getName()).AddUnknownSalesPackagesOwned(GetName()); - } + Manager.getInventoryManager().Get(event.getPlayer().getName()).addItem(new ClientItem(new Item(550, GetName()), 1)); + } } public void setWitherData(String text, double healthPercent) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ParticleKronos.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ParticleKronos.java new file mode 100644 index 000000000..dd74addb9 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ParticleKronos.java @@ -0,0 +1,87 @@ +package mineplex.core.gadget.gadgets; + +import java.util.HashMap; + +import mineplex.core.common.Rank; +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.types.ParticleGadget; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; + +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.player.PlayerJoinEvent; +import org.bukkit.event.player.PlayerQuitEvent; + +public class ParticleKronos extends ParticleGadget +{ + private HashMap _glass = new HashMap(); + + public ParticleKronos(GadgetManager manager) + { + super(manager, "Titanic Aura", new String[] + { + C.cWhite + "A symbol of Titan power", + C.cWhite + "whos ancestry traces back to Kronos,", + C.cWhite + "Titan Lord of Time.", + " ", + C.cRed + "???" + //When purchasable: C.cRed + "Unlocked with Titan Rank" + }, + -2, + Material.EYE_OF_ENDER, (byte)0); + } + + @EventHandler + public void playParticle(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + for (Player player : GetActive()) + { + if (!shouldDisplay(player)) + continue; + + //Create + if (!_glass.containsKey(player)) + _glass.put(player, new ParticleKronosData(player)); + + _glass.get(player).update(Manager.isMoving(player)); + } + } + + @EventHandler + public void titanOwner(PlayerJoinEvent event) + { + /*Until it becomes purchasable*/if (Manager.getClientManager().Get(event.getPlayer()).GetRank().equals(Rank.TITAN)) + //if (Manager.getClientManager().Get(event.getPlayer()).GetRank().has(Rank.TITAN)) + { + Manager.getDonationManager().Get(event.getPlayer().getName()).AddUnknownSalesPackagesOwned(GetName()); + } + } + + @Override + public void DisableCustom(Player player) + { + if (_active.remove(player)) + UtilPlayer.message(player, F.main("Gadget", "You unsummoned " + F.elem(GetName()) + ".")); + + clean(player); + } + + @EventHandler + public void quit(PlayerQuitEvent event) + { + clean(event.getPlayer()); + } + + private void clean(Player player) + { + _glass.remove(player); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ParticleKronosData.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ParticleKronosData.java new file mode 100644 index 000000000..5d78b2b3d --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ParticleKronosData.java @@ -0,0 +1,112 @@ +package mineplex.core.gadget.gadgets; + +import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilParticle.ParticleType; +import mineplex.core.common.util.UtilParticle.ViewDist; +import mineplex.core.common.util.UtilServer; + +import org.bukkit.Location; +import org.bukkit.Sound; +import org.bukkit.entity.Player; +import org.bukkit.util.Vector; + +public class ParticleKronosData +{ + private static class Sin + { + static final float[] table = new float[16384]; + + static + { + for (int i = 0; i < 16384; i++) + { + table[i] = ((float)Math.sin((i + 0.5F) / 16384.0F * 6.283186F)); + } + for (int i = 0; i < 360; i += 90) + { + table[((int)(i * 45.511112F) & 0x3FFF)] = ((float)Math.sin(i * 0.01745329F)); + } + } + } + + private int _step; + private Player _player; + + public ParticleKronosData(Player player) + { + _player = player; + } + + public void update(boolean moving) + { + if (moving) + UtilParticle.PlayParticle(ParticleType.ENCHANTMENT_TABLE, _player.getLocation().add(0, 1f, 0), 0.2f, 0.2f, 0.2f, 0, 1, + ViewDist.NORMAL, UtilServer.getPlayers()); + else + { + Vector v = new Vector(); + Location loc = _player.getLocation().clone(); + for (int i = 0; i < 8; i++) + { + _step += 1; + + float f1 = 3.141593F / 120 * _step; + float f2 = sinFloat(f1 * 2.718282F * 8 / 120) * 1F; + float f3 = f2 * 3.141593F * f1; + + v.setX(1F * f2 * -cosFloat(f3)); + v.setZ(1F * f2 * -sinFloat(f3)); + v.setY(0.6F * f2 + 0.6F + 2.0F); + + rotateVector(v, 0, 0, 0); + + UtilParticle.PlayParticle(ParticleType.ENCHANTMENT_TABLE, loc.add(v), 0, 0, 0, 0, 1, + ViewDist.NORMAL, UtilServer.getPlayers()); + + loc.subtract(v); + } + + //Sound + _player.getWorld().playSound(_player.getLocation(), Sound.CAT_HISS, 0.2f, 1f); + } + } + + private void rotateVector(Vector vector, double x, double y, double z) + { + double cos; + double sin; + double new1; + double new2; + + //x-axis + cos = Math.cos(x); + sin = Math.sin(x); + new1 = vector.getY() * cos - vector.getZ() * sin; + new2 = vector.getY() * sin + vector.getZ() * cos; + vector.setY(new1).setZ(new2); + + //y-axis + cos = Math.cos(y); + sin = Math.sin(y); + new1 = vector.getX() * cos - vector.getZ() * sin; + new2 = vector.getX() * sin + vector.getZ() * cos; + vector.setX(new1).setZ(new2); + + //z-axis + cos = Math.cos(z); + sin = Math.sin(z); + new1 = vector.getX() * cos - vector.getY() * sin; + new2 = vector.getX() * sin + vector.getY() * cos; + vector.setX(new1).setY(new2); + } + + private float sinFloat(float f) + { + return Sin.table[((int)(f * 2607.5945F) & 0x3FFF)]; + } + + private float cosFloat(float f) + { + return Sin.table[((int)((f + 1.570796F) * 2607.5945F) & 0x3FFF)]; + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ParticleLegend.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ParticleLegend.java index 7be1a9609..ac5c3aaa8 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ParticleLegend.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ParticleLegend.java @@ -9,6 +9,8 @@ import org.bukkit.event.player.PlayerJoinEvent; import mineplex.core.common.Rank; import mineplex.core.common.util.C; import mineplex.core.gadget.types.ParticleGadget; +import mineplex.core.inventory.ClientItem; +import mineplex.core.inventory.data.Item; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.core.gadget.GadgetManager; @@ -46,9 +48,10 @@ public class ParticleLegend extends ParticleGadget @EventHandler public void legendOwner(PlayerJoinEvent event) { + // TODO HARDCODED Legendary Aura Database Item Id - 552 if (Manager.getClientManager().Get(event.getPlayer()).GetRank().has(Rank.LEGEND)) { - Manager.getDonationManager().Get(event.getPlayer().getName()).AddUnknownSalesPackagesOwned(GetName()); - } + Manager.getInventoryManager().Get(event.getPlayer().getName()).addItem(new ClientItem(new Item(552, GetName()), 1)); + } } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ParticleTitan.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ParticleTitan.java new file mode 100644 index 000000000..e9f3c8022 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ParticleTitan.java @@ -0,0 +1,22 @@ +package mineplex.core.gadget.gadgets; + +import org.bukkit.Material; + +import mineplex.core.common.util.C; +import mineplex.core.gadget.types.ParticleGadget; +import mineplex.core.gadget.GadgetManager; + +public class ParticleTitan extends ParticleGadget +{ + public ParticleTitan(GadgetManager manager) + { + super(manager, "Titanic Particle", new String[] + { + C.cWhite + "Coming Soon...", + " ", + C.cRed + "Unlocked with Titan Rank", + }, + -1, + Material.INK_SACK, (byte)8); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/ItemGadget.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/ItemGadget.java index 9ce8dfa8c..441f04535 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/ItemGadget.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/ItemGadget.java @@ -159,7 +159,7 @@ public abstract class ItemGadget extends Gadget return; } - Manager.getInventoryManager().addItemToInventory(player, getGadgetType().name(), GetName(), -1); + Manager.getInventoryManager().addItemToInventory(player, GetName(), -1); player.getInventory().setItem(Manager.getActiveItemSlot(), ItemStackFactory.Instance.CreateStack(GetDisplayMaterial(), GetDisplayData(), 1, F.item(Manager.getInventoryManager().Get(player).getItemCount(GetName()) + " " + GetName()))); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/game/GameDisplay.java b/Plugins/Mineplex.Core/src/mineplex/core/game/GameDisplay.java index 37d826e6c..652b7cfdb 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/game/GameDisplay.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/game/GameDisplay.java @@ -63,6 +63,7 @@ public enum GameDisplay Cards("Craft Against Humanity", Material.MAP, (byte)0, GameCategory.CLASSICS, 51), Skywars("Skywars", Material.FEATHER, (byte) 0, GameCategory.SURVIVAL, 52), SkywarsTeams("Skywars Teams", "Skywars", Material.FEATHER, (byte)0, GameCategory.TEAM_VARIANT, 53), + MonsterMaze("Monster Maze", Material.ROTTEN_FLESH, (byte)0, GameCategory.ARCADE, 55), Lobbers("Bomb Lobbers", Material.FIREBALL, (byte) 0, GameCategory.ARCADE, 54), diff --git a/Plugins/Mineplex.Core/src/mineplex/core/globalpacket/GlobalPacketManager.java b/Plugins/Mineplex.Core/src/mineplex/core/globalpacket/GlobalPacketManager.java new file mode 100644 index 000000000..1329e1045 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/globalpacket/GlobalPacketManager.java @@ -0,0 +1,61 @@ +package mineplex.core.globalpacket; + +import java.util.Arrays; +import java.util.UUID; + +import org.bukkit.entity.Player; +import org.bukkit.plugin.java.JavaPlugin; + +import mineplex.core.MiniPlugin; +import mineplex.core.account.CoreClientManager; +import mineplex.core.common.Rank; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.globalpacket.command.GlobalPacketCommand; +import mineplex.core.globalpacket.redis.GlobalPacketHandler; +import mineplex.core.globalpacket.redis.GlobalPacketMessage; +import mineplex.core.status.ServerStatusManager; +import mineplex.serverdata.commands.ServerCommandManager; + +public class GlobalPacketManager extends MiniPlugin +{ + private CoreClientManager _clientManager; + private ServerStatusManager _statusManager; + + public GlobalPacketManager(JavaPlugin plugin, CoreClientManager clientManager, ServerStatusManager statusManager) + { + super("Global Packet Manager", plugin); + + _clientManager = clientManager; + _statusManager = statusManager; + + ServerCommandManager.getInstance().registerCommandType("GlobalPacketMessage", GlobalPacketMessage.class, new GlobalPacketHandler(statusManager)); + } + + public void callGlobalCommand(Player caller, String[] args) + { + String callerName = null; + UUID callerUUID = null; + Rank callerRank = null; + + if (caller != null) + { + callerName = caller.getName(); + callerUUID = caller.getUniqueId(); + callerRank = _clientManager.Get(caller).GetRank(); + + UtilPlayer.message(caller, F.main("Global", "Sending Global Command with Arguments;")); + UtilPlayer.message(caller, F.main("Global", F.elem(Arrays.toString(args)))); + UtilPlayer.message(caller, F.main("Global", "Please be patient for a response.")); + } + + GlobalPacketMessage message = new GlobalPacketMessage(callerName, callerUUID, callerRank, _statusManager.getCurrentServerName(), args); + message.publish(); + } + + @Override + public void addCommands() + { + addCommand(new GlobalPacketCommand(this)); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/globalpacket/command/GlobalPacketCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/globalpacket/command/GlobalPacketCommand.java new file mode 100644 index 000000000..d30163fe7 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/globalpacket/command/GlobalPacketCommand.java @@ -0,0 +1,30 @@ +package mineplex.core.globalpacket.command; + +import org.bukkit.entity.Player; + +import mineplex.core.command.CommandBase; +import mineplex.core.common.Rank; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.globalpacket.GlobalPacketManager; + +public class GlobalPacketCommand extends CommandBase +{ + public GlobalPacketCommand(GlobalPacketManager plugin) + { + super(plugin, Rank.ADMIN, "globalpacket"); + } + + @Override + public void Execute(Player caller, String[] args) + { + if (args == null || args.length < 1) + { + UtilPlayer.message(caller, F.main("Global", "Please call the globalpacket command with at least 1 argument")); + UtilPlayer.message(caller, F.main("Global", "For help please see /globalpacket google doc")); + return; + } + + Plugin.callGlobalCommand(caller, args); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/globalpacket/event/GlobalPacketEvent.java b/Plugins/Mineplex.Core/src/mineplex/core/globalpacket/event/GlobalPacketEvent.java new file mode 100644 index 000000000..ba4c63fe5 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/globalpacket/event/GlobalPacketEvent.java @@ -0,0 +1,83 @@ +package mineplex.core.globalpacket.event; + +import java.util.UUID; + +import org.bukkit.entity.Player; +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; + +import mineplex.core.common.Rank; + +public class GlobalPacketEvent extends Event +{ + private Player _caller; + private String _callerName; + private UUID _callerUUID; + private Rank _callerRank; + private String _sourceServer; + private String[] _parts; + + public GlobalPacketEvent(Player caller, String callerName, UUID callerUUID, Rank callerRank, String sourceServer, String[] parts) + { + _caller = caller; + _callerName = callerName; + _callerUUID = callerUUID; + _callerRank = callerRank; + _sourceServer = sourceServer; + _parts = parts; + } + + /** + * The player that executed this global command. + * This player will be NULL when called on the servers that aren't _sourceServer + */ + public Player getCaller() + { + return _caller; + } + + /** + * The player name of the player that called the command + */ + public String getCallerName() + { + return _callerName; + } + + /** + * The UUID of the player that called the command + */ + public UUID getCallerUUID() + { + return _callerUUID; + } + + /** + * Get the rank of the player that called this global command + */ + public Rank getCallerRank() + { + return _callerRank; + } + + /** + * The server name that this global command came from + */ + public String getSourceServer() + { + return _sourceServer; + } + + /** + * Get the unprocessed parts of this command + */ + public String[] getParts() + { + return _parts; + } + + // Bukkit event stuff + private static final HandlerList handlers = new HandlerList(); + public static HandlerList getHandlerList() { return handlers; } + public HandlerList getHandlers() { return handlers; } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/globalpacket/redis/GlobalPacketHandler.java b/Plugins/Mineplex.Core/src/mineplex/core/globalpacket/redis/GlobalPacketHandler.java new file mode 100644 index 000000000..c3a141231 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/globalpacket/redis/GlobalPacketHandler.java @@ -0,0 +1,39 @@ +package mineplex.core.globalpacket.redis; + +import org.bukkit.entity.Player; + +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.globalpacket.event.GlobalPacketEvent; +import mineplex.core.status.ServerStatusManager; +import mineplex.serverdata.commands.CommandCallback; +import mineplex.serverdata.commands.ServerCommand; + +public class GlobalPacketHandler implements CommandCallback +{ + private ServerStatusManager _serverStatus; + + public GlobalPacketHandler(ServerStatusManager serverStatus) + { + _serverStatus = serverStatus; + } + + @Override + public void run(ServerCommand command) + { + if (command instanceof GlobalPacketMessage) + { + GlobalPacketMessage packetMessage = ((GlobalPacketMessage) command); + + Player caller = null; + if (packetMessage.getSourceServer() != null && packetMessage.getSourceServer().equals(_serverStatus.getCurrentServerName())) + { + caller = UtilPlayer.searchExact(packetMessage.getCallerUUID()); + } + + GlobalPacketEvent event = new GlobalPacketEvent(caller, packetMessage.getCallerName(), packetMessage.getCallerUUID(), + packetMessage.getCallerRank(), packetMessage.getSourceServer(), packetMessage.getParts()); + UtilServer.getServer().getPluginManager().callEvent(event); + } + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/globalpacket/redis/GlobalPacketMessage.java b/Plugins/Mineplex.Core/src/mineplex/core/globalpacket/redis/GlobalPacketMessage.java new file mode 100644 index 000000000..2138942a5 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/globalpacket/redis/GlobalPacketMessage.java @@ -0,0 +1,50 @@ +package mineplex.core.globalpacket.redis; + +import java.util.UUID; + +import mineplex.core.common.Rank; +import mineplex.serverdata.commands.ServerCommand; + +public class GlobalPacketMessage extends ServerCommand +{ + private String _callerName; + private UUID _callerUUID; + private Rank _callerRank; + private String _sourceServer; + private String[] _parts; + + public GlobalPacketMessage(String callerName, UUID callerUUID, Rank callerRank, String sourceServer, String[] parts) + { + _callerName = callerName; + _callerUUID = callerUUID; + _callerRank = callerRank; + _sourceServer = sourceServer; + _parts = parts; + } + + public String getCallerName() + { + return _callerName; + } + + public UUID getCallerUUID() + { + return _callerUUID; + } + + public Rank getCallerRank() + { + return _callerRank; + } + + public String getSourceServer() + { + return _sourceServer; + } + + public String[] getParts() + { + return _parts; + } +} + diff --git a/Plugins/Mineplex.Core/src/mineplex/core/inventory/InventoryManager.java b/Plugins/Mineplex.Core/src/mineplex/core/inventory/InventoryManager.java index 8117ceeed..2560f2891 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/inventory/InventoryManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/inventory/InventoryManager.java @@ -16,7 +16,6 @@ import mineplex.core.account.CoreClientManager; import mineplex.core.common.util.Callback; import mineplex.core.common.util.NautHashMap; import mineplex.core.inventory.command.GiveItemCommand; -import mineplex.core.inventory.data.Category; import mineplex.core.inventory.data.InventoryRepository; import mineplex.core.inventory.data.Item; import mineplex.core.updater.UpdateType; @@ -30,9 +29,9 @@ public class InventoryManager extends MiniDbClientPlugin private InventoryRepository _repository; private NautHashMap _items = new NautHashMap(); - private NautHashMap _categories = new NautHashMap(); + private NautHashMap _itemIdNameMap = new NautHashMap(); - private NautHashMap>> _inventoryQueue = new NautHashMap>>(); + private NautHashMap> _inventoryQueue = new NautHashMap>(); public InventoryManager(JavaPlugin plugin, CoreClientManager clientManager) { @@ -45,7 +44,6 @@ public class InventoryManager extends MiniDbClientPlugin public void run() { updateItems(); - updateCategories(); } }, 20L); } @@ -59,24 +57,12 @@ public class InventoryManager extends MiniDbClientPlugin for (Item item : items) { _items.put(item.Name, item); + _itemIdNameMap.put(item.Id, item.Name); } } } - private void updateCategories() - { - List categories = _repository.retrieveCategories(); - - synchronized (_inventoryLock) - { - for (Category category : categories) - { - _categories.put(category.Name, category); - } - } - } - - public void addItemToInventory(final Player player, String category, final String item, final int count) + public void addItemToInventory(final Player player, final String item, final int count) { if (_items.containsKey(item)) { @@ -84,20 +70,17 @@ public class InventoryManager extends MiniDbClientPlugin } if (!_inventoryQueue.containsKey(player)) - _inventoryQueue.put(player, new NautHashMap>()); - - if (!_inventoryQueue.get(player).containsKey(category)) - _inventoryQueue.get(player).put(category, new NautHashMap()); - + _inventoryQueue.put(player, new NautHashMap()); + int totalAmount = count; - if (_inventoryQueue.get(player).get(category).containsKey(item)) - totalAmount += _inventoryQueue.get(player).get(category).get(item); + if (_inventoryQueue.get(player).containsKey(item)) + totalAmount += _inventoryQueue.get(player).get(item); - _inventoryQueue.get(player).get(category).put(item, totalAmount); + _inventoryQueue.get(player).put(item, totalAmount); } - public void addItemToInventory(final Callback callback, final Player player, String category, final String item, final int count) + public void addItemToInventory(final Callback callback, final Player player, final String item, final int count) { addItemToInventoryForOffline(new Callback() { @@ -106,26 +89,12 @@ public class InventoryManager extends MiniDbClientPlugin if (!success) { System.out.println("Add item to Inventory FAILED for " + player.getName()); - - if (_items.containsKey(item)) - { - Get(player).addItem(new ClientItem(_items.get(item), -count)); - } } if (callback != null) callback.run(success); } - }, player.getUniqueId(), category, item, count); - - } - - public boolean validCategory(String category) - { - synchronized (_inventoryLock) - { - return _categories.containsKey(category); - } + }, player.getUniqueId(), item, count); } public boolean validItem(String item) @@ -151,28 +120,17 @@ public class InventoryManager extends MiniDbClientPlugin return item; } - public void addItemToInventoryForOffline(final Callback callback, final UUID uuid, final String category, final String item, final int count) + public void addItemToInventoryForOffline(final Callback callback, final UUID uuid, final String item, final int count) { Bukkit.getServer().getScheduler().runTaskAsynchronously(getPlugin(), new Runnable() { public void run() { - synchronized (_inventoryLock) - { - if (!_categories.containsKey(category)) - { - _repository.addCategory(category); - System.out.println("InventoryManager Adding Category : " + category); - } - } - - updateCategories(); - synchronized (_inventoryLock) { if (!_items.containsKey(item)) { - _repository.addItem(item, _categories.get(category).Id); + _repository.addItem(item); System.out.println("InventoryManager Adding Item : " + item); } } @@ -206,28 +164,25 @@ public class InventoryManager extends MiniDbClientPlugin for (final Player player : _inventoryQueue.keySet()) { - for (final String category : _inventoryQueue.get(player).keySet()) + for (final String item : _inventoryQueue.get(player).keySet()) { - for (final String item : _inventoryQueue.get(player).get(category).keySet()) - { - final int count = _inventoryQueue.get(player).get(category).get(item); + final int count = _inventoryQueue.get(player).get(item); - addItemToInventoryForOffline(new Callback() + addItemToInventoryForOffline(new Callback() + { + public void run(Boolean success) { - public void run(Boolean success) + if (!success) { - if (!success) + System.out.println("Add item to Inventory FAILED for " + player); + + if (_items.containsKey(item)) { - System.out.println("Add item to Inventory FAILED for " + player); - - if (_items.containsKey(item)) - { - Get(player).addItem(new ClientItem(_items.get(item), -count)); - } + Get(player).addItem(new ClientItem(_items.get(item), -count)); } } - }, player.getUniqueId(), category, item, count); - } + } + }, player.getUniqueId(), item, count); } //Clean @@ -254,12 +209,12 @@ public class InventoryManager extends MiniDbClientPlugin @Override public void processLoginResultSet(String playerName, int accountId, ResultSet resultSet) throws SQLException { - Set(playerName, _repository.loadClientInformation(resultSet)); + Set(playerName, _repository.loadClientInformation(resultSet, _itemIdNameMap)); } @Override public String getQuery(int accountId, String uuid, String name) { - return "SELECT items.name, ic.name as category, count FROM accountInventory AS ai INNER JOIN items ON items.id = ai.itemId INNER JOIN itemCategories AS ic ON ic.id = items.categoryId WHERE ai.accountId = '" + accountId + "';"; + return "SELECT ai.itemId, count FROM accountInventory AS ai WHERE ai.accountId = '" + accountId + "';"; } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/inventory/command/GiveItemCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/inventory/command/GiveItemCommand.java index 006688a96..ce6804e86 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/inventory/command/GiveItemCommand.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/inventory/command/GiveItemCommand.java @@ -4,19 +4,14 @@ import java.util.UUID; import org.bukkit.entity.Player; -import mineplex.core.account.CoreClient; 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.UUIDFetcher; import mineplex.core.common.util.UtilPlayer; import mineplex.core.inventory.InventoryManager; import mineplex.core.inventory.data.Item; -/** - * Created by Shaun on 10/26/2014. - */ public class GiveItemCommand extends CommandBase { public GiveItemCommand(InventoryManager plugin) @@ -54,7 +49,7 @@ public class GiveItemCommand extends CommandBase } else if (player != null) { - Plugin.addItemToInventory(player, item.Category, item.Name, amount); + Plugin.addItemToInventory(player, item.Name, amount); UtilPlayer.message(caller, F.main("Item", "You gave " + F.elem(amount + " " + itemName) + " to player " + F.name(playerName))); UtilPlayer.message(player, F.main("Item", F.name(caller.getName()) + " gave you " + F.elem(amount + " " + itemName))); } @@ -74,7 +69,7 @@ public class GiveItemCommand extends CommandBase { UtilPlayer.message(caller, F.main("Item", "You gave " + F.elem(amount + " " + itemName) + " to offline player " + F.name(playerName))); } - }, uuid, item.Category, item.Name, amount); + }, uuid, item.Name, amount); } else { diff --git a/Plugins/Mineplex.Core/src/mineplex/core/inventory/data/InventoryRepository.java b/Plugins/Mineplex.Core/src/mineplex/core/inventory/data/InventoryRepository.java index 95837a935..a21d6c9ec 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/inventory/data/InventoryRepository.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/inventory/data/InventoryRepository.java @@ -7,6 +7,7 @@ import java.util.List; import org.bukkit.plugin.java.JavaPlugin; +import mineplex.core.common.util.NautHashMap; import mineplex.core.database.DBPool; import mineplex.core.database.RepositoryBase; import mineplex.core.database.ResultSetCallable; @@ -17,16 +18,12 @@ import mineplex.core.inventory.ClientItem; public class InventoryRepository extends RepositoryBase { - private static String CREATE_INVENTORY_TABLE = "CREATE TABLE IF NOT EXISTS items (id INT NOT NULL AUTO_INCREMENT, name VARCHAR(100), categoryId INT, rarity INT, PRIMARY KEY (id), FOREIGN KEY (categoryId) REFERENCES itemCategories(id), UNIQUE INDEX uniqueNameCategoryIndex (name, categoryId));"; - private static String CREATE_INVENTORY_CATEGORY_TABLE = "CREATE TABLE IF NOT EXISTS itemCategories (id INT NOT NULL AUTO_INCREMENT, name VARCHAR(100), PRIMARY KEY (id), UNIQUE INDEX nameIndex (name));"; + private static String CREATE_INVENTORY_TABLE = "CREATE TABLE IF NOT EXISTS items (id INT NOT NULL AUTO_INCREMENT, name VARCHAR(100), rarity INT, PRIMARY KEY (id), INDEX mameIndex (name));"; private static String CREATE_INVENTORY_RELATION_TABLE = "CREATE TABLE IF NOT EXISTS accountInventory (id INT NOT NULL AUTO_INCREMENT, accountId INT NOT NULL, itemId INT NOT NULL, count INT NOT NULL, PRIMARY KEY (id), FOREIGN KEY (accountId) REFERENCES accounts(id), FOREIGN KEY (itemId) REFERENCES items(id), UNIQUE INDEX accountItemIndex (accountId, itemId));"; - private static String INSERT_ITEM = "INSERT INTO items (name, categoryId) VALUES (?, ?);"; - private static String RETRIEVE_ITEMS = "SELECT items.id, items.name, itemCategories.name FROM items INNER JOIN itemCategories ON itemCategories.id = items.categoryId;"; - - private static String INSERT_CATEGORY = "INSERT INTO itemCategories (name) VALUES (?);"; - private static String RETRIEVE_CATEGORIES = "SELECT id, name FROM itemCategories;"; - + private static String INSERT_ITEM = "INSERT INTO items (name) VALUES (?);"; + private static String RETRIEVE_ITEMS = "SELECT items.id, items.name FROM items;"; + private static String INSERT_CLIENT_INVENTORY = "INSERT INTO accountInventory (accountId, itemId, count) VALUES (?, ?, ?) ON DUPLICATE KEY UPDATE count=count + VALUES(count);"; private static String UPDATE_CLIENT_INVENTORY = "UPDATE accountInventory SET count = count + ? WHERE accountId = ? AND itemId = ?;"; @@ -39,7 +36,6 @@ public class InventoryRepository extends RepositoryBase protected void initialize() { /* - executeUpdate(CREATE_INVENTORY_CATEGORY_TABLE); executeUpdate(CREATE_INVENTORY_TABLE); executeUpdate(CREATE_INVENTORY_RELATION_TABLE); */ @@ -49,33 +45,10 @@ public class InventoryRepository extends RepositoryBase protected void update() { } - - public List retrieveCategories() - { - final List categories = new ArrayList(); - - executeQuery(RETRIEVE_CATEGORIES, new ResultSetCallable() - { - public void processResultSet(ResultSet resultSet) throws SQLException - { - while (resultSet.next()) - { - categories.add(new Category(resultSet.getInt(1), resultSet.getString(2))); - } - } - }); - - return categories; - } - public void addItem(String name, int categoryId) + public void addItem(String name) { - executeUpdate(INSERT_ITEM, new ColumnVarChar("name", 100, name), new ColumnInt("categoryId", categoryId)); - } - - public void addCategory(String name) - { - executeUpdate(INSERT_CATEGORY, new ColumnVarChar("name", 100, name)); + executeUpdate(INSERT_ITEM, new ColumnVarChar("name", 100, name)); } public List retrieveItems() @@ -88,7 +61,7 @@ public class InventoryRepository extends RepositoryBase { while (resultSet.next()) { - items.add(new Item(resultSet.getInt(1), resultSet.getString(2), resultSet.getString(3))); + items.add(new Item(resultSet.getInt(1), resultSet.getString(2))); } } }); @@ -108,13 +81,13 @@ public class InventoryRepository extends RepositoryBase return true; } - public ClientInventory loadClientInformation(ResultSet resultSet) throws SQLException + public ClientInventory loadClientInformation(ResultSet resultSet, NautHashMap itemIdMap) throws SQLException { final ClientInventory clientInventory = new ClientInventory(); while (resultSet.next()) { - clientInventory.addItem(new ClientItem(new Item(resultSet.getString(1), resultSet.getString(2)), resultSet.getInt(3))); + clientInventory.addItem(new ClientItem(new Item(resultSet.getInt(1), itemIdMap.get(resultSet.getInt(1))), resultSet.getInt(2))); } return clientInventory; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/inventory/data/Item.java b/Plugins/Mineplex.Core/src/mineplex/core/inventory/data/Item.java index 5f4b3efdb..7b4c4db31 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/inventory/data/Item.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/inventory/data/Item.java @@ -4,17 +4,11 @@ public class Item { public int Id; public String Name; - public String Category; - public Item(String name, String category) - { - this(-1, name, category); - } - - public Item(int id, String name, String category) + + public Item(int id, String name) { Id = id; Name = name; - Category = category; } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/mount/MountManager.java b/Plugins/Mineplex.Core/src/mineplex/core/mount/MountManager.java index 38152a878..78d19c59a 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/mount/MountManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/mount/MountManager.java @@ -3,6 +3,25 @@ package mineplex.core.mount; import java.util.ArrayList; import java.util.List; +import mineplex.core.MiniPlugin; +import mineplex.core.account.CoreClientManager; +import mineplex.core.blockrestore.BlockRestore; +import mineplex.core.common.util.F; +import mineplex.core.common.util.NautHashMap; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.disguise.DisguiseManager; +import mineplex.core.donation.DonationManager; +import mineplex.core.mount.types.MountCart; +import mineplex.core.mount.types.MountDragon; +import mineplex.core.mount.types.MountFrost; +import mineplex.core.mount.types.MountMule; +import mineplex.core.mount.types.MountSlime; +import mineplex.core.mount.types.MountSpider; +import mineplex.core.mount.types.MountTitan; +import mineplex.core.mount.types.MountUndead; +import mineplex.core.mount.types.MountZombie; + import org.bukkit.Material; import org.bukkit.entity.Entity; import org.bukkit.entity.Horse; @@ -14,17 +33,6 @@ import org.bukkit.event.player.PlayerInteractEntityEvent; import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.plugin.java.JavaPlugin; -import mineplex.core.MiniPlugin; -import mineplex.core.account.CoreClientManager; -import mineplex.core.blockrestore.BlockRestore; -import mineplex.core.common.util.F; -import mineplex.core.common.util.NautHashMap; -import mineplex.core.common.util.UtilPlayer; -import mineplex.core.common.util.UtilServer; -import mineplex.core.disguise.DisguiseManager; -import mineplex.core.donation.DonationManager; -import mineplex.core.mount.types.*; - public class MountManager extends MiniPlugin { private CoreClientManager _clientManager; @@ -57,6 +65,9 @@ public class MountManager extends MiniPlugin _types.add(new MountDragon(this)); _types.add(new MountSlime(this)); _types.add(new MountCart(this)); + _types.add(new MountSpider(this)); + _types.add(new MountZombie(this)); + _types.add(new MountTitan(this)); //_types.add(new MountSheep(this)); } @@ -168,5 +179,15 @@ public class MountManager extends MiniPlugin return _disguiseManager; } - + public boolean isMount(Entity ent) + { + for (Mount mount : _playerActiveMountMap.values()) + { + if (mount.GetActive().values().contains(ent)) + { + return true; + } + } + return false; + } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountCart.java b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountCart.java index 0c3c5d113..af5e1db39 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountCart.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountCart.java @@ -1,21 +1,8 @@ package mineplex.core.mount.types; -import org.bukkit.ChatColor; -import org.bukkit.EntityEffect; -import org.bukkit.Material; -import org.bukkit.Sound; -import org.bukkit.entity.Minecart; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.entity.EntityDamageEvent; -import org.bukkit.event.entity.EntityTargetEvent; -import org.bukkit.event.player.PlayerInteractEntityEvent; -import org.bukkit.event.vehicle.VehicleDamageEvent; - import mineplex.core.common.util.F; import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilAlg; -import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilPlayer; import mineplex.core.mount.Mount; @@ -24,6 +11,17 @@ import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; +import org.bukkit.ChatColor; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.craftbukkit.v1_7_R4.entity.CraftMinecart; +import org.bukkit.entity.Minecart; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.entity.EntityTargetEvent; +import org.bukkit.event.player.PlayerInteractEntityEvent; +import org.bukkit.event.vehicle.VehicleDamageEvent; + public class MountCart extends Mount { public MountCart(MountManager manager) @@ -112,13 +110,18 @@ public class MountCart extends Mount if (cart.getPassenger() == null) continue; - if (!UtilEnt.isGrounded(cart)) + if (!((CraftMinecart) cart).getHandle().onGround) continue; +// if (!UtilEnt.isGrounded(cart)) +// continue; + if (!(cart.getPassenger() instanceof Player)) continue; - UtilAction.velocity(cart, cart.getPassenger().getLocation().getDirection(), 1.4, true, 0, 0, 1, false); + Player player = (Player) cart.getPassenger(); + + UtilAction.velocity(cart, UtilAlg.getTrajectory2d(player.getEyeLocation(), UtilPlayer.getTargetLocation(player, 5)), 1.4, true, 0, 0, 1, false); if (Math.random() > 0.8) cart.getWorld().playSound(cart.getLocation(), Sound.MINECART_BASE, 0.05f, 2f); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountSpider.java b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountSpider.java new file mode 100644 index 000000000..704a588d1 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountSpider.java @@ -0,0 +1,233 @@ +package mineplex.core.mount.types; + +import java.lang.reflect.Field; +import java.util.ArrayList; +import java.util.Map.Entry; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.disguise.disguises.DisguiseSpider; +import mineplex.core.mount.HorseMount; +import mineplex.core.mount.MountManager; +import mineplex.core.recharge.Recharge; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import net.minecraft.server.v1_7_R4.EntityLiving; + +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.Horse; +import org.bukkit.entity.Horse.Color; +import org.bukkit.entity.Horse.Style; +import org.bukkit.entity.Horse.Variant; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.inventory.ItemStack; +import org.bukkit.util.Vector; + +public class MountSpider extends HorseMount +{ + /** + * @author Mysticate + */ + + public MountSpider(MountManager manager) + { + super(manager, "Spider Mount", new String[] + { + C.cWhite + "Why ride a horse when you can", + C.cWhite + "ride a cute and cuddly spider!", + C.cBlack, + C.cYellow + "Look Up" + C.cGray + " to use " + C.cGreen + "Wall Climb", + C.cYellow + "Jump" + C.cGray + " to use " + C.cGreen + "Leap", + C.cBlack, + C.cPurple + "Only available during " + C.Line + "Halloween 2015", + C.cPurple + "Purchase at " + C.Line + "www.mineplex.com/shop" + }, Material.WEB, (byte) 0, -1, Color.BLACK, Style.NONE, Variant.HORSE, 2.0, Material.AIR); + } + + @Override + public void EnableCustom(Player player) + { + player.leaveVehicle(); + player.eject(); + + //Remove other mounts + Manager.DeregisterAll(player); + + Horse horse = player.getWorld().spawn(player.getLocation(), Horse.class); + horse.setAdult(); + horse.setAgeLock(true); + horse.setColor(_color); + horse.setStyle(_style); + horse.setVariant(_variant); + horse.setOwner(player); + horse.setMaxDomestication(1); + horse.setJumpStrength(_jump); + horse.setMaxHealth(20); + horse.setHealth(horse.getMaxHealth()); + horse.getInventory().setSaddle(new ItemStack(Material.SADDLE)); + + if (horse.getVariant() == Variant.MULE) + horse.setCarryingChest(true); + + if (_armor != null) + horse.getInventory().setArmor(new ItemStack(_armor)); + + horse.setCustomName(player.getName() + "'s " + GetName()); + + //Inform + UtilPlayer.message(player, F.main("Mount", "You spawned " + F.elem(GetName()) + ".")); + + //Store + _active.put(player, horse); + + DisguiseSpider spider = new DisguiseSpider(horse); + spider.setName(player.getName() + "'s Spider Mount"); + Manager.getDisguiseManager().disguise(spider); + + UtilEnt.silence(horse, true); + } + + @EventHandler + public void sounds(UpdateEvent event) + { + if (event.getType() != UpdateType.FASTEST) + return; + + ArrayList used = new ArrayList(); + for (Player player : GetActive().keySet()) + { + Horse horse = GetActive().get(player); + + used.add(horse); + + if (!Recharge.Instance.use(player, "Spider Mount Sounds", (1000 * UtilMath.r(3)) + 500, false, false)) + continue; + + //Moving + if (horse.getVelocity().length() != 0 && UtilEnt.isGrounded(horse)) + { + horse.getWorld().playSound(horse.getLocation(), Sound.SPIDER_WALK, .4F, 1.0F); + } + } + } + + @EventHandler + public void wallClimb(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + for (Entry horse : GetActive().entrySet()) + { + if (horse.getValue().getPassenger() != horse.getKey()) + continue; + + //If player is looking up + if (horse.getKey().getEyeLocation().getPitch() > -45) + continue; + + for (Block block : UtilBlock.getSurrounding(horse.getValue().getLocation().getBlock(), true)) + { + if (UtilBlock.airFoliage(block) || block.isLiquid()) + continue; + + UtilAction.velocity(horse.getValue(), new Vector(horse.getValue().getVelocity().getX(), 0.2, horse.getValue().getVelocity().getZ())); + continue; + } + } + } + +// @EventHandler(priority = EventPriority.LOW) +// public void doubleJump(PlayerToggleFlightEvent event) +// { +// Player player = event.getPlayer(); +// +// if (player.getGameMode() == GameMode.CREATIVE) +// return; +// +// if (!GetActive().containsKey(player)) +// return; +// +// if (GetActive().get(player).getPassenger() != event.getPlayer()) +// return; +// +// //Chicken Cancel +// DisguiseBase disguise = Manager.getDisguiseManager().getDisguise(player); +// if (disguise != null && ((disguise instanceof DisguiseChicken && !((DisguiseChicken)disguise).isBaby()) || disguise instanceof DisguiseBat || disguise instanceof DisguiseEnderman || disguise instanceof DisguiseWither)) +// return; +// +// Horse horse = GetActive().get(event.getPlayer()); +// +// if (!UtilEnt.isGrounded(horse)) +// return; +// +// event.setCancelled(true); +// player.setFlying(false); +// +// //Disable Flight +// player.setAllowFlight(false); +// +// //Velocity +// UtilAction.velocity(horse, 1.4, 0.38, 1, true); +// +// //Sound +// player.playSound(horse.getLocation(), Sound.SPIDER_IDLE, .4F, 1.0F); +// } + + @EventHandler + public void jump(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + for (Player player : GetActive().keySet()) + { + final Horse horse = GetActive().get(player); + + if (horse.getPassenger() != player) + continue; + + if (!UtilEnt.isGrounded(horse)) + continue; + + if (!Recharge.Instance.use(player, "Spider Mount Jump", 100, false, false)) + continue; + + try + { + Field jump = EntityLiving.class.getDeclaredField("bc"); + final boolean accessable = jump.isAccessible(); + + jump.setAccessible(true); + boolean isJumping = jump.getBoolean(((CraftPlayer) player).getHandle()); + + jump.setAccessible(accessable); + + if (!isJumping) + continue; + + //Not jumping anymore + ((CraftPlayer) player).getHandle().f(false); + + //Velocity + UtilAction.velocity(horse, 1.4, 0.38, .8, true); + + //Sound + player.playSound(horse.getLocation(), Sound.SPIDER_IDLE, .4F, 1.0F); + } + catch (Exception ex) + { + ex.printStackTrace(); + } + } + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountTitan.java b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountTitan.java new file mode 100644 index 000000000..e4ea28811 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountTitan.java @@ -0,0 +1,27 @@ +package mineplex.core.mount.types; + +import org.bukkit.Material; +import org.bukkit.entity.Horse.Color; +import org.bukkit.entity.Horse.Style; +import org.bukkit.entity.Horse.Variant; + +import mineplex.core.common.util.C; +import mineplex.core.mount.HorseMount; +import mineplex.core.mount.MountManager; + +public class MountTitan extends HorseMount +{ + public MountTitan(MountManager manager) + { + super(manager, "Titanic Mount", new String[] + { + C.cWhite + "Coming Soon...", + " ", + C.cRed + "Unlocked with Titan Rank", + }, + Material.INK_SACK, + (byte)8, + -1, + Color.BLACK, Style.BLACK_DOTS, Variant.UNDEAD_HORSE, 0.8, null); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountUndead.java b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountUndead.java index 20a398d80..ebe2216c5 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountUndead.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountUndead.java @@ -1,23 +1,22 @@ package mineplex.core.mount.types; +import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilParticle.ParticleType; +import mineplex.core.common.util.UtilParticle.ViewDist; +import mineplex.core.common.util.UtilServer; +import mineplex.core.mount.HorseMount; +import mineplex.core.mount.MountManager; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; + import org.bukkit.Material; import org.bukkit.entity.Horse; import org.bukkit.entity.Horse.Color; import org.bukkit.entity.Horse.Style; import org.bukkit.entity.Horse.Variant; -import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; -import mineplex.core.common.util.C; -import mineplex.core.common.util.UtilParticle; -import mineplex.core.common.util.UtilServer; -import mineplex.core.common.util.UtilParticle.ParticleType; -import mineplex.core.common.util.UtilParticle.ViewDist; -import mineplex.core.mount.HorseMount; -import mineplex.core.mount.MountManager; -import mineplex.core.updater.UpdateType; -import mineplex.core.updater.event.UpdateEvent; - public class MountUndead extends HorseMount { public MountUndead(MountManager manager) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountZombie.java b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountZombie.java new file mode 100644 index 000000000..9b396f6b5 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountZombie.java @@ -0,0 +1,30 @@ +package mineplex.core.mount.types; + +import org.bukkit.Material; +import org.bukkit.entity.Horse.Color; +import org.bukkit.entity.Horse.Style; +import org.bukkit.entity.Horse.Variant; + +import mineplex.core.common.util.C; +import mineplex.core.mount.HorseMount; +import mineplex.core.mount.MountManager; + +public class MountZombie extends HorseMount +{ + public MountZombie(MountManager manager) + { + super(manager, "Decrepit Warhorse", new String[] + { + C.cWhite + "Once a fierce warhorse, this", + C.cWhite + "undead beast will send fear", + C.cWhite + "into the hearts of your enemies.", + " ", + C.cYellow + "Earned by defeating the Pumpkin King", + C.cYellow + "in the 2015 Halloween Horror Event.", + }, + Material.ROTTEN_FLESH, + (byte)0, + -1, + Color.BLACK, Style.BLACK_DOTS, Variant.UNDEAD_HORSE, 0.8, null); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/notifier/NotificationManager.java b/Plugins/Mineplex.Core/src/mineplex/core/notifier/NotificationManager.java index 99e3cc185..53c841b6c 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/notifier/NotificationManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/notifier/NotificationManager.java @@ -17,36 +17,37 @@ import mineplex.core.updater.event.UpdateEvent; public class NotificationManager extends MiniPlugin { - private boolean _enabled = true; + private boolean _enabled = false; private CoreClientManager _clientManager; - + private String _summerLine = C.cYellow + "█" + C.cBlack + "█" + C.cYellow + "█" + C.cBlack + "█" + C.cYellow + "█" + C.cBlack + "█" + - C.cYellow + "█" + C.cBlack + "█" + C.cYellow + "█" + C.cBlack + "█" + C.cYellow + "█" + C.cBlack + "█" + - C.cYellow + "█" + C.cBlack + "█" + C.cYellow + "█" + C.cBlack + "█" + C.cYellow + "█" + C.cBlack + "█" + - C.cYellow + "█" + C.cBlack + "█" + C.cYellow + "█" + C.cBlack + "█" + C.cYellow + "█" + C.cBlack + "█" + - C.cYellow + "█" + C.cBlack + "█" + C.cYellow + "█" + C.cBlack + "█" + C.cYellow + "█" + C.cBlack + "█" + - C.cYellow + "█" + C.cBlack + "█" + C.cYellow + "█" + C.cBlack + "█" + C.cYellow + "█"; + C.cYellow + "█" + C.cBlack + "█" + C.cYellow + "█" + C.cBlack + "█" + C.cYellow + "█" + C.cBlack + "█" + + C.cYellow + "█" + C.cBlack + "█" + C.cYellow + "█" + C.cBlack + "█" + C.cYellow + "█" + C.cBlack + "█" + + C.cYellow + "█" + C.cBlack + "█" + C.cYellow + "█" + C.cBlack + "█" + C.cYellow + "█" + C.cBlack + "█" + + C.cYellow + "█" + C.cBlack + "█" + C.cYellow + "█" + C.cBlack + "█" + C.cYellow + "█" + C.cBlack + "█" + + C.cYellow + "█" + C.cBlack + "█" + C.cYellow + "█" + C.cBlack + "█" + C.cYellow + "█"; public NotificationManager(JavaPlugin plugin, CoreClientManager client) { super("Notification Manager", plugin); - + _clientManager = client; } - + @EventHandler public void notify(UpdateEvent event) { if (!_enabled) return; - + // if (event.getType() == UpdateType.MIN_08) // hugeSale(); + +// if (event.getType() == UpdateType.MIN_16) +// sale(); - if (event.getType() == UpdateType.MIN_16) - sale(); } private void sale() @@ -54,10 +55,10 @@ public class NotificationManager extends MiniPlugin for (Player player : UtilServer.getPlayers()) { Rank rank = _clientManager.Get(player).GetRank(); - + if (rank.has(Rank.LEGEND)) continue; - + if (rank == Rank.ALL) { UtilPlayer.message(player, C.cWhite + " 50% Off Sale! " + " Purchase " + C.cAqua + C.Bold + "Ultra Rank" + C.cWhite + " for $15"); @@ -70,20 +71,20 @@ public class NotificationManager extends MiniPlugin { UtilPlayer.message(player, C.cWhite + " 50% Off Sale! " + "Upgrade to " + C.cGreen + C.Bold + "Legend Rank" + C.cWhite + " for $15!"); } - + UtilPlayer.message(player, C.cWhite + " Visit " + F.link("www.mineplex.com/shop") + C.cWhite + " for 50% Off Ranks!"); } } - + private void hugeSale() { for (Player player : UtilServer.getPlayers()) { Rank rank = _clientManager.Get(player).GetRank(); - + if (rank.has(Rank.LEGEND)) continue; - + UtilPlayer.message(player, _summerLine); UtilPlayer.message(player, " "); UtilPlayer.message(player, " " + @@ -91,7 +92,7 @@ public class NotificationManager extends MiniPlugin C.cYellow + C.Bold + " SUMMER SUPER SALE " + C.cGreen + C.Bold + "75% OFF"); UtilPlayer.message(player, " "); - + if (rank == Rank.ALL) { UtilPlayer.message(player, C.cWhite + " " + player.getName() + ", you can get 75% Off " + C.cAqua + C.Bold + "All Lifetime Ranks" + C.cWhite + "!"); @@ -107,7 +108,7 @@ public class NotificationManager extends MiniPlugin UtilPlayer.message(player, C.cWhite + " Hello " + player.getName() + ", upgrade to " + C.cGreen + C.Bold + "LEGEND RANK" + C.cWhite + " for only $7.50!"); UtilPlayer.message(player, C.cWhite + " This is our biggest sale ever, " + C.cRed + C.Line + "ends Sunday 16th" + C.cWhite + "!"); } - + UtilPlayer.message(player, " "); UtilPlayer.message(player, " " + C.cGreen + "www.mineplex.com/shop"); UtilPlayer.message(player, " "); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/pet/PetManager.java b/Plugins/Mineplex.Core/src/mineplex/core/pet/PetManager.java index 46488298a..bd746ab78 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/pet/PetManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/pet/PetManager.java @@ -19,6 +19,9 @@ import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilServer; import mineplex.core.disguise.DisguiseManager; import mineplex.core.donation.DonationManager; +import mineplex.core.inventory.ClientItem; +import mineplex.core.inventory.InventoryManager; +import mineplex.core.inventory.data.Item; import net.minecraft.server.v1_7_R4.EntityCreature; import net.minecraft.server.v1_7_R4.EntityWither; import net.minecraft.server.v1_7_R4.Navigation; @@ -70,8 +73,10 @@ public class PetManager extends MiniClientPlugin private NautHashMap _petRenameQueue = new NautHashMap(); private DonationManager _donationManager; private CoreClientManager _clientManager; + private InventoryManager _inventoryManager; - public PetManager(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager, DisguiseManager disguiseManager, mineplex.core.creature.Creature creatureModule, BlockRestore restore, String webAddress) + public PetManager(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager + , InventoryManager inventoryManager, DisguiseManager disguiseManager, mineplex.core.creature.Creature creatureModule, BlockRestore restore, String webAddress) { super("Pet Manager", plugin); @@ -82,6 +87,7 @@ public class PetManager extends MiniClientPlugin _blockRestore = restore; _donationManager = donationManager; _clientManager = clientManager; + _inventoryManager = inventoryManager; _activePetOwners = new NautHashMap(); _failedAttempts = new NautHashMap(); @@ -146,10 +152,12 @@ public class PetManager extends MiniClientPlugin { Player p = event.getPlayer(); Rank rank = _clientManager.Get(p).GetRank(); - if (rank.has(Rank.LEGEND)) - { - _donationManager.Get(p.getName()).AddUnknownSalesPackagesOwned("Widder"); - } + + if (rank.has(Rank.LEGEND)) + { + if (!Get(p).GetPets().containsKey(EntityType.WITHER)) + Get(p).GetPets().put(EntityType.WITHER, "Widder"); + } } public void AddPetOwner(Player player, EntityType entityType, Location location) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/pet/repository/PetRepository.java b/Plugins/Mineplex.Core/src/mineplex/core/pet/repository/PetRepository.java index 85973eeb9..efb2331c0 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/pet/repository/PetRepository.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/pet/repository/PetRepository.java @@ -34,6 +34,9 @@ public class PetRepository extends RepositoryBase { public void run() { + if (token.PetId == 0 || token.AccountId == 0) + return; + executeInsert("INSERT INTO accountPets(petName, petId, accountId) VALUES (?, ?, ?);", null, new ColumnVarChar("petName", 32, token.PetName) , new ColumnInt("petId", token.PetId) , new ColumnInt("accountId", token.AccountId)); @@ -49,6 +52,9 @@ public class PetRepository extends RepositoryBase { public void run() { + if (token.PetId == 0 || token.AccountId == 0) + return; + executeUpdate("DELETE FROM accountPets WHERE petId = ? AND accountId = ?;" , new ColumnInt("petId", token.PetId) , new ColumnInt("accountId", token.AccountId)); @@ -69,6 +75,9 @@ public class PetRepository extends RepositoryBase { public void run() { + if (token.PetId == 0 || token.AccountId == 0) + return; + int rowsChanged = executeUpdate("UPDATE accountPets SET petName = ? WHERE petId = ? AND accountId = ?;", new ColumnVarChar("petName", 32, token.PetName) , new ColumnInt("petId", token.PetId) , new ColumnInt("accountId", token.AccountId)); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/pet/types/Pumpkin.java b/Plugins/Mineplex.Core/src/mineplex/core/pet/types/Pumpkin.java index ae646cb75..71b561f2c 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/pet/types/Pumpkin.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/pet/types/Pumpkin.java @@ -10,5 +10,4 @@ public class Pumpkin extends Pet { super("Pumpling", EntityType.ZOMBIE, -1); } - } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/poll/PollRepository.java b/Plugins/Mineplex.Core/src/mineplex/core/poll/PollRepository.java index 53884c66f..588d3d549 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/poll/PollRepository.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/poll/PollRepository.java @@ -35,8 +35,8 @@ public class PollRepository extends RepositoryBase @Override protected void initialize() { - executeUpdate(CREATE_POLL_TABLE); - executeUpdate(CREATE_RELATION_TABLE); + //executeUpdate(CREATE_POLL_TABLE); + //executeUpdate(CREATE_RELATION_TABLE); } @Override diff --git a/Plugins/Mineplex.Core/src/mineplex/core/preferences/ui/PreferencesPage.java b/Plugins/Mineplex.Core/src/mineplex/core/preferences/ui/PreferencesPage.java index 1fb8c4d0d..2d4b29462 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/preferences/ui/PreferencesPage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/preferences/ui/PreferencesPage.java @@ -178,6 +178,9 @@ public class PreferencesPage extends ShopPageBase 0) { int weight = _random.nextInt(totalWeight); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardType.java b/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardType.java index b226448c2..6464a22a5 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardType.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardType.java @@ -7,7 +7,7 @@ public enum RewardType OldChest( 0, 0.05, 0.4, 5), AncientChest( 0, 1, 4, 25), - MythicalChest( 0.4, 3, 12, 75), + MythicalChest( 0.3, 3, 12, 75), SpinnerFiller( 0.1, 1, 4, 20), SpinnerReal( 0.000001, 0.05, 0.4, 5); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/reward/rewards/CoinReward.java b/Plugins/Mineplex.Core/src/mineplex/core/reward/rewards/CoinReward.java index 1bf59afb9..dbfce1d9b 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/reward/rewards/CoinReward.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/reward/rewards/CoinReward.java @@ -9,8 +9,8 @@ import mineplex.core.common.util.Callback; import mineplex.core.donation.DonationManager; import mineplex.core.reward.Reward; import mineplex.core.reward.RewardData; -import mineplex.core.reward.RewardManager; import mineplex.core.reward.RewardRarity; +import mineplex.core.reward.RewardType; public class CoinReward extends Reward { @@ -35,7 +35,7 @@ public class CoinReward extends Reward } @Override - public RewardData giveRewardCustom(Player player) + public RewardData giveRewardCustom(Player player, RewardType rewardType) { int coinsToReward = _random.nextInt(_maxCoinCount - _minCoinCount) + _minCoinCount; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/reward/rewards/ExperienceReward.java b/Plugins/Mineplex.Core/src/mineplex/core/reward/rewards/ExperienceReward.java index ad1ad3b5b..3ead33459 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/reward/rewards/ExperienceReward.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/reward/rewards/ExperienceReward.java @@ -9,6 +9,7 @@ import org.bukkit.inventory.ItemStack; import mineplex.core.reward.Reward; import mineplex.core.reward.RewardData; import mineplex.core.reward.RewardRarity; +import mineplex.core.reward.RewardType; import mineplex.core.stats.StatsManager; public class ExperienceReward extends Reward @@ -29,7 +30,7 @@ public class ExperienceReward extends Reward } @Override - protected RewardData giveRewardCustom(Player player) + protected RewardData giveRewardCustom(Player player, RewardType rewardType) { int experience = _random.nextInt(_maxExperience - _minExperience) + _minExperience; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/reward/rewards/GemReward.java b/Plugins/Mineplex.Core/src/mineplex/core/reward/rewards/GemReward.java index 26e695abb..1e4e2fb78 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/reward/rewards/GemReward.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/reward/rewards/GemReward.java @@ -10,8 +10,8 @@ import mineplex.core.common.util.Callback; import mineplex.core.donation.DonationManager; import mineplex.core.reward.Reward; import mineplex.core.reward.RewardData; -import mineplex.core.reward.RewardManager; import mineplex.core.reward.RewardRarity; +import mineplex.core.reward.RewardType; public class GemReward extends Reward { @@ -36,7 +36,7 @@ public class GemReward extends Reward } @Override - public RewardData giveRewardCustom(Player player) + public RewardData giveRewardCustom(Player player, RewardType rewardType) { int GemsToReward = _random.nextInt(_maxGemCount - _minGemCount) + _minGemCount; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/reward/rewards/InventoryReward.java b/Plugins/Mineplex.Core/src/mineplex/core/reward/rewards/InventoryReward.java index 0eb1504e0..407d60593 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/reward/rewards/InventoryReward.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/reward/rewards/InventoryReward.java @@ -8,8 +8,8 @@ import org.bukkit.inventory.ItemStack; import mineplex.core.inventory.InventoryManager; import mineplex.core.reward.Reward; import mineplex.core.reward.RewardData; -import mineplex.core.reward.RewardManager; import mineplex.core.reward.RewardRarity; +import mineplex.core.reward.RewardType; /** * Created by shaun on 14-09-12. @@ -44,7 +44,7 @@ public class InventoryReward extends Reward } @Override - public RewardData giveRewardCustom(Player player) + public RewardData giveRewardCustom(Player player, RewardType rewardType) { int amountToGive; @@ -57,7 +57,7 @@ public class InventoryReward extends Reward amountToGive = _minAmount; } - _inventoryManager.addItemToInventory(player, "Item", _packageName, amountToGive); + _inventoryManager.addItemToInventory(player, _packageName, amountToGive); return new RewardData(getRarity().getColor() + amountToGive + " " + _name, _itemStack, getRarity()); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/reward/rewards/PetReward.java b/Plugins/Mineplex.Core/src/mineplex/core/reward/rewards/PetReward.java index ff9d1ad4d..672839e88 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/reward/rewards/PetReward.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/reward/rewards/PetReward.java @@ -11,8 +11,9 @@ import mineplex.core.pet.PetManager; import mineplex.core.pet.repository.token.PetChangeToken; import mineplex.core.pet.repository.token.PetToken; import mineplex.core.reward.RewardData; -import mineplex.core.reward.RewardManager; import mineplex.core.reward.RewardRarity; +import mineplex.core.reward.RewardType; +import mineplex.playerCache.PlayerCache; /** * Created by shaun on 14-09-18. @@ -33,9 +34,15 @@ public class PetReward extends UnknownPackageReward } @Override - protected RewardData giveRewardCustom(Player player) + protected RewardData giveRewardCustom(Player player, RewardType rewardType) { PetChangeToken token = new PetChangeToken(); + + if (_inventoryManager.getClientManager().Get(player) != null) + token.AccountId = _inventoryManager.getClientManager().Get(player).getAccountId(); + else + token.AccountId = PlayerCache.getInstance().getPlayer(player.getUniqueId()).getAccountId(); + token.Name = player.getName(); token.PetType = _petEntity.toString(); token.PetName = getPackageName(); @@ -44,12 +51,22 @@ public class PetReward extends UnknownPackageReward petToken.PetType = token.PetType; _petManager.GetRepository().AddPet(token); -// _petManager.addPetOwnerToQueue(player.getName(), _petEntity); - _petManager.Get(player).GetPets().put(_petEntity, token.PetName); - _inventoryManager.addItemToInventory(player, "Pet", _petEntity.toString(), 1); + _inventoryManager.addItemToInventory(player, _petEntity.toString(), 1); - return super.giveRewardCustom(player); + return getFakeRewardData(player); + } + + @Override + public boolean canGiveReward(Player player) + { + if (DonationManager.Get(player.getName()) == null) + { + System.out.println("Could not give reward " + getPackageName() + " to Offline Player: " + player.getName()); + return false; + } + + return !_petManager.Get(player).GetPets().containsKey(_petEntity); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/reward/rewards/RankReward.java b/Plugins/Mineplex.Core/src/mineplex/core/reward/rewards/RankReward.java index ca694776a..db925baa2 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/reward/rewards/RankReward.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/reward/rewards/RankReward.java @@ -1,6 +1,6 @@ package mineplex.core.reward.rewards; -import java.util.UUID; +import java.util.Random; import org.bukkit.Material; import org.bukkit.entity.Player; @@ -8,35 +8,51 @@ import org.bukkit.inventory.ItemStack; import mineplex.core.account.CoreClientManager; import mineplex.core.common.Rank; -import mineplex.core.common.util.UUIDFetcher; import mineplex.core.reward.Reward; import mineplex.core.reward.RewardData; import mineplex.core.reward.RewardRarity; +import mineplex.core.reward.RewardType; +import mineplex.core.status.ServerStatusManager; +import mineplex.core.titangiveaway.redis.TitanChestGiveawayMessage; public class RankReward extends Reward { + private Random _random; private CoreClientManager _clientManager; + private ServerStatusManager _statusManager; - public RankReward(CoreClientManager clientManager, int weight, RewardRarity rarity) + public RankReward(CoreClientManager clientManager, ServerStatusManager statusManager, int weight, RewardRarity rarity) { super(rarity, weight); _clientManager = clientManager; + _statusManager = statusManager; + _random = new Random(); } @Override - public RewardData giveRewardCustom(Player player) + public RewardData giveRewardCustom(Player player, RewardType rewardType) { Rank rank = null; if (_clientManager.Get(player).GetRank() == Rank.ALL) rank = Rank.ULTRA; else if (_clientManager.Get(player).GetRank() == Rank.ULTRA) rank = Rank.HERO; else if (_clientManager.Get(player).GetRank() == Rank.HERO) rank = Rank.LEGEND; + else if (rewardType == RewardType.MythicalChest && _clientManager.Get(player).GetRank() == Rank.LEGEND) rank = Rank.TITAN; + + if (rewardType == RewardType.MythicalChest && _random.nextDouble() < 0.01) // 1 Percent + rank = Rank.TITAN; if (rank == null) return new RewardData(getRarity().getColor() + "Rank Upgrade Error", new ItemStack(Material.PAPER), getRarity()); - _clientManager.Get(player).SetRank(rank); + _clientManager.Get(player).SetRank(rank, false); _clientManager.getRepository().saveRank(null, player.getName(), player.getUniqueId(), rank, true); + + if (rank == Rank.TITAN) + { + TitanChestGiveawayMessage message = new TitanChestGiveawayMessage(player.getName(), _statusManager.getCurrentServerName()); + message.publish(); + } return new RewardData(getRarity().getColor() + rank.Name + " Rank", new ItemStack(Material.NETHER_STAR), getRarity()); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/reward/rewards/UnknownPackageReward.java b/Plugins/Mineplex.Core/src/mineplex/core/reward/rewards/UnknownPackageReward.java index af27a817e..70f1cae85 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/reward/rewards/UnknownPackageReward.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/reward/rewards/UnknownPackageReward.java @@ -6,15 +6,12 @@ import org.bukkit.inventory.ItemStack; import mineplex.core.donation.DonationManager; import mineplex.core.reward.Reward; import mineplex.core.reward.RewardData; -import mineplex.core.reward.RewardManager; import mineplex.core.reward.RewardRarity; +import mineplex.core.reward.RewardType; -/** - * Created by shaun on 14-09-12. - */ public class UnknownPackageReward extends Reward { - private DonationManager _donationManager; + protected DonationManager DonationManager; private ItemStack _itemStack; private String _name; private String _packageName; @@ -22,16 +19,16 @@ public class UnknownPackageReward extends Reward public UnknownPackageReward(DonationManager donationManager, String name, String packageName, ItemStack itemStack, RewardRarity rarity, int weight) { super(rarity, weight); - _donationManager = donationManager; + DonationManager = donationManager; _name = name; _packageName = packageName; _itemStack = itemStack; } @Override - protected RewardData giveRewardCustom(Player player) + protected RewardData giveRewardCustom(Player player, RewardType rewardType) { - _donationManager.PurchaseUnknownSalesPackage(null, player.getName(), _donationManager.getClientManager().Get(player).getAccountId(), _packageName, true, 0, true); + DonationManager.PurchaseUnknownSalesPackage(null, player.getName(), DonationManager.getClientManager().Get(player).getAccountId(), _packageName, true, 0, true); return new RewardData(getRarity().getColor() + _name, _itemStack, getRarity()); } @@ -39,13 +36,13 @@ public class UnknownPackageReward extends Reward @Override public boolean canGiveReward(Player player) { - if (_donationManager.Get(player.getName()) == null) + if (DonationManager.Get(player.getName()) == null) { System.out.println("Could not give reward " + _packageName + " to Offline Player: " + player.getName()); return false; } - - return !_donationManager.Get(player.getName()).OwnsUnknownPackage(_packageName); + + return !DonationManager.Get(player.getName()).OwnsUnknownPackage(_packageName); } @Override @@ -69,7 +66,7 @@ public class UnknownPackageReward extends Reward { if (obj instanceof UnknownPackageReward) { - return ((UnknownPackageReward) obj).getPackageName().equals(_packageName); + return _packageName.equals(((UnknownPackageReward) obj).getPackageName()); } return false; } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/stats/StatsManager.java b/Plugins/Mineplex.Core/src/mineplex/core/stats/StatsManager.java index 7c8a2dd9b..4b60646f1 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/stats/StatsManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/stats/StatsManager.java @@ -160,18 +160,25 @@ public class StatsManager extends MiniDbClientPlugin if (player.isOnline()) continue; - int uploadKey = PlayerCache.getInstance().getPlayer(player.getUniqueId()).getAccountId(); - - uploadQueue.put(uploadKey, new NautHashMap()); - - for (String statName : _statUploadQueue.get(player).keySet()) + try { - int statId = _stats.get(statName); - uploadQueue.get(uploadKey).put(statId, _statUploadQueue.get(player).get(statName)); - System.out.println(player.getName() + " saving stat : " + statName + " adding " + _statUploadQueue.get(player).get(statName)); + int uploadKey = PlayerCache.getInstance().getPlayer(player.getUniqueId()).getAccountId(); + + uploadQueue.put(uploadKey, new NautHashMap()); + + for (String statName : _statUploadQueue.get(player).keySet()) + { + int statId = _stats.get(statName); + uploadQueue.get(uploadKey).put(statId, _statUploadQueue.get(player).get(statName)); + System.out.println(player.getName() + " saving stat : " + statName + " adding " + _statUploadQueue.get(player).get(statName)); + } + + statIterator.remove(); + } + catch (Exception e) + { + //System.out.println("[StatsManager] AccountId was not set for " + player.getName()); } - - statIterator.remove(); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/titangiveaway/LightFlicker.java b/Plugins/Mineplex.Core/src/mineplex/core/titangiveaway/LightFlicker.java new file mode 100644 index 000000000..dbebdb828 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/titangiveaway/LightFlicker.java @@ -0,0 +1,53 @@ +package mineplex.core.titangiveaway; + +import java.util.Random; + +import org.bukkit.Sound; +import org.bukkit.World; +import org.bukkit.entity.Player; +import org.bukkit.scheduler.BukkitRunnable; + +public class LightFlicker extends BukkitRunnable +{ + private static int MAX_TICKS = 100; + + private World _world; + private Random _random; + private int _ticks; + private long _previousTime; + + public LightFlicker(World world) + { + _world = world; + _random = new Random(); + _ticks = 0; + _previousTime = world.getTime(); + } + + @Override + public void run() + { + if (_ticks >= MAX_TICKS) + { + _world.setTime(_previousTime); + cancel(); + return; + } + + if (_ticks % 5 == 0) + { + long time = (long) (24000 * _random.nextDouble()); + _world.setTime(time); + } + + if (_ticks % 10 == 0) + { + for (Player player : _world.getPlayers()) + { + player.playSound(player.getEyeLocation(), Sound.AMBIENCE_THUNDER, 1, 1); + } + } + + _ticks++; + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/titangiveaway/TitanGiveawayAnimation.java b/Plugins/Mineplex.Core/src/mineplex/core/titangiveaway/TitanGiveawayAnimation.java new file mode 100644 index 000000000..2a5e70db6 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/titangiveaway/TitanGiveawayAnimation.java @@ -0,0 +1,65 @@ +package mineplex.core.titangiveaway; + +import mineplex.core.common.util.UtilFirework; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilTime; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; + +import org.bukkit.Bukkit; +import org.bukkit.Color; +import org.bukkit.FireworkEffect.Type; +import org.bukkit.Location; +import org.bukkit.Sound; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.HandlerList; +import org.bukkit.event.Listener; + +public class TitanGiveawayAnimation implements Listener +{ + private Location _location; + private Long _duration, _startTime, _worldTime; + + public TitanGiveawayAnimation(TitanGiveawayManager manager, Location start, Long duration) + { + _location = start.clone(); + _duration = duration; + _startTime = System.currentTimeMillis(); +// _worldTime = start.getWorld().getTime(); + Bukkit.getPluginManager().registerEvents(this, manager.getPlugin()); + } + + public TitanGiveawayAnimation(TitanGiveawayManager manager, Location start) + { + this(manager, start, 11111L); + } + + @EventHandler(priority = EventPriority.MONITOR) + public void tick(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + if (UtilTime.elapsed(_startTime, _duration)) + { + remove(); + return; + } + +// _location.getWorld().setTime(UtilMath.random.nextLong()); + for (Player player : UtilServer.getPlayers()) + { + player.playSound(_location, Sound.ORB_PICKUP, 5, 5); + UtilFirework.packetPlayFirework(player, _location, Type.BURST, Color.RED, true, false); + } + } + + private void remove() + { +// _location.getWorld().setTime(_worldTime); + HandlerList.unregisterAll(this); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/titangiveaway/TitanGiveawayManager.java b/Plugins/Mineplex.Core/src/mineplex/core/titangiveaway/TitanGiveawayManager.java new file mode 100644 index 000000000..46a13f688 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/titangiveaway/TitanGiveawayManager.java @@ -0,0 +1,129 @@ +package mineplex.core.titangiveaway; + +import java.util.Random; + +import org.bukkit.entity.Player; +import org.bukkit.plugin.java.JavaPlugin; + +import mineplex.core.MiniPlugin; +import mineplex.core.account.CoreClientManager; +import mineplex.core.common.Rank; +import mineplex.core.common.util.Callback; +import mineplex.core.status.ServerStatusManager; +import mineplex.core.titangiveaway.redis.GiveawayMessageHandler; +import mineplex.core.titangiveaway.redis.TitanChestGiveawayHandler; +import mineplex.core.titangiveaway.redis.TitanChestGiveawayMessage; +import mineplex.core.titangiveaway.redis.TitanGiveawayMessage; +import mineplex.serverdata.Region; +import mineplex.serverdata.commands.ServerCommandManager; + +public class TitanGiveawayManager extends MiniPlugin +{ + private static final double RANK_FIND_CHANCE = 0.001; +// private static final double RANK_FIND_CHANCE = 1; + + private TitanGiveawayRepository _repository; + private CoreClientManager _clientManager; + private ServerStatusManager _statusManager; + private Random _random; + + public TitanGiveawayManager(JavaPlugin plugin, CoreClientManager clientManager, ServerStatusManager statusManager) + { + super("Titan Giveaway", plugin); + + _repository = new TitanGiveawayRepository(plugin); + _clientManager = clientManager; + _statusManager = statusManager; + _random = new Random(); + + ServerCommandManager.getInstance().registerCommandType("TitanGiveawayMessage", TitanGiveawayMessage.class, new GiveawayMessageHandler(plugin)); + ServerCommandManager.getInstance().registerCommandType("TitanChestGiveawayMessage", TitanChestGiveawayMessage.class, new TitanChestGiveawayHandler(_statusManager)); + } + + public void openPumpkin(final Player player, final Runnable onSuccess) + { + double rand = _random.nextDouble(); + if (!hasTitan(player) && rand < RANK_FIND_CHANCE) + { + final int accountId = _clientManager.getAccountId(player); + final Region region = getRegion(); + final String serverName = getServerName(); + + // Need to check database that we can give away a rank + runAsync(new Runnable() + { + @Override + public void run() + { + final boolean pass = _repository.canGiveaway(region); + + if (pass && _repository.addTitan(accountId, region, serverName)) + { + runSync(new Runnable() + { + @Override + public void run() + { + giveRank(new Callback() + { + @Override + public void run(Rank rank) + { + if (rank == Rank.TITAN) + { + TitanGiveawayMessage message = new TitanGiveawayMessage(player.getName(), _repository.getTitanCount() + 1); + message.publish(); + if (onSuccess != null) onSuccess.run(); + } + } + }, Rank.TITAN, player); + } + }); + } + } + }); + } + } + + /** + * Confirm that the player doesn't already have TITAN rank + */ + private boolean hasTitan(Player player) + { + return _clientManager.hasRank(player, Rank.TITAN); + } + + public Region getRegion() + { + return _statusManager.getRegion(); + } + + public String getServerName() + { + return _statusManager.getCurrentServerName(); + } + + private void giveRank(Callback callback, Rank rank, Player player) + { + _clientManager.Get(player).SetRank(rank, false); + _clientManager.getRepository().saveRank(callback, player.getName(), player.getUniqueId(), rank, true); + } + +// @EventHandler +// public void onCommand(final PlayerCommandPreprocessEvent event) +// { +// if (event.getMessage().contains("pumpkin")) +// { +// openPumpkin(event.getPlayer(), new Runnable() +// { +// @Override +// public void run() +// { +// Location location = event.getPlayer().getLocation().add(1, 0.5, 1); +// new TitanGiveawayAnimation(TitanGiveawayManager.this, location, 3000L); +// } +// }); +// event.setCancelled(true); +// } +// } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/titangiveaway/TitanGiveawayRepository.java b/Plugins/Mineplex.Core/src/mineplex/core/titangiveaway/TitanGiveawayRepository.java new file mode 100644 index 000000000..4eb95a46d --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/titangiveaway/TitanGiveawayRepository.java @@ -0,0 +1,70 @@ +package mineplex.core.titangiveaway; + +import java.sql.CallableStatement; +import java.sql.Connection; +import java.sql.Types; + +import org.bukkit.plugin.java.JavaPlugin; + +import mineplex.core.database.DBPool; +import mineplex.core.database.RepositoryBase; +import mineplex.core.database.column.ColumnInt; +import mineplex.core.database.column.ColumnVarChar; +import mineplex.serverdata.Region; + +public class TitanGiveawayRepository extends RepositoryBase +{ + private static final String ADD_TITAN = "INSERT INTO titanGiveaway (accountId, region, serverName) VALUES (?, ?, ?)"; + + private int _titanCount; + + public TitanGiveawayRepository(JavaPlugin plugin) + { + super(plugin, DBPool.ACCOUNT); + _titanCount = 0; + } + + @Override + protected void initialize() + { + + } + + @Override + protected void update() + { + + } + + public boolean addTitan(int accountId, Region region, String serverName) + { + return 1 == executeUpdate(ADD_TITAN, new ColumnInt("accountId", accountId), new ColumnVarChar("region", 10, region.name()), new ColumnVarChar("serverName", 64, serverName)); + } + + public boolean canGiveaway(Region region) + { + try (Connection connection = getConnection(); + CallableStatement callableStatement = connection.prepareCall("{call check_titanGiveaway(?, ?, ?)}")) + { + callableStatement.setString(1, region.name()); + callableStatement.registerOutParameter(2, Types.BOOLEAN); + callableStatement.registerOutParameter(3, Types.INTEGER); + callableStatement.executeUpdate(); + + boolean pass = callableStatement.getBoolean(2); + int titanCount = callableStatement.getInt(3); + + _titanCount = titanCount; + return pass; + } + catch (Exception e) + { + } + return false; + } + + public int getTitanCount() + { + return _titanCount; + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/titangiveaway/redis/GiveawayMessageHandler.java b/Plugins/Mineplex.Core/src/mineplex/core/titangiveaway/redis/GiveawayMessageHandler.java new file mode 100644 index 000000000..93bd6183e --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/titangiveaway/redis/GiveawayMessageHandler.java @@ -0,0 +1,48 @@ +package mineplex.core.titangiveaway.redis; + +import org.bukkit.Bukkit; +import org.bukkit.Sound; +import org.bukkit.World; +import org.bukkit.entity.Player; +import org.bukkit.plugin.java.JavaPlugin; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilTextMiddle; +import mineplex.core.common.util.UtilTime; +import mineplex.core.titangiveaway.LightFlicker; +import mineplex.serverdata.commands.CommandCallback; +import mineplex.serverdata.commands.ServerCommand; + +public class GiveawayMessageHandler implements CommandCallback +{ + private JavaPlugin _plugin; + + public GiveawayMessageHandler(JavaPlugin plugin) + { + _plugin = plugin; + } + + @Override + public void run(ServerCommand command) + { + if (command instanceof TitanGiveawayMessage) + { + TitanGiveawayMessage message = ((TitanGiveawayMessage) command); + String playerName = message.getPlayerName(); + int count = message.getTitanCount(); + String countString = count + UtilTime.getDayOfMonthSuffix(count); + String chatMessage = C.cRed + playerName + C.cWhite + " found Titan in a " + C.cRed + "Flaming Pumpkin"; + UtilTextMiddle.display(C.cDRed + C.Bold + "TITAN", chatMessage, 20, 80, 20, UtilServer.getPlayers()); + World world = UtilServer.getPlayers().length > 0 ? UtilServer.getPlayers()[0].getWorld() : Bukkit.getWorlds().get(0); + LightFlicker lightFlicker = new LightFlicker(world); + lightFlicker.runTaskTimer(_plugin, 1, 1); + + for (Player player : UtilServer.getPlayers()) + { +// player.sendMessage(chatMessage); + player.playSound(player.getEyeLocation(), Sound.AMBIENCE_CAVE, 1, 1); + } + } + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/titangiveaway/redis/TitanChestGiveawayHandler.java b/Plugins/Mineplex.Core/src/mineplex/core/titangiveaway/redis/TitanChestGiveawayHandler.java new file mode 100644 index 000000000..65081a2d8 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/titangiveaway/redis/TitanChestGiveawayHandler.java @@ -0,0 +1,48 @@ +package mineplex.core.titangiveaway.redis; + +import org.bukkit.Sound; +import org.bukkit.entity.Player; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilTextMiddle; +import mineplex.core.status.ServerStatusManager; +import mineplex.serverdata.commands.CommandCallback; +import mineplex.serverdata.commands.ServerCommand; + +public class TitanChestGiveawayHandler implements CommandCallback +{ + private static final long COOLDOWN = 60000L * 120; // 120 Minutes + + private ServerStatusManager _statusManager; + private long _lastTimer; + + public TitanChestGiveawayHandler(ServerStatusManager statusManager) + { + _statusManager = statusManager; + _lastTimer = 0; + } + + + @Override + public void run(ServerCommand command) + { + if (command instanceof TitanChestGiveawayMessage) + { + TitanChestGiveawayMessage chestCommand = ((TitanChestGiveawayMessage) command); + if (chestCommand.getServer().equals(_statusManager.getCurrentServerName()) || System.currentTimeMillis() >= _lastTimer + COOLDOWN) + { + String chatMessage = C.cRed + chestCommand.getPlayerName() + C.cWhite + " found Titan in a " + C.cRed + "Mythical Chest"; + UtilTextMiddle.display(C.cDRed + C.Bold + "TITAN", chatMessage, 20, 80, 20, UtilServer.getPlayers()); + + for (Player player : UtilServer.getPlayers()) + { +// player.sendMessage(chatMessage); + player.playSound(player.getEyeLocation(), Sound.AMBIENCE_CAVE, 1, 1); + } + + _lastTimer = System.currentTimeMillis(); + } + } + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/titangiveaway/redis/TitanChestGiveawayMessage.java b/Plugins/Mineplex.Core/src/mineplex/core/titangiveaway/redis/TitanChestGiveawayMessage.java new file mode 100644 index 000000000..beb3e7276 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/titangiveaway/redis/TitanChestGiveawayMessage.java @@ -0,0 +1,32 @@ +package mineplex.core.titangiveaway.redis; + +import mineplex.serverdata.commands.ServerCommand; + +public class TitanChestGiveawayMessage extends ServerCommand +{ + private String _playerName; + private String _server; + + public TitanChestGiveawayMessage(String playerName, String server) + { + _playerName = playerName; + _server = server; + } + + public String getPlayerName() + { + return _playerName; + } + + public String getServer() + { + return _server; + } + + @Override + public void run() + { + // Handled in Command Callback + } +} + diff --git a/Plugins/Mineplex.Core/src/mineplex/core/titangiveaway/redis/TitanGiveawayMessage.java b/Plugins/Mineplex.Core/src/mineplex/core/titangiveaway/redis/TitanGiveawayMessage.java new file mode 100644 index 000000000..c2f39792c --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/titangiveaway/redis/TitanGiveawayMessage.java @@ -0,0 +1,32 @@ +package mineplex.core.titangiveaway.redis; + +import mineplex.serverdata.commands.ServerCommand; + +public class TitanGiveawayMessage extends ServerCommand +{ + private String _playerName; + private int _titanCount; + + public TitanGiveawayMessage(String playerName, int titanCount) + { + _playerName = playerName; + _titanCount = titanCount; + } + + public String getPlayerName() + { + return _playerName; + } + + public int getTitanCount() + { + return _titanCount; + } + + @Override + public void run() + { + // Handled in Command Callback + } +} + diff --git a/Plugins/Mineplex.Core/src/mineplex/core/treasure/Treasure.java b/Plugins/Mineplex.Core/src/mineplex/core/treasure/Treasure.java index 08680f868..86806edb7 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/Treasure.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/Treasure.java @@ -25,6 +25,7 @@ import mineplex.core.hologram.HologramManager; import mineplex.core.reward.Reward; import mineplex.core.reward.RewardData; import mineplex.core.reward.RewardRarity; +import mineplex.core.reward.RewardType; import mineplex.core.treasure.animation.Animation; import mineplex.core.treasure.animation.BlockChangeAnimation; import mineplex.core.treasure.animation.ChestOpenAnimation; @@ -56,6 +57,7 @@ public class Treasure private int _currentChest; private Reward[] _rewards; + private RewardType _rewardType; private int _currentReward; private boolean _finished; @@ -65,14 +67,14 @@ public class Treasure private HologramManager _hologramManager; - public Treasure(Player player, Reward[] rewards, Block centerBlock, Block[] chestBlocks, TreasureType treasureType, BlockRestore blockRestore, HologramManager hologramManager) + public Treasure(Player player, Reward[] rewards, RewardType rewardType, Block centerBlock, Block[] chestBlocks, TreasureType treasureType, BlockRestore blockRestore, HologramManager hologramManager) { - this(player, new Random(), rewards, centerBlock, chestBlocks, treasureType, hologramManager); + this(player, new Random(), rewards, rewardType, centerBlock, chestBlocks, treasureType, hologramManager); _blockRestore = blockRestore; } - public Treasure(Player player, Random seed, Reward[] rewards, Block centerBlock, Block[] chestBlocks, TreasureType treasureType, HologramManager hologramManager) + public Treasure(Player player, Random seed, Reward[] rewards, RewardType rewardType, Block centerBlock, Block[] chestBlocks, TreasureType treasureType, HologramManager hologramManager) { _player = player; _random = seed; @@ -85,6 +87,7 @@ public class Treasure _currentChest = 0; _currentReward = 0; + _rewardType = rewardType; _rewards = rewards; _chestData = new ChestData[chestBlocks.length]; @@ -196,7 +199,7 @@ public class Treasure if (data != null && !data.isOpened() && _currentReward < _rewards.length) { Reward reward = _rewards[_currentReward]; - RewardData rewardData = reward.giveReward("Treasure", _player); + RewardData rewardData = reward.giveReward(_rewardType, _player); _currentReward++; if (swapList) @@ -296,7 +299,7 @@ public class Treasure for (int i = _currentReward; i < _rewards.length; i++) { - _rewards[_currentReward].giveReward("Treasure", _player); + _rewards[_currentReward].giveReward(_rewardType, _player); } _currentReward = _rewards.length; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureLocation.java b/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureLocation.java index 7368f718a..d909bbe9b 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureLocation.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureLocation.java @@ -107,7 +107,7 @@ public class TreasureLocation implements Listener Bukkit.broadcastMessage(F.main("Treasure", F.name(player.getName()) + " is opening a " + treasureType.getName())); Reward[] rewards = _treasureManager.getRewards(player, treasureType.getRewardType()); - Treasure treasure = new Treasure(player, rewards, _chestBlock, _chestSpawns, treasureType, _treasureManager.getBlockRestore(), _hologramManager); + Treasure treasure = new Treasure(player, rewards, treasureType.getRewardType(), _chestBlock, _chestSpawns, treasureType, _treasureManager.getBlockRestore(), _hologramManager); _currentTreasure = treasure; UtilTextMiddle.display(treasureType.getName(), "Choose 4 Chests To Open", 20, 180, 20, player); @@ -132,7 +132,7 @@ public class TreasureLocation implements Listener int itemCount = _inventoryManager.Get(player).getItemCount(treasureType.getItemName()); if (itemCount > 0) { - _inventoryManager.addItemToInventory(player, "Item", treasureType.getItemName(), -1); + _inventoryManager.addItemToInventory(player, treasureType.getItemName(), -1); return true; } return false; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureManager.java b/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureManager.java index 30d1a2335..92ced2a3d 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureManager.java @@ -21,6 +21,7 @@ import mineplex.core.reward.Reward; import mineplex.core.reward.RewardManager; import mineplex.core.reward.RewardType; import mineplex.core.stats.StatsManager; +import mineplex.core.status.ServerStatusManager; /** * Created by Shaun on 8/27/2014. @@ -34,7 +35,7 @@ public class TreasureManager extends MiniPlugin private StatsManager _statsManager; private List _treasureLocations; - public TreasureManager(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager, InventoryManager inventoryManager, PetManager petManager, BlockRestore blockRestore, HologramManager hologramManager, StatsManager statsManager) + public TreasureManager(JavaPlugin plugin, CoreClientManager clientManager, ServerStatusManager statusManager, DonationManager donationManager, InventoryManager inventoryManager, PetManager petManager, BlockRestore blockRestore, HologramManager hologramManager, StatsManager statsManager) { super("Treasure", plugin); @@ -42,11 +43,11 @@ public class TreasureManager extends MiniPlugin _blockRestore = blockRestore; _hologramManager = hologramManager; _statsManager = statsManager; - _rewardManager = new RewardManager(clientManager, donationManager, _inventoryManager, petManager, statsManager, + _rewardManager = new RewardManager(clientManager, statusManager, donationManager, _inventoryManager, petManager, statsManager, 100, 250, 500, 1000, 4000, 6000, - 12000, 32000, + 12000, 22000, true, false); World world = Bukkit.getWorlds().get(0); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/treasure/gui/BuyChestButton.java b/Plugins/Mineplex.Core/src/mineplex/core/treasure/gui/BuyChestButton.java index e1afeaf64..9f13d2518 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/gui/BuyChestButton.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/gui/BuyChestButton.java @@ -49,7 +49,7 @@ public class BuyChestButton implements IButton { public void run() { - _inventoryManager.addItemToInventory(player, "Item", _chestName, 1); + _inventoryManager.addItemToInventory(player, _chestName, 1); _page.refresh(); } }, _page, new ChestPackage(_chestName, _chestMat, _chestCost), CurrencyType.Coins, player)); diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/Hub.java b/Plugins/Mineplex.Hub/src/mineplex/hub/Hub.java index e196f062c..979745883 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/Hub.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/Hub.java @@ -19,8 +19,10 @@ import mineplex.core.elo.EloManager; import mineplex.core.energy.Energy; import mineplex.core.friend.FriendManager; import mineplex.core.give.Give; +import mineplex.core.globalpacket.GlobalPacketManager; import mineplex.core.hologram.HologramManager; import mineplex.core.ignore.IgnoreManager; +import mineplex.core.inventory.InventoryManager; import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.memory.MemoryFix; import mineplex.core.message.MessageManager; @@ -44,6 +46,7 @@ import mineplex.core.stats.StatsManager; import mineplex.core.status.ServerStatusManager; import mineplex.core.task.TaskManager; import mineplex.core.teleport.Teleport; +import mineplex.core.titangiveaway.TitanGiveawayManager; import mineplex.core.updater.FileUpdater; import mineplex.core.updater.Updater; import mineplex.core.velocity.VelocityFix; @@ -102,11 +105,13 @@ public class Hub extends JavaPlugin implements IRelation preferenceManager.GiveItem = true; Creature creature = new Creature(this); NpcManager npcManager = new NpcManager(this, creature); - PetManager petManager = new PetManager(this, clientManager, donationManager, disguiseManager, creature, blockRestore, webServerAddress); + InventoryManager inventoryManager = new InventoryManager(this, clientManager); + PetManager petManager = new PetManager(this, clientManager, donationManager, inventoryManager, disguiseManager, creature, blockRestore, webServerAddress); PollManager pollManager = new PollManager(this, clientManager, donationManager); //Main Modules ServerStatusManager serverStatusManager = new ServerStatusManager(this, clientManager, new LagMeter(this, clientManager)); + new TitanGiveawayManager(this, clientManager, serverStatusManager); Portal portal = new Portal(this, clientManager, serverStatusManager.getCurrentServerName()); @@ -122,7 +127,7 @@ public class Hub extends JavaPlugin implements IRelation PartyManager partyManager = new PartyManager(this, portal, clientManager, preferenceManager); PersonalServerManager personalServerManager = new PersonalServerManager(this, clientManager); - HubManager hubManager = new HubManager(this, blockRestore, clientManager, donationManager, new ConditionManager(this), disguiseManager, new TaskManager(this, clientManager, webServerAddress), portal, partyManager, preferenceManager, petManager, pollManager, statsManager, achievementManager, new HologramManager(this), npcManager, personalServerManager, packetHandler, punish); + HubManager hubManager = new HubManager(this, blockRestore, clientManager, donationManager, inventoryManager, new ConditionManager(this), disguiseManager, new TaskManager(this, clientManager, webServerAddress), portal, partyManager, preferenceManager, petManager, pollManager, statsManager, achievementManager, new HologramManager(this), npcManager, personalServerManager, packetHandler, punish, serverStatusManager); QueueManager queueManager = new QueueManager(this, clientManager, donationManager, new EloManager(this, clientManager), partyManager); @@ -140,6 +145,7 @@ public class Hub extends JavaPlugin implements IRelation return true; } }); + new GlobalPacketManager(this, clientManager, serverStatusManager); //new Replay(this, packetHandler); AprilFoolsManager.Initialize(this, clientManager, disguiseManager); diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java index 72e575a1a..bbd306e36 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java @@ -3,6 +3,79 @@ package mineplex.hub; import java.util.ArrayList; import java.util.HashMap; +import mineplex.core.MiniClientPlugin; +import mineplex.core.account.CoreClient; +import mineplex.core.account.CoreClientManager; +import mineplex.core.achievement.AchievementManager; +import mineplex.core.aprilfools.AprilFoolsManager; +import mineplex.core.benefit.BenefitManager; +import mineplex.core.blockrestore.BlockRestore; +import mineplex.core.bonuses.BonusManager; +import mineplex.core.botspam.BotSpamManager; +import mineplex.core.common.Rank; +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilInv; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilTime; +import mineplex.core.common.util.UtilWorld; +import mineplex.core.cosmetic.CosmeticManager; +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.hologram.HologramManager; +import mineplex.core.inventory.InventoryManager; +import mineplex.core.message.PrivateMessageEvent; +import mineplex.core.mount.MountManager; +import mineplex.core.mount.event.MountActivateEvent; +import mineplex.core.notifier.NotificationManager; +import mineplex.core.npc.NpcManager; +import mineplex.core.packethandler.PacketHandler; +import mineplex.core.party.Party; +import mineplex.core.party.PartyManager; +import mineplex.core.personalServer.PersonalServerManager; +import mineplex.core.pet.PetManager; +import mineplex.core.poll.PollManager; +import mineplex.core.portal.Portal; +import mineplex.core.preferences.PreferencesManager; +import mineplex.core.projectile.ProjectileManager; +import mineplex.core.punish.Punish; +import mineplex.core.stats.StatsManager; +import mineplex.core.status.ServerStatusManager; +import mineplex.core.task.TaskManager; +import mineplex.core.treasure.TreasureManager; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.hub.commands.DisguiseCommand; +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; +import mineplex.hub.modules.HubVisibilityManager; +import mineplex.hub.modules.JumpManager; +import mineplex.hub.modules.KothManager; +import mineplex.hub.modules.NewsManager; +import mineplex.hub.modules.ParkourManager; +import mineplex.hub.modules.SoccerManager; +import mineplex.hub.modules.TextManager; +import mineplex.hub.modules.WorldManager; +import mineplex.hub.profile.gui.GUIProfile; +import mineplex.hub.tutorial.TutorialManager; +import mineplex.minecraft.game.classcombat.Skill.event.SkillTriggerEvent; +import mineplex.minecraft.game.classcombat.item.event.ItemTriggerEvent; +import mineplex.minecraft.game.core.combat.DeathMessageType; +import mineplex.minecraft.game.core.combat.event.CombatDeathEvent; +import mineplex.minecraft.game.core.condition.ConditionManager; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; + import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.GameMode; @@ -34,89 +107,15 @@ import org.bukkit.event.player.PlayerVelocityEvent; import org.bukkit.event.server.ServerListPingEvent; import org.bukkit.event.world.ChunkLoadEvent; import org.bukkit.inventory.ItemStack; -import org.bukkit.inventory.meta.BookMeta; import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.scoreboard.DisplaySlot; import org.bukkit.scoreboard.Objective; import org.bukkit.scoreboard.Scoreboard; -import mineplex.core.MiniClientPlugin; -import mineplex.core.account.CoreClient; -import mineplex.core.account.CoreClientManager; -import mineplex.core.achievement.AchievementManager; -import mineplex.core.aprilfools.AprilFoolsManager; -import mineplex.core.benefit.BenefitManager; -import mineplex.core.blockrestore.BlockRestore; -import mineplex.core.botspam.BotSpamManager; -import mineplex.core.common.Rank; -import mineplex.core.common.util.C; -import mineplex.core.common.util.F; -import mineplex.core.common.util.UtilAction; -import mineplex.core.common.util.UtilAlg; -import mineplex.core.common.util.UtilInv; -import mineplex.core.common.util.UtilMath; -import mineplex.core.common.util.UtilPlayer; -import mineplex.core.common.util.UtilServer; -import mineplex.core.common.util.UtilTime; -import mineplex.core.common.util.UtilWorld; -import mineplex.core.cosmetic.CosmeticManager; -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.hologram.HologramManager; -import mineplex.core.inventory.InventoryManager; -import mineplex.core.message.PrivateMessageEvent; -import mineplex.core.mount.MountManager; -import mineplex.core.mount.event.MountActivateEvent; -import mineplex.core.notifier.NotificationManager; -import mineplex.core.npc.NpcManager; -import mineplex.core.packethandler.PacketHandler; -import mineplex.core.party.Party; -import mineplex.core.party.PartyManager; -import mineplex.core.personalServer.PersonalServerManager; -import mineplex.core.pet.PetManager; -import mineplex.core.portal.Portal; -import mineplex.core.preferences.PreferencesManager; -import mineplex.core.projectile.ProjectileManager; -import mineplex.core.punish.Punish; -import mineplex.core.reward.RewardManager; -import mineplex.core.stats.StatsManager; -import mineplex.core.task.TaskManager; -import mineplex.core.treasure.TreasureManager; -import mineplex.core.updater.UpdateType; -import mineplex.core.updater.event.UpdateEvent; -import mineplex.core.bonuses.BonusManager; -import mineplex.hub.commands.DisguiseCommand; -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; -import mineplex.hub.modules.HubVisibilityManager; -import mineplex.hub.modules.JumpManager; -import mineplex.hub.modules.KothManager; -import mineplex.hub.modules.NewsManager; -import mineplex.hub.modules.ParkourManager; -import mineplex.hub.modules.SoccerManager; -import mineplex.hub.modules.TextManager; -import mineplex.hub.modules.WorldManager; -import mineplex.core.poll.PollManager; -import mineplex.hub.profile.gui.GUIProfile; -import mineplex.hub.tutorial.TutorialManager; -import mineplex.minecraft.game.classcombat.Skill.event.SkillTriggerEvent; -import mineplex.minecraft.game.classcombat.item.event.ItemTriggerEvent; -import mineplex.minecraft.game.core.combat.DeathMessageType; -import mineplex.minecraft.game.core.combat.event.CombatDeathEvent; -import mineplex.minecraft.game.core.condition.ConditionManager; -import mineplex.minecraft.game.core.damage.CustomDamageEvent; - public class HubManager extends MiniClientPlugin { // ☃❅ Snowman! - public HubType Type = HubType.Normal; + public HubType Type = HubType.Halloween; private BlockRestore _blockRestore; private CoreClientManager _clientManager; @@ -142,6 +141,7 @@ public class HubManager extends MiniClientPlugin private PetManager _petManager; private PacketHandler _packetHandler; private PersonalServerManager _personalServerManager; +// private HalloweenSpookinessManager _halloweenManager; private Location _spawn; private int _scoreboardTick = 0; @@ -159,7 +159,7 @@ public class HubManager extends MiniClientPlugin //Admin private boolean _gadgetsEnabled = true; - public HubManager(JavaPlugin plugin, BlockRestore blockRestore, CoreClientManager clientManager, DonationManager donationManager, ConditionManager conditionManager, DisguiseManager disguiseManager, TaskManager taskManager, Portal portal, PartyManager partyManager, PreferencesManager preferences, PetManager petManager, PollManager pollManager, StatsManager statsManager, AchievementManager achievementManager, HologramManager hologramManager, NpcManager npcManager, PersonalServerManager personalServerManager, PacketHandler packetHandler, Punish punish) + public HubManager(JavaPlugin plugin, BlockRestore blockRestore, CoreClientManager clientManager, DonationManager donationManager, InventoryManager inventoryManager, ConditionManager conditionManager, DisguiseManager disguiseManager, TaskManager taskManager, Portal portal, PartyManager partyManager, PreferencesManager preferences, PetManager petManager, PollManager pollManager, StatsManager statsManager, AchievementManager achievementManager, HologramManager hologramManager, NpcManager npcManager, PersonalServerManager personalServerManager, PacketHandler packetHandler, Punish punish, ServerStatusManager serverStatusManager) { super("Hub Manager", plugin); @@ -188,11 +188,11 @@ public class HubManager extends MiniClientPlugin _news = new NewsManager(this); _mountManager = new MountManager(_plugin, clientManager, donationManager, blockRestore, _disguiseManager); - _inventoryManager = new InventoryManager(plugin, clientManager); + _inventoryManager = inventoryManager; new BenefitManager(plugin, clientManager, _inventoryManager); _gadgetManager = new GadgetManager(_plugin, clientManager, donationManager, _inventoryManager, _mountManager, petManager, preferences, disguiseManager, blockRestore, new ProjectileManager(plugin), achievementManager); - _treasureManager = new TreasureManager(_plugin, clientManager, donationManager, _inventoryManager, petManager, _blockRestore, hologramManager, statsManager); + _treasureManager = new TreasureManager(_plugin, clientManager, serverStatusManager, donationManager, _inventoryManager, petManager, _blockRestore, hologramManager, statsManager); new CosmeticManager(_plugin, clientManager, donationManager, _inventoryManager, _gadgetManager, _mountManager, petManager, _treasureManager); new SoccerManager(this, _gadgetManager); @@ -218,9 +218,10 @@ public class HubManager extends MiniClientPlugin ((CraftWorld)Bukkit.getWorlds().get(0)).getHandle().pvpMode = true; - new BonusManager(plugin, clientManager, donationManager, pollManager , npcManager, hologramManager, statsManager, _inventoryManager, petManager); - + new BonusManager(plugin, clientManager, serverStatusManager, donationManager, pollManager , npcManager, hologramManager, statsManager, _inventoryManager, petManager); +// _halloweenManager = new HalloweenSpookinessManager(this); + // NotificationManager notificationManager = new NotificationManager(plugin, clientManager, donationManager); // new MailManager(_plugin, notificationManager); @@ -740,6 +741,11 @@ public class HubManager extends MiniClientPlugin //Display Rank obj.getScore(C.cGold + C.Bold + "Rank").setScore(line--); + //Remove Old + player.getScoreboard().resetScores(_clientManager.Get(player).GetLastRank(false).Name); + player.getScoreboard().resetScores(_clientManager.Get(player).GetLastRank(true).Name); + player.getScoreboard().resetScores("No Rank"); + //Add New if (GetClients().Get(player).GetRank().has(Rank.ULTRA)) obj.getScore(GetClients().Get(player).GetRank().Name).setScore(line--); else if (GetDonation().Get(player.getName()).OwnsUnknownPackage("SuperSmashMobs ULTRA") || @@ -843,6 +849,11 @@ public class HubManager extends MiniClientPlugin return _visibilityManager; } +// public HalloweenSpookinessManager getHalloweenManager() +// { +// return _halloweenManager; +// } + @EventHandler(priority = EventPriority.MONITOR) public void gadgetCollide(GadgetCollideEntityEvent event) { diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/HalloweenSpookinessManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/HalloweenSpookinessManager.java new file mode 100644 index 000000000..1369420a2 --- /dev/null +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/HalloweenSpookinessManager.java @@ -0,0 +1,233 @@ +package mineplex.hub.modules; + +import java.util.ArrayList; +import java.util.HashSet; +import java.util.Set; + +import mineplex.core.MiniPlugin; +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilEnt; +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.disguise.disguises.DisguiseArmorStand; +import mineplex.core.itemstack.ItemBuilder; +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 org.bukkit.Color; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.entity.Skeleton; +import org.bukkit.event.EventHandler; +import org.bukkit.util.Vector; + +public class HalloweenSpookinessManager extends MiniPlugin +{ + /** + * + * This class doesn't work (yet.) I haven't had time to debug it due to the halloween update + * releasing in.. one hour..? + * Maybe release later this week or in future halloweens. + * @author Mysticate + * + */ + + protected class CreepyDudeData + { + public final Location Location; + public final Skeleton Skeleton; + public final DisguiseArmorStand Disguise; + + public CreepyDudeData(Location loc, Skeleton skel, DisguiseArmorStand stand) + { + Location = loc; + Skeleton = skel; + Disguise = stand; + } + + public void resetStare() + { + Disguise.setHeadPosition(new Vector(UtilAlg.GetPitch(Location.getDirection()), UtilAlg.GetYaw(Location.getDirection()), 0)); + } + } + + private HubManager _manager; + private final boolean _enabled; + + private Set _creepyDudes = new HashSet(); + + private Player _target; + private long _targetTime = System.currentTimeMillis(); + private long _lastTarget = System.currentTimeMillis(); + + public HalloweenSpookinessManager(HubManager manager) + { + super("Halloween Manager", manager.getPlugin()); + + _manager = manager; + _enabled = manager.Type == HubType.Halloween; + } + + @Override + public void enable() + { + if (!_enabled) + return; + + Location creepyDudeLoc = new Location(_manager.GetSpawn().getWorld(), 9.5, 72.0, -8.5, 70, 46); + Location creepyLittleDude1Loc = new Location(_manager.GetSpawn().getWorld(), 10.25, 72.0, -7.75, 70, 46); + Location creepyLittleDude2Loc = new Location(_manager.GetSpawn().getWorld(), 8.75, 72.0, -9.25, 70, 46); + + Skeleton creepyDude = spawnCreepyDude(creepyDudeLoc); + Skeleton creepyLittleDude1 = spawnCreepyDude(creepyLittleDude1Loc); + Skeleton creepyLittleDude2 = spawnCreepyDude(creepyLittleDude2Loc); + + DisguiseArmorStand creepyDudeDisguise = disguiseCreepyDude(creepyDude, creepyDudeLoc, false); + DisguiseArmorStand creepyLittleDude1Disguise = disguiseCreepyDude(creepyLittleDude1, creepyLittleDude1Loc, true); + DisguiseArmorStand creepyLittleDude2Disguise = disguiseCreepyDude(creepyLittleDude2, creepyLittleDude2Loc, true); + + _creepyDudes.add(new CreepyDudeData(creepyDudeLoc, creepyDude, creepyDudeDisguise)); + _creepyDudes.add(new CreepyDudeData(creepyLittleDude1Loc, creepyLittleDude1, creepyLittleDude1Disguise)); + _creepyDudes.add(new CreepyDudeData(creepyLittleDude2Loc, creepyLittleDude2, creepyLittleDude2Disguise)); + } + + @Override + public void disable() + { + if (!_enabled) + return; + + for (CreepyDudeData data : _creepyDudes) + { + data.Skeleton.remove(); + } + } + + private Skeleton spawnCreepyDude(Location loc) + { + Skeleton skeleton = loc.getWorld().spawn(loc, Skeleton.class); + + UtilEnt.silence(skeleton, true); + UtilEnt.Vegetate(skeleton); + UtilEnt.ghost(skeleton, true, false); + + skeleton.getEquipment().setItemInHand(ItemStackFactory.Instance.CreateStack(0)); + skeleton.getEquipment().setHelmet(ItemStackFactory.Instance.CreateStack(Material.SKULL_ITEM)); + skeleton.getEquipment().setChestplate(new ItemBuilder(Material.LEATHER_CHESTPLATE).setUnbreakable(true).setColor(Color.BLACK).build()); + skeleton.getEquipment().setLeggings(new ItemBuilder(Material.LEATHER_LEGGINGS).setUnbreakable(true).setColor(Color.BLACK).build()); + skeleton.getEquipment().setHelmet(new ItemBuilder(Material.LEATHER_BOOTS).setUnbreakable(true).setColor(Color.BLACK).build()); + + return skeleton; + } + + private DisguiseArmorStand disguiseCreepyDude(Skeleton creepyDude, Location loc, boolean small) + { + DisguiseArmorStand disguise = new DisguiseArmorStand(creepyDude); + disguise.setHeadPosition(new Vector(UtilAlg.GetPitch(loc.getDirection()), UtilAlg.GetYaw(loc.getDirection()), 0)); + + disguise.setCustomNameVisible(false); + disguise.setInvisible(true); + disguise.setRemoveBase(); + + if (small) + disguise.setSmall(); + + _manager.GetDisguise().disguise(disguise); + return disguise; + } + + @EventHandler + public void creepSmallChildOut(UpdateEvent event) + { + if (!_enabled) + return; + + if (event.getType() != UpdateType.TICK) + return; + + if (_target == null) + return; + + //Follow for 2 seconds + if (!_target.isOnline() || _manager.getPreferences().Get(_target).Invisibility || UtilTime.elapsed(_targetTime, 2000)) + { + resetFollowing(); + return; + } + + for (CreepyDudeData data : _creepyDudes) + { + Vector vec = UtilAlg.getTrajectory(data.Skeleton.getEyeLocation(), _target.getEyeLocation()); + data.Disguise.setHeadPosition(new Vector(UtilAlg.GetPitch(vec), UtilAlg.GetYaw(vec), 0)); + } + } + + @EventHandler + public void targetSmallChild(UpdateEvent event) + { + if (!_enabled) + return; + + if (event.getType() != UpdateType.FAST) + return; + + if (_target != null) + return; + + if (!UtilTime.elapsed(_lastTarget, 1000 * 60 + UtilMath.r(30) * 1000)) + return; + + Player target = findTarget(); + if (target == null) + return; + + _target = target; + _targetTime = System.currentTimeMillis(); + } + + private void resetFollowing() + { + _target = null; + _lastTarget = System.currentTimeMillis(); + + for (CreepyDudeData data : _creepyDudes) + { + data.resetStare(); + } + } + + private Player findTarget() + { + ArrayList dudeLocations = new ArrayList(); + for (CreepyDudeData data : _creepyDudes) + { + dudeLocations.add(data.Location); + } + + Location average = UtilAlg.getAverageLocation(dudeLocations); + ArrayList best = new ArrayList(); + + for (Player player : UtilServer.getPlayers()) + { + if (!UtilPlayer.is1_8(player)) + continue; + + if (_manager.getPreferences().Get(player).Invisibility) + continue; + + if (UtilMath.offset(player.getLocation(), average) <= 7) + best.add(player); + } + + if (best.isEmpty()) + return null; + + return UtilAlg.Random(best); + } +} diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/NewsManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/NewsManager.java index efc323beb..b41043b9d 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/NewsManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/NewsManager.java @@ -3,14 +3,6 @@ package mineplex.hub.modules; import java.util.HashMap; import java.util.Iterator; -import org.bukkit.Bukkit; -import org.bukkit.ChatColor; -import org.bukkit.entity.Creature; -import org.bukkit.entity.Player; -import org.bukkit.entity.Wither; -import org.bukkit.event.EventHandler; -import org.bukkit.event.player.PlayerJoinEvent; - import mineplex.core.MiniPlugin; import mineplex.core.common.Rank; import mineplex.core.common.util.C; @@ -18,9 +10,9 @@ import mineplex.core.common.util.Callback; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilTextMiddle; import mineplex.core.common.util.UtilTextTop; import mineplex.core.common.util.UtilTime; -import mineplex.core.common.util.UtilTextMiddle; import mineplex.core.gadget.gadgets.MorphWither; import mineplex.core.gadget.types.Gadget; import mineplex.core.gadget.types.GadgetType; @@ -30,6 +22,15 @@ import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.hub.HubManager; import mineplex.hub.HubRepository; +import mineplex.hub.HubType; + +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.entity.Creature; +import org.bukkit.entity.Player; +import org.bukkit.entity.Wither; +import org.bukkit.event.EventHandler; +import org.bukkit.event.player.PlayerJoinEvent; public class NewsManager extends MiniPlugin { @@ -39,7 +40,7 @@ public class NewsManager extends MiniPlugin private int _newsIndex = 0; private long _newsTime = System.currentTimeMillis(); - private int _mineplexIndex = 0; + private int _animationIndex = 0; private HubRepository _repository = new HubRepository(); @@ -228,30 +229,169 @@ public class NewsManager extends MiniPlugin RefreshNews(); } + @EventHandler + public void joinNewsOverlay(final PlayerJoinEvent event) + { + for (int i=0 ; i<_news.length ; i++) + { + final int count = i; + + UtilServer.getServer().getScheduler().runTaskLater(Manager.getPlugin(), new Runnable() + { + @Override + public void run() + { + UtilTextMiddle.display(C.cGold + C.Bold + "MINEPLEX" + ChatColor.RESET, _news[_news.length - 1 - count] + ChatColor.RESET, (count == 0) ? 20 : 0, 60, 20, event.getPlayer()); + } + }, 60 * i + (i != 0 ? 20 : 0)); + } + } + @EventHandler public void DragonBarUpdate(UpdateEvent event) { if (event.getType() != UpdateType.FASTEST) return; - - _mineplexIndex = (_mineplexIndex + 1)%6; - //News Change - if (UtilTime.elapsed(_newsTime, 4500)) + String text = ""; + double healthPercent = 1; + + if (Manager.Type == HubType.Halloween) { - _newsIndex = (_newsIndex + 1)%_news.length; - _newsTime = System.currentTimeMillis(); + /** + * @author Mysticate + * Myst's sexy ass animation :> + */ + + _animationIndex = (_animationIndex + 1) % 147; + + if (_animationIndex == 0) text = C.cGoldB + " "; + if (_animationIndex == 1) text = C.cGoldB + " H"; + if (_animationIndex == 2) text = C.cGoldB + " HA"; + if (_animationIndex == 3) text = C.cGoldB + " HAP"; + if (_animationIndex == 4) text = C.cGoldB + " HAPP"; + if (_animationIndex == 5) text = C.cGoldB + " HAPPY"; + if (_animationIndex == 6) text = C.cGoldB + " HAPPY "; + if (_animationIndex == 7) text = C.cGoldB + " HAPPY H"; + if (_animationIndex == 8) text = C.cGoldB + " HAPPY HA"; + if (_animationIndex == 9) text = C.cGoldB + " HAPPY HAL"; + if (_animationIndex == 10) text = C.cGoldB + " HAPPY HALL"; + if (_animationIndex == 11) text = C.cGoldB + " HAPPY HALLO"; + if (_animationIndex == 12) text = C.cGoldB + " HAPPY HALLOW"; + if (_animationIndex == 13) text = C.cGoldB + " HAPPY HALLOWE"; + if (_animationIndex == 14) text = C.cGoldB + " HAPPY HALLOWEE"; + if (_animationIndex == 15) text = C.cGoldB + " HAPPY HALLOWEEN"; + if (_animationIndex == 16) text = C.cGoldB + " HAPPY HALLOWEEN "; + if (_animationIndex == 17) text = C.cGoldB + " HAPPY HALLOWEEN "; + if (_animationIndex == 18) text = C.cGoldB + " HAPPY HALLOWEEN "; + if (_animationIndex == 19) text = C.cGoldB + " HAPPY HALLOWEEN "; + if (_animationIndex == 20) text = C.cGoldB + " HAPPY HALLOWEEN "; + if (_animationIndex == 20) text = C.cGoldB + " HAPPY HALLOWEEN "; + if (_animationIndex == 21 || _animationIndex == 22) text = C.cGoldB + " HAPPY HALLOWEEN "; + + if (_animationIndex > 22 && _animationIndex <= 42) + { + if (_animationIndex % 3 == 0) text = C.cWhiteB + "2015" + C.cGoldB + " HAPPY HALLOWEEN " + C.cWhiteB + "2015"; + else if (_animationIndex % 3 == 1) text = C.cWhiteB + "2015" + C.cRedB + " HAPPY HALLOWEEN " + C.cWhiteB + "2015"; + else text = C.cWhiteB + "2015" + C.cYellowB + " HAPPY HALLOWEEN " + C.cWhiteB + "2015"; + } + + if (_animationIndex == 43 || _animationIndex == 44) text = C.cGoldB + " HAPPY HALLOWEEN "; + if (_animationIndex == 45) text = C.cGoldB + " HAPPY HALLOWEEN "; + if (_animationIndex == 46) text = C.cGoldB + " HAPPY HALLOWEEN "; + if (_animationIndex == 47) text = C.cGoldB + " HAPPY HALLOWEEN "; + if (_animationIndex == 48) text = C.cGoldB + " HAPPY HALLOWEEN "; + if (_animationIndex == 49) text = C.cGoldB + " HAPPY HALLOWEEN "; + if (_animationIndex == 50) text = C.cGoldB + " HAPPY HALLOWEEN "; + if (_animationIndex == 51) text = C.cGoldB + "HAPPY HALLOWEEN "; + if (_animationIndex == 52) text = C.cGoldB + "APPY HALLOWEEN "; + if (_animationIndex == 53) text = C.cGoldB + "PPY HALLOWEEN "; + if (_animationIndex == 54) text = C.cGoldB + "PY HALLOWEEN "; + if (_animationIndex == 55) text = C.cGoldB + "Y HALLOWEEN "; + if (_animationIndex == 56) text = C.cGoldB + " HALLOWEEN "; + if (_animationIndex == 57) text = C.cGoldB + "HALLOWEEN "; + if (_animationIndex == 58) text = C.cGoldB + "ALLOWEEN "; + if (_animationIndex == 59) text = C.cGoldB + "LLOWEEN "; + if (_animationIndex == 60) text = C.cGoldB + "LOWEEN "; + if (_animationIndex == 61) text = C.cGoldB + "OWEEN "; + if (_animationIndex == 62) text = C.cGoldB + "WEEN "; + if (_animationIndex == 63) text = C.cGoldB + "EEN "; + if (_animationIndex == 64) text = C.cGoldB + "EN "; + if (_animationIndex == 65) text = C.cGoldB + "N "; + if (_animationIndex == 66) text = C.cGoldB + " "; + + if (_animationIndex == 66) text = C.cGoldB + " S"; + if (_animationIndex == 67) text = C.cGoldB + " SP"; + if (_animationIndex == 68) text = C.cGoldB + " SPO"; + if (_animationIndex == 69) text = C.cGoldB + " SPOO"; + if (_animationIndex == 70) text = C.cGoldB + " SPOOK"; + if (_animationIndex == 71) text = C.cGoldB + " SPOOKY"; + if (_animationIndex == 72) text = C.cGoldB + " SPOOKY "; + if (_animationIndex == 73) text = C.cGoldB + " SPOOKY S"; + if (_animationIndex == 74) text = C.cGoldB + " SPOOKY SA"; + if (_animationIndex == 75) text = C.cGoldB + " SPOOKY SAL"; + if (_animationIndex == 76) text = C.cGoldB + " SPOOKY SALE"; + if (_animationIndex == 77) text = C.cGoldB + " SPOOKY SALE "; + if (_animationIndex == 78) text = C.cGoldB + " SPOOKY SALE "; + if (_animationIndex == 79) text = C.cGoldB + " SPOOKY SALE "; + if (_animationIndex == 80) text = C.cGoldB + " SPOOKY SALE "; + if (_animationIndex == 81) text = C.cGoldB + " SPOOKY SALE "; + if (_animationIndex == 82) text = C.cGoldB + " SPOOKY SALE "; + if (_animationIndex == 83) text = C.cGoldB + " SPOOKY SALE "; + if (_animationIndex == 84 || _animationIndex == 85) text = C.cGoldB + " SPOOKY SALE "; + + if (_animationIndex > 84 && _animationIndex <= 124) + { + if (_animationIndex % 2 == 0) text = C.cWhiteB + "50% OFF" + C.cGoldB + " SPOOKY SALE " + C.cWhiteB + "50% OFF"; + else if (_animationIndex % 2 == 1) text = C.cWhiteB + "50% OFF" + C.cRedB + " SPOOKY SALE " + C.cWhiteB + "50% OFF"; + else text = C.cWhiteB + "50% OFF" + C.cYellowB + " SPOOKY SALE " + C.cWhiteB + "50% OFF"; + } + + if (_animationIndex == 125 || _animationIndex == 126) text = C.cGoldB + " SPOOKY SALE "; + if (_animationIndex == 127) text = C.cGoldB + " SPOOKY SALE "; + if (_animationIndex == 128) text = C.cGoldB + " SPOOKY SALE "; + if (_animationIndex == 129) text = C.cGoldB + " SPOOKY SALE "; + if (_animationIndex == 130) text = C.cGoldB + " SPOOKY SALE "; + if (_animationIndex == 131) text = C.cGoldB + " SPOOKY SALE "; + if (_animationIndex == 132) text = C.cGoldB + " SPOOKY SALE "; + if (_animationIndex == 133) text = C.cGoldB + " SPOOKY SALE "; + if (_animationIndex == 134) text = C.cGoldB + " SPOOKY SALE "; + if (_animationIndex == 135) text = C.cGoldB + "SPOOKY SALE "; + if (_animationIndex == 136) text = C.cGoldB + "POOKY SALE "; + if (_animationIndex == 137) text = C.cGoldB + "OOKY SALE "; + if (_animationIndex == 138) text = C.cGoldB + "OKY SALE "; + if (_animationIndex == 139) text = C.cGoldB + "KY SALE "; + if (_animationIndex == 140) text = C.cGoldB + "Y SALE "; + if (_animationIndex == 141) text = C.cGoldB + " SALE "; + if (_animationIndex == 142) text = C.cGoldB + "SALE "; + if (_animationIndex == 143) text = C.cGoldB + "ALE "; + if (_animationIndex == 144) text = C.cGoldB + "LE "; + if (_animationIndex == 145) text = C.cGoldB + "E "; + if (_animationIndex == 146) text = C.cGoldB + " "; } - if (_newsIndex >= _news.length) + else { - // Resets newsIndex if outside of bounds of news array after RefreshNews but before UtilTime.elapsed above - _newsIndex = 0; + + + //News Change + if (UtilTime.elapsed(_newsTime, 4500)) + { + _newsIndex = (_newsIndex + 1)%_news.length; + _newsTime = System.currentTimeMillis(); + } + if (_newsIndex >= _news.length) + { + // Resets newsIndex if outside of bounds of news array after RefreshNews but before UtilTime.elapsed above + _newsIndex = 0; + } + + healthPercent = (double)_newsIndex/(double)(_news.length-1); + text = _news[_newsIndex]; } - double healthPercent = (double)_newsIndex/(double)(_news.length-1); - String text = _news[_newsIndex]; - UtilTextTop.display(text, UtilServer.getPlayers()); + + //Fix Entity Names for (Creature pet : Manager.getPetManager().getPets()) { if (pet instanceof Wither) @@ -277,22 +417,4 @@ public class NewsManager extends MiniPlugin } } } - - @EventHandler - public void joinNewsOverlay(final PlayerJoinEvent event) - { - for (int i=0 ; i<_news.length ; i++) - { - final int count = i; - - UtilServer.getServer().getScheduler().runTaskLater(Manager.getPlugin(), new Runnable() - { - @Override - public void run() - { - UtilTextMiddle.display(C.cGold + C.Bold + "MINEPLEX" + ChatColor.RESET, _news[_news.length - 1 - count] + ChatColor.RESET, (count == 0) ? 20 : 0, 60, 20, event.getPlayer()); - } - }, 60 * i + (i != 0 ? 20 : 0)); - } - } -} +} \ No newline at end of file diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/queue/QueueRepository.java b/Plugins/Mineplex.Hub/src/mineplex/hub/queue/QueueRepository.java index 3e66c7a84..0dfdf8640 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/queue/QueueRepository.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/queue/QueueRepository.java @@ -30,32 +30,6 @@ public class QueueRepository public void initialize() { - PreparedStatement preparedStatement = null; - - try (Connection connection = DBPool.QUEUE.getConnection()) - { - // Create table - preparedStatement = connection.prepareStatement(CREATE_ELO_QUEUE_TABLE); - preparedStatement.execute(); - } - catch (Exception exception) - { - exception.printStackTrace(); - } - finally - { - if (preparedStatement != null) - { - try - { - preparedStatement.close(); - } - catch (SQLException e) - { - e.printStackTrace(); - } - } - } } public void deleteQueueRecord(PlayerMatchStatus matchStatus) diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerGameMenu.java b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerGameMenu.java index 3e17d1070..17f606598 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerGameMenu.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerGameMenu.java @@ -64,7 +64,7 @@ public class ServerGameMenu extends ShopPageBase ChatColor.RESET + "Join " + ChatColor.GREEN + getPlugin().getGroupTagPlayerCount("BR") + ChatColor.RESET + " other players!", })); - setItem(2, ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD.getId(), (byte)0, 1, ChatColor.RESET + C.Bold + ChatColor.YELLOW + "Survival Games " + C.cGray + "Solo/Team Survival", new String[] + setItem(2, ItemStackFactory.Instance.CreateStack(Material.DIAMOND_SWORD.getId(), (byte)0, 1, ChatColor.RESET + C.Bold + ChatColor.YELLOW + "Survival Games " + C.cGray + "Solo/Team Survival", new String[] { ChatColor.RESET + "", ChatColor.RESET + "Search for chests to find loot and ", diff --git a/Plugins/Mineplex.MapParser/src/mineplex/mapparser/GameType.java b/Plugins/Mineplex.MapParser/src/mineplex/mapparser/GameType.java index 7fe8dd6f8..5a0e9e0ca 100644 --- a/Plugins/Mineplex.MapParser/src/mineplex/mapparser/GameType.java +++ b/Plugins/Mineplex.MapParser/src/mineplex/mapparser/GameType.java @@ -37,6 +37,7 @@ public enum GameType MineStrike("MineStrike"), MineWare("MineWare"), MilkCow("Milk the Cow"), + MonsterMaze("Monster Maze"), Paintball("Super Paintball"), Quiver("One in the Quiver"), QuiverTeams("One in the Quiver Teams"), diff --git a/Plugins/Mineplex.MapParser/src/mineplex/mapparser/MapParser.java b/Plugins/Mineplex.MapParser/src/mineplex/mapparser/MapParser.java index 622e7516c..c807b068f 100644 --- a/Plugins/Mineplex.MapParser/src/mineplex/mapparser/MapParser.java +++ b/Plugins/Mineplex.MapParser/src/mineplex/mapparser/MapParser.java @@ -1,6 +1,8 @@ package mineplex.mapparser; +import java.io.BufferedWriter; import java.io.File; +import java.io.FileWriter; import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; @@ -8,6 +10,39 @@ import java.util.Iterator; import java.util.LinkedList; import java.util.List; +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.UtilBlock; +import mineplex.core.common.util.UtilEvent; +import mineplex.core.common.util.UtilEvent.ActionType; +import mineplex.core.common.util.UtilGear; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilTime; +import mineplex.core.common.util.UtilWorld; +import mineplex.mapparser.command.AdminCommand; +import mineplex.mapparser.command.AuthorCommand; +import mineplex.mapparser.command.BaseCommand; +import mineplex.mapparser.command.CopyCommand; +import mineplex.mapparser.command.CopySchematicsCommand; +import mineplex.mapparser.command.CreateCommand; +import mineplex.mapparser.command.DeleteCommand; +import mineplex.mapparser.command.GameTypeCommand; +import mineplex.mapparser.command.HubCommand; +import mineplex.mapparser.command.ListCommand; +import mineplex.mapparser.command.MapCommand; +import mineplex.mapparser.command.NameCommand; +import mineplex.mapparser.command.ParseCommand200; +import mineplex.mapparser.command.ParseCommand400; +import mineplex.mapparser.command.ParseCommand600; +import mineplex.mapparser.command.RenameCommand; +import mineplex.mapparser.command.SaveCommand; +import mineplex.mapparser.command.SetSpawnCommand; +import mineplex.mapparser.command.SpawnCommand; +import mineplex.mapparser.command.WorldsCommand; + import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.GameMode; @@ -29,6 +64,7 @@ import org.bukkit.event.block.BlockIgniteEvent; import org.bukkit.event.block.BlockIgniteEvent.IgniteCause; import org.bukkit.event.block.BlockSpreadEvent; import org.bukkit.event.block.LeavesDecayEvent; +import org.bukkit.event.block.SignChangeEvent; import org.bukkit.event.entity.EntitySpawnEvent; import org.bukkit.event.player.AsyncPlayerChatEvent; import org.bukkit.event.player.PlayerCommandPreprocessEvent; @@ -40,40 +76,28 @@ import org.bukkit.plugin.Plugin; import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.util.Vector; -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.UtilBlock; -import mineplex.core.common.util.UtilEvent; -import mineplex.core.common.util.UtilEvent.ActionType; -import mineplex.core.common.util.UtilGear; -import mineplex.core.common.util.UtilPlayer; -import mineplex.core.common.util.UtilServer; -import mineplex.mapparser.command.*; - public class MapParser extends JavaPlugin implements Listener { private WorldManager _worldManager; - + private Parse _curParse = null; private HashMap _mapData = new HashMap(); private HashSet _mapsBeingZipped = new HashSet(); private List _commands = new ArrayList(); private Location _spawnLocation; - + private HashMap _permissionMap = new HashMap(); - + @Override public void onEnable() { _worldManager = new WorldManager(this); - + getServer().getPluginManager().registerEvents(this, this); - + getServer().getWorlds().get(0).setSpawnLocation(0, 106, 0); _spawnLocation = new Location(getServer().getWorlds().get(0), 0, 106, 0); - + //Updates getServer().getScheduler().scheduleSyncRepeatingTask(this, new Ticker(this), 1, 1); @@ -101,21 +125,21 @@ public class MapParser extends JavaPlugin implements Listener @Override public void onDisable() { - + } - + @EventHandler public void PlayerJoin(PlayerJoinEvent event) { Player player = event.getPlayer(); - + player.teleport(getSpawnLocation()); - + ResetInventory(event.getPlayer()); - + DisplayHelp(player); } - + @EventHandler public void permissionUpdate(TickEvent event) { @@ -124,11 +148,11 @@ public class MapParser extends JavaPlugin implements Listener permissionSet(player); } } - + public void permissionSet(Player player) { boolean hasPermission = GetData(player.getWorld().getName()).HasAccess(player); - + if (!_permissionMap.containsKey(player) || _permissionMap.get(player) != hasPermission) { for (Plugin plugin : Bukkit.getPluginManager().getPlugins()) @@ -137,18 +161,18 @@ public class MapParser extends JavaPlugin implements Listener player.addAttachment(plugin, "voxelsniper.sniper", hasPermission); player.addAttachment(plugin, "voxelsniper.brush.*", hasPermission); } - + _permissionMap.put(player, hasPermission); - + UtilPlayer.message(player, "Plugin Permissions: " + F.tf(hasPermission)); } } - - + + public void DisplayHelp(Player player) { UtilPlayer.message(player, F.main("Parser", "Listing Commands;")); - UtilPlayer.message(player, F.value("Parameters", "Parameters: = Required, [?] = Optional")); + UtilPlayer.message(player, F.value("Parameters", "Parameters: = Required, [?] = Optional")); UtilPlayer.message(player, F.value("/hub", "Return to hub world")); UtilPlayer.message(player, " "); UtilPlayer.message(player, F.value("/name ", "Set name for current map")); @@ -165,9 +189,9 @@ public class MapParser extends JavaPlugin implements Listener UtilPlayer.message(player, F.value("/map [gametype]", "Teleport to a map")); UtilPlayer.message(player, " "); UtilPlayer.message(player, C.cYellow + "Documentation: " + C.cGreen + "http://tinyurl.com/mpxmaps"); - + } - + @EventHandler public void Command(PlayerCommandPreprocessEvent event) { @@ -186,7 +210,7 @@ public class MapParser extends JavaPlugin implements Listener if (event.getMessage().toLowerCase().startsWith("/help")) { event.setCancelled(true); - + DisplayHelp(player); } @@ -197,7 +221,7 @@ public class MapParser extends JavaPlugin implements Listener if (alias.equalsIgnoreCase(commandLabel)) { event.setCancelled(true); - + if (!command.execute(player, commandLabel, args)) { UtilPlayer.message(player, F.main("Parser", "Invalid Input.")); @@ -229,13 +253,13 @@ public class MapParser extends JavaPlugin implements Listener { if (_curParse == null) return; - + if (_curParse.Update()) { Announce("Parse Completed!"); - + Announce("Cleaning and Creating ZIP..."); - + try { _worldManager.finalizeParsedWorld(_curParse.getWorld()); @@ -245,55 +269,55 @@ public class MapParser extends JavaPlugin implements Listener Announce("Creating ZIP Failed! Please Try Again!"); e.printStackTrace(); } - + _curParse = null; } } - + @EventHandler public void DisableCreatures(EntitySpawnEvent event) { if (event.getEntityType() == EntityType.DROPPED_ITEM || event.getEntity() instanceof LivingEntity) event.setCancelled(true); } - + @EventHandler public void DisableBurn(BlockBurnEvent event) { event.setCancelled(true); } - + @EventHandler public void DisableIgnite(BlockIgniteEvent event) { if (event.getCause() == IgniteCause.LAVA || event.getCause() == IgniteCause.SPREAD) event.setCancelled(true); } - + @EventHandler public void DisableFire(BlockSpreadEvent event) { event.setCancelled(true); } - + @EventHandler public void DisableFade(BlockFadeEvent event) { event.setCancelled(true); } - + @EventHandler public void DisableDecay(LeavesDecayEvent event) { event.setCancelled(true); } - + @EventHandler public void DisableIceForm(BlockFormEvent event) { event.setCancelled(true); } - + @EventHandler public void Updates(PlayerMoveEvent event) { @@ -305,12 +329,12 @@ public class MapParser extends JavaPlugin implements Listener world.setTime(8000); world.setStorm(false); } - - + + if (event.getPlayer().getGameMode() != GameMode.CREATIVE) event.getPlayer().setGameMode(GameMode.CREATIVE); } - + @EventHandler public void SaveUnloadWorlds(TickEvent event) { @@ -333,14 +357,14 @@ public class MapParser extends JavaPlugin implements Listener _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()); } - }); + }); } } } @@ -466,13 +490,13 @@ public class MapParser extends JavaPlugin implements Listener 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)); -// player.getInventory().addItem(new ItemStack(Material.STONE_AXE)); -// player.getInventory().addItem(new ItemStack(Material.WOOD_AXE)); + // 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)); + // player.getInventory().addItem(new ItemStack(Material.STONE_AXE)); + // player.getInventory().addItem(new ItemStack(Material.WOOD_AXE)); } public WorldManager getWorldManager() @@ -531,14 +555,14 @@ public class MapParser extends JavaPlugin implements Listener public void commandCancel(PlayerCommandPreprocessEvent event) { if (event.getMessage().startsWith("/tp") || - event.getMessage().startsWith("/hub") || - event.getMessage().startsWith("/list") || - event.getMessage().startsWith("/map") || - event.getMessage().startsWith("/create") || - event.getMessage().startsWith("/copy") || - event.getMessage().startsWith("/delete")) + event.getMessage().startsWith("/hub") || + event.getMessage().startsWith("/list") || + event.getMessage().startsWith("/map") || + event.getMessage().startsWith("/create") || + event.getMessage().startsWith("/copy") || + event.getMessage().startsWith("/delete")) return; - + //Permission if (!GetData(event.getPlayer().getWorld().getName()).HasAccess(event.getPlayer())) { @@ -563,24 +587,24 @@ public class MapParser extends JavaPlugin implements Listener { event.setQuitMessage(F.sys("Player Quit", event.getPlayer().getName())); } - + @EventHandler(priority = EventPriority.LOWEST) public void TeleportCommand(PlayerCommandPreprocessEvent event) { if (!event.getMessage().toLowerCase().startsWith("/tp")) return; - + Player player = event.getPlayer(); - + String[] tokens = event.getMessage().split(" "); - + if (tokens.length != 2) { return; } - + event.setCancelled(true); - + Player target = UtilPlayer.searchOnline(player, tokens[1], true); if (target != null) { @@ -588,30 +612,30 @@ public class MapParser extends JavaPlugin implements Listener player.teleport(target); } } - + @EventHandler(priority = EventPriority.LOWEST) public void FlySpeed(PlayerCommandPreprocessEvent event) { if (!event.getMessage().toLowerCase().startsWith("/speed")) return; - + Player player = event.getPlayer(); - + String[] tokens = event.getMessage().split(" "); - + if (tokens.length != 2) { return; } - + event.setCancelled(true); - + try { float speed = Float.parseFloat(tokens[1]); - + player.setFlySpeed(speed); - + UtilPlayer.message(player, F.main("Game", "Fly Speed set to " + F.elem("" + speed) + ".")); } catch (Exception e) @@ -619,28 +643,28 @@ public class MapParser extends JavaPlugin implements Listener UtilPlayer.message(player, F.main("Game", "Invalid Speed Input.")); } } - + private HashMap>> treeHistory = new HashMap>>(); - + @EventHandler(priority = EventPriority.HIGHEST) public void treeRemover(PlayerInteractEvent event) { if (event.isCancelled()) return; - + //Permission if (!GetData(event.getPlayer().getWorld().getName()).HasAccess(event.getPlayer())) { return; } - + Player player = event.getPlayer(); - + if (!UtilGear.isMat(player.getItemInHand(), Material.NETHER_STAR)) return; - + event.setCancelled(true); - + //Remove if (event.getAction() == Action.LEFT_CLICK_BLOCK) { @@ -649,31 +673,31 @@ public class MapParser extends JavaPlugin implements Listener player.sendMessage(C.cRed + C.Bold + "TreeTool: " + ChatColor.RESET + "Left-Click on Log"); return; } - + HashSet toRemove = searchLog(new HashSet(), event.getClickedBlock()); - + if (toRemove.isEmpty()) { player.sendMessage(C.cRed + C.Bold + "TreeTool: " + ChatColor.RESET + "Left-Click on Log"); return; } - + HashSet history = new HashSet(); - + for (Block block : toRemove) { history.add(new BlockData(block)); - + block.setType(Material.AIR); } - + if (!treeHistory.containsKey(player)) treeHistory.put(player, new ArrayList>()); - + treeHistory.get(player).add(0, history); - + player.sendMessage(C.cRed + C.Bold + "TreeTool: " + ChatColor.RESET + "Tree Removed"); - + while (treeHistory.get(player).size() > 10) treeHistory.get(player).remove(10); } @@ -684,66 +708,227 @@ public class MapParser extends JavaPlugin implements Listener player.sendMessage(C.cGreen + C.Bold + "TreeTool: " + ChatColor.RESET + "No Tree History"); return; } - + HashSet datas = treeHistory.get(player).remove(0); - + for (BlockData data : datas) data.restore(); - + player.sendMessage(C.cGreen + C.Bold + "TreeTool: " + ChatColor.RESET + "Tree Restored"); } } + @EventHandler + public void mmMazeParser(PlayerInteractEvent event) + { + if (event.isCancelled()) + return; + + if (event.getAction() != Action.LEFT_CLICK_BLOCK) return; + + //Permission + if (!GetData(event.getPlayer().getWorld().getName()).HasAccess(event.getPlayer())) + { + return; + } + + Player player = event.getPlayer(); + + if (!UtilGear.isMat(player.getItemInHand(), Material.WEB)) + return; + + event.setCancelled(true); + + // parse + + Block clicked = event.getClickedBlock(); + Location center = clicked.getLocation(); + Location lowestCorner = center.clone().subtract(49, 0, 49); + + // 0 = air or other + // 1 = path - quartz + // 2 = mob spawn - gold + // 3 = safe spawn - stone + + int[][] maze = new int[99][99]; + + /*Iterator iter = blocks.iterator(); + while(iter.hasNext()) + { + Block b = iter.next(); + switch (b.getType()) { + case QUARTZ_BLOCK: + maze[x][y] = 1; + break; + + case GOLD_BLOCK: + maze[x][y] = 2; + break; + + case STONE: + maze[x][y] = 3; + break; + + default: + maze[x][y] = 0; + break; + } + x++; + if(x > 99) + { + y++; + x = 0; + } + if(y > 99) + { + System.out.println("y > 99"); + break; + } + }*/ + + for (int i = 0; i < 99; i++) + for (int j = 0; j < 99; j++) + maze[i][j] = getMMParseValue(lowestCorner.clone().add(j, 0, i).getBlock().getType()); + + //Save + try + { + FileWriter fstream = new FileWriter(GetData(player.getWorld().getName()).MapFolder + File.separator + "Maze.dat"); + BufferedWriter out = new BufferedWriter(fstream); + + out.write("private static final int[][] PARSED_MAZE = {" + System.lineSeparator()); + for (int j[] : maze) + { + out.write("{"); + boolean first = true; + for (int k : j) + { + if(!first) out.write(","); + out.write(k + ""); + + first = false; + } + out.write("}," + System.lineSeparator()); + } + out.write("};" + System.lineSeparator()); + + out.close(); + } + catch (Exception e) + { + player.sendMessage(C.cRed + C.Bold + "MMMazeParse: " + ChatColor.RESET + "An error has occured, see console."); + e.printStackTrace(); + } + player.sendMessage(C.cGreen + C.Bold + "MMMazeParse: " + ChatColor.RESET + "Maze parsed."); + } + + private int getMMParseValue(Material m) + { + switch (m) { + case QUARTZ_BLOCK: + return 1; + + case GOLD_BLOCK: + return 2; + + case STONE: + return 3; + + case DIRT: + return 4; + + case COBBLESTONE: + return 5; + + case BRICK: + return 6; + + default: + return 0; + } + } + private HashSet searchLog(HashSet blocks, Block current) { //Not Tree if (current.getType() != Material.LOG && current.getType() != Material.LEAVES) return blocks; - + if (!blocks.add(current)) return blocks; - + for (Block other : UtilBlock.getSurrounding(current, true)) { if (current.getType() != Material.LOG && current.getType() != Material.LEAVES) continue; - + if (blocks.contains(other)) continue; - + //Dont spread from leaves to log if (current.getType() == Material.LEAVES && other.getType() == Material.LOG) continue; - + searchLog(blocks, other); } - + return blocks; } - + long lastUse = 0; @EventHandler(priority = EventPriority.LOWEST) public void leaptest(PlayerInteractEvent event) { - + if (event.getPlayer().getItemInHand() == null) return; - + if (event.getPlayer().getItemInHand().getType() != Material.FEATHER) return; - + if (System.currentTimeMillis() - lastUse < 800) { Bukkit.broadcastMessage("Cooldown"); return; } - - + + lastUse = System.currentTimeMillis(); - + Vector vel = event.getPlayer().getLocation().getDirection().multiply(1.2); vel.add(new Vector(0,0.6,0)); - + event.getPlayer().setVelocity(vel); } + + @EventHandler + public void signChangeLog(SignChangeEvent event) + { + if (GetData(event.getPlayer().getWorld().getName()).HasAccess(event.getPlayer())) + { + try + { + File file = new File(event.getPlayer().getWorld().getName() + "/" + "sign_log.txt"); + + if (!file.exists()) + file.createNewFile(); + + FileWriter fw = new FileWriter(file.getAbsoluteFile(), true); + BufferedWriter bw = new BufferedWriter(fw); + + bw.write("\n\n"); + bw.write("\n" + "Date: " + UtilTime.now()); + bw.write("\n" + "Player: " + event.getPlayer().getName()); + bw.write("\n" + "Location: " + UtilWorld.locToStrClean(event.getBlock().getLocation())); + for (int i=0 ; i implements IClas if (!_enabled) return; - if (event.getMessage().equals("/skill")) + if (event.getMessage().length() < 1) + return; + + String[] args = event.getMessage().toLowerCase().split(" "); + + if (args[0].equals("/skill")) { - ClientClass client = Get(event.getPlayer().getName()); + Player target = event.getPlayer(); + + //Target Other + if (args.length > 1 && _clientManager.Get(event.getPlayer()).GetRank().has(Rank.MODERATOR)) + { + target = UtilPlayer.searchOnline(event.getPlayer(), args[1], true); + + if (target == null) + { + return; + } + } + + ClientClass client = Get(target.getName()); if (client == null) - event.getPlayer().sendMessage("You do not have a ClientClass."); + event.getPlayer().sendMessage(target.getName() + " does not have a ClientClass."); else { client.DisplaySkills(event.getPlayer()); diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/shop/page/SkillPage.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/shop/page/SkillPage.java index 37c726d6c..176cfb332 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/shop/page/SkillPage.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/shop/page/SkillPage.java @@ -400,10 +400,10 @@ public class SkillPage extends ShopPageBase } }, this, new SkillSalesPackage(skill), CurrencyType.Gems, player)); } - + private boolean isSkillLocked(ISkill skill) { - if (skill.IsFree() || getClientManager().Get(getPlayer().getName()).GetRank().has(Rank.ULTRA) || getDonationManager().Get(getPlayer().getName()).OwnsUnknownPackage("Champions ULTRA") || getDonationManager().Get(getPlayer().getName()).OwnsUnknownPackage("Champions " + skill.GetName())) + if (skill.IsFree() || getClientManager().Get(getPlayer().getName()).GetRank().has(Rank.HELPER) || getDonationManager().Get(getPlayer().getName()).OwnsUnknownPackage("Champions ULTRA") || getDonationManager().Get(getPlayer().getName()).OwnsUnknownPackage("Champions " + skill.GetName())) return false; return true; @@ -411,7 +411,7 @@ public class SkillPage extends ShopPageBase private boolean isItemLocked(Item item) { - if (item.isFree() || getClientManager().Get(getPlayer().getName()).GetRank().has(Rank.ULTRA) || getDonationManager().Get(getPlayer().getName()).OwnsUnknownPackage("Champions ULTRA") || getDonationManager().Get(getPlayer().getName()).OwnsUnknownPackage("Champions " + item.GetName())) + if (item.isFree() || getClientManager().Get(getPlayer().getName()).GetRank().has(Rank.HELPER) || getDonationManager().Get(getPlayer().getName()).OwnsUnknownPackage("Champions ULTRA") || getDonationManager().Get(getPlayer().getName()).OwnsUnknownPackage("Champions " + item.GetName())) return false; return true; diff --git a/Plugins/Mineplex.ServerMonitor/src/mineplex/servermonitor/ServerMonitor.java b/Plugins/Mineplex.ServerMonitor/src/mineplex/servermonitor/ServerMonitor.java index fad091eb9..8056b8d2a 100644 --- a/Plugins/Mineplex.ServerMonitor/src/mineplex/servermonitor/ServerMonitor.java +++ b/Plugins/Mineplex.ServerMonitor/src/mineplex/servermonitor/ServerMonitor.java @@ -183,12 +183,19 @@ public class ServerMonitor log("Using " + usedCpuPercent + "% of available CPU (" + availableCPU + " Free) and " + usedRamPercent + "% of available RAM (" + availableRAM / 1000 + "GB Free)"); - _historyRepository.saveDedicatedServerStats(_dedicatedServers); - log("Saved Dedicated Server Stats."); - _historyRepository.saveServerGroupStats((int)totalCPU, (int)totalRAM, _serverGroupMap.values()); - log("Saved ServerGroup Stats."); - _historyRepository.saveNetworkStats(usedCpuPercent, usedRamPercent, availableCPU, availableRAM, _region); - log("Saved Network Stats."); + try + { + _historyRepository.saveDedicatedServerStats(_dedicatedServers); + log("Saved Dedicated Server Stats."); + _historyRepository.saveServerGroupStats((int)totalCPU, (int)totalRAM, _serverGroupMap.values()); + log("Saved ServerGroup Stats."); + _historyRepository.saveNetworkStats(usedCpuPercent, usedRamPercent, availableCPU, availableRAM, _region); + log("Saved Network Stats."); + } + catch (Exception ex) + { + ex.printStackTrace(); + } if (_count == 0) { @@ -305,21 +312,28 @@ public class ServerMonitor while (_processes.size() > 0) { - for (Iterator iterator = _processes.iterator(); iterator.hasNext();) + try { - ProcessRunner pr = iterator.next(); - - try + for (Iterator iterator = _processes.iterator(); iterator.hasNext();) { - pr.join(100); - } - catch (InterruptedException e) - { - e.printStackTrace(); + ProcessRunner pr = iterator.next(); + + try + { + pr.join(100); + } + catch (InterruptedException e) + { + e.printStackTrace(); + } + + if (pr.isDone()) + iterator.remove(); } - - if (pr.isDone()) - iterator.remove(); + } + catch (Exception ex) + { + ex.printStackTrace(); } if (_processes.size() > 0) @@ -335,7 +349,7 @@ public class ServerMonitor } } - if (processWaits >= 10) + if (processWaits >= 5) { log("Killing stale processes."); @@ -344,6 +358,8 @@ public class ServerMonitor iterator.next().abort(); iterator.remove(); } + + _processes.clear(); } processWaits++; @@ -366,7 +382,7 @@ public class ServerMonitor catch (Exception ex) { log("Error doing something : " + ex.getMessage()); - + ex.printStackTrace(); try { Thread.sleep(1000); diff --git a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/password/PasswordRepository.java b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/password/PasswordRepository.java index 20cb041e0..f0cf867d4 100644 --- a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/password/PasswordRepository.java +++ b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/password/PasswordRepository.java @@ -31,7 +31,7 @@ public class PasswordRepository extends RepositoryBase @Override protected void initialize() { - executeUpdate(CREATE_SERVER_PASSWORD_TABLE); + //executeUpdate(CREATE_SERVER_PASSWORD_TABLE); } @Override diff --git a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/command/ItemCommand.java b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/command/ItemCommand.java index 336fd3c46..a7760bad9 100644 --- a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/command/ItemCommand.java +++ b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/command/ItemCommand.java @@ -40,12 +40,6 @@ public class ItemCommand extends CommandBase final String itemName = tempName; final int amount = amountSpecified; - if (!Plugin.getInventoryManager().validCategory(category)) - { - caller.sendMessage(F.main(Plugin.getName(), "You have entered an invalid Category.")); - return; - } - if (!Plugin.getInventoryManager().validItem(itemName)) { caller.sendMessage(F.main(Plugin.getName(), "You have entered an invalid Item.")); @@ -76,7 +70,7 @@ public class ItemCommand extends CommandBase UtilPlayer.message(caller, F.main(Plugin.getName(), "ERROR processing " + playerName + " " + amount + " " + itemName + ".")); } } - }, uuid, category, itemName, amount); + }, uuid, itemName, amount); } }, playerName, client.getAccountId(), (amount == 1 ? itemName : itemName + " " + amount), false, 0, false); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/Arcade.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/Arcade.java index 71fa876f8..08a7f2bec 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/Arcade.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/Arcade.java @@ -6,7 +6,7 @@ import org.bukkit.entity.Player; import org.bukkit.plugin.java.JavaPlugin; import mineplex.core.FoodDupeFix; -import org.omg.CORBA._PolicyStub; +import mineplex.core.globalpacket.GlobalPacketManager; import net.minecraft.server.v1_7_R4.BiomeBase; import net.minecraft.server.v1_7_R4.MinecraftServer; @@ -27,9 +27,6 @@ import mineplex.core.disguise.DisguiseManager; import mineplex.core.donation.DonationManager; import mineplex.core.friend.FriendManager; import mineplex.core.gadget.GadgetManager; -import mineplex.core.gadget.gadgets.OutfitTeam; -import mineplex.core.gadget.types.Gadget; -import mineplex.core.gadget.types.GadgetType; import mineplex.core.give.Give; import mineplex.core.hologram.HologramManager; import mineplex.core.ignore.IgnoreManager; @@ -60,7 +57,6 @@ import mineplex.core.visibility.VisibilityManager; import mineplex.minecraft.game.core.combat.CombatManager; import mineplex.minecraft.game.core.damage.DamageManager; import nautilus.game.arcade.game.GameServerConfig; -import nautilus.game.arcade.game.Game.GameState; public class Arcade extends JavaPlugin { @@ -141,13 +137,14 @@ public class Arcade extends JavaPlugin //Inventory InventoryManager inventoryManager = new InventoryManager(this, _clientManager); - PetManager petManager = new PetManager(this, _clientManager, _donationManager, disguiseManager, creature, blockRestore, webServerAddress); + PetManager petManager = new PetManager(this, _clientManager, _donationManager, inventoryManager, disguiseManager, creature, blockRestore, webServerAddress); MountManager mountManager = new MountManager(this, _clientManager, _donationManager, blockRestore, disguiseManager); GadgetManager gadgetManager = new GadgetManager(this, _clientManager, _donationManager, inventoryManager, mountManager, petManager, preferenceManager, disguiseManager, blockRestore, projectileManager, achievementManager); CosmeticManager cosmeticManager = new CosmeticManager(this, _clientManager, _donationManager, inventoryManager, gadgetManager, mountManager, petManager, null); cosmeticManager.setInterfaceSlot(7); cosmeticManager.disableTeamArmor(); - + + new GlobalPacketManager(this, _clientManager, serverStatusManager); //Arcade Manager PollManager pollManager = new PollManager(this, _clientManager, _donationManager); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java index 036793db1..61e1dca19 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java @@ -1,42 +1,11 @@ package nautilus.game.arcade; -import java.awt.Event; import java.io.File; import java.util.ArrayList; import java.util.HashSet; import java.util.Iterator; import java.util.Map.Entry; -import org.bukkit.Bukkit; -import org.bukkit.ChatColor; -import org.bukkit.GameMode; -import org.bukkit.Material; -import org.bukkit.OfflinePlayer; -import org.bukkit.Sound; -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEntity; -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer; -import org.bukkit.entity.Entity; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.EventPriority; -import org.bukkit.event.HandlerList; -import org.bukkit.event.block.BlockBurnEvent; -import org.bukkit.event.block.BlockFadeEvent; -import org.bukkit.event.block.BlockSpreadEvent; -import org.bukkit.event.block.LeavesDecayEvent; -import org.bukkit.event.entity.CreatureSpawnEvent; -import org.bukkit.event.inventory.InventoryType; -import org.bukkit.event.player.PlayerCommandPreprocessEvent; -import org.bukkit.event.player.PlayerJoinEvent; -import org.bukkit.event.player.PlayerLoginEvent; -import org.bukkit.event.player.PlayerQuitEvent; -import org.bukkit.event.server.ServerListPingEvent; -import org.bukkit.potion.PotionEffect; -import org.bukkit.util.Vector; - -import com.google.common.base.Objects; - import mineplex.core.MiniPlugin; import mineplex.core.account.CoreClientManager; import mineplex.core.achievement.AchievementManager; @@ -63,9 +32,7 @@ import mineplex.core.donation.DonationManager; import mineplex.core.elo.EloManager; import mineplex.core.energy.Energy; import mineplex.core.explosion.Explosion; -import mineplex.core.gadget.gadgets.OutfitTeam; -import mineplex.core.gadget.types.Gadget; -import mineplex.core.gadget.types.GadgetType; +import mineplex.core.explosion.ExplosionEvent; import mineplex.core.hologram.HologramManager; import mineplex.core.inventory.InventoryManager; import mineplex.core.itemstack.ItemStackFactory; @@ -83,8 +50,8 @@ import mineplex.core.poll.PollManager; import mineplex.core.portal.Portal; import mineplex.core.preferences.PreferencesManager; import mineplex.core.projectile.ProjectileManager; -import mineplex.core.resourcepack.ResUnloadCheck; import mineplex.core.resourcepack.ResPackManager; +import mineplex.core.resourcepack.ResUnloadCheck; import mineplex.core.resourcepack.redis.RedisUnloadResPack; import mineplex.core.reward.RewardRarity; import mineplex.core.reward.rewards.PetReward; @@ -93,6 +60,7 @@ import mineplex.core.status.ServerStatusManager; import mineplex.core.task.TaskManager; import mineplex.core.teleport.Teleport; import mineplex.core.timing.TimingManager; +import mineplex.core.titangiveaway.TitanGiveawayManager; import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.classcombat.Class.ClassManager; import mineplex.minecraft.game.classcombat.Condition.SkillConditionManager; @@ -111,9 +79,9 @@ import nautilus.game.arcade.addons.TeamArmorAddon; import nautilus.game.arcade.addons.compass.CompassAddon; import nautilus.game.arcade.command.DisguiseCommand; import nautilus.game.arcade.command.GameCommand; +import nautilus.game.arcade.command.KitUnlockCommand; import nautilus.game.arcade.command.RequiredRankCommand; import nautilus.game.arcade.command.WriteCommand; -import nautilus.game.arcade.command.KitUnlockCommand; import nautilus.game.arcade.events.GameStateChangeEvent; import nautilus.game.arcade.game.Game; import nautilus.game.arcade.game.Game.GameState; @@ -135,9 +103,41 @@ import nautilus.game.arcade.managers.GameSpectatorManager; import nautilus.game.arcade.managers.GameStatManager; import nautilus.game.arcade.managers.GameTournamentManager; import nautilus.game.arcade.managers.GameWorldManager; +import nautilus.game.arcade.managers.HolidayManager; import nautilus.game.arcade.managers.IdleManager; import nautilus.game.arcade.managers.MiscManager; import nautilus.game.arcade.shop.ArcadeShop; + +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.GameMode; +import org.bukkit.Material; +import org.bukkit.OfflinePlayer; +import org.bukkit.Sound; +import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEntity; +import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer; +import org.bukkit.entity.Entity; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.HandlerList; +import org.bukkit.event.block.BlockBurnEvent; +import org.bukkit.event.block.BlockFadeEvent; +import org.bukkit.event.block.BlockSpreadEvent; +import org.bukkit.event.block.LeavesDecayEvent; +import org.bukkit.event.entity.CreatureSpawnEvent; +import org.bukkit.event.entity.EntityExplodeEvent; +import org.bukkit.event.inventory.InventoryType; +import org.bukkit.event.player.PlayerCommandPreprocessEvent; +import org.bukkit.event.player.PlayerJoinEvent; +import org.bukkit.event.player.PlayerLoginEvent; +import org.bukkit.event.player.PlayerQuitEvent; +import org.bukkit.event.server.ServerListPingEvent; +import org.bukkit.potion.PotionEffect; +import org.bukkit.util.Vector; + +import com.google.common.base.Objects; public class ArcadeManager extends MiniPlugin implements IRelation { @@ -294,7 +294,8 @@ public class ArcadeManager extends MiniPlugin implements IRelation new MiscManager(this); _hologramManager = hologramManager; _idleManager = new IdleManager(this); - //new HolidayManager(this); + TitanGiveawayManager titanGiveaway = new TitanGiveawayManager(getPlugin(), clientManager, serverStatusManager); + new HolidayManager(this, titanGiveaway); // Game Addons new CompassAddon(plugin, this); @@ -303,7 +304,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation new NotificationManager(getPlugin(), clientManager); - new BonusManager(plugin, clientManager, donationManager, pollManager , npcManager, hologramManager, statsManager, _inventoryManager, petManager); + new BonusManager(plugin, clientManager, serverStatusManager, donationManager, pollManager , npcManager, hologramManager, statsManager, _inventoryManager, petManager); //Champions Modules _energy = new Energy(plugin); @@ -820,7 +821,9 @@ public class ArcadeManager extends MiniPlugin implements IRelation return; } } - if (_clientManager.Get(event.getPlayer().getName()).GetRank().has(event.getPlayer(), Rank.MODERATOR, false)) + if (_clientManager.Get(event.getPlayer().getName()).GetRank().has(event.getPlayer(), Rank.MODERATOR, false) || + _clientManager.Get(event.getPlayer().getName()).GetRank() == Rank.MAPDEV || + _clientManager.Get(event.getPlayer().getName()).GetRank() == Rank.MAPLEAD) { event.allow(); event.setResult(PlayerLoginEvent.Result.ALLOWED); @@ -939,7 +942,10 @@ public class ArcadeManager extends MiniPlugin implements IRelation player.setLevel(0); player.setExp(0f); + player.setPlayerTime(player.getWorld().getTime(), false); + ((CraftPlayer) player).getHandle().spectating = false; + ((CraftPlayer) player).getHandle().ghost = false; ((CraftPlayer) player).getHandle().k = true; // Arrows go bye bye. @@ -1385,6 +1391,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation player.setFlying(true); player.setFlySpeed(0.1f); ((CraftPlayer) player).getHandle().spectating = true; + ((CraftPlayer) player).getHandle().ghost = true; ((CraftPlayer) player).getHandle().k = false; GetCondition().Factory().Cloak("Spectator", player, player, 7777, true, true); @@ -1559,4 +1566,43 @@ public class ArcadeManager extends MiniPlugin implements IRelation { _requiredRank = rank; } + + @EventHandler(priority=EventPriority.LOWEST) + public void explosionCancel(EntityExplodeEvent event) + { + if (GetGame() == null || !GetGame().InProgress()) + { + event.blockList().clear(); + event.setCancelled(true); + } + } + + @EventHandler(priority = EventPriority.LOWEST) + public void explosionCancel(ExplosionEvent event) + { + if (GetGame() == null || !GetGame().InProgress()) + { + event.GetBlocks().clear(); + } + } + + @EventHandler + public void spawnDebug(PlayerCommandPreprocessEvent event) + { + if (event.getPlayer().isOp() && event.getMessage().contains("setmax")) + { + try + { + int i = Integer.parseInt(event.getMessage().split(" ")[1]); + + _serverConfig.MaxPlayers = i; + } + catch (Exception e) + { + + } + + event.setCancelled(true); + } + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/GameType.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/GameType.java index 875e86e77..282858030 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/GameType.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/GameType.java @@ -1,5 +1,7 @@ package nautilus.game.arcade; +import org.bukkit.Material; + import mineplex.core.game.GameCategory; import mineplex.core.game.GameDisplay; import nautilus.game.arcade.game.Game; @@ -31,6 +33,7 @@ import nautilus.game.arcade.game.games.micro.Micro; import nautilus.game.arcade.game.games.milkcow.MilkCow; import nautilus.game.arcade.game.games.minestrike.MineStrike; import nautilus.game.arcade.game.games.mineware.MineWare; +import nautilus.game.arcade.game.games.monstermaze.MonsterMaze; import nautilus.game.arcade.game.games.oldmineware.OldMineWare; import nautilus.game.arcade.game.games.paintball.Paintball; import nautilus.game.arcade.game.games.quiver.Quiver; @@ -59,8 +62,6 @@ import nautilus.game.arcade.game.games.wither.WitherGame; import nautilus.game.arcade.game.games.wizards.Wizards; import nautilus.game.arcade.game.games.zombiesurvival.ZombieSurvival; -import org.bukkit.Material; - public enum GameType { //Mini @@ -121,6 +122,7 @@ public enum GameType Cards(Cards.class, GameDisplay.Cards), Skywars(SoloSkywars.class, GameDisplay.Skywars), SkywarsTeams(TeamSkywars.class, GameDisplay.SkywarsTeams, new GameType[]{GameType.Skywars}, false), + MonsterMaze(MonsterMaze.class, GameDisplay.MonsterMaze), Event(EventGame.class, GameDisplay.Event, new GameType[]{ GameType.BaconBrawl, GameType.Barbarians, GameType.Bridge, GameType.Build, GameType.Build, diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/Bridge.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/Bridge.java index f839c7539..e10942288 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/Bridge.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/Bridge.java @@ -6,6 +6,52 @@ import java.util.HashSet; import java.util.Iterator; import java.util.UUID; +import mineplex.core.common.Rank; +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.MapUtil; +import mineplex.core.common.util.NautHashMap; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilEvent; +import mineplex.core.common.util.UtilEvent.ActionType; +import mineplex.core.common.util.UtilGear; +import mineplex.core.common.util.UtilInv; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilTextMiddle; +import mineplex.core.common.util.UtilTime; +import mineplex.core.common.util.UtilWorld; +import mineplex.core.explosion.ExplosionEvent; +import mineplex.core.itemstack.ItemStackFactory; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.minecraft.game.core.combat.event.CombatDeathEvent; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.GameType; +import nautilus.game.arcade.events.GameStateChangeEvent; +import nautilus.game.arcade.events.PlayerDeathOutEvent; +import nautilus.game.arcade.game.Game; +import nautilus.game.arcade.game.GameTeam; +import nautilus.game.arcade.game.TeamGame; +import nautilus.game.arcade.game.games.bridge.kits.KitApple; +import nautilus.game.arcade.game.games.bridge.kits.KitArcher; +import nautilus.game.arcade.game.games.bridge.kits.KitBeserker; +import nautilus.game.arcade.game.games.bridge.kits.KitBomber; +import nautilus.game.arcade.game.games.bridge.kits.KitDestructor; +import nautilus.game.arcade.game.games.bridge.kits.KitMammoth; +import nautilus.game.arcade.game.games.bridge.kits.KitMiner; +import nautilus.game.arcade.kit.Kit; +import nautilus.game.arcade.ore.OreHider; +import nautilus.game.arcade.ore.OreObsfucation; +import nautilus.game.arcade.stats.BridgesSniperStatTracker; +import nautilus.game.arcade.stats.DeathBomberStatTracker; +import nautilus.game.arcade.stats.FoodForTheMassesStatTracker; +import nautilus.game.arcade.stats.KillFastStatTracker; +import nautilus.game.arcade.stats.TntMinerStatTracker; + import org.bukkit.ChatColor; import org.bukkit.Effect; import org.bukkit.Location; @@ -29,6 +75,7 @@ import org.bukkit.event.block.BlockFromToEvent; import org.bukkit.event.block.BlockPlaceEvent; import org.bukkit.event.entity.EntityChangeBlockEvent; import org.bukkit.event.entity.EntityExplodeEvent; +import org.bukkit.event.entity.EntitySpawnEvent; import org.bukkit.event.entity.ItemSpawnEvent; import org.bukkit.event.inventory.PrepareItemCraftEvent; import org.bukkit.event.player.PlayerBucketEmptyEvent; @@ -40,45 +87,6 @@ import org.bukkit.inventory.ItemStack; import org.bukkit.metadata.FixedMetadataValue; import org.bukkit.util.Vector; -import mineplex.core.common.Rank; -import mineplex.core.common.util.C; -import mineplex.core.common.util.F; -import mineplex.core.common.util.MapUtil; -import mineplex.core.common.util.NautHashMap; -import mineplex.core.common.util.UtilAction; -import mineplex.core.common.util.UtilAlg; -import mineplex.core.common.util.UtilBlock; -import mineplex.core.common.util.UtilEvent; -import mineplex.core.common.util.UtilGear; -import mineplex.core.common.util.UtilTextMiddle; -import mineplex.core.common.util.UtilWorld; -import mineplex.core.common.util.UtilEvent.ActionType; -import mineplex.core.common.util.UtilMath; -import mineplex.core.common.util.UtilPlayer; -import mineplex.core.common.util.UtilTime; -import mineplex.core.explosion.ExplosionEvent; -import mineplex.core.itemstack.ItemStackFactory; -import mineplex.core.updater.event.UpdateEvent; -import mineplex.core.updater.UpdateType; -import mineplex.minecraft.game.core.combat.event.CombatDeathEvent; -import mineplex.minecraft.game.core.damage.CustomDamageEvent; -import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.GameType; -import nautilus.game.arcade.events.GameStateChangeEvent; -import nautilus.game.arcade.events.PlayerDeathOutEvent; -import nautilus.game.arcade.game.Game; -import nautilus.game.arcade.game.GameTeam; -import nautilus.game.arcade.game.TeamGame; -import nautilus.game.arcade.game.games.bridge.kits.*; -import nautilus.game.arcade.kit.Kit; -import nautilus.game.arcade.ore.OreHider; -import nautilus.game.arcade.ore.OreObsfucation; -import nautilus.game.arcade.stats.BridgesSniperStatTracker; -import nautilus.game.arcade.stats.DeathBomberStatTracker; -import nautilus.game.arcade.stats.KillFastStatTracker; -import nautilus.game.arcade.stats.FoodForTheMassesStatTracker; -import nautilus.game.arcade.stats.TntMinerStatTracker; - public class Bridge extends TeamGame implements OreObsfucation { /** @@ -1159,6 +1167,59 @@ public class Bridge extends TeamGame implements OreObsfucation if (!IsAlive(event.getPlayer())) return; + //No water basing + if (event.getBlock().getRelative(BlockFace.UP).isLiquid() || + event.getBlockReplacedState().getTypeId() == 8 || + event.getBlockReplacedState().getTypeId() == 9 || + event.getBlockReplacedState().getTypeId() == 10 || + event.getBlockReplacedState().getTypeId() == 11) + { + if (event.getItemInHand() != null && + event.getItemInHand().getType() == Material.WOOD_DOOR || + event.getItemInHand().getTypeId() == 193 || //1.8 doors + event.getItemInHand().getTypeId() == 194 || //1.8 doors + event.getItemInHand().getTypeId() == 195 || //1.8 doors + event.getItemInHand().getTypeId() == 196 || //1.8 doors + event.getItemInHand().getTypeId() == 197 || //1.8 doors + event.getItemInHand().getTypeId() == 330 || //1.8 doors + event.getItemInHand().getTypeId() == 427 || //1.8 doors + event.getItemInHand().getTypeId() == 428 || //1.8 doors + event.getItemInHand().getTypeId() == 429 || //1.8 doors + event.getItemInHand().getTypeId() == 430 || //1.8 doors + event.getItemInHand().getTypeId() == 431 || //1.8 doors + event.getItemInHand().getType() == Material.TRAP_DOOR || + event.getItemInHand().getTypeId() == 167 || //Iron trap door + event.getItemInHand().getType() == Material.LADDER || + event.getItemInHand().getType() == Material.STONE_PLATE || + event.getItemInHand().getType() == Material.WOOD_PLATE || + event.getItemInHand().getType() == Material.IRON_PLATE || + event.getItemInHand().getType() == Material.GOLD_PLATE || + event.getItemInHand().getType() == Material.WOOD_BUTTON || + event.getItemInHand().getType() == Material.STONE_BUTTON || + event.getItemInHand().getType() == Material.SIGN || + event.getItemInHand().getType() == Material.FENCE || + event.getItemInHand().getType() == Material.FENCE_GATE || + event.getItemInHand().getTypeId() == 183 || //1.8 Fences stuff + event.getItemInHand().getTypeId() == 184 || + event.getItemInHand().getTypeId() == 185 || + event.getItemInHand().getTypeId() == 186 || + event.getItemInHand().getTypeId() == 187 || + event.getItemInHand().getTypeId() == 188 || + event.getItemInHand().getTypeId() == 189 || + event.getItemInHand().getTypeId() == 190 || + event.getItemInHand().getTypeId() == 191 || + event.getItemInHand().getTypeId() == 192 || + event.getItemInHand().getType() == Material.NETHER_FENCE || + event.getItemInHand().getType() == Material.STEP || + event.getItemInHand().getType() == Material.WOOD_STEP || + event.getItemInHand().getTypeId() == 182) //Red sandstone slab + { + event.getPlayer().getWorld().playEffect(event.getBlock().getLocation(), Effect.STEP_SOUND, event.getItemInHand().getTypeId()); + event.setCancelled(true); + return; + } + } + //Too High if (event.getBlock().getLocation().getBlockY() > GetHeightLimit()) { @@ -1735,6 +1796,40 @@ public class Bridge extends TeamGame implements OreObsfucation cheaterKill(damager); } } + + @EventHandler + public void preventMinecarts(PlayerInteractEvent event) + { + if (!IsLive()) + return; + + if (!IsAlive(event.getPlayer())) + return; + + if (!UtilEvent.isAction(event, ActionType.R)) + return; + + if (event.getItem() == null) + return; + + if (event.getItem().getType().toString().toLowerCase().contains("minecart")) + { + event.setCancelled(true); + UtilInv.Update(event.getPlayer()); + } + } + + @EventHandler + public void preventMinecarts(EntitySpawnEvent event) + { + if (!IsLive()) + return; + + if (event.getEntityType().toString().toLowerCase().contains("minecart")) + { + event.getEntity().remove(); + } + } public void cheaterKill(Player player) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/build/Build.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/build/Build.java index 92ead83b8..e0fad7f01 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/build/Build.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/build/Build.java @@ -4,7 +4,42 @@ import java.util.AbstractMap; import java.util.ArrayList; import java.util.Map.Entry; +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.NautHashMap; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilEvent; +import mineplex.core.common.util.UtilEvent.ActionType; +import mineplex.core.common.util.UtilGear; +import mineplex.core.common.util.UtilInv; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilParticle.ParticleType; +import mineplex.core.common.util.UtilParticle.ViewDist; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilTextBottom; +import mineplex.core.common.util.UtilTextMiddle; +import mineplex.core.common.util.UtilTime; +import mineplex.core.explosion.ExplosionEvent; +import mineplex.core.itemstack.ItemStackFactory; +import mineplex.core.recharge.Recharge; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.GameType; +import nautilus.game.arcade.events.GameStateChangeEvent; +import nautilus.game.arcade.events.PlayerPrepareTeleportEvent; +import nautilus.game.arcade.game.SoloGame; +import nautilus.game.arcade.game.games.build.gui.MobShop; +import nautilus.game.arcade.game.games.build.gui.OptionsShop; +import nautilus.game.arcade.game.games.build.kits.KitBuilder; +import nautilus.game.arcade.kit.Kit; + import org.bukkit.ChatColor; +import org.bukkit.Effect; import org.bukkit.GameMode; import org.bukkit.Location; import org.bukkit.Material; @@ -13,6 +48,7 @@ import org.bukkit.block.Block; import org.bukkit.entity.Boat; import org.bukkit.entity.Entity; import org.bukkit.entity.EntityType; +import org.bukkit.entity.FallingBlock; import org.bukkit.entity.Hanging; import org.bukkit.entity.Item; import org.bukkit.entity.ItemFrame; @@ -41,6 +77,7 @@ import org.bukkit.event.block.BlockPistonRetractEvent; import org.bukkit.event.block.BlockPlaceEvent; import org.bukkit.event.entity.CreatureSpawnEvent; import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason; +import org.bukkit.event.entity.EntityChangeBlockEvent; import org.bukkit.event.entity.EntityCombustEvent; import org.bukkit.event.entity.EntityDamageByEntityEvent; import org.bukkit.event.entity.EntityDamageEvent; @@ -63,42 +100,6 @@ import org.bukkit.event.vehicle.VehicleCreateEvent; import org.bukkit.event.vehicle.VehicleDamageEvent; import org.bukkit.inventory.ItemStack; -import mineplex.core.common.Rank; -import mineplex.core.common.util.C; -import mineplex.core.common.util.F; -import mineplex.core.common.util.NautHashMap; -import mineplex.core.common.util.UtilAction; -import mineplex.core.common.util.UtilAlg; -import mineplex.core.common.util.UtilEvent; -import mineplex.core.common.util.UtilEvent.ActionType; -import mineplex.core.common.util.UtilParticle.ParticleType; -import mineplex.core.common.util.UtilParticle.ViewDist; -import mineplex.core.common.util.UtilGear; -import mineplex.core.common.util.UtilInv; -import mineplex.core.common.util.UtilMath; -import mineplex.core.common.util.UtilParticle; -import mineplex.core.common.util.UtilPlayer; -import mineplex.core.common.util.UtilServer; -import mineplex.core.common.util.UtilTextBottom; -import mineplex.core.common.util.UtilTime; -import mineplex.core.common.util.UtilTextMiddle; -import mineplex.core.explosion.ExplosionEvent; -import mineplex.core.itemstack.ItemStackFactory; -import mineplex.core.recharge.Recharge; -import mineplex.core.updater.UpdateType; -import mineplex.core.updater.event.UpdateEvent; -import mineplex.minecraft.game.core.damage.CustomDamageEvent; -import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.GameType; -import nautilus.game.arcade.events.GameStateChangeEvent; -import nautilus.game.arcade.events.PlayerPrepareTeleportEvent; -import nautilus.game.arcade.game.SoloGame; -import nautilus.game.arcade.game.Game.GameState; -import nautilus.game.arcade.game.games.build.gui.MobShop; -import nautilus.game.arcade.game.games.build.gui.OptionsShop; -import nautilus.game.arcade.game.games.build.kits.KitBuilder; -import nautilus.game.arcade.kit.Kit; - public class Build extends SoloGame { private NautHashMap _data = new NautHashMap(); @@ -932,6 +933,36 @@ public class Build extends SoloGame return; } } + + @EventHandler + public void blockForm(EntityChangeBlockEvent event) + { + if (!(event.getEntity() instanceof FallingBlock)) + return; + + if (!event.getBlock().isLiquid()) + return; + + boolean in = false; + for (BuildData data : _data.values()) + { + if (data.inBuildArea(event.getBlock())) + { + in = true; + break; + } + } + + if (!in) + { + event.setCancelled(true); + + event.getEntity().remove(); + + //Effect + event.getBlock().getWorld().playEffect(event.getBlock().getLocation(), Effect.STEP_SOUND, ((FallingBlock) event.getEntity()).getBlockId()); + } + } @EventHandler public void entityCombust(EntityCombustEvent event) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/build/BuildData.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/build/BuildData.java index a8306e7d1..61d8ac2a5 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/build/BuildData.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/build/BuildData.java @@ -308,6 +308,17 @@ public class BuildData if (mat == Material.LAVA_BUCKET) mat = Material.LAVA; else if (mat == Material.WATER_BUCKET) mat = Material.WATER; + //Set everything to air first to prevent the forming of obby. + if (mat == Material.LAVA || mat == Material.WATER) + { + int y = Math.min(CornerA.getBlockY(), CornerB.getBlockY()) - 1; + for (int x= Math.min(CornerA.getBlockX(), CornerB.getBlockX()) ; x <= Math.max(CornerA.getBlockX(), CornerB.getBlockX()) ; x++) + for (int z= Math.min(CornerA.getBlockZ(), CornerB.getBlockZ()) ; z <= Math.max(CornerA.getBlockZ(), CornerB.getBlockZ()) ; z++) + { + MapUtil.QuickChangeBlockAt(Player.getWorld(), x, y, z, Material.AIR, data); + } + } + int y = Math.min(CornerA.getBlockY(), CornerB.getBlockY()) - 1; for (int x= Math.min(CornerA.getBlockX(), CornerB.getBlockX()) ; x <= Math.max(CornerA.getBlockX(), CornerB.getBlockX()) ; x++) for (int z= Math.min(CornerA.getBlockZ(), CornerB.getBlockZ()) ; z <= Math.max(CornerA.getBlockZ(), CornerB.getBlockZ()) ; z++) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/build/gui/page/GroundPage.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/build/gui/page/GroundPage.java index 369b13f2c..454d84971 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/build/gui/page/GroundPage.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/build/gui/page/GroundPage.java @@ -32,7 +32,7 @@ public class GroundPage extends ShopPageBase new GroundData(Material.STAINED_CLAY, (byte) 0), new GroundData(Material.STAINED_CLAY, (byte) 15), new GroundData(Material.STAINED_CLAY, (byte) 4), new GroundData(Material.STAINED_CLAY, (byte) 3), new GroundData(Material.STAINED_CLAY, (byte) 5), new GroundData(Material.STAINED_CLAY, (byte) 6), - new GroundData(Material.QUARTZ_BLOCK), new GroundData(Material.ICE), new GroundData(Material.IRON_BLOCK), + new GroundData(Material.QUARTZ_BLOCK), new GroundData(Material.PACKED_ICE), new GroundData(Material.IRON_BLOCK), new GroundData(Material.GOLD_BLOCK), new GroundData(Material.DIAMOND_BLOCK)}; private Build _game; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/draw/Draw.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/draw/Draw.java index 9d30a56f1..a0b18be18 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/draw/Draw.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/draw/Draw.java @@ -358,6 +358,14 @@ public class Draw extends SoloGame return; } } + else + { + if (event.getMessage().toLowerCase().contains(_round.Word.toLowerCase())) + { + event.setCancelled(true); + return; + } + } } @EventHandler diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java index 0d34b7797..39ceda806 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java @@ -25,7 +25,6 @@ import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.combat.CombatComponent; -import mineplex.minecraft.game.core.combat.DeathMessageType; import mineplex.minecraft.game.core.combat.CombatManager.AttackReason; import mineplex.minecraft.game.core.combat.DeathMessageType; import mineplex.minecraft.game.core.combat.event.CombatDeathEvent; @@ -74,6 +73,7 @@ import org.bukkit.event.entity.EntityCombustEvent; import org.bukkit.event.entity.PlayerDeathEvent; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerItemHeldEvent; +import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.util.Vector; public class Evolution extends SoloGame @@ -223,6 +223,12 @@ public class Evolution extends SoloGame upgradeKit(event.GetPlayer(), false); } + @EventHandler + public void removeToken(PlayerQuitEvent event) + { + _tokens.remove(event.getPlayer().getName()); + } + // //Double Kit // @EventHandler(priority = EventPriority.MONITOR) // public void storeTokens(GameStateChangeEvent event) @@ -369,9 +375,12 @@ public class Evolution extends SoloGame } } - @EventHandler + @EventHandler(priority = EventPriority.MONITOR) public void onDamage(CustomDamageEvent event) { + if (event.IsCancelled()) + return; + if (!IsLive()) return; @@ -747,7 +756,11 @@ public class Evolution extends SoloGame for (int i = 0 ; i < tokens.size() ; i++) { - players.add(tokens.get(i).Player); + Player cur = tokens.get(i).Player; + if (!cur.isOnline()) + continue; + + players.add(cur); } //Award Gems diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/kits/KitHealth.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/kits/KitHealth.java index b9d93c102..71ae6fc03 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/kits/KitHealth.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/kits/KitHealth.java @@ -61,7 +61,7 @@ public class KitHealth extends Kit if (!Manager.GetGame().IsLive()) return; - Player killer = UtilPlayer.searchExact(event.GetLog().GetPlayer().GetName()); + Player killer = UtilPlayer.searchExact(event.GetLog().GetKiller().GetName()); if (killer == null || !killer.isOnline()) return; @@ -74,6 +74,6 @@ public class KitHealth extends Kit if (!HasKit(killer)) return; - killer.setHealth(killer.getMaxHealth()); + UtilPlayer.health(killer, 9999); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitChicken.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitChicken.java index 32587d144..82536ec47 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitChicken.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitChicken.java @@ -1,6 +1,7 @@ package nautilus.game.arcade.game.games.evolution.mobs; import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilEvent; import mineplex.core.common.util.UtilEvent.ActionType; import mineplex.core.common.util.UtilGear; @@ -66,6 +67,9 @@ public class KitChicken extends EvoKit if (!UtilEvent.isAction(event, ActionType.R)) return; + if (UtilBlock.usable(event.getClickedBlock())) + return; + if (!Manager.GetGame().IsLive()) return; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkBounceEVO.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkBounceEVO.java index 063a22493..d200e76e9 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkBounceEVO.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkBounceEVO.java @@ -55,6 +55,9 @@ public class PerkBounceEVO extends Perk if (!UtilEvent.isAction(event, ActionType.R)) return; + + if (UtilBlock.usable(event.getClickedBlock())) + return; if (UtilBlock.usable(event.getClickedBlock())) return; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkDoubleJumpEVO.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkDoubleJumpEVO.java index 11978b075..bc457ab77 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkDoubleJumpEVO.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkDoubleJumpEVO.java @@ -65,6 +65,9 @@ public class PerkDoubleJumpEVO extends Perk if (player.getGameMode() == GameMode.CREATIVE) return; + + event.setCancelled(true); + player.setFlying(false); EvolutionAbilityUseEvent useEvent = new EvolutionAbilityUseEvent(player, GetName(), 0); Bukkit.getServer().getPluginManager().callEvent(useEvent); @@ -72,9 +75,6 @@ public class PerkDoubleJumpEVO extends Perk if (useEvent.isCancelled()) return; - event.setCancelled(true); - player.setFlying(false); - //Disable Flight player.setAllowFlight(false); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkFlamingSwordEVO.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkFlamingSwordEVO.java index 6e226b34e..8f38ff279 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkFlamingSwordEVO.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkFlamingSwordEVO.java @@ -5,6 +5,7 @@ import java.util.Map.Entry; import mineplex.core.common.util.C; import mineplex.core.common.util.NautHashMap; +import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilEvent; import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilTime; @@ -49,6 +50,9 @@ public class PerkFlamingSwordEVO extends Perk if (!UtilEvent.isAction(event, ActionType.R)) return; + if (UtilBlock.usable(event.getClickedBlock())) + return; + if (!Manager.GetGame().IsLive()) return; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkSiesmicSlamEVO.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkSiesmicSlamEVO.java index 02435d894..48f655fd4 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkSiesmicSlamEVO.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkSiesmicSlamEVO.java @@ -71,6 +71,9 @@ public class PerkSiesmicSlamEVO extends Perk if (!UtilEvent.isAction(event, ActionType.R)) return; + if (UtilBlock.usable(event.getClickedBlock())) + return; + if (!UtilInv.IsItem(event.getItem(), Material.IRON_INGOT, (byte) 0)) return; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkSulphurBombEVO.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkSulphurBombEVO.java index a11c63035..b38629a80 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkSulphurBombEVO.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkSulphurBombEVO.java @@ -2,6 +2,7 @@ package nautilus.game.arcade.game.games.evolution.mobs.perks; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilEvent; import mineplex.core.common.util.UtilEvent.ActionType; @@ -55,6 +56,9 @@ public class PerkSulphurBombEVO extends Perk implements IThrown if (!UtilEvent.isAction(event, ActionType.R)) return; + if (UtilBlock.usable(event.getClickedBlock())) + return; + if (!UtilInv.IsItem(event.getItem(), Material.SULPHUR, (byte) 0)) return; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkWebEVO.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkWebEVO.java index 7abe68567..03aeaa0d8 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkWebEVO.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkWebEVO.java @@ -1,6 +1,7 @@ package nautilus.game.arcade.game.games.evolution.mobs.perks; import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilEvent; import mineplex.core.common.util.UtilEvent.ActionType; import mineplex.core.common.util.UtilInv; @@ -39,6 +40,9 @@ public class PerkWebEVO extends Perk implements IThrown if (!UtilEvent.isAction(event, ActionType.R)) return; + if (UtilBlock.usable(event.getClickedBlock())) + return; + if (!Manager.GetGame().IsLive()) return; @@ -109,7 +113,11 @@ public class PerkWebEVO extends Perk implements IThrown public void Web(ProjectileUser data) { Location loc = data.GetThrown().getLocation(); + data.GetThrown().remove(); + + if (loc.getBlock().getType() != Material.AIR) + return; Manager.GetBlockRestore().Add(loc.getBlock(), 30, (byte)0, 4000); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/trackers/NoAbilityTracker.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/trackers/NoAbilityTracker.java index 655eb6f79..68b0cee22 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/trackers/NoAbilityTracker.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/trackers/NoAbilityTracker.java @@ -29,6 +29,9 @@ public class NoAbilityTracker extends StatTracker @EventHandler(priority = EventPriority.MONITOR) public void onEvolutionAbility(EvolutionAbilityUseEvent event) { + if (event.isCancelled()) + return; + if (!getGame().IsLive()) return; 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 8d03a03a9..5371ff69f 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 @@ -6,23 +6,6 @@ import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; -import org.bukkit.ChatColor; -import org.bukkit.Difficulty; -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; -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.entity.EntityDamageEvent.DamageCause; -import org.bukkit.event.player.PlayerCommandPreprocessEvent; - import mineplex.core.common.util.C; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilBlock; @@ -40,12 +23,41 @@ import nautilus.game.arcade.GameType; import nautilus.game.arcade.events.GameStateChangeEvent; import nautilus.game.arcade.game.GameTeam; import nautilus.game.arcade.game.SoloGame; -import nautilus.game.arcade.game.games.halloween.creatures.*; -import nautilus.game.arcade.game.games.halloween.kits.*; -import nautilus.game.arcade.game.games.halloween.waves.*; +import nautilus.game.arcade.game.games.halloween.creatures.CreatureBase; +import nautilus.game.arcade.game.games.halloween.creatures.InterfaceMove; +import nautilus.game.arcade.game.games.halloween.kits.KitFinn; +import nautilus.game.arcade.game.games.halloween.kits.KitRobinHood; +import nautilus.game.arcade.game.games.halloween.kits.KitThor; +import nautilus.game.arcade.game.games.halloween.waves.Wave1; +import nautilus.game.arcade.game.games.halloween.waves.Wave2; +import nautilus.game.arcade.game.games.halloween.waves.Wave3; +import nautilus.game.arcade.game.games.halloween.waves.Wave4; +import nautilus.game.arcade.game.games.halloween.waves.Wave5; +import nautilus.game.arcade.game.games.halloween.waves.WaveBase; +import nautilus.game.arcade.game.games.halloween.waves.WaveBoss; +import nautilus.game.arcade.game.games.halloween.waves.WaveVictory; import nautilus.game.arcade.kit.Kit; import net.minecraft.server.v1_7_R4.PacketPlayOutNamedSoundEffect; +import org.bukkit.ChatColor; +import org.bukkit.Difficulty; +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.Fireball; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.entity.EntityDamageByEntityEvent; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +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; + public class Halloween extends SoloGame { //Wave Data @@ -401,12 +413,24 @@ public class Halloween extends SoloGame { for (Player player : GetPlayers(false)) { - Manager.GetDonation().PurchaseUnknownSalesPackage(null, player.getName(), Manager.GetClients().Get(player).getAccountId(), "Pumpling", false, 0, true); Manager.GetGame().AddGems(player, 30, "Killing the Pumpkin King", false, false); Manager.GetGame().AddGems(player, 10, "Participation", false, false); } - SetCustomWinLine("You earned Pumpling Pet!"); + if (Manager.IsRewardItems()) + { + SetCustomWinLine("You earned the Decrepit Warhorse Mount!"); + + for (Player player : GetPlayers(false)) + { + //Prevent game hopping + if (!player.isOnline()) + continue; + + Manager.GetDonation().PurchaseUnknownSalesPackage(null, player.getName(), Manager.GetClients().Get(player).getAccountId(), "Decrepit Warhorse", false, 0, true); + } + } + AnnounceEnd(this.GetTeamList().get(0)); SetState(GameState.End); @@ -430,6 +454,9 @@ public class Halloween extends SoloGame @EventHandler(priority = EventPriority.LOWEST) public void Explosion(EntityExplodeEvent event) { + if (!IsLive()) + return; + if (event.getEntity() instanceof Fireball) { event.blockList().clear(); @@ -450,6 +477,26 @@ public class Halloween extends SoloGame } } + @EventHandler + public void makeFireballsNotGetRektBcFireballsAreRudeAf(EntityDamageByEntityEvent event) + { + if (!IsLive()) + return; + + if (!(event.getDamager() instanceof Player)) + return; + + Player player = (Player) event.getDamager(); + + if (!UtilPlayer.isSpectator(player) || IsAlive(player)) + return; + + if (!(event.getEntity() instanceof Fireball)) + return; + + event.setCancelled(true); + } + @EventHandler public void ItemSpawn(ItemSpawnEvent event) { @@ -512,16 +559,16 @@ public class Halloween extends SoloGame //Rounds Scoreboard.WriteBlank(); - Scoreboard.Write(C.cYellow + "Wave"); - Scoreboard.Write((_wave+1) + " of 6"); + Scoreboard.Write(C.cYellow + C.Bold + "Wave"); + Scoreboard.Write(Math.min(6, _wave+1) + " of 6"); Scoreboard.WriteBlank(); - Scoreboard.Write(C.cYellow + "Monsters"); + Scoreboard.Write(C.cYellow + C.Bold + "Monsters"); Scoreboard.Write("" + _mobs.size()); //Drawer Scoreboard.WriteBlank(); - Scoreboard.Write(C.cYellow + "Players"); + Scoreboard.Write(C.cYellow + C.Bold + "Players"); if (GetPlayers(true).size() < 8) { 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 996312035..ad817be05 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 @@ -1,13 +1,7 @@ package nautilus.game.arcade.game.games.halloween.kits; -import org.bukkit.Material; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.inventory.ItemStack; - import mineplex.core.common.util.C; +import mineplex.core.common.util.F; import mineplex.core.common.util.UtilMath; import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.updater.UpdateType; @@ -16,7 +10,16 @@ import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.kit.AbbreviatedKit; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.perks.*; +import nautilus.game.arcade.kit.perks.PerkBlizzardFinn; +import nautilus.game.arcade.kit.perks.PerkFlameSlam; +import nautilus.game.arcade.kit.perks.PerkFletcher; + +import org.bukkit.Material; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.inventory.ItemStack; public class KitFinn extends AbbreviatedKit { @@ -46,9 +49,9 @@ public class KitFinn extends AbbreviatedKit @Override public void GiveItems(Player player) { - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.GOLD_AXE, (byte)0, 1, "Flaming Axe")); - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.DIAMOND_SWORD, (byte)0, 1, "Icy Sword")); - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.BOW, (byte)0, 1, "Bow")); + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.GOLD_AXE, (byte)0, 1, F.item("Flaming Axe"))); + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.DIAMOND_SWORD, (byte)0, 1, F.item("Icy Sword"))); + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.BOW, (byte)0, 1, F.item("Bow"))); player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP)); player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP)); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/kits/KitRobinHood.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/kits/KitRobinHood.java index 2049db690..db2a8e825 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/kits/KitRobinHood.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/kits/KitRobinHood.java @@ -1,13 +1,7 @@ package nautilus.game.arcade.game.games.halloween.kits; -import org.bukkit.Material; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.inventory.ItemStack; - import mineplex.core.common.util.C; +import mineplex.core.common.util.F; import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilPlayer; import mineplex.core.itemstack.ItemStackFactory; @@ -17,7 +11,16 @@ import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.kit.AbbreviatedKit; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.perks.*; +import nautilus.game.arcade.kit.perks.PerkBarrage; +import nautilus.game.arcade.kit.perks.PerkFletcher; +import nautilus.game.arcade.kit.perks.PerkQuickshotRobinHood; + +import org.bukkit.Material; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.inventory.ItemStack; public class KitRobinHood extends AbbreviatedKit { @@ -46,8 +49,8 @@ public class KitRobinHood extends AbbreviatedKit @Override public void GiveItems(Player player) { - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD, (byte)0, 1, "Sword")); - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.BOW, (byte)0, 1, "Bow")); + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD, (byte)0, 1, F.item("Sword"))); + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.BOW, (byte)0, 1, F.item("Bow"))); player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP)); player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP)); 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 37d1cc62a..cf589fb4e 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 @@ -1,5 +1,20 @@ package nautilus.game.arcade.game.games.halloween.kits; +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilMath; +import mineplex.core.itemstack.ItemStackFactory; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.kit.AbbreviatedKit; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.perks.PerkFletcher; +import nautilus.game.arcade.kit.perks.PerkHammerThrow; +import nautilus.game.arcade.kit.perks.PerkKnockbackAttack; +import nautilus.game.arcade.kit.perks.PerkSeismicHammer; + import org.bukkit.Material; import org.bukkit.entity.EntityType; import org.bukkit.entity.LivingEntity; @@ -7,19 +22,6 @@ import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.inventory.ItemStack; -import mineplex.core.common.util.C; -import mineplex.core.common.util.UtilMath; -import mineplex.core.itemstack.ItemStackFactory; -import mineplex.core.updater.UpdateType; -import mineplex.core.updater.event.UpdateEvent; -import mineplex.minecraft.game.core.damage.CustomDamageEvent; -import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.kit.AbbreviatedKit; -import nautilus.game.arcade.kit.KitAvailability; -import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.SmashKit; -import nautilus.game.arcade.kit.perks.*; - public class KitThor extends AbbreviatedKit { public KitThor(ArcadeManager manager) @@ -36,7 +38,7 @@ public class KitThor extends AbbreviatedKit new Perk[] { new PerkKnockbackAttack(2), - new PerkFletcher(2, 2, true), + new PerkFletcher(2, 2, true, 9), new PerkSeismicHammer(), new PerkHammerThrow(), }, @@ -48,9 +50,9 @@ public class KitThor extends AbbreviatedKit @Override public void GiveItems(Player player) { - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_AXE, (byte)0, 1, "Seismic Hammer")); - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.DIAMOND_AXE, (byte)0, 1, "Thor Hammer")); - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.BOW, (byte)0, 1, "Bow")); + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_AXE, (byte)0, 1, F.item("Seismic Hammer"))); + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.DIAMOND_AXE, (byte)0, 1, F.item("Thor Hammer"))); + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.BOW, (byte)0, 1, F.item("Bow"))); player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP)); player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP)); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/HideSeek.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/HideSeek.java index bb7fa45b0..ee2af9ec4 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/HideSeek.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/HideSeek.java @@ -1484,6 +1484,9 @@ public class HideSeek extends TeamGame @EventHandler public void InfestLeave(VehicleExitEvent event) { + if (!IsLive()) + return; + InfestEnd(event.getExited()); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/forms/BlockForm.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/forms/BlockForm.java index a19aa9cd8..4d8570d9d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/forms/BlockForm.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/forms/BlockForm.java @@ -84,7 +84,8 @@ public class BlockForm extends Form // Player > Chicken DisguiseChicken disguise = new DisguiseChicken(Player); disguise.setBaby(); - disguise.setInvisible(true); + +// disguise.setInvisible(true); disguise.setSoundDisguise(new DisguiseCat(Player)); Host.Manager.GetDisguise().disguise(disguise); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/perks/PerkWaller.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/perks/PerkWaller.java index 9f7802238..90550c8c4 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/perks/PerkWaller.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/perks/PerkWaller.java @@ -4,7 +4,9 @@ import java.util.HashSet; import java.util.Set; import mineplex.core.common.util.C; +import mineplex.core.common.util.F; import mineplex.core.common.util.UtilEvent; +import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilEvent.ActionType; import mineplex.core.common.util.UtilInv; import nautilus.game.arcade.game.games.lobbers.events.TNTThrowEvent; @@ -68,6 +70,12 @@ public class PerkWaller extends Perk if (!UtilInv.IsItem(event.getItem(), Material.STONE_SPADE, (byte) 0)) return; + if (event.getClickedBlock().isLiquid()) + { + UtilPlayer.message(event.getPlayer(), F.main("Game", "You may not place a wall in a liquid!")); + return; + } + UtilInv.remove(event.getPlayer(), Material.STONE_SPADE, (byte) 0, 1); _wallBlocks.addAll(buildWall(event.getClickedBlock().getLocation(), event.getPlayer().getLocation().getYaw())); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/MineStrike.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/MineStrike.java index c0dbe5c9e..a49a647fd 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/MineStrike.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/MineStrike.java @@ -10,11 +10,11 @@ import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.Color; import org.bukkit.Effect; -import org.bukkit.GameMode; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.block.Block; +import org.bukkit.block.BlockFace; import org.bukkit.craftbukkit.v1_7_R4.entity.CraftArrow; import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer; import org.bukkit.entity.Arrow; @@ -277,7 +277,7 @@ public class MineStrike extends TeamGame //"Tap Crouch when close to an ally to Boost", "Open Inventory at spawn to buy guns", "Hold Right-Click to Plant Bomb", - "Look at the Bomb to Defuse Bomb", + "Look at the Bomb to Defuse it", "Moving decreases accuracy", "Sprinting heavily decreases accuracy", "Jumping massively decreases accuracy", @@ -716,6 +716,7 @@ public class MineStrike extends TeamGame return; Grenade grenade = getGrenadeInHand(event.getPlayer(), null); + if (grenade == null) return; @@ -1519,9 +1520,25 @@ public class MineStrike extends TeamGame if (!UtilGear.isMat(player.getItemInHand(), Material.GOLD_SWORD)) return; + // Fixed bomb able to be planted after the round is over. + if (_roundOver) + { + UtilPlayer.message(player, F.main("Game", "You cannot plant the bomb once the round is over.")); + event.setCancelled(true); + return; + } + + // Added a small tip for players that are trying to right-click with the bomb. + if (UtilEvent.isAction(event, ActionType.L)) + { + UtilPlayer.message(player, F.main("Game", "You must " + F.elem("Right-Click") + " while holding the bomb to plant it.")); + event.setCancelled(true); + return; + } + if (!UtilEnt.isGrounded(player)) { - UtilPlayer.message(player, F.main("Game", "You can only plant Bomb on the ground!")); + UtilPlayer.message(player, F.main("Game", "You can only plant the bomb on the ground.")); event.setCancelled(true); return; } @@ -1529,7 +1546,7 @@ public class MineStrike extends TeamGame //Should never occur with 1 Bomb if (_bombPlanter != null) { - UtilPlayer.message(player, F.main("Game", "Someone else is planting Bomb...")); + UtilPlayer.message(player, F.main("Game", "Someone else is planting the bomb.")); event.setCancelled(true); return; } @@ -1548,7 +1565,7 @@ public class MineStrike extends TeamGame //Too Far if (!near) { - UtilPlayer.message(player, F.main("Game", "You can only plant Bomb at a bomb site!")); + UtilPlayer.message(player, F.main("Game", "You can only plant the bomb at a bomb site.")); event.setCancelled(true); return; } @@ -1556,7 +1573,7 @@ public class MineStrike extends TeamGame _bombPlanter = player; _bombPlanter.setExp(0f); - UtilPlayer.message(player, F.main("Game", "You are placing the Bomb.")); + UtilPlayer.message(player, F.main("Game", "You are now placing the bomb.")); //Radio playSound(Radio.T_BOMB_PLANT, null, GetTeam(_bombPlanter)); @@ -1568,6 +1585,10 @@ public class MineStrike extends TeamGame if (event.getType() != UpdateType.TICK) return; + // Added to check if the round is over when a bomb is being planted. + if (_roundOver) + return; + if (_bombPlanter == null) return; @@ -1937,6 +1958,7 @@ public class MineStrike extends TeamGame for (Player player : UtilServer.getPlayers()) { player.playSound(player.getLocation(), Sound.LEVEL_UP, 1f, 1f); + removeScope(player); Recharge.Instance.Reset(player, "reload"); } @@ -2838,4 +2860,28 @@ public class MineStrike extends TeamGame { return _freezeTime > 0; } + + @EventHandler + public void cancelFireExtinguish(PlayerInteractEvent event) + { + // This is an extra event added in order to prevent players from + // extinguishing fire that gets generated from moltovs and incendiary grenades. + + if (!IsLive()) + return; + + if (UtilEvent.isAction(event, ActionType.L_BLOCK)) + { + Block block = event.getClickedBlock(); + + for (BlockFace face : BlockFace.values()) + { + if (block.getRelative(face).getType() == Material.FIRE) + { + event.setCancelled(true); + return; + } + } + } + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/ShopManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/ShopManager.java index bb6d58f7a..f6bb986f3 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/ShopManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/ShopManager.java @@ -23,6 +23,7 @@ import nautilus.game.arcade.game.games.minestrike.items.guns.Gun; import nautilus.game.arcade.game.games.minestrike.items.guns.GunStats; import nautilus.game.arcade.game.games.minestrike.items.guns.Shotgun; +import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.Color; import org.bukkit.GameMode; @@ -46,7 +47,7 @@ public class ShopManager } public void enterShop(Player player) - { + { GameTeam team = Host.GetTeam(player); if (team == null) return; @@ -101,14 +102,13 @@ public class ShopManager public void addItem(StrikeItem item, Player player, int slot) { player.getInventory().setItem(slot, item.getShopItem(getMoney(player), hasItem(player, item))); - _shop.get(player).put(slot, item); } public boolean hasItem(Player player, StrikeItem item) { - int count = 0; + for (int i=0 ; i<9 ; i++) { if (UtilGear.isMat(player.getInventory().getItem(i), item.getSkin())) @@ -286,7 +286,7 @@ public class ShopManager } public void update() - { + { for (Player player : Host.GetPlayers(false)) { GameTeam team = Host.GetTeam(player); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/items/StrikeItem.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/items/StrikeItem.java index 33848a071..aa16cc517 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/items/StrikeItem.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/items/StrikeItem.java @@ -107,6 +107,9 @@ public abstract class StrikeItem if (this instanceof Gun) { + //Fixes it so it stops reloading when dropped. Allows other players to reload when it's dropped if its ammo is 0. + ((Gun) this).forceCancelReload(player); + game.deregisterGun((Gun)this); if (!onlyDeregisterAndRemove) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/items/grenades/FireGrenadeBase.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/items/grenades/FireGrenadeBase.java index a9cdeded4..9558b55f9 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/items/grenades/FireGrenadeBase.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/items/grenades/FireGrenadeBase.java @@ -3,7 +3,6 @@ package nautilus.game.arcade.game.games.minestrike.items.grenades; import java.util.HashMap; import mineplex.core.common.util.UtilBlock; -import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilParticle; import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilParticle.ParticleType; @@ -12,6 +11,7 @@ import nautilus.game.arcade.game.GameTeam; import nautilus.game.arcade.game.games.minestrike.MineStrike; import nautilus.game.arcade.game.games.minestrike.Radio; +import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.Location; import org.bukkit.Material; @@ -39,7 +39,10 @@ public abstract class FireGrenadeBase extends Grenade @Override public boolean updateCustom(MineStrike game, Entity ent) { - if (UtilEnt.isGrounded(ent)) + // Fixed grenade effect not being activated when thrown in the ground. + // Looks like ent.isOnGround() worked, while we previously used UtilEnt.isGrounded(ent). + + if (ent.isOnGround()) { createFire(game, ent.getLocation()); @@ -76,7 +79,10 @@ public abstract class FireGrenadeBase extends Grenade public void run() { if (round == game.getRound() && !game.isFreezeTime()) - game.Manager.GetBlockRestore().Add(block, 51, (byte)0, (long) (_baseTime + blocks.get(block) * _baseTime)); + { + double time = _baseTime + blocks.get(block) * _baseTime; + game.Manager.GetBlockRestore().Add(block, 51, (byte)0, (long) time); + } } }, 60 - (int)(60d * blocks.get(block))); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/items/grenades/Grenade.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/items/grenades/Grenade.java index 1f4100f97..595c303ea 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/items/grenades/Grenade.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/items/grenades/Grenade.java @@ -17,6 +17,7 @@ import mineplex.core.common.util.C; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilInv; import mineplex.core.common.util.UtilPlayer; import nautilus.game.arcade.game.games.minestrike.MineStrike; import nautilus.game.arcade.game.games.minestrike.items.StrikeItem; @@ -82,59 +83,54 @@ public abstract class Grenade extends StrikeItem } public boolean giveToPlayer(Player player, boolean setOwnerName) - { - int slot = 3; - + { int alreadyHas = 0; + int bestSlot = -1; - while (player.getInventory().getItem(slot) != null && player.getInventory().getItem(slot).getType() != Material.AIR && slot <= 6) + for (int i = 3 ; i < 7 ; i++) { - if (player.getInventory().getItem(slot).getType() == getSkin()) - { + if (UtilInv.IsItem(player.getInventory().getItem(i), getSkin(), (byte) -1)) alreadyHas++; - - if (alreadyHas >= _limit) - return false; - } - slot++; + if (alreadyHas >= _limit) + return false; + + if ((player.getInventory().getItem(i) == null || UtilInv.IsItem(player.getInventory().getItem(i), Material.AIR, (byte) -1) && bestSlot == -1)) + bestSlot = i; } - if (slot > 6) + if (bestSlot == -1 || bestSlot > 6) return false; - giveToPlayer(player, slot, setOwnerName); - + giveToPlayer(player, bestSlot, setOwnerName); return true; } public boolean canGiveToPlayer(Player player) - { - int slot = 3; - + { int alreadyHas = 0; + int bestSlot = -1; - while (player.getInventory().getItem(slot) != null && player.getInventory().getItem(slot).getType() != Material.AIR && slot <= 6) + for (int i = 3 ; i < 7 ; i++) { - if (player.getInventory().getItem(slot).getType() == getSkin()) - { + if (UtilInv.IsItem(player.getInventory().getItem(i), getSkin(), (byte) -1)) alreadyHas++; - - if (alreadyHas >= _limit) - return false; - } - slot++; + if (alreadyHas >= _limit) + return false; + + if ((player.getInventory().getItem(i) == null || isStack(player.getInventory().getItem(i))) && bestSlot == -1) + bestSlot = i; } - if (slot > 6) + if (bestSlot == -1 || bestSlot > 6) return false; return true; } public void throwGrenade(Player player, boolean wasLeftClick, MineStrike game) - { + { player.setItemInHand(null); _thrower = player; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/items/guns/Gun.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/items/guns/Gun.java index dfd1863e8..a01c65619 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/items/guns/Gun.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/items/guns/Gun.java @@ -269,6 +269,12 @@ public class Gun extends StrikeItem _reloading = true; } + + public void forceCancelReload(Player player) + { + _reloading = false; + Recharge.Instance.recharge(player, getName() + " Reload"); + } @Override public void fixStackName() diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/MMMazes.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/MMMazes.java new file mode 100644 index 000000000..dd0ada4c0 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/MMMazes.java @@ -0,0 +1,300 @@ +package nautilus.game.arcade.game.games.monstermaze; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Iterator; +import java.util.List; + +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilMath; +import nautilus.game.arcade.game.games.monstermaze.mazes.Maze1; +import nautilus.game.arcade.game.games.monstermaze.mazes.Maze2; +import nautilus.game.arcade.game.games.monstermaze.mazes.Maze3; + +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.block.Block; + +public class MMMazes +{ + private static int[][] _lastSelected = null; + + public static MazePreset getRandomMapPreset(Location loc, MazeBlockData data) + { + return new MazePreset(getRandomMap(), loc, data); + } + + public static class MazePreset + { + private MazeBlockData _data; + + private boolean _built = false; + + private ArrayList _maze = new ArrayList(); + private ArrayList _validSafePadSpawns; + private ArrayList _spawns = new ArrayList(); + + private ArrayList _centerSafeZone = new ArrayList(); + private ArrayList _centerSafeZonePaths = new ArrayList(); + + private ArrayList _glassBounds = new ArrayList(); + + private ArrayList _safeZones = new ArrayList(); + + private Location _center; + + public MazePreset(int[][] rawMaze, Location loc, MazeBlockData data) + { + int[][] maze = rawMaze; + + _data = data; + + _center = loc; + + Location cur = _center.clone().subtract(49, 0, 49); + + // x/y refers to array coordinates, not physical minecraft location + + //0 = Air + //1 = Maze + //2 = Spawn + //3 = Center Safe Area + //4 = Safe Barrier + //5 = Paths through center safe area + //6 = paths through safe barrier + + for (int y = 0; y < 99; y++) + { + for (int x = 0; x < 99; x++) + { + int i = maze[y][x]; + if(i == 1) + { + _maze.add(cur); + } + else if(i == 2) + { + _maze.add(cur); + _spawns.add(cur); + } + else if(i == 3) + { + _centerSafeZone.add(cur); + } + else if(i == 4) + { + _centerSafeZone.add(cur); + _glassBounds.add(cur.clone().add(0, 2, 0)); + } + else if (i == 5) + { + _centerSafeZone.add(cur); + _centerSafeZonePaths.add(cur); + _maze.add(cur); + } + else if (i == 6) + { + _centerSafeZone.add(cur); + _glassBounds.add(cur.clone().add(0, 2, 0)); + _centerSafeZonePaths.add(cur); + _maze.add(cur); + } + cur = cur.clone().add(0, 0, 1); + } + cur.setZ(_center.clone().subtract(49, 0, 49).getZ()); + cur = cur.clone().add(1, 0, 0); + } + + _validSafePadSpawns = new ArrayList(_maze); + + Iterator iter = _validSafePadSpawns.iterator(); + removeLoop: while(iter.hasNext()) + { + Location l = iter.next(); + + for(Location s : _spawns) + { + if(UtilMath.offset2d(l, s) < 10) + { + iter.remove(); + continue removeLoop; + } + } + + for(Location b : _glassBounds) + { + if(UtilMath.offset2d(l, b) < 7) + { + iter.remove(); + continue removeLoop; + } + } + } + + ArrayList locsToPickFrom = new ArrayList<>(_validSafePadSpawns); + + int numberOfSafeZones = 8; + for (int i = 0; i < numberOfSafeZones; i++) + { + Location toAdd = null; + if (locsToPickFrom == null) + { + toAdd = UtilAlg.Random(locsToPickFrom); + } + else + { + ArrayList toBeAwayFrom = new ArrayList(_safeZones); + toBeAwayFrom.add(_center); + toAdd = UtilAlg.getLocationAwayFromOtherLocations(locsToPickFrom, toBeAwayFrom); + } + + _safeZones.add(toAdd); +// for(Block b : UtilBlock.getInBoundingBox(toAdd.clone().add(1, 0, 1), toAdd.clone().subtract(1, 0, 1), false)) +// { +// _safeZones.add(b.getLocation()); +// } + + for (Block b : UtilBlock.getInRadius(toAdd.getBlock(), 6).keySet()) + { + locsToPickFrom.remove(b.getLocation()); + } + } + System.out.println("_safeZones.size() = " + _safeZones.size()); + + Iterator it = _maze.iterator(); + while(it.hasNext()) + { + Location lo = it.next(); + if(_safeZones.contains(lo.getBlock().getLocation())) it.remove(); + } + + Iterator iter2 = _validSafePadSpawns.iterator(); + removeLoop: while(iter2.hasNext()) + { + Location l = iter2.next(); + + for(Location s : _safeZones) + { + if(UtilMath.offset2d(l, s) < 7) + { + iter2.remove(); + continue removeLoop; + } + } + + } + } + + @SuppressWarnings("deprecation") + public void build() + { + for (Location loc : _maze) + { + buildMazeBlockAt(loc); + } + + for (Location loc : _spawns) + { + loc.clone().subtract(0, 1, 0).getBlock().setType(Material.REDSTONE_BLOCK); + } + + for (Location loc : _centerSafeZone) + { + loc.clone().subtract(0, 1, 0).getBlock().setTypeIdAndData(159, (byte) 5, true); + } + + _built = true; + } + + public ArrayList getSpawns() + { + return _spawns; + } + + public ArrayList getSafeZones() + { + return _safeZones; + } + + public boolean isBuilt() + { + return _built; + } + + @SuppressWarnings("deprecation") + public void buildMazeBlockAt(Location loc) + { + Location mod = loc.clone(); + + mod.subtract(0, 1, 0).getBlock().setTypeIdAndData(_data.Top.Type.getId(), _data.Top.Data, true); + mod.subtract(0, 1, 0).getBlock().setTypeIdAndData(_data.Middle.Type.getId(), _data.Middle.Data, true); + mod.subtract(0, 1, 0).getBlock().setTypeIdAndData(_data.Bottom.Type.getId(), _data.Bottom.Data, true); + } + + // anywhere a monster can walk + public ArrayList getMaze() + { + return _maze; + } + + public ArrayList getGlassBounds() + { + return _glassBounds; + } + + public ArrayList getCenterSafeZone() + { + return _centerSafeZone; + } + + public ArrayList getCenterSafeZonePaths() + { + return _centerSafeZonePaths; + } + + public ArrayList getValidSafePadSpawns() + { + return _validSafePadSpawns; + } + + public Location getCenter() + { + return _center; + } + } + + // PARSED MAZES + + private static final int[][] getRandomMap() + { + List maps = Arrays.asList(Maze1.MAZE, Maze2.MAZE, Maze3.MAZE); + + //Attempt 10 times to get a new random maze. + int[][] selected = null; + for (int i = 0 ; i < 10 && selected == null ; i++) + { + int[][] possible = maps.get(UtilMath.r(maps.size())); + + if (_lastSelected != possible) + selected = possible; + } + + //If the random hit the last selected every time + //Then just pick a random one. + if (selected == null) + selected = maps.get(UtilMath.r(maps.size())); + + //This makes it work between different games. + _lastSelected = selected; + return maps.get(UtilMath.r(maps.size())); + } + + //0 = Air + //1 = Maze + //2 = Spawn + //3 = Center Safe Area + //4 = Safe Barrier + //5 = Paths through center safe area + //6 = paths through safe barrier +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/Maze.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/Maze.java new file mode 100644 index 000000000..fabd6bd90 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/Maze.java @@ -0,0 +1,1093 @@ +package nautilus.game.arcade.game.games.monstermaze; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.LinkedList; +import java.util.Map.Entry; +import java.util.Set; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilTextMiddle; +import mineplex.core.common.util.UtilTime; +import mineplex.core.common.util.UtilParticle.ParticleType; +import mineplex.core.common.util.UtilParticle.ViewDist; +import mineplex.core.disguise.DisguiseFactory; +import mineplex.core.disguise.disguises.DisguiseBase; +import mineplex.core.disguise.disguises.DisguiseMagmaCube; +import mineplex.core.disguise.disguises.DisguiseSlime; +import mineplex.core.disguise.disguises.DisguiseSnowman; +import mineplex.core.recharge.Recharge; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import nautilus.game.arcade.events.GameStateChangeEvent; +import nautilus.game.arcade.game.Game.GameState; +import nautilus.game.arcade.game.games.monstermaze.MMMazes.MazePreset; +import nautilus.game.arcade.game.games.monstermaze.MazeMobWaypoint.CardinalDirection; +import nautilus.game.arcade.game.games.monstermaze.events.EntityLaunchEvent; +import nautilus.game.arcade.game.games.monstermaze.events.FirstToSafepadEvent; +import nautilus.game.arcade.game.games.monstermaze.events.MonsterBumpPlayerEvent; +import nautilus.game.arcade.game.games.monstermaze.events.SafepadBuildEvent; +import nautilus.game.arcade.game.games.monstermaze.kits.KitBodyBuilder; +import net.minecraft.server.v1_7_R4.Packet; +import net.minecraft.server.v1_7_R4.PacketPlayOutAnimation; +import net.minecraft.server.v1_7_R4.PacketPlayOutBlockBreakAnimation; + +import org.bukkit.Bukkit; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.block.Block; +import org.bukkit.block.BlockFace; +import org.bukkit.entity.Entity; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.entity.Snowman; +import org.bukkit.event.EventHandler; +import org.bukkit.event.HandlerList; +import org.bukkit.event.Listener; +import org.bukkit.event.block.EntityBlockFormEvent; +import org.bukkit.event.entity.EntityCombustEvent; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; + +public class Maze implements Listener +{ + private MonsterMaze _host; + private MazePreset _preset; + + private Location _location; + + private ArrayList _playersOnPad = new ArrayList(); + private HashMap _ents = new HashMap(); + + private HashSet _movementWaypoints = new HashSet(); + private HashSet _movementWaypointsDisabled = new HashSet(); + private ArrayList _playerContainmentGlass = new ArrayList(); + + private int _centerSafeZoneDecay = 11; +// private NautHashMap _centerSafeZoneDecay = new NautHashMap(); + + private SafePad _nextSafePad; + private SafePad _safePad = null; + private LinkedList _oldSafePads = new LinkedList(); + private int _curSafe = 1; + + private int _phaseTimer = 60; + private int _phaseTimerStart = 60; + + @SuppressWarnings("deprecation") + public Maze(MonsterMaze host, MazePreset maze) + { + _host = host; + _preset = maze; + + for (Location loc : getPreset().getMaze()) + { + _movementWaypoints.add(loc.getBlock()); + } + + for (Location loc : maze.getGlassBounds()) + { + _playerContainmentGlass.add(loc.clone().subtract(0, 1, 0)); + _playerContainmentGlass.add(loc.clone().subtract(0, 2, 0)); + } + + for (Location loc : _playerContainmentGlass) + { + loc.getBlock().setType(Material.STAINED_GLASS); + loc.getBlock().setData((byte) 5); + } + + for(Location loc : _preset.getCenterSafeZonePaths()) + { + _movementWaypointsDisabled.add(loc.getBlock()); + } + + _location = maze.getCenter(); + + spawnSafePad(); + _safePad = _nextSafePad; + _nextSafePad = null; + + Bukkit.getPluginManager().registerEvents(this, _host.Manager.getPlugin()); + } + + public SafePad getSafePad() + { + return _safePad; + } + + public MazePreset getPreset() + { + return _preset; + } + + public Location getLocation() + { + return _location; + } + + public int getCurrentSafePadCount() + { + return _curSafe; + } + + public boolean isOnPad(Player player, boolean checkNotActive ) + { + if (_safePad == null) + return false; + + if (_safePad.isOn(player)) + return true; + + if (checkNotActive) + { + for (SafePad pad : _oldSafePads) + { + if (pad.isOn(player)) + { + return true; + } + } + + if (_nextSafePad != null) + { + if (_nextSafePad.isOn(player)) + { + return true; + } + } + + return false; + } + + return false; + } + + @EventHandler + public void setCompassTarget(UpdateEvent event) + { + if (event.getType() != UpdateType.FASTER) + return; + + if (_safePad == null) + return; + + for (Player player : _host.GetPlayers(true)) + { + player.setCompassTarget(_safePad.getLocation()); + } + } + + @EventHandler + public void updateTick(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + if (!_host.IsLive()) + return; + + //Updates + checkPlayersOnSafePad(); + move(); + bump(); +// removeMobsOnSafePad(); + } + + @EventHandler + public void updateSecond(UpdateEvent event) + { + if (event.getType() != UpdateType.SEC) + return; + + if (!_host.IsLive()) + return; + + decrementSafePadTime(); + decrementPhaseTime(); + + if (UtilTime.elapsed(_host.getGameLiveTime(), 20000)) + { + deteriorateCenter(); + } + } + + @EventHandler + public void updateExperience(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + if (!_host.IsLive()) + return; + +// if (UtilTime.elapsed(Host.getGameLiveTime(), 15000)) +// { +// deteriorateCenter(); +// } + + if (_safePad == null) + { + for (Player p : _host.GetPlayers(true)) + { + p.setExp(0F); + } + return; + } + + if (_playersOnPad.isEmpty()) //Nobody has gotten to it yet + { + float percent = (float) Math.min(Math.max(_phaseTimer * (1 / _phaseTimerStart), 0), .999); + + for(Player p : _host.GetPlayers(true)) + { + p.setExp(percent); + } + return; + } + + float percentage = (float) Math.min(Math.max(_phaseTimer / Math.max(6, 16 - (_curSafe - 1)), 0), 1); + for (Player p : _host.GetPlayers(true)) + { + p.setExp(percentage); + } + } + +// private void removeMobsOnSafePad() +// { +// Iterator it = _ents.keySet().iterator(); +// while (it.hasNext()) +// { +// LivingEntity e = it.next(); +// if(_safePad != null) +// { +// if(_safePad.isOn(e)) +// { +// System.out.println("entity on safepad removed"); +// it.remove(); +// e.remove(); +// continue; +// } +// } +// +// for (SafePad oldSafePad : _oldSafePads) +// { +// if(oldSafePad.isOn(e)) +// { +// System.out.println("entity on old safepad removed"); +// it.remove(); +// e.remove(); +// } +// } +// } +// } + + private void bump() + { + //Hit Players + for (Player player : _host.GetPlayers(true)) + { + if (!Recharge.Instance.usable(player, "Monster Hit")) + continue; + + if (isOnPad(player, true)) + continue; + + //Hit Snowman + for (LivingEntity ent : _ents.keySet()) + { + if (UtilMath.offset(player, ent) >= 1) + continue; + + Recharge.Instance.useForce(player, "Monster Hit", 1000); + + //Velocity + //UtilAction.velocity(player, new Vector(1,0,0), 4, false, 0, 1.2, 1.2, true); + UtilAction.velocity(player, UtilAlg.getTrajectory(ent, player), 1, false, 0, 0.75, 1.2, true); + + //Damage Event + _host.Manager.GetDamage().NewDamageEvent(player, null, null, + null, 4, false, false, false, + "Monster", "Monster Attack"); + + PacketPlayOutAnimation animation = new PacketPlayOutAnimation(); + animation.a = ent.getEntityId(); + animation.b = 0; + + if (_host.Manager.GetDisguise().isDisguised(ent)) + animation.a = _host.Manager.GetDisguise().getDisguise(ent).GetEntityId(); + + for (Player cur : UtilServer.getPlayers()) + { + for (int i = 0 ; i < 3 ; i++) + { + UtilPlayer.sendPacket(cur, animation); + } + } + + Bukkit.getPluginManager().callEvent(new MonsterBumpPlayerEvent(player)); + } + } + } + + private void move() + { + Iterator> entIterator = _ents.entrySet().iterator(); + + //Move & Die + while (entIterator.hasNext()) + { + Entry data = entIterator.next(); + + //New or Fallen + if (data.getValue().Target == null || data.getKey().getLocation().getY() < data.getValue().Target.getBlockY()) + { + Location loc = UtilAlg.findClosest(data.getKey().getLocation(), getPreset().getMaze()); + + data.getKey().teleport(loc); + data.getValue().Target = loc; + } + + //New Waypoint + if (UtilMath.offset2d(data.getKey().getLocation(), data.getValue().Target) < 0.4) + { + ArrayList nextBlock = new ArrayList(); + + Block north = getTarget(data.getKey().getLocation().getBlock(), null, BlockFace.NORTH); + Block south = getTarget(data.getKey().getLocation().getBlock(), null, BlockFace.SOUTH); + Block east = getTarget(data.getKey().getLocation().getBlock(), null, BlockFace.EAST); + Block west = getTarget(data.getKey().getLocation().getBlock(), null, BlockFace.WEST); + + if (north != null) nextBlock.add(north); + if (south != null) nextBlock.add(south); + if (east != null) nextBlock.add(east); + if (west != null) nextBlock.add(west); + + if(nextBlock.isEmpty()) + { + entIterator.remove(); + data.getKey().remove(); + continue; + } + + if(nextBlock.size() > 1 && data.getValue().Direction != CardinalDirection.NULL) // they can do a uturn if they're stuck + { + if(data.getValue().Direction == CardinalDirection.NORTH) + { + nextBlock.remove(south); + } + else if(data.getValue().Direction == CardinalDirection.SOUTH) + { + nextBlock.remove(north); + } + else if(data.getValue().Direction == CardinalDirection.WEST) + { + nextBlock.remove(east); + } + else if(data.getValue().Direction == CardinalDirection.EAST) + { + nextBlock.remove(west); + } + } + + if (nextBlock.isEmpty()) + { + entIterator.remove(); + data.getKey().remove(); + continue; + } + + //Random Direction + Location nextLoc = UtilAlg.Random(nextBlock).getLocation(); + data.getValue().Target = nextLoc.clone().add(0.5, 0, 0.5); + if(north != null && nextLoc.equals(north.getLocation())) + { + data.getValue().Direction = CardinalDirection.NORTH; + } + else if(south != null && nextLoc.equals(south.getLocation())) + { + data.getValue().Direction = CardinalDirection.SOUTH; + } + else if(east != null && nextLoc.equals(east.getLocation())) + { + data.getValue().Direction = CardinalDirection.EAST; + } + else if(west != null && nextLoc.equals(west.getLocation())) + { + data.getValue().Direction = CardinalDirection.WEST; + } + UtilEnt.CreatureMove(data.getKey(), data.getValue().Target, 1.4f); + + } + + //Timeout Move + if (UtilMath.offset(data.getKey().getLocation(), data.getValue().Last) > 0.1) + data.getValue().Time = System.currentTimeMillis(); + + if (UtilTime.elapsed(data.getValue().Time, 2000)) + UtilEnt.CreatureMove(data.getKey(), data.getValue().Target, 1.4f); + } + } + + private Block getTarget(Block start, Block cur, BlockFace face) + { + if (cur == null) + cur = start; + + while (_movementWaypoints.contains(cur.getRelative(face)) && !_movementWaypointsDisabled.contains(cur.getRelative(face))) + { + cur = cur.getRelative(face); + + //Stop at intersection + int count = 0; + + if (face != BlockFace.NORTH && _movementWaypoints.contains(cur.getRelative(BlockFace.NORTH)) && !_movementWaypointsDisabled.contains(cur.getRelative(BlockFace.NORTH))) count++; + if (face != BlockFace.SOUTH && _movementWaypoints.contains(cur.getRelative(BlockFace.SOUTH)) && !_movementWaypointsDisabled.contains(cur.getRelative(BlockFace.SOUTH))) count++; + if (face != BlockFace.EAST && _movementWaypoints.contains(cur.getRelative(BlockFace.EAST)) && !_movementWaypointsDisabled.contains(cur.getRelative(BlockFace.EAST))) count++; + if (face != BlockFace.WEST && _movementWaypoints.contains(cur.getRelative(BlockFace.WEST)) && !_movementWaypointsDisabled.contains(cur.getRelative(BlockFace.WEST))) count++; + + if (count > 1) + break; + } + + if (cur.equals(start)) + return null; + + return cur; + } + +// @SuppressWarnings("deprecation") +// public void addSafeZone() +// { +// if (_safeZones.isEmpty()) +// return; +// +// Location zone = _safeZones.remove(UtilMath.r(_safeZones.size())); +// for (Block b : UtilBlock.getInBoundingBox(zone.clone().add(1, 0, 1), zone.clone().subtract(1, 0, 1), false)) +// { +// for (int i = 0 ; i < 3 ; i++) +// { +// Block cur = b.getLocation().clone().subtract(0, i, 0).getBlock(); +// +// cur.getRelative(BlockFace.DOWN).setType(Material.STAINED_CLAY); +// cur.getRelative(BlockFace.DOWN).setData((byte) 13); +// } +// +// _disabledWaypoints.add(b); +// +// Iterator it = _ents.keySet().iterator(); +// while (it.hasNext()) { +// Entity e = it.next(); +// if (UtilMath.offset(e.getLocation(), b.getLocation()) < 2) +// { +// _ents.remove(_ents.get(e)); +// it.remove(); +// e.remove(); +// } +// } +// } +// } + + public void fillSpawn(int numToSpawn) + { + System.out.println("spawning " + numToSpawn + " entities on map"); + + int spawned = 0; + + while(spawned <= numToSpawn) + { + ArrayList validSpawns = new ArrayList(getPreset().getMaze()); + + Iterator iter = validSpawns.iterator(); + while (iter.hasNext()) { + Location b = iter.next(); + if(UtilMath.offset(b, _location) < 7.5) + { + iter.remove(); + } + } + Location loc = UtilAlg.Random(validSpawns); + + _host.CreatureAllowOverride = true; + Snowman ent = loc.getWorld().spawn(loc, Snowman.class); + + DisguiseBase disguise = DisguiseFactory.createDisguise(ent, _host.getMonsterType()); + + if (disguise instanceof DisguiseSlime) + { + ((DisguiseSlime) disguise).SetSize(3); + } + + if (disguise instanceof DisguiseMagmaCube) + { + ((DisguiseMagmaCube) disguise).SetSize(3); + } + + _host.CreatureAllowOverride = false; + + UtilEnt.Vegetate(ent, true); + UtilEnt.ghost(ent, true, false); + _ents.put(ent, new MazeMobWaypoint(ent.getLocation())); + + if (disguise != null && !(disguise instanceof DisguiseSnowman)) + { + _host.Manager.GetDisguise().disguise(disguise); + } + + spawned++; + } + } + + private void spawn(int numToSpawn) + { + Location loc = UtilAlg.Random(getPreset().getSpawns()); + + int spawned = 0; + + while (spawned <= numToSpawn) + { + _host.CreatureAllowOverride = true; + Snowman ent = loc.getWorld().spawn(loc, Snowman.class); + + DisguiseBase disguise = DisguiseFactory.createDisguise(ent, _host.getMonsterType()); + + if (disguise instanceof DisguiseSlime) + { + ((DisguiseSlime) disguise).SetSize(3); + } + + if (disguise instanceof DisguiseMagmaCube) + { + ((DisguiseMagmaCube) disguise).SetSize(3); + } + + _host.CreatureAllowOverride = false; + + UtilEnt.Vegetate(ent, true); + UtilEnt.ghost(ent, true, false); + _ents.put(ent, new MazeMobWaypoint(ent.getLocation())); + + if (disguise != null && !(disguise instanceof DisguiseSnowman)) + { + _host.Manager.GetDisguise().disguise(disguise); + } + + spawned++; + } + } + + private Location pickNextLocForSafePad() // short method name + { + if (_safePad != null || !_oldSafePads.isEmpty()) + { + ArrayList best = new ArrayList(); + ArrayList toAvoid = new ArrayList(); + + for (SafePad pad : _oldSafePads) + { + toAvoid.add(pad.getLocation()); + } + + if (_safePad != null) + { + toAvoid.add(_safePad.getLocation()); + } + + for (Location pos : getPreset().getValidSafePadSpawns()) + { + boolean canAdd = true; + for (Location avoid : toAvoid) + { + if (UtilMath.offset(pos, avoid) < 40) + { + canAdd = false; + } + } + + if (canAdd) + { + best.add(pos); + } + } + + if (best.isEmpty()) + { + return UtilAlg.findFurthest(_location, getPreset().getValidSafePadSpawns()); + } + else + { + return UtilAlg.Random(best); + } + } + else + { + return UtilAlg.findFurthest(_location, getPreset().getValidSafePadSpawns()); + } + } + + private void stopSafePad() + { + if (_safePad != null) + { + _safePad.turnOffBeacon(); + _oldSafePads.addLast(_safePad); + _safePad = null; + } + } + + public void spawnSafePad() + { + Location next = pickNextLocForSafePad(); + + //Delay + _nextSafePad = new SafePad(_host, this, next.clone().subtract(0, 1, 0)); // maybe don't need to clone() + _nextSafePad.build(); + + for (Block cur : UtilBlock.getInBoundingBox(next.clone().add(-2, 0, -2), next.clone().add(2, 0, 2), false)) + { + if (!_movementWaypointsDisabled.contains(cur)) + _movementWaypointsDisabled.add(cur); + } + + for (Iterator it = _ents.keySet().iterator() ; it.hasNext() ;) + { + LivingEntity en = it.next(); + + if (!_nextSafePad.isOn(en)) + continue; + + it.remove(); + en.remove(); + } + + Bukkit.getPluginManager().callEvent(new SafepadBuildEvent()); + } + + @SuppressWarnings("deprecation") + public void deteriorateCenter() + { + if (getPreset().getCenterSafeZone().isEmpty() || _centerSafeZoneDecay == -1 +// && _centerSafeZoneDecay.isEmpty() + ) + return; + + _centerSafeZoneDecay--; + + ArrayList toSend = new ArrayList(); + + int ind = 0; + + Iterator iterator = getPreset().getCenterSafeZone().iterator(); + while (iterator.hasNext()) + { + Location cur = iterator.next(); + Location loc = cur.clone().subtract(0, 1, 0); + + if(_centerSafeZoneDecay == 10) + { + loc.getBlock().setTypeIdAndData(159, (byte) 5, true); + toSend.add(getBreakPacket(loc, ind, 1)); + } + else if(_centerSafeZoneDecay == 9) + { + toSend.add(getBreakPacket(loc, ind, 2)); + } + else if(_centerSafeZoneDecay == 8) + { + loc.getBlock().setTypeIdAndData(159, (byte) 4, true); + toSend.add(getBreakPacket(loc, ind, 3)); + } + else if(_centerSafeZoneDecay == 7) + { + toSend.add(getBreakPacket(loc, ind, 4)); + } + else if(_centerSafeZoneDecay == 6) + { + loc.getBlock().setTypeIdAndData(159, (byte) 1, true); + toSend.add(getBreakPacket(loc, ind, 5)); + } + else if(_centerSafeZoneDecay == 5) + { + toSend.add(getBreakPacket(loc, ind, 6)); + } + else if(_centerSafeZoneDecay == 4) + { + loc.getBlock().setTypeIdAndData(159, (byte) 14, true); + toSend.add(getBreakPacket(loc, ind, 7)); + } + else if(_centerSafeZoneDecay == 3) + { + toSend.add(getBreakPacket(loc, ind, 8)); + } + else if(_centerSafeZoneDecay == 2) + { + toSend.add(getBreakPacket(loc, ind, 9)); + } + else if(_centerSafeZoneDecay == 1) + { + toSend.add(getBreakPacket(loc, ind, -1)); + iterator.remove(); + + if (getPreset().getCenterSafeZonePaths().contains(cur)) + { + getPreset().getCenterSafeZonePaths().remove(cur); + getPreset().buildMazeBlockAt(cur); + _movementWaypointsDisabled.remove(cur.getBlock()); + } + else + { + loc.getBlock().setTypeIdAndData(0, (byte) 0, true); + } + + getPreset().getMaze().add(cur); + } + + ind++; + } + + for (Player p : UtilServer.getPlayers()) + { + UtilPlayer.sendPacket(p, toSend.toArray(new Packet[toSend.size()])); + } + + if (_centerSafeZoneDecay == 1) + { + _centerSafeZoneDecay = -1; + } + +// if (!_centerSafeZone.isEmpty()) +// { +// Location toBreak = _centerSafeZone.remove(UtilMath.r(_centerSafeZone.size())); +// +// if (_centerSafeZonePaths.contains(toBreak)) +// { +// if (!_waypoints.contains(toBreak.getBlock())) +// _waypoints.add(toBreak.getBlock()); +// +// if (!_map.contains(toBreak)) +// _map.add(toBreak); +// +// _centerSafeZonePaths.remove(toBreak); +// _preset.buildMazeBlockAt(toBreak); +// +// for (int i = 0 ; i < 3 ; i++) +// { +// Location cur = toBreak.clone().subtract(0, i, 0); +// cur.getWorld().playEffect(cur, Effect.STEP_SOUND, cur.getBlock().getTypeId()); +// } +// } +// else +// { +// _centerSafeZoneDecay.put(toBreak, System.currentTimeMillis()); +// } +// } +// +// if (!_centerSafeZoneDecay.isEmpty()) +// { +// NautHashMap copy = new NautHashMap(_centerSafeZoneDecay); +// +// for (Entry entry : copy.entrySet()) +// { +// if (UtilTime.elapsed(entry.getValue(), 1250)) //break +// { +// for (int i = 1 ; i < 4 ; i++) +// { +// Location cur = entry.getKey().clone().subtract(0, i, 0); +// cur.getWorld().playEffect(cur, Effect.STEP_SOUND, 152); +// cur.getBlock().setTypeIdAndData(0, (byte) 0, true); +// } +// +// _centerSafeZonePaths.remove(entry.getKey()); +// _centerSafeZoneDecay.remove(entry.getKey()); +// continue; +// } +// else if (UtilTime.elapsed(entry.getValue(), 1000)) //red +// { +// for (int i = 1 ; i < 4 ; i++) +// { +// Location cur = entry.getKey().clone().subtract(0, i, 0); +// cur.getBlock().setTypeIdAndData(159, (byte) 14, true); +// } +// continue; +// } +// else if (UtilTime.elapsed(entry.getValue(), 750)) //orange +// { +// for (int i = 1 ; i < 3 ; i++) +// { +// Location cur = entry.getKey().clone().subtract(0, i, 0); +// cur.getBlock().setTypeIdAndData(159, (byte) 1, true); +// } +// continue; +// } +// else if (UtilTime.elapsed(entry.getValue(), 500)) //yellow +// { +// for (int i = 1 ; i < 4 ; i++) +// { +// Location cur = entry.getKey().clone().subtract(0, i, 0); +// cur.getBlock().setTypeIdAndData(159, (byte) 4, true); +// } +// continue; +// } +// else if (UtilTime.elapsed(entry.getValue(), 250)) //blue +// { +// for (int i = 1 ; i < 4 ; i++) +// { +// Location cur = entry.getKey().clone().subtract(0, i, 0); +// cur.getBlock().setTypeIdAndData(159, (byte) 3, true); +// } +// continue; +// } +// } +// } + } + + private Packet getBreakPacket(Location location, int index, int progress) + { + return new PacketPlayOutBlockBreakAnimation(index, location.getBlockX(), location.getBlockY(), location.getBlockZ(), progress); + } + + public void decrementSafePadTime() + { + Iterator iterator = _oldSafePads.iterator(); + while (iterator.hasNext()) + { + SafePad pad = iterator.next(); + + if (!pad.decay()) + continue; + + for (Block block : UtilBlock.getInBoundingBox(pad.getLocation().clone().add(-2, 1, -2), pad.getLocation().clone().add(2, 1, 2), false)) + { + if (_movementWaypointsDisabled.contains(block)) + _movementWaypointsDisabled.remove(block); + } + + iterator.remove(); + } + } + + public void decrementPhaseTime() + { + if (_safePad == null) + return; + + if(_phaseTimer == -1) return; + + _phaseTimer--; + if(_phaseTimer == 20) // only gets to this by running out of time naturally, not by player + { + UtilTextMiddle.display("", C.cGreen + C.Bold + (int) _phaseTimer, 5, 40, 5); + } + + if(_phaseTimer == 15 || _phaseTimer == 10) + { + UtilTextMiddle.display("", C.cGreen + C.Bold + (int) _phaseTimer, 5, 40, 5); + } + + if(_phaseTimer == 5 || _phaseTimer == 4) + { + UtilTextMiddle.display("", C.cGreen + C.Bold + (int) _phaseTimer, 5, 40, 5); + } + + if(_phaseTimer == 3) + { + UtilTextMiddle.display("", C.cYellow + C.Bold + (int) _phaseTimer, 5, 40, 5); + } + + if(_phaseTimer == 2) + { + UtilTextMiddle.display("", C.cGold + C.Bold + (int) _phaseTimer, 5, 40, 5); + spawnSafePad(); + } + + if(_phaseTimer == 1) + { + UtilTextMiddle.display("", C.cRed + C.Bold + (int) _phaseTimer, 5, 40, 5); + } + + if(_phaseTimer == 0) + { + for (Player p : _host.GetPlayers(true)) + { + if(_safePad.isOn(p)) + { + UtilTextMiddle.display("", C.cYellow + C.Bold + "Get to the Next Safe Pad!", 5, 40, 5, p); + // maybe send them a happy message? =) + // UtilPlayer.message(p, F.main("Game", "Since you were on the Safe Pad, you didn't die!")); + } + else + { + _host.Manager.GetDamage().NewDamageEvent(p, null, null, + DamageCause.CUSTOM, 500, false, false, false, + "Game", "Map damage"); + UtilTextMiddle.display("", C.cRed + C.Bold + "You weren't on the Safe Pad!", 5, 40, 5, p); + UtilPlayer.message(p, F.main("Game", "You weren't on the Safe Pad!")); + } + } + + spawn(15); + + stopSafePad(); + + _playersOnPad.clear(); + + _phaseTimerStart = Math.max(15, 60 - ((_curSafe - 1) * 2)); + _phaseTimer = _phaseTimerStart; + + if (_nextSafePad == null) + { + spawnSafePad(); + } + + Iterator it = _ents.keySet().iterator(); + while (it.hasNext()) + { + Entity e = it.next(); + if (_nextSafePad.isOn(e)) + { + _ents.remove(_ents.get(e)); + it.remove(); + e.remove(); + } + } + + _curSafe++; + + _safePad = _nextSafePad; + _nextSafePad = null; + + + } + } + + private void checkPlayersOnSafePad() + { + if (_safePad == null) + return; + + boolean allOn = true; + for (Player p : _host.GetPlayers(true)) + { + if (!_safePad.isOn(p)) + { + allOn = false; + + if (_playersOnPad.contains(p)) + { + UtilTextMiddle.display("", C.cRed + C.Bold + "Get back to the Safe Pad!", 0, 5, 0, p); + } + continue; + } + + if (_playersOnPad.contains(p)) + continue; + + UtilPlayer.message(p, F.main("Game", "You made it to the Safe Pad!")); + _playersOnPad.add(p); + + _host.AddGems(p, 2, "Safe Pads Reached", true, true); + + if (_playersOnPad.size() == 1) // first player + { + _host.Announce(F.main("Game", F.name(p.getName()) + " made it to the Safe Pad first!")); + + UtilTextMiddle.display("", C.cYellow + C.Bold + "You got to the Safe Pad first!", 5, 40, 5, p); + _host.AddGems(p, 7.5, "First Safe Pads", true, true); + p.playSound(p.getLocation(), Sound.SUCCESSFUL_HIT, 1.0f, 1.0f); + + //2 hearts + UtilPlayer.health(p, 4.0); + + if (_host.GetKit(p) instanceof KitBodyBuilder) + { + p.setMaxHealth(Math.min(p.getMaxHealth() + 2, 30)); + UtilParticle.PlayParticle(ParticleType.HEART, p.getEyeLocation().clone().add(0, .5, 0), 0F, 0F, 0F, 0, 3, ViewDist.NORMAL, UtilServer.getPlayers()); + } + + int decreased = Math.max(6, 16 - (_curSafe - 1)); + _phaseTimer = Math.min(decreased, _phaseTimer); + + for (Player player : _host.GetPlayers(true)) + { + if (player == p) + continue; + + UtilPlayer.message(player, F.main("Game", "You have " + F.time(decreased + " Seconds") + " to make it to the Safe Pad!")); + } + + Bukkit.getPluginManager().callEvent(new FirstToSafepadEvent(p)); + } + else // not the first + { + p.playSound(p.getLocation(), Sound.SUCCESSFUL_HIT, 1.0f, 1.0f); + UtilTextMiddle.display("", C.cYellow + C.Bold + "You got to the Safe Pad!", 5, 40, 5, p); + + UtilPlayer.health(p, 2.0); + } + } + + if (allOn) + { + _phaseTimer = Math.min(4, _phaseTimer); + } + } + + public void removePlayerContainmentUnit() + { + for(Location loc : _playerContainmentGlass) + { + loc.getBlock().setType(Material.AIR); + } + } + + public Set getMonsters() + { + return _ents.keySet(); + } + + public int getPhaseTimer() + { + return _phaseTimer; + } + + @EventHandler + public void onGameStateDead(GameStateChangeEvent event) + { + if (event.GetState() != GameState.Dead) + return; + + HandlerList.unregisterAll(this); + } + + @EventHandler + public void onSnowForm(EntityBlockFormEvent event) + { + event.setCancelled(true); + } + + @EventHandler + public void onEntityCombust(EntityCombustEvent event) + { + event.setCancelled(true); + } + + @EventHandler + public void onEntityLaunch(EntityLaunchEvent event) + { + if (!_ents.containsKey(event.getEntity())) + return; + + _ents.remove(event.getEntity()); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/MazeBlockData.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/MazeBlockData.java new file mode 100644 index 000000000..5a795cfda --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/MazeBlockData.java @@ -0,0 +1,34 @@ +package nautilus.game.arcade.game.games.monstermaze; + +import org.bukkit.Material; + +public class MazeBlockData +{ + public static class MazeBlock + { + public final Material Type; + public final byte Data; + + public MazeBlock(Material type) + { + this(type, (byte) 0); + } + + public MazeBlock(Material type, byte data) + { + Type = type; + Data = data; + } + } + + public final MazeBlock Top; + public final MazeBlock Middle; + public final MazeBlock Bottom; + + public MazeBlockData(MazeBlock top, MazeBlock middle, MazeBlock bottom) + { + Top = top; + Middle = middle; + Bottom = bottom; + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/MazeMobWaypoint.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/MazeMobWaypoint.java new file mode 100644 index 000000000..4238ebba2 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/MazeMobWaypoint.java @@ -0,0 +1,23 @@ +package nautilus.game.arcade.game.games.monstermaze; + +import org.bukkit.Location; + +public class MazeMobWaypoint +{ + public Location Last; + public Location Target; + public long Time; + public CardinalDirection Direction = CardinalDirection.NULL; + + public MazeMobWaypoint(Location last) + { + Last = last; + Target = null; + Time = System.currentTimeMillis(); + } + + public enum CardinalDirection + { + NORTH, SOUTH, EAST, WEST, NULL // such order much not care + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/MonsterMaze.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/MonsterMaze.java new file mode 100644 index 000000000..7d9811035 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/MonsterMaze.java @@ -0,0 +1,433 @@ +package nautilus.game.arcade.game.games.monstermaze; + +import java.util.HashMap; +import java.util.Iterator; +import java.util.regex.Pattern; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilInv; +import mineplex.core.common.util.UtilTextMiddle; +import mineplex.core.common.util.UtilTime; +import mineplex.core.itemstack.ItemStackFactory; +import mineplex.core.recharge.Recharge; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.minecraft.game.core.condition.Condition.ConditionType; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.GameType; +import nautilus.game.arcade.events.GameStateChangeEvent; +import nautilus.game.arcade.game.SoloGame; +import nautilus.game.arcade.game.games.monstermaze.MMMazes.MazePreset; +import nautilus.game.arcade.game.games.monstermaze.MazeBlockData.MazeBlock; +import nautilus.game.arcade.game.games.monstermaze.events.AbilityUseEvent; +import nautilus.game.arcade.game.games.monstermaze.events.MonsterBumpPlayerEvent; +import nautilus.game.arcade.game.games.monstermaze.kits.KitBodyBuilder; +import nautilus.game.arcade.game.games.monstermaze.kits.KitJumper; +import nautilus.game.arcade.game.games.monstermaze.kits.KitRepulsor; +import nautilus.game.arcade.game.games.monstermaze.kits.KitSlowball; +import nautilus.game.arcade.game.games.monstermaze.trackers.AbilityUseTracker; +import nautilus.game.arcade.game.games.monstermaze.trackers.FirstToSafepadTracker; +import nautilus.game.arcade.game.games.monstermaze.trackers.PilotTracker; +import nautilus.game.arcade.game.games.monstermaze.trackers.SnowmanHitTracker; +import nautilus.game.arcade.game.games.monstermaze.trackers.SurvivePast10thSafepadTracker; +import nautilus.game.arcade.kit.Kit; + +import org.bukkit.Bukkit; +import org.bukkit.Effect; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.block.Block; +import org.bukkit.entity.EnderCrystal; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.entity.EntityDamageEvent; +import org.bukkit.event.entity.EntityRegainHealthEvent; +import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason; +import org.bukkit.scoreboard.Team; + +public class MonsterMaze extends SoloGame +{ + private Maze _maze; + private EntityType _monsterType; + + private MazePreset _preset; + + private Location _center; + + private HashMap _launched = new HashMap(); + + @SuppressWarnings("unchecked") + public MonsterMaze(ArcadeManager manager) + { + super(manager, GameType.MonsterMaze, + + new Kit[] + { + new KitJumper(manager), + new KitSlowball(manager), + new KitBodyBuilder(manager), + new KitRepulsor(manager) + }, + + new String[] + { + "Run over the maze and don't fall off,", + "but make sure you avoid the monsters!", + "Make it to a Safe Pad or be killed!" + }); + + DamagePvP = false; + DamagePvE = false; + + DamageFall = false; + + HungerSet = 20; + + PrepareFreeze = false; + + HungerSet = 20; + + CompassEnabled = false; + + VersionRequire1_8 = true; + + registerStatTrackers( + new SnowmanHitTracker(this), + new AbilityUseTracker(this), + new FirstToSafepadTracker(this), + new PilotTracker(this), + new SurvivePast10thSafepadTracker(this) + ); + //_maze = new SnowmanMaze(this, WorldData.GetDataLocs("GRAY")/*, WorldData.GetCustomLocs("103")*/); + } + + public Maze getMaze() + { + return _maze; + } + + @EventHandler + public void GameStateChange(GameStateChangeEvent event) + { + if(event.GetState() == GameState.Live) + { + _maze.removePlayerContainmentUnit(); + + UtilTextMiddle.display("", C.cYellow + C.Bold + "Get to the Safe Pad!", 5, 40, 5); + + for (Team team : GetScoreboard().GetScoreboard().getTeams()) + team.setCanSeeFriendlyInvisibles(true); + } + else if(event.GetState() == GameState.Recruit) + { + _monsterType = loadEntityType(); + _center = WorldData.GetDataLocs("ORANGE").get(0); + _preset = MMMazes.getRandomMapPreset(_center, getMazeBlockData()); + _preset.build(); + _maze = new Maze(this, _preset); + + _maze.fillSpawn(150); + } + } + + private EntityType loadEntityType() + { + EntityType en = EntityType.SNOWMAN; + + for (String key : WorldData.GetAllCustomLocs().keySet()) + { + try + { + if (key.startsWith("E")) + { + en = EntityType.valueOf(key.split(Pattern.quote("="))[1].toUpperCase()); + } + } + catch (Exception ex) + { + + } + } + return en; + } + + @SuppressWarnings("deprecation") + private MazeBlockData getMazeBlockData() + { + MazeBlock top = null; + MazeBlock mid = null; + MazeBlock bottom = null; + for (String key : WorldData.GetAllCustomLocs().keySet()) + { + try + { + if (key.startsWith("B1")) + { + String[] typeData = key.split(Pattern.quote("="))[1].split(Pattern.quote(",")); + top = new MazeBlock(Material.getMaterial(Integer.valueOf(typeData[0])), Byte.valueOf(typeData[1])); + } + else if (key.startsWith("B2")) + { + String[] typeData = key.split(Pattern.quote("="))[1].split(Pattern.quote(",")); + mid = new MazeBlock(Material.getMaterial(Integer.valueOf(typeData[0])), Byte.valueOf(typeData[1])); + } + else if (key.startsWith("B3")) + { + String[] typeData = key.split(Pattern.quote("="))[1].split(Pattern.quote(",")); + bottom = new MazeBlock(Material.getMaterial(Integer.valueOf(typeData[0])), Byte.valueOf(typeData[1])); + } + } + catch (Exception ex) + { + + } + } + + if (top != null && mid != null && bottom != null) + { + return new MazeBlockData(top, mid, bottom); + } + else + { + return new MazeBlockData(new MazeBlock(Material.QUARTZ_BLOCK), new MazeBlock(Material.QUARTZ_BLOCK, (byte) 2), new MazeBlock(Material.STEP, (byte) 15)); + } + } + + private void setJumpsLeft(Player player, int jumps) + { + if (jumps <= 0) + { + player.getInventory().setItem(8, null); + } + else + { + player.getInventory().setItem(8, ItemStackFactory.Instance.CreateStack(Material.FEATHER, (byte)0, jumps, C.cYellow + C.Bold + jumps + " Jumps Remaining")); + } + } + + @EventHandler + public void jumpEvent(UpdateEvent event) + { + if(event.getType() != UpdateType.TICK) + return; + + if (!IsLive()) + return; + + for (Player p : GetPlayers(true)) + { + if (!UtilInv.contains(p, "Jumps Remaining", Material.FEATHER, (byte) 0, 1) || p.getLocation().getY()-_center.getY() <= 0 || !Recharge.Instance.usable(p, "MM Player Jump") || isLaunched(p)) + continue; + + setJumpsLeft(p, p.getInventory().getItem(8).getAmount() - 1); + + p.playSound(p.getLocation(), Sound.CHICKEN_EGG_POP, 1.0f, 1.0f); + + Recharge.Instance.useForce(p, "MM Player Jump", 750); + + //Find blocks below a player + for (int i = 0 ; i < 3 ; i++) + { + Block under = p.getLocation().clone().subtract(0, i, 0).getBlock(); + + if (under.getType() == Material.AIR) + continue; + + under.getWorld().playEffect(under.getLocation(), Effect.STEP_SOUND, UtilBlock.getStepSoundId(under)); + + for (Block block : UtilBlock.getSurrounding(under, true)) + { + if (block.getType() == Material.AIR) + continue; + + block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, UtilBlock.getStepSoundId(block)); + } + + break; + } + + Bukkit.getPluginManager().callEvent(new AbilityUseEvent(p)); + } + } + + @EventHandler + public void PotionEffects(UpdateEvent event) + { + if(event.getType() != UpdateType.TICK) return; + if(!InProgress()) return; + + for(Player pl : GetPlayers(true)) + { + if (IsLive() && (UtilInv.contains(pl, Material.FEATHER, (byte) 0, 1))) + { + while (Manager.GetCondition().GetActiveCondition(pl, ConditionType.JUMP) != null) + Manager.GetCondition().GetActiveCondition(pl, ConditionType.JUMP).Expire(); + } + else + { + if (!Manager.GetCondition().HasCondition(pl, ConditionType.JUMP, null)) + Manager.GetCondition().Factory().Jump("No jumping", pl, null, 9999999, 250, true, false, false); + } + +// if (!Manager.GetCondition().HasCondition(pl, ConditionType.INVISIBILITY, null)) +// Manager.GetCondition().Factory().Invisible("Hide players", pl, null, 9999999, 2, true, false, false); + } + } + + public EntityType getMonsterType() + { + return _monsterType; + } + + @EventHandler + public void onPlayerBump(MonsterBumpPlayerEvent event) + { + if (!IsLive()) + return; + + _launched.put(event.getPlayer(), System.currentTimeMillis()); + } + + @EventHandler + public void tickBumps(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + if (!IsLive()) + return; + + HashMap copy = new HashMap(); + copy.putAll(_launched); + + for (Iterator iterator = copy.keySet().iterator() ; iterator.hasNext() ;) + { + Player player = iterator.next(); + + if (player == null || !player.isOnline()) + { + _launched.remove(player); + continue; + } + + if (UtilEnt.isGrounded(player) && UtilTime.elapsed(copy.get(player), 500)) + { + _launched.remove(player); + continue; + } + + //If there are blocks surrounding the block it's on top of (if it's on the side of a block) + if (player.getLocation().getY() == player.getLocation().getBlockY() && !UtilBlock.getInBoundingBox(player.getLocation().clone().add(1, -1, 1), player.getLocation().clone().subtract(1, 1, 1), true).isEmpty() && UtilTime.elapsed(copy.get(player), 500)) + { + _launched.remove(player); + continue; + } + + //Time out + if (UtilTime.elapsed(copy.get(player), 3000)) + { + _launched.remove(player); + continue; + } + } + } + + public boolean isLaunched(Player player) + { + return _launched.containsKey(player); + } + + @EventHandler + public void onRegain(EntityRegainHealthEvent event) + { + if (event.getRegainReason() == RegainReason.SATIATED) + { + event.setCancelled(true); + } + } + + //Fix for eye of ender + @EventHandler + public void onDamage(EntityDamageEvent event) + { + if (event.getEntity() instanceof EnderCrystal) + { + event.setCancelled(true); + } + } + + private boolean _announced = false; + @EventHandler + public void sendF5Message(UpdateEvent event) + { + if (event.getType() != UpdateType.FASTEST) + return; + + if (GetState() != GameState.Prepare) + return; + + if (_announced) + return; + + if (!UtilTime.elapsed(GetStateTime(), 4000)) + return; + + _announced = true; + UtilTextMiddle.display(C.cYellow + C.Bold + "Press F5", C.cAqua + C.Bold + "Monster Maze is best in 3rd person!"); + Announce(C.cYellow + C.Scramble + "@@" + C.cAqua + C.Bold + " Monster Maze is best played in 3rd Person! (Push F5) " + C.cYellow + C.Scramble + "@@"); + } + + @Override + @EventHandler + public void ScoreboardUpdate(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + return; + + if (GetTeamList().isEmpty()) + return; + + Scoreboard.Reset(); + + Scoreboard.WriteBlank(); + + Scoreboard.Write(C.cYellow + C.Bold + "Players"); + + if (GetPlayers(true).size() > 5) + { + Scoreboard.Write(C.cWhite + GetPlayers(true).size() + " Alive"); + } + else + { + for (Player p : GetPlayers(true)) + { + Scoreboard.Write(C.cWhite + p.getName()); + } + } + + Scoreboard.WriteBlank(); + + Scoreboard.Write(C.cGreen + C.Bold + "Safe Pad"); + + if (_maze.getSafePad() != null) + { + Scoreboard.Write(C.cWhite + _maze.getPhaseTimer() + " Seconds"); + } + else + { + Scoreboard.Write("None"); + } + + Scoreboard.WriteBlank(); + + Scoreboard.Write(C.cGold + C.Bold + "Stage"); + + Scoreboard.Write(C.cWhite + getMaze().getCurrentSafePadCount()); + + Scoreboard.Draw(); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/SafePad.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/SafePad.java new file mode 100644 index 000000000..669ff6cf4 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/SafePad.java @@ -0,0 +1,309 @@ +package nautilus.game.arcade.game.games.monstermaze; + +import java.util.ArrayList; +import java.util.Iterator; + +import mineplex.core.common.util.MapUtil; +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilPlayer; +import net.minecraft.server.v1_7_R4.Packet; +import net.minecraft.server.v1_7_R4.PacketPlayOutBlockBreakAnimation; + +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.entity.Entity; +import org.bukkit.entity.Player; + +public class SafePad +{ + private MonsterMaze Host; +// private Maze _maze; + + private Location _loc; + + private int _decayCount = 11; + + private ArrayList _blocks = new ArrayList(); + + public SafePad(MonsterMaze host, Maze maze, Location loc) + { + Host = host; +// _maze = maze; + + _loc = loc; + + //beacon surface + for (int x = -2 ; x < 3 ; x++) + { + for (int z = -2 ; z < 3 ; z++) + { + if (x == 0 && z == 0) + continue; + + _blocks.add(new SafePadBlock(loc.clone().add(x, 0, z), Material.STAINED_CLAY, (byte) 5)); + } + } + + // beacon + _blocks.add(new SafePadBlock(loc.clone().add(0, 0, 0), Material.BEACON, (byte)0)); + + // beacon base + for (int x = -1 ; x < 2 ; x++) + { + for (int z = -1 ; z < 2 ; z++) + { + _blocks.add(new SafePadBlock(loc.clone().add(x, -1, z), Material.IRON_BLOCK, (byte)0)); + } + + //Stairs + _blocks.add(new SafePadBlock(loc.clone().add(x, -1, 2), Material.QUARTZ_STAIRS, (byte) 7)); + _blocks.add(new SafePadBlock(loc.clone().add(x, -1, -2), Material.QUARTZ_STAIRS, (byte) 6)); + _blocks.add(new SafePadBlock(loc.clone().add(2, -1, x), Material.QUARTZ_STAIRS, (byte) 5)); + _blocks.add(new SafePadBlock(loc.clone().add(-2, -1, x), Material.QUARTZ_STAIRS, (byte) 4)); + } + + // corner blocks + _blocks.add(new SafePadBlock(loc.clone().add(2, -1, 2), Material.QUARTZ_BLOCK, (byte) 1)); + _blocks.add(new SafePadBlock(loc.clone().add(-2, -1, 2), Material.QUARTZ_BLOCK, (byte) 1)); + _blocks.add(new SafePadBlock(loc.clone().add(2, -1, -2), Material.QUARTZ_BLOCK, (byte) 1)); + _blocks.add(new SafePadBlock(loc.clone().add(-2, -1, -2), Material.QUARTZ_BLOCK, (byte) 1)); + + // air slabs + for (int x = -2 ; x < 3 ; x++) + { + for (int z = -2 ; z < 3 ; z++) + { + _blocks.add(new SafePadBlock(loc.clone().add(x, -2, z), Material.AIR, (byte) 0)); + } + } + } + + public class SafePadBlock + { + private Material _origM; + private byte _origD; + + private Material _tempMat; + private byte _tempData; + + Location _loc; + + @SuppressWarnings("deprecation") + public SafePadBlock(Location loc, Material newMat, byte newData) + { + _origM = loc.getBlock().getType(); + _origD = loc.getBlock().getData(); + + _tempMat = newMat; + _tempData = newData; + + _loc = loc; + } + + @SuppressWarnings("deprecation") + public void setMaterial(Material m) + { + _tempMat = m; + MapUtil.QuickChangeBlockAt(_loc, _tempMat.getId(), _tempData); + } + + @SuppressWarnings("deprecation") + public void setData(byte b) // for glass changing + { + _tempData = b; + MapUtil.QuickChangeBlockAt(_loc, _tempMat.getId(), _tempData); + } + + public Material getBlockMaterial() + { + return _loc.getBlock().getType(); + } + + @SuppressWarnings("deprecation") + public byte getBlockData() + { + return _loc.getBlock().getData(); + } + + public Location getLocation() + { + return _loc; + } + + @SuppressWarnings("deprecation") + public void build() + { + MapUtil.QuickChangeBlockAt(_loc, _tempMat.getId(), _tempData); +// _loc.getWorld().playEffect(_loc, Effect.STEP_SOUND, _loc.getBlock().getTypeId()); + } + + @SuppressWarnings("deprecation") + public void restore() + { + MapUtil.QuickChangeBlockAt(_loc, _origM.getId(), _origD); +// _loc.getWorld().playEffect(_loc, Effect.STEP_SOUND, _loc.getBlock().getTypeId()); + } + } + + public void build() + { + for(SafePadBlock spb : _blocks) + { + spb.build(); + } + } + + private void setBreakData(byte newData) + { + for (SafePadBlock spb : _blocks) + { + if (spb.getBlockMaterial() != Material.STAINED_CLAY) + continue; + + spb.setData(newData); + } + } + + public void turnOffBeacon() + { + for (SafePadBlock bl : _blocks) + { + if (bl.getBlockMaterial() == Material.IRON_BLOCK) + bl.setMaterial(Material.QUARTZ_BLOCK); + + if (bl.getBlockMaterial() == Material.BEACON) + { + bl.setMaterial(Material.STAINED_CLAY); + bl.setData((byte) 5); + } + } + } + + public boolean decay() + { + if (_decayCount == -1) + return true; + + _decayCount--; + + if(_decayCount == 10) + { + setBreakData((byte)5); // green + setCrackedProgress(1); + } + else if(_decayCount == 9) + { + setCrackedProgress(2); + } + else if(_decayCount == 8) + { + setBreakData((byte)4); // yellow + setCrackedProgress(3); + } + else if(_decayCount == 7) + { + setCrackedProgress(4); + } + else if(_decayCount == 6) + { + setBreakData((byte)1); // orange + setCrackedProgress(5); + } + else if(_decayCount == 5) + { + setCrackedProgress(6); + } + else if(_decayCount == 4) + { + setBreakData((byte)14); // red + setCrackedProgress(7); + } + else if(_decayCount == 3) + { + setCrackedProgress(8); + } + else if(_decayCount == 2) + { + setCrackedProgress(9); + } + else if(_decayCount == 1) + { + _decayCount = -1; + + setCrackedProgress(-1); + + destroySurface(); + destroyBase(); + + return true; + } + return false; + } + + private void setCrackedProgress(int progress) + { + int i = 0; + Iterator iter = _blocks.iterator(); + ArrayList packets = new ArrayList(); + while(iter.hasNext()) + { + SafePadBlock spb = iter.next(); + if (!spb.getLocation().getBlock().getType().equals(Material.STAINED_CLAY)) + continue; + + i++; + + Packet packet = new PacketPlayOutBlockBreakAnimation(i, spb.getLocation().getBlockX(), spb.getLocation().getBlockY(), spb.getLocation().getBlockZ(), progress); + packets.add(packet); + } + for(Player p : Host.GetPlayers(false)) + { + Packet[] pcks = new Packet[packets.size()]; + packets.toArray(pcks); + UtilPlayer.sendPacket(p, pcks); + } + /*for(SafePadBlock spb : _blocks) + { + if(!spb.getLocation().getBlock().getType().equals(Material.STAINED_GLASS)) continue; + + UtilParticle.PlayParticle(ParticleType.BLOCK_DUST.getParticle(Material.STAINED_GLASS, spb.getBlockData()), spb.getLocation(), 0.5f, 0.5f, 0.5f, 0.05f, 8, ViewDist.NORMAL, Host.GetPlayers(false).toArray(new Player[Host.GetPlayers(false).size()])); + Packet packet = new PacketPlayOutBlockBreakAnimation(1, spb.getLocation().getBlockX(), spb.getLocation().getBlockY(), spb.getLocation().getBlockZ(), progress); + for(Player p : Host.GetPlayers(false)) + { + UtilPlayer.sendPacket(p, packet); + } + }*/ + } + + public void destroyBase() + { + for (final SafePadBlock bl : _blocks) + { + if (bl.getBlockMaterial() == Material.QUARTZ_BLOCK || bl.getBlockMaterial() == Material.QUARTZ_STAIRS || bl.getBlockMaterial() == Material.AIR) + { + bl.restore(); + } + } + } + + public void destroySurface() + { + for (final SafePadBlock bl : _blocks) + { + if (bl.getBlockMaterial() == Material.STAINED_CLAY) + { + bl.restore(); + } + } + } + + public Location getLocation() + { + return _loc; + } + + public boolean isOn(Entity e) + { + return UtilAlg.inBoundingBox(e.getLocation(), getLocation().clone().add(2.999, 5, 2), getLocation().clone().add(-2, 0, -2.999)); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/events/AbilityUseEvent.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/events/AbilityUseEvent.java new file mode 100644 index 000000000..8b07fda5e --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/events/AbilityUseEvent.java @@ -0,0 +1,30 @@ +package nautilus.game.arcade.game.games.monstermaze.events; + +import org.bukkit.entity.Player; +import org.bukkit.event.HandlerList; +import org.bukkit.event.player.PlayerEvent; + +public class AbilityUseEvent extends PlayerEvent +{ + /** + * @author Mysticate + */ + + private static final HandlerList _handlers = new HandlerList(); + + private static HandlerList getHandlerList() + { + return _handlers; + } + + @Override + public HandlerList getHandlers() + { + return getHandlerList(); + } + + public AbilityUseEvent(Player player) + { + super(player); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/events/EntityLaunchEvent.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/events/EntityLaunchEvent.java new file mode 100644 index 000000000..273652196 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/events/EntityLaunchEvent.java @@ -0,0 +1,30 @@ +package nautilus.game.arcade.game.games.monstermaze.events; + +import org.bukkit.entity.Entity; +import org.bukkit.event.HandlerList; +import org.bukkit.event.entity.EntityEvent; + +public class EntityLaunchEvent extends EntityEvent +{ + /** + * @author Mysticate + */ + + private static final HandlerList _handlers = new HandlerList(); + + private static HandlerList getHandlerList() + { + return _handlers; + } + + @Override + public HandlerList getHandlers() + { + return getHandlerList(); + } + + public EntityLaunchEvent(Entity ent) + { + super(ent); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/events/FirstToSafepadEvent.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/events/FirstToSafepadEvent.java new file mode 100644 index 000000000..532905fff --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/events/FirstToSafepadEvent.java @@ -0,0 +1,30 @@ +package nautilus.game.arcade.game.games.monstermaze.events; + +import org.bukkit.entity.Player; +import org.bukkit.event.HandlerList; +import org.bukkit.event.player.PlayerEvent; + +public class FirstToSafepadEvent extends PlayerEvent +{ + /** + * @author Mysticate + */ + + private static final HandlerList _handlers = new HandlerList(); + + private static HandlerList getHandlerList() + { + return _handlers; + } + + @Override + public HandlerList getHandlers() + { + return getHandlerList(); + } + + public FirstToSafepadEvent(Player player) + { + super(player); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/events/MonsterBumpPlayerEvent.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/events/MonsterBumpPlayerEvent.java new file mode 100644 index 000000000..9822cb194 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/events/MonsterBumpPlayerEvent.java @@ -0,0 +1,30 @@ +package nautilus.game.arcade.game.games.monstermaze.events; + +import org.bukkit.entity.Player; +import org.bukkit.event.HandlerList; +import org.bukkit.event.player.PlayerEvent; + +public class MonsterBumpPlayerEvent extends PlayerEvent +{ + /** + * @author Mysticate + */ + + private static final HandlerList _handlers = new HandlerList(); + + private static HandlerList getHandlerList() + { + return _handlers; + } + + @Override + public HandlerList getHandlers() + { + return getHandlerList(); + } + + public MonsterBumpPlayerEvent(Player player) + { + super(player); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/events/SafepadBuildEvent.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/events/SafepadBuildEvent.java new file mode 100644 index 000000000..6a3e381f4 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/events/SafepadBuildEvent.java @@ -0,0 +1,24 @@ +package nautilus.game.arcade.game.games.monstermaze.events; + +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; + +public class SafepadBuildEvent extends Event +{ + /** + * @author Mysticate + */ + + private static final HandlerList _handlers = new HandlerList(); + + private static HandlerList getHandlerList() + { + return _handlers; + } + + @Override + public HandlerList getHandlers() + { + return getHandlerList(); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/kits/KitBodyBuilder.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/kits/KitBodyBuilder.java new file mode 100644 index 000000000..d6722bebb --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/kits/KitBodyBuilder.java @@ -0,0 +1,38 @@ +package nautilus.game.arcade.game.games.monstermaze.kits; + +import mineplex.core.common.util.F; +import mineplex.core.itemstack.ItemStackFactory; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.kit.Kit; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; + +import org.bukkit.Material; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; + +public class KitBodyBuilder extends Kit +{ + public KitBodyBuilder(ArcadeManager manager) + { + super(manager, "Body Builder", KitAvailability.Gem, 2000, + + new String[] + { + "Your health just keeps getting better!" + }, + + new Perk[] + { + new Perk("Body Builder", new String[]{"Your " + F.elem("Max Health") + " increases by " + F.skill("One Heart"), "when you are first to a Safe Pad.", "Maximum of 15 hearts."}){} + }, + EntityType.SKELETON, + ItemStackFactory.Instance.CreateStack(373, 8229)); + } + + @Override + public void GiveItems(Player player) + { + player.getInventory().setItem(4, ItemStackFactory.Instance.CreateStack(Material.COMPASS, (byte) 0, 1, F.item("Safe Pad Locator"))); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/kits/KitJumper.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/kits/KitJumper.java new file mode 100644 index 000000000..2cc376cfc --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/kits/KitJumper.java @@ -0,0 +1,50 @@ +package nautilus.game.arcade.game.games.monstermaze.kits; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.itemstack.ItemStackFactory; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.game.games.monstermaze.kits.perks.PerkJumpsDisplay; +import nautilus.game.arcade.kit.Kit; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; + +import org.bukkit.Material; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; + +public class KitJumper extends Kit +{ + public KitJumper(ArcadeManager manager) + { + super(manager, "Jumper", KitAvailability.Free, + + new String[] + { + "You have springs attached to your feet!", + "Bouncy... bouncy... bouncy..." + }, + + new Perk[] + { + new Perk("Jumper", new String[] + { + C.cGray + "You can jump " + C.cYellow + "5 Times" + C.cGray + "." + }) + { + + }, + new PerkJumpsDisplay() + }, + EntityType.SKELETON, + new ItemStack(Material.FEATHER)); + } + + @Override + public void GiveItems(Player player) + { + player.getInventory().setItem(4, ItemStackFactory.Instance.CreateStack(Material.COMPASS, (byte) 0, 1, F.item("Safe Pad Locator"))); + player.getInventory().setItem(8, ItemStackFactory.Instance.CreateStack(Material.FEATHER, (byte)0, 5, C.cYellow + C.Bold + 5 + " Jumps Remaining")); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/kits/KitRepulsor.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/kits/KitRepulsor.java new file mode 100644 index 000000000..992dea92d --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/kits/KitRepulsor.java @@ -0,0 +1,54 @@ +package nautilus.game.arcade.game.games.monstermaze.kits; + +import mineplex.core.achievement.Achievement; +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.itemstack.ItemStackFactory; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.game.games.monstermaze.kits.perks.PerkRepulsor; +import nautilus.game.arcade.kit.Kit; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; + +import org.bukkit.Material; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; + +public class KitRepulsor extends Kit +{ + public KitRepulsor(ArcadeManager manager) + { + super(manager, "Repulsor", KitAvailability.Achievement, 0, + + new String[] + { + "You love to watch monsters", + "fly away... Caw..." + }, + + new Perk[] + { + new PerkRepulsor() + }, + EntityType.SKELETON, + new ItemStack(Material.COAL)); + + setAchievementRequirements(new Achievement[] + { + Achievement.MONSTER_MAZE_HARD_MODE, + Achievement.MONSTER_MAZE_NINJA, + Achievement.MONSTER_MAZE_PILOT, + Achievement.MONSTER_MAZE_SPEEDSTER, + Achievement.MONSTER_MAZE_SURVIVAL, + Achievement.MONSTER_MAZE_WINS + }); + } + + @Override + public void GiveItems(Player player) + { + player.getInventory().setItem(0, ItemStackFactory.Instance.CreateStack(Material.COAL, (byte) 0, 3, C.cYellow + C.Bold + "Right Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Repulse")); + player.getInventory().setItem(4, ItemStackFactory.Instance.CreateStack(Material.COMPASS, (byte) 0, 1, F.item("Safe Pad Locator"))); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/kits/KitSlowball.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/kits/KitSlowball.java new file mode 100644 index 000000000..914c9d084 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/kits/KitSlowball.java @@ -0,0 +1,61 @@ +package nautilus.game.arcade.game.games.monstermaze.kits; + +import mineplex.core.common.util.F; +import mineplex.core.itemstack.ItemStackFactory; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.kit.Kit; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.perks.PerkConstructor; + +import org.bukkit.Material; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.entity.Snowball; +import org.bukkit.event.EventHandler; +import org.bukkit.inventory.ItemStack; + +public class KitSlowball extends Kit +{ + public KitSlowball(ArcadeManager manager) + { + super(manager, "Slowballer", KitAvailability.Gem, 4000, + + new String[] + { + "Slow enemies so they can't get to", + "their Safe Pad in time!" + }, + + new Perk[] + { + new PerkConstructor("Slowballer", 2, 16, Material.SNOW_BALL, "Slowball", true) + }, + EntityType.SKELETON, + new ItemStack(Material.SNOW_BALL)); + } + + @Override + public void GiveItems(Player player) + { + player.getInventory().setItem(4, ItemStackFactory.Instance.CreateStack(Material.COMPASS, (byte) 0, 1, F.item("Safe Pad Locator"))); + } + + @EventHandler + public void SnowballHit(CustomDamageEvent event) + { + if (event.GetProjectile() == null) + return; + + if (!(event.GetProjectile() instanceof Snowball)) + return; + + event.GetProjectile().remove(); + +// event.GetDamageeEntity().playEffect(EntityEffect.HURT); + + Manager.GetCondition().Factory().Slow("Snowball Slow", event.GetDamageeEntity(), (LivingEntity)event.GetProjectile().getShooter(), 2, 1, false, false, true, false); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/kits/perks/PerkJumpsDisplay.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/kits/perks/PerkJumpsDisplay.java new file mode 100644 index 000000000..c6b23dc7a --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/kits/perks/PerkJumpsDisplay.java @@ -0,0 +1,41 @@ +package nautilus.game.arcade.game.games.monstermaze.kits.perks; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilTextBottom; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import nautilus.game.arcade.kit.Perk; + +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; + +public class PerkJumpsDisplay extends Perk +{ + public PerkJumpsDisplay() + { + super("Display", new String[0], false); + } + + @EventHandler + public void onShow(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + return; + + for (Player player : Manager.GetGame().GetPlayers(true)) + { + if (!Kit.HasKit(player)) + continue; + + if (player.getInventory().getItem(8) == null || player.getInventory().getItem(8).getAmount() <= 0) + { + UtilTextBottom.display(C.cWhite + "No jumps left", player); + } + else + { + UtilTextBottom.display(F.elem(player.getInventory().getItem(8).getAmount() + "") + C.cWhite + " jumps left", player); + } + } + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/kits/perks/PerkRepulsor.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/kits/perks/PerkRepulsor.java new file mode 100644 index 000000000..dce06ba0a --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/kits/perks/PerkRepulsor.java @@ -0,0 +1,128 @@ +package nautilus.game.arcade.game.games.monstermaze.kits.perks; + +import java.util.HashMap; + +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilEvent; +import mineplex.core.common.util.UtilEvent.ActionType; +import mineplex.core.common.util.UtilFirework; +import mineplex.core.common.util.UtilInv; +import mineplex.core.common.util.UtilTime; +import mineplex.core.updater.event.UpdateEvent; +import nautilus.game.arcade.game.games.monstermaze.events.AbilityUseEvent; +import nautilus.game.arcade.game.games.monstermaze.events.EntityLaunchEvent; +import nautilus.game.arcade.kit.Perk; + +import org.bukkit.Bukkit; +import org.bukkit.Color; +import org.bukkit.EntityEffect; +import org.bukkit.FireworkEffect.Type; +import org.bukkit.Material; +import org.bukkit.entity.Entity; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.player.PlayerInteractEvent; + +public class PerkRepulsor extends Perk +{ + private HashMap _launched = new HashMap(); + + public PerkRepulsor() + { + super("Repulsor", new String[] + { + F.elem("Click") + " with Coal to use " + F.skill("Repulse") + ".", + }); + } + + @EventHandler + public void onRepulse(PlayerInteractEvent event) + { + if (!Manager.GetGame().IsLive()) + return; + + if (!UtilEvent.isAction(event, ActionType.R)) + return; + + if (!UtilInv.IsItem(event.getItem(), Material.COAL, (byte) 0)) + return; + + Player player = event.getPlayer(); + + if (!Kit.HasKit(player)) + return; + + event.setCancelled(true); + + UtilInv.remove(player, Material.COAL, (byte)0, 1); + UtilInv.Update(player); + + UtilFirework.playFirework(player.getLocation(), Type.BALL_LARGE, Color.AQUA, false, false); + + for (Entity ent : UtilEnt.getInRadius(player.getLocation(), 6).keySet()) + { + if (ent instanceof Player || !(ent instanceof LivingEntity)) + continue; + + ent.playEffect(EntityEffect.HURT); + UtilAction.velocity(ent, UtilAlg.getTrajectory2d(player, ent), 1, true, 0, 0.8, 2, true); + + _launched.put(ent, System.currentTimeMillis()); + + Bukkit.getPluginManager().callEvent(new EntityLaunchEvent(ent)); + } + + Bukkit.getPluginManager().callEvent(new AbilityUseEvent(player)); + } + + @EventHandler + public void onUpdate(UpdateEvent event) + { + if (!Manager.GetGame().IsLive()) + return; + + HashMap copy = new HashMap(); + copy.putAll(_launched); + + for (Entity en : copy.keySet()) + { + if (en == null || !en.isValid()) + { + remove(en); + continue; + } + + if (en.isOnGround() && UtilTime.elapsed(copy.get(en), 500)) + { + remove(en); + continue; + } + + //If there are blocks surrounding the block it's on top of (if it's on the side of a block) + if (!UtilBlock.getInBoundingBox(en.getLocation().clone().add(1, -1, 1), en.getLocation().clone().subtract(1, 1, 1), true).isEmpty() && UtilTime.elapsed(copy.get(en), 500)) + { + remove(en); + continue; + } + + if (UtilTime.elapsed(copy.get(en), 1500)) + { + remove(en); + continue; + } + } + } + + private void remove(Entity en) + { + _launched.remove(en); + en.remove(); + + UtilFirework.playFirework(en.getLocation(), Type.BALL, Color.BLACK, false, false); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/mazes/Maze1.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/mazes/Maze1.java new file mode 100644 index 000000000..fd12d09ad --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/mazes/Maze1.java @@ -0,0 +1,112 @@ +package nautilus.game.arcade.game.games.monstermaze.mazes; + +/** + * Created by William (WilliamTiger). + * 21/10/15 + */ +public class Maze1 +{ + + public static final int[][] MAZE = { + {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0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0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, + {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, + }; + +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/mazes/Maze2.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/mazes/Maze2.java new file mode 100644 index 000000000..251bb1689 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/mazes/Maze2.java @@ -0,0 +1,112 @@ +package nautilus.game.arcade.game.games.monstermaze.mazes; + +/** + * Created by William (WilliamTiger). + * 21/10/15 + */ +public class Maze2 +{ + + public static final int[][] MAZE = { + {0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0}, + {0,0,0,2,0,0,1,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,1,0,0,2,0,0,0}, + {0,0,0,1,0,0,1,0,0,1,0,0,2,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0,0,0,0,0,0}, + }; + +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/mazes/Maze3.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/mazes/Maze3.java new file mode 100644 index 000000000..c74b80dc7 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/mazes/Maze3.java @@ -0,0 +1,112 @@ +package nautilus.game.arcade.game.games.monstermaze.mazes; + +/** + * Created by William (WilliamTiger). + * 21/10/15 + */ +public class Maze3 +{ + + public static final int[][] MAZE = { + {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, + {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, + {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,1,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, + {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,2,0,1,0,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0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,2,0,1,0,2,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, + {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,1,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, + {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, + {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, + }; + +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/trackers/AbilityUseTracker.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/trackers/AbilityUseTracker.java new file mode 100644 index 000000000..5291aa42e --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/trackers/AbilityUseTracker.java @@ -0,0 +1,85 @@ +package nautilus.game.arcade.game.games.monstermaze.trackers; + +import java.util.ArrayList; +import java.util.List; + +import nautilus.game.arcade.events.GameStateChangeEvent; +import nautilus.game.arcade.game.Game.GameState; +import nautilus.game.arcade.game.games.monstermaze.MonsterMaze; +import nautilus.game.arcade.game.games.monstermaze.events.AbilityUseEvent; +import nautilus.game.arcade.stats.StatTracker; + +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; + +public class AbilityUseTracker extends StatTracker +{ + /** + * @author Mysticate + */ + + private List _out = new ArrayList(); + + public AbilityUseTracker(MonsterMaze game) + { + super(game); + } + + @EventHandler + public void onAbilityUse(AbilityUseEvent event) + { + if (!getGame().IsLive()) + return; + + if (isOut(event.getPlayer())) + return; + + setOut(event.getPlayer()); + } + + @EventHandler(priority = EventPriority.MONITOR) + public void onGameEnd(GameStateChangeEvent event) + { + if (event.GetState() != GameState.End) + return; + + if (getGame().getWinners() == null) + return; + + for (Player player : getGame().getWinners()) + { + if (isOut(player)) + continue; + + addStat(player); + } + + _out.clear(); + } + + private boolean isOut(Player player) + { + for (String out : _out) + { + if (out.equalsIgnoreCase(player.getName())) + { + return true; + } + } + return false; + } + + private void setOut(Player player) + { + if (isOut(player)) + return; + + _out.add(player.getName()); + } + + private void addStat(Player player) + { + addStat(player, "Hard Mode", 1, true, false); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/trackers/FirstToSafepadTracker.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/trackers/FirstToSafepadTracker.java new file mode 100644 index 000000000..694c7e873 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/trackers/FirstToSafepadTracker.java @@ -0,0 +1,34 @@ +package nautilus.game.arcade.game.games.monstermaze.trackers; + +import nautilus.game.arcade.game.games.monstermaze.MonsterMaze; +import nautilus.game.arcade.game.games.monstermaze.events.FirstToSafepadEvent; +import nautilus.game.arcade.stats.StatTracker; + +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; + +public class FirstToSafepadTracker extends StatTracker +{ + /** + * @author Mysticate + */ + + public FirstToSafepadTracker(MonsterMaze game) + { + super(game); + } + + @EventHandler + public void onSafepadFirst(FirstToSafepadEvent event) + { + if (!getGame().IsLive()) + return; + + addStat(event.getPlayer()); + } + + private void addStat(Player player) + { + addStat(player, "Speed", 1, false, false); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/trackers/PilotTracker.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/trackers/PilotTracker.java new file mode 100644 index 000000000..1e665963a --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/trackers/PilotTracker.java @@ -0,0 +1,113 @@ +package nautilus.game.arcade.game.games.monstermaze.trackers; + +import java.util.HashMap; + +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilTime; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import nautilus.game.arcade.events.GameStateChangeEvent; +import nautilus.game.arcade.game.Game.GameState; +import nautilus.game.arcade.game.games.monstermaze.MonsterMaze; +import nautilus.game.arcade.game.games.monstermaze.events.MonsterBumpPlayerEvent; +import nautilus.game.arcade.stats.StatTracker; + +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; + +public class PilotTracker extends StatTracker +{ + /** + * @author Mysticate + */ + + private HashMap _launched = new HashMap(); + + public PilotTracker(MonsterMaze game) + { + super(game); + } + + @EventHandler + public void onSnowmanHit(MonsterBumpPlayerEvent event) + { + if (!getGame().IsLive()) + return; + + if (isLaunched(event.getPlayer())) + return; + + setLaunched(event.getPlayer()); + } + + @EventHandler + public void onUpdate(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + if (!getGame().IsLive()) + return; + + HashMap copy = new HashMap(); + copy.putAll(_launched); + + for (Player player : copy.keySet()) + { + if (!isLaunched(player)) + continue; + + //Make sure the player isn't still on the ground after getting hit. + if (!UtilTime.elapsed(_launched.get(player), 250)) + continue; + + if (player == null || !player.isOnline() || !getGame().IsAlive(player)) + { + _launched.remove(player); + continue; + } + + if (UtilEnt.isGrounded(player)) + { + _launched.remove(player); + + if (getGame().getMaze().isOnPad(player, false)) + { + addStat(player); + } + + continue; + } + + if (UtilTime.elapsed(_launched.get(player), 2000)) + { + _launched.remove(player); + continue; + } + } + } + + @EventHandler + public void clearLaunched(GameStateChangeEvent event) + { + if (event.GetState() != GameState.End) + return; + + _launched.clear(); + } + + private boolean isLaunched(Player player) + { + return _launched.containsKey(player); + } + + private void setLaunched(Player player) + { + _launched.put(player, System.currentTimeMillis()); + } + + private void addStat(Player player) + { + addStat(player, "Pilot", 1, true, false); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/trackers/SnowmanHitTracker.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/trackers/SnowmanHitTracker.java new file mode 100644 index 000000000..81d37e68d --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/trackers/SnowmanHitTracker.java @@ -0,0 +1,85 @@ +package nautilus.game.arcade.game.games.monstermaze.trackers; + +import java.util.ArrayList; +import java.util.List; + +import nautilus.game.arcade.events.GameStateChangeEvent; +import nautilus.game.arcade.game.Game.GameState; +import nautilus.game.arcade.game.games.monstermaze.MonsterMaze; +import nautilus.game.arcade.game.games.monstermaze.events.MonsterBumpPlayerEvent; +import nautilus.game.arcade.stats.StatTracker; + +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; + +public class SnowmanHitTracker extends StatTracker +{ + /** + * @author Mysticate + */ + + private List _out = new ArrayList(); + + public SnowmanHitTracker(MonsterMaze game) + { + super(game); + } + + @EventHandler + public void onSnowmanHit(MonsterBumpPlayerEvent event) + { + if (!getGame().IsLive()) + return; + + if (isOut(event.getPlayer())) + return; + + setOut(event.getPlayer()); + } + + @EventHandler(priority = EventPriority.MONITOR) + public void onGameEnd(GameStateChangeEvent event) + { + if (event.GetState() != GameState.End) + return; + + if (getGame().getWinners() == null) + return; + + for (Player player : getGame().getWinners()) + { + if (isOut(player)) + continue; + + addStat(player); + } + + _out.clear(); + } + + private boolean isOut(Player player) + { + for (String out : _out) + { + if (out.equalsIgnoreCase(player.getName())) + { + return true; + } + } + return false; + } + + private void setOut(Player player) + { + if (isOut(player)) + return; + + _out.add(player.getName()); + } + + private void addStat(Player player) + { + addStat(player, "Ninja", 1, true, false); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/trackers/SurvivePast10thSafepadTracker.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/trackers/SurvivePast10thSafepadTracker.java new file mode 100644 index 000000000..e2aabc5fd --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/trackers/SurvivePast10thSafepadTracker.java @@ -0,0 +1,40 @@ +package nautilus.game.arcade.game.games.monstermaze.trackers; + +import nautilus.game.arcade.game.games.monstermaze.MonsterMaze; +import nautilus.game.arcade.game.games.monstermaze.events.SafepadBuildEvent; +import nautilus.game.arcade.stats.StatTracker; + +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; + +public class SurvivePast10thSafepadTracker extends StatTracker +{ + /** + * @author Mysticate + */ + + public SurvivePast10thSafepadTracker(MonsterMaze game) + { + super(game); + } + + @EventHandler + public void onSafepadBuild(SafepadBuildEvent event) + { + if (!getGame().IsLive()) + return; + + if (getGame().getMaze().getCurrentSafePadCount() > 10) + { + for (Player player : getGame().GetPlayers(true)) + { + addStat(player); + } + } + } + + private void addStat(Player player) + { + addStat(player, "ToughCompetition", 1, true, false); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/Paintball.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/Paintball.java index 54d387758..19ead99b7 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/Paintball.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/Paintball.java @@ -274,6 +274,9 @@ public class Paintball extends TeamGame PlayerOut(damagee); AddGems(damager, 2, "Kills", true, true); + + AddStat(damager, "Kills", 1, false, false); + AddStat(damagee, "Deaths", 1, false, false); } //Hit Sound diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skywars/Skywars.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skywars/Skywars.java index 6feb9d7d7..38552e39b 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skywars/Skywars.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skywars/Skywars.java @@ -436,7 +436,7 @@ public abstract class Skywars extends Game _worldBlocks.remove(bestBlock); if (bestBlock.getType() != Material.AIR) { - if (Math.random() > 0.75D) + if (Math.random() > 0.95D) { bestBlock.getWorld().spawnFallingBlock( bestBlock.getLocation().add(0.5D, 0.5D, 0.5D), @@ -1256,7 +1256,7 @@ public abstract class Skywars extends Game Player shooter = (Player)event.getEntity().getShooter(); - if (GetKit(shooter) instanceof KitDestructor) + if (event.getEntity().hasMetadata("Destructor")) return; event.getEntity().setPassenger(shooter); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitZombie.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitZombie.java index 00e5e30fb..08ea676e6 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitZombie.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitZombie.java @@ -58,7 +58,7 @@ public class KitZombie extends SmashKit UtilInv.Clear(player); player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_AXE, (byte)0, 1, - C.cYellow + C.Bold + "Left-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Bile Blaster", + C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Bile Blaster", new String[] { ChatColor.RESET + "Spew up your dinner from last night.", diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/turfforts/TurfForts.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/turfforts/TurfForts.java index 3e4b5c774..e1c15992d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/turfforts/TurfForts.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/turfforts/TurfForts.java @@ -287,10 +287,20 @@ public class TurfForts extends TeamGame { if (event.isCancelled()) // this statement might save just a small amount of time return; - - if(getArcadeManager().isSpectator(event.getPlayer())) event.setCancelled(true); + + if (!IsAlive(event.getPlayer())) + { + event.setCancelled(true); + return; + } + + if (UtilPlayer.isSpectator(event.getPlayer())) + { + event.setCancelled(true); + return; + } } - + @EventHandler public void BlockPlace(BlockPlaceEvent event) { @@ -304,7 +314,18 @@ public class TurfForts extends TeamGame return; } + if (!IsAlive(event.getPlayer())) + { + event.setCancelled(true); + return; + } + if (UtilPlayer.isSpectator(event.getPlayer())) + { + event.setCancelled(true); + return; + } + //On Own Block block = event.getBlock().getRelative(BlockFace.DOWN); while (block.getTypeId() == 0) 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 9175d6350..84e3459ae 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 @@ -4,6 +4,37 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.NautHashMap; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilEvent; +import mineplex.core.common.util.UtilInv; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilTextMiddle; +import mineplex.core.common.util.UtilTime; +import mineplex.core.common.util.UtilWorld; +import mineplex.core.itemstack.ItemStackFactory; +import mineplex.core.packethandler.PacketPlayOutWorldBorder; +import mineplex.core.recharge.Recharge; +import mineplex.core.timing.TimingManager; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.minecraft.game.core.combat.CombatLog; +import mineplex.minecraft.game.core.combat.event.CombatDeathEvent; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import mineplex.serverdata.Utility; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.GameType; +import nautilus.game.arcade.events.GameStateChangeEvent; +import nautilus.game.arcade.game.GameTeam; +import nautilus.game.arcade.game.TeamGame; +import nautilus.game.arcade.kit.Kit; + import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.Chunk; @@ -26,12 +57,12 @@ import org.bukkit.event.EventPriority; import org.bukkit.event.block.BlockBreakEvent; import org.bukkit.event.block.BlockPlaceEvent; import org.bukkit.event.entity.EntityDamageEvent; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.entity.EntityDeathEvent; import org.bukkit.event.entity.EntityExplodeEvent; import org.bukkit.event.entity.EntityRegainHealthEvent; -import org.bukkit.event.entity.PlayerDeathEvent; -import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason; +import org.bukkit.event.entity.PlayerDeathEvent; import org.bukkit.event.inventory.PrepareItemCraftEvent; import org.bukkit.event.player.PlayerChangedWorldEvent; import org.bukkit.event.player.PlayerCommandPreprocessEvent; @@ -55,37 +86,6 @@ import org.bukkit.potion.PotionEffectType; import org.bukkit.scoreboard.DisplaySlot; import org.bukkit.scoreboard.Objective; -import mineplex.core.common.util.C; -import mineplex.core.common.util.F; -import mineplex.core.common.util.NautHashMap; -import mineplex.core.common.util.UtilAction; -import mineplex.core.common.util.UtilAlg; -import mineplex.core.common.util.UtilBlock; -import mineplex.core.common.util.UtilEvent; -import mineplex.core.common.util.UtilInv; -import mineplex.core.common.util.UtilMath; -import mineplex.core.common.util.UtilWorld; -import mineplex.core.common.util.UtilPlayer; -import mineplex.core.common.util.UtilServer; -import mineplex.core.common.util.UtilTime; -import mineplex.core.common.util.UtilTextMiddle; -import mineplex.core.itemstack.ItemStackFactory; -import mineplex.core.packethandler.PacketPlayOutWorldBorder; -import mineplex.core.recharge.Recharge; -import mineplex.core.timing.TimingManager; -import mineplex.core.updater.UpdateType; -import mineplex.core.updater.event.UpdateEvent; -import mineplex.minecraft.game.core.combat.CombatLog; -import mineplex.minecraft.game.core.combat.event.CombatDeathEvent; -import mineplex.minecraft.game.core.damage.CustomDamageEvent; -import mineplex.serverdata.Utility; -import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.GameType; -import nautilus.game.arcade.events.GameStateChangeEvent; -import nautilus.game.arcade.game.GameTeam; -import nautilus.game.arcade.game.TeamGame; -import nautilus.game.arcade.kit.Kit; - public class UHC extends TeamGame { private NautHashMap _teamReqs = new NautHashMap(); @@ -344,6 +344,10 @@ public class UHC extends TeamGame player.getWorld().playSound(loc, Sound.NOTE_BASS, 2f, 1f); player.getWorld().playSound(loc, Sound.NOTE_BASS, 2f, 1f); } + else + { + player.teleport(GetSpectatorLocation()); + } } } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wither/WitherGame.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wither/WitherGame.java index 925d0d6fb..47f61d98f 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wither/WitherGame.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wither/WitherGame.java @@ -143,6 +143,9 @@ public class WitherGame extends TeamGame implements IBlockRestorer this.TeamArmor = true; this.TeamArmorHotbar = false; + + this.InventoryClick = false; + this.InventoryOpenBlock = false; _help = new String[] { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/spells/SpellGust.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/spells/SpellGust.java index 730274a97..1aad6027d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/spells/SpellGust.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/spells/SpellGust.java @@ -1,10 +1,12 @@ package nautilus.game.arcade.game.games.wizards.spells; +import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; import java.util.Map.Entry; import mineplex.core.common.util.UtilPlayer; +import mineplex.minecraft.game.core.damage.DamageChange; import nautilus.game.arcade.game.games.wizards.Spell; import nautilus.game.arcade.game.games.wizards.spellinterfaces.SpellClick; @@ -57,6 +59,8 @@ public class SpellGust extends Spell implements SpellClick Wizards.getArcadeManager().GetCondition().Factory().Falling("Gust", target, player, 40, false, true); + Wizards.Manager.GetDamage().GetCombatManager().Get(target).Attacked(player.getName(), 0, player, "Gust", new ArrayList()); + target.setVelocity(vec); target.getWorld().playSound(target.getLocation(), Sound.BAT_TAKEOFF, 1, 0.7F); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkDestructor.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkDestructor.java index 96311faab..26c589be3 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkDestructor.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkDestructor.java @@ -1,26 +1,44 @@ package nautilus.game.arcade.kit.perks; -import mineplex.core.common.util.*; +import java.util.HashMap; +import java.util.HashSet; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilEvent; +import mineplex.core.common.util.UtilEvent.ActionType; +import mineplex.core.common.util.UtilInv; +import mineplex.core.common.util.UtilParticle; import mineplex.core.common.util.UtilParticle.ParticleType; import mineplex.core.common.util.UtilParticle.ViewDist; -import mineplex.core.itemstack.*; -import mineplex.core.recharge.*; -import mineplex.core.updater.*; -import mineplex.core.updater.event.*; -import mineplex.minecraft.game.core.damage.CustomDamageEvent; -import nautilus.game.arcade.kit.*; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilTime; +import mineplex.core.itemstack.ItemStackFactory; +import mineplex.core.recharge.Recharge; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import nautilus.game.arcade.kit.Perk; import nautilus.game.arcade.kit.perks.event.PerkDestructorBlockEvent; -import org.bukkit.*; -import org.bukkit.block.*; -import org.bukkit.entity.*; -import org.bukkit.event.*; -import org.bukkit.event.entity.*; -import org.bukkit.event.inventory.*; -import org.bukkit.event.player.*; -import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause; - -import java.util.*; +import org.bukkit.Effect; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.block.Block; +import org.bukkit.block.BlockFace; +import org.bukkit.entity.EnderPearl; +import org.bukkit.entity.Player; +import org.bukkit.entity.Projectile; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.entity.PlayerDeathEvent; +import org.bukkit.event.entity.ProjectileHitEvent; +import org.bukkit.event.entity.ProjectileLaunchEvent; +import org.bukkit.event.inventory.InventoryClickEvent; +import org.bukkit.event.player.PlayerDropItemEvent; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.metadata.FixedMetadataValue; public class PerkDestructor extends Perk { @@ -31,6 +49,7 @@ public class PerkDestructor extends Perk private long _fallTime; + private HashSet _preparing = new HashSet(); private HashMap _blocks = new HashMap(); public PerkDestructor(int spawnRate, int max, long fallTime, boolean enabled) @@ -74,7 +93,7 @@ public class PerkDestructor extends Perk if (!Recharge.Instance.use(cur, GetName(), _spawnRate * 1000, false, false)) continue; - if (UtilInv.contains(cur, Material.ENDER_PEARL, (byte) 0, _max)) + if (UtilInv.contains(cur, "Seismic Charge", Material.ENDER_PEARL, (byte) 0, _max)) continue; //Add @@ -119,7 +138,25 @@ public class PerkDestructor extends Perk UtilInv.DisallowMovementOf(event, "Seismic Charge", Material.ENDER_PEARL, (byte) 0, true); } - @EventHandler + @EventHandler(priority = EventPriority.MONITOR) + public void preThrowItem(PlayerInteractEvent event) + { + if (!UtilEvent.isAction(event, ActionType.R)) + return; + + if (!Manager.GetGame().IsLive()) + return; + + if (!Manager.IsAlive(event.getPlayer())) + return; + + if (!UtilInv.IsItem(event.getItem(), "Seismic Charge", Material.ENDER_PEARL, (byte) 0)) + return; + + _preparing.add(event.getPlayer().getName()); + } + + @EventHandler(priority = EventPriority.LOW) public void throwItem(ProjectileLaunchEvent event) { if (Manager.GetGame() == null || !Manager.GetGame().IsLive()) @@ -128,47 +165,112 @@ public class PerkDestructor extends Perk if (!(event.getEntity() instanceof EnderPearl)) return; - event.getEntity().setVelocity(event.getEntity().getVelocity().multiply(0.7)); + if (!(event.getEntity().getShooter() instanceof Player)) + return; + + Player player = (Player) event.getEntity().getShooter(); + + if (!Manager.IsAlive(player)) + return; + + if (_preparing.contains(player.getName())) + { + _preparing.remove(player.getName()); + event.getEntity().setMetadata("Destructor", new FixedMetadataValue(Manager.getPlugin(), 1)); + + event.getEntity().setVelocity(event.getEntity().getVelocity().multiply(0.7)); + } } - + @EventHandler - public void collide(PlayerTeleportEvent event) + public void collide(ProjectileHitEvent event) { - if (Manager.GetGame() == null || !Manager.GetGame().IsLive()) + if (!Manager.GetGame().IsLive()) + return; + + Projectile proj = event.getEntity(); + + if (!(proj.getShooter() instanceof Player)) + return; + + Player player = (Player) proj.getShooter(); + + if (!Manager.IsAlive(player)) + return; + + if (!Kit.HasKit(player)) return; - if (event.getCause() != TeleportCause.ENDER_PEARL) + if (!proj.hasMetadata("Destructor")) return; - if (!Kit.HasKit(event.getPlayer())) - return; - - for (Block block : UtilBlock.getInRadius(event.getTo(), 4).keySet()) + for (Block block : UtilBlock.getInRadius(proj.getLocation(), 4).keySet()) { if (block.getType() == Material.AIR || block.getType() == Material.BEDROCK || block.isLiquid()) continue; //Event - PerkDestructorBlockEvent blockEvent = new PerkDestructorBlockEvent(event.getPlayer(), block); + PerkDestructorBlockEvent blockEvent = new PerkDestructorBlockEvent(player, block); UtilServer.getServer().getPluginManager().callEvent(blockEvent); if (!blockEvent.isCancelled()) { _blocks.put(block, System.currentTimeMillis()); - + block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, block.getType()); } } - - UtilParticle.PlayParticle(ParticleType.LARGE_EXPLODE, event.getTo(), 0f, 0f, 0f, 0f, 1, - ViewDist.MAX, UtilServer.getPlayers()); - - event.getTo().getWorld().playSound(event.getTo(), Sound.EXPLODE, 1f, 0.5f); - event.getTo().getWorld().playSound(event.getTo(), Sound.FIREWORK_TWINKLE, 2f, 0.5f); - - event.setCancelled(true); + + UtilParticle.PlayParticle(ParticleType.LARGE_EXPLODE, proj.getLocation(), 0f, 0f, 0f, 0f, 1, ViewDist.MAX, UtilServer.getPlayers()); + + proj.getWorld().playSound(proj.getLocation(), Sound.EXPLODE, 1f, 0.5f); + proj.getWorld().playSound(proj.getLocation(), Sound.FIREWORK_TWINKLE, 2f, 0.5f); } + +// @EventHandler +// public void collide(PlayerTeleportEvent event) +// { +// if (Manager.GetGame() == null || !Manager.GetGame().IsLive()) +// return; +// +// if (event.getCause() != TeleportCause.ENDER_PEARL) +// return; +// +// if (!Manager.IsAlive(event.getPlayer())) +// return; +// +// if (!Kit.HasKit(event.getPlayer())) +// return; +// +// +// +// for (Block block : UtilBlock.getInRadius(event.getTo(), 4).keySet()) +// { +// if (block.getType() == Material.AIR || block.getType() == Material.BEDROCK || block.isLiquid()) +// continue; +// +// //Event +// PerkDestructorBlockEvent blockEvent = new PerkDestructorBlockEvent(event.getPlayer(), block); +// UtilServer.getServer().getPluginManager().callEvent(blockEvent); +// +// if (!blockEvent.isCancelled()) +// { +// _blocks.put(block, System.currentTimeMillis()); +// +// block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, block.getType()); +// } +// } +// +// UtilParticle.PlayParticle(ParticleType.LARGE_EXPLODE, event.getTo(), 0f, 0f, 0f, 0f, 1, +// ViewDist.MAX, UtilServer.getPlayers()); +// +// event.getTo().getWorld().playSound(event.getTo(), Sound.EXPLODE, 1f, 0.5f); +// event.getTo().getWorld().playSound(event.getTo(), Sound.FIREWORK_TWINKLE, 2f, 0.5f); +// +// event.setCancelled(true); +// } + @SuppressWarnings("deprecation") @EventHandler public void fall(UpdateEvent event) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkDigger.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkDigger.java index da6f350e3..400cb8b65 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkDigger.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkDigger.java @@ -1,13 +1,10 @@ package nautilus.game.arcade.kit.perks; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; - import mineplex.core.common.util.C; -import mineplex.core.updater.event.UpdateEvent; -import mineplex.core.updater.UpdateType; import nautilus.game.arcade.kit.Perk; +import org.bukkit.entity.Player; + public class PerkDigger extends Perk { public PerkDigger() @@ -18,21 +15,14 @@ public class PerkDigger extends Perk }); } - @EventHandler - public void DigSpeed(UpdateEvent event) + @Override + public void Apply(Player player) + { + addEffects(player); + } + + private void addEffects(Player player) { - if (event.getType() != UpdateType.FAST) - return; - - if (Manager.GetGame() == null) - return; - - for (Player player : Manager.GetGame().GetPlayers(true)) - { - if (!Kit.HasKit(player)) - continue; - - Manager.GetCondition().Factory().DigFast(GetName(), player, player, 2.9, 1, false, false, true); - } + Manager.GetCondition().Factory().DigFast(GetName(), player, null, Integer.MAX_VALUE, 1, false, false, true); } } 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 9db75a2b2..8a10e6100 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 @@ -1,18 +1,6 @@ package nautilus.game.arcade.kit.perks; import java.util.HashMap; -import java.util.Iterator; - -import org.bukkit.GameMode; -import org.bukkit.Sound; -import org.bukkit.entity.Entity; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.block.Action; -import org.bukkit.event.entity.EntityDamageEvent.DamageCause; -import org.bukkit.event.player.PlayerInteractEvent; -import org.bukkit.util.Vector; import mineplex.core.common.util.C; import mineplex.core.common.util.F; @@ -22,17 +10,27 @@ import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilParticle.ParticleType; +import mineplex.core.common.util.UtilParticle.ViewDist; import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilTime; -import mineplex.core.common.util.UtilParticle.ParticleType; -import mineplex.core.common.util.UtilParticle.ViewDist; import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent; import nautilus.game.arcade.kit.Perk; +import org.bukkit.Sound; +import org.bukkit.entity.Entity; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.block.Action; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.util.Vector; + public class PerkFlameSlam extends Perk { private HashMap _live = new HashMap(); @@ -93,10 +91,17 @@ public class PerkFlameSlam extends Perk return; //Collide - Iterator liveIterator = _live.keySet().iterator(); - while (liveIterator.hasNext()) + HashMap copy = new HashMap(); + copy.putAll(_live); + + for (Player player : copy.keySet()) { - Player player = liveIterator.next(); + if (!Manager.IsAlive(player) || UtilPlayer.isSpectator(player)) + { + _live.remove(player); + continue; + } + Vector vel = player.getLocation().getDirection(); vel.setY(0); UtilAlg.Normalize(vel); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkFletcher.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkFletcher.java index ac6763c56..399fc38e7 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkFletcher.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkFletcher.java @@ -3,7 +3,18 @@ package nautilus.game.arcade.kit.perks; import java.util.HashSet; import java.util.Iterator; -import org.bukkit.GameMode; +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilGear; +import mineplex.core.common.util.UtilInv; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.itemstack.ItemStackFactory; +import mineplex.core.recharge.Recharge; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import nautilus.game.arcade.kit.Perk; + import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.craftbukkit.v1_7_R4.entity.CraftArrow; @@ -18,18 +29,6 @@ import org.bukkit.event.player.PlayerDropItemEvent; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.ItemMeta; -import mineplex.core.common.util.C; -import mineplex.core.common.util.F; -import mineplex.core.common.util.UtilGear; -import mineplex.core.common.util.UtilInv; -import mineplex.core.common.util.UtilPlayer; -import mineplex.core.common.util.UtilServer; -import mineplex.core.itemstack.ItemStackFactory; -import mineplex.core.recharge.Recharge; -import mineplex.core.updater.event.UpdateEvent; -import mineplex.core.updater.UpdateType; -import nautilus.game.arcade.kit.Perk; - public class PerkFletcher extends Perk { private HashSet _fletchArrows = new HashSet(); @@ -37,8 +36,14 @@ public class PerkFletcher extends Perk private int _max = 0; private int _time = 0; private boolean _remove; + private int _slot; public PerkFletcher(int time, int max, boolean remove) + { + this(time, max, remove, -1); + } + + public PerkFletcher(int time, int max, boolean remove, int slot) { super("Fletcher", new String[] { @@ -48,6 +53,7 @@ public class PerkFletcher extends Perk _time = time; _max = max; _remove = remove; + _slot = slot; } public boolean isFletchedArrow(ItemStack stack) @@ -126,7 +132,14 @@ public class PerkFletcher extends Perk continue; //Add - cur.getInventory().addItem(ItemStackFactory.Instance.CreateStack(262, (byte)0, 1, F.item("Fletched Arrow"))); + if (_slot == -1) + { + cur.getInventory().addItem(ItemStackFactory.Instance.CreateStack(262, (byte)0, 1, F.item("Fletched Arrow"))); + } + else + { + cur.getInventory().setItem(_slot, ItemStackFactory.Instance.CreateStack(262, (byte)0, 1, F.item("Fletched Arrow"))); + } cur.playSound(cur.getLocation(), Sound.ITEM_PICKUP, 2f, 1f); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkHammerThrow.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkHammerThrow.java index 17d725b8b..6abfaf5d1 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkHammerThrow.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkHammerThrow.java @@ -3,6 +3,24 @@ package nautilus.game.arcade.kit.perks; import java.util.HashMap; import java.util.Iterator; +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilEvent; +import mineplex.core.common.util.UtilEvent.ActionType; +import mineplex.core.common.util.UtilInv; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.itemstack.ItemStackFactory; +import mineplex.core.projectile.IThrown; +import mineplex.core.projectile.ProjectileUser; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.kit.Perk; + import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.block.Block; @@ -12,28 +30,12 @@ import org.bukkit.entity.Item; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; -import org.bukkit.event.block.Action; import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerPickupItemEvent; import org.bukkit.inventory.ItemStack; import org.bukkit.util.Vector; -import mineplex.core.common.util.C; -import mineplex.core.common.util.F; -import mineplex.core.common.util.UtilAction; -import mineplex.core.common.util.UtilBlock; -import mineplex.core.common.util.UtilEnt; -import mineplex.core.common.util.UtilMath; -import mineplex.core.common.util.UtilPlayer; -import mineplex.core.itemstack.ItemStackFactory; -import mineplex.core.projectile.IThrown; -import mineplex.core.projectile.ProjectileUser; -import mineplex.core.updater.UpdateType; -import mineplex.core.updater.event.UpdateEvent; -import mineplex.minecraft.game.core.damage.CustomDamageEvent; -import nautilus.game.arcade.kit.Perk; - public class PerkHammerThrow extends Perk implements IThrown { private HashMap _thrown = new HashMap(); @@ -51,19 +53,16 @@ public class PerkHammerThrow extends Perk implements IThrown { if (event.isCancelled()) return; - - if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK) + + if (!UtilEvent.isAction(event, ActionType.R)) return; if (UtilBlock.usable(event.getClickedBlock())) return; - if (event.getPlayer().getItemInHand() == null) + if (!UtilInv.IsItem(event.getItem(), Material.DIAMOND_AXE, (byte) -1)) return; - - if (!event.getPlayer().getItemInHand().getType().toString().contains("DIAMOND_AXE")) - return; - + Player player = event.getPlayer(); if (!Kit.HasKit(player)) @@ -96,7 +95,7 @@ public class PerkHammerThrow extends Perk implements IThrown Player player = _thrown.remove(event.getItem()); - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.DIAMOND_AXE, (byte)0, 1, "Thor Hammer")); + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.DIAMOND_AXE, (byte)0, 1, F.item("Thor Hammer"))); } @EventHandler @@ -111,11 +110,19 @@ public class PerkHammerThrow extends Perk implements IThrown { Item item = itemIterator.next(); - if (item.getTicksLived() > 200) + if (item == null || item.getTicksLived() > 200 || !item.isValid() || item.isDead()) { - _thrown.get(item).getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.DIAMOND_AXE, (byte)0, 1, "Thor Hammer")); - item.remove(); + if (item != null) + item.remove(); + + Player player = _thrown.get(item); + itemIterator.remove(); + + if (!Manager.IsAlive(player)) + continue; + + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.DIAMOND_AXE, (byte)0, 1, F.item("Thor Hammer"))); } } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkHorsePet.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkHorsePet.java index e6717a68f..19133d9b3 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkHorsePet.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkHorsePet.java @@ -3,6 +3,7 @@ package nautilus.game.arcade.kit.perks; import java.util.HashMap; import java.util.Iterator; +import org.bukkit.Bukkit; import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.entity.Entity; @@ -39,6 +40,8 @@ public class PerkHorsePet extends Perk { C.cGray + "You have a loyal horse companion.", }); + + //Bukkit.getPluginManager().registerEvents(this, Manager.getPlugin()); } @Override @@ -81,6 +84,9 @@ public class PerkHorsePet extends Perk if (event.getType() != UpdateType.SEC) return; + if (!Manager.GetGame().IsLive()) + return; + //Respawn Iterator respawnIterator = _deathTime.keySet().iterator(); while (respawnIterator.hasNext()) @@ -142,6 +148,9 @@ public class PerkHorsePet extends Perk @EventHandler public void heal(UpdateEvent event) { + if (!Manager.GetGame().IsLive()) + return; + if (event.getType() != UpdateType.SLOW) return; @@ -155,6 +164,9 @@ public class PerkHorsePet extends Perk @EventHandler public void death(PlayerDeathEvent event) { + if (!Manager.GetGame().IsLive()) + return; + Horse horse = _horseMap.remove(event.getEntity()); if (horse == null) @@ -166,6 +178,9 @@ public class PerkHorsePet extends Perk @EventHandler public void damageRider(CustomDamageEvent event) { + if (!Manager.GetGame().IsLive()) + return; + if (!(event.GetDamageeEntity() instanceof Horse)) return; @@ -196,6 +211,12 @@ public class PerkHorsePet extends Perk if (!_horseMap.containsValue(event.getRightClicked())) return; + + if (!Manager.GetGame().IsLive()) + { + event.setCancelled(true); + return; + } Player player = event.getPlayer(); Horse horse = (Horse)event.getRightClicked(); @@ -204,6 +225,7 @@ public class PerkHorsePet extends Perk { UtilPlayer.message(player, F.main("Mount", "This is not your Horse!")); event.setCancelled(true); + return; } } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkHyper.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkHyper.java new file mode 100644 index 000000000..879d5612d --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkHyper.java @@ -0,0 +1,53 @@ +package nautilus.game.arcade.kit.perks; + +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.player.PlayerInteractEvent; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilEvent; +import mineplex.core.common.util.UtilEvent.ActionType; +import mineplex.core.recharge.Recharge; +import mineplex.core.common.util.UtilInv; +import nautilus.game.arcade.kit.Perk; + +public class PerkHyper extends Perk +{ + public PerkHyper() + { + super("Hyper", new String[] + { + C.cYellow + "Right-click" + C.cGray + " with Sugar to " + C.cGreen + "GO HYPER" + }); + } + + @EventHandler + public void Interact(PlayerInteractEvent event) + { + if(!UtilEvent.isAction(event, ActionType.R)) return; + + if (event.getPlayer().getItemInHand() == null) + return; + + if (event.getPlayer().getItemInHand().getType() != Material.SUGAR) + return; + + Player player = event.getPlayer(); + + if (!Kit.HasKit(player)) + return; + + if (!Recharge.Instance.usable(player, "Hyper")) + return; + + Recharge.Instance.useForce(player, "Hyper", 3000); + + event.setCancelled(true); + + UtilInv.remove(player, Material.SUGAR, (byte)0, 1); + UtilInv.Update(player); + + Manager.GetCondition().Factory().Speed(GetName(), player, player, 4, 0, false, false, true); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameFlagManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameFlagManager.java index 34c55e670..d4fea8c1b 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameFlagManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameFlagManager.java @@ -1,5 +1,7 @@ package nautilus.game.arcade.managers; +import java.util.HashMap; + import mineplex.core.antihack.AntiHack; import mineplex.core.common.Rank; import mineplex.core.common.util.C; @@ -12,6 +14,7 @@ import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilTextMiddle; +import mineplex.core.common.util.UtilTime; import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.recharge.Recharge; import mineplex.core.teleport.event.MineplexTeleportEvent; @@ -732,6 +735,7 @@ public class GameFlagManager implements Listener player.setAllowFlight(true); player.setFlying(true); ((CraftPlayer)player).getHandle().spectating = true; + ((CraftPlayer) player).getHandle().ghost = true; ((CraftPlayer)player).getHandle().k = false; for (int i=0 ; i<9 ; i++) @@ -849,11 +853,16 @@ public class GameFlagManager implements Listener if (game.HungerSet != -1) for (Player player : game.GetPlayers(true)) + { player.setFoodLevel(game.HungerSet); + player.setSaturation(1F); + } if (game.HealthSet != -1) for (Player player : game.GetPlayers(true)) + { player.setHealth(game.HealthSet); + } } @EventHandler(priority = EventPriority.LOWEST) @@ -1188,6 +1197,8 @@ public class GameFlagManager implements Listener } } + private HashMap _versionKickCleanup = new HashMap(); + @EventHandler public void versionJoinCheck(PlayerJoinEvent event) { @@ -1215,6 +1226,51 @@ public class GameFlagManager implements Listener player.playSound(player.getLocation(), Sound.ENDERDRAGON_GROWL, 10f, 1f); Manager.GetPortal().sendPlayerToServer(player, "Lobby"); + + if (!_versionKickCleanup.containsKey(player)) + _versionKickCleanup.put(player, System.currentTimeMillis()); + } + + @EventHandler + public void onVersionCleanup(UpdateEvent event) + { + if (event.getType() != UpdateType.FASTER) + return; + + if (Manager.GetGame() == null || !Manager.GetGame().VersionRequire1_8) + { + if (!_versionKickCleanup.isEmpty()) + _versionKickCleanup.clear(); + + return; + } + + HashMap copy = new HashMap(); + copy.putAll(_versionKickCleanup); + + for (Player player : copy.keySet()) + { + if (UtilPlayer.is1_8(player)) + { + _versionKickCleanup.remove(player); + continue; + } + + if (!player.isOnline()) + { + _versionKickCleanup.remove(player); + continue; + } + + //Force kick the player after 10 seconds of not being sent to lobby. + if (UtilTime.elapsed(copy.get(player), 10000)) + { + _versionKickCleanup.remove(player); + + player.kickPlayer(C.cGold + C.Bold + Manager.GetGame().GetType().GetName() + " requires you to be using Minecraft 1.8!"); + continue; + } + } } @EventHandler diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameGemManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameGemManager.java index eb0edb352..1c5d2233f 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameGemManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameGemManager.java @@ -195,10 +195,13 @@ public class GameGemManager implements Listener double hoursOnline = timeOnline/3600000d; - if (hoursOnline > 5) - hoursOnline = 5; - - total += (int)(earned * (hoursOnline * 0.2)); + if (hoursOnline < 24) + { + if (hoursOnline > 5) + hoursOnline = 5; + + total += (int)(earned * (hoursOnline * 0.2)); + } } if (DoubleGem && game.GemDoubleEnabled) @@ -313,17 +316,20 @@ public class GameGemManager implements Listener double hoursOnline = timeOnline/3600000d; - if (hoursOnline > 5) - hoursOnline = 5; - - int extraGems = (int)(earnedGems * (hoursOnline * 0.2)); - - if (extraGems > 0) + if (hoursOnline < 24) { - UtilPlayer.message(player, F.elem(C.cGreen + "+" + extraGems + " Gems") + " for " + - F.elem("Online for " + UtilTime.MakeStr(timeOnline) + C.cGreen + " +" + (int)(hoursOnline * 20) + "%")); - - totalGems += extraGems; + if (hoursOnline > 5) + hoursOnline = 5; + + int extraGems = (int)(earnedGems * (hoursOnline * 0.2)); + + if (extraGems > 0) + { + UtilPlayer.message(player, F.elem(C.cGreen + "+" + extraGems + " Gems") + " for " + + F.elem("Online for " + UtilTime.MakeStr(timeOnline) + C.cGreen + " +" + (int)(hoursOnline * 20) + "%")); + + totalGems += extraGems; + } } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameHostManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameHostManager.java index 3b79045b8..388cd99b5 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameHostManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameHostManager.java @@ -94,6 +94,8 @@ public class GameHostManager implements Listener ultraGames.add(GameType.TurfWars); ultraGames.add(GameType.Spleef); ultraGames.add(GameType.Lobbers); + ultraGames.add(GameType.Evolution); + ultraGames.add(GameType.MonsterMaze); //Hero Games heroGames.add(GameType.ChampionsDominate); @@ -121,7 +123,6 @@ public class GameHostManager implements Listener legendGames.add(GameType.SurvivalGamesTeams); */ //Rejected / Other - legendGames.add(GameType.Evolution); legendGames.add(GameType.MilkCow); legendGames.add(GameType.SearchAndDestroy); legendGames.add(GameType.ZombieSurvival); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameLobbyManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameLobbyManager.java index d144e7ba9..a18abd254 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameLobbyManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameLobbyManager.java @@ -7,6 +7,49 @@ import java.util.HashMap; import java.util.List; import java.util.Map.Entry; +import mineplex.core.account.CoreClient; +import mineplex.core.common.Rank; +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.MapUtil; +import mineplex.core.common.util.NautHashMap; +import mineplex.core.common.util.UtilBlockText; +import mineplex.core.common.util.UtilBlockText.TextAlign; +import mineplex.core.common.util.UtilParticle.ParticleType; +import mineplex.core.common.util.UtilParticle.ViewDist; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilFirework; +import mineplex.core.common.util.UtilInv; +import mineplex.core.common.util.UtilParticle; +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.cosmetic.event.ActivateGemBoosterEvent; +import mineplex.core.donation.Donor; +import mineplex.core.event.CustomTagEvent; +import mineplex.core.explosion.ExplosionEvent; +import mineplex.core.packethandler.IPacketHandler; +import mineplex.core.packethandler.PacketHandler; +import mineplex.core.packethandler.PacketInfo; +import mineplex.core.packethandler.PacketVerifier; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.GameType; +import nautilus.game.arcade.events.GameStateChangeEvent; +import nautilus.game.arcade.game.Game; +import nautilus.game.arcade.game.Game.GameState; +import nautilus.game.arcade.game.GameTeam; +import nautilus.game.arcade.game.games.uhc.UHC; +import nautilus.game.arcade.kit.Kit; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.KitSorter; +import net.minecraft.server.v1_7_R4.Packet; +import net.minecraft.server.v1_7_R4.PacketPlayOutEntityMetadata; +import net.minecraft.server.v1_7_R4.WatchableObject; + import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.Color; @@ -37,45 +80,6 @@ import org.bukkit.scoreboard.DisplaySlot; import org.bukkit.scoreboard.Objective; import org.bukkit.scoreboard.Scoreboard; -import net.minecraft.server.v1_7_R4.Packet; -import net.minecraft.server.v1_7_R4.PacketPlayOutEntityMetadata; -import net.minecraft.server.v1_7_R4.WatchableObject; -import mineplex.core.account.CoreClient; -import mineplex.core.common.Rank; -import mineplex.core.common.util.C; -import mineplex.core.common.util.F; -import mineplex.core.common.util.MapUtil; -import mineplex.core.common.util.NautHashMap; -import mineplex.core.common.util.UtilBlockText; -import mineplex.core.common.util.UtilBlockText.TextAlign; -import mineplex.core.common.util.UtilEnt; -import mineplex.core.common.util.UtilFirework; -import mineplex.core.common.util.UtilInv; -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.cosmetic.event.ActivateGemBoosterEvent; -import mineplex.core.donation.Donor; -import mineplex.core.event.CustomTagEvent; -import mineplex.core.packethandler.IPacketHandler; -import mineplex.core.packethandler.PacketHandler; -import mineplex.core.packethandler.PacketInfo; -import mineplex.core.packethandler.PacketVerifier; -import mineplex.core.updater.UpdateType; -import mineplex.core.updater.event.UpdateEvent; -import mineplex.minecraft.game.core.damage.CustomDamageEvent; -import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.GameType; -import nautilus.game.arcade.events.GameStateChangeEvent; -import nautilus.game.arcade.game.Game; -import nautilus.game.arcade.game.Game.GameState; -import nautilus.game.arcade.game.GameTeam; -import nautilus.game.arcade.game.games.uhc.UHC; -import nautilus.game.arcade.kit.Kit; -import nautilus.game.arcade.kit.KitAvailability; -import nautilus.game.arcade.kit.KitSorter; - public class GameLobbyManager implements Listener, IPacketHandler { public ArcadeManager Manager; @@ -1297,7 +1301,7 @@ public class GameLobbyManager implements Listener, IPacketHandler if (Manager.GetGame().GetState() == GameState.Live) return; - + event.blockList().clear(); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameLootManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameLootManager.java index ca8a39e3e..b630bbe6a 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameLootManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameLootManager.java @@ -50,7 +50,7 @@ public class GameLootManager implements Listener Manager.getPluginManager().registerEvents(this, Manager.getPlugin()); - _rewardManager = new RewardManager(Manager.GetClients(), Manager.GetDonation(), Manager.getInventoryManager(), petManager, Manager.GetStatsManager(), + _rewardManager = new RewardManager(Manager.GetClients(), Manager.GetServerStatusManager(), Manager.GetDonation(), Manager.getInventoryManager(), petManager, Manager.GetStatsManager(), 100, 250, 500, 1000, 1500, 2500, @@ -164,7 +164,7 @@ public class GameLootManager implements Listener Reward reward = _rewardManager.nextReward(player, null, false, RewardType.GameLoot, true); - RewardData rewardData = reward.giveReward("GameLoot", player); + RewardData rewardData = reward.giveReward(RewardType.GameLoot, player); String outputName = reward.getRarity().getColor() + rewardData.getFriendlyName(); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameSpectatorManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameSpectatorManager.java index 544951294..f82d75403 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameSpectatorManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameSpectatorManager.java @@ -1,6 +1,7 @@ package nautilus.game.arcade.managers; import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.game.Game.GameState; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; @@ -38,9 +39,17 @@ public class GameSpectatorManager implements Listener { if (Manager.GetGame() == null) return; - + Player player = event.getPlayer(); + if (Manager.GetGame().GetState() == GameState.Recruit) + { + if (Manager.getCosmeticManager().getMountManager().isMount(event.getRightClicked())) + { + return; + } + } + if (!Manager.GetGame().IsAlive(player)) event.setCancelled(true); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/HolidayManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/HolidayManager.java index a53b9aa5e..d26c941c9 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/HolidayManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/HolidayManager.java @@ -15,6 +15,8 @@ import mineplex.core.common.util.UtilParticle.ViewDist; import mineplex.core.common.util.UtilTime; import mineplex.core.common.util.UtilWorld; import mineplex.core.itemstack.ItemStackFactory; +import mineplex.core.titangiveaway.TitanGiveawayAnimation; +import mineplex.core.titangiveaway.TitanGiveawayManager; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import nautilus.game.arcade.ArcadeManager; @@ -26,6 +28,7 @@ import net.minecraft.server.v1_7_R4.TileEntity; import net.minecraft.server.v1_7_R4.TileEntityEnderChest; import org.bukkit.Effect; +import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.block.Block; @@ -38,6 +41,7 @@ import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.bukkit.event.block.BlockDamageEvent; +import org.bukkit.event.player.PlayerCommandPreprocessEvent; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerPickupItemEvent; import org.bukkit.inventory.ItemStack; @@ -78,21 +82,25 @@ public class HolidayManager implements Listener } } - private HolidayType type = HolidayType.Easter; + private HolidayType type = HolidayType.Halloween; + private String _statName = "Halloween Pumpkins 2015"; ArcadeManager Manager; + private TitanGiveawayManager _titanManager; public HashSet _active = new HashSet(); private HashSet _eggs = new HashSet(); private HashSet _coins = new HashSet(); + private HashSet _gems = new HashSet(); public long _lastSpawn = System.currentTimeMillis(); - public HolidayManager(ArcadeManager manager) + public HolidayManager(ArcadeManager manager, TitanGiveawayManager titanManager) { Manager = manager; + _titanManager = titanManager; Manager.getPluginManager().registerEvents(this, Manager.getPlugin()); } @@ -122,7 +130,7 @@ public class HolidayManager implements Listener block.getType() != Material.JACK_O_LANTERN && block.getType() != Material.CHEST) { - specialBlockBreak(block); + specialBlockBreak(null, block); blockIterator.remove(); continue; } @@ -147,7 +155,7 @@ public class HolidayManager implements Listener { UtilParticle.PlayParticle(ParticleType.HAPPY_VILLAGER, block.getLocation().add(0.5, 0.2, 0.5), 0.3f, 0.2f, 0.3f, 0, 1, ViewDist.LONG, UtilServer.getPlayers()); - + if (Math.random() > 0.90) { Item egg = block.getWorld().dropItem(block.getLocation().add(0.5, 0.8, 0.5), @@ -158,7 +166,7 @@ public class HolidayManager implements Listener block.getWorld().playSound(block.getLocation(), Sound.CHICKEN_EGG_POP, 0.25f + (float)Math.random() * 0.75f, 0.75f + (float)Math.random() * 0.5f); } - + if (Math.random() > 0.95) { sendChestPackets(block); @@ -176,6 +184,9 @@ public class HolidayManager implements Listener if (Manager.GetGame() == null) return; + if (Manager.GetGameHostManager().isPrivateServer()) + return; + Game game = Manager.GetGame(); int requirement = (int)((double)Manager.GetPlayerFull() * 0.5d); @@ -234,7 +245,7 @@ public class HolidayManager implements Listener for (Player other : UtilServer.getPlayers()) ((CraftPlayer) other).getHandle().playerConnection.sendPacket(packet); } - + private Block findSpecialBlockLocation(Game game) { Block block = null; @@ -273,50 +284,36 @@ public class HolidayManager implements Listener } return null; - } +} - @EventHandler - public void specialBlockInteract(PlayerInteractEvent event) - { - if (UtilPlayer.isSpectator(event.getPlayer())) - return; - - if (!UtilEvent.isAction(event, ActionType.R_BLOCK)) - return; - - if (event.getClickedBlock() == null) - return; - - if (event.getClickedBlock().getType() != Material.CHEST) - return; - - if (!_active.contains(event.getClickedBlock())) - return; - - event.setCancelled(true); - - specialBlockBreak(event.getClickedBlock()); - } - @EventHandler public void specialBlockDamage(BlockDamageEvent event) { if (UtilPlayer.isSpectator(event.getPlayer())) return; + if (Manager.GetGame() != null && !Manager.GetGame().IsAlive(event.getPlayer())) + return; + if (!_active.contains(event.getBlock())) return; - - specialBlockBreak(event.getBlock()); + + specialBlockBreak(event.getPlayer(), event.getBlock()); } - private void specialBlockBreak(Block block) + private void specialBlockBreak(Player player, final Block block) { block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, type.getBlockType()); block.setType(Material.AIR); + if (player != null && Manager.GetGame() != null) + { + Manager.GetGame().AddStat(player, _statName, 1, false, true); + System.out.println("Recording Pumpkin Break for " + player.getName()); + } + //Coins - for (int i=0 ; i < 4 + Math.random()*16 ; i++) + for (int i=0 ; i < 4 + Math.random()*8 ; i++) { Item coin = block.getWorld().dropItem(block.getLocation().add(0.5, 1, 0.5), ItemStackFactory.Instance.CreateStack(175, (byte)0, 1, UtilMath.r(999999) + "Coin")); @@ -333,6 +330,38 @@ public class HolidayManager implements Listener _coins.add(coin); } + //Gems + for (int i=0 ; i < 4 + Math.random()*8 ; i++) + { + Item gem = block.getWorld().dropItem(block.getLocation().add(0.5, 1, 0.5), + ItemStackFactory.Instance.CreateStack(Material.EMERALD, (byte)0, 1, UtilMath.r(999999) + "Gem")); + + Vector vel = new Vector( + (Math.random() - 0.5) * 0.5, + 0.1 + Math.random() * 0.3, + (Math.random() - 0.5) * 0.5); + + gem.setVelocity(vel); + + gem.setPickupDelay(20); + + _gems.add(gem); + } + + // Titan Giveaway + if (player != null) + { + _titanManager.openPumpkin(player, new Runnable() + { + @Override + public void run() + { + Location location = block.getLocation().add(0.5, 0.5, 0.5); + new TitanGiveawayAnimation(_titanManager, location, 3000L); + } + }); + } + //Effect block.getWorld().playSound(block.getLocation(), type.getBlockSound(), 1f, 1f); } @@ -342,13 +371,22 @@ public class HolidayManager implements Listener { if (UtilPlayer.isSpectator(event.getPlayer())) return; - + if (_coins.contains(event.getItem())) { event.setCancelled(true); event.getItem().remove(); - Manager.GetDonation().RewardCoins(null, type + " Coins", event.getPlayer().getName(), Manager.GetClients().Get(event.getPlayer()).getAccountId(), 4 * event.getItem().getItemStack().getAmount()); + Manager.GetDonation().RewardCoinsLater(type + " Coins", event.getPlayer(), 4 * event.getItem().getItemStack().getAmount()); + + event.getPlayer().getWorld().playSound(event.getPlayer().getLocation(), Sound.ORB_PICKUP, 1f, 2f); + } + else if (_gems.contains(event.getItem())) + { + event.setCancelled(true); + event.getItem().remove(); + + Manager.GetDonation().RewardGemsLater(type + " Gems", event.getPlayer(), 4 * event.getItem().getItemStack().getAmount()); event.getPlayer().getWorld().playSound(event.getPlayer().getLocation(), Sound.ORB_PICKUP, 1f, 2f); } @@ -358,7 +396,7 @@ public class HolidayManager implements Listener event.setCancelled(true); } } - + @EventHandler public void itemClean(UpdateEvent event) { @@ -378,6 +416,19 @@ public class HolidayManager implements Listener } } + Iterator gemIterator = _gems.iterator(); + + while (gemIterator.hasNext()) + { + Item gem = gemIterator.next(); + + if (!gem.isValid() || gem.getTicksLived() > 1200) + { + gem.remove(); + gemIterator.remove(); + } + } + Iterator eggIterator = _eggs.iterator(); while (eggIterator.hasNext()) @@ -391,4 +442,13 @@ public class HolidayManager implements Listener } } } + + @EventHandler + public void spawnDebug(PlayerCommandPreprocessEvent event) + { + if (event.getPlayer().isOp() && event.getPlayer().getName().equals("Chiss") && event.getMessage().contains("pumpkin")) + { + spawnSpecialBlock(event.getPlayer().getLocation().getBlock()); + } + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/titangiveaway/TitanGiveawayRepository.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/titangiveaway/TitanGiveawayRepository.java new file mode 100644 index 000000000..0ace10a33 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/titangiveaway/TitanGiveawayRepository.java @@ -0,0 +1,49 @@ +package nautilus.game.arcade.managers.titangiveaway; + +import java.sql.CallableStatement; +import java.sql.Connection; +import java.sql.Types; + +import mineplex.core.database.DBPool; +import mineplex.core.database.RepositoryBase; + +import org.bukkit.plugin.java.JavaPlugin; + +public class TitanGiveawayRepository extends RepositoryBase +{ + private int _titanGiveawayCount; + + public TitanGiveawayRepository(JavaPlugin plugin) + { + super(plugin, DBPool.ACCOUNT); + _titanGiveawayCount = 0; + } + + @Override + protected void initialize() + { + + } + + @Override + protected void update() + { + + } + + public boolean canGiveaway() + { + try (Connection connection = getConnection(); + CallableStatement callableStatement = connection.prepareCall("{call check_titanGiveaway(?)}")) + { + callableStatement.registerOutParameter(1, Types.BOOLEAN); + + + } + catch (Exception e) + { + } + + return false; + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/WinStatTracker.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/WinStatTracker.java index 6836ec0a2..382b6bbd0 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/WinStatTracker.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/WinStatTracker.java @@ -27,6 +27,9 @@ public class WinStatTracker extends StatTracker { for (Player winner : winners) { + if (!winner.isOnline()) + continue; + addStat(winner, "Wins", 1, false, false); // if (getGame().GetKit(winner) != null)