mirror of
https://github.com/songoda/FabledSkyBlock.git
synced 2025-01-10 17:58:03 +01:00
Code optimizations
This commit is contained in:
parent
da02fd6d95
commit
f6679f79b2
@ -47,8 +47,8 @@ public class BanCommand extends SubCommand {
|
||||
|| (island.hasRole(IslandRole.Operator, player.getUniqueId()) && permissionManager.hasPermission(island, "Ban", IslandRole.Operator))) {
|
||||
Player targetPlayer = Bukkit.getServer().getPlayer(args[0]);
|
||||
|
||||
UUID targetPlayerUUID = null;
|
||||
String targetPlayerName = null;
|
||||
UUID targetPlayerUUID;
|
||||
String targetPlayerName;
|
||||
|
||||
if (targetPlayer == null) {
|
||||
OfflinePlayer targetPlayerOffline = new OfflinePlayer(args[0]);
|
||||
|
@ -8,10 +8,8 @@ import com.songoda.skyblock.island.IslandManager;
|
||||
import com.songoda.skyblock.island.IslandRole;
|
||||
import com.songoda.skyblock.island.IslandStatus;
|
||||
import com.songoda.skyblock.message.MessageManager;
|
||||
import com.songoda.skyblock.playerdata.PlayerDataManager;
|
||||
import com.songoda.skyblock.sound.SoundManager;
|
||||
import com.songoda.skyblock.utils.player.OfflinePlayer;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.ConsoleCommandSender;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.entity.Player;
|
||||
|
@ -11,29 +11,31 @@ import java.util.UUID;
|
||||
|
||||
public class OfflinePlayer {
|
||||
|
||||
private UUID uuid;
|
||||
private final UUID uuid;
|
||||
org.bukkit.OfflinePlayer bukkitOfflinePlayer;
|
||||
|
||||
private String name;
|
||||
private String memberSince;
|
||||
private String lastOnline;
|
||||
private final String memberSince;
|
||||
private final String lastOnline;
|
||||
private UUID owner = null;
|
||||
private String[] texture;
|
||||
private final String[] texture;
|
||||
|
||||
private int playtime;
|
||||
private final int playtime;
|
||||
|
||||
public OfflinePlayer(String name) {
|
||||
SkyBlock skyblock = SkyBlock.getInstance();
|
||||
UserCacheManager userCacheManager = skyblock.getUserCacheManager();
|
||||
|
||||
bukkitOfflinePlayer = Bukkit.getServer().getOfflinePlayer(name);
|
||||
|
||||
this.name = bukkitOfflinePlayer.getName();
|
||||
this.uuid = bukkitOfflinePlayer.getUniqueId();
|
||||
|
||||
if (this.uuid == null && userCacheManager.hasUser(name)) {
|
||||
|
||||
if (userCacheManager.hasUser(name)) {
|
||||
this.uuid = userCacheManager.getUser(name);
|
||||
bukkitOfflinePlayer = Bukkit.getServer().getOfflinePlayer(uuid);
|
||||
} else {
|
||||
this.uuid = bukkitOfflinePlayer.getUniqueId();
|
||||
}
|
||||
|
||||
this.name = bukkitOfflinePlayer.getName();
|
||||
|
||||
FileConfiguration configLoad = YamlConfiguration.loadConfiguration(
|
||||
new File(new File(skyblock.getDataFolder().toString() + "/player-data"), uuid.toString() + ".yml"));
|
||||
|
Loading…
Reference in New Issue
Block a user