mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-22 21:26:45 +01:00
Fixes cast exception
This commit is contained in:
parent
421203a27d
commit
5d8492b675
@ -18,6 +18,7 @@ import java.sql.SQLException;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
@CommandDeclaration(
|
@CommandDeclaration(
|
||||||
@ -30,7 +31,7 @@ import java.util.Map.Entry;
|
|||||||
usage = "/plots database [area] <sqlite|mysql|import>")
|
usage = "/plots database [area] <sqlite|mysql|import>")
|
||||||
public class Database extends SubCommand {
|
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() {
|
TaskManager.runTaskAsync(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
@ -61,7 +62,7 @@ public class Database extends SubCommand {
|
|||||||
MainUtil.sendMessage(player, "/plot database [area] <sqlite|mysql|import>");
|
MainUtil.sendMessage(player, "/plot database [area] <sqlite|mysql|import>");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
ArrayList<Plot> plots;
|
List<Plot> plots;
|
||||||
PlotArea area = PS.get().getPlotAreaByString(args[0]);
|
PlotArea area = PS.get().getPlotAreaByString(args[0]);
|
||||||
if (area != null) {
|
if (area != null) {
|
||||||
plots = PS.get().sortPlotsByTemp(area.getPlots());
|
plots = PS.get().sortPlotsByTemp(area.getPlots());
|
||||||
|
@ -92,7 +92,7 @@ public class Visit extends SubCommand {
|
|||||||
sendMessage(player, C.NOT_VALID_NUMBER, "(1, " + unsorted.size() + ")");
|
sendMessage(player, C.NOT_VALID_NUMBER, "(1, " + unsorted.size() + ")");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
ArrayList<Plot> plots = PS.get().sortPlotsByTemp(unsorted);
|
List<Plot> plots = PS.get().sortPlotsByTemp(unsorted);
|
||||||
Plot plot = plots.get(page - 1);
|
Plot plot = plots.get(page - 1);
|
||||||
if (!plot.hasOwner()) {
|
if (!plot.hasOwner()) {
|
||||||
if (!Permissions.hasPermission(player, "plots.visit.unowned")) {
|
if (!Permissions.hasPermission(player, "plots.visit.unowned")) {
|
||||||
|
@ -36,7 +36,7 @@ public interface AbstractDB {
|
|||||||
* @param plots Plots for which the default table entries should be created
|
* @param plots Plots for which the default table entries should be created
|
||||||
* @param whenDone
|
* @param whenDone
|
||||||
*/
|
*/
|
||||||
void createPlotsAndData(ArrayList<Plot> plots, Runnable whenDone);
|
void createPlotsAndData(List<Plot> plots, Runnable whenDone);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a plot
|
* Create a plot
|
||||||
|
@ -81,7 +81,7 @@ public class DBFunc {
|
|||||||
*
|
*
|
||||||
* @param plots List containing all plot objects
|
* @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);
|
DBFunc.dbManager.createPlotsAndData(plots, whenDone);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -436,7 +436,7 @@ public class SQLManager implements AbstractDB {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void createPlotsAndData(final ArrayList<Plot> myList, final Runnable whenDone) {
|
public void createPlotsAndData(final List<Plot> myList, final Runnable whenDone) {
|
||||||
addGlobalTask(new Runnable() {
|
addGlobalTask(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
@ -580,7 +580,7 @@ public class SQLManager implements AbstractDB {
|
|||||||
*
|
*
|
||||||
* @param myList list of plots to be created
|
* @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>() {
|
StmtMod<Plot> mod = new StmtMod<Plot>() {
|
||||||
@Override
|
@Override
|
||||||
public String getCreateMySQL(int size) {
|
public String getCreateMySQL(int size) {
|
||||||
@ -638,7 +638,7 @@ public class SQLManager implements AbstractDB {
|
|||||||
setBulk(myList, mod, whenDone);
|
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();
|
int size = objList.size();
|
||||||
if (size == 0) {
|
if (size == 0) {
|
||||||
if (whenDone != null) {
|
if (whenDone != null) {
|
||||||
|
Loading…
Reference in New Issue
Block a user