Switch results map to use UUID as key
This commit is contained in:
@@ -1,7 +1,6 @@
|
|||||||
package dev.heliosares.auxprotect.core.commands;
|
package dev.heliosares.auxprotect.core.commands;
|
||||||
|
|
||||||
import dev.heliosares.auxprotect.adapters.sender.SenderAdapter;
|
import dev.heliosares.auxprotect.adapters.sender.SenderAdapter;
|
||||||
import dev.heliosares.auxprotect.api.AuxProtectAPI;
|
|
||||||
import dev.heliosares.auxprotect.core.APPermission;
|
import dev.heliosares.auxprotect.core.APPermission;
|
||||||
import dev.heliosares.auxprotect.core.Command;
|
import dev.heliosares.auxprotect.core.Command;
|
||||||
import dev.heliosares.auxprotect.core.IAuxProtect;
|
import dev.heliosares.auxprotect.core.IAuxProtect;
|
||||||
@@ -43,12 +42,13 @@ import java.util.Iterator;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
import java.util.UUID;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
public class LookupCommand extends Command {
|
public class LookupCommand extends Command {
|
||||||
|
|
||||||
static final HashMap<String, Results> results = new HashMap<>();
|
static final HashMap<UUID, Results> results = new HashMap<>();
|
||||||
|
|
||||||
public LookupCommand(IAuxProtect plugin) {
|
public LookupCommand(IAuxProtect plugin) {
|
||||||
super(plugin, "lookup", APPermission.LOOKUP, true, "l");
|
super(plugin, "lookup", APPermission.LOOKUP, true, "l");
|
||||||
@@ -235,9 +235,8 @@ public class LookupCommand extends Command {
|
|||||||
}
|
}
|
||||||
if (isPageLookup || first || last || next || prev) {
|
if (isPageLookup || first || last || next || prev) {
|
||||||
Results result = null;
|
Results result = null;
|
||||||
String uuid = sender.getUniqueId().toString();
|
if (results.containsKey(sender.getUniqueId())) {
|
||||||
if (results.containsKey(uuid)) {
|
result = results.get(sender.getUniqueId());
|
||||||
result = results.get(uuid);
|
|
||||||
}
|
}
|
||||||
if (result == null) {
|
if (result == null) {
|
||||||
sender.sendLang(Language.L.COMMAND__LOOKUP__NO_RESULTS_SELECTED);
|
sender.sendLang(Language.L.COMMAND__LOOKUP__NO_RESULTS_SELECTED);
|
||||||
@@ -398,10 +397,9 @@ public class LookupCommand extends Command {
|
|||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
} else if (params_.hasFlag(Flag.ACTIVITY)) {
|
} else if (params_.hasFlag(Flag.ACTIVITY)) {
|
||||||
String uuid = sender.getUniqueId().toString();
|
|
||||||
Results result = new ActivityResults(plugin, rs, sender, params_);
|
Results result = new ActivityResults(plugin, rs, sender, params_);
|
||||||
result.showPage(result.getNumPages(4), 4);
|
result.showPage(result.getNumPages(4), 4);
|
||||||
results.put(uuid, result);
|
results.put(sender.getUniqueId(), result);
|
||||||
return;
|
return;
|
||||||
} else if (params_.hasFlag(Flag.XRAY)) {
|
} else if (params_.hasFlag(Flag.XRAY)) {
|
||||||
Set<Integer> users = new HashSet<>();
|
Set<Integer> users = new HashSet<>();
|
||||||
@@ -473,10 +471,9 @@ public class LookupCommand extends Command {
|
|||||||
new PlaybackSolver(plugin, sender, rs, params_.getAfter(), actions);
|
new PlaybackSolver(plugin, sender, rs, params_.getAfter(), actions);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
String uuid = sender.getUniqueId().toString();
|
|
||||||
Results result = new Results(plugin, rs, sender, params_);
|
Results result = new Results(plugin, rs, sender, params_);
|
||||||
result.showPage(1, 4);
|
result.showPage(1, 4);
|
||||||
results.put(uuid, result);
|
results.put(sender.getUniqueId(), result);
|
||||||
|
|
||||||
if (params_.hasFlag(Flag.XRAY)) {
|
if (params_.hasFlag(Flag.XRAY)) {
|
||||||
sender.sendMessage(XraySolver.solve(rs));
|
sender.sendMessage(XraySolver.solve(rs));
|
||||||
|
|||||||
Reference in New Issue
Block a user