package net.milkycraft.Listeners;

import net.milkycraft.Spawnegg;

import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.enchantment.PrepareItemEnchantEvent;

public class EnchantListener implements Listener {
	/*
	 * Class Tested and working
	 */
	Spawnegg plugin;
	public EnchantListener(Spawnegg instance) {
		plugin = instance;
	}
	@EventHandler(priority = EventPriority.HIGH)
	public void onEnchantAttempt(PrepareItemEnchantEvent e) {
		if(plugin.getConfig().getBoolean("Disable.Enchanting") &&
				!e.getEnchanter().hasPermission("entitymanager.enchanting")) {
				e.setCancelled(true);
				return;
		}
	}
}

@@ -61,16 +61,78 @@
 wnegg;%0A%0A
+import org.bukkit.ChatColor;%0Aimport org.bukkit.entity.Player;%0A
 import o
@@ -157,24 +157,24 @@
 entHandler;%0A
-
 import org.b
@@ -403,16 +403,17 @@
 plugin;%0A
+%0A
 %09public 
@@ -473,16 +473,17 @@
 nce;%0A%09%7D%0A
+%0A
 %09@EventH
@@ -518,16 +518,19 @@
 ity.HIGH
+EST
 )%0A%09publi
@@ -586,16 +586,17 @@
 ) %7B%0A%09%09if
+ 
 (plugin.
@@ -643,16 +643,16 @@
 ng%22)
- &&
 %0A%09%09%09%09
+&& 
 !e.g
@@ -713,17 +713,16 @@
 )) %7B%0A%09%09%09
-%09
 e.setCan
@@ -742,16 +742,596 @@
 %0A%09%09%09
-%09return;
+e.getEnchanter().sendMessage(%0A%09%09%09%09%09ChatColor.GREEN + %22%5BEM%5D%22 + ChatColor.RED%0A%09%09%09%09%09%09%09+ %22 You dont have permission to enchant items!%22);%0A%09%09%09if (plugin.getConfig().getBoolean(%22Send-Alerts%22)) %7B%0A%09%09%09%09for (Player p : e.getEnchanter().getServer().getOnlinePlayers()) %7B%0A%09%09%09%09%09if (p.hasPermission(%22entitymanager.admin%22)) %7B%0A%09%09%09%09%09%09p.sendMessage(ChatColor.GREEN%0A%09%09%09%09%09%09%09%09+ %22%5BEM%5D %22%0A%09%09%09%09%09%09%09%09+ ChatColor.DARK_RED%0A%09%09%09%09%09%09%09%09+ e.getEnchanter().getDisplayName()%0A%09%09%09%09%09%09%09%09+ %22 tried to enchant a %22%0A%09%09%09%09%09%09%09%09+ ChatColor.GOLD%0A%09%09%09%09%09%09%09%09+ e.getItem().getType().toString()%0A%09%09%09%09%09%09%09%09%09%09.toLowerCase() + %22.%22);%0A%09%09%09%09%09%7D%0A%09%09%09%09%7D%0A%09%09%09%7D
 %0A%09%09%7D

Send alerts