I'm trying to make a Minecraft plugin that does /daytime. The plugin gets recognized by /pl, but if I execute the command it does not work.
I tried modifying and moving the plugin.xml thinking Bukkit did not know where the main class was.
package domenicoplugin.domenicopluginbello;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.plugin.java.JavaPlugin;
public final class Domenicopluginbello extends JavaPlugin {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (command.getName().equalsIgnoreCase("daytime")) {
getServer().getWorlds().get(0).setTime(1000); // set time to morning (1000 ticks)
sender.sendMessage("The time has been set to morning.");
return true;
}
return false;
}
}
}
You should follow wiki to create a command.
extends JavaPluginas main class that register command and multiple others. This class should contains aonEnable()method which register commands.getCommand("daytime").setExecutor(new DayTimeCommand());plugin.ymlfile like:DayTimeCommandthat will be like:PS: I suggest you to change the name of package/class, and use
domenico.belloas package, andBelloorMainas class name.