Cleanup. Added toString override for polygonal regions.

Dieser Commit ist enthalten in:
Wizjany 2011-08-24 18:27:18 -04:00
Ursprung 26d07b4ca4
Commit da6e6da024
5 geänderte Dateien mit 36 neuen und 20 gelöschten Zeilen

Datei anzeigen

@ -1162,6 +1162,7 @@ public class EditSession {
return affected;
}
/**
* Make faces of the region (as if it was a cuboid if it's not).
*

Datei anzeigen

@ -118,7 +118,8 @@ public class WorldEdit {
else
logMode = loggingAnnotation.value();
String msg = "WorldEdit: " + player.getName() + ": " + StringUtil.joinString(args, " ");
String msg = "WorldEdit: " + player.getName() + "(in " + player.getWorld().getName() + ")"
+ ": " + StringUtil.joinString(args, " ");
if (logMode != null) {
Vector position = player.getPosition();
final LocalSession session = getSession(player);

Datei anzeigen

@ -32,7 +32,6 @@ import org.bukkit.event.Event.Priority;
import org.bukkit.event.Event;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerListener;
import org.bukkit.plugin.PluginManager;
import org.bukkit.plugin.java.JavaPlugin;
import com.sk89q.bukkit.migration.PermissionsResolverManager;
import com.sk89q.bukkit.migration.PermissionsResolverServerListener;
@ -136,9 +135,7 @@ public class WorldEditPlugin extends JavaPlugin {
* Register the events used by WorldEdit.
*/
protected void registerEvents() {
@SuppressWarnings("unused")
PlayerListener playerListener = new WorldEditPlayerListener(this);
@SuppressWarnings("unused")
PlayerListener criticalPlayerListener = new WorldEditCriticalPlayerListener(this);
// The permissions resolver has some hooks of its own
@ -152,16 +149,13 @@ public class WorldEditPlugin extends JavaPlugin {
* @param listener
* @param priority
*/
protected void registerEvent(String typeName, Listener listener, Priority priority) {
public void registerEvent(String typeName, Listener listener, Priority priority) {
try {
Event.Type type = Event.Type.valueOf(typeName);
PluginManager pm = getServer().getPluginManager();
pm.registerEvent(type, listener, priority, this);
this.getServer().getPluginManager().registerEvent(type, listener, priority, this);
} catch (IllegalArgumentException e) {
logger.info("WorldGuard: Unable to register missing event type " + typeName);
logger.info("WorldEdit: Unable to register missing event type " + typeName);
}
/*getServer().getPluginManager()
.registerEvent(type, listener, priority, this);*/
}
/**
@ -170,7 +164,7 @@ public class WorldEditPlugin extends JavaPlugin {
* @param type
* @param listener
*/
protected void registerEvent(String typeName, Listener listener) {
public void registerEvent(String typeName, Listener listener) {
registerEvent(typeName, listener, Event.Priority.Normal);
}

Datei anzeigen

@ -344,12 +344,13 @@ public class CuboidRegion implements Region {
}
/**
* Returns string representation "( (x, y, z) - (x, y, z) )".
* Returns string representation in the format
* "(minX, minY, minZ) - (maxX, maxY, maxZ)".
*
* @return string
*/
@Override
public String toString() {
return "( "+getMinimumPoint()+" - "+getMaximumPoint()+" )";
return getMinimumPoint() + " - " + getMaximumPoint();
}
}

Datei anzeigen

@ -465,6 +465,25 @@ public class Polygonal2DRegion implements Region {
return items.iterator();*/
}
/**
* Returns string representation in the format
* "(x1, z1) - ... - (xN, zN) * (minY - maxY)"
*
* @return string
*/
public String toString() {
StringBuilder sb = new StringBuilder();
List<BlockVector2D> pts = getPoints();
Iterator<BlockVector2D> it = pts.iterator();
while (it.hasNext()) {
BlockVector2D current = it.next();
sb.append("(" + current.getBlockX() + ", " + current.getBlockZ() + ")");
if (it.hasNext()) sb.append(" - ");
}
sb.append(" * (" + minY + " - " + maxY + ")");
return sb.toString();
}
/**
* A terrible polygonal region iterator.
*/