Worldguard API help

Discussion in 'Plugin Development' started by DragonSlayer1920, May 11, 2014.

Thread Status:
Not open for further replies.
  1. Hello, I am trying to use the Worldguard API in my plots plugin. I need help figuring out how to get the current region a player is standing in for a /plot info command.

    Example: The player preforms "/plot info" then it responds with "Your are in (Region Name) and then some more stuff..."

    But I can not figure out how to get the region a player is in, I have looked through other threads, worldguards source, and javadocs and can not find any way to do this.

    I have found a couple working ways from other threads, but once you restart the server it can not find a plot it could find before the restart. Please Help Me Out! :)
     
  2. Offline

    raGan.

  3. @raGan I am still really confused could you help me out.
     
  4. Offline

    RawCode

    type in google world guard tutorial and then try again
     
  5. Offline

    mazentheamazin

  6. Offline

    raGan.

    Konkz likes this.
  7. Offline

    mazentheamazin

    raGan.
    Thats a bit rude, isn't it? If my code is wrong, or even if its absolute crap. Tell me that, how to fix it, and make me better. But, its not right that you just, insult me like that. What you're doing doesn't help anybody in this case, which is not the right attitude that I, and others hope to see from the community of the forums.
     
  8. Offline

    Konkz

    He was a little rude, indeed but you did spoon feed him a reflection. Not only he does not understand that but he will copy and paste it and never learn.

    We are here to help and educate at times, not just give them code - if you continue to do that people will write an on enable method and we will be excepted to give them a full code and let them call it theirs.

    @OP: Here is the World Guard API, do some Google search such as WorldGuard api how to get what region player is in etc.
     
    mazentheamazin likes this.
  9. Offline

    mazentheamazin

    Konkz
    Ah, I see. Thanks for informing me, I'll work on that :)
     
    Konkz likes this.
  10. Offline

    raGan.

    It might have sounded way more rude than originally intended. Konkz is right, you did spoon feed him the code, wich would not be so bad, if OP did not just need one line from that method. Your way of doing what he asked was like shooting birds with a cannon. I wanted to point it out first, but I was not aware of your actual intentions, so I asked. :)
     
    mazentheamazin and Konkz like this.
  11. Offline

    nlthijs48

    DragonSlayer1920 You can get all regions that match the location of the player by getting the RegionManager of the world the player is in. Check the following code:
    Code:java
    1. ApplicableRegionSet regions = plugin.getWorldGuard().getRegionManager(player.getWorld()).getApplicableRegions(player.getLocation());
    2. for(ProtectedRegion r : regions) {
    3. // do something with the found regions
    4. }
    5.  

    'player' holds a player object, 'worldGuard' holds the reference to WorldGuardPlugin.
     
  12. Offline

    raGan.

    nlthijs48
    Why so complicated?
    Code:
    regions.iterator().next()
    Now we gave him full code, so he does not even need to read other people's code.
     
  13. Offline

    RawCode

    sadly there is no way to dislike posts...

    spoonfeeding is way to nowhere
     
Thread Status:
Not open for further replies.

Share This Page