Gets the Entity held in this EntityPersistor. If the reference is invalid, the EntityPersistor will attempt to refresh it. @return The wrapped Entity
()
| 92 | * @return The wrapped Entity |
| 93 | */ |
| 94 | public T get() { |
| 95 | refresh: |
| 96 | if (!entity.isValid()) { |
| 97 | for (Entity entity : this.entity.getLocation().getChunk().getEntities()) { |
| 98 | if (entity.getUniqueId().equals(this.entity.getUniqueId())) { |
| 99 | this.entity = (T) entity; |
| 100 | break refresh; |
| 101 | } |
| 102 | } |
| 103 | for (World world : Bukkit.getWorlds()) { |
| 104 | for (Entity entity : world.getEntities()) { |
| 105 | if (this.entity.getUniqueId().equals(entity.getUniqueId())) { |
| 106 | this.entity = (T) entity; |
| 107 | break; |
| 108 | } |
| 109 | } |
| 110 | } |
| 111 | } |
| 112 | return entity; |
| 113 | } |
| 114 | |
| 115 | } |
nothing calls this directly
no test coverage detected