Skip to content

Commit

Permalink
Prevent Shift + Click from placing items inside the menu
Browse files Browse the repository at this point in the history
  • Loading branch information
focamacho committed Jan 5, 2022
1 parent 4027f09 commit 7c896cc
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
allprojects {
group = 'com.focamacho'
version = '1.0.6'
version = '1.0.7'
}

subprojects {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,9 @@ public void onClick(InventoryClickEvent ce) {
// Prevent inventory double clicks from stealing items from the menu
if(ce.getClick() == ClickType.DOUBLE_CLICK) ce.setCancelled(true);

// Prevent Shift + Click from placing items inside the menu
if(ce.getClick() == ClickType.SHIFT_LEFT || ce.getClick() == ClickType.SHIFT_RIGHT) ce.setCancelled(true);

int slot = ce.getSlot();
if (slot < 9 * chestMenu.getRows()) {
ce.setCancelled(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,9 @@ public void update() {
// Prevent dragging items from placing items inside the menu
if(ce instanceof ClickInventoryEvent.Drag) ce.setCancelled(true);

// Prevent Shift + Click from placing items inside the menu
if(ce instanceof ClickInventoryEvent.Shift) ce.setCancelled(true);

// Prevent weird things from happening when sponge do not send the slot in the event
if(!ce.getSlot().isPresent()) {
ce.setCancelled(true);
Expand Down

0 comments on commit 7c896cc

Please sign in to comment.