Added a blacklist for SyncTouch items.

This commit is contained in:
Brianna 2020-01-24 15:44:47 -05:00
parent e00599c422
commit 0070c049f6
3 changed files with 12 additions and 8 deletions

View File

@ -157,14 +157,13 @@ public class BlockListeners implements Listener {
break;
}
if (location == null) return;
if (location == null
|| location.getBlock().getType() != Material.CHEST
|| Settings.SYNC_TOUCH_BLACKLIST.getStringList().contains(event.getBlock().getType().name())
if (location.getBlock().getType() != Material.CHEST) return;
if (event.getBlock().getType().name().contains("SHULKER")
|| (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_13) ? event.getBlock().getType() == Material.SPAWNER : event.getBlock().getType() == Material.valueOf("MOB_SPAWNER"))
|| event.getBlock().getType() == Material.HOPPER
|| event.getBlock().getType() == Material.DISPENSER) {
|| event.getBlock().getType().name().contains("SHULKER")
|| (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_13) ? event.getBlock().getType() == Material.SPAWNER
: event.getBlock().getType() == Material.valueOf("MOB_SPAWNER"))) {
return;
}

View File

@ -51,6 +51,11 @@ public class Settings {
"The amount of time in ticks a player has between hitting the hopper",
"Link button and performing the link. When the time is up the link event is canceled.");
public static final ConfigSetting SYNC_TOUCH_BLACKLIST = new ConfigSetting(config, "Main.Sync Touch Blacklist",
Arrays.asList("CHEST", "FURNACE", "HOPPER"),
"Items that shouldn't work with Sync touch. You should put items in here",
"that other plugins use to store data with.");
public static final ConfigSetting MAX_CHUNK = new ConfigSetting(config, "Main.Max Hoppers Per Chunk", -1,
"The maximum amount of hoppers per chunk.");

View File

@ -450,7 +450,7 @@ public class HopTask extends BukkitRunnable {
// Create item that will be moved.
ItemStack itemToMove = item.clone();
itemToMove.setAmount(item.getAmount() < maxToMove ? item.getAmount() : maxToMove);
itemToMove.setAmount(Math.min(item.getAmount(), maxToMove));
// Process whitelist and blacklist.
boolean blocked = (!hopper.getFilter().getWhiteList().isEmpty() && hopper.getFilter().getWhiteList().stream().noneMatch(itemStack -> itemStack.isSimilar(item))