mirror of
https://github.com/kaboomserver/extras.git
synced 2025-07-23 14:03:55 +00:00
Enforce code style check
This commit is contained in:
parent
5c24a9bc44
commit
11ce7cf2be
14 changed files with 188 additions and 170 deletions
|
@ -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 + "\"");
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue