Merge branch 'master' of ssh://184.154.0.242:7999/min/Mineplex

This commit is contained in:
Jonathan Williams 2015-08-01 01:12:24 -05:00
commit 992c0fc36f
95 changed files with 6994 additions and 2707 deletions

View File

@ -18,6 +18,8 @@
<element id="extracted-dir" path="$PROJECT_DIR$/Libraries/gson-2.2.1.jar" path-in-jar="/" /> <element id="extracted-dir" path="$PROJECT_DIR$/Libraries/gson-2.2.1.jar" path-in-jar="/" />
<element id="module-output" name="Mineplex.Database" /> <element id="module-output" name="Mineplex.Database" />
<element id="extracted-dir" path="$PROJECT_DIR$/Libraries/jooq-3.5.2.jar" path-in-jar="/" /> <element id="extracted-dir" path="$PROJECT_DIR$/Libraries/jooq-3.5.2.jar" path-in-jar="/" />
<element id="extracted-dir" path="$PROJECT_DIR$/Libraries/org-apache-commons-lang.jar" path-in-jar="/" />
<element id="extracted-dir" path="$PROJECT_DIR$/Libraries/commons-dbcp2-2.0.1.jar" path-in-jar="/" />
</root> </root>
</artifact> </artifact>
</component> </component>

View File

@ -21,8 +21,34 @@
<profile default="true" name="Default" enabled="false"> <profile default="true" name="Default" enabled="false">
<processorPath useClasspath="true" /> <processorPath useClasspath="true" />
</profile> </profile>
<profile default="false" name="Annotation profile for hub" enabled="true">
<sourceOutputDir name="target/generated-sources/annotations" />
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
<outputRelativeToContentRoot value="true" />
<processorPath useClasspath="true" />
<module name="hub" />
</profile>
<profile default="false" name="Annotation profile for gameplay" enabled="true">
<sourceOutputDir name="target/generated-sources/annotations" />
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
<outputRelativeToContentRoot value="true" />
<processorPath useClasspath="true" />
<module name="gameplay" />
</profile>
<profile default="false" name="Annotation profile for common" enabled="true">
<sourceOutputDir name="target/generated-sources/annotations" />
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
<outputRelativeToContentRoot value="true" />
<processorPath useClasspath="true" />
<module name="common" />
</profile>
</annotationProcessing> </annotationProcessing>
<bytecodeTargetLevel target="1.7" /> <bytecodeTargetLevel target="1.7">
<module name="common" target="1.7" />
<module name="gameplay" target="1.7" />
<module name="hub" target="1.7" />
<module name="parent" target="1.7" />
</bytecodeTargetLevel>
</component> </component>
<component name="JavacSettings"> <component name="JavacSettings">
<option name="GENERATE_NO_WARNINGS" value="true" /> <option name="GENERATE_NO_WARNINGS" value="true" />

View File

@ -1,5 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="Encoding" useUTFGuessing="true" native2AsciiForPropertiesFiles="false" /> <component name="Encoding" useUTFGuessing="true" native2AsciiForPropertiesFiles="false">
<file url="file://$PROJECT_DIR$/ParkerFactions" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/ParkerFactions/common" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/ParkerFactions/gameplay" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/ParkerFactions/hub" charset="UTF-8" />
</component>
</project> </project>

View File

@ -7,6 +7,13 @@
</list> </list>
</component> </component>
<component name="IdProvider" IDEtalkID="7E81636CD93857493DFE224533ECF492" /> <component name="IdProvider" IDEtalkID="7E81636CD93857493DFE224533ECF492" />
<component name="MavenProjectsManager">
<option name="originalFiles">
<list>
<option value="$PROJECT_DIR$/ParkerFactions/pom.xml" />
</list>
</option>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" assert-keyword="true" jdk-15="true" project-jdk-name="1.7" project-jdk-type="JavaSDK"> <component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" assert-keyword="true" jdk-15="true" project-jdk-name="1.7" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" /> <output url="file://$PROJECT_DIR$/out" />
</component> </component>

View File

@ -18,6 +18,10 @@
<module fileurl="file://$PROJECT_DIR$/Mineplex.ServerData/Mineplex.ServerData.iml" filepath="$PROJECT_DIR$/Mineplex.ServerData/Mineplex.ServerData.iml" group="Core" /> <module fileurl="file://$PROJECT_DIR$/Mineplex.ServerData/Mineplex.ServerData.iml" filepath="$PROJECT_DIR$/Mineplex.ServerData/Mineplex.ServerData.iml" group="Core" />
<module fileurl="file://$PROJECT_DIR$/Mineplex.ServerMonitor/Mineplex.ServerMonitor.iml" filepath="$PROJECT_DIR$/Mineplex.ServerMonitor/Mineplex.ServerMonitor.iml" group="Core" /> <module fileurl="file://$PROJECT_DIR$/Mineplex.ServerMonitor/Mineplex.ServerMonitor.iml" filepath="$PROJECT_DIR$/Mineplex.ServerMonitor/Mineplex.ServerMonitor.iml" group="Core" />
<module fileurl="file://$PROJECT_DIR$/Nautilus.Game.Arcade/Nautilus.Game.Arcade.iml" filepath="$PROJECT_DIR$/Nautilus.Game.Arcade/Nautilus.Game.Arcade.iml" group="Game" /> <module fileurl="file://$PROJECT_DIR$/Nautilus.Game.Arcade/Nautilus.Game.Arcade.iml" filepath="$PROJECT_DIR$/Nautilus.Game.Arcade/Nautilus.Game.Arcade.iml" group="Game" />
<module fileurl="file://$PROJECT_DIR$/ParkerFactions/common/common.iml" filepath="$PROJECT_DIR$/ParkerFactions/common/common.iml" />
<module fileurl="file://$PROJECT_DIR$/ParkerFactions/gameplay/gameplay.iml" filepath="$PROJECT_DIR$/ParkerFactions/gameplay/gameplay.iml" />
<module fileurl="file://$PROJECT_DIR$/ParkerFactions/hub/hub.iml" filepath="$PROJECT_DIR$/ParkerFactions/hub/hub.iml" />
<module fileurl="file://$PROJECT_DIR$/ParkerFactions/parent.iml" filepath="$PROJECT_DIR$/ParkerFactions/parent.iml" />
</modules> </modules>
</component> </component>
</project> </project>

View File

@ -1,20 +1,20 @@
package mineplex.core.common; package mineplex.core.common;
import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilPlayer;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilPlayer;
public enum Rank public enum Rank
{ {
LT("LT", ChatColor.DARK_RED), LT("LT", ChatColor.DARK_RED),
OWNER("Owner", ChatColor.DARK_RED), OWNER("Owner", ChatColor.DARK_RED),
DEVELOPER("Dev", ChatColor.RED), DEVELOPER("Dev", ChatColor.RED),
ADMIN("Admin", ChatColor.RED), ADMIN("Admin", ChatColor.RED),
JNR_DEV("Jr.Dev", ChatColor.RED),
SNR_MODERATOR("Sr.Mod", ChatColor.GOLD), SNR_MODERATOR("Sr.Mod", ChatColor.GOLD),
MODERATOR("Mod", ChatColor.GOLD), MODERATOR("Mod", ChatColor.GOLD),
JNR_DEV("Jr.Dev", ChatColor.RED),
HELPER("Trainee", ChatColor.DARK_AQUA), HELPER("Trainee", ChatColor.DARK_AQUA),
MAPLEAD("MapLead", ChatColor.DARK_PURPLE), MAPLEAD("MapLead", ChatColor.DARK_PURPLE),
MAPDEV("Builder", ChatColor.BLUE), MAPDEV("Builder", ChatColor.BLUE),

View File

@ -1,7 +1,10 @@
package mineplex.core.common.util; package mineplex.core.common.util;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
public class UtilAction public class UtilAction
@ -37,6 +40,14 @@ public class UtilAction
//Velocity //Velocity
ent.setFallDistance(0); ent.setFallDistance(0);
//Debug
if (ent instanceof Player && UtilGear.isMat(((Player)ent).getItemInHand(), Material.SUGAR))
{
Bukkit.broadcastMessage(F.main("Debug", "Velocity Sent: " + vec.length()));
}
ent.setVelocity(vec); ent.setVelocity(vec);
} }
} }

View File

@ -7,6 +7,7 @@ import java.util.TreeSet;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -260,4 +261,96 @@ public class UtilAlg
return isInPyramid(player.getLocation().getDirection(), UtilAlg.getTrajectory(player.getEyeLocation(), target.getEyeLocation()), angleLimit) || return isInPyramid(player.getLocation().getDirection(), UtilAlg.getTrajectory(player.getEyeLocation(), target.getEyeLocation()), angleLimit) ||
isInPyramid(player.getLocation().getDirection(), UtilAlg.getTrajectory(player.getEyeLocation(), target.getLocation()), angleLimit); isInPyramid(player.getLocation().getDirection(), UtilAlg.getTrajectory(player.getEyeLocation(), target.getLocation()), angleLimit);
} }
public static Location getLocationAwayFromPlayers(ArrayList<Location> locs, ArrayList<Player> 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<Location> locs, ArrayList<Player> players, ArrayList<Player> 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;
}
} }

View File

@ -19,12 +19,20 @@ public class UpdateRank extends CommandBase<CoreClientManager>
{ {
public UpdateRank(CoreClientManager plugin) public UpdateRank(CoreClientManager plugin)
{ {
super(plugin, Rank.ADMIN, "updateRank"); super(plugin, Rank.ADMIN, new Rank[] {Rank.JNR_DEV /*On test servers only*/}, "updateRank");
} }
@Override @Override
public void Execute(final Player caller, String[] args) 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) if (args == null)
{ {
UtilPlayer.message(caller, F.main(Plugin.getName(), "/" + AliasUsed + " joeschmo MODERATOR")); UtilPlayer.message(caller, F.main(Plugin.getName(), "/" + AliasUsed + " joeschmo MODERATOR"));
@ -52,9 +60,9 @@ public class UpdateRank extends CommandBase<CoreClientManager>
final Rank rank = tempRank; 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!")); UtilPlayer.message(caller, F.main(Plugin.getName(), ChatColor.RED + "" + ChatColor.BOLD + "Insufficient privileges!"));
return; return;

View File

@ -56,7 +56,7 @@ public enum Achievement
//Survival Games //Survival Games
SURVIVAL_GAMES_WINS("Katniss Everdeen", 600, SURVIVAL_GAMES_WINS("Katniss Everdeen", 600,
new String[]{"Survival Games.Wins"}, new String[]{"Survival Games.Wins"},
new String[]{"Win 30 games of Survival Games"}, new String[]{"Win 20 games of Survival Games"},
new int[]{30}, new int[]{30},
AchievementCategory.SURVIVAL_GAMES), AchievementCategory.SURVIVAL_GAMES),
@ -87,7 +87,7 @@ public enum Achievement
//Skywars //Skywars
SKYWARS_WINS("Sky King",2000, SKYWARS_WINS("Sky King",2000,
new String[]{"Skywars.Wins"}, new String[]{"Skywars.Wins"},
new String[]{"Win 30 Games of Skywars"}, new String[]{"Win 20 Games of Skywars"},
new int[]{30}, new int[]{30},
AchievementCategory.SKYWARS), AchievementCategory.SKYWARS),

View File

@ -208,20 +208,22 @@ public class AchievementManager extends MiniPlugin
{ {
int level = get(sender, Achievement.GLOBAL_MINEPLEX_LEVEL).getLevel(); int level = get(sender, Achievement.GLOBAL_MINEPLEX_LEVEL).getLevel();
if (sender.getName().equalsIgnoreCase("Phinary") || sender.getName().equalsIgnoreCase("Horus")) if (sender.getName().equalsIgnoreCase("B2_mp"))
level = -level;
else if (sender.getName().equalsIgnoreCase("B2_mp"))
return 101; return 101;
else if (rank.Has(Rank.OWNER))
level = Math.max(level, 50 + get(sender, Achievement.GLOBAL_GEM_HUNTER).getLevel()); if (rank.Has(Rank.MODERATOR))
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))
level = Math.max(level, 5); 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); 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; return level;
} }

View File

@ -6,12 +6,14 @@ import java.util.List;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.entity.PlayerDeathEvent; import org.bukkit.event.entity.PlayerDeathEvent;
import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerMoveEvent; import org.bukkit.event.player.PlayerMoveEvent;
import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.event.player.PlayerToggleSneakEvent;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
import mineplex.core.MiniPlugin; import mineplex.core.MiniPlugin;
@ -430,4 +432,16 @@ public class GadgetManager extends MiniPlugin
return true; 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);
}
}
}
} }

View File

@ -51,7 +51,7 @@ public enum GameDisplay
SquidShooter("Squid Shooter", Material.FIREWORK_CHARGE, (byte)0, GameCategory.ARCADE, 43), SquidShooter("Squid Shooter", Material.FIREWORK_CHARGE, (byte)0, GameCategory.ARCADE, 43),
Stacker("Super Stacker", Material.BOWL, (byte)0, GameCategory.ARCADE, 42), Stacker("Super Stacker", Material.BOWL, (byte)0, GameCategory.ARCADE, 42),
SurvivalGames("Survival Games", Material.IRON_SWORD, (byte)0, GameCategory.SURVIVAL, 22), 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), Tug("Tug of Wool", Material.WHEAT, (byte)0, GameCategory.ARCADE, 44),
TurfWars("Turf Wars", Material.STAINED_CLAY, (byte)14, GameCategory.ARCADE, 45), TurfWars("Turf Wars", Material.STAINED_CLAY, (byte)14, GameCategory.ARCADE, 45),
UHC("Ultra Hardcore", Material.GOLDEN_APPLE, (byte)0, GameCategory.SURVIVAL, 46), 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), Build("Master Builders", Material.WOOD, (byte)0, GameCategory.CLASSICS, 50),
Cards("Craft Against Humanity", Material.MAP, (byte)0, GameCategory.CLASSICS, 51), 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); Event("Mineplex Event", Material.CAKE, (byte)0, GameCategory.EVENT, 999);

View File

@ -52,7 +52,6 @@ public class MountSheep extends HorseMount
DisguiseSheep disguise = new DisguiseSheep(horse); DisguiseSheep disguise = new DisguiseSheep(horse);
disguise.setName(player.getName(), Manager.getClientManager().Get(player).GetRank()); disguise.setName(player.getName(), Manager.getClientManager().Get(player).GetRank());
disguise.setCustomNameVisible(true);
//disguise.setColor(DyeColor.getByColor(org.bukkit.Color.fromRGB(100, 0, 200))); //disguise.setColor(DyeColor.getByColor(org.bukkit.Color.fromRGB(100, 0, 200)));
Manager.getDisguiseManager().disguise(disguise); Manager.getDisguiseManager().disguise(disguise);

View File

@ -48,7 +48,6 @@ public class MountSlime extends Mount<Slime>
mount.setSize(2); mount.setSize(2);
mount.setCustomName(player.getName() + "'s " + GetName()); mount.setCustomName(player.getName() + "'s " + GetName());
mount.setCustomNameVisible(true);
//Inform //Inform
UtilPlayer.message(player, F.main("Mount", "You spawned " + F.elem(GetName()) + ".")); UtilPlayer.message(player, F.main("Mount", "You spawned " + F.elem(GetName()) + "."));

View File

@ -45,8 +45,8 @@ public class NotificationManager extends MiniPlugin
// if (event.getType() == UpdateType.MIN_08) // if (event.getType() == UpdateType.MIN_08)
// hugeSale(); // hugeSale();
if (event.getType() == UpdateType.MIN_16) // if (event.getType() == UpdateType.MIN_16)
sale(); // sale();
} }
private void sale() private void sale()

View File

@ -12,7 +12,7 @@ public class HomeCommand extends CommandBase<NpcManager>
{ {
public HomeCommand(NpcManager plugin) public HomeCommand(NpcManager plugin)
{ {
super(plugin, Rank.DEVELOPER, "home"); super(plugin, Rank.DEVELOPER, new Rank[] {Rank.JNR_DEV}, "home");
} }
@Override @Override

View File

@ -10,7 +10,7 @@ public class NpcCommand extends MultiCommandBase<NpcManager>
{ {
public NpcCommand(NpcManager plugin) 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 AddCommand(plugin));
AddCommand(new DeleteCommand(plugin)); AddCommand(new DeleteCommand(plugin));

View File

@ -14,7 +14,7 @@ public class SendCommand extends CommandBase<Portal>
{ {
public SendCommand(Portal plugin) public SendCommand(Portal plugin)
{ {
super(plugin, Rank.ADMIN, "send"); super(plugin, Rank.ADMIN, new Rank[] {Rank.JNR_DEV}, "send");
} }
@Override @Override

View File

@ -261,7 +261,7 @@ public class PreferencesPage extends ShopPageBase<PreferencesManager, Preference
buildPreference(42, Material.SLIME_BALL, "Hub Forcefield", userPreferences.HubForcefield, _toggleHubForcefield); buildPreference(42, Material.SLIME_BALL, "Hub Forcefield", userPreferences.HubForcefield, _toggleHubForcefield);
buildPreference(44, Material.SADDLE, "Hub Ignore Velocity", userPreferences.IgnoreVelocity, _toggleHubIgnoreVelocity); buildPreference(44, Material.SADDLE, "Hub Ignore Velocity", userPreferences.IgnoreVelocity, _toggleHubIgnoreVelocity);
} }
if (getClientManager().Get(getPlayer()).GetRank().Has(Rank.ADMIN)) if (getClientManager().Get(getPlayer()).GetRank().Has(Rank.ADMIN) || getClientManager().Get(getPlayer()).GetRank() == Rank.JNR_DEV)
{ {
buildPreference(36, Material.NETHER_STAR, "Hub Invisibility", userPreferences.Invisibility, _toggleHubInvisibility); buildPreference(36, Material.NETHER_STAR, "Hub Invisibility", userPreferences.Invisibility, _toggleHubInvisibility);
buildPreference(38, Material.SLIME_BALL, "Hub Forcefield", userPreferences.HubForcefield, _toggleHubForcefield); buildPreference(38, Material.SLIME_BALL, "Hub Forcefield", userPreferences.HubForcefield, _toggleHubForcefield);

View File

@ -15,6 +15,7 @@ import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.HandlerList; import org.bukkit.event.HandlerList;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;
import org.bukkit.event.inventory.ClickType;
import org.bukkit.event.inventory.InventoryClickEvent; import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.event.inventory.InventoryCloseEvent; import org.bukkit.event.inventory.InventoryCloseEvent;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
@ -292,6 +293,20 @@ public class PunishPage extends CraftInventoryCustom implements Listener
}, 1, false, true), new PunishButton(this, Category.ChatOffense, 4, false, -1)); }, 1, false, true), new PunishButton(this, Category.ChatOffense, 4, false, -1));
} }
if (_plugin.GetClients().Get(_player).GetRank() == Rank.DEVELOPER || _plugin.GetClients().Get(_player).GetRank() == Rank.JNR_DEV)
{
ShopItem devWarning = new ShopItem(Material.YELLOW_FLOWER, "DEV WARNING", new String[] {ChatColor.RESET + "Developers are advised against using the punish system", ChatColor.RESET + "unless permitted by LT"}, 1, true, true);
devWarning.addGlow();
AddButton(0, devWarning, new IButton()
{
@Override
public void onClick(Player player, ClickType clickType)
{
}
});
}
Collections.sort(punishments, new PunishmentSorter()); Collections.sort(punishments, new PunishmentSorter());
int slot = 45; int slot = 45;

View File

@ -1,6 +1,7 @@
package mineplex.core.recharge; package mineplex.core.recharge;
import java.util.HashSet; import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList; import java.util.LinkedList;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -219,6 +220,26 @@ public class Recharge extends MiniPlugin
_recharge.put(player.getName(), new NautHashMap<String, RechargeData>()); _recharge.put(player.getName(), new NautHashMap<String, RechargeData>());
} }
public void Reset(Player player, String stringContains)
{
NautHashMap<String, RechargeData> data = _recharge.get(player.getName());
if (data == null)
return;
Iterator<String> 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) public void debug(Player player, String ability)
{ {
if (!_recharge.containsKey(player.getName())) if (!_recharge.containsKey(player.getName()))

View File

@ -71,7 +71,7 @@ public class TimeCommand extends CommandBase<StatsManager>
else else
{ {
long time = Plugin.Get(target).getStat("Global.TimeInGame"); 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"));
} }
} }
} }

View File

@ -10,7 +10,7 @@ public class HereCommand extends CommandBase<Teleport>
{ {
public HereCommand(Teleport plugin) public HereCommand(Teleport plugin)
{ {
super(plugin, Rank.ADMIN, "here", "h"); super(plugin, Rank.ADMIN, new Rank[] {Rank.JNR_DEV}, "here", "h");
} }
@Override @Override

View File

@ -15,7 +15,7 @@ public class RestartServerCommand extends CommandBase<FileUpdater>
{ {
public RestartServerCommand(FileUpdater plugin) public RestartServerCommand(FileUpdater plugin)
{ {
super(plugin, Rank.ADMIN, "restart"); super(plugin, Rank.ADMIN, new Rank[] {Rank.JNR_DEV}, "restart");
} }
@Override @Override

View File

@ -495,7 +495,10 @@ public class HubManager extends MiniClientPlugin<HubClient>
@EventHandler(priority = EventPriority.LOW) @EventHandler(priority = EventPriority.LOW)
public void AdminOP(PlayerJoinEvent event) 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); event.getPlayer().setOp(true);
else else
event.getPlayer().setOp(false); event.getPlayer().setOp(false);

View File

@ -10,7 +10,7 @@ public class GadgetToggle extends CommandBase<HubManager>
{ {
public GadgetToggle(HubManager plugin) public GadgetToggle(HubManager plugin)
{ {
super(plugin, Rank.ADMIN, new String[] {"gadget"}); super(plugin, Rank.ADMIN, new Rank[] {Rank.JNR_DEV}, new String[] {"gadget"});
} }
@Override @Override

View File

@ -13,7 +13,7 @@ public class GameModeCommand extends CommandBase<HubManager>
{ {
public GameModeCommand(HubManager plugin) public GameModeCommand(HubManager plugin)
{ {
super(plugin, Rank.ADMIN, new String[] {"gm"}); super(plugin, Rank.ADMIN, new Rank[] {Rank.JNR_DEV}, new String[] {"gm"});
} }
@Override @Override

View File

@ -10,7 +10,7 @@ public class NewsCommand extends MultiCommandBase<HubManager>
{ {
public NewsCommand(HubManager plugin) 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 NewsAddCommand(plugin));
AddCommand(new NewsDeleteCommand(plugin)); AddCommand(new NewsDeleteCommand(plugin));

View File

@ -19,7 +19,7 @@ public class NewsListCommand extends CommandBase<HubManager>
{ {
public NewsListCommand(HubManager plugin) public NewsListCommand(HubManager plugin)
{ {
super(plugin, Rank.ADMIN, "list"); super(plugin, Rank.ADMIN, new Rank[] {Rank.JNR_DEV}, "list");
} }
@Override @Override

View File

@ -42,7 +42,7 @@ public class ForcefieldManager extends MiniPlugin
for (Player player : UtilServer.getPlayers()) 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()) for (Player other : UtilServer.getPlayers())
{ {
@ -56,7 +56,7 @@ public class ForcefieldManager extends MiniPlugin
if (UtilMath.offset(other, player) > range) if (UtilMath.offset(other, player) > range)
continue; 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; continue;
if (Recharge.Instance.use(other, "Forcefield Bump", 500, false, false)) if (Recharge.Instance.use(other, "Forcefield Bump", 500, false, false))

View File

@ -341,7 +341,7 @@ public class ClientClass
if (notify) if (notify)
{ {
ListSkills(_client.GetPlayer()); 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) + ".")); _client.GetPlayer().sendMessage(F.main("Class", "You equipped " + F.skill(customBuild.Name) + "."));
} }

View File

@ -41,6 +41,7 @@ import org.bukkit.event.EventPriority;
import org.bukkit.event.entity.EntityDamageByEntityEvent; import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.event.entity.EntityDamageEvent; import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.player.PlayerVelocityEvent;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
@ -390,11 +391,22 @@ public class DamageManager extends MiniPlugin
trajectory.multiply(0.6 * knockback); trajectory.multiply(0.6 * knockback);
trajectory.setY(Math.abs(trajectory.getY())); trajectory.setY(Math.abs(trajectory.getY()));
//Apply //Debug
UtilAction.velocity(event.GetDamageeEntity(), if (event.GetDamageeEntity() instanceof Player && UtilGear.isMat(((Player)event.GetDamageeEntity()).getItemInHand(), Material.SUGAR))
trajectory, 0.2 + trajectory.length() * 0.8, false, 0, Math.abs(0.2 * knockback), 0.4 + (0.04 * knockback), true); {
} 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) 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) private void DisplayDamage(CustomDamageEvent event)
{ {
for (Player player : UtilServer.getPlayers()) for (Player player : UtilServer.getPlayers())
{ {
if (!UtilGear.isMat(player.getItemInHand(), Material.BOOK)) if (!UtilGear.isMat(player.getItemInHand(), Material.COMMAND))
continue; continue;
UtilPlayer.message(player, " "); UtilPlayer.message(player, " ");

View File

@ -1,5 +1,6 @@
package nautilus.game.arcade; package nautilus.game.arcade;
import java.awt.Event;
import java.io.File; import java.io.File;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashSet; 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.Game.GameState;
import nautilus.game.arcade.game.GameServerConfig; import nautilus.game.arcade.game.GameServerConfig;
import nautilus.game.arcade.game.GameTeam; 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.game.games.uhc.UHC;
import nautilus.game.arcade.managers.GameAchievementManager; import nautilus.game.arcade.managers.GameAchievementManager;
import nautilus.game.arcade.managers.GameChatManager; import nautilus.game.arcade.managers.GameChatManager;
@ -143,6 +145,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation
private Creature _creature; private Creature _creature;
private DamageManager _damageManager; private DamageManager _damageManager;
private Explosion _explosionManager; private Explosion _explosionManager;
private EventModule _eventManager;
private Fire _fire; private Fire _fire;
private ProjectileManager _projectileManager; private ProjectileManager _projectileManager;
@ -257,6 +260,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation
_cosmeticManager = cosmeticManager; _cosmeticManager = cosmeticManager;
_portal = portal; _portal = portal;
_petManager = petManager; _petManager = petManager;
_eventManager = new EventModule(this, getPlugin());
// Shop // Shop
_arcadeShop = new ArcadeShop(this, clientManager, donationManager); _arcadeShop = new ArcadeShop(this, clientManager, donationManager);
@ -562,6 +566,11 @@ public class ArcadeManager extends MiniPlugin implements IRelation
return _gameWorldManager; return _gameWorldManager;
} }
public EventModule GetEventModule()
{
return _eventManager;
}
public PreferencesManager getPreferences() public PreferencesManager getPreferences()
{ {
return _preferencesManager; return _preferencesManager;
@ -653,7 +662,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation
return; return;
} }
if (!GetServerConfig().PublicServer) if (!GetServerConfig().PublicServer || GetServerConfig().PlayerServerWhitelist)
{ {
event.setMotd(ChatColor.GRAY + "Private"); event.setMotd(ChatColor.GRAY + "Private");
return; 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."); event.disallow(PlayerLoginEvent.Result.KICK_OTHER, C.Bold + "Server has reached max capacity for gameplay purposes.");
return; 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.allow();
event.setResult(PlayerLoginEvent.Result.ALLOWED); 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) public boolean IsAlive(Player player)
{ {
if (_game == null) if (_game == null)

View File

@ -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.runner.Runner;
import nautilus.game.arcade.game.games.searchanddestroy.SearchAndDestroy; import nautilus.game.arcade.game.games.searchanddestroy.SearchAndDestroy;
import nautilus.game.arcade.game.games.sheep.SheepGame; import nautilus.game.arcade.game.games.sheep.SheepGame;
import nautilus.game.arcade.game.games.skywars.Skywars; import nautilus.game.arcade.game.games.skywars.SoloSkywars;
import nautilus.game.arcade.game.games.smash.SuperSmash; 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.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.snake.Snake;
import nautilus.game.arcade.game.games.sneakyassassins.SneakyAssassins; import nautilus.game.arcade.game.games.sneakyassassins.SneakyAssassins;
import nautilus.game.arcade.game.games.snowfight.SnowFight; 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.spleef.SpleefTeams;
import nautilus.game.arcade.game.games.squidshooter.SquidShooter; import nautilus.game.arcade.game.games.squidshooter.SquidShooter;
import nautilus.game.arcade.game.games.stacker.Stacker; import nautilus.game.arcade.game.games.stacker.Stacker;
import nautilus.game.arcade.game.games.survivalgames.SurvivalGames; import nautilus.game.arcade.game.games.survivalgames.SoloSurvivalGames;
import nautilus.game.arcade.game.games.survivalgames.SurvivalGamesTeams; import nautilus.game.arcade.game.games.survivalgames.TeamSurvivalGames;
import nautilus.game.arcade.game.games.tug.Tug; import nautilus.game.arcade.game.games.tug.Tug;
import nautilus.game.arcade.game.games.turfforts.TurfForts; import nautilus.game.arcade.game.games.turfforts.TurfForts;
import nautilus.game.arcade.game.games.uhc.UHC; import nautilus.game.arcade.game.games.uhc.UHC;
@ -70,7 +71,7 @@ public enum GameType
ChampionsDominate(ChampionsDominate.class, GameDisplay.ChampionsDominate), ChampionsDominate(ChampionsDominate.class, GameDisplay.ChampionsDominate),
//ChampionsMOBA(ChampionsMOBA.class, "Champions MOBA", "Champions", Material.SKULL_ITEM, (byte)0, GameCategory.CHAMPIONS, 7), //ChampionsMOBA(ChampionsMOBA.class, "Champions MOBA", "Champions", Material.SKULL_ITEM, (byte)0, GameCategory.CHAMPIONS, 7),
ChampionsTDM(ChampionsTDM.class, GameDisplay.ChampionsTDM), 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), DeathTag(DeathTag.class, GameDisplay.DeathTag),
DragonEscape(DragonEscape.class, GameDisplay.DragonEscape), DragonEscape(DragonEscape.class, GameDisplay.DragonEscape),
DragonEscapeTeams(DragonEscapeTeams.class, GameDisplay.DragonEscapeTeams), DragonEscapeTeams(DragonEscapeTeams.class, GameDisplay.DragonEscapeTeams),
@ -81,7 +82,7 @@ public enum GameType
Evolution(Evolution.class, GameDisplay.Evolution), Evolution(Evolution.class, GameDisplay.Evolution),
//FlappyBird(FlappyBird.class, "Flappy Bird", Material.FEATHER, (byte)0, GameCategory.ARCADE, 17), //FlappyBird(FlappyBird.class, "Flappy Bird", Material.FEATHER, (byte)0, GameCategory.ARCADE, 17),
Gravity(Gravity.class, GameDisplay.Gravity), 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), HideSeek(HideSeek.class, GameDisplay.HideSeek),
HoleInTheWall(HoleInTheWall.class, GameDisplay.HoleInTheWall), HoleInTheWall(HoleInTheWall.class, GameDisplay.HoleInTheWall),
Horse(Horse.class, GameDisplay.Horse), Horse(Horse.class, GameDisplay.Horse),
@ -98,9 +99,9 @@ public enum GameType
SearchAndDestroy(SearchAndDestroy.class, GameDisplay.SearchAndDestroy), SearchAndDestroy(SearchAndDestroy.class, GameDisplay.SearchAndDestroy),
Sheep(SheepGame.class, GameDisplay.Sheep), Sheep(SheepGame.class, GameDisplay.Sheep),
Smash(SuperSmash.class, GameDisplay.Smash), Smash(SoloSuperSmash.class, GameDisplay.Smash),
SmashDomination(SuperSmashDominate.class, GameDisplay.SmashDomination), 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), Snake(Snake.class, GameDisplay.Snake),
SneakyAssassins(SneakyAssassins.class, GameDisplay.SneakyAssassins), SneakyAssassins(SneakyAssassins.class, GameDisplay.SneakyAssassins),
SnowFight(SnowFight.class, GameDisplay.SnowFight), SnowFight(SnowFight.class, GameDisplay.SnowFight),
@ -108,23 +109,35 @@ public enum GameType
SpleefTeams(SpleefTeams.class, GameDisplay.SpleefTeams), SpleefTeams(SpleefTeams.class, GameDisplay.SpleefTeams),
SquidShooter(SquidShooter.class, GameDisplay.SquidShooter), SquidShooter(SquidShooter.class, GameDisplay.SquidShooter),
Stacker(Stacker.class, GameDisplay.Stacker), Stacker(Stacker.class, GameDisplay.Stacker),
SurvivalGames(SurvivalGames.class, GameDisplay.SurvivalGames), SurvivalGames(SoloSurvivalGames.class, GameDisplay.SurvivalGames),
SurvivalGamesTeams(SurvivalGamesTeams.class, GameDisplay.SurvivalGamesTeams), SurvivalGamesTeams(TeamSurvivalGames.class, GameDisplay.SurvivalGamesTeams, new GameType[]{GameType.SurvivalGames}, false),
Tug(Tug.class, GameDisplay.Tug), Tug(Tug.class, GameDisplay.Tug),
TurfWars(TurfForts.class, GameDisplay.TurfWars), TurfWars(TurfForts.class, GameDisplay.TurfWars),
UHC(UHC.class, GameDisplay.UHC), UHC(UHC.class, GameDisplay.UHC),
WitherAssault(WitherGame.class, GameDisplay.WitherAssault), WitherAssault(WitherGame.class, GameDisplay.WitherAssault),
Wizards(Wizards.class, GameDisplay.Wizards, "http://chivebox.com/file/c/ResWizards.zip", true), Wizards(Wizards.class, GameDisplay.Wizards, "http://chivebox.com/file/c/ResWizards.zip", true),
ZombieSurvival(ZombieSurvival.class, GameDisplay.ZombieSurvival), ZombieSurvival(ZombieSurvival.class, GameDisplay.ZombieSurvival),
Build(Build.class, GameDisplay.Build), Build(Build.class, GameDisplay.Build),
Cards(Cards.class, GameDisplay.Cards), 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; GameDisplay _display;
boolean _enforceResourcePack; boolean _enforceResourcePack;
GameType[] _mapSource;
boolean _ownMaps;
String _resourcePack; String _resourcePack;
Class<? extends Game> _gameClass; Class<? extends Game> _gameClass;
@ -133,15 +146,27 @@ public enum GameType
GameType(Class<? extends Game> gameClass, GameDisplay display) 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) 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; _display = display;
_gameClass = gameClass; _gameClass = gameClass;
_resourcePack = resourcePackUrl; _resourcePack = resourcePackUrl;
_enforceResourcePack = enforceResourcePack; _enforceResourcePack = enforceResourcePack;
_mapSource = mapSource;
_ownMaps = ownMaps;
} }
public Class<? extends Game> getGameClass() public Class<? extends Game> getGameClass()
@ -159,6 +184,16 @@ public enum GameType
return _resourcePack; return _resourcePack;
} }
public GameType[] getMapSource()
{
return _mapSource;
}
public boolean ownMaps()
{
return _ownMaps;
}
public String GetName() public String GetName()
{ {
return _display.getName(); return _display.getName();
@ -183,4 +218,5 @@ public enum GameType
{ {
return _display.getGameCategory(); return _display.getGameCategory();
} }
} }

View File

@ -3,9 +3,8 @@ package nautilus.game.arcade.command;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import nautilus.game.arcade.ArcadeManager;
import net.minecraft.util.com.mojang.authlib.GameProfile; import net.minecraft.util.com.mojang.authlib.GameProfile;
import mineplex.core.command.CommandBase; import mineplex.core.command.CommandBase;
import mineplex.core.common.Rank; import mineplex.core.common.Rank;
import mineplex.core.common.util.C; 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.UUIDFetcher;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
import mineplex.core.disguise.disguises.DisguisePlayer; import mineplex.core.disguise.disguises.DisguisePlayer;
import nautilus.game.arcade.ArcadeManager;
public class DisguiseCommand extends CommandBase<ArcadeManager> public class DisguiseCommand extends CommandBase<ArcadeManager>
{ {
public DisguiseCommand(ArcadeManager plugin) 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 @Override

View File

@ -25,7 +25,7 @@ public class GameCommand extends MultiCommandBase<ArcadeManager>
UtilPlayer.message(caller, F.main(Plugin.getName(), "Commands List:")); 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 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 stop", "Stop the current game", Rank.ADMIN));
UtilPlayer.message(caller, F.help("/game set <GameType> (Map)", "Set the current game or next game", Rank.ADMIN)); UtilPlayer.message(caller, F.help("/game set <GameType> (MapSource) (Map)", "Set the current game or next game", Rank.ADMIN));
UtilPlayer.message(caller, F.main("Tip", "Use TAB for games/maps!")); UtilPlayer.message(caller, F.main("Tip", "Use TAB for games/maps!"));
} }
} }

View File

@ -29,16 +29,31 @@ public class SetCommand extends CommandBase<ArcadeManager>
if (args == null || args.length == 0) if (args == null || args.length == 0)
{ {
caller.sendMessage(F.help("/game set <GameType> (Map)", "Set the current game or next game", Rank.ADMIN)); caller.sendMessage(F.help("/game set <GameType> (MapSource) (Map)", "Set the current game or next game", Rank.ADMIN));
return; return;
} }
String game = args[0].toLowerCase(); String game = args[0].toLowerCase();
if (args.length > 1) if (args.length >= 2)
{ {
Plugin.GetGameCreationManager().MapPref = args[1]; String map = "";
UtilPlayer.message(caller, C.cAqua + C.Bold + "Map Preference: " + ChatColor.RESET + args[1]); 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 //Parse Game

View File

@ -11,7 +11,7 @@ public class WriteCommand extends CommandBase<ArcadeManager>
{ {
public WriteCommand(ArcadeManager plugin) public WriteCommand(ArcadeManager plugin)
{ {
super(plugin, Rank.ADMIN, "write"); super(plugin, Rank.ADMIN, new Rank[] {Rank.JNR_DEV}, "write");
} }
@Override @Override

View File

@ -86,7 +86,7 @@ public abstract class Game implements Listener
protected String[] _gameDesc; protected String[] _gameDesc;
//Map //Map
private ArrayList<String> _files; private HashMap<GameType, ArrayList<String>> _files;
//State //State
private GameState _gameState = GameState.Loading; private GameState _gameState = GameState.Loading;
@ -193,8 +193,6 @@ public abstract class Game implements Listener
public int HungerSet = -1; public int HungerSet = -1;
public int HealthSet = -1; public int HealthSet = -1;
public int SpawnDistanceRequirement = 1;
public boolean PrepareFreeze = true; public boolean PrepareFreeze = true;
private double _itemMergeRadius = 0; private double _itemMergeRadius = 0;
@ -211,6 +209,11 @@ public abstract class Game implements Listener
public int TickPerTeleport = 1; public int TickPerTeleport = 1;
public int FillTeamsInOrderToCount = -1;
public boolean SpawnNearAllies = false;
public boolean SpawnNearEnemies = false;
public boolean StrictAntiHack = false; public boolean StrictAntiHack = false;
public boolean DisableKillCommand = true; public boolean DisableKillCommand = true;
@ -258,6 +261,9 @@ public abstract class Game implements Listener
public boolean CanAddStats = true; public boolean CanAddStats = true;
public boolean CanGiveLoot = true; public boolean CanGiveLoot = true;
public boolean HideTeamSheep = false;
public boolean ReplaceTeamsWithKits = false;
public boolean VersionRequire1_8 = false; public boolean VersionRequire1_8 = false;
public ArrayList<String> GemBoosters = new ArrayList<String>(); public ArrayList<String> GemBoosters = new ArrayList<String>();
@ -281,16 +287,28 @@ public abstract class Game implements Listener
Scoreboard = new GameScoreboard(this); Scoreboard = new GameScoreboard(this);
//Map Select //Map Select
_files = Manager.LoadFiles(GetName()); _files = new HashMap<GameType, ArrayList<String>>();
for(GameType type : GetWorldHostNames())
{
_files.put(type, Manager.LoadFiles(type.GetName()));
}
if (Manager.GetGameCreationManager().MapPref != null) if (Manager.GetGameCreationManager().MapPref != null)
{ {
ArrayList<String> matches = new ArrayList<String>(); HashMap<GameType, ArrayList<String>> matches = new HashMap<GameType, ArrayList<String>>();
for (String cur : _files) for (GameType game : _files.keySet())
{ {
if (cur.toLowerCase().contains(Manager.GetGameCreationManager().MapPref.toLowerCase())) ArrayList<String> list = new ArrayList<String>();
for(String cur : _files.get(game))
{ {
matches.add(cur); if (cur.toLowerCase().contains(Manager.GetGameCreationManager().MapPref.toLowerCase()))
System.out.print("Map Preference: " + cur); {
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; _files = matches;
Manager.GetGameCreationManager().MapPref = null; Manager.GetGameCreationManager().MapPref = null;
Manager.GetGameCreationManager().MapSource = null;
} }
WorldData = new WorldData(this); WorldData = new WorldData(this);
@ -332,7 +351,7 @@ public abstract class Game implements Listener
_kits = kits; _kits = kits;
} }
public ArrayList<String> GetFiles() public HashMap<GameType, ArrayList<String>> GetFiles()
{ {
return _files; return _files;
} }
@ -342,6 +361,60 @@ public abstract class Game implements Listener
return _gameType.GetName(); 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<String> maps)
{
for(GameType game : _files.keySet())
{
if(maps.equals(_files.get(game)))
{
return game;
}
}
return null;
}
public String GetMode() public String GetMode()
{ {
return null; return null;
@ -465,9 +538,6 @@ public abstract class Game implements Listener
//Add //Add
GetTeamList().add(team); GetTeamList().add(team);
//Set Spawn Data
team.SetSpawnRequirement(this.SpawnDistanceRequirement);
System.out.println("Created Team: " + team.GetName()); System.out.println("Created Team: " + team.GetName());
} }
@ -549,6 +619,17 @@ public abstract class Game implements Listener
public GameTeam ChooseTeam(Player player) 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; GameTeam team = null;
//Random Team //Random Team
@ -1365,4 +1446,5 @@ public abstract class Game implements Listener
//End //End
SetState(GameState.End); SetState(GameState.End);
} }
} }

View File

@ -37,6 +37,8 @@ public class GameServerConfig
public boolean PublicServer = true; public boolean PublicServer = true;
public boolean PlayerServerWhitelist = false;
public boolean IsValid() public boolean IsValid()
{ {
return ServerType != null && MinPlayers != -1 && MaxPlayers != -1; return ServerType != null && MinPlayers != -1 && MaxPlayers != -1;

View File

@ -5,8 +5,10 @@ import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.Iterator; import java.util.Iterator;
import mineplex.core.account.CoreClient;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilServer;
@ -65,14 +67,14 @@ public class GameTeam
private HashSet<Kit> _kitRestrict = new HashSet<Kit>(); private HashSet<Kit> _kitRestrict = new HashSet<Kit>();
private int _spawnDistance = 0;
private boolean _visible = true; private boolean _visible = true;
private boolean _displayTag;
//Records order players go out in //Records order players go out in
protected ArrayList<Player> _places = new ArrayList<Player>(); protected ArrayList<Player> _places = new ArrayList<Player>();
public GameTeam(Game host, String name, ChatColor color, ArrayList<Location> spawns) public GameTeam(Game host, String name, ChatColor color, ArrayList<Location> spawns, boolean tags)
{ {
Host = host; Host = host;
@ -80,6 +82,12 @@ public class GameTeam
_name = name; _name = name;
_color = color; _color = color;
_spawns = spawns; _spawns = spawns;
_displayTag = tags;
}
public GameTeam(Game host, String name, ChatColor color, ArrayList<Location> spawns)
{
this(host, name, color, spawns, false);
} }
public String GetName() public String GetName()
@ -99,40 +107,48 @@ public class GameTeam
public Location GetSpawn() public Location GetSpawn()
{ {
// ArrayList<Location> valid = new ArrayList<Location>(); //Keep allies together
if (!Host.IsLive() && Host.SpawnNearAllies)
Location best = null;
double bestDist = 0;
for (Location loc : _spawns)
{ {
double closestPlayer = -1; //Find Location Nearest Ally
Location loc = UtilAlg.getLocationNearPlayers(_spawns, GetPlayers(true), Host.GetPlayers(true));
if (loc != null)
return loc;
for (Player player : Host.GetPlayers(true)) //No allies existed spawned yet
//Spawn near enemies (used for SG)
if (Host.SpawnNearEnemies)
{ {
double playerDist = UtilMath.offsetSquared(player.getLocation(), loc); loc = UtilAlg.getLocationNearPlayers(_spawns, Host.GetPlayers(true), Host.GetPlayers(true));
if (loc != null)
if (closestPlayer == -1 || playerDist < closestPlayer) return loc;
closestPlayer = playerDist;
} }
//Spawn away from enemies
if (best == null || closestPlayer > bestDist) else
{ {
best = loc; loc = UtilAlg.getLocationAwayFromPlayers(_spawns, Host.GetPlayers(true));
bestDist = closestPlayer; 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 (closestPlayer > _spawnDistance * _spawnDistance)
// {
// valid.add(loc);
// }
} }
// if (valid.size() > 0)
// valid.get(UtilMath.r(valid.size()));
if (best != null)
return best;
return _spawns.get(UtilMath.r(_spawns.size())); return _spawns.get(UtilMath.r(_spawns.size()));
} }
@ -149,7 +165,14 @@ public class GameTeam
public void DisbandTeam() public void DisbandTeam()
{ {
for (Player player : _players.keySet()) 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.")); UtilPlayer.message(player, F.main("Team", _color + C.Bold + _displayName + " Team was disbanded."));
}
_players.clear(); _players.clear();
} }
@ -333,11 +356,6 @@ public class GameTeam
_spawns = spawns; _spawns = spawns;
} }
public void SetSpawnRequirement(int value)
{
_spawnDistance = value;
}
public void SetVisible(boolean b) public void SetVisible(boolean b)
{ {
_visible = b; _visible = b;
@ -348,6 +366,16 @@ public class GameTeam
return _visible; return _visible;
} }
public void setDisplayTag(boolean b)
{
_displayTag = b;
}
public boolean GetDisplaytag()
{
return _displayTag;
}
public void SetRespawnTime(double i) public void SetRespawnTime(double i)
{ {
_respawnTime = i; _respawnTime = i;
@ -390,6 +418,4 @@ public class GameTeam
return _places; return _places;
} }
} }

View File

@ -75,8 +75,6 @@ public class Evolution extends SoloGame
this.PrepareFreeze = false; this.PrepareFreeze = false;
this.SpawnDistanceRequirement = 16;
_scoreObj = Scoreboard.GetScoreboard().registerNewObjective("Evolutions", "dummy"); _scoreObj = Scoreboard.GetScoreboard().registerNewObjective("Evolutions", "dummy");
_scoreObj.setDisplaySlot(DisplaySlot.BELOW_NAME); _scoreObj.setDisplaySlot(DisplaySlot.BELOW_NAME);
} }

View File

@ -1927,14 +1927,7 @@ public class MineStrike extends TeamGame
{ {
player.playSound(player.getLocation(), Sound.LEVEL_UP, 1f, 1f); player.playSound(player.getLocation(), Sound.LEVEL_UP, 1f, 1f);
//Clear reloading things Recharge.Instance.Reset(player, "reload");
for (String recharge : Recharge.Instance.Get(player).keySet())
{
if (!recharge.toLowerCase().contains("reload"))
continue;
Recharge.Instance.recharge(player, recharge);
}
} }
UtilTextMiddle.display(null, winnerLine, 20, 120, 20); UtilTextMiddle.display(null, winnerLine, 20, 120, 20);

View File

@ -72,7 +72,6 @@ public class Quiver extends SoloGame
this.DamageSelf = false; this.DamageSelf = false;
this.DamageTeamSelf = true; this.DamageTeamSelf = true;
this.PrepareFreeze = false; this.PrepareFreeze = false;
this.SpawnDistanceRequirement = 16;
this.BlockBreakAllow.add(102); this.BlockBreakAllow.add(102);
this.BlockBreakAllow.add(20); this.BlockBreakAllow.add(20);

View File

@ -59,7 +59,6 @@ public class QuiverTeams extends TeamGame
this.DamageSelf = false; this.DamageSelf = false;
this.DamageTeamSelf = false; this.DamageTeamSelf = false;
this.PrepareFreeze = false; this.PrepareFreeze = false;
this.SpawnDistanceRequirement = 24;
this.BlockBreakAllow.add(102); this.BlockBreakAllow.add(102);
this.BlockBreakAllow.add(20); this.BlockBreakAllow.add(20);
this.BlockBreakAllow.add(18); this.BlockBreakAllow.add(18);

View File

@ -6,6 +6,7 @@ import java.util.HashSet;
import java.util.Iterator; import java.util.Iterator;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.MapUtil; import mineplex.core.common.util.MapUtil;
import mineplex.core.common.util.NautHashMap; import mineplex.core.common.util.NautHashMap;
import mineplex.core.common.util.UtilAction; 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;
import mineplex.core.common.util.UtilTime.TimeUnit; import mineplex.core.common.util.UtilTime.TimeUnit;
import mineplex.core.explosion.ExplosionEvent; import mineplex.core.explosion.ExplosionEvent;
import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.loot.ChestLoot; import mineplex.core.loot.ChestLoot;
import mineplex.core.loot.RandomItem; import mineplex.core.loot.RandomItem;
import mineplex.core.updater.UpdateType; 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.events.PlayerKillZombieEvent;
import nautilus.game.arcade.game.games.skywars.kits.KitChicken; 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.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.KitMiner;
import nautilus.game.arcade.game.games.skywars.kits.KitMadScientist;
import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.ore.OreHider; import nautilus.game.arcade.ore.OreHider;
import nautilus.game.arcade.stats.DeathBomberStatTracker; import nautilus.game.arcade.stats.DeathBomberStatTracker;
@ -65,6 +67,7 @@ import org.bukkit.entity.Chicken;
import org.bukkit.entity.Egg; import org.bukkit.entity.Egg;
import org.bukkit.entity.EnderPearl; import org.bukkit.entity.EnderPearl;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.entity.Item;
import org.bukkit.entity.LivingEntity; import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.entity.Projectile; 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.BlockSpreadEvent;
import org.bukkit.event.block.LeavesDecayEvent; import org.bukkit.event.block.LeavesDecayEvent;
import org.bukkit.event.entity.EntityCombustEvent; import org.bukkit.event.entity.EntityCombustEvent;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.entity.EntityDeathEvent; import org.bukkit.event.entity.EntityDeathEvent;
import org.bukkit.event.entity.EntityTargetLivingEntityEvent; import org.bukkit.event.entity.EntityTargetLivingEntityEvent;
import org.bukkit.event.entity.ExplosionPrimeEvent; import org.bukkit.event.entity.ExplosionPrimeEvent;
import org.bukkit.event.entity.ItemDespawnEvent; import org.bukkit.event.entity.ItemDespawnEvent;
import org.bukkit.event.entity.ProjectileHitEvent;
import org.bukkit.event.entity.ProjectileLaunchEvent; import org.bukkit.event.entity.ProjectileLaunchEvent;
import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerPickupItemEvent; import org.bukkit.event.player.PlayerPickupItemEvent;
@ -92,7 +97,7 @@ import org.bukkit.inventory.ItemStack;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
public class Skywars extends SoloGame public abstract class Skywars extends Game
{ {
//./parse 19 30 56 //./parse 19 30 56
@ -128,24 +133,21 @@ public class Skywars extends SoloGame
private ChestLoot _middleBlock = new ChestLoot(); private ChestLoot _middleBlock = new ChestLoot();
@SuppressWarnings("unchecked") @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 KitChicken(manager),
new KitMiner(manager), new KitMiner(manager),
new KitMadScientist(manager), new KitMadScientist(manager),
new KitDestructor(manager), new KitDestructor(manager),
}, new String[] }, description);
{
"Free for all battle in the sky!",
"Craft or loot gear for combat",
"Last player alive wins!"
});
PrepareFreeze = true; PrepareFreeze = true;
HideTeamSheep = true;
CompassEnabled = true; CompassEnabled = true;
StrictAntiHack = true; StrictAntiHack = true;
@ -159,8 +161,6 @@ public class Skywars extends SoloGame
WorldTimeSet = 0; WorldTimeSet = 0;
WorldBoundaryKill = false; WorldBoundaryKill = false;
SpawnDistanceRequirement = 48;
DamageSelf = true; DamageSelf = true;
DamageTeamSelf = true; DamageTeamSelf = true;
DamageEvP = true; DamageEvP = true;
@ -962,6 +962,9 @@ public class Skywars extends SoloGame
if (event.GetDamage() >= 1) if (event.GetDamage() >= 1)
return; return;
if(GetTeam(event.GetDamagerPlayer(true)) == GetTeam(event.GetDamageePlayer()))
return;
if (event.GetProjectile() instanceof Egg || event.GetProjectile() instanceof Snowball) if (event.GetProjectile() instanceof Egg || event.GetProjectile() instanceof Snowball)
{ {
event.SetCancelled("Egg/Snowball"); event.SetCancelled("Egg/Snowball");
@ -983,6 +986,25 @@ public class Skywars extends SoloGame
} }
} }
@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) private void fillChest(Player looter, Block block)
{ {
_lootedBlocks.add(block.getLocation()); _lootedBlocks.add(block.getLocation());
@ -1193,63 +1215,6 @@ public class Skywars extends SoloGame
_oreHider.BlockBreak(event); _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 @EventHandler
public void tntDamageAttribute(ExplosionPrimeEvent event) public void tntDamageAttribute(ExplosionPrimeEvent event)
{ {
@ -1367,4 +1332,15 @@ public class Skywars extends SoloGame
else else
return 12; return 12;
} }
public TNTGenerator getTnTGen()
{
return this._tntGen;
}
public long getCrumbleTime()
{
return this._crumbleTime;
}
} }

View File

@ -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<Player> 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<Player> getWinners()
{
if (GetState().ordinal() >= GameState.End.ordinal())
{
List<Player> 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<Player> getLosers()
{
List<Player> winners = getWinners();
if (winners == null)
return null;
List<Player> losers = GetTeamList().get(0).GetPlayers(false);
losers.removeAll(winners);
return losers;
}
@Override
public String GetMode()
{
return "Solo Mode";
}
}

View File

@ -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<Player, Player> _teamReqs = new NautHashMap<Player, Player>();
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<Location> initialSpawns = this.GetTeamList().get(0).GetSpawns();
this.GetTeamList().clear();
ArrayList<Location> spawns = new ArrayList<Location>();
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<Location> 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<GameTeam> alive = new ArrayList<GameTeam>();
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<GameTeam> teamsAlive = new ArrayList<GameTeam>();
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<Player> getWinners()
{
if (WinnerTeam == null)
return null;
return WinnerTeam.GetPlayers(false);
}
@Override
public List<Player> getLosers()
{
if (WinnerTeam == null)
return null;
List<Player> 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<Player> 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";
}
}

View File

@ -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<Player> 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<Player> getWinners()
{
if (GetState().ordinal() >= GameState.End.ordinal())
{
List<Player> 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<Player> getLosers()
{
List<Player> winners = getWinners();
if (winners == null)
return null;
List<Player> losers = GetTeamList().get(0).GetPlayers(false);
losers.removeAll(winners);
return losers;
}
@Override
public String GetMode()
{
return "Solo Mode";
}
}

View File

@ -1,40 +1,16 @@
package nautilus.game.arcade.game.games.smash; package nautilus.game.arcade.game.games.smash;
import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; 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.C;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAlg; import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilFirework; import mineplex.core.common.util.UtilFirework;
import mineplex.core.common.util.UtilInv; import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilPlayer; 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.data.BlockData;
import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.recharge.Recharge; import mineplex.core.recharge.Recharge;
@ -45,19 +21,57 @@ import nautilus.game.arcade.ArcadeFormat;
import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType; import nautilus.game.arcade.GameType;
import nautilus.game.arcade.events.GameStateChangeEvent; import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.game.Game;
import nautilus.game.arcade.game.GameTeam; import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.game.SoloGame;
import nautilus.game.arcade.game.GameTeam.PlayerState; 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.Kit;
import nautilus.game.arcade.kit.SmashKit; import nautilus.game.arcade.kit.SmashKit;
import nautilus.game.arcade.stats.KillFastStatTracker;
import nautilus.game.arcade.stats.FreeKitWinStatTracker; import nautilus.game.arcade.stats.FreeKitWinStatTracker;
import nautilus.game.arcade.stats.KillFastStatTracker;
import nautilus.game.arcade.stats.OneVThreeStatTracker; import nautilus.game.arcade.stats.OneVThreeStatTracker;
import nautilus.game.arcade.stats.RecoveryMasterStatTracker; import nautilus.game.arcade.stats.RecoveryMasterStatTracker;
import nautilus.game.arcade.stats.WinWithoutDyingStatTracker; 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<Player, Integer> _lives = new HashMap<Player, Integer>(); private HashMap<Player, Integer> _lives = new HashMap<Player, Integer>();
@ -68,9 +82,9 @@ public class SuperSmash extends SoloGame
private HashSet<BlockData> _restoreBlock = new HashSet<BlockData>(); private HashSet<BlockData> _restoreBlock = new HashSet<BlockData>();
public SuperSmash(ArcadeManager manager) public SuperSmash(ArcadeManager manager, GameType type, String[] description)
{ {
super(manager, GameType.Smash, super(manager, type,
new Kit[] new Kit[]
{ {
@ -98,31 +112,23 @@ public class SuperSmash extends SoloGame
new KitSheep(manager) new KitSheep(manager)
}, },description);
new String[]
{
"Each player has 3 respawns",
"Attack to restore hunger!",
"Last player alive wins!"
});
this.DeathOut = false; this.DeathOut = false;
this.DamageTeamSelf = true;
this.CompassEnabled = true; this.CompassEnabled = true;
this.DeathSpectateSecs = 4; this.DeathSpectateSecs = 4;
this.SpawnDistanceRequirement = 32;
this.WorldWaterDamage = 1000; this.WorldWaterDamage = 1000;
this.HideTeamSheep = true;
this.ReplaceTeamsWithKits = true;
// Add stat table here // Add stat table here
// Example // Example
//Manager.GetStatsManager().addTable("SuperSmashMobStats", "Kills", "Deaths", "Wins", "Losses"); // Manager.GetStatsManager().addTable("SuperSmashMobStats", "Kills", "Deaths", "Wins", "Losses");
registerStatTrackers( registerStatTrackers(
new WinWithoutDyingStatTracker(this, "MLGPro"), 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)) if (!_lives.containsKey(player))
return 0; return 0;
@ -165,14 +171,14 @@ public class SuperSmash extends SoloGame
return _lives.get(player); return _lives.get(player);
} }
private boolean LoseLife(Player player) public boolean LoseLife(Player player)
{ {
int lives = GetLives(player) - 1; int lives = GetLives(player) - 1;
if (lives > 0) if (lives > 0)
{ {
UtilPlayer.message(player, C.cRed + C.Bold + "You have died!"); 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); player.playSound(player.getLocation(), Sound.NOTE_BASS_GUITAR, 2f, 0.5f);
_lives.put(player, lives); _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 @EventHandler
public void powerupSpawn(UpdateEvent event) public void powerupSpawn(UpdateEvent event)
{ {
@ -530,9 +491,4 @@ public class SuperSmash extends SoloGame
int amount = Math.max(1, (int)(event.GetDamage()/2)); int amount = Math.max(1, (int)(event.GetDamage()/2));
UtilPlayer.hunger(damager, amount); UtilPlayer.hunger(damager, amount);
} }
public String GetMode()
{
return "Deathmatch";
}
} }

View File

@ -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<Player, Integer> _lives = new HashMap<Player, Integer>();
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);
}
}

View File

@ -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<Player, Player> _teamReqs = new NautHashMap<Player, Player>();
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<GameTeam> alive = new ArrayList<GameTeam>();
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<Location> 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<GameTeam> teamsAlive = new ArrayList<GameTeam>();
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<Player> getWinners()
{
if (WinnerTeam == null)
return null;
return WinnerTeam.GetPlayers(false);
}
@Override
public List<Player> getLosers()
{
if (WinnerTeam == null)
return null;
List<Player> 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<Player> 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";
}
}

View File

@ -1,57 +1,128 @@
package nautilus.game.arcade.game.games.snowfight; 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.Effect;
import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.Sound; import org.bukkit.Sound;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.World.Environment; import org.bukkit.World.Environment;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.block.BlockFace; 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.Player;
import org.bukkit.entity.Projectile; import org.bukkit.entity.Projectile;
import org.bukkit.entity.Snowball; import org.bukkit.entity.Snowball;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority; import org.bukkit.event.EventPriority;
import org.bukkit.event.block.Action;
import org.bukkit.event.block.BlockDamageEvent; 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.EntityDamageEvent.DamageCause;
import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason;
import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.inventory.ItemStack; 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 com.sun.xml.internal.bind.v2.runtime.unmarshaller.XsiNilLoader.Array;
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;
public class SnowFight extends TeamGame public class SnowFight extends TeamGame
{ {
private HashMap<Player, Integer> _tiles;
private boolean _meteoroids;
private boolean _peace;
public SnowFight(ArcadeManager manager) public SnowFight(ArcadeManager manager)
{ {
super(manager, GameType.SnowFight, super(manager, GameType.SnowFight,
new Kit[] new Kit[]
{ {
new NullKit(manager) new KitSportsman(manager),
new KitTactician(manager),
new KitMedic(manager)
}, },
new String[] new String[]
{ {
"Just like... kill your enemies. with snow." "Just like... kill your enemies. with snow.",
}); "Be careful if you are on Ice your body will freeze"
});
this.HungerSet = 20; 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<Player, Integer>();
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 @EventHandler
public void Weather(UpdateEvent event) public void Weather(UpdateEvent event)
@ -70,6 +141,62 @@ public class SnowFight extends TeamGame
world.setTime(4000); 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 @EventHandler
public void BlockDamage(BlockDamageEvent event) public void BlockDamage(BlockDamageEvent event)
{ {
@ -84,97 +211,119 @@ public class SnowFight extends TeamGame
if (!IsSnow(event.getBlock())) if (!IsSnow(event.getBlock()))
return; return;
if (UtilInv.contains(player, Material.SNOW_BALL, (byte) 0, 16))
if (UtilInv.contains(player, Material.SNOW_BALL, (byte)0, 16))
return; return;
//Item // Item
UtilInv.insert(player, new ItemStack(Material.SNOW_BALL));
//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); SnowDecrease(event.getBlock(), 1);
//Effect // Effect
event.getBlock().getWorld().playEffect(event.getBlock().getLocation(), Effect.STEP_SOUND, 80); event.getBlock().getWorld().playEffect(event.getBlock().getLocation(), Effect.STEP_SOUND, 80);
} }
// @EventHandler // @EventHandler
// public void InteractSnowball(PlayerInteractEvent event) // public void InteractSnowball(PlayerInteractEvent event)
// { // {
// Player player = event.getPlayer(); // Player player = event.getPlayer();
// //
// if (!IsLive()) // if (!IsLive())
// return; // return;
// //
// if (!IsPlaying(player)) // if (!IsPlaying(player))
// return; // return;
// //
// if (!UtilGear.isMat(player.getItemInHand(), Material.SNOW_BALL)) // if (!UtilGear.isMat(player.getItemInHand(), Material.SNOW_BALL))
// return; // return;
// //
// event.setCancelled(true); // event.setCancelled(true);
// //
// if (UtilEvent.isAction(event, ActionType.L)) // if (UtilEvent.isAction(event, ActionType.L))
// SnowballThrow(player); // SnowballThrow(player);
// //
// else if (UtilEvent.isAction(event, ActionType.R_BLOCK)) // else if (UtilEvent.isAction(event, ActionType.R_BLOCK))
// SnowballPlace(player, event.getClickedBlock(), 1); // SnowballPlace(player, event.getClickedBlock(), 1);
// } // }
// //
// private void SnowballPlace(Player player, Block block, int above) // private void SnowballPlace(Player player, Block block, int above)
// { // {
// if (block.getTypeId() == 78 || UtilBlock.airFoliage(block)) // if (block.getTypeId() == 78 || UtilBlock.airFoliage(block))
// { // {
// //Build // //Build
// if (block.getTypeId() == 78) // if (block.getTypeId() == 78)
// { // {
// block.setTypeIdAndData(78, (byte)(block.getData() + 1), true); // block.setTypeIdAndData(78, (byte)(block.getData() + 1), true);
// //
// if (block.getData() >= 7) // if (block.getData() >= 7)
// block.setTypeIdAndData(80, (byte)0, true); // block.setTypeIdAndData(80, (byte)0, true);
// } // }
// else // else
// { // {
// block.setTypeIdAndData(78, (byte)0, true); // block.setTypeIdAndData(78, (byte)0, true);
// } // }
// //
// //Sound // //Sound
// block.getWorld().playSound(block.getLocation(), Sound.STEP_SNOW, 1f, 0.6f); // block.getWorld().playSound(block.getLocation(), Sound.STEP_SNOW, 1f,
// // 0.6f);
// //Use Snow //
// SnowballCount(player, -1); // //Use Snow
// } // SnowballCount(player, -1);
// else if ((IsSnow(block) || UtilBlock.solid(block)) && above > 0) // }
// { // else if ((IsSnow(block) || UtilBlock.solid(block)) && above > 0)
// SnowballPlace(player, block.getRelative(BlockFace.UP), above - 1); // {
// } // SnowballPlace(player, block.getRelative(BlockFace.UP), above - 1);
// } // }
// // }
// private void SnowballThrow(Player player) //
// { // private void SnowballThrow(Player player)
// //Throw // {
// player.launchProjectile(Snowball.class); // //Throw
// // player.launchProjectile(Snowball.class);
// //Use Snow //
// SnowballCount(player, -1); // //Use Snow
// // SnowballCount(player, -1);
// //Sound //
// player.getWorld().playSound(player.getLocation(), Sound.STEP_SNOW, 3f, 1.5f); // //Sound
// } // player.getWorld().playSound(player.getLocation(), Sound.STEP_SNOW, 3f,
// 1.5f);
// }
// private void SnowballCount(Player player, int count) // private void SnowballCount(Player player, int count)
// { // {
// if (player.getInventory().getItem(1) != null) // if (player.getInventory().getItem(1) != null)
// count += player.getInventory().getItem(1).getAmount(); // count += player.getInventory().getItem(1).getAmount();
// //
// if (count > 16) // if (count > 16)
// count = 16; // count = 16;
// //
// if (count > 0) // if (count > 0)
// player.getInventory().setItem(1, ItemStackFactory.Instance.CreateStack(Material.SNOW_BALL, count)); // player.getInventory().setItem(1,
// else // ItemStackFactory.Instance.CreateStack(Material.SNOW_BALL, count));
// player.getInventory().setItem(1, null); // else
// } // player.getInventory().setItem(1, null);
// }
private void SnowDecrease(Block block, int height) private void SnowDecrease(Block block, int height)
{ {
@ -184,30 +333,53 @@ public class SnowFight extends TeamGame
if (!IsSnow(block)) if (!IsSnow(block))
return; return;
//Shuffle Up // Shuffle Up
while (IsSnow(block.getRelative(BlockFace.UP))) while (IsSnow(block.getRelative(BlockFace.UP)))
block = block.getRelative(BlockFace.UP); block = block.getRelative(BlockFace.UP);
//Snow Block // Snow Block
int snowLevel = 8; int snowLevel = 8;
if (block.getTypeId() == 78) if (block.getTypeId() == 78)
snowLevel = block.getData() + 1; snowLevel = block.getData() + 1;
//Lower // Lower
if (height >= snowLevel) if (height >= snowLevel)
{ {
block.setTypeIdAndData(0, (byte)0, true); block.setTypeIdAndData(0, (byte) 0, true);
SnowDecrease(block.getRelative(BlockFace.DOWN), height-snowLevel); SnowDecrease(block.getRelative(BlockFace.DOWN), height - snowLevel);
} }
else 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) @EventHandler(priority = EventPriority.HIGH)
public void SnowballDamage(CustomDamageEvent event) public void GenerallDamage(CustomDamageEvent event)
{ {
if(event.GetCause() == DamageCause.ENTITY_ATTACK)
event.SetCancelled("No Melee");
}
@EventHandler(priority = EventPriority.HIGH)
public void SnowballEggDamage(CustomDamageEvent event)
{
if(!_peace)
{
event.SetCancelled("Peace Phase");
return;
}
if (event.IsCancelled()) if (event.IsCancelled())
return; return;
@ -215,20 +387,249 @@ public class SnowFight extends TeamGame
return; return;
Projectile proj = event.GetProjectile(); Projectile proj = event.GetProjectile();
if (proj == null) return; if (proj == null)
if (!(proj instanceof Snowball))
return; return;
event.AddMod("Snowball", "Snowball", 3, true); if(proj instanceof Fireball)
event.SetIgnoreRate(true); return;
//Effect 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); 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) private boolean IsSnow(Block block)
{ {
return block.getTypeId() == 78 || block.getTypeId() == 80; 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<Player> 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();
}
} }

View File

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

View File

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

View File

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

View File

@ -48,7 +48,6 @@ public class SquidShooter extends SoloGame
this.DamageSelf = false; this.DamageSelf = false;
this.DamageTeamSelf = true; this.DamageTeamSelf = true;
this.PrepareFreeze = false; this.PrepareFreeze = false;
this.SpawnDistanceRequirement = 16;
this.CompassEnabled = true; this.CompassEnabled = true;
this.KitRegisterState = GameState.Prepare; this.KitRegisterState = GameState.Prepare;
} }

View File

@ -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<Player> 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<Player> getWinners()
{
if (GetState().ordinal() >= GameState.End.ordinal())
{
List<Player> 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<Player> getLosers()
{
List<Player> winners = getWinners();
if (winners == null)
return null;
List<Player> losers = GetTeamList().get(0).GetPlayers(false);
losers.removeAll(winners);
return losers;
}
@Override
public String GetMode()
{
return "Solo Mode";
}
}

View File

@ -114,7 +114,7 @@ import net.minecraft.server.v1_7_R4.TileEntityChest;
import net.minecraft.server.v1_7_R4.WorldServer; import net.minecraft.server.v1_7_R4.WorldServer;
import net.minecraft.util.com.mojang.authlib.GameProfile; import net.minecraft.util.com.mojang.authlib.GameProfile;
public class SurvivalGames extends SoloGame public abstract class SurvivalGames extends Game
{ {
// Chest loot // Chest loot
private ChestLoot _baseLoot = new ChestLoot(true); private ChestLoot _baseLoot = new ChestLoot(true);
@ -168,9 +168,9 @@ public class SurvivalGames extends SoloGame
*/ */
private Field _ticksField; private Field _ticksField;
public SurvivalGames(ArcadeManager manager) public SurvivalGames(ArcadeManager manager, GameType type, String[] description)
{ {
super(manager, GameType.SurvivalGames, super(manager, type,
new Kit[] new Kit[]
{ {
@ -195,18 +195,7 @@ public class SurvivalGames extends SoloGame
new KitBarbarian(manager), new KitBarbarian(manager),
new KitHorseman(manager), new KitHorseman(manager),
}, }, description);
new String[]
{
"Search for chests to find loot",
"Slaughter your opponents",
"Stay away from the borders!",
"Last tribute alive wins!"
});
_help = new String[] _help = new String[]
{ {
@ -221,6 +210,10 @@ public class SurvivalGames extends SoloGame
StrictAntiHack = true; StrictAntiHack = true;
HideTeamSheep = true;
this.ReplaceTeamsWithKits = true;
GameTimeout = 1500000; GameTimeout = 1500000;
QuitDropItems = true; QuitDropItems = true;
@ -228,8 +221,6 @@ public class SurvivalGames extends SoloGame
WorldTimeSet = 0; WorldTimeSet = 0;
WorldBoundaryKill = false; WorldBoundaryKill = false;
SpawnDistanceRequirement = 48;
DamageSelf = true; DamageSelf = true;
DamageTeamSelf = true; DamageTeamSelf = true;
@ -757,7 +748,8 @@ public class SurvivalGames extends SoloGame
WorldTimeSet = 0; WorldTimeSet = 0;
WorldData.World.setTime(15000); WorldData.World.setTime(15000);
GetTeamList().get(0).SpawnTeleport(false); for (GameTeam team : GetTeamList())
team.SpawnTeleport(false);
_borderPositions.clear(); _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() private void setBorder()
{ {
_borderStartedMoving = System.currentTimeMillis(); _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;
}
} }

View File

@ -7,38 +7,6 @@ import java.util.HashSet;
import java.util.Iterator; import java.util.Iterator;
import java.util.Map.Entry; 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.C;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
import mineplex.core.common.util.MapUtil; 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.UtilInv;
import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilParticle; 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.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist; import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilTime; import mineplex.core.common.util.UtilTime;
import mineplex.core.common.util.UtilTime.TimeUnit; 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.Game;
import nautilus.game.arcade.game.GameTeam; import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.game.TeamGame; 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 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 public class SurvivalGamesTeams extends TeamGame
{ {
private HashSet<Location> _openedChest = new HashSet<Location>(); private HashSet<Location> _openedChest = new HashSet<Location>();
@ -114,7 +129,7 @@ public class SurvivalGamesTeams extends TeamGame
public SurvivalGamesTeams(ArcadeManager manager) public SurvivalGamesTeams(ArcadeManager manager)
{ {
super(manager, GameType.SurvivalGamesTeams, super(manager, GameType.SurvivalGames,
new Kit[] new Kit[]
{ {
@ -161,7 +176,8 @@ public class SurvivalGamesTeams extends TeamGame
this.WorldTimeSet = 0; this.WorldTimeSet = 0;
this.WorldBoundaryKill = false; 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.DamageSelf = true;
this.DamageTeamSelf = false; this.DamageTeamSelf = false;

View File

@ -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<Player, Player> _teamReqs = new NautHashMap<Player, Player>();
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<Location> 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<GameTeam> alive = new ArrayList<GameTeam>();
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<GameTeam> teamsAlive = new ArrayList<GameTeam>();
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<Player> getWinners()
{
if (WinnerTeam == null)
return null;
return WinnerTeam.GetPlayers(false);
}
@Override
public List<Player> getLosers()
{
if (WinnerTeam == null)
return null;
List<Player> 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<Player> 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";
}
}

View File

@ -1,6 +1,7 @@
package nautilus.game.arcade.game.games.wither; package nautilus.game.arcade.game.games.wither;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.Iterator; 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.UtilAction;
import mineplex.core.common.util.UtilAlg; import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilBlock; 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.UtilMath;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilTextMiddle; import mineplex.core.common.util.UtilTextMiddle;
import mineplex.core.common.util.UtilTime; import mineplex.core.common.util.UtilTime;
import mineplex.core.data.BlockData; import mineplex.core.data.BlockData;
import mineplex.core.itemstack.ItemBuilder;
import mineplex.core.updater.UpdateType; import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.core.condition.Condition.ConditionType; 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.GameTeam.PlayerState;
import nautilus.game.arcade.game.TeamGame; import nautilus.game.arcade.game.TeamGame;
import nautilus.game.arcade.game.games.paintball.PlayerCopy; 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.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.game.games.wither.kit.KitWitherMinion;
import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.kit.NullKit; import nautilus.game.arcade.kit.NullKit;
import nautilus.game.arcade.kit.perks.data.IBlockRestorer; import nautilus.game.arcade.kit.perks.data.IBlockRestorer;
import nautilus.game.arcade.stats.WitherAssaultReviveTracker;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.EntityEffect; import org.bukkit.EntityEffect;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer; import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
import org.bukkit.entity.LivingEntity; import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.entity.Projectile;
import org.bukkit.entity.ThrownPotion; import org.bukkit.entity.ThrownPotion;
import org.bukkit.entity.Wither;
import org.bukkit.entity.WitherSkull;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority; 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.EntityCombustEvent;
import org.bukkit.event.entity.ProjectileHitEvent; 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.potion.PotionEffectType;
import org.bukkit.scheduler.BukkitRunnable;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
public class WitherGame extends TeamGame implements IBlockRestorer public class WitherGame extends TeamGame implements IBlockRestorer
@ -59,35 +83,34 @@ public class WitherGame extends TeamGame implements IBlockRestorer
private double _witherFactor = 2.5; private double _witherFactor = 2.5;
private int _yLimit = 0; private int _yLimit = 0;
private int _maxY;
private long _gameTime = 300000; private long _gameTime = 300000;
private HashMap<Player, PlayerCopy> _doubles = new HashMap<Player, PlayerCopy>(); private HashMap<Player, PlayerCopy> _doubles = new HashMap<Player, PlayerCopy>();
// private int _livesPerPlayer = 3; // private int _livesPerPlayer = 3;
// private HashMap<Player, Integer> _lives = new HashMap<Player, Integer>(); // private HashMap<Player, Integer> _lives = new HashMap<Player, Integer>();
private HashSet<BlockData> _blocks = new HashSet<BlockData>(); private HashSet<BlockData> _blocks = new HashSet<BlockData>();
private ArrayList<Location> _locationsOfBlocks = new ArrayList<Location>();
public WitherGame(ArcadeManager manager) public WitherGame(ArcadeManager manager)
{ {
super(manager, GameType.WitherAssault, super(manager, GameType.WitherAssault,
new Kit[] new Kit[]
{ {
new KitHumanArcher(manager), new KitHumanArcher(manager),
//new KitHumanBuilder(manager), new KitHumanMedic(manager),
//new KitHumanRunner(manager), new KitHumanEditor(manager),
new NullKit(manager),
new NullKit(manager),
new NullKit(manager), new NullKit(manager),
new KitWitherMinion(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 + " Run and hide from the Withers",
C.cGreen + "Humans" + C.cWhite + " Revive your dead allies!", C.cGreen + "Humans" + C.cWhite + " Revive your dead allies!",
@ -95,7 +118,7 @@ public class WitherGame extends TeamGame implements IBlockRestorer
" ", " ",
C.cRed + "Withers" + C.cWhite + " Moves very slowly when near ground", C.cRed + "Withers" + C.cWhite + " Moves very slowly when near ground",
C.cRed + "Withers" + C.cWhite + " Kill all the Humans within 5 Minutes", C.cRed + "Withers" + C.cWhite + " Kill all the Humans within 5 Minutes",
}); });
this.DeathOut = true; this.DeathOut = true;
this.DamageTeamSelf = false; this.DamageTeamSelf = false;
@ -103,14 +126,26 @@ public class WitherGame extends TeamGame implements IBlockRestorer
this.DeathSpectateSecs = 4; this.DeathSpectateSecs = 4;
this.HungerSet = 20; this.HungerSet = 20;
this.WorldBoundaryKill = false; this.WorldBoundaryKill = false;
this.CompassEnabled = false;
this.CompassEnabled = true; //Customizing for the Editor kit
this.CompassGiveItem = false; this.BlockBreak = true;
this.BlockPlace = true;
this.ItemPickup = true;
this.KitRegisterState = GameState.Prepare; this.KitRegisterState = GameState.Prepare;
this.TeamArmor = true; 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 @Override
@ -160,27 +195,184 @@ public class WitherGame extends TeamGame implements IBlockRestorer
if (event.getType() != UpdateType.FAST) if (event.getType() != UpdateType.FAST)
return; return;
//Not Enough Players // Not Enough Players
if (_runners.GetPlayers(true).size() < 2) if (_runners.GetPlayers(true).size() < 2)
return; return;
//Enough Withers // Enough Withers
if (_withers.GetPlayers(true).size() * _witherFactor >= _runners.GetPlayers(true).size()) if (_withers.GetPlayers(true).size() * _witherFactor >= _runners
.GetPlayers(true).size())
return; return;
Player player = UtilAlg.Random(_runners.GetPlayers(true)); Player player = UtilAlg.Random(_runners.GetPlayers(true));
setWither(player, 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<String>(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) public void setWither(Player player, boolean forced)
{ {
// _lives.remove(player); // _lives.remove(player);
SetPlayerTeam(player, _withers, true); SetPlayerTeam(player, _withers, true);
//Kit // Kit
Kit newKit = GetKits()[4]; Kit newKit = GetKits()[GetKits().length-1];
SetKit(player, newKit, false); SetKit(player, newKit, false);
newKit.ApplyKit(player); newKit.ApplyKit(player);
@ -191,32 +383,37 @@ public class WitherGame extends TeamGame implements IBlockRestorer
{ {
AddGems(player, 10, "Forced Wither", false, false); AddGems(player, 10, "Forced Wither", false, false);
Announce(F.main("Game", F.elem(_withers.GetColor() + player.getName()) + " has become a " + Announce(F.main(
F.elem(_withers.GetColor() + newKit.GetName()) + ".")); "Game",
F.elem(_withers.GetColor() + player.getName())
+ " has become a "
+ F.elem(_withers.GetColor() + newKit.GetName())
+ "."));
player.getWorld().strikeLightningEffect(player.getLocation()); player.getWorld().strikeLightningEffect(player.getLocation());
} }
} }
// @EventHandler // @EventHandler
// public void playerLoseLife(final PlayerDeathOutEvent event) // public void playerLoseLife(final PlayerDeathOutEvent event)
// { // {
// Player player = event.GetPlayer(); // Player player = event.GetPlayer();
// //
// if (_lives.containsKey(player)) // if (_lives.containsKey(player))
// { // {
// int lives = _lives.get(player); // int lives = _lives.get(player);
// //
// if (lives <= 1) // if (lives <= 1)
// return; // return;
// //
// _lives.put(player, lives - 1); // _lives.put(player, lives - 1);
// //
// UtilPlayer.message(player, F.main("Game", "You have " + F.elem(C.cGreen + C.Bold + lives + " Lives Remaining") + ".")); // UtilPlayer.message(player, F.main("Game", "You have " + F.elem(C.cGreen +
// // C.Bold + lives + " Lives Remaining") + "."));
// event.setCancelled(true); //
// } // event.setCancelled(true);
// } // }
// }
@EventHandler @EventHandler
public void gameStart(GameStateChangeEvent event) public void gameStart(GameStateChangeEvent event)
@ -224,31 +421,55 @@ public class WitherGame extends TeamGame implements IBlockRestorer
if (event.GetState() != GameState.Live) if (event.GetState() != GameState.Live)
return; 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)) 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 @EventHandler
// public void playerLivesDisplay(PlayerKitGiveEvent event) public void removeUselessPlayerCopies(UpdateEvent event)
// { {
// if (!_runners.HasPlayer(event.GetPlayer())) if(event.getType() != UpdateType.TWOSEC)
// return; return;
//
// //Player Lives for(Player players: _doubles.keySet())
// if (!_lives.containsKey(event.GetPlayer())) {
// _lives.put(event.GetPlayer(), _livesPerPlayer); if(!players.isOnline())
// {
// int lives = _lives.get(event.GetPlayer()); PlayerCopy pc = _doubles.get(players);
// pc.GetEntity().remove();
// if (lives <= 0) _doubles.remove(players);
// return; }
// }
// event.GetPlayer().getInventory().setItem(8, ItemStackFactory.Instance.CreateStack(Material.BONE, (byte)0, lives, C.cGreen + C.Bold + lives + " Lives Remaining"));
// } }
// @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 @Override
public void EndCheck() public void EndCheck()
@ -256,23 +477,24 @@ public class WitherGame extends TeamGame implements IBlockRestorer
if (!IsLive()) if (!IsLive())
return; return;
//Players Quit // Players Quit
if (GetPlayers(true).size() < 2) if (GetPlayers(true).size() < 1)
{ {
SetState(GameState.End); SetState(GameState.End);
_locationsOfBlocks.clear();
} }
GameTeam winner = null; GameTeam winner = null;
//Wither Win // Wither Win
if (UtilTime.elapsed(this.GetStateTime(), _gameTime)) if (UtilTime.elapsed(this.GetStateTime(), _gameTime))
winner = _runners; winner = _runners;
//Runner Win // Runner Win
if (_runners.GetPlayers(true).isEmpty()) if (_runners.GetPlayers(true).isEmpty())
winner = _withers; winner = _withers;
//Set Win // Set Win
if (winner != null) if (winner != null)
{ {
AnnounceEnd(winner); AnnounceEnd(winner);
@ -290,8 +512,9 @@ public class WitherGame extends TeamGame implements IBlockRestorer
AddGems(player, 10, "Participation", false, false); AddGems(player, 10, "Participation", false, false);
} }
//End // End
SetState(GameState.End); SetState(GameState.End);
_locationsOfBlocks.clear();
} }
} }
@ -305,28 +528,35 @@ public class WitherGame extends TeamGame implements IBlockRestorer
if (event.getType() != UpdateType.FAST) if (event.getType() != UpdateType.FAST)
return; return;
// int lives = 0; // int lives = 0;
// for (int i : _lives.values()) // for (int i : _lives.values())
// lives += i; // lives += i;
//Wipe Last // Wipe Last
Scoreboard.Reset(); Scoreboard.Reset();
Scoreboard.WriteBlank(); Scoreboard.WriteBlank();
Scoreboard.Write(_runners.GetColor() + C.Bold + _runners.GetName()); 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.WriteBlank();
Scoreboard.Write(_withers.GetColor() + C.Bold + _withers.GetName()); Scoreboard.Write(_withers.GetColor() + C.Bold + _withers.GetName());
Scoreboard.Write(_withers.GetColor() + "" + _withers.GetPlayers(true).size() + " Players"); Scoreboard.Write(_withers.GetColor() + ""
+ _withers.GetPlayers(true).size() + " Players");
// Scoreboard.WriteBlank(); // Scoreboard.WriteBlank();
// Scoreboard.Write(C.cYellow + C.Bold + "Humans Alive"); // Scoreboard.Write(C.cYellow + C.Bold + "Humans Alive");
// Scoreboard.Write(lives + " / " + (_lives.size() * _livesPerPlayer)); // Scoreboard.Write(lives + " / " + (_lives.size() * _livesPerPlayer));
Scoreboard.WriteBlank(); Scoreboard.WriteBlank();
Scoreboard.Write(C.cYellow + C.Bold + "Time Left"); 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(); Scoreboard.Draw();
} }
@ -353,7 +583,7 @@ public class WitherGame extends TeamGame implements IBlockRestorer
public int getRequiredWithers() public int getRequiredWithers()
{ {
return (int)(GetPlayers(true).size()/_witherFactor); return (int) (GetPlayers(true).size() / _witherFactor);
} }
@EventHandler @EventHandler
@ -365,24 +595,39 @@ public class WitherGame extends TeamGame implements IBlockRestorer
if (event.getType() != UpdateType.FASTER) if (event.getType() != UpdateType.FASTER)
return; return;
Location _spawn = GetTeamList().get(1).GetSpawn();
for (Player player : _withers.GetPlayers(true)) for (Player player : _withers.GetPlayers(true))
{ {
ArrayList<Location> collisions = new ArrayList<Location>(); ArrayList<Location> collisions = new ArrayList<Location>();
//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; speed = 0.16;
}
else
{
speed = 0.09 - (_yLimit - player.getLocation().getY()) * 0.006;
}
if (speed < 0.016) if (distanceToGround < 4)
{
speed = 0.016; speed = 0.016;
}
else
{
speed = 0.09 - (_yLimit - player.getLocation().getY()) * 0.006;
}
player.setFlySpeed((float)speed); player.setFlySpeed((float) speed);
// Bump
//Bump for (Block block : UtilBlock.getInRadius(
for (Block block : UtilBlock.getInRadius(player.getLocation().add(0, 0.5, 0), 1.5d).keySet()) player.getLocation().add(0, 0.5, 0), 1.5d).keySet())
{ {
if (!UtilBlock.airFoliage(block)) 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) if (vec == null)
continue; continue;
UtilAction.velocity(player, vec, 0.6, false, 0, 0.4, 10, true); UtilAction.velocity(player, vec, 0.6, false, 0, 0.4, 10, true);
// if (player.getLocation().getY() < _yLimit + 6) // if (player.getLocation().getY() < _yLimit + 6)
// UtilAction.velocity(player, new Vector(0, 1, 0), 0.6, false, 0, 0, 10, true); // UtilAction.velocity(player, new Vector(0, 1, 0), 0.6, false, 0,
// 0, 10, true);
} }
} }
@ -411,14 +658,17 @@ public class WitherGame extends TeamGame implements IBlockRestorer
{ {
Block block = blockIter.next(); 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(); blockIter.remove();
else if (!isInsideMap(block.getLocation())) else if (!isInsideMap(block.getLocation()))
blockIter.remove(); blockIter.remove();
// else if (UtilAlg.inBoundingBox(block.getLocation(), _safeA, _safeB) || UtilAlg.inBoundingBox(block.getLocation(), _spawnA, _spawnB)) // else if (UtilAlg.inBoundingBox(block.getLocation(), _safeA,
// blockIter.remove(); // _safeB) || UtilAlg.inBoundingBox(block.getLocation(), _spawnA,
// _spawnB))
// blockIter.remove();
} }
for (Block block : blocks) for (Block block : blocks)
@ -434,41 +684,44 @@ public class WitherGame extends TeamGame implements IBlockRestorer
{ {
BlockData data = dataIt.next(); 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) 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(); dataIt.remove();
} }
} }
} }
// @EventHandler // @EventHandler
// public void cleanLives(PlayerQuitEvent event) // public void cleanLives(PlayerQuitEvent event)
// { // {
// _lives.remove(event.getPlayer()); // _lives.remove(event.getPlayer());
// } // }
// @EventHandler // @EventHandler
// public void livesUpdate(UpdateEvent event) // public void livesUpdate(UpdateEvent event)
// { // {
// if (!IsLive()) // if (!IsLive())
// return; // return;
// //
// if (event.getType() != UpdateType.FASTER) // if (event.getType() != UpdateType.FASTER)
// return; // return;
// //
// Iterator<Player> playerIter = _lives.keySet().iterator(); // Iterator<Player> playerIter = _lives.keySet().iterator();
// //
// while (playerIter.hasNext()) // while (playerIter.hasNext())
// { // {
// Player player = playerIter.next(); // Player player = playerIter.next();
// //
// if (!player.isOnline() || !_runners.HasPlayer(player)) // if (!player.isOnline() || !_runners.HasPlayer(player))
// playerIter.remove(); // playerIter.remove();
// } // }
// } // }
@EventHandler @EventHandler
public void arrowDamage(CustomDamageEvent event) public void arrowDamage(CustomDamageEvent event)
@ -499,46 +752,54 @@ public class WitherGame extends TeamGame implements IBlockRestorer
if (event.GetDamagerPlayer(true) != null) if (event.GetDamagerPlayer(true) != null)
{ {
AddGems(event.GetDamagerPlayer(true), 2, "Humans Stunned", true, true); 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 + "."); Bukkit.broadcastMessage(C.cBlue + "Death> " + C.cGreen
+ event.GetDamageePlayer().getName() + C.cGray
+ " was killed by " + C.cRed
+ event.GetDamagerPlayer(true).getName() + C.cGray + ".");
} }
else 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) public void playerOut(Player player)
{ {
//State // State
SetPlayerState(player, PlayerState.OUT); SetPlayerState(player, PlayerState.OUT);
player.setHealth(20); player.setHealth(20);
player.setFlySpeed(0.1f); player.setFlySpeed(0.1f);
//Conditions // Conditions
Manager.GetCondition().Factory().Blind("Hit", player, player, 1.5, 0, false, false, false); Manager.GetCondition().Factory()
Manager.GetCondition().Factory().Cloak("Hit", player, player, 9999, false, false); .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.setAllowFlight(true);
player.setFlying(true); player.setFlying(true);
((CraftPlayer)player).getHandle().spectating = true; ((CraftPlayer) player).getHandle().spectating = true;
((CraftPlayer)player).getHandle().k = false; ((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)); _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); SetPlayerState(player, PlayerState.IN);
player.setHealth(20); player.setHealth(20);
//Teleport // Teleport
if (copy != null) if (copy != null)
{ {
Location loc = player.getLocation(); Location loc = player.getLocation();
@ -548,34 +809,47 @@ public class WitherGame extends TeamGame implements IBlockRestorer
player.teleport(loc); player.teleport(loc);
} }
//Settings // Settings
player.setAllowFlight(false); player.setAllowFlight(false);
player.setFlying(false); player.setFlying(false);
((CraftPlayer)player).getHandle().spectating = false; ((CraftPlayer) player).getHandle().spectating = false;
((CraftPlayer)player).getHandle().k = true; ((CraftPlayer) player).getHandle().k = true;
//Items // Items
player.getInventory().remove(Material.WATCH); player.getInventory().remove(Material.WATCH);
player.getInventory().remove(Material.COMPASS); player.getInventory().remove(Material.COMPASS);
//Inform // Inform
UtilPlayer.message(player, F.main("Game", "You have been revived!")); 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) if (copy != null)
{ {
UtilServer.getServer().getScheduler().scheduleSyncDelayedTask(Manager.getPlugin(), new Runnable() UtilServer
{ .getServer()
public void run() .getScheduler()
{ .scheduleSyncDelayedTask(Manager.getPlugin(),
//Remove Invis new Runnable()
if (IsAlive(player)) {
Manager.GetCondition().EndCondition(player, ConditionType.CLOAK, null); public void run()
{
// Remove Invis
if (IsAlive(player))
Manager.GetCondition().EndCondition(
player, ConditionType.CLOAK,
null);
//Remove Copy // Remove Copy
copy.remove(); copy.remove();
} }
}, 4); }, 4);
} }
} }
@ -594,12 +868,13 @@ public class WitherGame extends TeamGame implements IBlockRestorer
if (!(event.getEntity().getShooter() instanceof Player)) if (!(event.getEntity().getShooter() instanceof Player))
return; return;
Player thrower = (Player)event.getEntity().getShooter(); Player thrower = (Player) event.getEntity().getShooter();
GameTeam throwerTeam = GetTeam(thrower); GameTeam throwerTeam = GetTeam(thrower);
if (throwerTeam == null) return; if (throwerTeam == null)
return;
//Revive // Revive a copy
Iterator<PlayerCopy> copyIterator = _doubles.values().iterator(); Iterator<PlayerCopy> copyIterator = _doubles.values().iterator();
while (copyIterator.hasNext()) while (copyIterator.hasNext())
{ {
@ -609,27 +884,31 @@ public class WitherGame extends TeamGame implements IBlockRestorer
if (otherTeam == null || !otherTeam.equals(throwerTeam)) if (otherTeam == null || !otherTeam.equals(throwerTeam))
continue; 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; continue;
playerIn(copy.GetPlayer(), copy.GetEntity()); playerIn(copy.GetPlayer(), copy.GetEntity(), thrower);
copyIterator.remove(); copyIterator.remove();
AddGems(thrower, 3, "Revived Ally", true, true); AddGems(thrower, 3, "Revived Ally", true, true);
Bukkit.getPluginManager().callEvent(new HumanReviveEvent(thrower, copy.GetPlayer()));
} }
//Revive // Revive a player
for (Player player : GetPlayers(true)) // for (Player player : GetPlayers(true))
{ // {
GameTeam otherTeam = GetTeam(player); // GameTeam otherTeam = GetTeam(player);
if (otherTeam == null || !otherTeam.equals(throwerTeam)) // if (otherTeam == null || !otherTeam.equals(throwerTeam))
continue; // continue;
//
if (UtilMath.offset(player.getLocation().add(0,1,0), event.getEntity().getLocation()) > 3) // if (UtilMath.offset(player.getLocation().add(0, 1, 0), event
continue; // .getEntity().getLocation()) > 3)
// continue;
playerIn(player, null); //
} // playerIn(player, null, thrower);
// }
} }
@EventHandler @EventHandler

View File

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

View File

@ -26,20 +26,18 @@ public class KitHumanArcher extends Kit
{ {
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 PerkDoubleJump("Double Jump", 1.2, 1, true, 4000, true),
new PerkWitherArrowBlind(6), new PerkWitherArrowBlind(6),
new PerkFletcher(4, 4, true), new PerkFletcher(4, 4, true),
}, }, EntityType.ZOMBIE, null);
EntityType.ZOMBIE,
null);
} }
@ -49,8 +47,8 @@ public class KitHumanArcher extends Kit
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD)); player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD));
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.BOW)); player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.BOW));
ItemStack potion = new ItemStack(Material.POTION, 2, (short)16429); // 16422 ItemStack potion = new ItemStack(Material.POTION, 2, (short) 16429); // 16422
PotionMeta potionMeta = (PotionMeta)potion.getItemMeta(); PotionMeta potionMeta = (PotionMeta) potion.getItemMeta();
potionMeta.setDisplayName(ChatColor.RESET + "Revival Potion"); potionMeta.setDisplayName(ChatColor.RESET + "Revival Potion");
potion.setItemMeta(potionMeta); potion.setItemMeta(potionMeta);
player.getInventory().addItem(potion); player.getInventory().addItem(potion);

View File

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

View File

@ -18,12 +18,13 @@ import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.perks.PerkBlockRestorer; import nautilus.game.arcade.kit.perks.PerkBlockRestorer;
import nautilus.game.arcade.kit.perks.PerkDoubleJump; import nautilus.game.arcade.kit.perks.PerkDoubleJump;
import nautilus.game.arcade.kit.perks.PerkIronShell; 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[] new String[]
{ {
@ -33,7 +34,7 @@ public class KitHumanBuilder extends Kit
new Perk[] new Perk[]
{ {
new PerkDoubleJump("Double Jump", 1, 0.8, true, 6000, true), new PerkDoubleJump("Double Jump", 1, 0.8, true, 6000, true),
new PerkIronShell(), new PerkWitherMedicRefill(45, 1),
new PerkBlockRestorer() new PerkBlockRestorer()
}, },
EntityType.ZOMBIE, EntityType.ZOMBIE,
@ -45,7 +46,9 @@ public class KitHumanBuilder extends Kit
public void GiveItems(Player player) public void GiveItems(Player player)
{ {
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_AXE)); 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 ItemStack potion = new ItemStack(Material.POTION, 2, (short)16429); // 16422
PotionMeta potionMeta = (PotionMeta)potion.getItemMeta(); PotionMeta potionMeta = (PotionMeta)potion.getItemMeta();
@ -53,8 +56,6 @@ public class KitHumanBuilder extends Kit
potion.setItemMeta(potionMeta); potion.setItemMeta(potionMeta);
player.getInventory().addItem(potion); player.getInventory().addItem(potion);
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP));
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP));
} }
@Override @Override

View File

@ -28,55 +28,58 @@ public class KitWitherMinion extends Kit
{ {
super(manager, "Wither", KitAvailability.Free, super(manager, "Wither", KitAvailability.Free,
new String[] new String[]
{ {
"" ""
}, },
new Perk[] new Perk[]
{ {
new PerkWitherArrows(), new PerkWitherArrows(), new PerkWitherAttack(),
new PerkWitherAttack(), new PerkWitherMinion(), new PerkWitherCompassScent()
new PerkWitherMinion() }, EntityType.WITHER, null);
},
EntityType.WITHER,
null);
} }
// @Override // @Override
// public void SpawnCustom(LivingEntity ent) // public void SpawnCustom(LivingEntity ent)
// { // {
// ent.setMaxHealth(300); // ent.setMaxHealth(300);
// ent.setHealth(300); // ent.setHealth(300);
// //
// DisguiseWither disguise = new DisguiseWither(ent); // DisguiseWither disguise = new DisguiseWither(ent);
// disguise.SetName(C.cYellow + "Wither"); // disguise.SetName(C.cYellow + "Wither");
// disguise.SetCustomNameVisible(true); // disguise.SetCustomNameVisible(true);
// Manager.GetDisguise().disguise(disguise); // Manager.GetDisguise().disguise(disguise);
// } // }
@Override @Override
public void GiveItems(Player player) public void GiveItems(Player player)
{ {
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.GOLD_SWORD, (byte)0, 1, player.getInventory().addItem(
C.cYellow + C.Bold + "Left-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Wither Skull")); 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, player.getInventory().addItem(
C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Skeletal Minions")); 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, player.getInventory().addItem(
C.cYellow + C.Bold + "Human Finder X-9000")); ItemStackFactory.Instance
.CreateStack(Material.COMPASS, (byte) 0, 1, C.cYellow
+ C.Bold + "Human Finder X-9000"));
//Disguise // Disguise
DisguiseWither disguise = new DisguiseWither(player); DisguiseWither disguise = new DisguiseWither(player);
if (Manager.GetGame().GetTeam(player) != null) if (Manager.GetGame().GetTeam(player) != null)
disguise.setName(Manager.GetGame().GetTeam(player).GetColor() + player.getName()); disguise.setName(Manager.GetGame().GetTeam(player).GetColor()
else + player.getName());
disguise.setName(player.getName()); else disguise.setName(player.getName());
disguise.setCustomNameVisible(true); disguise.setCustomNameVisible(true);
Manager.GetDisguise().disguise(disguise); Manager.GetDisguise().disguise(disguise);

View File

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

View File

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

View File

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

View File

@ -44,6 +44,18 @@ public abstract class BasePage extends ShopPageBase<ArcadeManager, PrivateServer
}); });
} }
public void addBackToSetGamePage()
{
addButton(4, new ShopItem(Material.BED, C.cGray + " \u21FD Go Back", new String[]{}, 1, false), new IButton()
{
@Override
public void onClick(Player player, ClickType clickType)
{
getShop().openPageForPlayer(player, new SetGamePage(getPlugin(), getShop(), player));
}
});
}
public ItemStack getPlayerHead(String playerName, String title) public ItemStack getPlayerHead(String playerName, String title)
{ {
return getPlayerHead(playerName, title, null); return getPlayerHead(playerName, title, null);

View File

@ -0,0 +1,43 @@
package nautilus.game.arcade.gui.privateServer.page;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import mineplex.core.shop.item.ShopItem;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType;
import nautilus.game.arcade.gui.privateServer.PrivateServerShop;
import nautilus.game.arcade.gui.privateServer.button.ChooseMapButton;
/**
* 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 ChooseMapPage extends BasePage
{
private GameType _gameType;
public ChooseMapPage(ArcadeManager plugin, PrivateServerShop shop, Player player, GameType gameType)
{
super(plugin, shop, "Choose Map", player);
_gameType = gameType;
buildPage();
}
@Override
protected void buildPage()
{
addBackToSetGamePage();
int slot = 9;
for (String cur : getPlugin().LoadFiles(_gameType.GetName())){
ChooseMapButton btn = new ChooseMapButton(getPlugin(), getShop(), _gameType, cur);
addButton(slot, new ShopItem(Material.PAPER, cur.split("_")[1], new String[]{"§7Click to select map."}, 1, false), btn);
slot++;
}
}
}

View File

@ -1,5 +1,6 @@
package nautilus.game.arcade.gui.privateServer.page; package nautilus.game.arcade.gui.privateServer.page;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
@ -9,6 +10,7 @@ import org.bukkit.event.inventory.ClickType;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
import mineplex.core.game.GameCategory;
import mineplex.core.shop.item.IButton; import mineplex.core.shop.item.IButton;
import mineplex.core.shop.item.ShopItem; import mineplex.core.shop.item.ShopItem;
import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.ArcadeManager;
@ -30,6 +32,8 @@ public class EditRotationPage extends BasePage
List<GameType> enabledGames = getPlugin().GetServerConfig().GameList; List<GameType> enabledGames = getPlugin().GetServerConfig().GameList;
//Old code I'm not removing in-case the old style is wanted. - William
/*
int arcadeSlot = 9; int arcadeSlot = 9;
int classicSlot = 13; int classicSlot = 13;
int survivalSlot = 15; int survivalSlot = 15;
@ -64,13 +68,40 @@ public class EditRotationPage extends BasePage
addGameButton(slot, type, enabledGames.contains(type)); addGameButton(slot, type, enabledGames.contains(type));
} }
*/
ArrayList<GameCategory> allowedCats = new ArrayList<GameCategory>();
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) 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"); 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; int itemCount = enabled ? 1 : 0;
addButtonFakeCount(slot, shopItem, new IButton() addButtonFakeCount(slot, shopItem, new IButton()

View File

@ -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<GameCategory> allowedCats = new ArrayList<GameCategory>();
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;
}
}
}

View File

@ -16,6 +16,7 @@ import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.gui.privateServer.PrivateServerShop; import nautilus.game.arcade.gui.privateServer.PrivateServerShop;
import nautilus.game.arcade.gui.privateServer.button.BanButton; import nautilus.game.arcade.gui.privateServer.button.BanButton;
import nautilus.game.arcade.gui.privateServer.button.EditRotationButton; 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.GiveAdminButton;
import nautilus.game.arcade.gui.privateServer.button.KillButton; import nautilus.game.arcade.gui.privateServer.button.KillButton;
import nautilus.game.arcade.gui.privateServer.button.PlayerHeadButton; 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.StartGameButton;
import nautilus.game.arcade.gui.privateServer.button.StopGameButton; import nautilus.game.arcade.gui.privateServer.button.StopGameButton;
import nautilus.game.arcade.gui.privateServer.button.UnbanButton; import nautilus.game.arcade.gui.privateServer.button.UnbanButton;
import nautilus.game.arcade.gui.privateServer.button.WhitelistButton;
public class MenuPage extends BasePage public class MenuPage extends BasePage
{ {
public MenuPage(ArcadeManager plugin, PrivateServerShop shop, Player player) 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(); buildPage();
} }
@ -95,6 +97,12 @@ public class MenuPage extends BasePage
KillButton killButton = new KillButton(getPlugin()); KillButton killButton = new KillButton(getPlugin());
addButton(8 + 18, new ShopItem(Material.TNT, "Kill Private Server", 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); 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()); OptionsButton optionsButton = new OptionsButton(getPlugin(), getShop());

View File

@ -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 @Override
public void onClick(Player player, ClickType clickType) public void onClick(Player player, ClickType clickType)
@ -116,7 +116,9 @@ public class OptionsPage extends BasePage
private void toggleWhitelist() private void toggleWhitelist()
{ {
// TODO CHISSPIE _config.PlayerServerWhitelist = !_config.PlayerServerWhitelist;
if (_config.PlayerServerWhitelist == true)
_config.PublicServer = false;
refresh(); refresh();
} }
@ -138,6 +140,14 @@ public class OptionsPage extends BasePage
ChatColor.RED + " ", ChatColor.RED + " ",
ChatColor.RESET + "Click to " + (preference ? "Disable" : "Enable") }; 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<name>" };
}
addButton(index, new ShopItem(material, data, (preference ? ChatColor.GREEN : ChatColor.RED) + name, description, 1, false, false), button); 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); addButton(index + 9, new ShopItem(Material.INK_SACK, (preference ? (byte) 10 : (byte) 8), (preference ? ChatColor.GREEN : ChatColor.RED) + name, description, 1, false, false), button);
} }

View File

@ -1,10 +1,14 @@
package nautilus.game.arcade.gui.privateServer.page; package nautilus.game.arcade.gui.privateServer.page;
import java.util.ArrayList;
import java.util.List;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType; import org.bukkit.event.inventory.ClickType;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
import mineplex.core.game.GameCategory;
import mineplex.core.shop.item.IButton; import mineplex.core.shop.item.IButton;
import mineplex.core.shop.item.ShopItem; import mineplex.core.shop.item.ShopItem;
import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.ArcadeManager;
@ -24,6 +28,8 @@ public class SetGamePage extends BasePage
{ {
addBackButton(4); addBackButton(4);
//Old code I'm not removing in-case you want the old style - William.
/*
int arcadeSlot = 9; int arcadeSlot = 9;
int classicSlot = 13; int classicSlot = 13;
int survivalSlot = 15; int survivalSlot = 15;
@ -58,19 +64,59 @@ public class SetGamePage extends BasePage
addGameButton(slot, type); addGameButton(slot, type);
} }
*/
ArrayList<GameCategory> allowedCats = new ArrayList<GameCategory>();
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) private void addGameButton(int slot, final GameType type)
{ {
String infoString = ChatColor.RESET + C.cGray + "Click to make this next Game Type"; String infoString = ChatColor.RESET + C.cGray + "Make this next Game Type";
ShopItem shopItem = new ShopItem(type.GetMaterial(), type.GetMaterialData(), type.GetLobbyName(), new String[]{infoString}, 1, false, false); 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() addButton(slot, shopItem, new IButton()
{ {
@Override @Override
public void onClick(Player player, ClickType clickType) public void onClick(Player player, ClickType clickType)
{ {
getPlugin().GetGame().setGame(type, player, true); if (clickType == ClickType.LEFT)
player.closeInventory(); {
getPlugin().GetGame().setGame(type, player, true);
player.closeInventory();
return;
}
else if (clickType == ClickType.RIGHT)
{
getShop().openPageForPlayer(player, new ChooseMapPage(getPlugin(), getShop(), player, type));
return;
}
} }
}); });
} }

View File

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

View File

@ -131,7 +131,10 @@ public class PerkNeedler extends SmashPerk
DamageCause.THORNS, 1.1, true, true, false, DamageCause.THORNS, 1.1, true, true, false,
damager.getName(), GetName()); 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 @EventHandler

View File

@ -2,42 +2,21 @@ package nautilus.game.arcade.kit.perks;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator; import java.util.Iterator;
import java.util.Set; 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.C;
import mineplex.core.common.util.F; 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.UtilBlock;
import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilEvent; import mineplex.core.common.util.UtilEvent;
import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.core.common.util.UtilGear; import mineplex.core.common.util.UtilGear;
import mineplex.core.common.util.UtilParticle; 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.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist; import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.recharge.Recharge; import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType; import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent; 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.Perk;
import nautilus.game.arcade.kit.perks.data.IBlockRestorer; 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 public class PerkWitherAttack extends Perk
{ {
private ArrayList<WitherSkull> _active = new ArrayList<WitherSkull>(); private ArrayList<WitherSkull> _active = new ArrayList<WitherSkull>();

View File

@ -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<Integer[]> colors = new ArrayList<Integer[]>();
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<Location, Integer> locations = new HashMap<Location, Integer>();
public void run()
{
tick++;
Iterator<Entry<Location, Integer>> itel = locations.entrySet().iterator();
while (itel.hasNext())
{
Entry<Location, Integer> 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);
}
}

View File

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

View File

@ -76,7 +76,7 @@ public class PerkWitherMinion extends Perk
Manager.GetGame().CreatureAllowOverride = true; 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); Skeleton skel = player.getWorld().spawn(player.getEyeLocation(), Skeleton.class);
_ents.add(skel); _ents.add(skel);

View File

@ -77,7 +77,7 @@ public class GameChatManager implements Listener
} }
else if (Manager.GetGameHostManager().isAdmin(event.getPlayer(), false)) 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 "; rankStr = C.cDGreen + C.Bold + "Event Admin ";
else else
rankStr = C.cDGreen + C.Bold + "MPS Admin "; rankStr = C.cDGreen + C.Bold + "MPS Admin ";

View File

@ -37,6 +37,7 @@ public class GameCreationManager implements Listener
private ArrayList<GameType> _lastGames = new ArrayList<GameType>(); private ArrayList<GameType> _lastGames = new ArrayList<GameType>();
public String MapPref = null; public String MapPref = null;
public String MapSource = null;
public GameCreationManager(ArcadeManager manager) public GameCreationManager(ArcadeManager manager)
{ {

View File

@ -30,7 +30,7 @@ public class GameGemManager implements Listener
{ {
ArcadeManager Manager; ArcadeManager Manager;
boolean DoubleGem = false; boolean DoubleGem = true;
public GameGemManager(ArcadeManager manager) public GameGemManager(ArcadeManager manager)
{ {

View File

@ -10,7 +10,9 @@ import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilGear; import mineplex.core.common.util.UtilGear;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilTextBottom;
import mineplex.core.common.util.UtilTime; import mineplex.core.common.util.UtilTime;
import mineplex.core.game.GameCategory;
import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.updater.UpdateType; import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.event.UpdateEvent;
@ -18,6 +20,7 @@ import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType; import nautilus.game.arcade.GameType;
import nautilus.game.arcade.game.Game.GameState; import nautilus.game.arcade.game.Game.GameState;
import nautilus.game.arcade.gui.privateServer.PrivateServerShop; import nautilus.game.arcade.gui.privateServer.PrivateServerShop;
import nautilus.game.arcade.gui.privateServer.page.GameVotingPage;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.ChatColor; 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.PlayerCommandPreprocessEvent;
import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerLoginEvent;
import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.plugin.Plugin; import org.bukkit.plugin.Plugin;
@ -62,6 +66,10 @@ public class GameHostManager implements Listener
private HashMap<Player, Boolean> _permissionMap = new HashMap<Player, Boolean>(); private HashMap<Player, Boolean> _permissionMap = new HashMap<Player, Boolean>();
private boolean _voteInProgress = false;
private HashMap<String, GameType> _votes = new HashMap<String, GameType>();
private int _voteNotificationStage = 1;
public GameHostManager(ArcadeManager manager) public GameHostManager(ArcadeManager manager)
{ {
Manager = manager; Manager = manager;
@ -101,19 +109,28 @@ public class GameHostManager implements Listener
legendGames.add(GameType.Build); legendGames.add(GameType.Build);
legendGames.add(GameType.UHC); legendGames.add(GameType.UHC);
legendGames.add(GameType.MineStrike); legendGames.add(GameType.MineStrike);
legendGames.add(GameType.SnowFight);
legendGames.add(GameType.Gravity);
legendGames.add(GameType.Barbarians);
legendGames.add(GameType.OldMineWare);
legendGames.add(GameType.SmashDomination);
legendGames.add(GameType.Skywars); legendGames.add(GameType.Skywars);
// Team variants // Team variants - Currently being remade.
/*
legendGames.add(GameType.DragonEscapeTeams); legendGames.add(GameType.DragonEscapeTeams);
legendGames.add(GameType.DragonsTeams); legendGames.add(GameType.DragonsTeams);
legendGames.add(GameType.QuiverTeams); legendGames.add(GameType.QuiverTeams);
legendGames.add(GameType.SmashTeams); legendGames.add(GameType.SmashTeams);
legendGames.add(GameType.SpleefTeams); legendGames.add(GameType.SpleefTeams);
legendGames.add(GameType.SurvivalGamesTeams); legendGames.add(GameType.SurvivalGamesTeams);
*/
//Rejected / Other
legendGames.add(GameType.Evolution);
legendGames.add(GameType.MilkCow);
legendGames.add(GameType.SearchAndDestroy);
legendGames.add(GameType.ZombieSurvival);
legendGames.add(GameType.SurvivalGamesTeams);
legendGames.add(GameType.SkywarsTeams);
legendGames.add(GameType.SmashTeams);
legendGames.add(GameType.SnowFight);
legendGames.add(GameType.Gravity);
legendGames.add(GameType.Barbarians);
legendGames.add(GameType.SmashDomination);
//Config Defaults //Config Defaults
if (Manager.GetHost() != null && Manager.GetHost().length() > 0) if (Manager.GetHost() != null && Manager.GetHost().length() > 0)
@ -122,6 +139,16 @@ public class GameHostManager implements Listener
} }
} }
public ArrayList<GameType> hasWarning()
{
ArrayList<GameType> games = new ArrayList<>();
games.add(GameType.Evolution);
games.add(GameType.MilkCow);
games.add(GameType.SearchAndDestroy);
games.add(GameType.ZombieSurvival);
return games;
}
@EventHandler @EventHandler
public void updateHost(UpdateEvent event) public void updateHost(UpdateEvent event)
{ {
@ -152,6 +179,42 @@ public class GameHostManager implements Listener
} }
} }
@EventHandler
public void voteNotification(UpdateEvent e)
{
if (e.getType() != UpdateType.FAST)
return;
if (!_voteInProgress)
return;
if (_voteNotificationStage == 1)
{
UtilTextBottom.display(C.cYellow + C.Bold + "Type " + C.cGold + C.Bold + "/vote" + C.cYellow + C.Bold + " to vote for next game", UtilServer.getPlayers());
_voteNotificationStage++;
return;
}
else if (_voteNotificationStage == 2)
{
UtilTextBottom.display(C.cGold + C.Bold + "Type " + C.cYellow + C.Bold + "/vote" + C.cGold + C.Bold + " to vote for next game", UtilServer.getPlayers());
_voteNotificationStage = 1;
return;
}
}
@EventHandler
public void whitelistJoin(PlayerLoginEvent event)
{
Player p = event.getPlayer();
if (Manager.GetServerConfig().PlayerServerWhitelist){
if (!getWhitelist().contains(p.getName())){
if (_host == p)
return;
Manager.GetPortal().sendToHub(p, "You aren't on the whitelist of this Mineplex Private Server.");
}
}
}
@EventHandler @EventHandler
public void adminJoin(PlayerJoinEvent event) public void adminJoin(PlayerJoinEvent event)
{ {
@ -298,17 +361,76 @@ public class GameHostManager implements Listener
} }
@EventHandler @EventHandler
public void menuCommand(PlayerCommandPreprocessEvent event) public void broadcastCommand(PlayerCommandPreprocessEvent event)
{ {
if (!event.getMessage().toLowerCase().startsWith("/bc"))
return;
if (!isPrivateServer()) if (!isPrivateServer())
return; return;
if (!isAdmin(event.getPlayer(), true)) if (!isAdmin(event.getPlayer(), true))
{
event.getPlayer().sendMessage(F.main("Broadcast", "Only MPS admins can use this command."));
event.setCancelled(true);
return;
}
event.setCancelled(true);
if (event.getMessage().split(" ").length < 2)
{
event.getPlayer().sendMessage(F.main("Broadcast", "/bc <message>"));
return;
}
String msg = "";
for (int i = 1; i < event.getMessage().split(" ").length; i++)
{
msg += event.getMessage().split(" ")[i] + " ";
}
msg = msg.trim();
Bukkit.broadcastMessage("<EFBFBD>6<EFBFBD>l" + event.getPlayer().getName() + " <20>e" + msg);
}
@EventHandler
public void voteCommand(PlayerCommandPreprocessEvent event)
{
if (!event.getMessage().toLowerCase().startsWith("/vote"))
return; return;
if (!isPrivateServer())
{
UtilPlayer.message(event.getPlayer(), F.main("Vote", "This command is only available on private servers."));
event.setCancelled(true);
return;
}
if (!_voteInProgress)
{
UtilPlayer.message(event.getPlayer(), F.main("Vote", "There is no vote in progress."));
event.setCancelled(true);
return;
}
event.setCancelled(true);
_shop.openPageForPlayer(event.getPlayer(), new GameVotingPage(Manager, _shop, event.getPlayer()));
return;
}
@EventHandler
public void menuCommand(PlayerCommandPreprocessEvent event)
{
if (!event.getMessage().toLowerCase().startsWith("/menu")) if (!event.getMessage().toLowerCase().startsWith("/menu"))
return; return;
if (!isPrivateServer())
return;
if (!isAdmin(event.getPlayer(), true))
return;
event.setCancelled(true); event.setCancelled(true);
openMenu(event.getPlayer()); openMenu(event.getPlayer());
} }
@ -355,9 +477,14 @@ public class GameHostManager implements Listener
if (_host == null || !event.getPlayer().equals(_host)) if (_host == null || !event.getPlayer().equals(_host))
return; return;
if (!event.getMessage().toLowerCase().startsWith("/whitelist ")) if (!event.getMessage().toLowerCase().startsWith("/whitelist"))
return; return;
if (!isPrivateServer())
return;
event.setCancelled(true);
String[] args = event.getMessage().split(" "); String[] args = event.getMessage().split(" ");
for (int i=1 ; i<args.length ; i++) for (int i=1 ; i<args.length ; i++)
@ -366,7 +493,7 @@ public class GameHostManager implements Listener
if (_whitelist.add(name)) if (_whitelist.add(name))
{ {
UtilPlayer.message(event.getPlayer(), F.main("Host", "Added " + F.elem(name) + " to the whitelist.")); UtilPlayer.message(event.getPlayer(), F.main("Host", "Added " + F.elem(args[i]) + " to the whitelist."));
} }
} }
} }
@ -451,6 +578,24 @@ public class GameHostManager implements Listener
return games; return games;
} }
public HashMap<GameCategory, ArrayList<GameType>> getGames(Player p)
{
HashMap<GameCategory, ArrayList<GameType>> games = new HashMap<GameCategory, ArrayList<GameType>>();
for (GameCategory cat : GameCategory.values())
{
ArrayList<GameType> types = new ArrayList<>();
for (GameType type : getAvailableGames(p))
{
if (type.getGameCategory().equals(cat))
{
types.add(type);
}
}
games.put(cat, types);
}
return games;
}
public void ban(Player player) public void ban(Player player)
{ {
_blacklist.add(player.getName()); _blacklist.add(player.getName());
@ -536,28 +681,6 @@ public class GameHostManager implements Listener
return 4; return 4;
} }
@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]);
_host = Bukkit.getPlayerExact(Manager.GetServerConfig().HostName);
if (_host != null)
_hostRank = Manager.GetClients().Get(_host).GetRank();
setDefaultConfig();
event.setCancelled(true);
}
@EventHandler @EventHandler
public void setEventGame(PlayerCommandPreprocessEvent event) public void setEventGame(PlayerCommandPreprocessEvent event)
{ {
@ -650,4 +773,40 @@ public class GameHostManager implements Listener
{ {
_isEventServer = var; _isEventServer = var;
} }
public HashMap<String, GameType> getVotes()
{
return _votes;
}
public void setVoteInProgress(boolean voteInProgress)
{
_voteInProgress = voteInProgress;
}
public boolean isVoteInProgress()
{
return _voteInProgress;
}
public Rank getHostRank()
{
return _hostRank;
}
public void setHostRank(Rank rank)
{
_hostRank = rank;
}
public Player getHost()
{
return _host;
}
public void setHost(Player player)
{
_host = player;
}
} }

View File

@ -185,13 +185,20 @@ public class GameLobbyManager implements Listener, IPacketHandler
{ {
for (GameTeam team : Manager.GetGame().GetTeamList()) for (GameTeam team : Manager.GetGame().GetTeamList())
{ {
if (rank == Rank.ALL) if(team.GetDisplaytag())
{ {
scoreboard.registerNewTeam(rank.Name + team.GetName().toUpperCase()).setPrefix(team.GetColor() + ""); scoreboard.registerNewTeam(rank.Name + team.GetName().toUpperCase()).setPrefix(team.GetColor() + C.Bold + team.GetName() + team.GetColor() + " ");
} }
else else
{ {
scoreboard.registerNewTeam(rank.Name + team.GetName().toUpperCase()).setPrefix(rank.GetTag(true, true) + ChatColor.RESET + " " + team.GetColor()); if (rank == Rank.ALL)
{
scoreboard.registerNewTeam(rank.Name + team.GetName().toUpperCase()).setPrefix(team.GetColor() + "");
}
else
{
scoreboard.registerNewTeam(rank.Name + team.GetName().toUpperCase()).setPrefix(rank.GetTag(true, true) + ChatColor.RESET + " " + team.GetColor());
}
} }
} }
} }
@ -323,7 +330,7 @@ public class GameLobbyManager implements Listener, IPacketHandler
_teamBlocks.clear(); _teamBlocks.clear();
//Smash //Smash
if (game.GetType() == GameType.Smash || game.GetType() == GameType.SurvivalGames) if (game.HideTeamSheep)
{ {
//Text //Text
WriteTeamLine("Select", 0, 159, (byte)15); WriteTeamLine("Select", 0, 159, (byte)15);
@ -333,59 +340,8 @@ public class GameLobbyManager implements Listener, IPacketHandler
return; return;
} }
//UHC
if (game.GetType() == GameType.UHC)
{
// if (game.GetTeamList().size() > 1)
// {
// //Text
// WriteTeamLine("", 0, 159, (byte)15);
// WriteTeamLine("", 1, 159, (byte)4);
//
// for (int i=0 ; i<game.GetTeamList().size() ; i++)
// {
// GameTeam team = game.GetTeamList().get(i);
//
// //Circle Math
// double lead = i * ((2d * Math.PI)/game.GetTeamList().size());
// double sizeMod = 32;
// double oX = -Math.sin(lead) * sizeMod;
// double oZ = Math.cos(lead) * sizeMod;
//
// //Location
// Location entLoc = spawn.clone().add(oX, 0, oZ);
// entLoc.setY(_teamDisplay.getY());
//
// //Blocks
// SetKitTeamBlocks(entLoc.clone(), 35, team.GetColorData(), _teamBlocks);
//
// entLoc.add(0, 1.5, 0);
//
// entLoc.getChunk().load();
//
// //NPC
// Sheep ent = (Sheep)Manager.GetCreature().SpawnEntity(entLoc, EntityType.SHEEP);
// ent.setRemoveWhenFarAway(false);
// ent.setCustomNameVisible(false);
//
// ent.setColor(DyeColor.getByWoolData(team.GetColorData()));
//
// UtilEnt.Vegetate(ent);
//
// team.SetTeamEntity(ent);
//
// _teams.put(ent, new LobbyEnt(ent, entLoc, team));
// }
//
// return;
//
// }
return;
}
//Standard //Standard
if (game.GetKits().length > 1 || game.GetTeamList().size() < 6) if ((game.GetKits().length > 1 || game.GetTeamList().size() < 6) && game.GetType() != GameType.SurvivalGamesTeams)
{ {
//Display //Display
ArrayList<GameTeam> teams = new ArrayList<GameTeam>(); ArrayList<GameTeam> teams = new ArrayList<GameTeam>();
@ -558,7 +514,7 @@ public class GameLobbyManager implements Listener, IPacketHandler
} }
//Smash //Smash
if (game.GetType() == GameType.Smash || game.GetType() == GameType.SurvivalGames) if (game.ReplaceTeamsWithKits)
{ {
// WriteKitLine("Free", 0, 159, (byte)15); // WriteKitLine("Free", 0, 159, (byte)15);
// WriteKitLine("Kits", 1, 159, (byte)4); // WriteKitLine("Kits", 1, 159, (byte)4);
@ -911,9 +867,9 @@ public class GameLobbyManager implements Listener, IPacketHandler
WriteGameLine(game.GetType().GetLobbyName(), 0, 159, (byte)14); WriteGameLine(game.GetType().GetLobbyName(), 0, 159, (byte)14);
if (game.GetMode() == null) if (game.GetMode() == null)
WriteGameLine(" ", 1, 159, (byte)14); WriteGameLine(" ", 1, 159, (byte)1);
else else
WriteGameLine(game.GetMode(), 1, 159, (byte)14); WriteGameLine(game.GetMode(), 1, 159, (byte)1);
DisplayWaiting(); DisplayWaiting();
CreateKits(game); CreateKits(game);
@ -1024,7 +980,14 @@ public class GameLobbyManager implements Listener, IPacketHandler
kitName = kitName.substring(0, 16); kitName = kitName.substring(0, 16);
// Remove old // Remove old
entry.getValue().resetScores(C.cGray + C.Bold + "Kit"); //entry.getValue().resetScores(teamColor + C.Bold + "Kit");
for(String string : entry.getValue().getEntries())
{
if(string.endsWith("Kit"))
{
entry.getValue().resetScores(string);
}
}
entry.getValue().resetScores(_kitMap.get(entry.getKey()) + ""); entry.getValue().resetScores(_kitMap.get(entry.getKey()) + "");
// Set new // Set new

View File

@ -227,6 +227,9 @@ public class GameManager implements Listener
if (game instanceof UHC && !((UHC)game).isMapLoaded()) if (game instanceof UHC && !((UHC)game).isMapLoaded())
return; return;
if (Manager.GetGameHostManager().isPrivateServer() && Manager.GetGameHostManager().isVoteInProgress())
return;
//Disabling Cosmetics //Disabling Cosmetics
if (game.GetCountdown() <= 5 && game.GetCountdown() >= 0 && game.GadgetsDisabled) if (game.GetCountdown() <= 5 && game.GetCountdown() >= 0 && game.GadgetsDisabled)
{ {

View File

@ -124,7 +124,14 @@ public class GameScoreboard
for (GameTeam team : Game.GetTeamList()) for (GameTeam team : Game.GetTeamList())
{ {
System.out.println("Scoreboard Team: " + team.GetName().toUpperCase()); System.out.println("Scoreboard Team: " + team.GetName().toUpperCase());
_scoreboard.registerNewTeam(ParseTeamName(team.GetName().toUpperCase())).setPrefix(team.GetColor() + ""); if(team.GetDisplaytag())
{
_scoreboard.registerNewTeam(ParseTeamName(team.GetName().toUpperCase())).setPrefix(team.GetColor() + C.Bold + team.GetName() + team.GetColor() + " ");
}
else
{
_scoreboard.registerNewTeam(ParseTeamName(team.GetName().toUpperCase())).setPrefix(team.GetColor() + "");
}
} }
/* /*

View File

@ -0,0 +1,25 @@
package nautilus.game.arcade.stats;
import nautilus.game.arcade.game.Game;
import nautilus.game.arcade.game.games.wither.events.HumanReviveEvent;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
public class WitherAssaultReviveTracker extends StatTracker<Game>
{
public WitherAssaultReviveTracker(Game game)
{
super(game);
}
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onCombatDeath(HumanReviveEvent event)
{
if (getGame().GetState() != Game.GameState.Live)
return;
addStat(event.getPlayer(), "WitherHeal", 1, false, false);
}
}

View File

@ -16,6 +16,7 @@ import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.WorldUtil; import mineplex.core.common.util.WorldUtil;
import mineplex.core.common.util.ZipUtil; import mineplex.core.common.util.ZipUtil;
import mineplex.core.timing.TimingManager; import mineplex.core.timing.TimingManager;
import nautilus.game.arcade.GameType;
import nautilus.game.arcade.game.Game; import nautilus.game.arcade.game.Game;
import nautilus.game.arcade.game.games.uhc.UHC; import nautilus.game.arcade.game.games.uhc.UHC;
import net.minecraft.server.v1_7_R4.ChunkPreLoadEvent; import net.minecraft.server.v1_7_R4.ChunkPreLoadEvent;
@ -50,6 +51,8 @@ public class WorldData
public String MapName = "Null"; public String MapName = "Null";
public String MapAuthor = "Null"; public String MapAuthor = "Null";
public GameType Game = null;
public HashMap<String, ArrayList<Location>> SpawnLocs = new HashMap<String, ArrayList<Location>>(); public HashMap<String, ArrayList<Location>> SpawnLocs = new HashMap<String, ArrayList<Location>>();
private HashMap<String, ArrayList<Location>> DataLocs = new HashMap<String, ArrayList<Location>>(); private HashMap<String, ArrayList<Location>> DataLocs = new HashMap<String, ArrayList<Location>>();
private HashMap<String, ArrayList<Location>> CustomLocs = new HashMap<String, ArrayList<Location>>(); private HashMap<String, ArrayList<Location>> CustomLocs = new HashMap<String, ArrayList<Location>>();
@ -67,6 +70,7 @@ public class WorldData
public void Initialize() public void Initialize()
{ {
final WorldData worldData = this; final WorldData worldData = this;
GetFile();
UtilServer.getServer().getScheduler().runTaskAsynchronously(Host.Manager.getPlugin(), new Runnable() UtilServer.getServer().getScheduler().runTaskAsynchronously(Host.Manager.getPlugin(), new Runnable()
{ {
@ -121,18 +125,50 @@ public class WorldData
}); });
} }
protected GameType GetGame()
{
return Game;
}
protected String GetFile() protected String GetFile()
{ {
if (File == null) if (File == null)
{ {
File = Host.GetFiles().get(UtilMath.r(Host.GetFiles().size())); GameType game = null;
int gameRandom = UtilMath.r(Host.GetFiles().size());
int i = 0;
for(GameType type : Host.GetFiles().keySet())
{
if(i == gameRandom)
{
game = type;
break;
}
i++;
}
Game = game;
int map = UtilMath.r(Host.GetFiles().get(game).size());
File = Host.GetFiles().get(game).get(map);
//Don't allow repeat maps. //Don't allow repeat maps.
if (Host.GetFiles().size() > 1) if (Host.GetFiles().size() > 1)
{ {
while (File.equals(Host.Manager.GetGameCreationManager().GetLastMap())) while (File.equals(Host.Manager.GetGameCreationManager().GetLastMap()))
{ {
File = Host.GetFiles().get(UtilMath.r(Host.GetFiles().size())); GameType _game = null;
int _gameRandom = UtilMath.r(Host.GetFiles().size());
int _i = 0;
for(GameType _type : Host.GetFiles().keySet())
{
if(_i == _gameRandom)
{
_game = _type;
break;
}
_i++;
}
int _map = UtilMath.r(Host.GetFiles().get(game).size());
File = Host.GetFiles().get(_game).get(_map);
} }
} }
} }
@ -145,8 +181,9 @@ public class WorldData
public String GetFolder() public String GetFolder()
{ {
if (Folder == null) if (Folder == null)
Folder = "Game" + Id + "_" + Host.GetName() + "_" + GetFile(); {
Folder = "Game" + Id + "_" + GetGame().GetName() + "_" + GetFile();
}
return Folder; return Folder;
} }
@ -160,7 +197,7 @@ public class WorldData
TimingManager.stop("UnzipWorld creating folders"); TimingManager.stop("UnzipWorld creating folders");
TimingManager.start("UnzipWorld UnzipToDirectory"); TimingManager.start("UnzipWorld UnzipToDirectory");
ZipUtil.UnzipToDirectory("../../update/maps/" + Host.GetName() + "/" + GetFile() + ".zip", folder); ZipUtil.UnzipToDirectory("../../update/maps/" + GetGame().GetName() + "/" + GetFile() + ".zip", folder);
TimingManager.stop("UnzipWorld UnzipToDirectory"); TimingManager.stop("UnzipWorld UnzipToDirectory");
} }
@ -523,4 +560,5 @@ public class WorldData
{ {
return _dataEntries.get(key); return _dataEntries.get(key);
} }
} }