Bypass Towny Events?

Discussion in 'Plugin Development' started by YogurtSmudge, Jan 21, 2017.

Thread Status:
Not open for further replies.
  1. Offline

    YogurtSmudge

    Hi I'm trying to create a sort of war plugin. That basically allows you to raid other towns in Towny... I have the raiding part done but I have no idea how to bypass the Towny Block Place/Break Event. Anyone have any idea?
    Any help will be awesome, Thanks!
     
  2. Offline

    fireboyev

    1. Set your plugin's block break/place event priority to "HIGH"
    2. event.setCanceled(false)
     
  3. Offline

    YogurtSmudge

    Ok I will try that.

    Ok I tried it. and this is what I came up with but still no luck :(
    Code:
          @EventHandler(priority = EventPriority.HIGH)
          public void onPlace(BlockPlaceEvent e)
          {
              Block block = e.getBlock();
              Player p = e.getPlayer();
             
              if (CMD.isActive == false) {
                  p.sendMessage("error");
                  return;
              }
              if (CMD.isActive == true && block.getType() == Material.OBSIDIAN) {
                  e.setCancelled(false);
                  p.sendMessage("success");
              }
          }
    Did I do anything wrong?
    Also the "CMD.isActive" is toggled through a command. I am 100% that the isActive part is working.
    All I got was the "Outsiders aren't allowed to build" message from Towny.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jan 21, 2017
Thread Status:
Not open for further replies.

Share This Page