Skip to content

Commit 74e3545

Browse files
committed
spilt api interface (part 7, fix build)
1 parent 15177c5 commit 74e3545

File tree

15 files changed

+48
-40
lines changed

15 files changed

+48
-40
lines changed

src/main/java/org/maxgamer/quickshop/command/subcommand/SubCommand_Info.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
import org.maxgamer.quickshop.QuickShop;
2828
import org.maxgamer.quickshop.api.command.CommandHandler;
2929
import org.maxgamer.quickshop.api.shop.Shop;
30-
import org.maxgamer.quickshop.shop.JavaShopChunk;
30+
import org.maxgamer.quickshop.api.shop.ShopChunk;
3131
import org.maxgamer.quickshop.util.MsgUtil;
3232

3333
import java.util.Map;
@@ -46,7 +46,7 @@ public void onCommand(@NotNull CommandSender sender, @NotNull String commandLabe
4646
worlds = 0;
4747
int nostock = 0;
4848

49-
for (Map<JavaShopChunk, Map<Location, Shop>> inWorld :
49+
for (Map<ShopChunk, Map<Location, Shop>> inWorld :
5050
plugin.getShopManager().getShops().values()) {
5151
worlds++;
5252

src/main/java/org/maxgamer/quickshop/integration/lands/LandsIntegration.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@
3232
import org.jetbrains.annotations.NotNull;
3333
import org.maxgamer.quickshop.QuickShop;
3434
import org.maxgamer.quickshop.api.integration.IntegrationStage;
35-
import org.maxgamer.quickshop.integration.AbstractQSIntegratedPlugin;
3635
import org.maxgamer.quickshop.api.shop.Shop;
37-
import org.maxgamer.quickshop.shop.JavaShopChunk;
36+
import org.maxgamer.quickshop.api.shop.ShopChunk;
37+
import org.maxgamer.quickshop.integration.AbstractQSIntegratedPlugin;
3838
import org.maxgamer.quickshop.util.Util;
3939
import org.maxgamer.quickshop.util.logging.container.ShopRemoveLog;
4040
import org.maxgamer.quickshop.util.reload.ReloadResult;
@@ -100,13 +100,13 @@ public void onLandsPermissionChanges(LandUntrustPlayerEvent event) {
100100

101101
private void deleteShopInLand(Land land, UUID target) {
102102
//Getting all shop with world-chunk-shop mapping
103-
for (Map.Entry<String, Map<JavaShopChunk, Map<Location, Shop>>> entry : plugin.getShopManager().getShops().entrySet()) {
103+
for (Map.Entry<String, Map<ShopChunk, Map<Location, Shop>>> entry : plugin.getShopManager().getShops().entrySet()) {
104104
//Matching world
105105
World world = plugin.getServer().getWorld(entry.getKey());
106106
if (world != null) {
107107
//Matching chunk
108-
for (Map.Entry<JavaShopChunk, Map<Location, Shop>> chunkedShopEntry : entry.getValue().entrySet()) {
109-
JavaShopChunk shopChunk = chunkedShopEntry.getKey();
108+
for (Map.Entry<ShopChunk, Map<Location, Shop>> chunkedShopEntry : entry.getValue().entrySet()) {
109+
ShopChunk shopChunk = chunkedShopEntry.getKey();
110110
if (land.hasChunk(world, shopChunk.getX(), shopChunk.getZ())) {
111111
//Matching Owner and delete it
112112
Map<Location, Shop> shops = chunkedShopEntry.getValue();

src/main/java/org/maxgamer/quickshop/integration/towny/TownyIntegration.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,9 @@
3939
import org.maxgamer.quickshop.QuickShop;
4040
import org.maxgamer.quickshop.api.integration.IntegrateStage;
4141
import org.maxgamer.quickshop.api.integration.IntegrationStage;
42-
import org.maxgamer.quickshop.integration.AbstractQSIntegratedPlugin;
4342
import org.maxgamer.quickshop.api.shop.Shop;
44-
import org.maxgamer.quickshop.shop.JavaShopChunk;
43+
import org.maxgamer.quickshop.api.shop.ShopChunk;
44+
import org.maxgamer.quickshop.integration.AbstractQSIntegratedPlugin;
4545
import org.maxgamer.quickshop.util.Util;
4646
import org.maxgamer.quickshop.util.reload.ReloadResult;
4747
import org.maxgamer.quickshop.util.reload.ReloadStatus;
@@ -108,13 +108,13 @@ public void deleteShops(UUID owner, Town town) {
108108
worldName = town.getWorld().getName();
109109
}
110110
//Getting all shop with world-chunk-shop mapping
111-
for (Map.Entry<String, Map<JavaShopChunk, Map<Location, Shop>>> entry : plugin.getShopManager().getShops().entrySet()) {
111+
for (Map.Entry<String, Map<ShopChunk, Map<Location, Shop>>> entry : plugin.getShopManager().getShops().entrySet()) {
112112
//Matching world
113113
if (worldName.equals(entry.getKey())) {
114114
World world = Bukkit.getWorld(entry.getKey());
115115
if (world != null) {
116116
//Matching Location
117-
for (Map.Entry<JavaShopChunk, Map<Location, Shop>> chunkedShopEntry : entry.getValue().entrySet()) {
117+
for (Map.Entry<ShopChunk, Map<Location, Shop>> chunkedShopEntry : entry.getValue().entrySet()) {
118118
Map<Location, Shop> shopMap = chunkedShopEntry.getValue();
119119
for (Shop shop : shopMap.values()) {
120120
//Matching Owner
@@ -143,13 +143,13 @@ public void purgeShops(TownBlock townBlock) {
143143
String worldName;
144144
worldName = townBlock.getWorld().getName();
145145
//Getting all shop with world-chunk-shop mapping
146-
for (Map.Entry<String, Map<JavaShopChunk, Map<Location, Shop>>> entry : plugin.getShopManager().getShops().entrySet()) {
146+
for (Map.Entry<String, Map<ShopChunk, Map<Location, Shop>>> entry : plugin.getShopManager().getShops().entrySet()) {
147147
//Matching world
148148
if (worldName.equals(entry.getKey())) {
149149
World world = Bukkit.getWorld(entry.getKey());
150150
if (world != null) {
151151
//Matching Location
152-
for (Map.Entry<JavaShopChunk, Map<Location, Shop>> chunkedShopEntry : entry.getValue().entrySet()) {
152+
for (Map.Entry<ShopChunk, Map<Location, Shop>> chunkedShopEntry : entry.getValue().entrySet()) {
153153
Map<Location, Shop> shopMap = chunkedShopEntry.getValue();
154154
for (Shop shop : shopMap.values()) {
155155
//Matching Owner

src/main/java/org/maxgamer/quickshop/listener/PluginListener.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import org.bukkit.event.server.PluginDisableEvent;
2525
import org.bukkit.event.server.PluginEnableEvent;
2626
import org.maxgamer.quickshop.QuickShop;
27+
import org.maxgamer.quickshop.api.compatibility.CompatibilityManager;
2728
import org.maxgamer.quickshop.api.integration.IntegratedPlugin;
2829
import org.maxgamer.quickshop.api.integration.IntegrationManager;
2930
import org.maxgamer.quickshop.util.Util;
@@ -37,16 +38,16 @@ public class PluginListener extends AbstractQSListener {
3738

3839
private static final Set<String> COMPATIBILITY_MODULE_LIST = JavaCompatibilityManager.getModuleMapping().keySet();
3940
private IntegrationManager integrationHelper;
40-
private JavaCompatibilityManager compatibilityManager;
41+
private CompatibilityManager compatibilityManager;
4142

4243
public PluginListener(QuickShop plugin) {
4344
super(plugin);
4445
init();
4546
}
4647

4748
private void init() {
48-
//integrationHelper = plugin.getIntegrationHelper();
49-
compatibilityManager = plugin.getCompatibilityTool();
49+
integrationHelper = plugin.getIntegrationHelper();
50+
compatibilityManager = plugin.getCompatibilityManager();
5051
}
5152

5253

src/main/java/org/maxgamer/quickshop/listener/WorldListener.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
import org.bukkit.event.world.WorldUnloadEvent;
2929
import org.maxgamer.quickshop.QuickShop;
3030
import org.maxgamer.quickshop.api.shop.Shop;
31-
import org.maxgamer.quickshop.shop.JavaShopChunk;
31+
import org.maxgamer.quickshop.api.shop.ShopChunk;
3232
import org.maxgamer.quickshop.util.reload.ReloadResult;
3333
import org.maxgamer.quickshop.util.reload.ReloadStatus;
3434

@@ -54,17 +54,17 @@ public void onWorldLoad(WorldLoadEvent e) {
5454

5555
plugin.getShopLoader().loadShops(world.getName());
5656
// New world data
57-
final Map<JavaShopChunk, Map<Location, Shop>> inWorld = new ConcurrentHashMap<>(1);
57+
final Map<ShopChunk, Map<Location, Shop>> inWorld = new ConcurrentHashMap<>(1);
5858
// Old world data
59-
final Map<JavaShopChunk, Map<Location, Shop>> oldInWorld =
59+
final Map<ShopChunk, Map<Location, Shop>> oldInWorld =
6060
plugin.getShopManager().getShops(world.getName());
6161
// Nothing in the old world, therefore we don't care. No locations to
6262
// update.
6363
if (oldInWorld == null) {
6464
return;
6565
}
6666

67-
for (Entry<JavaShopChunk, Map<Location, Shop>> oldInChunk : oldInWorld.entrySet()) {
67+
for (Entry<ShopChunk, Map<Location, Shop>> oldInChunk : oldInWorld.entrySet()) {
6868
final Map<Location, Shop> inChunk = new ConcurrentHashMap<>(1);
6969
// Put the new chunk were the old chunk was
7070
inWorld.put(oldInChunk.getKey(), inChunk);

src/main/java/org/maxgamer/quickshop/permission/BukkitPermsProvider.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ public boolean hasPermission(@NotNull CommandSender sender, @NotNull String perm
4747
* @param permission The permission want to check
4848
* @return Debug Infos
4949
*/
50-
@Override
5150
public @NotNull PermissionInformationContainer getDebugInfo(
5251
@NotNull CommandSender sender, @NotNull String permission) {
5352
return new PermissionInformationContainer(sender, permission, null, null);

src/main/java/org/maxgamer/quickshop/permission/PermissionManager.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,9 @@ public boolean hasPermission(@NotNull CommandSender sender, @NotNull String perm
5858
boolean result = provider.hasPermission(sender, permission);
5959
if (Util.isDevMode()) {
6060
try {
61-
PermissionInformationContainer container = provider.getDebugInfo(sender, permission);
62-
Util.debugLog("Node: [" + container.getPermission() + "]; Result: [" + result + "]; Sender: [" + container.getSender().getName() + "]");
61+
//PermissionInformationContainer container = (PermissionInformationContainer) provider.getClass().getDeclaredMethod("getDebugInfo", CommandSender.class, String.class).invoke(provider,sender,permission);
62+
// PermissionInformationContainer container = provider.getDebugInfo(sender, permission);
63+
Util.debugLog("Node: [" + permission + "]; Result: [" + result + "]; Sender: [" + sender.getName() + "]");
6364
} catch (Exception th) {
6465
Util.debugLog("Exception threw when getting debug messages.");
6566
MsgUtil.debugStackTrace(th.getStackTrace());

src/main/java/org/maxgamer/quickshop/permission/VaultPermissionProvider.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ public boolean hasPermission(@NotNull CommandSender sender, @NotNull String perm
7272
* @param permission The permission want to check
7373
* @return Debug Infos
7474
*/
75-
@Override
7675
public @NotNull PermissionInformationContainer getDebugInfo(
7776
@NotNull CommandSender sender, @NotNull String permission) {
7877
if (sender instanceof Server) {

src/main/java/org/maxgamer/quickshop/shop/ContainerShop.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ public ContainerShop(
145145
@NotNull Location location,
146146
double price,
147147
@NotNull ItemStack item,
148-
@NotNull JavaShopModerator moderator,
148+
@NotNull ShopModerator moderator,
149149
boolean unlimited,
150150
@NotNull ShopType type,
151151
@NotNull YamlConfiguration extra,

src/main/java/org/maxgamer/quickshop/shop/JavaPriceLimiter.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
import org.bukkit.inventory.ItemStack;
2525
import org.jetbrains.annotations.NotNull;
2626
import org.maxgamer.quickshop.QuickShop;
27+
import org.maxgamer.quickshop.api.shop.PriceLimiter;
28+
import org.maxgamer.quickshop.api.shop.PriceLimiterCheckResult;
2729
import org.maxgamer.quickshop.api.shop.PriceLimiterStatus;
2830
import org.maxgamer.quickshop.util.CalculateUtil;
2931
import org.maxgamer.quickshop.util.Util;
@@ -34,14 +36,15 @@
3436

3537
@AllArgsConstructor
3638
@Data
37-
public class JavaPriceLimiter {
39+
public class JavaPriceLimiter implements PriceLimiter {
3840
private double minPrice;
3941
private double maxPrice;
4042
private boolean allowFreeShop;
4143
private boolean wholeNumberOnly;
4244

45+
@Override
4346
@NotNull
44-
public JavaPriceLimiterCheckResult check(@NotNull ItemStack stack, double price) {
47+
public PriceLimiterCheckResult check(@NotNull ItemStack stack, double price) {
4548
if (Double.isInfinite(price) || Double.isNaN(price)) {
4649
return new JavaPriceLimiterCheckResult(PriceLimiterStatus.NOT_VALID, minPrice, maxPrice);
4750
}

0 commit comments

Comments
 (0)