Fixed minor code smells

This commit is contained in:
Florian CUNY 2020-03-21 11:29:33 +01:00
parent e322f4047a
commit db9d2acf18
4 changed files with 9 additions and 11 deletions

View File

@ -355,7 +355,7 @@ public class IslandEvent extends IslandBaseEvent {
* @since 1.12.0 * @since 1.12.0
*/ */
public static class IslandPreclearEvent extends IslandBaseEvent { public static class IslandPreclearEvent extends IslandBaseEvent {
private @NonNull final Island oldIsland; private final @NonNull Island oldIsland;
private IslandPreclearEvent(Island island, UUID player, boolean admin, Location location, @NonNull Island oldIsland) { private IslandPreclearEvent(Island island, UUID player, boolean admin, Location location, @NonNull Island oldIsland) {
// Final variables have to be declared in the constructor // Final variables have to be declared in the constructor
@ -417,7 +417,7 @@ public class IslandEvent extends IslandBaseEvent {
* *
*/ */
public static class IslandResettedEvent extends IslandBaseEvent { public static class IslandResettedEvent extends IslandBaseEvent {
private @NonNull final Island oldIsland; private final @NonNull Island oldIsland;
private IslandResettedEvent(Island island, UUID player, boolean admin, Location location, Island oldIsland) { private IslandResettedEvent(Island island, UUID player, boolean admin, Location location, Island oldIsland) {
// Final variables have to be declared in the constructor // Final variables have to be declared in the constructor
@ -433,7 +433,6 @@ public class IslandEvent extends IslandBaseEvent {
public Island getOldIsland() { public Island getOldIsland() {
return oldIsland; return oldIsland;
} }
} }
/** /**
* Fired when something happens to the island not covered by other events * Fired when something happens to the island not covered by other events

View File

@ -20,12 +20,12 @@ public class BlueprintClipboardReader implements ClipboardReader {
@Override @Override
public Clipboard read() throws IOException { public Clipboard read() throws IOException {
return null; //TODO throw new UnsupportedOperationException(); // TODO
} }
@Override @Override
public void close() throws IOException { public void close() throws IOException {
throw new UnsupportedOperationException(); // TODO
} }
public InputStream getInputStream() { public InputStream getInputStream() {

View File

@ -19,12 +19,12 @@ public class BlueprintClipboardWriter implements ClipboardWriter {
} }
@Override @Override
public void write(Clipboard clipboard) throws IOException { public void write(Clipboard clipboard) throws IOException {
// TODO throw new UnsupportedOperationException(); // TODO
} }
@Override @Override
public void close() throws IOException { public void close() throws IOException {
throw new UnsupportedOperationException(); // TODO
} }
public OutputStream getOutputStream() { public OutputStream getOutputStream() {

View File

@ -30,6 +30,7 @@ import org.bukkit.entity.Entity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.entity.PufferFish; import org.bukkit.entity.PufferFish;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.bukkit.permissions.PermissionAttachmentInfo;
import org.bukkit.scheduler.BukkitTask; import org.bukkit.scheduler.BukkitTask;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
import org.eclipse.jdt.annotation.NonNull; import org.eclipse.jdt.annotation.NonNull;
@ -101,8 +102,6 @@ public class IslandsManager {
private Set<String> toSave = new HashSet<>(); private Set<String> toSave = new HashSet<>();
private Iterator<String> it;
private BukkitTask task; private BukkitTask task;
/** /**
@ -1018,7 +1017,7 @@ public class IslandsManager {
if (!toSave.isEmpty()) return; if (!toSave.isEmpty()) return;
// Get a list of ID's to save // Get a list of ID's to save
toSave = new HashSet<>(islandCache.getAllIslandIds()); toSave = new HashSet<>(islandCache.getAllIslandIds());
it = toSave.iterator(); Iterator<String> it = toSave.iterator();
task = Bukkit.getScheduler().runTaskTimer(plugin, () -> { task = Bukkit.getScheduler().runTaskTimer(plugin, () -> {
if (plugin.isEnabled() && it.hasNext()) { if (plugin.isEnabled() && it.hasNext()) {
getIslandById(it.next()).ifPresent(this::save); getIslandById(it.next()).ifPresent(this::save);
@ -1099,7 +1098,7 @@ public class IslandsManager {
// Permission checks for range changes only work when the target is online // Permission checks for range changes only work when the target is online
if (target.isOnline() && if (target.isOnline() &&
target.getEffectivePermissions().parallelStream() target.getEffectivePermissions().parallelStream()
.map(p -> p.getPermission()) .map(PermissionAttachmentInfo::getPermission)
.anyMatch(p -> p.startsWith(addon.getPermissionPrefix() + "island.range"))) { .anyMatch(p -> p.startsWith(addon.getPermissionPrefix() + "island.range"))) {
// Check if new owner has a different range permission than the island size // Check if new owner has a different range permission than the island size
int range = target.getPermissionValue( int range = target.getPermissionValue(