Skip to content
This repository was archived by the owner on Mar 10, 2022. It is now read-only.

Commit 3096bab

Browse files
Updated to latest version of Slimefun
1 parent ceba191 commit 3096bab

File tree

5 files changed

+30
-18
lines changed

5 files changed

+30
-18
lines changed

pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@
118118
<dependency>
119119
<groupId>com.github.TheBusyBiscuit</groupId>
120120
<artifactId>Slimefun4</artifactId>
121-
<version>RC-19</version>
121+
<version>RC-21</version>
122122
<scope>provided</scope>
123123
<exclusions>
124124
<exclusion>

src/main/java/io/github/thebusybiscuit/chestterminal/items/AccessTerminal.java

+1-9
Original file line numberDiff line numberDiff line change
@@ -77,15 +77,7 @@ public int[] getSlotsAccessedByItemTransport(ItemTransportFlow flow) {
7777
}
7878
};
7979

80-
registerBlockHandler(getId(), (p, b, tool, reason) -> {
81-
BlockMenu inv = BlockStorage.getInventory(b);
82-
83-
if (inv != null) {
84-
inv.dropItems(b.getLocation(), 17, 44);
85-
}
86-
87-
return true;
88-
});
80+
addItemHandler(new CTBlockBreakHandler(new int[] { 17, 44 }));
8981

9082
addItemHandler(new BlockPlaceHandler(true) {
9183

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package io.github.thebusybiscuit.chestterminal.items;
2+
3+
import org.bukkit.block.Block;
4+
5+
import io.github.thebusybiscuit.slimefun4.implementation.handlers.SimpleBlockBreakHandler;
6+
import me.mrCookieSlime.Slimefun.api.BlockStorage;
7+
import me.mrCookieSlime.Slimefun.api.inventory.BlockMenu;
8+
9+
class CTBlockBreakHandler extends SimpleBlockBreakHandler {
10+
11+
private final int[] slots;
12+
13+
CTBlockBreakHandler(int[] slots) {
14+
this.slots = slots;
15+
}
16+
17+
@Override
18+
public void onBlockBreak(Block b) {
19+
BlockMenu menu = BlockStorage.getInventory(b);
20+
21+
if (menu != null) {
22+
menu.dropItems(b.getLocation(), slots);
23+
}
24+
}
25+
26+
}

src/main/java/io/github/thebusybiscuit/chestterminal/items/ExportBus.java

+1-4
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,7 @@ public int[] getSlotsAccessedByItemTransport(ItemTransportFlow flow) {
4343
}
4444
};
4545

46-
registerBlockHandler(getId(), (p, b, tool, reason) -> {
47-
BlockStorage.getInventory(b).dropItems(b.getLocation(), getInputSlots());
48-
return true;
49-
});
46+
addItemHandler(new CTBlockBreakHandler(getInputSlots()));
5047

5148
addItemHandler(new BlockPlaceHandler(false) {
5249

src/main/java/io/github/thebusybiscuit/chestterminal/items/ImportBus.java

+1-4
Original file line numberDiff line numberDiff line change
@@ -95,10 +95,7 @@ public int[] getSlotsAccessedByItemTransport(ItemTransportFlow flow) {
9595
}
9696
};
9797

98-
registerBlockHandler(getId(), (p, b, tool, reason) -> {
99-
BlockStorage.getInventory(b).dropItems(b.getLocation(), getInputSlots());
100-
return true;
101-
});
98+
addItemHandler(new CTBlockBreakHandler(getInputSlots()));
10299

103100
addItemHandler(new BlockPlaceHandler(false) {
104101

0 commit comments

Comments
 (0)