diff --git a/api/src/main/java/net/okocraft/box/api/command/AbstractCommand.java b/api/src/main/java/net/okocraft/box/api/command/AbstractCommand.java index 511bcdec9d..8d2b6b9706 100644 --- a/api/src/main/java/net/okocraft/box/api/command/AbstractCommand.java +++ b/api/src/main/java/net/okocraft/box/api/command/AbstractCommand.java @@ -47,15 +47,15 @@ public AbstractCommand(@NotNull String name, @NotNull String permissionNode, @No } public @NotNull String getName() { - return name; + return this.name; } public @NotNull String getPermissionNode() { - return permissionNode; + return this.permissionNode; } public @NotNull @Unmodifiable Set getAliases() { - return aliases; + return this.aliases; } public @NotNull List onTabComplete(@NotNull CommandSender sender, @NotNull String[] args) { diff --git a/api/src/main/java/net/okocraft/box/api/command/SubCommandHoldable.java b/api/src/main/java/net/okocraft/box/api/command/SubCommandHoldable.java index e06644ab49..7f534b04d1 100644 --- a/api/src/main/java/net/okocraft/box/api/command/SubCommandHoldable.java +++ b/api/src/main/java/net/okocraft/box/api/command/SubCommandHoldable.java @@ -48,7 +48,7 @@ public SubCommandHolder(@NotNull Command... subCommands) { * @return the list of subcommands */ public @NotNull @Unmodifiable List getSubCommands() { - return subCommands; + return this.subCommands; } /** @@ -57,7 +57,7 @@ public SubCommandHolder(@NotNull Command... subCommands) { * @param subCommand the new subcommand */ public void register(@NotNull Command subCommand) { - subCommands.add(subCommand); + this.subCommands.add(subCommand); } /** @@ -66,7 +66,7 @@ public void register(@NotNull Command subCommand) { * @param subCommand the subcommand to unregister */ public void unregister(@NotNull Command subCommand) { - subCommands.remove(subCommand); + this.subCommands.remove(subCommand); } /** @@ -78,7 +78,7 @@ public void unregister(@NotNull Command subCommand) { public @NotNull Optional search(@NotNull String name) { name = Objects.requireNonNull(name).toLowerCase(Locale.ROOT); - for (var subCommand : subCommands) { + for (var subCommand : this.subCommands) { if (subCommand.getName().equals(name) || subCommand.getAliases().contains(name)) { return Optional.of(subCommand); } diff --git a/api/src/main/java/net/okocraft/box/api/event/feature/FeatureEvent.java b/api/src/main/java/net/okocraft/box/api/event/feature/FeatureEvent.java index 79d6117e69..6c3c74946d 100644 --- a/api/src/main/java/net/okocraft/box/api/event/feature/FeatureEvent.java +++ b/api/src/main/java/net/okocraft/box/api/event/feature/FeatureEvent.java @@ -40,7 +40,7 @@ public FeatureEvent(@NotNull BoxFeature feature, @NotNull Type type) { * @return the {@link Type} of this event */ public @NotNull Type getType() { - return type; + return this.type; } @Override diff --git a/api/src/main/java/net/okocraft/box/api/feature/AbstractBoxFeature.java b/api/src/main/java/net/okocraft/box/api/feature/AbstractBoxFeature.java index 81e6d7f1ff..6126b01129 100644 --- a/api/src/main/java/net/okocraft/box/api/feature/AbstractBoxFeature.java +++ b/api/src/main/java/net/okocraft/box/api/feature/AbstractBoxFeature.java @@ -22,7 +22,7 @@ protected AbstractBoxFeature(@NotNull String name) { @Override public @NotNull String getName() { - return name; + return this.name; } } diff --git a/api/src/main/java/net/okocraft/box/api/transaction/DepositAllImpl.java b/api/src/main/java/net/okocraft/box/api/transaction/DepositAllImpl.java index 39e56c653c..8c34a1ac31 100644 --- a/api/src/main/java/net/okocraft/box/api/transaction/DepositAllImpl.java +++ b/api/src/main/java/net/okocraft/box/api/transaction/DepositAllImpl.java @@ -53,13 +53,13 @@ record DepositAllImpl(@NotNull StockHolder stockHolder, var boxItem = itemManager.getBoxItem(item).orElse(null); - if (boxItem == null || (filter != null && !filter.test(boxItem)) || (view != null && !checkClickEvent(view, i))) { + if (boxItem == null || (this.filter != null && !this.filter.test(boxItem)) || (view != null && !checkClickEvent(view, i))) { continue; } int itemAmount = item.getAmount(); - stockHolder.increase(boxItem, itemAmount, cause); + this.stockHolder.increase(boxItem, itemAmount, cause); contents[i] = null; resultMap.mergeInt(boxItem, itemAmount, Integer::sum); diff --git a/api/src/main/java/net/okocraft/box/api/transaction/DepositImpl.java b/api/src/main/java/net/okocraft/box/api/transaction/DepositImpl.java index e9f178e2b0..96991e9101 100644 --- a/api/src/main/java/net/okocraft/box/api/transaction/DepositImpl.java +++ b/api/src/main/java/net/okocraft/box/api/transaction/DepositImpl.java @@ -38,22 +38,22 @@ record DepositImpl(@NotNull StockHolder stockHolder, @NotNull BoxItem boxItem, int depositedAmount = 0; - for (int i = 0; i < contents.length && depositedAmount < limit; i++) { + for (int i = 0; i < contents.length && depositedAmount < this.limit; i++) { var item = contents[i]; - if (item == null || !boxItem.getOriginal().isSimilar(item) || (view != null && !checkClickEvent(view, i))) { + if (item == null || !this.boxItem.getOriginal().isSimilar(item) || (view != null && !checkClickEvent(view, i))) { continue; } - int remaining = limit - depositedAmount; + int remaining = this.limit - depositedAmount; int itemAmount = item.getAmount(); if (itemAmount <= remaining) { - stockHolder.increase(boxItem, itemAmount, cause); + this.stockHolder.increase(this.boxItem, itemAmount, cause); depositedAmount += itemAmount; contents[i] = null; } else { - stockHolder.increase(boxItem, remaining, cause); + this.stockHolder.increase(this.boxItem, remaining, cause); depositedAmount += remaining; contents[i] = item.asQuantity(itemAmount - remaining); } diff --git a/api/src/main/java/net/okocraft/box/api/transaction/StockHolderTransaction.java b/api/src/main/java/net/okocraft/box/api/transaction/StockHolderTransaction.java index 22619cc365..3787ae4fe4 100644 --- a/api/src/main/java/net/okocraft/box/api/transaction/StockHolderTransaction.java +++ b/api/src/main/java/net/okocraft/box/api/transaction/StockHolderTransaction.java @@ -45,7 +45,7 @@ private StockHolderTransaction(@NotNull StockHolder stockHolder) { * @throws NullPointerException if {@code item} is null */ public @NotNull Deposit deposit(@NotNull BoxItem item, int limit) { - return new DepositImpl(stockHolder, Objects.requireNonNull(item), limit); + return new DepositImpl(this.stockHolder, Objects.requireNonNull(item), limit); } /** @@ -54,7 +54,7 @@ private StockHolderTransaction(@NotNull StockHolder stockHolder) { * @return a {@link Deposit} instance */ public @NotNull Deposit depositAll() { - return new DepositAllImpl(stockHolder, null); + return new DepositAllImpl(this.stockHolder, null); } /** @@ -65,7 +65,7 @@ private StockHolderTransaction(@NotNull StockHolder stockHolder) { * @throws NullPointerException if {@code filter} is null */ public @NotNull Deposit depositAll(@NotNull Predicate filter) { - return new DepositAllImpl(stockHolder, Objects.requireNonNull(filter)); + return new DepositAllImpl(this.stockHolder, Objects.requireNonNull(filter)); } /** @@ -77,7 +77,7 @@ private StockHolderTransaction(@NotNull StockHolder stockHolder) { * @throws NullPointerException if {@code item} is null */ public @NotNull Withdrawal withdraw(@NotNull BoxItem item, int limit) { - return new WithdrawalImpl(stockHolder, Objects.requireNonNull(item), limit); + return new WithdrawalImpl(this.stockHolder, Objects.requireNonNull(item), limit); } /** diff --git a/api/src/main/java/net/okocraft/box/api/transaction/TransactionResult.java b/api/src/main/java/net/okocraft/box/api/transaction/TransactionResult.java index 2f723983fc..de8967e13a 100644 --- a/api/src/main/java/net/okocraft/box/api/transaction/TransactionResult.java +++ b/api/src/main/java/net/okocraft/box/api/transaction/TransactionResult.java @@ -50,7 +50,7 @@ public record TransactionResult(@NotNull BoxItem item, int amount) { */ @ApiStatus.Obsolete public @NotNull BoxItem getItem() { - return item; + return this.item; } /** @@ -60,6 +60,6 @@ public record TransactionResult(@NotNull BoxItem item, int amount) { */ @ApiStatus.Obsolete public int getAmount() { - return amount; + return this.amount; } } diff --git a/api/src/main/java/net/okocraft/box/api/transaction/WithdrawalImpl.java b/api/src/main/java/net/okocraft/box/api/transaction/WithdrawalImpl.java index 0a6493d944..68deb972c2 100644 --- a/api/src/main/java/net/okocraft/box/api/transaction/WithdrawalImpl.java +++ b/api/src/main/java/net/okocraft/box/api/transaction/WithdrawalImpl.java @@ -31,12 +31,12 @@ record WithdrawalImpl(@NotNull StockHolder stockHolder, @NotNull BoxItem boxItem Objects.requireNonNull(inventory); Objects.requireNonNull(cause); - int maxStackSize = boxItem.getOriginal().getMaxStackSize(); + int maxStackSize = this.boxItem.getOriginal().getMaxStackSize(); int withdrawnAmount = 0; var contents = inventory.getStorageContents(); - for (int i = 0; i < contents.length && withdrawnAmount < limit; i++) { + for (int i = 0; i < contents.length && withdrawnAmount < this.limit; i++) { var item = contents[i]; if (item == null) { @@ -44,15 +44,15 @@ record WithdrawalImpl(@NotNull StockHolder stockHolder, @NotNull BoxItem boxItem continue; } - int withdrawn = stockHolder.decreaseToZero(boxItem, Math.min(limit - withdrawnAmount, maxStackSize), cause); + int withdrawn = this.stockHolder.decreaseToZero(this.boxItem, Math.min(this.limit - withdrawnAmount, maxStackSize), cause); if (withdrawn < 1) { break; } withdrawnAmount += withdrawn; - contents[i] = boxItem.getOriginal().asQuantity(withdrawn); - } else if (item.isSimilar(boxItem.getOriginal())) { + contents[i] = this.boxItem.getOriginal().asQuantity(withdrawn); + } else if (item.isSimilar(this.boxItem.getOriginal())) { if (view != null && !checkClickEvent(view, i)) { continue; } @@ -60,7 +60,7 @@ record WithdrawalImpl(@NotNull StockHolder stockHolder, @NotNull BoxItem boxItem int remaining = maxStackSize - item.getAmount(); if (0 < remaining) { - int withdrawn = stockHolder.decreaseToZero(boxItem, Math.min(limit - withdrawnAmount, remaining), cause); + int withdrawn = this.stockHolder.decreaseToZero(this.boxItem, Math.min(this.limit - withdrawnAmount, remaining), cause); if (withdrawn < 1) { break; @@ -76,7 +76,7 @@ record WithdrawalImpl(@NotNull StockHolder stockHolder, @NotNull BoxItem boxItem inventory.setStorageContents(contents); } - return TransactionResult.create(boxItem, withdrawnAmount); + return TransactionResult.create(this.boxItem, withdrawnAmount); } private static boolean checkClickEvent(@NotNull InventoryView view, int slot) { diff --git a/bundle/src/main/java/net/okocraft/box/bootstrap/BoxBootstrapContext.java b/bundle/src/main/java/net/okocraft/box/bootstrap/BoxBootstrapContext.java index 8cad07827c..5ce51a45c0 100644 --- a/bundle/src/main/java/net/okocraft/box/bootstrap/BoxBootstrapContext.java +++ b/bundle/src/main/java/net/okocraft/box/bootstrap/BoxBootstrapContext.java @@ -54,12 +54,12 @@ public final class BoxBootstrapContext implements net.okocraft.box.api.bootstrap @Override public @NotNull Path getDataDirectory() { - return dataDirectory; + return this.dataDirectory; } @Override public @NotNull String getVersion() { - return version; + return this.version; } @Override @@ -80,7 +80,7 @@ public final class BoxBootstrapContext implements net.okocraft.box.api.bootstrap } public @NotNull StorageRegistry getStorageRegistry() { - return storageRegistry; + return this.storageRegistry; } public @NotNull List getBoxFeatureList() { diff --git a/core/src/main/java/net/okocraft/box/core/BoxCore.java b/core/src/main/java/net/okocraft/box/core/BoxCore.java index 4777052ab0..ab4e4d5555 100644 --- a/core/src/main/java/net/okocraft/box/core/BoxCore.java +++ b/core/src/main/java/net/okocraft/box/core/BoxCore.java @@ -84,7 +84,7 @@ public boolean enable(@NotNull Storage storage) { BoxLogger.logger().info("Initializing managers..."); - userManager = new BoxUserManager(storage.getUserStorage()); + this.userManager = new BoxUserManager(storage.getUserStorage()); try { var itemLoadResult = ItemLoader.load(storage.getItemStorage(), this.context.defaultItemProvider()); @@ -103,9 +103,9 @@ public boolean enable(@NotNull Storage storage) { this.playerMap = new BoxPlayerMapImpl(this.userManager, this.stockManager, this.context.eventManager(), this.context.scheduler(), this.context.messageProvider()); this.playerMap.loadAll(); - Bukkit.getPluginManager().registerEvents(new PlayerConnectionListener(this.playerMap), context.plugin()); + Bukkit.getPluginManager().registerEvents(new PlayerConnectionListener(this.playerMap), this.context.plugin()); - stockManager.schedulerAutoSaveTask(this.context.scheduler()); + this.stockManager.schedulerAutoSaveTask(this.context.scheduler()); BoxLogger.logger().info("Registering commands..."); @@ -121,11 +121,11 @@ public boolean enable(@NotNull Storage storage) { } public void disable() { - if (playerMap != null) { - playerMap.unloadAll(); + if (this.playerMap != null) { + this.playerMap.unloadAll(); } - stockManager.close(); + this.stockManager.close(); DebugListener.unregister(this.context.eventManager()); } @@ -190,7 +190,7 @@ public void accept(Supplier componentSupplier) { @Override public @NotNull Path getPluginDirectory() { - return context.dataDirectory(); + return this.context.dataDirectory(); } @Override @@ -205,17 +205,17 @@ public void accept(Supplier componentSupplier) { @Override public @NotNull UserManager getUserManager() { - return userManager; + return this.userManager; } @Override public @NotNull ItemManager getItemManager() { - return itemManager; + return this.itemManager; } @Override public @NotNull StockManager getStockManager() { - return stockManager; + return this.stockManager; } @Override @@ -235,17 +235,17 @@ public void accept(Supplier componentSupplier) { @Override public @NotNull BoxPlayerMap getBoxPlayerMap() { - return playerMap; + return this.playerMap; } @Override public @NotNull BoxCommand getBoxCommand() { - return boxCommand; + return this.boxCommand; } @Override public @NotNull BoxAdminCommand getBoxAdminCommand() { - return boxAdminCommand; + return this.boxAdminCommand; } public void initializeFeatures(@NotNull List features) { diff --git a/core/src/main/java/net/okocraft/box/core/command/BaseCommand.java b/core/src/main/java/net/okocraft/box/core/command/BaseCommand.java index 7ceb7e294f..d98030a8af 100644 --- a/core/src/main/java/net/okocraft/box/core/command/BaseCommand.java +++ b/core/src/main/java/net/okocraft/box/core/command/BaseCommand.java @@ -45,7 +45,7 @@ public void onCommand(@NotNull CommandSender sender, @NotNull String[] args) { } if (args.length == 0) { - if (commandOfNoArgument != null && sender.hasPermission(commandOfNoArgument.getPermissionNode())) { + if (this.commandOfNoArgument != null && sender.hasPermission(this.commandOfNoArgument.getPermissionNode())) { this.scheduler.runAsyncTask(() -> this.commandOfNoArgument.onCommand(sender, args)); } else { ErrorMessages.NOT_ENOUGH_ARGUMENT.source(source).send(sender); @@ -54,7 +54,7 @@ public void onCommand(@NotNull CommandSender sender, @NotNull String[] args) { return; } - var optionalSubCommand = subCommandHolder.search(args[0]); + var optionalSubCommand = this.subCommandHolder.search(args[0]); if (optionalSubCommand.isEmpty()) { if (!args[0].equalsIgnoreCase("help")) { @@ -89,14 +89,14 @@ public void onCommand(@NotNull CommandSender sender, @NotNull String[] args) { } if (args.length == 1) { - return subCommandHolder.getSubCommands().stream() + return this.subCommandHolder.getSubCommands().stream() .filter(cmd -> sender.hasPermission(cmd.getPermissionNode())) .map(Command::getName) .filter(cmdName -> cmdName.startsWith(args[0].toLowerCase(Locale.ROOT))) .toList(); } - return subCommandHolder.search(args[0]) + return this.subCommandHolder.search(args[0]) .filter(cmd -> sender.hasPermission(cmd.getPermissionNode())) .map(cmd -> cmd.onTabComplete(sender, args)) .orElse(Collections.emptyList()); @@ -104,7 +104,7 @@ public void onCommand(@NotNull CommandSender sender, @NotNull String[] args) { @Override public @NotNull SubCommandHolder getSubCommandHolder() { - return subCommandHolder; + return this.subCommandHolder; } @Override @@ -113,7 +113,7 @@ public void onCommand(@NotNull CommandSender sender, @NotNull String[] args) { } public void changeNoArgumentCommand(@Nullable Command command) { - commandOfNoArgument = command; + this.commandOfNoArgument = command; } @EventHandler diff --git a/core/src/main/java/net/okocraft/box/core/listener/PlayerConnectionListener.java b/core/src/main/java/net/okocraft/box/core/listener/PlayerConnectionListener.java index 41283718bf..c354dcb818 100644 --- a/core/src/main/java/net/okocraft/box/core/listener/PlayerConnectionListener.java +++ b/core/src/main/java/net/okocraft/box/core/listener/PlayerConnectionListener.java @@ -17,11 +17,11 @@ public PlayerConnectionListener(@NotNull BoxPlayerMapImpl playerMap) { @EventHandler public void onJoin(@NotNull PlayerJoinEvent event) { - playerMap.scheduleLoadingData(event.getPlayer()); + this.playerMap.scheduleLoadingData(event.getPlayer()); } @EventHandler public void onQuit(@NotNull PlayerQuitEvent event) { - playerMap.unload(event.getPlayer()); + this.playerMap.unload(event.getPlayer()); } } diff --git a/core/src/main/java/net/okocraft/box/core/model/loader/LoadingPersonalStockHolder.java b/core/src/main/java/net/okocraft/box/core/model/loader/LoadingPersonalStockHolder.java index ac20d9e4c3..114509b06e 100644 --- a/core/src/main/java/net/okocraft/box/core/model/loader/LoadingPersonalStockHolder.java +++ b/core/src/main/java/net/okocraft/box/core/model/loader/LoadingPersonalStockHolder.java @@ -148,7 +148,7 @@ boolean isLoaded() { @VisibleForTesting boolean isClosed() { - return closed; + return this.closed; } @Override diff --git a/core/src/main/java/net/okocraft/box/core/model/manager/item/BoxItemMap.java b/core/src/main/java/net/okocraft/box/core/model/manager/item/BoxItemMap.java index c80f2564c0..2dae52a82a 100644 --- a/core/src/main/java/net/okocraft/box/core/model/manager/item/BoxItemMap.java +++ b/core/src/main/java/net/okocraft/box/core/model/manager/item/BoxItemMap.java @@ -195,9 +195,9 @@ void removeItemAtUnsynchronized(@NotNull BoxItem item) { } void rebuildCache() { - this.copiedItemIdListCache = IntImmutableList.of(itemNameToId.values().toIntArray()); - this.copiedItemNameListCache = ObjectImmutableList.of(itemNameToId.keySet().toArray(String[]::new)); - this.copiedBoxItemListCache = ObjectImmutableList.of(idToBoxItem.values().toArray(BoxItem[]::new)); + this.copiedItemIdListCache = IntImmutableList.of(this.itemNameToId.values().toIntArray()); + this.copiedItemNameListCache = ObjectImmutableList.of(this.itemNameToId.keySet().toArray(String[]::new)); + this.copiedBoxItemListCache = ObjectImmutableList.of(this.idToBoxItem.values().toArray(BoxItem[]::new)); } private @Nullable BoxItem getByItemNameAtUnsynchronized(@NotNull String itemName) { @@ -205,14 +205,14 @@ void rebuildCache() { } private @NotNull IntImmutableList getItemIdListAtUnsynchronized() { - return copiedItemIdListCache; + return this.copiedItemIdListCache; } private @NotNull ObjectImmutableList getItemNameListAtUnsynchronized() { - return copiedItemNameListCache; + return this.copiedItemNameListCache; } private @NotNull ObjectImmutableList getBoxItemListAtUnsynchronized() { - return copiedBoxItemListCache; + return this.copiedBoxItemListCache; } } diff --git a/core/src/main/java/net/okocraft/box/core/model/stock/NameHolder.java b/core/src/main/java/net/okocraft/box/core/model/stock/NameHolder.java index 3ae9a22a35..40efdeaa55 100644 --- a/core/src/main/java/net/okocraft/box/core/model/stock/NameHolder.java +++ b/core/src/main/java/net/okocraft/box/core/model/stock/NameHolder.java @@ -10,14 +10,14 @@ interface NameHolder { record Value(@NotNull String name) implements NameHolder { @Override public @NotNull String get() { - return name; + return this.name; } } record FromBoxUser(@NotNull BoxUser user) implements NameHolder { @Override public @NotNull String get() { - return user.getName().orElse("Unknown"); + return this.user.getName().orElse("Unknown"); } } } diff --git a/core/src/main/java/net/okocraft/box/core/model/stock/StockHolderImpl.java b/core/src/main/java/net/okocraft/box/core/model/stock/StockHolderImpl.java index 473b9b42d7..14b12324de 100644 --- a/core/src/main/java/net/okocraft/box/core/model/stock/StockHolderImpl.java +++ b/core/src/main/java/net/okocraft/box/core/model/stock/StockHolderImpl.java @@ -79,7 +79,7 @@ public void setAmount(@NotNull BoxItem item, int amount, @NotNull StockEvent.Cau stock = this.getStockOrPutNewStock(internalId, amount); if (stock == null) { - eventCaller.callSetEvent(this, item, amount, 0, cause); + this.eventCaller.callSetEvent(this, item, amount, 0, cause); return; } } @@ -87,7 +87,7 @@ public void setAmount(@NotNull BoxItem item, int amount, @NotNull StockEvent.Cau int previousAmount = stock.set(amount); if (previousAmount != amount) { - eventCaller.callSetEvent(this, item, amount, previousAmount, cause); + this.eventCaller.callSetEvent(this, item, amount, previousAmount, cause); } } @@ -112,7 +112,7 @@ public int increase(@NotNull BoxItem item, int increment, @NotNull StockEvent.Ca stock = this.getStockOrPutNewStock(internalId, increment); if (stock == null) { - eventCaller.callIncreaseEvent(this, item, increment, increment, cause); + this.eventCaller.callIncreaseEvent(this, item, increment, increment, cause); return increment; } } @@ -120,11 +120,11 @@ public int increase(@NotNull BoxItem item, int increment, @NotNull StockEvent.Ca var result = stock.add(increment); if (result.getClass() == Stock.ModifyResult.Success.class) { - eventCaller.callIncreaseEvent(this, item, increment, result.newValue(), cause); + this.eventCaller.callIncreaseEvent(this, item, increment, result.newValue(), cause); return result.newValue(); } else { int excess = ((Stock.ModifyResult.Overflow) result).excess(); - eventCaller.callOverflowEvent(this, item, increment - excess, excess, cause); + this.eventCaller.callOverflowEvent(this, item, increment - excess, excess, cause); return Integer.MAX_VALUE; } } @@ -166,7 +166,7 @@ private int decrease(@NotNull BoxItem item, int limit, @NotNull StockEvent.Cause if (result.oldValue() != 0) { int decrement = result.oldValue() - result.newValue(); - eventCaller.callDecreaseEvent(this, item, decrement, result.newValue(), cause); + this.eventCaller.callDecreaseEvent(this, item, decrement, result.newValue(), cause); if (returnType == RETURN_NEW_AMOUNT) { return result.newValue(); @@ -204,7 +204,7 @@ public int decreaseIfPossible(@NotNull BoxItem item, int decrement, @NotNull Sto return -1; } - eventCaller.callDecreaseEvent(this, item, decrement, result.newValue(), cause); + this.eventCaller.callDecreaseEvent(this, item, decrement, result.newValue(), cause); return result.newValue(); } @@ -230,7 +230,7 @@ public boolean decreaseIfPossible(@NotNull Object2IntMap decrementMap, } for (var entry : newAmountMap.object2IntEntrySet()) { - eventCaller.callDecreaseEvent(this, entry.getKey(), decrementMap.getInt(entry.getKey()), entry.getIntValue(), cause); + this.eventCaller.callDecreaseEvent(this, entry.getKey(), decrementMap.getInt(entry.getKey()), entry.getIntValue(), cause); } return true; @@ -285,12 +285,12 @@ public boolean decreaseIfPossible(@NotNull Object2IntMap decrementMap, try { stockDataCollection = this.createStockDataAtUnsynchronized(); - stockMap.clear(); + this.stockMap.clear(); } finally { this.lock.unlockWrite(stamp); } - eventCaller.callResetEvent(this, stockDataCollection); + this.eventCaller.callResetEvent(this, stockDataCollection); return stockDataCollection; } @@ -328,7 +328,7 @@ public String toString() { long stamp = this.lock.readLock(); try { - ObjectSet> entrySet = stockMap.int2ObjectEntrySet(); + ObjectSet> entrySet = this.stockMap.int2ObjectEntrySet(); stockDataCollection = new ObjectArrayList<>(entrySet.size()); for (var entry : entrySet) { diff --git a/core/src/main/java/net/okocraft/box/core/player/BoxPlayerImpl.java b/core/src/main/java/net/okocraft/box/core/player/BoxPlayerImpl.java index aea9f808b2..1c55889512 100644 --- a/core/src/main/java/net/okocraft/box/core/player/BoxPlayerImpl.java +++ b/core/src/main/java/net/okocraft/box/core/player/BoxPlayerImpl.java @@ -33,38 +33,38 @@ public BoxPlayerImpl(@NotNull BoxUser user, @NotNull Player player, @Override public @NotNull BoxUser asUser() { - return user; + return this.user; } @Override public @NotNull Player getPlayer() { - return player; + return this.player; } @Override public @NotNull LoadingPersonalStockHolder getPersonalStockHolder() { - return personalStockHolder; + return this.personalStockHolder; } @Override public @NotNull StockHolder getCurrentStockHolder() { - return currentHolder; + return this.currentHolder; } @Override public void setCurrentStockHolder(@NotNull StockHolder stockHolder) { - var previous = currentHolder; - currentHolder = Objects.requireNonNull(stockHolder); + var previous = this.currentHolder; + this.currentHolder = Objects.requireNonNull(stockHolder); this.eventCaller.callAsync(new PlayerStockHolderChangeEvent(this, previous)); } @Override public @NotNull UUID getUUID() { - return player.getUniqueId(); + return this.player.getUniqueId(); } @Override public @NotNull String getName() { - return player.getName(); + return this.player.getName(); } } diff --git a/core/src/main/java/net/okocraft/box/core/player/BoxPlayerMapImpl.java b/core/src/main/java/net/okocraft/box/core/player/BoxPlayerMapImpl.java index 5f00ed4dcb..6bceee3315 100644 --- a/core/src/main/java/net/okocraft/box/core/player/BoxPlayerMapImpl.java +++ b/core/src/main/java/net/okocraft/box/core/player/BoxPlayerMapImpl.java @@ -46,19 +46,19 @@ public BoxPlayerMapImpl(@NotNull BoxUserManager userManager, @NotNull BoxStockMa @Override public boolean isLoaded(@NotNull Player player) { - var boxPlayer = playerMap.get(player); + var boxPlayer = this.playerMap.get(player); return boxPlayer != null && boxPlayer != NOT_LOADED_YET; } @Override public boolean isScheduledLoading(@NotNull Player player) { - return playerMap.get(player) == NOT_LOADED_YET; + return this.playerMap.get(player) == NOT_LOADED_YET; } @Override public @NotNull BoxPlayer get(@NotNull Player player) { Objects.requireNonNull(player); - var boxPlayer = playerMap.get(player); + var boxPlayer = this.playerMap.get(player); if (boxPlayer == null || boxPlayer == NOT_LOADED_YET) { throw new IllegalStateException("player is not loaded (" + player.getName() + ")"); @@ -79,7 +79,7 @@ private void load(@NotNull Player player) { try { loadBoxPlayer(player); } catch (Exception e) { - playerMap.remove(player); + this.playerMap.remove(player); BoxLogger.logger().error("Could not load a player ({})", player.getName(), e); CoreMessages.LOAD_FAILURE_ON_JOIN.source(this.messageProvider.findSource(player)).send(player); } @@ -87,7 +87,7 @@ private void load(@NotNull Player player) { private void loadBoxPlayer(@NotNull Player player) { if (!player.isOnline()) { // The player is no longer online, so remove it from the map. - playerMap.remove(player); + this.playerMap.remove(player); return; } diff --git a/features/autostore/src/main/java/net/okocraft/box/feature/autostore/command/AutoStoreCommand.java b/features/autostore/src/main/java/net/okocraft/box/feature/autostore/command/AutoStoreCommand.java index 0b004546ca..eea51cf7cb 100644 --- a/features/autostore/src/main/java/net/okocraft/box/feature/autostore/command/AutoStoreCommand.java +++ b/features/autostore/src/main/java/net/okocraft/box/feature/autostore/command/AutoStoreCommand.java @@ -113,7 +113,7 @@ public void onCommand(@NotNull CommandSender sender, @NotNull String[] args) { } private @NotNull Optional matchSubCommand(@NotNull String nameOrAlias) { - return Stream.of(allCommand, directCommand, itemCommand) + return Stream.of(this.allCommand, this.directCommand, this.itemCommand) .filter(command -> command.getName().charAt(0) == nameOrAlias.charAt(0)) .findAny(); } diff --git a/features/autostore/src/main/java/net/okocraft/box/feature/autostore/event/AutoStoreSettingChangeEvent.java b/features/autostore/src/main/java/net/okocraft/box/feature/autostore/event/AutoStoreSettingChangeEvent.java index b2e61e8d32..71749af402 100644 --- a/features/autostore/src/main/java/net/okocraft/box/feature/autostore/event/AutoStoreSettingChangeEvent.java +++ b/features/autostore/src/main/java/net/okocraft/box/feature/autostore/event/AutoStoreSettingChangeEvent.java @@ -26,13 +26,13 @@ public AutoStoreSettingChangeEvent(@NotNull AutoStoreSetting setting) { * @return the changed {@link AutoStoreSetting} */ public @NotNull AutoStoreSetting getSetting() { - return setting; + return this.setting; } @Override public String toString() { return "AutoStoreSettingChangeEvent{" + - "setting=" + setting + + "setting=" + this.setting + '}'; } } diff --git a/features/autostore/src/main/java/net/okocraft/box/feature/autostore/gui/buttons/AbstractAutoStoreSettingButton.java b/features/autostore/src/main/java/net/okocraft/box/feature/autostore/gui/buttons/AbstractAutoStoreSettingButton.java index 90e5456d45..10ebd7cc27 100644 --- a/features/autostore/src/main/java/net/okocraft/box/feature/autostore/gui/buttons/AbstractAutoStoreSettingButton.java +++ b/features/autostore/src/main/java/net/okocraft/box/feature/autostore/gui/buttons/AbstractAutoStoreSettingButton.java @@ -16,7 +16,7 @@ protected AbstractAutoStoreSettingButton(int slot) { @Override public int getSlot() { - return slot; + return this.slot; } protected void callAutoStoreSettingChangeEvent(@NotNull AutoStoreSetting setting) { diff --git a/features/autostore/src/main/java/net/okocraft/box/feature/autostore/setting/AutoStoreSetting.java b/features/autostore/src/main/java/net/okocraft/box/feature/autostore/setting/AutoStoreSetting.java index 1c14d13391..86c2bdf2f7 100644 --- a/features/autostore/src/main/java/net/okocraft/box/feature/autostore/setting/AutoStoreSetting.java +++ b/features/autostore/src/main/java/net/okocraft/box/feature/autostore/setting/AutoStoreSetting.java @@ -37,7 +37,7 @@ public AutoStoreSetting(@NotNull UUID uuid) { * @return the user's {@link UUID} */ public @NotNull UUID getUuid() { - return uuid; + return this.uuid; } /** diff --git a/features/category/src/main/java/net/okocraft/box/feature/category/internal/registry/CategoryRegistryImpl.java b/features/category/src/main/java/net/okocraft/box/feature/category/internal/registry/CategoryRegistryImpl.java index c979166546..ed3ff51ee8 100644 --- a/features/category/src/main/java/net/okocraft/box/feature/category/internal/registry/CategoryRegistryImpl.java +++ b/features/category/src/main/java/net/okocraft/box/feature/category/internal/registry/CategoryRegistryImpl.java @@ -30,9 +30,9 @@ public void register(@NotNull String name, @NotNull Category category) { throw new IllegalArgumentException("Cannot register an unknown custom item category."); } - synchronized (lock) { - registry.put(name, category); - snapshot = List.copyOf(registry.values()); + synchronized (this.lock) { + this.registry.put(name, category); + this.snapshot = List.copyOf(this.registry.values()); } } @@ -40,9 +40,9 @@ public void register(@NotNull String name, @NotNull Category category) { public void unregister(@NotNull String name) { Objects.requireNonNull(name); - synchronized (lock) { - registry.remove(name); - snapshot = List.copyOf(registry.values()); + synchronized (this.lock) { + this.registry.remove(name); + this.snapshot = List.copyOf(this.registry.values()); } } @@ -50,24 +50,24 @@ public void unregister(@NotNull String name) { public void unregister(@NotNull Category category) { Objects.requireNonNull(category); - synchronized (lock) { - registry.values().removeIf(value -> value == category); // Removes only the specified instance. - snapshot = List.copyOf(registry.values()); + synchronized (this.lock) { + this.registry.values().removeIf(value -> value == category); // Removes only the specified instance. + this.snapshot = List.copyOf(this.registry.values()); } } @Override public void unregisterAll() { - synchronized (lock) { - registry.clear(); - snapshot = Collections.emptyList(); + synchronized (this.lock) { + this.registry.clear(); + this.snapshot = Collections.emptyList(); } } @Override public @NotNull Optional getByName(@NotNull String name) { Objects.requireNonNull(name); - return Optional.ofNullable(registry.get(name)); + return Optional.ofNullable(this.registry.get(name)); } @Override @@ -75,8 +75,8 @@ public void unregisterAll() { Objects.requireNonNull(category); Map snapshot; - synchronized (lock) { - snapshot = Map.copyOf(registry); + synchronized (this.lock) { + snapshot = Map.copyOf(this.registry); } for (var entry : snapshot.entrySet()) { @@ -92,8 +92,8 @@ public void unregisterAll() { public @NotNull @Unmodifiable List names() { List names; - synchronized (lock) { - names = List.copyOf(registry.keySet()); + synchronized (this.lock) { + names = List.copyOf(this.registry.keySet()); } return names; @@ -103,8 +103,8 @@ public void unregisterAll() { public @NotNull @Unmodifiable List values() { List result; - synchronized (lock) { - result = snapshot; + synchronized (this.lock) { + result = this.snapshot; } return result; @@ -114,7 +114,7 @@ public void unregisterAll() { public @NotNull @Unmodifiable Map asMap() { Map categoryMap; - synchronized (lock) { + synchronized (this.lock) { categoryMap = new LinkedHashMap<>(this.registry); } diff --git a/features/command/src/main/java/net/okocraft/box/feature/command/CommandFeature.java b/features/command/src/main/java/net/okocraft/box/feature/command/CommandFeature.java index c94825ff29..5d5095a734 100644 --- a/features/command/src/main/java/net/okocraft/box/feature/command/CommandFeature.java +++ b/features/command/src/main/java/net/okocraft/box/feature/command/CommandFeature.java @@ -49,15 +49,15 @@ public CommandFeature(@NotNull FeatureContext.Registration context) { @Override public void enable(@NotNull FeatureContext.Enabling context) { var api = BoxAPI.api(); - boxSubCommands.forEach(api.getBoxCommand().getSubCommandHolder()::register); - boxAdminSubCommands.forEach(api.getBoxAdminCommand().getSubCommandHolder()::register); + this.boxSubCommands.forEach(api.getBoxCommand().getSubCommandHolder()::register); + this.boxAdminSubCommands.forEach(api.getBoxAdminCommand().getSubCommandHolder()::register); } @Override public void disable(@NotNull FeatureContext.Disabling context) { var api = BoxAPI.api(); - boxSubCommands.forEach(api.getBoxCommand().getSubCommandHolder()::unregister); - boxAdminSubCommands.forEach(api.getBoxAdminCommand().getSubCommandHolder()::unregister); + this.boxSubCommands.forEach(api.getBoxCommand().getSubCommandHolder()::unregister); + this.boxAdminSubCommands.forEach(api.getBoxAdminCommand().getSubCommandHolder()::unregister); } @SafeVarargs diff --git a/features/command/src/main/java/net/okocraft/box/feature/command/boxadmin/InfinityCommand.java b/features/command/src/main/java/net/okocraft/box/feature/command/boxadmin/InfinityCommand.java index 614c968f34..f5b01e383f 100644 --- a/features/command/src/main/java/net/okocraft/box/feature/command/boxadmin/InfinityCommand.java +++ b/features/command/src/main/java/net/okocraft/box/feature/command/boxadmin/InfinityCommand.java @@ -132,7 +132,7 @@ private static class InfinityStockHolder implements StockHolder { @Override public @NotNull UUID getUUID() { - return uuid; + return this.uuid; } @Override diff --git a/features/command/src/main/java/net/okocraft/box/feature/command/boxadmin/ResetAllCommand.java b/features/command/src/main/java/net/okocraft/box/feature/command/boxadmin/ResetAllCommand.java index 661a843dc5..b374705764 100644 --- a/features/command/src/main/java/net/okocraft/box/feature/command/boxadmin/ResetAllCommand.java +++ b/features/command/src/main/java/net/okocraft/box/feature/command/boxadmin/ResetAllCommand.java @@ -63,8 +63,8 @@ public void onCommand(@NotNull CommandSender sender, @NotNull String[] args) { return; } - if (CONFIRM.equalsIgnoreCase(args[1]) && confirmationMap.containsKey(sender)) { - var target = confirmationMap.remove(sender); + if (CONFIRM.equalsIgnoreCase(args[1]) && this.confirmationMap.containsKey(sender)) { + var target = this.confirmationMap.remove(sender); BoxAPI.api().getStockManager().getPersonalStockHolder(target).reset(); @@ -83,7 +83,7 @@ public void onCommand(@NotNull CommandSender sender, @NotNull String[] args) { return; } - if (CANCEL.equalsIgnoreCase(args[1]) && confirmationMap.remove(sender) != null) { + if (CANCEL.equalsIgnoreCase(args[1]) && this.confirmationMap.remove(sender) != null) { this.cancel.source(msgSrc).send(sender); return; } @@ -91,7 +91,7 @@ public void onCommand(@NotNull CommandSender sender, @NotNull String[] args) { var target = UserSearcher.search(args[1]); if (target != null) { - confirmationMap.put(sender, target); + this.confirmationMap.put(sender, target); this.confirmation.apply(target.getName().orElseGet(target.getUUID()::toString)).source(msgSrc).send(sender); } else { ErrorMessages.PLAYER_NOT_FOUND.apply(args[1]).source(msgSrc).send(sender); @@ -104,7 +104,7 @@ public void onCommand(@NotNull CommandSender sender, @NotNull String[] args) { return Collections.emptyList(); } - if (confirmationMap.containsKey(sender)) { + if (this.confirmationMap.containsKey(sender)) { var secondArgument = args[1].toLowerCase(Locale.ROOT); if (secondArgument.isEmpty() || diff --git a/features/command/src/main/java/net/okocraft/box/feature/command/boxadmin/stock/StockCommand.java b/features/command/src/main/java/net/okocraft/box/feature/command/boxadmin/stock/StockCommand.java index 7a681603e7..1e6c2a1cb5 100644 --- a/features/command/src/main/java/net/okocraft/box/feature/command/boxadmin/stock/StockCommand.java +++ b/features/command/src/main/java/net/okocraft/box/feature/command/boxadmin/stock/StockCommand.java @@ -44,7 +44,7 @@ public void onCommand(@NotNull CommandSender sender, @NotNull String[] args) { return; } - var optionalSubCommand = subCommandHolder.search(args[1]); + var optionalSubCommand = this.subCommandHolder.search(args[1]); if (optionalSubCommand.isEmpty()) { if (!args[1].equalsIgnoreCase("help")) { @@ -66,13 +66,13 @@ public void onCommand(@NotNull CommandSender sender, @NotNull String[] args) { @Override public @NotNull List onTabComplete(@NotNull CommandSender sender, @NotNull String[] args) { if (args.length == 2) { - return subCommandHolder.getSubCommands().stream() + return this.subCommandHolder.getSubCommands().stream() .filter(cmd -> sender.hasPermission(cmd.getPermissionNode())) .map(Command::getName) .filter(cmdName -> cmdName.startsWith(args[1].toLowerCase(Locale.ROOT))) .toList(); } else { - return subCommandHolder.search(args[1]) + return this.subCommandHolder.search(args[1]) .filter(cmd -> sender.hasPermission(cmd.getPermissionNode())) .map(cmd -> cmd.onTabComplete(sender, args)) .orElse(Collections.emptyList()); @@ -92,6 +92,6 @@ public void onCommand(@NotNull CommandSender sender, @NotNull String[] args) { @Override public @NotNull SubCommandHolder getSubCommandHolder() { - return subCommandHolder; + return this.subCommandHolder; } } diff --git a/features/command/src/main/java/net/okocraft/box/feature/command/shared/SharedStockListCommand.java b/features/command/src/main/java/net/okocraft/box/feature/command/shared/SharedStockListCommand.java index 894eedd530..980af34252 100644 --- a/features/command/src/main/java/net/okocraft/box/feature/command/shared/SharedStockListCommand.java +++ b/features/command/src/main/java/net/okocraft/box/feature/command/shared/SharedStockListCommand.java @@ -236,19 +236,19 @@ private enum ArgumentType { } private @NotNull String getLongArg() { - return longArg; + return this.longArg; } private @NotNull String getShortArg() { - return shortArg; + return this.shortArg; } private @NotNull BiConsumer getContextConsumer() { - return contextConsumer; + return this.contextConsumer; } private @NotNull Function> getTabCompleter() { - return tabCompleter; + return this.tabCompleter; } } @@ -280,7 +280,7 @@ private ByName(boolean reserved) { @Override public int compare(BoxItem item, BoxItem other) { - return comparator.compare(item.getPlainName(), other.getPlainName()); + return this.comparator.compare(item.getPlainName(), other.getPlainName()); } } @@ -295,7 +295,7 @@ private ByAmount(boolean reserved) { @Override public int compare(int k1, int k2) { - return comparator.compare(k1, k2); + return this.comparator.compare(k1, k2); } } } diff --git a/features/craft/src/main/java/net/okocraft/box/feature/craft/CraftFeature.java b/features/craft/src/main/java/net/okocraft/box/feature/craft/CraftFeature.java index 1eb7dd9625..666d2a2246 100644 --- a/features/craft/src/main/java/net/okocraft/box/feature/craft/CraftFeature.java +++ b/features/craft/src/main/java/net/okocraft/box/feature/craft/CraftFeature.java @@ -49,15 +49,15 @@ public void enable(@NotNull FeatureContext.Enabling context) throws IOException BoxLogger.logger().info("{} recipes are imported!", recipeMap.size()); - ClickModeRegistry.register(craftMode); + ClickModeRegistry.register(this.craftMode); - BoxAPI.api().getBoxCommand().getSubCommandHolder().register(craftCommand); + BoxAPI.api().getBoxCommand().getSubCommandHolder().register(this.craftCommand); } @Override public void disable(@NotNull FeatureContext.Disabling context) { - ClickModeRegistry.unregister(craftMode); - BoxAPI.api().getBoxCommand().getSubCommandHolder().unregister(craftCommand); + ClickModeRegistry.unregister(this.craftMode); + BoxAPI.api().getBoxCommand().getSubCommandHolder().unregister(this.craftCommand); } @Override diff --git a/features/craft/src/main/java/net/okocraft/box/feature/craft/event/BoxCraftEvent.java b/features/craft/src/main/java/net/okocraft/box/feature/craft/event/BoxCraftEvent.java index 26b27c89ee..def372f1ca 100644 --- a/features/craft/src/main/java/net/okocraft/box/feature/craft/event/BoxCraftEvent.java +++ b/features/craft/src/main/java/net/okocraft/box/feature/craft/event/BoxCraftEvent.java @@ -37,7 +37,7 @@ public BoxCraftEvent(@NotNull Player crafter, @NotNull SelectedRecipe selectedRe * @return the player who is trying to craft */ public @NotNull Player getCrafter() { - return crafter; + return this.crafter; } /** @@ -46,7 +46,7 @@ public BoxCraftEvent(@NotNull Player crafter, @NotNull SelectedRecipe selectedRe * @return the recipe to craft */ public @NotNull SelectedRecipe getSelectedRecipe() { - return selectedRecipe; + return this.selectedRecipe; } /** @@ -55,12 +55,12 @@ public BoxCraftEvent(@NotNull Player crafter, @NotNull SelectedRecipe selectedRe * @return the number of times to craft */ public int getTimes() { - return times; + return this.times; } @Override public boolean isCancelled() { - return cancelled; + return this.cancelled; } @Override @@ -71,20 +71,20 @@ public void setCancelled(boolean cancel) { @Override public String toString() { return "BoxCraftEvent{" + - "crafter=" + crafter + - ", selectedRecipe=" + selectedRecipe + - ", times=" + times + - ", cancelled=" + cancelled + + "crafter=" + this.crafter + + ", selectedRecipe=" + this.selectedRecipe + + ", times=" + this.times + + ", cancelled=" + this.cancelled + '}'; } @Override public @NotNull String toDebugLog() { return "BoxCraftEvent{" + - "crafterUuid=" + crafter.getUniqueId() + - ", crafterName=" + crafter.getName() + - ", selectedRecipe=" + selectedRecipe + - ", times=" + times + + "crafterUuid=" + this.crafter.getUniqueId() + + ", crafterName=" + this.crafter.getName() + + ", selectedRecipe=" + this.selectedRecipe + + ", times=" + this.times + '}'; } } diff --git a/features/craft/src/main/java/net/okocraft/box/feature/craft/event/RecipeImportEvent.java b/features/craft/src/main/java/net/okocraft/box/feature/craft/event/RecipeImportEvent.java index db21c9b686..5a5cc54202 100644 --- a/features/craft/src/main/java/net/okocraft/box/feature/craft/event/RecipeImportEvent.java +++ b/features/craft/src/main/java/net/okocraft/box/feature/craft/event/RecipeImportEvent.java @@ -28,13 +28,13 @@ public RecipeImportEvent(@NotNull BoxItemRecipe recipe) { * @return the imported {@link BoxItemRecipe} */ public @NotNull BoxItemRecipe getRecipe() { - return recipe; + return this.recipe; } @Override public String toString() { return "RecipeImportEvent{" + - "recipe=" + recipe + + "recipe=" + this.recipe + '}'; } } diff --git a/features/craft/src/main/java/net/okocraft/box/feature/craft/gui/CurrentRecipe.java b/features/craft/src/main/java/net/okocraft/box/feature/craft/gui/CurrentRecipe.java index bb303dd517..963a5785a7 100644 --- a/features/craft/src/main/java/net/okocraft/box/feature/craft/gui/CurrentRecipe.java +++ b/features/craft/src/main/java/net/okocraft/box/feature/craft/gui/CurrentRecipe.java @@ -30,15 +30,15 @@ public CurrentRecipe(@NotNull BoxItemRecipe source) { } public @NotNull BoxItem getResult() { - return source.result(); + return this.source.result(); } public @NotNull ItemStack getResultPreview() { - return source.result().getOriginal().asQuantity(source.amount()); + return this.source.result().getOriginal().asQuantity(this.source.amount()); } public void nextRecipe(int pos, boolean sameIngredient) { - var recipe = ingredientsMap.get(pos); + var recipe = this.ingredientsMap.get(pos); if (recipe == null) { return; @@ -47,7 +47,7 @@ public void nextRecipe(int pos, boolean sameIngredient) { var selected = recipe.next(); if (sameIngredient) { - for (var other : ingredientsMap.values()) { + for (var other : this.ingredientsMap.values()) { if (recipe != other && recipe.isSameIngredient(other)) { other.select(selected); } @@ -58,20 +58,20 @@ public void nextRecipe(int pos, boolean sameIngredient) { } public @Nullable SelectableIngredients getIngredients(int pos) { - return ingredientsMap.get(pos); + return this.ingredientsMap.get(pos); } public void updateSelectedRecipe() { this.selectedRecipe = new SelectedRecipe( - ingredientsMap.values().stream().map(SelectableIngredients::getSelected).toList(), - source.result(), - source.amount() + this.ingredientsMap.values().stream().map(SelectableIngredients::getSelected).toList(), + this.source.result(), + this.source.amount() ); } public @NotNull SelectedRecipe getSelectedRecipe() { - return selectedRecipe; + return this.selectedRecipe; } public void selectFirstIngredients() { diff --git a/features/craft/src/main/java/net/okocraft/box/feature/craft/gui/button/CraftButton.java b/features/craft/src/main/java/net/okocraft/box/feature/craft/gui/button/CraftButton.java index 7e544b3315..adf383e077 100644 --- a/features/craft/src/main/java/net/okocraft/box/feature/craft/gui/button/CraftButton.java +++ b/features/craft/src/main/java/net/okocraft/box/feature/craft/gui/button/CraftButton.java @@ -52,7 +52,7 @@ public CraftButton(int slot, @NotNull TypedKey timesKey) { @Override public int getSlot() { - return slot; + return this.slot; } @Override diff --git a/features/craft/src/main/java/net/okocraft/box/feature/craft/gui/button/IngredientButton.java b/features/craft/src/main/java/net/okocraft/box/feature/craft/gui/button/IngredientButton.java index ec22ad90d3..fc8015c4cc 100644 --- a/features/craft/src/main/java/net/okocraft/box/feature/craft/gui/button/IngredientButton.java +++ b/features/craft/src/main/java/net/okocraft/box/feature/craft/gui/button/IngredientButton.java @@ -26,13 +26,13 @@ public record IngredientButton(int slot, int ingredientPos) implements Button { @Override public int getSlot() { - return slot; + return this.slot; } @Override public @NotNull ItemStack createIcon(@NotNull PlayerSession session) { var currentRecipe = session.getDataOrThrow(CurrentRecipe.DATA_KEY); - var ingredients = currentRecipe.getIngredients(ingredientPos); + var ingredients = currentRecipe.getIngredients(this.ingredientPos); if (ingredients == null) { return new ItemStack(Material.AIR); @@ -68,7 +68,7 @@ public int getSlot() { var currentRecipe = session.getDataOrThrow(CurrentRecipe.DATA_KEY); if (clickType.isShiftClick()) { - var ingredients = currentRecipe.getIngredients(ingredientPos); + var ingredients = currentRecipe.getIngredients(this.ingredientPos); if (ingredients == null) { return ClickResult.NO_UPDATE_NEEDED; @@ -91,7 +91,7 @@ public int getSlot() { return ClickResult.changeMenu(menu); } else { - currentRecipe.nextRecipe(ingredientPos, session.getData(CHANGE_PER_INGREDIENT) == null); + currentRecipe.nextRecipe(this.ingredientPos, session.getData(CHANGE_PER_INGREDIENT) == null); return ClickResult.UPDATE_ICONS; } } diff --git a/features/craft/src/main/java/net/okocraft/box/feature/craft/gui/button/IngredientChangeModeButton.java b/features/craft/src/main/java/net/okocraft/box/feature/craft/gui/button/IngredientChangeModeButton.java index f476f8c063..17abe289e7 100644 --- a/features/craft/src/main/java/net/okocraft/box/feature/craft/gui/button/IngredientChangeModeButton.java +++ b/features/craft/src/main/java/net/okocraft/box/feature/craft/gui/button/IngredientChangeModeButton.java @@ -25,7 +25,7 @@ public IngredientChangeModeButton(int slot) { @Override public int getSlot() { - return slot; + return this.slot; } @Override diff --git a/features/craft/src/main/java/net/okocraft/box/feature/craft/gui/button/RecipeSelectButton.java b/features/craft/src/main/java/net/okocraft/box/feature/craft/gui/button/RecipeSelectButton.java index 2133117064..2f3cc3ab5e 100644 --- a/features/craft/src/main/java/net/okocraft/box/feature/craft/gui/button/RecipeSelectButton.java +++ b/features/craft/src/main/java/net/okocraft/box/feature/craft/gui/button/RecipeSelectButton.java @@ -41,13 +41,13 @@ public RecipeSelectButton(int slot, @NotNull BoxItemRecipe recipe, int number) { @Override public int getSlot() { - return slot; + return this.slot; } @Override public @NotNull ItemStack createIcon(@NotNull PlayerSession session) { var editor = ItemEditor.create() - .displayName(translatable(this.recipe.result().getOriginal()).decoration(ITALIC, State.FALSE).append(space()).append(text("#" + number, NO_DECORATION_YELLOW))) + .displayName(translatable(this.recipe.result().getOriginal()).decoration(ITALIC, State.FALSE).append(space()).append(text("#" + this.number, NO_DECORATION_YELLOW))) .loreEmptyLine(); boolean simple = session.getData(SHOW_DETAILS) == null; @@ -56,10 +56,10 @@ public int getSlot() { return editor.loreEmptyLine() .loreLine( text(" -> ", NO_DECORATION_GRAY) - .append(translatable(recipe.result().getOriginal(), recipe.result().getDisplayName().style())) + .append(translatable(this.recipe.result().getOriginal(), this.recipe.result().getDisplayName().style())) .append(space()) .append(text("x", NO_DECORATION_GRAY)) - .append(text(recipe.amount(), NO_DECORATION_AQUA)) + .append(text(this.recipe.amount(), NO_DECORATION_AQUA)) ) .loreEmptyLineIf(simple) .loreLineIf(simple, () -> CLICK_TO_SHOW_DETAILS.create(session.getMessageSource())) @@ -75,7 +75,7 @@ public int getSlot() { return ClickResult.UPDATE_ICONS; } else { - var menu = CraftMenu.prepare(recipe); + var menu = CraftMenu.prepare(this.recipe); return ClickResult.changeMenu(menu); } } diff --git a/features/craft/src/main/java/net/okocraft/box/feature/craft/gui/button/ResultButton.java b/features/craft/src/main/java/net/okocraft/box/feature/craft/gui/button/ResultButton.java index 5ff1c07838..6662882a62 100644 --- a/features/craft/src/main/java/net/okocraft/box/feature/craft/gui/button/ResultButton.java +++ b/features/craft/src/main/java/net/okocraft/box/feature/craft/gui/button/ResultButton.java @@ -12,7 +12,7 @@ public record ResultButton(int slot) implements Button { @Override public int getSlot() { - return slot; + return this.slot; } @Override diff --git a/features/craft/src/main/java/net/okocraft/box/feature/craft/gui/button/ToggleDestinationButton.java b/features/craft/src/main/java/net/okocraft/box/feature/craft/gui/button/ToggleDestinationButton.java index 7061b280bf..1617e76ff9 100644 --- a/features/craft/src/main/java/net/okocraft/box/feature/craft/gui/button/ToggleDestinationButton.java +++ b/features/craft/src/main/java/net/okocraft/box/feature/craft/gui/button/ToggleDestinationButton.java @@ -31,7 +31,7 @@ public ToggleDestinationButton(int slot) { @Override public int getSlot() { - return slot; + return this.slot; } @Override diff --git a/features/craft/src/main/java/net/okocraft/box/feature/craft/gui/menu/RecipeSelectorMenu.java b/features/craft/src/main/java/net/okocraft/box/feature/craft/gui/menu/RecipeSelectorMenu.java index fed4298c01..032885853d 100644 --- a/features/craft/src/main/java/net/okocraft/box/feature/craft/gui/menu/RecipeSelectorMenu.java +++ b/features/craft/src/main/java/net/okocraft/box/feature/craft/gui/menu/RecipeSelectorMenu.java @@ -38,7 +38,7 @@ public RecipeSelectorMenu(@NotNull BoxItem item, @NotNull RecipeHolder recipeHol @Override protected @NotNull Button createButton(@NotNull BoxItemRecipe instance, int slot) { - return new RecipeSelectButton(slot, instance, recipeHolder.getRecipeList().indexOf(instance) + 1); + return new RecipeSelectButton(slot, instance, this.recipeHolder.getRecipeList().indexOf(instance) + 1); } @Override diff --git a/features/craft/src/main/java/net/okocraft/box/feature/craft/loader/Processor.java b/features/craft/src/main/java/net/okocraft/box/feature/craft/loader/Processor.java index 89ae638759..c6e97191f6 100644 --- a/features/craft/src/main/java/net/okocraft/box/feature/craft/loader/Processor.java +++ b/features/craft/src/main/java/net/okocraft/box/feature/craft/loader/Processor.java @@ -46,7 +46,7 @@ void processRecipe(@NotNull Recipe recipe) { return; } - var result = itemManager.getBoxItem(recipe.getResult()); + var result = this.itemManager.getBoxItem(recipe.getResult()); if (result.isEmpty()) { return; @@ -115,7 +115,7 @@ void processCustomRecipes() { } @NotNull Map result() { - return recipeMap; + return this.recipeMap; } private void processShapedRecipe(@NotNull ShapedRecipe recipe, @NotNull BoxItem result) { @@ -205,7 +205,7 @@ private int getPosition(char c, String @NotNull [] shape) { private void addRecipe(@NotNull List ingredients, @NotNull BoxItem result, int amount) { var recipe = new BoxItemRecipe(ingredients, result, amount); - recipeMap.computeIfAbsent(result, i -> new RecipeHolder()).addRecipe(recipe); + this.recipeMap.computeIfAbsent(result, i -> new RecipeHolder()).addRecipe(recipe); BoxAPI.api().getEventManager().call(new RecipeImportEvent(recipe)); } } diff --git a/features/craft/src/main/java/net/okocraft/box/feature/craft/model/RecipeHolder.java b/features/craft/src/main/java/net/okocraft/box/feature/craft/model/RecipeHolder.java index 0954eb9907..32c73a3620 100644 --- a/features/craft/src/main/java/net/okocraft/box/feature/craft/model/RecipeHolder.java +++ b/features/craft/src/main/java/net/okocraft/box/feature/craft/model/RecipeHolder.java @@ -18,7 +18,7 @@ public class RecipeHolder { * @param recipe the {@link BoxItemRecipe} to add */ public void addRecipe(@NotNull BoxItemRecipe recipe) { - recipeList.add(recipe); + this.recipeList.add(recipe); } /** @@ -27,6 +27,6 @@ public void addRecipe(@NotNull BoxItemRecipe recipe) { * @return the {@link BoxItemRecipe} list */ public @NotNull List getRecipeList() { - return recipeList; + return this.recipeList; } } diff --git a/features/gui/src/main/java/net/okocraft/box/feature/gui/GuiFeature.java b/features/gui/src/main/java/net/okocraft/box/feature/gui/GuiFeature.java index 668ddaa6d4..17340a38de 100644 --- a/features/gui/src/main/java/net/okocraft/box/feature/gui/GuiFeature.java +++ b/features/gui/src/main/java/net/okocraft/box/feature/gui/GuiFeature.java @@ -35,8 +35,8 @@ public void enable(@NotNull FeatureContext.Enabling context) { var boxCommand = BoxAPI.api().getBoxCommand(); - boxCommand.changeNoArgumentCommand(command); - boxCommand.getSubCommandHolder().register(command); + boxCommand.changeNoArgumentCommand(this.command); + boxCommand.getSubCommandHolder().register(this.command); Bukkit.getPluginManager().registerEvents(this.listener, context.plugin()); } @@ -46,10 +46,10 @@ public void disable(@NotNull FeatureContext.Disabling context) { var boxCommand = BoxAPI.api().getBoxCommand(); boxCommand.changeNoArgumentCommand(null); - boxCommand.getSubCommandHolder().unregister(command); + boxCommand.getSubCommandHolder().unregister(this.command); this.closeMenus(); - HandlerList.unregisterAll(listener); + HandlerList.unregisterAll(this.listener); } @Override diff --git a/features/gui/src/main/java/net/okocraft/box/feature/gui/api/button/EmptyButton.java b/features/gui/src/main/java/net/okocraft/box/feature/gui/api/button/EmptyButton.java index dfcdf2a665..96971e29fc 100644 --- a/features/gui/src/main/java/net/okocraft/box/feature/gui/api/button/EmptyButton.java +++ b/features/gui/src/main/java/net/okocraft/box/feature/gui/api/button/EmptyButton.java @@ -12,7 +12,7 @@ record EmptyButton(Material material, int slot) implements Button { @Override public int getSlot() { - return slot; + return this.slot; } @Override diff --git a/features/gui/src/main/java/net/okocraft/box/feature/gui/api/button/SimpleClickResult.java b/features/gui/src/main/java/net/okocraft/box/feature/gui/api/button/SimpleClickResult.java index ec69e343cc..d56377b4ff 100644 --- a/features/gui/src/main/java/net/okocraft/box/feature/gui/api/button/SimpleClickResult.java +++ b/features/gui/src/main/java/net/okocraft/box/feature/gui/api/button/SimpleClickResult.java @@ -13,7 +13,7 @@ final class SimpleClickResult implements ClickResult { @Override public String toString() { return "SimpleClickResult{" + - "name='" + name + '\'' + + "name='" + this.name + '\'' + '}'; } } diff --git a/features/gui/src/main/java/net/okocraft/box/feature/gui/api/buttons/BackOrCloseButton.java b/features/gui/src/main/java/net/okocraft/box/feature/gui/api/buttons/BackOrCloseButton.java index c07c24ad4f..73cc2fcb67 100644 --- a/features/gui/src/main/java/net/okocraft/box/feature/gui/api/buttons/BackOrCloseButton.java +++ b/features/gui/src/main/java/net/okocraft/box/feature/gui/api/buttons/BackOrCloseButton.java @@ -19,7 +19,7 @@ public record BackOrCloseButton(int slot) implements Button { @Override public int getSlot() { - return slot; + return this.slot; } @Override diff --git a/features/gui/src/main/java/net/okocraft/box/feature/gui/api/buttons/CloseButton.java b/features/gui/src/main/java/net/okocraft/box/feature/gui/api/buttons/CloseButton.java index a01177ddaa..c284bae790 100644 --- a/features/gui/src/main/java/net/okocraft/box/feature/gui/api/buttons/CloseButton.java +++ b/features/gui/src/main/java/net/okocraft/box/feature/gui/api/buttons/CloseButton.java @@ -21,7 +21,7 @@ public record CloseButton(int slot) implements Button { @Override public int getSlot() { - return slot; + return this.slot; } @Override diff --git a/features/gui/src/main/java/net/okocraft/box/feature/gui/api/buttons/amount/AmountModificationButton.java b/features/gui/src/main/java/net/okocraft/box/feature/gui/api/buttons/amount/AmountModificationButton.java index bd400f248c..14e35b36f5 100644 --- a/features/gui/src/main/java/net/okocraft/box/feature/gui/api/buttons/amount/AmountModificationButton.java +++ b/features/gui/src/main/java/net/okocraft/box/feature/gui/api/buttons/amount/AmountModificationButton.java @@ -18,7 +18,7 @@ protected AmountModificationButton(int slot, @NotNull TypedKey dataKey) @Override public final int getSlot() { - return slot; + return this.slot; } protected final @NotNull Amount getOrCreateAmount(@NotNull PlayerSession session) { diff --git a/features/gui/src/main/java/net/okocraft/box/feature/gui/api/buttons/amount/IncreaseAmountButton.java b/features/gui/src/main/java/net/okocraft/box/feature/gui/api/buttons/amount/IncreaseAmountButton.java index 9e2b8b94d0..c77a7d6490 100644 --- a/features/gui/src/main/java/net/okocraft/box/feature/gui/api/buttons/amount/IncreaseAmountButton.java +++ b/features/gui/src/main/java/net/okocraft/box/feature/gui/api/buttons/amount/IncreaseAmountButton.java @@ -54,7 +54,7 @@ public IncreaseAmountButton(int slot, @NotNull TypedKey dataKey, } private @NotNull Arg1 getClickToLore(int unit, int amount) { - return unit != 1 && amount == 1 ? clickToSetLore : clickToIncreaseLore; + return unit != 1 && amount == 1 ? this.clickToSetLore : this.clickToIncreaseLore; } @Override diff --git a/features/gui/src/main/java/net/okocraft/box/feature/gui/api/event/MenuClickEvent.java b/features/gui/src/main/java/net/okocraft/box/feature/gui/api/event/MenuClickEvent.java index 4fe0504fb4..bad1b4d389 100644 --- a/features/gui/src/main/java/net/okocraft/box/feature/gui/api/event/MenuClickEvent.java +++ b/features/gui/src/main/java/net/okocraft/box/feature/gui/api/event/MenuClickEvent.java @@ -24,7 +24,7 @@ public MenuClickEvent(@NotNull Menu menu, @NotNull PlayerSession session, @Override public boolean isCancelled() { - return cancelled; + return this.cancelled; } @Override @@ -33,11 +33,11 @@ public void setCancelled(boolean cancel) { } public @NotNull Button getClickedButton() { - return clickedButton; + return this.clickedButton; } public @NotNull ClickType getClickType() { - return clickType; + return this.clickType; } @Override diff --git a/features/gui/src/main/java/net/okocraft/box/feature/gui/api/event/MenuEvent.java b/features/gui/src/main/java/net/okocraft/box/feature/gui/api/event/MenuEvent.java index e6ad6a5b96..a3d015f065 100644 --- a/features/gui/src/main/java/net/okocraft/box/feature/gui/api/event/MenuEvent.java +++ b/features/gui/src/main/java/net/okocraft/box/feature/gui/api/event/MenuEvent.java @@ -19,14 +19,14 @@ public MenuEvent(@NotNull Menu menu, @NotNull PlayerSession session) { } public @NotNull Menu getMenu() { - return menu; + return this.menu; } public @NotNull PlayerSession getSession() { - return session; + return this.session; } public @NotNull Player getViewer() { - return session.getViewer(); + return this.session.getViewer(); } } diff --git a/features/gui/src/main/java/net/okocraft/box/feature/gui/api/event/MenuOpenEvent.java b/features/gui/src/main/java/net/okocraft/box/feature/gui/api/event/MenuOpenEvent.java index 962b85c38e..50411ce3d2 100644 --- a/features/gui/src/main/java/net/okocraft/box/feature/gui/api/event/MenuOpenEvent.java +++ b/features/gui/src/main/java/net/okocraft/box/feature/gui/api/event/MenuOpenEvent.java @@ -15,7 +15,7 @@ public MenuOpenEvent(@NotNull Menu menu, @NotNull PlayerSession session) { @Override public boolean isCancelled() { - return cancelled; + return this.cancelled; } @Override diff --git a/features/gui/src/main/java/net/okocraft/box/feature/gui/api/event/mode/ClickModeCheckEvent.java b/features/gui/src/main/java/net/okocraft/box/feature/gui/api/event/mode/ClickModeCheckEvent.java index d0361196d3..4ded382f3c 100644 --- a/features/gui/src/main/java/net/okocraft/box/feature/gui/api/event/mode/ClickModeCheckEvent.java +++ b/features/gui/src/main/java/net/okocraft/box/feature/gui/api/event/mode/ClickModeCheckEvent.java @@ -20,15 +20,15 @@ public ClickModeCheckEvent(@NotNull PlayerSession session, @NotNull BoxItemClick } public @NotNull PlayerSession getSession() { - return session; + return this.session; } public @NotNull BoxItemClickMode getMode() { - return mode; + return this.mode; } public boolean getOriginalResult() { - return originalResult; + return this.originalResult; } public boolean isAllowed() { diff --git a/features/gui/src/main/java/net/okocraft/box/feature/gui/api/menu/paginate/AbstractPaginatedMenu.java b/features/gui/src/main/java/net/okocraft/box/feature/gui/api/menu/paginate/AbstractPaginatedMenu.java index 9c31fd094c..5a8bb12426 100644 --- a/features/gui/src/main/java/net/okocraft/box/feature/gui/api/menu/paginate/AbstractPaginatedMenu.java +++ b/features/gui/src/main/java/net/okocraft/box/feature/gui/api/menu/paginate/AbstractPaginatedMenu.java @@ -33,22 +33,22 @@ protected AbstractPaginatedMenu(int rows, @NotNull List list, @NotNull TypedK this.list = list; this.currentPageKey = currentPageKey; this.iconsPerPage = (getRows() - 1) * 9; - this.maxPage = (list.size() + iconsPerPage - 1) / iconsPerPage; + this.maxPage = (list.size() + this.iconsPerPage - 1) / this.iconsPerPage; } @Override public final int getRows() { - return rows; + return this.rows; } @Override public final int getMaxPage() { - return maxPage; + return this.maxPage; } @Override public final int getIconsPerPage() { - return iconsPerPage; + return this.iconsPerPage; } @Override @@ -67,11 +67,11 @@ public void setCurrentPage(@NotNull PlayerSession session, int page) { var buttons = new ArrayList