Fixes cast exception

This commit is contained in:
Paulomart 2016-05-05 19:13:55 +02:00 committed by Matt
parent 421203a27d
commit 5d8492b675
5 changed files with 9 additions and 8 deletions

View File

@ -18,6 +18,7 @@ import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map.Entry;
@CommandDeclaration(
@ -30,7 +31,7 @@ import java.util.Map.Entry;
usage = "/plots database [area] <sqlite|mysql|import>")
public class Database extends SubCommand {
public static void insertPlots(final SQLManager manager, final ArrayList<Plot> plots, final PlotPlayer player) {
public static void insertPlots(final SQLManager manager, final List<Plot> plots, final PlotPlayer player) {
TaskManager.runTaskAsync(new Runnable() {
@Override
public void run() {
@ -61,7 +62,7 @@ public class Database extends SubCommand {
MainUtil.sendMessage(player, "/plot database [area] <sqlite|mysql|import>");
return false;
}
ArrayList<Plot> plots;
List<Plot> plots;
PlotArea area = PS.get().getPlotAreaByString(args[0]);
if (area != null) {
plots = PS.get().sortPlotsByTemp(area.getPlots());

View File

@ -92,7 +92,7 @@ public class Visit extends SubCommand {
sendMessage(player, C.NOT_VALID_NUMBER, "(1, " + unsorted.size() + ")");
return false;
}
ArrayList<Plot> plots = PS.get().sortPlotsByTemp(unsorted);
List<Plot> plots = PS.get().sortPlotsByTemp(unsorted);
Plot plot = plots.get(page - 1);
if (!plot.hasOwner()) {
if (!Permissions.hasPermission(player, "plots.visit.unowned")) {

View File

@ -36,7 +36,7 @@ public interface AbstractDB {
* @param plots Plots for which the default table entries should be created
* @param whenDone
*/
void createPlotsAndData(ArrayList<Plot> plots, Runnable whenDone);
void createPlotsAndData(List<Plot> plots, Runnable whenDone);
/**
* Create a plot

View File

@ -81,7 +81,7 @@ public class DBFunc {
*
* @param plots List containing all plot objects
*/
public static void createPlotsAndData(ArrayList<Plot> plots, Runnable whenDone) {
public static void createPlotsAndData(List<Plot> plots, Runnable whenDone) {
DBFunc.dbManager.createPlotsAndData(plots, whenDone);
}

View File

@ -436,7 +436,7 @@ public class SQLManager implements AbstractDB {
}
@Override
public void createPlotsAndData(final ArrayList<Plot> myList, final Runnable whenDone) {
public void createPlotsAndData(final List<Plot> myList, final Runnable whenDone) {
addGlobalTask(new Runnable() {
@Override
public void run() {
@ -580,7 +580,7 @@ public class SQLManager implements AbstractDB {
*
* @param myList list of plots to be created
*/
public void createPlots(ArrayList<Plot> myList, Runnable whenDone) {
public void createPlots(List<Plot> myList, Runnable whenDone) {
StmtMod<Plot> mod = new StmtMod<Plot>() {
@Override
public String getCreateMySQL(int size) {
@ -638,7 +638,7 @@ public class SQLManager implements AbstractDB {
setBulk(myList, mod, whenDone);
}
public <T> void setBulk(ArrayList<T> objList, StmtMod<T> mod, Runnable whenDone) {
public <T> void setBulk(List<T> objList, StmtMod<T> mod, Runnable whenDone) {
int size = objList.size();
if (size == 0) {
if (whenDone != null) {