Alot of users on my server have been downloading texture packs that leave all blocks invisible except rare ores (to give themselves an advantage over normal players). I thought of a simple idea to prevent this form of cheating that someone might be able to do easily and efficiently. Idea: -Find all rare ore locations, save them -Convert all rare ores to stone -If a player is within a certain radius of the rare block locations, change the stone back to the rare ore. -If the player leaves that location, convert back to stone. This way the rare ores would be invisible along with everything else in these cheat texture packs. Lemme know what you guys think.
very good idea, i will try to make this.... is it ok, when all rare materials will be saved on first start with the plugin and the never again. example: if you place a rare ore after the plugin saved all rare materials on the map it will not be hidden.
Well I was hoping they would always be hidden. And if new rare ores are randomly generated on the map it should apply to them aswell. Maybe there could be a command to click a block of rare material to disable this for? So if you want to manually place them and have them always visible you could use this command.
If someone does pick this up it would be awesome if you could do the same for chests bceause it would fix it for a PvP server.
Yeah, running a plugin like this is going to cause massive lag, every player movement would require looking up all rare ore in that chunk (Or around the player) which, if you store ALL ore, is not going to be fast.
Possible lag-fixing idea. Is it possible to do two things: one, scan a chunk on load instead of scanning the entire map at once, and two, check every 3-5 seconds with the current player locations instead of every time they move? That last part in particular is what -might- save the plugin from my limited experience in c#, because it'd be rechecking much less often and could likely be threaded a bit better. It'd have to have a larger "reveal" range than before to account for the fact that a player may be moving and thus may be closer than the location it's actually checking, but other than that it's one idea that may at least alleviate -some- lag. There's the one drawback that I have virtually no clue how Bukkit and MC store said chunk data, and while I can imagine how much it is, I'm betting it is still more than what I'm imagining. If that's the case, even if it cuts lag 50%, if it's taking even 10 seconds before, it'll still be taking far too long this way.
You can't thread anything to do with blocks, none of the Bukkit API is guaranteed thread safe (Except getBlockTypeAt or something). The thing with scanning on chunk load is you're actually replacing blocks, if your server crashes while these blocks are changed, and you don't have the list saved in a file (Scanning and then saving into a file on chunk load instead of server load/chunk generation would be slower) you've lost all rare ore in that chunk. That's actually something you would need to be extremely careful with, only replacing the blocks when you're sure you've written their original data to disk. There's also additional disk usage due to this.
Ouch, that'll definitely put a downer on this idea for sure. Don't suppose there'd be a way to make it thread safe right now either - I get the impression if it -could've- been, it would've been. Well, stuff that idea then, I'm out of them. This is one of those awesome puzzles where whoever solves it will be the love of more than a few server admins, but it's gunna be interesting to get there
The core of minecraft itself isn't thread safe, so there's not much bukkit can do to change that in regards to changing blocks.
Check out my Plugin FoundDiamonds Its on its way to becoming a better anti-xray mod, you just have to watch the info coming in. I'm also ~50% done with figuring out how to log the info to a txt file.
itsatacoshop, i was just about to recomend your plugin =D http://forums.bukkit.org/threads/fu...for-finding-ores-anti-xray-mod-too-602.10205/
Another option would be to check the 6 neighbouring blocks when a block is broken. Effectively, when a chunk is loaded, the plugin scans it for rare ores and replaces them all with smooth stone (and stores their locations). It would be best to store the aux rare ore data in the same directory as the chunk itself (or at least in the world folder). That way if someone copies the world folder, the data is kept with it. When a player breaks a neighbouring block, the plugin checks if that block is a rare ore and if so, replaces it with the rare ore. This means that only buried rare ores are replaced. If a rare ore has air as a neighbour in any of the 6 directions, then it stays as a rare ore.
If this isnt an option, is there a way to make the server check the users for their currently being used terrain.png to see if there are any transparent blocks? And if there are, it would not let them connect and say like "No texture pack cheats".