From BlockX/Y/Z to X/Y/Z

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

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

    immapoint

    Hey,

    in my plugin, I need to "convert" block-coordinates to real coordinates (getBlockX/Y/Z to getX/Y/Z).

    Who has an idea? ;D
     
  2. Offline

    Raphfrk

    What do you mean by real coordinates?
     
  3. Offline

    immapoint

    a double value, like in Location.getX(), not an integer, like in Location.getBlockX().
     
  4. Offline

    xupwup

    int a = 100;
    double b = (double) a;

    But why would you want to convert integers to doubles? If I were you I would be converting doubles to integers...
     
  5. Offline

    immapoint

    hm, thanks, but thats not the problem ;) anyway, I found a solution. but now im looking for a way to protect an area, like in towny (claim..) ;O
     
  6. Offline

    Novar234

    if a block is within XYZ and XYZ area specified by the user, cancel any action done to block?
     
  7. Offline

    Guybrush

    I'm quite curious as to why you want to convert them to doubles... I mean, I guess I've added or subtracted .5 from them to get their center... But really, what are you doing?

    Only issue with what Novar234 said is that you likely don't want to protect all areas from everything done by everyone. And just because a block is inside an area, doesn't mean it's not also in a smaller area with different rules... Well, now you're going to have to make a more complicated system unfortunately. My suggestion might be that you force any area in an area to be entirely encompassed by that area. Then you find all areas a block is in and whichever has the smallest x1-x2 value is the area encompassing your block.
     
  8. Offline

    Novar234

    Can something like WorldGuard help you achieve what you want?
     
Thread Status:
Not open for further replies.

Share This Page