Merge branch 'development'

This commit is contained in:
Brianna 2021-06-01 12:24:19 -05:00
commit 887d18315d
5 changed files with 17 additions and 6 deletions

View File

@ -2,7 +2,7 @@
<groupId>com.songoda</groupId> <groupId>com.songoda</groupId>
<artifactId>EpicHoppers</artifactId> <artifactId>EpicHoppers</artifactId>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<version>4.6.19</version> <version>4.6.20</version>
<build> <build>
<defaultGoal>clean install</defaultGoal> <defaultGoal>clean install</defaultGoal>
<finalName>EpicHoppers-${project.version}</finalName> <finalName>EpicHoppers-${project.version}</finalName>

View File

@ -36,6 +36,9 @@ public class BlockListeners implements Listener {
if (e.getBlock().getType() != Material.HOPPER) if (e.getBlock().getType() != Material.HOPPER)
return; return;
if (Settings.DISABLED_WORLDS.getStringList().contains(player.getWorld().getName()))
return;
int amt = count(e.getBlock().getChunk()); int amt = count(e.getBlock().getChunk());
int max = maxHoppers(player); int max = maxHoppers(player);

View File

@ -66,9 +66,10 @@ public class HopperListeners implements Listener {
// Special cases when a hopper is picking up items // Special cases when a hopper is picking up items
if (destination.getHolder() instanceof org.bukkit.block.Hopper) { if (destination.getHolder() instanceof org.bukkit.block.Hopper) {
Hopper toHopper = instance.getHopperManager().getHopper(destinationLocation); if (destinationLocation != null && Settings.ALLOW_NORMAL_HOPPERS.getBoolean() && !instance.getHopperManager().isHopper(destinationLocation))
if (destinationLocation != null && Settings.ALLOW_NORMAL_HOPPERS.getBoolean() && toHopper == null)
return; return;
Hopper toHopper = instance.getHopperManager().getHopper(destinationLocation);
// minecraft 1.8 doesn't have a method to get the hopper's location from the inventory, so we use the holder instead // minecraft 1.8 doesn't have a method to get the hopper's location from the inventory, so we use the holder instead
final ItemStack toMove = event.getItem(); final ItemStack toMove = event.getItem();

View File

@ -25,6 +25,11 @@ public class Settings {
public static final ConfigSetting ALLOW_NORMAL_HOPPERS = new ConfigSetting(config, "Main.Allow Normal Hoppers", false, public static final ConfigSetting ALLOW_NORMAL_HOPPERS = new ConfigSetting(config, "Main.Allow Normal Hoppers", false,
"Should natural hoppers not be epic hoppers?"); "Should natural hoppers not be epic hoppers?");
public static final ConfigSetting DISABLED_WORLDS = new ConfigSetting(config, "Main.Disabled Worlds",
Arrays.asList("example1", "example2"),
"Worlds where epic hoppers cannot be placed.",
"Any placed Epic Hopper will just be converted to a normal one.");
public static final ConfigSetting TELEPORT = new ConfigSetting(config, "Main.Allow Players To Teleport Through Hoppers", true, public static final ConfigSetting TELEPORT = new ConfigSetting(config, "Main.Allow Players To Teleport Through Hoppers", true,
"Should players be able to teleport through hoppers?"); "Should players be able to teleport through hoppers?");

View File

@ -1,5 +1,6 @@
package com.songoda.epichoppers.tasks; package com.songoda.epichoppers.tasks;
import com.songoda.core.compatibility.CompatibleMaterial;
import com.songoda.epichoppers.EpicHoppers; import com.songoda.epichoppers.EpicHoppers;
import com.songoda.epichoppers.boost.BoostData; import com.songoda.epichoppers.boost.BoostData;
import com.songoda.epichoppers.hopper.HopperManager; import com.songoda.epichoppers.hopper.HopperManager;
@ -521,11 +522,12 @@ public class HopTask extends BukkitRunnable {
* @return true if the block is a farm item, otherwise false * @return true if the block is a farm item, otherwise false
*/ */
private boolean isFarmItem(Block block) { private boolean isFarmItem(Block block) {
return EpicHoppers.getInstance().isEpicFarming() && com.songoda.epicfarming.EpicFarming.getInstance().getFarmManager().getFarm(block) != null; return plugin.isEpicFarming() && com.songoda.epicfarming.EpicFarming.getInstance().getFarmManager().getFarm(block) != null;
} }
private ItemStack[] getFarmContents(Block block) { private ItemStack[] getFarmContents(Block block) {
return com.songoda.epicfarming.EpicFarming.getInstance().getFarmManager() return com.songoda.epicfarming.EpicFarming.getInstance().getFarmManager().getFarm(block).getItems()
.getFarm(block).getItems().stream().filter(i -> i.getType() != Material.BONE_MEAL).collect(Collectors.toList()).toArray(new ItemStack[0]); .stream().filter(i -> CompatibleMaterial.getMaterial(i) != CompatibleMaterial.BONE_MEAL)
.toArray(ItemStack[]::new);
} }
} }