Merge branch 'feature/game-variants' into develop
This commit is contained in:
commit
cf6e3cf05d
@ -81,7 +81,9 @@ public enum GameDisplay
|
||||
|
||||
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 _lobbyName;
|
||||
|
@ -5,6 +5,7 @@ import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
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)
|
||||
{
|
||||
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)
|
||||
@ -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)
|
||||
{
|
||||
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,14 +802,20 @@ public class ItemStackFactory extends MiniPlugin
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
//XXX Owner Variant End
|
||||
|
||||
@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
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
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;
|
||||
if (data == 0)
|
||||
stack = new ItemStack(id, amount, damage);
|
||||
@ -874,7 +881,15 @@ public class ItemStackFactory extends MiniPlugin
|
||||
|
||||
if (setMeta)
|
||||
stack.setItemMeta(itemMeta);
|
||||
|
||||
|
||||
if(enchantments != null)
|
||||
{
|
||||
for(Enchantment enchantment : enchantments)
|
||||
{
|
||||
stack.addEnchantment(enchantment, enchLevel);
|
||||
}
|
||||
}
|
||||
|
||||
//Unbreakable
|
||||
if (unbreakable)
|
||||
{
|
||||
|
@ -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,
|
||||
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()
|
||||
{
|
||||
|
@ -50,6 +50,7 @@ public class ServerGroup
|
||||
private boolean _generateFreeVersions;
|
||||
|
||||
private String _games;
|
||||
private String _modes;
|
||||
private String _serverType;
|
||||
private boolean _addNoCheat;
|
||||
private boolean _addWorldEdit;
|
||||
@ -87,6 +88,7 @@ public class ServerGroup
|
||||
_tournamentPoints = Boolean.valueOf(data.get("tournamentPoints"));
|
||||
_generateFreeVersions = Boolean.valueOf(data.get("generateFreeVersions"));
|
||||
_games = data.get("games");
|
||||
_modes = data.get("modes");
|
||||
_serverType = data.get("serverType");
|
||||
_addNoCheat = Boolean.valueOf(data.get("addNoCheat"));
|
||||
_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
|
||||
, 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 rewardAchievements, boolean hotbarInventory, boolean hotbarHubClock, boolean playerKickIdle, boolean staffOnly, boolean whitelist, String resourcePack, Region region
|
||||
, String teamServerKey, String portalBottomCornerLocation, String portalTopCornerLocation, String npcName)
|
||||
@ -140,6 +142,7 @@ public class ServerGroup
|
||||
_tournament = tournament;
|
||||
_tournamentPoints = tournamentPoints;
|
||||
_games = games;
|
||||
_modes = modes;
|
||||
_serverType = serverType;
|
||||
_addNoCheat = noCheat;
|
||||
_addWorldEdit = worldEdit;
|
||||
@ -210,6 +213,7 @@ public class ServerGroup
|
||||
public boolean getGenerateFreeVersions() { return _generateFreeVersions; }
|
||||
|
||||
public String getGames() { return _games; }
|
||||
public String getModes() { return _modes; }
|
||||
public String getServerType() { return _serverType; }
|
||||
public boolean getAddNoCheat() { return _addNoCheat; }
|
||||
public boolean getAddWorldEdit() { return _addWorldEdit; }
|
||||
|
@ -1,6 +1,7 @@
|
||||
package nautilus.game.arcade;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.HashMap;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -237,7 +238,8 @@ public class Arcade extends JavaPlugin
|
||||
for (String gameName : _serverConfiguration.getServerGroup().getGames().split(","))
|
||||
{
|
||||
try
|
||||
{System.out.println(gameName);
|
||||
{
|
||||
System.out.println(gameName);
|
||||
GameType type = GameType.valueOf(gameName);
|
||||
config.GameList.add(type);
|
||||
}
|
||||
@ -246,6 +248,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)
|
||||
{
|
||||
@ -296,4 +322,32 @@ public class Arcade extends JavaPlugin
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -714,7 +714,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation
|
||||
// event.setMotd(ChatColor.GREEN + "Recruiting" + extrainformation);
|
||||
// }
|
||||
//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);
|
||||
}
|
||||
@ -1485,7 +1485,33 @@ public class ArcadeManager extends MiniPlugin implements IRelation
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
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)
|
||||
{
|
||||
boolean isChamps = gameType == GameType.ChampionsDominate || gameType == GameType.ChampionsTDM || gameType == GameType.ChampionsCTF || gameType == GameType.BossBattles;
|
||||
@ -1501,27 +1527,11 @@ public class ArcadeManager extends MiniPlugin implements IRelation
|
||||
|
||||
if (_enabled)
|
||||
{
|
||||
_classManager.setEnabled(true);
|
||||
_classShopManager.registerSelf();
|
||||
_skillFactory.registerSelf();
|
||||
_itemFactory.registerSelf();
|
||||
_energy.registerSelf();
|
||||
_eloManager.registerSelf();
|
||||
|
||||
//Class Shop
|
||||
_plugin.getServer().getPluginManager().registerEvents(_classShop, _plugin);
|
||||
enableChampionsModules();
|
||||
}
|
||||
else
|
||||
{
|
||||
_classManager.setEnabled(false);
|
||||
_classShopManager.deregisterSelf();
|
||||
_skillFactory.deregisterSelf();
|
||||
_itemFactory.deregisterSelf();
|
||||
_energy.deregisterSelf();
|
||||
_eloManager.deregisterSelf();
|
||||
|
||||
//Class Shop
|
||||
HandlerList.unregisterAll(_classShop);
|
||||
disableChampionsModules();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
@ -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.bouncyballs.BouncyBalls;
|
||||
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.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.castlesiege.CastleSiege;
|
||||
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.evolution.Evolution;
|
||||
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.halloween.Halloween;
|
||||
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.horsecharge.Horse;
|
||||
import nautilus.game.arcade.game.games.lobbers.BombLobbers;
|
||||
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.minecraftleague.MinecraftLeague;
|
||||
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.quiver.Quiver;
|
||||
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.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.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.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.SuperSmashDominate;
|
||||
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.sneakyassassins.SneakyAssassins;
|
||||
import nautilus.game.arcade.game.games.snowfight.SnowFight;
|
||||
import nautilus.game.arcade.game.games.speedbuilders.SpeedBuilders;
|
||||
import nautilus.game.arcade.game.games.spleef.Spleef;
|
||||
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.stacker.Stacker;
|
||||
import nautilus.game.arcade.game.games.survivalgames.SoloSurvivalGames;
|
||||
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.turfforts.TurfForts;
|
||||
import nautilus.game.arcade.game.games.typewars.TypeWars;
|
||||
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.wither.WitherGame;
|
||||
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.Snake, GameType.SneakyAssassins, GameType.SnowFight, GameType.Spleef, GameType.SpleefTeams, GameType.SquidShooter,
|
||||
GameType.Stacker, GameType.SurvivalGames, GameType.SurvivalGamesTeams, GameType.Tug, GameType.TurfWars, GameType.UHC,
|
||||
GameType.WitherAssault, GameType.Wizards, GameType.ZombieSurvival}, true);
|
||||
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;
|
||||
boolean _enforceResourcePack;
|
||||
@ -180,39 +218,64 @@ public enum GameType
|
||||
Pair<MinecraftVersion, String>[] _resourcePacks;
|
||||
Class<? extends Game> _gameClass;
|
||||
|
||||
GameMode[] _gameModes;
|
||||
private boolean _gameMaps;
|
||||
|
||||
private int _gameId; // Unique identifying id for this gamemode (used for statistics)
|
||||
public int getGameId() { return _gameId; }
|
||||
|
||||
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)
|
||||
{
|
||||
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)
|
||||
{
|
||||
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;
|
||||
_gameId = display.getGameId();
|
||||
_gameClass = gameClass;
|
||||
_gameModes = gameModes;
|
||||
_resourcePacks = resourcePackUrls;
|
||||
_enforceResourcePack = enforceResourcePack;
|
||||
_mapSource = mapSource;
|
||||
_ownMaps = ownMaps;
|
||||
_gameMaps = gameMaps;
|
||||
}
|
||||
|
||||
public Class<? extends Game> getGameClass()
|
||||
{
|
||||
return _gameClass;
|
||||
}
|
||||
|
||||
public GameMode[] getGameModes()
|
||||
{
|
||||
return _gameModes;
|
||||
}
|
||||
|
||||
public boolean isEnforceResourcePack()
|
||||
{
|
||||
@ -263,4 +326,21 @@ public enum GameType
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
@ -39,25 +39,31 @@ public class SetCommand extends CommandBase<ArcadeManager>
|
||||
}
|
||||
|
||||
String game = args[0].toLowerCase();
|
||||
|
||||
|
||||
if (args.length >= 2)
|
||||
{
|
||||
String map = "";
|
||||
String source = "";
|
||||
if(args.length == 3)
|
||||
String source = game;
|
||||
Plugin.GetGameCreationManager().MapSource = game;
|
||||
|
||||
for(String token : args)
|
||||
{
|
||||
Plugin.GetGameCreationManager().MapSource = args[1];
|
||||
Plugin.GetGameCreationManager().MapPref = args[2];
|
||||
source = args[1];
|
||||
map = args[2];
|
||||
}
|
||||
else
|
||||
{
|
||||
Plugin.GetGameCreationManager().MapSource = args[0];
|
||||
Plugin.GetGameCreationManager().MapPref = args[1];
|
||||
source = args[0];
|
||||
map = args[1];
|
||||
if(token.startsWith("@s"))
|
||||
{
|
||||
Plugin.GetGameCreationManager().MapSource = token.substring(1);
|
||||
source = token.substring(2);
|
||||
}
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -36,6 +36,7 @@ import org.bukkit.event.entity.ItemSpawnEvent;
|
||||
import org.bukkit.event.hanging.HangingBreakEvent;
|
||||
import org.bukkit.event.hanging.HangingPlaceEvent;
|
||||
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEntityEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.event.world.WorldLoadEvent;
|
||||
import org.bukkit.scoreboard.NameTagVisibility;
|
||||
@ -60,6 +61,7 @@ import mineplex.core.elo.EloTeam;
|
||||
import mineplex.core.itemstack.ItemBuilder;
|
||||
import mineplex.core.packethandler.IPacketHandler;
|
||||
import mineplex.core.packethandler.PacketInfo;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.minecraft.game.classcombat.event.ClassCombatCreatureAllowSpawnEvent;
|
||||
@ -276,6 +278,8 @@ public abstract class Game implements Listener
|
||||
|
||||
public long PrepareTime = 9000;
|
||||
public boolean PlaySoundGameStart = true;
|
||||
|
||||
public double XpMult = 1;
|
||||
|
||||
// Chat Stats
|
||||
public final ChatStatData Kills = new ChatStatData("Kills", "Kills", true);
|
||||
@ -335,6 +339,16 @@ public abstract class Game implements Listener
|
||||
public boolean FixSpawnFacing = 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 int _deadBodyCount;
|
||||
@ -344,6 +358,7 @@ public abstract class Game implements Listener
|
||||
public ArrayList<String> GemBoosters = new ArrayList<String>();
|
||||
private final Set<StatTracker<? extends Game>> _statTrackers = new HashSet<>();
|
||||
|
||||
private NautHashMap<Player, Player> _teamReqs = new NautHashMap<Player, Player>();
|
||||
public WinEffectManager WinEffectManager = new WinEffectManager();
|
||||
|
||||
public Game(ArcadeManager manager, GameType gameType, Kit[] kits, String[] gameDesc)
|
||||
@ -453,6 +468,7 @@ public abstract class Game implements Listener
|
||||
{
|
||||
GetType()
|
||||
};
|
||||
|
||||
if (GetType().getMapSource() != null)
|
||||
{
|
||||
if (GetType().ownMaps())
|
||||
@ -471,6 +487,16 @@ public abstract class Game implements Listener
|
||||
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;
|
||||
}
|
||||
|
||||
@ -1061,6 +1087,10 @@ public abstract class Game implements Listener
|
||||
|
||||
public boolean CanJoinTeam(GameTeam team)
|
||||
{
|
||||
if(TeamMode)
|
||||
{
|
||||
return team.GetSize() < PlayersPerTeam;
|
||||
}
|
||||
return Manager.IsTeamBalance() ? team.GetSize() < Math.max(1, UtilServer.getPlayers().length / GetTeamList().size())
|
||||
: true;
|
||||
}
|
||||
@ -1846,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()
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package nautilus.game.arcade.game;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap ;
|
||||
|
||||
import nautilus.game.arcade.GameType;
|
||||
|
||||
@ -10,6 +11,9 @@ public class GameServerConfig
|
||||
public int MinPlayers = -1;
|
||||
public int MaxPlayers = -1;
|
||||
public ArrayList<GameType> GameList = new ArrayList<GameType>();
|
||||
public ArrayList<String> GameModeList = new ArrayList<String>();
|
||||
|
||||
public HashMap<String, HashMap<String, String>> GameModeMods = new HashMap<>();
|
||||
|
||||
//Flags
|
||||
public String HostName = "";
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
@ -1,35 +1,31 @@
|
||||
package nautilus.game.arcade.game.games.bridge;
|
||||
|
||||
import mineplex.core.common.Rank;
|
||||
import mineplex.core.common.util.*;
|
||||
import mineplex.core.common.util.UtilEvent.ActionType;
|
||||
import mineplex.core.explosion.ExplosionEvent;
|
||||
import mineplex.core.itemstack.ItemStackFactory;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.minecraft.game.core.combat.event.CombatDeathEvent;
|
||||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.GameType;
|
||||
import nautilus.game.arcade.events.GameStateChangeEvent;
|
||||
import nautilus.game.arcade.events.PlayerDeathOutEvent;
|
||||
import nautilus.game.arcade.game.Game;
|
||||
import nautilus.game.arcade.game.GameTeam;
|
||||
import nautilus.game.arcade.game.TeamGame;
|
||||
import nautilus.game.arcade.game.games.bridge.kits.*;
|
||||
import nautilus.game.arcade.kit.Kit;
|
||||
import nautilus.game.arcade.ore.OreHider;
|
||||
import nautilus.game.arcade.ore.OreObsfucation;
|
||||
import nautilus.game.arcade.stats.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.*;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Effect;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.block.Chest;
|
||||
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.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.EventPriority;
|
||||
import org.bukkit.event.block.BlockBreakEvent;
|
||||
@ -54,7 +50,53 @@ import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.metadata.FixedMetadataValue;
|
||||
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
|
||||
{
|
||||
@ -113,9 +155,33 @@ public class Bridge extends TeamGame implements OreObsfucation
|
||||
private HashMap<GameTeam, Integer> _tournamentKills = new HashMap<GameTeam, Integer>();
|
||||
private long _tournamentKillMessageTimer = 0;
|
||||
|
||||
|
||||
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[]
|
||||
{
|
||||
@ -190,24 +256,6 @@ public class Bridge extends TeamGame implements OreObsfucation
|
||||
|
||||
|
||||
_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
|
||||
@ -301,7 +349,7 @@ public class Bridge extends TeamGame implements OreObsfucation
|
||||
if (!WorldData.GetCustomLocs("22").isEmpty()) ParseOre(WorldData.GetCustomLocs("22"));
|
||||
}
|
||||
|
||||
private void ParseChests()
|
||||
protected void ParseChests()
|
||||
{
|
||||
for (Location loc : WorldData.GetCustomLocs("54"))
|
||||
{
|
||||
@ -320,7 +368,7 @@ public class Bridge extends TeamGame implements OreObsfucation
|
||||
}
|
||||
}
|
||||
|
||||
private ItemStack GetChestItem()
|
||||
protected ItemStack GetChestItem()
|
||||
{
|
||||
if (_chestLoot.isEmpty())
|
||||
{
|
||||
@ -402,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 iron = (int) ((teamOre.size() / 24d) * _oreDensity);
|
||||
@ -556,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;
|
||||
|
||||
@ -622,7 +670,7 @@ public class Bridge extends TeamGame implements OreObsfucation
|
||||
}
|
||||
}
|
||||
|
||||
private void ParseWoodBridge() {
|
||||
protected void ParseWoodBridge() {
|
||||
_woodBridge = new ArrayList<Location>();
|
||||
|
||||
// Load Wood In
|
||||
@ -656,7 +704,7 @@ public class Bridge extends TeamGame implements OreObsfucation
|
||||
}
|
||||
}
|
||||
|
||||
private void ParseLavaBridge() {
|
||||
protected void ParseLavaBridge() {
|
||||
for (Location loc : WorldData.GetDataLocs("RED")) {
|
||||
_lavaBridge.add(loc.getBlock().getLocation());
|
||||
}
|
||||
@ -670,12 +718,12 @@ public class Bridge extends TeamGame implements OreObsfucation
|
||||
_lavaSource = WorldData.GetDataLocs("BLACK");
|
||||
}
|
||||
|
||||
private void ParseIceBridge()
|
||||
protected void ParseIceBridge()
|
||||
{
|
||||
_iceBridge = WorldData.GetDataLocs("LIGHT_BLUE");
|
||||
}
|
||||
|
||||
private void ParseMushrooms()
|
||||
protected void ParseMushrooms()
|
||||
{
|
||||
for (Location loc : WorldData.GetCustomLocs("21"))
|
||||
{
|
||||
@ -689,7 +737,7 @@ public class Bridge extends TeamGame implements OreObsfucation
|
||||
}
|
||||
}
|
||||
|
||||
private void ParseLillyPad()
|
||||
protected void ParseLillyPad()
|
||||
{
|
||||
for (Location loc : WorldData.GetDataLocs("LIME"))
|
||||
{
|
||||
@ -732,7 +780,7 @@ public class Bridge extends TeamGame implements OreObsfucation
|
||||
buildMushroom();
|
||||
}
|
||||
|
||||
private void BuildLava()
|
||||
protected void BuildLava()
|
||||
{
|
||||
for (int i = 0; i < 3; i++)
|
||||
if (_lavaBridge != null && _lavaSource != null
|
||||
@ -763,7 +811,7 @@ public class Bridge extends TeamGame implements OreObsfucation
|
||||
}
|
||||
}
|
||||
|
||||
private void BuildLillyPad()
|
||||
protected void BuildLillyPad()
|
||||
{
|
||||
for (int i = 0; i < 3; i++)
|
||||
if (_lillyPads != null && !_lillyPads.isEmpty())
|
||||
@ -795,7 +843,7 @@ public class Bridge extends TeamGame implements OreObsfucation
|
||||
_lillyPads.put(event.getBlock().getLocation(), System.currentTimeMillis() + (long)(Math.random() * 12000));
|
||||
}
|
||||
|
||||
private void buildMushroom()
|
||||
protected void buildMushroom()
|
||||
{
|
||||
if (_mushroomStem != null && !_mushroomStem.isEmpty())
|
||||
{
|
||||
@ -887,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))
|
||||
{
|
||||
@ -928,7 +976,7 @@ public class Bridge extends TeamGame implements OreObsfucation
|
||||
}
|
||||
}
|
||||
|
||||
private void BuildWood()
|
||||
protected void BuildWood()
|
||||
{
|
||||
if (_woodBridgeBlocks != null && !_woodBridgeBlocks.isEmpty())
|
||||
{
|
||||
@ -1946,6 +1994,21 @@ public class Bridge extends TeamGame implements OreObsfucation
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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";
|
||||
}
|
||||
|
||||
}
|
@ -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";
|
||||
}
|
||||
|
||||
}
|
@ -7,44 +7,6 @@ import java.util.List;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.UUID;
|
||||
|
||||
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.game.games.christmas.content.IceMaze;
|
||||
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 org.bukkit.ChatColor;
|
||||
import org.bukkit.Effect;
|
||||
import org.bukkit.GameMode;
|
||||
@ -108,7 +70,45 @@ import org.bukkit.event.vehicle.VehicleCreateEvent;
|
||||
import org.bukkit.event.vehicle.VehicleDamageEvent;
|
||||
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>();
|
||||
|
||||
@ -154,7 +154,22 @@ public class Build extends SoloGame
|
||||
|
||||
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[]
|
||||
{
|
||||
@ -224,16 +239,6 @@ public class Build extends SoloGame
|
||||
_mobShop = new MobShop(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");
|
||||
|
||||
registerStatTrackers(
|
||||
new BlockBreakStatTracker(this, false),
|
||||
new BlockPlaceStatTracker(this, new Material[]{})
|
||||
);
|
||||
|
||||
registerChatStats(
|
||||
new ChatStatData("BlocksPlaced", "Blocks Placed", true),
|
||||
new ChatStatData("BlocksBroken", "Blocks Broken", true)
|
||||
);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@ -244,6 +249,17 @@ public class Build extends SoloGame
|
||||
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
|
||||
public void prepare(GameStateChangeEvent event)
|
||||
{
|
||||
@ -415,19 +431,7 @@ public class Build extends SoloGame
|
||||
if (GetPlayers(true).size() >= 4 && _viewData.AbuseVotes.size() >= (double)(GetPlayers(true).size() - 1) / 2d)
|
||||
{
|
||||
result = C.cWhite + "Inappropriate Build";
|
||||
_viewData.setAbusive();
|
||||
|
||||
//Record Abuse
|
||||
AddStat(_viewData.Player, "Build Draw Abuse", 1, false, true);
|
||||
|
||||
//Announce
|
||||
Announce(C.cWhite + C.Bold + _viewData.Player.getName() + " has been reported for an inappropriate build.", false);
|
||||
_viewData.Spawn.getWorld().playSound(_viewData.Spawn, Sound.ENDERDRAGON_GROWL, 10f, 1f);
|
||||
|
||||
UtilPlayer.message(_viewData.Player, C.cWhite + C.Bold + "Inappropriate Builds can result in a Master Builders ban.");
|
||||
|
||||
//Return to Hub
|
||||
getArcadeManager().GetPortal().sendPlayerToServer(_viewData.Player, "Lobby");
|
||||
abusiveBulid();
|
||||
}
|
||||
else if (!hasDecentVote)
|
||||
{
|
||||
@ -446,7 +450,14 @@ public class Build extends SoloGame
|
||||
}
|
||||
|
||||
//Announce Builder
|
||||
UtilTextMiddle.display(result, "Built by: " + C.Bold + _viewData.Player.getName(), 0, 80, 5);
|
||||
if(_viewData.Player != null)
|
||||
{
|
||||
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;
|
||||
@ -517,69 +528,92 @@ public class Build extends SoloGame
|
||||
{
|
||||
tallyScores();
|
||||
|
||||
ArrayList<Player> places = new ArrayList<Player>();
|
||||
|
||||
//Calculate Places
|
||||
boolean first = true;
|
||||
while (!_data.isEmpty())
|
||||
{
|
||||
Player bestPlayer = null;
|
||||
double bestPoints = 0;
|
||||
|
||||
for (Player player : _data.keySet())
|
||||
{
|
||||
double points = _data.get(player).getPoints();
|
||||
|
||||
if (bestPlayer == null || points > bestPoints)
|
||||
{
|
||||
bestPlayer = player;
|
||||
bestPoints = points;
|
||||
}
|
||||
}
|
||||
|
||||
//Average points per player is 1000, so divided by 50 = 20 gems
|
||||
AddGems(bestPlayer, bestPoints / 50, "Build Votes", false, false);
|
||||
|
||||
BuildData data = _data.remove(bestPlayer);
|
||||
|
||||
//Teleport to winner
|
||||
if (first)
|
||||
{
|
||||
teleportPlayers(data);
|
||||
first = false;
|
||||
}
|
||||
|
||||
places.add(bestPlayer);
|
||||
_scoreboardPlaces.add(new AbstractMap.SimpleEntry<Player, Double>(bestPlayer, bestPoints));
|
||||
}
|
||||
calculatePlaces();
|
||||
|
||||
writeScoreboard();
|
||||
|
||||
//Announce
|
||||
AnnounceEnd(places);
|
||||
|
||||
//Gems
|
||||
if (places.size() >= 1)
|
||||
{
|
||||
_winnerUUID = places.get(0).getUniqueId();
|
||||
AddGems(places.get(0), 20, "1st Place", false, false);
|
||||
}
|
||||
|
||||
if (places.size() >= 2)
|
||||
AddGems(places.get(1), 15, "2nd Place", false, false);
|
||||
|
||||
if (places.size() >= 3)
|
||||
AddGems(places.get(2), 10, "3rd Place", false, false);
|
||||
|
||||
for (Player player : GetPlayers(false))
|
||||
if (player.isOnline())
|
||||
AddGems(player, 10, "Participation", false, false);
|
||||
|
||||
//End
|
||||
SetState(GameState.End);
|
||||
}
|
||||
}
|
||||
|
||||
public void calculatePlaces()
|
||||
{
|
||||
|
||||
ArrayList<Player> places = new ArrayList<Player>();
|
||||
|
||||
//Calculate Places
|
||||
boolean first = true;
|
||||
while (!_data.isEmpty())
|
||||
{
|
||||
Player bestPlayer = null;
|
||||
double bestPoints = 0;
|
||||
|
||||
for (Player player : _data.keySet())
|
||||
{
|
||||
double points = _data.get(player).getPoints();
|
||||
|
||||
if (bestPlayer == null || points > bestPoints)
|
||||
{
|
||||
bestPlayer = player;
|
||||
bestPoints = points;
|
||||
}
|
||||
}
|
||||
|
||||
//Average points per player is 1000, so divided by 50 = 20 gems
|
||||
AddGems(bestPlayer, bestPoints / 50, "Build Votes", false, false);
|
||||
|
||||
BuildData data = _data.remove(bestPlayer);
|
||||
|
||||
//Teleport to winner
|
||||
if (first)
|
||||
{
|
||||
teleportPlayers(data);
|
||||
first = false;
|
||||
}
|
||||
|
||||
places.add(bestPlayer);
|
||||
_scoreboardPlaces.add(new AbstractMap.SimpleEntry<Player, Double>(bestPlayer, bestPoints));
|
||||
}
|
||||
|
||||
//Announce
|
||||
AnnounceEnd(places);
|
||||
|
||||
//Gems
|
||||
if (places.size() >= 1)
|
||||
{
|
||||
_winnerUUID = places.get(0).getUniqueId();
|
||||
AddGems(places.get(0), 20, "1st Place", false, false);
|
||||
}
|
||||
|
||||
if (places.size() >= 2)
|
||||
AddGems(places.get(1), 15, "2nd Place", false, false);
|
||||
|
||||
if (places.size() >= 3)
|
||||
AddGems(places.get(2), 10, "3rd Place", false, false);
|
||||
|
||||
for (Player player : GetPlayers(false))
|
||||
if (player.isOnline())
|
||||
AddGems(player, 10, "Participation", false, false);
|
||||
}
|
||||
|
||||
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()
|
||||
{
|
||||
//Reset, if being re-called
|
||||
@ -645,7 +679,7 @@ public class Build extends SoloGame
|
||||
return _buildStateTime == 0;
|
||||
}
|
||||
|
||||
private void teleportPlayers(BuildData data)
|
||||
public void teleportPlayers(BuildData data)
|
||||
{
|
||||
//Teleport
|
||||
for (int i=0 ; i<UtilServer.getPlayers().length ; i++)
|
||||
@ -788,16 +822,22 @@ public class Build extends SoloGame
|
||||
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))
|
||||
return;
|
||||
|
||||
//Vote Abuse
|
||||
if (UtilGear.isMat(event.getPlayer().getItemInHand(), Material.BOOK))
|
||||
{
|
||||
_viewData.addAbuseVote(event.getPlayer());
|
||||
UtilTextMiddle.display(null, C.cWhite + C.Bold + "Inappropriate Build", 0, 40, 5, event.getPlayer());
|
||||
UtilPlayer.message(event.getPlayer(), C.cWhite + C.Bold + "You reported " + _viewData.Player.getName() + " for inappropriate build!");
|
||||
UtilPlayer.message(event.getPlayer(), C.cWhite + C.Bold + "Thanks for helping us keep Master Builders clean!");
|
||||
processReport(event.getPlayer());
|
||||
return;
|
||||
}
|
||||
|
||||
@ -837,6 +877,14 @@ public class Build extends SoloGame
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
public void playerQuit(PlayerQuitEvent event)
|
||||
@ -1074,11 +1122,16 @@ public class Build extends SoloGame
|
||||
if (data == null)
|
||||
return;
|
||||
|
||||
if (data.Player.equals(event.getPlayer()))
|
||||
|
||||
event.getItem().remove();
|
||||
|
||||
if(data.Player == null)
|
||||
{
|
||||
event.getItem().remove();
|
||||
UtilParticle.PlayParticle(ParticleType.LARGE_EXPLODE, event.getItem().getLocation().add(0, 0.5, 0), 0, 0, 0, 0, 1,
|
||||
ViewDist.LONG, UtilServer.getPlayers());
|
||||
if (data.Team.HasPlayer(event.getPlayer()))
|
||||
{
|
||||
UtilParticle.PlayParticle(ParticleType.LARGE_EXPLODE, event.getItem().getLocation().add(0, 0.5, 0), 0, 0, 0, 0, 1,
|
||||
ViewDist.LONG, UtilServer.getPlayers());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1395,7 +1448,7 @@ public class Build extends SoloGame
|
||||
|
||||
if (data != null)
|
||||
{
|
||||
data.addParticles(particleType);
|
||||
data.addParticles(event.getPlayer(), particleType);
|
||||
}
|
||||
|
||||
event.setCancelled(true);
|
||||
@ -1588,4 +1641,85 @@ public class Build extends SoloGame
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
@ -4,19 +4,6 @@ import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
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.Material;
|
||||
import org.bukkit.Sound;
|
||||
@ -28,6 +15,20 @@ import org.bukkit.entity.Item;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
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.PacketPlayOutSpawnEntityWeather;
|
||||
|
||||
@ -35,6 +36,8 @@ public class BuildData
|
||||
{
|
||||
public Player Player;
|
||||
|
||||
public GameTeam Team;
|
||||
|
||||
public boolean Judged = false;
|
||||
|
||||
public Location Spawn;
|
||||
@ -65,6 +68,19 @@ public class BuildData
|
||||
public BuildData(Player player, Location spawn, ArrayList<Location> buildBorders)
|
||||
{
|
||||
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;
|
||||
|
||||
CornerA = UtilAlg.findClosest(spawn, buildBorders);
|
||||
@ -90,50 +106,68 @@ public class BuildData
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean addParticles(ParticleType particleType)
|
||||
public boolean addParticles(Player player, ParticleType particleType)
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
Location toPlace = Player.getEyeLocation().add(Player.getLocation().getDirection());
|
||||
Location toPlace = player.getEyeLocation().add(player.getLocation().getDirection());
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
public void resetParticles()
|
||||
public void resetParticles(Player player)
|
||||
{
|
||||
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)
|
||||
{
|
||||
if (entity instanceof Ghast)
|
||||
{
|
||||
UtilPlayer.message(Player, F.main("Game", "You cannot spawn Ghasts!"));
|
||||
|
||||
if(Player != null)
|
||||
{
|
||||
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();
|
||||
return false;
|
||||
}
|
||||
|
||||
if (Entities.size() >= 16)
|
||||
{
|
||||
UtilPlayer.message(Player, F.main("Game", "You cannot spawn more than 16 Entities!"));
|
||||
|
||||
{
|
||||
if(Player != null)
|
||||
{
|
||||
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();
|
||||
return false;
|
||||
}
|
||||
@ -243,11 +277,26 @@ public class BuildData
|
||||
amount = 1;
|
||||
|
||||
if (all)
|
||||
{
|
||||
UtilParticle.PlayParticle(type, loc, 0.4f, 0.4f, 0.4f, 0, amount,
|
||||
ViewDist.LONGER, UtilServer.getPlayers());
|
||||
}
|
||||
else
|
||||
UtilParticle.PlayParticle(type, loc, 0.4f, 0.4f, 0.4f, 0, amount,
|
||||
ViewDist.LONGER, Player);
|
||||
{
|
||||
if(Player != null)
|
||||
{
|
||||
UtilParticle.PlayParticle(type, loc, 0.4f, 0.4f, 0.4f, 0, amount,
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -266,7 +315,17 @@ public class BuildData
|
||||
}
|
||||
else
|
||||
{
|
||||
playWeather(Player, type);
|
||||
if(Player != null)
|
||||
{
|
||||
playWeather(Player, type);
|
||||
}
|
||||
else
|
||||
{
|
||||
for(Player player : Team.GetPlayers(true))
|
||||
{
|
||||
playWeather(player, 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;
|
||||
}
|
||||
|
||||
@ -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 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 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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -64,7 +64,7 @@ public class GroundPage extends ShopPageBase<ArcadeManager, OptionsShop>
|
||||
@Override
|
||||
public void onClick(Player player, ClickType clickType)
|
||||
{
|
||||
buildData.setGround(data);
|
||||
buildData.setGround(player, data);
|
||||
}
|
||||
});
|
||||
index++;
|
||||
|
@ -70,7 +70,7 @@ public class ParticlesPage extends ShopPageBase<ArcadeManager, OptionsShop>
|
||||
@Override
|
||||
public void onClick(Player player, ClickType clickType)
|
||||
{
|
||||
buildData.resetParticles();
|
||||
buildData.resetParticles(player);
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -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";
|
||||
}
|
||||
|
||||
}
|
@ -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";
|
||||
}
|
||||
|
||||
}
|
@ -44,6 +44,8 @@ public class Arena
|
||||
|
||||
private ArrayList<Player> _alreadyAlertedPleaseWait;
|
||||
private boolean _alertedAlready2;
|
||||
|
||||
private boolean _poison;
|
||||
|
||||
private HashMap<Player, ArrayList<ParticleData>> _particles;
|
||||
|
||||
@ -64,7 +66,8 @@ public class Arena
|
||||
_doBye = false;
|
||||
_alreadyAlertedPleaseWait = new ArrayList<>();
|
||||
_alertedAlready2 = false;
|
||||
|
||||
_poison = false;
|
||||
|
||||
setupSpawns();
|
||||
}
|
||||
|
||||
@ -296,6 +299,8 @@ public class Arena
|
||||
|
||||
if (_state.equals(ArenaState.WAITING))
|
||||
{
|
||||
_poison = false;
|
||||
|
||||
if (_host.getRoundState() != RoundState.FIGHTING)
|
||||
return;
|
||||
|
||||
@ -323,6 +328,7 @@ public class Arena
|
||||
if (!UtilTime.elapsed(_stateTime, 60000))
|
||||
return; // No poison yet.
|
||||
|
||||
_poison = true;
|
||||
for (Player p : getPastPlayers())
|
||||
{
|
||||
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.
|
||||
}
|
||||
|
||||
public boolean isPoisoned()
|
||||
{
|
||||
return _poison;
|
||||
}
|
||||
}
|
@ -9,7 +9,6 @@ import org.bukkit.inventory.ItemStack;
|
||||
*/
|
||||
public enum ArenaType
|
||||
{
|
||||
|
||||
RED(1, new Loadout()
|
||||
{
|
||||
@Override
|
||||
|
@ -91,11 +91,34 @@ public class Gladiators extends SoloGame
|
||||
|
||||
public Gladiators(ArcadeManager manager)
|
||||
{
|
||||
super(manager, GameType.Gladiators,
|
||||
new Kit[]
|
||||
{
|
||||
new KitGladiator(manager)
|
||||
},
|
||||
this(manager, new Kit[]
|
||||
{
|
||||
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[]
|
||||
{
|
||||
"This is a 1v1 tournament!",
|
||||
@ -116,24 +139,6 @@ public class Gladiators extends SoloGame
|
||||
BlockBreakAllow.add(Material.DEAD_BUSH.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<>();
|
||||
|
||||
_roundState = RoundState.WAITING;
|
||||
@ -357,7 +362,7 @@ public class Gladiators extends SoloGame
|
||||
}
|
||||
}
|
||||
|
||||
private void findGameArenaSet()
|
||||
protected void findGameArenaSet()
|
||||
{
|
||||
_gameArenaSet = new ArrayList<>();
|
||||
|
||||
@ -753,7 +758,7 @@ public class Gladiators extends SoloGame
|
||||
p.setHealth(p.getMaxHealth()); //Heal
|
||||
}
|
||||
|
||||
private void giveLoadout(Player p, ArenaType type)
|
||||
protected void giveLoadout(Player p, ArenaType type)
|
||||
{
|
||||
if (!GetPlayers(true).contains(p))
|
||||
return;
|
||||
@ -1113,4 +1118,15 @@ public class Gladiators extends SoloGame
|
||||
_hotbarEditor.deregisterSelf(); // De-register as listener
|
||||
_hotbarEditor.onDisable(); // Fully disable
|
||||
}
|
||||
|
||||
public HashMap<Player, Arena> getArenas()
|
||||
{
|
||||
return _playerArenas;
|
||||
}
|
||||
|
||||
public HotbarEditor getHotbarEditor()
|
||||
{
|
||||
return _hotbarEditor;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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";
|
||||
}
|
||||
|
||||
}
|
@ -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";
|
||||
}
|
||||
|
||||
}
|
@ -285,16 +285,20 @@ public class HideSeek extends TeamGame
|
||||
}
|
||||
};
|
||||
|
||||
public HideSeek(ArcadeManager manager)
|
||||
public HideSeek(ArcadeManager manager)
|
||||
{
|
||||
super(manager, GameType.HideSeek,
|
||||
|
||||
new Kit[]
|
||||
{
|
||||
new KitHiderSwapper(manager), new KitHiderQuick(manager), new KitHiderShocker(manager),
|
||||
new KitHiderTeleporter(manager), new NullKit(manager), new KitSeekerLeaper(manager),
|
||||
new KitSeekerTNT(manager), new KitSeekerRadar(manager),
|
||||
},
|
||||
this(manager,
|
||||
new Kit[]
|
||||
{
|
||||
new KitHiderSwapper(manager), new KitHiderQuick(manager), new KitHiderShocker(manager),
|
||||
new KitHiderTeleporter(manager), new NullKit(manager), new KitSeekerLeaper(manager),
|
||||
new KitSeekerTNT(manager), new KitSeekerRadar(manager),
|
||||
});
|
||||
}
|
||||
|
||||
public HideSeek(ArcadeManager manager, Kit[] kits)
|
||||
{
|
||||
super(manager, GameType.HideSeek, kits,
|
||||
|
||||
new String[]
|
||||
{
|
||||
@ -935,7 +939,7 @@ public class HideSeek extends TeamGame
|
||||
if (!_hiders.HasPlayer(player))
|
||||
return;
|
||||
|
||||
if (!Recharge.Instance.use(player, "Axe Boost", 16000, true, true))
|
||||
if (!Recharge.Instance.use(player, "Axe Boost", 16000, inform(), true))
|
||||
return;
|
||||
|
||||
if (UtilGear.isMat(player.getItemInHand(), Material.WOOD_AXE))
|
||||
@ -998,7 +1002,7 @@ public class HideSeek extends TeamGame
|
||||
|
||||
event.setCancelled(true);
|
||||
|
||||
if (!Recharge.Instance.use(player, "Meow", 5000, true, true))
|
||||
if (!Recharge.Instance.use(player, "Meow", 5000, inform(), true))
|
||||
return;
|
||||
|
||||
player.getWorld().playSound(player.getLocation(), Sound.CAT_MEOW, 1f, 1f);
|
||||
@ -1027,7 +1031,7 @@ public class HideSeek extends TeamGame
|
||||
|
||||
event.setCancelled(true);
|
||||
|
||||
if (!Recharge.Instance.use(player, "Firework", 15000, true, true))
|
||||
if (!Recharge.Instance.use(player, "Firework", 15000, inform(), true))
|
||||
return;
|
||||
|
||||
this.AddGems(player, 2, "Fireworks", true, true);
|
||||
@ -1472,7 +1476,7 @@ public class HideSeek extends TeamGame
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Recharge.Instance.use(player, "Infest", 8000, true, true))
|
||||
if (!Recharge.Instance.use(player, "Infest", 8000, inform(), true))
|
||||
return;
|
||||
|
||||
// Cloak
|
||||
@ -1505,7 +1509,7 @@ public class HideSeek extends TeamGame
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Recharge.Instance.use(player, "Infest", 8000, true, true))
|
||||
if (!Recharge.Instance.use(player, "Infest", 8000, inform(), true))
|
||||
return;
|
||||
|
||||
// Cloak
|
||||
@ -1653,4 +1657,19 @@ public class HideSeek extends TeamGame
|
||||
|
||||
return ent.getVehicle() != null;
|
||||
}
|
||||
|
||||
public HashMap<Player, Form> getForms()
|
||||
{
|
||||
return _forms;
|
||||
}
|
||||
|
||||
public ArrayList<Material> getAllowedBlocks()
|
||||
{
|
||||
return _allowedBlocks;
|
||||
}
|
||||
|
||||
public boolean inform()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -70,7 +70,7 @@ public class BlockForm extends Form
|
||||
_fakeBlockId = UtilEnt.getNewEntityId();
|
||||
System.out.println("Block Form: " + _mat + " " + _mat.getId());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void Apply()
|
||||
{
|
||||
|
@ -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";
|
||||
}
|
||||
|
||||
}
|
@ -30,17 +30,9 @@ public class Micro extends TeamGame
|
||||
private ArrayList<Block> _blocks = 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,
|
||||
|
||||
new Kit[]
|
||||
{
|
||||
new KitArcher(manager),
|
||||
new KitWorker(manager),
|
||||
new KitFighter(manager)
|
||||
},
|
||||
|
||||
super(manager, type, kits,
|
||||
new String[]
|
||||
{
|
||||
"Small game, big strategy!",
|
||||
@ -58,6 +50,19 @@ public class Micro extends TeamGame
|
||||
|
||||
this.BlockBreak = true;
|
||||
this.BlockPlace = true;
|
||||
}
|
||||
|
||||
public Micro(ArcadeManager manager)
|
||||
{
|
||||
this(manager,
|
||||
|
||||
new Kit[]
|
||||
{
|
||||
new KitArcher(manager),
|
||||
new KitWorker(manager),
|
||||
new KitFighter(manager)
|
||||
},
|
||||
GameType.Micro);
|
||||
|
||||
registerStatTrackers(
|
||||
new KillsWithinGameStatTracker(this, 8, "Annihilation")
|
||||
|
@ -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";
|
||||
}
|
||||
|
||||
}
|
@ -56,17 +56,35 @@ public class Quiver extends SoloGame
|
||||
|
||||
public Quiver(ArcadeManager manager)
|
||||
{
|
||||
super(manager, GameType.Quiver,
|
||||
this(manager, new Kit[]
|
||||
{
|
||||
new KitLeaper(manager),
|
||||
new KitBrawler(manager),
|
||||
new KitEnchanter(manager),
|
||||
new KitSlamShot(manager),
|
||||
new KitNinja(manager)
|
||||
}, GameType.Quiver);
|
||||
|
||||
new Kit[]
|
||||
{
|
||||
new KitLeaper(manager),
|
||||
new KitBrawler(manager),
|
||||
new KitEnchanter(manager),
|
||||
new KitSlamShot(manager),
|
||||
new KitNinja(manager)
|
||||
},
|
||||
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[]
|
||||
{
|
||||
"Bow and Arrow insta-kills.",
|
||||
@ -89,22 +107,6 @@ public class Quiver extends SoloGame
|
||||
|
||||
_scoreObj = Scoreboard.GetScoreboard().registerNewObjective("Kills", "dummy");
|
||||
_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)
|
||||
@ -423,4 +425,9 @@ public class Quiver extends SoloGame
|
||||
else
|
||||
return null;
|
||||
}
|
||||
|
||||
public HashMap<Player, Long> getDeathTime()
|
||||
{
|
||||
return _deathTime;
|
||||
}
|
||||
}
|
||||
|
@ -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";
|
||||
}
|
||||
|
||||
}
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
@ -43,7 +43,20 @@ public class Runner extends SoloGame implements IThrown
|
||||
|
||||
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[]
|
||||
{
|
||||
@ -65,14 +78,6 @@ public class Runner extends SoloGame implements IThrown
|
||||
this.WorldWaterDamage = 4;
|
||||
|
||||
this.PrepareFreeze = false;
|
||||
|
||||
registerStatTrackers(new DistanceTraveledStatTracker(this, "MarathonRunner"));
|
||||
|
||||
registerChatStats(
|
||||
new ChatStatData("MarathonRunner", "Distance ran", true),
|
||||
BlankLine,
|
||||
new ChatStatData("kit", "Kit", true)
|
||||
);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@ -323,6 +328,11 @@ public class Runner extends SoloGame implements IThrown
|
||||
|
||||
BlockSmash(data.GetThrown());
|
||||
}
|
||||
|
||||
public HashMap<Block, Long> getBlocks()
|
||||
{
|
||||
return _blocks;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Idle(ProjectileUser data)
|
||||
|
@ -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";
|
||||
}
|
||||
|
||||
}
|
@ -125,14 +125,32 @@ public class SheepGame extends TeamGame
|
||||
|
||||
public SheepGame(ArcadeManager manager)
|
||||
{
|
||||
super(manager, GameType.Sheep,
|
||||
this(manager, new Kit[]
|
||||
{
|
||||
new KitBeserker(manager),
|
||||
new KitArcher(manager),
|
||||
new KitBrute(manager)
|
||||
}, GameType.Sheep);
|
||||
|
||||
new Kit[]
|
||||
{
|
||||
new KitBeserker(manager),
|
||||
new KitArcher(manager),
|
||||
new KitBrute(manager)
|
||||
},
|
||||
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[]
|
||||
{
|
||||
@ -150,21 +168,6 @@ public class SheepGame extends TeamGame
|
||||
|
||||
this.TeamArmor = 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
|
||||
@ -333,9 +336,8 @@ public class SheepGame extends TeamGame
|
||||
}
|
||||
|
||||
//Put Wool in Inventory
|
||||
player.getInventory().setItem(4 + count, ItemStackFactory.Instance.CreateStack(35, ((Sheep)sheep).getColor().getWoolData()));
|
||||
UtilInv.Update(player);
|
||||
|
||||
inventoryWool(player, count, sheep);
|
||||
|
||||
//Effect
|
||||
sheep.getWorld().playEffect(sheep.getLocation(), Effect.STEP_SOUND, 35);
|
||||
|
||||
@ -350,6 +352,12 @@ public class SheepGame extends TeamGame
|
||||
|
||||
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
|
||||
public void StackPlayer(PlayerInteractEntityEvent event)
|
||||
|
@ -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";
|
||||
}
|
||||
|
||||
}
|
@ -132,7 +132,7 @@ public abstract class Skywars extends Game
|
||||
private ChestLoot _middleTool = new ChestLoot();
|
||||
private ChestLoot _middleProjectile = new ChestLoot();
|
||||
private ChestLoot _middleBlock = new ChestLoot();
|
||||
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public Skywars(ArcadeManager manager, GameType type, String[] description)
|
||||
{
|
||||
@ -193,32 +193,14 @@ public abstract class Skywars extends Game
|
||||
|
||||
};
|
||||
|
||||
setupPlayerLoot();
|
||||
setupMiddleLoot();
|
||||
|
||||
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()
|
||||
{
|
||||
setupPlayerLoot();
|
||||
setupMiddleLoot();
|
||||
parseCreateZombieSpawns();
|
||||
parseCreateMiddleChests();
|
||||
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());
|
||||
Chest chest = (Chest) block.getState();
|
||||
@ -1122,7 +1104,7 @@ public abstract class Skywars extends Game
|
||||
}
|
||||
|
||||
|
||||
private void setupPlayerLoot()
|
||||
public void setupPlayerLoot()
|
||||
{
|
||||
//Armor
|
||||
_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));
|
||||
}
|
||||
|
||||
private void setupMiddleLoot()
|
||||
public void setupMiddleLoot()
|
||||
{
|
||||
//Armor
|
||||
_middleArmor.addLoot(new RandomItem(Material.GOLD_HELMET, 20));
|
||||
@ -1365,4 +1347,19 @@ public abstract class Skywars extends Game
|
||||
return this._crumbleTime;
|
||||
}
|
||||
|
||||
public ArrayList<Block> getSpawnChests()
|
||||
{
|
||||
return _spawnChests;
|
||||
}
|
||||
|
||||
public ArrayList<Block> getMiddleChests()
|
||||
{
|
||||
return _middleChests;
|
||||
}
|
||||
|
||||
public HashSet<Location> getLooted()
|
||||
{
|
||||
return _lootedBlocks;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -18,6 +18,11 @@ import nautilus.game.arcade.GameType;
|
||||
import nautilus.game.arcade.events.GameStateChangeEvent;
|
||||
import nautilus.game.arcade.game.GameTeam;
|
||||
import nautilus.game.arcade.game.Game.GameState;
|
||||
import 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
|
||||
{
|
||||
@ -26,7 +31,29 @@ public class SoloSkywars extends Skywars
|
||||
|
||||
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[]
|
||||
{
|
||||
"Free for all battle in the sky!",
|
||||
@ -35,6 +62,23 @@ public class SoloSkywars extends Skywars
|
||||
});
|
||||
|
||||
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
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
|
@ -19,6 +19,11 @@ import nautilus.game.arcade.GameType;
|
||||
import nautilus.game.arcade.events.GameStateChangeEvent;
|
||||
import nautilus.game.arcade.game.GameTeam;
|
||||
import nautilus.game.arcade.game.Game.GameState;
|
||||
import 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.Location;
|
||||
@ -34,11 +39,31 @@ import org.bukkit.event.player.PlayerQuitEvent;
|
||||
public class TeamSkywars extends Skywars
|
||||
{
|
||||
|
||||
private NautHashMap<Player, Player> _teamReqs = new NautHashMap<Player, Player>();
|
||||
|
||||
public TeamSkywars(ArcadeManager manager)
|
||||
{
|
||||
super(manager, GameType.SkywarsTeams,
|
||||
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[]
|
||||
{
|
||||
"Free for all battle in the sky!",
|
||||
@ -46,152 +71,17 @@ public class TeamSkywars extends Skywars
|
||||
"Last team alive wins!"
|
||||
});
|
||||
|
||||
this.FillTeamsInOrderToCount = 2;
|
||||
FillTeamsInOrderToCount = 2;
|
||||
|
||||
this.SpawnNearAllies = true;
|
||||
SpawnNearAllies = true;
|
||||
|
||||
this.DamageTeamSelf = false;
|
||||
DamageTeamSelf = false;
|
||||
|
||||
this.DontAllowOverfill = true;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void CustomTeamGeneration(GameStateChangeEvent event)
|
||||
{
|
||||
if (event.GetState() != GameState.Recruit)
|
||||
return;
|
||||
DontAllowOverfill = true;
|
||||
|
||||
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;
|
||||
PlayerTeamSelection = true;
|
||||
TeamMode = true;
|
||||
TeamPerSpawn = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -261,8 +151,6 @@ public class TeamSkywars extends Skywars
|
||||
Scoreboard.Write(UtilTime.convertString(this.getCrumbleTime() - (System.currentTimeMillis() - GetStateTime()), 0, TimeUnit.FIT));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Scoreboard.Draw();
|
||||
}
|
||||
@ -329,147 +217,6 @@ public class TeamSkywars extends Skywars
|
||||
return players;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean CanJoinTeam(GameTeam team)
|
||||
{
|
||||
return team.GetSize() < 2;
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH)
|
||||
public void teamSelectInteract(PlayerInteractEntityEvent event)
|
||||
{
|
||||
if (GetState() != GameState.Recruit)
|
||||
return;
|
||||
|
||||
if (event.getRightClicked() == null)
|
||||
return;
|
||||
|
||||
if (!(event.getRightClicked() instanceof Player))
|
||||
return;
|
||||
|
||||
Player player = event.getPlayer();
|
||||
|
||||
//Observer
|
||||
if (Manager.IsObserver(player))
|
||||
{
|
||||
UtilPlayer.message(player, F.main("Game", "Spectators cannot partake in games."));
|
||||
return;
|
||||
}
|
||||
|
||||
selectTeamMate(player, (Player)event.getRightClicked());
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void teamSelectCommand(PlayerCommandPreprocessEvent event)
|
||||
{
|
||||
if (GetState() != GameState.Recruit)
|
||||
return;
|
||||
|
||||
if (!event.getMessage().toLowerCase().startsWith("/team "))
|
||||
return;
|
||||
|
||||
event.setCancelled(true);
|
||||
|
||||
Player target = UtilPlayer.searchOnline(event.getPlayer(), event.getMessage().split(" ")[1], true);
|
||||
if (target == null)
|
||||
return;
|
||||
|
||||
//Observer
|
||||
if (Manager.IsObserver(event.getPlayer()))
|
||||
{
|
||||
UtilPlayer.message(event.getPlayer(), F.main("Game", "Spectators cannot partake in games."));
|
||||
return;
|
||||
}
|
||||
|
||||
if (event.getPlayer().equals(target))
|
||||
return;
|
||||
|
||||
selectTeamMate(event.getPlayer(), target);
|
||||
}
|
||||
|
||||
public void selectTeamMate(Player player, Player ally)
|
||||
{
|
||||
//Accept Invite
|
||||
if (_teamReqs.containsKey(ally) && _teamReqs.get(ally).equals(player))
|
||||
{
|
||||
//Remove Prefs
|
||||
_teamReqs.remove(player);
|
||||
_teamReqs.remove(ally);
|
||||
|
||||
//Inform
|
||||
UtilPlayer.message(player, F.main("Game", "You accepted " + ally.getName() + "'s Team Request!"));
|
||||
UtilPlayer.message(ally, F.main("Game", player.getName() + " accepted your Team Request!"));
|
||||
|
||||
//Leave Old Teams
|
||||
if (GetTeam(player) != null)
|
||||
GetTeam(player).DisbandTeam();
|
||||
|
||||
if (GetTeam(ally) != null)
|
||||
GetTeam(ally).DisbandTeam();
|
||||
|
||||
//Get Team
|
||||
GameTeam team = getEmptyTeam();
|
||||
if (team == null)
|
||||
return;
|
||||
|
||||
//Join Team
|
||||
SetPlayerTeam(player, team, true);
|
||||
SetPlayerTeam(ally, team, true);
|
||||
}
|
||||
//Send Invite
|
||||
else
|
||||
{
|
||||
//Already on Team with Target
|
||||
if (GetTeam(player) != null)
|
||||
if (GetTeam(player).HasPlayer(ally))
|
||||
return;
|
||||
|
||||
//Inform Player
|
||||
UtilPlayer.message(player, F.main("Game", "You sent a Team Request to " + ally.getName() + "!"));
|
||||
|
||||
//Inform Target
|
||||
if (Recharge.Instance.use(player, "Team Req " + ally.getName(), 2000, false, false))
|
||||
{
|
||||
UtilPlayer.message(ally, F.main("Game", player.getName() + " sent you a Team Request!"));
|
||||
UtilPlayer.message(ally, F.main("Game", "Type " + F.elem("/team " + player.getName()) + " to accept!"));
|
||||
}
|
||||
|
||||
//Add Pref
|
||||
_teamReqs.put(player, ally);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void teamQuit(PlayerQuitEvent event)
|
||||
{
|
||||
if (GetState() != GameState.Recruit)
|
||||
return;
|
||||
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if (GetTeam(player) != null)
|
||||
GetTeam(player).DisbandTeam();
|
||||
|
||||
Iterator<Player> teamIter = _teamReqs.keySet().iterator();
|
||||
while (teamIter.hasNext())
|
||||
{
|
||||
Player sender = teamIter.next();
|
||||
if (sender.equals(player) || _teamReqs.get(sender).equals(player))
|
||||
teamIter.remove();
|
||||
}
|
||||
}
|
||||
|
||||
public GameTeam getEmptyTeam()
|
||||
{
|
||||
for (GameTeam team : GetTeamList())
|
||||
{
|
||||
if (team.GetPlayers(false).isEmpty())
|
||||
return team;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String GetMode()
|
||||
{
|
||||
|
@ -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";
|
||||
}
|
||||
|
||||
}
|
@ -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";
|
||||
}
|
||||
|
||||
}
|
@ -15,8 +15,14 @@ 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.kit.Kit;
|
||||
import nautilus.game.arcade.game.Game.GameState;
|
||||
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
|
||||
{
|
||||
@ -34,6 +40,14 @@ public class SoloSuperSmash extends SuperSmash
|
||||
|
||||
this.DamageTeamSelf = true;
|
||||
|
||||
registerStatTrackers(
|
||||
new WinWithoutDyingStatTracker(this, "MLGPro"),
|
||||
new FreeKitWinStatTracker(this),
|
||||
new OneVThreeStatTracker(this),
|
||||
new KillFastStatTracker(this, 3, 10, "TripleKill"),
|
||||
new RecoveryMasterStatTracker(this)
|
||||
);
|
||||
|
||||
registerChatStats(
|
||||
Kills,
|
||||
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
|
||||
public void CustomTeamGeneration(GameStateChangeEvent event)
|
||||
{
|
||||
|
@ -85,7 +85,7 @@ public abstract class SuperSmash extends Game
|
||||
|
||||
public SuperSmash(ArcadeManager manager, GameType type, String[] description)
|
||||
{
|
||||
super(manager, type,
|
||||
this(manager,
|
||||
|
||||
new Kit[]
|
||||
{
|
||||
@ -114,7 +114,12 @@ public abstract class SuperSmash extends Game
|
||||
|
||||
new KitSheep(manager)
|
||||
|
||||
},description);
|
||||
}, type, description);
|
||||
}
|
||||
|
||||
public SuperSmash(ArcadeManager manager, Kit[] kits, GameType type, String[] description)
|
||||
{
|
||||
super(manager, type, kits, description);
|
||||
|
||||
this.DeathOut = false;
|
||||
|
||||
@ -131,14 +136,6 @@ public abstract class SuperSmash extends Game
|
||||
// Add stat table here
|
||||
// Example
|
||||
// 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)
|
||||
@ -493,4 +490,9 @@ public abstract class SuperSmash extends Game
|
||||
int amount = Math.max(1, (int)(event.GetDamage()/2));
|
||||
UtilPlayer.hunger(damager, amount);
|
||||
}
|
||||
|
||||
public HashMap<Player, Integer> getLiveMap()
|
||||
{
|
||||
return _lives;
|
||||
}
|
||||
}
|
||||
|
@ -16,6 +16,11 @@ import nautilus.game.arcade.GameType;
|
||||
import nautilus.game.arcade.events.GameStateChangeEvent;
|
||||
import nautilus.game.arcade.game.GameTeam;
|
||||
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.Location;
|
||||
@ -28,12 +33,6 @@ import org.bukkit.event.player.PlayerQuitEvent;
|
||||
|
||||
public class TeamSuperSmash extends SuperSmash
|
||||
{
|
||||
|
||||
public boolean ForceTeamSize = true;
|
||||
public int PlayersPerTeam = 2;
|
||||
public int TeamCount = 0;
|
||||
|
||||
private NautHashMap<Player, Player> _teamReqs = new NautHashMap<Player, Player>();
|
||||
|
||||
public TeamSuperSmash(ArcadeManager manager)
|
||||
{
|
||||
@ -45,15 +44,26 @@ public class TeamSuperSmash extends SuperSmash
|
||||
"Last team alive wins!"
|
||||
});
|
||||
|
||||
this.PlayersPerTeam = 2;
|
||||
this.FillTeamsInOrderToCount = 2;
|
||||
PlayersPerTeam = 2;
|
||||
FillTeamsInOrderToCount = 2;
|
||||
|
||||
this.SpawnNearAllies = true;
|
||||
this.DamageTeamSelf = false;
|
||||
SpawnNearAllies = true;
|
||||
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(
|
||||
Kills,
|
||||
@ -121,112 +131,6 @@ public class TeamSuperSmash extends SuperSmash
|
||||
|
||||
Scoreboard.Draw();
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void CustomTeamGeneration(GameStateChangeEvent event)
|
||||
{
|
||||
if (event.GetState() != GameState.Recruit)
|
||||
return;
|
||||
|
||||
ArrayList<Location> spawns = this.GetTeamList().get(0).GetSpawns();
|
||||
this.GetTeamList().clear();
|
||||
|
||||
TeamColors color = TeamColors.DARK_AQUA;
|
||||
|
||||
if(!this.ForceTeamSize)
|
||||
{
|
||||
for(int i = 1; i <= this.TeamCount; i++)
|
||||
{
|
||||
color = getNextColor(color);
|
||||
GameTeam team = new GameTeam(this, String.valueOf(i), color.getColor(), spawns);
|
||||
team.SetVisible(true);
|
||||
GetTeamList().add(team);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for(int i = 1; i <= Manager.GetPlayerFull() / this.PlayersPerTeam; i++)
|
||||
{
|
||||
color = getNextColor(color);
|
||||
int e = 0;
|
||||
for(GameTeam teams : GetTeamList())
|
||||
{
|
||||
if(teams.GetColor() == color.getColor())
|
||||
{
|
||||
e++;
|
||||
if(getColorName(color.getColor()).length <= e)
|
||||
{
|
||||
e = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
GameTeam team = new GameTeam(this, getColorName(color.getColor())[e], color.getColor(), spawns, true);
|
||||
team.SetVisible(true);
|
||||
GetTeamList().add(team);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private enum TeamColors
|
||||
{
|
||||
|
||||
YELLOW(ChatColor.YELLOW, new String[]{"Banana", "Sunshine", "Custard", "Sponge", "Star", "Giraffe", "Lego", "Light"}),
|
||||
GREEN(ChatColor.GREEN, new String[]{"Creepers", "Alien", "Seaweed", "Emerald", "Grinch", "Shrub", "Snake", "Leaf"}),
|
||||
AQUA(ChatColor.AQUA, new String[]{"Diamond", "Ice", "Pool", "Kraken", "Aquatic", "Ocean"}),
|
||||
RED(ChatColor.RED, new String[]{"Heart", "Tomato", "Ruby", "Jam", "Rose", "Apple", "TNT"}),
|
||||
GOLD(ChatColor.GOLD, new String[]{"Mango", "Foxes", "Sunset", "Nuggets", "Lion", "Desert", "Gapple"}),
|
||||
LIGHT_PURPLE(ChatColor.LIGHT_PURPLE, new String[]{"Dream", "Cupcake", "Cake", "Candy", "Unicorn"}),
|
||||
DARK_BLUE(ChatColor.DARK_BLUE, new String[]{"Squid", "Lapis", "Sharks", "Galaxy", "Empoleon"}),
|
||||
DARK_RED(ChatColor.DARK_RED, new String[]{"Rose", "Apple", "Twizzler", "Rocket", "Blood"}),
|
||||
WHITE(ChatColor.WHITE, new String[]{"Ghosts", "Spookies", "Popcorn", "Seagull", "Rice", "Snowman", "Artic"}),
|
||||
BLUE(ChatColor.BLUE, new String[]{"Sky", "Whale", "Lake", "Birds", "Bluebird", "Piplup"}),
|
||||
DARK_GREEN(ChatColor.DARK_GREEN, new String[]{"Forest", "Zombies", "Cactus", "Slime", "Toxic", "Poison"}),
|
||||
DARK_PURPLE(ChatColor.DARK_PURPLE, new String[]{"Amethyst", "Slugs", "Grape", "Witch", "Magic", "Zula"}),
|
||||
DARK_AQUA(ChatColor.DARK_AQUA, new String[]{"Snorlax", "Aquatic", "Clam", "Fish"});
|
||||
|
||||
private ChatColor color;
|
||||
private String[] names;
|
||||
|
||||
private TeamColors(ChatColor color, String[] names)
|
||||
{
|
||||
this.color = color;
|
||||
this.names = names;
|
||||
}
|
||||
|
||||
public ChatColor getColor()
|
||||
{
|
||||
return color;
|
||||
}
|
||||
|
||||
public String[] getNames()
|
||||
{
|
||||
return names;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private String[] getColorName(ChatColor color)
|
||||
{
|
||||
for(TeamColors colors : TeamColors.values())
|
||||
{
|
||||
if(colors.getColor() == color)
|
||||
{
|
||||
return colors.getNames();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private TeamColors getNextColor(TeamColors color)
|
||||
{
|
||||
for(TeamColors colors : TeamColors.values()) {
|
||||
if(colors.ordinal() == color.ordinal() + 1)
|
||||
{
|
||||
return colors;
|
||||
}
|
||||
}
|
||||
return TeamColors.YELLOW;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void EndCheck()
|
||||
@ -236,7 +140,7 @@ public class TeamSuperSmash extends SuperSmash
|
||||
|
||||
ArrayList<GameTeam> teamsAlive = new ArrayList<GameTeam>();
|
||||
|
||||
for (GameTeam team : this.GetTeamList())
|
||||
for (GameTeam team : GetTeamList())
|
||||
if (team.GetPlayers(true).size() > 0)
|
||||
teamsAlive.add(team);
|
||||
|
||||
@ -289,147 +193,6 @@ public class TeamSuperSmash extends SuperSmash
|
||||
|
||||
return players;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean CanJoinTeam(GameTeam team)
|
||||
{
|
||||
return team.GetSize() < PlayersPerTeam;
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH)
|
||||
public void teamSelectInteract(PlayerInteractEntityEvent event)
|
||||
{
|
||||
if (GetState() != GameState.Recruit)
|
||||
return;
|
||||
|
||||
if (event.getRightClicked() == null)
|
||||
return;
|
||||
|
||||
if (!(event.getRightClicked() instanceof Player))
|
||||
return;
|
||||
|
||||
Player player = event.getPlayer();
|
||||
|
||||
//Observer
|
||||
if (Manager.IsObserver(player))
|
||||
{
|
||||
UtilPlayer.message(player, F.main("Game", "Spectators cannot partake in games."));
|
||||
return;
|
||||
}
|
||||
|
||||
selectTeamMate(player, (Player)event.getRightClicked());
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void teamSelectCommand(PlayerCommandPreprocessEvent event)
|
||||
{
|
||||
if (GetState() != GameState.Recruit)
|
||||
return;
|
||||
|
||||
if (!event.getMessage().toLowerCase().startsWith("/team "))
|
||||
return;
|
||||
|
||||
event.setCancelled(true);
|
||||
|
||||
Player target = UtilPlayer.searchOnline(event.getPlayer(), event.getMessage().split(" ")[1], true);
|
||||
if (target == null)
|
||||
return;
|
||||
|
||||
//Observer
|
||||
if (Manager.IsObserver(event.getPlayer()))
|
||||
{
|
||||
UtilPlayer.message(event.getPlayer(), F.main("Game", "Spectators cannot partake in games."));
|
||||
return;
|
||||
}
|
||||
|
||||
if (event.getPlayer().equals(target))
|
||||
return;
|
||||
|
||||
selectTeamMate(event.getPlayer(), target);
|
||||
}
|
||||
|
||||
public void selectTeamMate(Player player, Player ally)
|
||||
{
|
||||
//Accept Invite
|
||||
if (_teamReqs.containsKey(ally) && _teamReqs.get(ally).equals(player))
|
||||
{
|
||||
//Remove Prefs
|
||||
_teamReqs.remove(player);
|
||||
_teamReqs.remove(ally);
|
||||
|
||||
//Inform
|
||||
UtilPlayer.message(player, F.main("Game", "You accepted " + ally.getName() + "'s Team Request!"));
|
||||
UtilPlayer.message(ally, F.main("Game", player.getName() + " accepted your Team Request!"));
|
||||
|
||||
//Leave Old Teams
|
||||
if (GetTeam(player) != null)
|
||||
GetTeam(player).DisbandTeam();
|
||||
|
||||
if (GetTeam(ally) != null)
|
||||
GetTeam(ally).DisbandTeam();
|
||||
|
||||
//Get Team
|
||||
GameTeam team = getEmptyTeam();
|
||||
if (team == null)
|
||||
return;
|
||||
|
||||
//Join Team
|
||||
SetPlayerTeam(player, team, true);
|
||||
SetPlayerTeam(ally, team, true);
|
||||
}
|
||||
//Send Invite
|
||||
else
|
||||
{
|
||||
//Already on Team with Target
|
||||
if (GetTeam(player) != null)
|
||||
if (GetTeam(player).HasPlayer(ally))
|
||||
return;
|
||||
|
||||
//Inform Player
|
||||
UtilPlayer.message(player, F.main("Game", "You sent a Team Request to " + ally.getName() + "!"));
|
||||
|
||||
//Inform Target
|
||||
if (Recharge.Instance.use(player, "Team Req " + ally.getName(), 2000, false, false))
|
||||
{
|
||||
UtilPlayer.message(ally, F.main("Game", player.getName() + " sent you a Team Request!"));
|
||||
UtilPlayer.message(ally, F.main("Game", "Type " + F.elem("/team " + player.getName()) + " to accept!"));
|
||||
}
|
||||
|
||||
//Add Pref
|
||||
_teamReqs.put(player, ally);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void teamQuit(PlayerQuitEvent event)
|
||||
{
|
||||
if (GetState() != GameState.Recruit)
|
||||
return;
|
||||
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if (GetTeam(player) != null)
|
||||
GetTeam(player).DisbandTeam();
|
||||
|
||||
Iterator<Player> teamIter = _teamReqs.keySet().iterator();
|
||||
while (teamIter.hasNext())
|
||||
{
|
||||
Player sender = teamIter.next();
|
||||
if (sender.equals(player) || _teamReqs.get(sender).equals(player))
|
||||
teamIter.remove();
|
||||
}
|
||||
}
|
||||
|
||||
public GameTeam getEmptyTeam()
|
||||
{
|
||||
for (GameTeam team : GetTeamList())
|
||||
{
|
||||
if (team.GetPlayers(false).isEmpty())
|
||||
return team;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String GetMode()
|
||||
|
@ -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";
|
||||
}
|
||||
|
||||
}
|
@ -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)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -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";
|
||||
}
|
||||
|
||||
}
|
@ -15,6 +15,10 @@ import nautilus.game.arcade.events.GameStateChangeEvent;
|
||||
import nautilus.game.arcade.game.GameTeam;
|
||||
import nautilus.game.arcade.game.Game.GameState;
|
||||
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.entity.Player;
|
||||
@ -27,7 +31,27 @@ public class SoloSurvivalGames extends SurvivalGames
|
||||
|
||||
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[]
|
||||
{
|
||||
"Search for chests to find loot",
|
||||
@ -39,8 +63,7 @@ public class SoloSurvivalGames extends SurvivalGames
|
||||
"Last tribute alive wins!"
|
||||
});
|
||||
|
||||
this.DamageTeamSelf = true;
|
||||
|
||||
this.DamageTeamSelf = true;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
|
@ -257,21 +257,6 @@ public abstract class SurvivalGames extends Game
|
||||
{
|
||||
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
|
||||
@ -311,7 +296,7 @@ public abstract class SurvivalGames extends Game
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
private ItemStack buildCompass(int uses)
|
||||
protected ItemStack buildCompass(int uses)
|
||||
{
|
||||
ItemBuilder item = new ItemBuilder(Material.COMPASS);
|
||||
item.setTitle(C.cWhite + "Player Tracker" + buildTime());
|
||||
@ -716,7 +701,7 @@ public abstract class SurvivalGames extends Game
|
||||
event.blockList().clear();
|
||||
}
|
||||
|
||||
private void fillChest(Player looter, Block block)
|
||||
public void fillChest(Player looter, Block block)
|
||||
{
|
||||
_lootedBlocks.add(block.getLocation());
|
||||
|
||||
@ -790,7 +775,7 @@ public abstract class SurvivalGames extends Game
|
||||
_supplyCrates.remove(block);
|
||||
}
|
||||
|
||||
private ItemStack GetChestItem(boolean superChest)
|
||||
protected ItemStack GetChestItem(boolean superChest)
|
||||
{
|
||||
if (superChest)
|
||||
return _crateLoot.getLoot();
|
||||
@ -1497,7 +1482,7 @@ public abstract class SurvivalGames extends Game
|
||||
_hiddenNames.remove(event.getPlayer());
|
||||
}
|
||||
|
||||
private void setupChestsEnchantingCrafting()
|
||||
public void setupChestsEnchantingCrafting()
|
||||
{
|
||||
ArrayList<Location> chests = WorldData.GetCustomLocs("54");
|
||||
|
||||
@ -1543,7 +1528,7 @@ public abstract class SurvivalGames extends Game
|
||||
}
|
||||
}
|
||||
|
||||
private void setupLoot()
|
||||
public void setupLoot()
|
||||
{
|
||||
// Food
|
||||
_baseLoot.addLoot(new RandomItem(Material.BAKED_POTATO, 30, 1, 3));
|
||||
@ -2062,27 +2047,72 @@ public abstract class SurvivalGames extends Game
|
||||
|
||||
public int getSecondsSinceStart()
|
||||
{
|
||||
return this._secondsSinceStart;
|
||||
return _secondsSinceStart;
|
||||
}
|
||||
|
||||
public int getChestRefillTime()
|
||||
{
|
||||
return this._chestRefillTime;
|
||||
return _chestRefillTime;
|
||||
}
|
||||
|
||||
public int getDeathMatchTime()
|
||||
{
|
||||
return this._deathMatchTime;
|
||||
return _deathMatchTime;
|
||||
}
|
||||
|
||||
public boolean isDeathMatchTeleported()
|
||||
{
|
||||
return this._deathMatchTeleported;
|
||||
return _deathMatchTeleported;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -18,6 +18,10 @@ import nautilus.game.arcade.GameType;
|
||||
import nautilus.game.arcade.events.GameStateChangeEvent;
|
||||
import nautilus.game.arcade.game.GameTeam;
|
||||
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.Location;
|
||||
@ -31,12 +35,6 @@ import org.bukkit.event.player.PlayerQuitEvent;
|
||||
public class TeamSurvivalGames extends SurvivalGames
|
||||
{
|
||||
|
||||
public boolean ForceTeamSize = true;
|
||||
public int PlayersPerTeam = 2;
|
||||
public int TeamCount = 0;
|
||||
|
||||
private NautHashMap<Player, Player> _teamReqs = new NautHashMap<Player, Player>();
|
||||
|
||||
public TeamSurvivalGames(ArcadeManager manager)
|
||||
{
|
||||
super(manager, GameType.SurvivalGamesTeams,
|
||||
@ -51,123 +49,32 @@ public class TeamSurvivalGames extends SurvivalGames
|
||||
"Last team alive wins!"
|
||||
});
|
||||
|
||||
this.PlayersPerTeam = 2;
|
||||
this.FillTeamsInOrderToCount = 2;
|
||||
PlayersPerTeam = 2;
|
||||
FillTeamsInOrderToCount = 2;
|
||||
|
||||
this.SpawnNearAllies = true;
|
||||
this.SpawnNearEnemies = true;
|
||||
SpawnNearAllies = true;
|
||||
SpawnNearEnemies = true;
|
||||
|
||||
this.DamageTeamSelf = false;
|
||||
DamageTeamSelf = false;
|
||||
|
||||
this.DontAllowOverfill = true;
|
||||
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void CustomTeamGeneration(GameStateChangeEvent event)
|
||||
{
|
||||
if (event.GetState() != GameState.Recruit)
|
||||
return;
|
||||
|
||||
ArrayList<Location> spawns = this.GetTeamList().get(0).GetSpawns();
|
||||
this.GetTeamList().clear();
|
||||
|
||||
TeamColors color = TeamColors.DARK_AQUA;
|
||||
|
||||
if(!this.ForceTeamSize)
|
||||
{
|
||||
for(int i = 1; i <= this.TeamCount; i++)
|
||||
{
|
||||
color = getNextColor(color);
|
||||
GameTeam team = new GameTeam(this, String.valueOf(i), color.getColor(), spawns);
|
||||
team.SetVisible(true);
|
||||
GetTeamList().add(team);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for(int i = 1; i <= Manager.GetPlayerFull() / this.PlayersPerTeam; i++)
|
||||
{
|
||||
//Got Spawns
|
||||
color = getNextColor(color);
|
||||
int e = 0;
|
||||
for(GameTeam teams : GetTeamList())
|
||||
{
|
||||
if(teams.GetColor() == color.getColor())
|
||||
{
|
||||
e++;
|
||||
if(getColorName(color.getColor()).length <= e)
|
||||
{
|
||||
e = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
GameTeam team = new GameTeam(this, getColorName(color.getColor())[e], color.getColor(), spawns, true);
|
||||
team.SetVisible(true);
|
||||
GetTeamList().add(team);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private enum TeamColors
|
||||
{
|
||||
|
||||
YELLOW(ChatColor.YELLOW, new String[]{"Banana", "Sunshine", "Custard", "Sponge", "Star", "Giraffe", "Lego", "Light"}),
|
||||
GREEN(ChatColor.GREEN, new String[]{"Creepers", "Alien", "Seaweed", "Emerald", "Grinch", "Shrub", "Snake", "Leaf"}),
|
||||
AQUA(ChatColor.AQUA, new String[]{"Diamond", "Ice", "Pool", "Kraken", "Aquatic", "Ocean"}),
|
||||
RED(ChatColor.RED, new String[]{"Heart", "Tomato", "Ruby", "Jam", "Rose", "Apple", "TNT"}),
|
||||
GOLD(ChatColor.GOLD, new String[]{"Mango", "Foxes", "Sunset", "Nuggets", "Lion", "Desert", "Gapple"}),
|
||||
LIGHT_PURPLE(ChatColor.LIGHT_PURPLE, new String[]{"Dream", "Cupcake", "Cake", "Candy", "Unicorn"}),
|
||||
DARK_BLUE(ChatColor.DARK_BLUE, new String[]{"Squid", "Lapis", "Sharks", "Galaxy", "Empoleon"}),
|
||||
DARK_RED(ChatColor.DARK_RED, new String[]{"Rose", "Apple", "Twizzler", "Rocket", "Blood"}),
|
||||
WHITE(ChatColor.WHITE, new String[]{"Ghosts", "Spookies", "Popcorn", "Seagull", "Rice", "Snowman", "Artic"}),
|
||||
BLUE(ChatColor.BLUE, new String[]{"Sky", "Whale", "Lake", "Birds", "Bluebird", "Piplup"}),
|
||||
DARK_GREEN(ChatColor.DARK_GREEN, new String[]{"Forest", "Zombies", "Cactus", "Slime", "Toxic", "Poison"}),
|
||||
DARK_PURPLE(ChatColor.DARK_PURPLE, new String[]{"Amethyst", "Slugs", "Grape", "Witch", "Magic", "Zula"}),
|
||||
DARK_AQUA(ChatColor.DARK_AQUA, new String[]{"Snorlax", "Aquatic", "Clam", "Fish"});
|
||||
|
||||
private ChatColor color;
|
||||
private String[] names;
|
||||
|
||||
private TeamColors(ChatColor color, String[] names)
|
||||
{
|
||||
this.color = color;
|
||||
this.names = names;
|
||||
}
|
||||
|
||||
public ChatColor getColor()
|
||||
{
|
||||
return color;
|
||||
}
|
||||
|
||||
public String[] getNames()
|
||||
{
|
||||
return names;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private String[] getColorName(ChatColor color)
|
||||
{
|
||||
for(TeamColors colors : TeamColors.values())
|
||||
{
|
||||
if(colors.getColor() == color)
|
||||
{
|
||||
return colors.getNames();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private TeamColors getNextColor(TeamColors color)
|
||||
{
|
||||
for(TeamColors colors : TeamColors.values()) {
|
||||
if(colors.ordinal() == color.ordinal() + 1)
|
||||
{
|
||||
return colors;
|
||||
}
|
||||
}
|
||||
return TeamColors.YELLOW;
|
||||
DontAllowOverfill = true;
|
||||
TeamMode = true;
|
||||
PlayerTeamSelection = true;
|
||||
|
||||
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)
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -185,7 +92,7 @@ public class TeamSurvivalGames extends SurvivalGames
|
||||
Scoreboard.WriteBlank();
|
||||
|
||||
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.Write(C.cYellow + C.Bold + "Teams");
|
||||
@ -221,21 +128,21 @@ public class TeamSurvivalGames extends SurvivalGames
|
||||
|
||||
Scoreboard.WriteBlank();
|
||||
|
||||
if (this.getChestRefillTime() > 0 && this.getDeathMatchTime() > 60)
|
||||
if (getChestRefillTime() > 0 && getDeathMatchTime() > 60)
|
||||
{
|
||||
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(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
|
||||
{
|
||||
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();
|
||||
@ -249,7 +156,7 @@ public class TeamSurvivalGames extends SurvivalGames
|
||||
|
||||
ArrayList<GameTeam> teamsAlive = new ArrayList<GameTeam>();
|
||||
|
||||
for (GameTeam team : this.GetTeamList())
|
||||
for (GameTeam team : GetTeamList())
|
||||
if (team.GetPlayers(true).size() > 0)
|
||||
teamsAlive.add(team);
|
||||
|
||||
@ -302,147 +209,6 @@ public class TeamSurvivalGames extends SurvivalGames
|
||||
|
||||
return players;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean CanJoinTeam(GameTeam team)
|
||||
{
|
||||
return team.GetSize() < PlayersPerTeam;
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH)
|
||||
public void teamSelectInteract(PlayerInteractEntityEvent event)
|
||||
{
|
||||
if (GetState() != GameState.Recruit)
|
||||
return;
|
||||
|
||||
if (event.getRightClicked() == null)
|
||||
return;
|
||||
|
||||
if (!(event.getRightClicked() instanceof Player))
|
||||
return;
|
||||
|
||||
Player player = event.getPlayer();
|
||||
|
||||
//Observer
|
||||
if (Manager.IsObserver(player))
|
||||
{
|
||||
UtilPlayer.message(player, F.main("Game", "Spectators cannot partake in games."));
|
||||
return;
|
||||
}
|
||||
|
||||
selectTeamMate(player, (Player)event.getRightClicked());
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void teamSelectCommand(PlayerCommandPreprocessEvent event)
|
||||
{
|
||||
if (GetState() != GameState.Recruit)
|
||||
return;
|
||||
|
||||
if (!event.getMessage().toLowerCase().startsWith("/team "))
|
||||
return;
|
||||
|
||||
event.setCancelled(true);
|
||||
|
||||
Player target = UtilPlayer.searchOnline(event.getPlayer(), event.getMessage().split(" ")[1], true);
|
||||
if (target == null)
|
||||
return;
|
||||
|
||||
//Observer
|
||||
if (Manager.IsObserver(event.getPlayer()))
|
||||
{
|
||||
UtilPlayer.message(event.getPlayer(), F.main("Game", "Spectators cannot partake in games."));
|
||||
return;
|
||||
}
|
||||
|
||||
if (event.getPlayer().equals(target))
|
||||
return;
|
||||
|
||||
selectTeamMate(event.getPlayer(), target);
|
||||
}
|
||||
|
||||
public void selectTeamMate(Player player, Player ally)
|
||||
{
|
||||
//Accept Invite
|
||||
if (_teamReqs.containsKey(ally) && _teamReqs.get(ally).equals(player))
|
||||
{
|
||||
//Remove Prefs
|
||||
_teamReqs.remove(player);
|
||||
_teamReqs.remove(ally);
|
||||
|
||||
//Inform
|
||||
UtilPlayer.message(player, F.main("Game", "You accepted " + ally.getName() + "'s Team Request!"));
|
||||
UtilPlayer.message(ally, F.main("Game", player.getName() + " accepted your Team Request!"));
|
||||
|
||||
//Leave Old Teams
|
||||
if (GetTeam(player) != null)
|
||||
GetTeam(player).DisbandTeam();
|
||||
|
||||
if (GetTeam(ally) != null)
|
||||
GetTeam(ally).DisbandTeam();
|
||||
|
||||
//Get Team
|
||||
GameTeam team = getEmptyTeam();
|
||||
if (team == null)
|
||||
return;
|
||||
|
||||
//Join Team
|
||||
SetPlayerTeam(player, team, true);
|
||||
SetPlayerTeam(ally, team, true);
|
||||
}
|
||||
//Send Invite
|
||||
else
|
||||
{
|
||||
//Already on Team with Target
|
||||
if (GetTeam(player) != null)
|
||||
if (GetTeam(player).HasPlayer(ally))
|
||||
return;
|
||||
|
||||
//Inform Player
|
||||
UtilPlayer.message(player, F.main("Game", "You sent a Team Request to " + ally.getName() + "!"));
|
||||
|
||||
//Inform Target
|
||||
if (Recharge.Instance.use(player, "Team Req " + ally.getName(), 2000, false, false))
|
||||
{
|
||||
UtilPlayer.message(ally, F.main("Game", player.getName() + " sent you a Team Request!"));
|
||||
UtilPlayer.message(ally, F.main("Game", "Type " + F.elem("/team " + player.getName()) + " to accept!"));
|
||||
}
|
||||
|
||||
//Add Pref
|
||||
_teamReqs.put(player, ally);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void teamQuit(PlayerQuitEvent event)
|
||||
{
|
||||
if (GetState() != GameState.Recruit)
|
||||
return;
|
||||
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if (GetTeam(player) != null)
|
||||
GetTeam(player).DisbandTeam();
|
||||
|
||||
Iterator<Player> teamIter = _teamReqs.keySet().iterator();
|
||||
while (teamIter.hasNext())
|
||||
{
|
||||
Player sender = teamIter.next();
|
||||
if (sender.equals(player) || _teamReqs.get(sender).equals(player))
|
||||
teamIter.remove();
|
||||
}
|
||||
}
|
||||
|
||||
public GameTeam getEmptyTeam()
|
||||
{
|
||||
for (GameTeam team : GetTeamList())
|
||||
{
|
||||
if (team.GetPlayers(false).isEmpty())
|
||||
return team;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String GetMode()
|
||||
|
@ -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";
|
||||
}
|
||||
|
||||
}
|
@ -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";
|
||||
}
|
||||
|
||||
}
|
@ -124,7 +124,20 @@ public class UHC extends TeamGame
|
||||
|
||||
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[]
|
||||
{
|
||||
@ -207,14 +220,6 @@ public class UHC extends TeamGame
|
||||
|
||||
_createTime = System.currentTimeMillis();
|
||||
_serverTime = Utility.currentTimeMillis();
|
||||
|
||||
registerChatStats(
|
||||
Kills,
|
||||
Assists,
|
||||
BlankLine,
|
||||
DamageTaken,
|
||||
DamageDealt
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -389,7 +394,7 @@ public class UHC extends TeamGame
|
||||
|
||||
// Timings
|
||||
TimingManager.startTotal("UHC Generation");
|
||||
|
||||
|
||||
for (int i = 0; i < _chunksPerTick ; i++)
|
||||
{
|
||||
// Unload Previous
|
||||
@ -1599,6 +1604,9 @@ public class UHC extends TeamGame
|
||||
if (visible)
|
||||
break;
|
||||
}
|
||||
|
||||
if(visible)
|
||||
setOreType(vein);
|
||||
|
||||
// Remove Vein
|
||||
if (!visible)
|
||||
@ -1621,6 +1629,11 @@ public class UHC extends TeamGame
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void setOreType(ArrayList<Block> blocks)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public boolean isMapLoaded()
|
||||
{
|
||||
|
@ -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";
|
||||
}
|
||||
|
||||
}
|
@ -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";
|
||||
}
|
||||
|
||||
}
|
@ -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";
|
||||
}
|
||||
|
||||
}
|
@ -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";
|
||||
}
|
||||
|
||||
}
|
@ -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);
|
||||
}
|
||||
}
|
@ -1,9 +1,20 @@
|
||||
package nautilus.game.arcade.managers;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.ParameterizedType;
|
||||
import java.lang.reflect.Type;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
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.UtilServer;
|
||||
@ -14,17 +25,12 @@ import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.minecraft.game.core.combat.CombatManager.AttackReason;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.GameMode;
|
||||
import nautilus.game.arcade.GameType;
|
||||
import nautilus.game.arcade.game.Game;
|
||||
import nautilus.game.arcade.game.Game.GameState;
|
||||
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
|
||||
{
|
||||
ArcadeManager Manager;
|
||||
@ -34,10 +40,12 @@ public class GameCreationManager implements Listener
|
||||
private GameType _nextGame = null;
|
||||
|
||||
private String _lastMap = "";
|
||||
private String _lastMode = "";
|
||||
private ArrayList<GameType> _lastGames = new ArrayList<GameType>();
|
||||
|
||||
public String MapPref = null;
|
||||
public String MapSource = null;
|
||||
public String ModePref = null;
|
||||
|
||||
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(MapPref == null ? "Map Pref = null" : "Map Pref = " + MapPref);
|
||||
|
||||
System.out.println(ModePref == null ? "Gamemode Pref = null" : "Gamemode Pref = " + ModePref);
|
||||
|
||||
//Chosen Game
|
||||
if (_nextGame != null)
|
||||
{
|
||||
@ -186,6 +196,7 @@ public class GameCreationManager implements Listener
|
||||
for (int i=0 ; i<50 ; i++)
|
||||
{
|
||||
gameType = Manager.GetGameList().get(UtilMath.r(Manager.GetGameList().size()));
|
||||
ModePref = randomGameMode(gameType);
|
||||
|
||||
if (!_lastGames.contains(gameType))
|
||||
break;
|
||||
@ -196,10 +207,42 @@ public class GameCreationManager implements Listener
|
||||
Manager.toggleChampionsModules(gameType);
|
||||
|
||||
_lastGames.add(0, gameType);
|
||||
|
||||
|
||||
boolean setVars = false;
|
||||
|
||||
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);
|
||||
}
|
||||
@ -233,9 +276,277 @@ public class GameCreationManager implements Listener
|
||||
UtilServer.getServer().getPluginManager().registerEvents(Manager.GetGame(), Manager.getPlugin());
|
||||
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)
|
||||
{
|
||||
_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;
|
||||
}
|
||||
}
|
||||
|
@ -3,8 +3,19 @@ package nautilus.game.arcade.managers;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.HashMap;
|
||||
|
||||
import mineplex.core.account.event.GetClientEvent;
|
||||
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.common.Rank;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
@ -20,22 +31,11 @@ import nautilus.game.arcade.events.FirstBloodEvent;
|
||||
import nautilus.game.arcade.events.GameStateChangeEvent;
|
||||
import nautilus.game.arcade.events.PlayerStateChangeEvent;
|
||||
import nautilus.game.arcade.game.Game;
|
||||
import nautilus.game.arcade.game.GemData;
|
||||
import nautilus.game.arcade.game.Game.GameState;
|
||||
import nautilus.game.arcade.game.GameTeam.PlayerState;
|
||||
import nautilus.game.arcade.game.GemData;
|
||||
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
|
||||
{
|
||||
ArcadeManager Manager;
|
||||
@ -182,6 +182,8 @@ public class GameGemManager implements Listener
|
||||
if (game.GemBoosterEnabled)
|
||||
total += (int)(earned * game.GetGemBoostAmount());
|
||||
|
||||
int shards = total;
|
||||
|
||||
//Gem Finder
|
||||
if (game.GemHunterEnabled)
|
||||
{
|
||||
@ -210,8 +212,20 @@ public class GameGemManager implements Listener
|
||||
|
||||
if (DoubleGem && game.GemDoubleEnabled)
|
||||
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().RewardCoins(null, "Earned", player.getName(), Manager.GetClients().getAccountId(player), shards);
|
||||
|
||||
//Stats
|
||||
Manager.GetStatsManager().incrementStat(player, "Global.GemsEarned", total);
|
||||
@ -299,6 +313,8 @@ public class GameGemManager implements Listener
|
||||
|
||||
totalGems += earnedGems * game.GetGemBoostAmount();
|
||||
}
|
||||
|
||||
int shards = totalGems;
|
||||
|
||||
//Gem Finder
|
||||
if (game.GemHunterEnabled)
|
||||
@ -344,13 +360,38 @@ public class GameGemManager implements Listener
|
||||
|
||||
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
|
||||
UtilPlayer.message(player, "");
|
||||
if (give)
|
||||
{
|
||||
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
|
||||
{
|
||||
|
@ -7,6 +7,36 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
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.common.Rank;
|
||||
import mineplex.core.common.util.C;
|
||||
@ -41,36 +71,6 @@ import nautilus.game.arcade.kit.Kit;
|
||||
import nautilus.game.arcade.kit.KitAvailability;
|
||||
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 ArcadeManager Manager;
|
||||
@ -355,7 +355,7 @@ public class GameLobbyManager implements Listener
|
||||
}
|
||||
|
||||
//UHC
|
||||
if (game.GetType() == GameType.UHC)
|
||||
if (game.GetType() == GameType.UHC || game.getClass().getSuperclass().equals(UHC.class))
|
||||
{
|
||||
if (game.GetTeamList().size() > 1)
|
||||
{
|
||||
@ -548,7 +548,7 @@ public class GameLobbyManager implements Listener
|
||||
block.setType(_kitBlocks.get(block));
|
||||
_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(" ", 1, 159, (byte)4);
|
||||
@ -989,10 +989,10 @@ public class GameLobbyManager implements Listener
|
||||
{
|
||||
WriteGameLine(game.GetType().GetLobbyName(), 0, 159, (byte)14);
|
||||
|
||||
if (game.GetMode() == null)
|
||||
if (Manager.GetGame().GetMode() == null)
|
||||
WriteGameLine(" ", 1, 159, (byte)1);
|
||||
else
|
||||
WriteGameLine(game.GetMode(), 1, 159, (byte)1);
|
||||
WriteGameLine(Manager.GetGame().GetMode(), 1, 159, (byte)1);
|
||||
|
||||
DisplayWaiting();
|
||||
CreateKits(game);
|
||||
|
@ -90,7 +90,7 @@ public class ExperienceStatTracker extends StatTracker<Game>
|
||||
mult = 1.5;
|
||||
|
||||
//Exp
|
||||
int expGained = (int)((timeExp + gemExp)*mult);
|
||||
int expGained = (int)(((timeExp + gemExp)*mult)*getGame().XpMult);
|
||||
|
||||
//Record Global and per Game
|
||||
addStat(player, "ExpEarned", expGained, false, true);
|
||||
|
Loading…
Reference in New Issue
Block a user