mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-25 22:56:45 +01:00
fixed road schematics / removed useless tests
This commit is contained in:
parent
c5d0f4c92b
commit
41d3283bbb
@ -232,6 +232,12 @@ public class HybridPlotWorld extends PlotWorld {
|
||||
short h2 = (short) d2.getY();
|
||||
this.SCHEMATIC_HEIGHT = (short) Math.max(h2, h1);
|
||||
|
||||
int shift = (int) Math.floor(this.ROAD_WIDTH / 2);
|
||||
int oddshift = 0;
|
||||
if (this.ROAD_WIDTH % 2 != 0) {
|
||||
oddshift = 1;
|
||||
}
|
||||
|
||||
for (short x = 0; x < w1; x++) {
|
||||
for (short z = 0; z < l1; z++) {
|
||||
for (short y = 0; y < h1; y++) {
|
||||
@ -241,8 +247,8 @@ public class HybridPlotWorld extends PlotWorld {
|
||||
byte data = blocks1[index].getData();
|
||||
|
||||
if (id != 0) {
|
||||
addOverlayBlock((short) (x - this.PATH_WIDTH_LOWER), (short) (y + this.OFFSET), (short) (z + this.PATH_WIDTH_LOWER + 1), id, data, false);
|
||||
addOverlayBlock((short) (z + this.PATH_WIDTH_LOWER + 1), (short) (y + this.OFFSET), (short) (x - this.PATH_WIDTH_LOWER), id, data, true);
|
||||
addOverlayBlock((short) (x - (shift)), (short) (y + this.OFFSET), (short) (z + shift + oddshift), id, data, false);
|
||||
addOverlayBlock((short) (z + shift + oddshift), (short) (y + this.OFFSET), (short) (x - shift), id, data, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -255,7 +261,7 @@ public class HybridPlotWorld extends PlotWorld {
|
||||
short id = blocks2[index].getBlock();
|
||||
byte data = blocks2[index].getData();
|
||||
if (id != 0) {
|
||||
addOverlayBlock((short) (x - this.PATH_WIDTH_LOWER), (short) (y + this.OFFSET), (short) (z - this.PATH_WIDTH_LOWER), id, data, false);
|
||||
addOverlayBlock((short) (x - shift), (short) (y + this.OFFSET), (short) (z - shift), id, data, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,325 +0,0 @@
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.block.Biome;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
import com.intellectualcrafters.plot.PlotMain;
|
||||
import com.intellectualcrafters.plot.config.Settings;
|
||||
import com.intellectualcrafters.plot.database.AbstractDB;
|
||||
import com.intellectualcrafters.plot.database.DBFunc;
|
||||
import com.intellectualcrafters.plot.flag.Flag;
|
||||
import com.intellectualcrafters.plot.generator.HybridPlotManager;
|
||||
import com.intellectualcrafters.plot.generator.HybridPlotWorld;
|
||||
import com.intellectualcrafters.plot.object.Plot;
|
||||
import com.intellectualcrafters.plot.object.PlotComment;
|
||||
import com.intellectualcrafters.plot.object.PlotId;
|
||||
import com.intellectualcrafters.plot.object.PlotManager;
|
||||
import com.intellectualcrafters.plot.object.PlotWorld;
|
||||
import com.intellectualcrafters.plot.util.PlotHelper;
|
||||
import com.intellectualcrafters.plot.util.SetBlockFast;
|
||||
|
||||
public class Test1 {
|
||||
|
||||
static Integer count = 0;
|
||||
|
||||
// I have no idea what I should actually test :p
|
||||
|
||||
public boolean nextTest() {
|
||||
Test1.count++;
|
||||
switch (Test1.count) {
|
||||
case 1:
|
||||
return test1_Square();
|
||||
case 2:
|
||||
return true; // test2_InitMain(); // fails
|
||||
case 3:
|
||||
return test3_InitPlotId();
|
||||
case 4:
|
||||
return test4_InitPlot();
|
||||
case 5:
|
||||
return test5_InitDBFunc();
|
||||
case 6:
|
||||
return true; // test6_Plots(); // fails
|
||||
case 7:
|
||||
return true; // test7_OnEnable(); // fails
|
||||
case 8:
|
||||
return true; // test8_AddPlotWorld(); // fails
|
||||
case 9:
|
||||
return true; // test9_CanSetFast(); // fails
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Test
|
||||
public void t1() {
|
||||
Assert.assertTrue(nextTest());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void t2() {
|
||||
Assert.assertTrue(nextTest());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void t3() {
|
||||
Assert.assertTrue(nextTest());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void t4() {
|
||||
Assert.assertTrue(nextTest());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void t5() {
|
||||
Assert.assertTrue(nextTest());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void t6() {
|
||||
Assert.assertTrue(nextTest());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void t7() {
|
||||
Assert.assertTrue(nextTest());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void t8() {
|
||||
Assert.assertTrue(nextTest());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void t9() {
|
||||
Assert.assertTrue(nextTest());
|
||||
}
|
||||
|
||||
public boolean test1_Square() {
|
||||
return PlotHelper.square(5) == 25;
|
||||
}
|
||||
|
||||
public boolean test2_InitMain() {
|
||||
boolean passed = false;
|
||||
try {
|
||||
final PlotMain plugin = PlotMain.getMain();
|
||||
passed = plugin != null;
|
||||
} catch (final Throwable e) {
|
||||
|
||||
}
|
||||
return passed;
|
||||
}
|
||||
|
||||
public boolean test3_InitPlotId() {
|
||||
boolean passed = false;
|
||||
try {
|
||||
final Object id = new PlotId(0, 0);
|
||||
passed = id != null;
|
||||
} catch (final Throwable e) {
|
||||
|
||||
}
|
||||
return passed;
|
||||
}
|
||||
|
||||
public boolean test4_InitPlot() {
|
||||
boolean passed = false;
|
||||
try {
|
||||
new Plot(new PlotId(0, 0), DBFunc.everyone, Biome.FOREST, new ArrayList<UUID>(), new ArrayList<UUID>(), new ArrayList<UUID>(), null, null, null, "testworld", new boolean[]{false, false, false, false});
|
||||
passed = true;
|
||||
} catch (final Throwable ignored) {
|
||||
|
||||
}
|
||||
return passed;
|
||||
}
|
||||
|
||||
public boolean test5_InitDBFunc() {
|
||||
|
||||
Settings.DB.USE_MONGO = true;
|
||||
Settings.DB.USE_MYSQL = false;
|
||||
Settings.DB.USE_SQLITE = false;
|
||||
|
||||
boolean passed = false;
|
||||
try {
|
||||
DBFunc.dbManager = new AbstractDB() {
|
||||
|
||||
@Override
|
||||
public void setTrusted(final String world, final Plot plot, final UUID uuid) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPosition(final String world, final Plot plot, final String position) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOwner(final Plot plot, final UUID uuid) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMerged(final String world, final Plot plot, final boolean[] merged) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setHelper(final String world, final Plot plot, final UUID uuid) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDenied(final String world, final Plot plot, final UUID uuid) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setComment(final String world, final Plot plot, final PlotComment comment) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAlias(final String world, final Plot plot, final String alias) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeTrusted(final String world, final Plot plot, final UUID uuid) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeHelper(final String world, final Plot plot, final UUID uuid) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeDenied(final String world, final Plot plot, final UUID uuid) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeComment(final String world, final Plot plot, final PlotComment comment) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public HashMap<String, Object> getSettings(final int id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getRatings(final Plot plot) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LinkedHashMap<String, HashMap<PlotId, Plot>> getPlots() {
|
||||
final LinkedHashMap<String, HashMap<PlotId, Plot>> plots = new LinkedHashMap<String, HashMap<PlotId, Plot>>();
|
||||
|
||||
plots.put("testworld", new HashMap<PlotId, Plot>());
|
||||
|
||||
final PlotId id = new PlotId(0, 0);
|
||||
|
||||
plots.get("testworld").put(id, new Plot(id, DBFunc.everyone, new ArrayList<UUID>(), new ArrayList<UUID>(), new ArrayList<UUID>(), null, null, null, "testworld", new boolean[]{false, false, false, false}));
|
||||
|
||||
return plots;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getId(final String world, final PlotId id2) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delete(final String world, final Plot plot) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createTables(final String database, final boolean add_constraint) throws Exception {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createPlots(final ArrayList<Plot> plots) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createPlotSettings(final int id, final Plot plot) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createPlot(final Plot plot) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createAllSettingsAndHelpers(final ArrayList<Plot> plots) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createPlotAndSettings(Plot plot) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFlags(String world, Plot plot, Set<Flag> flags) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void purgeIds(String world, Set<Integer> uniqueIds) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void purge(String world, Set<PlotId> plotIds) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<PlotComment> getComments(String world, Plot plot, int tier, boolean below) {
|
||||
return null;
|
||||
}
|
||||
};
|
||||
passed = true;
|
||||
} catch (final Throwable e) {
|
||||
|
||||
}
|
||||
return passed;
|
||||
}
|
||||
|
||||
public boolean test6_Plots() {
|
||||
return PlotMain.getAllPlotsRaw() != null;
|
||||
}
|
||||
|
||||
public boolean test7_OnEnable() {
|
||||
boolean passed = false;
|
||||
try {
|
||||
PlotMain.getMain().onEnable();
|
||||
passed = true;
|
||||
} catch (final Throwable e) {
|
||||
|
||||
}
|
||||
return passed;
|
||||
}
|
||||
|
||||
public boolean test8_AddPlotWorld() {
|
||||
boolean passed = false;
|
||||
try {
|
||||
final PlotWorld plotworld = new HybridPlotWorld("poop");
|
||||
final PlotManager manager = new HybridPlotManager();
|
||||
PlotMain.addPlotWorld("poop", plotworld, manager);
|
||||
passed = (PlotMain.getPlotManager("poop") != null) && (PlotMain.getWorldSettings("poop") != null);
|
||||
} catch (final Throwable e) {
|
||||
|
||||
}
|
||||
return passed;
|
||||
}
|
||||
|
||||
public boolean test9_CanSetFast() {
|
||||
boolean passed = false;
|
||||
try {
|
||||
new SetBlockFast();
|
||||
passed = true;
|
||||
} catch (final Throwable e) {
|
||||
|
||||
}
|
||||
return passed;
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user