SBPrime / AsyncWorldEdit-Premium

Async WorldEdit - Edit millions of blocks without lag! (Premium version)
Other
19 stars 4 forks source link

Server Hang When Load & Place a large Schematic file #136

Closed blackphreak closed 5 years ago

blackphreak commented 7 years ago

my code: https://pastebin.com/1Z9muTjG

pls help... I don't know how to fix this :(

[I tried to google for few hours but still have no idea how to fix]

Server Console Log: [16:28:55 INFO]: Running DungeonCreation in full async mode. [16:29:26 INFO]: Clipboard operation done. [16:29:26 INFO]: BlackPhreak lost connection: Disconnected <-- caused by connection timeout [16:29:26 INFO]: Job [0] DungeonCreation - placing blocks [16:29:26 INFO]: Job [0] DungeonCreation - done

SBPrime commented 7 years ago

You should start a new job for the whole piece of the code. That way everything will be asynced if not you will only async the block placing not the schematic load.

blackphreak commented 7 years ago

Can you give me some example pls? ._. I don't get it at all...

SBPrime commented 7 years ago

What you need to do:

  1. Get instance of IBlockPlacer
  2. Use the performAsAsyncJob
blackphreak commented 7 years ago

Here is my newest code: https://pastebin.com/Fv8JyeKY

but I can't get the job progress. the job done event will called before it really finished the job.

outputs: [00:24:10 INFO]: [jobAdded()-L169] job added initializing | name: ABC [00:24:10 INFO]: [jobAdded()-L169] job added initializing | name: ABC [00:24:10 INFO]: Running ABC in full async mode. [00:24:10 INFO]: Running DungeonCreation in full async mode. [00:24:10 INFO]: Job [0] ABC - placing blocks [00:24:10 INFO]: Job [0] DungeonCreation - placing blocks [00:24:12 INFO]: Clipboard operation done. [00:24:12 INFO]: Blocks processed: 246975 [00:24:12 INFO]: Job [0] DungeonCreation - done [00:24:12 INFO]: Job [0] ABC - done

SBPrime commented 7 years ago
  1. The job progress listener needs to be attached only once not for each task you create
  2. The blocksplacer job state change is used only for stage 1 to get the stage 2 you need to listen for job state change (this nees to be attached whne job is added)
  3. You should not add jobs directly to EditSession
  4. You should not use the ClipboardAsyncTask inside perform async task
  5. You need to use the iCancelabeEditSession inside perform async task
  6. You should not use the edit session used to create the async job inside perform as async.
blackphreak commented 7 years ago

cuz I don't know what should I put inside the iCancelableEditSession to perform async task. If I put nothing inside, it won't work.