Dieser Commit ist enthalten in:
sk89q 2014-04-04 16:09:05 -07:00
Ursprung e0fd804f70
Commit ae8becafdd
10 geänderte Dateien mit 37 neuen und 31 gelöschten Zeilen

Datei anzeigen

@ -246,7 +246,7 @@ public final class StringUtil {
int i; // iterates through s int i; // iterates through s
int j; // iterates through t int j; // iterates through t
char t_j; // jth character of t char tj; // jth character of t
int cost; // cost int cost; // cost
@ -255,11 +255,11 @@ public final class StringUtil {
} }
for (j = 1; j <= m; ++j) { for (j = 1; j <= m; ++j) {
t_j = t.charAt(j - 1); tj = t.charAt(j - 1);
d[0] = j; d[0] = j;
for (i = 1; i <= n; ++i) { for (i = 1; i <= n; ++i) {
cost = s.charAt(i - 1) == t_j ? 0 : 1; cost = s.charAt(i - 1) == tj ? 0 : 1;
// minimum of cell to the left+1, to the top+1, diagonally left // minimum of cell to the left+1, to the top+1, diagonally left
// and up +cost // and up +cost
d[i] = Math.min(Math.min(d[i - 1] + 1, p[i] + 1), p[i - 1] d[i] = Math.min(Math.min(d[i - 1] + 1, p[i] + 1), p[i - 1]

Datei anzeigen

@ -650,8 +650,8 @@ public class LocalSession {
* *
* @param CUIVersion * @param CUIVersion
*/ */
public void setCUIVersion(int CUIVersion) { public void setCUIVersion(int cuiVersion) {
this.cuiVersion = CUIVersion; this.cuiVersion = cuiVersion;
} }
/** /**

Datei anzeigen

@ -818,7 +818,7 @@ public class WorldEdit {
return false; return false;
} }
if (!player.hasPermission("worldedit.navigation.jumpto.tool") ){ if (!player.hasPermission("worldedit.navigation.jumpto.tool")) {
return false; return false;
} }

Datei anzeigen

@ -209,16 +209,16 @@ public final class Operators {
} }
// Usable AlmostEqual function, based on http://www.cygnus-software.com/papers/comparingfloats/comparingfloats.htm // Usable AlmostEqual function, based on http://www.cygnus-software.com/papers/comparingfloats/comparingfloats.htm
private static boolean almostEqual2sComplement(double A, double B, long maxUlps) { private static boolean almostEqual2sComplement(double a, double b, long maxUlps) {
// Make sure maxUlps is non-negative and small enough that the // Make sure maxUlps is non-negative and small enough that the
// default NAN won't compare as equal to anything. // default NAN won't compare as equal to anything.
//assert(maxUlps > 0 && maxUlps < 4 * 1024 * 1024); // this is for floats, not doubles //assert(maxUlps > 0 && maxUlps < 4 * 1024 * 1024); // this is for floats, not doubles
long aLong = Double.doubleToRawLongBits(A); long aLong = Double.doubleToRawLongBits(a);
// Make aLong lexicographically ordered as a twos-complement long // Make aLong lexicographically ordered as a twos-complement long
if (aLong < 0) aLong = 0x8000000000000000L - aLong; if (aLong < 0) aLong = 0x8000000000000000L - aLong;
long bLong = Double.doubleToRawLongBits(B); long bLong = Double.doubleToRawLongBits(b);
// Make bLong lexicographically ordered as a twos-complement long // Make bLong lexicographically ordered as a twos-complement long
if (bLong < 0) bLong = 0x8000000000000000L - bLong; if (bLong < 0) bLong = 0x8000000000000000L - bLong;

Datei anzeigen

@ -136,7 +136,7 @@ public class Switch extends Node implements RValue {
} }
boolean breakDetected = false; boolean breakDetected = false;
for (int i = index; i < caseStatements.length && !breakDetected ; ++i) { for (int i = index; i < caseStatements.length && !breakDetected; ++i) {
final RValue invokable = caseStatements[i].optimize(); final RValue invokable = caseStatements[i].optimize();
if (invokable instanceof Sequence) { if (invokable instanceof Sequence) {

Datei anzeigen

@ -37,6 +37,12 @@ public final class DocumentationPrinter {
private DocumentationPrinter() { private DocumentationPrinter() {
} }
/**
* Generates documentation.
*
* @param args arguments
* @throws IOException thrown on I/O error
*/
public static void main(String[] args) throws IOException { public static void main(String[] args) throws IOException {
File commandsDir = new File(args[0]); File commandsDir = new File(args[0]);
@ -96,7 +102,7 @@ public final class DocumentationPrinter {
try { try {
stream = new FileOutputStream("wiki_permissions.txt"); stream = new FileOutputStream("wiki_permissions.txt");
PrintStream print = new PrintStream(stream); PrintStream print = new PrintStream(stream);
_writePermissionsWikiTable(print, commandClasses, "/"); writePermissionsWikiTable(print, commandClasses, "/");
} finally { } finally {
if (stream != null) { if (stream != null) {
stream.close(); stream.close();
@ -104,8 +110,8 @@ public final class DocumentationPrinter {
} }
} }
private static void _writePermissionsWikiTable(PrintStream stream, private static void writePermissionsWikiTable(PrintStream stream,
List<Class<?>> commandClasses, String prefix) { List<Class<?>> commandClasses, String prefix) {
for (Class<?> cls : commandClasses) { for (Class<?> cls : commandClasses) {
for (Method method : cls.getMethods()) { for (Method method : cls.getMethods()) {
@ -162,7 +168,7 @@ public final class DocumentationPrinter {
method.getAnnotation(NestedCommand.class); method.getAnnotation(NestedCommand.class);
Class<?>[] nestedClasses = nested.value(); Class<?>[] nestedClasses = nested.value();
_writePermissionsWikiTable(stream, writePermissionsWikiTable(stream,
Arrays.asList(nestedClasses), Arrays.asList(nestedClasses),
prefix + cmd.aliases()[0] + " "); prefix + cmd.aliases()[0] + " ");
} }
@ -176,7 +182,7 @@ public final class DocumentationPrinter {
try { try {
stream = new FileOutputStream("plugin.yml"); stream = new FileOutputStream("plugin.yml");
PrintStream print = new PrintStream(stream); PrintStream print = new PrintStream(stream);
_writeBukkitYAML(print); writeBukkitYAML(print);
} finally { } finally {
if (stream != null) { if (stream != null) {
stream.close(); stream.close();
@ -184,7 +190,7 @@ public final class DocumentationPrinter {
} }
} }
private static void _writeBukkitYAML(PrintStream stream) { private static void writeBukkitYAML(PrintStream stream) {
stream.println("name: WorldEdit"); stream.println("name: WorldEdit");
stream.println("main: com.sk89q.worldedit.bukkit.WorldEditPlugin"); stream.println("main: com.sk89q.worldedit.bukkit.WorldEditPlugin");

Datei anzeigen

@ -128,8 +128,8 @@ public class HeightMap {
int newHeight = Math.min(maxY, data[index]); int newHeight = Math.min(maxY, data[index]);
// Offset x,z to be 'real' coordinates // Offset x,z to be 'real' coordinates
int X = x + originX; int xr = x + originX;
int Z = z + originZ; int zr = z + originZ;
// We are keeping the topmost blocks so take that in account for the scale // We are keeping the topmost blocks so take that in account for the scale
double scale = (double) (curHeight - originY) / (double) (newHeight - originY); double scale = (double) (curHeight - originY) / (double) (newHeight - originY);
@ -137,18 +137,18 @@ public class HeightMap {
// Depending on growing or shrinking we need to start at the bottom or top // Depending on growing or shrinking we need to start at the bottom or top
if (newHeight > curHeight) { if (newHeight > curHeight) {
// Set the top block of the column to be the same type (this might go wrong with rounding) // Set the top block of the column to be the same type (this might go wrong with rounding)
BaseBlock existing = session.getBlock(new Vector(X, curHeight, Z)); BaseBlock existing = session.getBlock(new Vector(xr, curHeight, zr));
// Skip water/lava // Skip water/lava
if (existing.getType() != BlockID.WATER && existing.getType() != BlockID.STATIONARY_WATER if (existing.getType() != BlockID.WATER && existing.getType() != BlockID.STATIONARY_WATER
&& existing.getType() != BlockID.LAVA && existing.getType() != BlockID.STATIONARY_LAVA) { && existing.getType() != BlockID.LAVA && existing.getType() != BlockID.STATIONARY_LAVA) {
session.setBlock(new Vector(X, newHeight, Z), existing); session.setBlock(new Vector(xr, newHeight, zr), existing);
++blocksChanged; ++blocksChanged;
// Grow -- start from 1 below top replacing airblocks // Grow -- start from 1 below top replacing airblocks
for (int y = newHeight - 1 - originY; y >= 0; --y) { for (int y = newHeight - 1 - originY; y >= 0; --y) {
int copyFrom = (int) (y * scale); int copyFrom = (int) (y * scale);
session.setBlock(new Vector(X, originY + y, Z), session.getBlock(new Vector(X, originY + copyFrom, Z))); session.setBlock(new Vector(xr, originY + y, zr), session.getBlock(new Vector(xr, originY + copyFrom, zr)));
++blocksChanged; ++blocksChanged;
} }
} }
@ -156,18 +156,18 @@ public class HeightMap {
// Shrink -- start from bottom // Shrink -- start from bottom
for (int y = 0; y < newHeight - originY; ++y) { for (int y = 0; y < newHeight - originY; ++y) {
int copyFrom = (int) (y * scale); int copyFrom = (int) (y * scale);
session.setBlock(new Vector(X, originY + y, Z), session.getBlock(new Vector(X, originY + copyFrom, Z))); session.setBlock(new Vector(xr, originY + y, zr), session.getBlock(new Vector(xr, originY + copyFrom, zr)));
++blocksChanged; ++blocksChanged;
} }
// Set the top block of the column to be the same type // Set the top block of the column to be the same type
// (this could otherwise go wrong with rounding) // (this could otherwise go wrong with rounding)
session.setBlock(new Vector(X, newHeight, Z), session.getBlock(new Vector(X, curHeight, Z))); session.setBlock(new Vector(xr, newHeight, zr), session.getBlock(new Vector(xr, curHeight, zr)));
++blocksChanged; ++blocksChanged;
// Fill rest with air // Fill rest with air
for (int y = newHeight + 1; y <= curHeight; ++y) { for (int y = newHeight + 1; y <= curHeight; ++y) {
session.setBlock(new Vector(X, y, Z), fillerAir); session.setBlock(new Vector(xr, y, zr), fillerAir);
++blocksChanged; ++blocksChanged;
} }
} }

Datei anzeigen

@ -47,7 +47,7 @@ public class TreeGenerator {
return true; return true;
} }
}, },
RANDOM_REDWOOD("Random redwood", "randredwood", "randomredwood", "anyredwood" ) { RANDOM_REDWOOD("Random redwood", "randredwood", "randomredwood", "anyredwood") {
public boolean generate(EditSession editSession, Vector pos) throws MaxChangedBlocksException { public boolean generate(EditSession editSession, Vector pos) throws MaxChangedBlocksException {
TreeType[] choices = new TreeType[] { TreeType[] choices = new TreeType[] {
TreeType.REDWOOD, TreeType.TALL_REDWOOD TreeType.REDWOOD, TreeType.TALL_REDWOOD
@ -70,7 +70,7 @@ public class TreeGenerator {
DARK_OAK("Dark Oak", "darkoak"), DARK_OAK("Dark Oak", "darkoak"),
MEGA_REDWOOD("Mega Redwood", "megaredwood"), MEGA_REDWOOD("Mega Redwood", "megaredwood"),
TALL_BIRCH("Tall Birch", "tallbirch"), TALL_BIRCH("Tall Birch", "tallbirch"),
RANDOM("Random", "rand", "random" ) { RANDOM("Random", "rand", "random") {
public boolean generate(EditSession editSession, Vector pos) throws MaxChangedBlocksException { public boolean generate(EditSession editSession, Vector pos) throws MaxChangedBlocksException {
TreeType[] choices = new TreeType[] { TreeType[] choices = new TreeType[] {
TreeType.TREE, TreeType.BIG_TREE, TreeType.BIRCH, TreeType.TREE, TreeType.BIG_TREE, TreeType.BIRCH,

Datei anzeigen

@ -60,9 +60,9 @@ public class OldChunk implements Chunk {
blocks = NBTUtils.getChildTag(rootTag.getValue(), "Blocks", ByteArrayTag.class).getValue(); blocks = NBTUtils.getChildTag(rootTag.getValue(), "Blocks", ByteArrayTag.class).getValue();
data = NBTUtils.getChildTag( rootTag.getValue(), "Data", ByteArrayTag.class).getValue(); data = NBTUtils.getChildTag(rootTag.getValue(), "Data", ByteArrayTag.class).getValue();
rootX = NBTUtils.getChildTag( rootTag.getValue(), "xPos", IntTag.class).getValue(); rootX = NBTUtils.getChildTag(rootTag.getValue(), "xPos", IntTag.class).getValue();
rootZ = NBTUtils.getChildTag( rootTag.getValue(), "zPos", IntTag.class).getValue(); rootZ = NBTUtils.getChildTag(rootTag.getValue(), "zPos", IntTag.class).getValue();
int size = 16 * 16 * 128; int size = 16 * 16 * 128;
if (blocks.length != size) { if (blocks.length != size) {

Datei anzeigen

@ -68,7 +68,7 @@ public class Snapshot implements Comparable<Snapshot> {
* @throws DataException * @throws DataException
*/ */
public ChunkStore getChunkStore() throws IOException, DataException { public ChunkStore getChunkStore() throws IOException, DataException {
ChunkStore chunkStore = _getChunkStore(); ChunkStore chunkStore = internalGetChunkStore();
logger.info("WorldEdit: Using " + chunkStore.getClass().getCanonicalName() logger.info("WorldEdit: Using " + chunkStore.getClass().getCanonicalName()
+ " for loading snapshot '" + file.getAbsolutePath() + "'"); + " for loading snapshot '" + file.getAbsolutePath() + "'");
@ -83,7 +83,7 @@ public class Snapshot implements Comparable<Snapshot> {
* @throws IOException * @throws IOException
* @throws DataException * @throws DataException
*/ */
public ChunkStore _getChunkStore() throws IOException, DataException { private ChunkStore internalGetChunkStore() throws IOException, DataException {
if (file.getName().toLowerCase().endsWith(".zip")) { if (file.getName().toLowerCase().endsWith(".zip")) {
try { try {
ChunkStore chunkStore = new TrueZipMcRegionChunkStore(file); ChunkStore chunkStore = new TrueZipMcRegionChunkStore(file);