Last active
March 29, 2026 17:29
-
-
Save Polokalap/c477dd203882bd61e4f159818f3aee8e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package mel.Polokalap.disabler.Commands; | |
| import mel.Polokalap.disabler.Main; | |
| import net.kyori.adventure.key.Namespaced; | |
| import net.kyori.adventure.text.Component; | |
| import net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer; | |
| import org.bukkit.*; | |
| import org.bukkit.block.Block; | |
| import org.bukkit.block.Sign; | |
| import org.bukkit.block.sign.Side; | |
| import org.bukkit.command.Command; | |
| import org.bukkit.command.CommandExecutor; | |
| import org.bukkit.command.CommandSender; | |
| import org.bukkit.entity.Player; | |
| import org.jetbrains.annotations.NotNull; | |
| public class TestCommand implements CommandExecutor { | |
| private static Main plugin = Main.getInstance(); | |
| @Override | |
| public boolean onCommand(@NotNull CommandSender sender, @NotNull Command cmd, @NotNull String s, @NotNull String @NotNull [] args) { | |
| if (!(sender instanceof Player player)) { | |
| sender.sendMessage(plugin.getConfig().getString("console.player")); | |
| return true; | |
| } | |
| double x = player.getLocation().clone().getX(); | |
| double y = player.getLocation().clone().getY(); | |
| double z = player.getLocation().clone().getZ(); | |
| World world = player.getWorld(); | |
| Location loc = new Location(world, x, y - 5.0d, z); | |
| Block block = loc.getBlock(); | |
| Material preBlockType = block.getType(); | |
| block.setType(Material.CHERRY_SIGN); | |
| Sign sign = (Sign) block.getState(); | |
| sign.getSide(Side.FRONT).line(2, Component.translatable("key.forward")); | |
| sign.getSide(Side.FRONT).line(1, Component.translatable("block.minecraft.cobblestone")); | |
| sign.getSide(Side.FRONT).line(0, Component.translatable("text.autoconfig.appleskin.title")); | |
| sign.setEditable(true); | |
| sign.setAllowedEditorUniqueId(player.getUniqueId()); | |
| sign.update(); | |
| player.openSign(sign, Side.FRONT); | |
| String line0 = PlainTextComponentSerializer.plainText() | |
| .serialize(sign.getSide(Side.FRONT).line(0)); | |
| String line1 = PlainTextComponentSerializer.plainText() | |
| .serialize(sign.getSide(Side.FRONT).line(1)); | |
| String line2 = PlainTextComponentSerializer.plainText() | |
| .serialize(sign.getSide(Side.FRONT).line(2)); | |
| player.sendMessage(line0); | |
| player.sendMessage(line1); | |
| player.sendMessage(line2); | |
| System.out.println(line0); | |
| System.out.println(line1); | |
| System.out.println(line2); | |
| player.closeInventory(); | |
| block.setType(preBlockType); | |
| return true; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment