Skip to content

Commit

Permalink
TASK-4197 fixed all PMD violations caused by PMD update
Browse files Browse the repository at this point in the history
  • Loading branch information
Wolf2323 committed May 15, 2024
1 parent 2900770 commit 2c642c8
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 23 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 17
java-version: 21
cache: 'maven'
- name: Build with Maven verify
run: ./mvnw -B verify
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>works.reload</groupId>
<artifactId>parent</artifactId>
<version>1.0.5</version>
<version>1.2.0</version>
</parent>

<groupId>org.wensheng</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
import java.net.Socket;
import java.nio.charset.StandardCharsets;
import java.util.ArrayDeque;
import java.util.Deque;
import java.util.logging.Level;
import java.util.logging.Logger;

Expand All @@ -76,9 +77,9 @@ class RemoteSession {
@SuppressWarnings("PMD.DoNotUseThreads")
private Thread outThread;

private final ArrayDeque<String> inQueue = new ArrayDeque<>();
private final Deque<String> inQueue = new ArrayDeque<>();

private final ArrayDeque<String> outQueue = new ArrayDeque<>();
private final Deque<String> outQueue = new ArrayDeque<>();

private boolean running = true;

Expand Down Expand Up @@ -256,6 +257,7 @@ private class OutputThread implements Runnable {
public OutputThread() {
}

@SuppressWarnings("PMD.DoNotUseThreads")
@Override
public void run() {
logger.log(Level.INFO, "Starting output thread!");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import org.wensheng.juicyraspberrypie.command.Handler;

import java.util.ArrayDeque;
import java.util.Deque;

/**
* An event queue for handling events.
Expand All @@ -16,7 +17,7 @@ public abstract class EventQueue<T extends Event> implements Handler, Listener {
/**
* The event queue.
*/
private final ArrayDeque<T> events = new ArrayDeque<>();
private final Deque<T> events = new ArrayDeque<>();

/**
* The plugin to associate with this event queue.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,7 @@ public String handle(final Instruction instruction) {
final Block block = event.getClickedBlock();
if (block != null) {
final Location loc = block.getLocation();
stringBuilder.append(getBlockLocation(loc));
stringBuilder.append(',');
stringBuilder.append(event.getBlockFace().name());
stringBuilder.append(',');
stringBuilder.append(event.getPlayer().getUniqueId());
stringBuilder.append(getBlockLocation(loc)).append(',').append(event.getBlockFace().name()).append(',').append(event.getPlayer().getUniqueId());
} else {
stringBuilder.append("0,0,0,Fail,0");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,7 @@ public String handle(final Instruction instruction) {
while (isQueueEmpty()) {
final AsyncPlayerChatEvent event = pollEvent();
final Player player = event.getPlayer();
stringBuilder.append(player.getName());
stringBuilder.append(',');
stringBuilder.append(player.getUniqueId());
stringBuilder.append(',');
stringBuilder.append(event.getMessage());
stringBuilder.append(player.getName()).append(',').append(player.getUniqueId()).append(',').append(event.getMessage());
if (!isQueueEmpty()) {
stringBuilder.append('|');
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,7 @@ public String handle(final Instruction instruction) {
if (player != null) {
final Block block = arrow.getLocation().getBlock();
final Location loc = block.getLocation();
stringBuilder.append(getBlockLocation(loc));
stringBuilder.append(',');
stringBuilder.append(player.getUniqueId());
stringBuilder.append(',');
stringBuilder.append(getBlockLocation(loc)).append(',').append(player.getUniqueId()).append(',');
final Entity hitEntity = event.getHitEntity();
if (hitEntity != null) {
stringBuilder.append(hitEntity.getUniqueId());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,7 @@ public GetPlayerIds(final Server server) {
public String handle(final Instruction instruction) {
final StringBuilder bdr = new StringBuilder();
for (final Player p : server.getOnlinePlayers()) {
bdr.append(p.getName());
bdr.append(',');
bdr.append(p.getUniqueId());
bdr.append('|');
bdr.append(p.getName()).append(',').append(p.getUniqueId()).append('|');
}
if (!bdr.isEmpty()) {
bdr.deleteCharAt(bdr.length() - 1);
Expand Down

0 comments on commit 2c642c8

Please sign in to comment.