Solved need help, world gourd (api)

Discussion in 'Plugin Help/Development/Requests' started by cnc4, Apr 7, 2015.

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

    cnc4

    Hello, i am making a plugin that protect houses, i am using world gourd to protect my city, so I am trying to disable the protection when player is in his home.

    I tryed this:
    Code:
    @EventHandler (priority = EventPriority.LOWEST ,ignoreCancelled =true)
        public void OnPlayerHouseDetect(PlayerInteractEvent e){
            Player p=e.getPlayer();
            Location loc ;
            if(e.getAction().equals(Action.RIGHT_CLICK_BLOCK ) ||(e.getAction().equals(Action.LEFT_CLICK_BLOCK))){
             loc =e.getClickedBlock().getLocation();
           
          
            }
             else
                 loc =p.getLocation();
            ApplicableRegionSet set =WGBukkit.getRegionManager(p.getWorld()).getApplicableRegions(p.getLocation());
            for(ProtectedRegion region : set)
              
                if(region.getId().equals("city")){
                    if(region.contains(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ())){
          
    
               
                   //checking here if the player in his house...
                   system.out.println("Cancelled false"); // I see this pring
               e.setCancelled(false); //nothing happening...
               
              
              
                }
                }
        }
              
            }
    and this:
    Code:
     plugin.protocolManager.addPacketListener(
                      new PacketAdapter(plugin, ListenerPriority.LOWEST,
                              PacketType.Play.Server.BLOCK_CHANGE) {
                          @Override
                        public void onPacketSending(PacketEvent event) {
                         
                            if (event.getPacketType() ==  PacketType.Play.Server.BLOCK_CHANGE) {
                                System.out.println("cancelled false"); //I see this pring.
                                    event.setCancelled(false); // and again nothing happend...
                         }
                        
                        }
                    });
    and nothing help, you have any idea how to make world gourd ignore players in a specific location?
     
  2. Offline

    cnc4

    UP, plz help!
     
  3. Offline

    cnc4

    up still need help.
     
  4. Offline

    timtower Moderator Moderator

    @cnc4 And why not add the player as an owner? And try to put your event on HIGH, might be that some plugins are changing it after yours.
    Also note that interact isn't the same as block break.
     
  5. Offline

    cnc4

    @timtower

    I cant add him as owner bacuase the protection is general to all the city.
    well THX! i just needed to change the event to block break, the prayority to HIGHEST and the ignoreCancelled to false.
    i dont know why change the prayoruty help because i ignore cancelled but whatever. but know i need to do this to every other interct like building and open chests ):
     
  6. Offline

    timtower Moderator Moderator

    @cnc4 The ignore canceled was probably the reason. You want to disable the protection, then the event should fire, if you use ignore canceled = true then worldguard makes sure that you won't get the event.
     
  7. Offline

    cnc4

    @timtower
    Yes but know when i use ignore canceled =false i still need to make my event on highest prayority is i want to cancelled the event.
     
  8. Offline

    timtower Moderator Moderator

  9. Offline

    cnc4

    @timtower

    Make the ignore canceled to true? because then it does not working at all...
     
  10. Offline

    timtower Moderator Moderator

    @cnc4 Don't do that, worldguard will cancel the event, then your things won't even run.
     
  11. Offline

    cnc4

    @timtower

    do what? make ignore canceled to false? because this is the only way it is working.
     
  12. Offline

    timtower Moderator Moderator

    @cnc4 The making it true, just remove the entire ignore part
     
  13. Offline

    cnc4

    @timtower

    Ok, do you know how can i block the world gourd message i think maybe packets but how can I check if the event was not cancelled?
     
  14. Offline

    timtower Moderator Moderator

    @cnc4 You could also make your own protection method instead of stopping worldguard stuff.
    Or add more regions with a different priority.
     
  15. Offline

    cnc4

    @timtower

    Well I dont trust myself enough to make a protection plugin, and different region in other priority wont help me because the priority right now is 0....
     
  16. Offline

    timtower Moderator Moderator

    @cnc4 And why won't stuff besides 0 not work? It is priority over regions that overlap, you can go to 10000 and to -10000, numbers can be bigger.
     
Thread Status:
Not open for further replies.

Share This Page