diff --git a/Plugins/.idea/artifacts/Nautilus_Game_Arcade_jar.xml b/Plugins/.idea/artifacts/Nautilus_Game_Arcade_jar.xml
index 3f5cae6e4..2fb39df09 100644
--- a/Plugins/.idea/artifacts/Nautilus_Game_Arcade_jar.xml
+++ b/Plugins/.idea/artifacts/Nautilus_Game_Arcade_jar.xml
@@ -18,6 +18,8 @@
+
+
\ No newline at end of file
diff --git a/Plugins/.idea/compiler.xml b/Plugins/.idea/compiler.xml
index 2e4d3e99b..b2c160566 100644
--- a/Plugins/.idea/compiler.xml
+++ b/Plugins/.idea/compiler.xml
@@ -21,8 +21,34 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
+
+
+
+
diff --git a/Plugins/.idea/encodings.xml b/Plugins/.idea/encodings.xml
index e206d70d8..d4f862411 100644
--- a/Plugins/.idea/encodings.xml
+++ b/Plugins/.idea/encodings.xml
@@ -1,5 +1,9 @@
-
-
-
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Plugins/.idea/misc.xml b/Plugins/.idea/misc.xml
index 76fba6e9f..5a73d09c7 100644
--- a/Plugins/.idea/misc.xml
+++ b/Plugins/.idea/misc.xml
@@ -7,6 +7,13 @@
+
+
+
diff --git a/Plugins/.idea/modules.xml b/Plugins/.idea/modules.xml
index bf0ac4bae..1b0feef52 100644
--- a/Plugins/.idea/modules.xml
+++ b/Plugins/.idea/modules.xml
@@ -18,6 +18,10 @@
+
+
+
+
\ No newline at end of file
diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/Rank.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/Rank.java
index 1c769e523..f0a1f16fc 100644
--- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/Rank.java
+++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/Rank.java
@@ -1,20 +1,20 @@
package mineplex.core.common;
-import mineplex.core.common.util.C;
-import mineplex.core.common.util.UtilPlayer;
-
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
+import mineplex.core.common.util.C;
+import mineplex.core.common.util.UtilPlayer;
+
public enum Rank
{
LT("LT", ChatColor.DARK_RED),
OWNER("Owner", ChatColor.DARK_RED),
DEVELOPER("Dev", ChatColor.RED),
ADMIN("Admin", ChatColor.RED),
+ JNR_DEV("Jr.Dev", ChatColor.RED),
SNR_MODERATOR("Sr.Mod", ChatColor.GOLD),
MODERATOR("Mod", ChatColor.GOLD),
- JNR_DEV("Jr.Dev", ChatColor.RED),
HELPER("Trainee", ChatColor.DARK_AQUA),
MAPLEAD("MapLead", ChatColor.DARK_PURPLE),
MAPDEV("Builder", ChatColor.BLUE),
diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilAction.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilAction.java
index 1b870ada9..09160ddc7 100644
--- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilAction.java
+++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilAction.java
@@ -1,7 +1,10 @@
package mineplex.core.common.util;
+import org.bukkit.Bukkit;
+import org.bukkit.Material;
import org.bukkit.entity.Entity;
+import org.bukkit.entity.Player;
import org.bukkit.util.Vector;
public class UtilAction
@@ -37,6 +40,14 @@ public class UtilAction
//Velocity
ent.setFallDistance(0);
- ent.setVelocity(vec);
+
+
+ //Debug
+ if (ent instanceof Player && UtilGear.isMat(((Player)ent).getItemInHand(), Material.SUGAR))
+ {
+ Bukkit.broadcastMessage(F.main("Debug", "Velocity Sent: " + vec.length()));
+ }
+
+ ent.setVelocity(vec);
}
}
diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilAlg.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilAlg.java
index fad8f1eef..d686faa2d 100644
--- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilAlg.java
+++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilAlg.java
@@ -7,6 +7,7 @@ import java.util.TreeSet;
+
import org.bukkit.Location;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
@@ -260,4 +261,96 @@ public class UtilAlg
return isInPyramid(player.getLocation().getDirection(), UtilAlg.getTrajectory(player.getEyeLocation(), target.getEyeLocation()), angleLimit) ||
isInPyramid(player.getLocation().getDirection(), UtilAlg.getTrajectory(player.getEyeLocation(), target.getLocation()), angleLimit);
}
+
+ public static Location getLocationAwayFromPlayers(ArrayList locs, ArrayList players)
+ {
+ Location bestLoc = null;
+ double bestDist = 0;
+
+ for (Location loc : locs)
+ {
+ double closest = -1;
+
+ for (Player player : players)
+ {
+ //Different Worlds
+ if (!player.getWorld().equals(loc.getWorld()))
+ continue;
+
+ double dist = UtilMath.offsetSquared(player.getLocation(), loc);
+
+ if (closest == -1 || dist < closest)
+ {
+ closest = dist;
+ }
+ }
+
+ if (closest == -1)
+ continue;
+
+ if (bestLoc == null || closest > bestDist)
+ {
+ bestLoc = loc;
+ bestDist = closest;
+ }
+ }
+
+ return bestLoc;
+ }
+
+ public static Location getLocationNearPlayers(ArrayList locs, ArrayList players, ArrayList dontOverlap)
+ {
+ Location bestLoc = null;
+ double bestDist = 0;
+
+ for (Location loc : locs)
+ {
+ double closest = -1;
+
+ boolean valid = true;
+
+ //Dont spawn on other players
+ for (Player player : dontOverlap)
+ {
+ if (!player.getWorld().equals(loc.getWorld()))
+ continue;
+
+ double dist = UtilMath.offsetSquared(player.getLocation(), loc);
+
+ if (dist < 0.8)
+ {
+ valid = false;
+ break;
+ }
+ }
+
+ if (!valid)
+ continue;
+
+ //Find closest player
+ for (Player player : players)
+ {
+ if (!player.getWorld().equals(loc.getWorld()))
+ continue;
+
+ double dist = UtilMath.offsetSquared(player.getLocation(), loc);
+
+ if (closest == -1 || dist < closest)
+ {
+ closest = dist;
+ }
+ }
+
+ if (closest == -1)
+ continue;
+
+ if (bestLoc == null || closest < bestDist)
+ {
+ bestLoc = loc;
+ bestDist = closest;
+ }
+ }
+
+ return bestLoc;
+ }
}
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/account/command/UpdateRank.java b/Plugins/Mineplex.Core/src/mineplex/core/account/command/UpdateRank.java
index 8a7efe8fe..21f0ee4c9 100644
--- a/Plugins/Mineplex.Core/src/mineplex/core/account/command/UpdateRank.java
+++ b/Plugins/Mineplex.Core/src/mineplex/core/account/command/UpdateRank.java
@@ -19,12 +19,20 @@ public class UpdateRank extends CommandBase
{
public UpdateRank(CoreClientManager plugin)
{
- super(plugin, Rank.ADMIN, "updateRank");
+ super(plugin, Rank.ADMIN, new Rank[] {Rank.JNR_DEV /*On test servers only*/}, "updateRank");
}
@Override
public void Execute(final Player caller, String[] args)
{
+ boolean testServer = Plugin.getPlugin().getConfig().getString("serverstatus.group").equalsIgnoreCase("Testing");
+
+ if (Plugin.Get(caller).GetRank() == Rank.JNR_DEV && !testServer)
+ {
+ F.main(Plugin.getName(), F.elem(Rank.JNR_DEV.GetTag(true, true)) + "s are only permitted to set ranks on test servers!");
+ return;
+ }
+
if (args == null)
{
UtilPlayer.message(caller, F.main(Plugin.getName(), "/" + AliasUsed + " joeschmo MODERATOR"));
@@ -52,9 +60,9 @@ public class UpdateRank extends CommandBase
final Rank rank = tempRank;
- if (rank == Rank.ADMIN || rank == Rank.YOUTUBE || rank == Rank.TWITCH || rank == Rank.MODERATOR || rank == Rank.HELPER || rank == Rank.ALL || rank == Rank.MAPDEV || rank == Rank.SNR_MODERATOR)
+ if (rank == Rank.ADMIN || rank == Rank.YOUTUBE || rank == Rank.TWITCH || rank == Rank.MODERATOR || rank == Rank.HELPER || rank == Rank.ALL || rank == Rank.MAPDEV || rank == Rank.SNR_MODERATOR || rank == Rank.JNR_DEV || rank == Rank.DEVELOPER)
{
- if (rank == Rank.ADMIN && !Plugin.hasRank(caller, Rank.LT))
+ if (!testServer && rank.Has(Rank.ADMIN) && !Plugin.hasRank(caller, Rank.LT))
{
UtilPlayer.message(caller, F.main(Plugin.getName(), ChatColor.RED + "" + ChatColor.BOLD + "Insufficient privileges!"));
return;
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/achievement/Achievement.java b/Plugins/Mineplex.Core/src/mineplex/core/achievement/Achievement.java
index 24dfd5c88..525ca469a 100644
--- a/Plugins/Mineplex.Core/src/mineplex/core/achievement/Achievement.java
+++ b/Plugins/Mineplex.Core/src/mineplex/core/achievement/Achievement.java
@@ -56,7 +56,7 @@ public enum Achievement
//Survival Games
SURVIVAL_GAMES_WINS("Katniss Everdeen", 600,
new String[]{"Survival Games.Wins"},
- new String[]{"Win 30 games of Survival Games"},
+ new String[]{"Win 20 games of Survival Games"},
new int[]{30},
AchievementCategory.SURVIVAL_GAMES),
@@ -87,7 +87,7 @@ public enum Achievement
//Skywars
SKYWARS_WINS("Sky King",2000,
new String[]{"Skywars.Wins"},
- new String[]{"Win 30 Games of Skywars"},
+ new String[]{"Win 20 Games of Skywars"},
new int[]{30},
AchievementCategory.SKYWARS),
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementManager.java b/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementManager.java
index f2a63704c..485f5a124 100644
--- a/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementManager.java
+++ b/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementManager.java
@@ -208,20 +208,22 @@ public class AchievementManager extends MiniPlugin
{
int level = get(sender, Achievement.GLOBAL_MINEPLEX_LEVEL).getLevel();
- if (sender.getName().equalsIgnoreCase("Phinary") || sender.getName().equalsIgnoreCase("Horus"))
- level = -level;
- else if (sender.getName().equalsIgnoreCase("B2_mp"))
+ if (sender.getName().equalsIgnoreCase("B2_mp"))
return 101;
- else if (rank.Has(Rank.OWNER))
- level = Math.max(level, 50 + get(sender, Achievement.GLOBAL_GEM_HUNTER).getLevel());
- else if (rank.Has(Rank.ADMIN))
- level = Math.max(level, 30 + get(sender, Achievement.GLOBAL_GEM_HUNTER).getLevel());
- else if (rank.Has(Rank.SNR_MODERATOR))
- level = Math.max(level, 15);
- else if (rank.Has(Rank.MODERATOR))
+
+ if (rank.Has(Rank.MODERATOR))
level = Math.max(level, 5);
- else if (rank.Has(Rank.JNR_DEV))
+ if (rank.Has(Rank.SNR_MODERATOR))
+ level = Math.max(level, 15);
+ if (rank.Has(Rank.JNR_DEV))
level = Math.max(level, 25);
+ if (rank.Has(Rank.ADMIN))
+ level = Math.max(level, 30 + get(sender, Achievement.GLOBAL_GEM_HUNTER).getLevel());
+ if (rank.Has(Rank.OWNER))
+ level = Math.max(level, 50 + get(sender, Achievement.GLOBAL_GEM_HUNTER).getLevel());
+
+ if (sender.getName().equalsIgnoreCase("Phinary"))
+ level = -level;
return level;
}
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java
index 775206ffd..bc7f2ac7d 100644
--- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java
+++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java
@@ -6,12 +6,14 @@ import java.util.List;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
+import org.bukkit.Sound;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.entity.PlayerDeathEvent;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerMoveEvent;
import org.bukkit.event.player.PlayerQuitEvent;
+import org.bukkit.event.player.PlayerToggleSneakEvent;
import org.bukkit.plugin.java.JavaPlugin;
import mineplex.core.MiniPlugin;
@@ -430,4 +432,16 @@ public class GadgetManager extends MiniPlugin
return true;
}
+
+ @EventHandler
+ public void chissMeow(PlayerToggleSneakEvent event)
+ {
+ if (event.getPlayer().getName().equals("Chiss"))
+ {
+ if (!event.getPlayer().isSneaking())
+ {
+ event.getPlayer().getWorld().playSound(event.getPlayer().getLocation(), Sound.CAT_MEOW, 1f, 1f);
+ }
+ }
+ }
}
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/game/GameDisplay.java b/Plugins/Mineplex.Core/src/mineplex/core/game/GameDisplay.java
index 07ffc1ccf..91c3ae291 100644
--- a/Plugins/Mineplex.Core/src/mineplex/core/game/GameDisplay.java
+++ b/Plugins/Mineplex.Core/src/mineplex/core/game/GameDisplay.java
@@ -51,7 +51,7 @@ public enum GameDisplay
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),
+ SurvivalGamesTeams("Survival Games", 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),
@@ -61,7 +61,8 @@ public enum GameDisplay
Build("Master Builders", Material.WOOD, (byte)0, GameCategory.CLASSICS, 50),
Cards("Craft Against Humanity", Material.MAP, (byte)0, GameCategory.CLASSICS, 51),
- Skywars("Skywars", Material.FEATHER, (byte) 0, GameCategory.SURVIVAL, 52),
+ Skywars("Skywars", "Skywars", Material.FEATHER, (byte) 0, GameCategory.SURVIVAL, 52),
+ SkywarsTeams("Skywars Teams", "Skywars",Material.FEATHER, (byte)5, GameCategory.TEAM_VARIANT, 53),
Event("Mineplex Event", Material.CAKE, (byte)0, GameCategory.EVENT, 999);
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountSheep.java b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountSheep.java
index bcee6ee2a..e2982d6ab 100644
--- a/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountSheep.java
+++ b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountSheep.java
@@ -52,7 +52,6 @@ public class MountSheep extends HorseMount
DisguiseSheep disguise = new DisguiseSheep(horse);
disguise.setName(player.getName(), Manager.getClientManager().Get(player).GetRank());
- disguise.setCustomNameVisible(true);
//disguise.setColor(DyeColor.getByColor(org.bukkit.Color.fromRGB(100, 0, 200)));
Manager.getDisguiseManager().disguise(disguise);
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountSlime.java b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountSlime.java
index 5bf9b6da2..1dccbdad5 100644
--- a/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountSlime.java
+++ b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountSlime.java
@@ -48,7 +48,6 @@ public class MountSlime extends Mount
mount.setSize(2);
mount.setCustomName(player.getName() + "'s " + GetName());
- mount.setCustomNameVisible(true);
//Inform
UtilPlayer.message(player, F.main("Mount", "You spawned " + F.elem(GetName()) + "."));
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/notifier/NotificationManager.java b/Plugins/Mineplex.Core/src/mineplex/core/notifier/NotificationManager.java
index 808d3fe33..342d7b840 100644
--- a/Plugins/Mineplex.Core/src/mineplex/core/notifier/NotificationManager.java
+++ b/Plugins/Mineplex.Core/src/mineplex/core/notifier/NotificationManager.java
@@ -45,8 +45,8 @@ public class NotificationManager extends MiniPlugin
// if (event.getType() == UpdateType.MIN_08)
// hugeSale();
- if (event.getType() == UpdateType.MIN_16)
- sale();
+// if (event.getType() == UpdateType.MIN_16)
+// sale();
}
private void sale()
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/npc/command/HomeCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/npc/command/HomeCommand.java
index 957816f12..03382bf95 100644
--- a/Plugins/Mineplex.Core/src/mineplex/core/npc/command/HomeCommand.java
+++ b/Plugins/Mineplex.Core/src/mineplex/core/npc/command/HomeCommand.java
@@ -12,7 +12,7 @@ public class HomeCommand extends CommandBase
{
public HomeCommand(NpcManager plugin)
{
- super(plugin, Rank.DEVELOPER, "home");
+ super(plugin, Rank.DEVELOPER, new Rank[] {Rank.JNR_DEV}, "home");
}
@Override
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/npc/command/NpcCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/npc/command/NpcCommand.java
index 3e3037964..5e66eee21 100644
--- a/Plugins/Mineplex.Core/src/mineplex/core/npc/command/NpcCommand.java
+++ b/Plugins/Mineplex.Core/src/mineplex/core/npc/command/NpcCommand.java
@@ -10,7 +10,7 @@ public class NpcCommand extends MultiCommandBase
{
public NpcCommand(NpcManager plugin)
{
- super(plugin, Rank.DEVELOPER, "npc");
+ super(plugin, Rank.DEVELOPER, new Rank[] {Rank.JNR_DEV}, "npc");
AddCommand(new AddCommand(plugin));
AddCommand(new DeleteCommand(plugin));
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/portal/Commands/SendCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/portal/Commands/SendCommand.java
index 3e447d5ae..e35d2f15e 100644
--- a/Plugins/Mineplex.Core/src/mineplex/core/portal/Commands/SendCommand.java
+++ b/Plugins/Mineplex.Core/src/mineplex/core/portal/Commands/SendCommand.java
@@ -14,7 +14,7 @@ public class SendCommand extends CommandBase
{
public SendCommand(Portal plugin)
{
- super(plugin, Rank.ADMIN, "send");
+ super(plugin, Rank.ADMIN, new Rank[] {Rank.JNR_DEV}, "send");
}
@Override
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/preferences/ui/PreferencesPage.java b/Plugins/Mineplex.Core/src/mineplex/core/preferences/ui/PreferencesPage.java
index f293eaf8d..31e1bb563 100644
--- a/Plugins/Mineplex.Core/src/mineplex/core/preferences/ui/PreferencesPage.java
+++ b/Plugins/Mineplex.Core/src/mineplex/core/preferences/ui/PreferencesPage.java
@@ -261,7 +261,7 @@ public class PreferencesPage extends ShopPageBase());
}
+
+ public void Reset(Player player, String stringContains)
+ {
+ NautHashMap data = _recharge.get(player.getName());
+
+ if (data == null)
+ return;
+
+ Iterator rechargeIter = data.keySet().iterator();
+
+ while (rechargeIter.hasNext())
+ {
+ String key = rechargeIter.next();
+
+ if (key.toLowerCase().contains(stringContains.toLowerCase()))
+ {
+ rechargeIter.remove();
+ }
+ }
+ }
public void debug(Player player, String ability)
{
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/stats/command/TimeCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/stats/command/TimeCommand.java
index 2754465d8..42fe8b841 100644
--- a/Plugins/Mineplex.Core/src/mineplex/core/stats/command/TimeCommand.java
+++ b/Plugins/Mineplex.Core/src/mineplex/core/stats/command/TimeCommand.java
@@ -71,7 +71,7 @@ public class TimeCommand extends CommandBase
else
{
long time = Plugin.Get(target).getStat("Global.TimeInGame");
- UtilPlayer.message(caller, F.main("Time", F.name(target.getName() + " has spent " + F.elem(UtilTime.convertString(time * 1000L, 1, UtilTime.TimeUnit.FIT)) + " in game")));
+ UtilPlayer.message(caller, F.main("Time", F.name(target.getName()) + " has spent " + F.elem(UtilTime.convertString(time * 1000L, 1, UtilTime.TimeUnit.FIT)) + " in game"));
}
}
}
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/teleport/command/HereCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/teleport/command/HereCommand.java
index a2371ce9a..264695e3a 100644
--- a/Plugins/Mineplex.Core/src/mineplex/core/teleport/command/HereCommand.java
+++ b/Plugins/Mineplex.Core/src/mineplex/core/teleport/command/HereCommand.java
@@ -10,7 +10,7 @@ public class HereCommand extends CommandBase
{
public HereCommand(Teleport plugin)
{
- super(plugin, Rank.ADMIN, "here", "h");
+ super(plugin, Rank.ADMIN, new Rank[] {Rank.JNR_DEV}, "here", "h");
}
@Override
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/updater/RestartServerCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/updater/RestartServerCommand.java
index ff2a51f08..1067506b0 100644
--- a/Plugins/Mineplex.Core/src/mineplex/core/updater/RestartServerCommand.java
+++ b/Plugins/Mineplex.Core/src/mineplex/core/updater/RestartServerCommand.java
@@ -15,7 +15,7 @@ public class RestartServerCommand extends CommandBase
{
public RestartServerCommand(FileUpdater plugin)
{
- super(plugin, Rank.ADMIN, "restart");
+ super(plugin, Rank.ADMIN, new Rank[] {Rank.JNR_DEV}, "restart");
}
@Override
diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java
index dcaac1d40..2cf2e5b53 100644
--- a/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java
+++ b/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java
@@ -103,7 +103,7 @@ import mineplex.minecraft.game.core.damage.CustomDamageEvent;
public class HubManager extends MiniClientPlugin
{
// ☃❅ Snowman!
- public HubType Type = HubType.Normal;
+ public HubType Type = HubType.Normal;
private BlockRestore _blockRestore;
private CoreClientManager _clientManager;
@@ -495,7 +495,10 @@ public class HubManager extends MiniClientPlugin
@EventHandler(priority = EventPriority.LOW)
public void AdminOP(PlayerJoinEvent event)
{
- if (_clientManager.Get(event.getPlayer()).GetRank().Has(Rank.OWNER))
+ // Give developers operator on their servers
+ boolean testServer = _plugin.getConfig().getString("serverstatus.group").equalsIgnoreCase("Testing");
+
+ if (_clientManager.Get(event.getPlayer()).GetRank().Has(Rank.OWNER) || (testServer && (_clientManager.Get(event.getPlayer()).GetRank().Has(Rank.DEVELOPER) || _clientManager.Get(event.getPlayer()).GetRank() == Rank.JNR_DEV)))
event.getPlayer().setOp(true);
else
event.getPlayer().setOp(false);
diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/commands/GadgetToggle.java b/Plugins/Mineplex.Hub/src/mineplex/hub/commands/GadgetToggle.java
index 810e964d8..2d99ce5d7 100644
--- a/Plugins/Mineplex.Hub/src/mineplex/hub/commands/GadgetToggle.java
+++ b/Plugins/Mineplex.Hub/src/mineplex/hub/commands/GadgetToggle.java
@@ -10,7 +10,7 @@ public class GadgetToggle extends CommandBase
{
public GadgetToggle(HubManager plugin)
{
- super(plugin, Rank.ADMIN, new String[] {"gadget"});
+ super(plugin, Rank.ADMIN, new Rank[] {Rank.JNR_DEV}, new String[] {"gadget"});
}
@Override
diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/commands/GameModeCommand.java b/Plugins/Mineplex.Hub/src/mineplex/hub/commands/GameModeCommand.java
index 7900e79ee..4416e7b15 100644
--- a/Plugins/Mineplex.Hub/src/mineplex/hub/commands/GameModeCommand.java
+++ b/Plugins/Mineplex.Hub/src/mineplex/hub/commands/GameModeCommand.java
@@ -13,7 +13,7 @@ public class GameModeCommand extends CommandBase
{
public GameModeCommand(HubManager plugin)
{
- super(plugin, Rank.ADMIN, new String[] {"gm"});
+ super(plugin, Rank.ADMIN, new Rank[] {Rank.JNR_DEV}, new String[] {"gm"});
}
@Override
diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/commands/NewsCommand.java b/Plugins/Mineplex.Hub/src/mineplex/hub/commands/NewsCommand.java
index dd1e33d77..a9e6cf029 100644
--- a/Plugins/Mineplex.Hub/src/mineplex/hub/commands/NewsCommand.java
+++ b/Plugins/Mineplex.Hub/src/mineplex/hub/commands/NewsCommand.java
@@ -10,7 +10,7 @@ public class NewsCommand extends MultiCommandBase
{
public NewsCommand(HubManager plugin)
{
- super(plugin, Rank.ADMIN, "news");
+ super(plugin, Rank.ADMIN, new Rank[] {Rank.JNR_DEV}, "news");
AddCommand(new NewsAddCommand(plugin));
AddCommand(new NewsDeleteCommand(plugin));
diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/commands/NewsListCommand.java b/Plugins/Mineplex.Hub/src/mineplex/hub/commands/NewsListCommand.java
index e3ca7c240..fa32eb919 100644
--- a/Plugins/Mineplex.Hub/src/mineplex/hub/commands/NewsListCommand.java
+++ b/Plugins/Mineplex.Hub/src/mineplex/hub/commands/NewsListCommand.java
@@ -19,7 +19,7 @@ public class NewsListCommand extends CommandBase
{
public NewsListCommand(HubManager plugin)
{
- super(plugin, Rank.ADMIN, "list");
+ super(plugin, Rank.ADMIN, new Rank[] {Rank.JNR_DEV}, "list");
}
@Override
diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/ForcefieldManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/ForcefieldManager.java
index 425ce1a0f..07caf2363 100644
--- a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/ForcefieldManager.java
+++ b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/ForcefieldManager.java
@@ -42,7 +42,7 @@ public class ForcefieldManager extends MiniPlugin
for (Player player : UtilServer.getPlayers())
{
- if (Manager.getPreferences().Get(player).HubForcefield && Manager.GetClients().Get(player).GetRank().Has(Rank.ADMIN))
+ if (Manager.getPreferences().Get(player).HubForcefield && (Manager.GetClients().Get(player).GetRank().Has(Rank.ADMIN) || Manager.GetClients().Get(player).GetRank() == Rank.JNR_DEV))
{
for (Player other : UtilServer.getPlayers())
{
@@ -56,7 +56,7 @@ public class ForcefieldManager extends MiniPlugin
if (UtilMath.offset(other, player) > range)
continue;
- if (Manager.GetClients().Get(other).GetRank().Has(Rank.ADMIN))
+ if (Manager.GetClients().Get(other).GetRank().Has(Rank.ADMIN) || Manager.GetClients().Get(other).GetRank() == Rank.JNR_DEV)
continue;
if (Recharge.Instance.use(other, "Forcefield Bump", 500, false, false))
diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Class/ClientClass.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Class/ClientClass.java
index ae8816f3a..e892c5f75 100644
--- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Class/ClientClass.java
+++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Class/ClientClass.java
@@ -341,7 +341,7 @@ public class ClientClass
if (notify)
{
ListSkills(_client.GetPlayer());
- _client.GetPlayer().getWorld().playSound(_client.GetPlayer().getLocation(), Sound.LEVEL_UP, 1f, 1f);
+ _client.GetPlayer().playSound(_client.GetPlayer().getLocation(), Sound.LEVEL_UP, 1f, 1f);
_client.GetPlayer().sendMessage(F.main("Class", "You equipped " + F.skill(customBuild.Name) + "."));
}
diff --git a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/damage/DamageManager.java b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/damage/DamageManager.java
index aab72ed1e..1d699e938 100644
--- a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/damage/DamageManager.java
+++ b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/damage/DamageManager.java
@@ -41,6 +41,7 @@ import org.bukkit.event.EventPriority;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
+import org.bukkit.event.player.PlayerVelocityEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.util.Vector;
@@ -251,34 +252,34 @@ public class DamageManager extends MiniPlugin
{
if (stack == null)
continue;
-
+
Map enchants = stack.getEnchantments();
for (Enchantment e : enchants.keySet())
{
if (e.equals(Enchantment.PROTECTION_ENVIRONMENTAL))
event.AddMod("Ench Prot", damagee.getName(), 0.5 * (double)enchants.get(e), false);
-
+
else if (e.equals(Enchantment.PROTECTION_FIRE) &&
event.GetCause() == DamageCause.FIRE &&
event.GetCause() == DamageCause.FIRE_TICK &&
event.GetCause() == DamageCause.LAVA)
event.AddMod("Ench Prot", damagee.getName(), 0.5 * (double)enchants.get(e), false);
-
+
else if (e.equals(Enchantment.PROTECTION_FALL) &&
event.GetCause() == DamageCause.FALL)
event.AddMod("Ench Prot", damagee.getName(), 0.5 * (double)enchants.get(e), false);
-
+
else if (e.equals(Enchantment.PROTECTION_EXPLOSIONS) &&
event.GetCause() == DamageCause.ENTITY_EXPLOSION)
event.AddMod("Ench Prot", damagee.getName(), 0.5 * (double)enchants.get(e), false);
-
+
else if (e.equals(Enchantment.PROTECTION_PROJECTILE) &&
event.GetCause() == DamageCause.PROJECTILE)
event.AddMod("Ench Prot", damagee.getName(), 0.5 * (double)enchants.get(e), false);
}
}
}
-
+
//Offensive
Player damager = event.GetDamagerPlayer(true);
if (damager != null)
@@ -390,11 +391,22 @@ public class DamageManager extends MiniPlugin
trajectory.multiply(0.6 * knockback);
trajectory.setY(Math.abs(trajectory.getY()));
- //Apply
- UtilAction.velocity(event.GetDamageeEntity(),
- trajectory, 0.2 + trajectory.length() * 0.8, false, 0, Math.abs(0.2 * knockback), 0.4 + (0.04 * knockback), true);
- }
+ //Debug
+ if (event.GetDamageeEntity() instanceof Player && UtilGear.isMat(((Player)event.GetDamageeEntity()).getItemInHand(), Material.SUGAR))
+ {
+ Bukkit.broadcastMessage("--------- " +
+ UtilEnt.getName(event.GetDamageeEntity()) + " hurt by " + UtilEnt.getName(event.GetDamagerEntity(true)) + "-----------" );
+
+ Bukkit.broadcastMessage(F.main("Debug", "Damage: " + event.GetDamage()));
+ }
+
+ //Apply
+ double vel = 0.2 + trajectory.length() * 0.8;
+
+ UtilAction.velocity(event.GetDamageeEntity(), trajectory, vel,
+ false, 0, Math.abs(0.2 * knockback), 0.4 + (0.04 * knockback), true);
+ }
}
catch (IllegalAccessException e)
{
@@ -410,11 +422,20 @@ public class DamageManager extends MiniPlugin
}
}
+ @EventHandler
+ public void debugVel2(PlayerVelocityEvent event)
+ {
+ if (UtilGear.isMat(((Player)event.getPlayer()).getItemInHand(), Material.SUGAR))
+ {
+ Bukkit.broadcastMessage(F.main("Debug", "Event: " + event.getVelocity().length()));
+ }
+ }
+
private void DisplayDamage(CustomDamageEvent event)
{
for (Player player : UtilServer.getPlayers())
{
- if (!UtilGear.isMat(player.getItemInHand(), Material.BOOK))
+ if (!UtilGear.isMat(player.getItemInHand(), Material.COMMAND))
continue;
UtilPlayer.message(player, " ");
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 59bb9719d..131fd4fb4 100644
--- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java
+++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java
@@ -1,5 +1,6 @@
package nautilus.game.arcade;
+import java.awt.Event;
import java.io.File;
import java.util.ArrayList;
import java.util.HashSet;
@@ -110,6 +111,7 @@ import nautilus.game.arcade.game.Game;
import nautilus.game.arcade.game.Game.GameState;
import nautilus.game.arcade.game.GameServerConfig;
import nautilus.game.arcade.game.GameTeam;
+import nautilus.game.arcade.game.games.event.EventModule;
import nautilus.game.arcade.game.games.uhc.UHC;
import nautilus.game.arcade.managers.GameAchievementManager;
import nautilus.game.arcade.managers.GameChatManager;
@@ -143,6 +145,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation
private Creature _creature;
private DamageManager _damageManager;
private Explosion _explosionManager;
+ private EventModule _eventManager;
private Fire _fire;
private ProjectileManager _projectileManager;
@@ -257,6 +260,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation
_cosmeticManager = cosmeticManager;
_portal = portal;
_petManager = petManager;
+ _eventManager = new EventModule(this, getPlugin());
// Shop
_arcadeShop = new ArcadeShop(this, clientManager, donationManager);
@@ -562,6 +566,11 @@ public class ArcadeManager extends MiniPlugin implements IRelation
return _gameWorldManager;
}
+ public EventModule GetEventModule()
+ {
+ return _eventManager;
+ }
+
public PreferencesManager getPreferences()
{
return _preferencesManager;
@@ -653,7 +662,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation
return;
}
- if (!GetServerConfig().PublicServer)
+ if (!GetServerConfig().PublicServer || GetServerConfig().PlayerServerWhitelist)
{
event.setMotd(ChatColor.GRAY + "Private");
return;
@@ -818,6 +827,11 @@ public class ArcadeManager extends MiniPlugin implements IRelation
event.disallow(PlayerLoginEvent.Result.KICK_OTHER, C.Bold + "Server has reached max capacity for gameplay purposes.");
return;
}
+ else if (_gameHostManager.isEventServer() && Bukkit.getServer().getOnlinePlayers().size() >= 128)
+ {
+ event.disallow(PlayerLoginEvent.Result.KICK_OTHER, C.Bold + "Server has reached max capacity for gameplay purposes.");
+ return;
+ }
event.allow();
event.setResult(PlayerLoginEvent.Result.ALLOWED);
@@ -829,6 +843,18 @@ public class ArcadeManager extends MiniPlugin implements IRelation
}
}
+ @EventHandler(priority = EventPriority.LOW)
+ public void AdminOP(PlayerJoinEvent event)
+ {
+ // Give developers operator on their servers
+ boolean testServer = _plugin.getConfig().getString("serverstatus.group").equalsIgnoreCase("Testing");
+
+ if (_clientManager.Get(event.getPlayer()).GetRank().Has(Rank.OWNER) || (testServer && (_clientManager.Get(event.getPlayer()).GetRank().Has(Rank.DEVELOPER) || _clientManager.Get(event.getPlayer()).GetRank() == Rank.JNR_DEV)))
+ event.getPlayer().setOp(true);
+ else
+ event.getPlayer().setOp(false);
+ }
+
public boolean IsAlive(Player player)
{
if (_game == 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 b2b8e3d40..65ee7948a 100644
--- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/GameType.java
+++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/GameType.java
@@ -38,10 +38,11 @@ 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.skywars.Skywars;
-import nautilus.game.arcade.game.games.smash.SuperSmash;
+import nautilus.game.arcade.game.games.skywars.SoloSkywars;
+import nautilus.game.arcade.game.games.skywars.TeamSkywars;
+import nautilus.game.arcade.game.games.smash.SoloSuperSmash;
import nautilus.game.arcade.game.games.smash.SuperSmashDominate;
-import nautilus.game.arcade.game.games.smash.SuperSmashTeam;
+import nautilus.game.arcade.game.games.smash.TeamSuperSmash;
import nautilus.game.arcade.game.games.snake.Snake;
import nautilus.game.arcade.game.games.sneakyassassins.SneakyAssassins;
import nautilus.game.arcade.game.games.snowfight.SnowFight;
@@ -49,8 +50,8 @@ 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.survivalgames.SoloSurvivalGames;
+import nautilus.game.arcade.game.games.survivalgames.TeamSurvivalGames;
import nautilus.game.arcade.game.games.tug.Tug;
import nautilus.game.arcade.game.games.turfforts.TurfForts;
import nautilus.game.arcade.game.games.uhc.UHC;
@@ -70,7 +71,7 @@ public enum GameType
ChampionsDominate(ChampionsDominate.class, GameDisplay.ChampionsDominate),
//ChampionsMOBA(ChampionsMOBA.class, "Champions MOBA", "Champions", Material.SKULL_ITEM, (byte)0, GameCategory.CHAMPIONS, 7),
ChampionsTDM(ChampionsTDM.class, GameDisplay.ChampionsTDM),
- Christmas(Christmas.class, GameDisplay.Christmas),
+ Christmas(Christmas.class, GameDisplay.Christmas, "http://chivebox.com/file/c/xmas.zip", true),
DeathTag(DeathTag.class, GameDisplay.DeathTag),
DragonEscape(DragonEscape.class, GameDisplay.DragonEscape),
DragonEscapeTeams(DragonEscapeTeams.class, GameDisplay.DragonEscapeTeams),
@@ -81,7 +82,7 @@ public enum GameType
Evolution(Evolution.class, GameDisplay.Evolution),
//FlappyBird(FlappyBird.class, "Flappy Bird", Material.FEATHER, (byte)0, GameCategory.ARCADE, 17),
Gravity(Gravity.class, GameDisplay.Gravity),
- Halloween(Halloween.class, GameDisplay.Halloween),
+ Halloween(Halloween.class, GameDisplay.Halloween, "http://chivebox.com/file/c/hh.zip", true),
HideSeek(HideSeek.class, GameDisplay.HideSeek),
HoleInTheWall(HoleInTheWall.class, GameDisplay.HoleInTheWall),
Horse(Horse.class, GameDisplay.Horse),
@@ -98,9 +99,9 @@ public enum GameType
SearchAndDestroy(SearchAndDestroy.class, GameDisplay.SearchAndDestroy),
Sheep(SheepGame.class, GameDisplay.Sheep),
- Smash(SuperSmash.class, GameDisplay.Smash),
+ Smash(SoloSuperSmash.class, GameDisplay.Smash),
SmashDomination(SuperSmashDominate.class, GameDisplay.SmashDomination),
- SmashTeams(SuperSmashTeam.class, GameDisplay.SmashTeams),
+ SmashTeams(TeamSuperSmash.class, GameDisplay.SmashTeams, new GameType[]{GameType.Smash}, false),
Snake(Snake.class, GameDisplay.Snake),
SneakyAssassins(SneakyAssassins.class, GameDisplay.SneakyAssassins),
SnowFight(SnowFight.class, GameDisplay.SnowFight),
@@ -108,23 +109,35 @@ public enum GameType
SpleefTeams(SpleefTeams.class, GameDisplay.SpleefTeams),
SquidShooter(SquidShooter.class, GameDisplay.SquidShooter),
Stacker(Stacker.class, GameDisplay.Stacker),
- SurvivalGames(SurvivalGames.class, GameDisplay.SurvivalGames),
- SurvivalGamesTeams(SurvivalGamesTeams.class, GameDisplay.SurvivalGamesTeams),
+ SurvivalGames(SoloSurvivalGames.class, GameDisplay.SurvivalGames),
+ SurvivalGamesTeams(TeamSurvivalGames.class, GameDisplay.SurvivalGamesTeams, new GameType[]{GameType.SurvivalGames}, false),
Tug(Tug.class, GameDisplay.Tug),
TurfWars(TurfForts.class, GameDisplay.TurfWars),
UHC(UHC.class, GameDisplay.UHC),
WitherAssault(WitherGame.class, GameDisplay.WitherAssault),
Wizards(Wizards.class, GameDisplay.Wizards, "http://chivebox.com/file/c/ResWizards.zip", true),
ZombieSurvival(ZombieSurvival.class, GameDisplay.ZombieSurvival),
-
Build(Build.class, GameDisplay.Build),
Cards(Cards.class, GameDisplay.Cards),
- Skywars(Skywars.class, GameDisplay.Skywars),
+ Skywars(SoloSkywars.class, GameDisplay.Skywars),
+ SkywarsTeams(TeamSkywars.class, GameDisplay.SkywarsTeams, new GameType[]{GameType.Skywars}, false),
- Event(EventGame.class, GameDisplay.Event);
+ Event(EventGame.class, GameDisplay.Event, new GameType[]{
+ GameType.BaconBrawl, GameType.Barbarians, GameType.Bridge, GameType.Build, GameType.Build,
+ GameType.Cards, GameType.CastleSiege, GameType.ChampionsDominate, GameType.ChampionsTDM, GameType.Christmas,
+ GameType.DeathTag, GameType.DragonEscape, GameType.DragonEscapeTeams, GameType.DragonRiders, GameType.Dragons,
+ GameType.Draw, GameType.Evolution, GameType.Gravity, GameType.Halloween, GameType.HideSeek,
+ GameType.HoleInTheWall, GameType.Horse, GameType.Micro, GameType.MilkCow, GameType.MineStrike, GameType.MineWare,
+ GameType.OldMineWare, GameType.Paintball, GameType.Quiver, GameType.QuiverTeams, GameType.Runner, GameType.SearchAndDestroy,
+ GameType.Sheep, GameType.Skywars, GameType.SkywarsTeams, GameType.Smash, GameType.SmashDomination, GameType.SmashTeams,
+ GameType.Snake, GameType.SneakyAssassins, GameType.SnowFight, GameType.Spleef, GameType.SpleefTeams, GameType.SquidShooter,
+ GameType.Stacker, GameType.SurvivalGames, GameType.SurvivalGamesTeams, GameType.Tug, GameType.TurfWars, GameType.UHC,
+ GameType.WitherAssault, GameType.Wizards, GameType.ZombieSurvival}, true);
GameDisplay _display;
boolean _enforceResourcePack;
+ GameType[] _mapSource;
+ boolean _ownMaps;
String _resourcePack;
Class extends Game> _gameClass;
@@ -133,17 +146,29 @@ public enum GameType
GameType(Class extends Game> gameClass, GameDisplay display)
{
- this(gameClass, display, null, false);
+ this(gameClass, display, null, false, null, true);
}
GameType(Class extends Game> gameClass, GameDisplay display, String resourcePackUrl, boolean enforceResourcePack)
+ {
+ this(gameClass, display, resourcePackUrl, enforceResourcePack, null, true);
+ }
+
+ GameType(Class extends Game> gameClass, GameDisplay display, GameType[] mapSource, boolean ownMap)
+ {
+ this(gameClass, display, null, false, mapSource, ownMap);
+ }
+
+ GameType(Class extends Game> gameClass, GameDisplay display, String resourcePackUrl, boolean enforceResourcePack, GameType[] mapSource, boolean ownMaps)
{
_display = display;
_gameClass = gameClass;
_resourcePack = resourcePackUrl;
_enforceResourcePack = enforceResourcePack;
+ _mapSource = mapSource;
+ _ownMaps = ownMaps;
}
-
+
public Class extends Game> getGameClass()
{
return _gameClass;
@@ -158,6 +183,16 @@ public enum GameType
{
return _resourcePack;
}
+
+ public GameType[] getMapSource()
+ {
+ return _mapSource;
+ }
+
+ public boolean ownMaps()
+ {
+ return _ownMaps;
+ }
public String GetName()
{
@@ -183,4 +218,5 @@ public enum GameType
{
return _display.getGameCategory();
}
+
}
\ No newline at end of file
diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/command/DisguiseCommand.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/command/DisguiseCommand.java
index 8e1e5dc51..f45344d2a 100644
--- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/command/DisguiseCommand.java
+++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/command/DisguiseCommand.java
@@ -3,9 +3,8 @@ package nautilus.game.arcade.command;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
-
-import nautilus.game.arcade.ArcadeManager;
import net.minecraft.util.com.mojang.authlib.GameProfile;
+
import mineplex.core.command.CommandBase;
import mineplex.core.common.Rank;
import mineplex.core.common.util.C;
@@ -13,12 +12,13 @@ import mineplex.core.common.util.ProfileLoader;
import mineplex.core.common.util.UUIDFetcher;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.disguise.disguises.DisguisePlayer;
+import nautilus.game.arcade.ArcadeManager;
public class DisguiseCommand extends CommandBase
{
public DisguiseCommand(ArcadeManager plugin)
{
- super(plugin, Rank.ADMIN, new Rank[] {Rank.YOUTUBE, Rank.TWITCH}, "disguise");
+ super(plugin, Rank.ADMIN, new Rank[] {Rank.YOUTUBE, Rank.TWITCH, Rank.JNR_DEV}, "disguise");
}
@Override
diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/command/GameCommand.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/command/GameCommand.java
index 7cb8a6f80..76e4edb1c 100644
--- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/command/GameCommand.java
+++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/command/GameCommand.java
@@ -25,7 +25,7 @@ public class GameCommand extends MultiCommandBase
UtilPlayer.message(caller, F.main(Plugin.getName(), "Commands List:"));
UtilPlayer.message(caller, F.help("/game start", "Start the current game", Rank.ADMIN));
UtilPlayer.message(caller, F.help("/game stop", "Stop the current game", Rank.ADMIN));
- UtilPlayer.message(caller, F.help("/game set (Map)", "Set the current game or next game", Rank.ADMIN));
+ UtilPlayer.message(caller, F.help("/game set (MapSource) (Map)", "Set the current game or next game", Rank.ADMIN));
UtilPlayer.message(caller, F.main("Tip", "Use TAB for games/maps!"));
}
}
diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/command/SetCommand.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/command/SetCommand.java
index 0d7f183a7..d6958a663 100644
--- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/command/SetCommand.java
+++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/command/SetCommand.java
@@ -29,16 +29,31 @@ public class SetCommand extends CommandBase
if (args == null || args.length == 0)
{
- caller.sendMessage(F.help("/game set (Map)", "Set the current game or next game", Rank.ADMIN));
+ caller.sendMessage(F.help("/game set (MapSource) (Map)", "Set the current game or next game", Rank.ADMIN));
return;
}
String game = args[0].toLowerCase();
- if (args.length > 1)
+ if (args.length >= 2)
{
- Plugin.GetGameCreationManager().MapPref = args[1];
- UtilPlayer.message(caller, C.cAqua + C.Bold + "Map Preference: " + ChatColor.RESET + args[1]);
+ String map = "";
+ String source = "";
+ if(args.length == 3)
+ {
+ Plugin.GetGameCreationManager().MapSource = args[1];
+ Plugin.GetGameCreationManager().MapPref = args[2];
+ source = args[1];
+ map = args[2];
+ }
+ else
+ {
+ Plugin.GetGameCreationManager().MapSource = args[0];
+ Plugin.GetGameCreationManager().MapPref = args[1];
+ source = args[0];
+ map = args[1];
+ }
+ UtilPlayer.message(caller, C.cAqua + C.Bold + "Map Preference: " + ChatColor.RESET + source + ":" + map);
}
//Parse Game
diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/command/WriteCommand.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/command/WriteCommand.java
index 1718baec5..386d3867d 100644
--- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/command/WriteCommand.java
+++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/command/WriteCommand.java
@@ -11,7 +11,7 @@ public class WriteCommand extends CommandBase
{
public WriteCommand(ArcadeManager plugin)
{
- super(plugin, Rank.ADMIN, "write");
+ super(plugin, Rank.ADMIN, new Rank[] {Rank.JNR_DEV}, "write");
}
@Override
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 abe4d740c..a59565071 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
@@ -86,7 +86,7 @@ public abstract class Game implements Listener
protected String[] _gameDesc;
//Map
- private ArrayList _files;
+ private HashMap> _files;
//State
private GameState _gameState = GameState.Loading;
@@ -193,8 +193,6 @@ public abstract class Game implements Listener
public int HungerSet = -1;
public int HealthSet = -1;
- public int SpawnDistanceRequirement = 1;
-
public boolean PrepareFreeze = true;
private double _itemMergeRadius = 0;
@@ -211,6 +209,11 @@ public abstract class Game implements Listener
public int TickPerTeleport = 1;
+ public int FillTeamsInOrderToCount = -1;
+
+ public boolean SpawnNearAllies = false;
+ public boolean SpawnNearEnemies = false;
+
public boolean StrictAntiHack = false;
public boolean DisableKillCommand = true;
@@ -258,6 +261,9 @@ public abstract class Game implements Listener
public boolean CanAddStats = true;
public boolean CanGiveLoot = true;
+ public boolean HideTeamSheep = false;
+ public boolean ReplaceTeamsWithKits = false;
+
public boolean VersionRequire1_8 = false;
public ArrayList GemBoosters = new ArrayList();
@@ -281,16 +287,28 @@ public abstract class Game implements Listener
Scoreboard = new GameScoreboard(this);
//Map Select
- _files = Manager.LoadFiles(GetName());
+ _files = new HashMap>();
+ for(GameType type : GetWorldHostNames())
+ {
+ _files.put(type, Manager.LoadFiles(type.GetName()));
+ }
if (Manager.GetGameCreationManager().MapPref != null)
{
- ArrayList matches = new ArrayList();
- for (String cur : _files)
+ HashMap> matches = new HashMap>();
+ for (GameType game : _files.keySet())
{
- if (cur.toLowerCase().contains(Manager.GetGameCreationManager().MapPref.toLowerCase()))
+ ArrayList list = new ArrayList();
+ for(String cur : _files.get(game))
{
- matches.add(cur);
- System.out.print("Map Preference: " + cur);
+ if (cur.toLowerCase().contains(Manager.GetGameCreationManager().MapPref.toLowerCase()))
+ {
+ if(game.toString().toLowerCase().contains(Manager.GetGameCreationManager().MapSource.toLowerCase()))
+ {
+ list.add(cur);
+ System.out.print("Map Preference: " + cur);
+ matches.put(game, list);
+ }
+ }
}
}
@@ -298,6 +316,7 @@ public abstract class Game implements Listener
_files = matches;
Manager.GetGameCreationManager().MapPref = null;
+ Manager.GetGameCreationManager().MapSource = null;
}
WorldData = new WorldData(this);
@@ -332,7 +351,7 @@ public abstract class Game implements Listener
_kits = kits;
}
- public ArrayList GetFiles()
+ public HashMap> GetFiles()
{
return _files;
}
@@ -341,6 +360,60 @@ public abstract class Game implements Listener
{
return _gameType.GetName();
}
+
+ public GameType[] GetWorldHostNames()
+ {
+ GameType[] mapSource = new GameType[]{GetType()};
+ if(GetType().getMapSource() != null)
+ {
+ if(GetType().ownMaps())
+ {
+ int i = 1;
+ mapSource = new GameType[GetType().getMapSource().length + 1];
+ for(GameType type : GetType().getMapSource())
+ {
+ mapSource[i] = type;
+ i++;
+ }
+ mapSource[0] = GetType();
+ }
+ else
+ {
+ mapSource = GetType().getMapSource();
+ }
+ }
+ return mapSource;
+ }
+
+ public String GetGameNamebyMap(String game, String map)
+ {
+ for(GameType type : _files.keySet())
+ {
+ if(type.GetName().toLowerCase().contains(game.toLowerCase()))
+ {
+ for(String string : _files.get(type))
+ {
+ if(string.toLowerCase().contains(map.toLowerCase()))
+ {
+ return type.GetName();
+ }
+ }
+ }
+ }
+ return null;
+ }
+
+ public GameType GetGameByMapList(ArrayList maps)
+ {
+ for(GameType game : _files.keySet())
+ {
+ if(maps.equals(_files.get(game)))
+ {
+ return game;
+ }
+ }
+ return null;
+ }
public String GetMode()
{
@@ -465,9 +538,6 @@ public abstract class Game implements Listener
//Add
GetTeamList().add(team);
- //Set Spawn Data
- team.SetSpawnRequirement(this.SpawnDistanceRequirement);
-
System.out.println("Created Team: " + team.GetName());
}
@@ -549,6 +619,17 @@ public abstract class Game implements Listener
public GameTeam ChooseTeam(Player player)
{
+ if (FillTeamsInOrderToCount != -1)
+ {
+ for (int i = 0; i < _teamList.size(); i++)
+ {
+ if (_teamList.get(i).GetSize() < FillTeamsInOrderToCount)
+ {
+ return _teamList.get(i);
+ }
+ }
+ }
+
GameTeam team = null;
//Random Team
@@ -1365,4 +1446,5 @@ public abstract class Game implements Listener
//End
SetState(GameState.End);
}
+
}
diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameServerConfig.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameServerConfig.java
index 3ea703536..0e1e2ac03 100644
--- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameServerConfig.java
+++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameServerConfig.java
@@ -36,6 +36,8 @@ public class GameServerConfig
public boolean PlayerKickIdle = true;
public boolean PublicServer = true;
+
+ public boolean PlayerServerWhitelist = false;
public boolean IsValid()
{
diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameTeam.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameTeam.java
index c465dbf1d..a4adccbd5 100644
--- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameTeam.java
+++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameTeam.java
@@ -5,8 +5,10 @@ import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
+import mineplex.core.account.CoreClient;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
+import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
@@ -60,19 +62,19 @@ public class GameTeam
private HashMap _players = new HashMap();
private ArrayList _spawns;
-
+
private Creature _teamEntity = null;
private HashSet _kitRestrict = new HashSet();
- private int _spawnDistance = 0;
-
private boolean _visible = true;
+ private boolean _displayTag;
+
//Records order players go out in
protected ArrayList _places = new ArrayList();
- public GameTeam(Game host, String name, ChatColor color, ArrayList spawns)
+ public GameTeam(Game host, String name, ChatColor color, ArrayList spawns, boolean tags)
{
Host = host;
@@ -80,6 +82,12 @@ public class GameTeam
_name = name;
_color = color;
_spawns = spawns;
+ _displayTag = tags;
+ }
+
+ public GameTeam(Game host, String name, ChatColor color, ArrayList spawns)
+ {
+ this(host, name, color, spawns, false);
}
public String GetName()
@@ -99,40 +107,48 @@ public class GameTeam
public Location GetSpawn()
{
- // ArrayList valid = new ArrayList();
-
- Location best = null;
- double bestDist = 0;
-
- for (Location loc : _spawns)
+ //Keep allies together
+ if (!Host.IsLive() && Host.SpawnNearAllies)
{
- double closestPlayer = -1;
-
- for (Player player : Host.GetPlayers(true))
+ //Find Location Nearest Ally
+ Location loc = UtilAlg.getLocationNearPlayers(_spawns, GetPlayers(true), Host.GetPlayers(true));
+ if (loc != null)
+ return loc;
+
+ //No allies existed spawned yet
+
+ //Spawn near enemies (used for SG)
+ if (Host.SpawnNearEnemies)
{
- double playerDist = UtilMath.offsetSquared(player.getLocation(), loc);
-
- if (closestPlayer == -1 || playerDist < closestPlayer)
- closestPlayer = playerDist;
+ loc = UtilAlg.getLocationNearPlayers(_spawns, Host.GetPlayers(true), Host.GetPlayers(true));
+ if (loc != null)
+ return loc;
}
-
- if (best == null || closestPlayer > bestDist)
+ //Spawn away from enemies
+ else
{
- best = loc;
- bestDist = closestPlayer;
- }
-
- // if (closestPlayer > _spawnDistance * _spawnDistance)
- // {
- // valid.add(loc);
- // }
+ loc = UtilAlg.getLocationAwayFromPlayers(_spawns, Host.GetPlayers(true));
+ if (loc != null)
+ return loc;
+ }
+ }
+ else
+ {
+ //Spawn near players
+ if (Host.SpawnNearEnemies)
+ {
+ Location loc = UtilAlg.getLocationNearPlayers(_spawns, Host.GetPlayers(true), Host.GetPlayers(true));
+ if (loc != null)
+ return loc;
+ }
+ //Spawn away from players
+ else
+ {
+ Location loc = UtilAlg.getLocationAwayFromPlayers(_spawns, Host.GetPlayers(true));
+ if (loc != null)
+ return loc;
+ }
}
-
- // if (valid.size() > 0)
- // valid.get(UtilMath.r(valid.size()));
-
- if (best != null)
- return best;
return _spawns.get(UtilMath.r(_spawns.size()));
}
@@ -149,7 +165,14 @@ public class GameTeam
public void DisbandTeam()
{
for (Player player : _players.keySet())
+ {
+ for(Player other : UtilServer.getPlayers())
+ {
+ other.getScoreboard().getTeam(Host.Manager.GetClients().Get(player).GetRank().Name + _name.toUpperCase()).removePlayer(player);
+ other.getScoreboard().getTeam(Host.Manager.GetClients().Get(player).GetRank().Name).addPlayer(player);
+ }
UtilPlayer.message(player, F.main("Team", _color + C.Bold + _displayName + " Team was disbanded."));
+ }
_players.clear();
}
@@ -333,11 +356,6 @@ public class GameTeam
_spawns = spawns;
}
- public void SetSpawnRequirement(int value)
- {
- _spawnDistance = value;
- }
-
public void SetVisible(boolean b)
{
_visible = b;
@@ -347,6 +365,16 @@ public class GameTeam
{
return _visible;
}
+
+ public void setDisplayTag(boolean b)
+ {
+ _displayTag = b;
+ }
+
+ public boolean GetDisplaytag()
+ {
+ return _displayTag;
+ }
public void SetRespawnTime(double i)
{
@@ -390,6 +418,4 @@ public class GameTeam
return _places;
}
-
-
}
diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventGame.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventGame.java
index 37211beec..05d1c8508 100644
--- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventGame.java
+++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventGame.java
@@ -1,48 +1,9 @@
package nautilus.game.arcade.game.games.event;
-import java.util.ArrayList;
-import java.util.HashMap;
+import java.util.Arrays;
import java.util.HashSet;
-import java.util.LinkedList;
import java.util.List;
-import org.bukkit.Bukkit;
-import org.bukkit.ChatColor;
-import org.bukkit.Effect;
-import org.bukkit.GameMode;
-import org.bukkit.Material;
-import org.bukkit.OfflinePlayer;
-import org.bukkit.Sound;
-import org.bukkit.World;
-import org.bukkit.block.BlockFace;
-import org.bukkit.craftbukkit.v1_7_R4.entity.CraftLivingEntity;
-import org.bukkit.entity.Ageable;
-import org.bukkit.entity.Entity;
-import org.bukkit.entity.EntityType;
-import org.bukkit.entity.Player;
-import org.bukkit.entity.Skeleton;
-import org.bukkit.entity.Slime;
-import org.bukkit.entity.Villager;
-import org.bukkit.entity.Wolf;
-import org.bukkit.entity.Zombie;
-import org.bukkit.entity.Skeleton.SkeletonType;
-import org.bukkit.entity.Villager.Profession;
-import org.bukkit.event.EventHandler;
-import org.bukkit.event.EventPriority;
-import org.bukkit.event.entity.CreatureSpawnEvent;
-import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason;
-import org.bukkit.event.entity.EntityDeathEvent;
-import org.bukkit.event.entity.EntityExplodeEvent;
-import org.bukkit.event.player.PlayerCommandPreprocessEvent;
-import org.bukkit.event.player.PlayerJoinEvent;
-import org.bukkit.event.player.PlayerToggleFlightEvent;
-import org.bukkit.inventory.ItemStack;
-import org.bukkit.plugin.Plugin;
-import org.bukkit.potion.PotionEffect;
-import org.bukkit.potion.PotionEffectType;
-
-import mineplex.core.common.util.C;
-import mineplex.core.common.util.F;
import mineplex.core.common.util.NautHashMap;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilAlg;
@@ -50,34 +11,45 @@ import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilEnt;
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.UtilText;
-import mineplex.core.creature.event.CreatureKillEntitiesEvent;
import mineplex.core.disguise.disguises.DisguiseBase;
import mineplex.core.disguise.disguises.DisguiseBat;
import mineplex.core.disguise.disguises.DisguiseChicken;
import mineplex.core.disguise.disguises.DisguiseEnderman;
import mineplex.core.disguise.disguises.DisguiseWither;
import mineplex.core.gadget.event.GadgetActivateEvent;
-import mineplex.core.gadget.types.Gadget;
-import mineplex.core.gadget.types.GadgetType;
-import mineplex.core.give.Give;
-import mineplex.core.mount.Mount;
import mineplex.core.mount.event.MountActivateEvent;
import mineplex.core.recharge.Recharge;
import mineplex.core.shop.item.SalesPackageBase;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.core.visibility.VisibilityManager;
-import nautilus.game.arcade.game.games.event.kits.*;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType;
+import nautilus.game.arcade.game.Game;
import nautilus.game.arcade.game.SoloGame;
+import nautilus.game.arcade.game.Game.GameState;
+import nautilus.game.arcade.game.games.event.kits.KitPlayer;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.managers.GameHostManager;
-public class EventGame extends SoloGame
+import org.bukkit.Effect;
+import org.bukkit.GameMode;
+import org.bukkit.Sound;
+import org.bukkit.block.BlockFace;
+import org.bukkit.entity.Entity;
+import org.bukkit.entity.Player;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.EventPriority;
+import org.bukkit.event.entity.CreatureSpawnEvent;
+import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason;
+import org.bukkit.event.entity.EntityDeathEvent;
+import org.bukkit.event.entity.EntityExplodeEvent;
+import org.bukkit.event.player.PlayerJoinEvent;
+import org.bukkit.event.player.PlayerToggleFlightEvent;
+import org.bukkit.inventory.ItemStack;
+
+public class EventGame extends Game
{
private GameHostManager _mps;
@@ -169,1276 +141,6 @@ public class EventGame extends SoloGame
player.setGameMode(GameMode.SURVIVAL);
}
- //Help
- private void commandHelp(Player player)
- {
- UtilPlayer.message(player, F.main("Event", "Displaying Commands;"));
-
- UtilPlayer.message(player, F.value("/e settings", "View Settings Help"));
-
- UtilPlayer.message(player, F.value("/e tp ", "Teleport to Target"));
- UtilPlayer.message(player, F.value("/e tp here ", "Teleport Target to Self"));
- UtilPlayer.message(player, F.value("/e tp here all", "Teleport Everyone to Self"));
-
- UtilPlayer.message(player, F.value("/e gadget", "Toggle Gadgets"));
- UtilPlayer.message(player, F.value("/e gadget list", "Lists Gadgets (Shows Whitelist)"));
- UtilPlayer.message(player, F.value("/e gadget ", "Toggles Whitelist for Gadget"));
- UtilPlayer.message(player, F.value("/e gadget clear", "Clears Gadget Whitelist"));
-
- UtilPlayer.message(player, F.value("/e silence [Time]", "Silence Chat"));
-
- UtilPlayer.message(player, F.value("/e admin [Player]", "Toggle Event Admin"));
-
- UtilPlayer.message(player, F.value("/e gm [Player]", "Toggle Creative Mode"));
-
- UtilPlayer.message(player, F.value("/e radius [Radius]", "Set Forcefield Radius"));
-
- UtilPlayer.message(player, F.value("/e give - ", "Give Item"));
- UtilPlayer.message(player, F.value("/e give
- [e:#,e:#...]", "Give Item"));
-
- UtilPlayer.message(player, F.value("/e doublejump", "Toggles Double Jump"));
-
- UtilPlayer.message(player, F.value("/e scoreboard [Text]", "Sets Scoreboard Text"));
-
- UtilPlayer.message(player, F.value("/e mob [#Amount] n[Name] s[Size] [angry] [baby]", ""));
- UtilPlayer.message(player, F.value("/e mob kill ", "Kill Mobs"));
-
- UtilPlayer.message(player, F.value("/e kit set", "Sets Player Kit to your Hotbar"));
- UtilPlayer.message(player, F.value("/e kit apply", "Gives Kit to Players"));
- UtilPlayer.message(player, F.value("/e kit clear", "Gives Kit to Players"));
-
- UtilPlayer.message(player, F.value("/e effect ", ""));
- UtilPlayer.message(player, F.value("/e effect clear", ""));
- }
-
- private void commandHelpSettings(Player player)
- {
- UtilPlayer.message(player, F.main("Event", "Displaying Settings Commands;"));
- UtilPlayer.message(player, F.value("/e damage all", "Toggles All Damage"));
- UtilPlayer.message(player, F.value("/e damage pvp", "Toggles PvP Damage"));
- UtilPlayer.message(player, F.value("/e damage pve", "Toggles PvE Damage"));
- UtilPlayer.message(player, F.value("/e damage pve", "Toggles EvP Damage"));
- UtilPlayer.message(player, F.value("/e damage fall", "Toggles Fall Damage"));
- UtilPlayer.message(player, F.value("/e health <-1 to 20>", "Locks Players Health"));
- UtilPlayer.message(player, F.value("/e hunger <-1 to 20>", "Locks Players Hunger"));
- UtilPlayer.message(player, F.value("/e item drop", "Toggles Item Drop"));
- UtilPlayer.message(player, F.value("/e item pickup", "Toggles Item Pickup"));
- UtilPlayer.message(player, F.value("/e blockplace", "Toggles Block Placing (On/Off)"));
- UtilPlayer.message(player, F.value("/e blockplace whitelist ", ""));
- UtilPlayer.message(player, F.value("/e blockplace blacklist ", ""));
- UtilPlayer.message(player, F.value("/e blockbreak", "Toggles Block Breaking (On/Off)"));
- UtilPlayer.message(player, F.value("/e blockbreak whitelist ", ""));
- UtilPlayer.message(player, F.value("/e blockbreak blacklist ", ""));
- UtilPlayer.message(player, F.value("/e time <-1 to 24000>", "Sets World Time"));
- }
-
- //Command Handler
- @EventHandler(priority = EventPriority.LOWEST)
- private void commandHandler(PlayerCommandPreprocessEvent event)
- {
- if (!InProgress())
- return;
-
- if (!event.getMessage().toLowerCase().startsWith("/e "))
- return;
-
- event.setCancelled(true);
-
- if (!_mps.isAdmin(event.getPlayer(), false))
- return;
-
- //Trim off /e and split to args
- String[] args = event.getMessage().substring(3, event.getMessage().length()).split(" ");
-
- if (args.length == 0 || args[0].equalsIgnoreCase("help"))
- {
- commandHelp(event.getPlayer());
- }
- else if (args[0].equalsIgnoreCase("settings"))
- {
- if (args.length >= 2 && args[1].equalsIgnoreCase("list"))
- listSettings(event.getPlayer());
- else
- commandHelpSettings(event.getPlayer());
- }
-
- //XXX Commands
- else if (args[0].equalsIgnoreCase("tp"))
- {
- commandTeleport(event.getPlayer(), args);
- }
- else if (args[0].equalsIgnoreCase("gadget"))
- {
- commandGadget(event.getPlayer(), args);
- }
- else if (args[0].equalsIgnoreCase("silence"))
- {
- commandSilence(event.getPlayer(), args);
- }
- else if (args[0].equalsIgnoreCase("admin"))
- {
- commandAdmin(event.getPlayer(), args);
- }
- else if (args[0].equalsIgnoreCase("gm"))
- {
- commandGamemode(event.getPlayer(), args);
- }
- else if (args[0].equalsIgnoreCase("radius"))
- {
- commandForcefieldRadius(event.getPlayer(), args);
- }
- else if (args[0].equalsIgnoreCase("doublejump"))
- {
- commandDoubleJump(event.getPlayer(), args);
- }
- else if (args[0].equalsIgnoreCase("scoreboard"))
- {
- commandScoreboard(event.getPlayer(), args);
- }
- else if (args[0].equalsIgnoreCase("whitelist"))
- {
- commandWhitelist(event.getPlayer(), args);
- }
- else if (args[0].equalsIgnoreCase("give"))
- {
- commandGive(event.getPlayer(), args);
- }
- else if (args[0].equalsIgnoreCase("effect"))
- {
- commandEffect(event.getPlayer(), args);
- }
- else if (args[0].equalsIgnoreCase("kit"))
- {
- commandKit(event.getPlayer(), args);
- }
- else if (args[0].equalsIgnoreCase("mob"))
- {
- if (args.length >= 2 && args[1].equalsIgnoreCase("kill"))
- commandMobKill(event.getPlayer(), args);
- else
- commandMob(event.getPlayer(), args);
- }
-
-
- //XXX Settings
- else if (event.getMessage().toLowerCase().equals("/e damage all"))
- {
- Damage = !Damage;
- Announce(F.main("Event Settings", F.value("Damage All", F.tf(Damage))));
- }
- else if (event.getMessage().toLowerCase().equals("/e damage pvp"))
- {
- DamagePvP = !DamagePvP;
- Announce(F.main("Event Settings", F.value("Damage PvP", F.tf(DamagePvP))));
- }
- else if (event.getMessage().toLowerCase().equals("/e damage pve"))
- {
- DamagePvE = !DamagePvE;
- Announce(F.main("Event Settings", F.value("Damage PvE", F.tf(DamagePvE))));
- }
- else if (event.getMessage().toLowerCase().equals("/e damage evp"))
- {
- DamageEvP = !DamageEvP;
- Announce(F.main("Event Settings", F.value("Damage EvP", F.tf(DamageEvP))));
- }
- else if (event.getMessage().toLowerCase().equals("/e damage fall"))
- {
- DamageFall = !DamageFall;
- Announce(F.main("Event Settings", F.value("Damage Fall", F.tf(DamageFall))));
- }
- else if (args[0].equalsIgnoreCase("health"))
- {
- commandHealth(event.getPlayer(), args);
- }
- else if (args[0].equalsIgnoreCase("hunger"))
- {
- commandHunger(event.getPlayer(), args);
- }
- else if (event.getMessage().toLowerCase().equals("/e item drop"))
- {
- ItemDrop = !ItemDrop;
- Announce(F.main("Event Settings", F.value("Item Drop", F.tf(ItemDrop))));
- }
- else if (event.getMessage().toLowerCase().equals("/e item pickup"))
- {
- ItemPickup = !ItemPickup;
- Announce(F.main("Event Settings", F.value("Item Pickup", F.tf(ItemPickup))));
- }
- else if (event.getMessage().toLowerCase().equals("/e blockplace"))
- {
- BlockPlace = !BlockPlace;
- Announce(F.main("Event Settings", F.value("Block Place", F.tf(BlockPlace))));
- }
- else if (args.length >= 4 && args[0].equalsIgnoreCase("blockplace")
- && (args[1].equalsIgnoreCase("whitelist") || args[1].equalsIgnoreCase("blacklist")))
- {
- commandBlockPlace(event.getPlayer(), args, args[1].equalsIgnoreCase("whitelist"), args[2]);
- }
- else if (event.getMessage().toLowerCase().equals("/e blockbreak"))
- {
- BlockBreak = !BlockBreak;
- Announce(F.main("Event Settings", F.value("Block Break", F.tf(BlockBreak))));
- }
- else if (args.length >= 4 && args[0].equalsIgnoreCase("blockbreak")
- && (args[1].equalsIgnoreCase("whitelist") || args[1].equalsIgnoreCase("blacklist")))
- {
- commandBlockBreak(event.getPlayer(), args, args[1].equalsIgnoreCase("whitelist"), args[2]);
- }
- else if (args[0].equalsIgnoreCase("time"))
- {
- commandTime(event.getPlayer(), args);
- }
- }
-
- private void listSettings(Player player)
- {
- UtilPlayer.message(player, F.value("Damage All", F.tf(Damage)));
- UtilPlayer.message(player, F.value("Damage PvP", F.tf(DamagePvP)));
- UtilPlayer.message(player, F.value("Damage PvE", F.tf(DamagePvE)));
- UtilPlayer.message(player, F.value("Damage EvP", F.tf(DamageEvP)));
- UtilPlayer.message(player, F.value("Damage Fall", F.tf(DamageFall)));
- UtilPlayer.message(player, F.value("Health Set", HealthSet+""));
- UtilPlayer.message(player, F.value("Hunger Set", HungerSet+""));
- UtilPlayer.message(player, F.value("Item Pickup", F.tf(ItemPickup)));
- UtilPlayer.message(player, F.value("Item Drop", F.tf(ItemDrop)));
- UtilPlayer.message(player, F.value("Block Place", F.tf(BlockPlace)));
- UtilPlayer.message(player, F.value("Block Place Whitelist", UtilText.listToString(BlockPlaceAllow, true)));
- UtilPlayer.message(player, F.value("Block Place Blacklist", UtilText.listToString(BlockPlaceDeny, true)));
- UtilPlayer.message(player, F.value("Block Break", F.tf(BlockPlace)));
- UtilPlayer.message(player, F.value("Block Break Whitelist", UtilText.listToString(BlockBreakAllow, true)));
- UtilPlayer.message(player, F.value("Block Break Blacklist", UtilText.listToString(BlockBreakDeny, true)));
- UtilPlayer.message(player, F.value("Time Set", WorldTimeSet+""));
- }
-
- private void commandBlockPlace(Player player, String[] args, boolean whitelist, String command)
- {
- try
- {
- int blockId = Integer.parseInt(args[3]);
-
- if (whitelist)
- {
- if (command.equalsIgnoreCase("add"))
- {
- BlockPlaceAllow.add(blockId);
- UtilPlayer.message(player, F.main("Event Settings", F.value("Block Place Whitelist", "Added " + blockId)));
- }
- else if (command.equalsIgnoreCase("remove"))
- {
- BlockPlaceAllow.remove(blockId);
- UtilPlayer.message(player, F.main("Event Settings", F.value("Block Place Whitelist", "Removed " + blockId)));
- }
- else if (command.equalsIgnoreCase("clear"))
- {
- BlockPlaceAllow.clear();
- UtilPlayer.message(player, F.main("Event Settings", F.value("Block Place Whitelist", "Cleared")));
- }
- else if (command.equalsIgnoreCase("list"))
- {
- UtilPlayer.message(player, F.main("Event Settings", F.value("Block Place Whitelist", UtilText.listToString(BlockPlaceAllow, true))));
- }
- }
- else
- {
- if (command.equalsIgnoreCase("add"))
- {
- BlockPlaceDeny.add(blockId);
- UtilPlayer.message(player, F.main("Event Settings", F.value("Block Place Blacklist", "Added " + blockId)));
- }
- else if (command.equalsIgnoreCase("remove"))
- {
- BlockPlaceDeny.remove(blockId);
- UtilPlayer.message(player, F.main("Event Settings", F.value("Block Place Blacklist", "Removed " + blockId)));
- }
- else if (command.equalsIgnoreCase("clear"))
- {
- BlockPlaceDeny.clear();
- UtilPlayer.message(player, F.main("Event Settings", F.value("Block Place Blacklist", "Cleared")));
- }
- else if (command.equalsIgnoreCase("list"))
- {
- UtilPlayer.message(player, F.main("Event Settings", F.value("Block Place Blacklist", UtilText.listToString(BlockPlaceDeny, true))));
- }
- }
-
- return;
- }
- catch (Exception e)
- {
-
- }
-
- commandHelpSettings(player);
- }
-
- private void commandBlockBreak(Player player, String[] args, boolean whitelist, String command)
- {
- try
- {
- int blockId = Integer.parseInt(args[3]);
-
- if (whitelist)
- {
- if (command.equalsIgnoreCase("add"))
- {
- BlockBreakAllow.add(blockId);
- UtilPlayer.message(player, F.main("Event Settings", F.value("Block Break Whitelist", "Added " + blockId)));
- }
- else if (command.equalsIgnoreCase("remove"))
- {
- BlockBreakAllow.remove(blockId);
- UtilPlayer.message(player, F.main("Event Settings", F.value("Block Break Whitelist", "Removed " + blockId)));
- }
- else if (command.equalsIgnoreCase("clear"))
- {
- BlockBreakAllow.clear();
- UtilPlayer.message(player, F.main("Event Settings", F.value("Block Break Whitelist", "Cleared")));
- }
- else if (command.equalsIgnoreCase("list"))
- {
- UtilPlayer.message(player, F.main("Event Settings", F.value("Block Break Whitelist", UtilText.listToString(BlockBreakAllow, true))));
- }
- }
- else
- {
- if (command.equalsIgnoreCase("add"))
- {
- BlockBreakDeny.add(blockId);
- UtilPlayer.message(player, F.main("Event Settings", F.value("Block Break Blacklist", "Added " + blockId)));
- }
- else if (command.equalsIgnoreCase("remove"))
- {
- BlockBreakDeny.remove(blockId);
- UtilPlayer.message(player, F.main("Event Settings", F.value("Block Break Blacklist", "Removed " + blockId)));
- }
- else if (command.equalsIgnoreCase("clear"))
- {
- BlockBreakDeny.clear();
- UtilPlayer.message(player, F.main("Event Settings", F.value("Block Break Blacklist", "Cleared")));
- }
- else if (command.equalsIgnoreCase("list"))
- {
- UtilPlayer.message(player, F.main("Event Settings", F.value("Block Break Blacklist", UtilText.listToString(BlockBreakDeny, true))));
- }
- }
-
- return;
- }
- catch (Exception e)
- {
-
- }
-
- commandHelpSettings(player);
- }
-
- private void commandHealth(Player player, String[] args)
- {
- try
- {
- if (args.length >= 2)
- {
- int health = Integer.parseInt(args[1]);
-
- if (health <= 0)
- health = -1;
- if (health > 20)
- health = 20;
-
- HealthSet = health;
-
- if (HealthSet == -1)
- Announce(F.main("Event Settings", F.value("Health Set", "Disabled")));
- else
- Announce(F.main("Event Settings", F.value("Health Set", HealthSet + "")));
-
- return;
- }
- }
- catch (Exception e)
- {
-
- }
-
- commandHelpSettings(player);
- }
-
- private void commandHunger(Player player, String[] args)
- {
- try
- {
- if (args.length >= 2)
- {
- int hunger = Integer.parseInt(args[1]);
-
- if (hunger <= 0)
- hunger = -1;
- if (hunger > 20)
- hunger = 20;
-
- HungerSet = hunger;
-
- if (HungerSet == -1)
- Announce(F.main("Event Settings", F.value("Hunger Set", "Disabled")));
- else
- Announce(F.main("Event Settings", F.value("Hunger Set", HungerSet + "")));
-
- return;
- }
- }
- catch (Exception e)
- {
-
- }
-
- commandHelpSettings(player);
- }
-
- private void commandTime(Player player, String[] args)
- {
- try
- {
- if (args.length >= 2)
- {
- int time = Integer.parseInt(args[1]);
-
- if (time <= -1)
- time = -1;
- if (time > 24000)
- time = 24000;
-
- WorldTimeSet = time;
-
- if (WorldTimeSet == -1)
- Announce(F.main("Event Settings", F.value("Time Set", "Disabled")));
- else
- Announce(F.main("Event Settings", F.value("Time Set", WorldTimeSet + "")));
-
- return;
- }
- }
- catch (Exception e)
- {
-
- }
-
- commandHelpSettings(player);
- }
-
- //Teleport Command (To, Here, All)
- private void commandTeleport(Player player, String[] args)
- {
- if (args.length >= 3 && args[1].equalsIgnoreCase("here"))
- {
- if (args[2].equalsIgnoreCase("all"))
- {
- for (Player other : UtilServer.getPlayers())
- {
- UtilPlayer.message(other, F.main("Event TP", player.getName() + " teleported everyone to self."));
- other.teleport(player);
- }
-
- return;
- }
-
- Player target = UtilPlayer.searchOnline(player, args[2], true);
- if (target != null)
- {
- target.teleport(player);
- UtilPlayer.message(target, F.main("Event TP", player.getName() + " teleported you to self."));
- UtilPlayer.message(player, F.main("Event TP", "Teleported " + target.getName() + " to you."));
- }
-
- return;
- }
-
- if (args.length >= 2)
- {
- Player target = UtilPlayer.searchOnline(player, args[1], true);
- if (target != null)
- {
- player.teleport(target);
- UtilPlayer.message(player, F.main("Event TP", "Teleported to " + target.getName() + "."));
- }
-
- return;
- }
-
- commandHelp(player);
- }
-
- //Gadget Commands (Global & Individual)
- private void commandGadget(Player player, String[] args)
- {
- if (args.length < 2)
- {
- _allowAllGadgets = !_allowAllGadgets;
-
- if (!_allowAllGadgets)
- {
- Manager.getCosmeticManager().getMountManager().DisableAll();
- Manager.getCosmeticManager().getGadgetManager().DisableAll();
- }
-
- Announce(F.main("Inventory", F.value("Allow All Gadgets", F.ed(_allowAllGadgets))));
- return;
- }
-
- if (args.length >= 2 && args[1].equalsIgnoreCase("clear"))
- {
- _gadgetWhitelist.clear();
- Announce(F.main("Inventory", F.value("Gadget Whitelist", "Cleared.")));
- return;
- }
-
- if (args.length >= 2 && args[1].equalsIgnoreCase("list"))
- {
- ChatColor color = ChatColor.AQUA;
-
- //Gadgets
- for (GadgetType type : GadgetType.values())
- {
- String items = C.Bold + type + " Gadgets> ";
-
- for (Gadget gadget : Manager.getCosmeticManager().getGadgetManager().getGadgets(type))
- {
- items += color + gadget.GetName().replaceAll(" ", "") + " ";
- color = (color == ChatColor.AQUA ? ChatColor.DARK_AQUA : ChatColor.AQUA);
- }
-
- UtilPlayer.message(player, items);
- }
-
- //Mounts
- String mounts = C.Bold + "Mount Gadgets> ";
- for (Mount> mount : Manager.getCosmeticManager().getMountManager().getMounts())
- {
- mounts += color + mount.GetName().replaceAll(" ", "") + " ";
- color = (color == ChatColor.AQUA ? ChatColor.DARK_AQUA : ChatColor.AQUA);
- }
- UtilPlayer.message(player, mounts);
-
- return;
- }
-
- if (args.length >= 2)
- {
- //Gadgets
- for (GadgetType type : GadgetType.values())
- {
- for (Gadget gadget : Manager.getCosmeticManager().getGadgetManager().getGadgets(type))
- {
- if (gadget.GetName().replaceAll(" ", "").equalsIgnoreCase(args[1]))
- {
- if (_gadgetWhitelist.remove(gadget))
- {
- Announce(F.main("Inventory", F.value(gadget.GetName() + " Gadget", F.ed(false))));
- gadget.DisableForAll();
- }
- else
- {
- Announce(F.main("Inventory", F.value(gadget.GetName() + " Gadget", F.ed(true))));
- _gadgetWhitelist.add(gadget);
- }
-
- return;
- }
- }
- }
-
- //Mounts
- for (Mount mount : Manager.getCosmeticManager().getMountManager().getMounts())
- {
- if (mount.GetName().replaceAll(" ", "").equalsIgnoreCase(args[1]))
- {
- if (_gadgetWhitelist.remove(mount))
- {
- Announce(F.main("Inventory", F.value(mount.GetName() + " Gadget", F.ed(false))));
- mount.DisableForAll();
- }
- else
- {
- Announce(F.main("Inventory", F.value(mount.GetName() + " Gadget", F.ed(true))));
- _gadgetWhitelist.add(mount);
- }
-
- return;
- }
- }
-
- UtilPlayer.message(player, F.main("Inventory", args[1] + " is not a valid gadget."));
-
- return;
- }
-
- commandHelp(player);
- }
-
- //Silence
- private void commandSilence(Player player, String[] args)
- {
- try
- {
- //Toggle
- if (args.length == 1)
- {
- //Disable
- if (Manager.GetChat().Silenced() != 0)
- {
- Manager.GetChat().Silence(0, true);
- }
- //Enable
- else
- {
- Manager.GetChat().Silence(-1, true);
- }
- }
- //Timer
- else
- {
- long time = (long) (Double.valueOf(args[1]) * 3600000);
-
- Manager.GetChat().Silence(time, true);
- }
- }
- catch (Exception e)
- {
- UtilPlayer.message(player, F.main("Chat", "Invalid Time Parameter."));
- }
- }
-
- //Gamemode (Self and Others)
- private void commandAdmin(Player player, String[] args)
- {
- Player target = player;
-
- if (args.length >= 2)
- {
- Player newTarget = UtilPlayer.searchOnline(player, args[1], true);
- if (newTarget != null)
- target = newTarget;
- else
- return;
- }
-
- if (!Manager.GetGameHostManager().isAdmin(target, false))
- Manager.GetGameHostManager().giveAdmin(target);
- else
- Manager.GetGameHostManager().removeAdmin(target.getName());
-
- UtilPlayer.message(player, F.main("Event Admin", target.getName() + " Admin: " + F.tf(Manager.GetGameHostManager().isAdmin(target, false))));
- }
-
- //Gamemode (Self and Others)
- private void commandGamemode(Player player, String[] args)
- {
- Player target = player;
-
- if (args.length >= 2)
- {
- Player newTarget = UtilPlayer.searchOnline(player, args[1], true);
- if (newTarget != null)
- target = newTarget;
- else
- return;
- }
-
- if (target.getGameMode() == GameMode.CREATIVE)
- target.setGameMode(GameMode.SURVIVAL);
- else
- target.setGameMode(GameMode.CREATIVE);
-
- UtilPlayer.message(player, F.main("Event GM", target.getName() + " Creative: " + F.tf(target.getGameMode() == GameMode.CREATIVE)));
- }
-
- //Forcefield
- private void commandForcefieldRadius(Player player, String[] args)
- {
- //Toggle
- if (args.length >= 2)
- {
- try
- {
- int range = Integer.parseInt(args[1]);
-
- _forcefield.put(player.getName(), range);
-
- UtilPlayer.message(player, F.main("Forcefield", "Enabled with " + F.elem(range + "") + " radius."));
- }
- catch (Exception e)
- {
- UtilPlayer.message(player, F.main("Forcefield", "Invalid Input."));
- }
- }
- else
- {
- _forcefield.remove(player.getName());
- UtilPlayer.message(player, F.main("Forcefield", "Disabled."));
- }
- }
-
- //Give
- private void commandGive(Player player, String[] args)
- {
- String[] newArgs = new String[args.length-1];
-
- for (int i=0 ; i= 2)
- {
- //Line
- int line = 0;
- try
- {
- line = Integer.parseInt(args[1]);
- }
- catch (Exception e)
- {
- UtilPlayer.message(player, F.main("Scoreboard", "Invalid Line Number."));
- return;
- }
-
- if (line < 1 || line > 14)
- {
- UtilPlayer.message(player, F.main("Scoreboard", "Invalid Line Number."));
- return;
- }
-
- //Text
- String lineText = "";
-
- //Reset String
- if (args.length <= 2)
- for (int i=0 ; i= 2 && args[1].equalsIgnoreCase("clear"))
- {
- for (int i=0 ; i<_sideText.length ; i++)
- {
- String lineText = "";
- for (int j=0 ; j= 2)
- {
- if (args[1].equalsIgnoreCase("on") || args[1].equalsIgnoreCase("off"))
- {
- UtilServer.getServer().setWhitelist(args[1].equalsIgnoreCase("on"));
-
- Announce(F.main("Event Settings", F.value("Whitelist", F.tf(args[1].equalsIgnoreCase("on")))));
- return;
- }
- }
-
- //Add and Remove
- if (args.length >= 3)
- {
- if (args[1].equalsIgnoreCase("add") || args[1].equalsIgnoreCase("remove"))
- {
- OfflinePlayer target = Bukkit.getOfflinePlayer(args[2]);
-
- if (args[1].equalsIgnoreCase("add"))
- {
- UtilServer.getServer().getWhitelistedPlayers().add(target);
- UtilPlayer.message(player, F.main("Whitelist", "Added " + args[2] + " to the whitelist."));
- }
- else
- {
- UtilServer.getServer().getWhitelistedPlayers().remove(target);
- UtilPlayer.message(player, F.main("Whitelist", "Removed " + args[2] + " to the whitelist."));
- }
-
- return;
- }
- }
-
- commandHelp(player);
- }
-
- //Mob
- private void commandMob(Player caller, String[] args)
- {
- if (args.length == 1)
- {
- HashMap entMap = new HashMap();
-
- int count = 0;
- for (World world : UtilServer.getServer().getWorlds())
- {
- for (Entity ent : world.getEntities())
- {
- if (!entMap.containsKey(ent.getType()))
- entMap.put(ent.getType(), 0);
-
- entMap.put(ent.getType(), 1 + entMap.get(ent.getType()));
- count++;
- }
- }
-
- UtilPlayer.message(caller, F.main("Creature", "Listing Entities:"));
- for (EntityType cur : entMap.keySet())
- {
- UtilPlayer.message(caller, F.desc(UtilEnt.getName(cur), entMap.get(cur)+""));
- }
-
- UtilPlayer.message(caller, F.desc("Total", count+""));
- }
- else
- {
- EntityType type = UtilEnt.searchEntity(caller, args[1], true);
-
- if (type == null)
- return;
-
- UtilPlayer.message(caller, F.main("Creature", "Spawning Creature(s);"));
-
- //Store Args
- HashSet argSet = new HashSet();
- for (int i = 2 ; i < args.length ; i++)
- if (args[i].length() > 0)
- argSet.add(args[i]);
-
-
- //Search Count
- int count = 1;
- HashSet argHandle = new HashSet();
- for (String arg : argSet)
- {
- try
- {
- int newCount = Integer.parseInt(arg);
-
- if (newCount <= 0)
- continue;
-
- //Set Count
- count = newCount;
- UtilPlayer.message(caller, F.desc("Amount", count+""));
-
- //Flag Arg
- argHandle.add(arg);
- break;
- }
- catch (Exception e)
- {
- //None
- }
- }
- for (String arg : argHandle)
- argSet.remove(arg);
-
- //Spawn
- HashSet entSet = new HashSet();
- for (int i = 0 ; i < count ; i++)
- {
- CreatureAllowOverride = true;
- entSet.add(Manager.GetCreature().SpawnEntity(caller.getTargetBlock(null, 0).getLocation().add(0.5, 1, 0.5), type));
- CreatureAllowOverride = false;
- }
-
- //Search Vars
- for (String arg : argSet)
- {
- if (arg.length() == 0)
- continue;
-
- //Baby
- else if (arg.equalsIgnoreCase("baby") || arg.equalsIgnoreCase("b"))
- {
- for (Entity ent : entSet)
- {
- if (ent instanceof Ageable)
- ((Ageable)ent).setBaby();
- else if (ent instanceof Zombie)
- ((Zombie)ent).setBaby(true);
- }
-
- UtilPlayer.message(caller, F.desc("Baby", "True"));
- argHandle.add(arg);
- }
-
- //Lock
- else if (arg.equalsIgnoreCase("age") || arg.equalsIgnoreCase("lock"))
- {
- for (Entity ent : entSet)
- if (ent instanceof Ageable)
- {
- ((Ageable)ent).setAgeLock(true);
- UtilPlayer.message(caller, F.desc("Age", "False"));
- }
-
- argHandle.add(arg);
- }
-
- //Angry
- else if (arg.equalsIgnoreCase("angry") || arg.equalsIgnoreCase("a"))
- {
- for (Entity ent : entSet)
- if (ent instanceof Wolf)
- ((Wolf)ent).setAngry(true);
-
- for (Entity ent : entSet)
- if (ent instanceof Skeleton)
- ((Skeleton)ent).setSkeletonType(SkeletonType.WITHER);
-
- UtilPlayer.message(caller, F.desc("Angry", "True"));
- argHandle.add(arg);
- }
-
- //Profession
- else if (arg.toLowerCase().charAt(0) == 'p')
- {
- try
- {
- String prof = arg.substring(1, arg.length());
-
- Profession profession = null;
- for (Profession cur : Profession.values())
- if (cur.name().toLowerCase().contains(prof.toLowerCase()))
- profession = cur;
-
- UtilPlayer.message(caller, F.desc("Profession", profession.name()));
-
- for (Entity ent : entSet)
- if (ent instanceof Villager)
- ((Villager)ent).setProfession(profession);
- }
- catch (Exception e)
- {
- UtilPlayer.message(caller, F.desc("Profession", "Invalid [" + arg + "] on " + type.name()));
- }
- argHandle.add(arg);
- }
-
- //Size
- else if (arg.toLowerCase().charAt(0) == 's')
- {
- try
- {
- String size = arg.substring(1, arg.length());
-
- UtilPlayer.message(caller, F.desc("Size", Integer.parseInt(size)+""));
-
- for (Entity ent : entSet)
- if (ent instanceof Slime)
- ((Slime)ent).setSize(Integer.parseInt(size));
- }
- catch (Exception e)
- {
- UtilPlayer.message(caller, F.desc("Size", "Invalid [" + arg + "] on " + type.name()));
- }
- argHandle.add(arg);
- }
-
- else if (arg.toLowerCase().charAt(0) == 'n' && arg.length() > 1)
- {
- try
- {
- String name = "";
-
- for (char c : arg.substring(1, arg.length()).toCharArray())
- {
- if (c != '_')
- name += c;
- else
- name += " ";
- }
-
- for (Entity ent : entSet)
- {
- if (ent instanceof CraftLivingEntity)
- {
- CraftLivingEntity cEnt = (CraftLivingEntity)ent;
- cEnt.setCustomName(name);
- cEnt.setCustomNameVisible(true);
- }
- }
- }
- catch (Exception e)
- {
- UtilPlayer.message(caller, F.desc("Size", "Invalid [" + arg + "] on " + type.name()));
- }
- argHandle.add(arg);
- }
- }
- for (String arg : argHandle)
- argSet.remove(arg);
-
- for (String arg : argSet)
- UtilPlayer.message(caller, F.desc("Unhandled", arg));
-
- //Inform
- UtilPlayer.message(caller, F.main("Creature", "Spawned " + count + " " + UtilEnt.getName(type) + "."));
- }
- }
-
- private void commandMobKill(Player caller, String[] args)
- {
- if (args.length < 3)
- {
- UtilPlayer.message(caller, F.main("Creature", "Missing Entity Type Parameter."));
- return;
- }
-
- EntityType type = UtilEnt.searchEntity(caller, args[2], true);
-
- if (type == null && !args[2].equalsIgnoreCase("all"))
- return;
-
- int count = 0;
- List killList = new ArrayList();
-
- for (World world : UtilServer.getServer().getWorlds())
- {
- for (Entity ent : world.getEntities())
- {
- if (ent.getType() == EntityType.PLAYER)
- continue;
-
- if (type == null || ent.getType() == type)
- {
- killList.add(ent);
- }
- }
- }
-
- CreatureKillEntitiesEvent event = new CreatureKillEntitiesEvent(killList);
- UtilServer.getServer().getPluginManager().callEvent(event);
-
- for (Entity entity : event.GetEntities())
- {
- entity.remove();
- count++;
- }
-
- String target = "ALL";
- if (type != null)
- target = UtilEnt.getName(type);
-
- UtilPlayer.message(caller, F.main("Creature", "Killed " + target + ". " + count + " Removed."));
- }
-
- private void commandKit(Player caller, String[] args)
- {
- if (args.length >= 2 && args[1].equalsIgnoreCase("apply"))
- {
- for (Player player : UtilServer.getPlayers())
- giveItems(player);
-
- Announce(F.main("Event Settings", F.value("Player Kit", "Applied to Players")));
- return;
- }
-
- if (args.length >= 2 && args[1].equalsIgnoreCase("clear"))
- {
- _kitItems = new ItemStack[6];
- Announce(F.main("Event Settings", F.value("Player Kit", "Cleared Kit")));
- return;
- }
-
- if (args.length >= 2 && args[1].equalsIgnoreCase("set"))
- {
- _kitItems = new ItemStack[6];
-
- for (int i=0 ; i<6 ; i++)
- {
- if (caller.getInventory().getItem(i) != null)
- _kitItems[i] = caller.getInventory().getItem(i).clone();
- else
- _kitItems[i] = null;
- }
-
- Announce(F.main("Event Settings", F.value("Player Kit", "Updated Items")));
- return;
- }
-
- commandHelp(caller);
- }
-
- private void commandEffect(Player caller, String[] args)
- {
- //Clear
- if (args.length >= 3 && args[2].equalsIgnoreCase("clear"))
- {
- //Get Targets
- LinkedList targets = new LinkedList();
-
- if (args[1].equalsIgnoreCase("all"))
- {
- for (Player cur : UtilServer.getPlayers())
- targets.add(cur);
- }
- else
- {
- targets = UtilPlayer.matchOnline(caller, args[1], true);
- if (targets.isEmpty())
- return;
- }
-
- for (Player player : targets)
- {
- //Remove all conditions
- Manager.GetCondition().EndCondition(player, null, null);
-
- //Remove all effects
- player.removePotionEffect(PotionEffectType.ABSORPTION);
- player.removePotionEffect(PotionEffectType.BLINDNESS);
- player.removePotionEffect(PotionEffectType.CONFUSION);
- player.removePotionEffect(PotionEffectType.DAMAGE_RESISTANCE);
- player.removePotionEffect(PotionEffectType.FAST_DIGGING);
- player.removePotionEffect(PotionEffectType.FIRE_RESISTANCE);
- player.removePotionEffect(PotionEffectType.HARM);
- player.removePotionEffect(PotionEffectType.HEAL);
- player.removePotionEffect(PotionEffectType.HEALTH_BOOST);
- player.removePotionEffect(PotionEffectType.HUNGER);
- player.removePotionEffect(PotionEffectType.INCREASE_DAMAGE);
- player.removePotionEffect(PotionEffectType.INVISIBILITY);
- player.removePotionEffect(PotionEffectType.JUMP);
- player.removePotionEffect(PotionEffectType.NIGHT_VISION);
- player.removePotionEffect(PotionEffectType.POISON);
- player.removePotionEffect(PotionEffectType.REGENERATION);
- player.removePotionEffect(PotionEffectType.SATURATION);
- player.removePotionEffect(PotionEffectType.SLOW);
- player.removePotionEffect(PotionEffectType.SLOW_DIGGING);
- player.removePotionEffect(PotionEffectType.SPEED);
- player.removePotionEffect(PotionEffectType.WATER_BREATHING);
- player.removePotionEffect(PotionEffectType.WEAKNESS);
- player.removePotionEffect(PotionEffectType.WITHER);
- }
-
- return;
- }
-
- //Apply
- if (args.length >= 5)
- {
- //Get Targets
- LinkedList targets = new LinkedList();
-
- if (args[1].equalsIgnoreCase("all"))
- {
- for (Player cur : UtilServer.getPlayers())
- targets.add(cur);
- }
- else
- {
- targets = UtilPlayer.matchOnline(caller, args[1], true);
- if (targets.isEmpty())
- return;
- }
-
- //Get Type
- PotionEffectType type = PotionEffectType.getByName(args[2]);
- if (type == null)
- {
- UtilPlayer.message(caller, F.main("Effect", "Invalid Effect Type: " + args[2]));
- UtilPlayer.message(caller, F.value("Valid Types", "http://minecraft.gamepedia.com/Status_effect"));
- return;
- }
-
- //Get Multiplier
- int mult = 0;
- try
- {
- mult = Integer.parseInt(args[3]);
-
- if (mult <= 0)
- mult = 0;
- if (mult > 255)
- mult = 255;
- }
- catch (Exception e)
- {
- UtilPlayer.message(caller, F.main("Effect", "Invalid Effect Level: " + args[3]));
- return;
- }
-
- //Get Duration
- int dur = 0;
- try
- {
- dur = Integer.parseInt(args[4]);
-
- if (dur <= 0)
- dur = 0;
- }
- catch (Exception e)
- {
- UtilPlayer.message(caller, F.main("Effect", "Invalid Effect Duration: " + args[4]));
- return;
- }
-
- //Apply
- PotionEffect effect = new PotionEffect(type, dur*20, mult);
- for (Player cur : targets)
- {
- cur.addPotionEffect(effect);
- }
-
- if (args[1].equalsIgnoreCase("all"))
- Announce(F.main("Effect", F.value("Applied Effect", type.getName() + " " + (mult+1) + " for " + dur + "s")));
- else
- UtilPlayer.message(caller, F.main("Effect", "Applied " + type.getName() + " " + (mult+1) + " for " + dur + "s for Targets."));
-
- return;
- }
-
- commandHelp(caller);
- }
-
@EventHandler
public void doubleJumpTrigger(PlayerToggleFlightEvent event)
{
@@ -1685,4 +387,81 @@ public class EventGame extends SoloGame
{
event.getDrops().clear();
}
+
+ public boolean isAllowGadget()
+ {
+ return _allowAllGadgets;
+ }
+
+ public void setAllowGadget(boolean var)
+ {
+ _allowAllGadgets = var;
+ }
+
+ public HashSet getGadgetWhitelist()
+ {
+ return _gadgetWhitelist;
+ }
+
+ public boolean isDoubleJump()
+ {
+ return _doubleJump;
+ }
+
+ public void setDoubleJump(boolean var)
+ {
+ _doubleJump = var;
+ }
+
+ public NautHashMap getForcefieldList()
+ {
+ return _forcefield;
+ }
+
+ public ItemStack[] getKitItems()
+ {
+ return _kitItems;
+ }
+
+ public void setKitItems(ItemStack[] kit)
+ {
+ _kitItems = kit;
+ }
+
+ public String[] getSideText()
+ {
+ return _sideText;
+ }
+
+ @Override
+ public List getWinners()
+ {
+ if (GetState().ordinal() >= GameState.End.ordinal())
+ {
+ List places = GetTeamList().get(0).GetPlacements(true);
+
+ if (places.isEmpty() || !places.get(0).isOnline())
+ return Arrays.asList();
+ else
+ return Arrays.asList(places.get(0));
+ }
+ else
+ return null;
+ }
+
+ @Override
+ public List getLosers()
+ {
+ List winners = getWinners();
+
+ if (winners == null)
+ return null;
+
+ List losers = GetTeamList().get(0).GetPlayers(false);
+
+ losers.removeAll(winners);
+
+ return losers;
+ }
+
}
diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventModule.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventModule.java
new file mode 100644
index 000000000..05d3129cd
--- /dev/null
+++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventModule.java
@@ -0,0 +1,1674 @@
+package nautilus.game.arcade.game.games.event;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.LinkedList;
+import java.util.List;
+
+import mineplex.core.MiniPlugin;
+import mineplex.core.common.util.C;
+import mineplex.core.common.util.F;
+import mineplex.core.common.util.NautHashMap;
+import mineplex.core.common.util.UtilEnt;
+import mineplex.core.common.util.UtilPlayer;
+import mineplex.core.common.util.UtilServer;
+import mineplex.core.common.util.UtilText;
+import mineplex.core.creature.event.CreatureKillEntitiesEvent;
+import mineplex.core.gadget.types.Gadget;
+import mineplex.core.gadget.types.GadgetType;
+import mineplex.core.give.Give;
+import mineplex.core.mount.Mount;
+import mineplex.core.updater.UpdateType;
+import mineplex.core.updater.event.UpdateEvent;
+import nautilus.game.arcade.ArcadeManager;
+
+import org.bukkit.Bukkit;
+import org.bukkit.ChatColor;
+import org.bukkit.GameMode;
+import org.bukkit.Material;
+import org.bukkit.OfflinePlayer;
+import org.bukkit.World;
+import org.bukkit.craftbukkit.v1_7_R4.entity.CraftLivingEntity;
+import org.bukkit.entity.Ageable;
+import org.bukkit.entity.Entity;
+import org.bukkit.entity.EntityType;
+import org.bukkit.entity.Player;
+import org.bukkit.entity.Skeleton;
+import org.bukkit.entity.Slime;
+import org.bukkit.entity.Villager;
+import org.bukkit.entity.Wolf;
+import org.bukkit.entity.Zombie;
+import org.bukkit.entity.Skeleton.SkeletonType;
+import org.bukkit.entity.Villager.Profession;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.EventPriority;
+import org.bukkit.event.entity.EntityChangeBlockEvent;
+import org.bukkit.event.player.PlayerCommandPreprocessEvent;
+import org.bukkit.inventory.ItemStack;
+import org.bukkit.plugin.java.JavaPlugin;
+import org.bukkit.potion.PotionEffect;
+import org.bukkit.potion.PotionEffectType;
+
+public class EventModule extends MiniPlugin
+{
+
+ public ArcadeManager Manager;
+
+ private NautHashMap _potionEffectsDuration = new NautHashMap<>();
+ private NautHashMap _potionEffectsMult = new NautHashMap<>();
+
+ private boolean _mobGriefing = true;
+
+ public EventModule(ArcadeManager manager, JavaPlugin plugin)
+ {
+ super("EventModule", plugin);
+ Manager = manager;
+ }
+
+ @EventHandler
+ public void mobGriefing(EntityChangeBlockEvent event)
+ {
+ if(!_mobGriefing)
+ {
+ event.setCancelled(true);
+ }
+ }
+
+ @EventHandler
+ public void setHostDebug(PlayerCommandPreprocessEvent event)
+ {
+ if (!event.getPlayer().isOp())
+ return;
+
+ if (!event.getMessage().toLowerCase().startsWith("/sethost "))
+ return;
+
+ Manager.GetServerConfig().HostName = event.getMessage().split(" ")[1];
+
+ event.getPlayer().sendMessage("Set host to: " + event.getMessage().split(" ")[1]);
+
+ Manager.GetGameHostManager().setHost(Bukkit.getPlayerExact(Manager.GetServerConfig().HostName));
+ if (Manager.GetGameHostManager().getHost() != null)
+ Manager.GetGameHostManager().setHostRank(Manager.GetClients().Get(Manager.GetGameHostManager().getHost()).GetRank());
+
+ Manager.GetGameHostManager().setDefaultConfig();
+
+ event.setCancelled(true);
+ }
+
+ private void commandHelp(Player player)
+ {
+ UtilPlayer.message(player, F.main("Event", "Displaying Commands;"));
+
+ UtilPlayer.message(player, F.value("/e settings", "View Settings Help"));
+
+ UtilPlayer.message(player, F.value("/e tp ", "Teleport to Target"));
+ UtilPlayer.message(player, F.value("/e tp here ", "Teleport Target to Self"));
+ UtilPlayer.message(player, F.value("/e tp here all", "Teleport Everyone to Self"));
+
+ UtilPlayer.message(player, F.value("/e gadget", "Toggle Gadgets"));
+ UtilPlayer.message(player, F.value("/e gadget list", "Lists Gadgets (Shows Whitelist)"));
+ UtilPlayer.message(player, F.value("/e gadget ", "Toggles Whitelist for Gadget"));
+ UtilPlayer.message(player, F.value("/e gadget clear", "Clears Gadget Whitelist"));
+
+ UtilPlayer.message(player, F.value("/e silence [Time]", "Silence Chat"));
+
+ UtilPlayer.message(player, F.value("/e admin [Player]", "Toggle Event Admin"));
+
+ UtilPlayer.message(player, F.value("/e gm [Player]", "Toggle Creative Mode"));
+
+ UtilPlayer.message(player, F.value("/e radius [Radius]", "Set Forcefield Radius"));
+
+ UtilPlayer.message(player, F.value("/e give
- ", "Give Item"));
+ UtilPlayer.message(player, F.value("/e give
- [e:#,e:#...]", "Give Item"));
+
+ UtilPlayer.message(player, F.value("/e doublejump", "Toggles Double Jump"));
+
+ UtilPlayer.message(player, F.value("/e scoreboard [Text]", "Sets Scoreboard Text"));
+
+ UtilPlayer.message(player, F.value("/e mob [#Amount] n[Name] s[Size] [angry] [baby]", ""));
+ UtilPlayer.message(player, F.value("/e mob kill ", "Kill Mobs"));
+
+ UtilPlayer.message(player, F.value("/e kit set", "Sets Player Kit to your Hotbar"));
+ UtilPlayer.message(player, F.value("/e kit apply", "Gives Kit to Players"));
+ UtilPlayer.message(player, F.value("/e kit clear", "Gives Kit to Players"));
+
+ UtilPlayer.message(player, F.value("/e effect ", ""));
+ UtilPlayer.message(player, F.value("/e effect clear", ""));
+ }
+
+ private void commandHelpSettings(Player player)
+ {
+ UtilPlayer.message(player, F.main("Event", "Displaying Settings Commands;"));
+ UtilPlayer.message(player, F.value("/e damage all", "Toggles All Damage"));
+ UtilPlayer.message(player, F.value("/e damage pvp", "Toggles PvP Damage"));
+ UtilPlayer.message(player, F.value("/e damage pve", "Toggles PvE Damage"));
+ UtilPlayer.message(player, F.value("/e damage pve", "Toggles EvP Damage"));
+ UtilPlayer.message(player, F.value("/e damage fall", "Toggles Fall Damage"));
+ UtilPlayer.message(player, F.value("/e health <-1 to 20>", "Locks Players Health"));
+ UtilPlayer.message(player, F.value("/e hunger <-1 to 20>", "Locks Players Hunger"));
+ UtilPlayer.message(player, F.value("/e item drop", "Toggles Item Drop"));
+ UtilPlayer.message(player, F.value("/e item pickup", "Toggles Item Pickup"));
+ UtilPlayer.message(player, F.value("/e blockplacecreative", "Toggles Block Placing in Creative (On/Off)"));
+ UtilPlayer.message(player, F.value("/e blockbreakcreative", "Toggles Block Breaking in Creative (On/Off)"));
+ UtilPlayer.message(player, F.value("/e blockplace", "Toggles Block Placing (On/Off)"));
+ UtilPlayer.message(player, F.value("/e blockplace", "Toggles Block Placing (On/Off)"));
+ UtilPlayer.message(player, F.value("/e blockplace whitelist ", ""));
+ UtilPlayer.message(player, F.value("/e blockplace blacklist ", ""));
+ UtilPlayer.message(player, F.value("/e blockbreak", "Toggles Block Breaking (On/Off)"));
+ UtilPlayer.message(player, F.value("/e blockbreak whitelist ", ""));
+ UtilPlayer.message(player, F.value("/e blockbreak blacklist ", ""));
+ UtilPlayer.message(player, F.value("/e time <-1 to 24000>", "Sets World Time"));
+ //UtilPlayer.message(player, F.value("/e joiningame", "toggles Join In Process for games"));
+ //UtilPlayer.message(player, F.value("/e deathout", "toggles Deathout in games"));
+ //UtilPlayer.message(player, F.value("/e quitout", "toggles Quitout in games"));
+ UtilPlayer.message(player, F.value("/e mobgriefing", "toggles mobgriefing in games"));
+ }
+
+ //Command Handler
+ @EventHandler(priority = EventPriority.LOWEST)
+ private void commandHandler(PlayerCommandPreprocessEvent event)
+ {
+ if (!Manager.GetGame().InProgress())
+ return;
+
+ if (!event.getMessage().toLowerCase().startsWith("/e "))
+ return;
+
+ if(!Manager.GetGameHostManager().isEventServer())
+ return;
+
+ event.setCancelled(true);
+
+ if (!Manager.GetGameHostManager().isAdmin(event.getPlayer(), false))
+ return;
+
+ //Trim off /e and split to args
+ String[] args = event.getMessage().substring(3, event.getMessage().length()).split(" ");
+
+ if (args.length == 0 || args[0].equalsIgnoreCase("help"))
+ {
+ commandHelp(event.getPlayer());
+ }
+ else if (args[0].equalsIgnoreCase("settings"))
+ {
+ if (args.length >= 2 && args[1].equalsIgnoreCase("list"))
+ listSettings(event.getPlayer());
+ else
+ commandHelpSettings(event.getPlayer());
+ }
+
+ //XXX Commands
+ else if (args[0].equalsIgnoreCase("tp"))
+ {
+ commandTeleport(event.getPlayer(), args);
+ }
+ else if (args[0].equalsIgnoreCase("gadget"))
+ {
+ commandGadget(event.getPlayer(), args);
+ }
+ else if (args[0].equalsIgnoreCase("silence"))
+ {
+ commandSilence(event.getPlayer(), args);
+ }
+ else if (args[0].equalsIgnoreCase("admin"))
+ {
+ commandAdmin(event.getPlayer(), args);
+ }
+ else if (args[0].equalsIgnoreCase("gm"))
+ {
+ commandGamemode(event.getPlayer(), args);
+ }
+ else if (args[0].equalsIgnoreCase("radius"))
+ {
+ commandForcefieldRadius(event.getPlayer(), args);
+ }
+ else if (args[0].equalsIgnoreCase("doublejump"))
+ {
+ commandDoubleJump(event.getPlayer(), args);
+ }
+ else if (args[0].equalsIgnoreCase("scoreboard"))
+ {
+ commandScoreboard(event.getPlayer(), args);
+ }
+ else if (args[0].equalsIgnoreCase("whitelist"))
+ {
+ commandWhitelist(event.getPlayer(), args);
+ }
+ else if (args[0].equalsIgnoreCase("give"))
+ {
+ commandGive(event.getPlayer(), args);
+ }
+ else if (args[0].equalsIgnoreCase("effect"))
+ {
+ commandEffect(event.getPlayer(), args);
+ }
+ else if (args[0].equalsIgnoreCase("kit"))
+ {
+ commandKit(event.getPlayer(), args);
+ }
+ else if (args[0].equalsIgnoreCase("mob"))
+ {
+ if (args.length >= 2 && args[1].equalsIgnoreCase("kill"))
+ commandMobKill(event.getPlayer(), args);
+ else
+ commandMob(event.getPlayer(), args);
+ }
+
+
+ //XXX Settings
+ else if (event.getMessage().toLowerCase().equals("/e damage all"))
+ {
+ Manager.GetGame().Damage = !Manager.GetGame().Damage;
+ Manager.GetGame().Announce(F.main("Event Settings", F.value("Damage All", F.tf(Manager.GetGame().Damage))));
+ }
+ else if (event.getMessage().toLowerCase().equals("/e damage pvp"))
+ {
+ Manager.GetGame().DamagePvP = !Manager.GetGame().DamagePvP;
+ Manager.GetGame().Announce(F.main("Event Settings", F.value("Damage PvP", F.tf(Manager.GetGame().DamagePvP))));
+ }
+ else if (event.getMessage().toLowerCase().equals("/e damage pve"))
+ {
+ Manager.GetGame().DamagePvE = !Manager.GetGame().DamagePvE;
+ Manager.GetGame().Announce(F.main("Event Settings", F.value("Damage PvE", F.tf(Manager.GetGame().DamagePvE))));
+ }
+ else if (event.getMessage().toLowerCase().equals("/e damage evp"))
+ {
+ Manager.GetGame().DamageEvP = !Manager.GetGame().DamageEvP;
+ Manager.GetGame().Announce(F.main("Event Settings", F.value("Damage EvP", F.tf(Manager.GetGame().DamageEvP))));
+ }
+ else if (event.getMessage().toLowerCase().equals("/e damage fall"))
+ {
+ Manager.GetGame().DamageFall = !Manager.GetGame().DamageFall;
+ Manager.GetGame().Announce(F.main("Event Settings", F.value("Damage Fall", F.tf(Manager.GetGame().DamageFall))));
+ }
+ else if (args[0].equalsIgnoreCase("health"))
+ {
+ commandHealth(event.getPlayer(), args);
+ }
+ else if (args[0].equalsIgnoreCase("hunger"))
+ {
+ commandHunger(event.getPlayer(), args);
+ }
+ else if (event.getMessage().toLowerCase().equals("/e item drop"))
+ {
+ Manager.GetGame().ItemDrop = !Manager.GetGame().ItemDrop;
+ Manager.GetGame().Announce(F.main("Event Settings", F.value("Item Drop", F.tf(Manager.GetGame().ItemDrop))));
+ }
+ else if (event.getMessage().toLowerCase().equals("/e item pickup"))
+ {
+ Manager.GetGame().ItemPickup = !Manager.GetGame().ItemPickup;
+ Manager.GetGame().Announce(F.main("Event Settings", F.value("Item Pickup", F.tf(Manager.GetGame().ItemPickup))));
+ }
+ else if (event.getMessage().toLowerCase().equals("/e blockplace"))
+ {
+ Manager.GetGame().BlockPlace = !Manager.GetGame().BlockPlace;
+ Manager.GetGame().Announce(F.main("Event Settings", F.value("Block Place", F.tf(Manager.GetGame().BlockPlace))));
+ }
+ else if (args.length >= 4 && args[0].equalsIgnoreCase("blockplace")
+ && (args[1].equalsIgnoreCase("whitelist") || args[1].equalsIgnoreCase("blacklist")))
+ {
+ commandBlockPlace(event.getPlayer(), args, args[1].equalsIgnoreCase("whitelist"), args[2]);
+ }
+ else if (event.getMessage().toLowerCase().equals("/e blockbreak"))
+ {
+ Manager.GetGame().BlockBreak = !Manager.GetGame().BlockBreak;
+ Manager.GetGame().Announce(F.main("Event Settings", F.value("Block Break", F.tf(Manager.GetGame().BlockBreak))));
+ }
+ else if (args.length >= 4 && args[0].equalsIgnoreCase("blockbreak")
+ && (args[1].equalsIgnoreCase("whitelist") || args[1].equalsIgnoreCase("blacklist")))
+ {
+ commandBlockBreak(event.getPlayer(), args, args[1].equalsIgnoreCase("whitelist"), args[2]);
+ }
+ else if (args[0].equalsIgnoreCase("time"))
+ {
+ commandTime(event.getPlayer(), args);
+ }
+ /*else if(args[0].equalsIgnoreCase("joiningame"))
+ {
+ commandSpectators(event.getPlayer(), args);
+ }
+ else if(args[0].equalsIgnoreCase("deathout"))
+ {
+ commandDeathout(event.getPlayer(), args);
+ }
+ else if(args[0].equalsIgnoreCase("quitout"))
+ {
+ commandQuitOut(event.getPlayer(), args);
+ }*/
+ else if(args[0].equalsIgnoreCase("blockplacecreative"))
+ {
+ commandBlockPlaceInCreative(event.getPlayer(), args);
+ }
+ else if(args[0].equalsIgnoreCase("blockbreakcreative"))
+ {
+ commandBlockBreakInCreative(event.getPlayer(), args);
+ }
+ else if(args[0].equalsIgnoreCase("mobgriefing"))
+ {
+ commandMobGriefing(event.getPlayer(), args);
+ }
+ }
+
+ private void listSettings(Player player)
+ {
+ UtilPlayer.message(player, F.value("Damage All", F.tf(Manager.GetGame().Damage)));
+ UtilPlayer.message(player, F.value("Damage PvP", F.tf(Manager.GetGame().DamagePvP)));
+ UtilPlayer.message(player, F.value("Damage PvE", F.tf(Manager.GetGame().DamagePvE)));
+ UtilPlayer.message(player, F.value("Damage EvP", F.tf(Manager.GetGame().DamageEvP)));
+ UtilPlayer.message(player, F.value("Damage Fall", F.tf(Manager.GetGame().DamageFall)));
+ UtilPlayer.message(player, F.value("Health Set", Manager.GetGame().HealthSet+""));
+ UtilPlayer.message(player, F.value("Hunger Set", Manager.GetGame().HungerSet+""));
+ UtilPlayer.message(player, F.value("Item Pickup", F.tf(Manager.GetGame().ItemPickup)));
+ UtilPlayer.message(player, F.value("Item Drop", F.tf(Manager.GetGame().ItemDrop)));
+ UtilPlayer.message(player, F.value("Block Place Creative", F.tf(Manager.GetGame().BlockPlaceCreative)));
+ UtilPlayer.message(player, F.value("Block Break Creative", F.tf(Manager.GetGame().BlockBreakCreative)));
+ UtilPlayer.message(player, F.value("Block Place", F.tf(Manager.GetGame().BlockPlace)));
+ UtilPlayer.message(player, F.value("Block Place Whitelist", UtilText.listToString(Manager.GetGame().BlockPlaceAllow, true)));
+ UtilPlayer.message(player, F.value("Block Place Blacklist", UtilText.listToString(Manager.GetGame().BlockPlaceDeny, true)));
+ UtilPlayer.message(player, F.value("Block Break", F.tf(Manager.GetGame().BlockPlace)));
+ UtilPlayer.message(player, F.value("Block Break Whitelist", UtilText.listToString(Manager.GetGame().BlockBreakAllow, true)));
+ UtilPlayer.message(player, F.value("Block Break Blacklist", UtilText.listToString(Manager.GetGame().BlockBreakDeny, true)));
+ UtilPlayer.message(player, F.value("Time Set", Manager.GetGame().WorldTimeSet+""));
+ UtilPlayer.message(player, F.value("Mob griefing", F.tf(_mobGriefing)));
+ }
+
+ private void commandBlockBreakInCreative(Player player, String[] args)
+ {
+ Manager.GetGame().BlockBreakCreative = !Manager.GetGame().BlockBreakCreative;
+
+ UtilPlayer.message(player, F.main("Settings", "BlockBreakCreative: " + F.tf(Manager.GetGame().BlockBreakCreative)));
+ }
+
+ private void commandBlockPlaceInCreative(Player player, String[] args)
+ {
+ Manager.GetGame().BlockPlaceCreative = !Manager.GetGame().BlockPlaceCreative;
+
+ UtilPlayer.message(player, F.main("Settings", "BlockPlaceCreative: " + F.tf(Manager.GetGame().BlockPlaceCreative)));
+ }
+
+ private void commandMobGriefing(Player player, String[] args)
+ {
+ _mobGriefing = !_mobGriefing;
+
+ UtilPlayer.message(player, F.main("Settings", "Mob Griefing: " + F.tf(_mobGriefing)));
+ }
+
+ private void commandBlockPlace(Player player, String[] args, boolean whitelist, String command)
+ {
+ try
+ {
+ int blockId = Integer.parseInt(args[3]);
+
+ if (whitelist)
+ {
+ if (command.equalsIgnoreCase("add"))
+ {
+ Manager.GetGame().BlockPlaceAllow.add(blockId);
+ UtilPlayer.message(player, F.main("Event Settings", F.value("Block Place Whitelist", "Added " + blockId)));
+ }
+ else if (command.equalsIgnoreCase("remove"))
+ {
+ Manager.GetGame().BlockPlaceAllow.remove(blockId);
+ UtilPlayer.message(player, F.main("Event Settings", F.value("Block Place Whitelist", "Removed " + blockId)));
+ }
+ else if (command.equalsIgnoreCase("clear"))
+ {
+ Manager.GetGame().BlockPlaceAllow.clear();
+ UtilPlayer.message(player, F.main("Event Settings", F.value("Block Place Whitelist", "Cleared")));
+ }
+ else if (command.equalsIgnoreCase("list"))
+ {
+ UtilPlayer.message(player, F.main("Event Settings", F.value("Block Place Whitelist", UtilText.listToString(Manager.GetGame().BlockPlaceAllow, true))));
+ }
+ }
+ else
+ {
+ if (command.equalsIgnoreCase("add"))
+ {
+ Manager.GetGame().BlockPlaceDeny.add(blockId);
+ UtilPlayer.message(player, F.main("Event Settings", F.value("Block Place Blacklist", "Added " + blockId)));
+ }
+ else if (command.equalsIgnoreCase("remove"))
+ {
+ Manager.GetGame().BlockPlaceDeny.remove(blockId);
+ UtilPlayer.message(player, F.main("Event Settings", F.value("Block Place Blacklist", "Removed " + blockId)));
+ }
+ else if (command.equalsIgnoreCase("clear"))
+ {
+ Manager.GetGame().BlockPlaceDeny.clear();
+ UtilPlayer.message(player, F.main("Event Settings", F.value("Block Place Blacklist", "Cleared")));
+ }
+ else if (command.equalsIgnoreCase("list"))
+ {
+ UtilPlayer.message(player, F.main("Event Settings", F.value("Block Place Blacklist", UtilText.listToString(Manager.GetGame().BlockPlaceDeny, true))));
+ }
+ }
+
+ return;
+ }
+ catch (Exception e)
+ {
+
+ }
+
+ commandHelpSettings(player);
+ }
+
+ private void commandBlockBreak(Player player, String[] args, boolean whitelist, String command)
+ {
+ try
+ {
+ int blockId = Integer.parseInt(args[3]);
+
+ if (whitelist)
+ {
+ if (command.equalsIgnoreCase("add"))
+ {
+ Manager.GetGame().BlockBreakAllow.add(blockId);
+ UtilPlayer.message(player, F.main("Event Settings", F.value("Block Break Whitelist", "Added " + blockId)));
+ }
+ else if (command.equalsIgnoreCase("remove"))
+ {
+ Manager.GetGame().BlockBreakAllow.remove(blockId);
+ UtilPlayer.message(player, F.main("Event Settings", F.value("Block Break Whitelist", "Removed " + blockId)));
+ }
+ else if (command.equalsIgnoreCase("clear"))
+ {
+ Manager.GetGame().BlockBreakAllow.clear();
+ UtilPlayer.message(player, F.main("Event Settings", F.value("Block Break Whitelist", "Cleared")));
+ }
+ else if (command.equalsIgnoreCase("list"))
+ {
+ UtilPlayer.message(player, F.main("Event Settings", F.value("Block Break Whitelist", UtilText.listToString(Manager.GetGame().BlockBreakAllow, true))));
+ }
+ }
+ else
+ {
+ if (command.equalsIgnoreCase("add"))
+ {
+ Manager.GetGame().BlockBreakDeny.add(blockId);
+ UtilPlayer.message(player, F.main("Event Settings", F.value("Block Break Blacklist", "Added " + blockId)));
+ }
+ else if (command.equalsIgnoreCase("remove"))
+ {
+ Manager.GetGame().BlockBreakDeny.remove(blockId);
+ UtilPlayer.message(player, F.main("Event Settings", F.value("Block Break Blacklist", "Removed " + blockId)));
+ }
+ else if (command.equalsIgnoreCase("clear"))
+ {
+ Manager.GetGame().BlockBreakDeny.clear();
+ UtilPlayer.message(player, F.main("Event Settings", F.value("Block Break Blacklist", "Cleared")));
+ }
+ else if (command.equalsIgnoreCase("list"))
+ {
+ UtilPlayer.message(player, F.main("Event Settings", F.value("Block Break Blacklist", UtilText.listToString(Manager.GetGame().BlockBreakDeny, true))));
+ }
+ }
+
+ return;
+ }
+ catch (Exception e)
+ {
+
+ }
+
+ commandHelpSettings(player);
+ }
+
+ private void commandHealth(Player player, String[] args)
+ {
+ try
+ {
+ if (args.length >= 2)
+ {
+ int health = Integer.parseInt(args[1]);
+
+ if (health <= 0)
+ health = -1;
+ if (health > 20)
+ health = 20;
+
+ Manager.GetGame().HealthSet = health;
+
+ if (Manager.GetGame().HealthSet == -1)
+ Manager.GetGame().Announce(F.main("Event Settings", F.value("Health Set", "Disabled")));
+ else
+ Manager.GetGame().Announce(F.main("Event Settings", F.value("Health Set", Manager.GetGame().HealthSet + "")));
+
+ return;
+ }
+ }
+ catch (Exception e)
+ {
+
+ }
+
+ commandHelpSettings(player);
+ }
+
+ private void commandHunger(Player player, String[] args)
+ {
+ try
+ {
+ if (args.length >= 2)
+ {
+ int hunger = Integer.parseInt(args[1]);
+
+ if (hunger <= 0)
+ hunger = -1;
+ if (hunger > 20)
+ hunger = 20;
+
+ Manager.GetGame().HungerSet = hunger;
+
+ if (Manager.GetGame().HungerSet == -1)
+ Manager.GetGame().Announce(F.main("Event Settings", F.value("Hunger Set", "Disabled")));
+ else
+ Manager.GetGame().Announce(F.main("Event Settings", F.value("Hunger Set", Manager.GetGame().HungerSet + "")));
+
+ return;
+ }
+ }
+ catch (Exception e)
+ {
+
+ }
+
+ commandHelpSettings(player);
+ }
+
+ private void commandTime(Player player, String[] args)
+ {
+ try
+ {
+ if (args.length >= 2)
+ {
+ int time = Integer.parseInt(args[1]);
+
+ if (time <= -1)
+ time = -1;
+ if (time > 24000)
+ time = 24000;
+
+ Manager.GetGame().WorldTimeSet = time;
+
+ if (Manager.GetGame().WorldTimeSet == -1)
+ Manager.GetGame().Announce(F.main("Event Settings", F.value("Time Set", "Disabled")));
+ else
+ Manager.GetGame().Announce(F.main("Event Settings", F.value("Time Set", Manager.GetGame().WorldTimeSet + "")));
+
+ return;
+ }
+ }
+ catch (Exception e)
+ {
+
+ }
+
+ commandHelpSettings(player);
+ }
+
+ //Teleport Command (To, Here, All)
+ private void commandTeleport(Player player, String[] args)
+ {
+ if (args.length >= 3 && args[1].equalsIgnoreCase("here"))
+ {
+ if (args[2].equalsIgnoreCase("all"))
+ {
+ for (Player other : UtilServer.getPlayers())
+ {
+ UtilPlayer.message(other, F.main("Event TP", player.getName() + " teleported everyone to self."));
+ other.teleport(player);
+ }
+
+ return;
+ }
+
+ Player target = UtilPlayer.searchOnline(player, args[2], true);
+ if (target != null)
+ {
+ target.teleport(player);
+ UtilPlayer.message(target, F.main("Event TP", player.getName() + " teleported you to self."));
+ UtilPlayer.message(player, F.main("Event TP", "Teleported " + target.getName() + " to you."));
+ }
+
+ return;
+ }
+
+ if (args.length >= 2)
+ {
+ Player target = UtilPlayer.searchOnline(player, args[1], true);
+ if (target != null)
+ {
+ player.teleport(target);
+ UtilPlayer.message(player, F.main("Event TP", "Teleported to " + target.getName() + "."));
+ }
+
+ return;
+ }
+
+ commandHelp(player);
+ }
+
+ //Gadget Commands (Global & Individual)
+ private void commandGadget(Player player, String[] args)
+ {
+ if(!(Manager.GetGame() instanceof EventGame)) {
+ UtilPlayer.message(player, F.main("Inventory", "You can only enable/disable gadgets in the Event game!"));
+ return;
+ }
+
+ if (args.length < 2)
+ {
+ ((EventGame) Manager.GetGame()).setAllowGadget(!((EventGame) Manager.GetGame()).isAllowGadget());
+
+ if (!((EventGame) Manager.GetGame()).isAllowGadget())
+ {
+ Manager.getCosmeticManager().getMountManager().DisableAll();
+ Manager.getCosmeticManager().getGadgetManager().DisableAll();
+ }
+
+ Manager.GetGame().Announce(F.main("Inventory", F.value("Allow All Gadgets", F.ed(((EventGame) Manager.GetGame()).isAllowGadget()))));
+ return;
+ }
+
+ if (args.length >= 2 && args[1].equalsIgnoreCase("clear"))
+ {
+ ((EventGame) Manager.GetGame()).getGadgetWhitelist().clear();
+ Manager.GetGame().Announce(F.main("Inventory", F.value("Gadget Whitelist", "Cleared.")));
+ return;
+ }
+
+ if (args.length >= 2 && args[1].equalsIgnoreCase("list"))
+ {
+ ChatColor color = ChatColor.AQUA;
+
+ //Gadgets
+ for (GadgetType type : GadgetType.values())
+ {
+ String items = C.Bold + type + " Gadgets> ";
+
+ for (Gadget gadget : Manager.getCosmeticManager().getGadgetManager().getGadgets(type))
+ {
+ items += color + gadget.GetName().replaceAll(" ", "") + " ";
+ color = (color == ChatColor.AQUA ? ChatColor.DARK_AQUA : ChatColor.AQUA);
+ }
+
+ UtilPlayer.message(player, items);
+ }
+
+ //Mounts
+ String mounts = C.Bold + "Mount Gadgets> ";
+ for (Mount> mount : Manager.getCosmeticManager().getMountManager().getMounts())
+ {
+ mounts += color + mount.GetName().replaceAll(" ", "") + " ";
+ color = (color == ChatColor.AQUA ? ChatColor.DARK_AQUA : ChatColor.AQUA);
+ }
+ UtilPlayer.message(player, mounts);
+
+ return;
+ }
+
+ if (args.length >= 2)
+ {
+ //Gadgets
+ for (GadgetType type : GadgetType.values())
+ {
+ for (Gadget gadget : Manager.getCosmeticManager().getGadgetManager().getGadgets(type))
+ {
+ if (gadget.GetName().replaceAll(" ", "").equalsIgnoreCase(args[1]))
+ {
+ if (((EventGame) Manager.GetGame()).getGadgetWhitelist().remove(gadget))
+ {
+ Manager.GetGame().Announce(F.main("Inventory", F.value(gadget.GetName() + " Gadget", F.ed(false))));
+ gadget.DisableForAll();
+ }
+ else
+ {
+ Manager.GetGame().Announce(F.main("Inventory", F.value(gadget.GetName() + " Gadget", F.ed(true))));
+ ((EventGame) Manager.GetGame()).getGadgetWhitelist().add(gadget);
+ }
+
+ return;
+ }
+ }
+ }
+
+ //Mounts
+ for (Mount mount : Manager.getCosmeticManager().getMountManager().getMounts())
+ {
+ if (mount.GetName().replaceAll(" ", "").equalsIgnoreCase(args[1]))
+ {
+ if (((EventGame) Manager.GetGame()).getGadgetWhitelist().remove(mount))
+ {
+ Manager.GetGame().Announce(F.main("Inventory", F.value(mount.GetName() + " Gadget", F.ed(false))));
+ mount.DisableForAll();
+ }
+ else
+ {
+ Manager.GetGame().Announce(F.main("Inventory", F.value(mount.GetName() + " Gadget", F.ed(true))));
+ ((EventGame) Manager.GetGame()).getGadgetWhitelist().add(mount);
+ }
+
+ return;
+ }
+ }
+
+ UtilPlayer.message(player, F.main("Inventory", args[1] + " is not a valid gadget."));
+
+ return;
+ }
+
+ commandHelp(player);
+ }
+
+ //Silence
+ private void commandSilence(Player player, String[] args)
+ {
+ try
+ {
+ //Toggle
+ if (args.length == 1)
+ {
+ //Disable
+ if (Manager.GetChat().Silenced() != 0)
+ {
+ Manager.GetChat().Silence(0, true);
+ }
+ //Enable
+ else
+ {
+ Manager.GetChat().Silence(-1, true);
+ }
+ }
+ //Timer
+ else
+ {
+ long time = (long) (Double.valueOf(args[1]) * 3600000);
+
+ Manager.GetChat().Silence(time, true);
+ }
+ }
+ catch (Exception e)
+ {
+ UtilPlayer.message(player, F.main("Chat", "Invalid Time Parameter."));
+ }
+ }
+
+ //Gamemode (Self and Others)
+ private void commandAdmin(Player player, String[] args)
+ {
+ Player target = player;
+
+ if (args.length >= 2)
+ {
+ Player newTarget = UtilPlayer.searchOnline(player, args[1], true);
+ if (newTarget != null)
+ target = newTarget;
+ else
+ return;
+ }
+
+ if (!Manager.GetGameHostManager().isAdmin(target, false))
+ Manager.GetGameHostManager().giveAdmin(target);
+ else
+ Manager.GetGameHostManager().removeAdmin(target.getName());
+
+ UtilPlayer.message(player, F.main("Event Admin", target.getName() + " Admin: " + F.tf(Manager.GetGameHostManager().isAdmin(target, false))));
+ }
+
+ //Gamemode (Self and Others)
+ private void commandGamemode(Player player, String[] args)
+ {
+ Player target = player;
+
+ if (args.length >= 2)
+ {
+ Player newTarget = UtilPlayer.searchOnline(player, args[1], true);
+ if (newTarget != null)
+ target = newTarget;
+ else
+ return;
+ }
+
+ if (target.getGameMode() == GameMode.CREATIVE)
+ target.setGameMode(GameMode.SURVIVAL);
+ else
+ target.setGameMode(GameMode.CREATIVE);
+
+ UtilPlayer.message(player, F.main("Event GM", target.getName() + " Creative: " + F.tf(target.getGameMode() == GameMode.CREATIVE)));
+ }
+
+ //Forcefield
+ private void commandForcefieldRadius(Player player, String[] args)
+ {
+
+ if(!(Manager.GetGame() instanceof EventGame)) {
+ UtilPlayer.message(player, F.main("Inventory", "You can only enable/disable the forcefield in the Event game!"));
+ return;
+ }
+
+ //Toggle
+ if (args.length >= 2)
+ {
+ try
+ {
+ int range = Integer.parseInt(args[1]);
+
+ ((EventGame) Manager.GetGame()).getForcefieldList().put(player.getName(), range);
+
+ UtilPlayer.message(player, F.main("Forcefield", "Enabled with " + F.elem(range + "") + " radius."));
+ }
+ catch (Exception e)
+ {
+ UtilPlayer.message(player, F.main("Forcefield", "Invalid Input."));
+ }
+ }
+ else
+ {
+ ((EventGame) Manager.GetGame()).getForcefieldList().remove(player.getName());
+ UtilPlayer.message(player, F.main("Forcefield", "Disabled."));
+ }
+ }
+
+ //Give
+ private void commandGive(Player player, String[] args)
+ {
+ String[] newArgs = new String[args.length-1];
+
+ for (int i=0 ; i= 2)
+ {
+ //Line
+ int line = 0;
+ try
+ {
+ line = Integer.parseInt(args[1]);
+ }
+ catch (Exception e)
+ {
+ UtilPlayer.message(player, F.main("Scoreboard", "Invalid Line Number."));
+ return;
+ }
+
+ if (line < 1 || line > 14)
+ {
+ UtilPlayer.message(player, F.main("Scoreboard", "Invalid Line Number."));
+ return;
+ }
+
+ //Text
+ String lineText = "";
+
+ //Reset String
+ if (args.length <= 2)
+ for (int i=0 ; i= 2 && args[1].equalsIgnoreCase("clear"))
+ {
+ for (int i=0 ; i<((EventGame) Manager.GetGame()).getSideText().length ; i++)
+ {
+ String lineText = "";
+ for (int j=0 ; j= 2)
+ {
+ if (args[1].equalsIgnoreCase("on") || args[1].equalsIgnoreCase("off"))
+ {
+ UtilServer.getServer().setWhitelist(args[1].equalsIgnoreCase("on"));
+
+ Manager.GetGame().Announce(F.main("Event Settings", F.value("Whitelist", F.tf(args[1].equalsIgnoreCase("on")))));
+ return;
+ }
+ }
+
+ //Add and Remove
+ if (args.length >= 3)
+ {
+ if (args[1].equalsIgnoreCase("add") || args[1].equalsIgnoreCase("remove"))
+ {
+ OfflinePlayer target = Bukkit.getOfflinePlayer(args[2]);
+
+ if (args[1].equalsIgnoreCase("add"))
+ {
+ UtilServer.getServer().getWhitelistedPlayers().add(target);
+ UtilPlayer.message(player, F.main("Whitelist", "Added " + args[2] + " to the whitelist."));
+ }
+ else
+ {
+ UtilServer.getServer().getWhitelistedPlayers().remove(target);
+ UtilPlayer.message(player, F.main("Whitelist", "Removed " + args[2] + " to the whitelist."));
+ }
+
+ return;
+ }
+ }
+
+ commandHelp(player);
+ }
+
+ //Mob
+ private void commandMob(Player caller, String[] args)
+ {
+ if (args.length == 1)
+ {
+ HashMap entMap = new HashMap();
+
+ int count = 0;
+ for (World world : UtilServer.getServer().getWorlds())
+ {
+ for (Entity ent : world.getEntities())
+ {
+ if (!entMap.containsKey(ent.getType()))
+ entMap.put(ent.getType(), 0);
+
+ entMap.put(ent.getType(), 1 + entMap.get(ent.getType()));
+ count++;
+ }
+ }
+
+ UtilPlayer.message(caller, F.main("Creature", "Listing Entities:"));
+ for (EntityType cur : entMap.keySet())
+ {
+ UtilPlayer.message(caller, F.desc(UtilEnt.getName(cur), entMap.get(cur)+""));
+ }
+
+ UtilPlayer.message(caller, F.desc("Total", count+""));
+ }
+ else
+ {
+ EntityType type = UtilEnt.searchEntity(caller, args[1], true);
+
+ if (type == null)
+ return;
+
+ UtilPlayer.message(caller, F.main("Creature", "Spawning Creature(s);"));
+
+ //Store Args
+ HashSet argSet = new HashSet();
+ for (int i = 2 ; i < args.length ; i++)
+ if (args[i].length() > 0)
+ argSet.add(args[i]);
+
+
+ //Search Count
+ int count = 1;
+ HashSet argHandle = new HashSet();
+ for (String arg : argSet)
+ {
+ try
+ {
+ int newCount = Integer.parseInt(arg);
+
+ if (newCount <= 0)
+ continue;
+
+ //Set Count
+ count = newCount;
+ UtilPlayer.message(caller, F.desc("Amount", count+""));
+
+ //Flag Arg
+ argHandle.add(arg);
+ break;
+ }
+ catch (Exception e)
+ {
+ //None
+ }
+ }
+ for (String arg : argHandle)
+ argSet.remove(arg);
+
+ //Spawn
+ HashSet entSet = new HashSet();
+ for (int i = 0 ; i < count ; i++)
+ {
+ Manager.GetGame().CreatureAllowOverride = true;
+ entSet.add(Manager.GetCreature().SpawnEntity(caller.getTargetBlock(null, 0).getLocation().add(0.5, 1, 0.5), type));
+ Manager.GetGame().CreatureAllowOverride = false;
+ }
+
+ //Search Vars
+ for (String arg : argSet)
+ {
+ if (arg.length() == 0)
+ continue;
+
+ //Baby
+ else if (arg.equalsIgnoreCase("baby") || arg.equalsIgnoreCase("b"))
+ {
+ for (Entity ent : entSet)
+ {
+ if (ent instanceof Ageable)
+ ((Ageable)ent).setBaby();
+ else if (ent instanceof Zombie)
+ ((Zombie)ent).setBaby(true);
+ }
+
+ UtilPlayer.message(caller, F.desc("Baby", "True"));
+ argHandle.add(arg);
+ }
+
+ //Lock
+ else if (arg.equalsIgnoreCase("age") || arg.equalsIgnoreCase("lock"))
+ {
+ for (Entity ent : entSet)
+ if (ent instanceof Ageable)
+ {
+ ((Ageable)ent).setAgeLock(true);
+ UtilPlayer.message(caller, F.desc("Age", "False"));
+ }
+
+ argHandle.add(arg);
+ }
+
+ //Angry
+ else if (arg.equalsIgnoreCase("angry") || arg.equalsIgnoreCase("a"))
+ {
+ for (Entity ent : entSet)
+ if (ent instanceof Wolf)
+ ((Wolf)ent).setAngry(true);
+
+ for (Entity ent : entSet)
+ if (ent instanceof Skeleton)
+ ((Skeleton)ent).setSkeletonType(SkeletonType.WITHER);
+
+ UtilPlayer.message(caller, F.desc("Angry", "True"));
+ argHandle.add(arg);
+ }
+
+ //Profession
+ else if (arg.toLowerCase().charAt(0) == 'p')
+ {
+ try
+ {
+ String prof = arg.substring(1, arg.length());
+
+ Profession profession = null;
+ for (Profession cur : Profession.values())
+ if (cur.name().toLowerCase().contains(prof.toLowerCase()))
+ profession = cur;
+
+ UtilPlayer.message(caller, F.desc("Profession", profession.name()));
+
+ for (Entity ent : entSet)
+ if (ent instanceof Villager)
+ ((Villager)ent).setProfession(profession);
+ }
+ catch (Exception e)
+ {
+ UtilPlayer.message(caller, F.desc("Profession", "Invalid [" + arg + "] on " + type.name()));
+ }
+ argHandle.add(arg);
+ }
+
+ //Size
+ else if (arg.toLowerCase().charAt(0) == 's')
+ {
+ try
+ {
+ String size = arg.substring(1, arg.length());
+
+ UtilPlayer.message(caller, F.desc("Size", Integer.parseInt(size)+""));
+
+ for (Entity ent : entSet)
+ if (ent instanceof Slime)
+ ((Slime)ent).setSize(Integer.parseInt(size));
+ }
+ catch (Exception e)
+ {
+ UtilPlayer.message(caller, F.desc("Size", "Invalid [" + arg + "] on " + type.name()));
+ }
+ argHandle.add(arg);
+ }
+
+ else if (arg.toLowerCase().charAt(0) == 'n' && arg.length() > 1)
+ {
+ try
+ {
+ String name = "";
+
+ for (char c : arg.substring(1, arg.length()).toCharArray())
+ {
+ if (c != '_')
+ name += c;
+ else
+ name += " ";
+ }
+
+ for (Entity ent : entSet)
+ {
+ if (ent instanceof CraftLivingEntity)
+ {
+ CraftLivingEntity cEnt = (CraftLivingEntity)ent;
+ cEnt.setCustomName(name);
+ cEnt.setCustomNameVisible(true);
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ UtilPlayer.message(caller, F.desc("Size", "Invalid [" + arg + "] on " + type.name()));
+ }
+ argHandle.add(arg);
+ }
+ else if (arg.toLowerCase().charAt(0) == 'h' && arg.length() > 1)
+ {
+ try
+ {
+ String health = "";
+
+ for (char c : arg.substring(1, arg.length()).toCharArray())
+ {
+ if (c != '_')
+ health += c;
+ else
+ health += " ";
+ }
+
+ double healthint = Double.parseDouble(health);
+
+ for (Entity ent : entSet)
+ {
+ if (ent instanceof CraftLivingEntity)
+ {
+ CraftLivingEntity cEnt = (CraftLivingEntity)ent;
+ cEnt.setMaxHealth(healthint);
+ cEnt.setHealth(healthint);
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ UtilPlayer.message(caller, F.desc("Health", "Invalid [" + arg + "] on " + type.name()));
+ }
+ argHandle.add(arg);
+ }
+ else if (arg.toLowerCase().charAt(0) == 'e' && arg.length() > 1)
+ {
+ try
+ {
+ String effect = "";
+
+ for (char c : arg.substring(1, arg.length()).toCharArray())
+ {
+ if (c != '_')
+ effect += c;
+ else
+ effect += " ";
+ }
+
+ PotionEffectType potionType = PotionEffectType.getByName(effect);
+
+ if (potionType == null)
+ {
+ UtilPlayer.message(caller, F.main("Effect", "Invalid Effect Type: " + args[2]));
+ UtilPlayer.message(caller, F.value("Valid Types", "http://minecraft.gamepedia.com/Status_effect"));
+ return;
+ }
+
+ for (Entity ent : entSet)
+ {
+ if (ent instanceof CraftLivingEntity)
+ {
+ CraftLivingEntity cEnt = (CraftLivingEntity)ent;
+ cEnt.addPotionEffect(new PotionEffect(potionType, Integer.MAX_VALUE, 0));
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ UtilPlayer.message(caller, F.desc("PotionEffect", "Invalid [" + arg + "] on " + type.name()));
+ }
+ argHandle.add(arg);
+ }
+ else if (arg.toLowerCase().charAt(0) == 'i' && arg.length() > 1)
+ {
+ try
+ {
+ String item = "";
+
+ for (char c : arg.substring(1, arg.length()).toCharArray())
+ {
+ item += c;
+ }
+
+ Material mat = Material.getMaterial(item);
+
+ for (Entity ent : entSet)
+ {
+ if (ent instanceof CraftLivingEntity)
+ {
+ CraftLivingEntity cEnt = (CraftLivingEntity)ent;
+ cEnt.getEquipment().setItemInHand(new ItemStack(mat));
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ UtilPlayer.message(caller, F.desc("Item", "Invalid [" + arg + "] on " + type.name()));
+ }
+ argHandle.add(arg);
+ }
+ else if (arg.toLowerCase().charAt(0) == 'a' && arg.length() > 1)
+ {
+ try
+ {
+ String armor = "";
+
+ for (char c : arg.substring(1, arg.length()).toCharArray())
+ {
+ if (c != '_')
+ armor += c;
+ else
+ armor += " ";
+ }
+
+ ItemStack head = null;
+ ItemStack chest = null;
+ ItemStack leggings = null;
+ ItemStack boots = null;
+
+
+ if(armor.equalsIgnoreCase("leather"))
+ {
+ head = new ItemStack(Material.LEATHER_HELMET);
+ chest = new ItemStack(Material.LEATHER_CHESTPLATE);
+ leggings = new ItemStack(Material.LEATHER_LEGGINGS);
+ boots = new ItemStack(Material.LEATHER_BOOTS);
+ }
+ if(armor.equalsIgnoreCase("gold"))
+ {
+ head = new ItemStack(Material.GOLD_HELMET);
+ chest = new ItemStack(Material.GOLD_CHESTPLATE);
+ leggings = new ItemStack(Material.GOLD_LEGGINGS);
+ boots = new ItemStack(Material.GOLD_BOOTS);
+ }
+ if(armor.equalsIgnoreCase("chain"))
+ {
+ head = new ItemStack(Material.CHAINMAIL_HELMET);
+ chest = new ItemStack(Material.CHAINMAIL_CHESTPLATE);
+ leggings = new ItemStack(Material.CHAINMAIL_LEGGINGS);
+ boots = new ItemStack(Material.CHAINMAIL_BOOTS);
+ }
+ if(armor.equalsIgnoreCase("iron"))
+ {
+ head = new ItemStack(Material.IRON_HELMET);
+ chest = new ItemStack(Material.IRON_CHESTPLATE);
+ leggings = new ItemStack(Material.IRON_LEGGINGS);
+ boots = new ItemStack(Material.IRON_BOOTS);
+ }
+ if(armor.equalsIgnoreCase("diamond"))
+ {
+ head = new ItemStack(Material.DIAMOND_HELMET);
+ chest = new ItemStack(Material.DIAMOND_CHESTPLATE);
+ leggings = new ItemStack(Material.DIAMOND_LEGGINGS);
+ boots = new ItemStack(Material.DIAMOND_BOOTS);
+ }
+
+ for (Entity ent : entSet)
+ {
+ if (ent instanceof CraftLivingEntity)
+ {
+ CraftLivingEntity cEnt = (CraftLivingEntity)ent;
+ cEnt.getEquipment().setHelmet(head);
+ cEnt.getEquipment().setChestplate(chest);
+ cEnt.getEquipment().setLeggings(leggings);
+ cEnt.getEquipment().setBoots(boots);
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ UtilPlayer.message(caller, F.desc("Armor", "Invalid [" + arg + "] on " + type.name()));
+ }
+ argHandle.add(arg);
+ }
+ }
+ for (String arg : argHandle)
+ argSet.remove(arg);
+
+ for (String arg : argSet)
+ UtilPlayer.message(caller, F.desc("Unhandled", arg));
+
+ //Inform
+ UtilPlayer.message(caller, F.main("Creature", "Spawned " + count + " " + UtilEnt.getName(type) + "."));
+ }
+ }
+
+ private void commandMobKill(Player caller, String[] args)
+ {
+ if (args.length < 3)
+ {
+ UtilPlayer.message(caller, F.main("Creature", "Missing Entity Type Parameter."));
+ return;
+ }
+
+ EntityType type = UtilEnt.searchEntity(caller, args[2], true);
+
+ if (type == null && !args[2].equalsIgnoreCase("all"))
+ return;
+
+ int count = 0;
+ List killList = new ArrayList();
+
+ for (World world : UtilServer.getServer().getWorlds())
+ {
+ for (Entity ent : world.getEntities())
+ {
+ if (ent.getType() == EntityType.PLAYER)
+ continue;
+
+ if (type == null || ent.getType() == type)
+ {
+ killList.add(ent);
+ }
+ }
+ }
+
+ CreatureKillEntitiesEvent event = new CreatureKillEntitiesEvent(killList);
+ UtilServer.getServer().getPluginManager().callEvent(event);
+
+ for (Entity entity : event.GetEntities())
+ {
+ entity.remove();
+ count++;
+ }
+
+ String target = "ALL";
+ if (type != null)
+ target = UtilEnt.getName(type);
+
+ UtilPlayer.message(caller, F.main("Creature", "Killed " + target + ". " + count + " Removed."));
+ }
+
+ private void commandKit(Player caller, String[] args)
+ {
+
+ if(!(Manager.GetGame() instanceof EventGame)) {
+ UtilPlayer.message(caller, F.main("Inventory", "You can only enable/disable a Kit in the Event game!"));
+ return;
+ }
+
+ if (args.length >= 2 && args[1].equalsIgnoreCase("apply"))
+ {
+ for (Player player : UtilServer.getPlayers())
+ ((EventGame) Manager.GetGame()).giveItems(player);
+
+ Manager.GetGame().Announce(F.main("Event Settings", F.value("Player Kit", "Applied to Players")));
+ return;
+ }
+
+ if (args.length >= 2 && args[1].equalsIgnoreCase("clear"))
+ {
+ ((EventGame) Manager.GetGame()).setKitItems(new ItemStack[6]);
+ Manager.GetGame().Announce(F.main("Event Settings", F.value("Player Kit", "Cleared Kit")));
+ return;
+ }
+
+ if (args.length >= 2 && args[1].equalsIgnoreCase("set"))
+ {
+ ((EventGame) Manager.GetGame()).setKitItems(new ItemStack[6]);
+
+ for (int i=0 ; i<6 ; i++)
+ {
+ if (caller.getInventory().getItem(i) != null)
+ ((EventGame) Manager.GetGame()).getKitItems()[i] = caller.getInventory().getItem(i).clone();
+ else
+ ((EventGame) Manager.GetGame()).getKitItems()[i] = null;
+ }
+
+ Manager.GetGame().Announce(F.main("Event Settings", F.value("Player Kit", "Updated Items")));
+ return;
+ }
+
+ commandHelp(caller);
+ }
+
+ private void commandEffect(Player caller, String[] args)
+ {
+ //Clear
+ if (args.length >= 3 && args[2].equalsIgnoreCase("clear"))
+ {
+ //Get Targets
+ LinkedList targets = new LinkedList();
+
+ if (args[1].equalsIgnoreCase("all"))
+ {
+ for (Player cur : UtilServer.getPlayers())
+ targets.add(cur);
+
+ _potionEffectsDuration.clear();
+ _potionEffectsMult.clear();
+ }
+ else
+ {
+ targets = UtilPlayer.matchOnline(caller, args[1], true);
+ if (targets.isEmpty())
+ return;
+ }
+
+ for (Player player : targets)
+ {
+ //Remove all conditions
+ Manager.GetCondition().EndCondition(player, null, null);
+
+ //Remove all effects
+ player.removePotionEffect(PotionEffectType.ABSORPTION);
+ player.removePotionEffect(PotionEffectType.BLINDNESS);
+ player.removePotionEffect(PotionEffectType.CONFUSION);
+ player.removePotionEffect(PotionEffectType.DAMAGE_RESISTANCE);
+ player.removePotionEffect(PotionEffectType.FAST_DIGGING);
+ player.removePotionEffect(PotionEffectType.FIRE_RESISTANCE);
+ player.removePotionEffect(PotionEffectType.HARM);
+ player.removePotionEffect(PotionEffectType.HEAL);
+ player.removePotionEffect(PotionEffectType.HEALTH_BOOST);
+ player.removePotionEffect(PotionEffectType.HUNGER);
+ player.removePotionEffect(PotionEffectType.INCREASE_DAMAGE);
+ player.removePotionEffect(PotionEffectType.INVISIBILITY);
+ player.removePotionEffect(PotionEffectType.JUMP);
+ player.removePotionEffect(PotionEffectType.NIGHT_VISION);
+ player.removePotionEffect(PotionEffectType.POISON);
+ player.removePotionEffect(PotionEffectType.REGENERATION);
+ player.removePotionEffect(PotionEffectType.SATURATION);
+ player.removePotionEffect(PotionEffectType.SLOW);
+ player.removePotionEffect(PotionEffectType.SLOW_DIGGING);
+ player.removePotionEffect(PotionEffectType.SPEED);
+ player.removePotionEffect(PotionEffectType.WATER_BREATHING);
+ player.removePotionEffect(PotionEffectType.WEAKNESS);
+ player.removePotionEffect(PotionEffectType.WITHER);
+ }
+
+ return;
+ }
+
+ //Apply
+ if (args.length >= 5)
+ {
+
+ //Get Type
+ PotionEffectType type = PotionEffectType.getByName(args[2]);
+ if (type == null)
+ {
+ UtilPlayer.message(caller, F.main("Effect", "Invalid Effect Type: " + args[2]));
+ UtilPlayer.message(caller, F.value("Valid Types", "http://minecraft.gamepedia.com/Status_effect"));
+ return;
+ }
+
+ //Get Multiplier
+ int mult = 0;
+ try
+ {
+ mult = Integer.parseInt(args[3]);
+
+ if (mult <= 0)
+ mult = 0;
+ if (mult > 255)
+ mult = 255;
+ }
+ catch (Exception e)
+ {
+ UtilPlayer.message(caller, F.main("Effect", "Invalid Effect Level: " + args[3]));
+ return;
+ }
+
+ //Get Duration
+ int dur = 0;
+ try
+ {
+ dur = Integer.parseInt(args[4]);
+
+ if (dur <= 0)
+ dur = 0;
+ }
+ catch (Exception e)
+ {
+ UtilPlayer.message(caller, F.main("Effect", "Invalid Effect Duration: " + args[4]));
+ return;
+ }
+
+ //Get Targets
+ LinkedList targets = new LinkedList();
+
+ if (args[1].equalsIgnoreCase("all"))
+ {
+ for (Player cur : UtilServer.getPlayers())
+ targets.add(cur);
+
+ _potionEffectsDuration.put(type, (long) (System.currentTimeMillis() + (dur * 1000)));
+ _potionEffectsMult.put(type, mult);
+ }
+ else
+ {
+ targets = UtilPlayer.matchOnline(caller, args[1], true);
+ if (targets.isEmpty())
+ return;
+ }
+
+ //Apply
+ PotionEffect effect = new PotionEffect(type, dur*20, mult);
+ for (Player cur : targets)
+ {
+ cur.addPotionEffect(effect);
+ }
+
+ if (args[1].equalsIgnoreCase("all"))
+ Manager.GetGame().Announce(F.main("Effect", F.value("Applied Effect", type.getName() + " " + (mult+1) + " for " + dur + "s")));
+ else
+ UtilPlayer.message(caller, F.main("Effect", "Applied " + type.getName() + " " + (mult+1) + " for " + dur + "s for Targets."));
+
+ return;
+ }
+
+ commandHelp(caller);
+ }
+
+ @EventHandler
+ public void updatePotionEffects(UpdateEvent event)
+ {
+ if(event.getType() != UpdateType.SEC)
+ return;
+
+ for(Player player : UtilServer.getPlayers())
+ {
+ for(PotionEffectType effect : _potionEffectsDuration.keySet())
+ {
+ player.addPotionEffect(new PotionEffect(effect, (int) (((_potionEffectsDuration.get(effect) - System.currentTimeMillis()) / 1000) * 20), _potionEffectsMult.get(effect)));
+ }
+ }
+ }
+
+}
diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java
index 3fb7a570f..338056822 100644
--- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java
+++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java
@@ -74,8 +74,6 @@ public class Evolution extends SoloGame
this.DeathOut = false;
this.PrepareFreeze = false;
-
- this.SpawnDistanceRequirement = 16;
_scoreObj = Scoreboard.GetScoreboard().registerNewObjective("Evolutions", "dummy");
_scoreObj.setDisplaySlot(DisplaySlot.BELOW_NAME);
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 45ec44424..010eaf74c 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
@@ -1927,14 +1927,7 @@ public class MineStrike extends TeamGame
{
player.playSound(player.getLocation(), Sound.LEVEL_UP, 1f, 1f);
- //Clear reloading things
- for (String recharge : Recharge.Instance.Get(player).keySet())
- {
- if (!recharge.toLowerCase().contains("reload"))
- continue;
-
- Recharge.Instance.recharge(player, recharge);
- }
+ Recharge.Instance.Reset(player, "reload");
}
UtilTextMiddle.display(null, winnerLine, 20, 120, 20);
diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/Quiver.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/Quiver.java
index bbd123b34..25b8b8fee 100644
--- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/Quiver.java
+++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/Quiver.java
@@ -72,7 +72,6 @@ public class Quiver extends SoloGame
this.DamageSelf = false;
this.DamageTeamSelf = true;
this.PrepareFreeze = false;
- this.SpawnDistanceRequirement = 16;
this.BlockBreakAllow.add(102);
this.BlockBreakAllow.add(20);
diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/QuiverTeams.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/QuiverTeams.java
index c4aecbae2..2d871d801 100644
--- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/QuiverTeams.java
+++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/QuiverTeams.java
@@ -59,7 +59,6 @@ public class QuiverTeams extends TeamGame
this.DamageSelf = false;
this.DamageTeamSelf = false;
this.PrepareFreeze = false;
- this.SpawnDistanceRequirement = 24;
this.BlockBreakAllow.add(102);
this.BlockBreakAllow.add(20);
this.BlockBreakAllow.add(18);
diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skywars/Skywars.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skywars/Skywars.java
index c6a2003e9..e042dd7b5 100644
--- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skywars/Skywars.java
+++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skywars/Skywars.java
@@ -6,6 +6,7 @@ import java.util.HashSet;
import java.util.Iterator;
import mineplex.core.common.util.C;
+import mineplex.core.common.util.F;
import mineplex.core.common.util.MapUtil;
import mineplex.core.common.util.NautHashMap;
import mineplex.core.common.util.UtilAction;
@@ -24,6 +25,7 @@ import mineplex.core.common.util.UtilTextMiddle;
import mineplex.core.common.util.UtilTime;
import mineplex.core.common.util.UtilTime.TimeUnit;
import mineplex.core.explosion.ExplosionEvent;
+import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.loot.ChestLoot;
import mineplex.core.loot.RandomItem;
import mineplex.core.updater.UpdateType;
@@ -41,8 +43,8 @@ import nautilus.game.arcade.game.games.skywars.data.TNTGenerator;
import nautilus.game.arcade.game.games.skywars.events.PlayerKillZombieEvent;
import nautilus.game.arcade.game.games.skywars.kits.KitChicken;
import nautilus.game.arcade.game.games.skywars.kits.KitDestructor;
-import nautilus.game.arcade.game.games.skywars.kits.KitMadScientist;
import nautilus.game.arcade.game.games.skywars.kits.KitMiner;
+import nautilus.game.arcade.game.games.skywars.kits.KitMadScientist;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.ore.OreHider;
import nautilus.game.arcade.stats.DeathBomberStatTracker;
@@ -65,6 +67,7 @@ import org.bukkit.entity.Chicken;
import org.bukkit.entity.Egg;
import org.bukkit.entity.EnderPearl;
import org.bukkit.entity.Entity;
+import org.bukkit.entity.Item;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.entity.Projectile;
@@ -80,11 +83,13 @@ import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.event.block.BlockSpreadEvent;
import org.bukkit.event.block.LeavesDecayEvent;
import org.bukkit.event.entity.EntityCombustEvent;
+import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.entity.EntityDeathEvent;
import org.bukkit.event.entity.EntityTargetLivingEntityEvent;
import org.bukkit.event.entity.ExplosionPrimeEvent;
import org.bukkit.event.entity.ItemDespawnEvent;
+import org.bukkit.event.entity.ProjectileHitEvent;
import org.bukkit.event.entity.ProjectileLaunchEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerPickupItemEvent;
@@ -92,7 +97,7 @@ import org.bukkit.inventory.ItemStack;
import org.bukkit.util.Vector;
@SuppressWarnings("deprecation")
-public class Skywars extends SoloGame
+public abstract class Skywars extends Game
{
//./parse 19 30 56
@@ -128,23 +133,20 @@ public class Skywars extends SoloGame
private ChestLoot _middleBlock = new ChestLoot();
@SuppressWarnings("unchecked")
- public Skywars(ArcadeManager manager)
+ public Skywars(ArcadeManager manager, GameType type, String[] description)
{
- super(manager, GameType.Skywars, new Kit[]
+ super(manager, type, new Kit[]
{
new KitChicken(manager),
new KitMiner(manager),
new KitMadScientist(manager),
new KitDestructor(manager),
- }, new String[]
- {
- "Free for all battle in the sky!",
- "Craft or loot gear for combat",
- "Last player alive wins!"
- });
+ }, description);
PrepareFreeze = true;
+
+ HideTeamSheep = true;
CompassEnabled = true;
@@ -159,8 +161,6 @@ public class Skywars extends SoloGame
WorldTimeSet = 0;
WorldBoundaryKill = false;
- SpawnDistanceRequirement = 48;
-
DamageSelf = true;
DamageTeamSelf = true;
DamageEvP = true;
@@ -962,6 +962,9 @@ public class Skywars extends SoloGame
if (event.GetDamage() >= 1)
return;
+ if(GetTeam(event.GetDamagerPlayer(true)) == GetTeam(event.GetDamageePlayer()))
+ return;
+
if (event.GetProjectile() instanceof Egg || event.GetProjectile() instanceof Snowball)
{
event.SetCancelled("Egg/Snowball");
@@ -982,6 +985,25 @@ public class Skywars extends SoloGame
event.GetDamageeEntity().setVelocity(vel);
}
}
+
+ @EventHandler
+ public void projectile(EntityDamageByEntityEvent event)
+ {
+ if(event.getDamager() instanceof Snowball || event.getDamager() instanceof Egg || event.getDamager() instanceof EnderPearl)
+ {
+ Projectile prj = (Projectile) event.getDamager();
+ if(prj.getShooter() instanceof Player)
+ {
+ if(event.getEntity() instanceof Player)
+ {
+ if(GetTeam((Player) prj.getShooter()) == GetTeam((Player) event.getEntity()))
+ {
+ event.setCancelled(true);
+ }
+ }
+ }
+ }
+ }
private void fillChest(Player looter, Block block)
{
@@ -1193,63 +1215,6 @@ public class Skywars extends SoloGame
_oreHider.BlockBreak(event);
}
- @Override
- @EventHandler
- public void ScoreboardUpdate(UpdateEvent event)
- {
- if (event.getType() != UpdateType.FAST)
- return;
-
- if (GetTeamList().isEmpty())
- return;
-
- Scoreboard.Reset();
-
- GameTeam team = GetTeamList().get(0);
-
- Scoreboard.WriteBlank();
- Scoreboard.Write(C.cYellow + C.Bold + "Players");
- if (team.GetPlayers(true).size() > 4)
- {
- Scoreboard.Write("" + team.GetPlayers(true).size());
- }
- else
- {
- for (Player player : team.GetPlayers(true))
- {
- Scoreboard.Write(C.cWhite + player.getName());
- }
- }
-
- if (IsLive())
- {
- Scoreboard.WriteBlank();
- Scoreboard.Write(C.cYellow + C.Bold + "Time");
- Scoreboard.Write(UtilTime.convertString(System.currentTimeMillis() - GetStateTime(), 0, TimeUnit.FIT));
-
- Scoreboard.WriteBlank();
- Scoreboard.Write((_tntGen.active() ? C.cGreen : C.cRed) + C.Bold + "TNT Spawn");
- Scoreboard.Write(_tntGen.getScoreboardInfo());
-
- Scoreboard.WriteBlank();
-
- if (UtilTime.elapsed(GetStateTime(), _crumbleTime))
- {
- Scoreboard.Write(C.cRed + C.Bold + "Map Crumble");
- Scoreboard.Write("Active");
- }
- else
- {
- Scoreboard.Write(C.cGreen + C.Bold + "Map Crumble");
- Scoreboard.Write(UtilTime.convertString(_crumbleTime - (System.currentTimeMillis() - GetStateTime()), 0, TimeUnit.FIT));
- }
- }
-
-
-
- Scoreboard.Draw();
- }
-
@EventHandler
public void tntDamageAttribute(ExplosionPrimeEvent event)
{
@@ -1367,4 +1332,15 @@ public class Skywars extends SoloGame
else
return 12;
}
+
+ public TNTGenerator getTnTGen()
+ {
+ return this._tntGen;
+ }
+
+ public long getCrumbleTime()
+ {
+ return this._crumbleTime;
+ }
+
}
diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skywars/SoloSkywars.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skywars/SoloSkywars.java
new file mode 100644
index 000000000..d5262599d
--- /dev/null
+++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skywars/SoloSkywars.java
@@ -0,0 +1,178 @@
+package nautilus.game.arcade.game.games.skywars;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import org.bukkit.ChatColor;
+import org.bukkit.entity.Player;
+import org.bukkit.event.EventHandler;
+
+import mineplex.core.common.util.C;
+import mineplex.core.common.util.UtilTime;
+import mineplex.core.common.util.UtilTime.TimeUnit;
+import mineplex.core.updater.UpdateType;
+import mineplex.core.updater.event.UpdateEvent;
+import nautilus.game.arcade.ArcadeManager;
+import nautilus.game.arcade.GameType;
+import nautilus.game.arcade.events.GameStateChangeEvent;
+import nautilus.game.arcade.game.GameTeam;
+import nautilus.game.arcade.game.Game.GameState;
+
+public class SoloSkywars extends Skywars
+{
+
+ private GameTeam _players;
+
+ public SoloSkywars(ArcadeManager manager)
+ {
+ super(manager, GameType.Skywars,
+ new String[]
+ {
+ "Free for all battle in the sky!",
+ "Craft or loot gear for combat",
+ "Last player alive wins!"
+ });
+
+ this.DamageTeamSelf = true;
+
+ }
+
+ @EventHandler
+ public void CustomTeamGeneration(GameStateChangeEvent event)
+ {
+ if (event.GetState() != GameState.Recruit)
+ return;
+
+ _players = GetTeamList().get(0);
+ _players.SetColor(ChatColor.YELLOW);
+ _players.SetName("Players");
+ _players.setDisplayName(C.cYellow + C.Bold + "Players");
+ }
+
+ @Override
+ @EventHandler
+ public void ScoreboardUpdate(UpdateEvent event)
+ {
+ if (event.getType() != UpdateType.FAST)
+ return;
+
+ if (GetTeamList().isEmpty())
+ return;
+
+ Scoreboard.Reset();
+
+ GameTeam team = GetTeamList().get(0);
+
+ Scoreboard.WriteBlank();
+ Scoreboard.Write(C.cYellow + C.Bold + "Players");
+ if (team.GetPlayers(true).size() > 4)
+ {
+ Scoreboard.Write("" + team.GetPlayers(true).size());
+ }
+ else
+ {
+ for (Player player : team.GetPlayers(true))
+ {
+ Scoreboard.Write(C.cWhite + player.getName());
+ }
+ }
+
+ if (IsLive())
+ {
+ Scoreboard.WriteBlank();
+ Scoreboard.Write(C.cYellow + C.Bold + "Time");
+ Scoreboard.Write(UtilTime.convertString(System.currentTimeMillis() - GetStateTime(), 0, TimeUnit.FIT));
+
+ Scoreboard.WriteBlank();
+ Scoreboard.Write((this.getTnTGen().active() ? C.cGreen : C.cRed) + C.Bold + "TNT Spawn");
+ Scoreboard.Write(this.getTnTGen().getScoreboardInfo());
+
+ Scoreboard.WriteBlank();
+
+ if (UtilTime.elapsed(GetStateTime(), this.getCrumbleTime()))
+ {
+ Scoreboard.Write(C.cRed + C.Bold + "Map Crumble");
+ Scoreboard.Write("Active");
+ }
+ else
+ {
+ Scoreboard.Write(C.cGreen + C.Bold + "Map Crumble");
+ Scoreboard.Write(UtilTime.convertString(this.getCrumbleTime() - (System.currentTimeMillis() - GetStateTime()), 0, TimeUnit.FIT));
+ }
+ }
+
+
+
+ Scoreboard.Draw();
+ }
+
+ @Override
+ public void EndCheck()
+ {
+ if (!IsLive())
+ return;
+
+ if (GetPlayers(true).size() <= 1)
+ {
+ ArrayList places = GetTeamList().get(0).GetPlacements(true);
+
+ //Announce
+ AnnounceEnd(places);
+
+ //Gems
+ if (places.size() >= 1)
+ AddGems(places.get(0), 20, "1st Place", false, false);
+
+ if (places.size() >= 2)
+ AddGems(places.get(1), 15, "2nd Place", false, false);
+
+ if (places.size() >= 3)
+ AddGems(places.get(2), 10, "3rd Place", false, false);
+
+ for (Player player : GetPlayers(false))
+ if (player.isOnline())
+ AddGems(player, 10, "Participation", false, false);
+
+ //End
+ SetState(GameState.End);
+ }
+ }
+
+ @Override
+ public List getWinners()
+ {
+ if (GetState().ordinal() >= GameState.End.ordinal())
+ {
+ List places = GetTeamList().get(0).GetPlacements(true);
+
+ if (places.isEmpty() || !places.get(0).isOnline())
+ return Arrays.asList();
+ else
+ return Arrays.asList(places.get(0));
+ }
+ else
+ return null;
+ }
+
+ @Override
+ public List getLosers()
+ {
+ List winners = getWinners();
+
+ if (winners == null)
+ return null;
+
+ List losers = GetTeamList().get(0).GetPlayers(false);
+
+ losers.removeAll(winners);
+
+ return losers;
+ }
+
+ @Override
+ public String GetMode()
+ {
+ return "Solo Mode";
+ }
+}
diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skywars/TeamSkywars.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skywars/TeamSkywars.java
new file mode 100644
index 000000000..fbe0dbf2b
--- /dev/null
+++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skywars/TeamSkywars.java
@@ -0,0 +1,476 @@
+package nautilus.game.arcade.game.games.skywars;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import mineplex.core.common.util.C;
+import mineplex.core.common.util.F;
+import mineplex.core.common.util.NautHashMap;
+import mineplex.core.common.util.UtilBlock;
+import mineplex.core.common.util.UtilPlayer;
+import mineplex.core.common.util.UtilTime;
+import mineplex.core.common.util.UtilTime.TimeUnit;
+import mineplex.core.recharge.Recharge;
+import mineplex.core.updater.UpdateType;
+import mineplex.core.updater.event.UpdateEvent;
+import nautilus.game.arcade.ArcadeManager;
+import nautilus.game.arcade.GameType;
+import nautilus.game.arcade.events.GameStateChangeEvent;
+import nautilus.game.arcade.game.GameTeam;
+import nautilus.game.arcade.game.Game.GameState;
+
+import org.bukkit.ChatColor;
+import org.bukkit.Location;
+import org.bukkit.Material;
+import org.bukkit.block.BlockFace;
+import org.bukkit.entity.Player;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.EventPriority;
+import org.bukkit.event.player.PlayerCommandPreprocessEvent;
+import org.bukkit.event.player.PlayerInteractEntityEvent;
+import org.bukkit.event.player.PlayerQuitEvent;
+
+public class TeamSkywars extends Skywars
+{
+
+ private NautHashMap _teamReqs = new NautHashMap();
+
+ public TeamSkywars(ArcadeManager manager)
+ {
+ super(manager, GameType.SkywarsTeams,
+ new String[]
+ {
+ "Free for all battle in the sky!",
+ "Craft or loot gear for combat",
+ "Last team alive wins!"
+ });
+
+ this.FillTeamsInOrderToCount = 2;
+
+ this.SpawnNearAllies = true;
+
+ this.DamageTeamSelf = false;
+ }
+
+ @EventHandler
+ public void CustomTeamGeneration(GameStateChangeEvent event)
+ {
+ if (event.GetState() != GameState.Recruit)
+ return;
+
+ ArrayList initialSpawns = this.GetTeamList().get(0).GetSpawns();
+ this.GetTeamList().clear();
+
+ ArrayList spawns = new ArrayList();
+
+ TeamColors color = TeamColors.DARK_AQUA;
+
+ //Create 1 Team for each Spawn
+ int i = 0;
+ for(Location location : initialSpawns)
+ {
+ i++;
+
+ spawns.add(location);
+
+ addRelativeSpawns(spawns, location);
+
+ //Got Spawns
+ color = getNextColor(color);
+ int e = 0;
+ for(GameTeam teams : GetTeamList())
+ {
+ if(teams.GetColor() == color.getColor())
+ {
+ e++;
+ if(getColorName(color.getColor()).length <= e)
+ {
+ e = 0;
+ }
+ }
+ }
+ GameTeam team = new GameTeam(this, getColorName(color.getColor())[e], color.getColor(), spawns, true);
+ team.SetVisible(true);
+ GetTeamList().add(team);
+ }
+ }
+
+ private void addRelativeSpawns(ArrayList spawns, Location location)
+ {
+ //Gather Extra Spawns
+ for(int x = -1; x <= 1; x++)
+ {
+ for(int z = -1; z <= 1; z++)
+ {
+ if(x != 0 && z != 0)
+ {
+ Location newSpawn = location.clone().add(x, 0, z);
+
+ //Search Downward for Solid
+ while (UtilBlock.airFoliage(newSpawn.getBlock().getRelative(BlockFace.DOWN)) && newSpawn.getY() > location.getY()-5)
+ {
+ newSpawn.subtract(0, 1, 0);
+ }
+
+ //Move Up out of Solid
+ while (!UtilBlock.airFoliage(newSpawn.getBlock()) && newSpawn.getY() < location.getY()+5)
+ {
+ newSpawn.add(0, 1, 0);
+ }
+
+ //On Solid, with 2 Air Above
+ if (UtilBlock.airFoliage(newSpawn.getBlock()) &&
+ UtilBlock.airFoliage(newSpawn.getBlock().getRelative(BlockFace.UP)) &&
+ !UtilBlock.airFoliage(newSpawn.getBlock().getRelative(BlockFace.DOWN)))
+ {
+ spawns.add(newSpawn);
+ }
+ }
+ }
+ }
+ }
+
+ private enum TeamColors
+ {
+
+ YELLOW(ChatColor.YELLOW, new String[]{"Banana", "Sunshine", "Custard", "Sponge", "Star", "Giraffe", "Lego", "Light"}),
+ GREEN(ChatColor.GREEN, new String[]{"Creepers", "Alien", "Seaweed", "Emerald", "Grinch", "Shrub", "Snake", "Leaf"}),
+ AQUA(ChatColor.AQUA, new String[]{"Diamond", "Ice", "Pool", "Kraken", "Aquatic", "Ocean"}),
+ RED(ChatColor.RED, new String[]{"Heart", "Tomato", "Ruby", "Jam", "Rose", "Apple", "TNT"}),
+ GOLD(ChatColor.GOLD, new String[]{"Mango", "Foxes", "Sunset", "Nuggets", "Lion", "Desert", "Gapple"}),
+ LIGHT_PURPLE(ChatColor.LIGHT_PURPLE, new String[]{"Dream", "Cupcake", "Cake", "Candy", "Unicorn"}),
+ DARK_BLUE(ChatColor.DARK_BLUE, new String[]{"Squid", "Lapis", "Sharks", "Galaxy", "Empoleon"}),
+ DARK_RED(ChatColor.DARK_RED, new String[]{"Rose", "Apple", "Twizzler", "Rocket", "Blood"}),
+ WHITE(ChatColor.WHITE, new String[]{"Ghosts", "Spookies", "Popcorn", "Seagull", "Rice", "Snowman", "Artic"}),
+ BLUE(ChatColor.BLUE, new String[]{"Sky", "Whale", "Lake", "Birds", "Bluebird", "Piplup"}),
+ DARK_GREEN(ChatColor.DARK_GREEN, new String[]{"Forest", "Zombies", "Cactus", "Slime", "Toxic", "Poison"}),
+ DARK_PURPLE(ChatColor.DARK_PURPLE, new String[]{"Amethyst", "Slugs", "Grape", "Witch", "Magic", "Zula"}),
+ DARK_AQUA(ChatColor.DARK_AQUA, new String[]{"Snorlax", "Aquatic", "Clam", "Fish"});
+
+ private ChatColor color;
+ private String[] names;
+
+ private TeamColors(ChatColor color, String[] names)
+ {
+ this.color = color;
+ this.names = names;
+ }
+
+ public ChatColor getColor()
+ {
+ return color;
+ }
+
+ public String[] getNames()
+ {
+ return names;
+ }
+
+ }
+
+ private String[] getColorName(ChatColor color)
+ {
+ for(TeamColors colors : TeamColors.values())
+ {
+ if(colors.getColor() == color)
+ {
+ return colors.getNames();
+ }
+ }
+ return null;
+ }
+
+ private TeamColors getNextColor(TeamColors color)
+ {
+ for(TeamColors colors : TeamColors.values()) {
+ if(colors.ordinal() == color.ordinal() + 1)
+ {
+ return colors;
+ }
+ }
+ return TeamColors.YELLOW;
+ }
+
+ @Override
+ @EventHandler
+ public void ScoreboardUpdate(UpdateEvent event)
+ {
+ if (event.getType() != UpdateType.FAST)
+ return;
+
+ if (GetTeamList().isEmpty())
+ return;
+
+ Scoreboard.Reset();
+
+ Scoreboard.WriteBlank();
+ Scoreboard.Write(C.cYellow + C.Bold + "Teams");
+
+ ArrayList alive = new ArrayList();
+ for (GameTeam team : GetTeamList())
+ {
+ if (team.IsTeamAlive())
+ alive.add(team);
+ }
+
+ if (GetPlayers(true).size() <= 4)
+ {
+ for (GameTeam team : GetTeamList())
+ {
+ for (Player player : team.GetPlayers(true))
+ {
+ Scoreboard.Write(team.GetColor() + player.getName());
+ }
+ }
+ }
+ else if (alive.size() <= 4)
+ {
+ for (GameTeam team : alive)
+ {
+ Scoreboard.Write(C.cWhite + team.GetPlayers(true).size() + " " + team.GetColor() + team.GetName());
+ }
+ }
+ else
+ {
+ Scoreboard.Write(C.cWhite + alive.size() + " Alive");
+ }
+
+ if (IsLive())
+ {
+ Scoreboard.WriteBlank();
+ Scoreboard.Write(C.cYellow + C.Bold + "Time");
+ Scoreboard.Write(UtilTime.convertString(System.currentTimeMillis() - GetStateTime(), 0, TimeUnit.FIT));
+
+ Scoreboard.WriteBlank();
+ Scoreboard.Write((this.getTnTGen().active() ? C.cGreen : C.cRed) + C.Bold + "TNT Spawn");
+ Scoreboard.Write(this.getTnTGen().getScoreboardInfo());
+
+ Scoreboard.WriteBlank();
+
+ if (UtilTime.elapsed(GetStateTime(), this.getCrumbleTime()))
+ {
+ Scoreboard.Write(C.cRed + C.Bold + "Map Crumble");
+ Scoreboard.Write("Active");
+ }
+ else
+ {
+ Scoreboard.Write(C.cGreen + C.Bold + "Map Crumble");
+ Scoreboard.Write(UtilTime.convertString(this.getCrumbleTime() - (System.currentTimeMillis() - GetStateTime()), 0, TimeUnit.FIT));
+ }
+ }
+
+
+
+ Scoreboard.Draw();
+ }
+
+ @Override
+ public void EndCheck()
+ {
+ if (!IsLive())
+ return;
+
+ ArrayList teamsAlive = new ArrayList();
+
+ for (GameTeam team : this.GetTeamList())
+ if (team.GetPlayers(true).size() > 0)
+ teamsAlive.add(team);
+
+ if (teamsAlive.size() <= 1)
+ {
+ //Announce
+ if (teamsAlive.size() > 0)
+ AnnounceEnd(teamsAlive.get(0));
+
+ for (GameTeam team : GetTeamList())
+ {
+ if (WinnerTeam != null && team.equals(WinnerTeam))
+ {
+ for (Player player : team.GetPlayers(false))
+ AddGems(player, 10, "Winning Team", false, false);
+ }
+
+ for (Player player : team.GetPlayers(false))
+ if (player.isOnline())
+ AddGems(player, 10, "Participation", false, false);
+ }
+
+ //End
+ SetState(GameState.End);
+ }
+ }
+
+ @Override
+ public List getWinners()
+ {
+ if (WinnerTeam == null)
+ return null;
+
+ return WinnerTeam.GetPlayers(false);
+ }
+
+ @Override
+ public List getLosers()
+ {
+ if (WinnerTeam == null)
+ return null;
+
+ List players = new ArrayList<>();
+
+ for (GameTeam team : GetTeamList())
+ {
+ if (team != WinnerTeam)
+ players.addAll(team.GetPlayers(false));
+ }
+
+ return players;
+ }
+
+ @Override
+ public boolean CanJoinTeam(GameTeam team)
+ {
+ return team.GetSize() < 2;
+ }
+
+ @EventHandler(priority = EventPriority.HIGH)
+ public void teamSelectInteract(PlayerInteractEntityEvent event)
+ {
+ if (GetState() != GameState.Recruit)
+ return;
+
+ if (event.getRightClicked() == null)
+ return;
+
+ if (!(event.getRightClicked() instanceof Player))
+ return;
+
+ Player player = event.getPlayer();
+
+ //Observer
+ if (Manager.IsObserver(player))
+ {
+ UtilPlayer.message(player, F.main("Game", "Spectators cannot partake in games."));
+ return;
+ }
+
+ selectTeamMate(player, (Player)event.getRightClicked());
+ }
+
+ @EventHandler
+ public void teamSelectCommand(PlayerCommandPreprocessEvent event)
+ {
+ if (GetState() != GameState.Recruit)
+ return;
+
+ if (!event.getMessage().toLowerCase().startsWith("/team "))
+ return;
+
+ event.setCancelled(true);
+
+ Player target = UtilPlayer.searchOnline(event.getPlayer(), event.getMessage().split(" ")[1], true);
+ if (target == null)
+ return;
+
+ //Observer
+ if (Manager.IsObserver(event.getPlayer()))
+ {
+ UtilPlayer.message(event.getPlayer(), F.main("Game", "Spectators cannot partake in games."));
+ return;
+ }
+
+ if (event.getPlayer().equals(target))
+ return;
+
+ selectTeamMate(event.getPlayer(), target);
+ }
+
+ public void selectTeamMate(Player player, Player ally)
+ {
+ //Accept Invite
+ if (_teamReqs.containsKey(ally) && _teamReqs.get(ally).equals(player))
+ {
+ //Remove Prefs
+ _teamReqs.remove(player);
+ _teamReqs.remove(ally);
+
+ //Inform
+ UtilPlayer.message(player, F.main("Game", "You accepted " + ally.getName() + "'s Team Request!"));
+ UtilPlayer.message(ally, F.main("Game", player.getName() + " accepted your Team Request!"));
+
+ //Leave Old Teams
+ if (GetTeam(player) != null)
+ GetTeam(player).DisbandTeam();
+
+ if (GetTeam(ally) != null)
+ GetTeam(ally).DisbandTeam();
+
+ //Get Team
+ GameTeam team = getEmptyTeam();
+ if (team == null)
+ return;
+
+ //Join Team
+ SetPlayerTeam(player, team, true);
+ SetPlayerTeam(ally, team, true);
+ }
+ //Send Invite
+ else
+ {
+ //Already on Team with Target
+ if (GetTeam(player) != null)
+ if (GetTeam(player).HasPlayer(ally))
+ return;
+
+ //Inform Player
+ UtilPlayer.message(player, F.main("Game", "You sent a Team Request to " + ally.getName() + "!"));
+
+ //Inform Target
+ if (Recharge.Instance.use(player, "Team Req " + ally.getName(), 2000, false, false))
+ {
+ UtilPlayer.message(ally, F.main("Game", player.getName() + " sent you a Team Request!"));
+ UtilPlayer.message(ally, F.main("Game", "Type " + F.elem("/team " + player.getName()) + " to accept!"));
+ }
+
+ //Add Pref
+ _teamReqs.put(player, ally);
+ }
+ }
+
+ @EventHandler
+ public void teamQuit(PlayerQuitEvent event)
+ {
+ if (GetState() != GameState.Recruit)
+ return;
+
+ Player player = event.getPlayer();
+
+ if (GetTeam(player) != null)
+ GetTeam(player).DisbandTeam();
+
+ Iterator teamIter = _teamReqs.keySet().iterator();
+ while (teamIter.hasNext())
+ {
+ Player sender = teamIter.next();
+ if (sender.equals(player) || _teamReqs.get(sender).equals(player))
+ teamIter.remove();
+ }
+ }
+
+ public GameTeam getEmptyTeam()
+ {
+ for (GameTeam team : GetTeamList())
+ {
+ if (team.GetPlayers(false).isEmpty())
+ return team;
+ }
+
+ return null;
+ }
+
+ @Override
+ public String GetMode()
+ {
+ return "Team Mode";
+ }
+}
diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/SoloSuperSmash.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/SoloSuperSmash.java
new file mode 100644
index 000000000..b9ba7a26b
--- /dev/null
+++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/SoloSuperSmash.java
@@ -0,0 +1,162 @@
+package nautilus.game.arcade.game.games.smash;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import org.bukkit.ChatColor;
+import org.bukkit.entity.Player;
+import org.bukkit.event.EventHandler;
+
+import mineplex.core.common.util.C;
+import mineplex.core.updater.UpdateType;
+import mineplex.core.updater.event.UpdateEvent;
+import nautilus.game.arcade.ArcadeManager;
+import nautilus.game.arcade.GameType;
+import nautilus.game.arcade.events.GameStateChangeEvent;
+import nautilus.game.arcade.game.GameTeam;
+import nautilus.game.arcade.game.Game.GameState;
+
+public class SoloSuperSmash extends SuperSmash
+{
+
+ private GameTeam _players;
+
+ public SoloSuperSmash(ArcadeManager manager)
+ {
+ super(manager, GameType.Smash, new String[]
+ {
+ "Each player has 3 respawns",
+ "Attack to restore hunger!",
+ "Last player alive wins!"
+ });
+
+ this.DamageTeamSelf = true;
+ }
+
+ @EventHandler
+ public void CustomTeamGeneration(GameStateChangeEvent event)
+ {
+ if (event.GetState() != GameState.Recruit)
+ return;
+
+ _players = GetTeamList().get(0);
+ _players.SetColor(ChatColor.YELLOW);
+ _players.SetName("Players");
+ _players.setDisplayName(C.cYellow + C.Bold + "Players");
+ }
+
+ @Override
+ @EventHandler
+ public void ScoreboardUpdate(UpdateEvent event)
+ {
+ if (event.getType() != UpdateType.FAST)
+ return;
+
+ //Wipe Last
+ Scoreboard.Reset();
+
+ if (GetPlayers(true).size() > 14)
+ {
+ Scoreboard.WriteBlank();
+ Scoreboard.Write(C.cGreen + "Players Alive");
+ Scoreboard.Write(GetPlayers(true).size() + " ");
+
+ Scoreboard.WriteBlank();
+ Scoreboard.Write(C.cRed + "Players Dead");
+ Scoreboard.Write((GetPlayers(false).size() - GetPlayers(true).size()) + " ");
+ }
+ else
+ {
+ Scoreboard.WriteBlank();
+
+ //Write New
+ for (Player player : GetPlayers(true))
+ {
+ int lives = GetLives(player);
+
+ String out;
+ if (lives >= 4) out = C.cGreen + player.getName();
+ else if (lives == 3) out = C.cYellow + player.getName();
+ else if (lives == 2) out = C.cGold + player.getName();
+ else if (lives == 1) out = C.cRed + player.getName();
+ else if (lives == 0) out = C.cRed + player.getName();
+ else
+ continue;
+
+ Scoreboard.WriteOrdered("Lives", out, lives, true);
+ }
+ }
+
+ Scoreboard.Draw();
+ }
+
+ @Override
+ public void EndCheck()
+ {
+ if (!IsLive())
+ return;
+
+ if (GetPlayers(true).size() <= 1)
+ {
+ ArrayList places = GetTeamList().get(0).GetPlacements(true);
+
+ //Announce
+ AnnounceEnd(places);
+
+ //Gems
+ if (places.size() >= 1)
+ AddGems(places.get(0), 20, "1st Place", false, false);
+
+ if (places.size() >= 2)
+ AddGems(places.get(1), 15, "2nd Place", false, false);
+
+ if (places.size() >= 3)
+ AddGems(places.get(2), 10, "3rd Place", false, false);
+
+ for (Player player : GetPlayers(false))
+ if (player.isOnline())
+ AddGems(player, 10, "Participation", false, false);
+
+ //End
+ SetState(GameState.End);
+ }
+ }
+
+ @Override
+ public List getWinners()
+ {
+ if (GetState().ordinal() >= GameState.End.ordinal())
+ {
+ List places = GetTeamList().get(0).GetPlacements(true);
+
+ if (places.isEmpty() || !places.get(0).isOnline())
+ return Arrays.asList();
+ else
+ return Arrays.asList(places.get(0));
+ }
+ else
+ return null;
+ }
+
+ @Override
+ public List getLosers()
+ {
+ List winners = getWinners();
+
+ if (winners == null)
+ return null;
+
+ List losers = GetTeamList().get(0).GetPlayers(false);
+
+ losers.removeAll(winners);
+
+ return losers;
+ }
+
+ @Override
+ public String GetMode()
+ {
+ return "Solo Mode";
+ }
+}
diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/SuperSmash.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/SuperSmash.java
index 8ea1c5c8a..6e255aea9 100644
--- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/SuperSmash.java
+++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/SuperSmash.java
@@ -1,40 +1,16 @@
package nautilus.game.arcade.game.games.smash;
+import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
-import org.bukkit.ChatColor;
-import org.bukkit.FireworkEffect.Type;
-import org.bukkit.Color;
-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.EnderCrystal;
-import org.bukkit.entity.Player;
-import org.bukkit.event.EventHandler;
-import org.bukkit.event.EventPriority;
-import org.bukkit.event.block.BlockFadeEvent;
-import org.bukkit.event.entity.EntityDamageEvent;
-import org.bukkit.event.entity.EntityDeathEvent;
-import org.bukkit.event.entity.EntityRegainHealthEvent;
-import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
-import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason;
-import org.bukkit.event.entity.PlayerDeathEvent;
-import org.bukkit.event.player.PlayerInteractEvent;
-
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAlg;
-import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilFirework;
import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilPlayer;
-import mineplex.core.common.util.UtilServer;
-import mineplex.core.common.util.UtilTextMiddle;
-import mineplex.core.common.util.UtilTime;
import mineplex.core.data.BlockData;
import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.recharge.Recharge;
@@ -45,19 +21,57 @@ import nautilus.game.arcade.ArcadeFormat;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType;
import nautilus.game.arcade.events.GameStateChangeEvent;
+import nautilus.game.arcade.game.Game;
import nautilus.game.arcade.game.GameTeam;
-import nautilus.game.arcade.game.SoloGame;
import nautilus.game.arcade.game.GameTeam.PlayerState;
-import nautilus.game.arcade.game.games.smash.kits.*;
+import nautilus.game.arcade.game.games.smash.kits.KitBlaze;
+import nautilus.game.arcade.game.games.smash.kits.KitChicken;
+import nautilus.game.arcade.game.games.smash.kits.KitCreeper;
+import nautilus.game.arcade.game.games.smash.kits.KitEnderman;
+import nautilus.game.arcade.game.games.smash.kits.KitGolem;
+import nautilus.game.arcade.game.games.smash.kits.KitMagmaCube;
+import nautilus.game.arcade.game.games.smash.kits.KitPig;
+import nautilus.game.arcade.game.games.smash.kits.KitSheep;
+import nautilus.game.arcade.game.games.smash.kits.KitSkeletalHorse;
+import nautilus.game.arcade.game.games.smash.kits.KitSkeleton;
+import nautilus.game.arcade.game.games.smash.kits.KitSkySquid;
+import nautilus.game.arcade.game.games.smash.kits.KitSlime;
+import nautilus.game.arcade.game.games.smash.kits.KitSnowman;
+import nautilus.game.arcade.game.games.smash.kits.KitSpider;
+import nautilus.game.arcade.game.games.smash.kits.KitWitch;
+import nautilus.game.arcade.game.games.smash.kits.KitWitherSkeleton;
+import nautilus.game.arcade.game.games.smash.kits.KitWolf;
+import nautilus.game.arcade.game.games.smash.kits.KitZombie;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.kit.SmashKit;
-import nautilus.game.arcade.stats.KillFastStatTracker;
import nautilus.game.arcade.stats.FreeKitWinStatTracker;
+import nautilus.game.arcade.stats.KillFastStatTracker;
import nautilus.game.arcade.stats.OneVThreeStatTracker;
import nautilus.game.arcade.stats.RecoveryMasterStatTracker;
import nautilus.game.arcade.stats.WinWithoutDyingStatTracker;
-public class SuperSmash extends SoloGame
+import org.bukkit.Bukkit;
+import org.bukkit.ChatColor;
+import org.bukkit.Color;
+import org.bukkit.FireworkEffect.Type;
+import org.bukkit.Location;
+import org.bukkit.Material;
+import org.bukkit.Sound;
+import org.bukkit.block.BlockFace;
+import org.bukkit.entity.EnderCrystal;
+import org.bukkit.entity.Player;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.EventPriority;
+import org.bukkit.event.block.BlockFadeEvent;
+import org.bukkit.event.entity.EntityDamageEvent;
+import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
+import org.bukkit.event.entity.EntityDeathEvent;
+import org.bukkit.event.entity.EntityRegainHealthEvent;
+import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason;
+import org.bukkit.event.entity.PlayerDeathEvent;
+import org.bukkit.event.player.PlayerInteractEvent;
+
+public abstract class SuperSmash extends Game
{
private HashMap _lives = new HashMap();
@@ -68,9 +82,9 @@ public class SuperSmash extends SoloGame
private HashSet _restoreBlock = new HashSet();
- public SuperSmash(ArcadeManager manager)
+ public SuperSmash(ArcadeManager manager, GameType type, String[] description)
{
- super(manager, GameType.Smash,
+ super(manager, type,
new Kit[]
{
@@ -98,31 +112,23 @@ public class SuperSmash extends SoloGame
new KitSheep(manager)
- },
-
- new String[]
- {
- "Each player has 3 respawns",
- "Attack to restore hunger!",
- "Last player alive wins!"
-
- });
+ },description);
this.DeathOut = false;
- this.DamageTeamSelf = true;
-
this.CompassEnabled = true;
this.DeathSpectateSecs = 4;
- this.SpawnDistanceRequirement = 32;
-
this.WorldWaterDamage = 1000;
-
+
+ this.HideTeamSheep = true;
+
+ this.ReplaceTeamsWithKits = true;
+
// Add stat table here
// Example
- //Manager.GetStatsManager().addTable("SuperSmashMobStats", "Kills", "Deaths", "Wins", "Losses");
+ // Manager.GetStatsManager().addTable("SuperSmashMobStats", "Kills", "Deaths", "Wins", "Losses");
registerStatTrackers(
new WinWithoutDyingStatTracker(this, "MLGPro"),
@@ -154,7 +160,7 @@ public class SuperSmash extends SoloGame
}
}
- private int GetLives(Player player)
+ public int GetLives(Player player)
{
if (!_lives.containsKey(player))
return 0;
@@ -165,14 +171,14 @@ public class SuperSmash extends SoloGame
return _lives.get(player);
}
- private boolean LoseLife(Player player)
+ public boolean LoseLife(Player player)
{
int lives = GetLives(player) - 1;
if (lives > 0)
{
UtilPlayer.message(player, C.cRed + C.Bold + "You have died!");
- UtilPlayer.message(player, C.cRed + C.Bold + "You have " + lives + (lives == 1 ? "life" : "lives") + " left!");
+ UtilPlayer.message(player, C.cRed + C.Bold + "You have " + lives + " " + (lives == 1 ? "life" : "lives") + " left!");
player.playSound(player.getLocation(), Sound.NOTE_BASS_GUITAR, 2f, 0.5f);
_lives.put(player, lives);
@@ -188,51 +194,6 @@ public class SuperSmash extends SoloGame
}
}
- @Override
- @EventHandler
- public void ScoreboardUpdate(UpdateEvent event)
- {
- if (event.getType() != UpdateType.FAST)
- return;
-
- //Wipe Last
- Scoreboard.Reset();
-
- if (GetPlayers(true).size() > 14)
- {
- Scoreboard.WriteBlank();
- Scoreboard.Write(C.cGreen + "Players Alive");
- Scoreboard.Write(GetPlayers(true).size() + " ");
-
- Scoreboard.WriteBlank();
- Scoreboard.Write(C.cRed + "Players Dead");
- Scoreboard.Write((GetPlayers(false).size() - GetPlayers(true).size()) + " ");
- }
- else
- {
- Scoreboard.WriteBlank();
-
- //Write New
- for (Player player : GetPlayers(true))
- {
- int lives = GetLives(player);
-
- String out;
- if (lives >= 4) out = C.cGreen + player.getName();
- else if (lives == 3) out = C.cYellow + player.getName();
- else if (lives == 2) out = C.cGold + player.getName();
- else if (lives == 1) out = C.cRed + player.getName();
- else if (lives == 0) out = C.cRed + player.getName();
- else
- continue;
-
- Scoreboard.WriteOrdered("Lives", out, lives, true);
- }
- }
-
- Scoreboard.Draw();
- }
-
@EventHandler
public void powerupSpawn(UpdateEvent event)
{
@@ -530,9 +491,4 @@ public class SuperSmash extends SoloGame
int amount = Math.max(1, (int)(event.GetDamage()/2));
UtilPlayer.hunger(damager, amount);
}
-
- public String GetMode()
- {
- return "Deathmatch";
- }
}
diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/SuperSmashTeam.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/SuperSmashTeam.java
deleted file mode 100644
index 4f4507bd3..000000000
--- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/SuperSmashTeam.java
+++ /dev/null
@@ -1,377 +0,0 @@
-package nautilus.game.arcade.game.games.smash;
-
-import java.util.HashMap;
-
-import org.bukkit.Sound;
-import org.bukkit.entity.Player;
-import org.bukkit.event.EventHandler;
-import org.bukkit.event.EventPriority;
-import org.bukkit.event.block.BlockFadeEvent;
-import org.bukkit.event.entity.EntityDamageEvent;
-import org.bukkit.event.entity.EntityDeathEvent;
-import org.bukkit.event.entity.EntityRegainHealthEvent;
-import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
-import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason;
-import org.bukkit.event.entity.PlayerDeathEvent;
-import org.bukkit.event.player.PlayerInteractEvent;
-
-import mineplex.core.common.util.C;
-import mineplex.core.common.util.F;
-import mineplex.core.common.util.UtilInv;
-import mineplex.core.common.util.UtilPlayer;
-import mineplex.core.recharge.Recharge;
-import mineplex.core.updater.UpdateType;
-import mineplex.core.updater.event.UpdateEvent;
-import mineplex.minecraft.game.core.damage.CustomDamageEvent;
-import nautilus.game.arcade.ArcadeFormat;
-import nautilus.game.arcade.ArcadeManager;
-import nautilus.game.arcade.GameType;
-import nautilus.game.arcade.events.GameStateChangeEvent;
-import nautilus.game.arcade.game.GameTeam;
-import nautilus.game.arcade.game.GameTeam.PlayerState;
-import nautilus.game.arcade.game.TeamGame;
-import nautilus.game.arcade.game.games.smash.kits.*;
-import nautilus.game.arcade.kit.Kit;
-
-public class SuperSmashTeam extends TeamGame
-{
- private HashMap _lives = new HashMap();
-
- public SuperSmashTeam(ArcadeManager manager)
- {
- super(manager, GameType.SmashTeams,
-
- new Kit[]
- {
-
- new KitSkeleton(manager),
- new KitGolem(manager),
- new KitSpider(manager),
- new KitSlime(manager),
-
- new KitCreeper(manager),
- new KitEnderman(manager),
- new KitSnowman(manager),
- new KitWolf(manager),
-
-
- new KitBlaze(manager),
- new KitWitch(manager),
- new KitChicken(manager),
- new KitSkeletalHorse(manager),
- new KitPig(manager),
- new KitSkySquid(manager),
- new KitWitherSkeleton(manager),
- new KitMagmaCube(manager),
-
- new KitSheep(manager)
-
- },
-
- new String[]
- {
- "Each player has 3 respawns",
- "Attack to restore hunger!",
- "Last player alive wins!"
-
- });
-
- this.DeathOut = false;
-
- this.DamageTeamSelf = false;
-
- this.CompassEnabled = true;
-
- this.SpawnDistanceRequirement = 16;
-
- this.TeamArmorHotbar = true;
- }
-
- @EventHandler(priority = EventPriority.HIGH)
- public void GameStateChange(GameStateChangeEvent event)
- {
- if (event.GetState() != GameState.Prepare)
- return;
-
- for (Player player : GetPlayers(true))
- _lives.put(player, 4);
- }
-
- @EventHandler
- public void PlayerOut(PlayerDeathEvent event)
- {
- if (!LoseLife(event.getEntity()))
- {
- this.SetPlayerState(event.getEntity(), PlayerState.OUT);
- }
- }
-
- private int GetLives(Player player)
- {
- if (!_lives.containsKey(player))
- return 0;
-
- if (!IsAlive(player))
- return 0;
-
- return _lives.get(player);
- }
-
- private boolean LoseLife(Player player)
- {
- int lives = GetLives(player) - 1;
-
- if (lives > 0)
- {
- UtilPlayer.message(player, C.cRed + C.Bold + "You have died!");
- 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);
-
- return true;
- }
- else
- {
- UtilPlayer.message(player, C.cRed + C.Bold + "You are out of the game!");
- player.playSound(player.getLocation(), Sound.EXPLODE, 2f, 1f);
-
- return false;
- }
- }
-
- @Override
- @EventHandler
- public void ScoreboardUpdate(UpdateEvent event)
- {
- if (event.getType() != UpdateType.FAST)
- return;
-
- //Wipe Last
- Scoreboard.Reset();
-
- if (GetPlayers(true).size() > 14)
- {
- for (GameTeam team : this.GetTeamList())
- {
- Scoreboard.WriteBlank();
- Scoreboard.Write(team.GetFormattedName());
-
- int lives = 0;
- for (Player player : team.GetPlayers(true))
- lives += GetLives(player);
-
- Scoreboard.Write(team.GetColor() + "" + lives + " Lives");
- }
- }
- else
- {
- Scoreboard.WriteBlank();
-
- //Write New
- for (Player player : GetPlayers(true))
- {
- int lives = GetLives(player);
-
- if (lives <= 0)
- continue;
-
- Scoreboard.WriteOrdered("Lives", GetTeam(player).GetColor() + player.getName(), lives, true);
- }
- }
-
- Scoreboard.Draw();
- }
-
- @EventHandler(priority = EventPriority.LOWEST)
- public void FallDamage(CustomDamageEvent event)
- {
- if (event.IsCancelled())
- return;
-
- if (event.GetCause() == DamageCause.FALL)
- event.SetCancelled("No Fall Damage");
- }
-
- @EventHandler(priority = EventPriority.HIGH)
- public void Knockback(CustomDamageEvent event)
- {
- if (event.IsCancelled())
- return;
-
- if (event.GetDamageePlayer() != null)
- event.AddKnockback("Smash Knockback", 1 + 0.1 * (20 - event.GetDamageePlayer().getHealth()));
- }
-
- @EventHandler(priority = EventPriority.HIGH)
- public void ArenaWalls(CustomDamageEvent event)
- {
- if (event.IsCancelled())
- return;
-
- if (event.GetCause() == DamageCause.VOID || event.GetCause() == DamageCause.LAVA)
- {
- event.GetDamageeEntity().eject();
- event.GetDamageeEntity().leaveVehicle();
-
- event.AddMod("Smash", "Super Smash Mobs", 5000, false);
- }
- }
-
- @EventHandler
- public void HealthChange(EntityRegainHealthEvent event)
- {
- if (event.getRegainReason() == RegainReason.SATIATED)
- event.setCancelled(true);
- }
-
- @EventHandler(priority = EventPriority.MONITOR)
- public void EntityDeath(EntityDeathEvent event)
- {
- event.getDrops().clear();
- }
-
- @Override
- public void SetKit(Player player, Kit kit, boolean announce)
- {
- GameTeam team = GetTeam(player);
- if (team != null)
- {
- if (!team.KitAllowed(kit))
- {
- player.playSound(player.getLocation(), Sound.NOTE_BASS, 2f, 0.5f);
- UtilPlayer.message(player, F.main("Kit", F.elem(team.GetFormattedName()) + " cannot use " + F.elem(kit.GetFormattedName() + " Kit") + "."));
- return;
- }
- }
-
- _playerKit.put(player, kit);
-
- if (announce)
- {
- player.playSound(player.getLocation(), Sound.ORB_PICKUP, 2f, 1f);
- UtilPlayer.message(player, F.main("Kit", "You equipped " + F.elem(kit.GetFormattedName() + " Kit") + "."));
- kit.ApplyKit(player);
- UtilInv.Update(player);
- }
- }
-
- @EventHandler(priority = EventPriority.LOWEST)
- public void AbilityDescription(PlayerInteractEvent event)
- {
- if (event.isCancelled())
- return;
-
- Player player = event.getPlayer();
-
- if (player.getItemInHand() == null)
- return;
-
- if (player.getItemInHand().getItemMeta() == null)
- return;
-
- if (player.getItemInHand().getItemMeta().getDisplayName() == null)
- return;
-
- if (player.getItemInHand().getItemMeta().getLore() == null)
- return;
-
- if (Manager.GetGame() == null || Manager.GetGame().GetState() != GameState.Recruit)
- return;
-
- for (int i=player.getItemInHand().getItemMeta().getLore().size() ; i<=7 ; i++)
- UtilPlayer.message(player, " ");
-
- UtilPlayer.message(player, ArcadeFormat.Line);
-
- UtilPlayer.message(player, "§aAbility - §f§l" + player.getItemInHand().getItemMeta().getDisplayName());
-
- //Perk Descs
- for (String line : player.getItemInHand().getItemMeta().getLore())
- {
- UtilPlayer.message(player, line);
- }
-
- UtilPlayer.message(player, ArcadeFormat.Line);
-
- player.playSound(player.getLocation(), Sound.NOTE_PLING, 1f, 2f);
-
- event.setCancelled(true);
- }
-
- @Override
- public double GetKillsGems(Player killer, Player killed, boolean assist)
- {
- return 4;
- }
-
- @EventHandler
- public void BlockFade(BlockFadeEvent event)
- {
- event.setCancelled(true);
- }
-
- private int hungerTick = 0;
- @EventHandler
- public void Hunger(UpdateEvent event)
- {
- if (event.getType() != UpdateType.SEC)
- return;
-
- if (!IsLive())
- return;
-
- hungerTick = (hungerTick + 1)%6;
-
- for (Player player : GetPlayers(true))
- {
- player.setSaturation(3f);
- player.setExhaustion(0f);
-
- if (player.getFoodLevel() <= 0)
- {
- Manager.GetDamage().NewDamageEvent(player, null, null,
- DamageCause.STARVATION, 1, false, true, false,
- "Starvation", GetName());
-
- UtilPlayer.message(player, F.main("Game", "Attack other players to restore hunger!"));
- }
-
- if (hungerTick == 0)
- UtilPlayer.hunger(player, -1);
- }
- }
-
- @EventHandler(priority = EventPriority.MONITOR)
- public void HungerRestore(CustomDamageEvent event)
- {
-
- if (event.IsCancelled())
- return;
-
- if (event.GetDamagerPlayer(true) == null)
- return;
-
- if (event.GetDamageePlayer() == null)
- return;
-
- if (GetTeam(event.GetDamageePlayer()) == null)
- return;
-
- Player damager = event.GetDamagerPlayer(true);
- if (damager == null)
- return;
-
- if (GetTeam(damager) == null)
- return;
-
- if (GetTeam(damager).equals(GetTeam(event.GetDamageePlayer())))
- return;
-
- if (!Recharge.Instance.use(damager, "Hunger Restore", 250, false, false))
- return;
-
- int amount = Math.max(1, (int)(event.GetDamage()/2));
- UtilPlayer.hunger(damager, amount);
- }
-}
diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/TeamSuperSmash.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/TeamSuperSmash.java
new file mode 100644
index 000000000..1d3b3052c
--- /dev/null
+++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/TeamSuperSmash.java
@@ -0,0 +1,424 @@
+package nautilus.game.arcade.game.games.smash;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import mineplex.core.common.util.C;
+import mineplex.core.common.util.F;
+import mineplex.core.common.util.NautHashMap;
+import mineplex.core.common.util.UtilPlayer;
+import mineplex.core.recharge.Recharge;
+import mineplex.core.updater.UpdateType;
+import mineplex.core.updater.event.UpdateEvent;
+import nautilus.game.arcade.ArcadeManager;
+import nautilus.game.arcade.GameType;
+import nautilus.game.arcade.events.GameStateChangeEvent;
+import nautilus.game.arcade.game.GameTeam;
+
+import org.bukkit.ChatColor;
+import org.bukkit.Location;
+import org.bukkit.entity.Player;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.EventPriority;
+import org.bukkit.event.player.PlayerCommandPreprocessEvent;
+import org.bukkit.event.player.PlayerInteractEntityEvent;
+import org.bukkit.event.player.PlayerQuitEvent;
+
+public class TeamSuperSmash extends SuperSmash
+{
+
+ public boolean ForceTeamSize = true;
+ public int PlayersPerTeam = 2;
+ public int TeamCount = 0;
+
+ private NautHashMap _teamReqs = new NautHashMap();
+
+ public TeamSuperSmash(ArcadeManager manager)
+ {
+ super(manager, GameType.SmashTeams,
+ new String[]
+ {
+ "Each player has 3 respawns",
+ "Attack to restore hunger!",
+ "Last team alive wins!"
+ });
+
+ this.PlayersPerTeam = 2;
+ this.FillTeamsInOrderToCount = 2;
+
+ this.SpawnNearAllies = true;
+ this.DamageTeamSelf = false;
+
+ this.TeamArmorHotbar = true;
+ }
+
+ @Override
+ @EventHandler
+ public void ScoreboardUpdate(UpdateEvent event)
+ {
+ if (event.getType() != UpdateType.FAST)
+ return;
+
+ ArrayList alive = new ArrayList();
+ for (GameTeam team : GetTeamList())
+ {
+ if (team.IsTeamAlive())
+ alive.add(team);
+ }
+
+ //Wipe Last
+ Scoreboard.Reset();
+ Scoreboard.WriteBlank();
+
+ if (GetPlayers(true).size() < 16)
+ {
+
+ for (GameTeam team : GetTeamList())
+ {
+ for (Player player : team.GetPlayers(true))
+ {
+ int lives = GetLives(player);
+
+ Scoreboard.Write(C.cWhite + lives + " " + team.GetColor() + player.getName());
+ }
+ }
+ }
+ else if (alive.size() < 16)
+ {
+ for (GameTeam team : alive)
+ {
+ int lives = 0;
+
+ for (Player player : team.GetPlayers(true))
+ {
+ lives += GetLives(player);
+ }
+
+ Scoreboard.Write(C.cWhite + lives + " " + team.GetColor() + team.GetName());
+ }
+ }
+ else
+ {
+ Scoreboard.Write(C.cYellow + C.Bold + "Teams Alive");
+ Scoreboard.Write(C.cWhite + alive.size());
+ }
+
+ Scoreboard.Draw();
+ }
+
+ @EventHandler
+ public void CustomTeamGeneration(GameStateChangeEvent event)
+ {
+ if (event.GetState() != GameState.Recruit)
+ return;
+
+ ArrayList spawns = this.GetTeamList().get(0).GetSpawns();
+ this.GetTeamList().clear();
+
+ TeamColors color = TeamColors.DARK_AQUA;
+
+ if(!this.ForceTeamSize)
+ {
+ for(int i = 1; i <= this.TeamCount; i++)
+ {
+ color = getNextColor(color);
+ GameTeam team = new GameTeam(this, String.valueOf(i), color.getColor(), spawns);
+ team.SetVisible(true);
+ GetTeamList().add(team);
+ }
+ }
+ else
+ {
+ for(int i = 1; i <= Manager.GetPlayerFull() / this.PlayersPerTeam; i++)
+ {
+ color = getNextColor(color);
+ int e = 0;
+ for(GameTeam teams : GetTeamList())
+ {
+ if(teams.GetColor() == color.getColor())
+ {
+ e++;
+ if(getColorName(color.getColor()).length <= e)
+ {
+ e = 0;
+ }
+ }
+ }
+ GameTeam team = new GameTeam(this, getColorName(color.getColor())[e], color.getColor(), spawns, true);
+ team.SetVisible(true);
+ GetTeamList().add(team);
+ }
+ }
+ }
+
+ private enum TeamColors
+ {
+
+ YELLOW(ChatColor.YELLOW, new String[]{"Banana", "Sunshine", "Custard", "Sponge", "Star", "Giraffe", "Lego", "Light"}),
+ GREEN(ChatColor.GREEN, new String[]{"Creepers", "Alien", "Seaweed", "Emerald", "Grinch", "Shrub", "Snake", "Leaf"}),
+ AQUA(ChatColor.AQUA, new String[]{"Diamond", "Ice", "Pool", "Kraken", "Aquatic", "Ocean"}),
+ RED(ChatColor.RED, new String[]{"Heart", "Tomato", "Ruby", "Jam", "Rose", "Apple", "TNT"}),
+ GOLD(ChatColor.GOLD, new String[]{"Mango", "Foxes", "Sunset", "Nuggets", "Lion", "Desert", "Gapple"}),
+ LIGHT_PURPLE(ChatColor.LIGHT_PURPLE, new String[]{"Dream", "Cupcake", "Cake", "Candy", "Unicorn"}),
+ DARK_BLUE(ChatColor.DARK_BLUE, new String[]{"Squid", "Lapis", "Sharks", "Galaxy", "Empoleon"}),
+ DARK_RED(ChatColor.DARK_RED, new String[]{"Rose", "Apple", "Twizzler", "Rocket", "Blood"}),
+ WHITE(ChatColor.WHITE, new String[]{"Ghosts", "Spookies", "Popcorn", "Seagull", "Rice", "Snowman", "Artic"}),
+ BLUE(ChatColor.BLUE, new String[]{"Sky", "Whale", "Lake", "Birds", "Bluebird", "Piplup"}),
+ DARK_GREEN(ChatColor.DARK_GREEN, new String[]{"Forest", "Zombies", "Cactus", "Slime", "Toxic", "Poison"}),
+ DARK_PURPLE(ChatColor.DARK_PURPLE, new String[]{"Amethyst", "Slugs", "Grape", "Witch", "Magic", "Zula"}),
+ DARK_AQUA(ChatColor.DARK_AQUA, new String[]{"Snorlax", "Aquatic", "Clam", "Fish"});
+
+ private ChatColor color;
+ private String[] names;
+
+ private TeamColors(ChatColor color, String[] names)
+ {
+ this.color = color;
+ this.names = names;
+ }
+
+ public ChatColor getColor()
+ {
+ return color;
+ }
+
+ public String[] getNames()
+ {
+ return names;
+ }
+
+ }
+
+ private String[] getColorName(ChatColor color)
+ {
+ for(TeamColors colors : TeamColors.values())
+ {
+ if(colors.getColor() == color)
+ {
+ return colors.getNames();
+ }
+ }
+ return null;
+ }
+
+ private TeamColors getNextColor(TeamColors color)
+ {
+ for(TeamColors colors : TeamColors.values()) {
+ if(colors.ordinal() == color.ordinal() + 1)
+ {
+ return colors;
+ }
+ }
+ return TeamColors.YELLOW;
+ }
+
+ @Override
+ public void EndCheck()
+ {
+ if (!IsLive())
+ return;
+
+ ArrayList teamsAlive = new ArrayList();
+
+ for (GameTeam team : this.GetTeamList())
+ if (team.GetPlayers(true).size() > 0)
+ teamsAlive.add(team);
+
+ if (teamsAlive.size() <= 1)
+ {
+ //Announce
+ if (teamsAlive.size() > 0)
+ AnnounceEnd(teamsAlive.get(0));
+
+ for (GameTeam team : GetTeamList())
+ {
+ if (WinnerTeam != null && team.equals(WinnerTeam))
+ {
+ for (Player player : team.GetPlayers(false))
+ AddGems(player, 10, "Winning Team", false, false);
+ }
+
+ for (Player player : team.GetPlayers(false))
+ if (player.isOnline())
+ AddGems(player, 10, "Participation", false, false);
+ }
+
+ //End
+ SetState(GameState.End);
+ }
+ }
+
+ @Override
+ public List getWinners()
+ {
+ if (WinnerTeam == null)
+ return null;
+
+ return WinnerTeam.GetPlayers(false);
+ }
+
+ @Override
+ public List getLosers()
+ {
+ if (WinnerTeam == null)
+ return null;
+
+ List players = new ArrayList<>();
+
+ for (GameTeam team : GetTeamList())
+ {
+ if (team != WinnerTeam)
+ players.addAll(team.GetPlayers(false));
+ }
+
+ return players;
+ }
+
+ @Override
+ public boolean CanJoinTeam(GameTeam team)
+ {
+ return team.GetSize() < PlayersPerTeam;
+ }
+
+ @EventHandler(priority = EventPriority.HIGH)
+ public void teamSelectInteract(PlayerInteractEntityEvent event)
+ {
+ if (GetState() != GameState.Recruit)
+ return;
+
+ if (event.getRightClicked() == null)
+ return;
+
+ if (!(event.getRightClicked() instanceof Player))
+ return;
+
+ Player player = event.getPlayer();
+
+ //Observer
+ if (Manager.IsObserver(player))
+ {
+ UtilPlayer.message(player, F.main("Game", "Spectators cannot partake in games."));
+ return;
+ }
+
+ selectTeamMate(player, (Player)event.getRightClicked());
+ }
+
+ @EventHandler
+ public void teamSelectCommand(PlayerCommandPreprocessEvent event)
+ {
+ if (GetState() != GameState.Recruit)
+ return;
+
+ if (!event.getMessage().toLowerCase().startsWith("/team "))
+ return;
+
+ event.setCancelled(true);
+
+ Player target = UtilPlayer.searchOnline(event.getPlayer(), event.getMessage().split(" ")[1], true);
+ if (target == null)
+ return;
+
+ //Observer
+ if (Manager.IsObserver(event.getPlayer()))
+ {
+ UtilPlayer.message(event.getPlayer(), F.main("Game", "Spectators cannot partake in games."));
+ return;
+ }
+
+ if (event.getPlayer().equals(target))
+ return;
+
+ selectTeamMate(event.getPlayer(), target);
+ }
+
+ public void selectTeamMate(Player player, Player ally)
+ {
+ //Accept Invite
+ if (_teamReqs.containsKey(ally) && _teamReqs.get(ally).equals(player))
+ {
+ //Remove Prefs
+ _teamReqs.remove(player);
+ _teamReqs.remove(ally);
+
+ //Inform
+ UtilPlayer.message(player, F.main("Game", "You accepted " + ally.getName() + "'s Team Request!"));
+ UtilPlayer.message(ally, F.main("Game", player.getName() + " accepted your Team Request!"));
+
+ //Leave Old Teams
+ if (GetTeam(player) != null)
+ GetTeam(player).DisbandTeam();
+
+ if (GetTeam(ally) != null)
+ GetTeam(ally).DisbandTeam();
+
+ //Get Team
+ GameTeam team = getEmptyTeam();
+ if (team == null)
+ return;
+
+ //Join Team
+ SetPlayerTeam(player, team, true);
+ SetPlayerTeam(ally, team, true);
+ }
+ //Send Invite
+ else
+ {
+ //Already on Team with Target
+ if (GetTeam(player) != null)
+ if (GetTeam(player).HasPlayer(ally))
+ return;
+
+ //Inform Player
+ UtilPlayer.message(player, F.main("Game", "You sent a Team Request to " + ally.getName() + "!"));
+
+ //Inform Target
+ if (Recharge.Instance.use(player, "Team Req " + ally.getName(), 2000, false, false))
+ {
+ UtilPlayer.message(ally, F.main("Game", player.getName() + " sent you a Team Request!"));
+ UtilPlayer.message(ally, F.main("Game", "Type " + F.elem("/team " + player.getName()) + " to accept!"));
+ }
+
+ //Add Pref
+ _teamReqs.put(player, ally);
+ }
+ }
+
+ @EventHandler
+ public void teamQuit(PlayerQuitEvent event)
+ {
+ if (GetState() != GameState.Recruit)
+ return;
+
+ Player player = event.getPlayer();
+
+ if (GetTeam(player) != null)
+ GetTeam(player).DisbandTeam();
+
+ Iterator teamIter = _teamReqs.keySet().iterator();
+ while (teamIter.hasNext())
+ {
+ Player sender = teamIter.next();
+ if (sender.equals(player) || _teamReqs.get(sender).equals(player))
+ teamIter.remove();
+ }
+ }
+
+ public GameTeam getEmptyTeam()
+ {
+ for (GameTeam team : GetTeamList())
+ {
+ if (team.GetPlayers(false).isEmpty())
+ return team;
+ }
+
+ return null;
+ }
+
+ @Override
+ public String GetMode()
+ {
+ return "Team Mode";
+ }
+}
diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/SnowFight.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/SnowFight.java
index 5343d64f2..a2e27f88e 100644
--- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/SnowFight.java
+++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/SnowFight.java
@@ -1,58 +1,129 @@
package nautilus.game.arcade.game.games.snowfight;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.HashSet;
+
+import mineplex.core.common.util.C;
+import mineplex.core.common.util.F;
+import mineplex.core.common.util.UtilBlock;
+import mineplex.core.common.util.UtilInv;
+import mineplex.core.common.util.UtilMath;
+import mineplex.core.common.util.UtilParticle;
+import mineplex.core.common.util.UtilPlayer;
+import mineplex.core.common.util.UtilServer;
+import mineplex.core.common.util.UtilSound;
+import mineplex.core.common.util.UtilText;
+import mineplex.core.common.util.UtilTextMiddle;
+import mineplex.core.common.util.UtilTime;
+import mineplex.core.common.util.UtilWorld;
+import mineplex.core.common.util.UtilParticle.ParticleType;
+import mineplex.core.common.util.UtilParticle.ViewDist;
+import mineplex.core.explosion.ExplosionEvent;
+import mineplex.core.itemstack.ItemStackFactory;
+import mineplex.core.updater.UpdateType;
+import mineplex.core.updater.event.UpdateEvent;
+import mineplex.minecraft.game.core.damage.CustomDamageEvent;
+import mineplex.minecraft.game.core.explosion.CustomExplosion;
+import nautilus.game.arcade.ArcadeManager;
+import nautilus.game.arcade.GameType;
+import nautilus.game.arcade.events.GameStateChangeEvent;
+import nautilus.game.arcade.game.GameTeam;
+import nautilus.game.arcade.game.TeamGame;
+import nautilus.game.arcade.game.games.snowfight.kits.KitTactician;
+import nautilus.game.arcade.game.games.snowfight.kits.KitMedic;
+import nautilus.game.arcade.game.games.snowfight.kits.KitSportsman;
+import nautilus.game.arcade.kit.Kit;
+import nautilus.game.arcade.kit.SmashKit;
+import net.minecraft.server.v1_7_R4.EntityFireball;
+
+import org.bukkit.Bukkit;
+import org.bukkit.ChatColor;
import org.bukkit.Effect;
+import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.World;
import org.bukkit.World.Environment;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
+import org.bukkit.craftbukkit.v1_7_R4.entity.CraftFireball;
+import org.bukkit.entity.Egg;
+import org.bukkit.entity.Entity;
+import org.bukkit.entity.EntityType;
+import org.bukkit.entity.FallingBlock;
+import org.bukkit.entity.Fireball;
import org.bukkit.entity.Player;
import org.bukkit.entity.Projectile;
import org.bukkit.entity.Snowball;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
+import org.bukkit.event.block.Action;
import org.bukkit.event.block.BlockDamageEvent;
+import org.bukkit.event.block.BlockPlaceEvent;
+import org.bukkit.event.entity.EntityChangeBlockEvent;
+import org.bukkit.event.entity.EntityRegainHealthEvent;
+import org.bukkit.event.entity.ProjectileHitEvent;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
+import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.inventory.ItemStack;
+import org.bukkit.metadata.FixedMetadataValue;
+import org.bukkit.potion.Potion;
+import org.bukkit.potion.PotionEffect;
+import org.bukkit.potion.PotionEffectType;
+import org.bukkit.potion.PotionType;
+import org.bukkit.scheduler.BukkitRunnable;
+import org.bukkit.util.Vector;
-import mineplex.minecraft.game.core.damage.CustomDamageEvent;
-import mineplex.core.common.util.UtilBlock;
-import mineplex.core.common.util.UtilEvent;
-import mineplex.core.common.util.UtilGear;
-import mineplex.core.common.util.UtilInv;
-import mineplex.core.common.util.UtilWorld;
-import mineplex.core.common.util.UtilEvent.ActionType;
-import mineplex.core.itemstack.ItemStackFactory;
-import mineplex.core.updater.event.UpdateEvent;
-import mineplex.core.updater.UpdateType;
-import nautilus.game.arcade.ArcadeManager;
-import nautilus.game.arcade.GameType;
-import nautilus.game.arcade.game.TeamGame;
-import nautilus.game.arcade.kit.Kit;
-import nautilus.game.arcade.kit.NullKit;
+import com.sun.xml.internal.bind.v2.runtime.unmarshaller.XsiNilLoader.Array;
public class SnowFight extends TeamGame
{
- public SnowFight(ArcadeManager manager)
+
+ private HashMap _tiles;
+ private boolean _meteoroids;
+ private boolean _peace;
+
+ public SnowFight(ArcadeManager manager)
{
super(manager, GameType.SnowFight,
- new Kit[]
+ new Kit[]
{
- new NullKit(manager)
+ new KitSportsman(manager),
+ new KitTactician(manager),
+ new KitMedic(manager)
},
- new String[]
- {
- "Just like... kill your enemies. with snow."
- });
-
+ new String[]
+ {
+ "Just like... kill your enemies. with snow.",
+ "Be careful if you are on Ice your body will freeze"
+ });
+
this.HungerSet = 20;
+ this.CompassEnabled = true;
+ this.CompassGiveItem = false;
+ this.TeamArmor = true;
+ this.TeamArmorHotbar = true;
+ this.BlockPlace = true;
+ this.BlockBreakAllow = new HashSet<>(Arrays.asList(Material.FENCE.getId()));
+ this._tiles = new HashMap();
+ this._meteoroids = false;
+ this._peace = false;
}
-
+ @EventHandler
+ public void GameState(GameStateChangeEvent event)
+ {
+ if(event.GetState() != GameState.Live)
+ return;
+
+ this.Announce(C.cRed + C.Bold + "ALERT: " + ChatColor.RESET + C.Bold + "15 seconds Peace Phase is starting!");
+ }
+
@EventHandler
public void Weather(UpdateEvent event)
{
@@ -69,6 +140,62 @@ public class SnowFight extends TeamGame
world.setWeatherDuration(40);
world.setTime(4000);
}
+
+ @EventHandler
+ public void IceDamage(UpdateEvent event) {
+ if(event.getType() != UpdateType.FAST)
+ return;
+
+ if(!IsLive())
+ return;
+
+ for(Player player : GetPlayers(true))
+ {
+ if(IsOnIce(player))
+ {
+ Bukkit.getPluginManager().callEvent(new CustomDamageEvent(player, null, null, DamageCause.CUSTOM, 2.0D, false, true, true, "Ice", "Ice", false));
+ }
+ }
+
+ }
+
+ @EventHandler
+ public void Meteor(UpdateEvent event) {
+ if(event.getType() != UpdateType.TWOSEC)
+ return;
+
+ if(!IsLive())
+ return;
+
+ if(System.currentTimeMillis() <= getGameLiveTime() + (15 * 1000))
+ return;
+
+ if(!_peace)
+ {
+ for(Player player : GetPlayers(false))
+ {
+ player.playSound(player.getLocation(), Sound.ENDERDRAGON_GROWL, 1F, 1F);
+ UtilTextMiddle.display(C.cGold + C.Bold + "Peace Phase ended", "Kill your enemies", player);
+ }
+ this.Announce(C.cRed + C.Bold + "ALERT: " + ChatColor.RESET + C.Bold + "Peace Phase ended");
+ _peace = true;
+ }
+
+ if(System.currentTimeMillis() <= getGameLiveTime() + (195 * 1000))
+ return;
+
+ if(!_meteoroids)
+ {
+ for(Player player : GetPlayers(false))
+ {
+ player.playSound(player.getLocation(), Sound.ENDERDRAGON_GROWL, 1F, 1F);
+ UtilTextMiddle.display(C.cGold + C.Bold + "ICE METEOROIDS!!!", "Avoid the Ice Fields", player);
+ }
+ this.Announce(C.cRed + C.Bold + "ALERT: " + ChatColor.RESET + C.Bold + "METEOROIDS START FALLING!");
+ _meteoroids = true;
+ }
+ makeMeteor();
+ }
@EventHandler
public void BlockDamage(BlockDamageEvent event)
@@ -84,97 +211,119 @@ public class SnowFight extends TeamGame
if (!IsSnow(event.getBlock()))
return;
-
- if (UtilInv.contains(player, Material.SNOW_BALL, (byte)0, 16))
+ if (UtilInv.contains(player, Material.SNOW_BALL, (byte) 0, 16))
return;
- //Item
- UtilInv.insert(player, new ItemStack(Material.SNOW_BALL));
+ // Item
- //Snow Height
+ if (!_tiles.containsKey(player))
+ {
+ _tiles.put(player, 0);
+ }
+
+ if (GetKit(player) instanceof KitSportsman)
+ UtilInv.insert(player, new ItemStack(Material.SNOW_BALL));
+
+
+ int tiles = _tiles.get(player);
+ _tiles.put(player, tiles + 1);
+
+ if (!(GetKit(player) instanceof KitSportsman))
+ {
+ if (_tiles.get(player) == 2)
+ {
+ UtilInv.insert(player, new ItemStack(Material.SNOW_BALL));
+ _tiles.put(player, 0);
+ }
+ }
+
+ // Snow Height
SnowDecrease(event.getBlock(), 1);
- //Effect
- event.getBlock().getWorld().playEffect(event.getBlock().getLocation(), Effect.STEP_SOUND, 80);
+ // Effect
+ event.getBlock().getWorld().playEffect(event.getBlock().getLocation(), Effect.STEP_SOUND, 80);
}
-// @EventHandler
-// public void InteractSnowball(PlayerInteractEvent event)
-// {
-// Player player = event.getPlayer();
-//
-// if (!IsLive())
-// return;
-//
-// if (!IsPlaying(player))
-// return;
-//
-// if (!UtilGear.isMat(player.getItemInHand(), Material.SNOW_BALL))
-// return;
-//
-// event.setCancelled(true);
-//
-// if (UtilEvent.isAction(event, ActionType.L))
-// SnowballThrow(player);
-//
-// else if (UtilEvent.isAction(event, ActionType.R_BLOCK))
-// SnowballPlace(player, event.getClickedBlock(), 1);
-// }
-//
-// private void SnowballPlace(Player player, Block block, int above)
-// {
-// if (block.getTypeId() == 78 || UtilBlock.airFoliage(block))
-// {
-// //Build
-// if (block.getTypeId() == 78)
-// {
-// block.setTypeIdAndData(78, (byte)(block.getData() + 1), true);
-//
-// if (block.getData() >= 7)
-// block.setTypeIdAndData(80, (byte)0, true);
-// }
-// else
-// {
-// block.setTypeIdAndData(78, (byte)0, true);
-// }
-//
-// //Sound
-// block.getWorld().playSound(block.getLocation(), Sound.STEP_SNOW, 1f, 0.6f);
-//
-// //Use Snow
-// SnowballCount(player, -1);
-// }
-// else if ((IsSnow(block) || UtilBlock.solid(block)) && above > 0)
-// {
-// SnowballPlace(player, block.getRelative(BlockFace.UP), above - 1);
-// }
-// }
-//
-// private void SnowballThrow(Player player)
-// {
-// //Throw
-// player.launchProjectile(Snowball.class);
-//
-// //Use Snow
-// SnowballCount(player, -1);
-//
-// //Sound
-// player.getWorld().playSound(player.getLocation(), Sound.STEP_SNOW, 3f, 1.5f);
-// }
+ // @EventHandler
+ // public void InteractSnowball(PlayerInteractEvent event)
+ // {
+ // Player player = event.getPlayer();
+ //
+ // if (!IsLive())
+ // return;
+ //
+ // if (!IsPlaying(player))
+ // return;
+ //
+ // if (!UtilGear.isMat(player.getItemInHand(), Material.SNOW_BALL))
+ // return;
+ //
+ // event.setCancelled(true);
+ //
+ // if (UtilEvent.isAction(event, ActionType.L))
+ // SnowballThrow(player);
+ //
+ // else if (UtilEvent.isAction(event, ActionType.R_BLOCK))
+ // SnowballPlace(player, event.getClickedBlock(), 1);
+ // }
+ //
+ // private void SnowballPlace(Player player, Block block, int above)
+ // {
+ // if (block.getTypeId() == 78 || UtilBlock.airFoliage(block))
+ // {
+ // //Build
+ // if (block.getTypeId() == 78)
+ // {
+ // block.setTypeIdAndData(78, (byte)(block.getData() + 1), true);
+ //
+ // if (block.getData() >= 7)
+ // block.setTypeIdAndData(80, (byte)0, true);
+ // }
+ // else
+ // {
+ // block.setTypeIdAndData(78, (byte)0, true);
+ // }
+ //
+ // //Sound
+ // block.getWorld().playSound(block.getLocation(), Sound.STEP_SNOW, 1f,
+ // 0.6f);
+ //
+ // //Use Snow
+ // SnowballCount(player, -1);
+ // }
+ // else if ((IsSnow(block) || UtilBlock.solid(block)) && above > 0)
+ // {
+ // SnowballPlace(player, block.getRelative(BlockFace.UP), above - 1);
+ // }
+ // }
+ //
+ // private void SnowballThrow(Player player)
+ // {
+ // //Throw
+ // player.launchProjectile(Snowball.class);
+ //
+ // //Use Snow
+ // SnowballCount(player, -1);
+ //
+ // //Sound
+ // player.getWorld().playSound(player.getLocation(), Sound.STEP_SNOW, 3f,
+ // 1.5f);
+ // }
-// private void SnowballCount(Player player, int count)
-// {
-// if (player.getInventory().getItem(1) != null)
-// count += player.getInventory().getItem(1).getAmount();
-//
-// if (count > 16)
-// count = 16;
-//
-// if (count > 0)
-// player.getInventory().setItem(1, ItemStackFactory.Instance.CreateStack(Material.SNOW_BALL, count));
-// else
-// player.getInventory().setItem(1, null);
-// }
+ // private void SnowballCount(Player player, int count)
+ // {
+ // if (player.getInventory().getItem(1) != null)
+ // count += player.getInventory().getItem(1).getAmount();
+ //
+ // if (count > 16)
+ // count = 16;
+ //
+ // if (count > 0)
+ // player.getInventory().setItem(1,
+ // ItemStackFactory.Instance.CreateStack(Material.SNOW_BALL, count));
+ // else
+ // player.getInventory().setItem(1, null);
+ // }
private void SnowDecrease(Block block, int height)
{
@@ -184,30 +333,53 @@ public class SnowFight extends TeamGame
if (!IsSnow(block))
return;
- //Shuffle Up
+ // Shuffle Up
while (IsSnow(block.getRelative(BlockFace.UP)))
block = block.getRelative(BlockFace.UP);
- //Snow Block
- int snowLevel = 8;
- if (block.getTypeId() == 78)
+ // Snow Block
+ int snowLevel = 8;
+ if (block.getTypeId() == 78)
snowLevel = block.getData() + 1;
- //Lower
+ // Lower
if (height >= snowLevel)
{
- block.setTypeIdAndData(0, (byte)0, true);
- SnowDecrease(block.getRelative(BlockFace.DOWN), height-snowLevel);
+ block.setTypeIdAndData(0, (byte) 0, true);
+ SnowDecrease(block.getRelative(BlockFace.DOWN), height - snowLevel);
}
else
{
- block.setTypeIdAndData(78, (byte)(snowLevel-height-1), true);
+ block.setTypeIdAndData(78, (byte) (snowLevel - height - 1), true);
}
}
+
+ @EventHandler
+ public void HealthRegen(EntityRegainHealthEvent event)
+ {
+ if(event.getRegainReason() == RegainReason.SATIATED)
+ {
+ event.setAmount(1);
+ }
+ }
+
+ @EventHandler(priority = EventPriority.HIGH)
+ public void GenerallDamage(CustomDamageEvent event)
+ {
+ if(event.GetCause() == DamageCause.ENTITY_ATTACK)
+ event.SetCancelled("No Melee");
+ }
@EventHandler(priority = EventPriority.HIGH)
- public void SnowballDamage(CustomDamageEvent event)
- {
+ public void SnowballEggDamage(CustomDamageEvent event)
+ {
+
+ if(!_peace)
+ {
+ event.SetCancelled("Peace Phase");
+ return;
+ }
+
if (event.IsCancelled())
return;
@@ -215,20 +387,249 @@ public class SnowFight extends TeamGame
return;
Projectile proj = event.GetProjectile();
- if (proj == null) return;
-
- if (!(proj instanceof Snowball))
+ if (proj == null)
return;
-
- event.AddMod("Snowball", "Snowball", 3, true);
+
+ if(proj instanceof Fireball)
+ return;
+
+ if(proj instanceof Snowball)
+ event.AddMod("Snowball", "Snowball", 2, true);
+
event.SetIgnoreRate(true);
+ event.SetIgnoreArmor(true);
- //Effect
- proj.getWorld().playEffect(proj.getLocation(), Effect.STEP_SOUND, 80);
+ // Effect
+ proj.getWorld().playEffect(proj.getLocation(), Effect.STEP_SOUND, 80);
+ ((Player) proj.getShooter()).playSound(((Player) proj.getShooter()).getLocation(), Sound.SUCCESSFUL_HIT, 1, 1);
}
private boolean IsSnow(Block block)
{
return block.getTypeId() == 78 || block.getTypeId() == 80;
}
+
+ private boolean IsOnIce(Player player)
+ {
+ return player.getLocation().getBlock().getRelative(BlockFace.DOWN).getType() == Material.ICE;
+ }
+
+
+ private void makeMeteor()
+ {
+
+ Location loc = getEndgameLocation();
+
+ if (loc == null)
+ {
+ return;
+ }
+
+ summonMeteor(loc, 20F);
+
+ }
+
+ private void summonMeteor(Location loc, float fireballSize)
+ {
+ Vector vector = new Vector(UtilMath.random.nextDouble() - 0.5D, 0.8, UtilMath.random.nextDouble() - 0.5D).normalize();
+
+ vector.multiply(40);
+
+ loc.add((UtilMath.random.nextDouble() - 0.5) * 7, 0, (UtilMath.random.nextDouble() - 0.5) * 7);
+
+ loc.add(vector);
+
+ final FallingBlock fallingblock = loc.getWorld().spawnFallingBlock(loc, Material.ICE, (byte) 0);
+
+ fallingblock.setMetadata("Meteor", new FixedMetadataValue(getArcadeManager().getPlugin(), fireballSize));
+
+ new BukkitRunnable()
+ {
+ int i;
+
+ public void run()
+ {
+ if (fallingblock.isValid() && IsLive())
+ {
+ UtilParticle.PlayParticle(ParticleType.LARGE_EXPLODE, fallingblock.getLocation(), 0.3F, 0.3F, 0.3F, 0, 3,
+ ViewDist.MAX, UtilServer.getPlayers());
+
+ if (i++ % 6 == 0)
+ {
+ fallingblock.getWorld().playSound(fallingblock.getLocation(), Sound.CAT_HISS, 1.3F, 0F);
+ }
+ }
+ else
+ {
+ cancel();
+ }
+ }
+ }.runTaskTimer(getArcadeManager().getPlugin(), 0, 0);
+
+ vector.normalize().multiply(-(0.04 + ((0.5 - 0.05) / 2)));
+ fallingblock.setFireTicks(9999);
+ }
+
+ @EventHandler
+ public void MeteorHit(EntityChangeBlockEvent event)
+ {
+ Entity projectile = event.getEntity();
+
+ float size = 2.5F;
+ double damage = 2.5D;
+
+ for(int i = 1; i <= 10; i++)
+ {
+ if(System.currentTimeMillis() >= getGameLiveTime() + (((30 * i) + 180) * 1000))
+ {
+ size = 2.5F * i;
+ damage = 2.5D * i;
+ }
+ }
+
+ if (projectile.hasMetadata("Meteor"))
+ {
+
+ CustomExplosion explosion = new CustomExplosion(getArcadeManager().GetDamage(), getArcadeManager().GetExplosion(),
+ projectile.getLocation(), size, "Meteor");
+
+ explosion.setBlockExplosionSize(size);
+ explosion.setFallingBlockExplosion(false);
+ explosion.setDropItems(false);
+ explosion.setBlocksDamagedEqually(true);
+
+ UtilParticle.PlayParticle(ParticleType.LARGE_EXPLODE, projectile.getLocation(), 1.0F, 1.0F, 1.0F, 1, 3, ViewDist.MAX, UtilServer.getPlayers());
+ for(Player player : UtilServer.getPlayers()) {
+ player.playSound(projectile.getLocation(), Sound.EXPLODE, 1, 1);
+ }
+
+ boolean fall = true;
+
+ for(Entity player : projectile.getNearbyEntities(size, size, size))
+ {
+ if(player instanceof Player)
+ {
+ Player damagee = (Player) player;
+ Bukkit.getPluginManager().callEvent(new CustomDamageEvent(damagee, null, null, DamageCause.CUSTOM, damage, false, true, true, "Ice Meteoroid", "Ice Meteoroid", false));
+ }
+ }
+
+ for(Block block : UtilBlock.getInRadius(event.getEntity().getLocation(), size).keySet())
+ {
+ if(block.getType() != Material.AIR)
+ {
+ block.setType(Material.ICE);
+ if(block.getRelative(BlockFace.DOWN).getType() == Material.AIR)
+ {
+ // to reduce lag
+ if(fall)
+ {
+ block.getWorld().spawnFallingBlock(block.getLocation(), block.getType(), block.getData());
+ fall = false;
+ }
+ else
+ {
+ fall = true;
+ }
+ block.setType(Material.AIR);
+ }
+ }
+ }
+
+ }
+ }
+
+ private Location getEndgameLocation()
+ {
+ int chance = UtilMath.r(50) + 3;
+ int accuracy = Math.max((int) (chance - (0.0001 * chance)), 1);
+
+ ArrayList players = GetPlayers(true);
+
+ for (int a = 0; a < 50; a++)
+ {
+ Player player = players.get(UtilMath.r(players.size()));
+
+ Location location = player.getLocation().add(UtilMath.r(accuracy * 2) - accuracy, 0,
+ UtilMath.r(accuracy * 2) - accuracy);
+
+ location = WorldData.World.getHighestBlockAt(location).getLocation().add(0.5, 0, 0.5);
+
+ if (location.getBlock().getType() == Material.AIR)
+ {
+ location.add(0, -1, 0);
+ }
+
+ if (location.getBlockY() > 0 && location.getBlock().getType() != Material.AIR)
+ {
+ return location;
+ }
+ }
+
+ return null;
+ }
+
+ @EventHandler
+ public void Place(BlockPlaceEvent event)
+ {
+ if(event.getBlock().getRelative(BlockFace.DOWN).getType() == Material.ICE
+ || event.getBlock().getRelative(BlockFace.DOWN).getType() == Material.PACKED_ICE
+ || event.getBlock().getRelative(BlockFace.DOWN).getType() == Material.FENCE)
+ {
+ UtilPlayer.message(event.getPlayer(), F.main("Game", "You cant place a Barrier here!"));
+ event.setCancelled(true);
+ }
+ }
+
+ @Override
+ @EventHandler
+ public void ScoreboardUpdate(UpdateEvent event)
+ {
+ if (event.getType() != UpdateType.FAST)
+ return;
+
+ Scoreboard.Reset();
+
+ Scoreboard.WriteBlank();
+ if(GetPlayers(true).size() <= 8)
+ {
+ for (GameTeam team : this.GetTeamList())
+ {
+ if (!team.IsTeamAlive())
+ continue;
+
+ for(Player player : team.GetPlayers(true))
+ {
+ Scoreboard.Write(team.GetColor() + player.getName());
+ }
+
+ Scoreboard.WriteBlank();
+ }
+ }
+ else
+ {
+ for (GameTeam team : this.GetTeamList())
+ {
+ Scoreboard.Write(team.GetColor() + C.Bold + team.GetName());
+ Scoreboard.Write(team.GetColor() + "Alive " + team.GetPlayers(true).size());
+ Scoreboard.WriteBlank();
+ }
+ }
+
+ long time = 1000 * 195 - (System.currentTimeMillis() - this.GetStateTime());
+
+ if (time > 0)
+ {
+ Scoreboard.Write(C.cYellow + C.Bold + "Meteoroids:");
+ if(IsLive())
+ Scoreboard.Write(UtilTime.MakeStr(time, 0));
+ }
+ else
+ {
+ Scoreboard.Write(C.cGold + C.Bold + "Meteoroids!");
+ }
+
+ Scoreboard.Draw();
+ }
+
}
diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/kits/KitMedic.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/kits/KitMedic.java
new file mode 100644
index 000000000..efebaf42e
--- /dev/null
+++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/kits/KitMedic.java
@@ -0,0 +1,140 @@
+package nautilus.game.arcade.game.games.snowfight.kits;
+
+import mineplex.core.common.util.UtilInv;
+import mineplex.core.common.util.UtilMath;
+import mineplex.core.itemstack.ItemStackFactory;
+import mineplex.core.updater.UpdateType;
+import mineplex.core.updater.event.UpdateEvent;
+import nautilus.game.arcade.ArcadeManager;
+import nautilus.game.arcade.kit.Kit;
+import nautilus.game.arcade.kit.KitAvailability;
+import nautilus.game.arcade.kit.Perk;
+
+import org.bukkit.Color;
+import org.bukkit.Material;
+import org.bukkit.entity.Egg;
+import org.bukkit.entity.Entity;
+import org.bukkit.entity.EntityType;
+import org.bukkit.entity.LivingEntity;
+import org.bukkit.entity.Player;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.entity.EntityDamageByEntityEvent;
+import org.bukkit.event.entity.PotionSplashEvent;
+import org.bukkit.inventory.ItemStack;
+import org.bukkit.inventory.meta.LeatherArmorMeta;
+import org.bukkit.potion.Potion;
+import org.bukkit.potion.PotionEffect;
+import org.bukkit.potion.PotionEffectType;
+import org.bukkit.potion.PotionType;
+
+public class KitMedic extends Kit
+{
+
+ public KitMedic(ArcadeManager manager)
+ {
+ super(manager, "Medic", KitAvailability.Free,
+
+ new String[]
+ {
+ "To the rescue...!",
+ " ",
+ "Gets 1 Snowball every second tile.",
+ "Left-Click Snow to pick up Snowballs (Max. 16)",
+ "Right-Click Snowballs to throw them.",
+ " ",
+ "Gets 1 Healing Potion every 32 seconds [max. 1]",
+ "Slowness II when hit.",
+ " ",
+ "Supports all nearby allies with REGENERATION."
+ },
+
+ new Perk[]
+ {
+ },
+ EntityType.SKELETON,
+ new ItemStack(Material.POTION));
+
+
+ }
+
+ @Override
+ public void GiveItems(Player player)
+ {
+ player.getInventory().setItem(2, ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP));
+ player.getInventory().setItem(3, ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP));
+ }
+
+ @Override
+ public void SpawnCustom(LivingEntity ent)
+ {
+ ent.getEquipment().setHelmet(new ItemStack(Material.LEATHER_HELMET));
+ ent.getEquipment().setChestplate(new ItemStack(Material.LEATHER_CHESTPLATE));
+ ent.getEquipment().setLeggings(new ItemStack(Material.LEATHER_LEGGINGS));
+ ent.getEquipment().setBoots(new ItemStack(Material.LEATHER_BOOTS));
+ }
+
+ @EventHandler
+ public void Aura(UpdateEvent event)
+ {
+ if (event.getType() != UpdateType.FAST)
+ return;
+
+ for (Player player : Manager.GetGame().GetPlayers(true))
+ {
+ if (!HasKit(player))
+ continue;
+
+ for (Player other : Manager.GetGame().GetPlayers(true))
+ {
+ if (other.equals(player))
+ continue;
+
+ if (UtilMath.offset(player, other) > 4)
+ continue;
+
+ if( Manager.GetGame().GetTeam(player).equals(Manager.GetGame().GetTeam(other)))
+ Manager.GetCondition().Factory().Regen("Aura", other, player, 1.9, 0, false, false, false);
+ }
+ }
+ }
+
+ @EventHandler
+ public void KitItems(UpdateEvent event)
+ {
+ if(!Manager.GetGame().IsLive())
+ return;
+
+ if (event.getType() == UpdateType.SLOWEST)
+ {
+ for (Player player : Manager.GetGame().GetPlayers(true))
+ {
+ if (!HasKit(player))
+ continue;
+
+ Potion potion = new Potion(PotionType.INSTANT_HEAL);
+ potion.setSplash(true);
+ player.getInventory().setItem(1, potion.toItemStack(1));
+ }
+ }
+ }
+
+ @EventHandler
+ public void Splash(PotionSplashEvent event)
+ {
+ if(event.getEntity().getShooter() instanceof Player)
+ {
+ if(!HasKit((Player) event.getEntity().getShooter()))
+ return;
+
+ for(Entity entity : event.getAffectedEntities())
+ {
+ if(entity instanceof Player)
+ {
+ Manager.GetCondition().Factory().Slow("Heal Potion", (Player)entity, (Player)event.getEntity().getShooter(), 5.0, 1, false, false, false, false);
+ }
+ }
+
+ }
+ }
+
+}
diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/kits/KitSportsman.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/kits/KitSportsman.java
new file mode 100644
index 000000000..43bd655e3
--- /dev/null
+++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/kits/KitSportsman.java
@@ -0,0 +1,92 @@
+package nautilus.game.arcade.game.games.snowfight.kits;
+
+import org.bukkit.Color;
+import org.bukkit.Material;
+import org.bukkit.entity.EntityType;
+import org.bukkit.entity.LivingEntity;
+import org.bukkit.entity.Player;
+import org.bukkit.event.EventHandler;
+import org.bukkit.inventory.ItemStack;
+import org.bukkit.inventory.meta.LeatherArmorMeta;
+import org.bukkit.potion.PotionEffect;
+import org.bukkit.potion.PotionEffectType;
+
+import mineplex.core.common.util.UtilMath;
+import mineplex.core.itemstack.ItemStackFactory;
+import mineplex.core.updater.UpdateType;
+import mineplex.core.updater.event.UpdateEvent;
+import nautilus.game.arcade.ArcadeManager;
+import nautilus.game.arcade.kit.Kit;
+import nautilus.game.arcade.kit.KitAvailability;
+import nautilus.game.arcade.kit.Perk;
+import nautilus.game.arcade.kit.perks.PerkFallDamage;
+
+public class KitSportsman extends Kit
+{
+
+ public KitSportsman(ArcadeManager manager)
+ {
+ super(manager, "Sportsman", KitAvailability.Free,
+
+ new String[]
+ {
+ "Trained to be the fastest on snow and ice.",
+ "",
+ "Gets 1 Snowball every tile",
+ "Left-Click Snow to pick up Snowballs (Max. 16)",
+ "Right-Click Snowballs to throw them.",
+ "",
+ "Supports all nearby allies with SPEED."
+ },
+
+ new Perk[]
+ {
+ new PerkFallDamage(3)
+ },
+ EntityType.SKELETON,
+ new ItemStack(Material.SNOW_BALL));
+
+ }
+
+ @Override
+ public void GiveItems(Player player)
+ {
+ player.getInventory().setItem(2, ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP));
+ player.getInventory().setItem(3, ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP));
+ }
+
+ @Override
+ public void SpawnCustom(LivingEntity ent)
+ {
+ ent.getEquipment().setHelmet(new ItemStack(Material.LEATHER_HELMET));
+ ent.getEquipment().setChestplate(new ItemStack(Material.LEATHER_CHESTPLATE));
+ ent.getEquipment().setLeggings(new ItemStack(Material.LEATHER_LEGGINGS));
+ ent.getEquipment().setBoots(new ItemStack(Material.LEATHER_BOOTS));
+ }
+
+ @EventHandler
+ public void Aura(UpdateEvent event)
+ {
+ if (event.getType() != UpdateType.FAST)
+ return;
+
+ for (Player player : Manager.GetGame().GetPlayers(true))
+ {
+ if (!HasKit(player))
+ continue;
+
+ for (Player other : Manager.GetGame().GetPlayers(true))
+ {
+ if (other.equals(player))
+ continue;
+
+ if (UtilMath.offset(player, other) > 4)
+ continue;
+
+ if( Manager.GetGame().GetTeam(player).equals(Manager.GetGame().GetTeam(other)))
+ Manager.GetCondition().Factory().Speed("Aura", other, player, 1.9, 0, false, false, false);
+ }
+ }
+ }
+
+}
diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/kits/KitTactician.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/kits/KitTactician.java
new file mode 100644
index 000000000..a0aec26c1
--- /dev/null
+++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/kits/KitTactician.java
@@ -0,0 +1,118 @@
+package nautilus.game.arcade.game.games.snowfight.kits;
+
+import mineplex.core.common.util.UtilInv;
+import mineplex.core.common.util.UtilMath;
+import mineplex.core.common.util.UtilPlayer;
+import mineplex.core.itemstack.ItemStackFactory;
+import mineplex.core.updater.UpdateType;
+import mineplex.core.updater.event.UpdateEvent;
+import mineplex.minecraft.game.core.condition.Condition.ConditionType;
+import nautilus.game.arcade.ArcadeManager;
+import nautilus.game.arcade.kit.Kit;
+import nautilus.game.arcade.kit.KitAvailability;
+import nautilus.game.arcade.kit.Perk;
+import nautilus.game.arcade.kit.perks.PerkFallDamage;
+
+import org.bukkit.Color;
+import org.bukkit.Material;
+import org.bukkit.entity.EntityType;
+import org.bukkit.entity.LivingEntity;
+import org.bukkit.entity.Player;
+import org.bukkit.event.EventHandler;
+import org.bukkit.inventory.ItemStack;
+import org.bukkit.inventory.meta.LeatherArmorMeta;
+import org.bukkit.potion.PotionType;
+
+public class KitTactician extends Kit
+{
+
+ public KitTactician(ArcadeManager manager)
+ {
+ super(manager, "Tactician", KitAvailability.Free,
+ new String[]
+ {
+ "No Snowfight is complete without a tactical game!",
+ " ",
+ "Gets 1 Snowball every second tile.",
+ "Left-Click Snow to pick up Snowballs (Max. 16)",
+ "Right-Click Snowballs to throw them.",
+ " ",
+ "Gets 1 Barrier every 32 seconds [max. 2]",
+ "Place Barriers to improve your defense.",
+ "You cant place Barriers above Ice, Packed Ice or Fences.",
+ " ",
+ "Supports all nearby allies with RESISTANCE."
+ }, new Perk[]
+ {
+ },
+ EntityType.SKELETON,
+ new ItemStack(Material.FENCE));
+
+ }
+
+ @Override
+ public void GiveItems(Player player)
+ {
+ player.getInventory().setItem(2, ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP));
+ player.getInventory().setItem(3, ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP));
+ player.getInventory().setItem(7, ItemStackFactory.Instance.CreateStack(Material.COMPASS.getId(), (byte) 0, 1, "§a§lTracking Compass"));
+ }
+
+ @Override
+ public void SpawnCustom(LivingEntity ent)
+ {
+ ent.getEquipment().setHelmet(new ItemStack(Material.LEATHER_HELMET));
+ ent.getEquipment().setChestplate(new ItemStack(Material.LEATHER_CHESTPLATE));
+ ent.getEquipment().setLeggings(new ItemStack(Material.LEATHER_LEGGINGS));
+ ent.getEquipment().setBoots(new ItemStack(Material.LEATHER_BOOTS));
+ }
+
+ @EventHandler
+ public void Aura(UpdateEvent event)
+ {
+ if (event.getType() != UpdateType.FAST)
+ return;
+
+ for (Player player : Manager.GetGame().GetPlayers(true))
+ {
+ if (!HasKit(player))
+ continue;
+
+ for (Player other : Manager.GetGame().GetPlayers(true))
+ {
+ if (other.equals(player))
+ continue;
+
+ if (UtilMath.offset(player, other) > 4)
+ continue;
+
+ if( Manager.GetGame().GetTeam(player).equals(Manager.GetGame().GetTeam(other)))
+ Manager.GetCondition().Factory().Protection("Aura", other, player, 1.9, 0, false, false, false);
+ }
+ }
+ }
+
+ @EventHandler
+ public void KitItems(UpdateEvent event)
+ {
+ if(!Manager.GetGame().IsLive())
+ return;
+
+ if (event.getType() == UpdateType.SLOWEST)
+ {
+ for (Player player : Manager.GetGame().GetPlayers(true))
+ {
+ if (!HasKit(player))
+ continue;
+
+ int amount = 0;
+ if (player.getInventory().getItem(1) != null && UtilInv.contains(player, Material.FENCE, (byte) 0, 1))
+ amount = 2;
+ else
+ amount = 1;
+ player.getInventory().setItem(1, ItemStackFactory.Instance.CreateStack(Material.FENCE, (byte) 0, amount, "Barrier"));
+ }
+ }
+ }
+
+}
diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/squidshooter/SquidShooter.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/squidshooter/SquidShooter.java
index c7334f60e..8842a3799 100644
--- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/squidshooter/SquidShooter.java
+++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/squidshooter/SquidShooter.java
@@ -48,7 +48,6 @@ public class SquidShooter extends SoloGame
this.DamageSelf = false;
this.DamageTeamSelf = true;
this.PrepareFreeze = false;
- this.SpawnDistanceRequirement = 16;
this.CompassEnabled = true;
this.KitRegisterState = GameState.Prepare;
}
diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/SoloSurvivalGames.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/SoloSurvivalGames.java
new file mode 100644
index 000000000..8085bf2ed
--- /dev/null
+++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/SoloSurvivalGames.java
@@ -0,0 +1,181 @@
+package nautilus.game.arcade.game.games.survivalgames;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import mineplex.core.common.util.C;
+import mineplex.core.common.util.UtilTime;
+import mineplex.core.common.util.UtilTime.TimeUnit;
+import mineplex.core.updater.UpdateType;
+import mineplex.core.updater.event.UpdateEvent;
+import nautilus.game.arcade.ArcadeManager;
+import nautilus.game.arcade.GameType;
+import nautilus.game.arcade.events.GameStateChangeEvent;
+import nautilus.game.arcade.game.GameTeam;
+import nautilus.game.arcade.game.Game.GameState;
+
+import org.bukkit.ChatColor;
+import org.bukkit.entity.Player;
+import org.bukkit.event.EventHandler;
+
+public class SoloSurvivalGames extends SurvivalGames
+{
+
+ private GameTeam _players;
+
+ public SoloSurvivalGames(ArcadeManager manager)
+ {
+ super(manager, GameType.SurvivalGames,
+ new String[]
+ {
+ "Search for chests to find loot",
+
+ "Slaughter your opponents",
+
+ "Stay away from the borders!",
+
+ "Last tribute alive wins!"
+ });
+
+ this.DamageTeamSelf = true;
+
+ }
+
+ @EventHandler
+ public void CustomTeamGeneration(GameStateChangeEvent event)
+ {
+ if (event.GetState() != GameState.Recruit)
+ return;
+
+ _players = GetTeamList().get(0);
+ _players.SetColor(ChatColor.YELLOW);
+ _players.SetName("Players");
+ _players.setDisplayName(C.cYellow + C.Bold + "Players");
+ }
+
+ @Override
+ @EventHandler
+ public void ScoreboardUpdate(UpdateEvent event)
+ {
+ if (event.getType() != UpdateType.FAST)
+ return;
+
+ if (GetTeamList().isEmpty())
+ return;
+
+ Scoreboard.Reset();
+
+ Scoreboard.WriteBlank();
+
+ GameTeam team = GetTeamList().get(0);
+
+ Scoreboard.Write(C.cGreen + C.Bold + "Time");
+ Scoreboard.Write(UtilTime.convertString(this.getSecondsSinceStart() * 1000, 0, TimeUnit.FIT));
+
+ Scoreboard.WriteBlank();
+
+ Scoreboard.Write(C.cYellow + C.Bold + "Tributes");
+ if (team.GetPlayers(true).size() > 7)
+ {
+ Scoreboard.Write("" + team.GetPlayers(true).size());
+ }
+ else
+ {
+ for (Player player : team.GetPlayers(true))
+ {
+ Scoreboard.Write(C.cWhite + player.getName());
+ }
+ }
+
+ Scoreboard.WriteBlank();
+
+ if (this.getChestRefillTime() > 0 && this.getDeathMatchTime() > 60)
+ {
+ Scoreboard.Write(C.cGold + C.Bold + "Chest Refill");
+ Scoreboard.Write(UtilTime.convertString(this.getChestRefillTime() * 1000, 0, TimeUnit.FIT));
+ }
+ else if (this.getDeathMatchTime() > 0)
+ {
+ Scoreboard.Write(C.cRed + C.Bold + "Deathmatch");
+ Scoreboard.Write(UtilTime.convertString(
+ Math.min(this.getDeathMatchTime(), this.isDeathMatchTeleported() ? 10 : this.getDeathMatchTime()) * 1000, 0, TimeUnit.FIT));
+ }
+ else
+ {
+ Scoreboard.Write(C.cRed + C.Bold + "Game End");
+ Scoreboard.Write(UtilTime.convertString(Math.max(0, this.getGameEndTime()) * 1000, 0, TimeUnit.FIT));
+ }
+
+ Scoreboard.Draw();
+ }
+
+ @Override
+ public void EndCheck()
+ {
+ if (!IsLive())
+ return;
+
+ if (GetPlayers(true).size() <= 1)
+ {
+ ArrayList places = GetTeamList().get(0).GetPlacements(true);
+
+ //Announce
+ AnnounceEnd(places);
+
+ //Gems
+ if (places.size() >= 1)
+ AddGems(places.get(0), 20, "1st Place", false, false);
+
+ if (places.size() >= 2)
+ AddGems(places.get(1), 15, "2nd Place", false, false);
+
+ if (places.size() >= 3)
+ AddGems(places.get(2), 10, "3rd Place", false, false);
+
+ for (Player player : GetPlayers(false))
+ if (player.isOnline())
+ AddGems(player, 10, "Participation", false, false);
+
+ //End
+ SetState(GameState.End);
+ }
+ }
+
+ @Override
+ public List getWinners()
+ {
+ if (GetState().ordinal() >= GameState.End.ordinal())
+ {
+ List places = GetTeamList().get(0).GetPlacements(true);
+
+ if (places.isEmpty() || !places.get(0).isOnline())
+ return Arrays.asList();
+ else
+ return Arrays.asList(places.get(0));
+ }
+ else
+ return null;
+ }
+
+ @Override
+ public List getLosers()
+ {
+ List winners = getWinners();
+
+ if (winners == null)
+ return null;
+
+ List losers = GetTeamList().get(0).GetPlayers(false);
+
+ losers.removeAll(winners);
+
+ return losers;
+ }
+
+ @Override
+ public String GetMode()
+ {
+ return "Solo Mode";
+ }
+}
diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/SurvivalGames.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/SurvivalGames.java
index 71d2e3f5c..0e984eb4c 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
@@ -114,7 +114,7 @@ import net.minecraft.server.v1_7_R4.TileEntityChest;
import net.minecraft.server.v1_7_R4.WorldServer;
import net.minecraft.util.com.mojang.authlib.GameProfile;
-public class SurvivalGames extends SoloGame
+public abstract class SurvivalGames extends Game
{
// Chest loot
private ChestLoot _baseLoot = new ChestLoot(true);
@@ -168,9 +168,9 @@ public class SurvivalGames extends SoloGame
*/
private Field _ticksField;
- public SurvivalGames(ArcadeManager manager)
+ public SurvivalGames(ArcadeManager manager, GameType type, String[] description)
{
- super(manager, GameType.SurvivalGames,
+ super(manager, type,
new Kit[]
{
@@ -195,18 +195,7 @@ public class SurvivalGames extends SoloGame
new KitBarbarian(manager),
new KitHorseman(manager),
- },
-
- new String[]
- {
- "Search for chests to find loot",
-
- "Slaughter your opponents",
-
- "Stay away from the borders!",
-
- "Last tribute alive wins!"
- });
+ }, description);
_help = new String[]
{
@@ -220,6 +209,10 @@ public class SurvivalGames extends SoloGame
// Manager.GetAntiStack().SetEnabled(false);
StrictAntiHack = true;
+
+ HideTeamSheep = true;
+
+ this.ReplaceTeamsWithKits = true;
GameTimeout = 1500000;
@@ -227,9 +220,7 @@ public class SurvivalGames extends SoloGame
WorldTimeSet = 0;
WorldBoundaryKill = false;
-
- SpawnDistanceRequirement = 48;
-
+
DamageSelf = true;
DamageTeamSelf = true;
@@ -757,7 +748,8 @@ public class SurvivalGames extends SoloGame
WorldTimeSet = 0;
WorldData.World.setTime(15000);
- GetTeamList().get(0).SpawnTeleport(false);
+ for (GameTeam team : GetTeamList())
+ team.SpawnTeleport(false);
_borderPositions.clear();
@@ -1683,62 +1675,6 @@ public class SurvivalGames extends SoloGame
}
- @Override
- @EventHandler
- public void ScoreboardUpdate(UpdateEvent event)
- {
- if (event.getType() != UpdateType.FAST)
- return;
-
- if (GetTeamList().isEmpty())
- return;
-
- Scoreboard.Reset();
-
- Scoreboard.WriteBlank();
-
- GameTeam team = GetTeamList().get(0);
-
- Scoreboard.Write(C.cGreen + C.Bold + "Time");
- Scoreboard.Write(UtilTime.convertString(_secondsSinceStart * 1000, 0, TimeUnit.FIT));
-
- Scoreboard.WriteBlank();
-
- Scoreboard.Write(C.cYellow + C.Bold + "Tributes");
- if (team.GetPlayers(true).size() > 7)
- {
- Scoreboard.Write("" + team.GetPlayers(true).size());
- }
- else
- {
- for (Player player : team.GetPlayers(true))
- {
- Scoreboard.Write(C.cWhite + player.getName());
- }
- }
-
- Scoreboard.WriteBlank();
-
- if (_chestRefillTime > 0 && _deathMatchTime > 60)
- {
- Scoreboard.Write(C.cGold + C.Bold + "Chest Refill");
- Scoreboard.Write(UtilTime.convertString(_chestRefillTime * 1000, 0, TimeUnit.FIT));
- }
- else if (_deathMatchTime > 0)
- {
- Scoreboard.Write(C.cRed + C.Bold + "Deathmatch");
- Scoreboard.Write(UtilTime.convertString(
- Math.min(_deathMatchTime, _deathMatchTeleported ? 10 : _deathMatchTime) * 1000, 0, TimeUnit.FIT));
- }
- else
- {
- Scoreboard.Write(C.cRed + C.Bold + "Game End");
- Scoreboard.Write(UtilTime.convertString(Math.max(0, _gameEndTime) * 1000, 0, TimeUnit.FIT));
- }
-
- Scoreboard.Draw();
- }
-
private void setBorder()
{
_borderStartedMoving = System.currentTimeMillis();
@@ -2295,4 +2231,30 @@ public class SurvivalGames extends SoloGame
}
}
}
+
+ public int getSecondsSinceStart()
+ {
+ return this._secondsSinceStart;
+ }
+
+ public int getChestRefillTime()
+ {
+ return this._chestRefillTime;
+ }
+
+ public int getDeathMatchTime()
+ {
+ return this._deathMatchTime;
+ }
+
+ public boolean isDeathMatchTeleported()
+ {
+ return this._deathMatchTeleported;
+ }
+
+ public int getGameEndTime()
+ {
+ return this._gameEndTime;
+ }
+
}
diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/SurvivalGamesTeams.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/SurvivalGamesTeams.java
index 3d2e51099..f6385469e 100644
--- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/SurvivalGamesTeams.java
+++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/SurvivalGamesTeams.java
@@ -7,38 +7,6 @@ import java.util.HashSet;
import java.util.Iterator;
import java.util.Map.Entry;
-import org.bukkit.*;
-import org.bukkit.FireworkEffect.Type;
-import org.bukkit.block.Block;
-import org.bukkit.block.BlockFace;
-import org.bukkit.block.Chest;
-import org.bukkit.entity.Entity;
-import org.bukkit.entity.ItemFrame;
-import org.bukkit.entity.Player;
-import org.bukkit.entity.Snowball;
-import org.bukkit.entity.TNTPrimed;
-import org.bukkit.event.EventHandler;
-import org.bukkit.event.EventPriority;
-import org.bukkit.event.block.Action;
-import org.bukkit.event.block.BlockBreakEvent;
-import org.bukkit.event.block.BlockBurnEvent;
-import org.bukkit.event.block.BlockFadeEvent;
-import org.bukkit.event.block.BlockPlaceEvent;
-import org.bukkit.event.block.BlockSpreadEvent;
-import org.bukkit.event.block.LeavesDecayEvent;
-import org.bukkit.event.entity.EntityExplodeEvent;
-import org.bukkit.event.entity.ExplosionPrimeEvent;
-import org.bukkit.event.entity.ItemSpawnEvent;
-import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
-import org.bukkit.event.hanging.HangingBreakEvent;
-import org.bukkit.event.player.PlayerCommandPreprocessEvent;
-import org.bukkit.event.player.PlayerInteractEvent;
-import org.bukkit.event.player.PlayerMoveEvent;
-import org.bukkit.event.player.PlayerQuitEvent;
-import org.bukkit.inventory.ItemStack;
-import org.bukkit.inventory.meta.ItemMeta;
-import org.bukkit.util.Vector;
-
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.MapUtil;
@@ -52,9 +20,9 @@ import mineplex.core.common.util.UtilFirework;
import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilParticle;
-import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist;
+import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilTime;
import mineplex.core.common.util.UtilTime.TimeUnit;
@@ -72,9 +40,56 @@ import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.game.Game;
import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.game.TeamGame;
-import nautilus.game.arcade.game.games.survivalgames.kit.*;
+import nautilus.game.arcade.game.games.survivalgames.kit.KitArcher;
+import nautilus.game.arcade.game.games.survivalgames.kit.KitAssassin;
+import nautilus.game.arcade.game.games.survivalgames.kit.KitAxeman;
+import nautilus.game.arcade.game.games.survivalgames.kit.KitBeastmaster;
+import nautilus.game.arcade.game.games.survivalgames.kit.KitBomber;
+import nautilus.game.arcade.game.games.survivalgames.kit.KitBrawler;
+import nautilus.game.arcade.game.games.survivalgames.kit.KitHorseman;
+import nautilus.game.arcade.game.games.survivalgames.kit.KitKnight;
+import nautilus.game.arcade.game.games.survivalgames.kit.KitLooter;
import nautilus.game.arcade.kit.Kit;
+import org.bukkit.Bukkit;
+import org.bukkit.ChatColor;
+import org.bukkit.Color;
+import org.bukkit.Effect;
+import org.bukkit.FireworkEffect;
+import org.bukkit.FireworkEffect.Type;
+import org.bukkit.Location;
+import org.bukkit.Material;
+import org.bukkit.Sound;
+import org.bukkit.block.Block;
+import org.bukkit.block.BlockFace;
+import org.bukkit.block.Chest;
+import org.bukkit.entity.Entity;
+import org.bukkit.entity.ItemFrame;
+import org.bukkit.entity.Player;
+import org.bukkit.entity.Snowball;
+import org.bukkit.entity.TNTPrimed;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.EventPriority;
+import org.bukkit.event.block.Action;
+import org.bukkit.event.block.BlockBreakEvent;
+import org.bukkit.event.block.BlockBurnEvent;
+import org.bukkit.event.block.BlockFadeEvent;
+import org.bukkit.event.block.BlockPlaceEvent;
+import org.bukkit.event.block.BlockSpreadEvent;
+import org.bukkit.event.block.LeavesDecayEvent;
+import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
+import org.bukkit.event.entity.EntityExplodeEvent;
+import org.bukkit.event.entity.ExplosionPrimeEvent;
+import org.bukkit.event.entity.ItemSpawnEvent;
+import org.bukkit.event.hanging.HangingBreakEvent;
+import org.bukkit.event.player.PlayerCommandPreprocessEvent;
+import org.bukkit.event.player.PlayerInteractEvent;
+import org.bukkit.event.player.PlayerMoveEvent;
+import org.bukkit.event.player.PlayerQuitEvent;
+import org.bukkit.inventory.ItemStack;
+import org.bukkit.inventory.meta.ItemMeta;
+import org.bukkit.util.Vector;
+
public class SurvivalGamesTeams extends TeamGame
{
private HashSet _openedChest = new HashSet();
@@ -114,7 +129,7 @@ public class SurvivalGamesTeams extends TeamGame
public SurvivalGamesTeams(ArcadeManager manager)
{
- super(manager, GameType.SurvivalGamesTeams,
+ super(manager, GameType.SurvivalGames,
new Kit[]
{
@@ -161,8 +176,9 @@ public class SurvivalGamesTeams extends TeamGame
this.WorldTimeSet = 0;
this.WorldBoundaryKill = false;
- this.SpawnDistanceRequirement = 48;
-
+ SpawnNearAllies = true;
+ SpawnNearEnemies = true; //This is to ensure theres no 'gaps' of 1 between teams, hence forcing a team to get split.
+
this.DamageSelf = true;
this.DamageTeamSelf = false;
diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/TeamSurvivalGames.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/TeamSurvivalGames.java
new file mode 100644
index 000000000..92931afd8
--- /dev/null
+++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/TeamSurvivalGames.java
@@ -0,0 +1,446 @@
+package nautilus.game.arcade.game.games.survivalgames;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import mineplex.core.common.util.C;
+import mineplex.core.common.util.F;
+import mineplex.core.common.util.NautHashMap;
+import mineplex.core.common.util.UtilPlayer;
+import mineplex.core.common.util.UtilTime;
+import mineplex.core.common.util.UtilTime.TimeUnit;
+import mineplex.core.recharge.Recharge;
+import mineplex.core.updater.UpdateType;
+import mineplex.core.updater.event.UpdateEvent;
+import nautilus.game.arcade.ArcadeManager;
+import nautilus.game.arcade.GameType;
+import nautilus.game.arcade.events.GameStateChangeEvent;
+import nautilus.game.arcade.game.GameTeam;
+
+import org.bukkit.ChatColor;
+import org.bukkit.Location;
+import org.bukkit.entity.Player;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.EventPriority;
+import org.bukkit.event.player.PlayerCommandPreprocessEvent;
+import org.bukkit.event.player.PlayerInteractEntityEvent;
+import org.bukkit.event.player.PlayerQuitEvent;
+
+public class TeamSurvivalGames extends SurvivalGames
+{
+
+ public boolean ForceTeamSize = true;
+ public int PlayersPerTeam = 2;
+ public int TeamCount = 0;
+
+ private NautHashMap _teamReqs = new NautHashMap();
+
+ public TeamSurvivalGames(ArcadeManager manager)
+ {
+ super(manager, GameType.SurvivalGamesTeams,
+ new String[]
+ {
+ "Search for chests to find loot",
+ "Slaughter your opponents",
+ "Stay away from the Deep Freeze!",
+ "Last team alive wins!"
+ });
+
+ this.PlayersPerTeam = 2;
+ this.FillTeamsInOrderToCount = 2;
+
+ this.SpawnNearAllies = true;
+ this.SpawnNearEnemies = true;
+
+ this.DamageTeamSelf = false;
+
+ }
+
+ @EventHandler
+ public void CustomTeamGeneration(GameStateChangeEvent event)
+ {
+ if (event.GetState() != GameState.Recruit)
+ return;
+
+ ArrayList spawns = this.GetTeamList().get(0).GetSpawns();
+ this.GetTeamList().clear();
+
+ TeamColors color = TeamColors.DARK_AQUA;
+
+ if(!this.ForceTeamSize)
+ {
+ for(int i = 1; i <= this.TeamCount; i++)
+ {
+ color = getNextColor(color);
+ GameTeam team = new GameTeam(this, String.valueOf(i), color.getColor(), spawns);
+ team.SetVisible(true);
+ GetTeamList().add(team);
+ }
+ }
+ else
+ {
+ for(int i = 1; i <= Manager.GetPlayerFull() / this.PlayersPerTeam; i++)
+ {
+ //Got Spawns
+ color = getNextColor(color);
+ int e = 0;
+ for(GameTeam teams : GetTeamList())
+ {
+ if(teams.GetColor() == color.getColor())
+ {
+ e++;
+ if(getColorName(color.getColor()).length <= e)
+ {
+ e = 0;
+ }
+ }
+ }
+ GameTeam team = new GameTeam(this, getColorName(color.getColor())[e], color.getColor(), spawns, true);
+ team.SetVisible(true);
+ GetTeamList().add(team);
+ }
+ }
+ }
+
+ private enum TeamColors
+ {
+
+ YELLOW(ChatColor.YELLOW, new String[]{"Banana", "Sunshine", "Custard", "Sponge", "Star", "Giraffe", "Lego", "Light"}),
+ GREEN(ChatColor.GREEN, new String[]{"Creepers", "Alien", "Seaweed", "Emerald", "Grinch", "Shrub", "Snake", "Leaf"}),
+ AQUA(ChatColor.AQUA, new String[]{"Diamond", "Ice", "Pool", "Kraken", "Aquatic", "Ocean"}),
+ RED(ChatColor.RED, new String[]{"Heart", "Tomato", "Ruby", "Jam", "Rose", "Apple", "TNT"}),
+ GOLD(ChatColor.GOLD, new String[]{"Mango", "Foxes", "Sunset", "Nuggets", "Lion", "Desert", "Gapple"}),
+ LIGHT_PURPLE(ChatColor.LIGHT_PURPLE, new String[]{"Dream", "Cupcake", "Cake", "Candy", "Unicorn"}),
+ DARK_BLUE(ChatColor.DARK_BLUE, new String[]{"Squid", "Lapis", "Sharks", "Galaxy", "Empoleon"}),
+ DARK_RED(ChatColor.DARK_RED, new String[]{"Rose", "Apple", "Twizzler", "Rocket", "Blood"}),
+ WHITE(ChatColor.WHITE, new String[]{"Ghosts", "Spookies", "Popcorn", "Seagull", "Rice", "Snowman", "Artic"}),
+ BLUE(ChatColor.BLUE, new String[]{"Sky", "Whale", "Lake", "Birds", "Bluebird", "Piplup"}),
+ DARK_GREEN(ChatColor.DARK_GREEN, new String[]{"Forest", "Zombies", "Cactus", "Slime", "Toxic", "Poison"}),
+ DARK_PURPLE(ChatColor.DARK_PURPLE, new String[]{"Amethyst", "Slugs", "Grape", "Witch", "Magic", "Zula"}),
+ DARK_AQUA(ChatColor.DARK_AQUA, new String[]{"Snorlax", "Aquatic", "Clam", "Fish"});
+
+ private ChatColor color;
+ private String[] names;
+
+ private TeamColors(ChatColor color, String[] names)
+ {
+ this.color = color;
+ this.names = names;
+ }
+
+ public ChatColor getColor()
+ {
+ return color;
+ }
+
+ public String[] getNames()
+ {
+ return names;
+ }
+
+ }
+
+ private String[] getColorName(ChatColor color)
+ {
+ for(TeamColors colors : TeamColors.values())
+ {
+ if(colors.getColor() == color)
+ {
+ return colors.getNames();
+ }
+ }
+ return null;
+ }
+
+ private TeamColors getNextColor(TeamColors color)
+ {
+ for(TeamColors colors : TeamColors.values()) {
+ if(colors.ordinal() == color.ordinal() + 1)
+ {
+ return colors;
+ }
+ }
+ return TeamColors.YELLOW;
+ }
+
+ @Override
+ @EventHandler
+ public void ScoreboardUpdate(UpdateEvent event)
+ {
+ if (event.getType() != UpdateType.FAST)
+ return;
+
+ if (GetTeamList().isEmpty())
+ return;
+
+ Scoreboard.Reset();
+
+ Scoreboard.WriteBlank();
+
+ Scoreboard.Write(C.cGreen + C.Bold + "Time");
+ Scoreboard.Write(UtilTime.convertString(this.getSecondsSinceStart() * 1000, 0, TimeUnit.FIT));
+
+ Scoreboard.WriteBlank();
+ Scoreboard.Write(C.cYellow + C.Bold + "Teams");
+
+ ArrayList alive = new ArrayList();
+ for (GameTeam team : GetTeamList())
+ {
+ if (team.IsTeamAlive())
+ alive.add(team);
+ }
+
+ if (GetPlayers(true).size() <= 7)
+ {
+ for (GameTeam team : GetTeamList())
+ {
+ for (Player player : team.GetPlayers(true))
+ {
+ Scoreboard.Write(team.GetColor() + player.getName());
+ }
+ }
+ }
+ else if (alive.size() <= 7)
+ {
+ for (GameTeam team : alive)
+ {
+ Scoreboard.Write(C.cWhite + team.GetPlayers(true).size() + " " + team.GetColor() + team.GetName());
+ }
+ }
+ else
+ {
+ Scoreboard.Write(C.cWhite + alive.size() + " Alive");
+ }
+
+ Scoreboard.WriteBlank();
+
+ if (this.getChestRefillTime() > 0 && this.getDeathMatchTime() > 60)
+ {
+ Scoreboard.Write(C.cGold + C.Bold + "Chest Refill");
+ Scoreboard.Write(UtilTime.convertString(this.getChestRefillTime() * 1000, 0, TimeUnit.FIT));
+ }
+ else if (this.getDeathMatchTime() > 0)
+ {
+ Scoreboard.Write(C.cRed + C.Bold + "Deathmatch");
+ Scoreboard.Write(UtilTime.convertString(
+ Math.min(this.getDeathMatchTime(), this.isDeathMatchTeleported() ? 10 : this.getDeathMatchTime()) * 1000, 0, TimeUnit.FIT));
+ }
+ else
+ {
+ Scoreboard.Write(C.cRed + C.Bold + "Game End");
+ Scoreboard.Write(UtilTime.convertString(Math.max(0, this.getGameEndTime()) * 1000, 0, TimeUnit.FIT));
+ }
+
+ Scoreboard.Draw();
+ }
+
+ @Override
+ public void EndCheck()
+ {
+ if (!IsLive())
+ return;
+
+ ArrayList teamsAlive = new ArrayList();
+
+ for (GameTeam team : this.GetTeamList())
+ if (team.GetPlayers(true).size() > 0)
+ teamsAlive.add(team);
+
+ if (teamsAlive.size() <= 1)
+ {
+ //Announce
+ if (teamsAlive.size() > 0)
+ AnnounceEnd(teamsAlive.get(0));
+
+ for (GameTeam team : GetTeamList())
+ {
+ if (WinnerTeam != null && team.equals(WinnerTeam))
+ {
+ for (Player player : team.GetPlayers(false))
+ AddGems(player, 10, "Winning Team", false, false);
+ }
+
+ for (Player player : team.GetPlayers(false))
+ if (player.isOnline())
+ AddGems(player, 10, "Participation", false, false);
+ }
+
+ //End
+ SetState(GameState.End);
+ }
+ }
+
+ @Override
+ public List getWinners()
+ {
+ if (WinnerTeam == null)
+ return null;
+
+ return WinnerTeam.GetPlayers(false);
+ }
+
+ @Override
+ public List getLosers()
+ {
+ if (WinnerTeam == null)
+ return null;
+
+ List players = new ArrayList<>();
+
+ for (GameTeam team : GetTeamList())
+ {
+ if (team != WinnerTeam)
+ players.addAll(team.GetPlayers(false));
+ }
+
+ return players;
+ }
+
+ @Override
+ public boolean CanJoinTeam(GameTeam team)
+ {
+ return team.GetSize() < PlayersPerTeam;
+ }
+
+ @EventHandler(priority = EventPriority.HIGH)
+ public void teamSelectInteract(PlayerInteractEntityEvent event)
+ {
+ if (GetState() != GameState.Recruit)
+ return;
+
+ if (event.getRightClicked() == null)
+ return;
+
+ if (!(event.getRightClicked() instanceof Player))
+ return;
+
+ Player player = event.getPlayer();
+
+ //Observer
+ if (Manager.IsObserver(player))
+ {
+ UtilPlayer.message(player, F.main("Game", "Spectators cannot partake in games."));
+ return;
+ }
+
+ selectTeamMate(player, (Player)event.getRightClicked());
+ }
+
+ @EventHandler
+ public void teamSelectCommand(PlayerCommandPreprocessEvent event)
+ {
+ if (GetState() != GameState.Recruit)
+ return;
+
+ if (!event.getMessage().toLowerCase().startsWith("/team "))
+ return;
+
+ event.setCancelled(true);
+
+ Player target = UtilPlayer.searchOnline(event.getPlayer(), event.getMessage().split(" ")[1], true);
+ if (target == null)
+ return;
+
+ //Observer
+ if (Manager.IsObserver(event.getPlayer()))
+ {
+ UtilPlayer.message(event.getPlayer(), F.main("Game", "Spectators cannot partake in games."));
+ return;
+ }
+
+ if (event.getPlayer().equals(target))
+ return;
+
+ selectTeamMate(event.getPlayer(), target);
+ }
+
+ public void selectTeamMate(Player player, Player ally)
+ {
+ //Accept Invite
+ if (_teamReqs.containsKey(ally) && _teamReqs.get(ally).equals(player))
+ {
+ //Remove Prefs
+ _teamReqs.remove(player);
+ _teamReqs.remove(ally);
+
+ //Inform
+ UtilPlayer.message(player, F.main("Game", "You accepted " + ally.getName() + "'s Team Request!"));
+ UtilPlayer.message(ally, F.main("Game", player.getName() + " accepted your Team Request!"));
+
+ //Leave Old Teams
+ if (GetTeam(player) != null)
+ GetTeam(player).DisbandTeam();
+
+ if (GetTeam(ally) != null)
+ GetTeam(ally).DisbandTeam();
+
+ //Get Team
+ GameTeam team = getEmptyTeam();
+ if (team == null)
+ return;
+
+ //Join Team
+ SetPlayerTeam(player, team, true);
+ SetPlayerTeam(ally, team, true);
+ }
+ //Send Invite
+ else
+ {
+ //Already on Team with Target
+ if (GetTeam(player) != null)
+ if (GetTeam(player).HasPlayer(ally))
+ return;
+
+ //Inform Player
+ UtilPlayer.message(player, F.main("Game", "You sent a Team Request to " + ally.getName() + "!"));
+
+ //Inform Target
+ if (Recharge.Instance.use(player, "Team Req " + ally.getName(), 2000, false, false))
+ {
+ UtilPlayer.message(ally, F.main("Game", player.getName() + " sent you a Team Request!"));
+ UtilPlayer.message(ally, F.main("Game", "Type " + F.elem("/team " + player.getName()) + " to accept!"));
+ }
+
+ //Add Pref
+ _teamReqs.put(player, ally);
+ }
+ }
+
+ @EventHandler
+ public void teamQuit(PlayerQuitEvent event)
+ {
+ if (GetState() != GameState.Recruit)
+ return;
+
+ Player player = event.getPlayer();
+
+ if (GetTeam(player) != null)
+ GetTeam(player).DisbandTeam();
+
+ Iterator teamIter = _teamReqs.keySet().iterator();
+ while (teamIter.hasNext())
+ {
+ Player sender = teamIter.next();
+ if (sender.equals(player) || _teamReqs.get(sender).equals(player))
+ teamIter.remove();
+ }
+ }
+
+ public GameTeam getEmptyTeam()
+ {
+ for (GameTeam team : GetTeamList())
+ {
+ if (team.GetPlayers(false).isEmpty())
+ return team;
+ }
+
+ return null;
+ }
+
+ @Override
+ public String GetMode()
+ {
+ return "Team Mode";
+ }
+}
diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wither/WitherGame.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wither/WitherGame.java
index 634e27970..2e3cf0d85 100644
--- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wither/WitherGame.java
+++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wither/WitherGame.java
@@ -1,6 +1,7 @@
package nautilus.game.arcade.game.games.wither;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
@@ -11,12 +12,17 @@ import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilBlock;
+import mineplex.core.common.util.UtilParticle;
+import mineplex.core.common.util.UtilEvent.ActionType;
+import mineplex.core.common.util.UtilParticle.ParticleType;
+import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilTextMiddle;
import mineplex.core.common.util.UtilTime;
import mineplex.core.data.BlockData;
+import mineplex.core.itemstack.ItemBuilder;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.core.condition.Condition.ConditionType;
@@ -28,27 +34,45 @@ import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.game.GameTeam.PlayerState;
import nautilus.game.arcade.game.TeamGame;
import nautilus.game.arcade.game.games.paintball.PlayerCopy;
+import nautilus.game.arcade.game.games.wither.events.HumanReviveEvent;
import nautilus.game.arcade.game.games.wither.kit.KitHumanArcher;
+import nautilus.game.arcade.game.games.wither.kit.KitHumanMedic;
+import nautilus.game.arcade.game.games.wither.kit.KitHumanEditor;
import nautilus.game.arcade.game.games.wither.kit.KitWitherMinion;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.kit.NullKit;
import nautilus.game.arcade.kit.perks.data.IBlockRestorer;
+import nautilus.game.arcade.stats.WitherAssaultReviveTracker;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.EntityEffect;
import org.bukkit.Location;
import org.bukkit.Material;
+import org.bukkit.Sound;
import org.bukkit.block.Block;
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
+import org.bukkit.entity.Projectile;
import org.bukkit.entity.ThrownPotion;
+import org.bukkit.entity.Wither;
+import org.bukkit.entity.WitherSkull;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
+import org.bukkit.event.block.Action;
+import org.bukkit.event.block.BlockBreakEvent;
+import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.event.entity.EntityCombustEvent;
import org.bukkit.event.entity.ProjectileHitEvent;
+import org.bukkit.event.entity.ProjectileLaunchEvent;
+import org.bukkit.event.player.PlayerInteractEvent;
+import org.bukkit.event.player.PlayerPickupItemEvent;
+import org.bukkit.event.player.PlayerQuitEvent;
+import org.bukkit.inventory.ItemStack;
+import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.potion.PotionEffectType;
+import org.bukkit.scheduler.BukkitRunnable;
import org.bukkit.util.Vector;
public class WitherGame extends TeamGame implements IBlockRestorer
@@ -57,70 +81,81 @@ public class WitherGame extends TeamGame implements IBlockRestorer
private GameTeam _withers;
private double _witherFactor = 2.5;
-
+
private int _yLimit = 0;
-
+ private int _maxY;
+
private long _gameTime = 300000;
-
+
private HashMap _doubles = new HashMap();
-
-// private int _livesPerPlayer = 3;
-// private HashMap _lives = new HashMap();
-
+
+ // private int _livesPerPlayer = 3;
+ // private HashMap _lives = new HashMap();
+
private HashSet _blocks = new HashSet();
+ private ArrayList _locationsOfBlocks = new ArrayList();
+
public WitherGame(ArcadeManager manager)
{
super(manager, GameType.WitherAssault,
- new Kit[]
- {
+ new Kit[]
+ {
new KitHumanArcher(manager),
- //new KitHumanBuilder(manager),
- //new KitHumanRunner(manager),
- new NullKit(manager),
- new NullKit(manager),
+ new KitHumanMedic(manager),
+ new KitHumanEditor(manager),
new NullKit(manager),
new KitWitherMinion(manager),
- //new KitWitherWeb(manager),
- //new KitWitherWeb(manager),
- },
+ },
+
+ new String[]
+ {
- new String[]
- {
-
C.cGreen + "Humans" + C.cWhite + " Run and hide from the Withers",
C.cGreen + "Humans" + C.cWhite + " Revive your dead allies!",
C.cGreen + "Humans" + C.cWhite + " Win by surviving for 5 minutes",
" ",
C.cRed + "Withers" + C.cWhite + " Moves very slowly when near ground",
C.cRed + "Withers" + C.cWhite + " Kill all the Humans within 5 Minutes",
- });
-
+ });
+
this.DeathOut = true;
this.DamageTeamSelf = false;
this.DamageSelf = false;
this.DeathSpectateSecs = 4;
this.HungerSet = 20;
this.WorldBoundaryKill = false;
+ this.CompassEnabled = false;
- this.CompassEnabled = true;
- this.CompassGiveItem = false;
-
+ //Customizing for the Editor kit
+ this.BlockBreak = true;
+ this.BlockPlace = true;
+ this.ItemPickup = true;
+
this.KitRegisterState = GameState.Prepare;
-
+
this.TeamArmor = true;
- this.TeamArmorHotbar = false;
+ this.TeamArmorHotbar = false;
+
+ _help = new String[]
+ {
+ "Blocks placed by an Editor can be passed by other humans by " + C.cDGreen + "Right-clicking the block",
+ "Withers are too powerful to be killed. Hiding is the only option!",
+ "Medics are a valuable asset. Stick with them and keep them safe!",
+
+ };
+
}
@Override
- public void ParseData()
+ public void ParseData()
{
_yLimit = WorldData.GetDataLocs("RED").get(0).getBlockY();
}
-
+
@EventHandler
- public void teamSetup(GameStateChangeEvent event)
+ public void teamSetup(GameStateChangeEvent event)
{
if (event.GetState() != GameState.Recruit)
return;
@@ -134,7 +169,7 @@ public class WitherGame extends TeamGame implements IBlockRestorer
_withers = team;
_withers.SetName("Withers");
_withers.SetColor(ChatColor.RED);
-
+
if (!kit.GetName().contains("Wither"))
team.GetRestrictedKits().add(kit);
}
@@ -143,7 +178,7 @@ public class WitherGame extends TeamGame implements IBlockRestorer
_runners = team;
_runners.SetName("Humans");
_runners.SetColor(ChatColor.GREEN);
-
+
if (kit.GetName().contains("Wither"))
team.GetRestrictedKits().add(kit);
}
@@ -160,95 +195,281 @@ public class WitherGame extends TeamGame implements IBlockRestorer
if (event.getType() != UpdateType.FAST)
return;
- //Not Enough Players
+ // Not Enough Players
if (_runners.GetPlayers(true).size() < 2)
return;
- //Enough Withers
- if (_withers.GetPlayers(true).size() * _witherFactor >= _runners.GetPlayers(true).size())
+ // Enough Withers
+ if (_withers.GetPlayers(true).size() * _witherFactor >= _runners
+ .GetPlayers(true).size())
return;
-
-
+
Player player = UtilAlg.Random(_runners.GetPlayers(true));
setWither(player, true);
}
+// @EventHandler
+// public void assignCompassOnStart(GameStateChangeEvent event)
+// {
+// if (event.GetState() != GameState.Live)
+// return;
+//
+// for (Player players : _withers.GetPlayers(true))
+// {
+// ItemStack compass = new ItemBuilder(Material.COMPASS, 1).build();
+//
+// ItemMeta im = compass.getItemMeta();
+// im.setLore(new ArrayList(Arrays.asList(
+// F.item("A compass that trigger"),
+// F.item("your ability to track humans!"))));
+// im.setDisplayName(F.name("Scent Trigger"));
+//
+// compass.setItemMeta(im);
+//
+// players.getInventory().setItem(7, compass);
+// }
+// }
+
+ // Cancel wither shooting in waiting lobby
+ @EventHandler
+ public void onWitherSkullFire(ProjectileLaunchEvent event)
+ {
+ if (GetState() == GameState.Recruit || GetState() == GameState.Prepare)
+ {
+ Projectile proj = event.getEntity();
+ WitherSkull ws = (WitherSkull) proj;
+
+ if (ws.getShooter() instanceof Wither)
+ {
+ event.setCancelled(true);
+ }
+ }
+ }
+
+ @EventHandler
+ public void handleCustomBlockPlace(BlockPlaceEvent event)
+ {
+ if(!IsLive())
+ {
+ return;
+ }
+ if(!GetKit(event.getPlayer()).GetName().contentEquals("Human Editor"))
+ {
+ event.setCancelled(true);
+ return;
+ }
+
+ _maxY = GetTeamList().get(1).GetSpawn().getBlockY() - 4;
+ if(event.getBlock().getLocation().getBlockY() < _maxY)
+ {
+ event.getPlayer().sendMessage(F.main("BlockChecker", "You may not build under this height!"));
+ event.setCancelled(true);
+ return;
+ }
+
+ _locationsOfBlocks.add(event.getBlock().getLocation());
+ }
+
+ @EventHandler
+ public void handleCustomBlockbreak(BlockBreakEvent event)
+ {
+ if(!IsLive())
+ {
+ return;
+ }
+ if(!GetKit(event.getPlayer()).GetName().contentEquals("Human Editor"))
+ {
+ event.setCancelled(true);
+ return;
+ }
+
+ Location blockLocation = event.getBlock().getLocation();
+ _maxY = GetTeamList().get(1).GetSpawn().getBlockY() - 3;
+ if(blockLocation.add(0,1,0).getBlock().getType() == Material.AIR)
+ {
+ for(Player humans: _runners.GetPlayers(true))
+ {
+ if(IsAlive(humans))
+ {
+ if(humans.getLocation().add(0,-1,0).getBlock().equals(event.getBlock()))
+ {
+ if(humans.getName() != event.getPlayer().getName())
+ {
+ event.setCancelled(true);
+ return;
+ }
+ }
+ }
+ }
+ }
+
+ if(blockLocation.getBlockY() < _maxY)
+ {
+ event.getPlayer().sendMessage(F.main("BlockChecker", "You may not build under this height!"));
+ event.setCancelled(true);
+ return;
+ }
+ }
+
+ @EventHandler
+ public void handleCustomItemPickup(PlayerPickupItemEvent event)
+ {
+ if(!IsLive())
+ {
+ return;
+ }
+ if(!GetKit(event.getPlayer()).GetName().contentEquals("Human Editor"))
+ {
+ event.setCancelled(true);
+ return;
+ }
+ }
+
+ //On Player interact with a placed block by Editor
+ @EventHandler
+ public void onPlayerInteract(final PlayerInteractEvent event)
+ {
+ if(!IsLive())
+ {
+ return;
+ }
+ if(!IsAlive(event.getPlayer()))
+ {
+ return;
+ }
+ if(GetTeam(event.getPlayer()).GetColor() == ChatColor.RED)
+ {
+ return;
+ }
+ if(event.getAction() == Action.RIGHT_CLICK_BLOCK)
+ {
+ Block clickedBlock = event.getClickedBlock();
+
+ if(_locationsOfBlocks.contains(clickedBlock.getLocation()))
+ {
+ new BukkitRunnable()
+ {
+
+ @Override
+ public void run()
+ {
+ if(!(event.getPlayer().getItemInHand().getType().isBlock()) || event.getPlayer().getItemInHand().getType() == Material.AIR)
+ {
+ UtilParticle.PlayParticle(ParticleType.FLAME, event.getClickedBlock().getLocation().add(0.5, 0.5, 0.5), 0, 0, 0, 0, 1, ViewDist.LONG, UtilServer.getPlayers());
+ event.getClickedBlock().getWorld().playSound(event.getClickedBlock().getLocation(), Sound.NOTE_STICKS, 2f, 1f);
+ Manager.GetBlockRestore().Add(event.getClickedBlock(), 0, event.getClickedBlock().getData(), 2000);
+ }
+ }
+ }.runTaskLater(Manager.getPlugin(), 5);
+ }
+ }
+ }
+
public void setWither(Player player, boolean forced)
{
-// _lives.remove(player);
-
+ // _lives.remove(player);
+
SetPlayerTeam(player, _withers, true);
-
- //Kit
- Kit newKit = GetKits()[4];
+
+ // Kit
+ Kit newKit = GetKits()[GetKits().length-1];
SetKit(player, newKit, false);
newKit.ApplyKit(player);
-
+
player.teleport(_withers.GetSpawn());
if (forced)
{
AddGems(player, 10, "Forced Wither", false, false);
- Announce(F.main("Game", F.elem(_withers.GetColor() + player.getName()) + " has become a " +
- F.elem(_withers.GetColor() + newKit.GetName()) + "."));
+ Announce(F.main(
+ "Game",
+ F.elem(_withers.GetColor() + player.getName())
+ + " has become a "
+ + F.elem(_withers.GetColor() + newKit.GetName())
+ + "."));
player.getWorld().strikeLightningEffect(player.getLocation());
}
}
-
-// @EventHandler
-// public void playerLoseLife(final PlayerDeathOutEvent event)
-// {
-// Player player = event.GetPlayer();
-//
-// if (_lives.containsKey(player))
-// {
-// int lives = _lives.get(player);
-//
-// if (lives <= 1)
-// return;
-//
-// _lives.put(player, lives - 1);
-//
-// UtilPlayer.message(player, F.main("Game", "You have " + F.elem(C.cGreen + C.Bold + lives + " Lives Remaining") + "."));
-//
-// event.setCancelled(true);
-// }
-// }
-
+
+ // @EventHandler
+ // public void playerLoseLife(final PlayerDeathOutEvent event)
+ // {
+ // Player player = event.GetPlayer();
+ //
+ // if (_lives.containsKey(player))
+ // {
+ // int lives = _lives.get(player);
+ //
+ // if (lives <= 1)
+ // return;
+ //
+ // _lives.put(player, lives - 1);
+ //
+ // UtilPlayer.message(player, F.main("Game", "You have " + F.elem(C.cGreen +
+ // C.Bold + lives + " Lives Remaining") + "."));
+ //
+ // event.setCancelled(true);
+ // }
+ // }
+
@EventHandler
public void gameStart(GameStateChangeEvent event)
{
if (event.GetState() != GameState.Live)
return;
-
- UtilTextMiddle.display(C.cGreen + "Humans Hiding", "15 Seconds until Assault", 10, 80, 10);
-
+
+ UtilTextMiddle.display(C.cGreen + "Humans Hiding",
+ "15 Seconds until Assault", 10, 80, 10);
+
for (Player player : _withers.GetPlayers(true))
{
- Manager.GetCondition().Factory().Blind("Game Start", player, null, 15, 0, false, false, false);
+ Manager.GetCondition()
+ .Factory()
+ .Blind("Game Start", player, null, 15, 0, false, false,
+ false);
}
}
-// @EventHandler
-// public void playerLivesDisplay(PlayerKitGiveEvent event)
-// {
-// if (!_runners.HasPlayer(event.GetPlayer()))
-// return;
-//
-// //Player Lives
-// if (!_lives.containsKey(event.GetPlayer()))
-// _lives.put(event.GetPlayer(), _livesPerPlayer);
-//
-// int lives = _lives.get(event.GetPlayer());
-//
-// if (lives <= 0)
-// return;
-//
-// event.GetPlayer().getInventory().setItem(8, ItemStackFactory.Instance.CreateStack(Material.BONE, (byte)0, lives, C.cGreen + C.Bold + lives + " Lives Remaining"));
-// }
+ @EventHandler
+ public void removeUselessPlayerCopies(UpdateEvent event)
+ {
+ if(event.getType() != UpdateType.TWOSEC)
+ return;
+
+ for(Player players: _doubles.keySet())
+ {
+ if(!players.isOnline())
+ {
+ PlayerCopy pc = _doubles.get(players);
+ pc.GetEntity().remove();
+ _doubles.remove(players);
+ }
+ }
+
+ }
+
+ // @EventHandler
+ // public void playerLivesDisplay(PlayerKitGiveEvent event)
+ // {
+ // if (!_runners.HasPlayer(event.GetPlayer()))
+ // return;
+ //
+ // //Player Lives
+ // if (!_lives.containsKey(event.GetPlayer()))
+ // _lives.put(event.GetPlayer(), _livesPerPlayer);
+ //
+ // int lives = _lives.get(event.GetPlayer());
+ //
+ // if (lives <= 0)
+ // return;
+ //
+ // event.GetPlayer().getInventory().setItem(8,
+ // ItemStackFactory.Instance.CreateStack(Material.BONE, (byte)0, lives,
+ // C.cGreen + C.Bold + lives + " Lives Remaining"));
+ // }
@Override
public void EndCheck()
@@ -256,23 +477,24 @@ public class WitherGame extends TeamGame implements IBlockRestorer
if (!IsLive())
return;
- //Players Quit
- if (GetPlayers(true).size() < 2)
+ // Players Quit
+ if (GetPlayers(true).size() < 1)
{
SetState(GameState.End);
+ _locationsOfBlocks.clear();
}
-
+
GameTeam winner = null;
-
- //Wither Win
+
+ // Wither Win
if (UtilTime.elapsed(this.GetStateTime(), _gameTime))
winner = _runners;
-
- //Runner Win
+
+ // Runner Win
if (_runners.GetPlayers(true).isEmpty())
winner = _withers;
-
- //Set Win
+
+ // Set Win
if (winner != null)
{
AnnounceEnd(winner);
@@ -290,8 +512,9 @@ public class WitherGame extends TeamGame implements IBlockRestorer
AddGems(player, 10, "Participation", false, false);
}
- //End
+ // End
SetState(GameState.End);
+ _locationsOfBlocks.clear();
}
}
@@ -301,33 +524,40 @@ public class WitherGame extends TeamGame implements IBlockRestorer
{
if (!InProgress())
return;
-
+
if (event.getType() != UpdateType.FAST)
return;
-
-// int lives = 0;
-// for (int i : _lives.values())
-// lives += i;
- //Wipe Last
+ // int lives = 0;
+ // for (int i : _lives.values())
+ // lives += i;
+
+ // Wipe Last
Scoreboard.Reset();
-
+
Scoreboard.WriteBlank();
Scoreboard.Write(_runners.GetColor() + C.Bold + _runners.GetName());
- Scoreboard.Write(_runners.GetColor() + "" + _runners.GetPlayers(true).size() + " Players");
-
+ Scoreboard.Write(_runners.GetColor() + ""
+ + _runners.GetPlayers(true).size() + " Players");
+
Scoreboard.WriteBlank();
Scoreboard.Write(_withers.GetColor() + C.Bold + _withers.GetName());
- Scoreboard.Write(_withers.GetColor() + "" + _withers.GetPlayers(true).size() + " Players");
-
-// Scoreboard.WriteBlank();
-// Scoreboard.Write(C.cYellow + C.Bold + "Humans Alive");
-// Scoreboard.Write(lives + " / " + (_lives.size() * _livesPerPlayer));
-
+ Scoreboard.Write(_withers.GetColor() + ""
+ + _withers.GetPlayers(true).size() + " Players");
+
+ // Scoreboard.WriteBlank();
+ // Scoreboard.Write(C.cYellow + C.Bold + "Humans Alive");
+ // Scoreboard.Write(lives + " / " + (_lives.size() * _livesPerPlayer));
+
Scoreboard.WriteBlank();
Scoreboard.Write(C.cYellow + C.Bold + "Time Left");
- Scoreboard.Write(UtilTime.MakeStr(Math.max(0, _gameTime - (System.currentTimeMillis() - this.GetStateTime())), 1));
-
+ Scoreboard.Write(UtilTime.MakeStr(
+ Math.max(
+ 0,
+ _gameTime
+ - (System.currentTimeMillis() - this
+ .GetStateTime())), 1));
+
Scoreboard.Draw();
}
@@ -339,7 +569,7 @@ public class WitherGame extends TeamGame implements IBlockRestorer
return _runners;
}
-
+
@Override
public boolean CanJoinTeam(GameTeam team)
{
@@ -347,42 +577,57 @@ public class WitherGame extends TeamGame implements IBlockRestorer
{
return team.GetSize() < getRequiredWithers();
}
-
+
return team.GetSize() < GetPlayers(true).size() - getRequiredWithers();
}
-
+
public int getRequiredWithers()
{
- return (int)(GetPlayers(true).size()/_witherFactor);
+ return (int) (GetPlayers(true).size() / _witherFactor);
}
-
+
@EventHandler
public void witherMovement(UpdateEvent event)
{
if (!IsLive())
return;
-
+
if (event.getType() != UpdateType.FASTER)
return;
-
+
+ Location _spawn = GetTeamList().get(1).GetSpawn();
for (Player player : _withers.GetPlayers(true))
{
ArrayList collisions = new ArrayList();
+
+ // Fly Speed
- //Fly Speed
- double speed = 0.09 - (_yLimit - player.getLocation().getY()) * 0.006;
-
- if (speed > 0.16)
+ double distanceToGround = player.getLocation().distance(new Location(_spawn.getWorld(), player.getLocation().getX(), _spawn.getY(), player.getLocation().getZ()));
+ double speed;
+
+ if (distanceToGround < 8)
+ {
speed = 0.16;
-
- if (speed < 0.016)
+ }
+ else
+ {
+ speed = 0.09 - (_yLimit - player.getLocation().getY()) * 0.006;
+ }
+
+ if (distanceToGround < 4)
+ {
speed = 0.016;
-
- player.setFlySpeed((float)speed);
-
-
- //Bump
- for (Block block : UtilBlock.getInRadius(player.getLocation().add(0, 0.5, 0), 1.5d).keySet())
+ }
+ else
+ {
+ speed = 0.09 - (_yLimit - player.getLocation().getY()) * 0.006;
+ }
+
+ player.setFlySpeed((float) speed);
+
+ // Bump
+ for (Block block : UtilBlock.getInRadius(
+ player.getLocation().add(0, 0.5, 0), 1.5d).keySet())
{
if (!UtilBlock.airFoliage(block))
{
@@ -390,15 +635,17 @@ public class WitherGame extends TeamGame implements IBlockRestorer
}
}
- Vector vec = UtilAlg.getAverageBump(player.getLocation(), collisions);
-
+ Vector vec = UtilAlg.getAverageBump(player.getLocation(),
+ collisions);
+
if (vec == null)
continue;
-
+
UtilAction.velocity(player, vec, 0.6, false, 0, 0.4, 10, true);
-
-// if (player.getLocation().getY() < _yLimit + 6)
-// UtilAction.velocity(player, new Vector(0, 1, 0), 0.6, false, 0, 0, 10, true);
+
+ // if (player.getLocation().getY() < _yLimit + 6)
+ // UtilAction.velocity(player, new Vector(0, 1, 0), 0.6, false, 0,
+ // 0, 10, true);
}
}
@@ -406,139 +653,153 @@ public class WitherGame extends TeamGame implements IBlockRestorer
public void addBlocks(Set blocks)
{
Iterator blockIter = blocks.iterator();
-
+
while (blockIter.hasNext())
{
Block block = blockIter.next();
-
- if (block.getType() == Material.BEDROCK || block.getType() == Material.IRON_BLOCK)
+
+ if (block.getType() == Material.BEDROCK
+ || block.getType() == Material.IRON_BLOCK)
blockIter.remove();
-
+
else if (!isInsideMap(block.getLocation()))
blockIter.remove();
-
-// else if (UtilAlg.inBoundingBox(block.getLocation(), _safeA, _safeB) || UtilAlg.inBoundingBox(block.getLocation(), _spawnA, _spawnB))
-// blockIter.remove();
+
+ // else if (UtilAlg.inBoundingBox(block.getLocation(), _safeA,
+ // _safeB) || UtilAlg.inBoundingBox(block.getLocation(), _spawnA,
+ // _spawnB))
+ // blockIter.remove();
}
-
+
for (Block block : blocks)
_blocks.add(new BlockData(block));
}
-
+
@Override
public void restoreBlock(Location loc, double radius)
{
Iterator dataIt = _blocks.iterator();
-
+
while (dataIt.hasNext())
{
BlockData data = dataIt.next();
-
- double dist = UtilMath.offset(loc, data.Block.getLocation().add(0.5, 0.5, 0.5));
-
+
+ double dist = UtilMath.offset(loc,
+ data.Block.getLocation().add(0.5, 0.5, 0.5));
+
if (dist < radius)
{
- Manager.GetBlockRestore().Add(data.Block, 0, (byte)0, data.Material.getId(), data.Data, (long) (6000 * (dist/radius)));
+ Manager.GetBlockRestore().Add(data.Block, 0, (byte) 0,
+ data.Material.getId(), data.Data,
+ (long) (6000 * (dist / radius)));
dataIt.remove();
}
}
}
-// @EventHandler
-// public void cleanLives(PlayerQuitEvent event)
-// {
-// _lives.remove(event.getPlayer());
-// }
-
-// @EventHandler
-// public void livesUpdate(UpdateEvent event)
-// {
-// if (!IsLive())
-// return;
-//
-// if (event.getType() != UpdateType.FASTER)
-// return;
-//
-// Iterator playerIter = _lives.keySet().iterator();
-//
-// while (playerIter.hasNext())
-// {
-// Player player = playerIter.next();
-//
-// if (!player.isOnline() || !_runners.HasPlayer(player))
-// playerIter.remove();
-// }
-// }
-
+ // @EventHandler
+ // public void cleanLives(PlayerQuitEvent event)
+ // {
+ // _lives.remove(event.getPlayer());
+ // }
+
+ // @EventHandler
+ // public void livesUpdate(UpdateEvent event)
+ // {
+ // if (!IsLive())
+ // return;
+ //
+ // if (event.getType() != UpdateType.FASTER)
+ // return;
+ //
+ // Iterator playerIter = _lives.keySet().iterator();
+ //
+ // while (playerIter.hasNext())
+ // {
+ // Player player = playerIter.next();
+ //
+ // if (!player.isOnline() || !_runners.HasPlayer(player))
+ // playerIter.remove();
+ // }
+ // }
+
@EventHandler
public void arrowDamage(CustomDamageEvent event)
{
if (event.GetProjectile() == null)
return;
-
+
event.AddMult(GetName(), "Arrow Mod", 0.75, false);
- }
-
+ }
+
@EventHandler(priority = EventPriority.HIGHEST)
public void damageOut(CustomDamageEvent event)
{
if (event.IsCancelled())
return;
-
+
if (event.GetDamageePlayer() == null)
return;
-
+
if (event.GetDamage() < event.GetDamageePlayer().getHealth())
return;
-
+
event.SetCancelled("Fake Death");
-
+
event.GetDamageePlayer().playEffect(EntityEffect.HURT);
-
+
playerOut(event.GetDamageePlayer());
-
+
if (event.GetDamagerPlayer(true) != null)
{
- AddGems(event.GetDamagerPlayer(true), 2, "Humans Stunned", true, true);
-
- Bukkit.broadcastMessage(C.cBlue + "Death> " + C.cGreen + event.GetDamageePlayer().getName() + C.cGray + " was killed by " + C.cRed + event.GetDamagerPlayer(true).getName() + C.cGray + ".");
+ AddGems(event.GetDamagerPlayer(true), 2, "Humans Stunned", true,
+ true);
+
+ Bukkit.broadcastMessage(C.cBlue + "Death> " + C.cGreen
+ + event.GetDamageePlayer().getName() + C.cGray
+ + " was killed by " + C.cRed
+ + event.GetDamagerPlayer(true).getName() + C.cGray + ".");
}
else
{
- Bukkit.broadcastMessage(C.cBlue + "Death> " + C.cGreen + event.GetDamageePlayer().getName() + C.cGray + " was killed.");
+ Bukkit.broadcastMessage(C.cBlue + "Death> " + C.cGreen
+ + event.GetDamageePlayer().getName() + C.cGray
+ + " was killed.");
}
}
-
+
public void playerOut(Player player)
{
- //State
+ // State
SetPlayerState(player, PlayerState.OUT);
player.setHealth(20);
-
+
player.setFlySpeed(0.1f);
- //Conditions
- Manager.GetCondition().Factory().Blind("Hit", player, player, 1.5, 0, false, false, false);
- Manager.GetCondition().Factory().Cloak("Hit", player, player, 9999, false, false);
+ // Conditions
+ Manager.GetCondition().Factory()
+ .Blind("Hit", player, player, 1.5, 0, false, false, false);
+ Manager.GetCondition().Factory()
+ .Cloak("Hit", player, player, 9999, false, false);
- //Settings
+ // Settings
player.setAllowFlight(true);
player.setFlying(true);
- ((CraftPlayer)player).getHandle().spectating = true;
- ((CraftPlayer)player).getHandle().k = false;
+ ((CraftPlayer) player).getHandle().spectating = true;
+ ((CraftPlayer) player).getHandle().k = false;
- player.setVelocity(new Vector(0,1.2,0));
+ player.setVelocity(new Vector(0, 1.2, 0));
_doubles.put(player, new PlayerCopy(this, player, ChatColor.YELLOW));
}
- public void playerIn(final Player player, final LivingEntity copy)
+ public void playerIn(final Player player, final LivingEntity copy, Player revivedBy)
{
- //State
+ // State
SetPlayerState(player, PlayerState.IN);
player.setHealth(20);
- //Teleport
+ // Teleport
if (copy != null)
{
Location loc = player.getLocation();
@@ -548,43 +809,56 @@ public class WitherGame extends TeamGame implements IBlockRestorer
player.teleport(loc);
}
- //Settings
+ // Settings
player.setAllowFlight(false);
player.setFlying(false);
- ((CraftPlayer)player).getHandle().spectating = false;
- ((CraftPlayer)player).getHandle().k = true;
-
- //Items
+ ((CraftPlayer) player).getHandle().spectating = false;
+ ((CraftPlayer) player).getHandle().k = true;
+
+ // Items
player.getInventory().remove(Material.WATCH);
player.getInventory().remove(Material.COMPASS);
- //Inform
- UtilPlayer.message(player, F.main("Game", "You have been revived!"));
+ // Inform
+ if(revivedBy != null)
+ {
+ UtilPlayer.message(player, F.main("Game", "You have been revived by " + C.cGold + revivedBy.getName()));
+ }
+ else
+ {
+ UtilPlayer.message(player, F.main("Game", "You have been revived!"));
+ }
- //Delayed Visibility
+ // Delayed Visibility
if (copy != null)
{
- UtilServer.getServer().getScheduler().scheduleSyncDelayedTask(Manager.getPlugin(), new Runnable()
- {
- public void run()
- {
- //Remove Invis
- if (IsAlive(player))
- Manager.GetCondition().EndCondition(player, ConditionType.CLOAK, null);
+ UtilServer
+ .getServer()
+ .getScheduler()
+ .scheduleSyncDelayedTask(Manager.getPlugin(),
+ new Runnable()
+ {
+ public void run()
+ {
+ // Remove Invis
+ if (IsAlive(player))
+ Manager.GetCondition().EndCondition(
+ player, ConditionType.CLOAK,
+ null);
- //Remove Copy
- copy.remove();
- }
- }, 4);
+ // Remove Copy
+ copy.remove();
+ }
+ }, 4);
}
}
-
+
@EventHandler
public void revive(ProjectileHitEvent event)
{
if (!IsLive())
return;
-
+
if (!(event.getEntity() instanceof ThrownPotion))
return;
@@ -594,12 +868,13 @@ public class WitherGame extends TeamGame implements IBlockRestorer
if (!(event.getEntity().getShooter() instanceof Player))
return;
- Player thrower = (Player)event.getEntity().getShooter();
+ Player thrower = (Player) event.getEntity().getShooter();
GameTeam throwerTeam = GetTeam(thrower);
- if (throwerTeam == null) return;
+ if (throwerTeam == null)
+ return;
- //Revive
+ // Revive a copy
Iterator copyIterator = _doubles.values().iterator();
while (copyIterator.hasNext())
{
@@ -609,39 +884,43 @@ public class WitherGame extends TeamGame implements IBlockRestorer
if (otherTeam == null || !otherTeam.equals(throwerTeam))
continue;
- if (UtilMath.offset(copy.GetEntity().getLocation().add(0,1,0), event.getEntity().getLocation()) > 3)
+ if (UtilMath.offset(copy.GetEntity().getLocation().add(0, 1, 0),
+ event.getEntity().getLocation()) > 3)
continue;
- playerIn(copy.GetPlayer(), copy.GetEntity());
+ playerIn(copy.GetPlayer(), copy.GetEntity(), thrower);
copyIterator.remove();
AddGems(thrower, 3, "Revived Ally", true, true);
+
+ Bukkit.getPluginManager().callEvent(new HumanReviveEvent(thrower, copy.GetPlayer()));
}
- //Revive
- for (Player player : GetPlayers(true))
- {
- GameTeam otherTeam = GetTeam(player);
- if (otherTeam == null || !otherTeam.equals(throwerTeam))
- continue;
-
- if (UtilMath.offset(player.getLocation().add(0,1,0), event.getEntity().getLocation()) > 3)
- continue;
-
- playerIn(player, null);
- }
+ // Revive a player
+// for (Player player : GetPlayers(true))
+// {
+// GameTeam otherTeam = GetTeam(player);
+// if (otherTeam == null || !otherTeam.equals(throwerTeam))
+// continue;
+//
+// if (UtilMath.offset(player.getLocation().add(0, 1, 0), event
+// .getEntity().getLocation()) > 3)
+// continue;
+//
+// playerIn(player, null, thrower);
+// }
}
-
+
@EventHandler
public void removePotionEffect(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
return;
-
+
for (Player player : GetPlayers(true))
player.removePotionEffect(PotionEffectType.WATER_BREATHING);
}
-
+
@EventHandler
public void skeletonDamage(CustomDamageEvent event)
{
@@ -654,7 +933,7 @@ public class WitherGame extends TeamGame implements IBlockRestorer
}
}
}
-
+
@EventHandler
public void skeletonCombust(EntityCombustEvent event)
{
diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wither/events/HumanReviveEvent.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wither/events/HumanReviveEvent.java
new file mode 100644
index 000000000..6cc0be5e6
--- /dev/null
+++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wither/events/HumanReviveEvent.java
@@ -0,0 +1,36 @@
+package nautilus.game.arcade.game.games.wither.events;
+
+import org.bukkit.entity.Player;
+import org.bukkit.event.HandlerList;
+import org.bukkit.event.player.PlayerEvent;
+
+public class HumanReviveEvent extends PlayerEvent
+{
+ private static final HandlerList handlers = new HandlerList();
+
+ public static HandlerList getHandlerList()
+ {
+ return handlers;
+ }
+
+ @Override
+ public HandlerList getHandlers()
+ {
+ return getHandlerList();
+ }
+
+ private final Player _revivedPlayer;
+
+ public HumanReviveEvent(Player who, Player revivedPlayer)
+ {
+ super(who);
+
+ _revivedPlayer = revivedPlayer;
+ }
+
+ public Player getRevivedPlayer()
+ {
+ return _revivedPlayer;
+ }
+
+}
diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wither/kit/KitHumanArcher.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wither/kit/KitHumanArcher.java
index 5fb97dbe3..bfdbbb8ba 100644
--- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wither/kit/KitHumanArcher.java
+++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wither/kit/KitHumanArcher.java
@@ -24,22 +24,20 @@ public class KitHumanArcher extends Kit
{
public KitHumanArcher(ArcadeManager manager)
{
- super(manager, "Human Archer", KitAvailability.Free,
+ super(manager, "Human Archer", KitAvailability.Free,
- new String[]
- {
- ""
- },
+ new String[]
+ {
+ ""
+ },
- new Perk[]
- {
+ new Perk[]
+ {
new PerkDoubleJump("Double Jump", 1.2, 1, true, 4000, true),
new PerkWitherArrowBlind(6),
new PerkFletcher(4, 4, true),
-
- },
- EntityType.ZOMBIE,
- null);
+
+ }, EntityType.ZOMBIE, null);
}
@@ -48,20 +46,20 @@ public class KitHumanArcher extends Kit
{
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD));
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.BOW));
-
- ItemStack potion = new ItemStack(Material.POTION, 2, (short)16429); // 16422
- PotionMeta potionMeta = (PotionMeta)potion.getItemMeta();
+
+ ItemStack potion = new ItemStack(Material.POTION, 2, (short) 16429); // 16422
+ PotionMeta potionMeta = (PotionMeta) potion.getItemMeta();
potionMeta.setDisplayName(ChatColor.RESET + "Revival Potion");
potion.setItemMeta(potionMeta);
player.getInventory().addItem(potion);
-
+
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP));
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP));
}
-
+
@Override
- public void SpawnCustom(LivingEntity ent)
+ public void SpawnCustom(LivingEntity ent)
{
-
+
}
}
diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wither/kit/KitHumanEditor.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wither/kit/KitHumanEditor.java
new file mode 100644
index 000000000..25c0098b1
--- /dev/null
+++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wither/kit/KitHumanEditor.java
@@ -0,0 +1,50 @@
+package nautilus.game.arcade.game.games.wither.kit;
+
+import mineplex.core.common.util.C;
+import mineplex.core.itemstack.ItemStackFactory;
+import nautilus.game.arcade.ArcadeManager;
+import nautilus.game.arcade.kit.Kit;
+import nautilus.game.arcade.kit.KitAvailability;
+import nautilus.game.arcade.kit.Perk;
+import nautilus.game.arcade.kit.perks.PerkDoubleJump;
+
+import org.bukkit.ChatColor;
+import org.bukkit.Material;
+import org.bukkit.entity.EntityType;
+import org.bukkit.entity.Player;
+import org.bukkit.inventory.ItemStack;
+import org.bukkit.inventory.meta.PotionMeta;
+
+public class KitHumanEditor extends Kit
+{
+ public KitHumanEditor(ArcadeManager manager)
+ {
+ super(manager, "Human Editor", KitAvailability.Gem, 5000,
+ new String[]
+ {
+ " ", "Can " + C.cYellow + "Edit " + C.cGray + "the terrain to they and their comrade's benefits", " "
+ },
+ new Perk[]
+ {
+ new PerkDoubleJump("Double Jump", 1, 0.8, true, 6000, true),
+ },
+ EntityType.ZOMBIE, new ItemStack(Material.STONE_PICKAXE));
+ }
+
+ @Override
+ public void GiveItems(Player player)
+ {
+ player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.STONE_AXE));
+ player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.STONE_PICKAXE));
+ player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.STONE_SPADE));
+
+ ItemStack potion = new ItemStack(Material.POTION, 2, (short) 16429); // 16422
+ PotionMeta potionMeta = (PotionMeta) potion.getItemMeta();
+ potionMeta.setDisplayName(ChatColor.RESET + "Revival Potion");
+ potion.setItemMeta(potionMeta);
+ player.getInventory().addItem(potion);
+
+ player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP));
+ player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP));
+ }
+}
diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wither/kit/KitHumanBuilder.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wither/kit/KitHumanMedic.java
similarity index 86%
rename from Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wither/kit/KitHumanBuilder.java
rename to Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wither/kit/KitHumanMedic.java
index d6c168aa4..095fcbb97 100644
--- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wither/kit/KitHumanBuilder.java
+++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wither/kit/KitHumanMedic.java
@@ -18,12 +18,13 @@ import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.perks.PerkBlockRestorer;
import nautilus.game.arcade.kit.perks.PerkDoubleJump;
import nautilus.game.arcade.kit.perks.PerkIronShell;
+import nautilus.game.arcade.kit.perks.PerkWitherMedicRefill;
-public class KitHumanBuilder extends Kit
+public class KitHumanMedic extends Kit
{
- public KitHumanBuilder(ArcadeManager manager)
+ public KitHumanMedic(ArcadeManager manager)
{
- super(manager, "Human Builder", KitAvailability.Free,
+ super(manager, "Human Medic", KitAvailability.Gem, 2000,
new String[]
{
@@ -33,7 +34,7 @@ public class KitHumanBuilder extends Kit
new Perk[]
{
new PerkDoubleJump("Double Jump", 1, 0.8, true, 6000, true),
- new PerkIronShell(),
+ new PerkWitherMedicRefill(45, 1),
new PerkBlockRestorer()
},
EntityType.ZOMBIE,
@@ -45,7 +46,9 @@ public class KitHumanBuilder extends Kit
public void GiveItems(Player player)
{
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_AXE));
- player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_SPADE));
+
+ player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP));
+ player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP));
ItemStack potion = new ItemStack(Material.POTION, 2, (short)16429); // 16422
PotionMeta potionMeta = (PotionMeta)potion.getItemMeta();
@@ -53,8 +56,6 @@ public class KitHumanBuilder extends Kit
potion.setItemMeta(potionMeta);
player.getInventory().addItem(potion);
- player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP));
- player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP));
}
@Override
diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wither/kit/KitWitherMinion.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wither/kit/KitWitherMinion.java
index 72a3e93de..92c03e455 100644
--- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wither/kit/KitWitherMinion.java
+++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wither/kit/KitWitherMinion.java
@@ -26,57 +26,60 @@ public class KitWitherMinion extends Kit
{
public KitWitherMinion(ArcadeManager manager)
{
- super(manager, "Wither", KitAvailability.Free,
+ super(manager, "Wither", KitAvailability.Free,
- new String[]
- {
- ""
- },
+ new String[]
+ {
+ ""
+ },
- new Perk[]
- {
- new PerkWitherArrows(),
- new PerkWitherAttack(),
- new PerkWitherMinion()
- },
- EntityType.WITHER,
- null);
+ new Perk[]
+ {
+ new PerkWitherArrows(), new PerkWitherAttack(),
+ new PerkWitherMinion(), new PerkWitherCompassScent()
+ }, EntityType.WITHER, null);
}
-
-// @Override
-// public void SpawnCustom(LivingEntity ent)
-// {
-// ent.setMaxHealth(300);
-// ent.setHealth(300);
-//
-// DisguiseWither disguise = new DisguiseWither(ent);
-// disguise.SetName(C.cYellow + "Wither");
-// disguise.SetCustomNameVisible(true);
-// Manager.GetDisguise().disguise(disguise);
-// }
-
-
+
+ // @Override
+ // public void SpawnCustom(LivingEntity ent)
+ // {
+ // ent.setMaxHealth(300);
+ // ent.setHealth(300);
+ //
+ // DisguiseWither disguise = new DisguiseWither(ent);
+ // disguise.SetName(C.cYellow + "Wither");
+ // disguise.SetCustomNameVisible(true);
+ // Manager.GetDisguise().disguise(disguise);
+ // }
@Override
- public void GiveItems(Player player)
- {
- player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.GOLD_SWORD, (byte)0, 1,
- C.cYellow + C.Bold + "Left-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Wither Skull"));
-
- player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.DIAMOND_SWORD, (byte)0, 1,
- C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Skeletal Minions"));
-
- player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.COMPASS, (byte)0, 1,
- C.cYellow + C.Bold + "Human Finder X-9000"));
+ public void GiveItems(Player player)
+ {
+ player.getInventory().addItem(
+ ItemStackFactory.Instance.CreateStack(Material.GOLD_SWORD,
+ (byte) 0, 1, C.cYellow + C.Bold + "Left-Click"
+ + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold
+ + "Wither Skull"));
- //Disguise
+ player.getInventory().addItem(
+ ItemStackFactory.Instance.CreateStack(Material.DIAMOND_SWORD,
+ (byte) 0, 1, C.cYellow + C.Bold + "Right-Click"
+ + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold
+ + "Skeletal Minions"));
+
+ player.getInventory().addItem(
+ ItemStackFactory.Instance
+ .CreateStack(Material.COMPASS, (byte) 0, 1, C.cYellow
+ + C.Bold + "Human Finder X-9000"));
+
+ // Disguise
DisguiseWither disguise = new DisguiseWither(player);
- if (Manager.GetGame().GetTeam(player) != null)
- disguise.setName(Manager.GetGame().GetTeam(player).GetColor() + player.getName());
- else
- disguise.setName(player.getName());
+ if (Manager.GetGame().GetTeam(player) != null)
+ disguise.setName(Manager.GetGame().GetTeam(player).GetColor()
+ + player.getName());
+ else disguise.setName(player.getName());
disguise.setCustomNameVisible(true);
Manager.GetDisguise().disguise(disguise);
@@ -87,25 +90,25 @@ public class KitWitherMinion extends Kit
{
if (event.IsCancelled())
return;
-
+
Player player = event.GetDamageePlayer();
if (player == null)
return;
-
+
if (HasKit(player))
event.SetCancelled("Wither Immunity");
}
-
+
@EventHandler(priority = EventPriority.LOWEST)
public void witherMeleeCancel(CustomDamageEvent event)
{
if (event.IsCancelled())
return;
-
+
Player player = event.GetDamagerPlayer(true);
if (player == null)
return;
-
+
if (!HasKit(player))
return;
@@ -120,7 +123,7 @@ public class KitWitherMinion extends Kit
{
if (event.getType() != UpdateType.TICK)
return;
-
+
for (Player player : UtilServer.getPlayers())
{
if (!HasKit(player))
diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/privateServer/button/ChooseMapButton.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/privateServer/button/ChooseMapButton.java
new file mode 100644
index 000000000..1dbc380a9
--- /dev/null
+++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/privateServer/button/ChooseMapButton.java
@@ -0,0 +1,41 @@
+package nautilus.game.arcade.gui.privateServer.button;
+
+import org.bukkit.entity.Player;
+import org.bukkit.event.inventory.ClickType;
+
+import mineplex.core.shop.item.IButton;
+import nautilus.game.arcade.ArcadeManager;
+import nautilus.game.arcade.GameType;
+import nautilus.game.arcade.gui.privateServer.PrivateServerShop;
+
+/**
+ * Created by WilliamTiger.
+ * All the code and any API's associated with it
+ * are not to be used anywhere else without written
+ * consent of William Burns. 2015.
+ * 08/07/2015
+ */
+public class ChooseMapButton implements IButton
+{
+ private ArcadeManager _arcadeManager;
+ private PrivateServerShop _privateServerShop;
+ private GameType _gameType;
+ private String _map;
+
+ public ChooseMapButton(ArcadeManager arcadeManager, PrivateServerShop privateServerShop, GameType gameType, String map)
+ {
+ _arcadeManager = arcadeManager;
+ _privateServerShop = privateServerShop;
+ _gameType = gameType;
+ _map = map;
+ }
+
+ @Override
+ public void onClick(Player player, ClickType clickType)
+ {
+ _arcadeManager.GetGameCreationManager().MapPref = _map;
+ _arcadeManager.GetGame().setGame(_gameType, player, true);
+ player.closeInventory();
+ return;
+ }
+}
diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/privateServer/button/GameVotingButton.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/privateServer/button/GameVotingButton.java
new file mode 100644
index 000000000..a3193d8f1
--- /dev/null
+++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/privateServer/button/GameVotingButton.java
@@ -0,0 +1,34 @@
+package nautilus.game.arcade.gui.privateServer.button;
+
+import org.bukkit.entity.Player;
+import org.bukkit.event.inventory.ClickType;
+
+import mineplex.core.shop.item.IButton;
+import nautilus.game.arcade.ArcadeManager;
+import nautilus.game.arcade.gui.privateServer.PrivateServerShop;
+import nautilus.game.arcade.gui.privateServer.page.GameVotingPage;
+
+/**
+ * Created by WilliamTiger.
+ * All the code and any API's associated with it
+ * are not to be used anywhere else without written
+ * consent of William Burns. 2015.
+ * 24/07/15
+ */
+public class GameVotingButton implements IButton
+{
+ private ArcadeManager _arcadeManager;
+ private PrivateServerShop _shop;
+
+ public GameVotingButton(ArcadeManager arcadeManager, PrivateServerShop shop)
+ {
+ _shop = shop;
+ _arcadeManager = arcadeManager;
+ }
+
+ @Override
+ public void onClick(Player player, ClickType clickType)
+ {
+ _shop.openPageForPlayer(player, new GameVotingPage(_arcadeManager, _shop, player));
+ }
+}
diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/privateServer/button/WhitelistButton.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/privateServer/button/WhitelistButton.java
new file mode 100644
index 000000000..768b4013f
--- /dev/null
+++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/privateServer/button/WhitelistButton.java
@@ -0,0 +1,34 @@
+package nautilus.game.arcade.gui.privateServer.button;
+
+import org.bukkit.entity.Player;
+import org.bukkit.event.inventory.ClickType;
+
+import mineplex.core.shop.item.IButton;
+import nautilus.game.arcade.ArcadeManager;
+import nautilus.game.arcade.gui.privateServer.PrivateServerShop;
+import nautilus.game.arcade.gui.privateServer.page.WhitelistedPage;
+
+/**
+ * Created by WilliamTiger.
+ * All the code and any API's associated with it
+ * are not to be used anywhere else without written
+ * consent of William Burns. 2015.
+ * 29/07/15
+ */
+public class WhitelistButton implements IButton
+{
+ private ArcadeManager _arcadeManager;
+ private PrivateServerShop _shop;
+
+ public WhitelistButton(ArcadeManager arcadeManager, PrivateServerShop shop)
+ {
+ _shop = shop;
+ _arcadeManager = arcadeManager;
+ }
+
+ @Override
+ public void onClick(Player player, ClickType clickType)
+ {
+ _shop.openPageForPlayer(player, new WhitelistedPage(_arcadeManager, _shop, player));
+ }
+}
diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/privateServer/page/BasePage.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/privateServer/page/BasePage.java
index f0bdac9d9..fe3555ce8 100644
--- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/privateServer/page/BasePage.java
+++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/privateServer/page/BasePage.java
@@ -44,6 +44,18 @@ public abstract class BasePage extends ShopPageBase enabledGames = getPlugin().GetServerConfig().GameList;
+ //Old code I'm not removing in-case the old style is wanted. - William
+ /*
int arcadeSlot = 9;
int classicSlot = 13;
int survivalSlot = 15;
@@ -64,13 +68,40 @@ public class EditRotationPage extends BasePage
addGameButton(slot, type, enabledGames.contains(type));
}
+ */
+
+ ArrayList allowedCats = new ArrayList();
+ allowedCats.add(GameCategory.ARCADE);
+ allowedCats.add(GameCategory.CLASSICS);
+ allowedCats.add(GameCategory.SURVIVAL);
+ allowedCats.add(GameCategory.CHAMPIONS);
+ allowedCats.add(GameCategory.EXTRA);
+ allowedCats.add(GameCategory.TEAM_VARIANT);
+
+ int gameSlot = 9;
+ for (GameCategory cat : _manager.getGames(getPlayer()).keySet())
+ {
+ if (!allowedCats.contains(cat))
+ continue;
+
+ for (GameType type : _manager.getGames(getPlayer()).get(cat))
+ {
+ addGameButton(gameSlot, type, enabledGames.contains(type));
+ gameSlot++;
+ }
+ }
}
private void addGameButton(int slot, final GameType type, boolean enabled)
{
- String titleString = ChatColor.RESET + (enabled ? C.cGreen : C.cRed) + ChatColor.BOLD + type.GetLobbyName();
+ String titleString = ChatColor.RESET + (enabled ? C.cGreen : C.cRed) + ChatColor.BOLD + type.GetName();
String infoString = ChatColor.RESET + C.cGray + (enabled ? "Click to Disable" : "Click to Enable");
- ShopItem shopItem = new ShopItem(type.GetMaterial(), type.GetMaterialData(), titleString, new String[]{infoString}, 1, false, false);
+ String[] lore = new String[]{infoString};
+ if (_manager.hasWarning().contains(type))
+ {
+ lore = new String[]{infoString, "§1", "§c§lWARNING: §fThis game was rejected!"};
+ }
+ ShopItem shopItem = new ShopItem(type.GetMaterial(), type.GetMaterialData(), titleString, lore, 1, false, false);
int itemCount = enabled ? 1 : 0;
addButtonFakeCount(slot, shopItem, new IButton()
diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/privateServer/page/GameVotingPage.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/privateServer/page/GameVotingPage.java
new file mode 100644
index 000000000..dbb24a7b1
--- /dev/null
+++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/privateServer/page/GameVotingPage.java
@@ -0,0 +1,174 @@
+package nautilus.game.arcade.gui.privateServer.page;
+
+import java.util.ArrayList;
+
+import org.bukkit.Material;
+import org.bukkit.Sound;
+import org.bukkit.entity.Player;
+import org.bukkit.event.inventory.ClickType;
+
+import mineplex.core.common.util.F;
+import mineplex.core.common.util.UtilPlayer;
+import mineplex.core.common.util.UtilServer;
+import mineplex.core.game.GameCategory;
+import mineplex.core.shop.item.IButton;
+import mineplex.core.shop.item.ShopItem;
+import nautilus.game.arcade.ArcadeManager;
+import nautilus.game.arcade.GameType;
+import nautilus.game.arcade.gui.privateServer.PrivateServerShop;
+
+/**
+ * Created by WilliamTiger.
+ * All the code and any API's associated with it
+ * are not to be used anywhere else without written
+ * consent of William Burns. 2015.
+ * 24/07/15
+ */
+public class GameVotingPage extends BasePage
+{
+ public GameVotingPage(ArcadeManager plugin, PrivateServerShop shop, Player player)
+ {
+ super(plugin, shop, "Game Voting Menu", player, 54);
+ buildPage();
+ }
+
+ @Override
+ protected void buildPage()
+ {
+ boolean host = getPlugin().GetGameHostManager().isHost(getPlayer());
+
+ if (host)
+ {
+ addBackButton(4);
+ addStartVoteButton(0);
+ addEndVoteButton(8);
+ }
+ else
+ {
+ addCloseButton(4);
+ }
+
+ ArrayList allowedCats = new ArrayList();
+ allowedCats.add(GameCategory.ARCADE);
+ allowedCats.add(GameCategory.CLASSICS);
+ allowedCats.add(GameCategory.SURVIVAL);
+ allowedCats.add(GameCategory.CHAMPIONS);
+ allowedCats.add(GameCategory.EXTRA);
+ allowedCats.add(GameCategory.TEAM_VARIANT);
+
+ int gameSlot = 9;
+ for (GameCategory cat : _manager.getGames(getPlayer()).keySet())
+ {
+ if (!allowedCats.contains(cat))
+ continue;
+
+ for (GameType type : _manager.getGames(getPlayer()).get(cat))
+ {
+ addGameButton(gameSlot, type);
+ gameSlot++;
+ }
+ }
+ }
+
+ private void addCloseButton(int slot)
+ {
+ ShopItem item = new ShopItem(Material.BED, (byte)0, "§cClose Menu", new String[]{}, 1, false, false);
+ addButton(slot, item, new IButton()
+ {
+ @Override
+ public void onClick(Player player, ClickType clickType)
+ {
+ player.closeInventory();
+ }
+ });
+ }
+
+ private void addEndVoteButton(int slot)
+ {
+ ShopItem item = new ShopItem(Material.REDSTONE_BLOCK, (byte)0, "§c§lEnd Vote", new String[]{}, 1, false, false);
+ addButton(slot, item, new IButton()
+ {
+ @Override
+ public void onClick(Player player, ClickType clickType)
+ {
+ if (!_manager.isHost(player)) //Double Check...
+ return;
+
+ getPlugin().GetGameHostManager().setVoteInProgress(false);
+ for (Player p : UtilServer.getPlayers())
+ {
+ UtilPlayer.message(p, F.main("Vote", "The vote has ended!"));
+ }
+ refresh();
+ }
+ });
+ }
+
+ private void addStartVoteButton(int slot)
+ {
+ String warning = "§c§lWARNING: §fThis will reset current votes!";
+ ShopItem item = new ShopItem(Material.EMERALD_BLOCK, (byte)0, "Start Vote", new String[]{warning}, 1, false, false);
+ addButton(slot, item, new IButton()
+ {
+ @Override
+ public void onClick(Player player, ClickType clickType)
+ {
+ if (!_manager.isHost(player)) //Double Check...
+ return;
+
+ getPlugin().GetGameHostManager().setVoteInProgress(true);
+ getPlugin().GetGameHostManager().getVotes().clear();
+ for (Player p : UtilServer.getPlayers())
+ {
+ UtilPlayer.message(p, F.main("Vote", "A vote has started! Use " + F.skill("/vote") + " to vote."));
+ p.playSound(p.getLocation(), Sound.NOTE_BASS, 1F, 1F);
+ }
+ refresh();
+ }
+ });
+ }
+
+ private void addGameButton(int slot, final GameType type)
+ {
+ String click = "§7Click to vote for this Game Type";
+ int votes = 0;
+ for (GameType cur : getPlugin().GetGameHostManager().getVotes().values())
+ {
+ if (cur.equals(type))
+ votes++;
+ }
+ String curVotes = "§7Votes: §e" + votes;
+ String[] lore = new String[]{click, curVotes};
+ if (_manager.hasWarning().contains(type))
+ {
+ lore = new String[]{click, curVotes, "§1", "§c§lWARNING: §fThis game was rejected!"};
+ }
+ ShopItem item = new ShopItem(type.GetMaterial(), type.GetMaterialData(), type.GetName(), new String[]{click, curVotes}, 1, false, false);
+ if (votes >= 1)
+ {
+ addButton(slot, item, new IButton()
+ {
+ @Override
+ public void onClick(Player player, ClickType clickType)
+ {
+ getPlugin().GetGameHostManager().getVotes().put(player.getName(), type);
+ refresh();
+ }
+ });
+ return;
+ }
+ else
+ {
+ addButtonFakeCount(slot, item, new IButton()
+ {
+ @Override
+ public void onClick(Player player, ClickType clickType)
+ {
+ getPlugin().GetGameHostManager().getVotes().put(player.getName(), type);
+ refresh();
+ }
+ }, votes);
+ return;
+ }
+ }
+}
diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/privateServer/page/MenuPage.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/privateServer/page/MenuPage.java
index 5afc072b6..c24a31d78 100644
--- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/privateServer/page/MenuPage.java
+++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/privateServer/page/MenuPage.java
@@ -16,6 +16,7 @@ import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.gui.privateServer.PrivateServerShop;
import nautilus.game.arcade.gui.privateServer.button.BanButton;
import nautilus.game.arcade.gui.privateServer.button.EditRotationButton;
+import nautilus.game.arcade.gui.privateServer.button.GameVotingButton;
import nautilus.game.arcade.gui.privateServer.button.GiveAdminButton;
import nautilus.game.arcade.gui.privateServer.button.KillButton;
import nautilus.game.arcade.gui.privateServer.button.PlayerHeadButton;
@@ -25,12 +26,13 @@ import nautilus.game.arcade.gui.privateServer.button.OptionsButton;
import nautilus.game.arcade.gui.privateServer.button.StartGameButton;
import nautilus.game.arcade.gui.privateServer.button.StopGameButton;
import nautilus.game.arcade.gui.privateServer.button.UnbanButton;
+import nautilus.game.arcade.gui.privateServer.button.WhitelistButton;
public class MenuPage extends BasePage
{
public MenuPage(ArcadeManager plugin, PrivateServerShop shop, Player player)
{
- super(plugin, shop, "Private Server Menu", player, 9*3);
+ super(plugin, shop, "Private Server Menu", player, 9*4);
buildPage();
}
@@ -95,6 +97,12 @@ public class MenuPage extends BasePage
KillButton killButton = new KillButton(getPlugin());
addButton(8 + 18, new ShopItem(Material.TNT, "Kill Private Server",
new String[]{ChatColor.RESET + C.cGray + "Shift-Right Click to Kill Private Server"}, 1, false), killButton);
+
+ GameVotingButton votingButton = new GameVotingButton(getPlugin(), getShop());
+ addButton(3 + 27, new ShopItem(Material.BOOKSHELF, "Game Voting", new String[]{}, 1, false), votingButton);
+
+ WhitelistButton whitelistButton = new WhitelistButton(getPlugin(), getShop());
+ addButton(5 + 27, new ShopItem(Material.PAPER, "Whitelisted Players", new String[]{}, 1, false), whitelistButton);
}
OptionsButton optionsButton = new OptionsButton(getPlugin(), getShop());
diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/privateServer/page/OptionsPage.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/privateServer/page/OptionsPage.java
index 9247d2831..1b2eebcc5 100644
--- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/privateServer/page/OptionsPage.java
+++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/privateServer/page/OptionsPage.java
@@ -43,7 +43,7 @@ public class OptionsPage extends BasePage
}
});
- buildPreference(13, Material.PAPER, "Enforce Whitelist (Coming Soon)", false, new IButton()
+ buildPreference(13, Material.PAPER, "Enforce Whitelist", _config.PlayerServerWhitelist, new IButton()
{
@Override
public void onClick(Player player, ClickType clickType)
@@ -116,7 +116,9 @@ public class OptionsPage extends BasePage
private void toggleWhitelist()
{
- // TODO CHISSPIE
+ _config.PlayerServerWhitelist = !_config.PlayerServerWhitelist;
+ if (_config.PlayerServerWhitelist == true)
+ _config.PublicServer = false;
refresh();
}
@@ -138,6 +140,14 @@ public class OptionsPage extends BasePage
ChatColor.RED + " ",
ChatColor.RESET + "Click to " + (preference ? "Disable" : "Enable") };
+ if (name.equalsIgnoreCase("Enforce Whitelist"))
+ {
+ description = new String[] {
+ "" + (preference ? ChatColor.GREEN + "Enabled" : ChatColor.RED + "Disabled"),
+ ChatColor.RED + " ",
+ ChatColor.RESET + "Click to " + (preference ? "Disable" : "Enable"), "", "§7Use §a/whitelist §e" };
+ }
+
addButton(index, new ShopItem(material, data, (preference ? ChatColor.GREEN : ChatColor.RED) + name, description, 1, false, false), button);
addButton(index + 9, new ShopItem(Material.INK_SACK, (preference ? (byte) 10 : (byte) 8), (preference ? ChatColor.GREEN : ChatColor.RED) + name, description, 1, false, false), button);
}
diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/privateServer/page/SetGamePage.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/privateServer/page/SetGamePage.java
index b8ca9a28e..b17e0009e 100644
--- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/privateServer/page/SetGamePage.java
+++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/privateServer/page/SetGamePage.java
@@ -1,10 +1,14 @@
package nautilus.game.arcade.gui.privateServer.page;
+import java.util.ArrayList;
+import java.util.List;
+
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import mineplex.core.common.util.C;
+import mineplex.core.game.GameCategory;
import mineplex.core.shop.item.IButton;
import mineplex.core.shop.item.ShopItem;
import nautilus.game.arcade.ArcadeManager;
@@ -24,6 +28,8 @@ public class SetGamePage extends BasePage
{
addBackButton(4);
+ //Old code I'm not removing in-case you want the old style - William.
+ /*
int arcadeSlot = 9;
int classicSlot = 13;
int survivalSlot = 15;
@@ -58,19 +64,59 @@ public class SetGamePage extends BasePage
addGameButton(slot, type);
}
+ */
+
+ ArrayList allowedCats = new ArrayList();
+ allowedCats.add(GameCategory.ARCADE);
+ allowedCats.add(GameCategory.CLASSICS);
+ allowedCats.add(GameCategory.SURVIVAL);
+ allowedCats.add(GameCategory.CHAMPIONS);
+ allowedCats.add(GameCategory.EXTRA);
+ allowedCats.add(GameCategory.TEAM_VARIANT);
+
+ int gameSlot = 9;
+ for (GameCategory cat : _manager.getGames(getPlayer()).keySet())
+ {
+ if (!allowedCats.contains(cat))
+ continue;
+
+ for (GameType type : _manager.getGames(getPlayer()).get(cat))
+ {
+ addGameButton(gameSlot, type);
+ gameSlot++;
+ }
+ }
}
private void addGameButton(int slot, final GameType type)
{
- String infoString = ChatColor.RESET + C.cGray + "Click to make this next Game Type";
- ShopItem shopItem = new ShopItem(type.GetMaterial(), type.GetMaterialData(), type.GetLobbyName(), new String[]{infoString}, 1, false, false);
+ String infoString = ChatColor.RESET + C.cGray + "Make this next Game Type";
+ String space = "§1";
+ String left = ChatColor.YELLOW + "Left-Click " + C.cGray + "for a §fRandom Map§7.";
+ String right = ChatColor.YELLOW + "Right-Click " + C.cGray + "to §fChoose Map§7.";
+ String[] normLore = new String[]{infoString, space, left, right};
+ if (_manager.hasWarning().contains(type))
+ {
+ normLore = new String[]{infoString, space, left, right, "§2", "§c§lWARNING: §fThis game was rejected!"};
+ }
+ ShopItem shopItem = new ShopItem(type.GetMaterial(), type.GetMaterialData(), type.GetName(), normLore, 1, false, false);
addButton(slot, shopItem, new IButton()
{
@Override
public void onClick(Player player, ClickType clickType)
{
- getPlugin().GetGame().setGame(type, player, true);
- player.closeInventory();
+ if (clickType == ClickType.LEFT)
+ {
+ getPlugin().GetGame().setGame(type, player, true);
+ player.closeInventory();
+ return;
+ }
+ else if (clickType == ClickType.RIGHT)
+ {
+ getShop().openPageForPlayer(player, new ChooseMapPage(getPlugin(), getShop(), player, type));
+ return;
+ }
+
}
});
}
diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/privateServer/page/WhitelistedPage.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/privateServer/page/WhitelistedPage.java
new file mode 100644
index 000000000..4643fa21b
--- /dev/null
+++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/privateServer/page/WhitelistedPage.java
@@ -0,0 +1,45 @@
+package nautilus.game.arcade.gui.privateServer.page;
+
+import org.bukkit.entity.Player;
+
+import mineplex.core.common.util.F;
+import nautilus.game.arcade.ArcadeManager;
+import nautilus.game.arcade.gui.privateServer.PrivateServerShop;
+
+/**
+ * Created by WilliamTiger.
+ * All the code and any API's associated with it
+ * are not to be used anywhere else without written
+ * consent of William Burns. 2015.
+ * 29/07/15
+ */
+public class WhitelistedPage extends PlayerPage
+{
+ public WhitelistedPage(ArcadeManager plugin, PrivateServerShop shop, Player player)
+ {
+ super(plugin, shop, "Whitelisted Players", player);
+ buildPage();
+ }
+
+ @Override
+ public boolean showPlayer(Player player)
+ {
+ if (getPlugin().GetGameHostManager().getWhitelist().contains(player.getName()))
+ return true;
+ return false;
+ }
+
+ @Override
+ public void clicked(int slot, Player player)
+ {
+ getPlugin().GetGameHostManager().getWhitelist().remove(player.getName());
+ getPlugin().GetPortal().sendToHub(player, "You are no longer whitelisted.");
+ getPlayer().sendMessage(F.main("Whitelist", "§e" + player.getName() + " §7is no longer whitelisted."));
+ }
+
+ @Override
+ public String getDisplayString(Player player)
+ {
+ return "Click to remove from whitelist";
+ }
+}
diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkNeedler.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkNeedler.java
index e3d65cd81..ce4603693 100644
--- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkNeedler.java
+++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkNeedler.java
@@ -131,7 +131,10 @@ public class PerkNeedler extends SmashPerk
DamageCause.THORNS, 1.1, true, true, false,
damager.getName(), GetName());
- Manager.GetCondition().Factory().Poison(GetName(), event.GetDamageeEntity(), damager, 2, 0, false, false, false);
+ if(Manager.GetGame().GetTeam(event.GetDamageePlayer()) != Manager.GetGame().GetTeam(damager))
+ {
+ Manager.GetCondition().Factory().Poison(GetName(), event.GetDamageeEntity(), damager, 2, 0, false, false, false);
+ }
}
@EventHandler
diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWitherAttack.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWitherAttack.java
index 06a5c5b47..8609bcaac 100644
--- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWitherAttack.java
+++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWitherAttack.java
@@ -2,42 +2,21 @@ package nautilus.game.arcade.kit.perks;
import java.util.ArrayList;
import java.util.HashMap;
-import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
-import org.bukkit.Location;
-import org.bukkit.Material;
-import org.bukkit.Sound;
-import org.bukkit.block.Block;
-import org.bukkit.block.BlockFace;
-import org.bukkit.entity.Entity;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.entity.Player;
-import org.bukkit.entity.WitherSkull;
-import org.bukkit.event.EventHandler;
-import org.bukkit.event.EventPriority;
-import org.bukkit.event.block.Action;
-import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
-import org.bukkit.event.entity.EntityExplodeEvent;
-import org.bukkit.event.player.PlayerInteractEvent;
-import org.bukkit.util.Vector;
-
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
-import mineplex.core.common.util.UtilAction;
-import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilEvent;
+import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.core.common.util.UtilGear;
import mineplex.core.common.util.UtilParticle;
-import mineplex.core.common.util.UtilServer;
-import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist;
-import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilPlayer;
+import mineplex.core.common.util.UtilServer;
import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
@@ -45,6 +24,19 @@ import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.perks.data.IBlockRestorer;
+import org.bukkit.Material;
+import org.bukkit.Sound;
+import org.bukkit.block.Block;
+import org.bukkit.block.BlockFace;
+import org.bukkit.entity.LivingEntity;
+import org.bukkit.entity.Player;
+import org.bukkit.entity.WitherSkull;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.EventPriority;
+import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
+import org.bukkit.event.entity.EntityExplodeEvent;
+import org.bukkit.event.player.PlayerInteractEvent;
+
public class PerkWitherAttack extends Perk
{
private ArrayList _active = new ArrayList();
diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWitherCompassScent.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWitherCompassScent.java
new file mode 100644
index 000000000..2326d1380
--- /dev/null
+++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWitherCompassScent.java
@@ -0,0 +1,169 @@
+package nautilus.game.arcade.kit.perks;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map.Entry;
+
+import mineplex.core.common.util.C;
+import mineplex.core.common.util.UtilAlg;
+import mineplex.core.common.util.UtilEvent;
+import mineplex.core.common.util.UtilEvent.ActionType;
+import mineplex.core.common.util.UtilGear;
+import mineplex.core.common.util.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.hologram.Hologram;
+import mineplex.core.hologram.Hologram.HologramTarget;
+import mineplex.core.recharge.Recharge;
+import nautilus.game.arcade.kit.Perk;
+
+import org.bukkit.Location;
+import org.bukkit.Material;
+import org.bukkit.Sound;
+import org.bukkit.entity.Player;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.player.PlayerInteractEvent;
+import org.bukkit.scheduler.BukkitRunnable;
+import org.bukkit.util.Vector;
+
+public class PerkWitherCompassScent extends Perk
+{
+ public PerkWitherCompassScent()
+ {
+ super("Smell Humans", new String[]
+ {
+ C.cYellow + "Right-Click" + C.cGray + " with a compass to use " + C.cGreen + "Wither Scent"
+ });
+ }
+
+ @EventHandler
+ public void compassRightClick(PlayerInteractEvent event)
+ {
+ if(event.isCancelled())
+ return;
+
+ if(!UtilEvent.isAction(event, ActionType.R))
+ return;
+
+ if (!UtilGear.isMat(event.getPlayer().getItemInHand(), Material.COMPASS))
+ return;
+
+ if(!Kit.HasKit(event.getPlayer()))
+ return;
+
+ if (!Recharge.Instance.use(event.getPlayer(), GetName(), 30*1000, true, true))
+ return;
+
+ event.setCancelled(true);
+ Player player = event.getPlayer();
+
+ // Code from Wizards changed to WitherGame:
+ Location loc = player.getEyeLocation().subtract(0, 1, 0);
+
+ final ArrayList colors = new ArrayList();
+
+ for (int x = -1; x <= 1; x++)
+ {
+
+ for (int y = -1; y <= 1; y++)
+ {
+
+ for (int z = -1; z <= 1; z++)
+ {
+ colors.add(new Integer[]
+ {
+ x, y, z
+ });
+ }
+ }
+ }
+
+ Collections.shuffle(colors);
+
+ for (Player enemy : Manager.GetGame().GetPlayers(true))
+ {
+ if (enemy == player)
+ {
+ continue;
+ }
+
+ if(Manager.GetGame().GetTeam(enemy).GetName().contentEquals("Withers"))
+ {
+ continue;
+ }
+
+ final double playerDist = Math.min(7, UtilMath.offset(enemy, player));
+
+ final Vector traj = UtilAlg.getTrajectory(player.getLocation(), enemy.getEyeLocation()).multiply(0.1);
+
+ final Hologram hologram = new Hologram(Manager.GetGame().getArcadeManager().getHologramManager(), loc.clone().add(0, 0.3, 0)
+ .add(traj.clone().normalize().multiply(playerDist)), enemy.getName());
+
+ hologram.setHologramTarget(HologramTarget.WHITELIST);
+ hologram.addPlayer(player);
+
+ hologram.start();
+
+ final Location location = loc.clone();
+ final Integer[] ints = colors.remove(0);
+
+ new BukkitRunnable()
+ {
+ int dist;
+ int tick;
+ HashMap locations = new HashMap();
+
+ public void run()
+ {
+ tick++;
+
+ Iterator> itel = locations.entrySet().iterator();
+
+ while (itel.hasNext())
+ {
+ Entry entry = itel.next();
+
+ if ((entry.getValue() + tick) % 3 == 0)
+ {
+ // Colored redstone dust
+ UtilParticle.PlayParticle(ParticleType.RED_DUST, entry.getKey(), ints[0], ints[1], ints[2], 1, 0,
+ ViewDist.LONG, UtilServer.getPlayers());
+ }
+
+ if (entry.getValue() < tick)
+ {
+ itel.remove();
+ }
+ }
+
+ if (dist <= playerDist * 10)
+ {
+ for (int a = 0; a < 2; a++)
+ {
+ // Colored redstone dust
+ UtilParticle.PlayParticle(ParticleType.RED_DUST, location, ints[0], ints[1], ints[2], 1, 0,
+ ViewDist.LONG, UtilServer.getPlayers());
+
+ locations.put(location.clone(), tick + 50);
+
+ location.add(traj);
+ dist++;
+ }
+ }
+ else if (locations.isEmpty())
+ {
+ hologram.stop();
+ cancel();
+ }
+ }
+ }.runTaskTimer(Manager.GetGame().getArcadeManager().getPlugin(), 0, 0);
+ }
+
+ player.playSound(player.getLocation(), Sound.ZOMBIE_UNFECT, 1.5F, 1);
+
+ }
+}
diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWitherMedicRefill.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWitherMedicRefill.java
new file mode 100644
index 000000000..06a140e6c
--- /dev/null
+++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWitherMedicRefill.java
@@ -0,0 +1,73 @@
+package nautilus.game.arcade.kit.perks;
+
+import org.bukkit.ChatColor;
+import org.bukkit.Material;
+import org.bukkit.Sound;
+import org.bukkit.entity.Player;
+import org.bukkit.event.EventHandler;
+import org.bukkit.inventory.ItemStack;
+import org.bukkit.inventory.meta.PotionMeta;
+
+import mineplex.core.common.util.C;
+import mineplex.core.common.util.F;
+import mineplex.core.common.util.UtilInv;
+import mineplex.core.common.util.UtilServer;
+import mineplex.core.itemstack.ItemStackFactory;
+import mineplex.core.recharge.Recharge;
+import mineplex.core.updater.UpdateType;
+import mineplex.core.updater.event.UpdateEvent;
+import nautilus.game.arcade.kit.Perk;
+
+public class PerkWitherMedicRefill extends Perk
+{
+ private int _max = 0;
+ private int _time = 0;
+
+ public PerkWitherMedicRefill(int timeInSeconds, int max)
+ {
+ super("Healing Hands", new String[]
+ {
+ C.cGray + "Receive 1 healing bottle every " + timeInSeconds + " seconds if you're inventory is clearned from a bottle.",
+ });
+
+ this._time = timeInSeconds;
+ this._max = max;
+
+ }
+
+ @EventHandler
+ public void bottleRefill(UpdateEvent event)
+ {
+ if (event.getType() != UpdateType.FAST)
+ return;
+
+ for (Player player : UtilServer.getPlayers())
+ {
+ if (Manager.isSpectator(player))
+ continue;
+
+ if (!Kit.HasKit(player))
+ continue;
+
+ if (!Manager.GetGame().IsAlive(player))
+ continue;
+
+ if (!Recharge.Instance.use(player, GetName(), _time * 1000, false, false))
+ continue;
+
+ //Add
+ ItemStack potion = new ItemStack(Material.POTION, 1, (short)16429); // 16422
+ PotionMeta potionMeta = (PotionMeta)potion.getItemMeta();
+ potionMeta.setDisplayName(ChatColor.RESET + "Revival Potion");
+ potion.setItemMeta(potionMeta);
+
+ if (UtilInv.contains(player, "Revival Potion", Material.POTION, potion.getData().getData(), _max))
+ continue;
+
+ player.getInventory().addItem(potion);
+
+ player.playSound(player.getLocation(), Sound.ITEM_PICKUP, 2f, 1f);
+ }
+ }
+
+}
diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWitherMinion.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWitherMinion.java
index d58ec59ad..c0131bc41 100644
--- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWitherMinion.java
+++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWitherMinion.java
@@ -76,7 +76,7 @@ public class PerkWitherMinion extends Perk
Manager.GetGame().CreatureAllowOverride = true;
- for (int i=0 ; i<3 ; i++)
+ for (int i=0 ; i<2 ; i++)
{
Skeleton skel = player.getWorld().spawn(player.getEyeLocation(), Skeleton.class);
_ents.add(skel);
diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameChatManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameChatManager.java
index 0f8f37712..6eb27a139 100644
--- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameChatManager.java
+++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameChatManager.java
@@ -77,7 +77,7 @@ public class GameChatManager implements Listener
}
else if (Manager.GetGameHostManager().isAdmin(event.getPlayer(), false))
{
- if (Manager.GetGame() != null && Manager.GetGame().GetType() == GameType.Event)
+ if (Manager.GetGameHostManager().isEventServer())
rankStr = C.cDGreen + C.Bold + "Event Admin ";
else
rankStr = C.cDGreen + C.Bold + "MPS Admin ";
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 401309e95..955a6e8f8 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
@@ -37,6 +37,7 @@ public class GameCreationManager implements Listener
private ArrayList _lastGames = new ArrayList();
public String MapPref = null;
+ public String MapSource = null;
public GameCreationManager(ArcadeManager manager)
{
diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameGemManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameGemManager.java
index 3617ab6a1..844b78975 100644
--- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameGemManager.java
+++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameGemManager.java
@@ -30,7 +30,7 @@ public class GameGemManager implements Listener
{
ArcadeManager Manager;
- boolean DoubleGem = false;
+ boolean DoubleGem = true;
public GameGemManager(ArcadeManager manager)
{
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 cfd640b0c..fab9c7138 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
@@ -10,7 +10,9 @@ import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilGear;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
+import mineplex.core.common.util.UtilTextBottom;
import mineplex.core.common.util.UtilTime;
+import mineplex.core.game.GameCategory;
import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
@@ -18,6 +20,7 @@ import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType;
import nautilus.game.arcade.game.Game.GameState;
import nautilus.game.arcade.gui.privateServer.PrivateServerShop;
+import nautilus.game.arcade.gui.privateServer.page.GameVotingPage;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
@@ -32,6 +35,7 @@ import org.bukkit.event.inventory.InventoryType;
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerJoinEvent;
+import org.bukkit.event.player.PlayerLoginEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.plugin.Plugin;
@@ -61,6 +65,10 @@ public class GameHostManager implements Listener
private boolean _isEventServer = false;
private HashMap _permissionMap = new HashMap();
+
+ private boolean _voteInProgress = false;
+ private HashMap _votes = new HashMap