Replace with Kyori

This commit is contained in:
Telesphoreo 2022-03-03 16:56:52 -06:00
parent 41f4029877
commit e258e27814

View File

@ -3,6 +3,7 @@ package dev.plex.world;
import dev.plex.Plex; import dev.plex.Plex;
import java.io.File; import java.io.File;
import java.util.Objects; import java.util.Objects;
import net.kyori.adventure.text.Component;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.WorldCreator; import org.bukkit.WorldCreator;
@ -37,16 +38,17 @@ public class CustomWorld extends WorldCreator
{ {
boolean existed = new File(name).exists(); boolean existed = new File(name).exists();
World world = super.generate(); World world = super.generate();
if (!existed) if (!existed)
{ {
Block block = world.getBlockAt(0, world.getHighestBlockYAt(0, 0) + 1, 0); Block block = world.getBlockAt(0, world.getHighestBlockYAt(0, 0) + 1, 0);
block.setType(Material.OAK_SIGN); block.setType(Material.OAK_SIGN);
BlockState state = block.getState(); BlockState state = block.getState();
if (state instanceof Sign) if (state instanceof Sign sign)
{ {
Sign sign = (Sign)state; sign.line(1, Component.text(
sign.setLine(1, Objects.requireNonNull(plugin.config.getString("worlds." + name + ".name"))); Objects.requireNonNull(plugin.config.getString("worlds." + name + ".name"))));
sign.setLine(2, "- 0, 0 -"); sign.line(2, Component.text("- 0, 0 -"));
sign.update(); sign.update();
} }
} }