Skip to content

Commit 5fb5e47

Browse files
committed
clean up
1 parent 0138af6 commit 5fb5e47

File tree

21 files changed

+154
-72
lines changed

21 files changed

+154
-72
lines changed

src/main/java/org/maxgamer/quickshop/command/CommandProcesser.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,10 @@
3030
@Deprecated
3131
public interface CommandProcesser extends CommandHandler<CommandSender> {
3232

33+
@Override
3334
void onCommand(@NotNull CommandSender sender, @NotNull String commandLabel, @NotNull String[] cmdArg);
3435

36+
@Override
3537
@Nullable
3638
default List<String> onTabComplete(
3739
@NotNull CommandSender sender, @NotNull String commandLabel, @NotNull String[] cmdArg) {

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,11 @@ public void onCommand(@NotNull Player sender, @NotNull String commandLabel, @Not
5353
plugin.text().of(sender, "taxaccount-unset").send();
5454
return;
5555
}
56-
if (Util.isUUID(cmdArg[0]))
56+
if (Util.isUUID(cmdArg[0])) {
5757
shop.setTaxAccount(UUID.fromString(cmdArg[0]));
58-
else
58+
} else {
5959
shop.setTaxAccount(Bukkit.getOfflinePlayer(cmdArg[0]).getUniqueId());
60+
}
6061
plugin.text().of(sender, "taxaccount-unset", cmdArg[0]).send();
6162
return;
6263
} else {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public void onCommand(@NotNull CommandSender sender, @NotNull String commandLabe
5353
return;
5454
}
5555

56-
if (cmdArg.length == 0 || !cmdArg[0].equalsIgnoreCase("confirm")) {
56+
if (cmdArg.length == 0 || !"confirm".equalsIgnoreCase(cmdArg[0])) {
5757
MsgUtil.sendDirectMessage(sender, ChatColor.RED + "You will need to restart the server to complete the update of plugin! Before restarting plugin will stop working!");
5858
MsgUtil.sendDirectMessage(sender, ChatColor.RED + "Type " + ChatColor.BOLD + "/qs update confirm" + ChatColor.RESET + ChatColor.RED + " to confirm update");
5959
return;

src/main/java/org/maxgamer/quickshop/database/DataType.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,18 @@ public class DataType {
1515

1616
public DataType(@NotNull DataTypeMapping type, @Nullable Integer length, @NotNull Object defaultValue) {
1717
this.datatype = type;
18-
if (length != null)
18+
if (length != null) {
1919
Validate.isTrue(length > 1, "Field length cannot be negative or zero.");
20+
}
2021
this.length = length;
2122
this.defaultValue = defaultValue;
2223
}
2324

2425
public DataType(@NotNull DataTypeMapping type, @Nullable Integer length) {
2526
this.datatype = type;
26-
if (length != null)
27+
if (length != null) {
2728
Validate.isTrue(length > 1, "Field length cannot be negative or zero.");
29+
}
2830
this.length = length;
2931
this.defaultValue = null;
3032
}

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,16 +165,18 @@ public boolean createColumn(@NotNull String tableName, @NotNull String columnNam
165165

166166
try {
167167
String table = plugin.getDbPrefix() + tableName;
168-
if (manager.hasColumn(table, columnName))
168+
if (manager.hasColumn(table, columnName)) {
169169
return false;
170+
}
170171
String sqlString;
171172
if (manager.getDatabase() instanceof MySQLCore) {
172173
sqlString = "alter table " + table + " add " + columnName + " " + type.getDatatype().getMysql();
173174
} else {
174175
sqlString = "alter table " + table + " add column " + columnName + " " + type.getDatatype().getSqlite();
175176
}
176-
if (type.getLength() != null)
177+
if (type.getLength() != null) {
177178
sqlString += "(" + type.getLength().toString() + ") ";
179+
}
178180
Util.debugLog("Append sql for creating column is " + sqlString);
179181
manager.runInstantTask(new DatabaseTask(sqlString, new DatabaseTask.Task() {
180182
@Override

src/main/java/org/maxgamer/quickshop/event/QSEvent.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,9 @@ public void callEvent() {
5858
*/
5959
public boolean callCancellableEvent() {
6060
QuickShop.getInstance().getServer().getPluginManager().callEvent(this);
61-
if (this instanceof Cancellable)
61+
if (this instanceof Cancellable) {
6262
return ((Cancellable) this).isCancelled();
63+
}
6364
return false;
6465
}
6566

src/main/java/org/maxgamer/quickshop/integration/advancedregionmarket/AdvancedShopRegionMarketIntegration.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ public void load() {
100100

101101
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
102102
public void onPluginLoad(PluginEnableEvent event) {
103-
if (event.getPlugin().getName().equals("ArmShopBridge")) {
103+
if ("ArmShopBridge".equals(event.getPlugin().getName())) {
104104
scanAndUnregister();
105105
}
106106
}

src/main/java/org/maxgamer/quickshop/integration/iridiumskyblock/IridiumSkyblockIntegration.java

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,9 @@ private void init() {
8080
*/
8181
@Override
8282
public boolean canCreateShopHere(@NotNull Player player, @NotNull Location location) {
83-
if (!IridiumSkyblockAPI.getInstance().isIslandWorld(location.getWorld())) return false;
83+
if (!IridiumSkyblockAPI.getInstance().isIslandWorld(location.getWorld())) {
84+
return false;
85+
}
8486
Optional<Island> island = IridiumSkyblockAPI.getInstance().getIslandViaLocation(location);
8587
if (!island.isPresent()) {
8688
return false;
@@ -135,7 +137,9 @@ public void deleteShopsWhenIslandDelete(IslandDeleteEvent event) {
135137
Island island = event.getIsland();
136138
List<User> members = event.getIsland().getMembers();
137139
for (Shop shop : plugin.getShopManager().getAllShops()) {
138-
if (!island.isInIsland(shop.getLocation())) continue;
140+
if (!island.isInIsland(shop.getLocation())) {
141+
continue;
142+
}
139143
for (User user : members) {
140144
if (shop.getOwner().equals(user.getUuid())) {
141145
plugin.logEvent(new ShopRemoveLog(Util.getNilUniqueId(),String.format("[%s Integration]Shop %s deleted caused by ShopOwnerQuitFromIsland", this.getName(), shop),shop.saveToInfoStorage()));
@@ -150,7 +154,9 @@ public void deleteShopsWhenIslandDelete(IslandRegenEvent event) {
150154
Island island = event.getIsland();
151155
List<User> members = event.getIsland().getMembers();
152156
for (Shop shop : plugin.getShopManager().getAllShops()) {
153-
if (!island.isInIsland(shop.getLocation())) continue;
157+
if (!island.isInIsland(shop.getLocation())) {
158+
continue;
159+
}
154160
for (User user : members) {
155161
if (shop.getOwner().equals(user.getUuid())) {
156162
plugin.logEvent(new ShopRemoveLog(Util.getNilUniqueId(),String.format("[%s Integration]Shop %s deleted caused by ShopOwnerQuitFromIsland", this.getName(), shop),shop.saveToInfoStorage()));
@@ -164,7 +170,9 @@ public void deleteShopsWhenIslandDelete(IslandRegenEvent event) {
164170
public void deleteShopWhenMemberKicked(UserKickEvent event) {
165171
Island island = event.getIsland();
166172
for (Shop shop : plugin.getShopManager().getPlayerAllShops(event.getUser().getUuid())) {
167-
if (!island.isInIsland(shop.getLocation())) continue;
173+
if (!island.isInIsland(shop.getLocation())) {
174+
continue;
175+
}
168176
plugin.logEvent(new ShopRemoveLog(Util.getNilUniqueId(),String.format("[%s Integration]Shop %s deleted caused by ShopOwnerQuitFromIsland", this.getName(), shop),shop.saveToInfoStorage()));
169177
shop.delete();
170178
}

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,9 @@ public DisplayProtectionListener(QuickShop plugin, Cache cache) {
6363
*/
6464
@Override
6565
public ReloadResult reloadModule() throws Exception {
66-
if (useEnhanceProtection == plugin.getConfig().getBoolean("shop.enchance-display-protect"))
66+
if (useEnhanceProtection == plugin.getConfig().getBoolean("shop.enchance-display-protect")) {
6767
return ReloadResult.builder().status(ReloadStatus.SUCCESS).build();
68+
}
6869
return ReloadResult.builder().status(ReloadStatus.REQUIRE_RESTART).build();
6970
}
7071

src/main/java/org/maxgamer/quickshop/listener/worldedit/WorldEditAdapter.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ public void register() {
4242
weBukkit.getWorldEdit().getEventBus().register(this);
4343
}
4444

45+
@Override
4546
public void unregister() {
4647
weBukkit.getWorldEdit().getEventBus().unregister(this);
4748
}

0 commit comments

Comments
 (0)