/** Handle Messages. */ public void handleEvent(Message event) { if (event.getMessageType() != Message.PRIVATE_MESSAGE && event.getMessageType() != Message.REMOTE_PRIVATE_MESSAGE) return; Player p = m_botAction.getPlayer(event.getPlayerID()); if (p == null) return; String name = p.getPlayerName(); String msg = event.getMessage(); if (m_opList.isER(name)) { if (msg.startsWith("!autoon")) { cmdOn(name); } else if (msg.startsWith("!autooff")) { cmdOff(name); } else if (msg.startsWith("!listtasks")) { cmdList(name); } else if (msg.startsWith("!addtask ")) { cmdAdd(name, msg.substring(9)); } else if (msg.startsWith("!removetask ")) { cmdRemove(name, msg.substring(12)); } else if (msg.startsWith("!modinfo")) { cmdModInfo(name); } } if (msg.startsWith("!info")) { cmdInfo(name); } else { cmdDefault(name, msg); } }
public DuelPlayer(Player p, duel2bot bot) { staffer = null; name = p.getPlayerName(); this.bot = bot; team = null; teams = new int[6]; ba = bot.ba; rules = null; freq = p.getFrequency(); ship = p.getShipType(); rating = 1000; if (ship > 0) status = IN; else status = SPEC; create = false; registered = false; banned = false; enabled = false; userMID = -1; userIP = ""; bot.lagChecks.add(name.toLowerCase()); user = new UserData(ba, db, name, true); getRules(); sql_setupUser(); }
/** Removes votes of players who have left. */ public void handleEvent(PlayerLeft event) { if (!isEnabled) return; if (tasks.size() == 0) return; Player p = m_botAction.getPlayer(event.getPlayerID()); if (p == null) return; for (int i = 0; i < tasks.size(); i++) { AutoTask c = tasks.get(i); if (c != null) c.removeVote(p.getPlayerName()); } }