• Our Minecraft servers are offline but we will keep this forum online for any community communication. Site permissions for posting could change at a later date but will remain online.

Regeneration Detector.java [Idea]

Status
Not open for further replies.

GamerChappy

Experienced
Joined
Apr 10, 2013
Messages
366
Reaction score
180
Ava, please look at this.

One thing I'm surprised NCP hasn't implemented yet is a universal regeneration hacker detection script.
And seeing as it hasn't been put in as a Feature Suggestion, I decided to make this thread along with my thought of how the script would run.

In my head, the script would go something like this:
'Regeneration Detector.java'
  • 1. Check [player] [health points(1)]
  • 2. Sleep 5 seconds.
  • 3. Check [player] [health points(2)]
  • 4a. If [potion] 'Regeneration II' status = false, perform [step] 5a;
  • 4b. If [potion] 'Regeneration II' status = true, perform [step] 5b;
  • 5a. If '[player] [amount of hearts(2)]' - '[player] [amount of hearts(1)' > 4 {You regenerate half a heart every 5 seconds with a full bar of hunger, but just to be on the safe side, you'd be better off adding three more health points (or one and a half hearts)} say '/kick [player] Detected increased Regeneration Speed'
  • 5b. If '[player] [amount of hearts(2)' - '[player] [amount of hearts(1)]' > 8 {An added 4 health points in total is given to the player over 5 seconds} say '/kick [player] Detected increased Regeneration Speed'
  • 6a. If '[player] [amount of hearts(2)]' - '[player] [amount of hearts(1)]' ≤ 4, re-run 'Regeneration Detector.java'
  • 6b. If '[player] [amount of hearts(2)]' - '[player] [amount of hearts(1)]' ≤ 8, re-run 'Regeneration Detector.java'
A huge amount of credit goes to JWingWangWong for creating pseudo-code based off of my design. Should make it easier for coders to understand.
Code:
Algorithm RegenHackDetector(namePlayer)
Detects if a player is regenerating health in an exploitive way

Pre:
    namePlayer :: a reference to Player class
Post:
    Nothing
Return:
    False if player is not regenerating hearts in an exploitive manner
    True if a player is regenerating hearts in an exploitive manner

    while(namePlayer.online is true)
        regenTime  <- 5    //set to seconds

        temp1 <- namePlayer.hearts
        counter(regenTime)

        temp2 <- namePlayer.hearts

        //Gives the number of change
        change <- temp2 - temp1

        if(namePlayer.status.regeneration2 is false)
            if(change > 4)
                print "/kick namePlayer.name "Detected increased regeneration speed""
                return true
            end if
        else if (namePlayer.status.regeneration2 is true)
            if(change > 8)
                print "/kick namePlayer.name "Detected increased regeneration speed""
                return true
        end if

        //no need to do 6a and 6b if the player is offline
    end while
    return false
end
In simpler terms:

In Minecraft, you have a maximum of 20 health points, or 10 hearts (). Every 5 seconds, Minecraft checks whether you have less than 20 health points. If you do, Minecraft will check whether you have at least 18 hunger points, or 9 'bars' of hunger (). If both of these check out, you will regenerate 1 health point, or half a heart ().

Regeneration hacking works by making your game 'ticking', or measure of time run faster. 'Ticking' is used in games to measure time. Obviously, Minecraft uses this. Normally, you will regenerate half a heart () every 100 ticks (5 seconds), but a regeneration hack could make your game 'ticking' run 50 times faster, meaning that you would regenerate half a heart every 2 ticks (0.1 of a second). This means you could gain 10 hearts () in 40 ticks (or 2 seconds)!

The (only) flaw to regeneration hacking is that EVERYTHING in Minecraft that relies on the game 'ticking' will go just as fast. For the following examples, I'm going to pretend that I made Minecraft's 'ticking' run 50 times faster:

Running out of breath underwater: 0.3 seconds.
Drowning after running out of breath (with 20 health points, or 10 hearts () to start with): 0.2 seconds.
"Attempting to swim in lava" (with 4 health points, or 2 hearts (
) taken every half second): 0.05 seconds.
Stop burning (after being lit on fire with a flint and steel, and having 8 health points, or 4 hearts () taken away): 0.08 seconds.

How my script works:

Every 5 seconds, the server checks your amount of health points. If you have regenerated too many health points between two checks, you get kicked from the server. If you have eaten a golden apple, the script will know that, and will allow the amount of regenerated health points to be higher.

Notes:

I have been told that regeneration hacks can now have their speeds controlled. This would eliminate those sneaky ones, but still catch the obvious ones.

I have taken into consideration the possibility of lag, noting that the extra 3 health points of compensation is added due to the possibility of a 15 second lag spike (the longest possible time allowed before a timeout exception).
I have also compensated for the use of Golden Apples, and in turn said for the script to modify the detection algorithm.

Leave suggestions, constructive criticism or anything else you have to say below!

NOTE: My idea is just an idea. I do not know how to code java, let alone any sort of programming language. You could not just copy and paste these into the server files and make them magically run!

Thanks,
GamerChappy.

EDIT: Changed the command from 1 week ban to kick.
EDIT: Explained how my script would work (in English terms). :p
EDIT: Added in JWangWingWong's pseudo-code.
 
Last edited:

I_love_desk

Peacekeeper
Joined
Sep 28, 2013
Messages
631
Reaction score
1,153
Damn, I made a thread to try to point out the problem but you've gone a big step further, well done. This being added would be amazing.

Edit: I just saw in that the script says ban player one week, I think that's a little harsh, kicking them would probably be more suitable and would probably prevent them from using the hack as they would be unable to play a game without being kicked.
 
Last edited:

GamerChappy

Experienced
Joined
Apr 10, 2013
Messages
366
Reaction score
180
Damn, I made a thread to try to point out the problem but you've gone a big step further, well done. This being added would be amazing.

Edit: I just saw in that the script says ban player one week, I think that's a little harsh, kicking them would probably be more suitable and would probably prevent them from using the hack as they would be unable to play a game without being kicked.
The default banning period for moderators catching hackers is 1 week. This is the exact same thing, just done automatically.
 

I_love_desk

Peacekeeper
Joined
Sep 28, 2013
Messages
631
Reaction score
1,153
The default banning period for moderators catching hackers is 1 week. This is the exact same thing, just done automatically.
Of course I agree with hackers immediately being banned for a week, but there's a possibility that immediately banning players that get this signal could cause problems with people getting banned while not hacking etc. There was a problem recently about players getting kicked for fly hacking when they weren't doing so, as well as problems with rubber banding while sprinting, both of which is just no cheat thinking someone is hacking. Those aren't massive problems when they just kick but if they were bannable they would be... Also this is just my opinion but I think a java log might not be quite enough evidence to be banning people with, especially as big servers like this have enough problems with false bans as is.

Plus remember that regen happens whenever someone takes damage which is inevitably going to happen, so if no cheat kicked players every time it detected those regen hacks, the game would become unplayable with them installed anyway as it would be impossible to complete a game.
 

Mooclan

Forum God
Joined
Aug 19, 2012
Messages
6,358
Reaction score
12,666
If this piece of code actually works, that would be amazing.
 

GamerChappy

Experienced
Joined
Apr 10, 2013
Messages
366
Reaction score
180
Of course I agree with hackers immediately being banned for a week, but there's a possibility that immediately banning players that get this signal could cause problems with people getting banned while not hacking etc. There was a problem recently about players getting kicked for fly hacking when they weren't doing so, as well as problems with rubber banding while sprinting, both of which is just no cheat thinking someone is hacking. Those aren't massive problems when they just kick but if they were bannable they would be... Also this is just my opinion but I think a java log might not be quite enough evidence to be banning people with, especially as big servers like this have enough problems with false bans as is.

Plus remember that regen happens whenever someone takes damage which is inevitably going to happen, so if no cheat kicked players every time it detected those regen hacks, the game would become unplayable with them installed anyway as it would be impossible to complete a game.
The way regen works is that every 100 ticks, Minecraft checks whether you have less than 20 health points. If you do, Minecraft will add a health point, or as seen to you as half a heart. Regeneration hacking works by forcing your game 'ticks' (measure of in-game time) to run exponentially faster. This is why you often hear their footsteps being repeated faster than normal. This is also why they drown faster when underwater. I've added the possibility of the script to compensate for the longest period of time possible between checks, and that is a 15 second lag spike. If the server doesn't recieve a single packet from you within 15 seconds, or likewise if the client doesn't recieve one, you will be disconnected from the server.

I have eliminated all possible false positives. Still, I can understand if the developers chose to only make it a kick (or a ban of lesser duration).
 

soggypickle

District 13
Joined
Jun 22, 2012
Messages
2,137
Reaction score
2,975
In all honesty, it wouldn't really matter whether they were kicked or banned. But if I had to choose, I'd say kick, just like the auto-BSM detecter. It prevents you from using it, and on the offchance that it fails and accuses a legitimate player of regen hacking, the person accused can just relog instead of have to wait a week for something they didn't do. Plus, all bans require evidence. If these auto-bans were issued, there would be no evidence attached to them, flooding the Sr Staff with Ban Disputes that they can't deal with. This sounds like a good idea that could be built upon, but I'd say change it to a kick for now. :)
 

GamerChappy

Experienced
Joined
Apr 10, 2013
Messages
366
Reaction score
180
If this piece of code actually works, that would be amazing.
Bear in mind the script isn't in any sort of programming language. I don't know how to code java, let alone C++ or even Python. Although in a few years I might, there is no way that plugin/script would ever work if you were to copy and paste it into the server files. :p
 

Mooclan

Forum God
Joined
Aug 19, 2012
Messages
6,358
Reaction score
12,666
Bear in mind the script isn't in any sort of programming language. I don't know how to code java, let alone C++ or even Python. Although in a few years I might, there is no way that plugin/script would ever work if you were to copy and paste it into the server files. :p
Oh, derp >_< Well, as one non-coder to another, I feel slightly embarrassed now.
 

Gunnishone

Platinum
Joined
Jun 28, 2013
Messages
1,640
Reaction score
848
The way regen works is that every 100 ticks, Minecraft checks whether you have less than 20 health points. If you do, Minecraft will add a health point, or as seen to you as half a heart. Regeneration hacking works by forcing your game 'ticks' (measure of in-game time) to run exponentially faster. This is why you often hear their footsteps being repeated faster than normal. This is also why they drown faster when underwater. I've added the possibility of the script to compensate for the longest period of time possible between checks, and that is a 15 second lag spike. If the server doesn't recieve a single packet from you within 15 seconds, or likewise if the client doesn't recieve one, you will be disconnected from the server.

I have eliminated all possible false positives. Still, I can understand if the developers chose to only make it a kick (or a ban of lesser duration).
Where the fudge in Melbourne do you live? Dat internet. You got NBN?

Sorry for off-topic!
 
Status
Not open for further replies.

Members online

No members online now.

Forum statistics

Threads
242,192
Messages
2,449,550
Members
523,970
Latest member
Atasci