Refresh sleep timers

This commit is contained in:
fullwall 2022-12-26 00:53:38 +08:00
parent 36671daeae
commit f6823fd842
5 changed files with 20 additions and 5 deletions

View File

@ -1212,7 +1212,10 @@ public class NMSImpl implements NMSBridge {
List<Player> nearbyPlayers = Lists.newArrayList(Iterables
.filter(CitizensAPI.getLocationLookup().getNearbyPlayers(entity.getLocation(), 64), (p) -> {
Long time = meta.getMarker(p.getUniqueId(), entity.getUniqueId().toString());
return time == null || Math.abs(System.currentTimeMillis() - time) > 5000;
if (time == null || Math.abs(System.currentTimeMillis() - time) > 5000)
return true;
meta.set(p.getUniqueId(), entity.getUniqueId().toString(), System.currentTimeMillis());
return false;
}));
if (nearbyPlayers.size() == 0)
return;

View File

@ -1279,7 +1279,10 @@ public class NMSImpl implements NMSBridge {
List<Player> nearbyPlayers = Lists.newArrayList(Iterables
.filter(CitizensAPI.getLocationLookup().getNearbyPlayers(entity.getLocation(), 64), (p) -> {
Long time = meta.getMarker(p.getUniqueId(), entity.getUniqueId().toString());
return time == null || Math.abs(System.currentTimeMillis() - time) > 5000;
if (time == null || Math.abs(System.currentTimeMillis() - time) > 5000)
return true;
meta.set(p.getUniqueId(), entity.getUniqueId().toString(), System.currentTimeMillis());
return false;
}));
if (nearbyPlayers.size() == 0)
return;

View File

@ -1289,7 +1289,10 @@ public class NMSImpl implements NMSBridge {
List<Player> nearbyPlayers = Lists.newArrayList(Iterables
.filter(CitizensAPI.getLocationLookup().getNearbyPlayers(entity.getLocation(), 64), (p) -> {
Long time = meta.getMarker(p.getUniqueId(), entity.getUniqueId().toString());
return time == null || Math.abs(System.currentTimeMillis() - time) > 5000;
if (time == null || Math.abs(System.currentTimeMillis() - time) > 5000)
return true;
meta.set(p.getUniqueId(), entity.getUniqueId().toString(), System.currentTimeMillis());
return false;
}));
if (nearbyPlayers.size() == 0)
return;

View File

@ -1329,7 +1329,10 @@ public class NMSImpl implements NMSBridge {
List<Player> nearbyPlayers = Lists.newArrayList(Iterables
.filter(CitizensAPI.getLocationLookup().getNearbyPlayers(entity.getLocation(), 64), (p) -> {
Long time = meta.getMarker(p.getUniqueId(), entity.getUniqueId().toString());
return time == null || Math.abs(System.currentTimeMillis() - time) > 5000;
if (time == null || Math.abs(System.currentTimeMillis() - time) > 5000)
return true;
meta.set(p.getUniqueId(), entity.getUniqueId().toString(), System.currentTimeMillis());
return false;
}));
if (nearbyPlayers.size() == 0)
return;

View File

@ -1149,7 +1149,10 @@ public class NMSImpl implements NMSBridge {
List<Player> nearbyPlayers = Lists.newArrayList(Iterables
.filter(CitizensAPI.getLocationLookup().getNearbyPlayers(entity.getLocation(), 64), (p) -> {
Long time = meta.getMarker(p.getUniqueId(), entity.getUniqueId().toString());
return time == null || Math.abs(System.currentTimeMillis() - time) > 5000;
if (time == null || Math.abs(System.currentTimeMillis() - time) > 5000)
return true;
meta.set(p.getUniqueId(), entity.getUniqueId().toString(), System.currentTimeMillis());
return false;
}));
if (nearbyPlayers.size() == 0)
return;