mirror of
https://github.com/kaboomserver/commandspy.git
synced 2025-05-13 12:01:14 +00:00
fix: consistency, maven warning
This commit is contained in:
parent
876ec6ae44
commit
91787dec90
3 changed files with 13 additions and 13 deletions
3
pom.xml
3
pom.xml
|
@ -5,8 +5,7 @@
|
|||
<version>master</version>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>17</maven.compiler.source>
|
||||
<maven.compiler.target>17</maven.compiler.target>
|
||||
<maven.compiler.release>17</maven.compiler.release>
|
||||
<maven.test.skip>true</maven.test.skip>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
|
|
@ -33,7 +33,8 @@ public final class CommandSpyState {
|
|||
} catch (final FileNotFoundException exception) {
|
||||
try {
|
||||
this.save(); // Create file if it doesn't exist
|
||||
} catch (IOException ignored) {}
|
||||
} catch (IOException ignored) {
|
||||
}
|
||||
} catch (final IOException exception) {
|
||||
LOGGER.error("Failed to load state file:", exception);
|
||||
}
|
||||
|
@ -47,7 +48,7 @@ public final class CommandSpyState {
|
|||
|
||||
// Loop until we read less than 16 bytes
|
||||
while ((read = reader.readNBytes(buffer.array(), 0, 16)) == 16) {
|
||||
this.users.add(new UUID(buffer.getLong(0), buffer.getLong(8)));
|
||||
this.users.add(new UUID(buffer.getLong(0), buffer.getLong(8)));
|
||||
}
|
||||
|
||||
reader.close();
|
||||
|
@ -62,7 +63,7 @@ public final class CommandSpyState {
|
|||
final ByteBuffer buffer = ByteBuffer.wrap(new byte[16]);
|
||||
|
||||
final long stamp = this.usersLock.readLock();
|
||||
for (final UUID uuid: this.users) {
|
||||
for (final UUID uuid : this.users) {
|
||||
buffer.putLong(0, uuid.getMostSignificantBits());
|
||||
buffer.putLong(8, uuid.getLeastSignificantBits());
|
||||
writer.write(buffer.array());
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
package pw.kaboom.commandspy;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.UUID;
|
||||
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.format.NamedTextColor;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
|
@ -14,10 +13,11 @@ import org.bukkit.event.Listener;
|
|||
import org.bukkit.event.block.SignChangeEvent;
|
||||
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.format.NamedTextColor;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.UUID;
|
||||
|
||||
public final class Main extends JavaPlugin implements CommandExecutor, Listener {
|
||||
private CommandSpyState config;
|
||||
|
||||
|
@ -47,7 +47,7 @@ public final class Main extends JavaPlugin implements CommandExecutor, Listener
|
|||
target.sendMessage(Component.empty()
|
||||
.append(Component.text("Successfully "))
|
||||
.append(stateString)
|
||||
.append(Component.text(" CommandSpy.")));
|
||||
.append(Component.text(" CommandSpy")));
|
||||
|
||||
if (source != target) {
|
||||
source.sendMessage(Component.empty()
|
||||
|
@ -55,7 +55,6 @@ public final class Main extends JavaPlugin implements CommandExecutor, Listener
|
|||
.append(stateString)
|
||||
.append(Component.text(" CommandSpy for "))
|
||||
.append(target.name())
|
||||
.append(Component.text("."))
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -76,7 +75,8 @@ public final class Main extends JavaPlugin implements CommandExecutor, Listener
|
|||
Boolean state = null;
|
||||
|
||||
switch (args.length) {
|
||||
case 0 -> {}
|
||||
case 0 -> {
|
||||
}
|
||||
case 1, 2 -> {
|
||||
// Get the last argument as a state. Fail if we have 2 arguments.
|
||||
state = getState(args[args.length - 1]);
|
||||
|
|
Loading…
Reference in a new issue