mirror of
https://github.com/amalthea-mc/ShopChest.git
synced 2024-11-10 04:31:06 +00:00
Added configuration values
You can now set whether a shop should be removed from the database if an error occurred when loading it, and you can set whether the floating shop item should be shown/enabled.
This commit is contained in:
parent
47414009bf
commit
1d22e28954
@ -84,6 +84,15 @@ public class Config {
|
|||||||
/** Whether admin shops should be excluded of the shop limits **/
|
/** Whether admin shops should be excluded of the shop limits **/
|
||||||
public boolean exclude_admin_shops;
|
public boolean exclude_admin_shops;
|
||||||
|
|
||||||
|
/** Whether the shop items should be shown **/
|
||||||
|
public boolean show_shop_items;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>Whether shops should automatically be removed from the database if an error occurred while loading</p>
|
||||||
|
* (e.g. when no chest is found at a shop's location)
|
||||||
|
*/
|
||||||
|
public boolean remove_shop_on_error;
|
||||||
|
|
||||||
/** The maximum distance between a player and a shop to see the hologram **/
|
/** The maximum distance between a player and a shop to see the hologram **/
|
||||||
public double maximal_distance;
|
public double maximal_distance;
|
||||||
|
|
||||||
@ -257,6 +266,8 @@ public class Config {
|
|||||||
hopper_protection = plugin.getConfig().getBoolean("hopper-protection");
|
hopper_protection = plugin.getConfig().getBoolean("hopper-protection");
|
||||||
explosion_protection = plugin.getConfig().getBoolean("explosion-protection");
|
explosion_protection = plugin.getConfig().getBoolean("explosion-protection");
|
||||||
exclude_admin_shops = plugin.getConfig().getBoolean("shop-limits.exclude-admin-shops");
|
exclude_admin_shops = plugin.getConfig().getBoolean("shop-limits.exclude-admin-shops");
|
||||||
|
show_shop_items = plugin.getConfig().getBoolean("show-shop-items");
|
||||||
|
remove_shop_on_error = plugin.getConfig().getBoolean("remove-shop-on-error");
|
||||||
maximal_distance = plugin.getConfig().getDouble("maximal-distance");
|
maximal_distance = plugin.getConfig().getDouble("maximal-distance");
|
||||||
shop_creation_price_normal = plugin.getConfig().getDouble("shop-creation-price.normal");
|
shop_creation_price_normal = plugin.getConfig().getDouble("shop-creation-price.normal");
|
||||||
shop_creation_price_admin = plugin.getConfig().getDouble("shop-creation-price.admin");
|
shop_creation_price_admin = plugin.getConfig().getDouble("shop-creation-price.admin");
|
||||||
|
@ -5,6 +5,7 @@ import de.epiceric.shopchest.config.Regex;
|
|||||||
import de.epiceric.shopchest.language.LanguageUtils;
|
import de.epiceric.shopchest.language.LanguageUtils;
|
||||||
import de.epiceric.shopchest.language.LocalizedMessage;
|
import de.epiceric.shopchest.language.LocalizedMessage;
|
||||||
import de.epiceric.shopchest.nms.IHologram;
|
import de.epiceric.shopchest.nms.IHologram;
|
||||||
|
import de.epiceric.shopchest.utils.ShopUtils;
|
||||||
import de.epiceric.shopchest.utils.Utils;
|
import de.epiceric.shopchest.utils.Utils;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
@ -52,6 +53,9 @@ public class Shop {
|
|||||||
this.chest = (Chest) b.getState();
|
this.chest = (Chest) b.getState();
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
|
if (plugin.getShopChestConfig().remove_shop_on_error)
|
||||||
|
ShopUtils.removeShop(this, true);
|
||||||
|
|
||||||
throw new Exception("No Chest found at specified Location: " + b.getX() + "; " + b.getY() + "; " + b.getZ());
|
throw new Exception("No Chest found at specified Location: " + b.getX() + "; " + b.getY() + "; " + b.getZ());
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
ex.printStackTrace();
|
ex.printStackTrace();
|
||||||
@ -99,6 +103,7 @@ public class Shop {
|
|||||||
* <b>Call this after {@link #createHologram()}, because it depends on the hologram's location</b>
|
* <b>Call this after {@link #createHologram()}, because it depends on the hologram's location</b>
|
||||||
*/
|
*/
|
||||||
private void createItem() {
|
private void createItem() {
|
||||||
|
if (plugin.getShopChestConfig().show_shop_items) {
|
||||||
Item item;
|
Item item;
|
||||||
Location itemLocation;
|
Location itemLocation;
|
||||||
ItemStack itemStack;
|
ItemStack itemStack;
|
||||||
@ -118,6 +123,7 @@ public class Shop {
|
|||||||
|
|
||||||
this.item = item;
|
this.item = item;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates the hologram of the shop
|
* Creates the hologram of the shop
|
||||||
@ -259,7 +265,7 @@ public class Shop {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return IHologram of the shop
|
* @return Hologram of the shop
|
||||||
*/
|
*/
|
||||||
public IHologram getHologram() {
|
public IHologram getHologram() {
|
||||||
return hologram;
|
return hologram;
|
||||||
|
@ -11,6 +11,14 @@ main-command-name: "shop"
|
|||||||
# The value must equal to the name of one of a file in the 'lang' folder (without the '.lang' extension)
|
# The value must equal to the name of one of a file in the 'lang' folder (without the '.lang' extension)
|
||||||
language-file: "en_US"
|
language-file: "en_US"
|
||||||
|
|
||||||
|
# Set whether the floating shop items on top of the chest should be shown
|
||||||
|
show-shop-items: true
|
||||||
|
|
||||||
|
# Set whether shops should automatically be removed from the database if an error occurred while loading
|
||||||
|
# e.g. when no chest is found at a shop's location
|
||||||
|
# This might be useful if you're removing shop chests with WorldEdit, resetting plots, or similar
|
||||||
|
remove-shop-on-error: false
|
||||||
|
|
||||||
# Set the maximal distance to the shop where the player can see the hologram.
|
# Set the maximal distance to the shop where the player can see the hologram.
|
||||||
# Value MUST be a number (e.g. 1, 1.5, 2.75, ...)
|
# Value MUST be a number (e.g. 1, 1.5, 2.75, ...)
|
||||||
maximal-distance: 1.75
|
maximal-distance: 1.75
|
||||||
|
Loading…
Reference in New Issue
Block a user