mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2024-10-31 16:01:00 +01:00
Fixed compile warning in PluginPlayersTable
This commit is contained in:
parent
2b4281ee53
commit
ab99ed1976
@ -24,7 +24,6 @@ import com.djrapitops.plan.data.store.containers.PlayerContainer;
|
|||||||
import com.djrapitops.plan.data.store.keys.PlayerKeys;
|
import com.djrapitops.plan.data.store.keys.PlayerKeys;
|
||||||
import com.djrapitops.plan.utilities.html.Html;
|
import com.djrapitops.plan.utilities.html.Html;
|
||||||
import com.djrapitops.plugin.utilities.ArrayUtil;
|
import com.djrapitops.plugin.utilities.ArrayUtil;
|
||||||
import org.apache.commons.lang3.ArrayUtils;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
@ -67,7 +66,7 @@ class PluginPlayersTable extends TableContainer {
|
|||||||
if (players.isEmpty()) {
|
if (players.isEmpty()) {
|
||||||
addRow("No Players");
|
addRow("No Players");
|
||||||
} else {
|
} else {
|
||||||
Map<UUID, String[]> rows = getRows(pluginDataSet);
|
Map<UUID, Serializable[]> rows = getRows(pluginDataSet);
|
||||||
addValues(rows);
|
addValues(rows);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -89,7 +88,7 @@ class PluginPlayersTable extends TableContainer {
|
|||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addValues(Map<UUID, String[]> rows) {
|
private void addValues(Map<UUID, Serializable[]> rows) {
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for (PlayerContainer profile : players) {
|
for (PlayerContainer profile : players) {
|
||||||
if (i >= maxPlayers) {
|
if (i >= maxPlayers) {
|
||||||
@ -101,30 +100,28 @@ class PluginPlayersTable extends TableContainer {
|
|||||||
Html link = openPlayerPageInNewTab ? Html.LINK_EXTERNAL : Html.LINK;
|
Html link = openPlayerPageInNewTab ? Html.LINK_EXTERNAL : Html.LINK;
|
||||||
String linkHtml = link.parse(PlanAPI.getInstance().getPlayerInspectPageLink(name), name);
|
String linkHtml = link.parse(PlanAPI.getInstance().getPlayerInspectPageLink(name), name);
|
||||||
|
|
||||||
String[] playerData = ArrayUtil.merge(new String[]{linkHtml}, rows.getOrDefault(uuid, new String[]{}));
|
Serializable[] playerData = ArrayUtil.merge(new Serializable[]{linkHtml}, rows.getOrDefault(uuid, new Serializable[]{}));
|
||||||
addRow(ArrayUtils.addAll(playerData));
|
addRow(playerData);
|
||||||
|
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private Map<UUID, String[]> getRows(TreeMap<String, Map<UUID, ? extends Serializable>> data) {
|
private Map<UUID, Serializable[]> getRows(TreeMap<String, Map<UUID, ? extends Serializable>> data) {
|
||||||
Map<UUID, String[]> rows = new HashMap<>();
|
Map<UUID, Serializable[]> rows = new HashMap<>();
|
||||||
|
|
||||||
int size = header.length - 1;
|
int size = header.length - 1;
|
||||||
for (PlayerContainer profile : players) {
|
for (PlayerContainer profile : players) {
|
||||||
UUID uuid = profile.getUnsafe(PlayerKeys.UUID);
|
UUID uuid = profile.getUnsafe(PlayerKeys.UUID);
|
||||||
|
|
||||||
String[] row = new String[size];
|
Serializable[] row = new Serializable[size];
|
||||||
for (int i = 0; i < size; i++) {
|
for (int i = 0; i < size; i++) {
|
||||||
String label = header[i + 1];
|
String label = header[i + 1];
|
||||||
|
|
||||||
Map<UUID, ? extends Serializable> playerSpecificData = data.getOrDefault(label, new HashMap<>());
|
Map<UUID, ? extends Serializable> playerSpecificData = data.getOrDefault(label, new HashMap<>());
|
||||||
Serializable value = playerSpecificData.get(uuid);
|
Serializable value = playerSpecificData.get(uuid);
|
||||||
if (value != null) {
|
if (value != null) {
|
||||||
row[i] = value.toString();
|
row[i] = value;
|
||||||
} else {
|
|
||||||
row[i] = "-";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
rows.put(uuid, row);
|
rows.put(uuid, row);
|
||||||
|
Loading…
Reference in New Issue
Block a user