Nodus people on my server dropped stacks of crap everywhere. So I thought of the drop delay! 1 second between each drop. This includes dragging out of inventory and pressing the Q button. Please do not interfere with kill/death event drops or chest drops. bypass.dropdelay ^ bypasses dropdelay (I have PEX and VAULT) STUFF I FOUND: http://jd.bukkit.org/doxygen/dd/d60..._1event_1_1player_1_1PlayerDropItemEvent.html I think you use PlayerDropItemEvent (final Player player, final Item drop) then setCancelled (boolean cancel) if drops faster than 1 sec I don't know so it would be awesome if you could post the source code too!
zecheesy, I'll make this for you zecheesy Jar: https://www.dropbox.com/s/2qoy9w5tjlmvp70/DropDelay.jar/ Source: https://github.com/JayzaSapphire/DropDelay/ Edit: Exempt permission: dropdelay.bypass EDIT by Moderator: merged posts, please use the edit button instead of double posting.
Nice work! Two things: There's no point in having methods that you aren't using: Code: public void onDisable() { } Java conventions say you should always use braces. The following confused me at first because I expected the return statement to be below. Code: if (event.isCancelled() || event.getPlayer().hasPermission("dropdelay.bypass")) return; Also, even though it's a small plugin you should probably use separate classes for the listener and the main class. Edit: And why does the task have to be asynchronous? I don't think that's the aim, but the lag will be negligible anyway.
Major I like to keep the onDisable method there even if i'm not using it, makes no difference anyways. There is also no need to use seperate classes if you don't want to, it also makes no difference. And that is the only time that i actually don't use braces. And i never said it had to be Asynchronous, i just don't use the main thread.
http://wiki.bukkit.org/Scheduler_Programming https://github.com/Bukkit/Bukkit/blob/master/src/main/java/org/bukkit/scheduler/BukkitScheduler.java
An asynchronous uses a disgusting amount of process if you use it for events that aren't approved for it. World Generation I believe is one of them, see here. What your going to do as have a task created after every single time a drop is well, dropped. So say 6 people dropped each a stack of CobbleStone (64) that's 384 tasks your plugin just created to begin after every second the server ticks. Synchronous tasks count with the server currently ticking. Therefore the main thread will cover your one second delay.
Also, an asynchronous task that is calling methods which are not thread-safe can result in some very horrible issues, such as deadlock (although probably not in this case specifically).