Exemplo n.º 1
0
 @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);
     }
   }
 }
Exemplo n.º 2
0
 @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();
   }
 }
Exemplo n.º 3
0
 public void handle(Throwable exception) {
   try {
     if (exception instanceof NullPointerException) {
       synchronized (lock) {
         JTable table = ui.getList();
         DefaultTableModel model = (DefaultTableModel) table.getModel();
         Vector<?> data = model.getDataVector();
         for (int i = 0; i < data.size(); i++) {
           Object row = data.get(i);
           if (row == null) data.remove(i);
         }
       }
     }
     exception.printStackTrace();
   } catch (Throwable exception2) {
     exception.printStackTrace();
   }
 }