From d84bd4ffe4d9f8cc2ece239ae81d7e86ceec1f78 Mon Sep 17 00:00:00 2001 From: libraryaddict Date: Thu, 28 May 2015 10:13:31 +1200 Subject: [PATCH 01/17] Messaging: Now with censors! --- .../mineplex/core/message/MessageManager.java | 60 +++++++++++++------ 1 file changed, 43 insertions(+), 17 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/message/MessageManager.java b/Plugins/Mineplex.Core/src/mineplex/core/message/MessageManager.java index db26122a2..3c7cc86cb 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/message/MessageManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/message/MessageManager.java @@ -2,7 +2,6 @@ package mineplex.core.message; import java.util.ArrayList; import java.util.HashMap; -import java.util.LinkedList; import java.util.UUID; import org.bukkit.Bukkit; @@ -23,7 +22,6 @@ import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilTime; import mineplex.core.common.util.UtilTime.TimeUnit; -import mineplex.core.event.StackerEvent; import mineplex.core.friend.FriendManager; import mineplex.core.friend.data.FriendData; import mineplex.core.friend.data.FriendStatus; @@ -98,7 +96,7 @@ public class MessageManager extends MiniClientPlugin } public boolean canMessage(Player from, Player to) - { + { if (!canSenderMessageThem(from, to.getName())) { return false; @@ -133,7 +131,7 @@ public class MessageManager extends MiniClientPlugin return null; } - + public boolean isMuted(Player sender) { PunishClient client = _punish.GetClient(sender.getName()); @@ -158,7 +156,7 @@ public class MessageManager extends MiniClientPlugin return true; } - + return false; } @@ -181,11 +179,11 @@ public class MessageManager extends MiniClientPlugin public void DoMessage(Player from, Player to, String message) { - PrivateMessageEvent pmEvent = new PrivateMessageEvent(from, to, message); + PrivateMessageEvent pmEvent = new PrivateMessageEvent(from, to, message); Bukkit.getServer().getPluginManager().callEvent(pmEvent); if (pmEvent.isCancelled()) return; - + if (!canMessage(from, to)) { return; @@ -193,7 +191,8 @@ public class MessageManager extends MiniClientPlugin // My attempt at trying to mitigate some of the spam bots - Phinary // Triggers if they are whispering a new player - if (!GetClientManager().Get(from).GetRank().Has(Rank.HELPER) && Get(from).LastTo != null && !Get(from).LastTo.equalsIgnoreCase(to.getName())) + if (!GetClientManager().Get(from).GetRank().Has(Rank.HELPER) && Get(from).LastTo != null + && !Get(from).LastTo.equalsIgnoreCase(to.getName())) { long delta = System.currentTimeMillis() - Get(from).LastToTime; @@ -211,7 +210,7 @@ public class MessageManager extends MiniClientPlugin } message = _chat.getFilteredMessage(from, message); - + // Inform UtilPlayer.message(from, C.cGold + "§l" + from.getName() + " > " + to.getName() + C.cYellow + " §l" + message); @@ -355,13 +354,11 @@ public class MessageManager extends MiniClientPlugin String toRank = F.rank(_clientManager.Get(to).GetRank()); - // Message the sender RedisMessageCallback message = new RedisMessageCallback(globalMessage, true, to.getName(), - C.cPurple + "-> " + toRank + " " + to.getName() + " " + C.cPurple - + globalMessage.getMessage()); - + C.cPurple + "-> " + toRank + " " + to.getName() + " " + C.cPurple + globalMessage.getMessage()); + // Inform Admins for (Player staff : UtilServer.getPlayers()) { @@ -392,8 +389,9 @@ public class MessageManager extends MiniClientPlugin return; } - String message = C.cGold + "§l" + globalMessage.getSender() + " > " + to.getName() + C.cYellow + " §l" + globalMessage.getMessage(); - + String message = C.cGold + "§l" + globalMessage.getSender() + " > " + to.getName() + C.cYellow + " §l" + + globalMessage.getMessage(); + // Message the receiver UtilPlayer.message(to, message); @@ -448,7 +446,7 @@ public class MessageManager extends MiniClientPlugin { UtilPlayer.message(staff, - recevierRank + " " + target.getName() + " " + C.cPurple + message.getMessage()); + recevierRank + " " + target.getName() + " " + C.cPurple + message.getMessage()); } } } @@ -456,7 +454,8 @@ public class MessageManager extends MiniClientPlugin } } - public void sendMessage(final Player sender, String target, String message, boolean isReply, final boolean adminMessage) + public void sendMessage(final Player sender, final String target, final String message, final boolean isReply, + final boolean adminMessage) { FriendData friends = _friendsManager.Get(sender); FriendStatus friend = null; @@ -484,6 +483,33 @@ public class MessageManager extends MiniClientPlugin } } + final FriendStatus friendInfo = friend; + + new BukkitRunnable() + { + final String newMessage = _chat.getFilteredMessage(sender, message); + + @Override + public void run() + { + new BukkitRunnable() + { + + @Override + public void run() + { + sendMessage(sender, target, newMessage, adminMessage, isReply, friendInfo); + } + + }.runTask(getPlugin()); + } + + }.runTaskAsynchronously(getPlugin()); + } + + private void sendMessage(final Player sender, String target, String message, final boolean adminMessage, boolean isReply, + FriendStatus friend) + { // We now have the friend object, if its not null. We are sending the message to that player. // Only notify player if friend is null and its not a reply From 6c9963e1b34a24ecc76bf44bf97fd2f70437c690 Mon Sep 17 00:00:00 2001 From: libraryaddict Date: Sat, 30 May 2015 05:44:49 +1200 Subject: [PATCH 02/17] CommandCenter: Cancel command event straight after verifying that its been registered --- .../src/mineplex/core/command/CommandCenter.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/command/CommandCenter.java b/Plugins/Mineplex.Core/src/mineplex/core/command/CommandCenter.java index 4da7927f9..2b4d8f81b 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/command/CommandCenter.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/command/CommandCenter.java @@ -60,8 +60,10 @@ public class CommandCenter implements Listener if (command != null) { - if (ClientManager.Get(event.getPlayer()).GetRank().Has(event.getPlayer(), command.GetRequiredRank(), command.GetSpecificRanks(), true)) - { + event.setCancelled(true); + + if (ClientManager.Get(event.getPlayer()).GetRank().Has(event.getPlayer(), command.GetRequiredRank(), command.GetSpecificRanks(), true)) + { if (!Recharge.Instance.use(event.getPlayer(), "Command", 500, false, false)) { event.getPlayer().sendMessage(F.main("Command Center", "You can't spam commands that fast.")); @@ -71,7 +73,6 @@ public class CommandCenter implements Listener command.SetAliasUsed(commandName.toLowerCase()); command.Execute(event.getPlayer(), args); } - event.setCancelled(true); } } From 574dd16022d220f734d2a22e9f3736e69cb96805 Mon Sep 17 00:00:00 2001 From: libraryaddict Date: Sat, 30 May 2015 10:20:28 +1200 Subject: [PATCH 03/17] Hub: Modify rulebook --- .../src/mineplex/hub/HubManager.java | 166 +++++++++--------- 1 file changed, 83 insertions(+), 83 deletions(-) diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java index d2637c0b7..d48f77298 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java @@ -203,130 +203,130 @@ public class HubManager extends MiniClientPlugin _serverName = getPlugin().getConfig().getString("serverstatus.name"); _serverName = _serverName.substring(0, Math.min(16, _serverName.length())); - meta.addPage("§m-------------------§r\n" - + "Welcome to §6§lMineplex§r\n" - + "§r§0§l§r§m§0§m-------------------§r§0\n" + meta.addPage("§m-------------------§r\n" + + "Welcome to §6§lMineplex§r\n" + + "§r§0§l§r§m§0§m-------------------§r§0\n" + "\n" - + "§2Please §0take a moment to read through this book!\n" + + "§2Please §0take a moment to read through this book!\n" + "\n" + "\n" + "Part 1 - Rules\n" + "\n" + "Part 2 - FAQ\n"); - meta.addPage("§m-------------------\n" - + "§r §2§lRules§r§0\n" - + "§m-------------------\n" - + "§r\n" - + "§l1.§§§r §4No§r spamming.\n" + meta.addPage("§m-------------------\n" + + "§r §2§lRules§r§0\n" + + "§m-------------------\n" + + "§r\n" + + "§l1.§§§r §4No§r spamming.\n" + "\n" - + "§0This is sending too many messages and/or repeating the same message in a short period of time.\n"); + + "§0This is sending too many messages and/or repeating the same message in a short period of time.\n"); - meta.addPage("§m-------------------\n" - + "§r §2§lRules§r§0\n" - + "§m-------------------\n" - + "§r\n" - + "§l2.§m§r §4No§0 use of excessive caps.\n" + meta.addPage("§m-------------------\n" + + "§r §2§lRules§r§0\n" + + "§m-------------------\n" + + "§r\n" + + "§l2.§m§r §4No§0 use of excessive caps.\n" + "\n" + "This is sending messages with an excessive amount of capital letters.\n"); - meta.addPage("§m-------------------\n" - + "§r §2§lRules§r§0\n" - + "§m-------------------\n" - + "§r\n" - + "§l3.§r §4No§0 hacking or use of any unapproved mods.\n" + meta.addPage("§m-------------------\n" + + "§r §2§lRules§r§0\n" + + "§m-------------------\n" + + "§r\n" + + "§l3.§r §4No§0 hacking or use of any unapproved mods.\n" + "\n" + "This means we do not tolerate any sort of hacked client or any unapproved mods, such as fly hacks.\n"); - meta.addPage("§m-------------------\n" - + "§r §2§lRules§r§0\n" - + "§m-------------------\n" - + "§r\n" - + "§l4.§r §4No§0 advertising non-Mineplex related links.\n" + meta.addPage("§m-------------------\n" + + "§r §2§lRules§r§0\n" + + "§m-------------------\n" + + "§r\n" + + "§l4.§r §4No§0 advertising non-Mineplex related links.\n" + "\n" + "This is when a link is sent in chat which directs others to non-Mineplex related content.\n"); - meta.addPage("§m-------------------\n" - + "§r §2§lRules§r§0\n" - + "§m-------------------\n" - + "§r\n" - + "§l5.§r §4No§0 trolling or use of any exploits.\n" + meta.addPage("§m-------------------\n" + + "§r §2§lRules§r§0\n" + + "§m-------------------\n" + + "§r\n" + + "§l5.§r §4No§0 trolling or use of any exploits.\n" + "\n" + "This means that abuse of bugs/glitches is not tolerated. You also may not do things such as teamkilling and/or blocking spawns.\n"); - meta.addPage("§m-------------------\n" - + "§r §2§lRules§r§0\n" - + "§m-------------------\n" - + "§r\n" - + "§l6.§r §2Be§0 respectful to others, yourself, and the environment around you.\n"); + meta.addPage("§m-------------------\n" + + "§r §2§lRules§r§0\n" + + "§m-------------------\n" + + "§r\n" + + "§l6.§r §2Be§0 respectful to others, yourself, and the environment around you.\n"); - meta.addPage("§m-------------------\n" - + "§r §2§lRules§r§0\n" - + "§m-------------------\n" - + "§r\n" - + "§rPlease report any bugs, exploits, and/or rule breakers on our forums with evidence.\n" - + "§omineplex.com/forums\n"); + meta.addPage("§m-------------------\n" + + "§r §2§lRules§r§0\n" + + "§m-------------------\n" + + "§r\n" + + "§rPlease report any bugs, exploits, and/or rule breakers on our forums with evidence.\n" + + "§omineplex.com/forums\n"); - meta.addPage("§m-------------------\n" - + "§r §2§lFAQ§r§0\n" - + "§m-------------------\n" - + "§r\n" - + "§lWhat is stacker and how do you play it?\n" + meta.addPage("§m-------------------\n" + + "§r §2§lFAQ§r§0\n" + + "§m-------------------\n" + + "§r\n" + + "§lWhat is stacker and how do you play it?\n" + "\n" - + "§rStacker is a hub game where you can stack & throw players/mobs.\n" + + "§rStacker is a hub game where you can stack & throw players/mobs.\n" + "\n" - + "§9Right-Click: pick up\n" + + "§9Right-Click: pick up\n" + "Left-Click: throw\n"); - meta.addPage("§m-------------------\n" - + "§r §2§lFAQ§r§0\n" - + "§m-------------------\n" - + "§r\n" - + "§lHow do I get §b§lUltra§0 §lor §5§lHero§0§l?\n" + meta.addPage("§m-------------------\n" + + "§r §2§lFAQ§r§0\n" + + "§m-------------------\n" + + "§r\n" + + "§lHow do I get §bUltra§l, §5Hero§l, or §aLegend§l?\n" + "\n" - + "§r§0You are able to purchase these ranks through our shop on our website at:\n" + + "§r§0You are able to purchase these ranks through our shop on our website at:\n" + "\n" - + "§owww.mineplex.com/shop\n"); + + "§owww.mineplex.com/shop\n"); - meta.addPage("§m-------------------\n" - + "§r §2§lFAQ§r§0\n" - + "§m-------------------\n" - + "§r\n" - + "§lWhy hasn't my rank been applied yet?\n" + meta.addPage("§m-------------------\n" + + "§r §2§lFAQ§r§0\n" + + "§m-------------------\n" + + "§r\n" + + "§lWhy hasn't my rank been applied yet?\n" + "\n" - + "§m§rYour rank may take a while to be applied. If it has been over 24 hours please contact:\n" + + "§m§rYour rank may take a while to be applied. If it has been over 24 hours please contact:\n" + "\n" - + "§omineplex.com/support\n"); + + "§omineplex.com/support\n"); - meta.addPage("§m-------------------\n" - + "§r §2§lFAQ§r§0\n" - + "§m-------------------\n" - + "§r\n" - + "§lWhat do I do if I was wrongfully punished?\n" + meta.addPage("§m-------------------\n" + + "§r §2§lFAQ§r§0\n" + + "§m-------------------\n" + + "§r\n" + + "§lWhat do I do if I was wrongfully punished?\n" + "\n" - + "§0If you believe you were wrongfully punished, please submit an appeal at:\n" + + "§0If you believe you were wrongfully punished, please submit an appeal at:\n" + "\n" - + "§omineplex.com/appeals\n"); + + "§omineplex.com/appeals\n"); - meta.addPage("§m-------------------\n" - + "§r §2§lFAQ§r§0\n" - + "§m-------------------\n" - + "§r\n" - + "§lHow do I apply for Helper?\n" + meta.addPage("§m-------------------\n" + + "§r §2§lFAQ§r§0\n" + + "§m-------------------\n" + + "§r\n" + + "§lHow do I apply for Trainee?\n" + "\n" - + "§rYou may only apply for Helper if you have §bUltra §0or §5Hero§0.\n" + + "§rYou may only apply for Helper if you have §bUltra§0, §5Hero§0, or §aLegend§0.\n" + "Apply at:\n" - + "§omineplex.com/application\n"); + + "§omineplex.com/application\n"); - meta.addPage("§m-------------------\n" - + "§r §6§lThank you for \n" - + " reading!§r§0\n" - + "§m-------------------\n" - + "§r\n" - + "Remember to visit our website §2mineplex.com§0 for important news & updates!\n" + meta.addPage("§m-------------------\n" + + "§r §6§lThank you for \n" + + " reading!§r§0\n" + + "§m-------------------\n" + + "§r\n" + + "Remember to visit our website §2mineplex.com§0 for important news & updates!\n" + "\n" + "\n" - + " §c§lH§6§lA§a§lV§9§lE §c§lF§6§lU§a§lN§9§l!\n"); + + " §c§lH§6§lA§a§lV§9§lE §c§lF§6§lU§a§lN§9§l!\n"); // These are needed or 1.8 clients will not show book correctly meta.setTitle("Rule Book"); From ae41f232b0fef7bbbbfa247bbeb2c69811c1bde0 Mon Sep 17 00:00:00 2001 From: libraryaddict Date: Sat, 30 May 2015 10:23:46 +1200 Subject: [PATCH 04/17] GameType: Change to reflection for creating game instances --- .../nautilus/game/arcade/ArcadeManager.java | 16 +- .../src/nautilus/game/arcade/GameFactory.java | 123 ------------ .../src/nautilus/game/arcade/GameType.java | 182 ++++++++++++------ .../arcade/managers/GameCreationManager.java | 25 ++- .../game/arcade/managers/GameHostManager.java | 2 +- 5 files changed, 148 insertions(+), 200 deletions(-) delete mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/GameFactory.java 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 62f80515e..df3a9868c 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java @@ -42,7 +42,6 @@ import mineplex.core.blockrestore.BlockRestore; import mineplex.core.blood.Blood; import mineplex.core.chat.Chat; import mineplex.core.common.Rank; -import mineplex.core.common.jsonchat.ChildJsonMessage; import mineplex.core.common.jsonchat.ClickEvent; import mineplex.core.common.jsonchat.JsonMessage; import mineplex.core.common.util.C; @@ -84,7 +83,6 @@ import mineplex.core.status.ServerStatusManager; import mineplex.core.task.TaskManager; import mineplex.core.teleport.Teleport; import mineplex.core.timing.TimingManager; -import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.classcombat.Class.ClassManager; import mineplex.minecraft.game.classcombat.Condition.SkillConditionManager; @@ -161,7 +159,6 @@ public class ArcadeManager extends MiniPlugin implements IRelation private EloManager _eloManager; // Managers - private GameFactory _gameFactory; private GameCreationManager _gameCreationManager; private GameGemManager _gameGemManager; private GameManager _gameManager; @@ -222,8 +219,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation _explosionManager.SetDebris(false); if (serverConfig.GameList.contains(GameType.ChampionsDominate) - || serverConfig.GameList.contains(GameType.ChampionsTDM) - || serverConfig.GameList.contains(GameType.ChampionsMOBA)) + || serverConfig.GameList.contains(GameType.ChampionsTDM)) { _conditionManager = new SkillConditionManager(plugin); } @@ -263,9 +259,6 @@ public class ArcadeManager extends MiniPlugin implements IRelation // Shop _arcadeShop = new ArcadeShop(this, clientManager, donationManager); - // Game Factory - _gameFactory = new GameFactory(this); - // Managers new GameChatManager(this); _gameCreationManager = new GameCreationManager(this); @@ -539,11 +532,6 @@ public class ArcadeManager extends MiniPlugin implements IRelation { return _gameHostManager; } - - public GameFactory GetGameFactory() - { - return _gameFactory; - } public GameManager GetGameManager() { @@ -1256,7 +1244,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation public void toggleChampionsModules(GameType gameType) { - boolean isChamps = gameType == GameType.ChampionsDominate || gameType == GameType.ChampionsTDM || gameType == GameType.ChampionsMOBA; + boolean isChamps = gameType == GameType.ChampionsDominate || gameType == GameType.ChampionsTDM; if (_enabled == isChamps) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/GameFactory.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/GameFactory.java deleted file mode 100644 index cf8cad827..000000000 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/GameFactory.java +++ /dev/null @@ -1,123 +0,0 @@ -package nautilus.game.arcade; - -import java.util.HashMap; - -import nautilus.game.arcade.game.games.sneakyassassins.*; - -import org.bukkit.ChatColor; - -import nautilus.game.arcade.game.Game; -import nautilus.game.arcade.game.games.baconbrawl.BaconBrawl; -import nautilus.game.arcade.game.games.barbarians.Barbarians; -import nautilus.game.arcade.game.games.bridge.Bridge; -import nautilus.game.arcade.game.games.build.Build; -import nautilus.game.arcade.game.games.cards.Cards; -import nautilus.game.arcade.game.games.castlesiege.CastleSiege; -import nautilus.game.arcade.game.games.champions.ChampionsDominate; -import nautilus.game.arcade.game.games.champions.ChampionsTDM; -import nautilus.game.arcade.game.games.christmas.Christmas; -import nautilus.game.arcade.game.games.deathtag.DeathTag; -import nautilus.game.arcade.game.games.dragonescape.DragonEscape; -import nautilus.game.arcade.game.games.dragonescape.DragonEscapeTeams; -import nautilus.game.arcade.game.games.dragonriders.DragonRiders; -import nautilus.game.arcade.game.games.dragons.Dragons; -import nautilus.game.arcade.game.games.dragons.DragonsTeams; -import nautilus.game.arcade.game.games.draw.Draw; -import nautilus.game.arcade.game.games.event.EventGame; -import nautilus.game.arcade.game.games.evolution.Evolution; -import nautilus.game.arcade.game.games.gravity.Gravity; -import nautilus.game.arcade.game.games.halloween.Halloween; -import nautilus.game.arcade.game.games.hideseek.HideSeek; -import nautilus.game.arcade.game.games.holeinwall.HoleInTheWall; -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.quiver.Quiver; -import nautilus.game.arcade.game.games.quiver.QuiverTeams; -import nautilus.game.arcade.game.games.runner.Runner; -import nautilus.game.arcade.game.games.searchanddestroy.SearchAndDestroy; -import nautilus.game.arcade.game.games.sheep.SheepGame; -import nautilus.game.arcade.game.games.smash.SuperSmash; -import nautilus.game.arcade.game.games.smash.SuperSmashDominate; -import nautilus.game.arcade.game.games.smash.SuperSmashTeam; -import nautilus.game.arcade.game.games.snake.Snake; -import nautilus.game.arcade.game.games.snowfight.SnowFight; -import nautilus.game.arcade.game.games.spleef.Spleef; -import nautilus.game.arcade.game.games.spleef.SpleefTeams; -import nautilus.game.arcade.game.games.squidshooter.SquidShooter; -import nautilus.game.arcade.game.games.stacker.Stacker; -import nautilus.game.arcade.game.games.survivalgames.SurvivalGames; -import nautilus.game.arcade.game.games.survivalgames.SurvivalGamesTeams; -import nautilus.game.arcade.game.games.paintball.Paintball; -import nautilus.game.arcade.game.games.tug.Tug; -import nautilus.game.arcade.game.games.turfforts.TurfForts; -import nautilus.game.arcade.game.games.uhc.UHC; -import nautilus.game.arcade.game.games.wither.WitherGame; -import nautilus.game.arcade.game.games.wizards.Wizards; -import nautilus.game.arcade.game.games.zombiesurvival.ZombieSurvival; - -public class GameFactory -{ - private ArcadeManager _manager; - - public GameFactory(ArcadeManager gameManager) - { - _manager = gameManager; - } - - public Game CreateGame(GameType gameType, HashMap pastTeams) - { - if (gameType == GameType.Barbarians) return new Barbarians(_manager); - else if (gameType == GameType.BaconBrawl) return new BaconBrawl(_manager); - else if (gameType == GameType.Bridge) return new Bridge(_manager); - else if (gameType == GameType.Build) return new Build(_manager); - else if (gameType == GameType.Cards) return new Cards(_manager); - else if (gameType == GameType.CastleSiege) return new CastleSiege(_manager); - else if (gameType == GameType.Christmas) return new Christmas(_manager); - else if (gameType == GameType.DeathTag) return new DeathTag(_manager); - else if (gameType == GameType.ChampionsDominate) return new ChampionsDominate(_manager); - else if (gameType == GameType.ChampionsTDM) return new ChampionsTDM(_manager); - else if (gameType == GameType.Dragons) return new Dragons(_manager); - else if (gameType == GameType.DragonsTeams) return new DragonsTeams(_manager); - else if (gameType == GameType.DragonEscape) return new DragonEscape(_manager); - else if (gameType == GameType.DragonEscapeTeams) return new DragonEscapeTeams(_manager); - else if (gameType == GameType.DragonRiders) return new DragonRiders(_manager); - else if (gameType == GameType.Draw) return new Draw(_manager); - else if (gameType == GameType.Event) return new EventGame(_manager); - else if (gameType == GameType.Evolution) return new Evolution(_manager); - else if (gameType == GameType.Gravity) return new Gravity(_manager); - else if (gameType == GameType.Halloween) return new Halloween(_manager); - else if (gameType == GameType.HideSeek) return new HideSeek(_manager); - else if (gameType == GameType.HoleInTheWall) return new HoleInTheWall(_manager); - else if (gameType == GameType.Micro) return new Micro(_manager); - else if (gameType == GameType.MineStrike) return new MineStrike(_manager); - else if (gameType == GameType.MineWare) return new MineWare(_manager); - else if (gameType == GameType.MilkCow) return new MilkCow(_manager); - else if (gameType == GameType.Paintball) return new Paintball(_manager); - else if (gameType == GameType.Quiver) return new Quiver(_manager); - else if (gameType == GameType.QuiverTeams) return new QuiverTeams(_manager); - else if (gameType == GameType.Runner) return new Runner(_manager); - else if (gameType == GameType.SearchAndDestroy) return new SearchAndDestroy(_manager); - else if (gameType == GameType.SnowFight) return new SnowFight(_manager); - else if (gameType == GameType.Sheep) return new SheepGame(_manager); - else if (gameType == GameType.Smash) return new SuperSmash(_manager); - else if (gameType == GameType.SmashTeams) return new SuperSmashTeam(_manager); - else if (gameType == GameType.SmashDomination) return new SuperSmashDominate(_manager); - else if (gameType == GameType.Snake) return new Snake(_manager); - else if (gameType == GameType.SneakyAssassins) return new SneakyAssassins(_manager); - else if (gameType == GameType.Spleef) return new Spleef(_manager); - else if (gameType == GameType.SpleefTeams) return new SpleefTeams(_manager); - else if (gameType == GameType.SquidShooter) return new SquidShooter(_manager); - else if (gameType == GameType.Stacker) return new Stacker(_manager); - else if (gameType == GameType.SurvivalGames) return new SurvivalGames(_manager); - else if (gameType == GameType.SurvivalGamesTeams) return new SurvivalGamesTeams(_manager); - else if (gameType == GameType.Tug) return new Tug(_manager); - else if (gameType == GameType.TurfWars) return new TurfForts(_manager); - else if (gameType == GameType.UHC) return new UHC(_manager); - else if (gameType == GameType.WitherAssault) return new WitherGame(_manager); - else if (gameType == GameType.Wizards) return new Wizards(_manager); - else if (gameType == GameType.ZombieSurvival) return new ZombieSurvival(_manager); - else return null; - } -} 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 07570963d..07945ed36 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/GameType.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/GameType.java @@ -1,65 +1,120 @@ package nautilus.game.arcade; +import nautilus.game.arcade.game.Game; +import nautilus.game.arcade.game.games.baconbrawl.BaconBrawl; +import nautilus.game.arcade.game.games.barbarians.Barbarians; +import nautilus.game.arcade.game.games.bridge.Bridge; +import nautilus.game.arcade.game.games.build.Build; +import nautilus.game.arcade.game.games.cards.Cards; +import nautilus.game.arcade.game.games.castlesiege.CastleSiege; +import nautilus.game.arcade.game.games.champions.ChampionsDominate; +import nautilus.game.arcade.game.games.champions.ChampionsTDM; +import nautilus.game.arcade.game.games.christmas.Christmas; +import nautilus.game.arcade.game.games.deathtag.DeathTag; +import nautilus.game.arcade.game.games.dragonescape.DragonEscape; +import nautilus.game.arcade.game.games.dragonescape.DragonEscapeTeams; +import nautilus.game.arcade.game.games.dragonriders.DragonRiders; +import nautilus.game.arcade.game.games.dragons.Dragons; +import nautilus.game.arcade.game.games.dragons.DragonsTeams; +import nautilus.game.arcade.game.games.draw.Draw; +import nautilus.game.arcade.game.games.event.EventGame; +import nautilus.game.arcade.game.games.evolution.Evolution; +import nautilus.game.arcade.game.games.gravity.Gravity; +import nautilus.game.arcade.game.games.halloween.Halloween; +import nautilus.game.arcade.game.games.hideseek.HideSeek; +import nautilus.game.arcade.game.games.holeinwall.HoleInTheWall; +import nautilus.game.arcade.game.games.horsecharge.Horse; +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.oldmineware.OldMineWare; +import nautilus.game.arcade.game.games.paintball.Paintball; +import nautilus.game.arcade.game.games.quiver.Quiver; +import nautilus.game.arcade.game.games.quiver.QuiverTeams; +import nautilus.game.arcade.game.games.runner.Runner; +import nautilus.game.arcade.game.games.searchanddestroy.SearchAndDestroy; +import nautilus.game.arcade.game.games.sheep.SheepGame; +import nautilus.game.arcade.game.games.smash.SuperSmash; +import nautilus.game.arcade.game.games.smash.SuperSmashDominate; +import nautilus.game.arcade.game.games.smash.SuperSmashTeam; +import nautilus.game.arcade.game.games.snake.Snake; +import nautilus.game.arcade.game.games.sneakyassassins.SneakyAssassins; +import nautilus.game.arcade.game.games.snowfight.SnowFight; +import nautilus.game.arcade.game.games.spleef.Spleef; +import nautilus.game.arcade.game.games.spleef.SpleefTeams; +import nautilus.game.arcade.game.games.squidshooter.SquidShooter; +import nautilus.game.arcade.game.games.stacker.Stacker; +import nautilus.game.arcade.game.games.survivalgames.SurvivalGames; +import nautilus.game.arcade.game.games.survivalgames.SurvivalGamesTeams; +import nautilus.game.arcade.game.games.tug.Tug; +import nautilus.game.arcade.game.games.turfforts.TurfForts; +import nautilus.game.arcade.game.games.uhc.UHC; +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 - BaconBrawl("Bacon Brawl", Material.PORK, (byte)0, GameCategory.ARCADE, 1), - Barbarians("A Barbarians Life", Material.WOOD_AXE, (byte)0, GameCategory.EXTRA, 2), - Bridge("The Bridges", Material.IRON_PICKAXE, (byte)0, GameCategory.SURVIVAL, 3), - CastleSiege("Castle Siege", Material.DIAMOND_CHESTPLATE, (byte)0, GameCategory.CLASSICS, 4), - ChampionsDominate("Champions Domination", "Champions", Material.BEACON, (byte)0, GameCategory.CHAMPIONS, 6), - ChampionsMOBA("Champions MOBA", "Champions", Material.SKULL_ITEM, (byte)0, GameCategory.CHAMPIONS, 7), - ChampionsTDM("Champions TDM", "Champions", Material.GOLD_SWORD, (byte)0, GameCategory.CHAMPIONS, 5), - Christmas("Christmas Chaos", Material.SNOW_BALL, (byte)0, GameCategory.CLASSICS, 8), - DeathTag("Death Tag", Material.SKULL_ITEM, (byte)0, GameCategory.ARCADE, 9), - DragonEscape("Dragon Escape", Material.DRAGON_EGG, (byte)0, GameCategory.ARCADE, 10), - DragonEscapeTeams("Dragon Escape Teams", Material.DRAGON_EGG, (byte)0, GameCategory.TEAM_VARIANT, 11), - DragonRiders("Dragon Riders", Material.DRAGON_EGG, (byte)0, GameCategory.ARCADE, 12), - Dragons("Dragons", Material.ENDER_STONE, (byte)0, GameCategory.ARCADE, 13), - DragonsTeams("Dragons Teams", Material.ENDER_STONE, (byte)0, GameCategory.TEAM_VARIANT, 14), - Draw("Draw My Thing", Material.BOOK_AND_QUILL, (byte)0, GameCategory.CLASSICS, 15), - Evolution("Evolution", Material.EMERALD, (byte)0, GameCategory.ARCADE, 16), - FlappyBird("Flappy Bird", Material.FEATHER, (byte)0, GameCategory.ARCADE, 17), - Gravity("Gravity", Material.ENDER_PORTAL, (byte)0, GameCategory.EXTRA, 18), - Halloween("Halloween Horror", Material.PUMPKIN, (byte)0, GameCategory.CLASSICS, 19), - HideSeek("Block Hunt", Material.GRASS, (byte)0, GameCategory.CLASSICS, 20), - HoleInTheWall("Hole in the Wall", Material.STAINED_GLASS, (byte) 2, GameCategory.ARCADE, 52), - Horse("Horseback", Material.IRON_BARDING, (byte)0, GameCategory.ARCADE, 21), - Micro("Micro Battle", Material.LAVA_BUCKET, (byte)0, GameCategory.ARCADE, 24), - MilkCow("Milk the Cow", Material.MILK_BUCKET, (byte)0, GameCategory.ARCADE, 27), - MineStrike("MineStrike", Material.TNT, (byte)0, GameCategory.CLASSICS, 25, "http://chivebox.com/file/c/assets.zip", false), - MineWare("MineWare", Material.PAPER, (byte)0, GameCategory.EXTRA, 26), - Paintball("Super Paintball", Material.ENDER_PEARL, (byte)0, GameCategory.ARCADE, 28), - Quiver("One in the Quiver", Material.ARROW, (byte)0, GameCategory.ARCADE, 29), - QuiverTeams("One in the Quiver Teams", Material.ARROW, (byte)0, GameCategory.TEAM_VARIANT, 30), - Runner("Runner", Material.LEATHER_BOOTS, (byte)0, GameCategory.ARCADE, 31), - SearchAndDestroy("Search and Destroy", Material.TNT, (byte)0, GameCategory.SURVIVAL, 32), - Sheep("Sheep Quest", Material.WOOL, (byte)4, GameCategory.ARCADE, 33), - Smash("Super Smash Mobs", Material.SKULL_ITEM, (byte)4, GameCategory.CLASSICS, 34), - SmashDomination("Super Smash Mobs Domination", "Super Smash Mobs", Material.SKULL_ITEM, (byte)4, GameCategory.EXTRA, 36), - SmashTeams("Super Smash Mobs Teams", "Super Smash Mobs", Material.SKULL_ITEM, (byte)4, GameCategory.TEAM_VARIANT, 35), - Snake("Snake", Material.WOOL, (byte)0, GameCategory.ARCADE, 37), - SneakyAssassins("Sneaky Assassins", Material.INK_SACK, (byte)0, GameCategory.ARCADE, 38), - SnowFight("Snow Fight", Material.SNOW_BALL, (byte)0, GameCategory.EXTRA, 39), - Spleef("Super Spleef", Material.IRON_SPADE, (byte)0, GameCategory.ARCADE, 40), - SpleefTeams("Super Spleef Teams", Material.IRON_SPADE, (byte)0, GameCategory.TEAM_VARIANT, 41), - SquidShooter("Squid Shooter", Material.FIREWORK_CHARGE, (byte)0, GameCategory.ARCADE, 43), - Stacker("Super Stacker", Material.BOWL, (byte)0, GameCategory.ARCADE, 42), - SurvivalGames("Survival Games", Material.IRON_SWORD, (byte)0, GameCategory.SURVIVAL, 22), - SurvivalGamesTeams("Survival Games Teams", Material.IRON_SWORD, (byte)0, GameCategory.TEAM_VARIANT, 23), - Tug("Tug of Wool", Material.WHEAT, (byte)0, GameCategory.ARCADE, 44), - TurfWars("Turf Wars", Material.STAINED_CLAY, (byte)14, GameCategory.ARCADE, 45), - UHC("Ultra Hardcore", Material.GOLDEN_APPLE, (byte)0, GameCategory.SURVIVAL, 46), - WitherAssault("Wither Assault", Material.SKULL_ITEM, (byte)1, GameCategory.ARCADE, 47), - Wizards("Wizards", Material.BLAZE_ROD, (byte)0, GameCategory.SURVIVAL, 48, "http://chivebox.com/file/c/ResWizards.zip", true), - ZombieSurvival("Zombie Survival", Material.SKULL_ITEM, (byte)2, GameCategory.SURVIVAL, 49), + BaconBrawl(BaconBrawl.class, "Bacon Brawl", Material.PORK, (byte)0, GameCategory.ARCADE, 1), + Barbarians(Barbarians.class, "A Barbarians Life", Material.WOOD_AXE, (byte)0, GameCategory.EXTRA, 2), + Bridge(Bridge.class, "The Bridges", Material.IRON_PICKAXE, (byte)0, GameCategory.SURVIVAL, 3), + CastleSiege(CastleSiege.class, "Castle Siege", Material.DIAMOND_CHESTPLATE, (byte)0, GameCategory.CLASSICS, 4), + ChampionsDominate(ChampionsDominate.class, "Champions Domination", "Champions", Material.BEACON, (byte)0, GameCategory.CHAMPIONS, 6), + //ChampionsMOBA(ChampionsMOBA.class, "Champions MOBA", "Champions", Material.SKULL_ITEM, (byte)0, GameCategory.CHAMPIONS, 7), + ChampionsTDM(ChampionsTDM.class, "Champions TDM", "Champions", Material.GOLD_SWORD, (byte)0, GameCategory.CHAMPIONS, 5), + Christmas(Christmas.class, "Christmas Chaos", Material.SNOW_BALL, (byte)0, GameCategory.CLASSICS, 8), + DeathTag(DeathTag.class, "Death Tag", Material.SKULL_ITEM, (byte)0, GameCategory.ARCADE, 9), + DragonEscape(DragonEscape.class, "Dragon Escape", Material.DRAGON_EGG, (byte)0, GameCategory.ARCADE, 10), + DragonEscapeTeams(DragonEscapeTeams.class, "Dragon Escape Teams", Material.DRAGON_EGG, (byte)0, GameCategory.TEAM_VARIANT, 11), + DragonRiders(DragonRiders.class, "Dragon Riders", Material.DRAGON_EGG, (byte)0, GameCategory.ARCADE, 12), + Dragons(Dragons.class, "Dragons", Material.ENDER_STONE, (byte)0, GameCategory.ARCADE, 13), + DragonsTeams(DragonsTeams.class, "Dragons Teams", Material.ENDER_STONE, (byte)0, GameCategory.TEAM_VARIANT, 14), + Draw(Draw.class, "Draw My Thing", Material.BOOK_AND_QUILL, (byte)0, GameCategory.CLASSICS, 15), + Evolution(Evolution.class, "Evolution", Material.EMERALD, (byte)0, GameCategory.ARCADE, 16), + //FlappyBird(FlappyBird.class, "Flappy Bird", Material.FEATHER, (byte)0, GameCategory.ARCADE, 17), + Gravity(Gravity.class, "Gravity", Material.ENDER_PORTAL, (byte)0, GameCategory.EXTRA, 18), + Halloween(Halloween.class, "Halloween Horror", Material.PUMPKIN, (byte)0, GameCategory.CLASSICS, 19), + HideSeek(HideSeek.class, "Block Hunt", Material.GRASS, (byte)0, GameCategory.CLASSICS, 20), + HoleInTheWall(HoleInTheWall.class, "Hole in the Wall", Material.STAINED_GLASS, (byte) 2, GameCategory.ARCADE, 52), + Horse(Horse.class, "Horseback", Material.IRON_BARDING, (byte)0, GameCategory.ARCADE, 21), + Micro(Micro.class, "Micro Battle", Material.LAVA_BUCKET, (byte)0, GameCategory.ARCADE, 24), + MilkCow(MilkCow.class, "Milk the Cow", Material.MILK_BUCKET, (byte)0, GameCategory.ARCADE, 27), + MineStrike(MineStrike.class, "MineStrike", Material.TNT, (byte)0, GameCategory.CLASSICS, 25, "http://chivebox.com/file/c/assets.zip", false), + MineWare(MineWare.class, "MineWare", Material.PAPER, (byte)0, GameCategory.EXTRA, 26), + OldMineWare(OldMineWare.class, "OldMineWare", Material.PAPER, (byte)0, GameCategory.EXTRA, 26), + Paintball(Paintball.class, "Super Paintball", Material.ENDER_PEARL, (byte)0, GameCategory.ARCADE, 28), + Quiver(Quiver.class, "One in the Quiver", Material.ARROW, (byte)0, GameCategory.ARCADE, 29), + QuiverTeams(QuiverTeams.class, "One in the Quiver Teams", Material.ARROW, (byte)0, GameCategory.TEAM_VARIANT, 30), + Runner(Runner.class, "Runner", Material.LEATHER_BOOTS, (byte)0, GameCategory.ARCADE, 31), + SearchAndDestroy(SearchAndDestroy.class, "Search and Destroy", Material.TNT, (byte)0, GameCategory.SURVIVAL, 32), + Sheep(SheepGame.class, "Sheep Quest", Material.WOOL, (byte)4, GameCategory.ARCADE, 33), + Smash(SuperSmash.class, "Super Smash Mobs", Material.SKULL_ITEM, (byte)4, GameCategory.CLASSICS, 34), + SmashDomination(SuperSmashDominate.class, "Super Smash Mobs Domination", "Super Smash Mobs", Material.SKULL_ITEM, (byte)4, GameCategory.EXTRA, 36), + SmashTeams(SuperSmashTeam.class, "Super Smash Mobs Teams", "Super Smash Mobs", Material.SKULL_ITEM, (byte)4, GameCategory.TEAM_VARIANT, 35), + Snake(Snake.class, "Snake", Material.WOOL, (byte)0, GameCategory.ARCADE, 37), + SneakyAssassins(SneakyAssassins.class, "Sneaky Assassins", Material.INK_SACK, (byte)0, GameCategory.ARCADE, 38), + SnowFight(SnowFight.class, "Snow Fight", Material.SNOW_BALL, (byte)0, GameCategory.EXTRA, 39), + Spleef(Spleef.class, "Super Spleef", Material.IRON_SPADE, (byte)0, GameCategory.ARCADE, 40), + SpleefTeams(SpleefTeams.class, "Super Spleef Teams", Material.IRON_SPADE, (byte)0, GameCategory.TEAM_VARIANT, 41), + SquidShooter(SquidShooter.class, "Squid Shooter", Material.FIREWORK_CHARGE, (byte)0, GameCategory.ARCADE, 43), + Stacker(Stacker.class, "Super Stacker", Material.BOWL, (byte)0, GameCategory.ARCADE, 42), + SurvivalGames(SurvivalGames.class, "Survival Games", Material.IRON_SWORD, (byte)0, GameCategory.SURVIVAL, 22), + SurvivalGamesTeams(SurvivalGamesTeams.class, "Survival Games Teams", Material.IRON_SWORD, (byte)0, GameCategory.TEAM_VARIANT, 23), + Tug(Tug.class, "Tug of Wool", Material.WHEAT, (byte)0, GameCategory.ARCADE, 44), + TurfWars(TurfForts.class, "Turf Wars", Material.STAINED_CLAY, (byte)14, GameCategory.ARCADE, 45), + UHC(UHC.class, "Ultra Hardcore", Material.GOLDEN_APPLE, (byte)0, GameCategory.SURVIVAL, 46), + WitherAssault(WitherGame.class, "Wither Assault", Material.SKULL_ITEM, (byte)1, GameCategory.ARCADE, 47), + Wizards(Wizards.class, "Wizards", Material.BLAZE_ROD, (byte)0, GameCategory.SURVIVAL, 48, "http://chivebox.com/file/c/ResWizards.zip", true), + ZombieSurvival(ZombieSurvival.class, "Zombie Survival", Material.SKULL_ITEM, (byte)2, GameCategory.SURVIVAL, 49), - Build("Master Builders", Material.BRICK, (byte)0, GameCategory.CLASSICS, 50), - Cards("Craft Against Humanity", Material.MAP, (byte)0, GameCategory.CLASSICS, 51), + Build(Build.class, "Master Builders", Material.BRICK, (byte)0, GameCategory.CLASSICS, 50), + Cards(Cards.class, "Craft Against Humanity", Material.MAP, (byte)0, GameCategory.CLASSICS, 51), - Event("Mineplex Event", Material.CAKE, (byte)0, GameCategory.EVENT, 999); + Event(EventGame.class, "Mineplex Event", Material.CAKE, (byte)0, GameCategory.EVENT, 999); String _name; String _lobbyName; @@ -68,27 +123,29 @@ public enum GameType GameCategory _gameCategory; boolean _enforceResourcePack; String _resourcePack; + Class _gameClass; private int _gameId; // Unique identifying id for this gamemode (used for statistics) public int getGameId() { return _gameId; } - GameType(String name, Material mat, byte data, GameCategory gameCategory, int gameId) + GameType(Class gameClass, String name, Material mat, byte data, GameCategory gameCategory, int gameId) { - this(name, name, mat, data, gameCategory, gameId); + this(gameClass, name, name, mat, data, gameCategory, gameId); } - GameType(String name, Material mat, byte data, GameCategory gameCategory, int gameId, String resourcePackUrl, boolean enforceResourcePack) + GameType(Class gameClass, String name, Material mat, byte data, GameCategory gameCategory, int gameId, String resourcePackUrl, boolean enforceResourcePack) { - this(name, name, mat, data, gameCategory, gameId, resourcePackUrl, enforceResourcePack); + this(gameClass, name, name, mat, data, gameCategory, gameId, resourcePackUrl, enforceResourcePack); } - GameType(String name, String lobbyName, Material mat, byte data, GameCategory gameCategory, int gameId) + GameType(Class gameClass, String name, String lobbyName, Material mat, byte data, GameCategory gameCategory, int gameId) { - this(name, lobbyName, mat, data, gameCategory, gameId, null, false); + this(gameClass, name, lobbyName, mat, data, gameCategory, gameId, null, false); } - GameType(String name, String lobbyName, Material mat, byte data, GameCategory gameCategory, int gameId, String resourcePackUrl, boolean enforceResourcePack) + GameType(Class gameClass, String name, String lobbyName, Material mat, byte data, GameCategory gameCategory, int gameId, String resourcePackUrl, boolean enforceResourcePack) { + _gameClass = gameClass; _name = name; _lobbyName = lobbyName; _mat = mat; @@ -99,6 +156,11 @@ public enum GameType _enforceResourcePack = enforceResourcePack; } + public Class getGameClass() + { + return _gameClass; + } + public boolean isEnforceResourcePack() { return _enforceResourcePack; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameCreationManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameCreationManager.java index f91764e84..a749ac987 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameCreationManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameCreationManager.java @@ -1,5 +1,6 @@ package nautilus.game.arcade.managers; +import java.lang.reflect.InvocationTargetException; import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; @@ -188,8 +189,28 @@ public class GameCreationManager implements Listener _lastGames.add(0, gameType); - //Make Game - Manager.SetGame(Manager.GetGameFactory().CreateGame(gameType, pastTeams)); + try + { + Game game = gameType.getGameClass().getConstructor(ArcadeManager.class).newInstance(Manager); + + Manager.SetGame(game); + } + catch (NoSuchMethodException ex) + { + System.err.println("Is the constructor for " + gameType.GetName() + " using only one argument?"); + ex.printStackTrace(); + return; + } + catch (InvocationTargetException ex) + { + ex.getCause().printStackTrace(); + return; + } + catch (Exception ex) + { + ex.printStackTrace(); + return; + } if (Manager.GetGame() == null) { 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 066b86440..e592af3cc 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 @@ -103,7 +103,7 @@ public class GameHostManager implements Listener legendGames.add(GameType.SnowFight); legendGames.add(GameType.Gravity); legendGames.add(GameType.Barbarians); - legendGames.add(GameType.MineWare); + legendGames.add(GameType.OldMineWare); legendGames.add(GameType.SmashDomination); // Team variants legendGames.add(GameType.DragonEscapeTeams); From 092447170e891449399d78e6ac5a1934834f1067 Mon Sep 17 00:00:00 2001 From: libraryaddict Date: Sat, 30 May 2015 10:24:15 +1200 Subject: [PATCH 05/17] Game Border: Fix typo that offsets border by one block --- .../src/nautilus/game/arcade/game/Game.java | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java index 4f3a4a4fd..4feac6c20 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java @@ -9,12 +9,10 @@ import java.util.Set; import org.bukkit.Bukkit; import org.bukkit.ChatColor; -import org.bukkit.GameMode; import org.bukkit.Location; import org.bukkit.Sound; import org.bukkit.block.BlockFace; import org.bukkit.craftbukkit.v1_7_R4.CraftWorld; -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer; import org.bukkit.entity.Entity; import org.bukkit.entity.Hanging; import org.bukkit.entity.Player; @@ -1279,12 +1277,12 @@ public abstract class Game implements Listener public boolean isInsideMap(Location loc) { return !( - loc.getX() >= WorldData.MaxX || + loc.getX() >= WorldData.MaxX + 1 || loc.getX() <= WorldData.MinX || loc.getZ() >= WorldData.MaxZ + 1 || - loc.getZ() <= WorldData.MinZ + 1 || - loc.getY() >= WorldData.MaxY || - loc.getY() <= WorldData.MinY + 1); + loc.getZ() <= WorldData.MinZ || + loc.getY() >= WorldData.MaxY + 1 || + loc.getY() <= WorldData.MinY); } public void setItemMerge(boolean itemMerge) From 35c005feb805f8195fea1b08aaf49757e6bdb88f Mon Sep 17 00:00:00 2001 From: libraryaddict Date: Sat, 30 May 2015 10:30:30 +1200 Subject: [PATCH 06/17] Game: add isInsideMap(Player) and have border call that on Game.java in order to have games able to define specific borders for players --- .../src/nautilus/game/arcade/game/Game.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java index 4feac6c20..11c0fdb97 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java @@ -1273,7 +1273,12 @@ public abstract class Game implements Listener { CreatureAllowOverride = event.getAllowed(); } - + + public boolean isInsideMap(Player player) + { + return isInsideMap(player.getLocation()); + } + public boolean isInsideMap(Location loc) { return !( From bcdb851e216bb477ed525cee0a1d1d9dd88d4091 Mon Sep 17 00:00:00 2001 From: libraryaddict Date: Tue, 2 Jun 2015 18:48:45 +1200 Subject: [PATCH 07/17] Teleport: Don't disqualify staff if they are not alive --- .../src/nautilus/game/arcade/managers/GameFlagManager.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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 ff5c02a6b..fdeb66332 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 @@ -840,7 +840,7 @@ public class GameFlagManager implements Listener for (Player player : UtilServer.getPlayers()) { - if (!game.isInsideMap(player.getLocation()) && game.IsAlive(player)) + if (!game.isInsideMap(player) && game.IsAlive(player)) { if (!Manager.IsAlive(player) || ((CraftPlayer)player).getHandle().spectating) { @@ -917,6 +917,9 @@ public class GameFlagManager implements Listener if (!game.TeleportsDisqualify) return; + if (!game.IsAlive(event.getPlayer())) + return; + //Remove Kit game.RemoveTeamPreference(event.getPlayer()); game.GetPlayerKits().remove(event.getPlayer()); From 4d8a54e7ba8123a23c6f53eb2c71c31ee715c5d4 Mon Sep 17 00:00:00 2001 From: libraryaddict Date: Tue, 2 Jun 2015 18:49:27 +1200 Subject: [PATCH 08/17] Wizards: Add spellbook on /spec --- .../game/games/wizards/WizardSpellMenu.java | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/WizardSpellMenu.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/WizardSpellMenu.java index 7fccee6e7..f24f415fa 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/WizardSpellMenu.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/WizardSpellMenu.java @@ -2,6 +2,7 @@ package nautilus.game.arcade.game.games.wizards; import mineplex.core.MiniPlugin; import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilInv; import mineplex.core.itemstack.ItemBuilder; import nautilus.game.arcade.events.GameStateChangeEvent; import nautilus.game.arcade.game.Game.GameState; @@ -10,15 +11,17 @@ import org.bukkit.Bukkit; import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; import org.bukkit.event.block.Action; import org.bukkit.event.entity.PlayerDeathEvent; +import org.bukkit.event.player.PlayerCommandPreprocessEvent; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.inventory.InventoryHolder; import org.bukkit.inventory.ItemStack; import org.bukkit.plugin.java.JavaPlugin; -public class WizardSpellMenu extends MiniPlugin +public class WizardSpellMenu extends MiniPlugin { private Wizards _wizards; private WizardSpellMenuShop _wizardShop; @@ -57,6 +60,19 @@ public class WizardSpellMenu extends MiniPlugin }); } + @EventHandler(priority = EventPriority.HIGH) + public void Observer(PlayerCommandPreprocessEvent event) + { + if (event.getMessage().equalsIgnoreCase("/spec")) + { + if (!_wizards.IsAlive(event.getPlayer()) + && !UtilInv.contains(event.getPlayer(), _wizardSpells.getType(), (byte) 0, 1)) + { + event.getPlayer().getInventory().setItem(0, _wizardSpells); + } + } + } + @EventHandler public void onJoin(GameStateChangeEvent event) { From a961e5f0d54b48dab0aeb4e321d2a9001ff5d812 Mon Sep 17 00:00:00 2001 From: libraryaddict Date: Tue, 2 Jun 2015 18:49:50 +1200 Subject: [PATCH 09/17] Wizards: Don't gain wands from stats page --- .../src/nautilus/game/arcade/game/games/wizards/Wizards.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/Wizards.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/Wizards.java index be15c1195..f68614c57 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/Wizards.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/Wizards.java @@ -1111,6 +1111,9 @@ public class Wizards extends SoloGame @EventHandler public void onClick(InventoryClickEvent event) { + if (event.getClickedInventory() == null || !(event.getClickedInventory().getHolder() instanceof BlockState)) + return; + ItemStack item = event.getCurrentItem(); if (item != null) From 3a6c030f01d5754d56c6a2ee8a9abd9bd2bcf862 Mon Sep 17 00:00:00 2001 From: libraryaddict Date: Thu, 4 Jun 2015 16:01:52 +1200 Subject: [PATCH 10/17] ConditionManager: Use a scheduler if the potion effect is being removed due to potion effect's doing something --- .../game/core/condition/Condition.java | 38 +++++++++++++++++-- 1 file changed, 34 insertions(+), 4 deletions(-) diff --git a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/condition/Condition.java b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/condition/Condition.java index acd2431cb..b35f4b59e 100644 --- a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/condition/Condition.java +++ b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/condition/Condition.java @@ -1,5 +1,6 @@ package mineplex.minecraft.game.core.condition; +import org.bukkit.Bukkit; import org.bukkit.Material; import org.bukkit.entity.LivingEntity; import org.bukkit.potion.PotionEffect; @@ -128,9 +129,9 @@ public class Condition //Add if (_ticks == -1) - (new PotionEffect(type, 72000, _mult, _ambient)).apply(_ent); + _ent.addPotionEffect(new PotionEffect(type, 72000, _mult, _ambient), true); else - (new PotionEffect(type, _ticks, _mult, _ambient)).apply(_ent); + _ent.addPotionEffect(new PotionEffect(type, _ticks, _mult, _ambient), true); } catch (Exception e) { @@ -142,8 +143,37 @@ public class Condition { try { - PotionEffectType type = PotionEffectType.getByName(_type.toString()); - _ent.removePotionEffect(type); + // TODO Remove once we update to 1.8, this fix fixes crashes for potioneffect's when acting on a potioneffect damage + // event. + boolean potionEffectCrash = false; + StackTraceElement[] stackTraces = Thread.currentThread().getStackTrace(); + + for (StackTraceElement trace : stackTraces) + { + if (trace.getClassName().equals("net.minecraft.server.v1_7_R4.EntityLiving") + && trace.getMethodName().equals("aO")) + { + potionEffectCrash = true; + break; + } + } + + if (potionEffectCrash) + { + Bukkit.getScheduler().runTaskLater(Manager.getPlugin(), new Runnable() + { + public void run() + { + PotionEffectType type = PotionEffectType.getByName(_type.toString()); + _ent.removePotionEffect(type); + } + }, 0); + } + else + { + PotionEffectType type = PotionEffectType.getByName(_type.toString()); + _ent.removePotionEffect(type); + } } catch (Exception e) { From f9b49caeed84c730699526a4f9e82dab0982c2f2 Mon Sep 17 00:00:00 2001 From: Cheese Date: Fri, 5 Jun 2015 12:21:20 +1000 Subject: [PATCH 11/17] More gems for bridges/sg kills Changed Al'Jaha MS name to Bombers Added Reporting functionality to Builders Nerfed Iron Hook Allowed longer AFk during games --- .../mineplex/core/common/util/UtilTime.java | 2 +- .../game/core/combat/CombatManager.java | 2 +- .../game/arcade/game/games/bridge/Bridge.java | 17 +++++ .../game/arcade/game/games/build/Build.java | 74 ++++++++++++++++--- .../arcade/game/games/build/BuildData.java | 18 ++++- .../game/arcade/game/games/micro/Micro.java | 3 +- .../game/games/minestrike/MineStrike.java | 6 +- .../games/survivalgames/SurvivalGames.java | 6 +- .../game/arcade/kit/perks/PerkIronHook.java | 2 +- .../game/arcade/managers/IdleManager.java | 2 +- .../nautilus/game/arcade/ore/OreHider.java | 14 ++-- 11 files changed, 118 insertions(+), 28 deletions(-) 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 15a286157..3a220464a 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 @@ -98,7 +98,7 @@ public class UtilTime if (type == TimeUnit.DAYS) text = (num = UtilMath.trim(trim, time / 86400000d)) + " Day"; else if (type == TimeUnit.HOURS) text = (num = UtilMath.trim(trim, time / 3600000d)) + " Hour"; else if (type == TimeUnit.MINUTES) text = (num = UtilMath.trim(trim, time / 60000d)) + " Minute"; - else if (type == TimeUnit.SECONDS) text = (int) (num = (int) UtilMath.trim(0, time / 1000d)) + " Second"; + else if (type == TimeUnit.SECONDS) text = (num = UtilMath.trim(trim, time / 1000d)) + " Second"; else text = (int) (num = (int) UtilMath.trim(0, time)) + " Millisecond"; } diff --git a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/combat/CombatManager.java b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/combat/CombatManager.java index f25fdedaa..46c925898 100644 --- a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/combat/CombatManager.java +++ b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/combat/CombatManager.java @@ -417,7 +417,7 @@ public class CombatManager extends MiniPlugin CombatDeathEvent deathEvent = new CombatDeathEvent(event, Get(event.getEntity().getName()), log); UtilServer.getServer().getPluginManager().callEvent(deathEvent); - + //XXX Death MSG if (deathEvent.GetBroadcastType() == DeathMessageType.Detailed || deathEvent.GetBroadcastType() == DeathMessageType.Absolute) { //Display Simple 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 b496a7530..6c4917e88 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 @@ -31,6 +31,7 @@ import org.bukkit.event.entity.EntityExplodeEvent; import org.bukkit.event.entity.ItemSpawnEvent; import org.bukkit.event.inventory.PrepareItemCraftEvent; import org.bukkit.event.player.PlayerBucketEmptyEvent; +import org.bukkit.event.player.PlayerCommandPreprocessEvent; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerPickupItemEvent; import org.bukkit.inventory.CraftingInventory; @@ -1626,4 +1627,20 @@ public class Bridge extends TeamGame implements OreObsfucation event.setCancelled(true); } } + + @Override + public double GetKillsGems(Player killer, Player killed, boolean assist) + { + if (assist) + return 3; + else + return 12; + } + + @EventHandler + public void toggleOre(PlayerCommandPreprocessEvent event) + { + if (event.getPlayer().isOp() && event.getMessage().contains("/oretoggle")) + _ore.ToggleVisibility(); + } } 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 9e5a9bc64..1d7ee11d3 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 @@ -63,6 +63,7 @@ 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; @@ -91,6 +92,7 @@ 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; @@ -107,8 +109,8 @@ public class Build extends SoloGame private int _buildGameState = 0; private long _buildStateTime = 0; private long _buildTime = 300000; - private long _voteTime = 12000; - private long _viewTime = 16000; + private long _voteTime = 14000; + private long _viewTime = 18000; private BuildData _viewData = null; private int _countdownTimerState = 0; @@ -372,7 +374,27 @@ public class Build extends SoloGame } } - if (!hasDecentVote) + String result = null; + + //More than half think its abusive + if (GetPlayers(true).size() >= 4 && _viewData.AbuseVotes.size() >= (double)(GetPlayers(true).size() - 1) / 2d) + { + result = C.cWhite + "Inappropriate Build"; + _viewData.setAbusive(); + + //Record Abuse + AddStat(_viewData.Player, "Build Draw Abuse", 1, false, true); + + //Announce + Announce(C.cWhite + C.Bold + _viewData.Player.getName() + " has been reported for an inappropriate build.", false); + _viewData.Spawn.getWorld().playSound(_viewData.Spawn, Sound.ENDERDRAGON_GROWL, 10f, 1f); + + UtilPlayer.message(_viewData.Player, C.cWhite + C.Bold + "Inappropriate Builds can result in a Master Buildres ban."); + + //Return to Hub + getArcadeManager().GetPortal().sendPlayerToServer(_viewData.Player, "Lobby"); + } + else if (!hasDecentVote) { Manager.GetExplosion().BlockExplosion(_viewData.Blocks, _viewData.Spawn, false); @@ -380,10 +402,12 @@ public class Build extends SoloGame _viewData.Spawn.getWorld().playSound(_viewData.Spawn, Sound.EXPLODE, 3f, 1f); UtilParticle.PlayParticle(ParticleType.HUGE_EXPLOSION, _viewData.Spawn, 4f, 4f, 4f, 0, 10, ViewDist.MAX, UtilServer.getPlayers()); + + result = C.cRed + "Failure"; } //Announce Builder - UtilTextMiddle.display(hasDecentVote ? null : C.cRed + "Failure", "Built by: " + C.Bold + _viewData.Player.getName(), 0, 80, 5); + UtilTextMiddle.display(result, "Built by: " + C.Bold + _viewData.Player.getName(), 0, 80, 5); } _viewData.Judged = true; @@ -431,6 +455,8 @@ public class Build extends SoloGame player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(160, (byte)3, 1, C.cAqua + C.Bold + "Amazing")); player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(160, (byte)10, 1, C.cPurple + C.Bold + "WOW! EVERYTHING IS AWESOME!")); + player.getInventory().setItem(8, ItemStackFactory.Instance.CreateStack(Material.BOOK, (byte)0, 1, C.cWhite + C.Bold + "Report Inappropriate Build")); + UtilTextMiddle.display(null, C.cYellow + "Click to Vote", 0, 60, 5, player); } @@ -711,9 +737,6 @@ public class Build extends SoloGame if (!IsAlive(event.getPlayer())) return; - if (!UtilGear.isMat(event.getPlayer().getItemInHand(), Material.STAINED_GLASS_PANE)) - return; - if (!UtilEvent.isAction(event, ActionType.R) && !UtilEvent.isAction(event, ActionType.L)) return; @@ -722,9 +745,22 @@ public class Build extends SoloGame UtilPlayer.message(event.getPlayer(), F.main("Game", "You cannot vote on your own creation!")); return; } - + if (!UtilTime.elapsed(_buildStateTime, 1500)) return; + + //Vote Abuse + if (UtilGear.isMat(event.getPlayer().getItemInHand(), Material.BOOK)) + { + _viewData.addAbuseVote(event.getPlayer()); + UtilTextMiddle.display(null, C.cWhite + C.Bold + "Inappropriate Build", 0, 40, 5, event.getPlayer()); + UtilPlayer.message(event.getPlayer(), C.cWhite + C.Bold + "You reported " + _viewData.Player.getName() + " for inappropriate build!"); + UtilPlayer.message(event.getPlayer(), C.cWhite + C.Bold + "Thanks for helping us keep Master Builders clean!"); + return; + } + + if (!UtilGear.isMat(event.getPlayer().getItemInHand(), Material.STAINED_GLASS_PANE)) + return; if (!_votes.containsKey(event.getPlayer())) _votes.put(event.getPlayer(), new NautHashMap()); @@ -1179,12 +1215,12 @@ public class Build extends SoloGame if (_buildGameState == 0) { Scoreboard.Write(C.cYellow + C.Bold + "Build Time"); - Scoreboard.Write(UtilTime.MakeStr(Math.max(0, _buildTime - (System.currentTimeMillis() - this.GetStateTime())), 1)); + Scoreboard.Write(UtilTime.MakeStr(Math.max(0, _buildTime - (System.currentTimeMillis() - this.GetStateTime())), 0)); } else if (_buildGameState == 2) { Scoreboard.Write(C.cYellow + C.Bold + "Vote Time"); - Scoreboard.Write(UtilTime.MakeStr(Math.max(0, _voteTime - (System.currentTimeMillis() - _buildStateTime)), 1)); + Scoreboard.Write(UtilTime.MakeStr(Math.max(0, _voteTime - (System.currentTimeMillis() - _buildStateTime)), 0)); // if (_viewData != null) // { @@ -1441,4 +1477,22 @@ public class Build extends SoloGame return GetTeamList().get(0).GetSpawn(); } + + @EventHandler + public void kickAbusers(UpdateEvent event) + { + if (event.getType() != UpdateType.SLOW) + return; + + for (Player player : UtilServer.getPlayers()) + { + if (Manager.GetStatsManager().Get(player).getStat("Global.Build Draw Abuse") >= 3) + { + UtilPlayer.message(player, C.cRed + C.Bold + "You have been flagged as an Inappropriate Builder!"); + UtilPlayer.message(player, C.cRed + C.Bold + "As a result, you are banned from this game."); + player.playSound(player.getLocation(), Sound.ENDERDRAGON_GROWL, 10f, 1f); + getArcadeManager().GetPortal().sendPlayerToServer(player, "Lobby"); + } + } + } } 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 d1892ca79..4069df70f 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 @@ -51,7 +51,10 @@ public class BuildData public NautHashMap Particles = new NautHashMap(); public int Time = 6000; - + + public HashSet AbuseVotes = new HashSet(); + public boolean IsAbusive = false; + // This is used to show the player to use their inventory to grab items public boolean ClickedInventory = false; @@ -307,6 +310,9 @@ public class BuildData public void addPoints(double d) { + if (IsAbusive) + return; + _totalPoints += d; } @@ -319,4 +325,14 @@ public class BuildData { _totalPoints = 0; } + + public void addAbuseVote(Player voter) + { + AbuseVotes.add(voter.getName()); + } + + public void setAbusive() + { + IsAbusive = true; + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/micro/Micro.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/micro/Micro.java index e35832f40..d8a817f01 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/micro/Micro.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/micro/Micro.java @@ -11,6 +11,7 @@ import org.bukkit.event.EventHandler; import org.bukkit.event.block.BlockBreakEvent; import org.bukkit.event.block.BlockPlaceEvent; +import mineplex.core.common.util.MapUtil; import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilTime; import mineplex.core.updater.UpdateType; @@ -178,7 +179,7 @@ public class Micro extends TeamGame return; for (Block block : _glass) - block.setType(Material.AIR); + MapUtil.QuickChangeBlockAt(block.getLocation(), Material.AIR); _glass.clear(); } 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 cfc70dab1..cb3d46357 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 @@ -245,8 +245,8 @@ public class MineStrike extends TeamGame C.cAqua + "SWAT" + C.cWhite + " Defend the Bomb Sites", C.cAqua + "SWAT" + C.cWhite + " Kill the Terrorists", " ", - C.cRed + "Al'Jaha" + C.cWhite + " Plant the Bomb at Bomb Site", - C.cRed + "Al'Jaha" + C.cWhite + " Kill the Counter-Terrorists", + C.cRed + "Bombers" + C.cWhite + " Plant the Bomb at Bomb Site", + C.cRed + "Bombers" + C.cWhite + " Kill the Counter-Terrorists", }); _shopManager = new ShopManager(this); @@ -313,7 +313,7 @@ public class MineStrike extends TeamGame this.GetTeamList().get(0).SetName("SWAT"); this.GetTeamList().get(1).SetColor(ChatColor.RED); - this.GetTeamList().get(1).SetName("Al'Jaha"); + this.GetTeamList().get(1).SetName("Bombers"); } @EventHandler diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/SurvivalGames.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/SurvivalGames.java index c7ca00602..d3e3a08d8 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/SurvivalGames.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/SurvivalGames.java @@ -1037,7 +1037,10 @@ public class SurvivalGames extends SoloGame @Override public double GetKillsGems(Player killer, Player killed, boolean assist) { - return 4; + if (assist) + return 3; + else + return 12; } @EventHandler @@ -2272,5 +2275,4 @@ public class SurvivalGames extends SoloGame } } } - } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkIronHook.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkIronHook.java index ef55aae76..b707bf669 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkIronHook.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkIronHook.java @@ -98,7 +98,7 @@ public class PerkIronHook extends Perk implements IThrown //Damage Event Manager.GetDamage().NewDamageEvent(target, player, null, - DamageCause.CUSTOM, velocity * 8, false, true, false, + DamageCause.CUSTOM, velocity * 4, false, true, false, player.getName(), GetName()); //Inform diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/IdleManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/IdleManager.java index 35fdef010..4d0ca2244 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/IdleManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/IdleManager.java @@ -73,7 +73,7 @@ public class IdleManager implements Listener if (_yaw.get(player) == player.getLocation().getYaw()) { - if (UtilTime.elapsed(_idle.get(player), 120000)) + if (UtilTime.elapsed(_idle.get(player), getArcadeManager().GetGame().IsLive() ? 240000 : 120000)) { if (getArcadeManager().GetGame().GetState() != GameState.Recruit && !getArcadeManager().GetGame().IsAlive(player)) continue; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ore/OreHider.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ore/OreHider.java index f16cfda1c..467310428 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ore/OreHider.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ore/OreHider.java @@ -13,11 +13,11 @@ public class OreHider { private NautHashMap _hidden = new NautHashMap(); private boolean _visible = false; - + public void AddOre(Location loc, Material type) { boolean visible = false; - + for (Block block : UtilBlock.getSurrounding(loc.getBlock(), false)) { if (!block.getType().isOccluding()) @@ -26,7 +26,7 @@ public class OreHider break; } } - + if (visible) { loc.getBlock().setType(type); @@ -36,7 +36,7 @@ public class OreHider _hidden.put(loc.getBlock().getLocation(), type); } } - + public void BlockBreak(BlockBreakEvent event) { for (Block block : UtilBlock.getSurrounding(event.getBlock(), false)) @@ -47,7 +47,7 @@ public class OreHider } } } - + public void Explosion(ExplosionEvent event) { for (Block cur : event.GetBlocks()) @@ -61,7 +61,7 @@ public class OreHider } } } - + public void ToggleVisibility() { if (!_visible) @@ -78,7 +78,7 @@ public class OreHider loc.getBlock().setType(Material.STONE); } } - + _visible = !_visible; } From 5f2810ae371c3fd0a1e0a5b953ebc9d45ea3a33f Mon Sep 17 00:00:00 2001 From: libraryaddict Date: Sat, 6 Jun 2015 18:07:55 +1200 Subject: [PATCH 12/17] SurvivalGames: Fix anyone able to start game --- .../game/games/survivalgames/SurvivalGames.java | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/SurvivalGames.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/SurvivalGames.java index c7ca00602..d7321ba82 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/SurvivalGames.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/SurvivalGames.java @@ -43,7 +43,6 @@ import org.bukkit.event.hanging.HangingBreakEvent; import org.bukkit.event.inventory.InventoryCloseEvent; import org.bukkit.event.inventory.PrepareItemCraftEvent; import org.bukkit.event.player.PlayerChangedWorldEvent; -import org.bukkit.event.player.PlayerChatEvent; import org.bukkit.event.player.PlayerCommandPreprocessEvent; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerJoinEvent; @@ -913,16 +912,6 @@ public class SurvivalGames extends SoloGame } } - @EventHandler - public void onChat(PlayerChatEvent event) - { - if (event.getMessage().equalsIgnoreCase("start game") && GetState() == GameState.Recruit) - { - // TODO Remove - getArcadeManager().GetGameManager().StateCountdown(this, 1, true); - } - } - @EventHandler public void DisableDamageLevel(CustomDamageEvent event) { From ef9c69f356d17b98f5927f82c02c5837b03389d0 Mon Sep 17 00:00:00 2001 From: libraryaddict Date: Sat, 6 Jun 2015 18:08:37 +1200 Subject: [PATCH 13/17] UtilShapes: Fix a method, add a space in OldMineWare in GameType --- .../src/mineplex/core/common/util/UtilShapes.java | 14 ++------------ .../src/nautilus/game/arcade/GameType.java | 2 +- 2 files changed, 3 insertions(+), 13 deletions(-) diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilShapes.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilShapes.java index c5443b0d1..b8486b467 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilShapes.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilShapes.java @@ -9,25 +9,15 @@ import org.bukkit.util.Vector; public class UtilShapes { - private final static BlockFace[] diagonalFaces = - { - BlockFace.SOUTH_WEST, BlockFace.NORTH_WEST, BlockFace.NORTH_EAST, BlockFace.SOUTH_EAST - }; - private final static BlockFace[] radial = { BlockFace.SOUTH, BlockFace.SOUTH_WEST, BlockFace.WEST, BlockFace.NORTH_WEST, BlockFace.NORTH, BlockFace.NORTH_EAST, BlockFace.EAST, BlockFace.SOUTH_EAST }; - private final static BlockFace[] squareFaces = - { - BlockFace.SOUTH, BlockFace.WEST, BlockFace.NORTH, BlockFace.EAST - }; - - public static ArrayList getCircle(Location loc, double radius, boolean hollow) + public static ArrayList getCircle(Location loc, double radius) { - return getCircleBlocks(loc, radius, 0, hollow, false); + return getCircleBlocks(loc, radius, 0, true, false); } public static ArrayList getSphereBlocks(Location loc, double radius, double height, boolean hollow) 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 07945ed36..a0042c0da 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/GameType.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/GameType.java @@ -85,7 +85,7 @@ public enum GameType MilkCow(MilkCow.class, "Milk the Cow", Material.MILK_BUCKET, (byte)0, GameCategory.ARCADE, 27), MineStrike(MineStrike.class, "MineStrike", Material.TNT, (byte)0, GameCategory.CLASSICS, 25, "http://chivebox.com/file/c/assets.zip", false), MineWare(MineWare.class, "MineWare", Material.PAPER, (byte)0, GameCategory.EXTRA, 26), - OldMineWare(OldMineWare.class, "OldMineWare", Material.PAPER, (byte)0, GameCategory.EXTRA, 26), + OldMineWare(OldMineWare.class, "Old MineWare", Material.PAPER, (byte)0, GameCategory.EXTRA, 26), Paintball(Paintball.class, "Super Paintball", Material.ENDER_PEARL, (byte)0, GameCategory.ARCADE, 28), Quiver(Quiver.class, "One in the Quiver", Material.ARROW, (byte)0, GameCategory.ARCADE, 29), QuiverTeams(QuiverTeams.class, "One in the Quiver Teams", Material.ARROW, (byte)0, GameCategory.TEAM_VARIANT, 30), From fd3232f45dd752f9abc1ec4016a6fa629c87d9a5 Mon Sep 17 00:00:00 2001 From: libraryaddict Date: Sat, 6 Jun 2015 18:30:47 +1200 Subject: [PATCH 14/17] Mineware: Rename old MineWare and move packages --- .../arcade/game/games/mineware/Challenge.java | 245 ++++++++ .../mineware/ChallengeSeperateRooms.java | 140 +++++ .../arcade/game/games/mineware/MineWare.java | 562 +++++++++++------- .../challenges/ChallengeBlockShot.java | 185 ++++++ .../challenges/ChallengeBuildBuilding.java | 88 +++ .../challenges/ChallengeChestLoot.java | 127 ++++ .../challenges/ChallengeDragonEgg.java | 171 ++++++ .../challenges/ChallengeHitTargets.java | 156 +++++ .../mineware/challenges/ChallengeLavaRun.java | 179 ++++++ .../challenges/ChallengeMilkACow.java | 241 ++++++++ .../challenges/ChallengeNavigateMaze.java | 246 ++++++++ .../challenges/ChallengePickASide.java | 193 ++++++ .../challenges/ChallengeShootChickens.java | 232 ++++++++ .../challenges/ChallengeStandOnColor.java | 213 +++++++ .../mineware/challenges/MazeGenerator.java | 104 ++++ .../games/mineware/random/CraftLadder.java | 24 - .../mineware/random/CraftStoneShovel.java | 24 - .../games/mineware/random/GatherCobble.java | 24 - .../mineware/random/GatherRedFlower.java | 24 - .../games/mineware/random/GatherSand.java | 24 - .../mineware/random/GatherYellowFlower.java | 24 - .../game/games/mineware/random/PlaceDoor.java | 24 - .../game/games/oldmineware/OldMineWare.java | 352 +++++++++++ .../order/Order.java | 8 +- .../order/OrderCraft.java | 6 +- .../order/OrderGather.java | 6 +- .../order/OrderPlace.java | 6 +- .../random/ActionMilkCow.java | 8 +- .../random/ActionShearSheep.java | 8 +- .../games/oldmineware/random/CraftLadder.java | 24 + .../oldmineware/random/CraftStoneShovel.java | 24 + .../random/DamageChicken.java | 8 +- .../random/DamageFall.java | 8 +- .../random/DamageGhast.java | 8 +- .../oldmineware/random/GatherCobble.java | 24 + .../oldmineware/random/GatherRedFlower.java | 24 + .../games/oldmineware/random/GatherSand.java | 24 + .../random/GatherYellowFlower.java | 24 + .../games/oldmineware/random/PlaceDoor.java | 24 + .../random/RideBoat.java | 8 +- .../random/RidePig.java | 8 +- .../random/StandAlone.java | 8 +- .../random/StandShelter.java | 8 +- .../random/StandStone.java | 8 +- .../random/StandWater.java | 8 +- 45 files changed, 3441 insertions(+), 443 deletions(-) create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/Challenge.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/ChallengeSeperateRooms.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeBlockShot.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeBuildBuilding.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeChestLoot.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeDragonEgg.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeHitTargets.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeLavaRun.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeMilkACow.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeNavigateMaze.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengePickASide.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeShootChickens.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeStandOnColor.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/MazeGenerator.java delete mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/random/CraftLadder.java delete mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/random/CraftStoneShovel.java delete mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/random/GatherCobble.java delete mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/random/GatherRedFlower.java delete mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/random/GatherSand.java delete mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/random/GatherYellowFlower.java delete mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/random/PlaceDoor.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/oldmineware/OldMineWare.java rename Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/{mineware => oldmineware}/order/Order.java (91%) rename Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/{mineware => oldmineware}/order/OrderCraft.java (91%) rename Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/{mineware => oldmineware}/order/OrderGather.java (88%) rename Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/{mineware => oldmineware}/order/OrderPlace.java (86%) rename Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/{mineware => oldmineware}/random/ActionMilkCow.java (80%) rename Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/{mineware => oldmineware}/random/ActionShearSheep.java (75%) create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/oldmineware/random/CraftLadder.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/oldmineware/random/CraftStoneShovel.java rename Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/{mineware => oldmineware}/random/DamageChicken.java (79%) rename Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/{mineware => oldmineware}/random/DamageFall.java (74%) rename Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/{mineware => oldmineware}/random/DamageGhast.java (86%) create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/oldmineware/random/GatherCobble.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/oldmineware/random/GatherRedFlower.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/oldmineware/random/GatherSand.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/oldmineware/random/GatherYellowFlower.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/oldmineware/random/PlaceDoor.java rename Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/{mineware => oldmineware}/random/RideBoat.java (75%) rename Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/{mineware => oldmineware}/random/RidePig.java (80%) rename Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/{mineware => oldmineware}/random/StandAlone.java (79%) rename Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/{mineware => oldmineware}/random/StandShelter.java (81%) rename Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/{mineware => oldmineware}/random/StandStone.java (76%) rename Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/{mineware => oldmineware}/random/StandWater.java (73%) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/Challenge.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/Challenge.java new file mode 100644 index 000000000..cd5a7e040 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/Challenge.java @@ -0,0 +1,245 @@ +package nautilus.game.arcade.game.games.mineware; + +import java.util.ArrayList; +import java.util.HashSet; +import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilInv; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilTime; +import mineplex.core.hologram.Hologram; +import mineplex.core.hologram.Hologram.HologramTarget; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.block.Block; +import org.bukkit.entity.Player; +import org.bukkit.event.Listener; +import org.bukkit.scheduler.BukkitRunnable; + +public abstract class Challenge implements Listener +{ + public enum ChallengeType + { + LastStanding, FirstComplete + } + + public MineWare Host; + + private String _order; + + protected long StartTime; + protected long Duration; + + private Location _center; + + protected HashSet Completed = new HashSet(); + private HashSet _modifiedBlocks = new HashSet(); + protected int Places; + private ChallengeType _challengeType; + + public Challenge(MineWare host, ChallengeType challengeType, String challengeName) + { + Host = host; + _order = challengeName; + _center = new Location(host.WorldData.World, 0, 0, 0); + _challengeType = challengeType; + } + + public HashSet getModifiedBlocks() + { + return _modifiedBlocks; + } + + public String getMessage(Player player) + { + return _order; + } + + public void setBorder(int minX, int maxX, int minY, int maxY, int minZ, int maxZ) + { + Host.WorldData.MinX = minX; + Host.WorldData.MaxX = maxX; + Host.WorldData.MinY = minY; + Host.WorldData.MaxY = maxY; + Host.WorldData.MinZ = minZ; + Host.WorldData.MaxZ = maxZ; + } + + protected void addBlock(Block block) + { + if (block.getType() == Material.AIR) + { + _modifiedBlocks.remove(block); + } + else + { + _modifiedBlocks.add(block); + } + } + + public void StartOrder() + { + setupPlayers(); + + Completed.clear(); + + StartTime = System.currentTimeMillis(); + + Duration = 60000; + + Places = (int) Math.ceil(getChallengers().size() / 2D); + } + + public void EndOrder() + { + cleanupRoom(); + } + + protected void displayCount(Player player, Location loc, String string) + { + final Hologram hologram = new Hologram(Host.Manager.getHologramManager(), loc, string); + hologram.setHologramTarget(HologramTarget.WHITELIST); + hologram.addPlayer(player); + hologram.start(); + final long expires = System.currentTimeMillis() + 500; + + new BukkitRunnable() + { + public void run() + { + if (!Host.IsLive() || expires < System.currentTimeMillis()) + { + hologram.stop(); + cancel(); + } + else + { + hologram.setLocation(hologram.getLocation().add(0, 0.1, 0)); + } + } + }.runTaskTimer(Host.Manager.getPlugin(), 0, 0); + } + + public abstract ArrayList getSpawns(); + + public abstract void cleanupRoom(); + + /** + * Register border + */ + public abstract void setupPlayers(); + + public abstract void generateRoom(); + + public String GetOrder() + { + return _order.toUpperCase(); + } + + public boolean isInsideMap(Player player) + { + return Host.isInsideMap(player.getLocation()); + } + + public final boolean Finish() + { + ArrayList players = getChallengers(); + + if (players.isEmpty()) + return true; + + if (_challengeType == ChallengeType.LastStanding) + { + if (players.size() <= Places) + { + for (Player player : players) + { + SetCompleted(player); + } + return true; + } + } + else if (_challengeType == ChallengeType.FirstComplete) + { + if (Completed.size() >= Places) + { + return true; + } + } + + return UtilTime.elapsed(StartTime, Duration); + } + + public int GetTimeLeft() + { + return (int) ((Duration - (System.currentTimeMillis() - StartTime)) / 1000); + } + + public void SetCompleted(Player player) + { + if (Completed.contains(player)) + return; + + Completed.add(player); + UtilPlayer.message(player, C.cGreen + C.Bold + "You completed the task!"); + player.playSound(player.getLocation(), Sound.LEVEL_UP, 2f, 1f); + UtilInv.Clear(player); + } + + public void setLost(Player player) + { + Host.LoseLife(player, false); + Host.Manager.addSpectator(player, true); + UtilInv.Clear(player); + } + + /** + * Get all players that are alive, regardless of having won or not. + */ + public ArrayList getChallengers() + { + return Host.getChallengers(); + } + + public boolean IsCompleted(Player player) + { + return Completed.contains(player); + } + + public float GetTimeLeftPercent() + { + float a = (float) (Duration - (System.currentTimeMillis() - StartTime)); + float b = (float) (Duration); + return a / b; + } + + public final int GetRemainingPlaces() + { + if (_challengeType == ChallengeType.FirstComplete) + { + return Places - Completed.size(); + } + else if (_challengeType == ChallengeType.LastStanding) + { + return getChallengers().size() - Places; + } + + return 0; + } + + public int getMinPlayers() + { + return 2; + } + + public Location getCenter() + { + return _center.clone(); + } + + public boolean hasWinner() + { + return !Completed.isEmpty(); + } + +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/ChallengeSeperateRooms.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/ChallengeSeperateRooms.java new file mode 100644 index 000000000..24f255d29 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/ChallengeSeperateRooms.java @@ -0,0 +1,140 @@ +package nautilus.game.arcade.game.games.mineware; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Map.Entry; +import mineplex.core.common.util.UtilPlayer; + +import org.bukkit.Location; +import org.bukkit.entity.Player; + +public abstract class ChallengeSeperateRooms extends Challenge +{ + private HashMap _borders = new HashMap(); + private HashMap _spawns = new HashMap(); + private double _borderX, _borderZ; + + public ChallengeSeperateRooms(MineWare host, ChallengeType challengeType, String challengeName) + { + super(host, challengeType, challengeName); + } + + public void assignRooms() + { + for (Player player : getChallengers()) + { + for (Entry entry : _spawns.entrySet()) + { + if (entry.getKey().distance(player.getLocation()) < 1) + { + _borders.put(player.getName(), entry.getValue()); + break; + } + } + } + } + + public final void generateRoom() + { + int size = getChallengers().size(); + + int x = 1; + int z = 1; + + while (size > x * z) + { + if (x > z) + { + z++; + } + else + { + x++; + } + } + + _borderX = (x * getBorderX()) + (x * getDividersX()); + _borderZ = (z * getBorderZ()) + (z * getDividersZ()); + _borderX /= 2; + _borderZ /= 2; + _borderX = Math.ceil(_borderX); + _borderZ = Math.ceil(_borderZ); + + int players = 0; + + for (int x1 = 0; x1 < x; x1++) + { + for (int z1 = 0; z1 < z; z1++) + { + if (++players > size) + continue; + + double lX = (x1 * getBorderX()) + (x1 * getDividersX()); + double lZ = (z1 * getBorderZ()) + (z1 * getDividersZ()); + lX -= _borderX; + lZ -= _borderZ; + + Location loc = getCenter().clone().add(lX, 0, lZ); + + generateRoom(loc.clone()); + + _spawns.put(getSpawn(loc.clone()), new Integer[] + { + loc.getBlockX(), loc.getBlockX() + getBorderX(), + + loc.getBlockY(), loc.getBlockY() + getBorderY(), + + loc.getBlockZ(), loc.getBlockZ() + getBorderZ() + }); + } + } + } + + @Override + public void StartOrder() + { + super.StartOrder(); + + setBorder((int) -Math.ceil(_borderX), (int) Math.ceil(_borderX), 0, 256, (int) -Math.ceil(_borderZ), + (int) Math.ceil(_borderZ)); + } + + public abstract void generateRoom(Location loc); + + public abstract int getBorderX(); + + public abstract int getBorderY(); + + public abstract int getBorderZ(); + + public abstract int getDividersX(); + + public abstract int getDividersZ(); + + public Location getSpawn(Location roomLocation) + { + return roomLocation.clone().add(getBorderX() / 2D, 1, getBorderZ() / 2D); + } + + @Override + public ArrayList getSpawns() + { + return new ArrayList(_spawns.keySet()); + } + + public boolean isInsideMap(Player player) + { + Location loc = player.getLocation(); + + if (!_borders.containsKey(player.getName()) || UtilPlayer.isSpectator(player)) + { + return super.isInsideMap(player); + } + + Integer[] borders = _borders.get(player.getName()); + + return !(loc.getX() >= borders[1] + 1 || loc.getX() <= borders[0] || loc.getZ() >= borders[5] + 1 + || loc.getZ() <= borders[4] || loc.getY() >= borders[3] + 1 || loc.getY() <= borders[2]); + } + +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/MineWare.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/MineWare.java index e6c3cbff6..7a8d6f32d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/MineWare.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/MineWare.java @@ -1,232 +1,424 @@ package nautilus.game.arcade.game.games.mineware; +import java.lang.reflect.InvocationTargetException; import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; import java.util.HashMap; -import java.util.Iterator; +import java.util.HashSet; -import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.Sound; -import org.bukkit.entity.Chicken; -import org.bukkit.entity.Cow; -import org.bukkit.entity.Creature; -import org.bukkit.entity.Ghast; -import org.bukkit.entity.Pig; +import org.bukkit.block.Block; +import org.bukkit.entity.Entity; import org.bukkit.entity.Player; -import org.bukkit.entity.Sheep; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.HandlerList; -import org.bukkit.event.entity.EntityTargetEvent; +import org.bukkit.event.entity.PlayerDeathEvent; import org.bukkit.event.player.PlayerDropItemEvent; -import org.bukkit.util.Vector; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.event.player.PlayerMoveEvent; +import org.bukkit.event.player.PlayerQuitEvent; +import org.bukkit.inventory.InventoryHolder; import mineplex.core.common.util.C; -import mineplex.core.common.util.UtilAlg; -import mineplex.core.common.util.UtilBlock; +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.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.SoloGame; -import nautilus.game.arcade.game.games.mineware.order.Order; -import nautilus.game.arcade.game.games.mineware.random.*; -import nautilus.game.arcade.game.games.runner.kits.KitLeaper; +import nautilus.game.arcade.game.GameTeam.PlayerState; +import nautilus.game.arcade.game.games.holeinwall.KitNormal; +import nautilus.game.arcade.game.games.mineware.challenges.*; import nautilus.game.arcade.kit.Kit; public class MineWare extends SoloGame { private HashMap _lives = new HashMap(); - - private Order _order = null; + private HashSet _killed = new HashSet(); + + private Challenge _order; + private ArrayList _lastOrderBlocks; private long _orderTime = 0; - private int _orderCount = 0; - - private ArrayList _orders = new ArrayList(); - private ArrayList _ordersCopy = new ArrayList(); - - private Location _ghastLoc = null; - private Location _ghastTarget = null; - private Ghast _ghast = null; - private ArrayList _mobLocs = new ArrayList(); - private ArrayList _mobs = new ArrayList(); - - public MineWare(ArcadeManager manager) + private boolean _orderWaiting; + + private ArrayList> _orders = new ArrayList>(); + private ArrayList> _ordersCopy = new ArrayList>(); + + public MineWare(ArcadeManager manager, String justSoError) { super(manager, GameType.MineWare, - new Kit[] - { - new KitLeaper(manager), - }, + new Kit[] + { + new KitNormal(manager), + }, + + new String[] + { + "Follow the orders given in chat!", "First half to follow it win the round.", "Other players lose one life.", + "Last player with lives wins!" + }); - new String[] - { - "Follow the orders given in chat!", - "First half to follow it win the round.", - "Other players lose one life.", - "Last player with lives wins!" - }); - - this.PrepareFreeze = false; - this.DamagePvP = false; - - this.BlockPlace = true; - this.BlockBreak = true; - - this.ItemDrop = true; - this.ItemPickup = true; - - InventoryOpenBlock = true; - InventoryOpenChest = true; + DamagePvE = false; + DamageEvP = false; + DamageFall = false; InventoryClick = true; - + DamageSelf = false; + DeathOut = false; + + Manager.GetCreature().SetDisableCustomDrops(true); + PopulateOrders(); } - - @Override - public void ParseData() - { - _ghastLoc = WorldData.GetDataLocs("WHITE").get(0); - while (_mobLocs.size() < 100) - { - Location loc = WorldData.GetRandomXZ(); - - while (UtilBlock.airFoliage(loc.getBlock())) - loc.add(0, -1, 0); - - Material mat = loc.getBlock().getType(); - - if (mat == Material.STONE || - mat == Material.GRASS || - mat == Material.SAND) - _mobLocs.add(loc); - } - } - - public void PopulateOrders() + @Override + public void EndCheck() { - _orders.add(new ActionMilkCow(this)); - _orders.add(new ActionShearSheep(this)); - - _orders.add(new CraftLadder(this)); - _orders.add(new CraftStoneShovel(this)); - - _orders.add(new DamageChicken(this)); - _orders.add(new DamageFall(this)); - _orders.add(new DamageGhast(this)); - - _orders.add(new GatherCobble(this)); - _orders.add(new GatherRedFlower(this)); - _orders.add(new GatherYellowFlower(this)); - _orders.add(new GatherSand(this)); - - _orders.add(new PlaceDoor(this)); - - _orders.add(new RideBoat(this)); - _orders.add(new RidePig(this)); - - _orders.add(new StandAlone(this)); - _orders.add(new StandShelter(this)); - _orders.add(new StandStone(this)); - _orders.add(new StandWater(this)); - } - - public Order GetOrder() - { - if (_ordersCopy.isEmpty()) + if (!IsLive()) + return; + + int living = 0; + + for (Player player : GetPlayers(false)) { - for (Order order : _orders) + if (_lives.containsKey(player) && _lives.get(player) > 0) { - _ordersCopy.add(order); + System.out.print(player.getName() + " is living"); + living++; } } - - return _ordersCopy.remove(UtilMath.r(_ordersCopy.size())); + + if (living <= 1) + { + SetState(GameState.End); + System.out.print("End game"); + AnnounceEnd(getWinners()); + } } - + + @Override + public boolean isInsideMap(Player player) + { + if (_order != null) + { + return _order.isInsideMap(player); + } + + return true; + } + + @EventHandler + public void onLive(GameStateChangeEvent event) + { + if (event.GetState() != GameState.Live) + { + return; + } + + UtilServer.getServer().getPluginManager().registerEvents(_order, Manager.getPlugin()); + + if (_order instanceof ChallengeSeperateRooms) + { + ((ChallengeSeperateRooms) _order).assignRooms(); + } + + _order.StartOrder(); + + sayChallenge(_order); + } + + public void PopulateOrders() + { + //_orders.add(ChallengeShootChickens.class); + //_orders.add(ChallengeStandOnColor.class); + _orders.add(ChallengePickASide.class); + //_orders.add(ChallengeMilkACow.class); + _orders.add(ChallengeHitTargets.class); + _orders.add(ChallengeNavigateMaze.class); + //_orders.add(ChallengeDragonEgg.class); + _orders.add(ChallengeBlockShot.class); + //_orders.add(ChallengeChestLoot.class); + _orders.add(ChallengeLavaRun.class); + } + + public Challenge GetOrder() + { + for (int i = 0; i < _orders.size() * 4; i++) + { + try + { + if (_ordersCopy.isEmpty()) + { + _ordersCopy.addAll(_orders); + } + + Challenge challenge = _ordersCopy.remove(UtilMath.r(_ordersCopy.size())).getConstructor(MineWare.class) + .newInstance(this); + + if (getChallengers().size() >= challenge.getMinPlayers()) + { + System.out.print("Using challenge " + challenge.getClass().getSimpleName()); + return challenge; + } + else + { + System.out.print("Cannot use challenge " + challenge.getClass().getSimpleName() + ", not enough players"); + + } + } + catch (InvocationTargetException ex) + { + ex.getCause().printStackTrace(); + } + catch (Exception e) + { + e.printStackTrace(); + } + } + + return null; + } + @EventHandler(priority = EventPriority.HIGH) public void GameStateChange(GameStateChangeEvent event) { if (event.GetState() != GameState.Prepare) return; - + for (Player player : GetPlayers(true)) - _lives.put(player, 10); + _lives.put(player, 5); // TODO + + _order = GetOrder(); + _order.generateRoom(); + + GetTeamList().get(0).SetSpawns(_order.getSpawns()); + SpectatorSpawn = UtilWorld.averageLocation(_order.getSpawns()).add(0, 7, 0); } - + + @EventHandler + public void onDamage(CustomDamageEvent event) + { + event.SetDamageToLevel(false); + } + + @EventHandler + public void onDeath(PlayerDeathEvent event) + { + _killed.add(event.getEntity()); + + if (_order == null) + return; + + LoseLife(event.getEntity(), true); + } + + public boolean IsAlive(Entity entity) + { + if (_killed.contains(entity)) + { + return false; + } + + return super.IsAlive(entity); + } + + @EventHandler + public void onQuit(PlayerQuitEvent event) + { + _lives.remove(event.getPlayer()); + } + + public ArrayList getChallengers() + { + ArrayList challengers = new ArrayList(); + + for (Player player : GetPlayers(false)) + { + if (!UtilPlayer.isSpectator(player)) + { + challengers.add(player); + } + } + + return challengers; + } + + public void sayChallenge(Challenge challenge) + { + for (Player player : UtilServer.getPlayers()) + { + player.playSound(player.getLocation(), Sound.NOTE_PLING, 1f, 1f); + + UtilPlayer.message(player, + C.cYellow + C.Bold + (IsAlive(player) ? challenge.getMessage(player) : challenge.GetOrder())); + } + } + + @EventHandler + public void onInteract(PlayerInteractEvent event) + { + if (!_orderWaiting) + { + return; + } + + event.setCancelled(true); + } + + @EventHandler + public void PlayerMoveCancel(PlayerMoveEvent event) + { + if (!PrepareFreeze) + return; + + if (!_orderWaiting) + return; + + if (!IsAlive(event.getPlayer())) + return; + + if (UtilMath.offset2d(event.getFrom(), event.getTo()) <= 0) + return; + + event.getFrom().setPitch(event.getTo().getPitch()); + event.getFrom().setYaw(event.getTo().getYaw()); + + event.setTo(event.getFrom()); + } + @EventHandler public void UpdateOrder(UpdateEvent event) { if (event.getType() != UpdateType.TICK) return; - + if (!IsLive()) return; - - //New Order + + // New Order if (_order == null) { - if (!UtilTime.elapsed(_orderTime, 1000)) + if (!UtilTime.elapsed(_orderTime, 1500)) return; - + + for (Player player : GetPlayers(false)) + { + if (_killed.contains(player) && _lives.get(player) > 0) + { + Manager.Clear(player); + } + } + + _killed.clear(); + _order = GetOrder(); - + if (_order == null) { + System.out.println("No challenge suitable"); SetState(GameState.Dead); return; } - - //Register - UtilServer.getServer().getPluginManager().registerEvents(_order, Manager.getPlugin()); - _order.StartOrder(_orderCount++); - Announce(C.cYellow + C.Bold + _order.GetOrder().toUpperCase()); - + for (Block block : _lastOrderBlocks) + { + if (block.getState() instanceof InventoryHolder) + { + ((InventoryHolder) block.getState()).getInventory().clear(); + } + + block.setTypeIdAndData(Material.AIR.getId(), (byte) 0, false); + } + + _order.generateRoom(); + + GetTeamList().get(0).SetSpawns(_order.getSpawns()); + SpectatorSpawn = UtilWorld.averageLocation(_order.getSpawns()).add(0, 7, 0); + + for (Player player : getChallengers()) + { + player.teleport(GetTeamList().get(0).GetSpawn()); + } + + if (_order instanceof ChallengeSeperateRooms) + { + ((ChallengeSeperateRooms) _order).assignRooms(); + } + + _orderTime = System.currentTimeMillis(); + _orderWaiting = true; /* XXX GetObjectiveSide().setDisplayName( ChatColor.WHITE + "§lMineWare " + C.cGreen + "§l" + "Round " + _orderCount); */ } - //Update Order + else if (_orderWaiting) + { + if (!UtilTime.elapsed(_orderTime, 1000)) + return; + + _orderWaiting = false; + + _order.StartOrder(); + + // Register + UtilServer.getServer().getPluginManager().registerEvents(_order, Manager.getPlugin()); + + sayChallenge(_order); + } + // Update Order else { if (_order.Finish()) { _orderTime = System.currentTimeMillis(); - - if (_order.PlayerHasCompleted()) + + for (Player player : getChallengers()) { - for (Player player : GetPlayers(true)) + UtilInv.Clear(player); + + if (_order.hasWinner() && !_order.IsCompleted(player)) { - if (!_order.IsCompleted(player)) - { - LoseLife(player); - - if (IsAlive(player)) - _order.FailItems(player); - } + LoseLife(player, false); } } - - - //Deregister + + // Deregister HandlerList.unregisterAll(_order); + _order.EndOrder(); + + _lastOrderBlocks = new ArrayList(_order.getModifiedBlocks()); + // Remove blocks from top to bottom, prevents blocks popping off. + Collections.sort(_lastOrderBlocks, new Comparator() + { + + @Override + public int compare(Block o1, Block o2) + { + return new Integer(o2.getY()).compareTo(o1.getY()); + } + }); + _order = null; + + EndCheck(); } else { - //Set Level + // Set Level for (Player player : UtilServer.getPlayers()) { player.setLevel(_order.GetRemainingPlaces()); @@ -240,110 +432,44 @@ public class MineWare extends SoloGame { if (!_lives.containsKey(player)) return 0; - - if (!IsAlive(player)) - return 0; - + return _lives.get(player); } - - private void LoseLife(Player player) + + public void LoseLife(Player player, boolean isDeath) { int lives = GetLives(player) - 1; - + if (lives > 0) { UtilPlayer.message(player, C.cRed + C.Bold + "You failed the task!"); UtilPlayer.message(player, C.cRed + C.Bold + "You have " + lives + " lives left!"); player.playSound(player.getLocation(), Sound.NOTE_BASS_GUITAR, 2f, 0.5f); - + _lives.put(player, lives); - } + } else - { + {System.out.print(player.getName() + " list"); UtilPlayer.message(player, C.cRed + C.Bold + "You are out of the game!"); player.playSound(player.getLocation(), Sound.EXPLODE, 2f, 1f); - - player.damage(5000); - + Scoreboard.ResetScore(player.getName()); - } - } - - @EventHandler - public void UpdateMobs(UpdateEvent event) - { - if (event.getType() != UpdateType.FAST) - return; - - if (!InProgress()) - return; - - Iterator mobIterator = _mobs.iterator(); - while (mobIterator.hasNext()) - { - Creature mob = mobIterator.next(); + SetPlayerState(player, PlayerState.OUT); - if (!mob.isValid()) + if (!isDeath) { - mob.remove(); - mobIterator.remove(); + Manager.addSpectator(player, true); } } - - if (_mobs.size() < 200) - { - Location loc = _mobLocs.get(UtilMath.r(_mobLocs.size())).clone().add(new Vector(0.5,1,0.5)); - double r = Math.random(); - - this.CreatureAllowOverride = true; - - if (r > 0.75) _mobs.add(loc.getWorld().spawn(loc, Pig.class)); - else if (r > 0.5) _mobs.add(loc.getWorld().spawn(loc, Cow.class)); - else if (r > 0.25) _mobs.add(loc.getWorld().spawn(loc, Chicken.class)); - else _mobs.add(loc.getWorld().spawn(loc, Sheep.class)); - - this.CreatureAllowOverride = false; - } - - if (_ghast == null || !_ghast.isValid()) - { - if (_ghast != null) - _ghast.remove(); - - this.CreatureAllowOverride = true; - _ghast = _ghastLoc.getWorld().spawn(_ghastLoc, Ghast.class); - this.CreatureAllowOverride = false; - - _ghast.setMaxHealth(10000); - _ghast.setHealth(_ghast.getMaxHealth()); - } - else - { - //New Target - if (_ghastTarget == null || UtilMath.offset(_ghast.getLocation(), _ghastTarget) < 5) - { - _ghastTarget = _ghastLoc.clone().add(40 - 80*Math.random(), -20*Math.random(), 40 - 80*Math.random()); - } - - _ghast.teleport(_ghast.getLocation().add(UtilAlg.getTrajectory(_ghast.getLocation(), _ghastTarget).multiply(0.1))); - } } - - @EventHandler - public void GhastTarget(EntityTargetEvent event) - { - if (event.getEntity().equals(_ghast)) - event.setCancelled(true); - } - + @Override public int GetScoreboardScore(Player player) { return GetLives(player); } - + @EventHandler public void ItemDrop(PlayerDropItemEvent event) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeBlockShot.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeBlockShot.java new file mode 100644 index 000000000..911c5e5a9 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeBlockShot.java @@ -0,0 +1,185 @@ +package nautilus.game.arcade.game.games.mineware.challenges; + +import java.util.ArrayList; +import java.util.HashMap; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilFirework; +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.UtilServer; +import mineplex.core.common.util.UtilShapes; +import mineplex.core.itemstack.ItemBuilder; +import nautilus.game.arcade.game.games.mineware.Challenge; +import nautilus.game.arcade.game.games.mineware.MineWare; + +import org.bukkit.FireworkEffect.Type; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.block.Block; +import org.bukkit.block.BlockFace; +import org.bukkit.enchantments.Enchantment; +import org.bukkit.entity.Entity; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.entity.ProjectileHitEvent; +import org.bukkit.event.entity.ProjectileLaunchEvent; +import org.bukkit.inventory.ItemStack; +import org.bukkit.material.Wool; +import org.bukkit.projectiles.ProjectileSource; +import org.bukkit.scheduler.BukkitRunnable; + +public class ChallengeBlockShot extends Challenge +{ + private HashMap _shotBlocks = new HashMap(); + private ArrayList _spawns = new ArrayList(); + private ArrayList _arrows = new ArrayList(); + + public ChallengeBlockShot(MineWare host) + { + super(host, ChallengeType.FirstComplete, "Shoot down 5 blocks"); + } + + @Override + public ArrayList getSpawns() + { + return _spawns; + } + + @EventHandler + public void onShoot(ProjectileLaunchEvent event) + { + _arrows.add(event.getEntity()); + } + + @Override + public void cleanupRoom() + { + for (Entity arrow : _arrows) + { + arrow.remove(); + } + } + + @EventHandler + public void onProjectileHit(final ProjectileHitEvent event) + { + event.getEntity().remove(); + + new BukkitRunnable() + { + public void run() + { + ProjectileSource shooter = event.getEntity().getShooter(); + + if (shooter != null && shooter instanceof Player) + { + Player player = (Player) shooter; + + for (double x = -0.5; x <= 0.5; x++) + { + for (double y = -0.5; y <= 0.5; y++) + { + for (double z = -0.5; z <= 0.5; z++) + { + Block block = event.getEntity().getLocation().add(x, y, z).getBlock(); + + if (block.getType() == Material.WOOL) + { + int score = _shotBlocks.get(player.getName()) + 1; + + _shotBlocks.put(player.getName(), score); + + Location sloc = player.getEyeLocation(); + sloc.add(UtilAlg.getTrajectory(sloc, block.getLocation().add(0.5, 0.5, 0.5)).multiply( + Math.min(7, block.getLocation().distance(sloc)))); + + displayCount(player, sloc, (score >= 5 ? C.cDGreen : score >= 3 ? C.cGreen + : score >= 1 ? C.cRed : C.cDRed) + + score); + + if (score == 5) + { + SetCompleted(player); + } + + Location loc = block.getLocation().add(0.5, 0.5, 0.5); + UtilParticle.PlayParticle(ParticleType.LARGE_EXPLODE, loc, 0, 0, 0, 0, 1, ViewDist.MAX, + UtilServer.getPlayers()); + + spawnBlock(); + + Wool wool = new Wool(block.getType(), block.getData()); + + UtilFirework.playFirework(loc, Type.BALL, wool.getColor().getColor(), true, true); + + block.setTypeIdAndData(Material.AIR.getId(), (byte) 0, false); + + addBlock(block); + + return; + } + } + } + } + } + } + }.runTaskLater(Host.Manager.getPlugin(), 0); + } + + private void spawnBlock() + { + while (true) + { + Block block = getCenter().add(UtilMath.r(40) - 20, 10 + UtilMath.r(10), UtilMath.r(40) - 20).getBlock(); + + if (block.getType() == Material.AIR) + { + block.setType(Material.WOOL); + block.setData((byte) UtilMath.r(16)); + addBlock(block); + + break; + } + } + } + + @Override + public void setupPlayers() + { + setBorder(-16, 16, 0, 20, -16, 16); + + for (Player player : Host.GetPlayers(true)) + { + player.getInventory().setItem(0, + new ItemBuilder(Material.BOW).addEnchantment(Enchantment.ARROW_INFINITE, 1).setUnbreakable(true).build()); + player.getInventory().setItem(9, new ItemStack(Material.ARROW)); + + _shotBlocks.put(player.getName(), 0); + } + } + + @Override + public void generateRoom() + { + for (Location loc : UtilShapes.getPointsInCircle(getCenter(), getChallengers().size(), 10)) + { + loc = loc.getBlock().getLocation().add(0.5, 7.1, 0.5); + _spawns.add(loc); + + Block block = loc.getBlock().getRelative(BlockFace.DOWN); + block.setType(Material.DOUBLE_STEP); + block.setData((byte) 8); + addBlock(block); + } + + for (int i = 0; i < 18; i++) + { + spawnBlock(); + } + } + +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeBuildBuilding.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeBuildBuilding.java new file mode 100644 index 000000000..9d87a6adb --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeBuildBuilding.java @@ -0,0 +1,88 @@ +package nautilus.game.arcade.game.games.mineware.challenges; + +import java.util.ArrayList; +import java.util.HashMap; + +import nautilus.game.arcade.game.games.mineware.ChallengeSeperateRooms; +import nautilus.game.arcade.game.games.mineware.MineWare; + +import org.bukkit.GameMode; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.entity.Player; + +public class ChallengeBuildBuilding extends ChallengeSeperateRooms +{ + private ArrayList _materials = new ArrayList(); + private HashMap _build = new HashMap(); + + public ChallengeBuildBuilding(MineWare host, String challengeName) + { + super(host, ChallengeType.FirstComplete, "Replicate the building!"); + + for (int x = 0; x < 3; x++) + { + for (int y = 0; y < 5; y++) + { + for (int z = 0; z < 3; z++) + { + + } + } + } + } + + @Override + public void generateRoom(Location loc) + { + // TODO Auto-generated method stub + + } + + @Override + public int getBorderX() + { + return 10; + } + + @Override + public int getBorderY() + { + return 20; + } + + @Override + public int getBorderZ() + { + return 10; + } + + @Override + public int getDividersX() + { + return 5; + } + + @Override + public int getDividersZ() + { + return 5; + } + + @Override + public void cleanupRoom() + { + // TODO Auto-generated method stub + + } + + @Override + public void setupPlayers() + { + for (Player player : getChallengers()) + { + player.setGameMode(GameMode.CREATIVE); + } + } + +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeChestLoot.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeChestLoot.java new file mode 100644 index 000000000..5b4562c2f --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeChestLoot.java @@ -0,0 +1,127 @@ +package nautilus.game.arcade.game.games.mineware.challenges; + +import java.util.ArrayList; + +import mineplex.core.common.util.UtilMath; +import nautilus.game.arcade.game.games.mineware.Challenge; +import nautilus.game.arcade.game.games.mineware.MineWare; + +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.block.Block; +import org.bukkit.block.BlockFace; +import org.bukkit.block.Chest; +import org.bukkit.block.DoubleChest; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.inventory.InventoryClickEvent; +import org.bukkit.inventory.Inventory; +import org.bukkit.inventory.ItemStack; + +public class ChallengeChestLoot extends Challenge +{ + public ChallengeChestLoot(MineWare host) + { + super(host, ChallengeType.FirstComplete, "Find a diamond in the chests"); + } + + @Override + public ArrayList getSpawns() + { + ArrayList spawns = new ArrayList(); + + for (int x = -7; x <= 7; x++) + { + for (int z = -7; z <= 7; z++) + { + if (x % 2 == 0 && z % 2 == 0) + { + spawns.add(getCenter().clone().add(x, 2.1, z)); + } + } + } + + return spawns; + } + + @Override + public void cleanupRoom() + { + } + + @Override + public void setupPlayers() + { + } + + @EventHandler + public void onInventoryClick(InventoryClickEvent event) + { + if (!(event.getInventory().getHolder() instanceof Player)) + { + event.setCancelled(true); + + if (event.getInventory().getHolder() instanceof DoubleChest || event.getInventory().getHolder() instanceof Chest) + { + if (event.getCurrentItem() != null && event.getCurrentItem().getType() == Material.DIAMOND) + { + event.setCurrentItem(new ItemStack(Material.AIR)); + SetCompleted((Player) event.getWhoClicked()); + } + } + } + } + + @Override + public void generateRoom() + { + ArrayList invs = new ArrayList(); + + for (int x = -7; x <= 7; x++) + { + for (int z = -7; z <= 7; z++) + { + Block b = getCenter().getBlock().getRelative(x, 1, z); + + if (Math.abs(x) % 2 == 0 && Math.abs(z) % 2 == 0) + { + b.setType(Material.CHEST); + + Inventory inventory = ((Chest) b.getState()).getInventory(); + invs.add(inventory); + + for (int i = 0; i < inventory.getSize(); i++) + { + ItemStack item = new ItemStack(Material.values()[UtilMath.r(Material.values().length)]); + + if (item.getType() == Material.DIAMOND || item.getType() == Material.AIR) + { + i--; + continue; + } + + inventory.setItem(i, item); + } + } + else + { + b.setType(Material.STAINED_CLAY); + b.setData((byte) UtilMath.r(16)); + + Block block = b.getRelative(BlockFace.UP); + block.setType(Material.STAINED_CLAY); + block.setData((byte) UtilMath.r(16)); + addBlock(block); + } + + addBlock(b); + } + } + + for (int i = 0; i < 10 + getChallengers().size(); i++) + { + Inventory inv = invs.get(UtilMath.r(invs.size())); + inv.setItem(UtilMath.r(inv.getSize()), new ItemStack(Material.DIAMOND)); + } + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeDragonEgg.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeDragonEgg.java new file mode 100644 index 000000000..b37659f0f --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeDragonEgg.java @@ -0,0 +1,171 @@ +package nautilus.game.arcade.game.games.mineware.challenges; + +import java.util.ArrayList; +import java.util.HashMap; + +import mineplex.core.common.util.C; +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.itemstack.ItemBuilder; +import nautilus.game.arcade.game.games.mineware.Challenge; +import nautilus.game.arcade.game.games.mineware.MineWare; + +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.block.Block; +import org.bukkit.entity.Entity; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.block.Action; +import org.bukkit.event.player.PlayerInteractEvent; + +public class ChallengeDragonEgg extends Challenge +{ + private HashMap _smashedEggs = new HashMap(); + private ArrayList _dragonEggs = new ArrayList(); + + public ChallengeDragonEgg(MineWare host) + { + super(host, ChallengeType.FirstComplete, "Whack a dragon egg 10 times"); + } + + @Override + public ArrayList getSpawns() + { + ArrayList spawns = new ArrayList(); + + for (int x = -14; x < 15; x++) + { + for (int z = -14; z < 15; z++) + { + if (x % 2 == 0 && z % 2 == 0) + { + spawns.add(getCenter().clone().add(x, 1.1, z)); + } + } + } + + return spawns; + } + + @EventHandler + public void onBlockHit(PlayerInteractEvent event) + { + if (event.getAction() != Action.LEFT_CLICK_BLOCK && event.getAction() != Action.RIGHT_CLICK_BLOCK) + { + return; + } + + if (UtilPlayer.isSpectator(event.getPlayer())) + { + return; + } + + Block block = event.getClickedBlock(); + + if (block.getType() != Material.DRAGON_EGG) + { + return; + } + + event.setCancelled(true); + + block.setType(Material.AIR); + addBlock(block); + + UtilParticle.PlayParticle(ParticleType.PORTAL, block.getLocation().add(0.5, 0.5, 0.5), 0.5F, 0.5F, 0.5F, 0, 11, + ViewDist.MAX, UtilServer.getPlayers()); + + Host.CreatureAllowOverride = true; + + for (int i = 0; i < 10; i++) + { + Block b = getCenter().clone().add(UtilMath.r(30) - 15, 1, UtilMath.r(30) - 15).getBlock(); + + if (b.getType() == Material.AIR) + { + Entity entity = getCenter().getWorld().spawnFallingBlock(b.getLocation().add(0.5, 2, 0.5), Material.DRAGON_EGG, + (byte) 0); + _dragonEggs.add(entity); + + break; + } + } + + Host.CreatureAllowOverride = false; + + Player player = event.getPlayer(); + + int score = _smashedEggs.get(player.getName()) + 1; + + displayCount(player, block.getLocation().add(0.5, 1, 0.5), (score >= 10 ? C.cDGreen : score >= 7 ? C.cGreen + : score >= 4 ? C.cRed : C.cDRed) + + score); + + _smashedEggs.put(player.getName(), score); + + if (score == 10) + { + SetCompleted(player); + } + } + + @Override + public void cleanupRoom() + { + for (int x = -15; x <= 15; x++) + { + for (int z = -15; z <= 15; z++) + { + Block b = getCenter().getBlock().getRelative(x, 1, z); + + addBlock(b); + } + } + + for (Entity ent : _dragonEggs) + { + ent.remove(); + } + } + + @Override + public void setupPlayers() + { + setBorder(-18, 18, 0, 20, -18, 18); + + for (Player player : getChallengers()) + { + _smashedEggs.put(player.getName(), 0); + player.getInventory().setItem(0, new ItemBuilder(Material.IRON_AXE).setTitle(C.cWhite + "Egg Smasher").build()); + } + } + + @Override + public void generateRoom() + { + for (int x = -15; x <= 15; x++) + { + for (int z = -15; z <= 15; z++) + { + Block b = getCenter().getBlock().getRelative(x, 0, z); + b.setType(Material.WOOL); + b.setData((byte) UtilMath.r(16)); + + addBlock(b); + } + } + + for (int i = 0; i < 9; i++) + { + Block b = getCenter().getBlock().getRelative(UtilMath.r(30) - 15, 1, UtilMath.r(30) - 15); + b.setType(Material.DRAGON_EGG); + addBlock(b); + } + } + +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeHitTargets.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeHitTargets.java new file mode 100644 index 000000000..88d43f903 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeHitTargets.java @@ -0,0 +1,156 @@ +package nautilus.game.arcade.game.games.mineware.challenges; + +import java.util.ArrayList; +import java.util.HashMap; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilPlayer; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.game.games.mineware.Challenge; +import nautilus.game.arcade.game.games.mineware.MineWare; + +import org.apache.commons.lang.StringUtils; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.block.Block; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; + +public class ChallengeHitTargets extends Challenge +{ + private HashMap> _targets = new HashMap>(); + private int _targetsEach; + + public ChallengeHitTargets(MineWare host) + { + super(host, ChallengeType.FirstComplete, "Hit the chosen players"); + } + + @EventHandler + public void onDamage(CustomDamageEvent event) + { + if (UtilPlayer.isSpectator(event.GetDamageePlayer())) + return; + + if (!(event.GetDamageeEntity() instanceof Player)) + return; + + Player p = event.GetDamageePlayer(); + + if (!_targets.containsKey(p.getName())) + return; + + String name = ((Player) event.GetDamageeEntity()).getName(); + + ArrayList targets = _targets.get(p.getName()); + + if (!targets.remove(name)) + { + p.playSound(p.getLocation(), Sound.NOTE_PLING, 1f, 1f); + + UtilPlayer.message(p, "Hit the players " + StringUtils.join(targets, C.cWhite + C.Bold + ", " + C.cYellow + C.Bold)); + return; + } + + displayCount(p, event.GetDamageeEntity().getEyeLocation().add(0, 0.3, 0), (targets.isEmpty() ? C.cDGreen + : targets.size() == 1 ? C.cRed : C.cDRed) + (_targetsEach - targets.size())); + + if (targets.isEmpty()) + { + SetCompleted(p); + } + } + + @Override + public String getMessage(Player player) + { + return "Hit the players " + + StringUtils.join(_targets.get(player.getName()), C.cWhite + C.Bold + ", " + C.cYellow + C.Bold); + } + + @Override + public int getMinPlayers() + { + return 4; + } + + @Override + public ArrayList getSpawns() + { + ArrayList spawns = new ArrayList(); + + for (int x = -8; x <= 8; x++) + { + for (int z = -8; z <= 8; z++) + { + if (x % 2 == 0 && z % 2 == 0) + { + spawns.add(getCenter().clone().add(x + 0.5, 1.1, z + 0.5)); + } + } + } + + return spawns; + } + + @Override + public void cleanupRoom() + { + } + + @Override + public void setupPlayers() + { + ArrayList players = new ArrayList(); + + for (Player player : players) + { + ArrayList names = new ArrayList(); + + for (Player p : players) + { + if (p != player) + { + names.add(p.getName()); + } + } + + while (names.size() > 3) + { + names.remove(UtilMath.r(names.size())); + } + + _targetsEach = names.size(); + + _targets.put(player.getName(), names); + } + } + + @Override + public void generateRoom() + { + for (int x = -10; x <= 10; x++) + { + for (int z = -10; z <= 10; z++) + { + Block b = getCenter().clone().add(x, 0, z).getBlock(); + b.setType(Material.SMOOTH_BRICK); + addBlock(b); + + if (Math.abs(x) > 1 && Math.abs(x) < 9 && Math.abs(z) > 1 && Math.abs(z) < 9) + { + for (int y = 1; y < 3; y++) + { + Block block = b.getRelative(0, y, 0); + block.setType(Material.SMOOTH_BRICK); + block.setData((byte) (UtilMath.r(8) < 7 ? 0 : UtilMath.r(2) + 1)); + addBlock(block); + } + } + } + } + } + +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeLavaRun.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeLavaRun.java new file mode 100644 index 000000000..f9778aa7e --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeLavaRun.java @@ -0,0 +1,179 @@ +package nautilus.game.arcade.game.games.mineware.challenges; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; +import java.util.HashMap; + +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 mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.game.games.mineware.Challenge; +import nautilus.game.arcade.game.games.mineware.MineWare; + +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.Player; +import org.bukkit.event.EventHandler; + +public class ChallengeLavaRun extends Challenge +{ + private long _delay; + private Location _obsidian; + + public ChallengeLavaRun(MineWare host) + { + super(host, ChallengeType.LastStanding, "The lava is coming! Stand on the obsidian!"); + } + + @Override + public ArrayList getSpawns() + { + ArrayList spawns = new ArrayList(); + + for (int x = -7; x <= 7; x++) + { + for (int z = -7; z <= 7; z++) + { + spawns.add(getCenter().clone().add(x + 0.5, 2, z + 0.5)); + } + } + + return spawns; + } + + @EventHandler + public void onDamage(CustomDamageEvent event) + { + if (event.GetDamagerEntity(true) != null) + { + return; + } + + event.AddMod("Ensure Death", null, 9999, false); + } + + @EventHandler + public void onTick(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + { + return; + } + + if (!UtilTime.elapsed(_delay, 2000)) + return; + + if (_obsidian == null) + { + _obsidian = getCenter().add(UtilMath.r(21) - 9.5, 1, UtilMath.r(21) - 9.5); + + for (int x = -10; x <= 10; x++) + { + for (int z = -10; z <= 10; z++) + { + Block b = getCenter().getBlock().getRelative(x, 1, z); + + b.setType(Material.GLASS); + addBlock(b); + } + } + + _obsidian.getBlock().setType(Material.OBSIDIAN); + + for (Player player : UtilServer.getPlayers()) + player.playSound(player.getLocation(), Sound.NOTE_PIANO, 2f, 0f); + } + else + { + ArrayList glassBlocks = new ArrayList(); + + for (int x = -10; x <= 10; x++) + { + for (int z = -10; z <= 10; z++) + { + Block b = getCenter().getBlock().getRelative(x, 1, z); + + if (b.getType() == Material.GLASS) + { + glassBlocks.add(b); + } + } + } + + if (glassBlocks.isEmpty()) + { + _delay = System.currentTimeMillis(); + _obsidian = null; + } + else + { + final HashMap distance = new HashMap(); + + for (Block b : glassBlocks) + { + distance.put(b, b.getLocation().add(0.5, 0, 0.5).distance(_obsidian)); + } + + Collections.sort(glassBlocks, new Comparator() + { + + @Override + public int compare(Block o1, Block o2) + { + return distance.get(o2).compareTo(distance.get(o1)); + } + }); + + for (int i = 0; i < Math.min(8, glassBlocks.size()); i++) + { + Block b = glassBlocks.remove(0); + b.setTypeIdAndData(Material.AIR.getId(), (byte) 0, false); + addBlock(b); + } + } + } + } + + @Override + public void cleanupRoom() + { + } + + @Override + public void setupPlayers() + { + } + + @Override + public void generateRoom() + { + for (int x = -15; x <= 15; x++) + { + for (int z = -15; z <= 15; z++) + { + Block block = getCenter().getBlock().getRelative(x, 0, z); + block.setType(Material.LAVA); + addBlock(block); + + if (Math.abs(x) <= 10 && Math.abs(z) <= 10) + { + Block b = block.getRelative(BlockFace.UP); + b.setType(Material.GLASS); + addBlock(b); + } + } + } + + _obsidian = getCenter().add(UtilMath.r(21) - 9.5, 1, UtilMath.r(21) - 9.5); + + _obsidian.getBlock().setType(Material.OBSIDIAN); + } + +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeMilkACow.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeMilkACow.java new file mode 100644 index 000000000..a7eeac736 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeMilkACow.java @@ -0,0 +1,241 @@ +package nautilus.game.arcade.game.games.mineware.challenges; + +import java.util.ArrayList; +import java.util.HashMap; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilPlayer; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.game.games.mineware.Challenge; +import nautilus.game.arcade.game.games.mineware.MineWare; + +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.block.Block; +import org.bukkit.entity.Cow; +import org.bukkit.entity.Entity; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.entity.Villager; +import org.bukkit.entity.Villager.Profession; +import org.bukkit.event.EventHandler; +import org.bukkit.event.player.PlayerInteractEntityEvent; +import org.bukkit.event.player.PlayerItemConsumeEvent; +import org.bukkit.inventory.ItemStack; + +public class ChallengeMilkACow extends Challenge +{ + private Villager _villager; + private HashMap> _milked = new HashMap>(); + private HashMap _score = new HashMap(); + + public ChallengeMilkACow(MineWare host) + { + super(host, ChallengeType.FirstComplete, "Deliver 5 buckets of milk to the villager"); + } + + @Override + public void cleanupRoom() + { + for (Entity cow : _milked.keySet()) + { + cow.remove(); + } + + _villager.remove(); + } + + @EventHandler + public void Damage(CustomDamageEvent event) + { + if (event.GetProjectile() == null) + return; + + Player player = event.GetDamagerPlayer(true); + + if (player == null) + return; + + LivingEntity ent = event.GetDamageeEntity(); + + if (!(ent instanceof Player)) + { + event.SetCancelled("Non-Combat Entity"); + } + } + + @Override + public void setupPlayers() + { + setBorder(-16, 16, 0, 10, -16, 16); + + for (Player player : Host.GetPlayers(true)) + { + player.getInventory().setItem(0, new ItemStack(Material.BUCKET)); + _score.put(player.getName(), 0); + } + } + + @Override + public void generateRoom() + { + for (int x = -16; x <= 16; x++) + { + for (int z = -16; z <= 16; z++) + { + for (int y = 0; y <= 1; y++) + { + Block b = getCenter().getBlock().getRelative(x, y, z); + + if (y == 0) + { + b.setType(Material.GRASS); + } + else + { + if (Math.abs(x) == 16 || Math.abs(z) == 16) + { + b.setType(Material.FENCE); + } + else if (UtilMath.r(4) == 0) + { + if (UtilMath.r(8) == 0) + { + b.setType(UtilMath.random.nextBoolean() ? Material.YELLOW_FLOWER : Material.RED_ROSE); + } + else + { + b.setType(Material.LONG_GRASS); + b.setData((byte) 1); + } + } + } + + if (b.getType() != Material.AIR) + { + addBlock(b); + } + } + } + } + + Host.CreatureAllowOverride = true; + _villager = (Villager) getCenter().getWorld().spawnEntity(getCenter().clone().add(0, 1, 0), EntityType.VILLAGER); + _villager.setProfession(Profession.FARMER); + String[] names = new String[] + { + "Tom", "Steve", "John", "Harry", "Andrew", "Daniel", "Jorge", "Jim" + }; + + if (UtilMath.r(5) == 0) + { + names = new String[] + { + "Moosworth", "Mooington", "Mooley", "Moose", "Mooskee", "Chicken", "Mooffy", "Moozzle" + }; + } + + for (int i = 0; i < 8; i++) + { + Location loc = getCenter().clone().add(UtilMath.r(26) - 13, 1, UtilMath.r(26) - 13); + Cow cow = (Cow) loc.getWorld().spawnEntity(loc, EntityType.COW); + + cow.setCustomName(C.cWhite + names[i]); + cow.setCustomNameVisible(true); + + _milked.put(cow, new ArrayList()); + } + + Host.CreatureAllowOverride = false; + } + + @EventHandler + public void onEntityInteract(PlayerInteractEntityEvent event) + { + Player p = event.getPlayer(); + + if (UtilPlayer.isSpectator(p)) + { + return; + } + + if (!Host.IsLive()) + { + return; + } + + ItemStack item = p.getItemInHand(); + + if (item == null) + return; + + Entity ent = event.getRightClicked(); + + if (_milked.containsKey(ent)) + { + if (item.getType() == Material.BUCKET) + { + if (!_milked.get(ent).contains(p.getName())) + { + p.setItemInHand(new ItemStack(Material.MILK_BUCKET)); + _milked.get(ent).add(p.getName()); + } + else + { + p.updateInventory(); + } + } + + event.setCancelled(true); + } + else if (ent == _villager) + { + if (item.getType() == Material.MILK_BUCKET) + { + p.setItemInHand(new ItemStack(Material.BUCKET)); + p.playSound(p.getLocation(), Sound.ORB_PICKUP, 2, 0); + int score = _score.get(p.getName()) + 1; + _score.put(p.getName(), score); + + displayCount(p, ((Villager) ent).getEyeLocation().add(0, 0.3, 0), (score >= 5 ? C.cDGreen : score >= 3 ? C.cGreen + : score >= 2 ? C.cRed : C.cDRed) + score); + + if (score == 5) + { + SetCompleted(p); + } + } + + event.setCancelled(true); + } + } + + @EventHandler + public void onConsume(PlayerItemConsumeEvent event) + { + event.setCancelled(true); + event.getPlayer().updateInventory(); + } + + @Override + public ArrayList getSpawns() + { + ArrayList spawns = new ArrayList(); + + for (int x = -13; x <= 13; x++) + { + for (int z = -13; z <= 13; z++) + { + if (x % 2 == 0 && z % 2 == 0) + { + spawns.add(getCenter().clone().add(x + 0.5, 1.1, z + 0.5)); + } + } + } + + return spawns; + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeNavigateMaze.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeNavigateMaze.java new file mode 100644 index 000000000..2056bac3b --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeNavigateMaze.java @@ -0,0 +1,246 @@ +package nautilus.game.arcade.game.games.mineware.challenges; + +import java.util.ArrayList; + +import mineplex.core.common.util.UtilPlayer; +import nautilus.game.arcade.game.games.mineware.Challenge; +import nautilus.game.arcade.game.games.mineware.MineWare; + +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.block.Block; +import org.bukkit.block.BlockFace; +import org.bukkit.event.EventHandler; +import org.bukkit.event.player.PlayerMoveEvent; + +public class ChallengeNavigateMaze extends Challenge +{ + + public ChallengeNavigateMaze(MineWare host) + { + super(host, ChallengeType.FirstComplete, "Make it to the other side of the maze"); + } + + @Override + public ArrayList getSpawns() + { + ArrayList spawns = new ArrayList(); + + for (int z = -9; z <= 12; z++) + { + Location loc = getCenter().clone().add(-16, 1.1, z); + spawns.add(loc); + } + + return spawns; + } + + @EventHandler + public void onMove(PlayerMoveEvent event) + { + if (UtilPlayer.isSpectator(event.getPlayer())) + return; + + if (event.getTo().getY() >= 1 && event.getTo().getX() > 15) + { + SetCompleted(event.getPlayer()); + } + } + + @Override + public void cleanupRoom() + { + } + + @Override + public void setupPlayers() + { + setBorder(-20, 18, 0, 10, -20, 18); + } + + @Override + public void generateRoom() + { + for (int x = -18; x <= 20; x++) + { + for (int z = -12; z <= 15; z++) + { + Block b = getCenter().getBlock().getRelative(x, 0, z); + + if (z == -12 || z == 15) + { + for (int y = 1; y <= 3; y++) + { + Block block = b.getRelative(0, y, 0); + block.setType(Material.STONE); + block.setData((byte) 0); + addBlock(block); + } + } + + if (x > 14 || x < -12) + { + b.setType(Material.WOOL); + b.setData((byte) (x < 0 ? 14 : 13)); + } + else + { + b.setType(Material.STONE); + b.setData((byte) 0); + + Block block = b.getRelative(0, 4, 0); + + if (block.getX() == -12) + { + block.setType(Material.STONE); + block.setData((byte) 0); + } + else + { + block.setType(Material.STAINED_GLASS); + block.setData((byte) 8); + } + + addBlock(block); + } + + addBlock(b); + } + } + + for (int i = 0; i < 30; i++) + { + ArrayList mazeBlocks = generateMaze(); + + if (mazeValid()) + { + for (Block b : mazeBlocks) + { + addBlock(b); + } + break; + } + else + { + System.out.print("Generated bad maze, trying again.."); + for (Block b : mazeBlocks) + { + b.setTypeIdAndData(Material.AIR.getId(), (byte) 0, false); + } + } + } + } + + private boolean mazeValid() + { + ArrayList blocks = new ArrayList(); + ArrayList nextLoop = new ArrayList(); + + nextLoop.add(getCenter().getBlock().getRelative(-15, 1, 0)); + + blocks.addAll(nextLoop); + + while (!nextLoop.isEmpty()) + { + Block block = nextLoop.remove(0); + + for (BlockFace face : new BlockFace[] + { + BlockFace.EAST, BlockFace.WEST, BlockFace.SOUTH, BlockFace.NORTH + }) + { + Block b = block.getRelative(face); + + if (blocks.contains(b)) + continue; + + blocks.add(b); + + if (b.getType() == Material.STONE || b.getX() < -14 || b.getZ() < -12 || b.getZ() > 15) + continue; + + if (b.getX() >= 15) + { + return true; + } + + nextLoop.add(b); + } + } + + return false; + } + + private ArrayList generateMaze() + { + ArrayList blocks = new ArrayList(); + int[][] maze = new MazeGenerator(10, 10).getMaze(); + + // Divisable by 2's are up and down walls + // Other's are left and right. All walls have a corner block. + + // This means I need to loop over all of the blocks, figure out if its a corner if yes then set block + // Else if its a wall, then figure out if I'm making the wall or not + for (int x = 1; x < 10; x++) + { + for (int z = 1; z < 10; z++) + { + Block b = getCenter().getBlock().getRelative((x - 5) * 3, 1, (z - 5) * 3); + + for (int y = 0; y < 3; y++) + { + Block block = b.getRelative(0, y, 0); + + if (block.getType() == Material.STONE) + continue; + + block.setType(Material.STONE); + block.setData((byte) 0); + blocks.add(block); + } + + // Set blocks for x + if ((maze[x][z] & 8) == 0) + { + for (int i = 1; i <= 2; i++) + { + for (int y = 0; y < 3; y++) + { + Block block = b.getRelative(i, y, 0); + + if (block.getType() == Material.STONE) + continue; + + block.setType(Material.STONE); + block.setData((byte) 0); + blocks.add(block); + } + } + + } + + // Set blocks for z + if ((maze[x][z] & 1) == 0) + { + for (int i = 1; i <= 2; i++) + { + for (int y = 0; y < 3; y++) + { + Block block = b.getRelative(0, y, i); + + if (block.getType() == Material.STONE) + continue; + + block.setType(Material.STONE); + block.setData((byte) 0); + blocks.add(block); + } + } + + } + } + } + + return blocks; + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengePickASide.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengePickASide.java new file mode 100644 index 000000000..b09cb2337 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengePickASide.java @@ -0,0 +1,193 @@ +package nautilus.game.arcade.game.games.mineware.challenges; + +import java.util.ArrayList; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilTextBottom; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import nautilus.game.arcade.game.games.mineware.Challenge; +import nautilus.game.arcade.game.games.mineware.MineWare; + +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.block.Block; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; + +public class ChallengePickASide extends Challenge +{ + private long _stageExpires; + private long _lastSound; + private boolean _isFalling; + + public ChallengePickASide(MineWare host) + { + super(host, ChallengeType.LastStanding, "Stand on the side with the least players! Don't be caught on the white blocks!"); + } + + public int getMinPlayers() + { + return 3; + } + + @Override + public ArrayList getSpawns() + { + ArrayList spawns = new ArrayList(); + + for (int x = -8; x <= 8; x++) + { + for (int z = -8; z <= 8; z++) + { + if (x % 2 == 0 && z % 2 == 0) + { + spawns.add(getCenter().clone().add(x + 0.5, 1.1, z + 0.5)); + } + } + } + + return spawns; + } + + @Override + public void cleanupRoom() + { + } + + @Override + public void setupPlayers() + { + setBorder(-10, 10, 0, 10, -10, 10); + } + + @EventHandler + public void OnTick(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + { + return; + } + + if (!Host.IsLive()) + { + return; + } + + Player[] players = getChallengers().toArray(new Player[0]); + + if (_stageExpires < System.currentTimeMillis()) + { + UtilTextBottom.displayProgress(0, players); + + if (_isFalling) + { + _isFalling = false; + _stageExpires = System.currentTimeMillis() + 1500; + } + else + { + _isFalling = true; + _stageExpires = System.currentTimeMillis() + 4000; + + ArrayList red = new ArrayList(); + ArrayList blue = new ArrayList(); + ArrayList misc = new ArrayList(); + + for (Player player : getChallengers()) + { + Location loc = player.getLocation(); + + while (loc.getBlockY() > 0 && loc.getBlock().getType() != Material.STAINED_CLAY) + { + loc.add(0, -1, 0); + } + + byte data = loc.getBlock().getType() == Material.STAINED_CLAY ? loc.getBlock().getData() : 0; + + if (data == 11) + { + red.add(player); + } + else if (data == 14) + { + blue.add(player); + } + else + { + misc.add(player); + } + } + + Host.Announce(C.cRed + "RED: " + red.size(), true); + Host.Announce(C.cRed + "BLUE: " + blue.size(), false); + + if (misc.size() > 0) + { + Host.Announce(C.cRed + "MISC: " + misc.size(), false); + } + + if (!red.isEmpty() && !blue.isEmpty()) + { + if (red.size() < blue.size()) + { + misc.addAll(blue); + } + else if (blue.size() < red.size()) + { + misc.addAll(red); + } + + for (Player player : misc) + { + setLost(player); + } + } + } + } + else if (!_isFalling) + { + UtilTextBottom.displayProgress((_stageExpires - System.currentTimeMillis()) / 8D, players); + + if (_lastSound < System.currentTimeMillis()) + { + _lastSound = System.currentTimeMillis() + 1000; + + for (Player player : UtilServer.getPlayers()) + player.playSound(player.getLocation(), Sound.NOTE_STICKS, 1f, 1f); + } + } + else + { + UtilTextBottom.displayProgress(0, players); + } + } + + @Override + public void generateRoom() + { + for (int x = -10; x <= 10; x++) + { + for (int z = -10; z <= 10; z++) + { + for (int y = 0; y <= 2; y++) + { + Block b = getCenter().getBlock().getRelative(x, y, z); + + if (y == 0 || Math.abs(x) == 10 || Math.abs(z) == 10) + { + if (y > 0 && Math.abs(z) != 10) + continue; + + b.setType(Material.STAINED_CLAY); + b.setData((byte) (z < 0 ? 11 : z > 0 ? 14 : 0)); + addBlock(b); + } + } + } + } + } + +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeShootChickens.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeShootChickens.java new file mode 100644 index 000000000..742949398 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeShootChickens.java @@ -0,0 +1,232 @@ +package nautilus.game.arcade.game.games.mineware.challenges; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilMath; +import mineplex.core.itemstack.ItemBuilder; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.game.games.mineware.Challenge; +import nautilus.game.arcade.game.games.mineware.MineWare; + +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.block.Block; +import org.bukkit.enchantments.Enchantment; +import org.bukkit.entity.Chicken; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.entity.Projectile; +import org.bukkit.event.EventHandler; +import org.bukkit.event.entity.EntityDeathEvent; +import org.bukkit.event.entity.ProjectileLaunchEvent; +import org.bukkit.inventory.ItemStack; + +public class ChallengeShootChickens extends Challenge +{ + private ArrayList _chickens = new ArrayList(); + private HashMap _killedChickens = new HashMap(); + private ArrayList _arrows = new ArrayList(); + + public ChallengeShootChickens(MineWare host) + { + super(host, ChallengeType.FirstComplete, "Shoot 6 chickens"); + } + + @Override + public void cleanupRoom() + { + for (Chicken chicken : _chickens) + { + chicken.remove(); + } + + for (Projectile arrow : _arrows) + { + arrow.remove(); + } + + Host.DamagePvE = false; + } + + @EventHandler + public void onShoot(ProjectileLaunchEvent event) + { + _arrows.add(event.getEntity()); + } + + @EventHandler + public void onDeath(EntityDeathEvent event) + { + event.getDrops().clear(); + event.setDroppedExp(0); + } + + @EventHandler + public void Damage(CustomDamageEvent event) + { + if (event.GetProjectile() == null) + { + event.SetCancelled("Not projectile damage"); + return; + } + + Player player = event.GetDamagerPlayer(true); + + if (player == null) + return; + + if (event.isCancelled()) + return; + + LivingEntity ent = event.GetDamageeEntity(); + + if (!_chickens.remove(ent)) + { + event.SetCancelled("Not a chicken"); + return; + } + + event.AddMod("Ensure Death", null, 10, false); + + int score = _killedChickens.get(player.getName()) + 1; + + Location sloc = player.getEyeLocation(); + sloc.add(UtilAlg.getTrajectory(sloc, ent.getEyeLocation()).multiply(Math.min(7, ent.getLocation().distance(sloc)))); + + displayCount(player, sloc, (score >= 6 ? C.cDGreen : score >= 4 ? C.cGreen : score >= 2 ? C.cRed : C.cDRed) + score); + + _killedChickens.put(player.getName(), score); + + if (score == 6) + { + SetCompleted(player); + } + } + + @EventHandler + public void onHalfSecond(UpdateEvent event) + { + if (!Host.IsLive()) + { + return; + } + + if (event.getType() != UpdateType.FAST) + { + return; + } + + Iterator itel = _chickens.iterator(); + + while (itel.hasNext()) + { + Chicken chicken = itel.next(); + + if (chicken.isOnGround() || !chicken.isValid()) + { + chicken.remove(); + itel.remove(); + } + } + + if (_chickens.size() < 13) + { + Location loc = getCenter().clone().add(UtilMath.r(20) - 10, 15, UtilMath.r(20) - 10); + + Host.CreatureAllowOverride = true; + Chicken chicken = (Chicken) loc.getWorld().spawnEntity(loc, EntityType.CHICKEN); + Host.CreatureAllowOverride = false; + chicken.setMaxHealth(0.1); + chicken.setHealth(0.1); + + _chickens.add(chicken); + } + } + + @Override + public void setupPlayers() + { + setBorder(-10, 10, 0, 10, -10, 10); + + for (Player player : Host.GetPlayers(true)) + { + player.getInventory().setItem(0, + new ItemBuilder(Material.BOW).addEnchantment(Enchantment.ARROW_INFINITE, 1).setUnbreakable(true).build()); + player.getInventory().setItem(9, new ItemStack(Material.ARROW)); + + _killedChickens.put(player.getName(), 0); + } + + Host.DamagePvE = true; + } + + @Override + public void generateRoom() + { + for (int x = -10; x <= 10; x++) + { + for (int z = -10; z <= 10; z++) + { + for (int y = 0; y <= 1; y++) + { + Block b = getCenter().getBlock().getRelative(x, y, z); + + if (y == 0) + { + b.setType(Material.GRASS); + } + else + { + if (Math.abs(x) == 10 || Math.abs(z) == 10) + { + b.setType(Material.FENCE); + } + else if (UtilMath.r(4) == 0) + { + if (UtilMath.r(8) == 0) + { + b.setType(UtilMath.random.nextBoolean() ? Material.YELLOW_FLOWER : Material.RED_ROSE); + } + else + { + b.setType(Material.LONG_GRASS); + b.setData((byte) 1); + } + } + } + + if (b.getType() != Material.AIR) + { + addBlock(b); + } + } + } + } + } + + @Override + public ArrayList getSpawns() + { + ArrayList spawns = new ArrayList(); + + for (int x = -8; x <= 8; x++) + { + for (int z = -8; z <= 8; z++) + { + if (x % 2 == 0 && z % 2 == 0) + { + spawns.add(getCenter().clone().add(x + 0.5, 1.1, z + 0.5)); + } + } + } + + return spawns; + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeStandOnColor.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeStandOnColor.java new file mode 100644 index 000000000..ce0e70068 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeStandOnColor.java @@ -0,0 +1,213 @@ +package nautilus.game.arcade.game.games.mineware.challenges; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map.Entry; + +import mineplex.core.common.util.UtilInv; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilTextBottom; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import nautilus.game.arcade.game.games.mineware.Challenge; +import nautilus.game.arcade.game.games.mineware.MineWare; + +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.block.Block; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.inventory.ItemStack; + +public class ChallengeStandOnColor extends Challenge +{ + private ArrayList _colors = new ArrayList(); + private int _currentColor; + private boolean _isFalling; + private long _lastSound; + private long _stageExpires; + private long _timeDelay = 5000; + + public ChallengeStandOnColor(MineWare host) + { + super(host, ChallengeType.LastStanding, "Stand on the correct color"); + + for (int i = 0; i <= 15; i++) + { + _colors.add(i); + } + + _colors.remove(new Integer(2)); + _colors.remove(new Integer(6)); + _colors.remove(new Integer(7)); + _colors.remove(new Integer(9)); + _colors.remove(new Integer(12)); + } + + @Override + public void cleanupRoom() + { + for (Player player : Host.GetPlayers(true)) + { + UtilInv.Clear(player); + } + } + + private void generateFloor() + { + ArrayList> cords = new ArrayList>(); + + int i = UtilMath.r(_colors.size()); + + for (int x = -4; x <= 4; x++) + { + for (int z = -4; z <= 4; z++) + { + cords.add(new HashMap.SimpleEntry(x * 2, z * 2)); + } + } + + Collections.shuffle(cords); + + for (Entry entry : cords) + { + byte color = (byte) (int) _colors.get(i++); + + if (i >= _colors.size()) + { + i = 0; + } + for (int x = 0; x <= 1; x++) + { + for (int z = 0; z <= 1; z++) + { + Block b = getCenter().getBlock().getRelative(entry.getKey() + x, 0, entry.getValue() + z); + + b.setTypeIdAndData(Material.STAINED_CLAY.getId(), color, false); + addBlock(b); + } + } + } + } + + @Override + public void generateRoom() + { + setBorder(-20, 20, 0, 10, -20, 20); + generateFloor(); + } + + @Override + public ArrayList getSpawns() + { + ArrayList spawns = new ArrayList(); + + for (int x = -7; x <= 7; x++) + { + for (int z = -7; z <= 7; z++) + { + if (x % 2 == 0 && z % 2 == 0) + { + spawns.add(getCenter().clone().add(x + 0.5, 1.1, z + 0.5)); + } + } + } + + return spawns; + } + + @EventHandler + public void OnTick(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + { + return; + } + + if (!Host.IsLive()) + { + return; + } + + Player[] players = getChallengers().toArray(new Player[0]); + + if (_stageExpires < System.currentTimeMillis()) + { + UtilTextBottom.displayProgress(0, players); + + if (_isFalling) + { + for (Player player : UtilServer.getPlayers()) + player.playSound(player.getLocation(), Sound.NOTE_PIANO, 2f, 0f); + + _timeDelay -= 800; + _isFalling = false; + _stageExpires = System.currentTimeMillis() + _timeDelay; + _currentColor = _colors.get(UtilMath.r(_colors.size())); + generateFloor(); + + for (Player player : getChallengers()) + { + for (int i = 0; i < 9; i++) + { + player.getInventory().setItem(i, new ItemStack(Material.STAINED_CLAY, 1, (short) _currentColor)); + } + } + } + else + { + _isFalling = true; + _stageExpires = System.currentTimeMillis() + 4000; + + for (int x = -8; x <= 9; x++) + { + for (int z = -8; z <= 9; z++) + { + Block b = getCenter().getBlock().getRelative(x, 0, z); + + if (b.getData() != _currentColor) + { + b.setTypeIdAndData(Material.AIR.getId(), (byte) 0, false); + addBlock(b); + } + } + } + } + } + else if (!_isFalling) + { + UtilTextBottom.displayProgress((_stageExpires - System.currentTimeMillis()) / (double) _timeDelay, players); + + if (_lastSound < System.currentTimeMillis()) + { + _lastSound = System.currentTimeMillis() + 1000; + + for (Player player : UtilServer.getPlayers()) + player.playSound(player.getLocation(), Sound.NOTE_STICKS, 1f, 1f); + } + } + else + { + UtilTextBottom.displayProgress(0, players); + } + } + + @Override + public void setupPlayers() + { + _stageExpires = System.currentTimeMillis() + _timeDelay; + _currentColor = _colors.get(UtilMath.r(_colors.size())); + + for (Player player : Host.GetPlayers(true)) + { + for (int i = 0; i < 9; i++) + { + player.getInventory().setItem(i, new ItemStack(Material.STAINED_CLAY, 1, (short) _currentColor)); + } + } + } + +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/MazeGenerator.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/MazeGenerator.java new file mode 100644 index 000000000..785911a54 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/MazeGenerator.java @@ -0,0 +1,104 @@ +package nautilus.game.arcade.game.games.mineware.challenges; + +import java.util.Arrays; +import java.util.Collections; + +/* + * recursive backtracking algorithm + * shamelessly borrowed from the ruby at + * http://weblog.jamisbuck.org/2010/12/27/maze-generation-recursive-backtracking + * + * This code taken from http://rosettacode.org/wiki/Maze_generation#Java + */ +public class MazeGenerator +{ + private final int x; + private final int y; + private final int[][] maze; + + public MazeGenerator(int x, int y) + { + this.x = x; + this.y = y; + maze = new int[this.x][this.y]; + generateMaze(0, 0); + } + + public int[][] getMaze() + { + return maze; + } + + public void display() + { + for (int i = 0; i < y; i++) + { + // draw the north edge + for (int j = 0; j < x; j++) + { + System.out.print((maze[j][i] & 1) == 0 ? "+---" : "+ "); + } + System.out.println("+"); + // draw the west edge + for (int j = 0; j < x; j++) + { + System.out.print((maze[j][i] & 8) == 0 ? "| " : " "); + } + System.out.println("|"); + } + // draw the bottom line + for (int j = 0; j < x; j++) + { + System.out.print("+---"); + } + System.out.println("+"); + } + + private void generateMaze(int cx, int cy) + { + DIR[] dirs = DIR.values(); + Collections.shuffle(Arrays.asList(dirs)); + for (DIR dir : dirs) + { + int nx = cx + dir.dx; + int ny = cy + dir.dy; + if (between(nx, x) && between(ny, y) && (maze[nx][ny] == 0)) + { + maze[cx][cy] |= dir.bit; + maze[nx][ny] |= dir.opposite.bit; + generateMaze(nx, ny); + } + } + } + + private boolean between(int v, int upper) + { + return (v >= 0) && (v < upper); + } + + private enum DIR + { + N(1, 0, -1), S(2, 0, 1), E(4, 1, 0), W(8, -1, 0); + private final int bit; + private final int dx; + private final int dy; + private DIR opposite; + + // use the static initializer to resolve forward references + static + { + N.opposite = S; + S.opposite = N; + E.opposite = W; + W.opposite = E; + } + + private DIR(int bit, int dx, int dy) + { + this.bit = bit; + this.dx = dx; + this.dy = dy; + } + }; + +} \ No newline at end of file diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/random/CraftLadder.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/random/CraftLadder.java deleted file mode 100644 index 2cb7ae54c..000000000 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/random/CraftLadder.java +++ /dev/null @@ -1,24 +0,0 @@ -package nautilus.game.arcade.game.games.mineware.random; - -import nautilus.game.arcade.game.games.mineware.MineWare; -import nautilus.game.arcade.game.games.mineware.order.OrderCraft; - -public class CraftLadder extends OrderCraft -{ - public CraftLadder(MineWare host) - { - super(host, "Craft some ladders", 65, -1, 1); - } - - @Override - public void Initialize() - { - - } - - @Override - public void Uninitialize() - { - - } -} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/random/CraftStoneShovel.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/random/CraftStoneShovel.java deleted file mode 100644 index 7c587446d..000000000 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/random/CraftStoneShovel.java +++ /dev/null @@ -1,24 +0,0 @@ -package nautilus.game.arcade.game.games.mineware.random; - -import nautilus.game.arcade.game.games.mineware.MineWare; -import nautilus.game.arcade.game.games.mineware.order.OrderCraft; - -public class CraftStoneShovel extends OrderCraft -{ - public CraftStoneShovel(MineWare host) - { - super(host, "Craft a stone shovel", 273, -1, 1); - } - - @Override - public void Initialize() - { - - } - - @Override - public void Uninitialize() - { - - } -} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/random/GatherCobble.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/random/GatherCobble.java deleted file mode 100644 index 06d8ad584..000000000 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/random/GatherCobble.java +++ /dev/null @@ -1,24 +0,0 @@ -package nautilus.game.arcade.game.games.mineware.random; - -import nautilus.game.arcade.game.games.mineware.MineWare; -import nautilus.game.arcade.game.games.mineware.order.OrderGather; - -public class GatherCobble extends OrderGather -{ - public GatherCobble(MineWare host) - { - super(host, "Pick up 10 Cobblestone", 4, -1, 10); - } - - @Override - public void Initialize() - { - - } - - @Override - public void Uninitialize() - { - - } -} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/random/GatherRedFlower.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/random/GatherRedFlower.java deleted file mode 100644 index 9a54ffd62..000000000 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/random/GatherRedFlower.java +++ /dev/null @@ -1,24 +0,0 @@ -package nautilus.game.arcade.game.games.mineware.random; - -import nautilus.game.arcade.game.games.mineware.MineWare; -import nautilus.game.arcade.game.games.mineware.order.OrderGather; - -public class GatherRedFlower extends OrderGather -{ - public GatherRedFlower(MineWare host) - { - super(host, "Pick 3 Red Roses", 38, -1, 3); - } - - @Override - public void Initialize() - { - - } - - @Override - public void Uninitialize() - { - - } -} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/random/GatherSand.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/random/GatherSand.java deleted file mode 100644 index 64f0fb9b3..000000000 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/random/GatherSand.java +++ /dev/null @@ -1,24 +0,0 @@ -package nautilus.game.arcade.game.games.mineware.random; - -import nautilus.game.arcade.game.games.mineware.MineWare; -import nautilus.game.arcade.game.games.mineware.order.OrderGather; - -public class GatherSand extends OrderGather -{ - public GatherSand(MineWare host) - { - super(host, "Pick up 16 Sand", 12, -1, 16); - } - - @Override - public void Initialize() - { - - } - - @Override - public void Uninitialize() - { - - } -} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/random/GatherYellowFlower.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/random/GatherYellowFlower.java deleted file mode 100644 index 66b3dc2f9..000000000 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/random/GatherYellowFlower.java +++ /dev/null @@ -1,24 +0,0 @@ -package nautilus.game.arcade.game.games.mineware.random; - -import nautilus.game.arcade.game.games.mineware.MineWare; -import nautilus.game.arcade.game.games.mineware.order.OrderGather; - -public class GatherYellowFlower extends OrderGather -{ - public GatherYellowFlower(MineWare host) - { - super(host, "Pick 4 Yellow Flowers", 37, -1, 4); - } - - @Override - public void Initialize() - { - - } - - @Override - public void Uninitialize() - { - - } -} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/random/PlaceDoor.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/random/PlaceDoor.java deleted file mode 100644 index 9f768220e..000000000 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/random/PlaceDoor.java +++ /dev/null @@ -1,24 +0,0 @@ -package nautilus.game.arcade.game.games.mineware.random; - -import nautilus.game.arcade.game.games.mineware.MineWare; -import nautilus.game.arcade.game.games.mineware.order.OrderPlace; - -public class PlaceDoor extends OrderPlace -{ - public PlaceDoor(MineWare host) - { - super(host, "Place a wooden door", 64, -1, 1); - } - - @Override - public void Initialize() - { - - } - - @Override - public void Uninitialize() - { - - } -} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/oldmineware/OldMineWare.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/oldmineware/OldMineWare.java new file mode 100644 index 000000000..919e9de19 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/oldmineware/OldMineWare.java @@ -0,0 +1,352 @@ +package nautilus.game.arcade.game.games.oldmineware; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; + +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.Chicken; +import org.bukkit.entity.Cow; +import org.bukkit.entity.Creature; +import org.bukkit.entity.Ghast; +import org.bukkit.entity.Pig; +import org.bukkit.entity.Player; +import org.bukkit.entity.Sheep; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.HandlerList; +import org.bukkit.event.entity.EntityTargetEvent; +import org.bukkit.event.player.PlayerDropItemEvent; +import org.bukkit.util.Vector; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilTime; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.GameType; +import nautilus.game.arcade.events.GameStateChangeEvent; +import nautilus.game.arcade.game.SoloGame; +import nautilus.game.arcade.game.games.oldmineware.order.Order; +import nautilus.game.arcade.game.games.oldmineware.random.*; +import nautilus.game.arcade.game.games.runner.kits.KitLeaper; +import nautilus.game.arcade.kit.Kit; + +public class OldMineWare extends SoloGame +{ + private HashMap _lives = new HashMap(); + + private Order _order = null; + private long _orderTime = 0; + private int _orderCount = 0; + + private ArrayList _orders = new ArrayList(); + private ArrayList _ordersCopy = new ArrayList(); + + private Location _ghastLoc = null; + private Location _ghastTarget = null; + private Ghast _ghast = null; + private ArrayList _mobLocs = new ArrayList(); + private ArrayList _mobs = new ArrayList(); + + public OldMineWare(ArcadeManager manager) + { + super(manager, GameType.OldMineWare, + + new Kit[] + { + new KitLeaper(manager), + }, + + new String[] + { + "Follow the orders given in chat!", + "First half to follow it win the round.", + "Other players lose one life.", + "Last player with lives wins!" + }); + + this.PrepareFreeze = false; + + this.DamagePvP = false; + + this.BlockPlace = true; + this.BlockBreak = true; + + this.ItemDrop = true; + this.ItemPickup = true; + + InventoryOpenBlock = true; + InventoryOpenChest = true; + InventoryClick = true; + + PopulateOrders(); + } + + @Override + public void ParseData() + { + _ghastLoc = WorldData.GetDataLocs("WHITE").get(0); + + while (_mobLocs.size() < 100) + { + Location loc = WorldData.GetRandomXZ(); + + while (UtilBlock.airFoliage(loc.getBlock())) + loc.add(0, -1, 0); + + Material mat = loc.getBlock().getType(); + + if (mat == Material.STONE || + mat == Material.GRASS || + mat == Material.SAND) + _mobLocs.add(loc); + } + } + + public void PopulateOrders() + { + _orders.add(new ActionMilkCow(this)); + _orders.add(new ActionShearSheep(this)); + + _orders.add(new CraftLadder(this)); + _orders.add(new CraftStoneShovel(this)); + + _orders.add(new DamageChicken(this)); + _orders.add(new DamageFall(this)); + _orders.add(new DamageGhast(this)); + + _orders.add(new GatherCobble(this)); + _orders.add(new GatherRedFlower(this)); + _orders.add(new GatherYellowFlower(this)); + _orders.add(new GatherSand(this)); + + _orders.add(new PlaceDoor(this)); + + _orders.add(new RideBoat(this)); + _orders.add(new RidePig(this)); + + _orders.add(new StandAlone(this)); + _orders.add(new StandShelter(this)); + _orders.add(new StandStone(this)); + _orders.add(new StandWater(this)); + } + + public Order GetOrder() + { + if (_ordersCopy.isEmpty()) + { + for (Order order : _orders) + { + _ordersCopy.add(order); + } + } + + return _ordersCopy.remove(UtilMath.r(_ordersCopy.size())); + } + + @EventHandler(priority = EventPriority.HIGH) + public void GameStateChange(GameStateChangeEvent event) + { + if (event.GetState() != GameState.Prepare) + return; + + for (Player player : GetPlayers(true)) + _lives.put(player, 10); + } + + @EventHandler + public void UpdateOrder(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + if (!IsLive()) + return; + + //New Order + if (_order == null) + { + if (!UtilTime.elapsed(_orderTime, 1000)) + return; + + _order = GetOrder(); + + if (_order == null) + { + SetState(GameState.Dead); + return; + } + + //Register + UtilServer.getServer().getPluginManager().registerEvents(_order, Manager.getPlugin()); + _order.StartOrder(_orderCount++); + + Announce(C.cYellow + C.Bold + _order.GetOrder().toUpperCase()); + + /* XXX + GetObjectiveSide().setDisplayName( + ChatColor.WHITE + "§lMineWare " + C.cGreen + "§l" + + "Round " + _orderCount); + */ + } + //Update Order + else + { + if (_order.Finish()) + { + _orderTime = System.currentTimeMillis(); + + if (_order.PlayerHasCompleted()) + { + for (Player player : GetPlayers(true)) + { + if (!_order.IsCompleted(player)) + { + LoseLife(player); + + if (IsAlive(player)) + _order.FailItems(player); + } + } + } + + + //Deregister + HandlerList.unregisterAll(_order); + _order.EndOrder(); + _order = null; + } + else + { + //Set Level + for (Player player : UtilServer.getPlayers()) + { + player.setLevel(_order.GetRemainingPlaces()); + player.setExp(_order.GetTimeLeftPercent()); + } + } + } + } + + private int GetLives(Player player) + { + if (!_lives.containsKey(player)) + return 0; + + if (!IsAlive(player)) + return 0; + + return _lives.get(player); + } + + private void LoseLife(Player player) + { + int lives = GetLives(player) - 1; + + if (lives > 0) + { + UtilPlayer.message(player, C.cRed + C.Bold + "You failed the task!"); + UtilPlayer.message(player, C.cRed + C.Bold + "You have " + lives + " lives left!"); + player.playSound(player.getLocation(), Sound.NOTE_BASS_GUITAR, 2f, 0.5f); + + _lives.put(player, lives); + } + else + { + UtilPlayer.message(player, C.cRed + C.Bold + "You are out of the game!"); + player.playSound(player.getLocation(), Sound.EXPLODE, 2f, 1f); + + player.damage(5000); + + Scoreboard.ResetScore(player.getName()); + } + } + + @EventHandler + public void UpdateMobs(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + return; + + if (!InProgress()) + return; + + Iterator mobIterator = _mobs.iterator(); + + while (mobIterator.hasNext()) + { + Creature mob = mobIterator.next(); + + if (!mob.isValid()) + { + mob.remove(); + mobIterator.remove(); + } + } + + if (_mobs.size() < 200) + { + Location loc = _mobLocs.get(UtilMath.r(_mobLocs.size())).clone().add(new Vector(0.5,1,0.5)); + double r = Math.random(); + + this.CreatureAllowOverride = true; + + if (r > 0.75) _mobs.add(loc.getWorld().spawn(loc, Pig.class)); + else if (r > 0.5) _mobs.add(loc.getWorld().spawn(loc, Cow.class)); + else if (r > 0.25) _mobs.add(loc.getWorld().spawn(loc, Chicken.class)); + else _mobs.add(loc.getWorld().spawn(loc, Sheep.class)); + + this.CreatureAllowOverride = false; + } + + if (_ghast == null || !_ghast.isValid()) + { + if (_ghast != null) + _ghast.remove(); + + this.CreatureAllowOverride = true; + _ghast = _ghastLoc.getWorld().spawn(_ghastLoc, Ghast.class); + this.CreatureAllowOverride = false; + + _ghast.setMaxHealth(10000); + _ghast.setHealth(_ghast.getMaxHealth()); + } + else + { + //New Target + if (_ghastTarget == null || UtilMath.offset(_ghast.getLocation(), _ghastTarget) < 5) + { + _ghastTarget = _ghastLoc.clone().add(40 - 80*Math.random(), -20*Math.random(), 40 - 80*Math.random()); + } + + _ghast.teleport(_ghast.getLocation().add(UtilAlg.getTrajectory(_ghast.getLocation(), _ghastTarget).multiply(0.1))); + } + } + + @EventHandler + public void GhastTarget(EntityTargetEvent event) + { + if (event.getEntity().equals(_ghast)) + event.setCancelled(true); + } + + @Override + public int GetScoreboardScore(Player player) + { + return GetLives(player); + } + + @EventHandler + public void ItemDrop(PlayerDropItemEvent event) + { + event.getItemDrop().remove(); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/order/Order.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/oldmineware/order/Order.java similarity index 91% rename from Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/order/Order.java rename to Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/oldmineware/order/Order.java index d1802065c..a3bc65606 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/order/Order.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/oldmineware/order/Order.java @@ -1,11 +1,11 @@ -package nautilus.game.arcade.game.games.mineware.order; +package nautilus.game.arcade.game.games.oldmineware.order; import java.util.HashSet; import mineplex.core.common.util.C; import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilTime; -import nautilus.game.arcade.game.games.mineware.MineWare; +import nautilus.game.arcade.game.games.oldmineware.OldMineWare; import org.bukkit.Sound; import org.bukkit.entity.Player; @@ -13,7 +13,7 @@ import org.bukkit.event.Listener; public abstract class Order implements Listener { - public MineWare Host; + public OldMineWare Host; private String _order; @@ -22,7 +22,7 @@ public abstract class Order implements Listener private HashSet _completed = new HashSet(); - public Order(MineWare host, String order) + public Order(OldMineWare host, String order) { Host = host; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/order/OrderCraft.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/oldmineware/order/OrderCraft.java similarity index 91% rename from Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/order/OrderCraft.java rename to Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/oldmineware/order/OrderCraft.java index 30c1e3530..5f1186993 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/order/OrderCraft.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/oldmineware/order/OrderCraft.java @@ -1,10 +1,10 @@ -package nautilus.game.arcade.game.games.mineware.order; +package nautilus.game.arcade.game.games.oldmineware.order; import java.util.HashMap; import mineplex.core.common.util.UtilInv; import mineplex.core.itemstack.ItemStackFactory; -import nautilus.game.arcade.game.games.mineware.MineWare; +import nautilus.game.arcade.game.games.oldmineware.OldMineWare; import org.bukkit.Material; import org.bukkit.Sound; @@ -23,7 +23,7 @@ public abstract class OrderCraft extends Order private byte _data; private int _req; - public OrderCraft(MineWare host, String order, int id, int data, int required) + public OrderCraft(OldMineWare host, String order, int id, int data, int required) { super(host, order); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/order/OrderGather.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/oldmineware/order/OrderGather.java similarity index 88% rename from Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/order/OrderGather.java rename to Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/oldmineware/order/OrderGather.java index 18a4712bf..1ed1a32fc 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/order/OrderGather.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/oldmineware/order/OrderGather.java @@ -1,10 +1,10 @@ -package nautilus.game.arcade.game.games.mineware.order; +package nautilus.game.arcade.game.games.oldmineware.order; import java.util.HashMap; import mineplex.core.common.util.UtilInv; import mineplex.core.itemstack.ItemStackFactory; -import nautilus.game.arcade.game.games.mineware.MineWare; +import nautilus.game.arcade.game.games.oldmineware.OldMineWare; import org.bukkit.Sound; import org.bukkit.entity.Player; @@ -19,7 +19,7 @@ public abstract class OrderGather extends Order private byte _data; private int _req; - public OrderGather(MineWare host, String order, int id, int data, int required) + public OrderGather(OldMineWare host, String order, int id, int data, int required) { super(host, order); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/order/OrderPlace.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/oldmineware/order/OrderPlace.java similarity index 86% rename from Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/order/OrderPlace.java rename to Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/oldmineware/order/OrderPlace.java index db0991c84..89e24c25f 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/order/OrderPlace.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/oldmineware/order/OrderPlace.java @@ -1,8 +1,8 @@ -package nautilus.game.arcade.game.games.mineware.order; +package nautilus.game.arcade.game.games.oldmineware.order; import java.util.HashMap; -import nautilus.game.arcade.game.games.mineware.MineWare; +import nautilus.game.arcade.game.games.oldmineware.OldMineWare; import org.bukkit.Sound; import org.bukkit.entity.Player; @@ -17,7 +17,7 @@ public abstract class OrderPlace extends Order private byte _data; private int _req; - public OrderPlace(MineWare host, String order, int id, int data, int required) + public OrderPlace(OldMineWare host, String order, int id, int data, int required) { super(host, order); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/random/ActionMilkCow.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/oldmineware/random/ActionMilkCow.java similarity index 80% rename from Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/random/ActionMilkCow.java rename to Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/oldmineware/random/ActionMilkCow.java index 8c3f99904..ac6a1cc84 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/random/ActionMilkCow.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/oldmineware/random/ActionMilkCow.java @@ -1,4 +1,4 @@ -package nautilus.game.arcade.game.games.mineware.random; +package nautilus.game.arcade.game.games.oldmineware.random; import org.bukkit.Material; import org.bukkit.entity.Cow; @@ -8,12 +8,12 @@ import org.bukkit.event.player.PlayerInteractEntityEvent; import org.bukkit.inventory.ItemStack; import mineplex.core.common.util.UtilGear; -import nautilus.game.arcade.game.games.mineware.MineWare; -import nautilus.game.arcade.game.games.mineware.order.Order; +import nautilus.game.arcade.game.games.oldmineware.OldMineWare; +import nautilus.game.arcade.game.games.oldmineware.order.Order; public class ActionMilkCow extends Order { - public ActionMilkCow(MineWare host) + public ActionMilkCow(OldMineWare host) { super(host, "milk a cow"); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/random/ActionShearSheep.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/oldmineware/random/ActionShearSheep.java similarity index 75% rename from Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/random/ActionShearSheep.java rename to Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/oldmineware/random/ActionShearSheep.java index 0dcd3e13f..ff8f55fbf 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/random/ActionShearSheep.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/oldmineware/random/ActionShearSheep.java @@ -1,4 +1,4 @@ -package nautilus.game.arcade.game.games.mineware.random; +package nautilus.game.arcade.game.games.oldmineware.random; import org.bukkit.Material; import org.bukkit.entity.Player; @@ -6,12 +6,12 @@ import org.bukkit.event.EventHandler; import org.bukkit.event.player.PlayerShearEntityEvent; import org.bukkit.inventory.ItemStack; -import nautilus.game.arcade.game.games.mineware.MineWare; -import nautilus.game.arcade.game.games.mineware.order.Order; +import nautilus.game.arcade.game.games.oldmineware.OldMineWare; +import nautilus.game.arcade.game.games.oldmineware.order.Order; public class ActionShearSheep extends Order { - public ActionShearSheep(MineWare host) + public ActionShearSheep(OldMineWare host) { super(host, "shear a sheep"); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/oldmineware/random/CraftLadder.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/oldmineware/random/CraftLadder.java new file mode 100644 index 000000000..de3423cf5 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/oldmineware/random/CraftLadder.java @@ -0,0 +1,24 @@ +package nautilus.game.arcade.game.games.oldmineware.random; + +import nautilus.game.arcade.game.games.oldmineware.OldMineWare; +import nautilus.game.arcade.game.games.oldmineware.order.OrderCraft; + +public class CraftLadder extends OrderCraft +{ + public CraftLadder(OldMineWare host) + { + super(host, "Craft some ladders", 65, -1, 1); + } + + @Override + public void Initialize() + { + + } + + @Override + public void Uninitialize() + { + + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/oldmineware/random/CraftStoneShovel.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/oldmineware/random/CraftStoneShovel.java new file mode 100644 index 000000000..67bb917d7 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/oldmineware/random/CraftStoneShovel.java @@ -0,0 +1,24 @@ +package nautilus.game.arcade.game.games.oldmineware.random; + +import nautilus.game.arcade.game.games.oldmineware.OldMineWare; +import nautilus.game.arcade.game.games.oldmineware.order.OrderCraft; + +public class CraftStoneShovel extends OrderCraft +{ + public CraftStoneShovel(OldMineWare host) + { + super(host, "Craft a stone shovel", 273, -1, 1); + } + + @Override + public void Initialize() + { + + } + + @Override + public void Uninitialize() + { + + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/random/DamageChicken.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/oldmineware/random/DamageChicken.java similarity index 79% rename from Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/random/DamageChicken.java rename to Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/oldmineware/random/DamageChicken.java index 26182e868..c5020a63c 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/random/DamageChicken.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/oldmineware/random/DamageChicken.java @@ -1,4 +1,4 @@ -package nautilus.game.arcade.game.games.mineware.random; +package nautilus.game.arcade.game.games.oldmineware.random; import org.bukkit.entity.Chicken; import org.bukkit.entity.LivingEntity; @@ -7,12 +7,12 @@ import org.bukkit.event.EventHandler; import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import mineplex.minecraft.game.core.damage.CustomDamageEvent; -import nautilus.game.arcade.game.games.mineware.MineWare; -import nautilus.game.arcade.game.games.mineware.order.Order; +import nautilus.game.arcade.game.games.oldmineware.OldMineWare; +import nautilus.game.arcade.game.games.oldmineware.order.Order; public class DamageChicken extends Order { - public DamageChicken(MineWare host) + public DamageChicken(OldMineWare host) { super(host, "punch a chicken"); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/random/DamageFall.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/oldmineware/random/DamageFall.java similarity index 74% rename from Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/random/DamageFall.java rename to Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/oldmineware/random/DamageFall.java index 6a700de8b..3e9a667a3 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/random/DamageFall.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/oldmineware/random/DamageFall.java @@ -1,16 +1,16 @@ -package nautilus.game.arcade.game.games.mineware.random; +package nautilus.game.arcade.game.games.oldmineware.random; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import mineplex.minecraft.game.core.damage.CustomDamageEvent; -import nautilus.game.arcade.game.games.mineware.MineWare; -import nautilus.game.arcade.game.games.mineware.order.Order; +import nautilus.game.arcade.game.games.oldmineware.OldMineWare; +import nautilus.game.arcade.game.games.oldmineware.order.Order; public class DamageFall extends Order { - public DamageFall(MineWare host) + public DamageFall(OldMineWare host) { super(host, "Take fall damage"); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/random/DamageGhast.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/oldmineware/random/DamageGhast.java similarity index 86% rename from Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/random/DamageGhast.java rename to Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/oldmineware/random/DamageGhast.java index 1ec28a023..1f0b34531 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/random/DamageGhast.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/oldmineware/random/DamageGhast.java @@ -1,4 +1,4 @@ -package nautilus.game.arcade.game.games.mineware.random; +package nautilus.game.arcade.game.games.oldmineware.random; import org.bukkit.Material; import org.bukkit.entity.Ghast; @@ -11,12 +11,12 @@ import org.bukkit.inventory.ItemStack; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent; -import nautilus.game.arcade.game.games.mineware.MineWare; -import nautilus.game.arcade.game.games.mineware.order.Order; +import nautilus.game.arcade.game.games.oldmineware.OldMineWare; +import nautilus.game.arcade.game.games.oldmineware.order.Order; public class DamageGhast extends Order { - public DamageGhast(MineWare host) + public DamageGhast(OldMineWare host) { super(host, "shoot the ghast"); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/oldmineware/random/GatherCobble.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/oldmineware/random/GatherCobble.java new file mode 100644 index 000000000..f0ad7c488 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/oldmineware/random/GatherCobble.java @@ -0,0 +1,24 @@ +package nautilus.game.arcade.game.games.oldmineware.random; + +import nautilus.game.arcade.game.games.oldmineware.OldMineWare; +import nautilus.game.arcade.game.games.oldmineware.order.OrderGather; + +public class GatherCobble extends OrderGather +{ + public GatherCobble(OldMineWare host) + { + super(host, "Pick up 10 Cobblestone", 4, -1, 10); + } + + @Override + public void Initialize() + { + + } + + @Override + public void Uninitialize() + { + + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/oldmineware/random/GatherRedFlower.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/oldmineware/random/GatherRedFlower.java new file mode 100644 index 000000000..95f6cc716 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/oldmineware/random/GatherRedFlower.java @@ -0,0 +1,24 @@ +package nautilus.game.arcade.game.games.oldmineware.random; + +import nautilus.game.arcade.game.games.oldmineware.OldMineWare; +import nautilus.game.arcade.game.games.oldmineware.order.OrderGather; + +public class GatherRedFlower extends OrderGather +{ + public GatherRedFlower(OldMineWare host) + { + super(host, "Pick 3 Red Roses", 38, -1, 3); + } + + @Override + public void Initialize() + { + + } + + @Override + public void Uninitialize() + { + + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/oldmineware/random/GatherSand.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/oldmineware/random/GatherSand.java new file mode 100644 index 000000000..440410865 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/oldmineware/random/GatherSand.java @@ -0,0 +1,24 @@ +package nautilus.game.arcade.game.games.oldmineware.random; + +import nautilus.game.arcade.game.games.oldmineware.OldMineWare; +import nautilus.game.arcade.game.games.oldmineware.order.OrderGather; + +public class GatherSand extends OrderGather +{ + public GatherSand(OldMineWare host) + { + super(host, "Pick up 16 Sand", 12, -1, 16); + } + + @Override + public void Initialize() + { + + } + + @Override + public void Uninitialize() + { + + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/oldmineware/random/GatherYellowFlower.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/oldmineware/random/GatherYellowFlower.java new file mode 100644 index 000000000..09f86376d --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/oldmineware/random/GatherYellowFlower.java @@ -0,0 +1,24 @@ +package nautilus.game.arcade.game.games.oldmineware.random; + +import nautilus.game.arcade.game.games.oldmineware.OldMineWare; +import nautilus.game.arcade.game.games.oldmineware.order.OrderGather; + +public class GatherYellowFlower extends OrderGather +{ + public GatherYellowFlower(OldMineWare host) + { + super(host, "Pick 4 Yellow Flowers", 37, -1, 4); + } + + @Override + public void Initialize() + { + + } + + @Override + public void Uninitialize() + { + + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/oldmineware/random/PlaceDoor.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/oldmineware/random/PlaceDoor.java new file mode 100644 index 000000000..de267c011 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/oldmineware/random/PlaceDoor.java @@ -0,0 +1,24 @@ +package nautilus.game.arcade.game.games.oldmineware.random; + +import nautilus.game.arcade.game.games.oldmineware.OldMineWare; +import nautilus.game.arcade.game.games.oldmineware.order.OrderPlace; + +public class PlaceDoor extends OrderPlace +{ + public PlaceDoor(OldMineWare host) + { + super(host, "Place a wooden door", 64, -1, 1); + } + + @Override + public void Initialize() + { + + } + + @Override + public void Uninitialize() + { + + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/random/RideBoat.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/oldmineware/random/RideBoat.java similarity index 75% rename from Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/random/RideBoat.java rename to Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/oldmineware/random/RideBoat.java index 42bb40d82..407c0e45b 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/random/RideBoat.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/oldmineware/random/RideBoat.java @@ -1,4 +1,4 @@ -package nautilus.game.arcade.game.games.mineware.random; +package nautilus.game.arcade.game.games.oldmineware.random; import org.bukkit.entity.Boat; import org.bukkit.entity.Player; @@ -6,12 +6,12 @@ import org.bukkit.event.EventHandler; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; -import nautilus.game.arcade.game.games.mineware.MineWare; -import nautilus.game.arcade.game.games.mineware.order.Order; +import nautilus.game.arcade.game.games.oldmineware.OldMineWare; +import nautilus.game.arcade.game.games.oldmineware.order.Order; public class RideBoat extends Order { - public RideBoat(MineWare host) + public RideBoat(OldMineWare host) { super(host, "Sit in a Boat"); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/random/RidePig.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/oldmineware/random/RidePig.java similarity index 80% rename from Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/random/RidePig.java rename to Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/oldmineware/random/RidePig.java index 8b737287a..2211166a6 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/random/RidePig.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/oldmineware/random/RidePig.java @@ -1,4 +1,4 @@ -package nautilus.game.arcade.game.games.mineware.random; +package nautilus.game.arcade.game.games.oldmineware.random; import org.bukkit.Material; import org.bukkit.entity.Pig; @@ -8,12 +8,12 @@ import org.bukkit.inventory.ItemStack; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; -import nautilus.game.arcade.game.games.mineware.MineWare; -import nautilus.game.arcade.game.games.mineware.order.Order; +import nautilus.game.arcade.game.games.oldmineware.OldMineWare; +import nautilus.game.arcade.game.games.oldmineware.order.Order; public class RidePig extends Order { - public RidePig(MineWare host) + public RidePig(OldMineWare host) { super(host, "ride a pig"); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/random/StandAlone.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/oldmineware/random/StandAlone.java similarity index 79% rename from Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/random/StandAlone.java rename to Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/oldmineware/random/StandAlone.java index b568c9e24..ec6458c0f 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/random/StandAlone.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/oldmineware/random/StandAlone.java @@ -1,4 +1,4 @@ -package nautilus.game.arcade.game.games.mineware.random; +package nautilus.game.arcade.game.games.oldmineware.random; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; @@ -6,12 +6,12 @@ import org.bukkit.event.EventHandler; import mineplex.core.common.util.UtilMath; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; -import nautilus.game.arcade.game.games.mineware.MineWare; -import nautilus.game.arcade.game.games.mineware.order.Order; +import nautilus.game.arcade.game.games.oldmineware.OldMineWare; +import nautilus.game.arcade.game.games.oldmineware.order.Order; public class StandAlone extends Order { - public StandAlone(MineWare host) + public StandAlone(OldMineWare host) { super(host, "Run away from everyone"); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/random/StandShelter.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/oldmineware/random/StandShelter.java similarity index 81% rename from Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/random/StandShelter.java rename to Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/oldmineware/random/StandShelter.java index ce0c3cdca..5197f1ebf 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/random/StandShelter.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/oldmineware/random/StandShelter.java @@ -1,4 +1,4 @@ -package nautilus.game.arcade.game.games.mineware.random; +package nautilus.game.arcade.game.games.oldmineware.random; import org.bukkit.block.Block; import org.bukkit.block.BlockFace; @@ -7,12 +7,12 @@ import org.bukkit.event.EventHandler; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; -import nautilus.game.arcade.game.games.mineware.MineWare; -import nautilus.game.arcade.game.games.mineware.order.Order; +import nautilus.game.arcade.game.games.oldmineware.OldMineWare; +import nautilus.game.arcade.game.games.oldmineware.order.Order; public class StandShelter extends Order { - public StandShelter(MineWare host) + public StandShelter(OldMineWare host) { super(host, "take shelter from rain"); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/random/StandStone.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/oldmineware/random/StandStone.java similarity index 76% rename from Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/random/StandStone.java rename to Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/oldmineware/random/StandStone.java index e88e9df61..abc09c80e 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/random/StandStone.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/oldmineware/random/StandStone.java @@ -1,4 +1,4 @@ -package nautilus.game.arcade.game.games.mineware.random; +package nautilus.game.arcade.game.games.oldmineware.random; import org.bukkit.Material; import org.bukkit.block.BlockFace; @@ -7,12 +7,12 @@ import org.bukkit.event.EventHandler; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; -import nautilus.game.arcade.game.games.mineware.MineWare; -import nautilus.game.arcade.game.games.mineware.order.Order; +import nautilus.game.arcade.game.games.oldmineware.OldMineWare; +import nautilus.game.arcade.game.games.oldmineware.order.Order; public class StandStone extends Order { - public StandStone(MineWare host) + public StandStone(OldMineWare host) { super(host, "Stand on stone"); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/random/StandWater.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/oldmineware/random/StandWater.java similarity index 73% rename from Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/random/StandWater.java rename to Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/oldmineware/random/StandWater.java index 69d7e2706..3ffafc56e 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/random/StandWater.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/oldmineware/random/StandWater.java @@ -1,16 +1,16 @@ -package nautilus.game.arcade.game.games.mineware.random; +package nautilus.game.arcade.game.games.oldmineware.random; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; -import nautilus.game.arcade.game.games.mineware.MineWare; -import nautilus.game.arcade.game.games.mineware.order.Order; +import nautilus.game.arcade.game.games.oldmineware.OldMineWare; +import nautilus.game.arcade.game.games.oldmineware.order.Order; public class StandWater extends Order { - public StandWater(MineWare host) + public StandWater(OldMineWare host) { super(host, "Go for a swim"); } From 1f08c989b50685e93670dcd06f19537ca073d105 Mon Sep 17 00:00:00 2001 From: libraryaddict Date: Tue, 9 Jun 2015 03:31:24 +1200 Subject: [PATCH 15/17] Minestrike: Enforce resource pack --- .../Nautilus.Game.Arcade/src/nautilus/game/arcade/GameType.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 a0042c0da..28d79a4b5 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/GameType.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/GameType.java @@ -83,7 +83,7 @@ public enum GameType Horse(Horse.class, "Horseback", Material.IRON_BARDING, (byte)0, GameCategory.ARCADE, 21), Micro(Micro.class, "Micro Battle", Material.LAVA_BUCKET, (byte)0, GameCategory.ARCADE, 24), MilkCow(MilkCow.class, "Milk the Cow", Material.MILK_BUCKET, (byte)0, GameCategory.ARCADE, 27), - MineStrike(MineStrike.class, "MineStrike", Material.TNT, (byte)0, GameCategory.CLASSICS, 25, "http://chivebox.com/file/c/assets.zip", false), + MineStrike(MineStrike.class, "MineStrike", Material.TNT, (byte)0, GameCategory.CLASSICS, 25, "http://chivebox.com/file/c/assets.zip", true), MineWare(MineWare.class, "MineWare", Material.PAPER, (byte)0, GameCategory.EXTRA, 26), OldMineWare(OldMineWare.class, "Old MineWare", Material.PAPER, (byte)0, GameCategory.EXTRA, 26), Paintball(Paintball.class, "Super Paintball", Material.ENDER_PEARL, (byte)0, GameCategory.ARCADE, 28), From 2971761a5e7fb5d118e8b82218a08679ea9302a1 Mon Sep 17 00:00:00 2001 From: libraryaddict Date: Tue, 9 Jun 2015 22:19:03 +1200 Subject: [PATCH 16/17] Game stop command: Move unregister of game listener after the gamestate has been changed --- .../src/nautilus/game/arcade/command/StopCommand.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/command/StopCommand.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/command/StopCommand.java index 13fa1b5f5..2f09c66bf 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/command/StopCommand.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/command/StopCommand.java @@ -22,8 +22,6 @@ public class StopCommand extends CommandBase if (Plugin.GetGame() == null) return; - HandlerList.unregisterAll(Plugin.GetGame()); - if (Plugin.GetGame().GetState() == GameState.End || Plugin.GetGame().GetState() == GameState.End) { caller.sendMessage("Game is already ending..."); @@ -38,6 +36,7 @@ public class StopCommand extends CommandBase Plugin.GetGame().SetState(GameState.End); } + HandlerList.unregisterAll(Plugin.GetGame()); Plugin.GetGame().Announce(C.cAqua + C.Bold + caller.getName() + " has stopped the game."); } From 37c6593753400db862a3da152af09dc9944d7142 Mon Sep 17 00:00:00 2001 From: libraryaddict Date: Wed, 10 Jun 2015 05:27:19 +1200 Subject: [PATCH 17/17] Hub: Fix rulebook --- .../src/mineplex/hub/HubManager.java | 194 +++++++++--------- 1 file changed, 97 insertions(+), 97 deletions(-) diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java index d48f77298..edf8669f6 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java @@ -202,131 +202,131 @@ public class HubManager extends MiniClientPlugin BookMeta meta = (BookMeta)_ruleBook.getItemMeta(); _serverName = getPlugin().getConfig().getString("serverstatus.name"); _serverName = _serverName.substring(0, Math.min(16, _serverName.length())); - - meta.addPage("§m-------------------§r\n" - + "Welcome to §6§lMineplex§r\n" - + "§r§0§l§r§m§0§m-------------------§r§0\n" + + meta.addPage("§m-------------------§r\n" + + "Welcome to §6§lMineplex§r\n" + + "§r§0§l§r§m§0§m-------------------§r§0\n" + "\n" - + "§2Please §0take a moment to read through this book!\n" + + "§2Please §0take a moment to read through this book!\n" + "\n" + "\n" + "Part 1 - Rules\n" + "\n" + "Part 2 - FAQ\n"); - - meta.addPage("§m-------------------\n" - + "§r §2§lRules§r§0\n" - + "§m-------------------\n" - + "§r\n" - + "§l1.§§§r §4No§r spamming.\n" + + meta.addPage("§m-------------------\n" + + "§r §2§lRules§r§0\n" + + "§m-------------------\n" + + "§r\n" + + "§l1.§§§r §4No§r spamming.\n" + "\n" - + "§0This is sending too many messages and/or repeating the same message in a short period of time.\n"); - - meta.addPage("§m-------------------\n" - + "§r §2§lRules§r§0\n" - + "§m-------------------\n" - + "§r\n" - + "§l2.§m§r §4No§0 use of excessive caps.\n" + + "§0This is sending too many messages and/or repeating the same message in a short period of time.\n"); + + meta.addPage("§m-------------------\n" + + "§r §2§lRules§r§0\n" + + "§m-------------------\n" + + "§r\n" + + "§l2.§m§r §4No§0 use of excessive caps.\n" + "\n" + "This is sending messages with an excessive amount of capital letters.\n"); - - meta.addPage("§m-------------------\n" - + "§r §2§lRules§r§0\n" - + "§m-------------------\n" - + "§r\n" - + "§l3.§r §4No§0 hacking or use of any unapproved mods.\n" + + meta.addPage("§m-------------------\n" + + "§r §2§lRules§r§0\n" + + "§m-------------------\n" + + "§r\n" + + "§l3.§r §4No§0 hacking or use of any unapproved mods.\n" + "\n" + "This means we do not tolerate any sort of hacked client or any unapproved mods, such as fly hacks.\n"); - - meta.addPage("§m-------------------\n" - + "§r §2§lRules§r§0\n" - + "§m-------------------\n" - + "§r\n" - + "§l4.§r §4No§0 advertising non-Mineplex related links.\n" + + meta.addPage("§m-------------------\n" + + "§r §2§lRules§r§0\n" + + "§m-------------------\n" + + "§r\n" + + "§l4.§r §4No§0 advertising non-Mineplex related links.\n" + "\n" + "This is when a link is sent in chat which directs others to non-Mineplex related content.\n"); - - meta.addPage("§m-------------------\n" - + "§r §2§lRules§r§0\n" - + "§m-------------------\n" - + "§r\n" - + "§l5.§r §4No§0 trolling or use of any exploits.\n" + + meta.addPage("§m-------------------\n" + + "§r §2§lRules§r§0\n" + + "§m-------------------\n" + + "§r\n" + + "§l5.§r §4No§0 trolling or use of any exploits.\n" + "\n" + "This means that abuse of bugs/glitches is not tolerated. You also may not do things such as teamkilling and/or blocking spawns.\n"); - - meta.addPage("§m-------------------\n" - + "§r §2§lRules§r§0\n" - + "§m-------------------\n" - + "§r\n" - + "§l6.§r §2Be§0 respectful to others, yourself, and the environment around you.\n"); - - meta.addPage("§m-------------------\n" - + "§r §2§lRules§r§0\n" - + "§m-------------------\n" - + "§r\n" - + "§rPlease report any bugs, exploits, and/or rule breakers on our forums with evidence.\n" - + "§omineplex.com/forums\n"); - - meta.addPage("§m-------------------\n" - + "§r §2§lFAQ§r§0\n" - + "§m-------------------\n" - + "§r\n" - + "§lWhat is stacker and how do you play it?\n" + + meta.addPage("§m-------------------\n" + + "§r §2§lRules§r§0\n" + + "§m-------------------\n" + + "§r\n" + + "§l6.§r §2Be§0 respectful to others, yourself, and the environment around you.\n"); + + meta.addPage("§m-------------------\n" + + "§r §2§lRules§r§0\n" + + "§m-------------------\n" + + "§r\n" + + "§rPlease report any bugs, exploits, and/or rule breakers on our forums with evidence.\n" + + "§omineplex.com/forums\n"); + + meta.addPage("§m-------------------\n" + + "§r §2§lFAQ§r§0\n" + + "§m-------------------\n" + + "§r\n" + + "§lWhat is stacker and how do you play it?\n" + "\n" - + "§rStacker is a hub game where you can stack & throw players/mobs.\n" + + "§rStacker is a hub game where you can stack & throw players/mobs.\n" + "\n" - + "§9Right-Click: pick up\n" + + "§9Right-Click: pick up\n" + "Left-Click: throw\n"); - - meta.addPage("§m-------------------\n" - + "§r §2§lFAQ§r§0\n" - + "§m-------------------\n" - + "§r\n" - + "§lHow do I get §bUltra§l, §5Hero§l, or §aLegend§l?\n" + + meta.addPage("§m-------------------\n" + + "§r §2§lFAQ§r§0\n" + + "§m-------------------\n" + + "§r\n" + + "§lHow do I get §bUltra§l, §5Hero§l, or §aLegend§l?\n" + "\n" - + "§r§0You are able to purchase these ranks through our shop on our website at:\n" + + "§r§0You are able to purchase these ranks through our shop on our website at:\n" + "\n" - + "§owww.mineplex.com/shop\n"); - - meta.addPage("§m-------------------\n" - + "§r §2§lFAQ§r§0\n" - + "§m-------------------\n" - + "§r\n" - + "§lWhy hasn't my rank been applied yet?\n" + + "§owww.mineplex.com/shop\n"); + + meta.addPage("§m-------------------\n" + + "§r §2§lFAQ§r§0\n" + + "§m-------------------\n" + + "§r\n" + + "§lWhy hasn't my rank been applied yet?\n" + "\n" - + "§m§rYour rank may take a while to be applied. If it has been over 24 hours please contact:\n" + + "§m§rYour rank may take a while to be applied. If it has been over 24 hours please contact:\n" + "\n" - + "§omineplex.com/support\n"); - - meta.addPage("§m-------------------\n" - + "§r §2§lFAQ§r§0\n" - + "§m-------------------\n" - + "§r\n" - + "§lWhat do I do if I was wrongfully punished?\n" + + "§omineplex.com/support\n"); + + meta.addPage("§m-------------------\n" + + "§r §2§lFAQ§r§0\n" + + "§m-------------------\n" + + "§r\n" + + "§lWhat do I do if I was wrongfully punished?\n" + "\n" - + "§0If you believe you were wrongfully punished, please submit an appeal at:\n" + + "§0If you believe you were wrongfully punished, please submit an appeal at:\n" + "\n" - + "§omineplex.com/appeals\n"); - - meta.addPage("§m-------------------\n" - + "§r §2§lFAQ§r§0\n" - + "§m-------------------\n" - + "§r\n" - + "§lHow do I apply for Trainee?\n" + + "§omineplex.com/appeals\n"); + + meta.addPage("§m-------------------\n" + + "§r §2§lFAQ§r§0\n" + + "§m-------------------\n" + + "§r\n" + + "§lHow do I apply for Trainee?\n" + "\n" - + "§rYou may only apply for Helper if you have §bUltra§0, §5Hero§0, or §aLegend§0.\n" + + "§rYou may only apply for Helper if you have §bUltra§0, §5Hero§0, or §aLegend§0.\n" + "Apply at:\n" - + "§omineplex.com/application\n"); - - meta.addPage("§m-------------------\n" - + "§r §6§lThank you for \n" - + " reading!§r§0\n" - + "§m-------------------\n" - + "§r\n" - + "Remember to visit our website §2mineplex.com§0 for important news & updates!\n" + + "§omineplex.com/application\n"); + + meta.addPage("§m-------------------\n" + + "§r §6§lThank you for \n" + + " reading!§r§0\n" + + "§m-------------------\n" + + "§r\n" + + "Remember to visit our website §2mineplex.com§0 for important news & updates!\n" + "\n" + "\n" - + " §c§lH§6§lA§a§lV§9§lE §c§lF§6§lU§a§lN§9§l!\n"); + + "§c§lH§6§lA§a§lV§9§lE §c§lF§6§lU§a§lN§9§l!\n"); // These are needed or 1.8 clients will not show book correctly meta.setTitle("Rule Book");