Twitch Prep

MAC changes
This commit is contained in:
Chiss 2014-05-02 14:35:41 +10:00
parent c1360c63f0
commit 1d4d98b910
18 changed files with 199 additions and 22 deletions

View File

@ -304,9 +304,9 @@ public class AntiHack extends MiniPlugin
out = out.substring(0, out.length() - 2); out = out.substring(0, out.length() - 2);
String severity = ""; String severity = "";
if (total > 18) severity = "Extreme"; if (total > 24) severity = "Extreme";
else if (total > 12) severity = "High"; else if (total > 16) severity = "High";
else if (total > 6) severity = "Medium"; else if (total > 8) severity = "Medium";
else severity = "Low"; else severity = "Low";
//Send Report //Send Report

View File

@ -161,7 +161,9 @@ public class IncendiaryShot extends SkillActive
Entity arrow = arrowIterator.next(); Entity arrow = arrowIterator.next();
if (arrow.isDead() || !arrow.isValid() || arrow.isOnGround()) if (arrow.isDead() || !arrow.isValid() || arrow.isOnGround())
{
arrowIterator.remove(); arrowIterator.remove();
}
} }
} }

View File

@ -153,6 +153,10 @@ public class Arcade extends JavaPlugin implements INautilusPlugin
{ {
config.MaxPlayers = Integer.parseInt(tokens[1]); config.MaxPlayers = Integer.parseInt(tokens[1]);
} }
else if (tokens[0].equals("TOURNAMENT"))
{
config.Tournament = Boolean.parseBoolean(tokens[1]);
}
//Games //Games
else else
{ {
@ -193,6 +197,7 @@ public class Arcade extends JavaPlugin implements INautilusPlugin
config.ServerType = "Minigames"; config.ServerType = "Minigames";
config.MinPlayers = 8; config.MinPlayers = 8;
config.MaxPlayers = 16; config.MaxPlayers = 16;
config.Tournament = false;
return config; return config;
} }
@ -207,6 +212,7 @@ public class Arcade extends JavaPlugin implements INautilusPlugin
out.write("SERVER_TYPE=" + config.ServerType + "\n"); out.write("SERVER_TYPE=" + config.ServerType + "\n");
out.write("PLAYERS_MIN=" + config.MinPlayers + "\n"); out.write("PLAYERS_MIN=" + config.MinPlayers + "\n");
out.write("PLAYERS_MAX=" + config.MaxPlayers + "\n"); out.write("PLAYERS_MAX=" + config.MaxPlayers + "\n");
out.write("\nTOURNAMENT=" + config.Tournament + "\n");
out.write("\n\nGames List;\n"); out.write("\n\nGames List;\n");
for (GameType type : GameType.values()) for (GameType type : GameType.values())

View File

@ -630,4 +630,9 @@ public class ArcadeManager extends MiniPlugin implements IRelation
event.SetCancelled(true); event.SetCancelled(true);
} }
} }
public boolean IsTournamentServer()
{
return _serverConfig.Tournament;
}
} }

View File

@ -14,6 +14,7 @@ public class GameCommand extends MultiCommandBase<ArcadeManager>
AddCommand(new StartCommand(Plugin)); AddCommand(new StartCommand(Plugin));
AddCommand(new StopCommand(Plugin)); AddCommand(new StopCommand(Plugin));
AddCommand(new SetCommand(Plugin));
} }
@Override @Override

View File

@ -0,0 +1,86 @@
package nautilus.game.arcade.command;
import java.util.ArrayList;
import org.bukkit.entity.Player;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType;
import nautilus.game.arcade.game.Game.GameState;
import mineplex.core.command.CommandBase;
import mineplex.core.common.Rank;
import mineplex.core.common.util.C;
public class SetCommand extends CommandBase<ArcadeManager>
{
public SetCommand(ArcadeManager plugin)
{
super(plugin, Rank.ADMIN, "set");
}
@Override
public void Execute(Player caller, String[] args)
{
if (Plugin.GetGame() == null)
return;
if (args.length == 0)
{
caller.sendMessage("/game set <GameType> (Map)");
return;
}
String game = args[0].toLowerCase();
if (args.length > 1)
Plugin.GetGameCreationManager().MapPref = args[1];
//Parse Game
ArrayList<GameType> matches = new ArrayList<GameType>();
for (GameType type : GameType.values())
{
if (type.toString().toLowerCase().equals(game))
{
matches.clear();
matches.add(type);
break;
}
if (type.toString().toLowerCase().contains(game))
{
matches.add(type);
}
}
if (matches.size() == 0)
{
caller.sendMessage("No results for: " + game);
return;
}
if (matches.size() > 1)
{
caller.sendMessage("Matched multiple games;");
for (GameType cur : matches)
caller.sendMessage(cur.toString());
return;
}
GameType type = matches.get(0);
Plugin.GetGameCreationManager().SetNextGameType(type);
//End Current
if (Plugin.GetGame().GetState() == GameState.Recruit)
{
Plugin.GetGame().SetState(GameState.Dead);
Plugin.GetGame().Announce(C.cAqua + C.Bold + caller.getName() + " has changed game to " + type.GetName() + ".");
}
else
{
Plugin.GetGame().Announce(C.cAqua + C.Bold + caller.getName() + " set next game to " + type.GetName() + ".");
}
}
}

View File

@ -161,7 +161,6 @@ public abstract class Game implements Listener
public boolean RepairWeapons = true; public boolean RepairWeapons = true;
public boolean AutoBalance = true;
public boolean AnnounceStay = true; public boolean AnnounceStay = true;
public boolean AnnounceJoinQuit = true; public boolean AnnounceJoinQuit = true;
@ -169,6 +168,8 @@ public abstract class Game implements Listener
public boolean DisplayLobbySide = true; public boolean DisplayLobbySide = true;
//Tourney
public boolean AutoBalance = true;
public boolean AutoStart = true; public boolean AutoStart = true;
public GameState KitRegisterState = GameState.Live; public GameState KitRegisterState = GameState.Live;
@ -210,8 +211,25 @@ public abstract class Game implements Listener
_sideObjective.setDisplaySlot(DisplaySlot.SIDEBAR); _sideObjective.setDisplaySlot(DisplaySlot.SIDEBAR);
_sideObjective.setDisplayName(C.Bold + GetName()); _sideObjective.setDisplayName(C.Bold + GetName());
//Map //Map Select
_files = Manager.LoadFiles(GetName()); _files = Manager.LoadFiles(GetName());
if (Manager.GetGameCreationManager().MapPref != null)
{
ArrayList<String> matches = new ArrayList<String>();
for (String cur : _files)
{
if (cur.toLowerCase().contains(Manager.GetGameCreationManager().MapPref.toLowerCase()))
{
matches.add(cur);
System.out.print("Map Preference: " + cur);
}
}
if (matches.size() > 0)
_files = matches;
Manager.GetGameCreationManager().MapPref = null;
}
WorldData = new WorldData(this); WorldData = new WorldData(this);
System.out.println("Loading " + GetName() + "..."); System.out.println("Loading " + GetName() + "...");
@ -808,7 +826,7 @@ public abstract class Game implements Listener
public boolean CanJoinTeam(GameTeam team) public boolean CanJoinTeam(GameTeam team)
{ {
return AutoBalance ? team.GetSize() < Math.max(1, UtilServer.getPlayers().length/GetTeamList().size()) : true; return (AutoBalance && !Manager.IsTournamentServer()) ? team.GetSize() < Math.max(1, UtilServer.getPlayers().length/GetTeamList().size()) : true;
} }
public GameTeam GetTeamPreference(Player player) public GameTeam GetTeamPreference(Player player)

View File

@ -10,6 +10,7 @@ public class GameServerConfig
public int MinPlayers = -1; public int MinPlayers = -1;
public int MaxPlayers = -1; public int MaxPlayers = -1;
public ArrayList<GameType> GameList = new ArrayList<GameType>(); public ArrayList<GameType> GameList = new ArrayList<GameType>();
public boolean Tournament = false;
public boolean IsValid() public boolean IsValid()
{ {

View File

@ -153,9 +153,8 @@ public class Bridge extends TeamGame implements OreObsfucation
GemMultiplier = 2.5; GemMultiplier = 2.5;
//Tournament //Tournament
QuitOut = true; if (Manager.IsTournamentServer())
AutoStart = true; QuitOut = false;
AutoBalance = true;
} }
@EventHandler @EventHandler

View File

@ -62,7 +62,7 @@ public class DragonEscapeTeams extends TeamGame
new Kit[] new Kit[]
{ {
new KitLeaper(manager), new KitLeaper(manager),
new KitDisruptor(manager), //new KitDisruptor(manager),
new KitWarper(manager), new KitWarper(manager),
}, },

View File

@ -267,7 +267,7 @@ public class DragonsTeams extends TeamGame
GetObjectiveSide().getScore(out).setScore(i++); GetObjectiveSide().getScore(out).setScore(i++);
//Team //Team
out = team.GetColor() + C.Bold + team.GetName() + " Time"; out = team.GetColor() + C.Bold + team.GetName();
if (out.length() >= 16) if (out.length() >= 16)
out = out.substring(0, 15); out = out.substring(0, 15);

View File

@ -26,7 +26,7 @@ public class KitPyrotechnic extends Kit
new Perk[] new Perk[]
{ {
new PerkSparkler(20, 2), new PerkSparkler(25, 2),
}, },
EntityType.ZOMBIE, EntityType.ZOMBIE,
new ItemStack(Material.EMERALD)); new ItemStack(Material.EMERALD));

View File

@ -47,6 +47,12 @@ public abstract class Kit implements Listener
_kitAvailability = kitAvailability; _kitAvailability = kitAvailability;
//Change to Free
if (Manager.IsTournamentServer() && (kitAvailability == KitAvailability.Green || kitAvailability == KitAvailability.Blue))
{
_kitAvailability = KitAvailability.Free;
}
_entityType = entityType; _entityType = entityType;
_itemInHand = itemInHand; _itemInHand = itemInHand;

View File

@ -27,11 +27,12 @@ public class GameCreationManager implements Listener
private ArrayList<Game> _ended = new ArrayList<Game>(); private ArrayList<Game> _ended = new ArrayList<Game>();
private GameType _nextGame = null; private GameType _nextGame = null;
private HashMap<String, ChatColor> _nextGameTeams = null;
private String _lastMap = ""; private String _lastMap = "";
private ArrayList<GameType> _lastGames = new ArrayList<GameType>(); private ArrayList<GameType> _lastGames = new ArrayList<GameType>();
public String MapPref = null;
public GameCreationManager(ArcadeManager manager) public GameCreationManager(ArcadeManager manager)
{ {
Manager = manager; Manager = manager;
@ -133,14 +134,13 @@ public class GameCreationManager implements Listener
HashMap<String, ChatColor> pastTeams = null; HashMap<String, ChatColor> pastTeams = null;
//Round 2 //Chosen Game
if (_nextGame != null && _nextGameTeams != null) if (_nextGame != null)
{ {
gameType = _nextGame; gameType = _nextGame;
pastTeams = _nextGameTeams;
_nextGame = null; _nextGame = null;
_nextGameTeams = null;
System.out.println("Staff Selected GameType: " + gameType);
} }
//Pick Game //Pick Game
@ -169,4 +169,9 @@ public class GameCreationManager implements Listener
UtilServer.getServer().getPluginManager().registerEvents(Manager.GetGame(), Manager.GetPlugin()); UtilServer.getServer().getPluginManager().registerEvents(Manager.GetGame(), Manager.GetPlugin());
} }
public void SetNextGameType(GameType type)
{
_nextGame = type;
}
} }

View File

@ -850,6 +850,9 @@ public class GameFlagManager implements Listener
@EventHandler @EventHandler
public void SpectatorMessage(UpdateEvent event) public void SpectatorMessage(UpdateEvent event)
{ {
if (Manager.IsTournamentServer())
return;
if (Manager.GetGame() == null) if (Manager.GetGame() == null)
return; return;

View File

@ -42,6 +42,9 @@ public class GameGemManager implements Listener
@EventHandler @EventHandler
public void PlayerKillAward(CombatDeathEvent event) public void PlayerKillAward(CombatDeathEvent event)
{ {
if (Manager.IsTournamentServer())
return;
Game game = Manager.GetGame(); Game game = Manager.GetGame();
if (game == null) return; if (game == null) return;
@ -87,6 +90,9 @@ public class GameGemManager implements Listener
@EventHandler @EventHandler
public void PlayerQuit(PlayerQuitEvent event) public void PlayerQuit(PlayerQuitEvent event)
{ {
if (Manager.IsTournamentServer())
return;
Game game = Manager.GetGame(); Game game = Manager.GetGame();
if (game == null) return; if (game == null) return;
@ -96,6 +102,9 @@ public class GameGemManager implements Listener
@EventHandler(priority = EventPriority.MONITOR) @EventHandler(priority = EventPriority.MONITOR)
public void PlayerStateChange(PlayerStateChangeEvent event) public void PlayerStateChange(PlayerStateChangeEvent event)
{ {
if (Manager.IsTournamentServer())
return;
if (event.GetState() != PlayerState.OUT) if (event.GetState() != PlayerState.OUT)
return; return;
@ -108,6 +117,9 @@ public class GameGemManager implements Listener
@EventHandler @EventHandler
public void GameStateChange(GameStateChangeEvent event) public void GameStateChange(GameStateChangeEvent event)
{ {
if (Manager.IsTournamentServer())
return;
if (event.GetState() != GameState.Dead) if (event.GetState() != GameState.Dead)
return; return;
@ -117,6 +129,9 @@ public class GameGemManager implements Listener
public void RewardGems(Game game, Player player, boolean give) public void RewardGems(Game game, Player player, boolean give)
{ {
if (Manager.IsTournamentServer())
return;
if (game.GetType() == GameType.UHC) if (game.GetType() == GameType.UHC)
return; return;
@ -130,6 +145,9 @@ public class GameGemManager implements Listener
public void GiveGems(Game game, Player player, HashMap<String,GemData> gems, double gameMult) public void GiveGems(Game game, Player player, HashMap<String,GemData> gems, double gameMult)
{ {
if (Manager.IsTournamentServer())
return;
if (gems == null) if (gems == null)
return; return;
@ -157,6 +175,9 @@ public class GameGemManager implements Listener
public void AnnounceGems(Game game, Player player, HashMap<String,GemData> gems, boolean give) public void AnnounceGems(Game game, Player player, HashMap<String,GemData> gems, boolean give)
{ {
if (Manager.IsTournamentServer())
return;
if (gems == null) if (gems == null)
return; return;

View File

@ -171,6 +171,8 @@ public class GameLobbyManager implements IPacketRunnable, Listener
} }
} }
public Collection<Scoreboard> GetScoreboards() public Collection<Scoreboard> GetScoreboards()
{ {
return _scoreboardMap.values(); return _scoreboardMap.values();
@ -712,6 +714,28 @@ public class GameLobbyManager implements IPacketRunnable, Listener
return; return;
} }
if (Manager.IsTournamentServer())
{
if (_advertiseStage == 0)
{
WriteAdvertiseLine("TWITCH.TV", 0, 159, (byte)4);
WriteAdvertiseLine("CHARITY EVENT", 1, 159, (byte)15);
WriteAdvertiseLine(" ", 2, 159, (byte)15);
WriteAdvertiseLine("PROUDLY SPONSORED BY", 3, 159, (byte)15);
WriteAdvertiseLine("www.mineplex.com", 4, 159, (byte)4);
}
else if (_advertiseStage == 1)
{
WriteAdvertiseLine("Supporting", 0, 159, (byte)15);
WriteAdvertiseLine("ChildsPlay", 1, 159, (byte)4);
WriteAdvertiseLine("AbleGamers", 2, 159, (byte)4);
WriteAdvertiseLine("Extra Life", 3, 159, (byte)4);
WriteAdvertiseLine("Stand for the Silent", 4, 159, (byte)4);
}
return;
}
if (_advertiseStage == 0) if (_advertiseStage == 0)
{ {
WriteAdvertiseLine("MINEPLEX ULTRA RANK", 0, 159, (byte)4); WriteAdvertiseLine("MINEPLEX ULTRA RANK", 0, 159, (byte)4);

View File

@ -112,7 +112,7 @@ public class GameManager implements Listener
if (game.GetCountdown() != -1) if (game.GetCountdown() != -1)
StateCountdown(game, -1, false); StateCountdown(game, -1, false);
else if (game.AutoStart) else if (game.AutoStart && !Manager.IsTournamentServer())
{ {
if (UtilServer.getPlayers().length >= Manager.GetPlayerFull()) if (UtilServer.getPlayers().length >= Manager.GetPlayerFull())
StateCountdown(game, 20, false); StateCountdown(game, 20, false);
@ -147,7 +147,7 @@ public class GameManager implements Listener
} }
} }
} }
else if (game.GetState() == GameState.Live) else if (game.GetState() == GameState.Live && !Manager.IsTournamentServer())
{ {
if (game.GetType() == GameType.Bridge) if (game.GetType() == GameType.Bridge)
{ {