Fixed compile warning in PluginPlayersTable

This commit is contained in:
Rsl1122 2019-01-08 11:10:50 +02:00
parent 2b4281ee53
commit ab99ed1976

View File

@ -24,7 +24,6 @@ import com.djrapitops.plan.data.store.containers.PlayerContainer;
import com.djrapitops.plan.data.store.keys.PlayerKeys;
import com.djrapitops.plan.utilities.html.Html;
import com.djrapitops.plugin.utilities.ArrayUtil;
import org.apache.commons.lang3.ArrayUtils;
import java.io.Serializable;
import java.util.*;
@ -67,7 +66,7 @@ class PluginPlayersTable extends TableContainer {
if (players.isEmpty()) {
addRow("No Players");
} else {
Map<UUID, String[]> rows = getRows(pluginDataSet);
Map<UUID, Serializable[]> rows = getRows(pluginDataSet);
addValues(rows);
}
}
@ -89,7 +88,7 @@ class PluginPlayersTable extends TableContainer {
return data;
}
private void addValues(Map<UUID, String[]> rows) {
private void addValues(Map<UUID, Serializable[]> rows) {
int i = 0;
for (PlayerContainer profile : players) {
if (i >= maxPlayers) {
@ -101,30 +100,28 @@ class PluginPlayersTable extends TableContainer {
Html link = openPlayerPageInNewTab ? Html.LINK_EXTERNAL : Html.LINK;
String linkHtml = link.parse(PlanAPI.getInstance().getPlayerInspectPageLink(name), name);
String[] playerData = ArrayUtil.merge(new String[]{linkHtml}, rows.getOrDefault(uuid, new String[]{}));
addRow(ArrayUtils.addAll(playerData));
Serializable[] playerData = ArrayUtil.merge(new Serializable[]{linkHtml}, rows.getOrDefault(uuid, new Serializable[]{}));
addRow(playerData);
i++;
}
}
private Map<UUID, String[]> getRows(TreeMap<String, Map<UUID, ? extends Serializable>> data) {
Map<UUID, String[]> rows = new HashMap<>();
private Map<UUID, Serializable[]> getRows(TreeMap<String, Map<UUID, ? extends Serializable>> data) {
Map<UUID, Serializable[]> rows = new HashMap<>();
int size = header.length - 1;
for (PlayerContainer profile : players) {
UUID uuid = profile.getUnsafe(PlayerKeys.UUID);
String[] row = new String[size];
Serializable[] row = new Serializable[size];
for (int i = 0; i < size; i++) {
String label = header[i + 1];
Map<UUID, ? extends Serializable> playerSpecificData = data.getOrDefault(label, new HashMap<>());
Serializable value = playerSpecificData.get(uuid);
if (value != null) {
row[i] = value.toString();
} else {
row[i] = "-";
row[i] = value;
}
}
rows.put(uuid, row);