1. How get chunk on which you stand? 2. How to realize: Player came to spawn territory (or other chunk) and he get message: "Welcome to spawn"?
idk how to, but i know it's possible. for the second thing: eg look at factionspro, it has areas & notifications on enter
Sorry. I didn't know one thing. I looked at the WorldEdit (CraftBukkit) code - I learned as they get that "ID" of chunks. PHP: $x = 500; // Player's X position$z = -120; // Player's Z position$chunk_x = (int) round($x / 16);$chunk_z = (int) round($z / 16);
That's wrong. You should use >> 4 not / 16, because bit shifting is much faster than division. Also, it should be floor not round. And what do you think happens if the $x and/or $z is/are -1? If you use bit shifting, you need to neither call functions (thus prevent some overhead that is fixed in PHP 5.7), nor to do rounding and division. I am not sure if it works well for extreme coordinates like those in the farlands, though.
-1 >> 4 is still -1 which is what you want. If you want to reduce stuff you can skip the round or floor. $x >> 4 is an int operation only so an int stays an int (no need to floor or cast to (int).