Remove a bunch of old stuff I don't use

This commit is contained in:
DaniFoldi 2022-02-27 15:20:07 +00:00
parent 9ba1aceca3
commit 9b7eae0eca
12 changed files with 92 additions and 294 deletions

Binary file not shown.

View File

@ -1 +0,0 @@
mvn -N install:install-file -Dfile=lib/IslandWorld-8.5.jar -DgroupId=pl.gnacik.islandworld -DartifactId=IslandWorld -Dversion=8.5 -Dpackaging=jar -DgeneratePom=true

View File

@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>ShopChest-parent</artifactId> <artifactId>ShopChest-parent</artifactId>
<groupId>de.epiceric</groupId> <groupId>de.epiceric</groupId>
<version>1.14.0-SNAPSHOT</version> <version>1.14.1-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath> <relativePath>../../pom.xml</relativePath>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
@ -13,6 +13,16 @@
<artifactId>shopchest-nms-interface</artifactId> <artifactId>shopchest-nms-interface</artifactId>
<version>1.0.0</version> <version>1.0.0</version>
<properties>
<!-- Encoding Properties -->
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.build.outputEncoding>UTF-8</project.build.outputEncoding>
<!-- JDK Version -->
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
</properties>
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>org.spigotmc</groupId> <groupId>org.spigotmc</groupId>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>ShopChest-parent</artifactId> <artifactId>ShopChest-parent</artifactId>
<groupId>de.epiceric</groupId> <groupId>de.epiceric</groupId>
<version>1.14.0-SNAPSHOT</version> <version>1.14.1-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath> <relativePath>../../pom.xml</relativePath>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>ShopChest-parent</artifactId> <artifactId>ShopChest-parent</artifactId>
<groupId>de.epiceric</groupId> <groupId>de.epiceric</groupId>
<version>1.14.0-SNAPSHOT</version> <version>1.14.1-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath> <relativePath>../../pom.xml</relativePath>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>ShopChest-parent</artifactId> <artifactId>ShopChest-parent</artifactId>
<groupId>de.epiceric</groupId> <groupId>de.epiceric</groupId>
<version>1.14.0-SNAPSHOT</version> <version>1.14.1-SNAPSHOT</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
@ -41,10 +41,6 @@
<groupId>com.github.TechFortress</groupId> <groupId>com.github.TechFortress</groupId>
<artifactId>GriefPrevention</artifactId> <artifactId>GriefPrevention</artifactId>
</dependency> </dependency>
<dependency>
<groupId>me.wiefferink</groupId>
<artifactId>areashop</artifactId>
</dependency>
<dependency> <dependency>
<groupId>world.bentobox</groupId> <groupId>world.bentobox</groupId>
<artifactId>bentobox</artifactId> <artifactId>bentobox</artifactId>
@ -57,10 +53,6 @@
<groupId>com.github.TownyAdvanced</groupId> <groupId>com.github.TownyAdvanced</groupId>
<artifactId>Towny</artifactId> <artifactId>Towny</artifactId>
</dependency> </dependency>
<dependency>
<groupId>pl.gnacik.islandworld</groupId>
<artifactId>IslandWorld</artifactId>
</dependency>
<dependency> <dependency>
<groupId>org.projectlombok</groupId> <groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId> <artifactId>lombok</artifactId>
@ -80,6 +72,12 @@
<dependency> <dependency>
<groupId>org.inventivetalent</groupId> <groupId>org.inventivetalent</groupId>
<artifactId>reflectionhelper</artifactId> <artifactId>reflectionhelper</artifactId>
<exclusions>
<exclusion>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</exclusion>
</exclusions>
</dependency> </dependency>
<dependency> <dependency>
<groupId>de.epiceric</groupId> <groupId>de.epiceric</groupId>

View File

@ -26,12 +26,10 @@ import de.epiceric.shopchest.external.PlotSquaredShopFlag;
import de.epiceric.shopchest.external.WorldGuardShopFlag; import de.epiceric.shopchest.external.WorldGuardShopFlag;
import de.epiceric.shopchest.external.listeners.ASkyBlockListener; import de.epiceric.shopchest.external.listeners.ASkyBlockListener;
import de.epiceric.shopchest.external.listeners.GriefPreventionListener; import de.epiceric.shopchest.external.listeners.GriefPreventionListener;
import de.epiceric.shopchest.external.listeners.IslandWorldListener;
import de.epiceric.shopchest.external.listeners.PlotSquaredListener; import de.epiceric.shopchest.external.listeners.PlotSquaredListener;
import de.epiceric.shopchest.external.listeners.TownyListener; import de.epiceric.shopchest.external.listeners.TownyListener;
import de.epiceric.shopchest.external.listeners.USkyBlockListener; import de.epiceric.shopchest.external.listeners.USkyBlockListener;
import de.epiceric.shopchest.language.LanguageUtils; import de.epiceric.shopchest.language.LanguageUtils;
import de.epiceric.shopchest.listeners.AreaShopListener;
import de.epiceric.shopchest.listeners.BentoBoxListener; import de.epiceric.shopchest.listeners.BentoBoxListener;
import de.epiceric.shopchest.listeners.BlockExplodeListener; import de.epiceric.shopchest.listeners.BlockExplodeListener;
import de.epiceric.shopchest.listeners.ChestProtectListener; import de.epiceric.shopchest.listeners.ChestProtectListener;
@ -54,18 +52,7 @@ import de.epiceric.shopchest.utils.UpdateChecker.UpdateCheckerResult;
import de.epiceric.shopchest.utils.Utils; import de.epiceric.shopchest.utils.Utils;
import fr.xephi.authme.AuthMe; import fr.xephi.authme.AuthMe;
import me.ryanhamshire.GriefPrevention.GriefPrevention; import me.ryanhamshire.GriefPrevention.GriefPrevention;
import me.wiefferink.areashop.AreaShop;
import net.milkbowl.vault.economy.Economy; import net.milkbowl.vault.economy.Economy;
import org.bukkit.Bukkit;
import org.bukkit.Chunk;
import org.bukkit.World;
import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.RegisteredServiceProvider;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.scheduler.BukkitRunnable;
import org.codemc.worldguardwrapper.WorldGuardWrapper;
import pl.islandworld.IslandWorld;
import us.talabrek.ultimateskyblock.api.uSkyBlockAPI; import us.talabrek.ultimateskyblock.api.uSkyBlockAPI;
import world.bentobox.bentobox.BentoBox; import world.bentobox.bentobox.BentoBox;
@ -103,9 +90,7 @@ public class ShopChest extends JavaPlugin {
private AuthMe authMe; private AuthMe authMe;
private uSkyBlockAPI uSkyBlock; private uSkyBlockAPI uSkyBlock;
private ASkyBlock aSkyBlock; private ASkyBlock aSkyBlock;
private IslandWorld islandWorld;
private GriefPrevention griefPrevention; private GriefPrevention griefPrevention;
private AreaShop areaShop;
private BentoBox bentoBox; private BentoBox bentoBox;
private ShopUpdater updater; private ShopUpdater updater;
private ExecutorService shopCreationThreadPool; private ExecutorService shopCreationThreadPool;
@ -312,21 +297,11 @@ public class ShopChest extends JavaPlugin {
aSkyBlock = (ASkyBlock) aSkyBlockPlugin; aSkyBlock = (ASkyBlock) aSkyBlockPlugin;
} }
Plugin islandWorldPlugin = Bukkit.getServer().getPluginManager().getPlugin("IslandWorld");
if (islandWorldPlugin instanceof IslandWorld) {
islandWorld = (IslandWorld) islandWorldPlugin;
}
Plugin griefPreventionPlugin = Bukkit.getServer().getPluginManager().getPlugin("GriefPrevention"); Plugin griefPreventionPlugin = Bukkit.getServer().getPluginManager().getPlugin("GriefPrevention");
if (griefPreventionPlugin instanceof GriefPrevention) { if (griefPreventionPlugin instanceof GriefPrevention) {
griefPrevention = (GriefPrevention) griefPreventionPlugin; griefPrevention = (GriefPrevention) griefPreventionPlugin;
} }
Plugin areaShopPlugin = Bukkit.getServer().getPluginManager().getPlugin("AreaShop");
if (areaShopPlugin instanceof AreaShop) {
areaShop = (AreaShop) areaShopPlugin;
}
Plugin bentoBoxPlugin = getServer().getPluginManager().getPlugin("BentoBox"); Plugin bentoBoxPlugin = getServer().getPluginManager().getPlugin("BentoBox");
if (bentoBoxPlugin instanceof BentoBox) { if (bentoBoxPlugin instanceof BentoBox) {
bentoBox = (BentoBox) bentoBoxPlugin; bentoBox = (BentoBox) bentoBoxPlugin;
@ -428,10 +403,6 @@ public class ShopChest extends JavaPlugin {
if (hasWorldGuard()) { if (hasWorldGuard()) {
getServer().getPluginManager().registerEvents(new WorldGuardListener(this), this); getServer().getPluginManager().registerEvents(new WorldGuardListener(this), this);
if (hasAreaShop()) {
getServer().getPluginManager().registerEvents(new AreaShopListener(this), this);
}
} }
if (hasBentoBox()) { if (hasBentoBox()) {
@ -444,8 +415,6 @@ public class ShopChest extends JavaPlugin {
getServer().getPluginManager().registerEvents(new ASkyBlockListener(this), this); getServer().getPluginManager().registerEvents(new ASkyBlockListener(this), this);
if (hasGriefPrevention()) if (hasGriefPrevention())
getServer().getPluginManager().registerEvents(new GriefPreventionListener(this), this); getServer().getPluginManager().registerEvents(new GriefPreventionListener(this), this);
if (hasIslandWorld())
getServer().getPluginManager().registerEvents(new IslandWorldListener(this), this);
if (hasPlotSquared()) { if (hasPlotSquared()) {
PlotSquaredListener psListener = new PlotSquaredListener(this); PlotSquaredListener psListener = new PlotSquaredListener(this);
getServer().getPluginManager().registerEvents(psListener, this); getServer().getPluginManager().registerEvents(psListener, this);
@ -567,13 +536,6 @@ public class ShopChest extends JavaPlugin {
return updater; return updater;
} }
/**
* @return Whether the plugin 'AreaShop' is enabled
*/
public boolean hasAreaShop() {
return Config.enableAreaShopIntegration && areaShop != null && areaShop.isEnabled();
}
/** /**
* @return Whether the plugin 'GriefPrevention' is enabled * @return Whether the plugin 'GriefPrevention' is enabled
*/ */
@ -588,12 +550,6 @@ public class ShopChest extends JavaPlugin {
return griefPrevention; return griefPrevention;
} }
/**
* @return Whether the plugin 'IslandWorld' is enabled
*/
public boolean hasIslandWorld() {
return Config.enableIslandWorldIntegration && islandWorld != null && islandWorld.isEnabled();
}
/** /**
* @return Whether the plugin 'ASkyBlock' is enabled * @return Whether the plugin 'ASkyBlock' is enabled
*/ */

View File

@ -1,21 +1,16 @@
package de.epiceric.shopchest.config; package de.epiceric.shopchest.config;
import de.epiceric.shopchest.ShopChest;
import de.epiceric.shopchest.utils.Operator;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.configuration.file.YamlConfiguration;
import java.io.File; import java.io.File;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import javax.script.ScriptEngine;
import javax.script.ScriptEngineManager;
import javax.script.ScriptException;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.configuration.file.YamlConfiguration;
import de.epiceric.shopchest.ShopChest;
import de.epiceric.shopchest.utils.Operator;
public class HologramFormat { public class HologramFormat {
public enum Requirement { public enum Requirement {
@ -31,9 +26,6 @@ public class HologramFormat {
// e.g.: "STONE" == "DIAMOND_SWORD" // e.g.: "STONE" == "DIAMOND_SWORD"
private static final Pattern SIMPLE_STRING_CONDITION = Pattern.compile("^\"([^\"]*)\" ([=!]=) \"([^\"]*)\"$"); private static final Pattern SIMPLE_STRING_CONDITION = Pattern.compile("^\"([^\"]*)\" ([=!]=) \"([^\"]*)\"$");
private ScriptEngineManager manager = new ScriptEngineManager();
private ScriptEngine engine = manager.getEngineByName("JavaScript");
private ShopChest plugin; private ShopChest plugin;
private File configFile; private File configFile;
private YamlConfiguration config; private YamlConfiguration config;
@ -55,24 +47,8 @@ public class HologramFormat {
public String getFormat(int line, Map<Requirement, Object> reqMap, Map<Placeholder, Object> plaMap) { public String getFormat(int line, Map<Requirement, Object> reqMap, Map<Placeholder, Object> plaMap) {
ConfigurationSection options = config.getConfigurationSection("lines." + line + ".options"); ConfigurationSection options = config.getConfigurationSection("lines." + line + ".options");
optionLoop:
for (String key : options.getKeys(false)) { for (String key : options.getKeys(false)) {
ConfigurationSection option = options.getConfigurationSection(key); return evalPlaceholder(options.getConfigurationSection(key).getString("format"), plaMap);
List<String> requirements = option.getStringList("requirements");
String format = option.getString("format");
for (String sReq : requirements) {
for (Requirement req : reqMap.keySet()) {
if (sReq.contains(req.toString())) {
if (!evalRequirement(sReq, reqMap)) {
continue optionLoop;
}
}
}
}
return evalPlaceholder(format, plaMap);
} }
return ""; return "";
@ -190,15 +166,7 @@ public class HologramFormat {
} }
} }
} }
return true;
// complex comparison
try {
return (boolean) engine.eval(cond);
} catch (ScriptException e) {
plugin.debug("Failed to eval condition: " + condition);
plugin.debug(e);
return false;
}
} }
} }
@ -209,35 +177,26 @@ public class HologramFormat {
* @return Result of the condition * @return Result of the condition
*/ */
public String evalPlaceholder(String string, Map<Placeholder, Object> values) { public String evalPlaceholder(String string, Map<Placeholder, Object> values) {
try { Matcher matcher = Pattern.compile("\\{([^}]+)}").matcher(string);
Matcher matcher = Pattern.compile("\\{([^}]+)}").matcher(string);
String newString = string;
while (matcher.find()) { while (matcher.find()) {
String withBrackets = matcher.group(); String withBrackets = matcher.group();
String script = withBrackets.substring(1, withBrackets.length() - 1); String replaced = withBrackets.substring(1, withBrackets.length() - 1);
for (Placeholder placeholder : values.keySet()) { for (Placeholder placeholder : values.keySet()) {
if (script.contains(placeholder.toString())) { if (replaced.contains(placeholder.toString())) {
Object val = values.get(placeholder); Object val = values.get(placeholder);
String sVal = String.valueOf(val); String sVal = String.valueOf(val);
if (val instanceof String && !(sVal.startsWith("\"") && sVal.endsWith("\""))) { if (val instanceof String && !(sVal.startsWith("\"") && sVal.endsWith("\""))) {
sVal = String.format("\"%s\"", sVal); sVal = String.format("\"%s\"", sVal);
}
script = script.replace(placeholder.toString(), sVal);
} }
}
String result = String.valueOf(engine.eval(script)); replaced = replaced.replace(placeholder.toString(), sVal);
newString = newString.replace(withBrackets, result); }
} }
return newString; string = string.replace(withBrackets, replaced);
} catch (ScriptException e) {
plugin.debug("Failed to eval placeholder script in string: " + string);
plugin.debug(e);
} }
return string; return string;

View File

@ -1,59 +0,0 @@
package de.epiceric.shopchest.external.listeners;
import java.util.Set;
import org.bukkit.Location;
import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import de.epiceric.shopchest.ShopChest;
import de.epiceric.shopchest.config.Config;
import de.epiceric.shopchest.event.ShopCreateEvent;
import de.epiceric.shopchest.event.ShopExtendEvent;
import de.epiceric.shopchest.utils.Utils;
import pl.islandworld.api.IslandWorldApi;
public class IslandWorldListener implements Listener {
private final ShopChest plugin;
public IslandWorldListener(ShopChest plugin) {
this.plugin = plugin;
}
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
public void onCreateShop(ShopCreateEvent e) {
if (!Config.enableIslandWorldIntegration || !IslandWorldApi.isInitialized())
return;
Set<Location> chestLocations = Utils.getChestLocations(e.getShop());
for (Location loc : chestLocations) {
if (handleForLocation(e.getPlayer(), loc, e))
return;
}
}
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
public void onExtendShop(ShopExtendEvent e) {
if (!Config.enableIslandWorldIntegration || !IslandWorldApi.isInitialized())
return;
handleForLocation(e.getPlayer(), e.getNewChestLocation(), e);
}
private boolean handleForLocation(Player player, Location loc, Cancellable e) {
if (!loc.getWorld().getName().equals(IslandWorldApi.getIslandWorld().getName()))
return false;
if (!IslandWorldApi.canBuildOnLocation(player, loc, true)) {
e.setCancelled(true);
plugin.debug("Cancel Reason: IslandWorld");
return true;
}
return false;
}
}

View File

@ -1,69 +0,0 @@
package de.epiceric.shopchest.listeners;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.codemc.worldguardwrapper.WorldGuardWrapper;
import org.codemc.worldguardwrapper.region.IWrappedRegion;
import de.epiceric.shopchest.ShopChest;
import de.epiceric.shopchest.config.Config;
import de.epiceric.shopchest.shop.Shop;
import me.wiefferink.areashop.events.notify.DeletedRegionEvent;
import me.wiefferink.areashop.events.notify.ResoldRegionEvent;
import me.wiefferink.areashop.events.notify.SoldRegionEvent;
import me.wiefferink.areashop.events.notify.UnrentedRegionEvent;
import me.wiefferink.areashop.regions.GeneralRegion;
public class AreaShopListener implements Listener {
private ShopChest plugin;
public AreaShopListener(ShopChest plugin) {
this.plugin = plugin;
}
@EventHandler
public void onRegionDeleted(DeletedRegionEvent e) {
if (Config.enableAreaShopIntegration && Config.areashopRemoveShopEvents.contains("DELETE")) {
removeShopsInRegion(e.getRegion());
}
}
@EventHandler
public void onRegionUnrented(UnrentedRegionEvent e) {
if (Config.enableAreaShopIntegration && Config.areashopRemoveShopEvents.contains("UNRENT")) {
removeShopsInRegion(e.getRegion());
}
}
@EventHandler
public void onRegionResold(ResoldRegionEvent e) {
if (Config.enableAreaShopIntegration && Config.areashopRemoveShopEvents.contains("RESELL")) {
removeShopsInRegion(e.getRegion());
}
}
@EventHandler
public void onRegionSold(SoldRegionEvent e) {
if (Config.enableAreaShopIntegration && Config.areashopRemoveShopEvents.contains("SELL")) {
removeShopsInRegion(e.getRegion());
}
}
private void removeShopsInRegion(GeneralRegion generalRegion) {
if (!plugin.hasWorldGuard()) return;
for (Shop shop : plugin.getShopUtils().getShops()) {
if (!shop.getLocation().getWorld().getName().equals(generalRegion.getWorldName())) continue;
for (IWrappedRegion r : WorldGuardWrapper.getInstance().getRegions(shop.getLocation())) {
if (generalRegion.getLowerCaseName().equals(r.getId())) {
plugin.getShopUtils().removeShopById(shop.getID(), true);
break;
}
}
}
}
}

View File

@ -24,8 +24,6 @@ import de.epiceric.shopchest.utils.Permissions;
import de.epiceric.shopchest.utils.ShopUtils; import de.epiceric.shopchest.utils.ShopUtils;
import de.epiceric.shopchest.utils.Utils; import de.epiceric.shopchest.utils.Utils;
import fr.xephi.authme.api.v3.AuthMeApi; import fr.xephi.authme.api.v3.AuthMeApi;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.event.HoverEvent;
import net.milkbowl.vault.economy.Economy; import net.milkbowl.vault.economy.Economy;
import net.milkbowl.vault.economy.EconomyResponse; import net.milkbowl.vault.economy.EconomyResponse;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
@ -41,6 +39,7 @@ import org.bukkit.block.Container;
import org.bukkit.block.DoubleChest; import org.bukkit.block.DoubleChest;
import org.bukkit.block.ShulkerBox; import org.bukkit.block.ShulkerBox;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.Event;
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;
@ -66,7 +65,6 @@ import java.util.Set;
import java.util.UUID; import java.util.UUID;
import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletableFuture;
import java.util.function.Consumer; import java.util.function.Consumer;
import java.util.regex.Matcher;
public class ShopInteractListener implements Listener { public class ShopInteractListener implements Listener {
@ -99,6 +97,7 @@ public class ShopInteractListener implements Listener {
loc = ((DoubleChest) chestInv.getHolder()).getLocation(); loc = ((DoubleChest) chestInv.getHolder()).getLocation();
} }
if (loc == null) return;
final Shop shop = plugin.getShopUtils().getShop(loc); final Shop shop = plugin.getShopUtils().getShop(loc);
if (shop == null) return; if (shop == null) return;
@ -130,7 +129,7 @@ public class ShopInteractListener implements Listener {
if (Config.enableAuthMeIntegration && plugin.hasAuthMe() && !AuthMeApi.getInstance().isAuthenticated(p)) if (Config.enableAuthMeIntegration && plugin.hasAuthMe() && !AuthMeApi.getInstance().isAuthenticated(p))
return; return;
if (e.isCancelled() && !p.hasPermission(Permissions.CREATE_PROTECTED)) { if (e.useInteractedBlock() == Event.Result.DENY && !p.hasPermission(Permissions.CREATE_PROTECTED)) {
p.sendMessage(LanguageUtils.getMessage(Message.NO_PERMISSION_CREATE_PROTECTED)); p.sendMessage(LanguageUtils.getMessage(Message.NO_PERMISSION_CREATE_PROTECTED));
plugin.debug(p.getName() + " is not allowed to create a shop on the selected chest"); plugin.debug(p.getName() + " is not allowed to create a shop on the selected chest");
} else if (shopUtils.isShop(b.getLocation())) { } else if (shopUtils.isShop(b.getLocation())) {
@ -166,7 +165,7 @@ public class ShopInteractListener implements Listener {
if (e.getAction() != Action.RIGHT_CLICK_BLOCK && e.getAction() != Action.LEFT_CLICK_BLOCK) if (e.getAction() != Action.RIGHT_CLICK_BLOCK && e.getAction() != Action.LEFT_CLICK_BLOCK)
return; return;
if (!ShopUtils.isShopMaterial(b.getType())) if (b == null || !ShopUtils.isShopMaterial(b.getType()))
return; return;
ClickType clickType = ClickType.getPlayerClickType(p); ClickType clickType = ClickType.getPlayerClickType(p);
@ -523,7 +522,7 @@ public class ShopInteractListener implements Listener {
Message message = shopType == ShopType.ADMIN ? Message.ADMIN_SHOP_CREATED : Message.SHOP_CREATED; Message message = shopType == ShopType.ADMIN ? Message.ADMIN_SHOP_CREATED : Message.SHOP_CREATED;
executor.sendMessage(LanguageUtils.getMessage(message, new Replacement(Placeholder.CREATION_PRICE, creationPrice))); executor.sendMessage(LanguageUtils.getMessage(message, new Replacement(Placeholder.CREATION_PRICE, creationPrice)));
}); });
}); }, plugin.getShopCreationThreadPool());
} }
/** /**
@ -575,7 +574,7 @@ public class ShopInteractListener implements Listener {
shopUtils.removeShop(shop, true); shopUtils.removeShop(shop, true);
plugin.debug("Removed shop (#" + shop.getID() + ")"); plugin.debug("Removed shop (#" + shop.getID() + ")");
}); });
}); }, plugin.getShopCreationThreadPool());
} }
/** /**
@ -802,7 +801,7 @@ public class ShopInteractListener implements Listener {
executor.sendMessage(LanguageUtils.getMessage(Message.ERROR_OCCURRED, new Replacement(Placeholder.ERROR, r2.errorMessage))); executor.sendMessage(LanguageUtils.getMessage(Message.ERROR_OCCURRED, new Replacement(Placeholder.ERROR, r2.errorMessage)));
econ.withdrawPlayer(shop.getVendor(), worldName, newPrice); econ.withdrawPlayer(shop.getVendor(), worldName, newPrice);
econ.depositPlayer(executor, worldName, newPrice * (100d - tax) / 100d); econ.depositPlayer(executor, worldName, newPrice * (100d - tax) / 100d);
}); }, plugin.getShopCreationThreadPool());
} }
} else { } else {
int finalNewAmount1 = newAmount; int finalNewAmount1 = newAmount;
@ -842,17 +841,17 @@ public class ShopInteractListener implements Listener {
plugin.debug("Economy transaction failed (r): " + r.errorMessage + " (#" + shop.getID() + ")"); plugin.debug("Economy transaction failed (r): " + r.errorMessage + " (#" + shop.getID() + ")");
executor.sendMessage(LanguageUtils.getMessage(Message.ERROR_OCCURRED, new Replacement(Placeholder.ERROR, r.errorMessage))); executor.sendMessage(LanguageUtils.getMessage(Message.ERROR_OCCURRED, new Replacement(Placeholder.ERROR, r.errorMessage)));
econ.depositPlayer(executor, worldName, newPrice); econ.depositPlayer(executor, worldName, newPrice);
}); }, plugin.getShopCreationThreadPool());
} }
} else { } else {
executor.sendMessage(LanguageUtils.getMessage(Message.NOT_ENOUGH_INVENTORY_SPACE)); executor.sendMessage(LanguageUtils.getMessage(Message.NOT_ENOUGH_INVENTORY_SPACE));
} }
}); }, plugin.getShopCreationThreadPool());
}); });
} else { } else {
executor.sendMessage(LanguageUtils.getMessage(Message.NOT_ENOUGH_MONEY)); executor.sendMessage(LanguageUtils.getMessage(Message.NOT_ENOUGH_MONEY));
} }
}); }, plugin.getShopCreationThreadPool());
} }
/** /**
@ -951,7 +950,7 @@ public class ShopInteractListener implements Listener {
econ.withdrawPlayer(executor, worldName, newPrice * (100d - tax) / 100d); econ.withdrawPlayer(executor, worldName, newPrice * (100d - tax) / 100d);
econ.depositPlayer(shop.getVendor(), worldName, newPrice); econ.depositPlayer(shop.getVendor(), worldName, newPrice);
plugin.debug("Sell event cancelled (#" + shop.getID() + ")"); plugin.debug("Sell event cancelled (#" + shop.getID() + ")");
}); }, plugin.getShopCreationThreadPool());
return; return;
} }
@ -996,7 +995,7 @@ public class ShopInteractListener implements Listener {
executor.sendMessage(LanguageUtils.getMessage(Message.ERROR_OCCURRED, new Replacement(Placeholder.ERROR, r2.errorMessage))); executor.sendMessage(LanguageUtils.getMessage(Message.ERROR_OCCURRED, new Replacement(Placeholder.ERROR, r2.errorMessage)));
econ.withdrawPlayer(executor, worldName, newPrice * (100d - tax) / 100d); econ.withdrawPlayer(executor, worldName, newPrice * (100d - tax) / 100d);
econ.depositPlayer(shop.getVendor(), worldName, newPrice); econ.depositPlayer(shop.getVendor(), worldName, newPrice);
}); }, plugin.getShopCreationThreadPool());
} }
} else { } else {
@ -1007,7 +1006,7 @@ public class ShopInteractListener implements Listener {
CompletableFuture.runAsync(() -> { CompletableFuture.runAsync(() -> {
econ.withdrawPlayer(executor, worldName, newPrice * (100d - tax) / 100d); econ.withdrawPlayer(executor, worldName, newPrice * (100d - tax) / 100d);
plugin.debug("Sell event cancelled (#" + shop.getID() + ")"); plugin.debug("Sell event cancelled (#" + shop.getID() + ")");
}); }, plugin.getShopCreationThreadPool());
return; return;
} }
@ -1037,9 +1036,9 @@ public class ShopInteractListener implements Listener {
plugin.debug("Economy transaction failed (r): " + r.errorMessage + " (#" + shop.getID() + ")"); plugin.debug("Economy transaction failed (r): " + r.errorMessage + " (#" + shop.getID() + ")");
executor.sendMessage(LanguageUtils.getMessage(Message.ERROR_OCCURRED, new Replacement(Placeholder.ERROR, r.errorMessage))); executor.sendMessage(LanguageUtils.getMessage(Message.ERROR_OCCURRED, new Replacement(Placeholder.ERROR, r.errorMessage)));
econ.withdrawPlayer(executor, worldName, newPrice); econ.withdrawPlayer(executor, worldName, newPrice);
}); }, plugin.getShopCreationThreadPool());
} }
}); }, plugin.getShopCreationThreadPool());
} else { } else {
executor.sendMessage(LanguageUtils.getMessage(Message.CHEST_NOT_ENOUGH_INVENTORY_SPACE)); executor.sendMessage(LanguageUtils.getMessage(Message.CHEST_NOT_ENOUGH_INVENTORY_SPACE));
@ -1048,7 +1047,7 @@ public class ShopInteractListener implements Listener {
} else { } else {
executor.sendMessage(LanguageUtils.getMessage(Message.VENDOR_NOT_ENOUGH_MONEY)); executor.sendMessage(LanguageUtils.getMessage(Message.VENDOR_NOT_ENOUGH_MONEY));
} }
}); }, plugin.getShopCreationThreadPool());
} }
/** /**

67
pom.xml
View File

@ -6,7 +6,7 @@
<groupId>de.epiceric</groupId> <groupId>de.epiceric</groupId>
<artifactId>ShopChest-parent</artifactId> <artifactId>ShopChest-parent</artifactId>
<version>1.14.0-SNAPSHOT</version> <version>1.14.1-SNAPSHOT</version>
<packaging>pom</packaging> <packaging>pom</packaging>
<modules> <modules>
@ -54,13 +54,20 @@
<project.build.outputEncoding>UTF-8</project.build.outputEncoding> <project.build.outputEncoding>UTF-8</project.build.outputEncoding>
<!-- JDK Version --> <!-- JDK Version -->
<maven.compiler.source>1.8</maven.compiler.source> <maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target> <maven.compiler.target>17</maven.compiler.target>
<!-- Default Spigot version for nms implementation. Must be overridden --> <!-- Default Spigot version for nms implementation. Must be overridden -->
<spigot.version>defaultVersion</spigot.version> <spigot.version>defaultVersion</spigot.version>
</properties> </properties>
<pluginRepositories>
<pluginRepository>
<id>maven-snapshots</id>
<url>https://repository.apache.org/content/repositories/snapshots/</url>
</pluginRepository>
</pluginRepositories>
<repositories> <repositories>
<!-- Spigot repo (Spigot API) --> <!-- Spigot repo (Spigot API) -->
<repository> <repository>
@ -77,11 +84,6 @@
<id>codemc-repo</id> <id>codemc-repo</id>
<url>https://repo.codemc.org/repository/maven-public/</url> <url>https://repo.codemc.org/repository/maven-public/</url>
</repository> </repository>
<!-- Intellectual Site repo (PlotSquared v6) -->
<repository>
<id>intellectualsites-snapshots-repo</id>
<url>https://mvn.intellectualsites.com/content/repositories/public/</url>
</repository>
<!-- Inventive Talent repo (ReflectionHelper) --> <!-- Inventive Talent repo (ReflectionHelper) -->
<repository> <repository>
<id>inventive-repo</id> <id>inventive-repo</id>
@ -92,11 +94,6 @@
<id>enginehub-repo</id> <id>enginehub-repo</id>
<url>https://maven.enginehub.org/repo/</url> <url>https://maven.enginehub.org/repo/</url>
</repository> </repository>
<!-- AreaShop repo -->
<repository>
<id>areashop-repo</id>
<url>http://maven.wiefferink.me</url>
</repository>
</repositories> </repositories>
<dependencyManagement> <dependencyManagement>
@ -122,7 +119,7 @@
<dependency> <dependency>
<groupId>com.plotsquared</groupId> <groupId>com.plotsquared</groupId>
<artifactId>PlotSquared-Core</artifactId> <artifactId>PlotSquared-Core</artifactId>
<version>6.2.1</version> <version>6.5.1</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency> <dependency>
@ -243,12 +240,6 @@
<version>0.97.5.0</version> <version>0.97.5.0</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency>
<groupId>pl.gnacik.islandworld</groupId>
<artifactId>IslandWorld</artifactId>
<version>8.5</version>
<scope>provided</scope>
</dependency>
<!-- Nms dependency --> <!-- Nms dependency -->
<dependency> <dependency>
@ -299,16 +290,6 @@
<artifactId>shopchest-nms-reflection</artifactId> <artifactId>shopchest-nms-reflection</artifactId>
<version>1.0.0</version> <version>1.0.0</version>
</dependency> </dependency>
<dependency>
<groupId>de.epiceric</groupId>
<artifactId>shopchest-nms-v1_17_R1</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>de.epiceric</groupId>
<artifactId>shopchest-nms-v1_17_1_R1</artifactId>
<version>1.0.0</version>
</dependency>
<dependency> <dependency>
<groupId>de.epiceric</groupId> <groupId>de.epiceric</groupId>
<artifactId>shopchest-nms-v1_18_R1</artifactId> <artifactId>shopchest-nms-v1_18_R1</artifactId>
@ -324,7 +305,7 @@
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId> <artifactId>maven-shade-plugin</artifactId>
<version>3.2.2</version> <version>3.3.1-SNAPSHOT</version>
<executions> <executions>
<execution> <execution>
<phase>package</phase> <phase>package</phase>
@ -352,6 +333,30 @@
<pattern>org.inventivetalent.reflection</pattern> <pattern>org.inventivetalent.reflection</pattern>
<shadedPattern>de.epiceric.shopchest.dependencies.reflectionhelper</shadedPattern> <shadedPattern>de.epiceric.shopchest.dependencies.reflectionhelper</shadedPattern>
</relocation> </relocation>
<relocation>
<pattern>com.google.common</pattern>
<shadedPattern>de.epiceric.shopchest.dependencies.google-common</shadedPattern>
</relocation>
<relocation>
<pattern>com.google.errorprone</pattern>
<shadedPattern>de.epiceric.shopchest.dependencies.google-errorprone</shadedPattern>
</relocation>
<relocation>
<pattern>com.google.gson</pattern>
<shadedPattern>de.epiceric.shopchest.dependencies.google-gson</shadedPattern>
</relocation>
<relocation>
<pattern>com.google.j2objc</pattern>
<shadedPattern>de.epiceric.shopchest.dependencies.google-j2objc</shadedPattern>
</relocation>
<relocation>
<pattern>com.google.thirdparty</pattern>
<shadedPattern>de.epiceric.shopchest.dependencies.google-thirdparty</shadedPattern>
</relocation>
<relocation>
<pattern>javax.annotation</pattern>
<shadedPattern>de.epiceric.shopchest.dependencies.javax-annotation</shadedPattern>
</relocation>
</relocations> </relocations>
<filters> <filters>
<filter> <filter>