@Override public void onCommand(String command) { String[] parts = command.split(" "); if (parts[0].equalsIgnoreCase("blockid") && parts.length == 2 && StringTools.isInteger(parts[1])) { synchronized (lock) { blockID = Integer.parseInt(parts[1]); JTable list = ui.getList(); DefaultTableModel model = (DefaultTableModel) list.getModel(); Vector<?> dataVector = model.getDataVector(); dataVector.clear(); model.fireTableDataChanged(); displayText(ChatColor.GRAY + "Block ID for searching is now " + ChatColor.GOLD + blockID); } } else if (parts[0].equalsIgnoreCase("blockradius") && parts.length == 2 && StringTools.isInteger(parts[1])) { synchronized (lock) { radius = Integer.parseInt(parts[1]); displayText( ChatColor.GRAY + "Block radius for searching is now " + ChatColor.GOLD + radius); } } }
@Override public void onStop() { commandManager.unregisterListener("blockid"); commandManager.unregisterListener("blockradius"); ui.setVisible(false); synchronized (lock) { JTable list = ui.getList(); DefaultTableModel model = (DefaultTableModel) list.getModel(); Vector<?> dataVector = model.getDataVector(); dataVector.clear(); model.fireTableDataChanged(); } }