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>
<artifactId>EpicHoppers</artifactId>
<modelVersion>4.0.0</modelVersion>
<version>4.6.19</version>
<version>4.6.20</version>
<build>
<defaultGoal>clean install</defaultGoal>
<finalName>EpicHoppers-${project.version}</finalName>

View File

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

View File

@ -66,9 +66,10 @@ public class HopperListeners implements Listener {
// Special cases when a hopper is picking up items
if (destination.getHolder() instanceof org.bukkit.block.Hopper) {
Hopper toHopper = instance.getHopperManager().getHopper(destinationLocation);
if (destinationLocation != null && Settings.ALLOW_NORMAL_HOPPERS.getBoolean() && toHopper == null)
if (destinationLocation != null && Settings.ALLOW_NORMAL_HOPPERS.getBoolean() && !instance.getHopperManager().isHopper(destinationLocation))
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
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,
"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,
"Should players be able to teleport through hoppers?");

View File

@ -1,5 +1,6 @@
package com.songoda.epichoppers.tasks;
import com.songoda.core.compatibility.CompatibleMaterial;
import com.songoda.epichoppers.EpicHoppers;
import com.songoda.epichoppers.boost.BoostData;
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
*/
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) {
return com.songoda.epicfarming.EpicFarming.getInstance().getFarmManager()
.getFarm(block).getItems().stream().filter(i -> i.getType() != Material.BONE_MEAL).collect(Collectors.toList()).toArray(new ItemStack[0]);
return com.songoda.epicfarming.EpicFarming.getInstance().getFarmManager().getFarm(block).getItems()
.stream().filter(i -> CompatibleMaterial.getMaterial(i) != CompatibleMaterial.BONE_MEAL)
.toArray(ItemStack[]::new);
}
}