1 - 7 of 7
CasterisCraftJunkiesI figured it out, It was because I didn't make a class yet XD. Anyways, I wrote my first test plugin but the command isn't working:
here is my code:
package com.optisize.test;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;
public class Test extends JavaPlugin {
public void onEnable() {
Bukkit.getServer().getLogger().info("Test Plugin is enabled");
}
public void onDisable() {
Bukkit.getServer().getLogger().info("Test Plugin is disabled");
}
public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[]args) {
if (!(sender instanceof Player)) {
sender.sendMessage(ChatColor.GREEN +"The console ran the test command!");
return true;
}
Player player = (Player) sender;
if (cmd.getName().equalsIgnoreCase("test")) {
player.sendMessage("You ran the test command");
}
return true;
}
}
and my plugins.ymlname: test
version: 0.1
main: com.optisize.test.test
author: Optisize
description: a test plugin.
commands:
test:
usage: /<command>
description: a test command
Further then I've gotten lol
package com.optisize.test;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;
public class Test extends JavaPlugin {
public void onEnable() {
Bukkit.getServer().getLogger().info("Test Plugin is enabled");
}
public void onDisable() {
Bukkit.getServer().getLogger().info("Test Plugin is disabled");
}
public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[]args) {
if (!(sender instanceof Player)) {
sender.sendMessage(ChatColor.GREEN +"The console ran the test command!");
return true;
}
Player player = (Player) sender;
if (cmd.getName().equalsIgnoreCase("test")) {
player.sendMessage("You ran the test command");
}
return true;
}
}
name: test
version: 0.1
main: com.optisize.test.test
author: Optisize
description: a test plugin.
commands:
test:
usage: /<command>
description: a test command1 - 7 of 7
© 2010 - 2026 Cyprezz LLC
www.planetminecraft.com
Planet Minecraft has a Progressive Web App!
get_app Install PMC APP
Already a member? Sign in
By continuing, you agree to Planet Minecraft's Terms of Use and Privacy Policy
