when i start up my server this plugin doesn't load in?
http://gyazo.com/01429fa54f67c90f32fa6b30307f50c8
package me.Minecraft_GOLD.Nightv;
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;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
public class Nightv extends JavaPlugin {
public void onEnable() {
}
public void onDisable() {}
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
if (!(sender instanceof Player)) {
sender.sendMessage(ChatColor.DARK_RED + "Error: The console Can't run this command!.");
return true;
}
Player p = (Player) sender;
if (cmd.getName().equalsIgnoreCase("nv")) {
p.addPotionEffect(new PotionEffect(PotionEffectType.NIGHT_VISION, 5000, 1));
p.sendMessage(ChatColor.GREEN + "Night Vision Enabled!.");
}
return false;
}
}
http://gyazo.com/01429fa54f67c90f32fa6b30307f50c8
package me.Minecraft_GOLD.Nightv;
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;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
public class Nightv extends JavaPlugin {
public void onEnable() {
}
public void onDisable() {}
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
if (!(sender instanceof Player)) {
sender.sendMessage(ChatColor.DARK_RED + "Error: The console Can't run this command!.");
return true;
}
Player p = (Player) sender;
if (cmd.getName().equalsIgnoreCase("nv")) {
p.addPotionEffect(new PotionEffect(PotionEffectType.NIGHT_VISION, 5000, 1));
p.sendMessage(ChatColor.GREEN + "Night Vision Enabled!.");
}
return false;
}
}
Create an account or sign in to comment.
11
1
A wise man once put it, "Get a job, get a cake, or get lost bub."
1
The cake was a lie, it's either get a job or get lost.
1
Make sure:
- Craftbukkit versions match
- No tabs or extra spaces in plugin.yml
- You exported it correctly, sometimes it messes up
- You post any errors you get. Try Bukkit.broadcastMessage("")'ing things to test what works and what doesn't.
Also, your main class path is not the same as what you have in your plugin.yml regarding capital letters. If you've fixed it, update your post so we don't have to try to help a non existant problem
Btw: There should be an error no matter what unless you completely left our your onEnable()
- Craftbukkit versions match
- No tabs or extra spaces in plugin.yml
- You exported it correctly, sometimes it messes up
- You post any errors you get. Try Bukkit.broadcastMessage("")'ing things to test what works and what doesn't.
Also, your main class path is not the same as what you have in your plugin.yml regarding capital letters. If you've fixed it, update your post so we don't have to try to help a non existant problem
Btw: There should be an error no matter what unless you completely left our your onEnable()
1
Anyways, if your plugin simply isn't showing up in the console whatsoever (i.e. No errors, start-up messages, etc.), then it's a problem with your plugin.yml. Put this in your main section in your plugin.yml For your command use two spaces (Yes some people say 3 or 4, but 2 has always worked for me).
This is my code for an op command I used on my server. It made things easier when I was testing plugins. I wouldn't have to switch back and forth between my console.
http://hastebin.com/jinasecuni.java
Click to reveal
"me.Minecraft_GOLD.Nightv.Nightv" (without quotation marks).
This is my code for an op command I used on my server. It made things easier when I was testing plugins. I wouldn't have to switch back and forth between my console.
http://hastebin.com/jinasecuni.java
1
From my experience, even if the command is in the same class you still need to implement CommandExecutor. I know for a fact you have to do that with listeners since it's one of the problems I ran into when I first started coding plugins.
1
Well, it's been a long time since I've put a command in the main class, so maybe you do need to implement CommandExecutor.. I can't remember. But I'm pretty sure he doesn't need to register the command.
1
You didn't register the command nor implement CommandExecutor. Also, can you show the plugin.yml contents?
1
If his command is inside a class that extends JavaPlugin, then there's no need for implementing CommandExecutor, nor register the command.
1
You have a capital V at the end, your class has a lower case v. Your main needs to have a lower case v.
1
1
Can you share the plugin.yml?