Skip to content

Commit

Permalink
Fix swap with off-hand allows item filter bypass
Browse files Browse the repository at this point in the history
  • Loading branch information
GeorgH93 committed Dec 29, 2024
1 parent a05bcc8 commit bab2a70
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2023 GeorgH93
* Copyright (C) 2024 GeorgH93
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand All @@ -25,6 +25,7 @@
import at.pcgamingfreaks.Message.Placeholder.Placeholder;
import at.pcgamingfreaks.Minepacks.Bukkit.API.Backpack;
import at.pcgamingfreaks.Minepacks.Bukkit.Minepacks;

import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
Expand Down Expand Up @@ -114,6 +115,13 @@ else if((event.getAction() == InventoryAction.HOTBAR_MOVE_AND_READD || event.get
event.setCancelled(true);
}
}
else if((event.getAction() == InventoryAction.HOTBAR_MOVE_AND_READD || event.getAction() == InventoryAction.HOTBAR_SWAP) && event.getClick().name().equals("SWAP_OFFHAND"))
{
if(checkIsBlockedAndShowMessage(player, player.getInventory().getItemInOffHand()))
{
event.setCancelled(true);
}
}
else if(!player.getInventory().equals(event.getClickedInventory()) && checkIsBlockedAndShowMessage(player, event.getCursor()))
{
event.setCancelled(true);
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<packaging>pom</packaging>

<properties>
<revision>2.4.31.5</revision>
<revision>2.4.31.6</revision>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>

Expand Down

0 comments on commit bab2a70

Please sign in to comment.