How to use WorldEdit as a Library to do this? [Opened Again]

Discussion in 'Plugin Development' started by TheWolfBadger, Jul 24, 2014.

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

    TheWolfBadger

    Hello Bukkit Community!

    I am here with another question! This one is about WorldEdit as I don't usually hook with plugins. I am making a Chunk plugin which saves Chunk's and such like a plotMe kind-of plugin. I was wondering how I would disable the world edit event if they make a circle that has a radius that has blocks going over their owned Chunks and such things like that. I have no idea how to go about this and such. I really just would like the event of Worldedit that sets blocks and stuff, so I can check it with some checks and disable it if needed. Thanks. - Jack Badger

    Was looking at this mostly http://wiki.sk89q.com/wiki/WorldEdit/API/Hooking_EditSession, however most of the imports seem to now be non-existing anymore. It was last updated last month though...

    ZachBora Just wondering, but how do you do this in PlotMe? I would very much appreciate a response from you :). Thanks. - Jack Badger

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 9, 2016
  2. Offline

    LordVakar

  3. Offline

    TheWolfBadger

    LordVakar I have done that. I'm wondering how to now make it so players can not make world edit objects over their claimed Chunks. Any ideas how to do this?
     
  4. Offline

    xTigerRebornx

  5. Offline

    TheWolfBadger

    xTigerRebornx I don't quite understand where I should look in that however... It's such a vague plugin.

    xTigerRebornx What exactly does the .setMask() method do?

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 9, 2016
  6. Offline

    xTigerRebornx

  7. Offline

    TheWolfBadger

    xTigerRebornx So basically a mask protects a Cuboid region if you set it? Can you please give me an example of how I would make this mask for a whole Chunk? Thanks. - Jack Badger
     
  8. Offline

    xTigerRebornx

  9. Offline

    TheWolfBadger

    xTigerRebornx My question was also: Do these Masks protect the blocks in them from being edited by WorldEdit?
    I also have another: What would be the min and the max points for a Chunk?
     
  10. Offline

    xTigerRebornx

    TheWolfBadger The Masks will restrict WorldEdit to the defined Region (hence the name RegionMask)
    As for the min/max pos, not really sure. Chunks are 16x16x256 (Not sure about the 256 part), so you could do some math involving getting the chunk coordinates, then mutliplying them by like 16 or something. Play around with chunk coordinates and the chunk's size. Ill look into it as well and see if I can find anything.
     
  11. Offline

    TheWolfBadger

  12. Offline

    xTigerRebornx

    TheWolfBadger likes this.
  13. Offline

    TheWolfBadger

    xTigerRebornx Thank you very much Tiger for your contributions to this thread :)! I will tell you if I have any more problems! :)

    Okay another question xTigerRebornx. Does this make it so it can be WorldEdited in, but not from other Cuboids?

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 9, 2016
  14. Offline

    xTigerRebornx

    TheWolfBadger AFAIK, it limits their edits by selection, their location shouldn't matter. If part of their selection is outside the mask's region, any edits will be blocked in the part that is outside the region.
     
  15. Offline

    TheWolfBadger

    xTigerRebornx Thank you for all this information man! :)

    xTigerRebornx This keeps returning null though man:
    Code:java
    1. public Chunk getChunk(Player p, int in) {
    2. int j = 0;
    3. int i = in-1;
    4. for(String strings : m.getConfig().getStringList("ChunkList")) {
    5. if(m.getConfig().getString("Chunks."+strings+".Owner").equals(p.getUniqueId().toString())) {
    6. if(!(j == i)) {
    7. j++;
    8. continue;
    9. } else {
    10. String s = this.m.getConfig().getString("Chunks."+strings+".Chunk");
    11. String[] st = s.split(":");
    12. Chunk chunk = p.getWorld().getChunkAt(Integer.parseInt(st[0]), Integer.parseInt(st[1]));
    13. return chunk;
    14. }
    15. }
    16. }
    17. return null;
    18. }


    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 9, 2016
  16. Offline

    xTigerRebornx

    TheWolfBadger All I can say is debug your code. Print out the values such as the values you are checking for in config (Owner, Chunk, ChunkList), find out whats wrong, and fix it.
     
  17. Offline

    TheWolfBadger

    xTigerRebornx Seems the Mask is actually not letting me edit at all like break blocks, place blocks, and setting blocks is not working with a Mask on the area... Um?
     
  18. Offline

    TheWolfBadger

    xTigerRebornx Well I fixed my other problems. One problem I have came across however is that it doesn't prevent the commands such as //sphere and/or //hsphere and they will go over the mask limit. Any ideas as to why and how to fix? Thank you as any help is appreciated. - Jack Badger

    xTigerRebornx Any ideas?

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 9, 2016
  19. Offline

    xTigerRebornx

    TheWolfBadger Not sure, perhaps you could ask around sk89q's forums (probably the best place you'll get help)
     
  20. Offline

    TheWolfBadger

    xTigerRebornx Well actually I fixed the problem. Now what I need to figure out what to do is how to check where the blocks of the sphere are going to go and check if all the blocks' chunks are owned by the player. Any ideas on that ? Thanks. - Jack Badger
     
  21. Offline

    xTigerRebornx

    TheWolfBadger Mimic the creation that WorldEdit does (their source should have a specific way of making spheres), except without placing the blocks (simply getting which blocks are affected).
     
Thread Status:
Not open for further replies.

Share This Page