This commit is contained in:
Esmorall 2019-12-09 16:37:56 -03:00
parent 827bea0c57
commit 1fbe990777
2 changed files with 5 additions and 4 deletions

View File

@ -16,7 +16,7 @@ disable-tick-for-untracked-entities: true
untrack-ticks: 400
#if tps are not below this value, the task will not perform the untrack and it will wait for the next run
tps-limit: 18.5
tps-limit: 19.5
#frecuency in ticks to check untracked entities
#It will check for players traking entities and will track it again (this is to prevent invisible entities)

View File

@ -16,10 +16,12 @@ import net.minemora.entitytrackerfixer.util.ReflectionUtils;
public class EntityTickManager extends TimerTask {
private static Field tickingField;
private static Field tickingEntitiesField;
static {
try {
tickingField = ReflectionUtils.getClassPrivateField(WorldServer.class, "tickingEntities");
tickingEntitiesField = ReflectionUtils.getClassPrivateField(WorldServer.class, "tickingEntities");
tickingField = ReflectionUtils.getClassPrivateField(WorldServer.class, "ticking");
} catch (NoSuchFieldException | SecurityException | IllegalArgumentException | IllegalAccessException e) {
e.printStackTrace();
}
@ -54,8 +56,7 @@ public class EntityTickManager extends TimerTask {
for(String worldName : cache.keySet()) {
WorldServer ws = ((CraftWorld)Bukkit.getWorld(worldName)).getHandle();
try {
boolean ticking = tickingField.getBoolean(ws);
if(ticking) {
if(tickingEntitiesField.getBoolean(ws) || tickingField.getBoolean(ws)) {
//System.out.println("ticking");
continue;
}