Skip to content

Commit 44c9d8e

Browse files
committed
PFHoppers Support
1 parent f5d1b2e commit 44c9d8e

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed

src/main/java/us/thezircon/play/autopickup/AutoPickup.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ public final class AutoPickup extends JavaPlugin {
3737
public static boolean usingEpicFurnaces = false; //EpicFurnaces - Songoda
3838
public static boolean usingWildChests = false; // WildChests - BG Development
3939

40+
public static boolean usingPFHoppers = false; // Play.PeacefulFarms.Net
41+
public static boolean usingPFMoreHoppers = false; // Patch for PF
42+
4043
public static boolean usingPlaceholderAPI = false; // Papi - clip
4144

4245
public static ArrayList<String> worldsBlacklist = null;
@@ -96,6 +99,16 @@ public void onEnable() {
9699
usingPlaceholderAPI = true;
97100
}
98101

102+
// Peaceful Farms - Hoppers Patch
103+
// PFHoppers
104+
if ((getServer().getPluginManager().getPlugin("PFHoppers") != null)) {
105+
usingPFHoppers = true;
106+
}
107+
// PFMoreHoppers
108+
if ((getServer().getPluginManager().getPlugin("PFMoreHoppers") != null)) {
109+
usingPFMoreHoppers = true;
110+
}
111+
99112
messages = new Messages();
100113

101114
// Listeners

src/main/java/us/thezircon/play/autopickup/listeners/BlockBreakEventListener.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,24 @@ public void run() {
168168
}
169169
}
170170

171+
// Peaceful Farms - PFHoppers Patch
172+
if (block.getState() instanceof Hopper && AutoPickup.usingPFHoppers) {
173+
Hopper hopper = (Hopper) block.getState();
174+
try {
175+
if (hopper.getCustomName().contains("PF Hopper"))
176+
return;
177+
} catch (NullPointerException ignored) {}
178+
}
179+
180+
// Peaceful Farms - PFMoreHoppers Patch
181+
if (block.getState() instanceof Hopper && AutoPickup.usingPFMoreHoppers) {
182+
NamespacedKey morePFHoppers = new NamespacedKey(PLUGIN.getServer().getPluginManager().getPlugin("PFMoreHoppers"), "pfmorehoppers:pfhopper-variant");
183+
Container con = (Container) block.getState();
184+
if (con.getPersistentDataContainer().getKeys().contains(morePFHoppers)) {
185+
return;
186+
}
187+
}
188+
171189
// WildChests patch
172190
if (AutoPickup.usingWildChests) {
173191
if (block.getType()==Material.CHEST) {

0 commit comments

Comments
 (0)