Package org.getspout.spoutapi.keyboard

Examples of org.getspout.spoutapi.keyboard.KeyBinding


  @Override
  public void registerBinding(String id, Keyboard defaultKey, String description, BindingExecutionDelegate callback, Plugin plugin) throws IllegalArgumentException {
    if (searchBinding(id, plugin) != null) {
      throw new IllegalArgumentException("This binding is already registered: " + id + " for plugin [" + plugin.getDescription().getName() + "]");
    }
    KeyBinding binding = new KeyBinding(id, defaultKey, description, plugin, callback);
    bindings.put(binding.getUniqueId(), binding);
    for (Player p : Bukkit.getServer().getOnlinePlayers()) {
      if (p instanceof SpoutPlayer) {
        sendKeybinding((SpoutPlayer)p, binding);
      }
    }
View Full Code Here


    return null;
  }

  @Override
  public void summonKey(UUID uniqueId, SpoutPlayer player, Keyboard key, boolean pressed) {
    KeyBinding binding = searchBinding(uniqueId);
    if (binding == null) {
      return;
    }
    String id = binding.getId();
    Plugin plugin = binding.getPlugin();
    if (pressed) {
      try {
        binding.getDelegate().keyPressed(new KeyBindingEvent(player, binding));
      } catch (Exception e) {
        System.out.println("Could not execute Key Press Delegate of plugin [" + plugin.getDescription().getName() + "] for action [" + id + "]!");
        e.printStackTrace();
      }
    } else {
      try {
        binding.getDelegate().keyReleased(new KeyBindingEvent(player, binding));
      } catch (Exception e) {
        System.out.println("Could not execute Key Release Delegate of plugin [" + plugin.getDescription().getName() + "] for action [" + id + "]!");
        e.printStackTrace();
      }
    }
View Full Code Here

TOP

Related Classes of org.getspout.spoutapi.keyboard.KeyBinding

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.