Skip to content

Commit

Permalink
style(*): add this qualifier for methods
Browse files Browse the repository at this point in the history
  • Loading branch information
Siroshun09 committed May 27, 2024
1 parent 6ac81cb commit a92c695
Show file tree
Hide file tree
Showing 54 changed files with 195 additions and 195 deletions.
2 changes: 1 addition & 1 deletion api/src/main/java/net/okocraft/box/api/event/BoxEvent.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public BoxEvent() {
* @return the debug log
*/
public @NotNull String toDebugLog() {
return toString();
return this.toString();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ public PlayerStockHolderChangeEvent(@NotNull BoxPlayer boxPlayer,
@Override
public @NotNull String toDebugLog() {
return "PlayerStockHolderChangeEvent{" +
"uuid=" + getBoxPlayer().getUUID() +
", name=" + getBoxPlayer().getName() +
"uuid=" + this.getBoxPlayer().getUUID() +
", name=" + this.getBoxPlayer().getName() +
", previousStockholderUuid=" + this.previous.getUUID() +
", previousStockHolderName=" + this.previous.getName() +
", previousStockHolderClass=" + this.previous.getClass().getSimpleName() +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public interface StockHolder {
* @throws NullPointerException if {@code item} is {@code null}
*/
default int getAmount(@NotNull BoxItem item) {
return getAmount(item.getInternalId());
return this.getAmount(item.getInternalId());
}

/**
Expand Down Expand Up @@ -152,7 +152,7 @@ default boolean decreaseIfPossible(@NotNull Map<BoxItem, Integer> decrementMap,
map.put(entry.getKey(), entry.getValue().intValue());
}

return decreaseIfPossible(map, cause);
return this.decreaseIfPossible(map, cause);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,61 +25,61 @@ public interface StockHolderWrapper extends StockHolder {

@Override
default @NotNull String getName() {
return delegate().getName();
return this.delegate().getName();
}

@Override
default @NotNull UUID getUUID() {
return delegate().getUUID();
return this.delegate().getUUID();
}

@Override
default int getAmount(int itemId) {
return delegate().getAmount(itemId);
return this.delegate().getAmount(itemId);
}

@Override
default void setAmount(@NotNull BoxItem item, @Range(from = 0, to = Integer.MAX_VALUE) int amount, StockEvent.@NotNull Cause cause) {
delegate().setAmount(item, amount, cause);
this.delegate().setAmount(item, amount, cause);
}

@Override
default int increase(@NotNull BoxItem item, @Range(from = 0, to = Integer.MAX_VALUE) int increment, StockEvent.@NotNull Cause cause) {
return delegate().increase(item, increment, cause);
return this.delegate().increase(item, increment, cause);
}

@Override
default int decrease(@NotNull BoxItem item, @Range(from = 0, to = Integer.MAX_VALUE) int decrement, StockEvent.@NotNull Cause cause) {
return delegate().decrease(item, decrement, cause);
return this.delegate().decrease(item, decrement, cause);
}

@Override
default int decreaseToZero(@NotNull BoxItem item, @Range(from = 0, to = Integer.MAX_VALUE) int limit, StockEvent.@NotNull Cause cause) {
return delegate().decreaseToZero(item, limit, cause);
return this.delegate().decreaseToZero(item, limit, cause);
}

@Override
default int decreaseIfPossible(@NotNull BoxItem item, @Range(from = 0, to = Integer.MAX_VALUE) int decrement, StockEvent.@NotNull Cause cause) {
return delegate().decreaseIfPossible(item, decrement, cause);
return this.delegate().decreaseIfPossible(item, decrement, cause);
}

@Override
default boolean decreaseIfPossible(@NotNull Object2IntMap<BoxItem> decrementMap, StockEvent.@NotNull Cause cause) {
return delegate().decreaseIfPossible(decrementMap, cause);
return this.delegate().decreaseIfPossible(decrementMap, cause);
}

@Override
default @NotNull @Unmodifiable Collection<BoxItem> getStockedItems() {
return delegate().getStockedItems();
return this.delegate().getStockedItems();
}

@Override
default @NotNull @Unmodifiable Collection<StockData> toStockDataCollection() {
return delegate().toStockDataCollection();
return this.delegate().toStockDataCollection();
}

@Override
default @NotNull @Unmodifiable Collection<StockData> reset() {
return delegate().reset();
return this.delegate().reset();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ record DepositImpl(@NotNull StockHolder stockHolder, @NotNull BoxItem boxItem,

@Override
public @NotNull @Unmodifiable List<TransactionResult> fromInventory(@NotNull Inventory inventory, @NotNull StockEvent.Cause cause) {
return fromInventory(inventory, null, cause);
return this.fromInventory(inventory, null, cause);
}

@Override
public @NotNull @Unmodifiable List<TransactionResult> fromTopInventory(@NotNull InventoryView view, @NotNull StockEvent.Cause cause) {
return fromInventory(view.getTopInventory(), view, cause);
return this.fromInventory(view.getTopInventory(), view, cause);
}

private @NotNull List<TransactionResult> fromInventory(@NotNull Inventory inventory, @Nullable InventoryView view, @NotNull StockEvent.Cause cause) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ record WithdrawalImpl(@NotNull StockHolder stockHolder, @NotNull BoxItem boxItem

@Override
public @NotNull TransactionResult toInventory(@NotNull Inventory inventory, @NotNull StockEvent.Cause cause) {
return toInventory(inventory, null, cause);
return this.toInventory(inventory, null, cause);
}

@Override
public @NotNull TransactionResult toTopInventory(@NotNull InventoryView view, @NotNull StockEvent.Cause cause) {
return toInventory(view.getTopInventory(), view, cause);
return this.toInventory(view.getTopInventory(), view, cause);
}

private @NotNull TransactionResult toInventory(@NotNull Inventory inventory, @Nullable InventoryView view, @NotNull StockEvent.Cause cause) {
Expand Down
2 changes: 1 addition & 1 deletion api/src/main/java/net/okocraft/box/api/util/Version.java
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ default boolean isAfterOrSame(@NotNull V other) {
* @return {@code true} if this {@link Version} is contained between the specified {@link Version}s, otherwise {@code false}
*/
default boolean isBetween(@NotNull V startInclusive, @NotNull V endInclusive) {
return isAfterOrSame(startInclusive) && isBeforeOrSame(endInclusive);
return this.isAfterOrSame(startInclusive) && this.isBeforeOrSame(endInclusive);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ public void onEnable() {
}

try {
runMigratorIfNeeded();
this.runMigratorIfNeeded();
} catch (Exception e) {
BoxLogger.logger().error("An exception occurred while migrating data.", e);
this.status = Status.EXCEPTION_OCCURRED;
Expand Down
4 changes: 2 additions & 2 deletions core/src/main/java/net/okocraft/box/core/BoxCore.java
Original file line number Diff line number Diff line change
Expand Up @@ -310,12 +310,12 @@ public void disableAllFeatures() {

@Override
public boolean canUseBox(@NotNull Player player) {
return !isDisabledWorld(player.getWorld()) || player.hasPermission("box.admin.ignore-disabled-world");
return !this.isDisabledWorld(player.getWorld()) || player.hasPermission("box.admin.ignore-disabled-world");
}

@Override
public boolean isDisabledWorld(@NotNull World world) {
return isDisabledWorld(world.getName());
return this.isDisabledWorld(world.getName());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public void onCommand(@NotNull CommandSender sender, @NotNull String[] args) {

var source = this.messageProvider.findSource(sender);

if (!sender.hasPermission(getPermissionNode())) {
if (!sender.hasPermission(this.getPermissionNode())) {
ErrorMessages.NO_PERMISSION.apply(this.getPermissionNode()).source(source).send(sender);
return;
}
Expand All @@ -49,7 +49,7 @@ public void onCommand(@NotNull CommandSender sender, @NotNull String[] args) {
this.scheduler.runAsyncTask(() -> this.commandOfNoArgument.onCommand(sender, args));
} else {
ErrorMessages.NOT_ENOUGH_ARGUMENT.source(source).send(sender);
sendHelp(sender, source);
this.sendHelp(sender, source);
}
return;
}
Expand All @@ -60,7 +60,7 @@ public void onCommand(@NotNull CommandSender sender, @NotNull String[] args) {
if (!args[0].equalsIgnoreCase("help")) {
ErrorMessages.SUB_COMMAND_NOT_FOUND.source(source).send(sender);
}
sendHelp(sender, source);
this.sendHelp(sender, source);
return;
}

Expand All @@ -84,7 +84,7 @@ public void onCommand(@NotNull CommandSender sender, @NotNull String[] args) {
Objects.requireNonNull(sender);
Objects.requireNonNull(args);

if (args.length == 0 || !sender.hasPermission(getPermissionNode())) {
if (args.length == 0 || !sender.hasPermission(this.getPermissionNode())) {
return Collections.emptyList();
}

Expand Down Expand Up @@ -139,13 +139,13 @@ public void onAsyncTabComplete(@NotNull AsyncTabCompleteEvent event) {

var label = buffer.substring(0, firstSpace).toLowerCase(Locale.ROOT);

if (!getName().equals(label) && !getAliases().contains(label)) {
if (!this.getName().equals(label) && !this.getAliases().contains(label)) {
return;
}

String[] args = buffer.substring(firstSpace + 1).split(" ", -1);

event.setCompletions(onTabComplete(event.getSender(), args));
event.setCompletions(this.onTabComplete(event.getSender(), args));
event.setHandled(true);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ boolean isRegistered(@NotNull String itemName) {
Objects.requireNonNull(itemName);
{
long readAttempt = this.lock.tryOptimisticRead();
boolean result = checkItemNameAtUnsynchronized(itemName);
boolean result = this.checkItemNameAtUnsynchronized(itemName);

if (this.lock.validate(readAttempt)) {
return result;
Expand All @@ -60,7 +60,7 @@ boolean isRegistered(@NotNull String itemName) {
this.lock.readLock();

try {
return checkItemNameAtUnsynchronized(itemName);
return this.checkItemNameAtUnsynchronized(itemName);
} finally {
this.lock.tryUnlockRead();
}
Expand All @@ -70,7 +70,7 @@ boolean isRegistered(@NotNull String itemName) {
Objects.requireNonNull(itemName);
{
long readAttempt = this.lock.tryOptimisticRead();
var boxItem = getByItemNameAtUnsynchronized(itemName);
var boxItem = this.getByItemNameAtUnsynchronized(itemName);

if (this.lock.validate(readAttempt)) {
return boxItem;
Expand All @@ -80,7 +80,7 @@ boolean isRegistered(@NotNull String itemName) {
this.lock.readLock();

try {
return getByItemNameAtUnsynchronized(itemName);
return this.getByItemNameAtUnsynchronized(itemName);
} finally {
this.lock.tryUnlockRead();
}
Expand All @@ -93,7 +93,7 @@ boolean isRegistered(@NotNull String itemName) {

{
long readAttempt = this.lock.tryOptimisticRead();
var boxItem = getByIdAtUnsynchronized(id);
var boxItem = this.getByIdAtUnsynchronized(id);

if (this.lock.validate(readAttempt)) {
return boxItem;
Expand All @@ -103,7 +103,7 @@ boolean isRegistered(@NotNull String itemName) {
this.lock.readLock();

try {
return getByIdAtUnsynchronized(id);
return this.getByIdAtUnsynchronized(id);
} finally {
this.lock.tryUnlockRead();
}
Expand All @@ -112,7 +112,7 @@ boolean isRegistered(@NotNull String itemName) {
@NotNull IntImmutableList getItemIdList() {
{
long readAttempt = this.lock.tryOptimisticRead();
var list = getItemIdListAtUnsynchronized();
var list = this.getItemIdListAtUnsynchronized();

if (this.lock.validate(readAttempt)) {
return list;
Expand All @@ -122,7 +122,7 @@ boolean isRegistered(@NotNull String itemName) {
this.lock.readLock();

try {
return getItemIdListAtUnsynchronized();
return this.getItemIdListAtUnsynchronized();
} finally {
this.lock.tryUnlockRead();
}
Expand All @@ -131,7 +131,7 @@ boolean isRegistered(@NotNull String itemName) {
@NotNull ObjectImmutableList<String> getItemNameList() {
{
long readAttempt = this.lock.tryOptimisticRead();
var list = getItemNameListAtUnsynchronized();
var list = this.getItemNameListAtUnsynchronized();

if (this.lock.validate(readAttempt)) {
return list;
Expand All @@ -141,7 +141,7 @@ boolean isRegistered(@NotNull String itemName) {
this.lock.readLock();

try {
return getItemNameListAtUnsynchronized();
return this.getItemNameListAtUnsynchronized();
} finally {
this.lock.tryUnlockRead();
}
Expand All @@ -150,7 +150,7 @@ boolean isRegistered(@NotNull String itemName) {
@NotNull ObjectImmutableList<BoxItem> getItemList() {
{
long readAttempt = this.lock.tryOptimisticRead();
var list = getBoxItemListAtUnsynchronized();
var list = this.getBoxItemListAtUnsynchronized();

if (this.lock.validate(readAttempt)) {
return list;
Expand All @@ -160,7 +160,7 @@ boolean isRegistered(@NotNull String itemName) {
this.lock.readLock();

try {
return getBoxItemListAtUnsynchronized();
return this.getBoxItemListAtUnsynchronized();
} finally {
this.lock.tryUnlockRead();
}
Expand Down Expand Up @@ -201,7 +201,7 @@ void rebuildCache() {
}

private @Nullable BoxItem getByItemNameAtUnsynchronized(@NotNull String itemName) {
return getByIdAtUnsynchronized(this.itemNameToId.getInt(itemName));
return this.getByIdAtUnsynchronized(this.itemNameToId.getInt(itemName));
}

private @NotNull IntImmutableList getItemIdListAtUnsynchronized() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ boolean isRegistered(@NotNull ItemStack itemStack) {

{
long readAttempt = this.lock.tryOptimisticRead();
boolean result = checkItemAtUnsynchronized(itemStack);
boolean result = this.checkItemAtUnsynchronized(itemStack);

if (this.lock.validate(readAttempt)) {
return result;
Expand All @@ -50,7 +50,7 @@ boolean isRegistered(@NotNull ItemStack itemStack) {
this.lock.readLock();

try {
return checkItemAtUnsynchronized(itemStack);
return this.checkItemAtUnsynchronized(itemStack);
} finally {
this.lock.tryUnlockRead();
}
Expand All @@ -60,14 +60,14 @@ boolean isRegistered(@NotNull ItemStack itemStack) {
Objects.requireNonNull(item);

if (!item.hasItemMeta()) {
return getByItemName(item.getType().name());
return this.getByItemName(item.getType().name());
}

var one = item.asOne();

{
long readAttempt = this.lock.tryOptimisticRead();
var boxItem = getByItemStackAtUnsynchronized(one);
var boxItem = this.getByItemStackAtUnsynchronized(one);

if (this.lock.validate(readAttempt)) {
return boxItem;
Expand All @@ -77,7 +77,7 @@ boolean isRegistered(@NotNull ItemStack itemStack) {
this.lock.readLock();

try {
return getByItemStackAtUnsynchronized(one);
return this.getByItemStackAtUnsynchronized(one);
} finally {
this.lock.tryUnlockRead();
}
Expand All @@ -100,6 +100,6 @@ void removeItemAtUnsynchronized(@NotNull BoxItem item) {
}

private @Nullable BoxItem getByItemStackAtUnsynchronized(@NotNull ItemStack item) {
return getByIdAtUnsynchronized(this.itemToId.getInt(item));
return this.getByIdAtUnsynchronized(this.itemToId.getInt(item));
}
}
Loading

0 comments on commit a92c695

Please sign in to comment.