mirror of
https://github.com/EssentialsX/Essentials.git
synced 2024-11-03 01:19:58 +01:00
Always return an offlineplayer object with the name, that the user wants.
This commit is contained in:
parent
5bb7d82fca
commit
abd86347c7
@ -36,7 +36,6 @@ import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.LogRecord;
|
||||
import java.util.logging.Logger;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
@ -440,7 +439,12 @@ public class Essentials extends JavaPlugin implements IEssentials
|
||||
}
|
||||
if (base instanceof String)
|
||||
{
|
||||
return userMap.getUser((String)base);
|
||||
final User user = userMap.getUser((String)base);
|
||||
if (user != null && user.getBase() instanceof OfflinePlayer)
|
||||
{
|
||||
((OfflinePlayer)user.getBase()).setName((String)base);
|
||||
}
|
||||
return user;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@ -472,7 +476,12 @@ public class Essentials extends JavaPlugin implements IEssentials
|
||||
@Override
|
||||
public User getOfflineUser(final String name)
|
||||
{
|
||||
return userMap.getUser(name);
|
||||
final User user = userMap.getUser(name);
|
||||
if (user != null && user.getBase() instanceof OfflinePlayer)
|
||||
{
|
||||
((OfflinePlayer)user.getBase()).setName(name);
|
||||
}
|
||||
return user;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -26,11 +26,11 @@ import org.bukkit.util.Vector;
|
||||
public class OfflinePlayer implements Player
|
||||
{
|
||||
private final transient IEssentials ess;
|
||||
private Location location = new Location(null, 0, 0, 0, 0, 0);
|
||||
private World world;
|
||||
private UUID uniqueId = UUID.randomUUID();
|
||||
private transient Location location = new Location(null, 0, 0, 0, 0, 0);
|
||||
private transient World world;
|
||||
private final transient UUID uniqueId = UUID.randomUUID();
|
||||
@Delegate(types = org.bukkit.OfflinePlayer.class)
|
||||
private final org.bukkit.OfflinePlayer base;
|
||||
private transient org.bukkit.OfflinePlayer base;
|
||||
|
||||
public OfflinePlayer(final String name, final IEssentials ess)
|
||||
{
|
||||
@ -822,4 +822,11 @@ public class OfflinePlayer implements Player
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
void setName(final String name)
|
||||
{
|
||||
if (!this.base.getName().equalsIgnoreCase(name)) {
|
||||
this.base = ess.getServer().getOfflinePlayer(name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user