Skip to content

Commit

Permalink
feat: Refactored onCommand(...)
Browse files Browse the repository at this point in the history
Made variable player as pattern variable.
  • Loading branch information
Lapis0875 committed Mar 17, 2022
1 parent 6a28a94 commit 8fd8085
Showing 1 changed file with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ public boolean onCommand(
@NotNull String label,
@NotNull String[] args
) {
if (sender instanceof Player) {
Player player = (Player) sender;
if (sender instanceof Player player) {
switch (command.getName()) {
case Constants.CMD_LOCK:
// lock
Expand Down Expand Up @@ -128,7 +127,7 @@ else if (blockFacing.isPresent() && NBTLock.isLockable(blockFacing.get().getType
}
NBTLock lock = new NBTLock(player);
Block b = blockFacing.get();
lock.applyLock(b, null);
lock.applyLock(b);
player.sendMessage(Component.text(
String.format(
"%s 블럭을 잠갔습니다!",
Expand Down Expand Up @@ -296,7 +295,7 @@ else if (targetBlock.isPresent() && NBTLock.isLockable(targetBlock.get().getType
objectLock.ifPresent(
(lock) -> {
if (lock.ownerUUID.equals(player.getUniqueId())) {
lock.removeLock(targetBlock.get(), null);
lock.removeLock(targetBlock.get());
player.sendMessage(Component.text(
String.format(
"%s 블럭을 잠금 해제했습니다!",
Expand Down

0 comments on commit 8fd8085

Please sign in to comment.