|
9 | 9 | import com.sekwah.advancedportals.spigot.connector.container.SpigotPlayerContainer;
|
10 | 10 | import com.sekwah.advancedportals.spigot.connector.container.SpigotWorldContainer;
|
11 | 11 | import com.sekwah.advancedportals.spigot.utils.ContainerHelpers;
|
| 12 | + |
| 13 | +import java.util.Arrays; |
12 | 14 | import java.util.List;
|
13 | 15 | import org.bukkit.Location;
|
14 | 16 | import org.bukkit.Material;
|
@@ -232,21 +234,19 @@ public void onChunkLoad(ChunkLoadEvent event) {
|
232 | 234 | if (!configRepository.getDisableGatewayBeam()) {
|
233 | 235 | return;
|
234 | 236 | }
|
235 |
| - SpigotWorldContainer world = new SpigotWorldContainer(event.getWorld()); |
236 |
| - BlockState[] tileEntities = event.getChunk().getTileEntities(); |
237 |
| - for (BlockState block : tileEntities) { |
238 |
| - if (block.getType() == Material.END_GATEWAY) { |
239 |
| - Location loc = block.getLocation(); |
240 |
| - if (portalServices.inPortalRegion( |
241 |
| - new BlockLocation(loc.getWorld().getName(), |
242 |
| - loc.getBlockX(), loc.getBlockY(), |
243 |
| - loc.getBlockZ()), |
244 |
| - 2)) { |
245 |
| - EndGateway tileState = (EndGateway) block; |
246 |
| - tileState.setAge(Long.MIN_VALUE); |
247 |
| - tileState.update(); |
248 |
| - } |
249 |
| - } |
250 |
| - } |
| 237 | + Arrays.stream(event.getChunk().getTileEntities()) |
| 238 | + .filter(blockState -> blockState.getType() == Material.END_GATEWAY) |
| 239 | + .forEach(endGatewayPortal -> { |
| 240 | + Location loc = endGatewayPortal.getLocation(); |
| 241 | + if (portalServices.inPortalRegion( |
| 242 | + new BlockLocation(loc.getWorld().getName(), |
| 243 | + loc.getBlockX(), loc.getBlockY(), |
| 244 | + loc.getBlockZ()), |
| 245 | + 2)) { |
| 246 | + EndGateway tileState = (EndGateway) endGatewayPortal; |
| 247 | + tileState.setAge(Long.MIN_VALUE); |
| 248 | + tileState.update(); |
| 249 | + } |
| 250 | + }); |
251 | 251 | }
|
252 | 252 | }
|
0 commit comments