示例#1
0
 protected void buttonClicked(Button btn) {
   if (btn.equals(recordButton)) {
     recording = !recording;
     updateRecordButton();
   }
   if (btn.equals(doneButton)) {
     item.setTitle(commandText.getText());
     if (!item.getTitle().equals("") && item.getKey() != -1) {
       SimpleKeyBindingManager manager =
           (SimpleKeyBindingManager) SpoutClient.getInstance().getKeyBindingManager();
       manager.unregisterShortcut(item);
       manager.registerShortcut(item);
     }
     mc.displayGuiScreen(parent);
     parent.getModel().refresh();
   }
   if (btn.equals(addButton)) {
     editCommand(-1);
   }
   if (btn.equals(editButton)) {
     editCommand(slot.getSelectedRow());
   }
   if (btn.equals(removeButton)) {
     item.removeCommand(slot.getSelectedRow());
     slot.updateItems();
     updateButtons();
   }
 }
示例#2
0
 protected void keyTyped(char c, int i) {
   if (recording && !SimpleKeyBindingManager.isModifierKey(i)) {
     item.setKey(i);
     item.setRawModifiers((byte) 0);
     SimpleKeyBindingManager.setModifiersToShortcut(item);
     recording = false;
     updateRecordButton();
   } else {
     super.keyTyped(c, i);
   }
 }
示例#3
0
 protected void keyTyped(char c, int i, boolean pressed) {
   ControlsBasicItem item = model.getEditingItem();
   if (item != null) {
     if (item.useModifiers() && (!SimpleKeyBindingManager.isModifierKey(i) && pressed)
         || (SimpleKeyBindingManager.isModifierKey(i) && !pressed)) {
       item.setModifiers(SimpleKeyBindingManager.getPressedModifiers());
       item.setKey(i);
       model.finishEdit();
     } else if (!item.useModifiers()) {
       item.setKey(i);
       model.finishEdit();
     }
   }
 }
示例#4
0
 @Override
 protected void mouseClicked(int x, int y, int button) {
   ControlsBasicItem item = model.getEditingItem();
   if (item != null && item.useMouseButtons()) {
     item.setModifiers(SimpleKeyBindingManager.getPressedModifiers());
     item.setKey(SimpleKeyBindingManager.MOUSE_OFFSET + button);
     model.finishEdit();
   }
 }
示例#5
0
 public void deleteCurrentControl() {
   SimpleKeyBindingManager man =
       (SimpleKeyBindingManager) SpoutClient.getInstance().getKeyBindingManager();
   ControlsBasicItem item = model.getItem(view.getSelectedRow());
   ShortcutBindingItem sh = null;
   if (item != null && item instanceof ShortcutBindingItem) {
     sh = (ShortcutBindingItem) item;
   }
   KeyBindingItem binding = null;
   if (item != null && item instanceof KeyBindingItem) {
     binding = (KeyBindingItem) item;
   }
   if (sh != null) {
     man.unregisterShortcut(sh.getShortcut());
     man.save();
   } else if (binding != null) {
     man.unregisterControl(binding.getBinding());
     man.save();
     model.refresh();
   } else {
     item.setKey(-128);
   }
   model.refresh();
 }
示例#6
0
  private SpoutClient() {
    instance = this;
    securityKey = (new Random()).nextDouble();
    securityThreadGroup = new ThreadGroup("Sandboxed Threads");
    securityManager =
        new SimpleSecurityManager(securityKey, securityThreadGroup, Thread.currentThread());
    if (!Thread.currentThread().getName().equals("Minecraft main thread")) {
      throw new SecurityException("Main thread name mismatch");
    }
    addonManager = new SimpleAddonManager(this, commandMap, securityManager, securityKey);
    // System.setSecurityManager(securityManager);

    ((SimpleKeyBindingManager) bindingManager).load();
    addonStore.load();
    serverManager.init();
    Log.setVerbose(false);
    Log.setLogSystem(new SilencedLogSystem());
  }