1
私は、minecraft用のプラグインを作成しようとしていました。最初のバージョンはうまくいきました、それは/ healと/ hしか持っていなかったので、私は/ dayと/ weedを追加しました。Bukkitプラグインが動作しない
:すべてこのクラスのplugins.ymlでエラーがない
@Override
public void onEnable() {
System.out.println("kBase has been enabled");
}
@Override
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
if (cmd.getName().equalsIgnoreCase("heal") || cmd.getName().equalsIgnoreCase("h")) {
if (sender instanceof Player) {
Player player = (Player) sender;
if (player.hasPermission("kbase.heal")) {
if(args.length == 0){
((Damageable) sender).setHealth(20);
sender.sendMessage(ChatColor.GREEN + "You have been healed!");
} else if(args.length == 1){
String playerName = args[0];
Player selected = Bukkit.getServer().getPlayer(playerName);
if (selected == null) {
sender.sendMessage(ChatColor.RED + "The player" + ChatColor.GOLD + playerName + ChatColor.RED + "Is not online");
} else {
selected.setHealth(20.0);
selected.sendMessage(ChatColor.GREEN + "You have been healed");
sender.sendMessage(ChatColor.GREEN + "You have healed" + ChatColor.GOLD + playerName);
}
}
} else {
player.sendMessage(ChatColor.RED + "You do not have enough permissions");
}
}else if (cmd.getName().equalsIgnoreCase("day")) {
if (sender instanceof Player) {
Player player = (Player) sender;
World world = player.getWorld();
if (player.hasPermission("kbase.day")) {
world.setTime(0);
player.sendMessage(ChatColor.GREEN + "LET THERE BE LIGHT!");
} else {
player.sendMessage(ChatColor.RED + "You do not have enough permissions");
}
}else if (cmd.getName().equalsIgnoreCase("weed")) {
if (sender instanceof Player) {
Player player = (Player) sender;
if (player.hasPermission("kbase.weed")) {
player.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, 40, 1));
player.addPotionEffect(new PotionEffect(PotionEffectType.CONFUSION, 100, 1));
} else {
player.sendMessage(ChatColor.RED + "You do not have enough permissions");
}
}
}
}
}
return false;
}
:私はゲーム内/ PLを入力すると、それは "kBase"
プラグインクラスが表示されません
name: kBase
main: pw.klassic.kbase.kBase
version: 1.0
commands:
heal:
description: Heals yourself or someone else
h:
description: Heals yourself or someone else
day:
description: Makes the time day
weed:
description: Smoke weed everyday
permissions:
kbase.heal:
default: op
kbase.day:
default: op
kbase.weed
default: op
コンソールログ:
〜Klassic
コンソールで例外が発生していますか? – Rakete1111
私に見せて..... – Klassic
編集した質問 – Klassic