Skip to content

Commit 1e8fa34

Browse files
committed
spilt api interface (part 1)
1 parent e81cfa5 commit 1e8fa34

File tree

199 files changed

+1217
-746
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

199 files changed

+1217
-746
lines changed

src/main/java/org/maxgamer/quickshop/Cache.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
import org.checkerframework.checker.nullness.qual.NonNull;
2626
import org.jetbrains.annotations.NotNull;
2727
import org.jetbrains.annotations.Nullable;
28-
import org.maxgamer.quickshop.shop.Shop;
28+
import org.maxgamer.quickshop.api.shop.Shop;
2929

3030
import java.util.concurrent.TimeUnit;
3131

src/main/java/org/maxgamer/quickshop/QuickShop.java

Lines changed: 56 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,21 @@
4444
import org.jetbrains.annotations.NotNull;
4545
import org.jetbrains.annotations.Nullable;
4646
import org.maxgamer.quickshop.api.QuickShopAPI;
47-
import org.maxgamer.quickshop.chat.QuickChat;
47+
import org.maxgamer.quickshop.api.chat.QuickChat;
48+
import org.maxgamer.quickshop.api.compatibility.CompatibilityManager;
49+
import org.maxgamer.quickshop.api.shop.AbstractDisplayItem;
50+
import org.maxgamer.quickshop.database.AbstractDatabaseCore;
51+
import org.maxgamer.quickshop.api.economy.EconomyCore;
52+
import org.maxgamer.quickshop.api.integration.IntegrateStage;
53+
import org.maxgamer.quickshop.api.integration.IntegrationManager;
54+
import org.maxgamer.quickshop.api.shop.Shop;
55+
import org.maxgamer.quickshop.api.shop.ShopManager;
4856
import org.maxgamer.quickshop.chat.platform.minedown.BungeeQuickChat;
49-
import org.maxgamer.quickshop.command.CommandManager;
57+
import org.maxgamer.quickshop.command.JavaCommandManager;
5058
import org.maxgamer.quickshop.database.*;
5159
import org.maxgamer.quickshop.economy.*;
5260
import org.maxgamer.quickshop.event.QSReloadEvent;
53-
import org.maxgamer.quickshop.integration.IntegrateStage;
54-
import org.maxgamer.quickshop.integration.IntegrationHelper;
61+
import org.maxgamer.quickshop.integration.JavaIntegrationManager;
5562
import org.maxgamer.quickshop.integration.worldguard.WorldGuardIntegration;
5663
import org.maxgamer.quickshop.listener.*;
5764
import org.maxgamer.quickshop.listener.worldedit.WorldEditAdapter;
@@ -60,11 +67,11 @@
6067
import org.maxgamer.quickshop.shop.*;
6168
import org.maxgamer.quickshop.util.Timer;
6269
import org.maxgamer.quickshop.util.*;
63-
import org.maxgamer.quickshop.util.compatibility.CompatibilityManager;
70+
import org.maxgamer.quickshop.util.compatibility.JavaCompatibilityManager;
6471
import org.maxgamer.quickshop.util.config.ConfigProvider;
6572
import org.maxgamer.quickshop.util.config.ConfigurationFixer;
6673
import org.maxgamer.quickshop.util.envcheck.*;
67-
import org.maxgamer.quickshop.util.language.text.TextManager;
74+
import org.maxgamer.quickshop.localization.text.JavaTextManager;
6875
import org.maxgamer.quickshop.util.matcher.item.BukkitItemMatcherImpl;
6976
import org.maxgamer.quickshop.util.matcher.item.ItemMatcher;
7077
import org.maxgamer.quickshop.util.matcher.item.QuickShopItemMatcherImpl;
@@ -86,7 +93,7 @@
8693

8794
import static java.nio.file.StandardCopyOption.REPLACE_EXISTING;
8895

89-
public class QuickShop extends JavaPlugin {
96+
public class QuickShop extends JavaPlugin implements QuickShopAPI {
9097

9198
/**
9299
* The active instance of QuickShop
@@ -108,8 +115,9 @@ public class QuickShop extends JavaPlugin {
108115
/**
109116
* WIP
110117
*/
118+
// Interfaced
111119
@Getter
112-
private final CompatibilityManager compatibilityTool = new CompatibilityManager(this);
120+
private final JavaCompatibilityManager compatibilityTool = new JavaCompatibilityManager(this);
113121
/**
114122
* The shop limites.
115123
*/
@@ -122,22 +130,24 @@ public class QuickShop extends JavaPlugin {
122130
@Getter
123131
private final ReloadManager reloadManager = new ReloadManager();
124132
boolean onLoadCalled = false;
125-
@Getter
126-
private IntegrationHelper integrationHelper;
133+
// Interfaced
134+
private JavaIntegrationManager integrationHelper;
127135
/**
128136
* The BootError, if it not NULL, plugin will stop loading and show setted errors when use /qs
129137
*/
130138
@Nullable
131139
@Getter
132140
@Setter
133141
private BootError bootError;
142+
// Interfaced
134143
@Getter
135-
private CommandManager commandManager;
144+
private JavaCommandManager commandManager;
136145
/**
137146
* Contains all SQL tasks
138147
*/
139148
@Getter
140-
private DatabaseHelper databaseHelper;
149+
// Interfaced
150+
private JavaDatabaseHelper databaseHelper;
141151
/**
142152
* Queued database manager
143153
*/
@@ -151,7 +161,6 @@ public class QuickShop extends JavaPlugin {
151161
/**
152162
* Whether we should use display items or not
153163
*/
154-
@Getter
155164
private boolean display = true;
156165
@Getter
157166
private int displayItemCheckTicks;
@@ -167,7 +176,6 @@ public class QuickShop extends JavaPlugin {
167176
/**
168177
* Whether or not to limit players shop amounts
169178
*/
170-
@Getter
171179
private boolean limit = false;
172180
@Nullable
173181
@Getter
@@ -216,8 +224,8 @@ public class QuickShop extends JavaPlugin {
216224
/**
217225
* The Shop Manager used to store shops
218226
*/
219-
@Getter
220-
private ShopManager shopManager;
227+
// Interfaced
228+
private JavaShopManager shopManager;
221229
@Getter
222230
private DisplayAutoDespawnWatcher displayAutoDespawnWatcher;
223231
@Getter
@@ -258,7 +266,7 @@ public class QuickShop extends JavaPlugin {
258266
@Getter
259267
private WorldEditAdapter worldEditAdapter;
260268
@Getter
261-
private TextManager textManager;
269+
private JavaTextManager textManager;
262270
@Getter
263271
private ShopPurger shopPurger;
264272

@@ -310,6 +318,10 @@ public static String getFork() {
310318
return "Reremake";
311319
}
312320

321+
public IntegrationManager getIntegrationHelper() {
322+
return integrationHelper;
323+
}
324+
313325
/**
314326
* Get the Player's Shop limit.
315327
*
@@ -561,17 +573,16 @@ public final void onLoad() {
561573
this.onLoadCalled = true;
562574
getLogger().info("QuickShop " + getFork() + " - Early boot step - Booting up...");
563575
//BEWARE THESE ONLY RUN ONCE
564-
this.textManager = new TextManager(this);
576+
this.textManager = new JavaTextManager(this);
565577
this.buildInfo = new BuildInfo(getResource("BUILDINFO"));
566578
runtimeCheck(EnvCheckEntry.Stage.ON_LOAD);
567579
getLogger().info("Reading the configuration...");
568580
this.initConfiguration();
569-
QuickShopAPI._internal_access_only_setupApi(this);
570581
//noinspection ResultOfMethodCallIgnored
571582
getDataFolder().mkdirs();
572583
this.bootError = null;
573584
getLogger().info("Loading up integration modules.");
574-
this.integrationHelper = new IntegrationHelper(this);
585+
this.integrationHelper = new JavaIntegrationManager(this);
575586
this.integrationHelper.callIntegrationsLoad(IntegrateStage.onLoadBegin);
576587
if (getConfig().getBoolean("integration.worldguard.enable")) {
577588
Plugin wg = Bukkit.getPluginManager().getPlugin("WorldGuard");
@@ -770,8 +781,6 @@ public final void onEnable() {
770781
getLogger().info("Starting plugin self-test, please wait...");
771782
runtimeCheck(EnvCheckEntry.Stage.ON_ENABLE);
772783

773-
QuickShopAPI._internal_access_only_setupApi(this);
774-
775784
getLogger().info("Reading the configuration...");
776785
this.initConfiguration();
777786

@@ -832,15 +841,15 @@ public final void onEnable() {
832841

833842
getLogger().info("Registering commands...");
834843
/* PreInit for BootError feature */
835-
commandManager = new CommandManager(this);
844+
commandManager = new JavaCommandManager(this);
836845
//noinspection ConstantConditions
837846
getCommand("qs").setExecutor(commandManager);
838847
//noinspection ConstantConditions
839848
getCommand("qs").setTabCompleter(commandManager);
840849

841850
this.registerCustomCommands();
842851

843-
this.shopManager = new ShopManager(this);
852+
this.shopManager = new JavaShopManager(this);
844853

845854
this.permissionChecker = new PermissionChecker(this);
846855

@@ -889,7 +898,7 @@ public final void onEnable() {
889898
ongoingFeeWatcher = new OngoingFeeWatcher(this);
890899
InternalListener internalListener = new InternalListener(this);
891900
Bukkit.getPluginManager().registerEvents(internalListener, this);
892-
if (isDisplay() && AbstractDisplayItem.getNowUsing() != DisplayType.VIRTUALITEM) {
901+
if (this.display && AbstractDisplayItem.getNowUsing() != DisplayType.VIRTUALITEM) {
893902
displayWatcher = new DisplayWatcher(this);
894903
new DisplayProtectionListener(this, this.shopCache).register();
895904
if (Bukkit.getPluginManager().getPlugin("ClearLag") != null) {
@@ -996,7 +1005,7 @@ private boolean setupDatabase() {
9961005
}
9971006
this.databaseManager = new DatabaseManager(this, ServiceInjector.getDatabaseCore(dbCore));
9981007
// Make the database up to date
999-
this.databaseHelper = new DatabaseHelper(this, this.databaseManager);
1008+
this.databaseHelper = new JavaDatabaseHelper(this, this.databaseManager);
10001009
} catch (DatabaseManager.ConnectionException e) {
10011010
getLogger().log(Level.SEVERE, "Error when connecting to the database", e);
10021011
if (setupDBonEnableding) {
@@ -1968,7 +1977,27 @@ public void registerCustomCommands() {
19681977
Util.debugLog("Command alias successfully registered.");
19691978
}
19701979

1971-
public @NotNull TextManager text() {
1980+
public @NotNull JavaTextManager text() {
19721981
return textManager;
19731982
}
1983+
1984+
@Override
1985+
public CompatibilityManager getCompatibilityManager() {
1986+
return this.compatibilityTool;
1987+
}
1988+
1989+
@Override
1990+
public ShopManager getShopManager() {
1991+
return this.shopManager;
1992+
}
1993+
1994+
@Override
1995+
public boolean isDisplayEnabled() {
1996+
return this.display;
1997+
}
1998+
1999+
@Override
2000+
public boolean isLimit() {
2001+
return this.limit;
2002+
}
19742003
}

src/main/java/org/maxgamer/quickshop/ServiceInjector.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@
2424
import org.jetbrains.annotations.NotNull;
2525
import org.jetbrains.annotations.Nullable;
2626
import org.maxgamer.quickshop.database.AbstractDatabaseCore;
27-
import org.maxgamer.quickshop.economy.EconomyCore;
28-
import org.maxgamer.quickshop.util.language.game.GameLanguage;
27+
import org.maxgamer.quickshop.api.economy.EconomyCore;
28+
import org.maxgamer.quickshop.localization.game.game.GameLanguage;
2929
import org.maxgamer.quickshop.util.matcher.item.ItemMatcher;
3030

3131
/**

src/main/java/org/maxgamer/quickshop/api/DisplayItemAPI.java

Lines changed: 0 additions & 63 deletions
This file was deleted.

0 commit comments

Comments
 (0)