Anti X-Ray
PREVENTS cheaters from taking all the good stuff for themselves, without the tremendous overhead of Orebfuscator.
How does it work?
Basically, players are limited in the amount of valuable ores they can mine, based on their play time on the server. Legitimate, non-cheating players probably won't notice because the default limits are generous, but xrayers will be blocked from mining ore too quickly. So cheaters can still cheat, but they can't take more than a non-cheating player's reasonable share of ore. So their only gain is avoiding monsters while digging. They can't mine their first diamonds/"other good stuff" sooner than non-cheating players, and they can't take more total than they could if they weren't cheating.
How does this compare to Spigot AntiXRay and Orebfuscator?
The trouble with these and similar plugins is that while they're incredibly effective, they're very, very expensive to run. They consume a lot of CPU cycles doing deep packet inspection and manipulation, and they consume a lot of RAM trying to cache the results in memory. Small servers simply can't afford it, and larger servers have to cut back on their max players or other plugins. Any server which doesn't have enough CPU or memory may suffer heavy lag and crashes, other servers are simply spending too many cycles to stop a few cheaters - it's not a good trade-off.
In contrast, Anti-XRay is extremely cheap. It doesn't do any heavy processing, and consumes very little memory. It's true that technically cheaters can still use xray to find ores and dungeon chests (Mojang hasn't really made those worth hiding), but they're limited in how much advantage they get out of it. Basically, you're allowing players to cheat (but only very little!) to save immensely on CPU cycles and RAM.
How does this compare to ore loggers and ratio reporters?
Those simply don't work. Viewing a report to determine who has been x-raying only helps you catch players AFTER they've done permanent damage, removing massive amounts of diamonds so that non-cheating players can't find any. Banning the cheaters doesn't actually solve the problem, because it doesn't put the diamonds back in the ground AND more cheaters will soon replace those guys, so the problem continues. Also, this approach requires administrators to actively work to catch cheaters. An automatic approach like that provided by this plugin makes more sense.
Anti X-Ray keeps ores in the ground so that non-cheating players can find them. By placing limits on the amount of valuable resources a player can mine based on his play time on the server, Anti X-Ray guarantees that cheaters don't get greedy. They can still cheat a little, but not to the extreme of ruining the fun of other players. In fact, most new-to-server cheaters just leave the server to find another server where they can cheat without limits, solving your cheating problem very well.
Versus ore loggers, you're actually SOLVING the problem, and doing it in a fully automated fashion. Versus ore obfuscation solutions, you're saving RAM and CPU.
The Details
Players have an invisible currency which grows while they play (up to a maximum amount). Players who aren't actively playing (idling) don't gain any. When players break a valuable block, their total is reduced. If they don't have enough to break the block, they get a message explaining that they've reached their limit, and will have to wait X minutes before they can break that block.
Players who have been playing on your server since before you installed this plugin will start maxed-out to make the transition go smoothly.
Players who are NEW to your server after you install this plugin will start with a negative amount. This will prevent players from logging in and immediately x-raying to get valuables like diamond, because they won't have played enough yet to reasonably mine diamonds without cheating.
Yes, it's possible that some players who aren't cheating will run into the limits. It's my goal to adjust the default limits to minimize the chance of impacting legitimate players, while at the same time stopping xrayers from going crazy and taking all the valuable ore for themselves. If a player complains, these are the common scenarios:
- That player is a cheater, and is trying to convince you to disable the plugin or give him permission to bypass it so that he can cheat more.
- That player has "raided" someone else's existing mine instead of exploring on his own, allowing him to find diamond within the first hour of joining the server for the first time. Tell him to stop being lazy and earn his own diamonds.
- The player is EXTREMELY lucky, and managed to survive a reckless cave diving expedition without bothering to grow food or make armor and weapons. This is extremely unlikely - the player is probably cheating.
- That player is "branch mining", which involves tediously mining in long, straight, parallel tunnels near bedrock to collect lots of diamond. Chances are that player has an unhealthy obsession with diamonds, and already has a million more diamonds than he can possibly use. For this case, I recommend advising the player to take a break from mining when he hits the limit. If you give a player like this the bypass permission, he will grab most of the diamond in the area, robbing other players of the opportunity (even though he's not cheating, he's potentially causing a problem).
Catching Cheaters
This plugin will do a good job of preventing cheaters from benefiting from xray. However if you'd also like to actually catch and ban them, there's a configuration option to make a log entry and notify moderators (permission: antixray.monitorxrayers or op) when a player reaches the mining speed limit. This does NOT necessarily mean the player is cheating (read below!), but teleporting to the reported location will often be enough to determine whether the player was cheating or not. Since the 1.3 update, the Vanilla /tp command will accept coordinates, making these investigations very easy even when the player is offline.
What are the indications of a cheater?
It's impossible to know absolutely for certain whether a player is cheating or not unless you're looking over his shoulder while he plays. However all of these are indicators of likely cheating.
- Mines straight down. Xrayers don't fear lava because they can see through the ground.
- Mines in the dark. Xrayers don't need light - most of their blocks are transparent anyway.
- Mines in very long, single-block-wide tunnels (possibly winding), with very few, very short branches. You may notice a distinct lack of any pattern - unlike a "strip miner" who digs straight, parallel tunnels very close together, an xrayer's tunnels "wander". Xrayers don't need a pattern to be efficient, because they can see exactly where all the ore is, and so they can always take the shortest path to the next node.
- Starts mining before he even builds a rudimentary shelter, and without bothering to start even a small farm. Xrayers can see through most blocks, so they see caverns and monsters, and dig around them instead of fightning them.
- Carries very few supplies with him and doesn't wear armor while mining. May not even have a sword. Xrayers can see through most blocks, so they see caverns and monsters, and dig around them instead of fightning them.
- Finds diamonds VERY early after joining the server. Xrayers don't have to look for diamonds. They know exactly where they are and can see the shortest path immediately after logging in.
- Complains frequently, "Why do I have to wait to mine diamonds?!", while other players don't seem to notice the "problem".
- A VERY high ore-to-stone ratio. This plugin doesn't measure that, but you could supplement this with an ore logging plugin if you really want to catch and ban cheaters (this plugin will limit their cheating so that they don't mine more valuables than non-cheating players). Because xrayers can see the shortest path to any ore node, they minimize the number of stone blocks broken as they mine.
Setup and Configuration
Beyond just putting the .jar file in your plugins folder, all of these steps are optional. There is no database required - that is also optional.
Tweaking the Ore-per-Hour Ratio
Please do not adjust the diamond mining rate, starting values, etc, until you have actually tried the defaults for a day or so. Over-thinking them will likely lead to you choosing bad values which either prevent non cheaters from mining, or allow cheaters to cheat too much.
In the config file, you'll find something like this:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
AntiXRay: EnableMetricsTracking: true NewPlayerStartingPoints: -400 PointsEarnedPerHourPlayed: 800 MaximumPoints: 1600 IgnoreMaxPointsForBlockRatio: true ExemptCreativeModePlayers: true NotifyOnMiningLimitReached: false DefaultMaxHeight: 63 ProtectedBlockValues: EMERALD_ORE: Value: 50 MaxHeight: 35 DIAMOND_ORE: Value: 100 MaxHeight: 20 Worlds: world: '' world_nether: DefaultMaxHeight: 256 world_the_end: DefaultMaxHeight: 256 |
EnableMetricsTracking let's you disable metrics tracking. More about this at the bottom of this page.
New player starting points are how many points an entirely new player to your server (meaning he's NEVER been on your server before) will start with. The points are used to break blocks, like DIAMOND_ORE, which by default costs 100 points.
Points earned per hour played is the speed at which players get points. In this example, players get 800 points per hour, so on average, they can mine 8 diamonds per hour indefinitely without ever being temporarily blocked from mining.
Maximum points is the "buffer" players build up. Players don't spend ALL their time mining for diamonds, so this buffer gradually fills up with points. This means players who take breaks from mining will be less likely to encounter the mining speed limit.
In this example, because the starting points setting is much less than the cost of mining a diamond, this means that an entirely new player who has just joined the server can't mine ANY diamonds right away. This helps stop xrayers, who often start xraying right away, and will likely encounter the limit and either quit or complain (the latter helps you catch them).
You can add other ores as well, but generally xrayers don't bother to gobble up non-diamond ores, so those other ores probably aren't worth spending CPU cycles on tracking.
Cutom block definitions allow you to define new ore names by id and sub id (sometimes also called data). Read more about this below in the tekkit related section.
Protected block values is the place where you write down the default values for the ores you want to be protected by default in all worlds for which the plugin is enabled for. Additionally you can provide an ore-specific default maxHeight value for each of those. Read about maxHeight values below.
Default max height determines the default max height for all ores which don't have a specific maxHeight value set. Players are free to mine (break) as much ores they want above this height. This is useful for example to block players from mining to many diamond ore (which, in a default minecraft world, is only located below height 16), but at the same time allow them to place and break it again in their houses above that height with their fortune pickaxes if they like too, without having to reduce their point stock for that.
Now, there is the "Worlds" section:
This section determines the worlds in which AntiXRay shall be enabled and at the same time allows you to overwrite some of the default values specific for each world:
DefaultMaxHeight will overwrite the default max height from above, but only for this world.
ProtectedBlocks lets you add or overwrite ore values and ore specific max heights for this world.
In the example snippet below you can see how to use that: the example sets the value of diamond ore to 75 and it's height limit to 63 in world 'world' (maybe this world uses some custom world generator which generates slightly more diamond ore, up to height 63..).
Also you can see that the default max heights were increased to 256 in the nether and end worlds. By default players wouldn't be able to, for example, break diamond ore there (after placing it there of course) below height 20, because the section of default protected blocks from above restricts diamond ore by default in all enabled worlds if it is mined below height 20.
The world specific default max height value however overwrites all previously default max height values. So players can freely place and mine diamond ore again in the nether and the end.
In general heights get overwritten in this hierarchy:
default max height < default protected ore max height
< world specific default max height < world specific ore max height
More information on minecrafts default ore heights can be found in the minecraft wiki: http:www.minecraftwiki.net/wiki/Ore
If you want to add a world but not want to overwrite any default values or heights do as follows:
Let's say the world you want to add in order to enable AntiXRay in it is called "mining_world". Then create an (empty) section with the worlds name by putting 2 quotation marks behind the colon without anything between these, like so:
1 2 3 4 5 6 7 8 9 10 11 |
Worlds: mining_world: "" world: ProtectedBlocks: DIAMOND_ORE: Value: 75 MaxHeight: 63 world_nether: DefaultMaxHeight: 256 world_the_end: DefaultMaxHeight: 256 |
Without the colon or the empty quotation marks the plugin wouldn't be able to read the world name and it would get removed after the next reload.
More detailed block type specifications and Mods
You can also specify block types by id instead of name. This might be useful if you want to protect some custom blocks which got added by some mod.
Note however that there are mods this plugin doesn't quite work well for because they introduce new methods of mining which completely bypass plugins.
Also note that AntiXRay will automatically replace the block ids in the config with the material name, if it finds a matching one.
Also you can specify the data value (subid) for protected blocks by adding the data value to the block name/id separated by a tilde (~). Data values for blocks are usually used to differ between different states of the block (ex. the rotation of log or stairs, whether or not redstone ore is glowing, the color of wool, the growing state of plants, etc.). If you don't specify a data value it will default to -1, which is used to specify that the data value shall be ignored. This could look like this:
1 2 3 4 5 6 |
ProtectedBlockValues: 999~12: # maybe some custom modded block Value: 50 MaxHeight: 35 WOOL~14: # red wool, for example purposes Value: 100 |
Where's the Database Option?
By design, there is no database option. This is one of a few cases where using a database is definitely more trouble than it's worth, and possibly detrimental to performance. There are only TWO integer values stored per player. That integers are read from file only once per login, and written to file once per logout (or when you shut down the server). There's no need for a database, and besides that, it will slow your boot trying to establish the initial connection.
I used to have database support, and one of the problems was that the database was used so infrequently that the connection would fall asleep. I will not add the database option back in unless in the future, something about the above changes so that there's either a LOT more data, or very frequent changes to data.
Using a Block Ratio Instead
If you'd rather require players to mine more coal or break more stone to earn more valuable ores instead of making them wait an amount of time, you need to do three things. First, set the points per hour to zero. Second, set the "cost" of the other blocks you want players to break to a negative amount. Then when the player breaks those blocks, he will GAIN points, taking him closer to mining. Finally, update your messages.yml to explain that the player must break more stone or other ores (depending on your configuration), instead of telling him he will get more points by waiting. For example, if you wanted to allow players to mine one diamond per 100 stone broken, you'd do this:
- points per hour: 0
- starting points: 0
- DIAMOND_ORE: 100
- STONE: -1
- In messages.yml: "You're finding a lot of diamond! You have to break more stone before you can collect this ore."
Commands
/antixray help -> Overview over the possible commands.
/antixray reload -> Reloads the configuration and message files.
/antixray check [player] -> Shows you your or another players current points. I do NOT recommend you to give your players the ability to check their current points as they can use this information to avoid reaching their limit in order to avoid that you get a notification about them!
/antixray set <points|counter> -> Sets the players points or counter value. I do NOT recommend you to use this to reset your players points whenever they reach their limit (by doing so, you are wasting effort and you will make the limit useless)! This command is mainly meant for debugging purposes and trying out different mining limit settings.
Permission nodes
antixray.monitorxrayers (default: op) -> The player will get notified when a player has reached his mining limits and notifications are enabled.
antixray.bypass (default: false) -> Allows the player to freely mine any block without being checked by Anti X-Ray. Usage on own risk..
antixray.help (default: false) -> Allows a player to view the help page which contains information about the commands. Default: op
antixray.reload (default: op) -> Allows a player to reload the antixray configuration and message file.
antixray.check.self (default: op) -> Allows a player to view his amount of remaining mining points.
antixray.check.others (default: op) -> Allows a player to view an other players amount of remaining mining points.
antixray.set (default: op) -> Allows the setting of a players stored values, like the amount of remaining mining points.
Notice
This plugin uses Hidendra's Metrics class to report usage stats to mcstats.org. This is giving me (and you) an idea of how many servers are actually using this plugin. You can disable this by setting "AntiXRay.EnableMetricsTracking" to 'false' in the config.
Chinese Translation (v1.9.0)
A chinese translation by song_xin of this plugin's description, its config settings and messages can be found here: https://github.com/SongXin1015/translate/tree/master/Anti%20X-Ray
More Great Plugins!
If you like this plugin, check out these plugins too:
- Grief Prevention
- Prevents ALL types of grief.
- Easy for players and admins, mostly automatic.
- Players claim land to prevent theft and house wrecking.
- Automatically warn, mute, and kick or ban spammers.
- Blocks dumping lava and setting fire on another player in non-PvP servers.
- Disable fire damage, spread, or both.
- Wipe away ugly builds with a right-click - no database required!
- Automatically prevents spawn camping in PvP servers.
- Prevent damage to the surface by limiting lava and water placement, and TnT damage.
- Automatically clean up hanging tree tops.
- Includes a creative mode for creative worlds.
- Optional siege mode for build-based PvP.
- Population Density
- Automatically assigns new players to wilderness where they'll find other new players and plenty of space, wood, and ore.
- Optional teleportation system which can't be abused by players to escape combat or save them from being lost.
- Login queue to guarantee fairness when the server is full.
- Optional reserved spots for administrators.
- Automatically removes idle players when the server is nearly full.
Donations
If you like this plugin, consider supporting its development by making a donation.
Thanks in advance!
@ryvix
Yeah, I kind of get that. To put it in griefer language, it's major derpage.
@hispanicdude
So I looked into the file thing a bit. After running rapid login/logouts for a while and also rapidly updating player data (by breaking lots and lots of diamond ore very quickly in creative mode) I was unable to find any files left open (on Windows, using ProcessExplorer to verify - I'm assuming CentOS doesn't have some file handle bug). I've seen that particular crash reported many times on various forums, so I think it's a general Mojang problem that just happens every now and then. If you're certain this is a problem with my plugin, pleaes send along your supporting data so that I can investigate more thoroughly and fix the problem. Thanks for the help!
@bigscary
I am using them together because FamilyJewels hides ores not exposed to air. However quite a number of ore are still visible and so I hope Anti X Ray will slow them down and prevent them from mining too much if they are trying to xray and nobody is around to watch them. I actually also have a few others as well that I use in other ways to help detect people xraying.
Another method is to scan the chat logs for words related to xray, such as names of hacked clients, xray texture packs, etc. and analyze it and then you can go invisible and try to watch the player and see if they head directly to ores through walls, etc. to see if they are xraying.
I have caught quite a number of people and I still don't really understand why people would even want to xray in the first place, especially considering I have a creative world. But I guess some people just like cheating.
@ryvix
Why would you run both this and FG together? It seems like there's too much overlap to me. FG, if you can afford it, should be sufficient right?
@matedgo
What else did you change? Do you mean as opposed to orebfuscator, or do you mean as opposed to no anti xray plugins at all? Please measure your CPU use over a longer period of time. Since the code only responds to block breaks and only when they are diamond ore (by default), I think it extremely unlikely that you'd notice a CPU impact. However if that is the case, please post again.
@zedadiaswick
Sure, I'll add that. Thanks for the great idea. :)
@matedgo
All I'm doing is "is it diamond ore? no? then don't do anything". Are you maybe running with non default config, for example tracking lots and lots of different types of ores? Please provide some more information. I just can't imagine a typical server having a CPU problem with something so insanely simple and quick. I'm not calling you a liar, I just want to understand the situation.
@hispanicdude
I'll check into the open files thing. Files aren't supposed to be closed on quit, though, they're supposed to be closed immediately after write. Regardless, any files left open is a big deal. So I'll look into that.
Still pushing back on the mySQL thing. Let me look into these other reports first, and if you experience a problem even after those changes (assuming I made a mistake, and there are some fixes coming), then I'll revisit the SQL ask.
Well, by using FamilyJewels and this plugin together it definitely decreased my CPU usage by probably about half. It very likely also decreased my memory usage. But I didn't use the orebfuscator cache due to issues so it might not have done the same as for some people.
can add MYSQL? nice plugin but i need mysql.
Matedgo is right.
Also I strongly suggest you also add MYSQL, many servers are hosted in CentOS which have a limit to the amount of open files they can have. Your plugin doesnt seem to close opened files after a person quits, which will result in many cases in a crash due to {too many open files]
unplayable with over 60 players, my cpu usage goes biger and biger, chat isnt laging, but when u mine fast, the blocks are getting back and they need to mine it again, remove plugin, everythign is fine, plus whole minecraft server is on ramdisk, something is wrong.
Looking good, I've installed it and it's already stopped one new player from mining diamond in his first 30 minutes. Appears to have been xraying, though not entirely clear (it was exposed in a cave)
Could we get some feedback as admins when a player is blocked from mining an ore? Both at the time, and in some form of log we can look at to see who has been mining too quickly. We could then check up on them, and ban any who have obviously been trying to xray (coords would be helpful, here). I would much rather get rid of cheaters, than to simply put up blocks for them to find ways around.
funny thing, did this incrase 20% more cpu usage ... on 60 players and on other hand did lower my ram usage from 90% to 50% same with 60 players ?, i remove plugin, everything is back normal with cpu usage and ram..
Fantastic plugin. Its working great. The permissions idea is fantastic as well. Thank you for your work.
@bigscary
I'm not worried about RAM but I imagine it would be decreased for sure. I am going to attempt running them both at the same time yes. FamilyJewels is hiding any ore not exposed to air and seems very light in comparison. But I also want to test how this plugin works in the mix. So we shall see.
1.0.3 increased the default rate to 4 per hour, based on the survey. If you want these new defaults, delete your config.yml and /reload.
@ryvix
Don't forget to check your ram, too. Are you saying you're running both anti xray and family jewels at the same time? :\
@bigscary
OK, I will give it a shot with only diamonds and the FamilyJewels plugin and see how it looks in comparison to Orebfuscator on the CPU usage.
@kyle0440
I'll do that second thing, that's a really great idea, thanks!
@ryvix
Remember we're only trying to stop xrayers from abusing. Xrayers don't try to grab all the iron or gold in an area, because it's just not that valuable, and there's always plenty, and it's easy to find. If you do decide to track something, be careful abou tthe value you assign - a diamond is probably worth about 100 iron ore or maybe more, I'd think. To assess your economy, you could just ask a few players how many of X they'd want for a diamond.
@iSiiLeX
You said "sometimes 12", I asked for "average rate". :)
"On average, about how many diamonds per hour does a non-cheating, rapidly-mining player find?"
Just 6 ? I find sometimes 12 Diamonds in a Hour ;D
Can you maybe make a bypass permission, or add a check to see if the player is in creative mode?
Hey, I was testing this plugin out. Nice idea!
I wanted to also try to track Lapis ore and Gold ore though. And then there is a problem because I can't have separate points for each one.
So for example if I try to set it up to let them mine 40 gold ore an hour, 40 lapis ore, and 10 diamond ore, and they end up getting close to the gold ore top then keep mining then they won't have any points to mine diamond or lapis. Does that make any sense even?
Maybe it would be solvable if there could be separate tracking of points for each type of ore on the list but I don't know how else.
Someone suggested via private message that I use stone/diamond ratio instead of time/diamond ratio. Here's why I decided not to do that:
I had considered this originally. If I had, I'd be telling players "if you want to mine this diamond, you have to break X number of stone blocks first". You're right in that it would slow down cheaters, but I don't like that the solution for both cheaters and non-cheaters is to just break blocks. Nobody likes to just tunnel through stone - SOME players do it because they like the idea of being an "efficient miner" and maxing out their diamond/hour rate, but they still don't enjoy the actual process of just breaking block after block for hours. So I feel like I'd be punishing players who like to go cave diving by making them monotonously break blocks that they don't even want. Under my system, I'm telling players "sorry you can't do this right now, but you can go do anything else in Minecraft that entertains you, and come back later" rather than "time for you to spend a lot of time breaking stone". So whether a player is building or farming or exploring the wilderness with a friend or braving the nether and the end, he's still working toward more diamonds. He doesn't have to go monotonously bust blocks.
@rasnyderiii
You don't need it for this plugin. I'm serious when I say it's crazy inexpensive. Let me know if you actually have a performance problem.
@XeonG8
This is the only time I'll respond to you when you use that tone. Strong opinions and criticisms I'm okay with, but if you continue to stand on your soap box and use words like "stupid" and "silly" and "borked" to describe my work which is designed to help others at no benefit to myself, then you will not be permitted to post here.
I think you misunderstood me. I'm not trying to slow down all players. I'm trying to slow down cheaters without slowing down non-cheaters. I understand that you may argue that isn't the case currently, and in that case, I'd like to hear your feedback so I can make adjustments. What you're saying (I think?) is that in addition to slowing down cheaters, you also want to slow down some select other players. I totally respect your server strategy and your right to run it as you see fit - maybe you want to reward people who donate, or build really cool stuff, or who just show some loyalty by giving them some rewards, and that's a great plan. I'm just saying that I need to keep this plugin very, very lean and efficient and simple, because that's a big part of my compete strategy versus other plugins working on the same problem. Adding features which make the config file more complicated or which cost more RAM and CPU cycles that aren't helping stop cheaters is not something I'm willing to do. I want to solve the problem and stop there, so everyone who uses the plugin gets the best benefit/cost ratio. Not everyone would benefit from the features you're requesting, so I'm not adding them.
I've been known to change my mind on many topics in the past. If more continue to pressure me for something like this, I might do that. But one guy (and a particularly rude guy at that) asking for this is not enough.
@watdidyusaey
Xray is not the root of your thieving problem. It won't go away if you prevent xraying, it will only be reduced. I recommend Grief Prevention, LWC, Lockette, or some other "ownership" plugin which will fix the problem at the source - a player "owns" what he builds, and gets to decide who he shares it with. That will be a complete solution to your stealing problem, and it will be MUCH cheaper than orebfuscator or family jewels.
@Europia79
From above:
"Players who have been playing on your server since before you installed this plugin will start maxed-out to make the transition go smoothly."
"new player" means a player who has NEVER played on your server before. Players who've been playing on your server since before you installed this plugin will start with the max points because that will minimize the chance of your entire population going "WTF MAN WHY CAN'T I MINE THESE DIAMONDS" on day one. :) You're giving them the "benefit of the doubt" with respect to xraying, until they prove otherwise. If any of them are xraying, they will quickly run out their "buffer" and hit the limit.