1

Need coding help ;)

Rileys's Avatar Rileys1/29/15 2:00 am
1/30/2015 6:02 pm
Ciberg's Avatar Ciberg
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;
}
}
Posted by Rileys's Avatar
Rileys
Level 3 : Apprentice Network
1

Create an account or sign in to comment.

11

1
01/29/2015 8:12 pm
Level 1 : New Explorer
MCGeeneus
MCGeeneus's Avatar
A wise man once put it, "Get a job, get a cake, or get lost bub."
1
01/30/2015 6:02 pm
Level 18 : Journeyman Hunter
Ciberg
Ciberg's Avatar
The cake was a lie, it's either get a job or get lost.
1
01/29/2015 6:26 pm
Level 18 : Journeyman Hunter
Ciberg
Ciberg's Avatar
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()
1
01/29/2015 6:20 pm
Level 29 : Expert Modder
ArcaneGamer-
ArcaneGamer-'s Avatar
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
Click to reveal
"me.Minecraft_GOLD.Nightv.Nightv" (without quotation marks).
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
1
01/29/2015 6:13 pm
Level 29 : Expert Modder
ArcaneGamer-
ArcaneGamer-'s Avatar
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
01/29/2015 6:18 pm
Level 31 : Artisan Toast
ShadowCatEXE
ShadowCatEXE's Avatar
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
01/29/2015 4:56 pm
Level 29 : Expert Modder
ArcaneGamer-
ArcaneGamer-'s Avatar
You didn't register the command nor implement CommandExecutor. Also, can you show the plugin.yml contents?
1
01/29/2015 6:01 pm
Level 31 : Artisan Toast
ShadowCatEXE
ShadowCatEXE's Avatar
If his command is inside a class that extends JavaPlugin, then there's no need for implementing CommandExecutor, nor register the command.
1
01/29/2015 2:24 pm
Level 1 : New Crafter
Datac
Datac's Avatar
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
01/29/2015 5:02 am
Level 3 : Apprentice Network
Rileys
Rileys's Avatar
1
01/29/2015 2:03 am
Level 1 : New Crafter
Datac
Datac's Avatar
Can you share the plugin.yml?
Planet Minecraft

Website

© 2010 - 2024
www.planetminecraft.com

Welcome