1
Plugin Issue
I'm making a plugin and it involves ItemStacks. The issue is when i do /pl with that jar installed, it doesnt show on the list. Here is that Main.java class:
Also, here's the plugin.yml:
Please only comment if you know whats wrong. If you see nothing wrong, let me know to.
package me.Thom4444.DivergentWars;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.PlayerInventory;
import org.bukkit.plugin.java.JavaPlugin;
public class Main extends JavaPlugin {
@Override
public void onEnable(){
getLogger().info("Plugin Enabled. Ready to choose a faction.");
}
@Override
public void onDisable() {
getLogger().info("Plugin Disabled.");
}
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args){
Player p = (Player) sender;
if(cmd.getName().equalsIgnoreCase("dauntless")){
PlayerInventory pi = p.getInventory();
ItemStack dauntlessSword = new ItemStack(Material.IRON_SWORD, 1);
dauntlessSword.addEnchantment(Enchantment.DAMAGE_ALL, 1);
ItemStack dauntlessBow = new ItemStack(Material.BOW, 1);
ItemStack dauntlessArrow = new ItemStack(Material.ARROW, 128);
ItemStack dauntlessHelm = new ItemStack(Material.CHAINMAIL_HELMET, 1);
ItemStack dauntlessChest = new ItemStack(Material.CHAINMAIL_CHESTPLATE, 1);
ItemStack dauntlessLegs = new ItemStack(Material.IRON_LEGGINGS, 1);
ItemStack dauntlessBoots = new ItemStack(Material.CHAINMAIL_BOOTS, 1);
pi.clear();
pi.addItem(dauntlessSword);
pi.addItem(dauntlessBow);
pi.addItem(dauntlessArrow);
pi.setHelmet(dauntlessHelm);
pi.setChestplate(dauntlessChest);
pi.setLeggings(dauntlessLegs);
pi.setBoots(dauntlessBoots);
p.sendMessage(ChatColor.AQUA + "You have chosen: " + ChatColor.RED + "Dauntless.");
}else if(cmd.getLabel().equalsIgnoreCase("abnegation")){
PlayerInventory pi = p.getInventory();
ItemStack abnegSword = new ItemStack(Material.STONE_SWORD, 1);
abnegSword.addEnchantment(Enchantment.DAMAGE_ALL, 1);
ItemStack abnegHelm = new ItemStack(Material.CHAINMAIL_HELMET, 1);
abnegHelm.addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 1);
ItemStack abnegChest = new ItemStack(Material.CHAINMAIL_CHESTPLATE, 1);
abnegChest.addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 1);
ItemStack abnegLegs = new ItemStack(Material.CHAINMAIL_LEGGINGS, 1);
abnegLegs.addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 1);
ItemStack abnegBoots = new ItemStack(Material.CHAINMAIL_BOOTS, 1);
abnegBoots.addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 1);
pi.clear();
pi.addItem(abnegSword);
pi.setHelmet(abnegHelm);
pi.setChestplate(abnegChest);
pi.setLeggings(abnegLegs);
pi.setBoots(abnegBoots);
p.sendMessage(ChatColor.AQUA + "You have chosen: " + ChatColor.GRAY + "Abnegation");
}else if(cmd.getLabel().equalsIgnoreCase("erudite")){
PlayerInventory pi = p.getInventory();
ItemStack eruSword = new ItemStack(Material.WOOD_SWORD, 1);
eruSword.addEnchantment(Enchantment.DAMAGE_ALL, 1);
ItemStack eruBow = new ItemStack(Material.BOW, 1);
eruBow.addEnchantment(Enchantment.ARROW_INFINITE, 1);
ItemStack eruHelm = new ItemStack(Material.LEATHER_HELMET, 1);
ItemStack eruChest = new ItemStack(Material.LEATHER_CHESTPLATE, 1);
ItemStack eruLegs = new ItemStack(Material.LEATHER_LEGGINGS, 1);
ItemStack eruBoots = new ItemStack(Material.LEATHER_BOOTS, 1);
pi.clear();
pi.addItem(eruSword);
pi.addItem(eruBow);
pi.setHelmet(eruHelm);
pi.setChestplate(eruChest);
pi.setLeggings(eruLegs);
pi.setBoots(eruBoots);
p.sendMessage(ChatColor.AQUA + "You have chosen: " + ChatColor.BLUE + "Erudite.");
}else if(cmd.getLabel().equalsIgnoreCase("amity")){
PlayerInventory pi = p.getInventory();
ItemStack amityRose = new ItemStack(Material.RED_ROSE, 1);
amityRose.addEnchantment(Enchantment.DAMAGE_ALL, 5);
ItemStack amitySnow = new ItemStack(Material.SNOW_BALL, 64);
ItemStack amityHelm = new ItemStack(Material.LEATHER_HELMET);
amityHelm.addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 2);
ItemStack amityChest = new ItemStack(Material.LEATHER_CHESTPLATE);
amityChest.addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 2);
ItemStack amityLegs = new ItemStack(Material.LEATHER_LEGGINGS);
amityLegs.addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 2);
ItemStack amityBoots = new ItemStack(Material.LEATHER_BOOTS);
amityBoots.addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 2);
pi.clear();
pi.addItem(amityRose);
pi.addItem(amitySnow);
pi.setHelmet(amityHelm);
pi.setChestplate(amityChest);
pi.setLeggings(amityLegs);
pi.setBoots(amityBoots);
p.sendMessage(ChatColor.AQUA + "You have chosen: " + ChatColor.YELLOW + "Amity.");
}else if(cmd.getLabel().equalsIgnoreCase("candor")){
PlayerInventory pi = p.getInventory();
ItemStack candSword = new ItemStack(Material.IRON_SWORD, 1);
candSword.addEnchantment(Enchantment.DAMAGE_ALL, 2);
ItemStack candHelm = new ItemStack(Material.CHAINMAIL_HELMET, 1);
ItemStack candChest = new ItemStack(Material.CHAINMAIL_CHESTPLATE, 1);
ItemStack candLegs = new ItemStack(Material.CHAINMAIL_LEGGINGS, 1);
ItemStack candBoots = new ItemStack(Material.CHAINMAIL_BOOTS, 1);
pi.clear();
pi.addItem(candSword);
pi.setHelmet(candHelm);
pi.setChestplate(candChest);
pi.setLeggings(candLegs);
pi.setBoots(candBoots);
p.sendMessage(ChatColor.AQUA + "You have chosen: " + ChatColor.WHITE + "Candor.");
}
return false;
}
}
Also, here's the plugin.yml:
name: DivergentWars
author: Thom4444
version: 1.0
description: Are you Divergent?
main: me.Thom4444.DivergentWars.Main
commands:
dauntless:
description: Choose Dauntless
abnegation:
description: Choose Abnegation
erudite:
description: Choose Erudite
amity:
description: Choose Amity
candor:
description: Choose Candor
Please only comment if you know whats wrong. If you see nothing wrong, let me know to.
1
Did you make sure to add the Bukkit API as a dependency?
