Oh hello, this is my first post and there will surely be more of it xD tl;dr version. I will get to the point. Basically, I learnt some java basic a year ago or so and I can't really recall that much for now. Still, I wanna give it a shot at plugins. Starting following some tutorials yesterday. This is the tutorial I'm following and making a similar one, even tho the plugin in that vid worked fine, mine does not. This is prob the main class. Code (Text): package me.NeonNature; import org.bukkit.plugin.java.JavaPlugin; public class TestPlugin2 extends JavaPlugin { @Override public void onEnable() { new PlayerListener(this); } @Override public void onDisable() { } } which connects to Code (Text): package me.NeonNature; import net.md_5.bungee.api.ChatColor; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.bukkit.event.player.PlayerEggThrowEvent; import org.bukkit.event.player.PlayerToggleSneakEvent; import org.bukkit.potion.PotionEffect; import org.bukkit.potion.PotionEffectType; public class PlayerListener implements Listener { public PlayerListener(TestPlugin2 plugin){ plugin.getServer().getPluginManager().registerEvents(this, plugin); } @EventHandler public void onSneak(PlayerToggleSneakEvent e) { Player player = e.getPlayer(); if (player.isSneaking()) { player.sendMessage(ChatColor.GREEN + "You are sneaking like a Ninja..."); player.addPotionEffect(new PotionEffect(PotionEffectType.SPEED,Integer.MAX_VALUE, 2 )); player.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, Integer.MAX_VALUE, 1)); } } @EventHandler public void onThrowingEggs(PlayerEggThrowEvent a) { Player player = a.getPlayer(); player.sendMessage(ChatColor.RED + "DO NOT THROW EGGS!"); player.setFireTicks(1200); } } The problem is, every time I run it. It cannot pass the events to testplugin2 :S Please ^^ Thank you in advance <3 :3 Is there anything I should provide more?
Sorry, I can't help you with your problem. But you have to change this to the Bukkit ChatColor import
Ow. Just noticed it's Bungee o.o' idk how it got there xD Whatever. I'll try to fix it and see if it works. I'll edit this post soon
In onEnable use: this.getServer().getPluginManager().registerEvents(new PlayerListener(), this); and in PlayerListener remove public PlayerListener(TestPlugin2 plugin){ plugin.getServer().getPluginManager().registerEvents(this, plugin); }
Oh, I suppose that might work the same. Still, thanks for the alternative ^^ On other words and surprisingly, @vloso 's fix worked. ^^ Thank you.
Oh yes ^^ But I need to recall stuffs. I don't really remember that much now, but still not a newb xD But still, what I learnt was just basic and I'm not specialized in Java ^^ I'll try to close this thread for now (if that's possible I mean)