Scheme build with console without players

Discussion in 'Programming Help' started by GeniusCasioHl820A, Oct 29, 2017.

  1. GeniusCasioHl820A

    GeniusCasioHl820A New Member

    Hello.
    I'm writting simple plugin that will automaticly build schematic on map with console command like this
    Code (Text):
    buildthis 12 //12 is a scheme name
    There is important thing that commant will be execute from console, I didnt find any information about execute "/scheme load" from console, so my first idea was simple - create fake player extends Player and that use
    Code (Text):

    getServer().dispatchCommand(FakePlayer p, String command);
     
    I figured out that this will use next FakePlayer methods:
    • getWorld (return Bukkit.getServer().getWorld("world");
    • getLocation (return x0 y0 z0 Location in "world")
    • getUniqueId
    • getName (return "fakePlayer")
    • isPermissionSet (always true)
    • isOp (always true)
    • Also, when someone send message to my FakePlayer I just print it in console
    In my class that method's work propperly (at least i think its true) and return not-null value, UUID isn't fake too.
    There is a problem: "/scheme load 12" execute just fine:
    [WorldEdit] fakePlayer loaded .../WorldEdit/schematics/12.schematic
    But then, when I execute "//paste" i get this:
    [12:20:14 INFO]: Your clipboard is empty. Use //copy first.
    There is question - why this happends?
    Why i don't use WorldEdit API? - there is a second question, when scheme is too big, it's freeze server and even worse, drop it. So I think if user that use my plugin, will be use somthing like async_worldedit, then it's will be a problem when user installed support WE plugin, but my Builder does't work througth it.
    Does it true?
    Thanks
  2. wizjany

    wizjany Administrator Developer

    trying to work around the api isn't supported.
    just use the api, and if you want to support third party plugins, optionally use their api too.
  3. GeniusCasioHl820A

    GeniusCasioHl820A New Member

    Thunks, wizijany for answering me