mirror of
https://github.com/PikaMug/Quests.git
synced 2025-01-09 01:47:45 +01:00
Return null if Quester lookup uses null UUID, fixes #1418
This commit is contained in:
parent
28030649c2
commit
5ae6d357e8
@ -1305,28 +1305,28 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
||||
* Get Quester from player UUID
|
||||
*
|
||||
* @param id Player UUID
|
||||
* @return Quester, or null if not found
|
||||
* @return Quester, or null if UUID is null
|
||||
*/
|
||||
public Quester getQuester(final UUID id) {
|
||||
Quester quester = null;
|
||||
if (id == null) {
|
||||
return null;
|
||||
}
|
||||
for (final Quester q: questers) {
|
||||
if (q != null && q.getUUID().equals(id)) {
|
||||
quester = q;
|
||||
return q;
|
||||
}
|
||||
}
|
||||
if (quester == null) {
|
||||
quester = new Quester(this);
|
||||
quester.setUUID(id);
|
||||
if (depends.getCitizens() != null) {
|
||||
if (depends.getCitizens().getNPCRegistry().getByUniqueId(id) != null) {
|
||||
return quester;
|
||||
}
|
||||
}
|
||||
questers.add(quester);
|
||||
if (!quester.loadData()) {
|
||||
questers.remove(quester);
|
||||
final Quester quester = new Quester(this);
|
||||
quester.setUUID(id);
|
||||
if (depends.getCitizens() != null) {
|
||||
if (depends.getCitizens().getNPCRegistry().getByUniqueId(id) != null) {
|
||||
return quester;
|
||||
}
|
||||
}
|
||||
questers.add(quester);
|
||||
if (!quester.loadData()) {
|
||||
questers.remove(quester);
|
||||
}
|
||||
return quester;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user