Skip to content

Commit 75ea089

Browse files
committed
Fix duplicated slots
1 parent 07ea88a commit 75ea089

3 files changed

Lines changed: 8 additions & 6 deletions

File tree

README.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ Small and easy Bukkit inventory API with 1.7 to 1.14 support !
5757
<dependency>
5858
<groupId>fr.mrmicky</groupId>
5959
<artifactId>FastInv</artifactId>
60-
<version>3.0</version>
60+
<version>3.0.1</version>
6161
<scope>compile</scope>
6262
</dependency>
6363
</dependencies>
@@ -86,7 +86,7 @@ Just small example:
8686
```java
8787
public class ExampleInventory extends FastInv {
8888

89-
private AtomicBoolean preventClose = new AtomicBoolean(false);
89+
private boolean preventClose = false;
9090

9191
public ExampleInventory() {
9292
super(45, ChatColor.GOLD + "Example inventory");
@@ -98,10 +98,12 @@ public class ExampleInventory extends FastInv {
9898
setItems(getBorders(), new ItemBuilder(Material.LAPIS_BLOCK).name(" ").build());
9999

100100
// Add a simple item to prevent closing the inventory
101-
setItem(34, new ItemBuilder(Material.BARRIER).name(ChatColor.RED + "Prevent close").build(), e -> preventClose.set(!preventClose.get()));
101+
setItem(34, new ItemBuilder(Material.BARRIER).name(ChatColor.RED + "Prevent close").build(), e -> {
102+
preventClose = !preventClose;
103+
});
102104

103105
// Prevent from closing when preventClose is to true
104-
setCloseFilter(p -> preventClose.get());
106+
setCloseFilter(p -> preventClose);
105107
}
106108

107109
@Override

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<groupId>fr.mrmicky</groupId>
88
<artifactId>fastinv</artifactId>
9-
<version>3.0</version>
9+
<version>3.0.1</version>
1010

1111
<name>FastInv</name>
1212
<url>https://github.com/MrMicky-FR/FastInv</url>

src/main/java/fr/mrmicky/fastinv/FastInv.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ void handleClick(InventoryClickEvent e) {
314314
clickHandlers.forEach(c -> c.accept(e));
315315
}
316316

317-
Consumer<InventoryClickEvent> clickConsumer = itemHandlers.get(e.getSlot());
317+
Consumer<InventoryClickEvent> clickConsumer = itemHandlers.get(e.getRawSlot());
318318

319319
if (clickConsumer != null) {
320320
clickConsumer.accept(e);

0 commit comments

Comments
 (0)