Browse Source

box check only every 5 seconds

lakebane-master
FatBoy-DOTC 6 months ago
parent
commit
c412336257
  1. 6
      src/engine/objects/PlayerCharacter.java

6
src/engine/objects/PlayerCharacter.java

@ -179,6 +179,8 @@ public class PlayerCharacter extends AbstractCharacter {
public int mineAppliedID = 0; public int mineAppliedID = 0;
public long lastAction = 0; public long lastAction = 0;
public long lastBoxCheck = System.currentTimeMillis();
/** /**
* No Id Constructor * No Id Constructor
*/ */
@ -4893,6 +4895,10 @@ public class PlayerCharacter extends AbstractCharacter {
} }
public static boolean checkIfBoxed(PlayerCharacter player){ public static boolean checkIfBoxed(PlayerCharacter player){
if(System.currentTimeMillis() < player.lastBoxCheck + 5000)
return false;
player.lastBoxCheck = System.currentTimeMillis();
try { try {
for (PlayerCharacter pc : SessionManager.getAllActivePlayers()) { for (PlayerCharacter pc : SessionManager.getAllActivePlayers()) {
if(pc.getClientConnection().machineID.equals(player.getClientConnection().machineID) == false) if(pc.getClientConnection().machineID.equals(player.getClientConnection().machineID) == false)

Loading…
Cancel
Save