All pastes #570632 Raw Edit

Unnamed

public java v1 · immutable
·published 2007-06-16 20:08 UTC
rendered paste body
line = line.replaceAll("^\\s+", "");		Block block = Block.ALL;		IRC irc = IRC.getInstance();		Matcher m;		hide = false; // If set to true, will not be written		if (line.split("\\s+").length < 2) return; // If the line has only the timestamp		line = line.substring(line.split("\\s+")[0].length() +1); // Removes timestamp		// Host: Objective 8: Take out the base security systems as fast as you can and prepare to blow up the base!		if (line.matches("[^:]+:.*")) { // If it was someone speaking			RenPlayer plr = RenPlayer.getPlayer(line.substring(0,line.indexOf(":") -1));			String message = "";			if (line.length() > line.indexOf(":") +1) message = line.substring(line.indexOf(":") +1);			if (plr == null) {				plr = new RenPlayer(line.substring(0,line.indexOf(":") -1));			}			if (plr.name.equalsIgnoreCase("host")) {				irc.msg("09Host: " + message);			}			hide = true;		}		// PI layout: id<space>name<severalspaces>score<space>team<tab>ping<tab>ip;port<several spaces>kbps<severalspaces>time		else if ((m = Pattern.compile("(\\d+)\\s+(\\S+)\\s+(\\d+)\\s+(\\S+)\\x09(\\d+)\\x09([^;]+);(\\d+)\\s+(\\d+)\\s+(\\S+)").matcher(line)).find()) {			RenPlayer plr = RenPlayer.getPlayer(m.group(2));			if (plr == null) plr = new RenPlayer(m.group(2));			plr.id = Byte.parseByte(m.group(1));			plr.score = Integer.parseInt(m.group(3));			if (m.group(4).equalsIgnoreCase("GDI")) { plr.team = RenPlayer.Team.GDI; }			else if (m.group(4).equalsIgnoreCase("NOD")) plr.team = RenPlayer.Team.NOD;			else plr.team = RenPlayer.Team.NEUTRAL;			plr.lastPing = Integer.parseInt(m.group(5));			plr.ip = m.group(6);			plr.port = Integer.parseInt(m.group(7));			plr.lastBandwidth = Integer.parseInt(m.group(8));			plr.time = m.group(9).replaceAll("\\.",":");			hide = true;		}		/*		(14:55:54) <+St0rmTest> Unhandled: Westwood Online mode active since 6/15/2007 - 17:27:23 PM		(14:55:55) <+St0rmTest> Unhandled: Gameplay in progress		(14:55:58) <+St0rmTest> Unhandled:      Map : M08.mix		(14:55:58) <+St0rmTest> Unhandled:     Time : 0.00.00		(14:55:59) <+St0rmTest> Unhandled:      Fps : 60		(14:55:59) <+St0rmTest> Unhandled:      GDI : 5/60 players      535217 points		(14:56:00) <+St0rmTest> Unhandled:      NOD : 0/60 players      0 points		*/		else if (line.matches(".* mode active since [^ ]+ - [^ ]+ (AM|PM)")) { 			block = Block.GI;			if (line.substring(0,line.indexOf("mode") -2).equalsIgnoreCase("Westwood Online")) GameInfo.mode = GameInfo.Mode.WOL;			else GameInfo.mode = GameInfo.Mode.GSA;			hide = true;		}		else if (block == Block.GI) {			m = Pattern.compile("Map : (\\S+)").matcher(line);			if (m.find()) {				GameInfo.map = m.group(1);				return;			}			m = Pattern.compile("Time : (\\S+)").matcher(line);			if (m.find()) {				GameInfo.time = m.group(1);				return;			}			m = Pattern.compile("FPS : (\\S+)").matcher(line);			if (m.find()) {				GameInfo.FPS = Byte.parseByte(m.group(1));				return;			}			m = Pattern.compile("GDI : .* (\\d+) points").matcher(line);			if (m.find()) {				GameInfo.pointsGDI = Integer.parseInt(m.group(1));				return;			}			m = Pattern.compile("NOD : .* (\\d+) points").matcher(line);			if (m.find()) {				GameInfo.pointsNod = Integer.parseInt(m.group(1));				block = Block.ALL;				return;			}			hide = true;		}		else if (line.startsWith("_PLAYERKILL ")) {			if (Config.moduleShowKills) {				irc.msg("[04Kill]: " + line.substring(line.indexOf("_PLAYERKILL ")));			}			hide = true;		}		if (!hide) { IRC.getInstance().msg("Unhandled: " + line); }