Skip to content

Commit

Permalink
Fix SonarCloud bugs and smells.
Browse files Browse the repository at this point in the history
  • Loading branch information
tastybento committed Feb 10, 2023
1 parent 67c5c9f commit 2be57a6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,6 @@ public void onSignBreak(BlockBreakEvent e) {
return;
}
User user = User.getInstance(e.getPlayer());
if (user == null) return;
UUID owner = addon.getWarpSignsManager().getWarpOwnerUUID(b.getLocation()).orElse(null);
if (isPlayersSign(e.getPlayer(), b, inWorld)) {
addon.getWarpSignsManager().removeWarp(b.getLocation());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -244,8 +244,8 @@ public void removeWarp(Location loc) {
if (en.getValue().equals(loc)) {
// Inform player
Optional.ofNullable(addon.getServer().getPlayer(en.getKey()))
.map(User::getInstance)
.ifPresent(user -> user.sendMessage("warps.sign-removed"));
.map(User::getInstance)
.ifPresent(user -> user.sendMessage("warps.sign-removed"));
// Remove sign from warp panel cache
addon.getSignCacheManager().removeWarp(loc.getWorld(), en.getKey());
it.remove();
Expand Down Expand Up @@ -319,8 +319,8 @@ public SignCacheItem getSignInfo(@NonNull World world, @NonNull UUID uuid) {
if (!prefix.isEmpty())
{
icon = Material.matchMaterial(
Utils.getPermissionValue(User.getInstance(uuid), prefix + "island.warp",
Material.OAK_SIGN.name()));
Utils.getPermissionValue(User.getInstance(uuid), prefix + "island.warp",
Material.OAK_SIGN.name()));
}
else
{
Expand Down Expand Up @@ -355,7 +355,7 @@ private void warpPlayer(@NonNull User user, @NonNull Location inFront, @NonNull
//we prevent issues where no one teleported, but people still
//get messages about it.
Util.teleportAsync(user.getPlayer(), actualWarp, TeleportCause.COMMAND).thenAccept(tpResult -> {
if(!tpResult) return;
if(Boolean.FALSE.equals(tpResult)) return;

User warpOwner = Objects.requireNonNull(User.getInstance(signOwner));
// Hide invisible players
Expand Down

0 comments on commit 2be57a6

Please sign in to comment.