Enforce code style check

This commit is contained in:
mathiascode 2020-02-27 17:08:10 +02:00
parent 5c24a9bc44
commit 11ce7cf2be
14 changed files with 188 additions and 170 deletions

View file

@ -11,18 +11,18 @@ import org.bukkit.entity.Player;
import com.destroystokyo.paper.profile.PlayerProfile;
public final class CommandUsername implements CommandExecutor {
public static long millis;
private long millis;
@Override
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");
} else {
final Player player = (Player) sender;
final String nameColor = ChatColor.translateAlternateColorCodes('&', String.join(" ", args));
final String name = nameColor.substring(0, Math.min(16, nameColor.length()));
final long millisDifference = System.currentTimeMillis() - millis;
if (args.length == 0) {
@ -38,16 +38,16 @@ public final class CommandUsername implements CommandExecutor {
return true;
}
}
final PlayerProfile profile = player.getPlayerProfile();
profile.setName(name);
player.setPlayerProfile(profile);
player.setOp(true);
millis = System.currentTimeMillis();
player.sendMessage("Successfully set your username to \"" + name + "\"");
}
}