mirror of
https://github.com/Elecast2/EntityTrackerFixer.git
synced 2024-09-27 14:02:38 +02:00
fix crash #2
This commit is contained in:
parent
827bea0c57
commit
1fbe990777
@ -16,7 +16,7 @@ disable-tick-for-untracked-entities: true
|
|||||||
untrack-ticks: 400
|
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
|
#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
|
#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)
|
#It will check for players traking entities and will track it again (this is to prevent invisible entities)
|
||||||
|
@ -16,10 +16,12 @@ import net.minemora.entitytrackerfixer.util.ReflectionUtils;
|
|||||||
public class EntityTickManager extends TimerTask {
|
public class EntityTickManager extends TimerTask {
|
||||||
|
|
||||||
private static Field tickingField;
|
private static Field tickingField;
|
||||||
|
private static Field tickingEntitiesField;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
try {
|
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) {
|
} catch (NoSuchFieldException | SecurityException | IllegalArgumentException | IllegalAccessException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
@ -54,8 +56,7 @@ public class EntityTickManager extends TimerTask {
|
|||||||
for(String worldName : cache.keySet()) {
|
for(String worldName : cache.keySet()) {
|
||||||
WorldServer ws = ((CraftWorld)Bukkit.getWorld(worldName)).getHandle();
|
WorldServer ws = ((CraftWorld)Bukkit.getWorld(worldName)).getHandle();
|
||||||
try {
|
try {
|
||||||
boolean ticking = tickingField.getBoolean(ws);
|
if(tickingEntitiesField.getBoolean(ws) || tickingField.getBoolean(ws)) {
|
||||||
if(ticking) {
|
|
||||||
//System.out.println("ticking");
|
//System.out.println("ticking");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user