Skip to content

Commit

Permalink
ignore drops in inventory clicks
Browse files Browse the repository at this point in the history
  • Loading branch information
xGinko committed Jan 2, 2025
1 parent 76c2fa0 commit e8be936
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -248,16 +248,11 @@ public void onPlayerArmorChange(PlayerArmorChangeEvent event) {

@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = false)
public void onInventoryClick(InventoryClickEvent event) {
if (event.isCancelled() && illegalHandling == IllegalHandling.PREVENT_USE_ONLY) return;
if (guiPluginsSupported && event.getInventory().getLocation() == null) return;

if (illegalHandling == IllegalHandling.PREVENT_USE_ONLY) {
if ( event.isCancelled()
|| event.getClick() == ClickType.DROP
|| event.getClick() == ClickType.CONTROL_DROP
|| event.getClick() == ClickType.WINDOW_BORDER_LEFT
|| event.getClick() == ClickType.WINDOW_BORDER_RIGHT) {
return;
}
if (event.getClick() == ClickType.DROP || event.getClick() == ClickType.CONTROL_DROP
|| event.getClick() == ClickType.WINDOW_BORDER_LEFT || event.getClick() == ClickType.WINDOW_BORDER_RIGHT) {
return;
}

if (listenerCooldowns.get(event.getClass(), createIfAbsent).contains(event.getWhoClicked().getUniqueId())) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -247,16 +247,11 @@ public void onPlayerArmorChange(PlayerArmorChangeEvent event) {

@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = false)
public void onInventoryClick(InventoryClickEvent event) {
if (event.isCancelled() && illegalHandling == IllegalHandling.PREVENT_USE_ONLY) return;
if (guiPluginsSupported && event.getInventory().getLocation() == null) return;

if (illegalHandling == IllegalHandling.PREVENT_USE_ONLY) {
if ( event.isCancelled()
|| event.getClick() == ClickType.DROP
|| event.getClick() == ClickType.CONTROL_DROP
|| event.getClick() == ClickType.WINDOW_BORDER_LEFT
|| event.getClick() == ClickType.WINDOW_BORDER_RIGHT) {
return;
}
if (event.getClick() == ClickType.DROP || event.getClick() == ClickType.CONTROL_DROP
|| event.getClick() == ClickType.WINDOW_BORDER_LEFT || event.getClick() == ClickType.WINDOW_BORDER_RIGHT) {
return;
}

if (listenerCooldowns.get(event.getClass(), createIfAbsent).contains(event.getWhoClicked().getUniqueId())) {
Expand Down

0 comments on commit e8be936

Please sign in to comment.