Solved I need help!

Discussion in 'Plugin Development' started by Geekhellmc, Aug 6, 2014.

Thread Status:
Not open for further replies.
  1. Offline

    Geekhellmc

    I am pretty sure that alot of you know that when by exemple you do ChatColor. they give you a list of colors or when you do (something). it gives you a list of what it can do. Well it works fine on all my projects but 1 class in a project! It's not working at all in this class. Can anyone help me?
     
  2. Offline

    Geekhellmc

    AdamQpzm When I type by exemple ChatColor. in the class the different Color options don't appear.
     
  3. Offline

    CaLxCyMru

    Hello!
    Are you sure that you are importing the ChatColor class in the class that is giving you an error? Double check to see if you have this line;
    Code:java
    1. import org.bukkit.ChatColor;

    At the top of the class! :)
     
  4. Offline

    Geekhellmc

  5. Geekhellmc If you type ChatColor.RED, do you get an error?
     
  6. Offline

    CaLxCyMru

    Can you please paste your class?
     
  7. Offline

    Geekhellmc

    No I don't. Everything is fine but I really need that small tab that appears that shows the options so I know I am doing right with no errors. It's not just for ChatColor but for other things.
     
  8. Offline

    Geekhellmc

    CaLxCyMru this is the full Wand class. That's the class problem.
    Code:
    package me.Geekhellmc.SSB;
     
    import java.util.Arrays;
     
    import me.Geekhellmc.SSB.MessageManager.MessageTypie;
     
    import org.bukkit.ChatColor;
    import org.bukkit.Material;
    import org.bukkit.entity.Entity;
    import org.bukkit.entity.Fireball;
    import org.bukkit.entity.Player;
    import org.bukkit.event.player.PlayerInteractEvent;
    import org.bukkit.inventory.ItemStack;
    import org.bukkit.inventory.meta.ItemMeta;
    import org.bukkit.potion.PotionEffect;
    import org.bukkit.potion.PotionEffectType;
    import org.bukkit.util.Vector;
     
    public enum Wand {
     
        FIRE("Fire Blast", ChatColor.RED, new WandRunnable(){
            public void run(PlayerInteractEvent e){
                Fireball fb = e.getPlayer().launchProjectile(Fireball.class);
                fb.setIsIncendiary(false);
                fb.setYield(0F);
            }
        }),
     
        AIR("Air Blast", ChatColor.GRAY, new WandRunnable() {
            public void run(PlayerInteractEvent e) {
                for (Entity en : e.getPlayer().getNearbyEntities(3, 3, 3)) {
                    if (en instanceof Player) {
                        for (Entity entity : e.getPlayer().getNearbyEntities(5D, 5D, 5D)){
                            entity.setVelocity(new Vector(0.0, 1.5, 0.0));
                        }
                    }
                }
            }
        }),
        NATURE("NaturePoison", ChatColor.DARK_GREEN, new WandRunnable() {
            public void run(PlayerInteractEvent e) {
                for (Entity en : e.getPlayer().getNearbyEntities(3, 3, 3)) {
                    if (en instanceof Player) {
                        ((Player) en).addPotionEffect(new PotionEffect(PotionEffectType.POISON, 20 * 5, 1));
                        MessageManager.getInstance().msg((Player) en, MessageTypie.INFO, ChatColor.DARK_PURPLE + "You have been poisoned by " + e.getPlayer().getName() + "!");
                        MessageManager.getInstance().msg(e.getPlayer(), MessageTypie.INFO, ChatColor.DARK_PURPLE + "You have poisoned " + ((Player) en).getName() + "!");
                    }
                }
            }
        });
     
        private String name;
        private ChatColor color;
        private WandRunnable run;
     
        Wand(String name, ChatColor color, WandRunnable run){
            this.name = name;
            this.color = color;
            this.run = run;
        }
     
        public String getName(){
            return name;
        }
     
        public ChatColor getColor(){
            return color;
        }
     
        public String getFullName(){
            return color + name;
        }
     
        public void run(PlayerInteractEvent e){
            run.run(e);
        }
     
        public ItemStack createItemStack(){
            ItemStack i = new ItemStack(Material.STICK, 1);
     
            ItemMeta im = i.getItemMeta();
            im.setDisplayName(getFullName());
            im.setLore(Arrays.asList("A magic wand!"));
     
            i.setItemMeta(im);
     
            return i;
        }
     
        public static Wand forName(String name){
            for (Wand w : Wand.values()){
                if (w.getName().equalsIgnoreCase(name)) return w;
            }
     
            return null;
        }
     
    }
     
    abstract class WandRunnable {public abstract void run(PlayerInteractEvent e); }
    I am using bukkit 1.7.2 R0.3 and CraftBukkit 1.7.2 R0.3 but I use it in all my projects and it works fine.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 9, 2016
  9. Offline

    MrDynamo

    He asked what program you are using to edit your code, not your bukkit version.
     
  10. Offline

    Geekhellmc

    Oh wait,fixed it! I just had to reimport the external jars XD

    MrDynamo Sorry I confused JDK and IDE I use Eclipse

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 9, 2016
  11. Geekhellmc So you thought I was asking for your JDK, and you provided your Bukkit version? :S
     
    MrDynamo likes this.
  12. Offline

    Geekhellmc

    I keep forgetting what is IDE and JDK XD
     
Thread Status:
Not open for further replies.

Share This Page