Set maximum line length to 100 characters

This commit is contained in:
kaboom 2022-05-20 05:28:35 +03:00
parent 0184867a61
commit e28e4aa47a
6 changed files with 34 additions and 17 deletions

10
checkstyle.xml Normal file
View File

@ -0,0 +1,10 @@
<?xml version="1.0"?>
<!DOCTYPE module PUBLIC
"-//Checkstyle//DTD Checkstyle Configuration 1.3//EN"
"https://checkstyle.org/dtds/configuration_1_3.dtd">
<module name="Checker">
<module name="LineLength">
<property name="max" value="100"/>
</module>
</module>

View File

@ -41,9 +41,8 @@
<goal>check</goal>
</goals>
<configuration>
<suppressionsLocation>
suppressions.xml
</suppressionsLocation>
<configLocation>checkstyle.xml</configLocation>
<suppressionsLocation>suppressions.xml</suppressionsLocation>
<failOnViolation>true</failOnViolation>
</configuration>
</execution>

View File

@ -35,7 +35,8 @@ class Tick extends BukkitRunnable {
if (controller != null) {
for (int i = 0; i < controller.getInventory().getSize(); i++) {
if (controller.getInventory().getItem(i) != null) {
if (!controller.getInventory().getItem(i).equals(target.getInventory().getItem(i))) {
if (!controller.getInventory().getItem(i).equals(
target.getInventory().getItem(i))) {
target.getInventory().setItem(i, controller.getInventory().getItem(i));
}
} else {
@ -120,7 +121,8 @@ class ControlPlayer implements Listener {
new BukkitRunnable() {
@Override
public void run() {
target.chat("§iControlUChat§" + event.getMessage()); // Add prefix to prevent messages from being cancelled
// Add prefix to prevent messages from being cancelled
target.chat("§iControlUChat§" + event.getMessage());
}
}.runTask(JavaPlugin.getPlugin(Main.class));
@ -216,7 +218,8 @@ class ControlPlayer implements Listener {
allPlayers.showPlayer(JavaPlugin.getPlugin(Main.class), controller);
}
final Scoreboard scoreboard = Bukkit.getScoreboardManager().getMainScoreboard();
final Scoreboard scoreboard = Bukkit.getScoreboardManager()
.getMainScoreboard();
final Team team = scoreboard.getTeam("icuCollision");
if (team != null
@ -229,7 +232,8 @@ class ControlPlayer implements Listener {
}
}.runTaskLater(JavaPlugin.getPlugin(Main.class), tickDelay);
otherPlayer.sendMessage("The player you were controlling has disconnected. You are invisible for 10 seconds.");
otherPlayer.sendMessage("The player you were controlling has disconnected. "
+ "You are invisible for 10 seconds.");
} else if (PlayerList.getTarget(player.getUniqueId()) != null
&& PlayerList.getTarget(player.getUniqueId()).equals(otherPlayer)) {

View File

@ -45,7 +45,8 @@ public final class Main extends JavaPlugin {
}
controller.removePotionEffect(PotionEffectType.INVISIBILITY);
controller.sendMessage("You are no longer controlling \"" + target.getName() + "\" due to server reload");
controller.sendMessage("You are no longer controlling \"" + target.getName()
+ "\" due to server reload");
}
}
}

View File

@ -33,11 +33,14 @@ public final class CommandIcu implements CommandExecutor {
if (target == controller) {
controller.sendMessage("You are already controlling yourself");
} else if (PlayerList.getTarget(controller.getUniqueId()) != null) {
controller.sendMessage("You are already controlling \"" + target.getName() + "\"");
controller.sendMessage("You are already controlling \""
+ target.getName() + "\"");
} else if (PlayerList.getController(target.getUniqueId()) != null) {
controller.sendMessage("Player \"" + target.getName() + "\" is already being controlled");
controller.sendMessage("Player \"" + target.getName()
+ "\" is already being controlled");
} else if (PlayerList.getTarget(target.getUniqueId()) != null) {
controller.sendMessage("Player \"" + target.getName() + "\" is already controlling another player");
controller.sendMessage("Player \"" + target.getName()
+ "\" is already controlling another player");
} else if (!controller.canSee(target)) {
controller.sendMessage("You may not control this player");
} else {
@ -85,14 +88,16 @@ public final class CommandIcu implements CommandExecutor {
final int seconds = tickDelay / 20;
controller.sendMessage("You are no longer controlling \"" + target.getName() + "\". You are invisible for " + seconds + " seconds.");
controller.sendMessage("You are no longer controlling \"" + target.getName()
+ "\". You are invisible for " + seconds + " seconds.");
} else {
controller.sendMessage("You are not controlling anyone at the moment");
}
}
@Override
public boolean onCommand(final CommandSender sender, final Command command, final String label, final String[] args) {
public boolean onCommand(final CommandSender sender, final Command command, final String label,
final String[] args) {
if (sender instanceof ConsoleCommandSender) {
sender.sendMessage("Command has to be run by a player");
return true;

View File

@ -1,10 +1,8 @@
<?xml version="1.0"?>
<!DOCTYPE suppressions PUBLIC
"-//Puppy Crawl//DTD Suppressions 1.0//EN"
"http://www.puppycrawl.com/dtds/suppressions_1_0.dtd">
"-//Checkstyle//DTD SuppressionFilter Configuration 1.2//EN"
"https://checkstyle.org/dtds/suppressions_1_2.dtd">
<suppressions>
<suppress checks="Javadoc" files="."/>
<suppress checks="LineLength" files="."/>
</suppressions>