public static void signClick(PlayerInteractEvent event, PlayerHolder am) { /// Get our sign final Sign sign = (Sign) event.getClickedBlock().getState(); /// Check to see if sign has correct format (is more efficient than doing string manipulation ) if (!sign.getLine(0).matches("^.[0-9a-fA-F]\\*.*$") && !sign.getLine(0).matches("^\\[.*$")) { return; } final Action action = event.getAction(); if (action != Action.LEFT_CLICK_BLOCK && action != Action.RIGHT_CLICK_BLOCK) { return; } if (action == Action.LEFT_CLICK_BLOCK) { // / Dont let them break the sign event.setCancelled(true); } final ArenaClass ac = ArenaClassController.getClass( MessageUtil.decolorChat(sign.getLine(0)) .replace('*', ' ') .replace('[', ' ') .replace(']', ' ') .trim()); ArenaClassController.changeClass(event.getPlayer(), am, ac); }
public Object parseValue(String value) throws Exception { /// Handle values for this option switch (this) { case HEALTHP: case HEALTH: case POOLMONEY: case WITHINDISTANCE: case MONEY: return Double.valueOf(value); case LEVELRANGE: return MinMax.valueOf(value); case DISGUISEALLAS: return value; case MAGIC: case MAGICP: case HUNGER: case EXPERIENCE: case INVULNERABLE: return Integer.valueOf(value); case FLIGHTSPEED: return Float.valueOf(value); case ENCHANTS: return EffectUtil.parseArg(value, 0, 120); case DOCOMMANDS: return value; case GIVECLASS: return ArenaClassController.getClass(value); case GAMEMODE: GameMode gm; try { gm = GameMode.getByValue(Integer.valueOf(value)); } catch (Throwable e) { gm = GameMode.valueOf(value.toUpperCase()); } return gm; // multiply by number of ticks per second default: break; } return null; }