Cleanup and a few bugfixes
This commit is contained in:
@@ -66,8 +66,7 @@ public class CuboidRegionSelector implements RegionSelector, CUIPointBasedRegion
|
||||
player.print("First position set to " + pos1 + ".");
|
||||
}
|
||||
|
||||
session.dispatchCUIEvent(player,
|
||||
new SelectionPointEvent(0, pos, getArea()));
|
||||
session.dispatchCUIEvent(player, new SelectionPointEvent(0, pos, getArea()));
|
||||
}
|
||||
|
||||
public void explainSecondarySelection(LocalPlayer player,
|
||||
@@ -79,18 +78,15 @@ public class CuboidRegionSelector implements RegionSelector, CUIPointBasedRegion
|
||||
player.print("Second position set to " + pos2 + ".");
|
||||
}
|
||||
|
||||
session.dispatchCUIEvent(player,
|
||||
new SelectionPointEvent(1, pos, getArea()));
|
||||
session.dispatchCUIEvent(player, new SelectionPointEvent(1, pos, getArea()));
|
||||
}
|
||||
|
||||
public void explainRegionAdjust(LocalPlayer player, LocalSession session) {
|
||||
if (pos1 != null) {
|
||||
session.dispatchCUIEvent(player,
|
||||
new SelectionPointEvent(0, pos1, getArea()));
|
||||
session.dispatchCUIEvent(player, new SelectionPointEvent(0, pos1, getArea()));
|
||||
}
|
||||
if (pos2 != null) {
|
||||
session.dispatchCUIEvent(player,
|
||||
new SelectionPointEvent(1, pos2, getArea()));
|
||||
session.dispatchCUIEvent(player, new SelectionPointEvent(1, pos2, getArea()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -151,12 +147,12 @@ public class CuboidRegionSelector implements RegionSelector, CUIPointBasedRegion
|
||||
}
|
||||
|
||||
public void describeCUI(LocalPlayer player) {
|
||||
if (pos1 != null)
|
||||
player.dispatchCUIEvent(
|
||||
new SelectionPointEvent(0, pos1, getArea()));
|
||||
if (pos2 != null)
|
||||
player.dispatchCUIEvent(
|
||||
new SelectionPointEvent(1, pos2, getArea()));
|
||||
if (pos1 != null) {
|
||||
player.dispatchCUIEvent(new SelectionPointEvent(0, pos1, getArea()));
|
||||
}
|
||||
if (pos2 != null) {
|
||||
player.dispatchCUIEvent(new SelectionPointEvent(1, pos2, getArea()));
|
||||
}
|
||||
}
|
||||
|
||||
public int getArea() {
|
||||
|
||||
@@ -30,7 +30,6 @@ import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.cui.CUIPointBasedRegion;
|
||||
import com.sk89q.worldedit.cui.SelectionMinMaxEvent;
|
||||
import com.sk89q.worldedit.cui.SelectionPoint2DEvent;
|
||||
import com.sk89q.worldedit.cui.SelectionPointEvent;
|
||||
import com.sk89q.worldedit.cui.SelectionShapeEvent;
|
||||
|
||||
/**
|
||||
@@ -83,15 +82,12 @@ public class Polygonal2DRegionSelector implements RegionSelector, CUIPointBasedR
|
||||
public void explainSecondarySelection(LocalPlayer player,
|
||||
LocalSession session, Vector pos) {
|
||||
player.print("Added point #" + region.size() + " at " + pos + ".");
|
||||
session.dispatchCUIEvent(player,
|
||||
new SelectionPoint2DEvent(region.size() - 1, pos, getArea()));
|
||||
session.dispatchCUIEvent(player,
|
||||
new SelectionMinMaxEvent(region.minY, region.maxY));
|
||||
session.dispatchCUIEvent(player, new SelectionPoint2DEvent(region.size() - 1, pos, getArea()));
|
||||
session.dispatchCUIEvent(player, new SelectionMinMaxEvent(region.minY, region.maxY));
|
||||
}
|
||||
|
||||
public void explainRegionAdjust(LocalPlayer player, LocalSession session) {
|
||||
session.dispatchCUIEvent(player,
|
||||
new SelectionMinMaxEvent(region.minY, region.maxY));
|
||||
session.dispatchCUIEvent(player, new SelectionMinMaxEvent(region.minY, region.maxY));
|
||||
}
|
||||
|
||||
public BlockVector getPrimaryPosition() throws IncompleteRegionException {
|
||||
@@ -153,11 +149,9 @@ public class Polygonal2DRegionSelector implements RegionSelector, CUIPointBasedR
|
||||
public void describeCUI(LocalPlayer player) {
|
||||
List<BlockVector2D> points = region.getPoints();
|
||||
for (int id = 0; id < points.size(); id++) {
|
||||
player.dispatchCUIEvent(
|
||||
new SelectionPoint2DEvent(id, points.get(id), getArea()));
|
||||
player.dispatchCUIEvent(new SelectionPoint2DEvent(id, points.get(id), getArea()));
|
||||
}
|
||||
player.dispatchCUIEvent(
|
||||
new SelectionMinMaxEvent(region.minY, region.maxY));
|
||||
player.dispatchCUIEvent(new SelectionMinMaxEvent(region.minY, region.maxY));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user