This is a very small [only 1.17kb file size], very simple plugin that stops any player who does not have dropprevent.allowdrop from dropping items manually. Players will still drop items on death. Players will not be allowed to drop items by default, a player HAS to have the permission dropprevent.allowdrop in order to drop items, which means ops/players with all permissions will be able to drop with no need to edit permissions.
This is literally the source code, there is no config necessary, and it will work right out of the box. I think i made it as small as possible.
package com.K3R3P0.DropPrevent;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerDropItemEvent;
import org.bukkit.plugin.PluginManager;
import org.bukkit.plugin.java.JavaPlugin;
public class DropPrevent extends JavaPlugin implements Listener{
public void onEnable() {
PluginManager pm = getServer().getPluginManager();
pm.registerEvents(this, this);
}
@EventHandler
public void onPlayerDropItem(PlayerDropItemEvent event) {
if(!event.getPlayer().hasPermission("dropprevent.allowdrop")) {event.setCancelled(true);}
}
}
Thanks to chaseoes for helping me make this plugin even smaller!
I made this for my own needs, but figured i'd release it for anyone else who needs a simple solution to item dropping, if you need a more advanced anti-drop plugin, i suggest AntiDrops :)