Armour Stand Setting Added

This commit is contained in:
jameslfc19 2020-07-04 21:58:29 +01:00
parent 6366e2cafe
commit dab6b80064
4 changed files with 29 additions and 6 deletions

View File

@ -11,6 +11,8 @@ public class Settings {
private static String LIMIT_CHESTS_NUMBER = "limit-chestlinks-amount";
private static String SHOULD_ANIMATE_ALL_CHESTS = "should-animate-all-chests";
private static String RUN_HOPPERS_UNLOADED_CHUNKS = "run-hoppers-unloaded-chunks";
private static String SHOULD_CHEST_ARMOUR_STAND = "display_chestlink_armour_stands";
private static String SHOULD_AUTOCRAFT_ARMOUR_STAND = "display_chestlink_armour_stands";
private static Settings cf;
private FileConfiguration configuration;
@ -22,6 +24,8 @@ public class Settings {
private static int limitChestsAmount;
private static boolean shouldAnimateAllChests;
private static boolean runHoppersInUnloadedChunks;
private static boolean shouldDisplayChestLinkStand;
private static boolean shouldDisplayAutoCraftStand;
public static void initConfig(Plugin plugin){
cf = new Settings();
@ -35,6 +39,8 @@ public class Settings {
cf.configuration.addDefault(LIMIT_CHESTS_NUMBER,0);
cf.configuration.addDefault(SHOULD_ANIMATE_ALL_CHESTS,false);
cf.configuration.addDefault(RUN_HOPPERS_UNLOADED_CHUNKS,false);
cf.configuration.addDefault(SHOULD_CHEST_ARMOUR_STAND,true);
cf.configuration.addDefault(SHOULD_AUTOCRAFT_ARMOUR_STAND,true);
cf.configuration.options().copyDefaults(true);
cf.plugin.saveConfig();
@ -55,6 +61,8 @@ public class Settings {
limitChestsAmount = cf.configuration.getInt(LIMIT_CHESTS_NUMBER);
shouldAnimateAllChests = cf.configuration.getBoolean(SHOULD_ANIMATE_ALL_CHESTS);
runHoppersInUnloadedChunks = cf.configuration.getBoolean(RUN_HOPPERS_UNLOADED_CHUNKS);
shouldDisplayChestLinkStand = cf.configuration.getBoolean(SHOULD_CHEST_ARMOUR_STAND);
shouldDisplayAutoCraftStand = cf.configuration.getBoolean(SHOULD_AUTOCRAFT_ARMOUR_STAND);
}
/**
@ -72,4 +80,10 @@ public class Settings {
public static boolean isRunHoppersInUnloadedChunks() {
return runHoppersInUnloadedChunks;
}
public static boolean isShouldDisplayChestLinkStand() {
return shouldDisplayChestLinkStand;
}
public static boolean isShouldDisplayAutoCraftStand() {
return shouldDisplayAutoCraftStand;
}
}

View File

@ -117,7 +117,7 @@ public abstract class AbstractStorage implements ConfigurationSerializable {
}
private void init(){
Bukkit.getScheduler().scheduleSyncRepeatingTask(ChestsPlusPlus.PLUGIN, this::updateClients, 1, 5);
if(shouldDisplayArmourStands()) Bukkit.getScheduler().scheduleSyncRepeatingTask(ChestsPlusPlus.PLUGIN, this::updateClients, 1, 5);
}
public abstract StorageType getStorageType();
@ -142,6 +142,7 @@ public abstract class AbstractStorage implements ConfigurationSerializable {
protected abstract Inventory initInventory();
protected abstract void setIdentifier(String newIdentifier);
public abstract String getIdentifier();
public abstract boolean shouldDisplayArmourStands();
/**
* This is the distance from a full block to the size of the storage block. (e.g Chest is smaller than a regular block.)

View File

@ -1,11 +1,10 @@
package com.jamesdpeters.minecraft.chests.storage.autocraft;
import com.jamesdpeters.minecraft.chests.interfaces.VirtualCraftingHolder;
import com.jamesdpeters.minecraft.chests.misc.Settings;
import com.jamesdpeters.minecraft.chests.serialize.Config;
import com.jamesdpeters.minecraft.chests.serialize.RecipeSerializable;
import com.jamesdpeters.minecraft.chests.storage.abstracts.AbstractStorage;
import com.jamesdpeters.minecraft.chests.storage.abstracts.StorageType;
import com.jamesdpeters.minecraft.chests.storage.chestlink.ChestLinkStorageType;
import org.bukkit.Location;
import org.bukkit.OfflinePlayer;
import org.bukkit.block.Block;
@ -84,6 +83,11 @@ public class AutoCraftingStorage extends AbstractStorage implements Configuratio
return identifier;
}
@Override
public boolean shouldDisplayArmourStands() {
return Settings.isShouldDisplayAutoCraftStand();
}
@Override
public double getBlockOffset() {
return -0.07;

View File

@ -4,13 +4,13 @@ import com.jamesdpeters.minecraft.chests.ChestsPlusPlus;
import com.jamesdpeters.minecraft.chests.interfaces.VirtualInventoryHolder;
import com.jamesdpeters.minecraft.chests.inventories.ChestLinkMenu;
import com.jamesdpeters.minecraft.chests.misc.Messages;
import com.jamesdpeters.minecraft.chests.misc.Settings;
import com.jamesdpeters.minecraft.chests.misc.Utils;
import com.jamesdpeters.minecraft.chests.runnables.VirtualChestToHopper;
import com.jamesdpeters.minecraft.chests.serialize.Config;
import com.jamesdpeters.minecraft.chests.sort.InventorySorter;
import com.jamesdpeters.minecraft.chests.sort.SortMethod;
import com.jamesdpeters.minecraft.chests.storage.abstracts.AbstractStorage;
import com.jamesdpeters.minecraft.chests.storage.abstracts.StorageType;
import fr.minuskube.inv.ClickableItem;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
@ -35,7 +35,6 @@ import java.util.Map;
public class ChestLinkStorage extends AbstractStorage implements ConfigurationSerializable {
private String inventoryName;
private VirtualChestToHopper chestToHopper;
private SortMethod sortMethod;
public ChestLinkStorage(Map<String, Object> map){
@ -79,7 +78,7 @@ public class ChestLinkStorage extends AbstractStorage implements ConfigurationSe
}
private void init(){
chestToHopper = new VirtualChestToHopper(this);
VirtualChestToHopper chestToHopper = new VirtualChestToHopper(this);
chestToHopper.start();
}
@ -188,6 +187,11 @@ public class ChestLinkStorage extends AbstractStorage implements ConfigurationSe
return inventoryName;
}
@Override
public boolean shouldDisplayArmourStands() {
return Settings.isShouldDisplayChestLinkStand();
}
@Override
public double getBlockOffset() {
return 0;