I want to add a Fly Command to my plugin. That would be the first command I would do without tutorials.
Well, and as it is without much previous knowledge, it unfortunately does not work.
I would be happy if you could help me!
package me.Elias.geil.commands;
import org.bukkit.command.Command; import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player;
public class FlyCommand implements CommandExecutor {
@Override
public boolean onCommand (CommandSender sender, Command cmd, String label, String [] args) {
if (sender instanceof player)
{
Player player = (player) transmitter;
if (! Player.isFlying ()) {
player.setFlying (true);
sender.sendMessage ("You lost weight");
}
else {
player.setFlying (false);
sender.sendMessage ("You got fat!");
}
}
return true;
}
SetFlying (true); will throw an error if you don't setAllowFlight (true); used
PS:
In the event of errors, you should also read the error message. Or at least write…
Okay, I was a little premature. I'm sorry 😞