@Override
 public void onPlayerMove(PlayerMoveEvent event) {
   if (global.isProtected(event.getTo())
       && !LapisProtect.permissionHandler.has(event.getPlayer(), "lapisprotect.enter")) {
     if (!global.isProtected(event.getFrom())) {
       event.getPlayer().sendRawMessage(global.chatPrefix + "This area is protected.");
       event.setCancelled(true);
     }
   }
 }
示例#2
0
  @Override
  public void onDisable() {
    global.save();

    Logger log = getServer().getLogger();
    log.info(this + " is now disabled!");
  }
示例#3
0
  @Override
  public void onEnable() {
    global.load();

    setupPermissions();

    PluginManager pm = this.getServer().getPluginManager();
    pm.registerEvent(Type.BLOCK_PLACE, blockListener, Priority.Lowest, this);
    pm.registerEvent(Type.BLOCK_BREAK, blockListener, Priority.Lowest, this);
    pm.registerEvent(Type.BLOCK_SPREAD, blockListener, Priority.Lowest, this);
    pm.registerEvent(Type.BLOCK_IGNITE, blockListener, Priority.Lowest, this);
    pm.registerEvent(Type.PLAYER_MOVE, playerListener, Priority.Lowest, this);

    getCommand("protect").setExecutor(protectCommand);

    Logger log = getServer().getLogger();
    log.info(this + " is now enabled!");
  }