box check only every 5 seconds

This commit is contained in:
2024-05-17 23:38:53 -05:00
parent c8bea0d1ce
commit c412336257
+6
View File
@@ -179,6 +179,8 @@ public class PlayerCharacter extends AbstractCharacter {
public int mineAppliedID = 0;
public long lastAction = 0;
public long lastBoxCheck = System.currentTimeMillis();
/**
* No Id Constructor
*/
@@ -4893,6 +4895,10 @@ public class PlayerCharacter extends AbstractCharacter {
}
public static boolean checkIfBoxed(PlayerCharacter player){
if(System.currentTimeMillis() < player.lastBoxCheck + 5000)
return false;
player.lastBoxCheck = System.currentTimeMillis();
try {
for (PlayerCharacter pc : SessionManager.getAllActivePlayers()) {
if(pc.getClientConnection().machineID.equals(player.getClientConnection().machineID) == false)