This commit is contained in:
MidnightTale 2023-04-25 00:08:10 +07:00
commit 58a1f99cfa

View file

@ -84,9 +84,12 @@ public class FoliaFlow extends JavaPlugin implements Listener {
Location loc = new Location(Bukkit.getWorld("world_the_end"), 100, 48, 0); Location loc = new Location(Bukkit.getWorld("world_the_end"), 100, 48, 0);
BlockData blockData = Material.OBSIDIAN.createBlockData(); BlockData blockData = Material.OBSIDIAN.createBlockData();
display = Objects.requireNonNull(Bukkit.getWorld("world_the_end")).spawn(loc, BlockDisplay.class); display = Objects.requireNonNull(Bukkit.getWorld("world_the_end")).spawn(loc, BlockDisplay.class);
if (display == null) {
getLogger().severe("Failed to spawn BlockDisplay entity.");
return;
}
display.setBlock(blockData); display.setBlock(blockData);
getLogger().info("BlockDisplay entity spawned successfully.");
getServer().getPluginManager().registerEvents(this, this); getServer().getPluginManager().registerEvents(this, this);
} }
@ -99,6 +102,7 @@ public class FoliaFlow extends JavaPlugin implements Listener {
for (Entity entity : Objects.requireNonNull(Bukkit.getWorld("world_the_end")).getEntitiesByClass(BlockDisplay.class)) { for (Entity entity : Objects.requireNonNull(Bukkit.getWorld("world_the_end")).getEntitiesByClass(BlockDisplay.class)) {
entity.remove(); entity.remove();
} }
getLogger().info("BlockDisplay entity removed successfully.");
task.cancel(); task.cancel();
blockktask.cancel(); blockktask.cancel();
super.onDisable(); super.onDisable();