Using WorldEdit api for Schematics

Discussion in 'Plugin Development' started by HeyAwesomePeople, Oct 30, 2015.

Thread Status:
Not open for further replies.
  1. Hey all!

    I'm building a plugin in which players will be able to save their own person schematics. These will be privates schematics, therefor I cannot just give them worldedit commands. Plus this gives me to chance to restrict things they do.

    Anyways, I need help getting the players' clipboards. Around the internet I have found that I needed to the players localsession, then there is a method in there to get the clipboard, but it only brings back a clipboard holder which is completely useless for me. I'm pretty sure I need to be able to get a CuboidClipboard so I can call the saveSchematic method.

    I understand the WorldEdit API is very messy and is going to get some cleanup in WorldEdit 6.x( but that hasn't seemed to have started yet.

    I've looked over the docs but some things seem to be out of date.. How would I do this? Thanks
  2. Offline


    In order to get what's in the player's clipboard, the player would need to send that data to the server (or visa versa). Sadly, minecraft (and the servers) do not send that data, so you can't get what's in the clipboard unless you use a Modded client.
  3. Offline


    He's most likely talking about WorldEdit's Clipboard.

    You're on the right track. To get the LocalSession of a player, you use the getSession() method in WorldEdit class (which you can get by calling WorldEditPlugin#getWorldEdit()). And to get the CuboidClipboard, use LocalSession#getClipboard().
    Player somePlayer = ...
    LocalSession session = WorldEditPlugin#getWorldEdit().getSession(somePlayer.getName());
    CuboidClipboard clibboard = session.getClipboard();
    Last edited: Oct 30, 2015
    Zombie_Striker likes this.
  4. Offline


  5. @Assist

    But I don't see how the Clipboard can be useful. It doesn't contain any methods which I can retrieve a proper Clipboard from and be able to save schematics with.
  6. Offline



    You use the schematic Object and give it a clipboard, if I recall correctly.
Thread Status:
Not open for further replies.

Share This Page