mirror of
https://github.com/EpicEricEE/ShopChest.git
synced 2024-11-29 05:55:28 +01:00
Remove a couple config options
- Shop items cannot be hidden - Hologram interaction had to be removed - Hopper/Explosion protection cannot be disabled - Admin shops cannot be counted in shop limit - Only the nearest shop the player points at is shown
This commit is contained in:
parent
aea88b9f3b
commit
48bb669c01
@ -234,7 +234,7 @@ class ShopCommandExecutor implements CommandExecutor {
|
|||||||
int limit = shopUtils.getShopLimit(p);
|
int limit = shopUtils.getShopLimit(p);
|
||||||
if (limit != -1) {
|
if (limit != -1) {
|
||||||
if (shopUtils.getShopAmount(p) >= limit) {
|
if (shopUtils.getShopAmount(p) >= limit) {
|
||||||
if (shopType != Shop.ShopType.ADMIN || !Config.excludeAdminShops) {
|
if (shopType != Shop.ShopType.ADMIN) {
|
||||||
p.sendMessage(LanguageUtils.getMessage(Message.SHOP_LIMIT_REACHED, new Replacement(Placeholder.LIMIT, String.valueOf(limit))));
|
p.sendMessage(LanguageUtils.getMessage(Message.SHOP_LIMIT_REACHED, new Replacement(Placeholder.LIMIT, String.valueOf(limit))));
|
||||||
plugin.debug(p.getName() + " has reached the limit");
|
plugin.debug(p.getName() + " has reached the limit");
|
||||||
return;
|
return;
|
||||||
|
@ -131,16 +131,6 @@ public class Config {
|
|||||||
**/
|
**/
|
||||||
public static boolean buyGreaterOrEqualSell;
|
public static boolean buyGreaterOrEqualSell;
|
||||||
|
|
||||||
/**
|
|
||||||
* Whether shops should be protected by hoppers
|
|
||||||
**/
|
|
||||||
public static boolean hopperProtection;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Whether shops should be protected by explosions
|
|
||||||
**/
|
|
||||||
public static boolean explosionProtection;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Whether buys and sells must be confirmed
|
* Whether buys and sells must be confirmed
|
||||||
**/
|
**/
|
||||||
@ -157,11 +147,6 @@ public class Config {
|
|||||||
**/
|
**/
|
||||||
public static boolean enableUpdateChecker;
|
public static boolean enableUpdateChecker;
|
||||||
|
|
||||||
/**
|
|
||||||
* Whether hologram interaction should be enabled
|
|
||||||
**/
|
|
||||||
public static boolean enableHologramInteraction;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Whether the debug log file should be created
|
* Whether the debug log file should be created
|
||||||
**/
|
**/
|
||||||
@ -229,36 +214,21 @@ public class Config {
|
|||||||
**/
|
**/
|
||||||
public static boolean enableVendorMessages;
|
public static boolean enableVendorMessages;
|
||||||
|
|
||||||
/**
|
|
||||||
* Whether admin shops should be excluded of the shop limits
|
|
||||||
**/
|
|
||||||
public static boolean excludeAdminShops;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Whether the extension of a potion or tipped arrow (if available) should be appended to the item name.
|
* Whether the extension of a potion or tipped arrow (if available) should be appended to the item name.
|
||||||
**/
|
**/
|
||||||
public static boolean appendPotionLevelToItemName;
|
public static boolean appendPotionLevelToItemName;
|
||||||
|
|
||||||
/**
|
|
||||||
* Whether the shop items should be shown
|
|
||||||
**/
|
|
||||||
public static boolean showShopItems;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Whether players are allowed to sell/buy broken items
|
* Whether players are allowed to sell/buy broken items
|
||||||
**/
|
**/
|
||||||
public static boolean allowBrokenItems;
|
public static boolean allowBrokenItems;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Whether only the shops a player has in sight should be shown to him
|
* Whether only the shop a player is pointing at should be shown
|
||||||
**/
|
**/
|
||||||
public static boolean onlyShowShopsInSight;
|
public static boolean onlyShowShopsInSight;
|
||||||
|
|
||||||
/**
|
|
||||||
* Whether only the shop a player is looking at should be shown to him
|
|
||||||
**/
|
|
||||||
public static boolean onlyShowFirstShopInSight;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>Whether shops should automatically be removed from the database if an error occurred while loading</p>
|
* <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)
|
* (e.g. when no chest is found at a shop's location)
|
||||||
@ -494,12 +464,9 @@ public class Config {
|
|||||||
creativeSelectItem = plugin.getConfig().getBoolean("creative-select-item");
|
creativeSelectItem = plugin.getConfig().getBoolean("creative-select-item");
|
||||||
blacklist = (plugin.getConfig().getStringList("blacklist") == null) ? new ArrayList<String>() : plugin.getConfig().getStringList("blacklist");
|
blacklist = (plugin.getConfig().getStringList("blacklist") == null) ? new ArrayList<String>() : plugin.getConfig().getStringList("blacklist");
|
||||||
buyGreaterOrEqualSell = plugin.getConfig().getBoolean("buy-greater-or-equal-sell");
|
buyGreaterOrEqualSell = plugin.getConfig().getBoolean("buy-greater-or-equal-sell");
|
||||||
hopperProtection = plugin.getConfig().getBoolean("hopper-protection");
|
|
||||||
explosionProtection = plugin.getConfig().getBoolean("explosion-protection");
|
|
||||||
confirmShopping = plugin.getConfig().getBoolean("confirm-shopping");
|
confirmShopping = plugin.getConfig().getBoolean("confirm-shopping");
|
||||||
refundShopCreation = plugin.getConfig().getBoolean("refund-shop-creation");
|
refundShopCreation = plugin.getConfig().getBoolean("refund-shop-creation");
|
||||||
enableUpdateChecker = plugin.getConfig().getBoolean("enable-update-checker");
|
enableUpdateChecker = plugin.getConfig().getBoolean("enable-update-checker");
|
||||||
enableHologramInteraction = plugin.getConfig().getBoolean("enable-hologram-interaction");
|
|
||||||
enableDebugLog = plugin.getConfig().getBoolean("enable-debug-log");
|
enableDebugLog = plugin.getConfig().getBoolean("enable-debug-log");
|
||||||
enableEconomyLog = plugin.getConfig().getBoolean("enable-economy-log");
|
enableEconomyLog = plugin.getConfig().getBoolean("enable-economy-log");
|
||||||
cleanupEconomyLogDays = plugin.getConfig().getInt("cleanup-economy-log-days");
|
cleanupEconomyLogDays = plugin.getConfig().getInt("cleanup-economy-log-days");
|
||||||
@ -514,10 +481,7 @@ public class Config {
|
|||||||
enableAreaShopIntegration = plugin.getConfig().getBoolean("enable-areashop-integration");
|
enableAreaShopIntegration = plugin.getConfig().getBoolean("enable-areashop-integration");
|
||||||
enableVendorMessages = plugin.getConfig().getBoolean("enable-vendor-messages");
|
enableVendorMessages = plugin.getConfig().getBoolean("enable-vendor-messages");
|
||||||
onlyShowShopsInSight = plugin.getConfig().getBoolean("only-show-shops-in-sight");
|
onlyShowShopsInSight = plugin.getConfig().getBoolean("only-show-shops-in-sight");
|
||||||
onlyShowFirstShopInSight = plugin.getConfig().getBoolean("only-show-first-shop-in-sight");
|
|
||||||
excludeAdminShops = plugin.getConfig().getBoolean("shop-limits.exclude-admin-shops");
|
|
||||||
appendPotionLevelToItemName = plugin.getConfig().getBoolean("append-potion-level-to-item-name");
|
appendPotionLevelToItemName = plugin.getConfig().getBoolean("append-potion-level-to-item-name");
|
||||||
showShopItems = plugin.getConfig().getBoolean("show-shop-items");
|
|
||||||
removeShopOnError = plugin.getConfig().getBoolean("remove-shop-on-error");
|
removeShopOnError = plugin.getConfig().getBoolean("remove-shop-on-error");
|
||||||
invertMouseButtons = plugin.getConfig().getBoolean("invert-mouse-buttons");
|
invertMouseButtons = plugin.getConfig().getBoolean("invert-mouse-buttons");
|
||||||
hologramFixedBottom = plugin.getConfig().getBoolean("hologram-fixed-bottom");
|
hologramFixedBottom = plugin.getConfig().getBoolean("hologram-fixed-bottom");
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package de.epiceric.shopchest.listeners;
|
package de.epiceric.shopchest.listeners;
|
||||||
|
|
||||||
import de.epiceric.shopchest.ShopChest;
|
import de.epiceric.shopchest.ShopChest;
|
||||||
import de.epiceric.shopchest.config.Config;
|
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
@ -20,7 +19,6 @@ public class BlockExplodeListener implements Listener {
|
|||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onBlockExplode(BlockExplodeEvent e) {
|
public void onBlockExplode(BlockExplodeEvent e) {
|
||||||
if (Config.explosionProtection) {
|
|
||||||
ArrayList<Block> bl = new ArrayList<>(e.blockList());
|
ArrayList<Block> bl = new ArrayList<>(e.blockList());
|
||||||
for (Block b : bl) {
|
for (Block b : bl) {
|
||||||
if (b.getType().equals(Material.CHEST) || b.getType().equals(Material.TRAPPED_CHEST)) {
|
if (b.getType().equals(Material.CHEST) || b.getType().equals(Material.TRAPPED_CHEST)) {
|
||||||
@ -28,6 +26,5 @@ public class BlockExplodeListener implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -115,7 +115,6 @@ public class ChestProtectListener implements Listener {
|
|||||||
|
|
||||||
@EventHandler(ignoreCancelled = true)
|
@EventHandler(ignoreCancelled = true)
|
||||||
public void onEntityExplode(EntityExplodeEvent e) {
|
public void onEntityExplode(EntityExplodeEvent e) {
|
||||||
if (Config.explosionProtection) {
|
|
||||||
ArrayList<Block> bl = new ArrayList<>(e.blockList());
|
ArrayList<Block> bl = new ArrayList<>(e.blockList());
|
||||||
for (Block b : bl) {
|
for (Block b : bl) {
|
||||||
if (b.getType().equals(Material.CHEST) || b.getType().equals(Material.TRAPPED_CHEST)) {
|
if (b.getType().equals(Material.CHEST) || b.getType().equals(Material.TRAPPED_CHEST)) {
|
||||||
@ -123,7 +122,6 @@ public class ChestProtectListener implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler(ignoreCancelled = true)
|
@EventHandler(ignoreCancelled = true)
|
||||||
public void onBlockPlace(BlockPlaceEvent e) {
|
public void onBlockPlace(BlockPlaceEvent e) {
|
||||||
@ -224,7 +222,6 @@ public class ChestProtectListener implements Listener {
|
|||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
|
||||||
public void onItemMove(InventoryMoveItemEvent e) {
|
public void onItemMove(InventoryMoveItemEvent e) {
|
||||||
if (Config.hopperProtection) {
|
|
||||||
if ((e.getSource().getType().equals(InventoryType.CHEST)) && (!e.getInitiator().getType().equals(InventoryType.PLAYER))) {
|
if ((e.getSource().getType().equals(InventoryType.CHEST)) && (!e.getInitiator().getType().equals(InventoryType.PLAYER))) {
|
||||||
|
|
||||||
if (e.getSource().getHolder() instanceof DoubleChest) {
|
if (e.getSource().getHolder() instanceof DoubleChest) {
|
||||||
@ -239,8 +236,6 @@ public class ChestProtectListener implements Listener {
|
|||||||
|
|
||||||
if (shopUtils.isShop(c.getLocation())) e.setCancelled(true);
|
if (shopUtils.isShop(c.getLocation())) e.setCancelled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,7 +15,6 @@ import de.epiceric.shopchest.external.PlotSquaredShopFlag.GroupFlag;
|
|||||||
import de.epiceric.shopchest.language.LanguageUtils;
|
import de.epiceric.shopchest.language.LanguageUtils;
|
||||||
import de.epiceric.shopchest.language.Message;
|
import de.epiceric.shopchest.language.Message;
|
||||||
import de.epiceric.shopchest.language.Replacement;
|
import de.epiceric.shopchest.language.Replacement;
|
||||||
import de.epiceric.shopchest.nms.Hologram;
|
|
||||||
import de.epiceric.shopchest.nms.JsonBuilder;
|
import de.epiceric.shopchest.nms.JsonBuilder;
|
||||||
import de.epiceric.shopchest.shop.Shop;
|
import de.epiceric.shopchest.shop.Shop;
|
||||||
import de.epiceric.shopchest.shop.ShopProduct;
|
import de.epiceric.shopchest.shop.ShopProduct;
|
||||||
@ -39,16 +38,12 @@ import org.bukkit.block.Block;
|
|||||||
import org.bukkit.block.BlockFace;
|
import org.bukkit.block.BlockFace;
|
||||||
import org.bukkit.block.Chest;
|
import org.bukkit.block.Chest;
|
||||||
import org.bukkit.block.DoubleChest;
|
import org.bukkit.block.DoubleChest;
|
||||||
import org.bukkit.entity.ArmorStand;
|
|
||||||
import org.bukkit.entity.Entity;
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.EventPriority;
|
import org.bukkit.event.EventPriority;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.event.block.Action;
|
import org.bukkit.event.block.Action;
|
||||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
|
||||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||||
import org.bukkit.event.player.PlayerInteractAtEntityEvent;
|
|
||||||
import org.bukkit.event.player.PlayerInteractEvent;
|
import org.bukkit.event.player.PlayerInteractEvent;
|
||||||
import org.bukkit.inventory.EquipmentSlot;
|
import org.bukkit.inventory.EquipmentSlot;
|
||||||
import org.bukkit.inventory.Inventory;
|
import org.bukkit.inventory.Inventory;
|
||||||
@ -455,79 +450,12 @@ public class ShopInteractListener implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPlayerInteract(PlayerInteractEvent e) {
|
public void onPlayerInteract(PlayerInteractEvent e) {
|
||||||
if (Config.enableAuthMeIntegration && plugin.hasAuthMe() && !AuthMeApi.getInstance().isAuthenticated(e.getPlayer())) return;
|
if (Config.enableAuthMeIntegration && plugin.hasAuthMe() && !AuthMeApi.getInstance().isAuthenticated(e.getPlayer())) return;
|
||||||
handleInteractEvent(e);
|
handleInteractEvent(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
public void onPlayerInteractAtEntity(PlayerInteractAtEntityEvent e) {
|
|
||||||
if (!Config.enableHologramInteraction) return;
|
|
||||||
|
|
||||||
Entity entity = e.getRightClicked();
|
|
||||||
Player p = e.getPlayer();
|
|
||||||
if (Config.enableAuthMeIntegration && plugin.hasAuthMe() && !AuthMeApi.getInstance().isAuthenticated(p)) return;
|
|
||||||
|
|
||||||
if (Utils.getMajorVersion() == 8 || e.getHand() == EquipmentSlot.HAND) {
|
|
||||||
if (entity instanceof ArmorStand) {
|
|
||||||
ArmorStand armorStand = (ArmorStand) entity;
|
|
||||||
if (Hologram.isPartOfHologram(armorStand)) {
|
|
||||||
Hologram hologram = Hologram.getHologram(armorStand);
|
|
||||||
if (hologram != null) {
|
|
||||||
Block b = null;
|
|
||||||
for (Shop shop : plugin.getShopUtils().getShops()) {
|
|
||||||
if (shop.getHologram() != null && shop.getHologram().equals(hologram)) {
|
|
||||||
b = shop.getLocation().getBlock();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (b != null) {
|
|
||||||
PlayerInteractEvent interactEvent = new PlayerInteractEvent(p, Action.RIGHT_CLICK_BLOCK, Utils.getPreferredItemInHand(p), b, null);
|
|
||||||
handleInteractEvent(interactEvent);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
public void onPlayerDamageEntity(EntityDamageByEntityEvent e) {
|
|
||||||
if (!Config.enableHologramInteraction) return;
|
|
||||||
|
|
||||||
Entity entity = e.getEntity();
|
|
||||||
Entity damager = e.getDamager();
|
|
||||||
|
|
||||||
if (!(damager instanceof Player)) return;
|
|
||||||
Player p = (Player) damager;
|
|
||||||
if (Config.enableAuthMeIntegration && plugin.hasAuthMe() && !AuthMeApi.getInstance().isAuthenticated(p)) return;
|
|
||||||
|
|
||||||
if (entity instanceof ArmorStand) {
|
|
||||||
ArmorStand armorStand = (ArmorStand) entity;
|
|
||||||
if (Hologram.isPartOfHologram(armorStand)) {
|
|
||||||
Hologram hologram = Hologram.getHologram(armorStand);
|
|
||||||
if (hologram != null) {
|
|
||||||
Block b = null;
|
|
||||||
for (Shop shop : plugin.getShopUtils().getShops()) {
|
|
||||||
if (shop.getHologram() != null && shop.getHologram().equals(hologram)) {
|
|
||||||
b = shop.getLocation().getBlock();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (b != null) {
|
|
||||||
PlayerInteractEvent interactEvent = new PlayerInteractEvent(p, Action.LEFT_CLICK_BLOCK, Utils.getPreferredItemInHand(p), b, null);
|
|
||||||
handleInteractEvent(interactEvent);
|
|
||||||
e.setCancelled(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new shop
|
* Create a new shop
|
||||||
*
|
*
|
||||||
|
@ -44,7 +44,6 @@ public class Hologram {
|
|||||||
private final ShopChest plugin;
|
private final ShopChest plugin;
|
||||||
|
|
||||||
private boolean exists;
|
private boolean exists;
|
||||||
private ArmorStandWrapper interactArmorStandWrapper;
|
|
||||||
|
|
||||||
public Hologram(ShopChest plugin, String[] lines, Location location) {
|
public Hologram(ShopChest plugin, String[] lines, Location location) {
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
@ -54,14 +53,6 @@ public class Hologram {
|
|||||||
addLine(i, lines[i]);
|
addLine(i, lines[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Config.enableHologramInteraction) {
|
|
||||||
double y = 0.6;
|
|
||||||
if (Config.hologramFixedBottom) y = 0.85;
|
|
||||||
|
|
||||||
Location loc = getLocation().add(0, y, 0);
|
|
||||||
interactArmorStandWrapper = new ArmorStandWrapper(plugin, loc, null, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
this.exists = true;
|
this.exists = true;
|
||||||
HOLOGRAMS.add(this);
|
HOLOGRAMS.add(this);
|
||||||
}
|
}
|
||||||
@ -90,7 +81,7 @@ public class Hologram {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return interactArmorStandWrapper != null && armorStand.getUniqueId().equals(interactArmorStandWrapper.getUuid());
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -100,13 +91,6 @@ public class Hologram {
|
|||||||
return wrappers;
|
return wrappers;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return The {@link ArmorStandWrapper} of this hologram that is positioned higher to be used for interaction
|
|
||||||
*/
|
|
||||||
public ArmorStandWrapper getInteractArmorStandWrapper() {
|
|
||||||
return interactArmorStandWrapper;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param p Player to check
|
* @param p Player to check
|
||||||
* @return Whether the hologram is visible to the player
|
* @return Whether the hologram is visible to the player
|
||||||
@ -163,11 +147,6 @@ public class Hologram {
|
|||||||
}
|
}
|
||||||
wrappers.clear();
|
wrappers.clear();
|
||||||
|
|
||||||
if (interactArmorStandWrapper != null) {
|
|
||||||
interactArmorStandWrapper.remove();
|
|
||||||
}
|
|
||||||
interactArmorStandWrapper = null;
|
|
||||||
|
|
||||||
exists = false;
|
exists = false;
|
||||||
HOLOGRAMS.remove(this);
|
HOLOGRAMS.remove(this);
|
||||||
}
|
}
|
||||||
@ -185,10 +164,6 @@ public class Hologram {
|
|||||||
for (ArmorStandWrapper wrapper : wrappers) {
|
for (ArmorStandWrapper wrapper : wrappers) {
|
||||||
wrapper.setVisible(p, visible);
|
wrapper.setVisible(p, visible);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (interactArmorStandWrapper != null) {
|
|
||||||
interactArmorStandWrapper.setVisible(p, visible);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -117,7 +117,7 @@ public class Shop {
|
|||||||
plugin.debug("Failed to create shop (#" + id + ")");
|
plugin.debug("Failed to create shop (#" + id + ")");
|
||||||
plugin.debug(ex);
|
plugin.debug(ex);
|
||||||
return false;
|
return false;
|
||||||
} else if ((!ItemUtils.isAir(b.getRelative(BlockFace.UP).getType())) && Config.showShopItems) {
|
} else if ((!ItemUtils.isAir(b.getRelative(BlockFace.UP).getType()))) {
|
||||||
NotEnoughSpaceException ex = new NotEnoughSpaceException(String.format("No space above chest in world '%s' at location: %d; %d; %d",
|
NotEnoughSpaceException ex = new NotEnoughSpaceException(String.format("No space above chest in world '%s' at location: %d; %d; %d",
|
||||||
b.getWorld().getName(), b.getX(), b.getY(), b.getZ()));
|
b.getWorld().getName(), b.getX(), b.getY(), b.getZ()));
|
||||||
plugin.getShopUtils().removeShop(this, Config.removeShopOnError);
|
plugin.getShopUtils().removeShop(this, Config.removeShopOnError);
|
||||||
@ -175,7 +175,6 @@ 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 (Config.showShopItems) {
|
|
||||||
plugin.debug("Creating item (#" + id + ")");
|
plugin.debug("Creating item (#" + id + ")");
|
||||||
|
|
||||||
Location itemLocation;
|
Location itemLocation;
|
||||||
@ -183,7 +182,6 @@ public class Shop {
|
|||||||
itemLocation = new Location(location.getWorld(), holoLocation.getX(), location.getY() + 0.9, holoLocation.getZ());
|
itemLocation = new Location(location.getWorld(), holoLocation.getX(), location.getY() + 0.9, holoLocation.getZ());
|
||||||
item = new ShopItem(plugin, product.getItemStack(), itemLocation);
|
item = new ShopItem(plugin, product.getItemStack(), itemLocation);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Runs everything that needs to be called synchronously in order
|
* Runs everything that needs to be called synchronously in order
|
||||||
|
@ -204,7 +204,7 @@ public class ShopUtils {
|
|||||||
|
|
||||||
for (Shop shop : getShops()) {
|
for (Shop shop : getShops()) {
|
||||||
if (shop.getVendor().equals(p)) {
|
if (shop.getVendor().equals(p)) {
|
||||||
if (shop.getShopType() != Shop.ShopType.ADMIN || !Config.excludeAdminShops) {
|
if (shop.getShopType() != Shop.ShopType.ADMIN) {
|
||||||
shopCount++;
|
shopCount++;
|
||||||
|
|
||||||
InventoryHolder ih = shop.getInventoryHolder();
|
InventoryHolder ih = shop.getInventoryHolder();
|
||||||
@ -304,10 +304,8 @@ public class ShopUtils {
|
|||||||
|
|
||||||
private void updateVisibleShops(Player player) {
|
private void updateVisibleShops(Player player) {
|
||||||
double itemDistSquared = Math.pow(Config.maximalItemDistance, 2);
|
double itemDistSquared = Math.pow(Config.maximalItemDistance, 2);
|
||||||
boolean firstShopInSight = Config.onlyShowFirstShopInSight;
|
|
||||||
double maxDist = Config.maximalDistance;
|
double maxDist = Config.maximalDistance;
|
||||||
|
|
||||||
List<Shop> shopsInSight = new ArrayList<>();
|
|
||||||
double nearestDistSquared = Double.MAX_VALUE;
|
double nearestDistSquared = Double.MAX_VALUE;
|
||||||
Shop nearestShop = null;
|
Shop nearestShop = null;
|
||||||
|
|
||||||
@ -330,7 +328,6 @@ public class ShopUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (shop != null && shop.hasHologram()) {
|
if (shop != null && shop.hasHologram()) {
|
||||||
shopsInSight.add(shop);
|
|
||||||
double distSquared = pLoc.distanceSquared(loc);
|
double distSquared = pLoc.distanceSquared(loc);
|
||||||
if (distSquared < nearestDistSquared) {
|
if (distSquared < nearestDistSquared) {
|
||||||
nearestDistSquared = distSquared;
|
nearestDistSquared = distSquared;
|
||||||
@ -340,15 +337,9 @@ public class ShopUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (Shop shop : getShops()) {
|
for (Shop shop : getShops()) {
|
||||||
if (firstShopInSight) {
|
|
||||||
if (!shop.equals(nearestShop) && shop.hasHologram()) {
|
if (!shop.equals(nearestShop) && shop.hasHologram()) {
|
||||||
shop.getHologram().hidePlayer(player);
|
shop.getHologram().hidePlayer(player);
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
if (!shopsInSight.contains(shop)) {
|
|
||||||
shop.getHologram().hidePlayer(player);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Display item based on distance
|
// Display item based on distance
|
||||||
Location shopLocation = shop.getLocation();
|
Location shopLocation = shop.getLocation();
|
||||||
@ -368,12 +359,6 @@ public class ShopUtils {
|
|||||||
if (nearestShop != null) {
|
if (nearestShop != null) {
|
||||||
nearestShop.getHologram().showPlayer(player);
|
nearestShop.getHologram().showPlayer(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!firstShopInSight) {
|
|
||||||
for (Shop otherShop : shopsInSight) {
|
|
||||||
otherShop.getHologram().showPlayer(player);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateNearestShops(Player p) {
|
private void updateNearestShops(Player p) {
|
||||||
|
@ -13,9 +13,6 @@ main-command-name: "shop"
|
|||||||
# (without the '.lang' extension)
|
# (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 the item with which a player can click a shop to retrieve information.
|
# Set the item with which a player can click a shop to retrieve information.
|
||||||
# You can set this to an empty string to disable this feature.
|
# You can set this to an empty string to disable this feature.
|
||||||
shop-info-item: "STICK"
|
shop-info-item: "STICK"
|
||||||
@ -44,12 +41,6 @@ refund-shop-creation: false
|
|||||||
# check for updates.
|
# check for updates.
|
||||||
enable-update-checker: true
|
enable-update-checker: true
|
||||||
|
|
||||||
# Set whether interaction with the hologram should be enabled.
|
|
||||||
# If set to true, a player can do the exact same thing with the
|
|
||||||
# hologram, as with the chest. You can even open the chest if you
|
|
||||||
# are the vendor or have permission.
|
|
||||||
enable-hologram-interaction: true
|
|
||||||
|
|
||||||
# Set whether buys and sells should be logged in the database.
|
# Set whether buys and sells should be logged in the database.
|
||||||
enable-economy-log: false
|
enable-economy-log: false
|
||||||
|
|
||||||
@ -107,10 +98,6 @@ enable-vendor-messages: true
|
|||||||
# distance) will be shown to him.
|
# distance) will be shown to him.
|
||||||
only-show-shops-in-sight: true
|
only-show-shops-in-sight: true
|
||||||
|
|
||||||
# Set whether only the shop a player is looking at should be shown to him.
|
|
||||||
# This only has effect if 'only-show-shops-in-sight' is enabled
|
|
||||||
only-show-first-shop-in-sight: true
|
|
||||||
|
|
||||||
# Set whether the hologram's location should be fixed at the bottom,
|
# Set whether the hologram's location should be fixed at the bottom,
|
||||||
# so when it gets more lines, it won't interfere with the item or chest,
|
# so when it gets more lines, it won't interfere with the item or chest,
|
||||||
# but goes higher.
|
# but goes higher.
|
||||||
@ -180,12 +167,6 @@ shop-creation-price:
|
|||||||
# ...an admin shop
|
# ...an admin shop
|
||||||
admin: 0
|
admin: 0
|
||||||
|
|
||||||
# Set whether the shop's chest should be protected by hoppers
|
|
||||||
hopper-protection: true
|
|
||||||
|
|
||||||
# Set whether the shop's chest should be protected by explosions
|
|
||||||
explosion-protection: true
|
|
||||||
|
|
||||||
# Set whether the buy price must be greater than or equal sell price.
|
# Set whether the buy price must be greater than or equal sell price.
|
||||||
buy-greater-or-equal-sell: true
|
buy-greater-or-equal-sell: true
|
||||||
|
|
||||||
@ -248,8 +229,8 @@ towny-shop-plots:
|
|||||||
- "COMMERCIAL"
|
- "COMMERCIAL"
|
||||||
|
|
||||||
# Configuration of the database, where everything is stored.
|
# Configuration of the database, where everything is stored.
|
||||||
# Shops are found in the table 'shop_list', and logged economy
|
# Shops are found in the table 'shopchest_shops', and logged economy
|
||||||
# transactions are found in the table 'shop_log'
|
# transactions are found in the table 'shopchest_economy_logs'
|
||||||
database:
|
database:
|
||||||
|
|
||||||
# Select the type of database which should be used
|
# Select the type of database which should be used
|
||||||
@ -287,12 +268,9 @@ database:
|
|||||||
# Shop limits are handled with permissions.
|
# Shop limits are handled with permissions.
|
||||||
# A player with permission "shopchest.limit.X" has a limit of X shops,
|
# A player with permission "shopchest.limit.X" has a limit of X shops,
|
||||||
# a player with permission "shopchest.limit.*" does not have a shop limit.
|
# a player with permission "shopchest.limit.*" does not have a shop limit.
|
||||||
|
# Admin shops are excluded from the shop limit.
|
||||||
shop-limits:
|
shop-limits:
|
||||||
|
|
||||||
# Set whether admin shops should be excluded of the shop limits.
|
|
||||||
# If set to true, admin shops won't be added to a player's shop count.
|
|
||||||
exclude-admin-shops: true
|
|
||||||
|
|
||||||
# Set the amount of shops that anyone who doesn't have a
|
# Set the amount of shops that anyone who doesn't have a
|
||||||
# specific permission may have.
|
# specific permission may have.
|
||||||
# If you don't want the players to have a limit by default
|
# If you don't want the players to have a limit by default
|
||||||
|
Loading…
Reference in New Issue
Block a user