Sueta

NoFurnaceExp

1.0.0

do not issue any exp when you extract an item from a furnace (toggle-able)

·Plugin

This tiny plugin will prevent exp to be issued when a player extract an item/items from a furnace.

Command:

  • /nfexp : toggle no furnace exp mode.

Permissions:

  • nfexp.toggle : allows you to toggle no furnace exp mode.

Code:

Spoiler
package com.vk2gpz.nofurnaceexp;

import org.bukkit.command.*;
import org.bukkit.event.*;
import org.bukkit.event.inventory.FurnaceExtractEvent;
import org.bukkit.plugin.PluginDescriptionFile;
import org.bukkit.plugin.java.*;

public class NoFurnaceExp extends JavaPlugin implements CommandExecutor, Listener {
   private boolean noExp;
   
   @Override
   public void onEnable() {
      this.saveDefaultConfig();
      noExp = getConfig().getBoolean("NoExpMode", true);
      getCommand("nfexp").setExecutor(this);
      getServer().getPluginManager().registerEvents(this, this);
      
      PluginDescriptionFile pdfile = getDescription();
      getLogger().info(pdfile.getName() + " version " + pdfile.getVersion() + " is Enabled");
   }
   
   @Override
   public void onDisable() {
      PluginDescriptionFile pdFile = getDescription();
      getLogger().info(pdFile.getName() + " version " + pdFile.getVersion() + " is Disabled");
   }
   
   
   @Override
   public boolean onCommand(CommandSender s, Command c, String l, String[] a) {
      if (s.hasPermission("nfexp.toggle")) {
         noExp = !noExp;
         s.sendMessage("§6No exp mode §c" + (noExp ? "enabled" : "disabled") + "§6.");
      }
      return true;
   }
   
   
   @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
   public void onFurnaceExtract(FurnaceExtractEvent e) {
      if (noExp) {
         e.setExpToDrop(0);
      }
   }
}

Similar projects

Plugin →