public class Airdrop extends JavaPlugin { @Override public void onEnable() { getLogger().info("AirdropPlugin has been enabled!"); if (getCommand("airdrop") != null) { getCommand("airdrop").setExecutor(new AirdropCommandExecutor()); } else { getLogger().warning("Command 'airdrop' not found!"); } }
@Override public void onDisable() { getLogger().info("AirdropPlugin has been disabled!"); } }
class AirdropCommandExecutor implements org.bukkit.command.CommandExecutor { @Override public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, String label, String[] args) { if (label.equalsIgnoreCase("airdrop") && sender instanceof Player && sender.isOp()) { Player player = (Player) sender; Random random = new Random(); int x = random.nextInt(3000); int z = random.nextInt(3000); Location dropLocation = new Location(player.getWorld(), x, player.getWorld().getHighestBlockYAt(x, z), z); player.getWorld().getBlockAt(dropLocation).setType(Material.BARREL); player.sendMessage("Airdrop spawned at coordinates: X: " + x + ", Z: " + z); return true; } return true; } }
а вот код в paper-plugin.yml name: airdrop version: '${project.version}' main: echolinochka.airdrop.Airdrop api-version: '1.20' commands: airdrop: description: Spawns an airdrop barrel at a random location within 3000x3000. usage: /airdrop permission: airdrop.command
ядро сервера paper 1.20.4 и нет ошибок не в коде не на сервере в консоли но почему-то нету команды на сервере
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;
import org.jetbrains.annotations.NotNull;
import java.util.Random;
public class Airdrop extends JavaPlugin {
@Override
public void onEnable() {
getLogger().info("AirdropPlugin has been enabled!");
if (getCommand("airdrop") != null) {
getCommand("airdrop").setExecutor(new AirdropCommandExecutor());
} else {
getLogger().warning("Command 'airdrop' not found!");
}
}
@Override
public void onDisable() {
getLogger().info("AirdropPlugin has been disabled!");
}
}
class AirdropCommandExecutor implements org.bukkit.command.CommandExecutor {
@Override
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, String label, String[] args) {
if (label.equalsIgnoreCase("airdrop") && sender instanceof Player && sender.isOp()) {
Player player = (Player) sender;
Random random = new Random();
int x = random.nextInt(3000);
int z = random.nextInt(3000);
Location dropLocation = new Location(player.getWorld(), x, player.getWorld().getHighestBlockYAt(x, z), z);
player.getWorld().getBlockAt(dropLocation).setType(Material.BARREL);
player.sendMessage("Airdrop spawned at coordinates: X: " + x + ", Z: " + z);
return true;
}
return true;
}
}
а вот код в paper-plugin.yml
name: airdrop
version: '${project.version}'
main: echolinochka.airdrop.Airdrop
api-version: '1.20'
commands:
airdrop:
description: Spawns an airdrop barrel at a random location within 3000x3000.
usage: /airdrop
permission: airdrop.command
ядро сервера paper 1.20.4 и нет ошибок не в коде не на сервере в консоли но почему-то нету команды на сервере