Fix SonarCloud bugs and smells.

This commit is contained in:
tastybento 2023-02-09 17:44:25 -08:00
parent 67c5c9f8c3
commit 2be57a66d2
2 changed files with 5 additions and 6 deletions

View File

@ -113,7 +113,6 @@ public class WarpSignsListener implements Listener {
return; return;
} }
User user = User.getInstance(e.getPlayer()); User user = User.getInstance(e.getPlayer());
if (user == null) return;
UUID owner = addon.getWarpSignsManager().getWarpOwnerUUID(b.getLocation()).orElse(null); UUID owner = addon.getWarpSignsManager().getWarpOwnerUUID(b.getLocation()).orElse(null);
if (isPlayersSign(e.getPlayer(), b, inWorld)) { if (isPlayersSign(e.getPlayer(), b, inWorld)) {
addon.getWarpSignsManager().removeWarp(b.getLocation()); addon.getWarpSignsManager().removeWarp(b.getLocation());

View File

@ -244,8 +244,8 @@ public class WarpSignsManager {
if (en.getValue().equals(loc)) { if (en.getValue().equals(loc)) {
// Inform player // Inform player
Optional.ofNullable(addon.getServer().getPlayer(en.getKey())) Optional.ofNullable(addon.getServer().getPlayer(en.getKey()))
.map(User::getInstance) .map(User::getInstance)
.ifPresent(user -> user.sendMessage("warps.sign-removed")); .ifPresent(user -> user.sendMessage("warps.sign-removed"));
// Remove sign from warp panel cache // Remove sign from warp panel cache
addon.getSignCacheManager().removeWarp(loc.getWorld(), en.getKey()); addon.getSignCacheManager().removeWarp(loc.getWorld(), en.getKey());
it.remove(); it.remove();
@ -319,8 +319,8 @@ public class WarpSignsManager {
if (!prefix.isEmpty()) if (!prefix.isEmpty())
{ {
icon = Material.matchMaterial( icon = Material.matchMaterial(
Utils.getPermissionValue(User.getInstance(uuid), prefix + "island.warp", Utils.getPermissionValue(User.getInstance(uuid), prefix + "island.warp",
Material.OAK_SIGN.name())); Material.OAK_SIGN.name()));
} }
else else
{ {
@ -355,7 +355,7 @@ public class WarpSignsManager {
//we prevent issues where no one teleported, but people still //we prevent issues where no one teleported, but people still
//get messages about it. //get messages about it.
Util.teleportAsync(user.getPlayer(), actualWarp, TeleportCause.COMMAND).thenAccept(tpResult -> { 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)); User warpOwner = Objects.requireNonNull(User.getInstance(signOwner));
// Hide invisible players // Hide invisible players