Hello! I've been thinking it could be good for a plugin of mine to start a new thread, but even after reading some threads on the old forums, I haven't found a clear way to make a thread and how to do some things. Can someone explain to me in detail how to make a new thread and how to manage it? Thanks in advance!
Well first, I just like to have a lot of knowledge about it. Even if it's not a smart idea, it's good to know how it works. Second, I'm planning to use a new thread for settings blocks. Repeating tasks do not work efficiently for a plugin I'm working on, and as far as I know (and read) I think it's not a good idea to schedule async tasks a lot of times consecutively in a short time.
setting blocks? you know that that is not possible. And scheduling AsyncTasks barely has much more overhead than creating a new thread.
Saying something is not possible does not help. If you're so sure it is not possible, please explain me why it is not. That's what I made this thread for after all. I don't really care if something is possible or not, only what you can do with making a new thread.
You can change chunk in AsyncTasks and on completion set this chunk to server I use this method, when use world edit (create big sphere (with radius 100 or more))
Maybe you should learn what a thread is. There is enough on the internet. Did you read some docs? Ok, then you may already know why you can't set blocks from there. If not: The main thread is doing its things and handling levels. You are now in another thread and want to make setBlock calls. The main thread would have to be interrupted and do that. It would simply result in the same. yes, that will be a bit faster