Solved Cancel message if event.setCalled = false /HELP

Discussion in 'Plugin Development' started by PeterXonwiiXx, Nov 14, 2015.

Thread Status:
Not open for further replies.
  1. ok this is my code first :/
    Code:
        }
    
        @EventHandler
        public void onBlockPlace(BlockPlaceEvent event) {
            Player player = event.getPlayer();
            Block block = event.getBlock();
            if (player.getPlayer().isOp())
                return;
            if (player.hasPermission("tnt.place.bypass"))
                return;
            if (block.getType() == (Material.TNT)) {
                event.setCancelled((boolean) getConfig().get("falseORtrue"));
                event.getPlayer().sendMessage(format(getConfig().getString("tntplace")));
            }
    when someone set TRUE in config message will be send,,but when its set to FALSE in config then it have to cancel the message,thats all my problem is....

    Thanks in advance,hope it will gonna work later <3
     
  2. Offline

    Scimiguy

    Don't do it like that.

    Check if the "falseORtrue" line in the config is true, and continue with the rest of the code afterwards if so.

    Other than that, I don't know what you're asking
     
  3. yeah thats what i mean but what i tried gave me an error,you maybe have a small example of how to check it,when it gets it from the config settings?

    thank anyway for coming by

    @Scimiguy
     
  4. Offline

    Abyssal

    @PeterXonwiiXx
    Maybe this will work
    Code:
    if(getConfig().getBoolean("falseORtrue") == true){
        if(block.getType() == Material.TNT){
            event.setCancelled(true);
        }
    }
    
     
  5. @Abyssal thanks.will try it out and edit this post if it works

    Thanks <3 did work great and it now does what i want,thanks again,and problem SOLVED
     
    Last edited: Nov 14, 2015
  6. Offline

    Scimiguy

    Spoonfeeding to the rescue! wooooo

    Also, you just spoonfed him value equation on a boolean. Sigh.........................
     
Thread Status:
Not open for further replies.

Share This Page