mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2024-12-23 01:37:37 +00:00
Code cleanup.
This commit is contained in:
parent
e0fd804f70
commit
ae8becafdd
@ -246,7 +246,7 @@ public final class StringUtil {
|
||||
int i; // iterates through s
|
||||
int j; // iterates through t
|
||||
|
||||
char t_j; // jth character of t
|
||||
char tj; // jth character of t
|
||||
|
||||
int cost; // cost
|
||||
|
||||
@ -255,11 +255,11 @@ public final class StringUtil {
|
||||
}
|
||||
|
||||
for (j = 1; j <= m; ++j) {
|
||||
t_j = t.charAt(j - 1);
|
||||
tj = t.charAt(j - 1);
|
||||
d[0] = j;
|
||||
|
||||
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
|
||||
// and up +cost
|
||||
d[i] = Math.min(Math.min(d[i - 1] + 1, p[i] + 1), p[i - 1]
|
||||
|
@ -650,8 +650,8 @@ public class LocalSession {
|
||||
*
|
||||
* @param CUIVersion
|
||||
*/
|
||||
public void setCUIVersion(int CUIVersion) {
|
||||
this.cuiVersion = CUIVersion;
|
||||
public void setCUIVersion(int cuiVersion) {
|
||||
this.cuiVersion = cuiVersion;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -818,7 +818,7 @@ public class WorldEdit {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!player.hasPermission("worldedit.navigation.jumpto.tool") ){
|
||||
if (!player.hasPermission("worldedit.navigation.jumpto.tool")) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -209,16 +209,16 @@ public final class Operators {
|
||||
}
|
||||
|
||||
// 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
|
||||
// default NAN won't compare as equal to anything.
|
||||
//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
|
||||
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
|
||||
if (bLong < 0) bLong = 0x8000000000000000L - bLong;
|
||||
|
||||
|
@ -136,7 +136,7 @@ public class Switch extends Node implements RValue {
|
||||
}
|
||||
|
||||
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();
|
||||
|
||||
if (invokable instanceof Sequence) {
|
||||
|
@ -37,6 +37,12 @@ public final class DocumentationPrinter {
|
||||
private DocumentationPrinter() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates documentation.
|
||||
*
|
||||
* @param args arguments
|
||||
* @throws IOException thrown on I/O error
|
||||
*/
|
||||
public static void main(String[] args) throws IOException {
|
||||
File commandsDir = new File(args[0]);
|
||||
|
||||
@ -96,7 +102,7 @@ public final class DocumentationPrinter {
|
||||
try {
|
||||
stream = new FileOutputStream("wiki_permissions.txt");
|
||||
PrintStream print = new PrintStream(stream);
|
||||
_writePermissionsWikiTable(print, commandClasses, "/");
|
||||
writePermissionsWikiTable(print, commandClasses, "/");
|
||||
} finally {
|
||||
if (stream != null) {
|
||||
stream.close();
|
||||
@ -104,7 +110,7 @@ public final class DocumentationPrinter {
|
||||
}
|
||||
}
|
||||
|
||||
private static void _writePermissionsWikiTable(PrintStream stream,
|
||||
private static void writePermissionsWikiTable(PrintStream stream,
|
||||
List<Class<?>> commandClasses, String prefix) {
|
||||
|
||||
for (Class<?> cls : commandClasses) {
|
||||
@ -162,7 +168,7 @@ public final class DocumentationPrinter {
|
||||
method.getAnnotation(NestedCommand.class);
|
||||
|
||||
Class<?>[] nestedClasses = nested.value();
|
||||
_writePermissionsWikiTable(stream,
|
||||
writePermissionsWikiTable(stream,
|
||||
Arrays.asList(nestedClasses),
|
||||
prefix + cmd.aliases()[0] + " ");
|
||||
}
|
||||
@ -176,7 +182,7 @@ public final class DocumentationPrinter {
|
||||
try {
|
||||
stream = new FileOutputStream("plugin.yml");
|
||||
PrintStream print = new PrintStream(stream);
|
||||
_writeBukkitYAML(print);
|
||||
writeBukkitYAML(print);
|
||||
} finally {
|
||||
if (stream != null) {
|
||||
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("main: com.sk89q.worldedit.bukkit.WorldEditPlugin");
|
||||
|
@ -128,8 +128,8 @@ public class HeightMap {
|
||||
int newHeight = Math.min(maxY, data[index]);
|
||||
|
||||
// Offset x,z to be 'real' coordinates
|
||||
int X = x + originX;
|
||||
int Z = z + originZ;
|
||||
int xr = x + originX;
|
||||
int zr = z + originZ;
|
||||
|
||||
// We are keeping the topmost blocks so take that in account for the scale
|
||||
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
|
||||
if (newHeight > curHeight) {
|
||||
// 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
|
||||
if (existing.getType() != BlockID.WATER && existing.getType() != BlockID.STATIONARY_WATER
|
||||
&& 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;
|
||||
|
||||
// Grow -- start from 1 below top replacing airblocks
|
||||
for (int y = newHeight - 1 - originY; y >= 0; --y) {
|
||||
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;
|
||||
}
|
||||
}
|
||||
@ -156,18 +156,18 @@ public class HeightMap {
|
||||
// Shrink -- start from bottom
|
||||
for (int y = 0; y < newHeight - originY; ++y) {
|
||||
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;
|
||||
}
|
||||
|
||||
// Set the top block of the column to be the same type
|
||||
// (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;
|
||||
|
||||
// Fill rest with air
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
@ -47,7 +47,7 @@ public class TreeGenerator {
|
||||
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 {
|
||||
TreeType[] choices = new TreeType[] {
|
||||
TreeType.REDWOOD, TreeType.TALL_REDWOOD
|
||||
@ -70,7 +70,7 @@ public class TreeGenerator {
|
||||
DARK_OAK("Dark Oak", "darkoak"),
|
||||
MEGA_REDWOOD("Mega Redwood", "megaredwood"),
|
||||
TALL_BIRCH("Tall Birch", "tallbirch"),
|
||||
RANDOM("Random", "rand", "random" ) {
|
||||
RANDOM("Random", "rand", "random") {
|
||||
public boolean generate(EditSession editSession, Vector pos) throws MaxChangedBlocksException {
|
||||
TreeType[] choices = new TreeType[] {
|
||||
TreeType.TREE, TreeType.BIG_TREE, TreeType.BIRCH,
|
||||
|
@ -60,9 +60,9 @@ public class OldChunk implements Chunk {
|
||||
|
||||
|
||||
blocks = NBTUtils.getChildTag(rootTag.getValue(), "Blocks", ByteArrayTag.class).getValue();
|
||||
data = NBTUtils.getChildTag( rootTag.getValue(), "Data", ByteArrayTag.class).getValue();
|
||||
rootX = NBTUtils.getChildTag( rootTag.getValue(), "xPos", IntTag.class).getValue();
|
||||
rootZ = NBTUtils.getChildTag( rootTag.getValue(), "zPos", IntTag.class).getValue();
|
||||
data = NBTUtils.getChildTag(rootTag.getValue(), "Data", ByteArrayTag.class).getValue();
|
||||
rootX = NBTUtils.getChildTag(rootTag.getValue(), "xPos", IntTag.class).getValue();
|
||||
rootZ = NBTUtils.getChildTag(rootTag.getValue(), "zPos", IntTag.class).getValue();
|
||||
|
||||
int size = 16 * 16 * 128;
|
||||
if (blocks.length != size) {
|
||||
|
@ -68,7 +68,7 @@ public class Snapshot implements Comparable<Snapshot> {
|
||||
* @throws DataException
|
||||
*/
|
||||
public ChunkStore getChunkStore() throws IOException, DataException {
|
||||
ChunkStore chunkStore = _getChunkStore();
|
||||
ChunkStore chunkStore = internalGetChunkStore();
|
||||
|
||||
logger.info("WorldEdit: Using " + chunkStore.getClass().getCanonicalName()
|
||||
+ " for loading snapshot '" + file.getAbsolutePath() + "'");
|
||||
@ -83,7 +83,7 @@ public class Snapshot implements Comparable<Snapshot> {
|
||||
* @throws IOException
|
||||
* @throws DataException
|
||||
*/
|
||||
public ChunkStore _getChunkStore() throws IOException, DataException {
|
||||
private ChunkStore internalGetChunkStore() throws IOException, DataException {
|
||||
if (file.getName().toLowerCase().endsWith(".zip")) {
|
||||
try {
|
||||
ChunkStore chunkStore = new TrueZipMcRegionChunkStore(file);
|
||||
|
Loading…
Reference in New Issue
Block a user