Skip to content

Commit fd2b01d

Browse files
committed
javadoc
1 parent 94a2311 commit fd2b01d

22 files changed

+283
-39
lines changed

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

Lines changed: 52 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,30 +10,78 @@
1010

1111
import java.util.Map;
1212

13+
/**
14+
* The unique entry point to allow you to access most features of QuickShop
15+
*/
1316
public interface QuickShopAPI {
14-
17+
/**
18+
* Getting Compatibility Manager (usually used for anti-chest)
19+
* @return Compatibility Manager
20+
*/
1521
CompatibilityManager getCompatibilityManager();
1622

23+
/**
24+
* Getting Shop Manager which managing most of shops
25+
* @return Shop manager
26+
*/
1727
ShopManager getShopManager();
1828

29+
/**
30+
* Getting QuickShop current stacking item support status
31+
* @return Stacking Item support enabled
32+
*/
1933
boolean isAllowStack();
2034

35+
/**
36+
* Getting QuickShop current display item support status
37+
* @return Display item enabled
38+
*/
2139
boolean isDisplayEnabled();
22-
40+
/**
41+
* Getting QuickShop current permission based shop amount limit status
42+
* @return Limit enabled
43+
*/
2344
boolean isLimit();
45+
/**
46+
* Getting QuickShop current permission based shop amount limits
47+
* @return Permissions 2 Shop Amounts mapping
48+
*/
49+
Map<String, Integer> getLimits();
2450

51+
/**
52+
* Getting the helper to directly access the database
53+
* @return The database helper
54+
*/
2555
DatabaseHelper getDatabaseHelper();
2656

57+
/**
58+
* Getting text manager that allow addon to create a user language locale based message
59+
* @return The text maanger
60+
*/
2761
TextManager getTextManager();
2862

63+
/**
64+
* Getting current using ItemMatcher impl
65+
* @return The item matcher
66+
*/
2967
ItemMatcher getItemMatcher();
3068

69+
/**
70+
* Getting the status that fee requires if user performing price change
71+
* @return requires fee
72+
*/
3173
boolean isPriceChangeRequiresFee();
3274

75+
/**
76+
* Getting command manager that allow addon direct access QuickShop sub-command system
77+
* @return The command manager
78+
*/
3379
CommandManager getCommandManager();
3480

35-
Map<String, Integer> getLimits();
36-
81+
/**
82+
* Getting this server game version
83+
* @return Game version
84+
*/
3785
GameVersion getGameVersion();
3886

3987
}

src/main/java/org/maxgamer/quickshop/api/chat/QuickChat.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
import org.maxgamer.quickshop.api.shop.Shop;
2828

2929
/**
30-
* QuickChat is a system to allow us to processing plain text and also MineDown
30+
* QuickChat is a system to allow us to process complex messages
3131
*/
3232
public interface QuickChat {
3333
/**

src/main/java/org/maxgamer/quickshop/api/command/CommandHandler.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@
2626
import java.util.Collections;
2727
import java.util.List;
2828

29+
/**
30+
* The command handler that processing sub commands under QS main command
31+
* @param <T> The subtype of CommandSender you want received
32+
*/
2933
public interface CommandHandler<T extends CommandSender> {
3034
/**
3135
* Calling while command executed by specified sender

src/main/java/org/maxgamer/quickshop/api/command/CommandManager.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@
77

88
import java.util.List;
99

10+
/**
11+
* The manager that managing all sub-commands that registered
12+
* Also performing permission checks in there.
13+
*/
1014
public interface CommandManager {
1115
/**
1216
* This is a interface to allow addons to register the subcommand into quickshop command manager.

src/main/java/org/maxgamer/quickshop/api/compatibility/CompatibilityManager.java

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,16 @@
33
import org.bukkit.entity.Player;
44
import org.jetbrains.annotations.NotNull;
55

6+
/**
7+
* Manager that managing all registered compatibility for anti-cheat modules
8+
*/
69
public interface CompatibilityManager {
7-
8-
boolean isRegistered(String pluginName);
10+
/**
11+
* Check a module registered
12+
* @param moduleName Module name
13+
* @return Is registered
14+
*/
15+
boolean isRegistered(String moduleName);
916

1017
/**
1118
* Switch the compatibility mode on or off, set false to disable all we known incompatiable plugin
@@ -16,15 +23,24 @@ public interface CompatibilityManager {
1623
*/
1724
void toggleProtectionListeners(boolean status, @NotNull Player player);
1825

26+
/**
27+
* Unregister all registered compatibility modules
28+
*/
1929
void unregisterAll();
2030

31+
/**
32+
* Register compatibility module
33+
* @param module Compatibility module
34+
*/
2135
void register(@NotNull CompatibilityModule module);
22-
23-
void register(@NotNull String moduleName);
24-
25-
void register(@NotNull Class<? extends CompatibilityModule> compatibilityModuleClass);
26-
36+
/**
37+
* Unregister a registered compatibility modules
38+
* @param moduleName Compatibility module name
39+
*/
2740
void unregister(@NotNull String moduleName);
28-
41+
/**
42+
* Unregister a registered compatibility modules
43+
* @param module Compatibility module
44+
*/
2945
void unregister(@NotNull CompatibilityModule module);
3046
}

src/main/java/org/maxgamer/quickshop/api/database/DatabaseHelper.java

Lines changed: 88 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,34 +11,120 @@
1111
import java.util.function.Consumer;
1212

1313
public interface DatabaseHelper {
14+
/**
15+
* Creates a column with specific name and data type
16+
* @param tableName The table name
17+
* @param columnName The column name
18+
* @param type The data type
19+
* @return Create result
20+
*/
1421
boolean createColumn(@NotNull String tableName, @NotNull String columnName, @NotNull DataType type);
1522

23+
/**
24+
* Cleanup transaction messages that saved in database
25+
* @param weekAgo How many weeks ago messages should we clean up
26+
*/
1627
void cleanMessage(long weekAgo);
1728

29+
/**
30+
* Purge and clean all saved transaction message in data that should send to specific player
31+
* @param player The player
32+
*/
1833
void cleanMessageForPlayer(@NotNull UUID player);
1934

35+
/**
36+
* Create a shop data record sand save into database
37+
* @param shop The shop object
38+
* @param onSuccess Success callback
39+
* @param onFailed Fails callback
40+
*/
2041
void createShop(@NotNull Shop shop, @Nullable Runnable onSuccess, @Nullable Consumer<SQLException> onFailed);
2142

43+
/**
44+
* Remove a shop data record from database
45+
* @param shop The shop
46+
*/
2247
void removeShop(Shop shop);
2348

49+
/**
50+
* Remove a shop data record from database
51+
* @param world Shop world
52+
* @param x Shop X
53+
* @param y Shop Y
54+
* @param z Shop Z
55+
*/
2456
void removeShop(String world, int x, int y, int z);
2557

58+
/**
59+
* Select all messages that saved in the database
60+
* @return Query result set
61+
* @throws SQLException Any errors related to SQL Errors
62+
*/
2663
WarpedResultSet selectAllMessages() throws SQLException;
27-
64+
/**
65+
* Select specific table content
66+
* @return Query result set
67+
* @throws SQLException Any errors related to SQL Errors
68+
*/
2869
WarpedResultSet selectTable(String table) throws SQLException;
29-
70+
/**
71+
* Select all shops that saved in the database
72+
* @return Query result set
73+
* @throws SQLException Any errors related to SQL Errors
74+
*/
3075
WarpedResultSet selectAllShops() throws SQLException;
3176

77+
/**
78+
* Create a transaction message record and save into database
79+
* @param player Target player
80+
* @param message The message content
81+
* @param time System time
82+
*/
3283
void sendMessage(@NotNull UUID player, @NotNull String message, long time);
3384

85+
/**
86+
* Upgrade legacy name based data record to uniqueId based record
87+
* @param ownerUUID The owner unique id
88+
* @param x Shop X
89+
* @param y Shop Y
90+
* @param z Shop Z
91+
* @param worldName Shop World
92+
*/
3493
void updateOwner2UUID(@NotNull String ownerUUID, int x, int y, int z, @NotNull String worldName);
3594

95+
/**
96+
* Update external cache data
97+
* (Used for Web UI or other something like that)
98+
* @param shop The shop
99+
* @param space The shop remaining space
100+
* @param stock The shop remaining stock
101+
*/
36102
void updateExternalInventoryProfileCache(@NotNull Shop shop, int space, int stock);
37103

104+
/**
105+
* Update a shop data into the database
106+
* @param owner Shop owner
107+
* @param item Shop item
108+
* @param unlimited Shop unlimited
109+
* @param shopType Shop type
110+
* @param price Shop price
111+
* @param x Shop x
112+
* @param y Shop y
113+
* @param z Shop z
114+
* @param world Shop world
115+
* @param extra Shop extra data
116+
* @param currency Shop currency
117+
* @param disableDisplay Shop display disabled status
118+
* @param taxAccount Shop specific tax account
119+
*/
38120
void updateShop(@NotNull String owner, @NotNull ItemStack item, int unlimited, int shopType,
39121
double price, int x, int y, int z, @NotNull String world, @NotNull String extra,
40122
@NotNull String currency, boolean disableDisplay, @Nullable String taxAccount);
41123

124+
/**
125+
* Insert a history record into logs table
126+
* @param record Record object that can be serialized by Gson.
127+
*/
42128
void insertHistoryRecord(Object record);
43129

44130
}

src/main/java/org/maxgamer/quickshop/api/economy/AbstractEconomy.java

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -31,25 +31,35 @@
3131

3232
import java.util.UUID;
3333

34+
/**
35+
* Abstract Economy Core
36+
*/
3437
public abstract class AbstractEconomy implements EconomyCore, Reloadable {
3538

36-
private final QuickShop plugin;
37-
38-
public AbstractEconomy(@NotNull QuickShop plugin) {
39-
this.plugin = plugin;
40-
39+
public AbstractEconomy() {
4140
}
4241

42+
/**
43+
* Getting QuickShop now using type of Economy
44+
* @return Economy type that QuickShop now using
45+
*/
4346
public static EconomyType getNowUsing() {
4447
return EconomyType.fromID(QuickShop.getInstance().getConfig().getInt("economy-type"));
4548
}
4649

4750
@Override
4851
public abstract String toString();
49-
// return core.getClass().getName().split("_")[1];
50-
//}
51-
5252

53+
/**
54+
* Transfer specific amount of currency from A to B
55+
* (Developer: This is low layer of Economy System, use EconomyTransaction if possible)
56+
* @param from The player who is paying money
57+
* @param to The player who is receiving money
58+
* @param amount The amount to transfer
59+
* @param world The transaction world
60+
* @param currency The currency name
61+
* @return successed
62+
*/
5363
@Override
5464
public boolean transfer(@NotNull UUID from, @NotNull UUID to, double amount, @NotNull World world, @Nullable String currency) {
5565
if (!isValid()) {
@@ -129,9 +139,7 @@ public boolean transfer(@NotNull UUID from, @NotNull UUID to, double amount, @No
129139
}
130140

131141
@Override
132-
public @NotNull Plugin getPlugin() {
133-
return plugin;
134-
}
142+
public abstract @NotNull Plugin getPlugin();
135143

136144
/**
137145
* Callback for reloading

src/main/java/org/maxgamer/quickshop/api/integration/IntegrationManager.java

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,21 @@
66
import java.util.Map;
77

88
public interface IntegrationManager {
9+
/**
10+
* Getting read-only mapping for all registered modules
11+
* @return All registered modules
12+
*/
913
Map<String, IntegratedPlugin> getIntegrationMap();
1014

15+
/**
16+
* Getting all registered Integration modules
17+
* @return All registered Integration
18+
*/
1119
List<IntegratedPlugin> getIntegrations();
1220

21+
/**
22+
* Re-execute a search task to register available modules if possible
23+
*/
1324
void searchAndRegisterPlugins();
1425

1526
/**
@@ -33,6 +44,11 @@ public interface IntegrationManager {
3344
*/
3445
void register(@NotNull String integratedPluginName);
3546

47+
/**
48+
* Check if a class is Integration module
49+
* @param clazz The class
50+
* @return Is Integration module
51+
*/
3652
@SuppressWarnings("BooleanMethodIsAlwaysInverted")
3753
static boolean isIntegrationClass(@NotNull Class<?> clazz) {
3854
return clazz.getDeclaredAnnotation(IntegrationStage.class) != null;
@@ -57,5 +73,10 @@ static boolean isIntegrationClass(@NotNull Class<?> clazz) {
5773
*/
5874
void unregister(@NotNull IntegratedPlugin integratedPlugin);
5975

76+
/**
77+
* Check if a integration has been registered
78+
* @param integrationName The integration
79+
* @return Registered
80+
*/
6081
boolean isRegistered(@NotNull String integrationName);
6182
}

src/main/java/org/maxgamer/quickshop/api/localization/text/TextManager.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77
import java.util.List;
88
import java.util.UUID;
99

10+
/**
11+
* The TextManager that allow create user's locale specified message.
12+
*/
1013
public interface TextManager {
1114
/**
1215
* Gets specific locale status

0 commit comments

Comments
 (0)