Merge remote-tracking branch 'remotes/origin/develop' into feature/gems

# Conflicts:
#	Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java
#	Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java
#	Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameGemManager.java
This commit is contained in:
Shaun Bennett 2016-06-09 00:39:39 -05:00
commit 699b35995f
87 changed files with 6198 additions and 1675 deletions

View File

@ -5,6 +5,8 @@ import org.bukkit.entity.Player;
import mineplex.core.achievement.AchievementManager; import mineplex.core.achievement.AchievementManager;
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.F;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
public class StatsCommand extends CommandBase<AchievementManager> public class StatsCommand extends CommandBase<AchievementManager>
@ -32,6 +34,9 @@ public class StatsCommand extends CommandBase<AchievementManager>
if (/* StaffServer special case */Plugin.getIncognito() != null && Plugin.getIncognito().Get(target).Hidden) if (/* StaffServer special case */Plugin.getIncognito() != null && Plugin.getIncognito().Get(target).Hidden)
{ {
UtilPlayer.message(caller,
F.main("Online Player Search", "" + C.mCount + "0" + C.mBody + " matches for [" + C.mElem
+ args[0] + C.mBody + "]."));
return; return;
} }

View File

@ -7,12 +7,6 @@ import java.util.Collections;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.plugin.java.JavaPlugin;
import mineplex.core.MiniDbClientPlugin; import mineplex.core.MiniDbClientPlugin;
import mineplex.core.account.CoreClientManager; import mineplex.core.account.CoreClientManager;
import mineplex.core.common.Rank; import mineplex.core.common.Rank;
@ -29,12 +23,17 @@ import mineplex.core.friend.command.FriendsDisplay;
import mineplex.core.friend.data.FriendData; import mineplex.core.friend.data.FriendData;
import mineplex.core.friend.data.FriendRepository; import mineplex.core.friend.data.FriendRepository;
import mineplex.core.friend.data.FriendStatus; import mineplex.core.friend.data.FriendStatus;
import mineplex.core.incognito.IncognitoManager;
import mineplex.core.portal.Portal; import mineplex.core.portal.Portal;
import mineplex.core.preferences.PreferencesManager; import mineplex.core.preferences.PreferencesManager;
import mineplex.core.updater.UpdateType; import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.event.UpdateEvent;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.plugin.java.JavaPlugin;
public class FriendManager extends MiniDbClientPlugin<FriendData> public class FriendManager extends MiniDbClientPlugin<FriendData>
{ {
private static FriendSorter _friendSorter = new FriendSorter(); private static FriendSorter _friendSorter = new FriendSorter();
@ -378,7 +377,7 @@ public class FriendManager extends MiniDbClientPlugin<FriendData>
message.add(C.cDAqua + "Toggle GUI").click("run_command", "/friendsdisplay"); message.add(C.cDAqua + "Toggle GUI").click("run_command", "/friendsdisplay");
message.hover("show_text", C.cAqua + "Toggle friends to display in a inventory"); message.hover("show_text", C.cAqua + "Toggle friends to display in an inventory");
message.add(C.cAqua + C.Strike + "======================"); message.add(C.cAqua + C.Strike + "======================");

View File

@ -81,7 +81,9 @@ public enum GameDisplay
Valentines("Valentines Vendetta", Material.LEATHER, (byte)0, GameCategory.EXTRA, 61), Valentines("Valentines Vendetta", Material.LEATHER, (byte)0, GameCategory.EXTRA, 61),
Event("Mineplex Event", Material.CAKE, (byte)0, GameCategory.EVENT, 999); Event("Mineplex Event", Material.CAKE, (byte)0, GameCategory.EVENT, 999),
Brawl("Brawl", Material.DIAMOND, (byte) 0, GameCategory.EVENT, 998);
String _name; String _name;
String _lobbyName; String _lobbyName;

View File

@ -5,6 +5,7 @@ import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.Map.Entry; import java.util.Map.Entry;
import mineplex.core.MiniPlugin; import mineplex.core.MiniPlugin;
@ -770,7 +771,7 @@ public class ItemStackFactory extends MiniPlugin
public ItemStack CreateStack(Material type, byte data, int amount, String name, String[] lore, String owner, boolean unbreakable) public ItemStack CreateStack(Material type, byte data, int amount, String name, String[] lore, String owner, boolean unbreakable)
{ {
return CreateStack(type.getId(), data, amount, (short)0, name, ArrayToList(lore), owner, unbreakable); return CreateStack(type.getId(), data, amount, (short)0, name, ArrayToList(lore), owner, unbreakable, 0, null);
} }
public ItemStack CreateStack(int id, byte data, int amount, String name, String[] lore, String owner) public ItemStack CreateStack(int id, byte data, int amount, String name, String[] lore, String owner)
@ -790,7 +791,7 @@ public class ItemStackFactory extends MiniPlugin
public ItemStack CreateStack(int id, byte data, int amount, short damage, String name, String[] lore, String owner, boolean unbreakable) public ItemStack CreateStack(int id, byte data, int amount, short damage, String name, String[] lore, String owner, boolean unbreakable)
{ {
return CreateStack(id, data, amount, damage, name, ArrayToList(lore), owner, unbreakable); return CreateStack(id, data, amount, damage, name, ArrayToList(lore), owner, unbreakable, 0, null);
} }
@ -801,13 +802,19 @@ public class ItemStackFactory extends MiniPlugin
public ItemStack CreateStack(int id, byte data, int amount, short damage, String name, List<String> lore, String owner) public ItemStack CreateStack(int id, byte data, int amount, short damage, String name, List<String> lore, String owner)
{ {
return CreateStack(id, data, amount, damage, name, lore, owner, true); return CreateStack(id, data, amount, damage, name, lore, owner, true, 0, null);
}
@SuppressWarnings("deprecation")
public ItemStack CreateStack(int id, byte data, int amount, short damage, String name, List<String> lore, String owner, boolean unbreakable)
{
return CreateStack(id, data, amount, damage, name, lore, owner, unbreakable, 0, null);
} }
//XXX Owner Variant End //XXX Owner Variant End
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
public ItemStack CreateStack(int id, byte data, int amount, short damage, String name, List<String> lore, String owner, boolean unbreakable) public ItemStack CreateStack(int id, byte data, int amount, short damage, String name, List<String> lore, String owner, boolean unbreakable, Integer enchLevel, Enchantment... enchantments)
{ {
ItemStack stack; ItemStack stack;
if (data == 0) if (data == 0)
@ -875,6 +882,14 @@ public class ItemStackFactory extends MiniPlugin
if (setMeta) if (setMeta)
stack.setItemMeta(itemMeta); stack.setItemMeta(itemMeta);
if(enchantments != null)
{
for(Enchantment enchantment : enchantments)
{
stack.addEnchantment(enchantment, enchLevel);
}
}
//Unbreakable //Unbreakable
if (unbreakable) if (unbreakable)
{ {

View File

@ -82,7 +82,7 @@ public class Party
for (Rank rank : Rank.values()) for (Rank rank : Rank.values())
{ {
if (rank != Rank.ALL) if (rank != Rank.ALL)
_scoreboard.registerNewTeam(rank.Name).setPrefix(rank.getTag(true, false) + ChatColor.RESET + " "); _scoreboard.registerNewTeam(rank.Name).setPrefix(rank.getTag(true, true) + ChatColor.RESET + " ");
else else
_scoreboard.registerNewTeam(rank.Name).setPrefix(""); _scoreboard.registerNewTeam(rank.Name).setPrefix("");
} }

View File

@ -160,7 +160,7 @@ public class PersonalServerManager extends MiniPlugin
} }
final ServerGroup serverGroup = new ServerGroup(serverName, serverName, host.getName(), ram, cpu, 1, 0, UtilMath.random.nextInt(250) + 19999, true, "arcade.zip", "Arcade.jar", "plugins/Arcade/", minPlayers, maxPlayers, final ServerGroup serverGroup = new ServerGroup(serverName, serverName, host.getName(), ram, cpu, 1, 0, UtilMath.random.nextInt(250) + 19999, true, "arcade.zip", "Arcade.jar", "plugins/Arcade/", minPlayers, maxPlayers,
true, false, false, games, "Player", true, event, false, true, false, true, true, false, false, false, false, true, true, true, false, false, "", _us ? Region.US : Region.EU, "", "", "", ""); true, false, false, games, "", "Player", true, event, false, true, false, true, true, false, false, false, false, true, true, true, false, false, "", _us ? Region.US : Region.EU, "", "", "", "");
getPlugin().getServer().getScheduler().runTaskAsynchronously(getPlugin(), new Runnable() getPlugin().getServer().getScheduler().runTaskAsynchronously(getPlugin(), new Runnable()
{ {

View File

@ -50,6 +50,7 @@ public class ServerGroup
private boolean _generateFreeVersions; private boolean _generateFreeVersions;
private String _games; private String _games;
private String _modes;
private String _serverType; private String _serverType;
private boolean _addNoCheat; private boolean _addNoCheat;
private boolean _addWorldEdit; private boolean _addWorldEdit;
@ -87,6 +88,7 @@ public class ServerGroup
_tournamentPoints = Boolean.valueOf(data.get("tournamentPoints")); _tournamentPoints = Boolean.valueOf(data.get("tournamentPoints"));
_generateFreeVersions = Boolean.valueOf(data.get("generateFreeVersions")); _generateFreeVersions = Boolean.valueOf(data.get("generateFreeVersions"));
_games = data.get("games"); _games = data.get("games");
_modes = data.get("modes");
_serverType = data.get("serverType"); _serverType = data.get("serverType");
_addNoCheat = Boolean.valueOf(data.get("addNoCheat")); _addNoCheat = Boolean.valueOf(data.get("addNoCheat"));
_addWorldEdit = Boolean.valueOf(data.get("addWorldEdit")); _addWorldEdit = Boolean.valueOf(data.get("addWorldEdit"));
@ -117,7 +119,7 @@ public class ServerGroup
} }
public ServerGroup(String name, String prefix, String host, int ram, int cpu, int totalServers, int joinable, int portSection, boolean arcade, String worldZip, String plugin, String configPath public ServerGroup(String name, String prefix, String host, int ram, int cpu, int totalServers, int joinable, int portSection, boolean arcade, String worldZip, String plugin, String configPath
, int minPlayers, int maxPlayers, boolean pvp, boolean tournament, boolean tournamentPoints, String games, String serverType, boolean noCheat, boolean worldEdit, boolean teamRejoin , int minPlayers, int maxPlayers, boolean pvp, boolean tournament, boolean tournamentPoints, String games, String modes, String serverType, boolean noCheat, boolean worldEdit, boolean teamRejoin
, boolean teamAutoJoin, boolean teamForceBalance, boolean gameAutoStart, boolean gameTimeout, boolean rewardGems, boolean rewardItems, boolean rewardStats , boolean teamAutoJoin, boolean teamForceBalance, boolean gameAutoStart, boolean gameTimeout, boolean rewardGems, boolean rewardItems, boolean rewardStats
, boolean rewardAchievements, boolean hotbarInventory, boolean hotbarHubClock, boolean playerKickIdle, boolean staffOnly, boolean whitelist, String resourcePack, Region region , boolean rewardAchievements, boolean hotbarInventory, boolean hotbarHubClock, boolean playerKickIdle, boolean staffOnly, boolean whitelist, String resourcePack, Region region
, String teamServerKey, String portalBottomCornerLocation, String portalTopCornerLocation, String npcName) , String teamServerKey, String portalBottomCornerLocation, String portalTopCornerLocation, String npcName)
@ -140,6 +142,7 @@ public class ServerGroup
_tournament = tournament; _tournament = tournament;
_tournamentPoints = tournamentPoints; _tournamentPoints = tournamentPoints;
_games = games; _games = games;
_modes = modes;
_serverType = serverType; _serverType = serverType;
_addNoCheat = noCheat; _addNoCheat = noCheat;
_addWorldEdit = worldEdit; _addWorldEdit = worldEdit;
@ -210,6 +213,7 @@ public class ServerGroup
public boolean getGenerateFreeVersions() { return _generateFreeVersions; } public boolean getGenerateFreeVersions() { return _generateFreeVersions; }
public String getGames() { return _games; } public String getGames() { return _games; }
public String getModes() { return _modes; }
public String getServerType() { return _serverType; } public String getServerType() { return _serverType; }
public boolean getAddNoCheat() { return _addNoCheat; } public boolean getAddNoCheat() { return _addNoCheat; }
public boolean getAddWorldEdit() { return _addWorldEdit; } public boolean getAddWorldEdit() { return _addWorldEdit; }

View File

@ -1,6 +1,7 @@
package nautilus.game.arcade; package nautilus.game.arcade;
import java.io.File; import java.io.File;
import java.util.HashMap;
import mineplex.core.boosters.BoosterManager; import mineplex.core.boosters.BoosterManager;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
@ -240,7 +241,8 @@ public class Arcade extends JavaPlugin
for (String gameName : _serverConfiguration.getServerGroup().getGames().split(",")) for (String gameName : _serverConfiguration.getServerGroup().getGames().split(","))
{ {
try try
{System.out.println(gameName); {
System.out.println(gameName);
GameType type = GameType.valueOf(gameName); GameType type = GameType.valueOf(gameName);
config.GameList.add(type); config.GameList.add(type);
} }
@ -249,6 +251,30 @@ public class Arcade extends JavaPlugin
} }
} }
try
{
if(_serverConfiguration.getServerGroup().getModes() != null)
{
if(_serverConfiguration.getServerGroup().getModes().contains(","))
{
for (String modeName : _serverConfiguration.getServerGroup().getModes().split(","))
{
addGamemode(modeName, config);
}
}
else
{
addGamemode(_serverConfiguration.getServerGroup().getModes(), config);
}
}
}
catch (Exception ex)
{
System.out.println("Error reading Gamemode variable values : ");
ex.printStackTrace();
}
} }
catch (Exception ex) catch (Exception ex)
{ {
@ -299,4 +325,32 @@ public class Arcade extends JavaPlugin
System.out.println("Deleted Old Game: " + file.getName()); System.out.println("Deleted Old Game: " + file.getName());
} }
} }
private void addGamemode(String gamemode, GameServerConfig config)
{
String mode = gamemode.split("\\{")[0];
System.out.println(mode);
config.GameModeList.add(mode);
String mods = gamemode.split("\\{")[1];
mods = mods.replace("}", "");
config.GameModeMods.put(mode, new HashMap<>());
if (mods.contains(";"))
{
for (String varSet : mods.split(";"))
{
String var = varSet.split("=")[0];
String value = varSet.split("=")[1];
config.GameModeMods.get(mode).put(var, value);
}
}
else
{
String var = mods.split("=")[0];
String value = mods.split("=")[1];
config.GameModeMods.get(mode).put(var, value);
}
}
} }

View File

@ -4,37 +4,6 @@ import java.io.File;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashSet; import java.util.HashSet;
import mineplex.core.boosters.Booster;
import mineplex.core.boosters.BoosterManager;
import nautilus.game.arcade.booster.GameBoosterManager;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.GameMode;
import org.bukkit.Material;
import org.bukkit.OfflinePlayer;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.HandlerList;
import org.bukkit.event.block.BlockBurnEvent;
import org.bukkit.event.block.BlockFadeEvent;
import org.bukkit.event.block.BlockSpreadEvent;
import org.bukkit.event.block.LeavesDecayEvent;
import org.bukkit.event.entity.CreatureSpawnEvent;
import org.bukkit.event.entity.EntityExplodeEvent;
import org.bukkit.event.inventory.InventoryType;
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerLoginEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.event.server.ServerListPingEvent;
import org.bukkit.potion.PotionEffect;
import org.bukkit.util.Vector;
import mineplex.core.MiniPlugin; import mineplex.core.MiniPlugin;
import mineplex.core.account.CoreClientManager; import mineplex.core.account.CoreClientManager;
import mineplex.core.achievement.AchievementManager; import mineplex.core.achievement.AchievementManager;
@ -44,7 +13,6 @@ import mineplex.core.bonuses.BonusManager;
import mineplex.core.chat.Chat; import mineplex.core.chat.Chat;
import mineplex.core.common.Rank; import mineplex.core.common.Rank;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
import mineplex.core.common.util.Callback;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilGear; import mineplex.core.common.util.UtilGear;
@ -80,7 +48,6 @@ import mineplex.core.preferences.PreferencesManager;
import mineplex.core.projectile.ProjectileManager; import mineplex.core.projectile.ProjectileManager;
import mineplex.core.punish.Punish; import mineplex.core.punish.Punish;
import mineplex.core.resourcepack.ResourcePackManager; import mineplex.core.resourcepack.ResourcePackManager;
import mineplex.core.reward.RewardData;
import mineplex.core.reward.RewardRarity; import mineplex.core.reward.RewardRarity;
import mineplex.core.reward.rewards.PetReward; import mineplex.core.reward.rewards.PetReward;
import mineplex.core.sponsorbranding.BrandingManager; import mineplex.core.sponsorbranding.BrandingManager;
@ -115,6 +82,7 @@ import nautilus.game.arcade.command.WriteCommand;
import nautilus.game.arcade.events.GameStateChangeEvent; import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.game.Game; 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.GameTeam.PlayerState;
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.event.EventModule;
@ -140,6 +108,34 @@ import nautilus.game.arcade.player.ArcadePlayer;
import nautilus.game.arcade.shop.ArcadeShop; import nautilus.game.arcade.shop.ArcadeShop;
import net.minecraft.server.v1_8_R3.EntityLiving; import net.minecraft.server.v1_8_R3.EntityLiving;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.GameMode;
import org.bukkit.Material;
import org.bukkit.OfflinePlayer;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.HandlerList;
import org.bukkit.event.block.BlockBurnEvent;
import org.bukkit.event.block.BlockFadeEvent;
import org.bukkit.event.block.BlockSpreadEvent;
import org.bukkit.event.block.LeavesDecayEvent;
import org.bukkit.event.entity.CreatureSpawnEvent;
import org.bukkit.event.entity.EntityExplodeEvent;
import org.bukkit.event.inventory.InventoryType;
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerLoginEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.event.server.ServerListPingEvent;
import org.bukkit.potion.PotionEffect;
import org.bukkit.util.Vector;
public class ArcadeManager extends MiniPlugin implements IRelation public class ArcadeManager extends MiniPlugin implements IRelation
{ {
// Modules // Modules
@ -196,7 +192,6 @@ public class ArcadeManager extends MiniPlugin implements IRelation
private Punish _punishmentManager; private Punish _punishmentManager;
private BrandingManager _brandingManager; private BrandingManager _brandingManager;
private BonusManager _bonusManager; private BonusManager _bonusManager;
private BoosterManager _boosterManager;
private IncognitoManager _incognitoManager; private IncognitoManager _incognitoManager;
@ -228,7 +223,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation
StatsManager statsManager, IncognitoManager incognitoManager, AchievementManager achievementManager, DisguiseManager disguiseManager, Creature creature, Teleport teleport, Blood blood, Chat chat, StatsManager statsManager, IncognitoManager incognitoManager, AchievementManager achievementManager, DisguiseManager disguiseManager, Creature creature, Teleport teleport, Blood blood, Chat chat,
Portal portal, PreferencesManager preferences, InventoryManager inventoryManager, PacketHandler packetHandler, Portal portal, PreferencesManager preferences, InventoryManager inventoryManager, PacketHandler packetHandler,
CosmeticManager cosmeticManager, ProjectileManager projectileManager, PetManager petManager, HologramManager hologramManager, String webAddress, PollManager pollManager, CosmeticManager cosmeticManager, ProjectileManager projectileManager, PetManager petManager, HologramManager hologramManager, String webAddress, PollManager pollManager,
NpcManager npcManager, CustomDataManager customDataManager, Punish punish, EloManager eloManager, BoosterManager boosterManager) NpcManager npcManager, CustomDataManager customDataManager, Punish punish, EloManager eloManager)
{ {
super("Game Manager", plugin); super("Game Manager", plugin);
@ -248,7 +243,6 @@ public class ArcadeManager extends MiniPlugin implements IRelation
_conditionManager = new SkillConditionManager(plugin); _conditionManager = new SkillConditionManager(plugin);
_brandingManager = new BrandingManager(plugin); _brandingManager = new BrandingManager(plugin);
_boosterManager = boosterManager;
//Dont see a reason to ever just use the normal one //Dont see a reason to ever just use the normal one
// if (serverConfig.GameList.contains(GameType.ChampionsDominate) // if (serverConfig.GameList.contains(GameType.ChampionsDominate)
@ -290,7 +284,6 @@ public class ArcadeManager extends MiniPlugin implements IRelation
_cosmeticManager = cosmeticManager; _cosmeticManager = cosmeticManager;
_portal = portal; _portal = portal;
_petManager = petManager; _petManager = petManager;
_hologramManager = hologramManager;
_eventManager = new EventModule(this, getPlugin()); _eventManager = new EventModule(this, getPlugin());
_resourcePackManager = new ResourcePackManager(plugin, portal); _resourcePackManager = new ResourcePackManager(plugin, portal);
@ -299,8 +292,6 @@ public class ArcadeManager extends MiniPlugin implements IRelation
// Shop // Shop
_arcadeShop = new ArcadeShop(this, clientManager, donationManager); _arcadeShop = new ArcadeShop(this, clientManager, donationManager);
// _gameBoosterManager = new GameBoosterManager(plugin, boosterManager, disguiseManager, hologramManager, serverConfig);
// Managers // Managers
_gameChatManager = new GameChatManager(this); _gameChatManager = new GameChatManager(this);
_gameCreationManager = new GameCreationManager(this); _gameCreationManager = new GameCreationManager(this);
@ -314,11 +305,12 @@ public class ArcadeManager extends MiniPlugin implements IRelation
_gameTournamentManager = new GameTournamentManager(this); _gameTournamentManager = new GameTournamentManager(this);
new GameStatManager(this); new GameStatManager(this);
FacebookManager facebookManager = new FacebookManager(plugin, clientManager, donationManager, inventoryManager); FacebookManager facebookManager = new FacebookManager(plugin, clientManager, donationManager, inventoryManager);
_bonusManager = new BonusManager(plugin, clientManager, serverStatusManager, donationManager, pollManager , npcManager, hologramManager, statsManager, _inventoryManager, petManager, facebookManager, _cosmeticManager.getGadgetManager(), _boosterManager); _bonusManager = new BonusManager(plugin, clientManager, serverStatusManager, donationManager, pollManager , npcManager, hologramManager, statsManager, _inventoryManager, petManager, facebookManager, _cosmeticManager.getGadgetManager());
new GameLootManager(this, petManager, _bonusManager.getRewardManager()); new GameLootManager(this, petManager, _bonusManager.getRewardManager());
new GameSpectatorManager(this); new GameSpectatorManager(this);
_gameWorldManager = new GameWorldManager(this); _gameWorldManager = new GameWorldManager(this);
new MiscManager(this); new MiscManager(this);
_hologramManager = hologramManager;
_idleManager = new IdleManager(this); _idleManager = new IdleManager(this);
TitanGiveawayManager titanGiveaway = new TitanGiveawayManager(getPlugin(), clientManager, serverStatusManager); TitanGiveawayManager titanGiveaway = new TitanGiveawayManager(getPlugin(), clientManager, serverStatusManager);
// new HolidayManager(this, titanGiveaway); // new HolidayManager(this, titanGiveaway);
@ -354,13 +346,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation
if (GetHost() != null && !GetHost().isEmpty()) if (GetHost() != null && !GetHost().isEmpty())
{ {
Bukkit.getScheduler().runTaskLater(plugin, new Runnable() Bukkit.getScheduler().runTaskLater(plugin, () -> Portal.transferPlayer(GetHost(), _serverStatusManager.getCurrentServerName()), 80L);
{
public void run()
{
Portal.transferPlayer(GetHost(), _serverStatusManager.getCurrentServerName());
}
}, 80L);
} }
loadRequiredRank(); loadRequiredRank();
@ -594,6 +580,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation
return canHurt(UtilPlayer.searchExact(a), UtilPlayer.searchExact(b)); return canHurt(UtilPlayer.searchExact(a), UtilPlayer.searchExact(b));
} }
@Override
public boolean canHurt(Player pA, Player pB) public boolean canHurt(Player pA, Player pB)
{ {
if (pA == null || pB == null) if (pA == null || pB == null)
@ -641,33 +628,54 @@ public class ArcadeManager extends MiniPlugin implements IRelation
@EventHandler @EventHandler
public void StaffIncognito(IncognitoStatusChangeEvent event) public void StaffIncognito(IncognitoStatusChangeEvent event)
{ {
if (event.getNewState() && _game != null && _game.IsPlaying(event.getPlayer()) && _game.IsLive()) if(event.getNewState()) //Is going into incognito
{
addSpectator(event.getPlayer(), true);
event.setCancelled(true);
return;
}
if (event.getNewState())
{ {
UtilServer.broadcast(F.sys("Quit", event.getPlayer().getName())); UtilServer.broadcast(F.sys("Quit", event.getPlayer().getName()));
if (_game == null || _game.GetState() != GameState.Live) if(_game.GetCountdown() > 0) //Lobby is counting down
{
// Clean
if (_game != null)
{
// Remove Data
_game.RemoveTeamPreference(event.getPlayer());
_game.GetPlayerKits().remove(event.getPlayer());
_game.GetPlayerGems().remove(event.getPlayer());
// Leave Team
GameTeam team = _game.GetTeam(event.getPlayer());
if (team != null)
{
team.RemovePlayer(event.getPlayer());
}
}
}
else if(_game.GetState() != GameState.Recruit) //Game is NOT in lobby
{
addSpectator(event.getPlayer(), true);
_specList.add(event.getPlayer());
if(_game.GetTeam(event.getPlayer()) != null)
_game.GetTeam(event.getPlayer()).SetPlayerState(event.getPlayer(), PlayerState.OUT);
}
else //Game is in lobby
{ {
_specList.add(event.getPlayer()); _specList.add(event.getPlayer());
} }
} }
else else //Is coming out of incognito
{ {
UtilServer.broadcast(F.sys("Join", event.getPlayer().getName())); UtilServer.broadcast(F.sys("Join", event.getPlayer().getName()));
if (_game != null && isSpectator(event.getPlayer())) if(!(_game.GetState() == GameState.Live || _game.GetState() == GameState.Prepare))
{
if (_game.GetState() != GameState.Live)
{ {
_specList.remove(event.getPlayer()); _specList.remove(event.getPlayer());
if(_game.GetTeam(event.getPlayer()) != null)
_game.GetTeam(event.getPlayer()).SetPlayerState(event.getPlayer(), PlayerState.IN);
} }
if (_game != null && isSpectator(event.getPlayer()))
{
event.show(false); event.show(false);
} }
} }
@ -706,7 +714,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation
// event.setMotd(ChatColor.GREEN + "Recruiting" + extrainformation); // event.setMotd(ChatColor.GREEN + "Recruiting" + extrainformation);
// } // }
//UHC Timed //UHC Timed
if (_game != null && _game.GetType() == GameType.UHC) if (_game != null && (_game.GetType() == GameType.UHC || _game.getClass().getSuperclass().equals(UHC.class)))
{ {
event.setMotd(((UHC) _game).getMotdStatus() + extrainformation); event.setMotd(((UHC) _game).getMotdStatus() + extrainformation);
} }
@ -1204,6 +1212,11 @@ public class ArcadeManager extends MiniPlugin implements IRelation
return _specList.contains(player); return _specList.contains(player);
} }
public boolean isVanished(Player player)
{
return _incognitoManager.Get(player).Status;
}
public boolean IsTournamentServer() public boolean IsTournamentServer()
{ {
return _serverConfig.Tournament; return _serverConfig.Tournament;
@ -1284,11 +1297,6 @@ public class ArcadeManager extends MiniPlugin implements IRelation
return _serverConfig.HostName; return _serverConfig.HostName;
} }
public BoosterManager getBoosterManager()
{
return _boosterManager;
}
@EventHandler @EventHandler
public void ObserverQuit(GameStateChangeEvent event) public void ObserverQuit(GameStateChangeEvent event)
{ {
@ -1473,16 +1481,37 @@ public class ArcadeManager extends MiniPlugin implements IRelation
PetReward reward = new PetReward(_petManager, _inventoryManager, _donationManager, pet, pet, type, RewardRarity.OTHER, 0, 0); PetReward reward = new PetReward(_petManager, _inventoryManager, _donationManager, pet, pet, type, RewardRarity.OTHER, 0, 0);
if (reward.canGiveReward(player)) if (reward.canGiveReward(player))
reward.giveReward(null, player, new Callback<RewardData>() reward.giveReward(null, player, data -> {
{
@Override
public void run(RewardData data)
{
}
}); });
} }
public void enableChampionsModules()
{
_classManager.setEnabled(true);
_classShopManager.registerSelf();
_skillFactory.registerSelf();
_itemFactory.registerSelf();
_energy.registerSelf();
_eloManager.registerSelf();
//Class Shop
_plugin.getServer().getPluginManager().registerEvents(_classShop, _plugin);
}
public void disableChampionsModules()
{
_classManager.setEnabled(false);
_classShopManager.deregisterSelf();
_skillFactory.deregisterSelf();
_itemFactory.deregisterSelf();
_energy.deregisterSelf();
_eloManager.deregisterSelf();
//Class Shop
HandlerList.unregisterAll(_classShop);
}
public void toggleChampionsModules(GameType gameType) public void toggleChampionsModules(GameType gameType)
{ {
boolean isChamps = gameType == GameType.ChampionsDominate || gameType == GameType.ChampionsTDM || gameType == GameType.ChampionsCTF || gameType == GameType.BossBattles; boolean isChamps = gameType == GameType.ChampionsDominate || gameType == GameType.ChampionsTDM || gameType == GameType.ChampionsCTF || gameType == GameType.BossBattles;
@ -1498,27 +1527,11 @@ public class ArcadeManager extends MiniPlugin implements IRelation
if (_enabled) if (_enabled)
{ {
_classManager.setEnabled(true); enableChampionsModules();
_classShopManager.registerSelf();
_skillFactory.registerSelf();
_itemFactory.registerSelf();
_energy.registerSelf();
_eloManager.registerSelf();
//Class Shop
_plugin.getServer().getPluginManager().registerEvents(_classShop, _plugin);
} }
else else
{ {
_classManager.setEnabled(false); disableChampionsModules();
_classShopManager.deregisterSelf();
_skillFactory.deregisterSelf();
_itemFactory.deregisterSelf();
_energy.deregisterSelf();
_eloManager.deregisterSelf();
//Class Shop
HandlerList.unregisterAll(_classShop);
} }
} }
@ -1555,7 +1568,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation
public boolean isSpectator(Entity player) public boolean isSpectator(Entity player)
{ {
if (player instanceof Player) if (player instanceof Player)
return UtilPlayer.isSpectator((Player)player); return UtilPlayer.isSpectator(player);
return false; return false;
} }

View File

@ -0,0 +1,56 @@
package nautilus.game.arcade;
import nautilus.game.arcade.game.Game;
/**
* This Object represents a Gamemode used in the GameType constructor
*
* @author xXVevzZXx
*/
public class GameMode
{
private Class<? extends Game> _gameMode;
private GameType _gameType;
private String _name;
/**
*
* @param gameMode Game class that in most cases extends the host game class
* @param name Gamemode name
*/
public GameMode(Class<? extends Game> gameMode, GameType gameType, String name)
{
_gameMode = gameMode;
_gameType = gameType;
_name = name;
}
/**
*
* @return Game class
*/
public Class<? extends Game> getGameClass()
{
return _gameMode;
}
/**
*
* @return Gamemode name
*/
public String getName()
{
return _name;
}
/**
*
* @return Gamemode gametype
*/
public GameType getType()
{
return _gameType;
}
}

View File

@ -10,7 +10,11 @@ import nautilus.game.arcade.game.games.barbarians.Barbarians;
import nautilus.game.arcade.game.games.bossbattles.BossBattles; import nautilus.game.arcade.game.games.bossbattles.BossBattles;
import nautilus.game.arcade.game.games.bouncyballs.BouncyBalls; import nautilus.game.arcade.game.games.bouncyballs.BouncyBalls;
import nautilus.game.arcade.game.games.bridge.Bridge; import nautilus.game.arcade.game.games.bridge.Bridge;
import nautilus.game.arcade.game.games.bridge.modes.OverpoweredBridge;
import nautilus.game.arcade.game.games.bridge.modes.SpeedBridges ;
import nautilus.game.arcade.game.games.build.Build; import nautilus.game.arcade.game.games.build.Build;
import nautilus.game.arcade.game.games.build.modes.DukesOfDecoration;
import nautilus.game.arcade.game.games.build.modes.TeamBuild;
import nautilus.game.arcade.game.games.cards.Cards; import nautilus.game.arcade.game.games.cards.Cards;
import nautilus.game.arcade.game.games.castlesiege.CastleSiege; import nautilus.game.arcade.game.games.castlesiege.CastleSiege;
import nautilus.game.arcade.game.games.champions.ChampionsCTF; import nautilus.game.arcade.game.games.champions.ChampionsCTF;
@ -27,13 +31,17 @@ import nautilus.game.arcade.game.games.draw.Draw;
import nautilus.game.arcade.game.games.event.EventGame; import nautilus.game.arcade.game.games.event.EventGame;
import nautilus.game.arcade.game.games.evolution.Evolution; import nautilus.game.arcade.game.games.evolution.Evolution;
import nautilus.game.arcade.game.games.gladiators.Gladiators; import nautilus.game.arcade.game.games.gladiators.Gladiators;
import nautilus.game.arcade.game.games.gladiators.modes.ChampionsGladiators;
import nautilus.game.arcade.game.games.gladiators.modes.OverpoweredGladiators;
import nautilus.game.arcade.game.games.gravity.Gravity; import nautilus.game.arcade.game.games.gravity.Gravity;
import nautilus.game.arcade.game.games.halloween.Halloween; import nautilus.game.arcade.game.games.halloween.Halloween;
import nautilus.game.arcade.game.games.hideseek.HideSeek; import nautilus.game.arcade.game.games.hideseek.HideSeek;
import nautilus.game.arcade.game.games.hideseek.modes.Countdown;
import nautilus.game.arcade.game.games.holeinwall.HoleInTheWall; import nautilus.game.arcade.game.games.holeinwall.HoleInTheWall;
import nautilus.game.arcade.game.games.horsecharge.Horse; import nautilus.game.arcade.game.games.horsecharge.Horse;
import nautilus.game.arcade.game.games.lobbers.BombLobbers; import nautilus.game.arcade.game.games.lobbers.BombLobbers;
import nautilus.game.arcade.game.games.micro.Micro; import nautilus.game.arcade.game.games.micro.Micro;
import nautilus.game.arcade.game.games.micro.modes.TinyWinners;
import nautilus.game.arcade.game.games.milkcow.MilkCow; import nautilus.game.arcade.game.games.milkcow.MilkCow;
import nautilus.game.arcade.game.games.minecraftleague.MinecraftLeague; import nautilus.game.arcade.game.games.minecraftleague.MinecraftLeague;
import nautilus.game.arcade.game.games.minestrike.MineStrike; import nautilus.game.arcade.game.games.minestrike.MineStrike;
@ -44,29 +52,42 @@ import nautilus.game.arcade.game.games.oldmineware.OldMineWare;
import nautilus.game.arcade.game.games.paintball.Paintball; import nautilus.game.arcade.game.games.paintball.Paintball;
import nautilus.game.arcade.game.games.quiver.Quiver; import nautilus.game.arcade.game.games.quiver.Quiver;
import nautilus.game.arcade.game.games.quiver.QuiverTeams; import nautilus.game.arcade.game.games.quiver.QuiverTeams;
import nautilus.game.arcade.game.games.quiver.modes.BunnyHop ;
import nautilus.game.arcade.game.games.rings.ElytraRings; import nautilus.game.arcade.game.games.rings.ElytraRings;
import nautilus.game.arcade.game.games.runner.Runner; import nautilus.game.arcade.game.games.runner.Runner;
import nautilus.game.arcade.game.games.runner.modes.FasterThanLight;
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.sheep.modes.EweHeroes;
import nautilus.game.arcade.game.games.skywars.SoloSkywars; import nautilus.game.arcade.game.games.skywars.SoloSkywars;
import nautilus.game.arcade.game.games.skywars.TeamSkywars; import nautilus.game.arcade.game.games.skywars.TeamSkywars;
import nautilus.game.arcade.game.games.skywars.modes.OverpoweredSkywars;
import nautilus.game.arcade.game.games.skywars.modes.UHCSkywars;
import nautilus.game.arcade.game.games.smash.SoloSuperSmash; 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.TeamSuperSmash; import nautilus.game.arcade.game.games.smash.TeamSuperSmash;
import nautilus.game.arcade.game.games.smash.modes.RandomKitSSM;
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;
import nautilus.game.arcade.game.games.speedbuilders.SpeedBuilders; import nautilus.game.arcade.game.games.speedbuilders.SpeedBuilders;
import nautilus.game.arcade.game.games.spleef.Spleef; 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.spleef.modes.UltraSpleef;
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.SoloSurvivalGames; import nautilus.game.arcade.game.games.survivalgames.SoloSurvivalGames;
import nautilus.game.arcade.game.games.survivalgames.TeamSurvivalGames; import nautilus.game.arcade.game.games.survivalgames.TeamSurvivalGames;
import nautilus.game.arcade.game.games.survivalgames.modes.OverpoweredSurvival;
import nautilus.game.arcade.game.games.survivalgames.modes.UHCSurvivalgames;
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.typewars.TypeWars; import nautilus.game.arcade.game.games.typewars.TypeWars;
import nautilus.game.arcade.game.games.uhc.UHC; import nautilus.game.arcade.game.games.uhc.UHC;
import nautilus.game.arcade.game.games.uhc.modes.Assassins;
import nautilus.game.arcade.game.games.uhc.modes.BloodDiamonds;
import nautilus.game.arcade.game.games.uhc.modes.CutClean ;
import nautilus.game.arcade.game.games.uhc.modes.GodBattles;
import nautilus.game.arcade.game.games.valentines.Valentines; import nautilus.game.arcade.game.games.valentines.Valentines;
import nautilus.game.arcade.game.games.wither.WitherGame; import nautilus.game.arcade.game.games.wither.WitherGame;
import nautilus.game.arcade.game.games.wizards.Wizards; import nautilus.game.arcade.game.games.wizards.Wizards;
@ -171,7 +192,24 @@ public enum GameType
GameType.Sheep, GameType.Skywars, GameType.SkywarsTeams, GameType.Smash, GameType.SmashDomination, GameType.SmashTeams, 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.Snake, GameType.SneakyAssassins, GameType.SnowFight, GameType.Spleef, GameType.SpleefTeams, GameType.SquidShooter,
GameType.Stacker, GameType.SurvivalGames, GameType.SurvivalGamesTeams, GameType.Tug, GameType.TurfWars, GameType.UHC, GameType.Stacker, GameType.SurvivalGames, GameType.SurvivalGamesTeams, GameType.Tug, GameType.TurfWars, GameType.UHC,
GameType.WitherAssault, GameType.Wizards, GameType.ZombieSurvival}, true); GameType.WitherAssault, GameType.Wizards, GameType.ZombieSurvival}, true),
Brawl(null, new GameMode[]{
new GameMode(OverpoweredBridge.class, GameType.Bridge, "OP Bridges"), new GameMode(SpeedBridges.class, GameType.Bridge, "Speed Bridges"),
new GameMode(OverpoweredGladiators.class, GameType.Gladiators, "OP Gladiators"), new GameMode(ChampionsGladiators.class, GameType.Gladiators, "Champions Gladiators"),
new GameMode(OverpoweredSkywars.class, GameType.Skywars, "OP Skywars"), new GameMode(UHCSkywars.class, GameType.Skywars, "UHC Skywars"),
new GameMode(TeamBuild.class, GameType.Build, "Team Master Builders"), new GameMode(DukesOfDecoration.class, GameType.Build, "Dukes Of Decoration"),
new GameMode(CutClean.class, GameType.UHC, "Cut Clean"), new GameMode(GodBattles.class, GameType.UHC, "God Battles"),
new GameMode(BloodDiamonds.class, GameType.UHC, "Blood Diamonds"), new GameMode(Assassins.class, GameType.UHC, "Assassins"),
new GameMode(OverpoweredSurvival.class, GameType.SurvivalGames, "OP Survival Games"), new GameMode(UHCSurvivalgames.class, GameType.SurvivalGames, "UHC Survivalgames"),
new GameMode(UltraSpleef.class, GameType.Spleef, "Ultra Spleef"),
new GameMode(RandomKitSSM.class, GameType.Smash, "Random Kit SSM"),
new GameMode(EweHeroes.class, GameType.Sheep, "Heroes Of The Ewe"),
new GameMode(FasterThanLight.class, GameType.Runner, "Faster Than Light"),
new GameMode(BunnyHop.class, GameType.Quiver, "Bunny Hop"),
new GameMode(TinyWinners.class, GameType.Micro, "Tiny Winners"),
new GameMode(Countdown.class, GameType.HideSeek, "Countdown"),
}, GameDisplay.Brawl, null, false, null, false, true);
GameDisplay _display; GameDisplay _display;
boolean _enforceResourcePack; boolean _enforceResourcePack;
@ -180,33 +218,53 @@ public enum GameType
Pair<MinecraftVersion, String>[] _resourcePacks; Pair<MinecraftVersion, String>[] _resourcePacks;
Class<? extends Game> _gameClass; Class<? extends Game> _gameClass;
GameMode[] _gameModes;
private boolean _gameMaps;
private int _gameId; // Unique identifying id for this gamemode (used for statistics) private int _gameId; // Unique identifying id for this gamemode (used for statistics)
public int getGameId() { return _gameId; } public int getGameId() { return _gameId; }
GameType(Class<? extends Game> gameClass, GameDisplay display) GameType(Class<? extends Game> gameClass, GameDisplay display)
{ {
this(gameClass, display, null, false, null, true); this(gameClass, new GameMode[]{}, display, null, false, null, true, false);
} }
GameType(Class<? extends Game> gameClass, GameDisplay display, Pair<MinecraftVersion, String>[] resourcePackUrl, boolean enforceResourcePack) GameType(Class<? extends Game> gameClass, GameDisplay display, Pair<MinecraftVersion, String>[] resourcePackUrl, boolean enforceResourcePack)
{ {
this(gameClass, display, resourcePackUrl, enforceResourcePack, null, true); this(gameClass, new GameMode[]{}, display, resourcePackUrl, enforceResourcePack, null, true, false);
} }
GameType(Class<? extends Game> gameClass, GameDisplay display, GameType[] mapSource, boolean ownMap) GameType(Class<? extends Game> gameClass, GameDisplay display, GameType[] mapSource, boolean ownMap)
{ {
this(gameClass, display, null, false, mapSource, ownMap); this(gameClass, new GameMode[]{}, display, null, false, mapSource, ownMap, false);
} }
GameType(Class<? extends Game> gameClass, GameDisplay display, Pair<MinecraftVersion, String>[] resourcePackUrls, boolean enforceResourcePack, GameType[] mapSource, boolean ownMaps) GameType(Class<? extends Game> gameClass, GameMode[] gameModes, GameDisplay display)
{
this(gameClass, gameModes, display, null, false, null, true, false);
}
GameType(Class<? extends Game> gameClass, GameMode[] gameModes, GameDisplay display, Pair<MinecraftVersion, String>[] resourcePackUrl, boolean enforceResourcePack)
{
this(gameClass, gameModes, display, resourcePackUrl, enforceResourcePack, null, true, false);
}
GameType(Class<? extends Game> gameClass, GameMode[] gameModes, GameDisplay display, GameType[] mapSource, boolean ownMap)
{
this(gameClass, gameModes, display, null, false, mapSource, ownMap, false);
}
GameType(Class<? extends Game> gameClass, GameMode[] gameModes, GameDisplay display, Pair<MinecraftVersion, String>[] resourcePackUrls, boolean enforceResourcePack, GameType[] mapSource, boolean ownMaps, boolean gameMaps)
{ {
_display = display; _display = display;
_gameId = display.getGameId(); _gameId = display.getGameId();
_gameClass = gameClass; _gameClass = gameClass;
_gameModes = gameModes;
_resourcePacks = resourcePackUrls; _resourcePacks = resourcePackUrls;
_enforceResourcePack = enforceResourcePack; _enforceResourcePack = enforceResourcePack;
_mapSource = mapSource; _mapSource = mapSource;
_ownMaps = ownMaps; _ownMaps = ownMaps;
_gameMaps = gameMaps;
} }
public Class<? extends Game> getGameClass() public Class<? extends Game> getGameClass()
@ -214,6 +272,11 @@ public enum GameType
return _gameClass; return _gameClass;
} }
public GameMode[] getGameModes()
{
return _gameModes;
}
public boolean isEnforceResourcePack() public boolean isEnforceResourcePack()
{ {
return _enforceResourcePack; return _enforceResourcePack;
@ -263,4 +326,21 @@ public enum GameType
{ {
return _display.getKitGameName(); return _display.getKitGameName();
} }
public boolean isUsingGameModes()
{
return _gameMaps;
}
public GameType getModeGameType(Class<? extends Game> game)
{
for (GameMode mode : getGameModes())
{
if (mode.getGameClass() != null && mode.getGameClass().getName().contentEquals(game.getName()))
{
return mode.getType();
}
}
return null;
}
} }

View File

@ -43,21 +43,27 @@ public class SetCommand extends CommandBase<ArcadeManager>
if (args.length >= 2) if (args.length >= 2)
{ {
String map = ""; String map = "";
String source = ""; String source = game;
if(args.length == 3) Plugin.GetGameCreationManager().MapSource = game;
for(String token : args)
{ {
Plugin.GetGameCreationManager().MapSource = args[1]; if(token.startsWith("@s"))
Plugin.GetGameCreationManager().MapPref = args[2];
source = args[1];
map = args[2];
}
else
{ {
Plugin.GetGameCreationManager().MapSource = args[0]; Plugin.GetGameCreationManager().MapSource = token.substring(1);
Plugin.GetGameCreationManager().MapPref = args[1]; source = token.substring(2);
source = args[0];
map = args[1];
} }
else if(token.startsWith("@m"))
{
Plugin.GetGameCreationManager().MapPref = token.substring(1);
map = token.substring(2);
}
else if(token.startsWith("@e"))
{
Plugin.GetGameCreationManager().ModePref = token.substring(2);
}
}
UtilPlayer.message(caller, C.cAqua + C.Bold + "Map Preference: " + ChatColor.RESET + source + ":" + map); UtilPlayer.message(caller, C.cAqua + C.Bold + "Map Preference: " + ChatColor.RESET + source + ":" + map);
} }

View File

@ -1,7 +1,5 @@
package nautilus.game.arcade.game; package nautilus.game.arcade.game;
import com.google.common.base.Joiner;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.HashMap; import java.util.HashMap;
@ -12,8 +10,6 @@ import java.util.Map.Entry;
import java.util.Set; import java.util.Set;
import java.util.UUID; import java.util.UUID;
import mineplex.core.boosters.Booster;
import mineplex.core.gamebooster.BoosterData;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Location; import org.bukkit.Location;
@ -40,6 +36,7 @@ import org.bukkit.event.entity.ItemSpawnEvent;
import org.bukkit.event.hanging.HangingBreakEvent; import org.bukkit.event.hanging.HangingBreakEvent;
import org.bukkit.event.hanging.HangingPlaceEvent; import org.bukkit.event.hanging.HangingPlaceEvent;
import org.bukkit.event.player.PlayerCommandPreprocessEvent; import org.bukkit.event.player.PlayerCommandPreprocessEvent;
import org.bukkit.event.player.PlayerInteractEntityEvent;
import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.event.world.WorldLoadEvent; import org.bukkit.event.world.WorldLoadEvent;
import org.bukkit.scoreboard.NameTagVisibility; import org.bukkit.scoreboard.NameTagVisibility;
@ -59,20 +56,17 @@ import mineplex.core.common.util.UtilTabTitle;
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.disguise.disguises.DisguisePlayer; import mineplex.core.disguise.disguises.DisguisePlayer;
import mineplex.core.giveaway.redis.GiveawayMessage;
import mineplex.core.elo.EloPlayer; import mineplex.core.elo.EloPlayer;
import mineplex.core.elo.EloTeam; import mineplex.core.elo.EloTeam;
import mineplex.core.itemstack.ItemBuilder; import mineplex.core.itemstack.ItemBuilder;
import mineplex.core.packethandler.IPacketHandler; import mineplex.core.packethandler.IPacketHandler;
import mineplex.core.packethandler.PacketInfo; import mineplex.core.packethandler.PacketInfo;
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;
import mineplex.minecraft.game.classcombat.event.ClassCombatCreatureAllowSpawnEvent; import mineplex.minecraft.game.classcombat.event.ClassCombatCreatureAllowSpawnEvent;
import mineplex.minecraft.game.core.combat.DeathMessageType; import mineplex.minecraft.game.core.combat.DeathMessageType;
import mineplex.minecraft.game.core.combat.event.CombatDeathEvent; import mineplex.minecraft.game.core.combat.event.CombatDeathEvent;
import mineplex.serverdata.Region;
import mineplex.serverdata.data.DataRepository;
import mineplex.serverdata.redis.RedisDataRepository;
import nautilus.game.arcade.ArcadeFormat; 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;
@ -171,9 +165,6 @@ public abstract class Game implements Listener
private ChatColor _helpColor = ChatColor.YELLOW; private ChatColor _helpColor = ChatColor.YELLOW;
protected String[] _help; protected String[] _help;
// Gem Boosters
private Booster _gemBooster;
// Gameplay Flags // Gameplay Flags
public long GameTimeout = 1200000; public long GameTimeout = 1200000;
@ -288,6 +279,8 @@ public abstract class Game implements Listener
public long PrepareTime = 9000; public long PrepareTime = 9000;
public boolean PlaySoundGameStart = true; public boolean PlaySoundGameStart = true;
public double XpMult = 1;
// Chat Stats // Chat Stats
public final ChatStatData Kills = new ChatStatData("Kills", "Kills", true); public final ChatStatData Kills = new ChatStatData("Kills", "Kills", true);
public final ChatStatData Assists = new ChatStatData("Assists", "Assists", true); public final ChatStatData Assists = new ChatStatData("Assists", "Assists", true);
@ -347,13 +340,25 @@ public abstract class Game implements Listener
public boolean AllowEntitySpectate = true; public boolean AllowEntitySpectate = true;
public boolean PlayerTeamSelection = false;
public boolean TeamMode = false;
public boolean TeamPerSpawn = false;
public boolean ForceTeamSize = true;
public int PlayersPerTeam = 2;
public int TeamCount = 0;
private IPacketHandler _useEntityPacketHandler; private IPacketHandler _useEntityPacketHandler;
private int _deadBodyCount; private int _deadBodyCount;
private NautHashMap<String, Entity> _deadBodies = new NautHashMap<String, Entity>(); private NautHashMap<String, Entity> _deadBodies = new NautHashMap<String, Entity>();
private NautHashMap<String, Long> _deadBodiesExpire = new NautHashMap<String, Long>(); private NautHashMap<String, Long> _deadBodiesExpire = new NautHashMap<String, Long>();
public ArrayList<String> GemBoosters = new ArrayList<String>();
private final Set<StatTracker<? extends Game>> _statTrackers = new HashSet<>(); private final Set<StatTracker<? extends Game>> _statTrackers = new HashSet<>();
private NautHashMap<Player, Player> _teamReqs = new NautHashMap<Player, Player>();
public WinEffectManager WinEffectManager = new WinEffectManager(); public WinEffectManager WinEffectManager = new WinEffectManager();
public Game(ArcadeManager manager, GameType gameType, Kit[] kits, String[] gameDesc) public Game(ArcadeManager manager, GameType gameType, Kit[] kits, String[] gameDesc)
@ -463,6 +468,7 @@ public abstract class Game implements Listener
{ {
GetType() GetType()
}; };
if (GetType().getMapSource() != null) if (GetType().getMapSource() != null)
{ {
if (GetType().ownMaps()) if (GetType().ownMaps())
@ -481,6 +487,16 @@ public abstract class Game implements Listener
mapSource = GetType().getMapSource(); mapSource = GetType().getMapSource();
} }
} }
if (GetType().isUsingGameModes())
{
GameType mode = GetType().getModeGameType(getClass());
if (mode.getMapSource() != null)
return mode.getMapSource();
else
return new GameType[]{mode};
}
return mapSource; return mapSource;
} }
@ -1071,6 +1087,10 @@ public abstract class Game implements Listener
public boolean CanJoinTeam(GameTeam team) public boolean CanJoinTeam(GameTeam team)
{ {
if(TeamMode)
{
return team.GetSize() < PlayersPerTeam;
}
return Manager.IsTeamBalance() ? team.GetSize() < Math.max(1, UtilServer.getPlayers().length / GetTeamList().size()) return Manager.IsTeamBalance() ? team.GetSize() < Math.max(1, UtilServer.getPlayers().length / GetTeamList().size())
: true; : true;
} }
@ -1402,6 +1422,46 @@ public abstract class Game implements Listener
SetState(GameState.End); SetState(GameState.End);
} }
public void AddGemBooster(Player player)
{
if (!GemBoosterEnabled)
{
UtilPlayer.message(player, F.main("Game", "You cannot use " + F.elem("Gem Boosters")) + " for this game.");
return;
}
if (GemBoosters.size() >= 4)
{
UtilPlayer.message(player, F.main("Game", "Games cannot have more than " + F.elem("4 Gem Boosters")) + ".");
return;
}
if (GemBoosters.contains(player.getName()))
{
UtilPlayer.message(player, F.main("Game", "You can only use " + F.elem("1 Gem Booster")) + " per game.");
return;
}
Announce(F.elem(player.getName()) + " used a " + F.elem(C.cGreen + "Gem Booster") + " for "
+ F.elem("+" + (100 - (GemBoosters.size() * 25)) + "% Gems") + "!");
GemBoosters.add(player.getName());
}
public double GetGemBoostAmount()
{
if (GemBoosters.size() == 1)
return 1;
if (GemBoosters.size() == 2)
return 1.75;
if (GemBoosters.size() == 3)
return 2.25;
if (GemBoosters.size() == 4)
return 2.5;
return 0;
}
public void AddStat(Player player, String stat, int amount, boolean limitTo1, boolean global) public void AddStat(Player player, String stat, int amount, boolean limitTo1, boolean global)
{ {
if (!Manager.IsRewardStats()) if (!Manager.IsRewardStats())
@ -1816,8 +1876,353 @@ public abstract class Game implements Listener
} }
} }
public void addTutorials(){} @EventHandler(priority = EventPriority.HIGH)
public void teamSelectInteract(PlayerInteractEntityEvent event)
{
if (!PlayerTeamSelection)
return;
public void disable(){} 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 (!PlayerTeamSelection)
return;
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 (!PlayerTeamSelection)
return;
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;
}
@EventHandler
public void CustomTeamGeneration(GameStateChangeEvent event)
{
if (!TeamMode)
return;
if (event.GetState() != GameState.Recruit)
return;
ArrayList<Location> initialSpawns = this.GetTeamList().get(0).GetSpawns();
ArrayList<Location> spawns = this.GetTeamList().get(0).GetSpawns();
this.GetTeamList().clear();
TeamColors color = TeamColors.DARK_AQUA;
if (TeamPerSpawn)
{
int i = 0;
for (Location location : initialSpawns)
{
i++;
spawns = new ArrayList<>();
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);
}
}
else
{
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 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;
}
public void addTutorials()
{
}
public void disable()
{
}
} }

View File

@ -1,6 +1,7 @@
package nautilus.game.arcade.game; package nautilus.game.arcade.game;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap ;
import nautilus.game.arcade.GameType; import nautilus.game.arcade.GameType;
@ -11,6 +12,9 @@ public class GameServerConfig
public int MinPlayers = -1; public int MinPlayers = -1;
public int MaxPlayers = -1; public int MaxPlayers = -1;
public ArrayList<GameType> GameList = new ArrayList<GameType>(); public ArrayList<GameType> GameList = new ArrayList<GameType>();
public ArrayList<String> GameModeList = new ArrayList<String>();
public HashMap<String, HashMap<String, String>> GameModeMods = new HashMap<>();
//Flags //Flags
public String HostName = ""; public String HostName = "";

View File

@ -0,0 +1,65 @@
package nautilus.game.arcade.game.games;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.HandlerList;
import org.bukkit.event.Listener;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.game.Game;
import nautilus.game.arcade.game.Game.GameState;
/**
* AbsorptionFix takes care of Absorption being ignored
* use this if you want to give out Golden apples
* it will convert Absorbtion into Health boost
*
* @author xXVevzZXx
*/
public class AbsorptionFix implements Listener
{
private Game _host;
public AbsorptionFix(Game game)
{
_host = game;
game.Manager.registerEvents(this);
}
@EventHandler
public void convertAbsorption(UpdateEvent event)
{
if (event.getType() != UpdateType.SEC)
return;
for (Player player : _host.GetPlayers(true))
{
if (player.hasPotionEffect(PotionEffectType.ABSORPTION))
{
for (PotionEffect effect : player.getActivePotionEffects())
{
if (effect.getType().toString().equalsIgnoreCase(PotionEffectType.ABSORPTION.toString()))
{
player.removePotionEffect(PotionEffectType.ABSORPTION);
player.addPotionEffect(new PotionEffect(PotionEffectType.HEALTH_BOOST, effect.getDuration(), effect.getAmplifier(), effect.isAmbient(), effect.hasParticles()));
player.setHealth(player.getMaxHealth());
}
}
}
}
}
@EventHandler
public void disable(GameStateChangeEvent event)
{
if (event.GetState() == GameState.End || event.GetState() == GameState.Dead)
HandlerList.unregisterAll(this);
}
}

View File

@ -1,34 +1,31 @@
package nautilus.game.arcade.game.games.bridge; package nautilus.game.arcade.game.games.bridge;
import mineplex.core.common.Rank; import java.util.ArrayList;
import mineplex.core.common.util.*; import java.util.HashMap;
import mineplex.core.common.util.UtilEvent.ActionType; import java.util.HashSet;
import mineplex.core.explosion.ExplosionEvent; import java.util.Iterator;
import mineplex.core.itemstack.ItemStackFactory; import java.util.List;
import mineplex.core.updater.UpdateType; import java.util.UUID;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.core.combat.event.CombatDeathEvent; import org.bukkit.ChatColor;
import mineplex.minecraft.game.core.damage.CustomDamageEvent; import org.bukkit.Effect;
import nautilus.game.arcade.ArcadeManager; import org.bukkit.GameMode;
import nautilus.game.arcade.GameType; import org.bukkit.Location;
import nautilus.game.arcade.events.GameStateChangeEvent; import org.bukkit.Material;
import nautilus.game.arcade.events.PlayerDeathOutEvent; import org.bukkit.Sound;
import nautilus.game.arcade.game.Game;
import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.game.TeamGame;
import nautilus.game.arcade.game.games.bridge.kits.*;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.ore.OreHider;
import nautilus.game.arcade.ore.OreObsfucation;
import nautilus.game.arcade.stats.*;
import org.bukkit.*;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.block.BlockFace; import org.bukkit.block.BlockFace;
import org.bukkit.block.Chest; import org.bukkit.block.Chest;
import org.bukkit.craftbukkit.v1_8_R3.block.CraftBlock; import org.bukkit.craftbukkit.v1_8_R3.block.CraftBlock;
import org.bukkit.craftbukkit.v1_8_R3.inventory.CraftItemStack; import org.bukkit.craftbukkit.v1_8_R3.inventory.CraftItemStack;
import org.bukkit.craftbukkit.v1_8_R3.util.CraftMagicNumbers; import org.bukkit.craftbukkit.v1_8_R3.util.CraftMagicNumbers;
import org.bukkit.entity.*; import org.bukkit.entity.Chicken;
import org.bukkit.entity.Cow;
import org.bukkit.entity.Entity;
import org.bukkit.entity.FallingBlock;
import org.bukkit.entity.Item;
import org.bukkit.entity.Pig;
import org.bukkit.entity.Player;
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.BlockBreakEvent; import org.bukkit.event.block.BlockBreakEvent;
@ -43,6 +40,7 @@ import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.event.inventory.InventoryType; import org.bukkit.event.inventory.InventoryType;
import org.bukkit.event.inventory.PrepareItemCraftEvent; import org.bukkit.event.inventory.PrepareItemCraftEvent;
import org.bukkit.event.player.PlayerBucketEmptyEvent; import org.bukkit.event.player.PlayerBucketEmptyEvent;
import org.bukkit.event.player.PlayerBucketFillEvent;
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.PlayerPickupItemEvent; import org.bukkit.event.player.PlayerPickupItemEvent;
@ -52,7 +50,53 @@ import org.bukkit.inventory.ItemStack;
import org.bukkit.metadata.FixedMetadataValue; import org.bukkit.metadata.FixedMetadataValue;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
import java.util.*; import mineplex.core.common.Rank;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.MapUtil;
import mineplex.core.common.util.NautHashMap;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilEvent;
import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.core.common.util.UtilGear;
import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilItem;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilTextMiddle;
import mineplex.core.common.util.UtilTime;
import mineplex.core.common.util.UtilWorld;
import mineplex.core.explosion.ExplosionEvent;
import mineplex.core.gadget.gadgets.gamemodifiers.GameModifierType;
import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.core.combat.event.CombatDeathEvent;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType;
import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.events.PlayerDeathOutEvent;
import nautilus.game.arcade.game.Game;
import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.game.TeamGame;
import nautilus.game.arcade.game.games.bridge.kits.KitApple;
import nautilus.game.arcade.game.games.bridge.kits.KitArcher;
import nautilus.game.arcade.game.games.bridge.kits.KitBeserker;
import nautilus.game.arcade.game.games.bridge.kits.KitBomber;
import nautilus.game.arcade.game.games.bridge.kits.KitDestructor;
import nautilus.game.arcade.game.games.bridge.kits.KitMammoth;
import nautilus.game.arcade.game.games.bridge.kits.KitMiner;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.ore.OreHider;
import nautilus.game.arcade.ore.OreObsfucation;
import nautilus.game.arcade.stats.BridgesSniperStatTracker;
import nautilus.game.arcade.stats.DeathBomberStatTracker;
import nautilus.game.arcade.stats.FoodForTheMassesStatTracker;
import nautilus.game.arcade.stats.KillFastStatTracker;
import nautilus.game.arcade.stats.TntMinerStatTracker;
public class Bridge extends TeamGame implements OreObsfucation public class Bridge extends TeamGame implements OreObsfucation
{ {
@ -111,9 +155,33 @@ public class Bridge extends TeamGame implements OreObsfucation
private HashMap<GameTeam, Integer> _tournamentKills = new HashMap<GameTeam, Integer>(); private HashMap<GameTeam, Integer> _tournamentKills = new HashMap<GameTeam, Integer>();
private long _tournamentKillMessageTimer = 0; private long _tournamentKillMessageTimer = 0;
public Bridge(ArcadeManager manager) public Bridge(ArcadeManager manager)
{ {
super(manager, GameType.Bridge, this(manager, GameType.Bridge);
registerStatTrackers(
new FoodForTheMassesStatTracker(this),
new BridgesSniperStatTracker(this),
new TntMinerStatTracker(this),
new KillFastStatTracker(this, 4, 10, "Rampage"),
new DeathBomberStatTracker(this, 5)
);
registerChatStats(
Kills,
Deaths,
KDRatio,
BlankLine,
Assists,
DamageTaken,
DamageDealt
);
}
public Bridge(ArcadeManager manager, GameType type)
{
super(manager, type,
new Kit[] new Kit[]
{ {
@ -188,24 +256,6 @@ public class Bridge extends TeamGame implements OreObsfucation
_tournament = Manager.IsTournamentServer(); _tournament = Manager.IsTournamentServer();
registerStatTrackers(
new FoodForTheMassesStatTracker(this),
new BridgesSniperStatTracker(this),
new TntMinerStatTracker(this),
new KillFastStatTracker(this, 4, 10, "Rampage"),
new DeathBomberStatTracker(this, 5)
);
registerChatStats(
Kills,
Deaths,
KDRatio,
BlankLine,
Assists,
DamageTaken,
DamageDealt
);
} }
@EventHandler @EventHandler
@ -299,7 +349,7 @@ public class Bridge extends TeamGame implements OreObsfucation
if (!WorldData.GetCustomLocs("22").isEmpty()) ParseOre(WorldData.GetCustomLocs("22")); if (!WorldData.GetCustomLocs("22").isEmpty()) ParseOre(WorldData.GetCustomLocs("22"));
} }
private void ParseChests() protected void ParseChests()
{ {
for (Location loc : WorldData.GetCustomLocs("54")) for (Location loc : WorldData.GetCustomLocs("54"))
{ {
@ -318,7 +368,7 @@ public class Bridge extends TeamGame implements OreObsfucation
} }
} }
private ItemStack GetChestItem() protected ItemStack GetChestItem()
{ {
if (_chestLoot.isEmpty()) if (_chestLoot.isEmpty())
{ {
@ -400,7 +450,7 @@ public class Bridge extends TeamGame implements OreObsfucation
private void ParseOre(ArrayList<Location> teamOre) public void ParseOre(ArrayList<Location> teamOre)
{ {
int coal = (int) ((teamOre.size() / 32d) * _oreDensity); int coal = (int) ((teamOre.size() / 32d) * _oreDensity);
int iron = (int) ((teamOre.size() / 24d) * _oreDensity); int iron = (int) ((teamOre.size() / 24d) * _oreDensity);
@ -554,7 +604,7 @@ public class Bridge extends TeamGame implements OreObsfucation
} }
} }
private void CreateOre(Location loc, Material type, int amount) public void CreateOre(Location loc, Material type, int amount)
{ {
double bonus = Math.random() + 1; double bonus = Math.random() + 1;
@ -620,7 +670,7 @@ public class Bridge extends TeamGame implements OreObsfucation
} }
} }
private void ParseWoodBridge() { protected void ParseWoodBridge() {
_woodBridge = new ArrayList<Location>(); _woodBridge = new ArrayList<Location>();
// Load Wood In // Load Wood In
@ -654,7 +704,7 @@ public class Bridge extends TeamGame implements OreObsfucation
} }
} }
private void ParseLavaBridge() { protected void ParseLavaBridge() {
for (Location loc : WorldData.GetDataLocs("RED")) { for (Location loc : WorldData.GetDataLocs("RED")) {
_lavaBridge.add(loc.getBlock().getLocation()); _lavaBridge.add(loc.getBlock().getLocation());
} }
@ -668,12 +718,12 @@ public class Bridge extends TeamGame implements OreObsfucation
_lavaSource = WorldData.GetDataLocs("BLACK"); _lavaSource = WorldData.GetDataLocs("BLACK");
} }
private void ParseIceBridge() protected void ParseIceBridge()
{ {
_iceBridge = WorldData.GetDataLocs("LIGHT_BLUE"); _iceBridge = WorldData.GetDataLocs("LIGHT_BLUE");
} }
private void ParseMushrooms() protected void ParseMushrooms()
{ {
for (Location loc : WorldData.GetCustomLocs("21")) for (Location loc : WorldData.GetCustomLocs("21"))
{ {
@ -687,7 +737,7 @@ public class Bridge extends TeamGame implements OreObsfucation
} }
} }
private void ParseLillyPad() protected void ParseLillyPad()
{ {
for (Location loc : WorldData.GetDataLocs("LIME")) for (Location loc : WorldData.GetDataLocs("LIME"))
{ {
@ -730,7 +780,7 @@ public class Bridge extends TeamGame implements OreObsfucation
buildMushroom(); buildMushroom();
} }
private void BuildLava() protected void BuildLava()
{ {
for (int i = 0; i < 3; i++) for (int i = 0; i < 3; i++)
if (_lavaBridge != null && _lavaSource != null if (_lavaBridge != null && _lavaSource != null
@ -761,7 +811,7 @@ public class Bridge extends TeamGame implements OreObsfucation
} }
} }
private void BuildLillyPad() protected void BuildLillyPad()
{ {
for (int i = 0; i < 3; i++) for (int i = 0; i < 3; i++)
if (_lillyPads != null && !_lillyPads.isEmpty()) if (_lillyPads != null && !_lillyPads.isEmpty())
@ -793,7 +843,7 @@ public class Bridge extends TeamGame implements OreObsfucation
_lillyPads.put(event.getBlock().getLocation(), System.currentTimeMillis() + (long)(Math.random() * 12000)); _lillyPads.put(event.getBlock().getLocation(), System.currentTimeMillis() + (long)(Math.random() * 12000));
} }
private void buildMushroom() protected void buildMushroom()
{ {
if (_mushroomStem != null && !_mushroomStem.isEmpty()) if (_mushroomStem != null && !_mushroomStem.isEmpty())
{ {
@ -885,7 +935,7 @@ public class Bridge extends TeamGame implements OreObsfucation
} }
} }
private void BuildIce() protected void BuildIce()
{ {
if (_iceBridge == null || _iceBridge.isEmpty() || UtilTime.elapsed(this.GetStateTime(), _bridgeTime + 120000)) if (_iceBridge == null || _iceBridge.isEmpty() || UtilTime.elapsed(this.GetStateTime(), _bridgeTime + 120000))
{ {
@ -926,7 +976,7 @@ public class Bridge extends TeamGame implements OreObsfucation
} }
} }
private void BuildWood() protected void BuildWood()
{ {
if (_woodBridgeBlocks != null && !_woodBridgeBlocks.isEmpty()) if (_woodBridgeBlocks != null && !_woodBridgeBlocks.isEmpty())
{ {
@ -1927,9 +1977,38 @@ public class Bridge extends TeamGame implements OreObsfucation
event.setCancelled(true); event.setCancelled(true);
} }
@EventHandler
public void disableWaterPickup(PlayerBucketFillEvent event)
{
if(_bridgesDown)
return;
UtilPlayer.message(event.getPlayer(), F.main("Game", "You cannot pickup liquids before the bridges have fallen."));
event.setCancelled(true);
}
public void setBridgeTime(int time) public void setBridgeTime(int time)
{ {
_bridgeTime = time; _bridgeTime = time;
} }
public boolean hasUsedRevive(Player player)
{
return _usedLife.contains(player.getName());
}
public double getOreDensity()
{
return _oreDensity;
}
public ArrayList<ItemStack> getChestLoot()
{
return _chestLoot;
}
public boolean bridgesDown()
{
return _bridgesDown;
}
} }

View File

@ -1,17 +1,19 @@
package nautilus.game.arcade.game.games.bridge.kits; package nautilus.game.arcade.game.games.bridge.kits;
import mineplex.core.itemstack.ItemStackFactory;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.game.games.bridge.Bridge;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.perks.PerkBarrage;
import nautilus.game.arcade.kit.perks.PerkFletcher;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.entity.EntityType; import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
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.*;
public class KitArcher extends Kit public class KitArcher extends Kit
{ {
public KitArcher(ArcadeManager manager) public KitArcher(ArcadeManager manager)
@ -36,6 +38,13 @@ public class KitArcher extends Kit
@Override @Override
public void GiveItems(Player player) public void GiveItems(Player player)
{ {
if(!(Manager.GetGame() instanceof Bridge))
{
return;
}
Bridge bridge = (Bridge) Manager.GetGame();
if(!bridge.hasUsedRevive(player))
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.BOW)); player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.BOW));
} }
} }

View File

@ -7,6 +7,7 @@ import org.bukkit.inventory.ItemStack;
import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.itemstack.ItemStackFactory;
import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.game.games.bridge.Bridge;
import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk; import nautilus.game.arcade.kit.Perk;
@ -36,6 +37,13 @@ public class KitBeserker extends Kit
@Override @Override
public void GiveItems(Player player) public void GiveItems(Player player)
{ {
if(!(Manager.GetGame() instanceof Bridge))
{
return;
}
Bridge bridge = (Bridge) Manager.GetGame();
if(!bridge.hasUsedRevive(player))
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.STONE_AXE)); player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.STONE_AXE));
} }
} }

View File

@ -7,6 +7,7 @@ import org.bukkit.inventory.ItemStack;
import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.itemstack.ItemStackFactory;
import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.game.games.bridge.Bridge;
import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk; import nautilus.game.arcade.kit.Perk;
@ -36,6 +37,13 @@ public class KitMammoth extends Kit
@Override @Override
public void GiveItems(Player player) public void GiveItems(Player player)
{ {
if(!(Manager.GetGame() instanceof Bridge))
{
return;
}
Bridge bridge = (Bridge) Manager.GetGame();
if(!bridge.hasUsedRevive(player))
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD)); player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD));
} }
} }

View File

@ -7,6 +7,7 @@ import org.bukkit.inventory.ItemStack;
import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.itemstack.ItemStackFactory;
import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.game.games.bridge.Bridge;
import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk; import nautilus.game.arcade.kit.Perk;
@ -36,6 +37,13 @@ public class KitMiner extends Kit
@Override @Override
public void GiveItems(Player player) public void GiveItems(Player player)
{ {
if(!(Manager.GetGame() instanceof Bridge))
{
return;
}
Bridge bridge = (Bridge) Manager.GetGame();
if(!bridge.hasUsedRevive(player))
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.STONE_PICKAXE)); player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.STONE_PICKAXE));
} }
} }

View File

@ -0,0 +1,498 @@
package nautilus.game.arcade.game.games.bridge.modes;
import java.util.ArrayList;
import java.util.HashMap;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.Chest;
import org.bukkit.block.Sign;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.block.Action;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.player.PlayerChatEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.EnchantmentStorageMeta;
import org.bukkit.potion.Potion;
import org.bukkit.potion.PotionType;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilPlayer;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType;
import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.events.PlayerPrepareTeleportEvent;
import nautilus.game.arcade.game.Game.GameState;
import nautilus.game.arcade.game.games.AbsorptionFix;
import nautilus.game.arcade.game.games.bridge.Bridge;
import net.md_5.bungee.api.ChatColor;
/**
* OverpoweredBridge gamemode for Bridges
*
* @author xXVevzZXx
*/
public class OverpoweredBridge extends Bridge
{
private HashMap<Player, Location> _starterChests;
private HashMap<Material, Integer> _starterItems;
public OverpoweredBridge(ArcadeManager manager)
{
super(manager, GameType.Brawl);
WorldBoundaryKill = true;
new AbsorptionFix(this);
}
@Override
public void ParseData()
{
_starterChests = new HashMap<>();
_starterItems = new HashMap<>();
_starterItems.put(Material.WOOD, 64);
_starterItems.put(Material.GOLDEN_APPLE, 10);
_starterItems.put(Material.DIAMOND_PICKAXE, 1);
_starterItems.put(Material.ENCHANTMENT_TABLE, 1);
_starterItems.put(Material.ANVIL, 1);
_starterItems.put(Material.BOOKSHELF, 64);
_starterItems.put(Material.BOOK, 64);
_starterItems.put(Material.EXP_BOTTLE, 64);
_starterItems.put(Material.COOKED_BEEF, 64);
_starterItems.put(Material.DIAMOND, 300);
ParseLavaBridge();
ParseWoodBridge();
ParseIceBridge();
ParseLillyPad();
ParseMushrooms();
ParseChests();
ParseOre(WorldData.GetCustomLocs("73")); // Red
ParseOre(WorldData.GetCustomLocs("14")); // Yellow
ParseOre(WorldData.GetCustomLocs("129")); // Green
ParseOre(WorldData.GetCustomLocs("56")); // Blue
//Mass Teams
if (!WorldData.GetCustomLocs("152").isEmpty())
ParseOre(WorldData.GetCustomLocs("152"));
if (!WorldData.GetCustomLocs("41").isEmpty())
ParseOre(WorldData.GetCustomLocs("41"));
if (!WorldData.GetCustomLocs("133").isEmpty())
ParseOre(WorldData.GetCustomLocs("133"));
if (!WorldData.GetCustomLocs("57").isEmpty())
ParseOre(WorldData.GetCustomLocs("57"));
if (!WorldData.GetCustomLocs("100").isEmpty())
ParseOre(WorldData.GetCustomLocs("100"));
if (!WorldData.GetCustomLocs("86").isEmpty())
ParseOre(WorldData.GetCustomLocs("86"));
if (!WorldData.GetCustomLocs("103").isEmpty())
ParseOre(WorldData.GetCustomLocs("103"));
if (!WorldData.GetCustomLocs("22").isEmpty())
ParseOre(WorldData.GetCustomLocs("22"));
}
@EventHandler
public void fallBridges(GameStateChangeEvent event)
{
if (event.GetState() == GameState.Live)
{
setBridgeTime(1000*60*8);
}
}
@EventHandler
public void informChest(GameStateChangeEvent event)
{
if (event.GetState() != GameState.Live)
return;
for (Player player : GetPlayers(true))
{
UtilPlayer.message(player, F.main("Game", ChatColor.AQUA
+ "A supply chest spawned near you. You should take a look into it"));
}
}
@EventHandler
public void supplyChest(PlayerPrepareTeleportEvent event)
{
Location chestLoc = event.GetPlayer().getLocation().clone().add(0, 0, 1);
_starterChests.put(event.GetPlayer(), chestLoc);
Block block = chestLoc.getBlock();
block.setType(Material.CHEST);
chestLoc.clone().add(0, 1, 0).getBlock().setType(Material.AIR);
Chest chest = (Chest) block.getState();
event.GetPlayer().getLocation().getBlock().setType(Material.WALL_SIGN);
Sign sign = (Sign) event.GetPlayer().getLocation().getBlock().getState();
sign.setLine(0, "§b=============");
sign.setLine(1, "§4§l" + event.GetPlayer().getName() + ChatColor.RESET + "§4's");
sign.setLine(2, "§4Supply Chest");
sign.setLine(3, "§b=============");
sign.update();
for (Material mat : _starterItems.keySet())
{
ItemStack stack = new ItemStack(mat);
int amount = _starterItems.get(mat);
if (amount > stack.getMaxStackSize())
{
while (amount > 0)
{
ItemStack item = new ItemStack(mat);
if (amount > stack.getMaxStackSize())
item.setAmount(stack.getMaxStackSize());
else
item.setAmount(amount);
chest.getInventory().addItem(item);
amount -= stack.getMaxStackSize();
}
}
else
{
ItemStack item = new ItemStack(mat, amount);
chest.getInventory().addItem(item);
}
}
}
@EventHandler
public void openChest(PlayerInteractEvent event)
{
if (event.getAction() == Action.RIGHT_CLICK_BLOCK)
{
if (event.getClickedBlock().getType() != Material.CHEST)
return;
for (Player player : _starterChests.keySet())
{
if (player == event.getPlayer())
continue;
if (_starterChests.get(player).getBlock().getLocation()
.equals(event.getClickedBlock().getLocation()))
{
event.setCancelled(true);
break;
}
}
}
}
@EventHandler
public void CheatChestBreak(BlockBreakEvent event)
{
if (event.getBlock().getType() != Material.CHEST)
return;
if (!IsAlive(event.getPlayer()))
return;
for (Player player : _starterChests.keySet())
{
if (player == event.getPlayer())
continue;
if (_starterChests.get(player).getBlock().getLocation()
.equals(event.getBlock().getLocation()))
{
event.setCancelled(true);
break;
}
}
}
@Override
public void ParseOre(ArrayList<Location> teamOre)
{
int coal = (int) ((teamOre.size() / 32d) * getOreDensity());
int iron = (int) ((teamOre.size() / 24d) * getOreDensity());
int gold = (int) ((teamOre.size() / 64d) * getOreDensity());
int diamond = 500 + (int) ((teamOre.size() / 32d) * getOreDensity());
int gravel = (int) ((teamOre.size() / 64d) * getOreDensity());
int lowY = 256;
int highY = 0;
for (Location loc : teamOre)
{
if (loc.getBlockY() < lowY)
lowY = loc.getBlockY();
if (loc.getBlockY() > highY)
highY = loc.getBlockY();
loc.getBlock().setTypeId(1);
}
int varY = highY - lowY;
//Gravel
for (int i = 0; i < gravel && !teamOre.isEmpty(); i++)
{
int attempts = 20;
int id = 0;
while (attempts > 0)
{
id = UtilMath.r(teamOre.size());
double height = (double) (teamOre.get(id).getBlockY() - lowY) / (double) varY;
if (height > 0.8)
break;
else if (height > 0.6 && Math.random() > 0.4)
break;
else if (height > 0.4 && Math.random() > 0.6)
break;
else if (height > 0.2 && Math.random() > 0.8)
break;
}
CreateOre(teamOre.remove(id), Material.GRAVEL, 6);
}
//Coal
for (int i = 0; i < coal && !teamOre.isEmpty(); i++)
{
int attempts = 20;
int id = 0;
while (attempts > 0)
{
id = UtilMath.r(teamOre.size());
double height = (double) (teamOre.get(id).getBlockY() - lowY) / (double) varY;
if (height > 0.8)
break;
else if (height > 0.6 && Math.random() > 0.4)
break;
else if (height > 0.4 && Math.random() > 0.6)
break;
else if (height > 0.2 && Math.random() > 0.8)
break;
}
CreateOre(teamOre.remove(id), Material.COAL_ORE, 6);
}
//Iron
for (int i = 0; i < iron && !teamOre.isEmpty(); i++)
{
int id = UtilMath.r(teamOre.size());
CreateOre(teamOre.remove(id), Material.IRON_ORE, 3);
}
//Gold
for (int i = 0; i < gold && !teamOre.isEmpty(); i++)
{
int attempts = 20;
int id = 0;
while (attempts > 0)
{
id = UtilMath.r(teamOre.size());
double height = (double) (teamOre.get(id).getBlockY() - lowY) / (double) varY;
if (height > 0.8 && Math.random() > 0.8)
break;
else if (height > 0.6 && Math.random() > 0.7)
break;
else if (height > 0.4 && Math.random() > 0.6)
break;
else if (height > 0.2 && Math.random() > 0.4)
break;
else if (Math.random() > 0.2)
break;
}
CreateOre(teamOre.remove(id), Material.GOLD_ORE, 3);
}
//Diamond
for (int i = 0; i < diamond && !teamOre.isEmpty(); i++)
{
int attempts = 20;
int id = 0;
while (attempts > 0)
{
id = UtilMath.r(teamOre.size());
double height = (double) (teamOre.get(id).getBlockY() - lowY) / (double) varY;
if (height > 0.8)
continue;
else if (height > 0.6 && Math.random() > 0.9)
break;
else if (height > 0.4 && Math.random() > 0.7)
break;
else if (height > 0.2 && Math.random() > 0.5)
break;
else
break;
}
CreateOre(teamOre.remove(id), Material.DIAMOND_ORE, 5);
}
}
@Override
protected void ParseChests()
{
for (Location loc : WorldData.GetCustomLocs("54"))
{
if (loc.getBlock().getType() != Material.CHEST)
loc.getBlock().setType(Material.CHEST);
Chest chest = (Chest) loc.getBlock().getState();
chest.getBlockInventory().clear();
int count = 22 + UtilMath.r(4);
for (int i = 0; i < count; i++)
{
chest.getBlockInventory().addItem(GetChestItem());
}
}
}
@Override
protected ItemStack GetChestItem()
{
if (getChestLoot().isEmpty())
{
for (int i = 0; i < 2; i++)
getChestLoot().add(new ItemStack(Material.DIAMOND_HELMET));
for (int i = 0; i < 2; i++)
getChestLoot().add(new ItemStack(Material.DIAMOND_CHESTPLATE));
for (int i = 0; i < 2; i++)
getChestLoot().add(new ItemStack(Material.DIAMOND_LEGGINGS));
for (int i = 0; i < 2; i++)
getChestLoot().add(new ItemStack(Material.DIAMOND_BOOTS));
for (int i = 0; i < 2; i++)
getChestLoot().add(new ItemStack(Material.DIAMOND_SWORD));
for (int i = 0; i < 2; i++)
getChestLoot().add(new ItemStack(Material.DIAMOND_AXE));
for (int i = 0; i < 2; i++)
getChestLoot().add(new ItemStack(Material.DIAMOND_PICKAXE));
for (int i = 0; i < 13; i++)
{
getChestLoot().add(new ItemStack(Material.GOLDEN_APPLE));
getChestLoot().add(new ItemStack(Material.ANVIL));
}
for (int i = 0; i < 5; i++)
{
Potion potionHealth = new Potion(PotionType.INSTANT_HEAL);
potionHealth.setLevel(2);
potionHealth.setSplash(true);
getChestLoot().add(potionHealth.toItemStack(1));
Potion potionDamage = new Potion(PotionType.INSTANT_DAMAGE);
potionDamage.setLevel(2);
potionDamage.setSplash(true);
getChestLoot().add(potionDamage.toItemStack(1));
Potion potionStrenght = new Potion(PotionType.STRENGTH);
potionStrenght.setLevel(1);
potionStrenght.setSplash(true);
getChestLoot().add(potionStrenght.toItemStack(1));
}
for (int i = 0; i < 5; i++)
{
ItemStack sharpness = new ItemStack(Material.ENCHANTED_BOOK);
EnchantmentStorageMeta sharpnessMeta = (EnchantmentStorageMeta) sharpness
.getItemMeta();
sharpnessMeta.addStoredEnchant(Enchantment.DAMAGE_ALL, 1 + UtilMath.r(5), true);
sharpness.setItemMeta(sharpnessMeta);
getChestLoot().add(sharpness);
ItemStack protection = new ItemStack(Material.ENCHANTED_BOOK);
EnchantmentStorageMeta protectionMeta = (EnchantmentStorageMeta) protection
.getItemMeta();
protectionMeta.addStoredEnchant(Enchantment.PROTECTION_ENVIRONMENTAL,
1 + UtilMath.r(4), true);
protection.setItemMeta(protectionMeta);
getChestLoot().add(protection);
ItemStack power = new ItemStack(Material.ENCHANTED_BOOK);
EnchantmentStorageMeta powerMeta = (EnchantmentStorageMeta) power.getItemMeta();
powerMeta.addStoredEnchant(Enchantment.ARROW_DAMAGE, 1 + UtilMath.r(5), true);
power.setItemMeta(powerMeta);
getChestLoot().add(power);
}
for (int i = 0; i < 10; i++)
getChestLoot().add(new ItemStack(Material.EXP_BOTTLE, 10));
for (int i = 0; i < 6; i++)
getChestLoot().add(new ItemStack(Material.BOW));
for (int i = 0; i < 8; i++)
getChestLoot().add(new ItemStack(Material.ARROW, 8));
for (int i = 0; i < 12; i++)
getChestLoot().add(new ItemStack(Material.MUSHROOM_SOUP));
for (int i = 0; i < 12; i++)
getChestLoot().add(new ItemStack(Material.COOKED_CHICKEN, 2));
}
ItemStack stack = getChestLoot().get(UtilMath.r(getChestLoot().size()));
int amount = 1;
if (stack.getType().getMaxStackSize() > 1)
amount = stack.getAmount() + UtilMath.r(stack.getAmount());
ItemStack item = stack.clone();
item.setAmount(amount);
return item;
}
@Override
public String GetMode()
{
return "OP Bridges";
}
}

View File

@ -0,0 +1,62 @@
package nautilus.game.arcade.game.games.bridge.modes;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.inventory.ItemStack;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType;
import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.game.games.bridge.Bridge;
import nautilus.game.arcade.game.games.bridge.kits.KitApple;
import nautilus.game.arcade.game.games.bridge.kits.KitArcher;
import nautilus.game.arcade.game.games.bridge.kits.KitBeserker;
import nautilus.game.arcade.game.games.bridge.kits.KitBomber;
import nautilus.game.arcade.game.games.bridge.kits.KitDestructor;
import nautilus.game.arcade.game.games.bridge.kits.KitMammoth;
import nautilus.game.arcade.game.games.bridge.kits.KitMiner;
import nautilus.game.arcade.kit.Kit;
/**
* SpeedBridges gamemode for Bridges
*
* @author xXVevzZXx
*/
public class SpeedBridges extends Bridge
{
private int _untilBridges;
public SpeedBridges(ArcadeManager manager)
{
super(manager, GameType.Brawl);
_untilBridges = 20000;
}
@EventHandler
public void fallBridges(GameStateChangeEvent event)
{
if (event.GetState() == GameState.Live)
{
setBridgeTime(_untilBridges);
for (Player player : GetPlayers(true))
{
player.getInventory().addItem(new ItemStack(Material.WOOD_SWORD));
player.getInventory().addItem(new ItemStack(Material.LEATHER_HELMET));
player.getInventory().addItem(new ItemStack(Material.LEATHER_CHESTPLATE));
player.getInventory().addItem(new ItemStack(Material.LEATHER_LEGGINGS));
player.getInventory().addItem(new ItemStack(Material.LEATHER_BOOTS));
}
}
}
@Override
public String GetMode()
{
return "Speed Bridges";
}
}

View File

@ -5,43 +5,6 @@ import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Map.Entry; import java.util.Map.Entry;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.NautHashMap;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilEvent;
import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.core.common.util.UtilGear;
import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilTextBottom;
import mineplex.core.common.util.UtilTextMiddle;
import mineplex.core.common.util.UtilTime;
import mineplex.core.explosion.ExplosionEvent;
import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType;
import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.events.PlayerPrepareTeleportEvent;
import nautilus.game.arcade.game.SoloGame;
import nautilus.game.arcade.game.games.build.gui.MobShop;
import nautilus.game.arcade.game.games.build.gui.OptionsShop;
import nautilus.game.arcade.game.games.build.kits.KitBuilder;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.managers.chat.ChatStatData;
import nautilus.game.arcade.stats.BlockBreakStatTracker;
import nautilus.game.arcade.stats.BlockPlaceStatTracker;
import java.util.UUID; import java.util.UUID;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
@ -75,6 +38,7 @@ 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.Action;
import org.bukkit.event.block.BlockBreakEvent; import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.block.BlockFadeEvent;
import org.bukkit.event.block.BlockFromToEvent; import org.bukkit.event.block.BlockFromToEvent;
import org.bukkit.event.block.BlockIgniteEvent; import org.bukkit.event.block.BlockIgniteEvent;
import org.bukkit.event.block.BlockIgniteEvent.IgniteCause; import org.bukkit.event.block.BlockIgniteEvent.IgniteCause;
@ -106,7 +70,45 @@ import org.bukkit.event.vehicle.VehicleCreateEvent;
import org.bukkit.event.vehicle.VehicleDamageEvent; import org.bukkit.event.vehicle.VehicleDamageEvent;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
public class Build extends SoloGame import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.NautHashMap;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilEvent;
import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.core.common.util.UtilGear;
import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilTextBottom;
import mineplex.core.common.util.UtilTextMiddle;
import mineplex.core.common.util.UtilTime;
import mineplex.core.explosion.ExplosionEvent;
import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType;
import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.events.PlayerPrepareTeleportEvent;
import nautilus.game.arcade.game.Game ;
import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.game.games.build.gui.MobShop;
import nautilus.game.arcade.game.games.build.gui.OptionsShop;
import nautilus.game.arcade.game.games.build.kits.KitBuilder;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.managers.chat.ChatStatData;
import nautilus.game.arcade.stats.BlockBreakStatTracker;
import nautilus.game.arcade.stats.BlockPlaceStatTracker;
public class Build extends Game
{ {
private NautHashMap<Player, BuildData> _data = new NautHashMap<Player, BuildData>(); private NautHashMap<Player, BuildData> _data = new NautHashMap<Player, BuildData>();
@ -152,7 +154,22 @@ public class Build extends SoloGame
public Build(ArcadeManager manager) public Build(ArcadeManager manager)
{ {
super(manager, GameType.Build, this(manager, GameType.Build);
registerStatTrackers(
new BlockBreakStatTracker(this, false),
new BlockPlaceStatTracker(this, new Material[]{})
);
registerChatStats(
new ChatStatData("BlocksPlaced", "Blocks Placed", true),
new ChatStatData("BlocksBroken", "Blocks Broken", true)
);
}
public Build(ArcadeManager manager, GameType type)
{
super(manager, type,
new Kit[] new Kit[]
{ {
@ -222,16 +239,6 @@ public class Build extends SoloGame
_mobShop = new MobShop(getArcadeManager(), getArcadeManager().GetClients(), getArcadeManager().GetDonation()); _mobShop = new MobShop(getArcadeManager(), getArcadeManager().GetClients(), getArcadeManager().GetDonation());
_optionsShop = new OptionsShop(this, getArcadeManager(), getArcadeManager().GetClients(), getArcadeManager().GetDonation()); _optionsShop = new OptionsShop(this, getArcadeManager(), getArcadeManager().GetClients(), getArcadeManager().GetDonation());
_shopItem = ItemStackFactory.Instance.CreateStack(Material.DIAMOND, (byte) 0, 1, C.cGreen + "Options"); _shopItem = ItemStackFactory.Instance.CreateStack(Material.DIAMOND, (byte) 0, 1, C.cGreen + "Options");
registerStatTrackers(
new BlockBreakStatTracker(this, false),
new BlockPlaceStatTracker(this, new Material[]{})
);
registerChatStats(
new ChatStatData("BlocksPlaced", "Blocks Placed", true),
new ChatStatData("BlocksBroken", "Blocks Broken", true)
);
} }
@EventHandler @EventHandler
@ -242,6 +249,17 @@ public class Build extends SoloGame
event.GetPlayer().setFlySpeed(0.04f); event.GetPlayer().setFlySpeed(0.04f);
} }
@EventHandler
public void CustomTeamGeneration(GameStateChangeEvent event)
{
if (event.GetState() != GameState.Recruit)
return;
GameTeam players = GetTeamList().get(0);
players.SetColor(ChatColor.YELLOW);
players.SetName("Players");
}
@EventHandler @EventHandler
public void prepare(GameStateChangeEvent event) public void prepare(GameStateChangeEvent event)
{ {
@ -413,22 +431,14 @@ public class Build extends SoloGame
if (GetPlayers(true).size() >= 4 && _viewData.AbuseVotes.size() >= (double)(GetPlayers(true).size() - 1) / 2d) if (GetPlayers(true).size() >= 4 && _viewData.AbuseVotes.size() >= (double)(GetPlayers(true).size() - 1) / 2d)
{ {
result = C.cWhite + "Inappropriate Build"; result = C.cWhite + "Inappropriate Build";
_viewData.setAbusive(); abusiveBulid();
//Record Abuse
AddStat(_viewData.Player, "Build Draw Abuse", 1, false, true);
//Announce
Announce(C.cWhite + C.Bold + _viewData.Player.getName() + " has been reported for an inappropriate build.", false);
_viewData.Spawn.getWorld().playSound(_viewData.Spawn, Sound.ENDERDRAGON_GROWL, 10f, 1f);
UtilPlayer.message(_viewData.Player, C.cWhite + C.Bold + "Inappropriate Builds can result in a Master Buildres ban.");
//Return to Hub
getArcadeManager().GetPortal().sendPlayerToServer(_viewData.Player, "Lobby");
} }
else if (!hasDecentVote) else if (!hasDecentVote)
{ {
for(Entity entity : _viewData.Entities)
{
entity.remove();
}
Manager.GetExplosion().BlockExplosion(_viewData.Blocks, _viewData.Spawn, false); Manager.GetExplosion().BlockExplosion(_viewData.Blocks, _viewData.Spawn, false);
//Effects //Effects
@ -440,8 +450,15 @@ public class Build extends SoloGame
} }
//Announce Builder //Announce Builder
if(_viewData.Player != null)
{
UtilTextMiddle.display(result, "Built by: " + C.Bold + _viewData.Player.getName(), 0, 80, 5); UtilTextMiddle.display(result, "Built by: " + C.Bold + _viewData.Player.getName(), 0, 80, 5);
} }
else
{
UtilTextMiddle.display(result, "Built by: " + C.Bold + _viewData.Team.getDisplayName(), 0, 80, 5);
}
}
_viewData.Judged = true; _viewData.Judged = true;
} }
@ -511,6 +528,18 @@ public class Build extends SoloGame
{ {
tallyScores(); tallyScores();
calculatePlaces();
writeScoreboard();
//End
SetState(GameState.End);
}
}
public void calculatePlaces()
{
ArrayList<Player> places = new ArrayList<Player>(); ArrayList<Player> places = new ArrayList<Player>();
//Calculate Places //Calculate Places
@ -547,8 +576,6 @@ public class Build extends SoloGame
_scoreboardPlaces.add(new AbstractMap.SimpleEntry<Player, Double>(bestPlayer, bestPoints)); _scoreboardPlaces.add(new AbstractMap.SimpleEntry<Player, Double>(bestPlayer, bestPoints));
} }
writeScoreboard();
//Announce //Announce
AnnounceEnd(places); AnnounceEnd(places);
@ -568,10 +595,23 @@ public class Build extends SoloGame
for (Player player : GetPlayers(false)) for (Player player : GetPlayers(false))
if (player.isOnline()) if (player.isOnline())
AddGems(player, 10, "Participation", false, false); AddGems(player, 10, "Participation", false, false);
//End
SetState(GameState.End);
} }
public void abusiveBulid()
{
_viewData.setAbusive();
//Record Abuse
AddStat(_viewData.Player, "Build Draw Abuse", 1, false, true);
//Announce
Announce(C.cWhite + C.Bold + _viewData.Player.getName() + " has been reported for an inappropriate build.", false);
_viewData.Spawn.getWorld().playSound(_viewData.Spawn, Sound.ENDERDRAGON_GROWL, 10f, 1f);
UtilPlayer.message(_viewData.Player, C.cWhite + C.Bold + "Inappropriate Builds can result in a Master Buildres ban.");
//Return to Hub
getArcadeManager().GetPortal().sendPlayerToServer(_viewData.Player, "Lobby");
} }
private void tallyScores() private void tallyScores()
@ -639,7 +679,7 @@ public class Build extends SoloGame
return _buildStateTime == 0; return _buildStateTime == 0;
} }
private void teleportPlayers(BuildData data) public void teleportPlayers(BuildData data)
{ {
//Teleport //Teleport
for (int i=0 ; i<UtilServer.getPlayers().length ; i++) for (int i=0 ; i<UtilServer.getPlayers().length ; i++)
@ -782,16 +822,22 @@ public class Build extends SoloGame
return; return;
} }
if(_viewData.Team != null)
{
if(_viewData.Team.HasPlayer(event.getPlayer()))
{
UtilPlayer.message(event.getPlayer(), F.main("Game", "You cannot vote on your own creation!"));
return;
}
}
if (!UtilTime.elapsed(_buildStateTime, 1500)) if (!UtilTime.elapsed(_buildStateTime, 1500))
return; return;
//Vote Abuse //Vote Abuse
if (UtilGear.isMat(event.getPlayer().getItemInHand(), Material.BOOK)) if (UtilGear.isMat(event.getPlayer().getItemInHand(), Material.BOOK))
{ {
_viewData.addAbuseVote(event.getPlayer()); processReport(event.getPlayer());
UtilTextMiddle.display(null, C.cWhite + C.Bold + "Inappropriate Build", 0, 40, 5, event.getPlayer());
UtilPlayer.message(event.getPlayer(), C.cWhite + C.Bold + "You reported " + _viewData.Player.getName() + " for inappropriate build!");
UtilPlayer.message(event.getPlayer(), C.cWhite + C.Bold + "Thanks for helping us keep Master Builders clean!");
return; return;
} }
@ -832,6 +878,14 @@ public class Build extends SoloGame
} }
} }
public void processReport(Player reporter)
{
_viewData.addAbuseVote(reporter);
UtilTextMiddle.display(null, C.cWhite + C.Bold + "Inappropriate Build", 0, 40, 5, reporter);
UtilPlayer.message(reporter, C.cWhite + C.Bold + "You reported " + _viewData.Player.getName() + " for inappropriate build!");
UtilPlayer.message(reporter, C.cWhite + C.Bold + "Thanks for helping us keep Master Builders clean!");
}
@EventHandler @EventHandler
public void playerQuit(PlayerQuitEvent event) public void playerQuit(PlayerQuitEvent event)
{ {
@ -1068,13 +1122,18 @@ public class Build extends SoloGame
if (data == null) if (data == null)
return; return;
if (data.Player.equals(event.getPlayer()))
{
event.getItem().remove(); event.getItem().remove();
if(data.Player == null)
{
if (data.Team.HasPlayer(event.getPlayer()))
{
UtilParticle.PlayParticle(ParticleType.LARGE_EXPLODE, event.getItem().getLocation().add(0, 0.5, 0), 0, 0, 0, 0, 1, UtilParticle.PlayParticle(ParticleType.LARGE_EXPLODE, event.getItem().getLocation().add(0, 0.5, 0), 0, 0, 0, 0, 1,
ViewDist.LONG, UtilServer.getPlayers()); ViewDist.LONG, UtilServer.getPlayers());
} }
} }
}
@EventHandler @EventHandler
public void itemExpire(ItemDespawnEvent event) public void itemExpire(ItemDespawnEvent event)
@ -1110,6 +1169,11 @@ public class Build extends SoloGame
return; return;
} }
if(event.getSpawnReason() == SpawnReason.SPAWNER_EGG && event.getEntityType() == EntityType.OCELOT)
{
event.getEntity().setCustomName("Ocelot");
}
Player bestPlayer = null; Player bestPlayer = null;
double bestDist = 0; double bestDist = 0;
@ -1384,7 +1448,7 @@ public class Build extends SoloGame
if (data != null) if (data != null)
{ {
data.addParticles(particleType); data.addParticles(event.getPlayer(), particleType);
} }
event.setCancelled(true); event.setCancelled(true);
@ -1510,6 +1574,12 @@ public class Build extends SoloGame
event.blockList().clear(); event.blockList().clear();
} }
@EventHandler(priority = EventPriority.LOWEST)
public void iceMelt(BlockFadeEvent event)
{
event.setCancelled(true);
}
@EventHandler @EventHandler
public void openMobGui(PlayerInteractEntityEvent event) public void openMobGui(PlayerInteractEntityEvent event)
{ {
@ -1571,4 +1641,85 @@ public class Build extends SoloGame
return Arrays.asList(player); return Arrays.asList(player);
} }
public NautHashMap<Player, BuildData> getData()
{
return _data;
}
public void setWord(String word)
{
_word = word;
}
public String getWord()
{
return _word;
}
public boolean useHolidayWords()
{
return _useHolidayWords;
}
public String[] getHolidayWords()
{
return _holidayWords;
}
public String[] getWords()
{
return _words;
}
public BuildData getViewData()
{
return _viewData;
}
public int getBuildGameState()
{
return _buildGameState;
}
public long getBuildStateTime()
{
return _buildStateTime;
}
public long getBuildTime()
{
return _buildTime;
}
public long getVoteTime()
{
return _voteTime;
}
public ItemStack getShop()
{
return _shopItem;
}
@Override
public void EndCheck()
{
}
@Override
public List<Player> getLosers()
{
List<Player> winners = getWinners();
if (winners == null)
return null;
List<Player> losers = GetPlayers(false);
losers.removeAll(winners);
return losers;
}
} }

View File

@ -4,19 +4,6 @@ import java.util.ArrayList;
import java.util.HashSet; import java.util.HashSet;
import java.util.Iterator; import java.util.Iterator;
import mineplex.core.common.util.F;
import mineplex.core.common.util.MapUtil;
import mineplex.core.common.util.NautHashMap;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.recharge.Recharge;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.Sound; import org.bukkit.Sound;
@ -28,6 +15,20 @@ 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.inventory.meta.ItemMeta; import org.bukkit.inventory.meta.ItemMeta;
import mineplex.core.common.util.F;
import mineplex.core.common.util.MapUtil;
import mineplex.core.common.util.NautHashMap;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.recharge.Recharge;
import nautilus.game.arcade.game.GameTeam;
import net.minecraft.server.v1_8_R3.EntityLightning; import net.minecraft.server.v1_8_R3.EntityLightning;
import net.minecraft.server.v1_8_R3.PacketPlayOutSpawnEntityWeather; import net.minecraft.server.v1_8_R3.PacketPlayOutSpawnEntityWeather;
@ -35,6 +36,8 @@ public class BuildData
{ {
public Player Player; public Player Player;
public GameTeam Team;
public boolean Judged = false; public boolean Judged = false;
public Location Spawn; public Location Spawn;
@ -65,6 +68,19 @@ public class BuildData
public BuildData(Player player, Location spawn, ArrayList<Location> buildBorders) public BuildData(Player player, Location spawn, ArrayList<Location> buildBorders)
{ {
Player = player; Player = player;
Team = null;
Spawn = spawn;
CornerA = UtilAlg.findClosest(spawn, buildBorders);
buildBorders.remove(CornerA);
CornerB = UtilAlg.findClosest(spawn, buildBorders);
buildBorders.remove(CornerB);
}
public BuildData(GameTeam team, Location spawn, ArrayList<Location> buildBorders)
{
Player = null;
Team = team;
Spawn = spawn; Spawn = spawn;
CornerA = UtilAlg.findClosest(spawn, buildBorders); CornerA = UtilAlg.findClosest(spawn, buildBorders);
@ -90,50 +106,68 @@ public class BuildData
return true; return true;
} }
public boolean addParticles(ParticleType particleType) public boolean addParticles(Player player, ParticleType particleType)
{ {
if (Particles.size() >= 24) if (Particles.size() >= 24)
{ {
UtilPlayer.message(Player, F.main("Game", "You cannot spawn more than 24 Particles!")); UtilPlayer.message(player, F.main("Game", "You cannot spawn more than 24 Particles!"));
return false; return false;
} }
Location toPlace = Player.getEyeLocation().add(Player.getLocation().getDirection()); Location toPlace = player.getEyeLocation().add(player.getLocation().getDirection());
if (!inBuildArea(toPlace.getBlock())) if (!inBuildArea(toPlace.getBlock()))
{ {
UtilPlayer.message(Player, F.main("Game", "You cannot place particles outside your plot!")); UtilPlayer.message(player, F.main("Game", "You cannot place particles outside your plot!"));
return false; return false;
} }
Particles.put(toPlace, particleType); Particles.put(toPlace, particleType);
UtilPlayer.message(Player, F.main("Game", "You placed " + particleType.getFriendlyName() + "!")); UtilPlayer.message(player, F.main("Game", "You placed " + particleType.getFriendlyName() + "!"));
return true; return true;
} }
public void resetParticles() public void resetParticles(Player player)
{ {
Particles.clear(); Particles.clear();
UtilPlayer.message(Player, F.main("Game", "You cleared your Particles!")); UtilPlayer.message(player, F.main("Game", "You cleared your Particles!"));
} }
public boolean addEntity(Entity entity) public boolean addEntity(Entity entity)
{ {
if (entity instanceof Ghast) if (entity instanceof Ghast)
{
if(Player != null)
{ {
UtilPlayer.message(Player, F.main("Game", "You cannot spawn Ghasts!")); UtilPlayer.message(Player, F.main("Game", "You cannot spawn Ghasts!"));
}
else
{
for(Player player : Team.GetPlayers(true))
{
UtilPlayer.message(player, F.main("Game", "You cannot spawn Ghasts!"));
}
}
entity.remove(); entity.remove();
return false; return false;
} }
if (Entities.size() >= 16) if (Entities.size() >= 16)
{
if(Player != null)
{ {
UtilPlayer.message(Player, F.main("Game", "You cannot spawn more than 16 Entities!")); UtilPlayer.message(Player, F.main("Game", "You cannot spawn more than 16 Entities!"));
}
else
{
for(Player player : Team.GetPlayers(true))
{
UtilPlayer.message(player, F.main("Game", "You cannot spawn more than 16 Entities!"));
}
}
entity.remove(); entity.remove();
return false; return false;
} }
@ -243,12 +277,27 @@ public class BuildData
amount = 1; amount = 1;
if (all) if (all)
{
UtilParticle.PlayParticle(type, loc, 0.4f, 0.4f, 0.4f, 0, amount, UtilParticle.PlayParticle(type, loc, 0.4f, 0.4f, 0.4f, 0, amount,
ViewDist.LONGER, UtilServer.getPlayers()); ViewDist.LONGER, UtilServer.getPlayers());
}
else else
{
if(Player != null)
{
UtilParticle.PlayParticle(type, loc, 0.4f, 0.4f, 0.4f, 0, amount, UtilParticle.PlayParticle(type, loc, 0.4f, 0.4f, 0.4f, 0, amount,
ViewDist.LONGER, Player); ViewDist.LONGER, Player);
} }
else
{
for(Player player : Team.GetPlayers(true))
{
UtilParticle.PlayParticle(type, loc, 0.4f, 0.4f, 0.4f, 0, amount,
ViewDist.LONGER, player);
}
}
}
}
} }
public void playWeather(boolean b) public void playWeather(boolean b)
@ -265,9 +314,19 @@ public class BuildData
} }
} }
else else
{
if(Player != null)
{ {
playWeather(Player, type); playWeather(Player, type);
} }
else
{
for(Player player : Team.GetPlayers(true))
{
playWeather(player, type);
}
}
}
} }
public void playWeather(Player player, org.bukkit.WeatherType type) public void playWeather(Player player, org.bukkit.WeatherType type)
@ -294,11 +353,11 @@ public class BuildData
} }
} }
public void setGround(GroundData ground) public void setGround(Player player, GroundData ground)
{ {
if (!Recharge.Instance.use(Player, "Change Ground", 2000, true, false)) if (!Recharge.Instance.use(player, "Change Ground", 2000, true, false))
{ {
Player.playSound(Player.getLocation(), Sound.NOTE_BASS_GUITAR, 1f, 0.1f); player.playSound(player.getLocation(), Sound.NOTE_BASS_GUITAR, 1f, 0.1f);
return; return;
} }
@ -315,7 +374,7 @@ public class BuildData
for (int x= Math.min(CornerA.getBlockX(), CornerB.getBlockX()) ; x <= Math.max(CornerA.getBlockX(), CornerB.getBlockX()) ; x++) for (int x= Math.min(CornerA.getBlockX(), CornerB.getBlockX()) ; x <= Math.max(CornerA.getBlockX(), CornerB.getBlockX()) ; x++)
for (int z= Math.min(CornerA.getBlockZ(), CornerB.getBlockZ()) ; z <= Math.max(CornerA.getBlockZ(), CornerB.getBlockZ()) ; z++) for (int z= Math.min(CornerA.getBlockZ(), CornerB.getBlockZ()) ; z <= Math.max(CornerA.getBlockZ(), CornerB.getBlockZ()) ; z++)
{ {
MapUtil.QuickChangeBlockAt(Player.getWorld(), x, y, z, Material.AIR, data); MapUtil.QuickChangeBlockAt(player.getWorld(), x, y, z, Material.AIR, data);
} }
} }
@ -323,7 +382,7 @@ public class BuildData
for (int x= Math.min(CornerA.getBlockX(), CornerB.getBlockX()) ; x <= Math.max(CornerA.getBlockX(), CornerB.getBlockX()) ; x++) for (int x= Math.min(CornerA.getBlockX(), CornerB.getBlockX()) ; x <= Math.max(CornerA.getBlockX(), CornerB.getBlockX()) ; x++)
for (int z= Math.min(CornerA.getBlockZ(), CornerB.getBlockZ()) ; z <= Math.max(CornerA.getBlockZ(), CornerB.getBlockZ()) ; z++) for (int z= Math.min(CornerA.getBlockZ(), CornerB.getBlockZ()) ; z <= Math.max(CornerA.getBlockZ(), CornerB.getBlockZ()) ; z++)
{ {
MapUtil.QuickChangeBlockAt(Player.getWorld(), x, y, z, mat, data); MapUtil.QuickChangeBlockAt(player.getWorld(), x, y, z, mat, data);
} }
} }

View File

@ -64,7 +64,7 @@ public class GroundPage extends ShopPageBase<ArcadeManager, OptionsShop>
@Override @Override
public void onClick(Player player, ClickType clickType) public void onClick(Player player, ClickType clickType)
{ {
buildData.setGround(data); buildData.setGround(player, data);
} }
}); });
index++; index++;

View File

@ -70,7 +70,7 @@ public class ParticlesPage extends ShopPageBase<ArcadeManager, OptionsShop>
@Override @Override
public void onClick(Player player, ClickType clickType) public void onClick(Player player, ClickType clickType)
{ {
buildData.resetParticles(); buildData.resetParticles(player);
} }
}); });

View File

@ -0,0 +1,238 @@
package nautilus.game.arcade.game.games.build.modes;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.bukkit.Bukkit;
import org.bukkit.Effect;
import org.bukkit.GameMode;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.block.BlockDamageEvent;
import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.event.inventory.InventoryAction;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.event.inventory.InventoryCreativeEvent;
import org.bukkit.event.inventory.InventoryDragEvent;
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.recharge.Recharge;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType;
import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.events.PlayerPrepareTeleportEvent;
import nautilus.game.arcade.game.games.build.Build;
import net.md_5.bungee.api.ChatColor;
/**
* DukesOfDecoration gamemode for Master Builders
*
* @author xXVevzZXx
*/
public class DukesOfDecoration extends Build
{
private ArrayList<Material> _blocks;
public DukesOfDecoration(ArcadeManager manager)
{
super(manager, GameType.Brawl);
List<Material> notAllowed = Arrays.asList(new Material[]{
Material.COMMAND,
Material.COMMAND_MINECART,
Material.BARRIER,
Material.BURNING_FURNACE,
Material.MOB_SPAWNER,
Material.FURNACE,
Material.DRAGON_EGG,
Material.ENDER_PORTAL,
Material.ENDER_PORTAL_FRAME,
Material.SOIL,
Material.PORTAL,
Material.GLOWING_REDSTONE_ORE,
Material.SUGAR_CANE_BLOCK,
Material.IRON_DOOR_BLOCK,
Material.DOUBLE_STEP,
Material.DOUBLE_PLANT,
Material.DOUBLE_STONE_SLAB2,
Material.WOOD_DOUBLE_STEP,
Material.BREWING_STAND,
Material.WALL_SIGN,
Material.YELLOW_FLOWER,
Material.RED_ROSE,
Material.SAPLING,
Material.RED_MUSHROOM,
Material.BROWN_MUSHROOM,
Material.DIODE_BLOCK_ON,
Material.DIODE_BLOCK_OFF,
Material.WATER,
Material.STATIONARY_WATER,
Material.LAVA,
Material.STATIONARY_WATER,
Material.SIGN_POST,
Material.REDSTONE_LAMP_ON,
Material.PISTON_EXTENSION,
Material.MELON_STEM,
Material.BED_BLOCK,
Material.POTATO,
Material.CARROT,
Material.COCOA,
Material.REDSTONE_WIRE,
Material.SKULL,
Material.CROPS,
Material.FLOWER_POT,
Material.HUGE_MUSHROOM_1,
Material.HUGE_MUSHROOM_2,
Material.FIRE
});
_blocks = new ArrayList<>();
for (int i = 0; i < 8; i++)
{
Material mat = Material.values()[1 + UtilMath.r(174)];
while (_blocks.contains(mat) || notAllowed.contains(mat))
{
mat = Material.values()[1 + UtilMath.r(174)];
}
System.out.println(mat.toString());
_blocks.add(mat);
}
}
@Override
@EventHandler
public void prepare(PlayerPrepareTeleportEvent event)
{
event.GetPlayer().setGameMode(GameMode.SURVIVAL);
event.GetPlayer().setAllowFlight(true);
event.GetPlayer().setFlying(true);
event.GetPlayer().setFlySpeed(0.04f);
}
@EventHandler
public void blockDamage(BlockDamageEvent event)
{
if (!IsLive())
return;
if(!Recharge.Instance.usable(event.getPlayer(), "Block Break"))
return;
Block block = event.getBlock();
BlockBreakEvent breakEvent = new BlockBreakEvent(block, event.getPlayer());
Bukkit.getPluginManager().callEvent(breakEvent);
if (breakEvent.isCancelled())
return;
block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, block.getTypeId());
block.setTypeId(0);
Recharge.Instance.use(event.getPlayer(), "Block Break", 100, false, false);
}
@EventHandler
public void keepBlocks(BlockPlaceEvent event)
{
if (!IsLive())
return;
ItemStack item = event.getPlayer().getItemInHand().clone();
int slot = event.getPlayer().getInventory().getHeldItemSlot();
event.getPlayer().getInventory().setItem(slot, item);
}
@EventHandler
public void giveBlocks(GameStateChangeEvent event)
{
if (event.GetState() != GameState.Live)
return;
for (Player player : GetPlayers(true))
{
giveBlocks(player);
}
}
@EventHandler
public void giveBlockCommand(PlayerCommandPreprocessEvent event)
{
if(!IsLive())
return;
if (!IsPlaying(event.getPlayer()))
return;
if (!event.getMessage().equalsIgnoreCase("/giveblocks"))
return;
event.setCancelled(true);
UtilInv.Clear(event.getPlayer());
giveBlocks(event.getPlayer());
}
public void giveBlocks(Player player)
{
Manager.runSyncLater(new Runnable()
{
@Override
public void run()
{
for (Material mat : _blocks)
{
UtilInv.insert(player, buildingBlock(new ItemStack(mat)));
}
UtilPlayer.message(player, F.main("Game", "You have been given your building blocks. If you want to get them once again type " + F.game("/giveblocks")));
}
}, 10);
}
@EventHandler
public void placeBlock(BlockPlaceEvent event)
{
if (!_blocks.contains(event.getBlockPlaced().getType())
|| (event.getBlockPlaced().getType() == Material.WOOL && event.getBlock().getData() != 0
|| event.getBlockPlaced().getType() == Material.STAINED_CLAY && event.getBlock().getData() != 0
|| event.getBlockPlaced().getType() == Material.STAINED_GLASS && event.getBlock().getData() != 0
|| event.getBlockPlaced().getType() == Material.STAINED_GLASS_PANE && event.getBlock().getData() != 0))
{
event.setCancelled(true);
UtilPlayer.message(event.getPlayer(), F.main("Game", "You can not place this Block"));
}
}
private ItemStack buildingBlock(ItemStack item)
{
ItemMeta meta = item.getItemMeta();
ChatColor color = ChatColor.values()[UtilMath.r(14)];
if(color == ChatColor.BLACK || color == ChatColor.GRAY || color == ChatColor.DARK_GRAY || color == ChatColor.WHITE)
color = ChatColor.RED;
meta.setLore(Arrays.asList(new String[]{color + "" + ChatColor.BOLD + "Building block"}));
item.setItemMeta(meta);
return item;
}
@Override
public String GetMode()
{
return "Dukes Of Decoration";
}
}

View File

@ -0,0 +1,220 @@
package nautilus.game.arcade.game.games.build.modes;
import java.util.AbstractMap;
import java.util.ArrayList;
import java.util.List;
import java.util.Map.Entry;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilTextMiddle;
import mineplex.core.common.util.UtilTime;
import 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.games.build.Build;
import nautilus.game.arcade.game.games.build.BuildData;
import nautilus.game.arcade.game.games.build.BuildQuality;
/**
* TeamBuild gamemode for Master builders
*
* @author xXVevzZXx
*/
public class TeamBuild extends Build
{
private ArrayList<Player> _winners;
private ArrayList<Entry<GameTeam,Double>> _scoreboardPlaces = new ArrayList<Entry<GameTeam,Double>>();
public TeamBuild(ArcadeManager manager)
{
super(manager, GameType.Brawl);
TeamMode = true;
PlayerTeamSelection = true;
TeamPerSpawn = true;
FillTeamsInOrderToCount = 2;
_winners = new ArrayList<>();
}
@Override
@EventHandler
public void prepare(GameStateChangeEvent event)
{
if (event.GetState() == GameState.Live)
{
for (GameTeam team : GetTeamList())
{
Location spawn = team.GetSpawns().get(0);
BuildData data = new BuildData(team, spawn, WorldData.GetDataLocs("YELLOW"));
for (Player player : team.GetPlayers(true))
{
getData().put(player, data);
player.setFlySpeed(0.1f);
}
}
if (!useHolidayWords() || Math.random() >= 0.5)
setWord(getWords()[UtilMath.r(getWords().length)]);
else
setWord(getHolidayWords()[UtilMath.r(getHolidayWords().length)]);
UtilTextMiddle.display(null, C.cYellow + "Build " + C.cWhite + getWord(), 0, 80, 5);
this.WorldTimeSet = -1;
}
}
@Override
public void processReport(Player reporter)
{
getViewData().addAbuseVote(reporter);
UtilTextMiddle.display(null, C.cWhite + C.Bold + "Inappropriate Build", 0, 40, 5, reporter);
UtilPlayer.message(reporter, C.cWhite + C.Bold + "You reported " + getViewData().Team.getDisplayName() + " for inappropriate build!");
UtilPlayer.message(reporter, C.cWhite + C.Bold + "Thanks for helping us keep Master Builders clean!");
}
@Override
public void abusiveBulid()
{
getViewData().setAbusive();
for (Player player : getViewData().Team.GetPlayers(true))
{
//Record Abuse
AddStat(player, "Build Draw Abuse", 1, false, true);
UtilPlayer.message(player, C.cWhite + C.Bold + "Inappropriate Builds can result in a Master Buildres ban.");
//Announce
Announce(C.cWhite + C.Bold + player.getName() + " has been reported for an inappropriate build.", false);
//Return to Hub
getArcadeManager().GetPortal().sendPlayerToServer(player, "Lobby");
}
getViewData().Spawn.getWorld().playSound(getViewData().Spawn, Sound.ENDERDRAGON_GROWL, 10f, 1f);
}
public void writeScoreboard()
{
//Wipe Last
Scoreboard.Reset();
Scoreboard.WriteBlank();
Scoreboard.Write(C.cYellow + C.Bold + "Build Theme");
Scoreboard.Write(getWord());
Scoreboard.WriteBlank();
if (getBuildGameState() == 0)
{
Scoreboard.Write(C.cYellow + C.Bold + "Build Time");
Scoreboard.Write(UtilTime.MakeStr(Math.max(0, getBuildTime() - (System.currentTimeMillis() - this.GetStateTime())), 0));
}
else if (getBuildGameState() == 2)
{
Scoreboard.Write(C.cYellow + C.Bold + "Vote Time");
Scoreboard.Write(UtilTime.MakeStr(Math.max(0, getVoteTime() - (System.currentTimeMillis() - getBuildStateTime())), 0));
}
else if (getBuildGameState() == 4)
{
for (Entry<GameTeam, Double> score : _scoreboardPlaces)
{
Scoreboard.Write(BuildQuality.getFinalQuality(score.getValue()).getColor() + (int)(score.getValue().intValue()/10) + " " + ChatColor.RESET + score.getKey().getDisplayName());
}
}
Scoreboard.Draw();
}
@Override
public void calculatePlaces()
{
ArrayList<GameTeam> places = new ArrayList<GameTeam>();
//Calculate Places
boolean first = true;
while (!getData().isEmpty())
{
GameTeam bestTeam = null;
double bestPoints = 0;
for (Player player : getData().keySet())
{
double points = getData().get(player).getPoints();
if (bestTeam == null || points > bestPoints)
{
bestTeam = getData().get(player).Team;
bestPoints = points;
}
}
BuildData data = null;
//Average points per player is 1000, so divided by 50 = 20 gems
for (Player player : bestTeam.GetPlayers(true))
{
AddGems(player, bestPoints / 50, "Build Votes", false, false);
data = getData().remove(player);
}
//Teleport to winner
if (first)
{
teleportPlayers(data);
first = false;
}
places.add(bestTeam);
_scoreboardPlaces.add(new AbstractMap.SimpleEntry<GameTeam, Double>(bestTeam, bestPoints));
}
//Announce
AnnounceEnd(places.get(0));
//Gems
if (places.size() >= 1)
{
for (Player player : places.get(0).GetPlayers(true))
{
_winners.add(player);
AddGems(player, 20, "1st Place", false, false);
}
}
for (Player player : GetPlayers(false))
if (player.isOnline())
AddGems(player, 10, "Participation", false, false);
}
@Override
public List<Player> getWinners()
{
return _winners;
}
@Override
public String GetMode()
{
return "Team Master Builders";
}
}

View File

@ -7,9 +7,11 @@ import java.util.List;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.entity.ItemFrame;
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.PlayerInteractEntityEvent;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
@ -211,6 +213,15 @@ public class DeathTag extends SoloGame
} }
} }
@EventHandler
public void onPlayerInteractEntity(PlayerInteractEntityEvent event)
{
if(event.getRightClicked() instanceof ItemFrame)
{
event.setCancelled(true);
}
}
@EventHandler @EventHandler
public void UpdateChasers(UpdateEvent event) public void UpdateChasers(UpdateEvent event)
{ {

View File

@ -628,4 +628,13 @@ public class DragonEscape extends SoloGame
other.sendBlockChange(data.Block.getLocation(), data.Material, data.Data); other.sendBlockChange(data.Block.getLocation(), data.Material, data.Data);
} }
} }
@EventHandler
public void onPlayerInteract(PlayerInteractEvent event)
{
if(event.getClickedBlock().getType() != Material.TRAP_DOOR)
return;
// Stops players using trap doors in game.
event.setCancelled(true);
}
} }

View File

@ -111,10 +111,11 @@ public class Draw extends SoloGame
"Hints are given at top of screen", "Hints are given at top of screen",
}); });
this.StrictAntiHack = true; StrictAntiHack = true;
this.Damage = false; Damage = false;
this.HungerSet = 20; HungerSet = 20;
this.WorldTimeSet = 8000; WorldTimeSet = 8000;
AllowParticles = false;
_words = new String[] _words = new String[]
{ {

View File

@ -45,6 +45,8 @@ public class Arena
private ArrayList<Player> _alreadyAlertedPleaseWait; private ArrayList<Player> _alreadyAlertedPleaseWait;
private boolean _alertedAlready2; private boolean _alertedAlready2;
private boolean _poison;
private HashMap<Player, ArrayList<ParticleData>> _particles; private HashMap<Player, ArrayList<ParticleData>> _particles;
public Arena(Gladiators host, Location mid, ArenaType colour) public Arena(Gladiators host, Location mid, ArenaType colour)
@ -64,6 +66,7 @@ public class Arena
_doBye = false; _doBye = false;
_alreadyAlertedPleaseWait = new ArrayList<>(); _alreadyAlertedPleaseWait = new ArrayList<>();
_alertedAlready2 = false; _alertedAlready2 = false;
_poison = false;
setupSpawns(); setupSpawns();
} }
@ -296,6 +299,8 @@ public class Arena
if (_state.equals(ArenaState.WAITING)) if (_state.equals(ArenaState.WAITING))
{ {
_poison = false;
if (_host.getRoundState() != RoundState.FIGHTING) if (_host.getRoundState() != RoundState.FIGHTING)
return; return;
@ -323,6 +328,7 @@ public class Arena
if (!UtilTime.elapsed(_stateTime, 60000)) if (!UtilTime.elapsed(_stateTime, 60000))
return; // No poison yet. return; // No poison yet.
_poison = true;
for (Player p : getPastPlayers()) for (Player p : getPastPlayers())
{ {
UtilTextBottom.display(C.cRed + C.Bold + "YOU ARE POISONED! KEEP FIGHTING!", p); UtilTextBottom.display(C.cRed + C.Bold + "YOU ARE POISONED! KEEP FIGHTING!", p);
@ -411,4 +417,9 @@ public class Arena
_pastPlayers.clear(); // Clear out the un-used players. _pastPlayers.clear(); // Clear out the un-used players.
} }
public boolean isPoisoned()
{
return _poison;
}
} }

View File

@ -9,7 +9,6 @@ import org.bukkit.inventory.ItemStack;
*/ */
public enum ArenaType public enum ArenaType
{ {
RED(1, new Loadout() RED(1, new Loadout()
{ {
@Override @Override

View File

@ -91,11 +91,34 @@ public class Gladiators extends SoloGame
public Gladiators(ArcadeManager manager) public Gladiators(ArcadeManager manager)
{ {
super(manager, GameType.Gladiators, this(manager, new Kit[]
new Kit[]
{ {
new KitGladiator(manager) new KitGladiator(manager)
}, },
GameType.Gladiators);
registerStatTrackers(
new BrawlerTracker(this),
new UntouchableTracker(this),
new FlawlessTracker(this),
new PrecisionTracker(this),
new SwiftKillTracker(this)
);
registerChatStats(
Kills,
Assists,
BlankLine,
new ChatStatData("Untouchable", "Untouchable", true),
BlankLine,
DamageDealt,
DamageTaken
);
}
public Gladiators(ArcadeManager manager, Kit[] kits, GameType type)
{
super(manager, type, kits,
new String[] new String[]
{ {
"This is a 1v1 tournament!", "This is a 1v1 tournament!",
@ -116,24 +139,6 @@ public class Gladiators extends SoloGame
BlockBreakAllow.add(Material.DEAD_BUSH.getId()); BlockBreakAllow.add(Material.DEAD_BUSH.getId());
BlockBreakAllow.add(Material.LONG_GRASS.getId()); BlockBreakAllow.add(Material.LONG_GRASS.getId());
registerStatTrackers(
new BrawlerTracker(this),
new UntouchableTracker(this),
new FlawlessTracker(this),
new PrecisionTracker(this),
new SwiftKillTracker(this)
);
registerChatStats(
Kills,
Assists,
BlankLine,
new ChatStatData("Untouchable", "Untouchable", true),
BlankLine,
DamageDealt,
DamageTaken
);
_playerArenas = new HashMap<>(); _playerArenas = new HashMap<>();
_roundState = RoundState.WAITING; _roundState = RoundState.WAITING;
@ -357,7 +362,7 @@ public class Gladiators extends SoloGame
} }
} }
private void findGameArenaSet() protected void findGameArenaSet()
{ {
_gameArenaSet = new ArrayList<>(); _gameArenaSet = new ArrayList<>();
@ -753,7 +758,7 @@ public class Gladiators extends SoloGame
p.setHealth(p.getMaxHealth()); //Heal p.setHealth(p.getMaxHealth()); //Heal
} }
private void giveLoadout(Player p, ArenaType type) protected void giveLoadout(Player p, ArenaType type)
{ {
if (!GetPlayers(true).contains(p)) if (!GetPlayers(true).contains(p))
return; return;
@ -1113,4 +1118,15 @@ public class Gladiators extends SoloGame
_hotbarEditor.deregisterSelf(); // De-register as listener _hotbarEditor.deregisterSelf(); // De-register as listener
_hotbarEditor.onDisable(); // Fully disable _hotbarEditor.onDisable(); // Fully disable
} }
public HashMap<Player, Arena> getArenas()
{
return _playerArenas;
}
public HotbarEditor getHotbarEditor()
{
return _hotbarEditor;
}
} }

View File

@ -0,0 +1,93 @@
package nautilus.game.arcade.game.games.gladiators.modes;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.entity.EntityRegainHealthEvent;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType;
import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.game.games.champions.ChampionsFixes;
import nautilus.game.arcade.game.games.champions.kits.KitAssassin;
import nautilus.game.arcade.game.games.champions.kits.KitBrute;
import nautilus.game.arcade.game.games.champions.kits.KitKnight;
import nautilus.game.arcade.game.games.champions.kits.KitMage;
import nautilus.game.arcade.game.games.champions.kits.KitRanger;
import nautilus.game.arcade.game.games.gladiators.Arena;
import nautilus.game.arcade.game.games.gladiators.ArenaType;
import nautilus.game.arcade.game.games.gladiators.Gladiators;
import nautilus.game.arcade.kit.Kit;
/**
* ChampionsGladiators gamemode for Gladiators
*
* @author xXVevzZXx
*/
public class ChampionsGladiators extends Gladiators
{
public ChampionsGladiators(ArcadeManager manager)
{
super(manager, new Kit[]
{
new KitBrute(manager),
new KitRanger(manager),
new KitKnight(manager),
new KitMage(manager),
new KitAssassin(manager),
}, GameType.Brawl);
Manager.GetDamage().UseSimpleWeaponDamage = false;
Manager.getCosmeticManager().setHideParticles(true);
Manager.getClassManager().GetItemFactory().getProximityManager().setProxyLimit(6);
StrictAntiHack = true;
TeamArmor = false;
new ChampionsFixes(this);
manager.enableChampionsModules();
}
@Override
protected void giveLoadout(Player p, ArenaType type)
{
if (!GetPlayers(true).contains(p))
return;
GetKit(p).ApplyKit(p);
p.playSound(p.getLocation(), Sound.LEVEL_UP, 1f, 1f);
}
@EventHandler
public void end(GameStateChangeEvent event)
{
if (event.GetState() != GameState.End)
return;
Manager.disableChampionsModules();
}
@EventHandler
public void healthDisable(EntityRegainHealthEvent event)
{
if(!(event.getEntity() instanceof Player))
return;
Player player = (Player) event.getEntity();
Arena arena = getPlayerArenas().get(player);
if(arena.isPoisoned())
event.setCancelled(true);
}
@Override
public String GetMode()
{
return "Champions Gladiators";
}
}

View File

@ -0,0 +1,109 @@
package nautilus.game.arcade.game.games.gladiators.modes;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerChatEvent;
import org.bukkit.inventory.ItemStack;
import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilItem;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType;
import nautilus.game.arcade.game.games.gladiators.Arena;
import nautilus.game.arcade.game.games.gladiators.ArenaType;
import nautilus.game.arcade.game.games.gladiators.Gladiators;
import nautilus.game.arcade.game.games.gladiators.hotbar.HotbarLayout;
import nautilus.game.arcade.game.games.gladiators.kits.KitGladiator;
import nautilus.game.arcade.kit.Kit;
/**
* OverpoweredGladiators gamemode for Gladiators
*
* @author xXVevzZXx
*/
public class OverpoweredGladiators extends Gladiators
{
public OverpoweredGladiators(ArcadeManager manager)
{
super(manager, new Kit[]
{
new KitGladiator(manager)
},
GameType.Brawl);
}
@Override
protected void giveLoadout(Player p, ArenaType type)
{
if (!GetPlayers(true).contains(p))
return;
HotbarLayout layout = getHotbarEditor().getLayout(p);
int round = 0;
if (type == ArenaType.GREEN)
round = 1;
else if (type == ArenaType.YELLOW)
round = 2;
else if (type == ArenaType.ORANGE)
round = 3;
else if(type == ArenaType.RED)
round = 4;
UtilInv.Clear(p);
p.getInventory().clear();
p.getInventory().setArmorContents(null);
p.getInventory().setItem(layout.getRod(), UtilItem.makeUnbreakable(type.getLoadout().getRod()));
p.getInventory().setItem(layout.getArrows(), new ItemStack(Material.ARROW, round * 5));
ItemStack sword = new ItemStack(Material.DIAMOND_SWORD);
ItemStack bow = new ItemStack(Material.BOW);
ItemStack helmet = new ItemStack(Material.DIAMOND_HELMET);
ItemStack chest = new ItemStack(Material.DIAMOND_CHESTPLATE);
ItemStack leggings = new ItemStack(Material.DIAMOND_LEGGINGS);
ItemStack boots = new ItemStack(Material.DIAMOND_BOOTS);
if (round != 0)
{
sword.addEnchantment(Enchantment.DAMAGE_ALL, round);
bow.addEnchantment(Enchantment.ARROW_DAMAGE, round);
helmet.addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, round);
chest.addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, round);
leggings.addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, round);
boots.addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, round);
}
p.getInventory().setItem(layout.getSword(), UtilItem.makeUnbreakable(sword));
p.getInventory().setItem(layout.getBow(), UtilItem.makeUnbreakable(bow));
p.getInventory().setHelmet(UtilItem.makeUnbreakable(helmet));
p.getInventory().setChestplate(UtilItem.makeUnbreakable(chest));
p.getInventory().setLeggings(UtilItem.makeUnbreakable(leggings));
p.getInventory().setBoots(UtilItem.makeUnbreakable(boots));
if (round >= 4)
{
UtilInv.insert(p, new ItemStack(Material.GOLDEN_APPLE,1 , (short) 1));
}
p.playSound(p.getLocation(), Sound.LEVEL_UP, 1f, 1f);
}
@Override
public String GetMode()
{
return "OP Gladiators";
}
}

View File

@ -287,14 +287,18 @@ public class HideSeek extends TeamGame
public HideSeek(ArcadeManager manager) public HideSeek(ArcadeManager manager)
{ {
super(manager, GameType.HideSeek, this(manager,
new Kit[] new Kit[]
{ {
new KitHiderSwapper(manager), new KitHiderQuick(manager), new KitHiderShocker(manager), new KitHiderSwapper(manager), new KitHiderQuick(manager), new KitHiderShocker(manager),
new KitHiderTeleporter(manager), new NullKit(manager), new KitSeekerLeaper(manager), new KitHiderTeleporter(manager), new NullKit(manager), new KitSeekerLeaper(manager),
new KitSeekerTNT(manager), new KitSeekerRadar(manager), new KitSeekerTNT(manager), new KitSeekerRadar(manager),
}, });
}
public HideSeek(ArcadeManager manager, Kit[] kits)
{
super(manager, GameType.HideSeek, kits,
new String[] new String[]
{ {
@ -935,7 +939,7 @@ public class HideSeek extends TeamGame
if (!_hiders.HasPlayer(player)) if (!_hiders.HasPlayer(player))
return; return;
if (!Recharge.Instance.use(player, "Axe Boost", 16000, true, true)) if (!Recharge.Instance.use(player, "Axe Boost", 16000, inform(), true))
return; return;
if (UtilGear.isMat(player.getItemInHand(), Material.WOOD_AXE)) if (UtilGear.isMat(player.getItemInHand(), Material.WOOD_AXE))
@ -998,7 +1002,7 @@ public class HideSeek extends TeamGame
event.setCancelled(true); event.setCancelled(true);
if (!Recharge.Instance.use(player, "Meow", 5000, true, true)) if (!Recharge.Instance.use(player, "Meow", 5000, inform(), true))
return; return;
player.getWorld().playSound(player.getLocation(), Sound.CAT_MEOW, 1f, 1f); player.getWorld().playSound(player.getLocation(), Sound.CAT_MEOW, 1f, 1f);
@ -1027,7 +1031,7 @@ public class HideSeek extends TeamGame
event.setCancelled(true); event.setCancelled(true);
if (!Recharge.Instance.use(player, "Firework", 15000, true, true)) if (!Recharge.Instance.use(player, "Firework", 15000, inform(), true))
return; return;
this.AddGems(player, 2, "Fireworks", true, true); this.AddGems(player, 2, "Fireworks", true, true);
@ -1472,7 +1476,7 @@ public class HideSeek extends TeamGame
return; return;
} }
if (!Recharge.Instance.use(player, "Infest", 8000, true, true)) if (!Recharge.Instance.use(player, "Infest", 8000, inform(), true))
return; return;
// Cloak // Cloak
@ -1505,7 +1509,7 @@ public class HideSeek extends TeamGame
return; return;
} }
if (!Recharge.Instance.use(player, "Infest", 8000, true, true)) if (!Recharge.Instance.use(player, "Infest", 8000, inform(), true))
return; return;
// Cloak // Cloak
@ -1653,4 +1657,19 @@ public class HideSeek extends TeamGame
return ent.getVehicle() != null; return ent.getVehicle() != null;
} }
public HashMap<Player, Form> getForms()
{
return _forms;
}
public ArrayList<Material> getAllowedBlocks()
{
return _allowedBlocks;
}
public boolean inform()
{
return true;
}
} }

View File

@ -0,0 +1,141 @@
package nautilus.game.arcade.game.games.hideseek.modes;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilTextBottom;
import mineplex.core.common.util.UtilTime;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.game.games.hideseek.HideSeek;
import nautilus.game.arcade.game.games.hideseek.forms.BlockForm;
import nautilus.game.arcade.game.games.hideseek.forms.Form;
import nautilus.game.arcade.game.games.hideseek.kits.KitHiderQuick;
import nautilus.game.arcade.game.games.hideseek.kits.KitHiderSwapper;
import nautilus.game.arcade.game.games.hideseek.kits.KitSeekerLeaper;
import nautilus.game.arcade.game.games.hideseek.kits.KitSeekerRadar;
import nautilus.game.arcade.game.games.hideseek.kits.KitSeekerTNT;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.kit.NullKit;
/**
* Countdown gammeode for Blockhunt
*
* @author xXVevzZXx
*/
public class Countdown extends HideSeek
{
private int _changeInterval;
private long _lastChanged = 0;
public Countdown(ArcadeManager manager)
{
super(manager,
new Kit[]
{
new KitHiderQuick(manager), new NullKit(manager), new KitSeekerLeaper(manager),
new KitSeekerTNT(manager), new KitSeekerRadar(manager),
});
_changeInterval = 30;
}
@EventHandler
public void gameState(GameStateChangeEvent event)
{
if (event.GetState() != GameState.Live)
return;
_lastChanged = System.currentTimeMillis();
}
@EventHandler
public void countdown(UpdateEvent event)
{
if (!IsLive())
return;
if (event.getType() == UpdateType.SEC)
{
if (System.currentTimeMillis() > _lastChanged + 25000)
{
for (Player player : UtilServer.getPlayers())
{
player.playSound(player.getLocation(), Sound.NOTE_PLING, 2F, 2F);
}
}
}
if (event.getType() != UpdateType.TICK)
return;
double percentage = (double) (System.currentTimeMillis() - _lastChanged) / (_changeInterval*1000);
for (Player player : UtilServer.getPlayers())
{
UtilTextBottom.displayProgress("Block change", percentage,
UtilTime.MakeStr(Math.max(0, (_changeInterval*1000) - (System.currentTimeMillis() - _lastChanged))), player);
}
}
@EventHandler
public void changeForms(UpdateEvent event)
{
if (!IsLive())
return;
if (event.getType() != UpdateType.SEC)
return;
if (UtilTime.elapsed(_lastChanged, _changeInterval*1000))
{
_lastChanged = System.currentTimeMillis();
Material mat = getAllowedBlocks().get(UtilMath.r(getAllowedBlocks().size()));
for (Player player : GetPlayers(true))
{
if (!getForms().containsKey(player))
{
UtilPlayer.message(player, F.main("Game", "Hiders have changed forms!"));
continue;
}
getForms().get(player).Remove();
Form form = new BlockForm(this, player, mat);
getForms().put(player, form);
form.Apply();
Bukkit.getPluginManager().callEvent(new PlayerChangeFormEvent(player, form));
}
}
}
@Override
public boolean inform()
{
return false;
}
@Override
public String GetMode()
{
return "Countdown";
}
}

View File

@ -30,17 +30,9 @@ public class Micro extends TeamGame
private ArrayList<Block> _blocks = new ArrayList<Block>(); private ArrayList<Block> _blocks = new ArrayList<Block>();
private ArrayList<Block> _glass = new ArrayList<Block>(); private ArrayList<Block> _glass = new ArrayList<Block>();
public Micro(ArcadeManager manager) public Micro(ArcadeManager manager, Kit[] kits, GameType type)
{ {
super(manager, GameType.Micro, super(manager, type, kits,
new Kit[]
{
new KitArcher(manager),
new KitWorker(manager),
new KitFighter(manager)
},
new String[] new String[]
{ {
"Small game, big strategy!", "Small game, big strategy!",
@ -58,6 +50,19 @@ public class Micro extends TeamGame
this.BlockBreak = true; this.BlockBreak = true;
this.BlockPlace = true; this.BlockPlace = true;
}
public Micro(ArcadeManager manager)
{
this(manager,
new Kit[]
{
new KitArcher(manager),
new KitWorker(manager),
new KitFighter(manager)
},
GameType.Micro);
registerStatTrackers( registerStatTrackers(
new KillsWithinGameStatTracker(this, 8, "Annihilation") new KillsWithinGameStatTracker(this, 8, "Annihilation")

View File

@ -0,0 +1,75 @@
package nautilus.game.arcade.game.games.micro.modes;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType;
import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.game.games.champions.kits.KitAssassin;
import nautilus.game.arcade.game.games.champions.kits.KitBrute;
import nautilus.game.arcade.game.games.champions.kits.KitKnight;
import nautilus.game.arcade.game.games.champions.kits.KitMage;
import nautilus.game.arcade.game.games.champions.kits.KitRanger;
import nautilus.game.arcade.game.games.micro.Micro;
import nautilus.game.arcade.kit.Kit;
/**
* TinnyWinners gamemode for Micro battles
*
* @author xXVevzZXx
*/
public class TinyWinners extends Micro
{
public TinyWinners(ArcadeManager manager)
{
super(manager,
new Kit[]
{
new KitBrute(manager), new KitRanger(manager), new KitKnight(manager),
new KitMage(manager), new KitAssassin(manager)
},
GameType.Brawl);
Manager.GetDamage().UseSimpleWeaponDamage = false;
Manager.getCosmeticManager().setHideParticles(true);
Manager.getClassManager().GetItemFactory().getProximityManager().setProxyLimit(6);
StrictAntiHack = true;
TeamArmor = false;
manager.enableChampionsModules();
}
@EventHandler
public void end(GameStateChangeEvent event)
{
if (event.GetState() != GameState.End)
return;
Manager.disableChampionsModules();
}
@Override
@EventHandler
public void FoodUpdate(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
return;
for (Player player : GetPlayers(true))
player.setFoodLevel(20);
}
@Override
public String GetMode()
{
return "Tiny Winners";
}
}

View File

@ -216,6 +216,7 @@ public class MinecraftLeague extends RankedTeamGame
_tower = new TowerManager(this); _tower = new TowerManager(this);
Alert = new TowerAlert(); Alert = new TowerAlert();
Bukkit.getPluginManager().registerEvents(_freeze, manager.getPlugin()); Bukkit.getPluginManager().registerEvents(_freeze, manager.getPlugin());
Bukkit.getPluginManager().registerEvents(_tower, manager.getPlugin());
} }
private enum DamageAmount private enum DamageAmount

View File

@ -2,24 +2,31 @@ package nautilus.game.arcade.game.games.minecraftleague.data;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashSet;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;
import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilItem; import mineplex.core.common.util.UtilItem;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilTextMiddle; import mineplex.core.common.util.UtilTextMiddle;
import mineplex.core.itemstack.ItemBuilder; import mineplex.core.itemstack.ItemBuilder;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import nautilus.game.arcade.game.Game.GameState; import nautilus.game.arcade.game.Game.GameState;
import nautilus.game.arcade.game.GameTeam; import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.game.games.minecraftleague.DataLoc; import nautilus.game.arcade.game.games.minecraftleague.DataLoc;
import nautilus.game.arcade.game.games.minecraftleague.MinecraftLeague; import nautilus.game.arcade.game.games.minecraftleague.MinecraftLeague;
import nautilus.game.arcade.world.WorldData; import nautilus.game.arcade.world.WorldData;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;
public class TowerManager implements Listener public class TowerManager implements Listener
@ -30,6 +37,7 @@ public class TowerManager implements Listener
private ConcurrentHashMap<TeamTowerBase, DefenderAI> _def = new ConcurrentHashMap<TeamTowerBase, DefenderAI>(); private ConcurrentHashMap<TeamTowerBase, DefenderAI> _def = new ConcurrentHashMap<TeamTowerBase, DefenderAI>();
//private ConcurrentHashMap<TeamTowerBase, MapZone> _mapZone = new ConcurrentHashMap<TeamTowerBase, MapZone>(); //private ConcurrentHashMap<TeamTowerBase, MapZone> _mapZone = new ConcurrentHashMap<TeamTowerBase, MapZone>();
private ConcurrentHashMap<GameTeam, TeamBeacon> _beacons = new ConcurrentHashMap<GameTeam, TeamBeacon>(); private ConcurrentHashMap<GameTeam, TeamBeacon> _beacons = new ConcurrentHashMap<GameTeam, TeamBeacon>();
private HashSet<UUID> _waitingPlayers = new HashSet<UUID>();
private OreGenerator _ore; private OreGenerator _ore;
public boolean Attack = false; public boolean Attack = false;
@ -255,42 +263,39 @@ public class TowerManager implements Listener
} }
for (Player player : towerBase.getTeam().GetPlayers(true)) for (Player player : towerBase.getTeam().GetPlayers(true))
{ {
if (!UtilPlayer.isSpectator(player)) giveArmor(player);
{
boolean replaced = false;
if (UtilItem.isLeatherProduct(player.getInventory().getHelmet()))
{
if (replaced)
continue;
replaced = true;
player.getInventory().setHelmet(new ItemBuilder(Material.GOLD_HELMET).setUnbreakable(true).build());
}
if (UtilItem.isLeatherProduct(player.getInventory().getLeggings()))
{
if (replaced)
continue;
replaced = true;
player.getInventory().setLeggings(new ItemBuilder(Material.GOLD_LEGGINGS).setUnbreakable(true).build());
}
if (UtilItem.isLeatherProduct(player.getInventory().getChestplate()))
{
if (replaced)
continue;
replaced = true;
player.getInventory().setChestplate(new ItemBuilder(Material.GOLD_CHESTPLATE).setUnbreakable(true).build());
}
if (UtilItem.isLeatherProduct(player.getInventory().getBoots()))
{
if (replaced)
continue;
replaced = true;
player.getInventory().setBoots(new ItemBuilder(Material.GOLD_BOOTS).setUnbreakable(true).build());
}
}
} }
makeVulnerable(getTeamTowers(towerBase.getTeam()).get(_vulnerableTower.get(towerBase.getTeam()))); makeVulnerable(getTeamTowers(towerBase.getTeam()).get(_vulnerableTower.get(towerBase.getTeam())));
} }
public void giveArmor(Player player)
{
if (!UtilPlayer.isSpectator(player))
{
if (UtilItem.isLeatherProduct(player.getInventory().getHelmet()))
{
player.getInventory().setHelmet(new ItemBuilder(Material.GOLD_HELMET).setUnbreakable(true).build());
}
else if (UtilItem.isLeatherProduct(player.getInventory().getLeggings()))
{
player.getInventory().setLeggings(new ItemBuilder(Material.GOLD_LEGGINGS).setUnbreakable(true).build());
}
else if (UtilItem.isLeatherProduct(player.getInventory().getChestplate()))
{
player.getInventory().setChestplate(new ItemBuilder(Material.GOLD_CHESTPLATE).setUnbreakable(true).build());
}
else if (UtilItem.isLeatherProduct(player.getInventory().getBoots()))
{
player.getInventory().setBoots(new ItemBuilder(Material.GOLD_BOOTS).setUnbreakable(true).build());
}
_waitingPlayers.remove(player.getUniqueId());
}
else
{
_waitingPlayers.add(player.getUniqueId());
}
}
public void toggleAttack() public void toggleAttack()
{ {
//Attack = !Attack; //Attack = !Attack;
@ -304,4 +309,20 @@ public class TowerManager implements Listener
_def.get(tower).update(); _def.get(tower).update();
} }
} }
@EventHandler
public void onUpdate(UpdateEvent event)
{
if(event.getType() != UpdateType.SEC)
return;
for(UUID uuid : _waitingPlayers)
{
Player player = Bukkit.getPlayer(uuid);
if(UtilPlayer.isSpectator(player))
{
continue;
}
giveArmor(player);
}
}
} }

View File

@ -3179,7 +3179,7 @@ public class MineStrike extends TeamGame
vec.multiply(1d / count); vec.multiply(1d / count);
SpectatorSpawn.setX(vec.getX()); SpectatorSpawn.setX(vec.getX());
SpectatorSpawn.setY(vec.getY() + 50); //ADD 50 SpectatorSpawn.setY(vec.getY() + 7); //ADD 7
SpectatorSpawn.setZ(vec.getZ()); SpectatorSpawn.setZ(vec.getZ());
// Move Up - Out Of Blocks // Move Up - Out Of Blocks

View File

@ -4,6 +4,7 @@ import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.UUID;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
@ -34,6 +35,7 @@ import org.bukkit.ChatColor;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.Sound; import org.bukkit.Sound;
import org.bukkit.entity.Arrow; import org.bukkit.entity.Arrow;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority; import org.bukkit.event.EventPriority;
@ -48,22 +50,41 @@ public class Quiver extends SoloGame
private HashMap<Player, Integer> _combo = new HashMap<Player, Integer>(); private HashMap<Player, Integer> _combo = new HashMap<Player, Integer>();
private HashMap<Player, Integer> _bestCombo = new HashMap<Player, Integer>(); private HashMap<Player, Integer> _bestCombo = new HashMap<Player, Integer>();
private HashMap<Player, Long> _deathTime = new HashMap<Player, Long>(); private HashMap<Player, Long> _deathTime = new HashMap<Player, Long>();
private HashMap<UUID, Integer> _bowTime = new HashMap<>();
private Objective _scoreObj; private Objective _scoreObj;
public Quiver(ArcadeManager manager) public Quiver(ArcadeManager manager)
{ {
super(manager, GameType.Quiver, this(manager, new Kit[]
new Kit[]
{ {
new KitLeaper(manager), new KitLeaper(manager),
new KitBrawler(manager), new KitBrawler(manager),
new KitEnchanter(manager), new KitEnchanter(manager),
new KitSlamShot(manager), new KitSlamShot(manager),
new KitNinja(manager) new KitNinja(manager)
}, }, GameType.Quiver);
registerStatTrackers(
new WinWithoutDyingStatTracker(this, "Perfectionist"),
new SharpShooterStatTracker(this),
new WinWithoutBowStatTracker(this, "WhatsABow")
);
registerChatStats(
Kills,
Deaths,
KDRatio,
BlankLine,
Assists,
DamageTaken,
DamageDealt
);
}
public Quiver(ArcadeManager manager, Kit[] kits, GameType type)
{
super(manager, type, kits,
new String[] new String[]
{ {
"Bow and Arrow insta-kills.", "Bow and Arrow insta-kills.",
@ -86,22 +107,6 @@ public class Quiver extends SoloGame
_scoreObj = Scoreboard.GetScoreboard().registerNewObjective("Kills", "dummy"); _scoreObj = Scoreboard.GetScoreboard().registerNewObjective("Kills", "dummy");
_scoreObj.setDisplaySlot(DisplaySlot.BELOW_NAME); _scoreObj.setDisplaySlot(DisplaySlot.BELOW_NAME);
registerStatTrackers(
new WinWithoutDyingStatTracker(this, "Perfectionist"),
new SharpShooterStatTracker(this),
new WinWithoutBowStatTracker(this, "WhatsABow")
);
registerChatStats(
Kills,
Deaths,
KDRatio,
BlankLine,
Assists,
DamageTaken,
DamageDealt
);
} }
@EventHandler(priority = EventPriority.HIGH) @EventHandler(priority = EventPriority.HIGH)
@ -114,6 +119,26 @@ public class Quiver extends SoloGame
{ {
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(262, (byte)0, 1, F.item("Super Arrow"))); player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(262, (byte)0, 1, F.item("Super Arrow")));
player.playSound(player.getLocation(), Sound.PISTON_EXTEND, 3f, 2f); player.playSound(player.getLocation(), Sound.PISTON_EXTEND, 3f, 2f);
_bowTime.put(player.getUniqueId(), 0);
}
}
@EventHandler
public void onUpdate(UpdateEvent event)
{
if(event.getType() != UpdateType.TICK)
return;
for(Player player : GetPlayers(true))
{
if(UtilPlayer.isChargingBow(player))
{
_bowTime.put(player.getUniqueId(), _bowTime.get(player.getUniqueId()) + 1);
}
else
{
_bowTime.put(player.getUniqueId(), 0);
}
} }
} }
@ -131,6 +156,14 @@ public class Quiver extends SoloGame
if (!(arrow.getShooter() instanceof Player)) if (!(arrow.getShooter() instanceof Player))
return; return;
Player shooter = (Player) arrow.getShooter();
//If the player has a full charge but they haven't been holding the bow for more than 20 ticks
if(_bowTime.get(shooter.getUniqueId()) < 20 && event.getForce() == 1)
{
event.setCancelled(true);
return;
}
if (!_deathTime.containsKey(arrow.getShooter())) if (!_deathTime.containsKey(arrow.getShooter()))
return; return;
@ -277,6 +310,14 @@ public class Quiver extends SoloGame
@EventHandler @EventHandler
public void ArrowDamage(CustomDamageEvent event) public void ArrowDamage(CustomDamageEvent event)
{ {
if (!(event.GetDamagerEntity(true) instanceof Arrow)
&& !(event.GetDamagerEntity(true) instanceof Player)
&& (event.GetDamagerEntity(true) instanceof Entity))
{
event.setCancelled(true);
return;
}
if (event.GetProjectile() == null) if (event.GetProjectile() == null)
return; return;
@ -384,4 +425,9 @@ public class Quiver extends SoloGame
else else
return null; return null;
} }
public HashMap<Player, Long> getDeathTime()
{
return _deathTime;
}
} }

View File

@ -0,0 +1,100 @@
package nautilus.game.arcade.game.games.quiver.modes;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.itemstack.ItemStackFactory;
import mineplex.minecraft.game.core.combat.event.CombatDeathEvent;
import mineplex.minecraft.game.core.condition.Condition.ConditionType;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType;
import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.game.games.quiver.Quiver;
import nautilus.game.arcade.game.games.quiver.kits.KitSlamShot;
import nautilus.game.arcade.game.games.quiver.modes.kits.KitModedLeaper;
import nautilus.game.arcade.kit.Kit;
/**
* BunnyHop gamemode for One in the quiver
*
* @author xXVevzZXx
*/
public class BunnyHop extends Quiver
{
private int _arrowAmount;
public BunnyHop(ArcadeManager manager)
{
super(manager, new Kit[]
{
new KitModedLeaper(manager)
}, GameType.Brawl);
_arrowAmount = 2;
}
@Override
@EventHandler(priority = EventPriority.HIGH)
public void GameStateChange(GameStateChangeEvent event)
{
if (event.GetState() != GameState.Live)
return;
for (Player player : GetPlayers(true))
{
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(262, (byte)0, 2, F.item("Super Arrow")));
player.playSound(player.getLocation(), Sound.PISTON_EXTEND, 3f, 2f);
}
}
@Override
@EventHandler
public void Death(CombatDeathEvent event)
{
if (event.GetEvent().getEntity() instanceof Player)
{
getDeathTime().put((Player) event.GetEvent().getEntity(), System.currentTimeMillis());
}
if (event.GetLog().GetKiller() == null)
return;
if (!event.GetLog().GetKiller().IsPlayer())
return;
Player player = UtilPlayer.searchExact(event.GetLog().GetKiller().GetName());
if (player == null)
return;
int amount = _arrowAmount;
if (GetKit(player) instanceof KitSlamShot)
{
if (Manager.GetCondition().HasCondition(event.GetEvent().getEntity(),
ConditionType.FALLING, null))
{
amount = _arrowAmount * 2;
}
}
//New Arrow
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(262, (byte) 0, amount,
F.item("Super Arrow")));
player.playSound(player.getLocation(), Sound.PISTON_EXTEND, 3f, 2f);
//Score
AddKill(player);
}
@Override
public String GetMode()
{
return "Bunny Hop";
}
}

View File

@ -0,0 +1,60 @@
package nautilus.game.arcade.game.games.quiver.modes.kits;
import org.bukkit.Material;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilServer;
import mineplex.core.itemstack.ItemStackFactory;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.game.Game.GameState;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.perks.PerkTripleJump;
public class KitModedLeaper extends Kit
{
public KitModedLeaper(ArcadeManager manager)
{
super(manager, "Jumper", KitAvailability.Free,
new String[]
{
"Evade and kill using your triple jump!"
},
new Perk[]
{
new PerkTripleJump("Triple Jump", 0.9, 0.9, true, 0, false)
},
EntityType.ZOMBIE,
new ItemStack(Material.IRON_AXE));
}
@Override
public void GiveItems(Player player)
{
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_AXE));
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.BOW));
if (Manager.GetGame().GetState() == GameState.Live)
{
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(262, (byte)0, 2, F.item("Super Arrow")));
final Player fPlayer = player;
UtilServer.getServer().getScheduler().scheduleSyncDelayedTask(Manager.getPlugin(), new Runnable()
{
public void run()
{
UtilInv.Update(fPlayer);
}
}, 10);
}
}
}

View File

@ -43,7 +43,20 @@ public class Runner extends SoloGame implements IThrown
public Runner(ArcadeManager manager) public Runner(ArcadeManager manager)
{ {
super(manager, GameType.Runner, this(manager, GameType.Runner);
registerStatTrackers(new DistanceTraveledStatTracker(this, "MarathonRunner"));
registerChatStats(
new ChatStatData("MarathonRunner", "Distance ran", true),
BlankLine,
new ChatStatData("kit", "Kit", true)
);
}
public Runner(ArcadeManager manager, GameType type)
{
super(manager, type,
new Kit[] new Kit[]
{ {
@ -65,14 +78,6 @@ public class Runner extends SoloGame implements IThrown
this.WorldWaterDamage = 4; this.WorldWaterDamage = 4;
this.PrepareFreeze = false; this.PrepareFreeze = false;
registerStatTrackers(new DistanceTraveledStatTracker(this, "MarathonRunner"));
registerChatStats(
new ChatStatData("MarathonRunner", "Distance ran", true),
BlankLine,
new ChatStatData("kit", "Kit", true)
);
} }
@EventHandler @EventHandler
@ -324,6 +329,11 @@ public class Runner extends SoloGame implements IThrown
BlockSmash(data.GetThrown()); BlockSmash(data.GetThrown());
} }
public HashMap<Block, Long> getBlocks()
{
return _blocks;
}
@Override @Override
public void Idle(ProjectileUser data) public void Idle(ProjectileUser data)
{ {

View File

@ -0,0 +1,125 @@
package nautilus.game.arcade.game.games.runner.modes;
import java.util.HashSet;
import java.util.Iterator;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.entity.FallingBlock;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import mineplex.core.common.util.MapUtil;
import mineplex.core.common.util.UtilTime;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.game.games.runner.Runner;
/**
* GottaGoFast gamemode for Runner
*
* @author xXVevzZXx
*/
public class FasterThanLight extends Runner
{
public FasterThanLight(ArcadeManager manager)
{
super(manager);
}
@EventHandler
public void speed(UpdateEvent event)
{
if (!IsLive())
return;
if (event.getType() != UpdateType.SEC)
return;
for (Player player : GetPlayers(true))
{
player.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 40, 2, true, true),
true);
}
}
@Override
@EventHandler
public void BlockBreak(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
return;
if (!IsLive())
return;
//Add Blocks
for (Player player : GetPlayers(true))
{
//Side Standing
double xMod = player.getLocation().getX() % 1;
if (player.getLocation().getX() < 0)
xMod += 1;
double zMod = player.getLocation().getZ() % 1;
if (player.getLocation().getZ() < 0)
zMod += 1;
int xMin = 0;
int xMax = 0;
int zMin = 0;
int zMax = 0;
if (xMod < 0.3)
xMin = -1;
if (xMod > 0.7)
xMax = 1;
if (zMod < 0.3)
zMin = -1;
if (zMod > 0.7)
zMax = 1;
for (int x = xMin; x <= xMax; x++)
{
for (int z = zMin; z <= zMax; z++)
{
AddBlock(player.getLocation().add(x, -0.5, z).getBlock());
}
}
}
//Decay
HashSet<Block> readd = new HashSet<Block>();
Iterator<Block> blockIterator = getBlocks().keySet().iterator();
while (blockIterator.hasNext())
{
Block block = blockIterator.next();
if (!UtilTime.elapsed(getBlocks().get(block), 200))
continue;
//Fall
int id = block.getTypeId();
byte data = block.getData();
MapUtil.QuickChangeBlockAt(block.getLocation(), Material.AIR);
FallingBlock ent = block.getWorld().spawnFallingBlock(block.getLocation(), id, data);
Manager.GetProjectile().AddThrow(ent, null, this, -1, true, false, false, false, 0.3f);
blockIterator.remove();
}
}
@Override
public String GetMode()
{
return "Faster Than Light";
}
}

View File

@ -125,14 +125,32 @@ public class SheepGame extends TeamGame
public SheepGame(ArcadeManager manager) public SheepGame(ArcadeManager manager)
{ {
super(manager, GameType.Sheep, this(manager, new Kit[]
new Kit[]
{ {
new KitBeserker(manager), new KitBeserker(manager),
new KitArcher(manager), new KitArcher(manager),
new KitBrute(manager) new KitBrute(manager)
}, }, GameType.Sheep);
registerStatTrackers(
new SheepThiefStatTracker(this),
new SheepDropStatTracker(this),
new WinWithSheepStatTracker(this)
);
registerChatStats(
new ChatStatData("AnimalRescue", "Captures", true),
new ChatStatData("Thief", "Stolen", true),
BlankLine,
Kills,
Deaths,
KDRatio
);
}
public SheepGame(ArcadeManager manager, Kit[] kits, GameType type)
{
super(manager, type, kits,
new String[] new String[]
{ {
@ -150,21 +168,6 @@ public class SheepGame extends TeamGame
this.TeamArmor = true; this.TeamArmor = true;
this.TeamArmorHotbar = true; this.TeamArmorHotbar = true;
registerStatTrackers(
new SheepThiefStatTracker(this),
new SheepDropStatTracker(this),
new WinWithSheepStatTracker(this)
);
registerChatStats(
new ChatStatData("AnimalRescue", "Captures", true),
new ChatStatData("Thief", "Stolen", true),
BlankLine,
Kills,
Deaths,
KDRatio
);
} }
@Override @Override
@ -333,8 +336,7 @@ public class SheepGame extends TeamGame
} }
//Put Wool in Inventory //Put Wool in Inventory
player.getInventory().setItem(4 + count, ItemStackFactory.Instance.CreateStack(35, ((Sheep)sheep).getColor().getWoolData())); inventoryWool(player, count, sheep);
UtilInv.Update(player);
//Effect //Effect
sheep.getWorld().playEffect(sheep.getLocation(), Effect.STEP_SOUND, 35); sheep.getWorld().playEffect(sheep.getLocation(), Effect.STEP_SOUND, 35);
@ -351,6 +353,12 @@ public class SheepGame extends TeamGame
return true; return true;
} }
public void inventoryWool(Player player, int count, Entity sheep)
{
player.getInventory().setItem(4 + count, ItemStackFactory.Instance.CreateStack(35, ((Sheep)sheep).getColor().getWoolData()));
UtilInv.Update(player);
}
@EventHandler @EventHandler
public void StackPlayer(PlayerInteractEntityEvent event) public void StackPlayer(PlayerInteractEntityEvent event)
{ {

View File

@ -0,0 +1,90 @@
package nautilus.game.arcade.game.games.sheep.modes;
import org.bukkit.Material;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.inventory.ItemStack;
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.games.champions.ChampionsFixes;
import nautilus.game.arcade.game.games.champions.kits.KitAssassin;
import nautilus.game.arcade.game.games.champions.kits.KitBrute;
import nautilus.game.arcade.game.games.champions.kits.KitKnight;
import nautilus.game.arcade.game.games.champions.kits.KitMage;
import nautilus.game.arcade.game.games.champions.kits.KitRanger;
import nautilus.game.arcade.game.games.sheep.SheepGame;
import nautilus.game.arcade.kit.Kit;
/**
* EweHeroes gaemode for Sheep quest
*
* @author xXVevzZXx
*/
public class EweHeroes extends SheepGame
{
public EweHeroes(ArcadeManager manager)
{
super(manager,
new Kit[]
{
new KitBrute(manager),
new KitRanger(manager),
new KitKnight(manager),
new KitMage(manager),
new KitAssassin(manager),
}, GameType.Brawl);
Manager.GetDamage().UseSimpleWeaponDamage = false;
Manager.getCosmeticManager().setHideParticles(true);
Manager.getClassManager().GetItemFactory().getProximityManager().setProxyLimit(6);
StrictAntiHack = true;
TeamArmor = false;
new ChampionsFixes(this);
manager.enableChampionsModules();
}
@EventHandler
public void saddle(UpdateEvent event)
{
if (event.getType() != UpdateType.FASTER)
return;
for (Player player : GetPlayers(true))
{
player.getInventory().setItem(7, new ItemStack(Material.SADDLE));
}
}
@EventHandler
public void end(GameStateChangeEvent event)
{
if (event.GetState() != GameState.End)
return;
Manager.disableChampionsModules();
}
@Override
public void inventoryWool(Player player, int count, Entity sheep)
{
}
@Override
public String GetMode()
{
return "Heroes Of The Ewe";
}
}

View File

@ -193,32 +193,14 @@ public abstract class Skywars extends Game
}; };
setupPlayerLoot();
setupMiddleLoot();
setAlreadyAnnounced(false); setAlreadyAnnounced(false);
registerStatTrackers(
new SkywarsTNTStatTracker(this),
new DeathBomberStatTracker(this, 3), //TNT Kills
new SkywarsKillZombieStatTracker(this),
new WinWithoutOpeningChestStatTracker(this),
new WinWithoutWearingArmorStatTracker(this));
registerChatStats(
Kills,
Deaths,
KDRatio,
BlankLine,
Assists,
DamageTaken,
DamageDealt
);
} }
public void ParseData() public void ParseData()
{ {
setupPlayerLoot();
setupMiddleLoot();
parseCreateZombieSpawns(); parseCreateZombieSpawns();
parseCreateMiddleChests(); parseCreateMiddleChests();
parseCreatePlayerChests(); parseCreatePlayerChests();
@ -1027,7 +1009,7 @@ public abstract class Skywars extends Game
} }
} }
private void fillChest(Player looter, Block block) public void fillChest(Player looter, Block block)
{ {
_lootedBlocks.add(block.getLocation()); _lootedBlocks.add(block.getLocation());
Chest chest = (Chest) block.getState(); Chest chest = (Chest) block.getState();
@ -1122,7 +1104,7 @@ public abstract class Skywars extends Game
} }
private void setupPlayerLoot() public void setupPlayerLoot()
{ {
//Armor //Armor
_playerArmor.addLoot(new RandomItem(Material.LEATHER_HELMET, 20)); _playerArmor.addLoot(new RandomItem(Material.LEATHER_HELMET, 20));
@ -1168,7 +1150,7 @@ public abstract class Skywars extends Game
_playerBlock.addLoot(new RandomItem(Material.WOOD, 30, 8, 16)); _playerBlock.addLoot(new RandomItem(Material.WOOD, 30, 8, 16));
} }
private void setupMiddleLoot() public void setupMiddleLoot()
{ {
//Armor //Armor
_middleArmor.addLoot(new RandomItem(Material.GOLD_HELMET, 20)); _middleArmor.addLoot(new RandomItem(Material.GOLD_HELMET, 20));
@ -1365,4 +1347,19 @@ public abstract class Skywars extends Game
return this._crumbleTime; return this._crumbleTime;
} }
public ArrayList<Block> getSpawnChests()
{
return _spawnChests;
}
public ArrayList<Block> getMiddleChests()
{
return _middleChests;
}
public HashSet<Location> getLooted()
{
return _lootedBlocks;
}
} }

View File

@ -18,6 +18,11 @@ import nautilus.game.arcade.GameType;
import nautilus.game.arcade.events.GameStateChangeEvent; import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.game.GameTeam; import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.game.Game.GameState; import nautilus.game.arcade.game.Game.GameState;
import nautilus.game.arcade.stats.DeathBomberStatTracker;
import nautilus.game.arcade.stats.SkywarsKillZombieStatTracker;
import nautilus.game.arcade.stats.SkywarsTNTStatTracker;
import nautilus.game.arcade.stats.WinWithoutOpeningChestStatTracker;
import nautilus.game.arcade.stats.WinWithoutWearingArmorStatTracker;
public class SoloSkywars extends Skywars public class SoloSkywars extends Skywars
{ {
@ -26,7 +31,29 @@ public class SoloSkywars extends Skywars
public SoloSkywars(ArcadeManager manager) public SoloSkywars(ArcadeManager manager)
{ {
super(manager, GameType.Skywars, this(manager, GameType.Skywars);
registerStatTrackers(
new SkywarsTNTStatTracker(this),
new DeathBomberStatTracker(this, 3), //TNT Kills
new SkywarsKillZombieStatTracker(this),
new WinWithoutOpeningChestStatTracker(this),
new WinWithoutWearingArmorStatTracker(this));
registerChatStats(
Kills,
Deaths,
KDRatio,
BlankLine,
Assists,
DamageTaken,
DamageDealt
);
}
public SoloSkywars(ArcadeManager manager, GameType type)
{
super(manager, type,
new String[] new String[]
{ {
"Free for all battle in the sky!", "Free for all battle in the sky!",
@ -36,6 +63,23 @@ public class SoloSkywars extends Skywars
this.DamageTeamSelf = true; this.DamageTeamSelf = true;
registerStatTrackers(
new SkywarsTNTStatTracker(this),
new DeathBomberStatTracker(this, 3), //TNT Kills
new SkywarsKillZombieStatTracker(this),
new WinWithoutOpeningChestStatTracker(this),
new WinWithoutWearingArmorStatTracker(this));
registerChatStats(
Kills,
Deaths,
KDRatio,
BlankLine,
Assists,
DamageTaken,
DamageDealt
);
} }
@EventHandler @EventHandler

View File

@ -19,6 +19,11 @@ import nautilus.game.arcade.GameType;
import nautilus.game.arcade.events.GameStateChangeEvent; import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.game.GameTeam; import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.game.Game.GameState; import nautilus.game.arcade.game.Game.GameState;
import nautilus.game.arcade.stats.DeathBomberStatTracker;
import nautilus.game.arcade.stats.SkywarsKillZombieStatTracker;
import nautilus.game.arcade.stats.SkywarsTNTStatTracker;
import nautilus.game.arcade.stats.WinWithoutOpeningChestStatTracker;
import nautilus.game.arcade.stats.WinWithoutWearingArmorStatTracker;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Location; import org.bukkit.Location;
@ -34,11 +39,31 @@ import org.bukkit.event.player.PlayerQuitEvent;
public class TeamSkywars extends Skywars public class TeamSkywars extends Skywars
{ {
private NautHashMap<Player, Player> _teamReqs = new NautHashMap<Player, Player>();
public TeamSkywars(ArcadeManager manager) public TeamSkywars(ArcadeManager manager)
{ {
super(manager, GameType.SkywarsTeams, this(manager, GameType.SkywarsTeams);
registerStatTrackers(
new SkywarsTNTStatTracker(this),
new DeathBomberStatTracker(this, 3), //TNT Kills
new SkywarsKillZombieStatTracker(this),
new WinWithoutOpeningChestStatTracker(this),
new WinWithoutWearingArmorStatTracker(this));
registerChatStats(
Kills,
Deaths,
KDRatio,
BlankLine,
Assists,
DamageTaken,
DamageDealt
);
}
public TeamSkywars(ArcadeManager manager, GameType type)
{
super(manager, type,
new String[] new String[]
{ {
"Free for all battle in the sky!", "Free for all battle in the sky!",
@ -46,152 +71,17 @@ public class TeamSkywars extends Skywars
"Last team alive wins!" "Last team alive wins!"
}); });
this.FillTeamsInOrderToCount = 2; FillTeamsInOrderToCount = 2;
this.SpawnNearAllies = true; SpawnNearAllies = true;
this.DamageTeamSelf = false; DamageTeamSelf = false;
this.DontAllowOverfill = true; DontAllowOverfill = true;
}
@EventHandler PlayerTeamSelection = true;
public void CustomTeamGeneration(GameStateChangeEvent event) TeamMode = true;
{ TeamPerSpawn = true;
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 @Override
@ -262,8 +152,6 @@ public class TeamSkywars extends Skywars
} }
} }
Scoreboard.Draw(); Scoreboard.Draw();
} }
@ -329,147 +217,6 @@ public class TeamSkywars extends Skywars
return players; 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 @Override
public String GetMode() public String GetMode()
{ {

View File

@ -0,0 +1,219 @@
package nautilus.game.arcade.game.games.skywars.modes;
import java.util.HashSet;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.Chest;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import mineplex.core.common.util.UtilMath;
import mineplex.core.loot.ChestLoot;
import mineplex.core.loot.RandomItem;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType;
import nautilus.game.arcade.game.games.AbsorptionFix;
import nautilus.game.arcade.game.games.skywars.TeamSkywars;
/**
* OverpoweredSkywars gamemode for Skywars
*
* @author xXVevzZXx
*/
public class OverpoweredSkywars extends TeamSkywars
{
private ChestLoot _playerArmor = new ChestLoot();
private ChestLoot _playerFood = new ChestLoot();
private ChestLoot _playerTool = new ChestLoot();
private ChestLoot _playerProjectile = new ChestLoot();
private ChestLoot _playerBlock = new ChestLoot();
private ChestLoot _middleArmor = new ChestLoot();
private ChestLoot _middleFood = new ChestLoot();
private ChestLoot _middleTool = new ChestLoot();
private ChestLoot _middleProjectile = new ChestLoot();
private ChestLoot _middleBlock = new ChestLoot();
public OverpoweredSkywars(ArcadeManager manager)
{
super(manager, GameType.Brawl);
new AbsorptionFix(this);
}
@Override
public void fillChest(Player looter, Block block)
{
getLooted().add(block.getLocation());
Chest chest = (Chest) block.getState();
chest.getBlockInventory().clear();
//Prevents same inventory spot being used twice
HashSet<Integer> used = new HashSet<Integer>();
//Player Island
if (getSpawnChests().contains(block))
{
//Armor
for (int i=0 ; i<1 + UtilMath.r(2) ; i++)
{
ItemStack item = _playerArmor.getLoot();
chest.getBlockInventory().setItem(getIndex(used), item);
}
//Food
for (int i=0 ; i<1 + UtilMath.r(3) ; i++)
chest.getBlockInventory().setItem(getIndex(used), _playerFood.getLoot());
//Tool
for (int i=0 ; i<1 + UtilMath.r(2) ; i++)
chest.getBlockInventory().setItem(getIndex(used), _playerTool.getLoot());
//Projectile
for (int i=0 ; i<1 + UtilMath.r(2) ; i++)
chest.getBlockInventory().setItem(getIndex(used), _playerProjectile.getLoot());
//Block
for (int i=0 ; i<1 + UtilMath.r(2) ; i++)
chest.getBlockInventory().setItem(getIndex(used), _playerBlock.getLoot());
}
//Other
else if (getMiddleChests().contains(block))
{
//Armor
for (int i=0 ; i<1 + UtilMath.r(2) ; i++)
{
ItemStack item = _middleArmor.getLoot();
item.addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 1 + UtilMath.r(3));
chest.getBlockInventory().setItem(getIndex(used), item);
}
//Food
for (int i=0 ; i<1 + UtilMath.r(3) ; i++)
chest.getBlockInventory().setItem(getIndex(used), _middleFood.getLoot());
//Tool
for (int i=0 ; i<1 + UtilMath.r(2) ; i++)
chest.getBlockInventory().setItem(getIndex(used), _middleTool.getLoot());
//Projectile
for (int i=0 ; i<1 + UtilMath.r(2) ; i++)
chest.getBlockInventory().setItem(getIndex(used), _middleProjectile.getLoot());
//Block
for (int i=0 ; i<1 + UtilMath.r(2) ; i++)
chest.getBlockInventory().setItem(getIndex(used), _middleBlock.getLoot());
}
else
{
//Armor
for (int i=0 ; i<UtilMath.r(2) ; i++)
chest.getBlockInventory().setItem(getIndex(used), _middleArmor.getLoot());
//Food
for (int i=0 ; i<UtilMath.r(3) ; i++)
chest.getBlockInventory().setItem(getIndex(used), _middleFood.getLoot());
//Tool
for (int i=0 ; i<UtilMath.r(2) ; i++)
chest.getBlockInventory().setItem(getIndex(used), _middleTool.getLoot());
//Projectile
for (int i=0 ; i<UtilMath.r(2) ; i++)
chest.getBlockInventory().setItem(getIndex(used), _middleProjectile.getLoot());
//Block
for (int i=0 ; i<UtilMath.r(2) ; i++)
chest.getBlockInventory().setItem(getIndex(used), _middleBlock.getLoot());
}
}
@Override
public void setupPlayerLoot()
{
//Armor
_playerArmor.addLoot(new RandomItem(Material.DIAMOND_HELMET, 20));
_playerArmor.addLoot(new RandomItem(Material.DIAMOND_CHESTPLATE, 32));
_playerArmor.addLoot(new RandomItem(Material.DIAMOND_LEGGINGS, 28));
_playerArmor.addLoot(new RandomItem(Material.DIAMOND_BOOTS, 16));
//Food
_playerFood.addLoot(new RandomItem(Material.BAKED_POTATO, 1, 1, 4));
_playerFood.addLoot(new RandomItem(Material.COOKED_BEEF, 1, 1, 2));
_playerFood.addLoot(new RandomItem(Material.COOKED_CHICKEN, 1, 1, 2));
//Tools
_playerTool.addLoot(new RandomItem(Material.DIAMOND_SWORD, 2));
_playerTool.addLoot(new RandomItem(Material.FISHING_ROD, 2));
_playerTool.addLoot(new RandomItem(Material.DIAMOND_PICKAXE, 3));
_playerTool.addLoot(new RandomItem(Material.IRON_AXE, 1));
//Projectile
_playerProjectile.addLoot(new RandomItem(Material.ARROW, 18, 2, 8));
_playerProjectile.addLoot(new RandomItem(Material.SNOW_BALL, 60, 2, 5));
_playerProjectile.addLoot(new RandomItem(Material.EGG, 60, 2, 5));
_playerProjectile.addLoot(new RandomItem(Material.ENDER_PEARL, 20, 2, 5));
_playerProjectile.addLoot(new RandomItem(Material.LAVA_BUCKET, 20, 1, 1));
//Block
_playerBlock.addLoot(new RandomItem(Material.COBBLESTONE, 30, 8, 16));
_playerBlock.addLoot(new RandomItem(Material.WOOD, 30, 8, 16));
}
@Override
public void setupMiddleLoot()
{
_middleArmor.addLoot(new RandomItem(Material.DIAMOND_HELMET, 5));
_middleArmor.addLoot(new RandomItem(Material.DIAMOND_CHESTPLATE, 8));
_middleArmor.addLoot(new RandomItem(Material.DIAMOND_LEGGINGS, 7));
_middleArmor.addLoot(new RandomItem(Material.DIAMOND_BOOTS, 4));
//Food
_middleFood.addLoot(new RandomItem(Material.COOKED_BEEF, 1, 1, 3));
_middleFood.addLoot(new RandomItem(Material.COOKED_CHICKEN, 1, 1, 3));
_middleFood.addLoot(new RandomItem(Material.MUSHROOM_SOUP, 1));
_middleFood.addLoot(new RandomItem(Material.GRILLED_PORK, 1, 1, 3));
//Tools
_middleTool.addLoot(new RandomItem(Material.DIAMOND_SWORD, 1));
_middleTool.addLoot(new RandomItem(Material.FISHING_ROD, 1));
//Projectile
_middleTool.addLoot(new RandomItem(Material.BOW, 1));
_middleProjectile.addLoot(new RandomItem(Material.ARROW, 2, 4, 12));
_middleProjectile.addLoot(new RandomItem(Material.ENDER_PEARL, 1, 1, 2));
//Block
_middleBlock.addLoot(new RandomItem(Material.BRICK, 30, 12, 24));
_middleBlock.addLoot(new RandomItem(Material.GLASS, 30, 12, 24));
_middleBlock.addLoot(new RandomItem(Material.SOUL_SAND, 30, 12, 24));
}
private int getIndex(HashSet<Integer> used)
{
int i = UtilMath.r(27);
while (used.contains(i))
{
i = UtilMath.r(27);
}
used.add(i);
return i;
}
@Override
public String GetMode()
{
return "OP Skywars";
}
}

View File

@ -0,0 +1,89 @@
package nautilus.game.arcade.game.games.skywars.modes;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.entity.EntityDeathEvent;
import org.bukkit.event.entity.EntityRegainHealthEvent;
import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason;
import org.bukkit.inventory.ItemStack;
import org.bukkit.scoreboard.DisplaySlot;
import org.bukkit.scoreboard.Objective;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType;
import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.game.Game.GameState;
import nautilus.game.arcade.game.games.AbsorptionFix;
import nautilus.game.arcade.game.games.skywars.SoloSkywars;
/**
* UHCSkywars gamemode for Skywars
*
* @author xXVevzZXx
*/
public class UHCSkywars extends SoloSkywars
{
public UHCSkywars(ArcadeManager manager)
{
super(manager, GameType.Brawl);
SoupEnabled = false;
new AbsorptionFix(this);
}
@EventHandler
public void registerObj(GameStateChangeEvent event)
{
if(event.GetState() == GameState.Prepare)
{
Objective objective = Scoreboard.GetScoreboard().registerNewObjective("Health", "health");
objective.setDisplaySlot(DisplaySlot.PLAYER_LIST);
}
if(event.GetState() == GameState.Live)
{
for(Player player : GetPlayers(true))
{
player.damage(2);
}
Manager.runSyncLater(new Runnable()
{
@Override
public void run()
{
for(Player player : GetPlayers(true))
{
player.setHealth(player.getMaxHealth());
}
}
}, 10);
}
}
@EventHandler
public void regenHealth(EntityRegainHealthEvent event)
{
if(event.getRegainReason() == RegainReason.SATIATED)
event.setCancelled(true);
}
@EventHandler
public void gappleDrop(EntityDeathEvent event)
{
if(event.getEntity() instanceof Player)
{
event.getDrops().add(new ItemStack(Material.GOLDEN_APPLE));
}
}
@Override
public String GetMode()
{
return "UHC Skywars";
}
}

View File

@ -15,8 +15,14 @@ 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.GameTeam; import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.game.Game.GameState; import nautilus.game.arcade.game.Game.GameState;
import nautilus.game.arcade.managers.chat.ChatStatData; import nautilus.game.arcade.managers.chat.ChatStatData;
import nautilus.game.arcade.stats.FreeKitWinStatTracker;
import nautilus.game.arcade.stats.KillFastStatTracker;
import nautilus.game.arcade.stats.OneVThreeStatTracker;
import nautilus.game.arcade.stats.RecoveryMasterStatTracker;
import nautilus.game.arcade.stats.WinWithoutDyingStatTracker;
public class SoloSuperSmash extends SuperSmash public class SoloSuperSmash extends SuperSmash
{ {
@ -34,6 +40,14 @@ public class SoloSuperSmash extends SuperSmash
this.DamageTeamSelf = true; this.DamageTeamSelf = true;
registerStatTrackers(
new WinWithoutDyingStatTracker(this, "MLGPro"),
new FreeKitWinStatTracker(this),
new OneVThreeStatTracker(this),
new KillFastStatTracker(this, 3, 10, "TripleKill"),
new RecoveryMasterStatTracker(this)
);
registerChatStats( registerChatStats(
Kills, Kills,
Deaths, Deaths,
@ -47,6 +61,18 @@ public class SoloSuperSmash extends SuperSmash
); );
} }
public SoloSuperSmash(ArcadeManager manager, Kit[] kits, GameType type)
{
super(manager, kits, type, new String[]
{
"Each player has 3 respawns",
"Attack to restore hunger!",
"Last player alive wins!"
});
this.DamageTeamSelf = true;
}
@EventHandler @EventHandler
public void CustomTeamGeneration(GameStateChangeEvent event) public void CustomTeamGeneration(GameStateChangeEvent event)
{ {

View File

@ -85,7 +85,7 @@ public abstract class SuperSmash extends Game
public SuperSmash(ArcadeManager manager, GameType type, String[] description) public SuperSmash(ArcadeManager manager, GameType type, String[] description)
{ {
super(manager, type, this(manager,
new Kit[] new Kit[]
{ {
@ -114,7 +114,12 @@ public abstract class SuperSmash extends Game
new KitSheep(manager) new KitSheep(manager)
},description); }, type, description);
}
public SuperSmash(ArcadeManager manager, Kit[] kits, GameType type, String[] description)
{
super(manager, type, kits, description);
this.DeathOut = false; this.DeathOut = false;
@ -131,14 +136,6 @@ public abstract class SuperSmash extends Game
// 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(
new WinWithoutDyingStatTracker(this, "MLGPro"),
new FreeKitWinStatTracker(this),
new OneVThreeStatTracker(this),
new KillFastStatTracker(this, 3, 10, "TripleKill"),
new RecoveryMasterStatTracker(this)
);
} }
@EventHandler(priority = EventPriority.HIGH) @EventHandler(priority = EventPriority.HIGH)
@ -493,4 +490,9 @@ public abstract class SuperSmash extends Game
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 HashMap<Player, Integer> getLiveMap()
{
return _lives;
}
} }

View File

@ -16,6 +16,11 @@ import nautilus.game.arcade.GameType;
import nautilus.game.arcade.events.GameStateChangeEvent; import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.game.GameTeam; import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.managers.chat.ChatStatData; import nautilus.game.arcade.managers.chat.ChatStatData;
import nautilus.game.arcade.stats.FreeKitWinStatTracker;
import nautilus.game.arcade.stats.KillFastStatTracker;
import nautilus.game.arcade.stats.OneVThreeStatTracker;
import nautilus.game.arcade.stats.RecoveryMasterStatTracker;
import nautilus.game.arcade.stats.WinWithoutDyingStatTracker;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Location; import org.bukkit.Location;
@ -29,12 +34,6 @@ import org.bukkit.event.player.PlayerQuitEvent;
public class TeamSuperSmash extends SuperSmash 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) public TeamSuperSmash(ArcadeManager manager)
{ {
super(manager, GameType.SmashTeams, super(manager, GameType.SmashTeams,
@ -45,15 +44,26 @@ public class TeamSuperSmash extends SuperSmash
"Last team alive wins!" "Last team alive wins!"
}); });
this.PlayersPerTeam = 2; PlayersPerTeam = 2;
this.FillTeamsInOrderToCount = 2; FillTeamsInOrderToCount = 2;
this.SpawnNearAllies = true; SpawnNearAllies = true;
this.DamageTeamSelf = false; DamageTeamSelf = false;
this.TeamArmorHotbar = true; TeamArmorHotbar = true;
this.DontAllowOverfill = true; DontAllowOverfill = true;
TeamMode = true;
PlayerTeamSelection = true;
registerStatTrackers(
new WinWithoutDyingStatTracker(this, "MLGPro"),
new FreeKitWinStatTracker(this),
new OneVThreeStatTracker(this),
new KillFastStatTracker(this, 3, 10, "TripleKill"),
new RecoveryMasterStatTracker(this)
);
registerChatStats( registerChatStats(
Kills, Kills,
@ -122,112 +132,6 @@ public class TeamSuperSmash extends SuperSmash
Scoreboard.Draw(); 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 @Override
public void EndCheck() public void EndCheck()
{ {
@ -236,7 +140,7 @@ public class TeamSuperSmash extends SuperSmash
ArrayList<GameTeam> teamsAlive = new ArrayList<GameTeam>(); ArrayList<GameTeam> teamsAlive = new ArrayList<GameTeam>();
for (GameTeam team : this.GetTeamList()) for (GameTeam team : GetTeamList())
if (team.GetPlayers(true).size() > 0) if (team.GetPlayers(true).size() > 0)
teamsAlive.add(team); teamsAlive.add(team);
@ -290,147 +194,6 @@ public class TeamSuperSmash extends SuperSmash
return players; 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 @Override
public String GetMode() public String GetMode()
{ {

View File

@ -0,0 +1,156 @@
package nautilus.game.arcade.game.games.smash.modes;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.HandlerList;
import org.bukkit.event.entity.EntityDeathEvent;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilServer;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType;
import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.game.games.smash.SoloSuperSmash;
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.KitCow;
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.game.games.smash.modes.kits.KitPlayer;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.kit.Perk;
/**
* RandomKitSSM gamemode for SSM
*
* @author xXVevzZXx
*/
public class RandomKitSSM extends SoloSuperSmash
{
private Kit[] _kits;
private int _maxLives;
public RandomKitSSM(ArcadeManager manager)
{
super(manager, new Kit[]{new KitPlayer(manager)}, GameType.Brawl);
_maxLives = 5;
_kits = 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 KitZombie(manager),
new KitCow(manager),
new KitSheep(manager)
};
}
@Override
@EventHandler(priority = EventPriority.HIGH)
public void GameStateChange(GameStateChangeEvent event)
{
super.GameStateChange(event);
if (event.GetState() != GameState.Prepare)
return;
for (Player player : GetPlayers(true))
{
getLiveMap().put(player, _maxLives);
Kit kit = _kits[UtilMath.r(_kits.length)];
SetKit(player, kit, true);
}
}
@EventHandler
public void KitRegister(GameStateChangeEvent event)
{
if (event.GetState() != event.GetGame().KitRegisterState)
return;
for (Kit kit : _kits)
{
UtilServer.getServer().getPluginManager().registerEvents(kit, Manager.getPlugin());
for (Perk perk : kit.GetPerks())
{
UtilServer.getServer().getPluginManager().registerEvents(perk, Manager.getPlugin());
perk.registeredEvents();
}
}
}
@EventHandler
public void end(GameStateChangeEvent event)
{
if (event.GetState() != GameState.Dead)
return;
for (Kit kit : _kits)
{
HandlerList.unregisterAll(kit);
for (Perk perk : kit.GetPerks())
{
HandlerList.unregisterAll(perk);
perk.unregisteredEvents();
}
}
}
@EventHandler
public void kitSwitch(EntityDeathEvent event)
{
if (!(event.getEntity() instanceof Player))
return;
Kit kit = _kits[UtilMath.r(_kits.length)];
SetKit((Player) event.getEntity(), kit, true);
}
@Override
public String GetMode()
{
return "Random Kit SSM";
}
}

View File

@ -0,0 +1,47 @@
package nautilus.game.arcade.game.games.smash.modes.kits;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.SmashKit;
/**
* KitPlayer
*
* @author xXVevzZXx
*/
public class KitPlayer extends SmashKit
{
public KitPlayer(ArcadeManager manager)
{
super(manager, "Hipster", KitAvailability.Free, 0,
new String[]{"Always get another kit!"}, new Perk[]{}, EntityType.ZOMBIE, new ItemStack(Material.RECORD_10), "Super",
1, Sound.BURP);
}
@Override
public void giveCoreItems(Player player)
{
}
@Override
public void giveSuperItems(Player player)
{
}
@Override
public void GiveItems(Player player)
{
}
}

View File

@ -0,0 +1,176 @@
package nautilus.game.arcade.game.games.spleef.modes;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.bukkit.entity.Snowball;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.block.BlockDamageEvent;
import org.bukkit.event.entity.ProjectileHitEvent;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.recharge.Recharge;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.game.games.spleef.Spleef;
import nautilus.game.arcade.game.games.spleef.kits.KitSnowballer;
/**
* UltraSpleef gamemode for Super Spleef
*
* @author xXVevzZXx
*/
public class UltraSpleef extends Spleef
{
public UltraSpleef(ArcadeManager manager)
{
super(manager);
}
@Override
@EventHandler(priority = EventPriority.LOW)
public void BlockDamage(BlockDamageEvent event)
{
if (!this.IsLive())
return;
if (!this.IsAlive(event.getPlayer()))
return;
event.setCancelled(true);
if (event.getBlock().getType() == Material.BEDROCK)
return;
BlockFade(event.getBlock(), event.getPlayer(), false);
for (Block block : UtilBlock.getSurrounding(event.getBlock(), false))
{
BlockFade(block, event.getPlayer(), false);
}
//Snowball
if (GetKit(event.getPlayer()) instanceof KitSnowballer && event.getBlock().getType() != Material.BEDROCK)
if (!UtilInv.contains(event.getPlayer(), Material.SNOW_BALL, (byte)0, 16))
event.getPlayer().getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.SNOW_BALL, 2));
}
@Override
@EventHandler
public void SnowballDamage(ProjectileHitEvent event)
{
if (!IsLive())
return;
if (!(event.getEntity() instanceof Snowball))
return;
Snowball ball = (Snowball)event.getEntity();
if (ball.getShooter() == null || !(ball.getShooter() instanceof Player))
return;
Location loc = ball.getLocation().add(ball.getVelocity().multiply(0.8));
Block block = loc.getBlock();
//Find Nearest if hit nothing :O
if (block.getType() == Material.AIR)
{
Block closest = null;
double closestDist = 0;
for (Block other : UtilBlock.getSurrounding(block, true))
{
if (other.getType() == Material.AIR)
continue;
double dist = UtilMath.offset(loc, other.getLocation().add(0.5, 0.5, 0.5));
if (closest == null || dist < closestDist)
{
closest = other;
closestDist = dist;
}
}
if (closest != null)
block = closest;
}
for (Block other : UtilBlock.getSurrounding(block, true))
{
BlockFade(other, (Player)ball.getShooter(), false);
}
}
@Override
public void BlockFade(Block block, Player player, boolean slowDamage)
{
if (block.getType() == Material.BEDROCK || block.getType() == Material.LAVA || block.getType() == Material.STATIONARY_LAVA)
return;
//Prevent Super Hunger from Bow
if (Recharge.Instance.use(player, GetName() + " Hunger", 50, false, false))
UtilPlayer.hunger(player, 1);
if (!slowDamage)
{
Break(block, player);
return;
}
//Wool and Stained Clay
if (block.getTypeId() == 35 || block.getTypeId() == 159)
{
//Greens
if (block.getData() == 5 || block.getData() == 13)
block.setData((byte)14);
else
Break(block, player);
}
//Stone Brick
else if (block.getTypeId() == 98)
{
Break(block, player);
}
//Grass
else if (block.getTypeId() == 2)
{
Break(block, player);
}
//Wood Planks
else if (block.getTypeId() == 5)
{
if (block.getData() == 1)
block.setData((byte)0);
else
Break(block, player);
}
//Other
else if (block.getTypeId() != 7)
{
Break(block, player);
}
}
@Override
public String GetMode()
{
return "Ultra Spleef";
}
}

View File

@ -15,6 +15,10 @@ import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.game.GameTeam; import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.game.Game.GameState; import nautilus.game.arcade.game.Game.GameState;
import nautilus.game.arcade.managers.chat.ChatStatData; import nautilus.game.arcade.managers.chat.ChatStatData;
import nautilus.game.arcade.stats.FirstSupplyDropOpenStatTracker;
import nautilus.game.arcade.stats.KillsWithinTimeLimitStatTracker;
import nautilus.game.arcade.stats.SimultaneousSkeletonStatTracker;
import nautilus.game.arcade.stats.WinWithoutWearingArmorStatTracker;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -27,7 +31,27 @@ public class SoloSurvivalGames extends SurvivalGames
public SoloSurvivalGames(ArcadeManager manager) public SoloSurvivalGames(ArcadeManager manager)
{ {
super(manager, GameType.SurvivalGames, this(manager, GameType.SurvivalGames);
registerStatTrackers(new WinWithoutWearingArmorStatTracker(this),
new KillsWithinTimeLimitStatTracker(this, 3, 60, "Bloodlust"),
new FirstSupplyDropOpenStatTracker(this),
new SimultaneousSkeletonStatTracker(this, 5));
registerChatStats(
Kills,
Assists,
BlankLine,
DamageTaken,
DamageDealt,
BlankLine,
new ChatStatData("SupplyDropsOpened", "Event chests opened", true)
);
}
public SoloSurvivalGames(ArcadeManager manager, GameType type)
{
super(manager, type,
new String[] new String[]
{ {
"Search for chests to find loot", "Search for chests to find loot",
@ -40,7 +64,6 @@ public class SoloSurvivalGames extends SurvivalGames
}); });
this.DamageTeamSelf = true; this.DamageTeamSelf = true;
} }
@EventHandler @EventHandler

View File

@ -37,18 +37,20 @@ import org.bukkit.event.entity.ItemSpawnEvent;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.entity.ProjectileHitEvent; import org.bukkit.event.entity.ProjectileHitEvent;
import org.bukkit.event.hanging.HangingBreakEvent; import org.bukkit.event.hanging.HangingBreakEvent;
import org.bukkit.event.inventory.InventoryOpenEvent;
import org.bukkit.event.inventory.PrepareItemCraftEvent; import org.bukkit.event.inventory.PrepareItemCraftEvent;
import org.bukkit.event.player.PlayerChangedWorldEvent;
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.PlayerMoveEvent; import org.bukkit.event.player.PlayerMoveEvent;
import org.bukkit.event.player.PlayerPickupItemEvent;
import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.event.vehicle.VehicleCreateEvent; import org.bukkit.event.vehicle.VehicleCreateEvent;
import org.bukkit.inventory.BeaconInventory;
import org.bukkit.inventory.FurnaceInventory; import org.bukkit.inventory.FurnaceInventory;
import org.bukkit.inventory.InventoryHolder; import org.bukkit.inventory.InventoryHolder;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.FireworkMeta; import org.bukkit.inventory.meta.FireworkMeta;
import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.scheduler.BukkitRunnable; import org.bukkit.scheduler.BukkitRunnable;
import org.bukkit.scoreboard.Scoreboard; import org.bukkit.scoreboard.Scoreboard;
import org.bukkit.scoreboard.Team; import org.bukkit.scoreboard.Team;
@ -63,6 +65,7 @@ import mineplex.core.common.util.UtilEvent;
import mineplex.core.common.util.UtilEvent.ActionType; import mineplex.core.common.util.UtilEvent.ActionType;
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.UtilItem;
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.UtilPlayer;
@ -94,8 +97,6 @@ import nautilus.game.arcade.stats.SimultaneousSkeletonStatTracker;
import nautilus.game.arcade.stats.WinWithoutWearingArmorStatTracker; import nautilus.game.arcade.stats.WinWithoutWearingArmorStatTracker;
import net.minecraft.server.v1_8_R3.EntityLargeFireball; import net.minecraft.server.v1_8_R3.EntityLargeFireball;
import net.minecraft.server.v1_8_R3.PacketPlayOutScoreboardTeam; import net.minecraft.server.v1_8_R3.PacketPlayOutScoreboardTeam;
import net.minecraft.server.v1_8_R3.PacketPlayOutWorldBorder;
import net.minecraft.server.v1_8_R3.PacketPlayOutWorldBorder.EnumWorldBorderAction;
import net.minecraft.server.v1_8_R3.ScoreboardTeam; import net.minecraft.server.v1_8_R3.ScoreboardTeam;
import net.minecraft.server.v1_8_R3.WorldServer; import net.minecraft.server.v1_8_R3.WorldServer;
@ -256,21 +257,6 @@ public abstract class SurvivalGames extends Game
{ {
ex.printStackTrace(); ex.printStackTrace();
} }
registerStatTrackers(new WinWithoutWearingArmorStatTracker(this),
new KillsWithinTimeLimitStatTracker(this, 3, 60, "Bloodlust"),
new FirstSupplyDropOpenStatTracker(this),
new SimultaneousSkeletonStatTracker(this, 5));
registerChatStats(
Kills,
Assists,
BlankLine,
DamageTaken,
DamageDealt,
BlankLine,
new ChatStatData("SupplyDropsOpened", "Event chests opened", true)
);
} }
@EventHandler @EventHandler
@ -310,7 +296,7 @@ public abstract class SurvivalGames extends Game
event.setCancelled(true); event.setCancelled(true);
} }
private ItemStack buildCompass(int uses) protected ItemStack buildCompass(int uses)
{ {
ItemBuilder item = new ItemBuilder(Material.COMPASS); ItemBuilder item = new ItemBuilder(Material.COMPASS);
item.setTitle(C.cWhite + "Player Tracker" + buildTime()); item.setTitle(C.cWhite + "Player Tracker" + buildTime());
@ -715,7 +701,7 @@ public abstract class SurvivalGames extends Game
event.blockList().clear(); event.blockList().clear();
} }
private void fillChest(Player looter, Block block) public void fillChest(Player looter, Block block)
{ {
_lootedBlocks.add(block.getLocation()); _lootedBlocks.add(block.getLocation());
@ -775,6 +761,8 @@ public abstract class SurvivalGames extends Game
item = buildCompass(5); item = buildCompass(5);
} }
handlePickup(item);
chest.getBlockInventory().setItem(UtilMath.r(27), item); chest.getBlockInventory().setItem(UtilMath.r(27), item);
} }
@ -787,7 +775,7 @@ public abstract class SurvivalGames extends Game
_supplyCrates.remove(block); _supplyCrates.remove(block);
} }
private ItemStack GetChestItem(boolean superChest) protected ItemStack GetChestItem(boolean superChest)
{ {
if (superChest) if (superChest)
return _crateLoot.getLoot(); return _crateLoot.getLoot();
@ -808,6 +796,9 @@ public abstract class SurvivalGames extends Game
@EventHandler @EventHandler
public void ItemSpawn(ItemSpawnEvent event) public void ItemSpawn(ItemSpawnEvent event)
{ {
if (event.getEntity().getItemStack().hasItemMeta())
return;
Material mat = event.getEntity().getItemStack().getType(); Material mat = event.getEntity().getItemStack().getType();
switch (mat) switch (mat)
@ -1008,6 +999,32 @@ public abstract class SurvivalGames extends Game
} }
} }
@EventHandler
public void pickupItems(PlayerPickupItemEvent event)
{
handlePickup(event.getItem().getItemStack());
}
private void handlePickup(ItemStack stack)
{
if (stack.getType() == Material.CARROT
|| stack.getType() == Material.POTATO
|| stack.getType() == Material.WHEAT
|| stack.getType() == Material.CARROT_ITEM
|| stack.getType() == Material.POTATO_ITEM)
{
String name = "Carrot";
if (stack.getType() == Material.POTATO || stack.getType() == Material.POTATO_ITEM)
name = "Potato";
if (stack.getType() == Material.WHEAT)
name = "Wheat";
ItemMeta meta = stack.getItemMeta();
meta.setDisplayName(name);
stack.setItemMeta(meta);
}
}
@EventHandler @EventHandler
public void OpenChest(PlayerInteractEvent event) public void OpenChest(PlayerInteractEvent event)
{ {
@ -1465,7 +1482,7 @@ public abstract class SurvivalGames extends Game
_hiddenNames.remove(event.getPlayer()); _hiddenNames.remove(event.getPlayer());
} }
private void setupChestsEnchantingCrafting() public void setupChestsEnchantingCrafting()
{ {
ArrayList<Location> chests = WorldData.GetCustomLocs("54"); ArrayList<Location> chests = WorldData.GetCustomLocs("54");
@ -1511,7 +1528,7 @@ public abstract class SurvivalGames extends Game
} }
} }
private void setupLoot() public void setupLoot()
{ {
// Food // Food
_baseLoot.addLoot(new RandomItem(Material.BAKED_POTATO, 30, 1, 3)); _baseLoot.addLoot(new RandomItem(Material.BAKED_POTATO, 30, 1, 3));
@ -2019,29 +2036,83 @@ public abstract class SurvivalGames extends Game
} }
} }
@EventHandler
public void onInventoryOpen(InventoryOpenEvent event)
{
if(event.getInventory() instanceof BeaconInventory)
{
event.setCancelled(true);
}
}
public int getSecondsSinceStart() public int getSecondsSinceStart()
{ {
return this._secondsSinceStart; return _secondsSinceStart;
} }
public int getChestRefillTime() public int getChestRefillTime()
{ {
return this._chestRefillTime; return _chestRefillTime;
} }
public int getDeathMatchTime() public int getDeathMatchTime()
{ {
return this._deathMatchTime; return _deathMatchTime;
} }
public boolean isDeathMatchTeleported() public boolean isDeathMatchTeleported()
{ {
return this._deathMatchTeleported; return _deathMatchTeleported;
} }
public int getGameEndTime() public int getGameEndTime()
{ {
return this._gameEndTime; return _gameEndTime;
}
public ArrayList<Block> getSupplyBlocks()
{
return _supplyCrates;
}
public HashSet<Location> getLootedBlocks()
{
return _lootedBlocks;
}
public ChestLoot getBaseLoot()
{
return _baseLoot;
}
public ChestLoot getCrateLoot()
{
return _crateLoot;
}
public ChestLoot getSpawnLoot()
{
return _spawnLoot;
}
public ChestLoot getDeathMatch()
{
return _deathMatchLoot;
}
public ChestLoot getRawFurnace()
{
return _rawFurnace;
}
public ChestLoot getFurnace()
{
return _cookedFurnace;
}
public Location getSpawn()
{
return _spawn;
} }
} }

View File

@ -18,6 +18,10 @@ import nautilus.game.arcade.GameType;
import nautilus.game.arcade.events.GameStateChangeEvent; import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.game.GameTeam; import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.managers.chat.ChatStatData; import nautilus.game.arcade.managers.chat.ChatStatData;
import nautilus.game.arcade.stats.FirstSupplyDropOpenStatTracker;
import nautilus.game.arcade.stats.KillsWithinTimeLimitStatTracker;
import nautilus.game.arcade.stats.SimultaneousSkeletonStatTracker;
import nautilus.game.arcade.stats.WinWithoutWearingArmorStatTracker;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Location; import org.bukkit.Location;
@ -31,12 +35,6 @@ import org.bukkit.event.player.PlayerQuitEvent;
public class TeamSurvivalGames extends SurvivalGames 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) public TeamSurvivalGames(ArcadeManager manager)
{ {
super(manager, GameType.SurvivalGamesTeams, super(manager, GameType.SurvivalGamesTeams,
@ -51,123 +49,32 @@ public class TeamSurvivalGames extends SurvivalGames
"Last team alive wins!" "Last team alive wins!"
}); });
this.PlayersPerTeam = 2; PlayersPerTeam = 2;
this.FillTeamsInOrderToCount = 2; FillTeamsInOrderToCount = 2;
this.SpawnNearAllies = true; SpawnNearAllies = true;
this.SpawnNearEnemies = true; SpawnNearEnemies = true;
this.DamageTeamSelf = false; DamageTeamSelf = false;
this.DontAllowOverfill = true; DontAllowOverfill = true;
TeamMode = true;
PlayerTeamSelection = true;
} registerStatTrackers(new WinWithoutWearingArmorStatTracker(this),
new KillsWithinTimeLimitStatTracker(this, 3, 60, "Bloodlust"),
new FirstSupplyDropOpenStatTracker(this),
new SimultaneousSkeletonStatTracker(this, 5));
@EventHandler registerChatStats(
public void CustomTeamGeneration(GameStateChangeEvent event) Kills,
{ Assists,
if (event.GetState() != GameState.Recruit) BlankLine,
return; DamageTaken,
DamageDealt,
ArrayList<Location> spawns = this.GetTeamList().get(0).GetSpawns(); BlankLine,
this.GetTeamList().clear(); new ChatStatData("SupplyDropsOpened", "Event chests opened", true)
);
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 @Override
@ -185,7 +92,7 @@ public class TeamSurvivalGames extends SurvivalGames
Scoreboard.WriteBlank(); Scoreboard.WriteBlank();
Scoreboard.Write(C.cGreen + C.Bold + "Time"); Scoreboard.Write(C.cGreen + C.Bold + "Time");
Scoreboard.Write(UtilTime.convertString(this.getSecondsSinceStart() * 1000, 0, TimeUnit.FIT)); Scoreboard.Write(UtilTime.convertString(getSecondsSinceStart() * 1000, 0, TimeUnit.FIT));
Scoreboard.WriteBlank(); Scoreboard.WriteBlank();
Scoreboard.Write(C.cYellow + C.Bold + "Teams"); Scoreboard.Write(C.cYellow + C.Bold + "Teams");
@ -221,21 +128,21 @@ public class TeamSurvivalGames extends SurvivalGames
Scoreboard.WriteBlank(); Scoreboard.WriteBlank();
if (this.getChestRefillTime() > 0 && this.getDeathMatchTime() > 60) if (getChestRefillTime() > 0 && getDeathMatchTime() > 60)
{ {
Scoreboard.Write(C.cGold + C.Bold + "Chest Refill"); Scoreboard.Write(C.cGold + C.Bold + "Chest Refill");
Scoreboard.Write(UtilTime.convertString(this.getChestRefillTime() * 1000, 0, TimeUnit.FIT)); Scoreboard.Write(UtilTime.convertString(getChestRefillTime() * 1000, 0, TimeUnit.FIT));
} }
else if (this.getDeathMatchTime() > 0) else if (getDeathMatchTime() > 0)
{ {
Scoreboard.Write(C.cRed + C.Bold + "Deathmatch"); Scoreboard.Write(C.cRed + C.Bold + "Deathmatch");
Scoreboard.Write(UtilTime.convertString( Scoreboard.Write(UtilTime.convertString(
Math.min(this.getDeathMatchTime(), this.isDeathMatchTeleported() ? 10 : this.getDeathMatchTime()) * 1000, 0, TimeUnit.FIT)); Math.min(getDeathMatchTime(), isDeathMatchTeleported() ? 10 : getDeathMatchTime()) * 1000, 0, TimeUnit.FIT));
} }
else else
{ {
Scoreboard.Write(C.cRed + C.Bold + "Game End"); Scoreboard.Write(C.cRed + C.Bold + "Game End");
Scoreboard.Write(UtilTime.convertString(Math.max(0, this.getGameEndTime()) * 1000, 0, TimeUnit.FIT)); Scoreboard.Write(UtilTime.convertString(Math.max(0, getGameEndTime()) * 1000, 0, TimeUnit.FIT));
} }
Scoreboard.Draw(); Scoreboard.Draw();
@ -249,7 +156,7 @@ public class TeamSurvivalGames extends SurvivalGames
ArrayList<GameTeam> teamsAlive = new ArrayList<GameTeam>(); ArrayList<GameTeam> teamsAlive = new ArrayList<GameTeam>();
for (GameTeam team : this.GetTeamList()) for (GameTeam team : GetTeamList())
if (team.GetPlayers(true).size() > 0) if (team.GetPlayers(true).size() > 0)
teamsAlive.add(team); teamsAlive.add(team);
@ -303,147 +210,6 @@ public class TeamSurvivalGames extends SurvivalGames
return players; 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 @Override
public String GetMode() public String GetMode()
{ {

View File

@ -20,7 +20,7 @@ public class KitHorseman extends Kit
new String[] new String[]
{ {
"Proud owner of a (rapidly growing) horse!" "Proud owner of a horse!"
}, },
new Perk[] new Perk[]

View File

@ -0,0 +1,321 @@
package nautilus.game.arcade.game.games.survivalgames.modes;
import java.util.ArrayList;
import java.util.Arrays;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.Chest;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.inventory.ItemStack;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilMath;
import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.loot.RandomItem;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType;
import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.game.games.AbsorptionFix;
import nautilus.game.arcade.game.games.survivalgames.SoloSurvivalGames;
import nautilus.game.arcade.game.games.survivalgames.SupplyChestOpenEvent;
import nautilus.game.arcade.game.games.survivalgames.kit.KitLooter;
/**
* OverpoweredSurvival gammeode for Survivalgames
*
* @author xXVevzZXx
*/
public class OverpoweredSurvival extends SoloSurvivalGames
{
public OverpoweredSurvival(ArcadeManager manager)
{
super(manager, GameType.Brawl);
new AbsorptionFix(this);
}
@Override
public void setupLoot()
{
// Food
getBaseLoot().addLoot(new RandomItem(Material.BAKED_POTATO, 30, 1, 3));
getBaseLoot().addLoot(new RandomItem(Material.COOKED_BEEF, 30, 1, 2));
getBaseLoot().addLoot(new RandomItem(Material.COOKED_CHICKEN, 30, 1, 2));
getBaseLoot().addLoot(new RandomItem(Material.MUSHROOM_SOUP, 15, 1, 1));
getBaseLoot().addLoot(new RandomItem(Material.APPLE, 30));
// Weapons
getBaseLoot().addLoot(new RandomItem(Material.DIAMOND_AXE, 80));
getBaseLoot().addLoot(new RandomItem(Material.DIAMOND_SWORD, 70));
getBaseLoot().addLoot(new RandomItem(Material.IRON_AXE, 40));
getBaseLoot().addLoot(new RandomItem(Material.IRON_SWORD, 35));
// armor
getBaseLoot().addLoot(new RandomItem(Material.DIAMOND_BOOTS, 35));
getBaseLoot().addLoot(new RandomItem(Material.DIAMOND_CHESTPLATE, 35));
getBaseLoot().addLoot(new RandomItem(Material.DIAMOND_HELMET, 35));
getBaseLoot().addLoot(new RandomItem(Material.DIAMOND_LEGGINGS, 35));
getBaseLoot().addLoot(new RandomItem(Material.IRON_BOOTS, 15));
getBaseLoot().addLoot(new RandomItem(Material.IRON_CHESTPLATE, 15));
getBaseLoot().addLoot(new RandomItem(Material.IRON_HELMET, 15));
getBaseLoot().addLoot(new RandomItem(Material.IRON_LEGGINGS, 15));
// Throwable
getBaseLoot().addLoot(new RandomItem(Material.FISHING_ROD, 30));
getBaseLoot().addLoot(new RandomItem(Material.BOW, 20));
getBaseLoot().addLoot(new RandomItem(Material.ARROW, 40, 4, 12));
// Misc
getBaseLoot().addLoot(new RandomItem(Material.EXP_BOTTLE, 40, 5, 20));
getBaseLoot().addLoot(new RandomItem(Material.COMPASS, 20));
getBaseLoot().addLoot(new RandomItem(Material.STICK, 30, 1, 2));
getBaseLoot().addLoot(new RandomItem(Material.FLINT, 30, 1, 2));
getBaseLoot().addLoot(new RandomItem(Material.FEATHER, 30, 1, 2));
getBaseLoot().addLoot(new RandomItem(Material.GOLD_INGOT, 20));
getBaseLoot().addLoot(new RandomItem(ItemStackFactory.Instance.CreateStack(Material.TNT,
(byte) 0, 1, F.item("Throwing TNT")), 15));
getSpawnLoot().addLoot(new RandomItem(Material.MUSHROOM_SOUP, 15));
getSpawnLoot().addLoot(new RandomItem(Material.BAKED_POTATO, 30, 1, 3));
getSpawnLoot().addLoot(new RandomItem(Material.COOKED_BEEF, 30, 1, 2));
getSpawnLoot().addLoot(new RandomItem(Material.COOKED_CHICKEN, 30, 1, 2));
getSpawnLoot().addLoot(new RandomItem(Material.MUSHROOM_SOUP, 15, 1, 1));
getSpawnLoot().addLoot(new RandomItem(Material.APPLE, 30));
getSpawnLoot().addLoot(new RandomItem(Material.IRON_BOOTS, 15));
getSpawnLoot().addLoot(new RandomItem(Material.IRON_CHESTPLATE, 15));
getSpawnLoot().addLoot(new RandomItem(Material.IRON_HELMET, 15));
getSpawnLoot().addLoot(new RandomItem(Material.IRON_LEGGINGS, 15));
// Loot for chests in spawn
// Weaponry and ores
getSpawnLoot().addLoot(new RandomItem(Material.IRON_SWORD, 30));
getSpawnLoot().addLoot(new RandomItem(Material.IRON_AXE, 30));
getSpawnLoot().addLoot(new RandomItem(Material.DIAMOND, 30, 3, 6));
// Supply crate loot
int e = 4;
for (int i = 1; i < 4; i++)
{
getCrateLoot().addLoot(new RandomItem(
ItemStackFactory.Instance.CreateStack(Material.DIAMOND_HELMET.getId(), (byte) 0,
1, (short) 0, null, Arrays.asList(new String[] {}), null, false, i,
Enchantment.PROTECTION_ENVIRONMENTAL),
e * 10));
getCrateLoot().addLoot(new RandomItem(
ItemStackFactory.Instance.CreateStack(Material.DIAMOND_CHESTPLATE.getId(),
(byte) 0, 1, (short) 0, null, Arrays.asList(new String[] {}), null,
false, i, Enchantment.PROTECTION_ENVIRONMENTAL),
e * 10));
getCrateLoot().addLoot(new RandomItem(
ItemStackFactory.Instance.CreateStack(Material.DIAMOND_LEGGINGS.getId(),
(byte) 0, 1, (short) 0, null, Arrays.asList(new String[] {}), null,
false, i, Enchantment.PROTECTION_ENVIRONMENTAL),
e * 10));
getCrateLoot().addLoot(new RandomItem(
ItemStackFactory.Instance.CreateStack(Material.DIAMOND_BOOTS.getId(), (byte) 0,
1, (short) 0, null, Arrays.asList(new String[] {}), null, false, i,
Enchantment.PROTECTION_ENVIRONMENTAL),
e * 10));
getCrateLoot().addLoot(new RandomItem(
ItemStackFactory.Instance.CreateStack(Material.DIAMOND_SWORD.getId(), (byte) 0,
1, (short) 0, null, Arrays.asList(new String[] {}), null, false, i,
Enchantment.DAMAGE_ALL),
e * 10));
getCrateLoot().addLoot(new RandomItem(
ItemStackFactory.Instance.CreateStack(Material.DIAMOND_AXE.getId(), (byte) 0, 1,
(short) 0, null, Arrays.asList(new String[] {}), null, false, i,
Enchantment.DAMAGE_ALL),
e * 10));
getCrateLoot().addLoot(new RandomItem(
ItemStackFactory.Instance.CreateStack(Material.IRON_HELMET.getId(), (byte) 0, 1,
(short) 0, null, Arrays.asList(new String[] {}), null, false, i,
Enchantment.PROTECTION_ENVIRONMENTAL),
e * 3));
getCrateLoot().addLoot(new RandomItem(
ItemStackFactory.Instance.CreateStack(Material.IRON_CHESTPLATE.getId(),
(byte) 0, 1, (short) 0, null, Arrays.asList(new String[] {}), null,
false, i, Enchantment.PROTECTION_ENVIRONMENTAL),
e * 3));
getCrateLoot().addLoot(new RandomItem(
ItemStackFactory.Instance.CreateStack(Material.IRON_LEGGINGS.getId(), (byte) 0,
1, (short) 0, null, Arrays.asList(new String[] {}), null, false, i,
Enchantment.PROTECTION_ENVIRONMENTAL),
e * 3));
getCrateLoot().addLoot(new RandomItem(
ItemStackFactory.Instance.CreateStack(Material.IRON_BOOTS.getId(), (byte) 0, 1,
(short) 0, null, Arrays.asList(new String[] {}), null, false, i,
Enchantment.PROTECTION_ENVIRONMENTAL),
e * 3));
getCrateLoot().addLoot(new RandomItem(
ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD.getId(), (byte) 0, 1,
(short) 0, null, Arrays.asList(new String[] {}), null, false, i,
Enchantment.DAMAGE_ALL),
e * 3));
getCrateLoot().addLoot(
new RandomItem(ItemStackFactory.Instance.CreateStack(Material.IRON_AXE.getId(),
(byte) 0, 1, (short) 0, null, Arrays.asList(new String[] {}), null,
false, i, Enchantment.DAMAGE_ALL), e * 3));
e--;
}
// Cooked furnace
getFurnace().addLoot(new RandomItem(Material.COOKED_BEEF, 3, 1, 2));
getFurnace().addLoot(new RandomItem(Material.COOKED_CHICKEN, 3, 1, 2));
getFurnace().addLoot(new RandomItem(Material.COOKED_FISH, 3, 1, 2));
getFurnace().addLoot(new RandomItem(Material.GRILLED_PORK, 3, 1, 2));
getFurnace().addLoot(new RandomItem(Material.BAKED_POTATO, 3, 1, 1));
getFurnace().addLoot(new RandomItem(Material.PUMPKIN_PIE, 3, 1, 1));
getFurnace().addLoot(new RandomItem(Material.IRON_INGOT, 1, 1, 1));
// Raw furnace
getRawFurnace().addLoot(new RandomItem(Material.RAW_BEEF, 1, 1, 3));
getRawFurnace().addLoot(new RandomItem(Material.RAW_CHICKEN, 1, 1, 3));
getRawFurnace().addLoot(new RandomItem(Material.RAW_FISH, 1, 1, 3));
getRawFurnace().addLoot(new RandomItem(Material.PORK, 1, 1, 3));
getRawFurnace().addLoot(new RandomItem(Material.POTATO_ITEM, 1, 1, 3));
// Deathmatch Loot
getDeathMatch().addLoot(new RandomItem(Material.PUMPKIN_PIE, 4));
getDeathMatch().addLoot(new RandomItem(Material.BAKED_POTATO, 4));
getDeathMatch().addLoot(new RandomItem(Material.CAKE, 4));
getDeathMatch().addLoot(new RandomItem(Material.APPLE, 4));
getDeathMatch().addLoot(new RandomItem(Material.DIAMOND_AXE, 3));
getDeathMatch().addLoot(new RandomItem(Material.DIAMOND_SWORD, 3));
}
@Override
public void fillChest(Player looter, Block block)
{
getLootedBlocks().add(block.getLocation());
Chest chest = (Chest) block.getState();
chest.getBlockInventory().clear();
int items = 2;
if (Math.random() > 0.50)
items++;
if (Math.random() > 0.65)
items++;
if (Math.random() > 0.80)
items++;
if (Math.random() > 0.95)
items++;
boolean spawnChest = getChestRefillTime() > 0
&& UtilMath.offset(chest.getLocation(), getSpawn()) < 8;
if (spawnChest)
items += 3;
if (GetKit(looter) instanceof KitLooter)
{
items += UtilMath.r(3);
}
if (getSupplyBlocks().contains(block))
{
items = 5;
if (Math.random() > 0.50)
items++;
if (Math.random() > 0.60)
items++;
if (Math.random() > 0.70)
items++;
if (Math.random() > 0.80)
items++;
if (Math.random() > 0.90)
items++;
if (Math.random() > 0.95)
items++;
}
for (int i = 0; i < items; i++)
{
ItemStack item;
if (spawnChest)
{
item = getSpawnLoot().getLoot();
}
else if (isDeathMatchTeleported())
{
item = getDeathMatch().getLoot();
}
else
{
item = GetChestItem(getSupplyBlocks().contains(block));
}
if (item.getType() == Material.COMPASS)
{
item = buildCompass(5);
}
chest.getBlockInventory().setItem(UtilMath.r(27), item);
}
if (getSupplyBlocks().contains(block))
{
Bukkit.getPluginManager().callEvent(new SupplyChestOpenEvent(looter, block));
}
getSupplyBlocks().remove(block);
}
@Override
public void setupChestsEnchantingCrafting()
{
ArrayList<Location> chests = WorldData.GetCustomLocs("54");
System.out.println("Map Chest Locations: " + chests.size());
// Enchants
System.out.println("Enchanting Tables: " + Math.min(5, chests.size()));
for (int i = 0; i < 5 && !chests.isEmpty(); i++)
{
Location loc = chests.remove(UtilMath.r(chests.size()));
loc.getBlock().setType(Material.ENCHANTMENT_TABLE);
}
// Crafting
System.out.println("Crafting Benches: " + Math.min(10, chests.size()));
for (int i = 0; i < 10 && !chests.isEmpty(); i++)
{
Location loc = chests.remove(UtilMath.r(chests.size()));
loc.getBlock().setType(Material.WORKBENCH);
}
}
@EventHandler(priority = EventPriority.LOWEST)
public void StartEffectApply(GameStateChangeEvent event)
{
if (event.GetState() != GameState.Live)
return;
for (Player player : GetPlayers(true))
{
Manager.GetCondition().Factory().HealthBoost("Start Health", player, player, 30, 3,
false, false, false);
player.setHealth(player.getMaxHealth());
}
}
@Override
public String GetMode()
{
return "OP Survival Games";
}
}

View File

@ -0,0 +1,71 @@
package nautilus.game.arcade.game.games.survivalgames.modes;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.entity.EntityDeathEvent;
import org.bukkit.event.entity.EntityRegainHealthEvent;
import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason;
import org.bukkit.inventory.ItemStack;
import org.bukkit.scoreboard.DisplaySlot;
import org.bukkit.scoreboard.Objective;
import mineplex.core.loot.RandomItem;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType;
import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.game.games.AbsorptionFix;
import nautilus.game.arcade.game.games.survivalgames.SoloSurvivalGames;
/**
* UHCSurvivalgames gamemode for Survivalgames
*
* @author xXVevzZXx
*/
public class UHCSurvivalgames extends SoloSurvivalGames
{
public UHCSurvivalgames(ArcadeManager manager)
{
super(manager, GameType.Brawl);
SoupEnabled = false;
new AbsorptionFix(this);
}
@EventHandler
public void registerObj(GameStateChangeEvent event)
{
if (event.GetState() != GameState.Prepare)
return;
else if (event.GetState() != GameState.Live)
getCrateLoot().addLoot(new RandomItem(new ItemStack(Material.GOLDEN_APPLE), 100));
Objective objective = Scoreboard.GetScoreboard().registerNewObjective("Health", "health");
objective.setDisplaySlot(DisplaySlot.PLAYER_LIST);
}
@EventHandler
public void regenHealth(EntityRegainHealthEvent event)
{
if (event.getRegainReason() == RegainReason.SATIATED)
event.setCancelled(true);
}
@EventHandler
public void gappleDrop(EntityDeathEvent event)
{
if (event.getEntity() instanceof Player)
{
event.getDrops().add(new ItemStack(Material.GOLDEN_APPLE));
}
}
@Override
public String GetMode()
{
return "UHC Survivalagmes";
}
}

View File

@ -124,7 +124,20 @@ public class UHC extends TeamGame
public UHC(ArcadeManager manager) public UHC(ArcadeManager manager)
{ {
super(manager, GameType.UHC, this(manager, GameType.UHC);
registerChatStats(
Kills,
Assists,
BlankLine,
DamageTaken,
DamageDealt
);
}
public UHC(ArcadeManager manager, GameType type)
{
super(manager, type,
new Kit[] new Kit[]
{ {
@ -207,14 +220,6 @@ public class UHC extends TeamGame
_createTime = System.currentTimeMillis(); _createTime = System.currentTimeMillis();
_serverTime = Utility.currentTimeMillis(); _serverTime = Utility.currentTimeMillis();
registerChatStats(
Kills,
Assists,
BlankLine,
DamageTaken,
DamageDealt
);
} }
@Override @Override
@ -1600,6 +1605,9 @@ public class UHC extends TeamGame
break; break;
} }
if(visible)
setOreType(vein);
// Remove Vein // Remove Vein
if (!visible) if (!visible)
{ {
@ -1622,6 +1630,11 @@ public class UHC extends TeamGame
} }
} }
public void setOreType(ArrayList<Block> blocks)
{
}
public boolean isMapLoaded() public boolean isMapLoaded()
{ {
return _mapLoaded; return _mapLoaded;

View File

@ -0,0 +1,119 @@
package nautilus.game.arcade.game.games.uhc.modes;
import java.util.HashMap;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.entity.PlayerDeathEvent;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.itemstack.ItemStackFactory;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType;
import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.game.games.uhc.UHC;
/**
* Assassins gamemode for UHC
*
* @author xXVevzZXx
*/
public class Assassins extends UHC
{
private HashMap<Player, Player> _assassins;
public Assassins(ArcadeManager manager)
{
super(manager, GameType.Brawl);
}
@EventHandler
public void setTargets(GameStateChangeEvent event)
{
if (event.GetState() != GameState.Live)
return;
for (Player player : GetPlayers(true))
{
for (Player other : GetPlayers(true))
{
if (GetTeam(player) == GetTeam(other))
continue;
if (_assassins.containsValue(other))
continue;
_assassins.put(player, other);
UtilPlayer.message(player, F.main("Game", "Your target is " + F.game(other.getName()) + ". If you kill another Player no loot will drop."));
}
}
for (Player player : GetPlayers(true))
{
if (!_assassins.containsKey(player))
{
getNewTarget(player);
}
}
}
@EventHandler
public void killPlayer(PlayerDeathEvent event)
{
Player player = event.getEntity();
for (Player other : _assassins.keySet())
{
if (_assassins.get(other) == player)
{
UtilPlayer.message(other, F.main("Game", "Your target has died."));
Player newTarget = _assassins.get(player);
if (GetTeam(newTarget) != GetTeam(other))
{
_assassins.put(other, newTarget);
}
else
{
getNewTarget(other);
}
}
}
if (event.getEntity().getKiller() instanceof Player)
{
Player killer = event.getEntity().getKiller();
if (_assassins.get(killer) != event.getEntity())
{
event.getDrops().clear();
event.setDroppedExp(0);
}
}
}
public void getNewTarget(Player player)
{
Player other = GetPlayers(true).get(UtilMath.r(GetPlayers(true).size()));
while (other == player || GetTeam(player) == GetTeam(other))
{
other = GetPlayers(true).get(UtilMath.r(GetPlayers(true).size()));
}
_assassins.put(player, other);
UtilPlayer.message(player, F.main("Game", "Your target is " + F.game(other.getName()) + ". If you kill another Player no loot will drop."));
UtilInv.insert(player, ItemStackFactory.Instance.CreateStack(Material.PAPER, (byte) 0, 1, "Your target is: " + F.game(other.getName())));
}
@Override
public String GetMode()
{
return "Assassins";
}
}

View File

@ -0,0 +1,49 @@
package nautilus.game.arcade.game.games.uhc.modes;
import java.util.HashMap;
import org.bukkit.Material;
import org.bukkit.event.EventHandler;
import org.bukkit.event.block.BlockBreakEvent;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType;
import nautilus.game.arcade.game.games.uhc.UHC;
/**
* BloodDiamonds gamemode for UHC
*
* @author xXVevzZXx
*/
public class BloodDiamonds extends UHC
{
private HashMap<Material, Double> _oreDamage;
public BloodDiamonds(ArcadeManager manager)
{
super(manager, GameType.Brawl);
_oreDamage = new HashMap<>();
_oreDamage.put(Material.DIAMOND_ORE, 1D);
}
@EventHandler
public void damageOres(BlockBreakEvent event)
{
for (Material mat : _oreDamage.keySet())
{
if (event.getBlock().getType() == mat)
{
event.getPlayer().damage(_oreDamage.get(mat));
}
}
}
@Override
public String GetMode()
{
return "Blood Diamonds";
}
}

View File

@ -0,0 +1,118 @@
package nautilus.game.arcade.game.games.uhc.modes;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.entity.EntityDeathEvent;
import org.bukkit.inventory.ItemStack;
import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilMath;
import mineplex.core.itemstack.ItemStackFactory;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType;
import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.game.games.uhc.UHC;
/**
* CutClean gamemode for UHC
*
* @author xXVevzZXx
*/
public class CutClean extends UHC
{
private int _steakAmount;
private HashMap<Material, Material> _oreDrops;
private HashMap<Material, Material> _drops;
public CutClean(ArcadeManager manager)
{
super(manager, GameType.Brawl);
_steakAmount = 15;
_oreDrops = new HashMap<>();
_oreDrops.put(Material.GOLD_ORE, Material.GOLD_INGOT);
_oreDrops.put(Material.IRON_ORE, Material.IRON_INGOT);
_drops = new HashMap<>();
_drops.put(Material.RAW_BEEF, Material.COOKED_BEEF);
_drops.put(Material.RAW_CHICKEN, Material.COOKED_CHICKEN);
_drops.put(Material.RAW_FISH, Material.COOKED_FISH);
_drops.put(Material.PORK, Material.GRILLED_PORK);
_drops.put(Material.RABBIT, Material.COOKED_RABBIT);
}
@EventHandler
public void giveSteak(GameStateChangeEvent event)
{
if (event.GetState() != GameState.Live)
return;
for (Player player : GetPlayers(true))
{
UtilInv.insert(player,
ItemStackFactory.Instance.CreateStack(Material.COOKED_BEEF, _steakAmount));
}
}
@EventHandler
public void smeltOres(BlockBreakEvent event)
{
for (Material mat : _oreDrops.keySet())
{
if (event.getBlock().getType() == mat)
{
event.setCancelled(true);
event.getBlock().setType(Material.AIR);
Bukkit.getScheduler().runTaskLater(Manager.getPlugin(), new Runnable()
{
@Override
public void run()
{
event.getBlock().getWorld().dropItem(
event.getBlock().getLocation().add(0.5, 0.2, 0.5),
new ItemStack(_oreDrops.get(mat)));
}
}, 1);
}
}
}
@EventHandler
public void smeltFood(EntityDeathEvent event)
{
List<ItemStack> drops = event.getDrops();
for (Material mat : _drops.keySet())
{
Iterator<ItemStack> itemIterator = drops.iterator();
while (itemIterator.hasNext())
{
ItemStack item = itemIterator.next();
if (item.getType() == mat)
{
itemIterator.remove();
drops.add(ItemStackFactory.Instance.CreateStack(_drops.get(mat),
1 + UtilMath.r(3)));
}
}
}
}
@Override
public String GetMode()
{
return "Cut Clean";
}
}

View File

@ -0,0 +1,109 @@
package nautilus.game.arcade.game.games.uhc.modes;
import java.util.ArrayList;
import java.util.HashMap;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.inventory.ItemStack;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilItem;
import mineplex.core.common.util.UtilMath;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType;
import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.game.games.uhc.UHC;
/**
* GodBattles gamemode for UHC
*
* @author xXVevzZXx
*/
public class GodBattles extends UHC
{
private ArrayList<Material> _ores;
private HashMap<Material, Material> _oreDrops;
public GodBattles(ArcadeManager manager)
{
super(manager, GameType.Brawl);
_ores = new ArrayList<>();
_ores.add(Material.GOLD_ORE);
_ores.add(Material.DIAMOND_ORE);
_oreDrops = new HashMap<>();
_oreDrops.put(Material.GOLD_ORE, Material.GOLD_BLOCK);
}
@EventHandler
public void blockOres(BlockBreakEvent event)
{
for (Material mat : _oreDrops.keySet())
{
if (event.getBlock().getType() == mat)
{
event.setCancelled(true);
event.getBlock().setType(Material.AIR);
Bukkit.getScheduler().runTaskLater(Manager.getPlugin(), new Runnable()
{
@Override
public void run()
{
event.getBlock().getWorld().dropItem(
event.getBlock().getLocation().add(0.5, 0.2, 0.5),
new ItemStack(_oreDrops.get(mat)));
}
}, 1);
}
}
}
@EventHandler
public void givePickaxe(GameStateChangeEvent event)
{
if(event.GetState() != GameState.Live)
return;
for (Player player : GetPlayers(true))
{
player.getInventory().addItem(UtilItem.makeUnbreakable(new ItemStack(Material.DIAMOND_PICKAXE)));
}
}
@Override
public void setOreType(ArrayList<Block> blocks)
{
Material ore = _ores.get(UtilMath.r(_ores.size()));
for (Block block : blocks)
{
if(block.getType() != Material.DIAMOND_ORE && block.getType() != Material.GOLD_ORE)
{
if(!UtilBlock.isVisible(block))
block.setType(ore);
}
}
}
@Override
public boolean isOre(Block block)
{
return (block.getType() == Material.COAL_ORE || block.getType() == Material.REDSTONE_ORE || block.getType() == Material.IRON_ORE || block.getType() == Material.GOLD_ORE || block.getType() == Material.DIAMOND_ORE);
}
@Override
public String GetMode()
{
return "God Battles";
}
}

View File

@ -476,7 +476,7 @@ public enum SpellType // ❤
C.cGray + "Misc spells that don't fit in", C.cGray + "Misc spells that don't fit in",
"These spells generally effect the world itself").build(), C.cGray), "These spells generally affect the world itself").build(), C.cGray),
SUPPORT(4, 4, 4, new ItemBuilder(Material.INK_SACK, 1, (short) 14).setTitle(C.cDGreen + "Support Spells") SUPPORT(4, 4, 4, new ItemBuilder(Material.INK_SACK, 1, (short) 14).setTitle(C.cDGreen + "Support Spells")
.addLore(C.cGray + "Spells of assistance").build(), C.cDGreen); .addLore(C.cGray + "Spells of assistance").build(), C.cDGreen);

View File

@ -3,6 +3,7 @@ package nautilus.game.arcade.game.games.wizards;
import mineplex.core.MiniPlugin; import mineplex.core.MiniPlugin;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilInv; import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilServer;
import mineplex.core.itemstack.ItemBuilder; import mineplex.core.itemstack.ItemBuilder;
import nautilus.game.arcade.events.GameStateChangeEvent; import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.game.Game.GameState; import nautilus.game.arcade.game.Game.GameState;
@ -74,15 +75,25 @@ public class WizardSpellMenu extends MiniPlugin
} }
@EventHandler @EventHandler
public void onJoin(GameStateChangeEvent event) public void onGameStateChange(GameStateChangeEvent event)
{ {
if (event.GetState() == GameState.Recruit) if (event.GetState() == GameState.Recruit)
{ {
for (Player player : Bukkit.getOnlinePlayers()) for (Player player : UtilServer.GetPlayers())
{ {
player.getInventory().setItem(0, _wizardSpells); player.getInventory().setItem(0, _wizardSpells);
} }
} }
else if(event.GetState() == GameState.Prepare)
{
for(Player player : UtilServer.GetPlayers())
{
if (!_wizards.IsAlive(player))
{
player.getInventory().setItem(0, _wizardSpells);
}
}
}
} }
@EventHandler @EventHandler

View File

@ -41,8 +41,9 @@ public class ChooseMapPage extends BasePage
} }
for(String cur : getPlugin().LoadFiles(loadMaps)) for(String cur : getPlugin().LoadFiles(loadMaps))
{ {
String name = cur.contains("_") ? cur.split("_")[1] : cur;
ChooseMapButton btn = new ChooseMapButton(getPlugin(), getShop(), _gameType, cur); 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); addButton(slot, new ShopItem(Material.PAPER, name, new String[]{"§7Click to select map."}, 1, false), btn);
slot++; slot++;
} }
} }

View File

@ -1,11 +1,6 @@
package nautilus.game.arcade.gui.privateServer.page; package nautilus.game.arcade.gui.privateServer.page;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
import mineplex.core.game.GameCategory; import mineplex.core.game.GameCategory;
@ -15,6 +10,10 @@ import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType; import nautilus.game.arcade.GameType;
import nautilus.game.arcade.gui.privateServer.PrivateServerShop; import nautilus.game.arcade.gui.privateServer.PrivateServerShop;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
public class SetGamePage extends BasePage public class SetGamePage extends BasePage
{ {
public SetGamePage(ArcadeManager plugin, PrivateServerShop shop, Player player) public SetGamePage(ArcadeManager plugin, PrivateServerShop shop, Player player)
@ -113,6 +112,11 @@ public class SetGamePage extends BasePage
} }
else if (clickType == ClickType.RIGHT) else if (clickType == ClickType.RIGHT)
{ {
//UHC has auto generating maps.
if(type == GameType.UHC)
{
return;
}
getShop().openPageForPlayer(player, new ChooseMapPage(getPlugin(), getShop(), player, type)); getShop().openPageForPlayer(player, new ChooseMapPage(getPlugin(), getShop(), player, type));
return; return;
} }

View File

@ -14,9 +14,11 @@ import org.bukkit.entity.Player;
import org.bukkit.entity.Horse; import org.bukkit.entity.Horse;
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.PlayerCommandPreprocessEvent;
import org.bukkit.event.player.PlayerInteractEntityEvent; import org.bukkit.event.player.PlayerInteractEntityEvent;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import mineplex.core.common.Rank;
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;
@ -161,13 +163,37 @@ public class PerkHorsePet extends Perk
} }
} }
@EventHandler
public void modTeleport(PlayerCommandPreprocessEvent event)
{
if (!Manager.GetGame().IsLive())
return;
if (!event.getMessage().toLowerCase().startsWith("/tp") && !event.getMessage().toLowerCase().startsWith("/teleport"))
return;
if (!Manager.GetClients().hasRank(event.getPlayer(), Rank.MODERATOR)
|| Manager.GetClients().hasRank(event.getPlayer(), Rank.DEVELOPER))
return;
if (event.getMessage().split(" ").length < 2)
return;
despawnHorse(event.getPlayer());
}
@EventHandler @EventHandler
public void death(PlayerDeathEvent event) public void death(PlayerDeathEvent event)
{ {
if (!Manager.GetGame().IsLive()) if (!Manager.GetGame().IsLive())
return; return;
Horse horse = _horseMap.remove(event.getEntity()); despawnHorse(event.getEntity());
}
private void despawnHorse(Player player)
{
Horse horse = _horseMap.remove(player);
if (horse == null) if (horse == null)
return; return;

View File

@ -1,5 +1,6 @@
package nautilus.game.arcade.kit.perks; package nautilus.game.arcade.kit.perks;
import mineplex.core.common.Rank;
import mineplex.core.common.util.*; import mineplex.core.common.util.*;
import mineplex.core.updater.*; import mineplex.core.updater.*;
import mineplex.core.updater.event.*; import mineplex.core.updater.event.*;
@ -274,10 +275,34 @@ public class PerkSkeletons extends Perk
event.AddMod("Skeleton Minion", "Damage", damage, false); event.AddMod("Skeleton Minion", "Damage", damage, false);
} }
@EventHandler
public void modTeleport(PlayerCommandPreprocessEvent event)
{
if (!Manager.GetGame().IsLive())
return;
if (!event.getMessage().toLowerCase().startsWith("/tp") && !event.getMessage().toLowerCase().startsWith("/teleport"))
return;
if (!Manager.GetClients().hasRank(event.getPlayer(), Rank.MODERATOR)
|| Manager.GetClients().hasRank(event.getPlayer(), Rank.DEVELOPER))
return;
if (event.getMessage().split(" ").length < 2)
return;
despawnSkels(event.getPlayer());
}
@EventHandler @EventHandler
public void PlayerDeath(PlayerDeathEvent event) public void PlayerDeath(PlayerDeathEvent event)
{ {
ArrayList<Skeleton> skels = _minions.remove(event.getEntity()); despawnSkels(event.getEntity());
}
private void despawnSkels(Player player)
{
ArrayList<Skeleton> skels = _minions.remove(player);
if (skels == null) if (skels == null)
return; return;

View File

@ -54,7 +54,7 @@ public class PerkSpiderLeap extends Perk
{ {
if (UtilEnt.isGrounded(player) || UtilBlock.solid(player.getLocation().getBlock().getRelative(BlockFace.DOWN))) if (UtilEnt.isGrounded(player) || UtilBlock.solid(player.getLocation().getBlock().getRelative(BlockFace.DOWN)))
{ {
player.setExp(0.999f); player.setExp((float) Math.min(0.999, player.getExp()+(1f/80f)));
_secondJump.remove(player); _secondJump.remove(player);
} }
@ -107,9 +107,15 @@ public class PerkSpiderLeap extends Perk
//Disable Flight //Disable Flight
player.setAllowFlight(false); player.setAllowFlight(false);
if (player.getExp() < (1f/6f))
return;
//Velocity //Velocity
UtilAction.velocity(player, 1.0, 0.2, 1.0, true); UtilAction.velocity(player, 1.0, 0.2, 1.0, true);
//Energy
player.setExp((float) Math.max(0, player.getExp()-(1f/6f)));
//Sound //Sound
player.getWorld().playSound(player.getLocation(), Sound.SPIDER_IDLE, 1f, 1.5f); player.getWorld().playSound(player.getLocation(), Sound.SPIDER_IDLE, 1f, 1.5f);

View File

@ -0,0 +1,147 @@
package nautilus.game.arcade.kit.perks;
import java.util.HashSet;
import org.bukkit.Effect;
import org.bukkit.GameMode;
import org.bukkit.block.BlockFace;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerToggleFlightEvent;
import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilServer;
import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import nautilus.game.arcade.kit.Perk;
public class PerkTripleJump extends Perk
{
private double _power;
private double _heightMax;
private boolean _control;
private long _recharge;
private boolean _displayForce;
private HashSet<Player> _disabled = new HashSet<Player>();
public PerkTripleJump(String name, double power, double heightLimit, boolean control)
{
super(name, new String[]
{
C.cYellow + "Tap Jump Twice" + C.cGray + " to " + C.cGreen + name
});
_power = power;
_heightMax = heightLimit;
_control = control;
_recharge = 0;
_displayForce = false;
}
public PerkTripleJump(String name, double power, double heightLimit, boolean control, long recharge, boolean displayForce)
{
super(name, new String[]
{
C.cYellow + "Tap Jump Twice" + C.cGray + " to " + C.cGreen + name
});
_power = power;
_heightMax = heightLimit;
_control = control;
_recharge = recharge;
_displayForce = displayForce;
}
@EventHandler
public void FlightHop(PlayerToggleFlightEvent event)
{
Player player = event.getPlayer();
if (!Kit.HasKit(player))
return;
if (Manager.isSpectator(player))
return;
if (player.getGameMode() == GameMode.CREATIVE)
return;
event.setCancelled(true);
player.setFlying(false);
//Disable Flight
if(!Recharge.Instance.usable(player, GetName()))
{
player.setAllowFlight(false);
}
//Velocity
if (_control)
{
UtilAction.velocity(player, _power, 0.2, _heightMax, true);
}
else
{
UtilAction.velocity(player, player.getLocation().getDirection(), _power, true, _power, 0, _heightMax, true);
}
//Sound
player.getWorld().playEffect(player.getLocation(), Effect.BLAZE_SHOOT, 0);
//Recharge
if (_recharge > 0)
{
if(Recharge.Instance.usable(player, GetName()))
{
Recharge.Instance.useForce(player, GetName(), _recharge);
}
else
{
Recharge.Instance.useForce(player, GetName() + " 2", 500);
}
if (_displayForce)
{
Recharge.Instance.setDisplayForce(player, GetName(), true);
}
}
Recharge.Instance.useForce(player, GetName(), 500);
}
@EventHandler
public void FlightUpdate(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
return;
for (Player player : UtilServer.getPlayers())
{
if (Manager.isSpectator(player))
continue;
if (!Kit.HasKit(player))
continue;
if (_recharge > 0 && !Recharge.Instance.usable(player, GetName()))
continue;
if (player.isOnGround() || (UtilBlock.solid(player.getLocation().getBlock().getRelative(BlockFace.DOWN)) && UtilBlock.solid(player.getLocation().getBlock())))
player.setAllowFlight(true);
}
}
public void disableForPlayer(Player player)
{
_disabled.add(player);
}
public void enableForPlayer(Player player)
{
_disabled.remove(player);
}
}

View File

@ -9,10 +9,8 @@ import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.PotionMeta; import org.bukkit.inventory.meta.PotionMeta;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilInv; import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilServer;
import mineplex.core.itemstack.ItemStackFactory;
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;
@ -27,7 +25,7 @@ public class PerkWitherMedicRefill extends Perk
{ {
super("Healing Hands", new String[] super("Healing Hands", new String[]
{ {
C.cGray + "Receive 1 healing bottle every " + timeInSeconds + " seconds if you're inventory is clearned from a bottle.", C.cGray + "Receive 1 healing bottle every " + timeInSeconds + " seconds. Maximum of 1.",
}); });
this._time = timeInSeconds; this._time = timeInSeconds;

View File

@ -20,9 +20,11 @@ import org.bukkit.event.EventHandler;
import org.bukkit.event.block.Action; import org.bukkit.event.block.Action;
import org.bukkit.event.entity.EntityTargetEvent; import org.bukkit.event.entity.EntityTargetEvent;
import org.bukkit.event.entity.PlayerDeathEvent; import org.bukkit.event.entity.PlayerDeathEvent;
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.event.player.PlayerQuitEvent;
import mineplex.core.common.Rank;
import mineplex.core.common.util.*; import mineplex.core.common.util.*;
import mineplex.core.recharge.Recharge; import mineplex.core.recharge.Recharge;
import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.event.UpdateEvent;
@ -49,7 +51,7 @@ public class PerkWolfPet extends Perk
super("Wolf Master", new String[] super("Wolf Master", new String[]
{ {
C.cGray + "Spawn 1 Wolf every " + spawnRate + " seconds. Maximum of " + max + ".", C.cGray + "Spawn 1 Wolf every " + spawnRate + " seconds. Maximum of " + max + ".",
C.cYellow + "Right-Click" + C.cGray + " with Sword/Axe to use " + C.cGreen + "Wolf Tackle", C.cYellow + "Right-Click" + C.cGray + " with Sword/Axe to use " + C.cGreen + "Cub Strike",
}); });
_spawnRate = spawnRate; _spawnRate = spawnRate;
@ -292,23 +294,39 @@ public class PerkWolfPet extends Perk
} }
@EventHandler @EventHandler
public void PlayerDeath(PlayerDeathEvent event) public void modTeleport(PlayerCommandPreprocessEvent event)
{ {
ArrayList<Wolf> wolves = _wolfMap.remove(event.getEntity()); if (!Manager.GetGame().IsLive())
if (wolves == null)
return; return;
for (Wolf wolf : wolves) if (!event.getMessage().toLowerCase().startsWith("/tp") && !event.getMessage().toLowerCase().startsWith("/teleport"))
wolf.remove(); return;
wolves.clear(); if (!Manager.GetClients().hasRank(event.getPlayer(), Rank.MODERATOR)
|| Manager.GetClients().hasRank(event.getPlayer(), Rank.DEVELOPER))
return;
if (event.getMessage().split(" ").length < 2)
return;
despawnWolf(event.getPlayer());
}
@EventHandler
public void PlayerDeath(PlayerDeathEvent event)
{
despawnWolf(event.getEntity());
} }
@EventHandler @EventHandler
public void PlayerQuit(PlayerQuitEvent event) public void PlayerQuit(PlayerQuitEvent event)
{ {
ArrayList<Wolf> wolves = _wolfMap.remove(event.getPlayer()); despawnWolf(event.getPlayer());
}
private void despawnWolf(Player player)
{
ArrayList<Wolf> wolves = _wolfMap.remove(player);
if (wolves == null) if (wolves == null)
return; return;

View File

@ -1,9 +1,20 @@
package nautilus.game.arcade.managers; package nautilus.game.arcade.managers;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException; import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import java.util.Map;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.HandlerList;
import org.bukkit.event.Listener;
import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilServer;
@ -14,17 +25,12 @@ import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.core.combat.CombatManager.AttackReason; import mineplex.minecraft.game.core.combat.CombatManager.AttackReason;
import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameMode;
import nautilus.game.arcade.GameType; import nautilus.game.arcade.GameType;
import nautilus.game.arcade.game.Game; import nautilus.game.arcade.game.Game;
import nautilus.game.arcade.game.Game.GameState; import nautilus.game.arcade.game.Game.GameState;
import nautilus.game.arcade.stats.StatTracker; import nautilus.game.arcade.stats.StatTracker;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.HandlerList;
import org.bukkit.event.Listener;
public class GameCreationManager implements Listener public class GameCreationManager implements Listener
{ {
ArcadeManager Manager; ArcadeManager Manager;
@ -34,10 +40,12 @@ public class GameCreationManager implements Listener
private GameType _nextGame = null; private GameType _nextGame = null;
private String _lastMap = ""; private String _lastMap = "";
private String _lastMode = "";
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 String MapSource = null;
public String ModePref = null;
public GameCreationManager(ArcadeManager manager) public GameCreationManager(ArcadeManager manager)
{ {
@ -171,6 +179,8 @@ public class GameCreationManager implements Listener
System.out.println(_nextGame == null ? "Next Game = null" : "Next Game = " + _nextGame.GetName()); System.out.println(_nextGame == null ? "Next Game = null" : "Next Game = " + _nextGame.GetName());
System.out.println(MapPref == null ? "Map Pref = null" : "Map Pref = " + MapPref); System.out.println(MapPref == null ? "Map Pref = null" : "Map Pref = " + MapPref);
System.out.println(ModePref == null ? "Gamemode Pref = null" : "Gamemode Pref = " + ModePref);
//Chosen Game //Chosen Game
if (_nextGame != null) if (_nextGame != null)
{ {
@ -186,6 +196,7 @@ public class GameCreationManager implements Listener
for (int i=0 ; i<50 ; i++) for (int i=0 ; i<50 ; i++)
{ {
gameType = Manager.GetGameList().get(UtilMath.r(Manager.GetGameList().size())); gameType = Manager.GetGameList().get(UtilMath.r(Manager.GetGameList().size()));
ModePref = randomGameMode(gameType);
if (!_lastGames.contains(gameType)) if (!_lastGames.contains(gameType))
break; break;
@ -197,9 +208,41 @@ public class GameCreationManager implements Listener
_lastGames.add(0, gameType); _lastGames.add(0, gameType);
boolean setVars = false;
try try
{ {
Game game = gameType.getGameClass().getConstructor(ArcadeManager.class).newInstance(Manager); GameMode mode = null;
Class<? extends Game> gameClass = gameType.getGameClass();
if (ModePref != null)
{
for (GameMode modes : gameType.getGameModes())
{
if (modes.getName().replaceAll(" ", "").toUpperCase().startsWith(ModePref.toUpperCase()))
{
_lastMode = ModePref;
mode = modes;
gameClass = modes.getGameClass();
setVars = true;
break;
}
}
}
if (gameClass == null)
{
gameClass = gameType.getGameModes()[UtilMath.r(gameType.getGameModes().length)].getGameClass();
}
ModePref = null;
Game game = gameClass.getConstructor(ArcadeManager.class).newInstance(Manager);
if (setVars && mode != null)
{
modifyGameConfiguration(gameClass, mode, game);
}
Manager.SetGame(game); Manager.SetGame(game);
} }
@ -234,8 +277,276 @@ public class GameCreationManager implements Listener
TimingManager.stop("registerEvents"); TimingManager.stop("registerEvents");
} }
private String randomGameMode(GameType type)
{
ArrayList<String> modes = Manager.GetServerConfig().GameModeList;
if (modes.size() == 0)
return null;
GameMode[] gameModes = type.getGameModes();
String mode = modes.get(UtilMath.r(modes.size()));
int i = 0;
while (mode.equalsIgnoreCase(_lastMode) && !containsMode(gameModes, mode) && i != 25)
{
mode = modes.get(UtilMath.r(modes.size()));
i++;
}
return mode.replace(" ", "");
}
private boolean containsMode(GameMode[] modes, String mode)
{
for (GameMode otherMode : modes)
{
if (otherMode.getName().equalsIgnoreCase(mode))
{
return true;
}
}
return false;
}
public void SetNextGameType(GameType type) public void SetNextGameType(GameType type)
{ {
_nextGame = type; _nextGame = type;
} }
@SuppressWarnings("unchecked")
private void modifyGameConfiguration(Class<? extends Game> gameClass, GameMode mode, Game game)
{
ArrayList<Class<? extends Game>> classes = new ArrayList<>();
Class<? extends Game> superClass = gameClass;
while(superClass != Game.class)
{
classes.add(superClass);
superClass = (Class<? extends Game>) superClass.getSuperclass();
}
classes.add(Game.class);
HashMap<String, String> varSet = Manager.GetServerConfig().GameModeMods.get(mode.getName());
if (varSet == null)
return;
for (Class<? extends Game> clazz : classes)
{
for (String var : varSet.keySet())
{
String value = varSet.get(var);
if (value.contains("("))
{
boolean add = value.contains("+");
boolean remove = value.contains("-");
value = value.split("\\(")[1];
value = value.replace(")", "");
processList(clazz, game, var,
value.contains(":") ? value.split("\\:") : new String[]
{ value }, add, remove);
}
else if (value.contains("["))
{
value = value.split("\\[")[1];
value = value.replace("]", "");
Map<String, String> varMap = new HashMap<>();
String[] values = value.contains(":") ? value.split(":") : new String[]
{ value };
for (String keyValueSet : values)
{
String key = keyValueSet.split("\\$")[0];
String val = keyValueSet.split("\\$")[1];
varMap.put(key, val);
}
processMap(clazz, game, var, varMap);
}
else
{
processVariable(clazz, game, var, value);
}
}
}
}
@SuppressWarnings("unchecked")
private void processMap(Class<? extends Game> clazz, Game game, String var,
Map<String, String> map)
{
Field f = getField(clazz, var);
if (f == null)
return;
try
{
f.setAccessible(true);
ParameterizedType type = (ParameterizedType) f.getGenericType();
Type keyGeneric = type.getActualTypeArguments()[0];
Class<?> keyGenericClazz = Class.forName(keyGeneric.getTypeName());
Type valueGeneric = type.getActualTypeArguments()[1];
Class<?> valueGenericClazz = Class.forName(valueGeneric.getTypeName());
Map<Object, Object> currentMap = (Map<Object, Object>) f.get(game);
for (String key : map.keySet())
{
currentMap.put(parseValue(keyGenericClazz, key, game),
parseValue(valueGenericClazz, map.get(key), game));
}
f.setAccessible(false);
}
catch (Exception ex)
{
System.out.println("Error while editing map");
}
}
@SuppressWarnings("unchecked")
private void processList(Class<? extends Game> clazz, Game game, String var, String[] value,
boolean add, boolean remove)
{
Field f = getField(clazz, var);
if (f == null)
return;
try
{
f.setAccessible(true);
ParameterizedType type = (ParameterizedType) f.getGenericType();
Type generic = type.getActualTypeArguments()[0];
Class<?> genericClazz = Class.forName(generic.getTypeName());
ArrayList<Object> currentList = (ArrayList<Object>) f.get(game);
if (!add && !remove)
{
add = true;
currentList.clear();
}
for (String finalValue : value)
{
if (add)
{
currentList.add(parseValue(genericClazz, finalValue, game));
}
else if (remove)
{
currentList.remove(parseValue(genericClazz, finalValue, game));
}
}
f.setAccessible(false);
}
catch (Exception ex)
{
System.out.println("Error while editing list");
}
}
private void processVariable(Class<? extends Game> clazz, Game game, String var, String value)
{
Field f = getField(clazz, var);
if (f == null)
return;
try
{
f.setAccessible(true);
Object finalValue = parseValue(f.getType(), value, game);
if (value != null)
{
f.set(game, finalValue);
}
f.setAccessible(false);
}
catch (Exception ex)
{
ex.printStackTrace();
System.out.println("Error while setting variable");
}
}
private Object parseValue(Class<?> clazz, String value, Game game)
{
try
{
if (clazz == boolean.class)
{
return Boolean.parseBoolean(value);
}
else if (clazz == String.class)
{
return value;
}
else if (clazz == int.class)
{
return Integer.parseInt(value);
}
else if (clazz == float.class)
{
return Float.parseFloat(value);
}
else if (clazz == double.class)
{
return Double.parseDouble(value);
}
else if (clazz == long.class)
{
return Long.parseLong(value);
}
else if (clazz == byte.class)
{
return Byte.parseByte(value);
}
else if (clazz == short.class)
{
return Short.parseShort(value);
}
else if (clazz == Material.class)
{
return Material.getMaterial(value);
}
else if (clazz == ChatColor.class)
{
return ChatColor.getByChar(value);
}
return null;
}
catch (Exception ex)
{
System.out.println("Error while parsing value");
return null;
}
}
private Field getField(Class<? extends Game> clazz, String var)
{
Field f = null;
try
{
f = clazz.getDeclaredField(var);
}
catch (Exception e)
{
try
{
f = clazz.getDeclaredField("_" + var);
}
catch (Exception ex)
{
}
}
return f;
}
} }

View File

@ -3,8 +3,20 @@ package nautilus.game.arcade.managers;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.util.HashMap; import java.util.HashMap;
import org.bukkit.Sound;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftHumanEntity;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerQuitEvent;
import com.mojang.authlib.GameProfile;
import mineplex.core.achievement.Achievement; import mineplex.core.achievement.Achievement;
import mineplex.core.boosters.Booster; import mineplex.core.boosters.Booster;
import mineplex.core.common.Rank;
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.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
@ -20,22 +32,11 @@ import nautilus.game.arcade.events.FirstBloodEvent;
import nautilus.game.arcade.events.GameStateChangeEvent; import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.events.PlayerStateChangeEvent; import nautilus.game.arcade.events.PlayerStateChangeEvent;
import nautilus.game.arcade.game.Game; import nautilus.game.arcade.game.Game;
import nautilus.game.arcade.game.GemData;
import nautilus.game.arcade.game.Game.GameState; import nautilus.game.arcade.game.Game.GameState;
import nautilus.game.arcade.game.GameTeam.PlayerState; import nautilus.game.arcade.game.GameTeam.PlayerState;
import nautilus.game.arcade.game.GemData;
import net.minecraft.server.v1_8_R3.EntityHuman; import net.minecraft.server.v1_8_R3.EntityHuman;
import org.bukkit.Sound;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftHumanEntity;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerQuitEvent;
import com.mojang.authlib.GameProfile;
public class GameGemManager implements Listener public class GameGemManager implements Listener
{ {
ArcadeManager Manager; ArcadeManager Manager;
@ -184,6 +185,8 @@ public class GameGemManager implements Listener
total += (int)(earned * game.getGemBooster().getMultiplier()); total += (int)(earned * game.getGemBooster().getMultiplier());
*/ */
int shards = total;
//Gem Finder //Gem Finder
if (game.GemHunterEnabled) if (game.GemHunterEnabled)
{ {
@ -213,7 +216,19 @@ public class GameGemManager implements Listener
if (DoubleGem && game.GemDoubleEnabled) if (DoubleGem && game.GemDoubleEnabled)
total += earned; total += earned;
Rank rank = Manager.GetClients().Get(player).GetRank();
if (rank == rank.ULTRA)
shards *= 1.5;
else if (rank == rank.HERO)
shards *= 2;
else if (rank == rank.LEGEND)
shards *= 2.5;
else if (rank.has(Rank.TITAN))
shards *= 3;
Manager.GetDonation().RewardGems(null, "Earned " + game.GetName(), player.getName(), player.getUniqueId(), total); Manager.GetDonation().RewardGems(null, "Earned " + game.GetName(), player.getName(), player.getUniqueId(), total);
Manager.GetDonation().RewardCoins(null, "Earned", player.getName(), Manager.GetClients().getAccountId(player), shards);
//Stats //Stats
Manager.GetStatsManager().incrementStat(player, "Global.GemsEarned", total); Manager.GetStatsManager().incrementStat(player, "Global.GemsEarned", total);
@ -305,6 +320,8 @@ public class GameGemManager implements Listener
} }
*/ */
int shards = totalGems;
//Gem Finder //Gem Finder
if (game.GemHunterEnabled) if (game.GemHunterEnabled)
{ {
@ -350,12 +367,37 @@ public class GameGemManager implements Listener
totalGems += earnedGems; totalGems += earnedGems;
} }
int earnedShards = shards;
double mult = 1;
Rank rank = Manager.GetClients().Get(player).GetRank();
if (rank == rank.ULTRA)
mult = 1.5;
else if (rank == rank.HERO)
mult = 2;
else if (rank == rank.LEGEND)
mult = 2.5;
else if (rank.has(Rank.TITAN))
mult = 3;
shards *= mult;
mult--;
UtilPlayer.message(player, F.elem(C.cAqua + "+" + earnedShards + " Treasure Shards") + " for " + F.elem("Earning " + earnedShards + " Gems"));
if (rank.has(Rank.ULTRA))
{
UtilPlayer.message(player, F.elem(C.cAqua + "+" + (shards - earnedShards) + " Treasure Shards") + " for " +
F.elem(rank.getTag(true, true)) + F.elem(" Rank" + C.cAqua + " +" + Math.round((mult*100)) + "%"));
}
//Inform //Inform
UtilPlayer.message(player, ""); UtilPlayer.message(player, "");
if (give) if (give)
{ {
UtilPlayer.message(player, F.elem(C.cWhite + "§lYou now have " + UtilPlayer.message(player, F.elem(C.cWhite + "§lYou now have " +
C.cGreen + C.Bold + (Manager.GetDonation().Get(player.getName()).GetGems() + totalGems) + " Gems")); C.cGreen + C.Bold + (Manager.GetDonation().Get(player.getName()).GetGems() + totalGems) + " Gems") + C.cWhite + C.Bold + " and " +
F.elem(C.cAqua + C.Bold + (Manager.GetDonation().Get(player.getName()).getCoins() + shards) + " Treasure Shards"));
} }
else else
{ {

View File

@ -7,6 +7,36 @@ import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map.Entry; import java.util.Map.Entry;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Color;
import org.bukkit.DyeColor;
import org.bukkit.FireworkEffect.Type;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.entity.Creature;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.entity.Sheep;
import org.bukkit.entity.Slime;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityCombustEvent;
import org.bukkit.event.entity.EntityExplodeEvent;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.event.inventory.InventoryType;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.event.player.PlayerVelocityEvent;
import org.bukkit.event.weather.WeatherChangeEvent;
import org.bukkit.scoreboard.DisplaySlot;
import org.bukkit.scoreboard.Objective;
import org.bukkit.scoreboard.Scoreboard;
import mineplex.core.account.CoreClient; import mineplex.core.account.CoreClient;
import mineplex.core.common.Rank; import mineplex.core.common.Rank;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
@ -42,36 +72,6 @@ import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.KitSorter; import nautilus.game.arcade.kit.KitSorter;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Color;
import org.bukkit.DyeColor;
import org.bukkit.FireworkEffect.Type;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.entity.Creature;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.entity.Sheep;
import org.bukkit.entity.Slime;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityCombustEvent;
import org.bukkit.event.entity.EntityExplodeEvent;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.event.inventory.InventoryType;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.event.player.PlayerVelocityEvent;
import org.bukkit.event.weather.WeatherChangeEvent;
import org.bukkit.scoreboard.DisplaySlot;
import org.bukkit.scoreboard.Objective;
import org.bukkit.scoreboard.Scoreboard;
public class GameLobbyManager implements Listener public class GameLobbyManager implements Listener
{ {
public ArcadeManager Manager; public ArcadeManager Manager;
@ -358,7 +358,7 @@ public class GameLobbyManager implements Listener
} }
//UHC //UHC
if (game.GetType() == GameType.UHC) if (game.GetType() == GameType.UHC || game.getClass().getSuperclass().equals(UHC.class))
{ {
if (game.GetTeamList().size() > 1) if (game.GetTeamList().size() > 1)
{ {
@ -551,7 +551,7 @@ public class GameLobbyManager implements Listener
block.setType(_kitBlocks.get(block)); block.setType(_kitBlocks.get(block));
_kitBlocks.clear(); _kitBlocks.clear();
if (game.GetKits().length <= 1 && game.GetType() == GameType.UHC) if (game.GetKits().length <= 1 && (game.GetType() == GameType.UHC || game.getClass().getSuperclass().equals(UHC.class)))
{ {
WriteKitLine(" ", 0, 159, (byte)15); WriteKitLine(" ", 0, 159, (byte)15);
WriteKitLine(" ", 1, 159, (byte)4); WriteKitLine(" ", 1, 159, (byte)4);
@ -992,10 +992,10 @@ public class GameLobbyManager implements Listener
{ {
WriteGameLine(game.GetType().GetLobbyName(), 0, 159, (byte)14); WriteGameLine(game.GetType().GetLobbyName(), 0, 159, (byte)14);
if (game.GetMode() == null) if (Manager.GetGame().GetMode() == null)
WriteGameLine(" ", 1, 159, (byte)1); WriteGameLine(" ", 1, 159, (byte)1);
else else
WriteGameLine(game.GetMode(), 1, 159, (byte)1); WriteGameLine(Manager.GetGame().GetMode(), 1, 159, (byte)1);
DisplayWaiting(); DisplayWaiting();
CreateKits(game); CreateKits(game);
@ -1050,6 +1050,16 @@ public class GameLobbyManager implements Listener
_colorTick = !_colorTick; _colorTick = !_colorTick;
int spectatorCount = 0;
for(Player players : UtilServer.GetPlayers())
{
if (Manager.isVanished(players))
{
spectatorCount++;
}
}
for (Entry<Player, Scoreboard> entry : _scoreboardMap.entrySet()) for (Entry<Player, Scoreboard> entry : _scoreboardMap.entrySet())
{ {
Objective objective = entry.getValue().getObjective("§l" + "Lobby"); Objective objective = entry.getValue().getObjective("§l" + "Lobby");
@ -1082,7 +1092,8 @@ public class GameLobbyManager implements Listener
// Remove Old // Remove Old
entry.getValue().resetScores(_oldPlayerCount + "/" + _oldMaxPlayerCount); entry.getValue().resetScores(_oldPlayerCount + "/" + _oldMaxPlayerCount);
// Set new // Set new
objective.getScore(UtilServer.getPlayers().length + "/" + Manager.GetPlayerFull()).setScore(line--);
objective.getScore(UtilServer.getPlayers().length - spectatorCount + "/" + Manager.GetPlayerFull()).setScore(line--);
if (Manager.GetGame() != null) if (Manager.GetGame() != null)
{ {
@ -1153,7 +1164,7 @@ public class GameLobbyManager implements Listener
} }
} }
_oldPlayerCount = UtilServer.getPlayers().length; _oldPlayerCount = UtilServer.getPlayers().length - spectatorCount;
_oldMaxPlayerCount = Manager.GetPlayerFull(); _oldMaxPlayerCount = Manager.GetPlayerFull();
} }
@ -1352,5 +1363,4 @@ public class GameLobbyManager implements Listener
event.setCancelled(true); event.setCancelled(true);
} }
} }

View File

@ -90,7 +90,7 @@ public class ExperienceStatTracker extends StatTracker<Game>
mult = 1.5; mult = 1.5;
//Exp //Exp
int expGained = (int)((timeExp + gemExp)*mult); int expGained = (int)(((timeExp + gemExp)*mult)*getGame().XpMult);
//Record Global and per Game //Record Global and per Game
addStat(player, "ExpEarned", expGained, false, true); addStat(player, "ExpEarned", expGained, false, true);