This commit is contained in:
boy0001
2015-08-09 19:58:29 +10:00
parent 051449157a
commit e28c68ee74
14 changed files with 113 additions and 49 deletions

View File

@ -254,13 +254,29 @@ public class PS {
}
// World generators:
ConfigurationSection section = config.getConfigurationSection("worlds");
final ConfigurationSection section = config.getConfigurationSection("worlds");
if (section != null) {
for (String world : section.getKeys(false)) {
if (world.equals("CheckingPlotSquaredGenerator")) {
continue;
}
if (BlockManager.manager.isWorld(world)) {
break;
IMP.setGenerator(world);
}
}
TaskManager.runTaskLater(new Runnable() {
@Override
public void run() {
for (String world : section.getKeys(false)) {
if (world.equals("CheckingPlotSquaredGenerator")) {
continue;
}
if (!BlockManager.manager.isWorld(world)) {
IMP.setGenerator(world);
}
}
}
}, 1);
}
// Copy files

View File

@ -62,7 +62,7 @@ import com.plotsquared.bukkit.util.BukkitUtil;
*
*/
@SuppressWarnings("unused") public class PlotAPI {
public class PlotAPI {
/**
* Permission that allows for admin access, this permission node will allow the player to use any part of the

View File

@ -25,6 +25,7 @@ import java.util.Collection;
import java.util.UUID;
import java.util.regex.Matcher;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.config.Settings;
import com.intellectualcrafters.plot.database.DBFunc;
@ -36,6 +37,7 @@ import com.intellectualcrafters.plot.object.PlotId;
import com.intellectualcrafters.plot.object.PlotInventory;
import com.intellectualcrafters.plot.object.PlotItemStack;
import com.intellectualcrafters.plot.object.PlotPlayer;
import com.intellectualcrafters.plot.object.PlotWorld;
import com.intellectualcrafters.plot.util.BlockManager;
import com.intellectualcrafters.plot.util.MainUtil;
import com.intellectualcrafters.plot.util.StringMan;

View File

@ -25,6 +25,7 @@ import java.util.Arrays;
import java.util.List;
import java.util.Map.Entry;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.config.ConfigurationNode;
import com.intellectualcrafters.plot.config.Settings;
@ -220,7 +221,11 @@ public class Setup extends SubCommand {
return false;
}
if (BlockManager.manager.isWorld(args[0])) {
MainUtil.sendMessage(plr, "&cThat world name is already taken!");
if (PS.get().isPlotWorld(args[0])) {
MainUtil.sendMessage(plr, "&cThat world name is already taken!");
return false;
}
MainUtil.sendMessage(plr, "&cThe world you specified already exists. After restarting, new terrain will use PlotSquared, however you may need to reset the world for it to generate correctly!");
}
object.world = args[0];
SetupUtils.setupMap.remove(name);

View File

@ -197,7 +197,7 @@ public enum C {
SETUP_STEP("$3[$1Step %s0$3] $1%s1 $2- $1Expecting: $2%s2 $1Default: $2%s3", "Setup"),
SETUP_INVALID_ARG("$2%s0 is not a valid argument for step %s1. To cancel setup use: $1/plot setup cancel", "Setup"),
SETUP_VALID_ARG("$2Value $1%s0 $2set to %s1", "Setup"),
SETUP_FINISHED("$3If you are using MULTIVERSE or MULTIWORLD the world should have just been created. Otherwise you will need to add the world manually through the bukkit.yml", "Setup"),
SETUP_FINISHED("$4You should have been teleported to the created world. Otherwise you will need to set the generator manually using the bukkit.yml or your chosen world management plugin.", "Setup"),
SETUP_WORLD_TAKEN("$2%s is already a registered plotworld", "Setup"),
SETUP_MISSING_WORLD("$2You need to specify a world name ($1/plot setup &l<world>$1 <generator>$2)&-$1Additional commands:&-$2 - $1/plot setup <value>&-$2 - $1/plot setup back&-$2 - $1/plot setup cancel", "Setup"),
SETUP_MISSING_GENERATOR("$2You need to specify a generator ($1/plot setup <world> &l<generator>&r$2)&-$1Additional commands:&-$2 - $1/plot setup <value>&-$2 - $1/plot setup back&-$2 - $1/plot setup cancel", "Setup"),

View File

@ -81,23 +81,12 @@ public class SQLManager implements AbstractDB {
public SQLManager(final Connection c, final String p) {
// Private final
this.connection = c;
try {
if (this.connection.getAutoCommit()) {
this.connection.setAutoCommit(false);
TaskManager.runTaskRepeat(new Runnable() {
@Override
public void run() {
commit();
}
TaskManager.runTaskRepeat(new Runnable() {
@Override
public void run() {
try {
SQLManager.this.connection.commit();
} catch (SQLException e) {
e.printStackTrace();
}
}
}, 200);
} catch (SQLException e) {
e.printStackTrace();
}
}, 200);
this.prefix = p;
// Set timout
// setTimout();
@ -671,6 +660,9 @@ public class SQLManager implements AbstractDB {
public void commit() {
try {
if (this.connection.getAutoCommit()) {
this.connection.setAutoCommit(false);
}
this.connection.commit();
} catch (SQLException e) {
e.printStackTrace();

View File

@ -53,16 +53,16 @@ public abstract class SquarePlotManager extends GridPlotManager {
int idx;
int idz;
if (x < 0) {
idx = ((x - 1)/size);
x = size + ((x - 1) % size);
idx = (x/size);
x = size + (x % size);
}
else {
idx = (x/size) + 1;
x = (x % size);
}
if (z < 0) {
idz = ((z - 1)/size);
z = size + ((z - 1) % size);
idz = (z/size);
z = size + (z % size);
}
else {
idz = (z/size) + 1;
@ -104,16 +104,16 @@ public abstract class SquarePlotManager extends GridPlotManager {
int rx;
int rz;
if (x < 0) {
dx = ((x - 1) / size);
rx = size + ((x - 1) % size);
dx = (x / size);
rx = size + (x % size);
}
else {
dx = (x/size) + 1;
rx = (x % size);
}
if (z < 0) {
dz = ((z - 1)/size);
rz = size + ((z - 1) % size);
dz = (z/size);
rz = size + (z % size);
}
else {
dz = (z/size) + 1;

View File

@ -32,6 +32,10 @@ public class MathMan {
};
}
public static int roundInt(double value) {
return (int) (value < 0 ? value - 1 : value);
}
/**
* Returns [ pitch, yaw ]
* @param x