Populate last known name on Quester instantiation, fixes #1479

This commit is contained in:
PikaMug 2020-11-29 23:17:59 -05:00
parent d5d1dbde48
commit f435d871dd
3 changed files with 7 additions and 4 deletions

View File

@ -228,6 +228,10 @@ public class Quester implements Comparable<Quester> {
}
};
/**
* @deprecated Use {@link #Quester(Quests, UUID)}
*/
@Deprecated
public Quester(final Quests plugin) {
this.plugin = plugin;
}
@ -235,6 +239,7 @@ public class Quester implements Comparable<Quester> {
public Quester(final Quests plugin, final UUID uuid) {
this.plugin = plugin;
this.id = uuid;
this.lastKnownName = Bukkit.getOfflinePlayer(uuid).getName();
}
@Override

View File

@ -509,8 +509,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
Quester quester = getQuester(player.getUniqueId());
if (quester == null) {
// Must be new player
quester = new Quester(Quests.this);
quester.setUUID(player.getUniqueId());
quester = new Quester(Quests.this, player.getUniqueId());
if (quester.saveData()) {
getLogger().info("Created new data for player " + player.getName());
} else {

View File

@ -1399,8 +1399,7 @@ public class CmdExecutor implements CommandExecutor {
} catch (final Exception e) {
plugin.getLogger().info("Data file does not exist for " + id.toString());
}
quester = new Quester(plugin);
quester.setUUID(id);
quester = new Quester(plugin, id);
quester.saveData();
final ConcurrentSkipListSet<Quester> temp2 = (ConcurrentSkipListSet<Quester>) plugin.getOfflineQuesters();
temp2.add(quester);