Protecting Areas

Discussion in 'Plugin Development' started by immapoint, Jan 21, 2011.

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


    Ok, next question: ;O
    I'm looking for a way to protect my whole town by setting up an area.
    only townmembers should be able to destroy/build anything in it.

    is there a way?
    i had a simple idea:
    User not townmember? then
         user in specified area? then
    Problem: i wrote a code(ca. 150 lines) to look for these areas, then, find out, if the user is in this area etc. the code was ok, in eclipse AND in a server test. but the server was lagging and, when i destroyed a block, nothing happened...
  2. Offline


    How are you defining areas? And how are you defining townmembers? And how are you checking whether or not a person is in an area? And when are you checking if a person is in an area?
  3. Offline


    defining areas:
    is an area of TownName, from x:20.5, y:20.6 to x:20.6, y:20.7 (z is not required, the whole z-level will be protected.)

    defining townmembers:
    -> UserName is townmember of TownName.

    the users coordinates are x: 20.0 y:20.0 z: 20.0
    the rectangle is from x1.0 y1.0 to x80.0 y90.0
    So, the user is in the area. Means:
    the x-coordinate of the user must be higher than the x-coordinate of the left-bottom edge(1.0) and lower than the x-coordinate of the right-top edge (80.0).
    same with the y-coordinate. higher than 1.0 and lower than 90.0
    that means, the user is in the rectangle/area.

    im checking this, when a user tries to destroy/place a block, so that the user(if he is not in town) is not able to place a block.

    i know, my code is very untidy, hope you can read it ;O

    Hmm, ill try to write a new code, hopefully it works ;O

    Attached Files:

    Last edited by a moderator: May 6, 2016
  4. Offline


    First thing,

    Y is the HEIGHT. x and z are both horizontal. That may help with some of the troubles you're having.

    The next thing is, try to break your problem down into smaller subproblems. Ideally, you want every method to easily fit in a single screen. 8 lines is enough.

    Right now I'm building something similar, but towns are circular (spherical). I need to stop the placement of TNT within the towns.
  5. Offline


    >_______________< i'm so stupid.. xD ok, that should solve my problems ;O

    I think, the problem is, that i'm trying to read 2 files per block-break. thats too much, so i have to read the files while enabling the plugin.

    now i also have 3 more classes that are saving settings of players/the map so i just need to search for matching information ;D
  6. Offline



    also this failed :(
    Hm. I need some help, do u have some ideas how to protect an area? ;O
  7. Offline


    One problem I had with my AreaGuard plugin was another plugin uncanceled the event. Make shire your testing without unneeded plugins first. If this turns out to be the case you can setup priority to be higher.
Thread Status:
Not open for further replies.

Share This Page