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);
String severity = "";
if (total > 18) severity = "Extreme";
else if (total > 12) severity = "High";
else if (total > 6) severity = "Medium";
if (total > 24) severity = "Extreme";
else if (total > 16) severity = "High";
else if (total > 8) severity = "Medium";
else severity = "Low";
//Send Report

View File

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

View File

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

View File

@ -630,4 +630,9 @@ public class ArcadeManager extends MiniPlugin implements IRelation
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 StopCommand(Plugin));
AddCommand(new SetCommand(Plugin));
}
@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,14 +161,15 @@ public abstract class Game implements Listener
public boolean RepairWeapons = true;
public boolean AutoBalance = true;
public boolean AnnounceStay = true;
public boolean AnnounceJoinQuit = true;
public boolean AnnounceSilence = true;
public boolean DisplayLobbySide = true;
//Tourney
public boolean AutoBalance = true;
public boolean AutoStart = true;
public GameState KitRegisterState = GameState.Live;
@ -210,8 +211,25 @@ public abstract class Game implements Listener
_sideObjective.setDisplaySlot(DisplaySlot.SIDEBAR);
_sideObjective.setDisplayName(C.Bold + GetName());
//Map
//Map Select
_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);
System.out.println("Loading " + GetName() + "...");
@ -808,7 +826,7 @@ public abstract class Game implements Listener
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)

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -27,10 +27,11 @@ public class GameCreationManager implements Listener
private ArrayList<Game> _ended = new ArrayList<Game>();
private GameType _nextGame = null;
private HashMap<String, ChatColor> _nextGameTeams = null;
private String _lastMap = "";
private ArrayList<GameType> _lastGames = new ArrayList<GameType>();
public String MapPref = null;
public GameCreationManager(ArcadeManager manager)
{
@ -133,14 +134,13 @@ public class GameCreationManager implements Listener
HashMap<String, ChatColor> pastTeams = null;
//Round 2
if (_nextGame != null && _nextGameTeams != null)
//Chosen Game
if (_nextGame != null)
{
gameType = _nextGame;
pastTeams = _nextGameTeams;
_nextGame = null;
_nextGameTeams = null;
System.out.println("Staff Selected GameType: " + gameType);
}
//Pick Game
@ -169,4 +169,9 @@ public class GameCreationManager implements Listener
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
public void SpectatorMessage(UpdateEvent event)
{
if (Manager.IsTournamentServer())
return;
if (Manager.GetGame() == null)
return;

View File

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

View File

@ -170,6 +170,8 @@ public class GameLobbyManager implements IPacketRunnable, Listener
AddPlayerToScoreboards(otherPlayer, null);
}
}
public Collection<Scoreboard> GetScoreboards()
{
@ -711,6 +713,28 @@ public class GameLobbyManager implements IPacketRunnable, Listener
{
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)
{

View File

@ -112,7 +112,7 @@ public class GameManager implements Listener
if (game.GetCountdown() != -1)
StateCountdown(game, -1, false);
else if (game.AutoStart)
else if (game.AutoStart && !Manager.IsTournamentServer())
{
if (UtilServer.getPlayers().length >= Manager.GetPlayerFull())
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)
{