mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2024-12-23 01:37:37 +00:00
Updated com.sk89q.worldedit.Point to use generics.
This commit is contained in:
parent
7387e36016
commit
8e2c6ece61
@ -29,8 +29,8 @@ public class EditSession {
|
|||||||
/**
|
/**
|
||||||
* Stores the original blocks before modification.
|
* Stores the original blocks before modification.
|
||||||
*/
|
*/
|
||||||
private HashMap<Point,Integer> original = new HashMap<Point,Integer>();
|
private HashMap<Point<Integer>,Integer> original = new HashMap<Point<Integer>,Integer>();
|
||||||
private HashMap<Point,Integer> current = new HashMap<Point,Integer>();
|
private HashMap<Point<Integer>,Integer> current = new HashMap<Point<Integer>,Integer>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets a block without changing history.
|
* Sets a block without changing history.
|
||||||
@ -55,7 +55,7 @@ public class EditSession {
|
|||||||
* @return Whether the block changed
|
* @return Whether the block changed
|
||||||
*/
|
*/
|
||||||
public boolean setBlock(int x, int y, int z, int blockType) {
|
public boolean setBlock(int x, int y, int z, int blockType) {
|
||||||
Point pt = new Point(x, y, z);
|
Point<Integer> pt = new Point<Integer>(x, y, z);
|
||||||
if (!original.containsKey(pt)) {
|
if (!original.containsKey(pt)) {
|
||||||
original.put(pt, getBlock(x, y, z));
|
original.put(pt, getBlock(x, y, z));
|
||||||
}
|
}
|
||||||
@ -79,9 +79,9 @@ public class EditSession {
|
|||||||
* Restores all blocks to their initial state.
|
* Restores all blocks to their initial state.
|
||||||
*/
|
*/
|
||||||
public void undo() {
|
public void undo() {
|
||||||
for (Map.Entry<Point,Integer> entry : original.entrySet()) {
|
for (Map.Entry<Point<Integer>,Integer> entry : original.entrySet()) {
|
||||||
Point pt = (Point)entry.getKey();
|
Point pt = (Point)entry.getKey();
|
||||||
rawSetBlock((int)pt.getX(), (int)pt.getY(),(int)pt.getZ(),
|
rawSetBlock((Integer)pt.getX(), (Integer)pt.getY(),(Integer)pt.getZ(),
|
||||||
(int)entry.getValue());
|
(int)entry.getValue());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -90,9 +90,9 @@ public class EditSession {
|
|||||||
* Sets to new state.
|
* Sets to new state.
|
||||||
*/
|
*/
|
||||||
public void redo() {
|
public void redo() {
|
||||||
for (Map.Entry<Point,Integer> entry : current.entrySet()) {
|
for (Map.Entry<Point<Integer>,Integer> entry : current.entrySet()) {
|
||||||
Point pt = (Point)entry.getKey();
|
Point pt = (Point)entry.getKey();
|
||||||
rawSetBlock((int)pt.getX(), (int)pt.getY(),(int)pt.getZ(),
|
rawSetBlock((Integer)pt.getX(), (Integer)pt.getY(),(Integer)pt.getZ(),
|
||||||
(int)entry.getValue());
|
(int)entry.getValue());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -25,10 +25,10 @@ import org.apache.commons.lang3.builder.HashCodeBuilder;
|
|||||||
*
|
*
|
||||||
* @author Albert
|
* @author Albert
|
||||||
*/
|
*/
|
||||||
public final class Point {
|
public final class Point<T> {
|
||||||
private final double x, y, z;
|
private final T x, y, z;
|
||||||
|
|
||||||
public Point(double x, double y, double z) {
|
public Point(T x, T y, T z) {
|
||||||
this.x = x;
|
this.x = x;
|
||||||
this.y = y;
|
this.y = y;
|
||||||
this.z = z;
|
this.z = z;
|
||||||
@ -37,7 +37,7 @@ public final class Point {
|
|||||||
/**
|
/**
|
||||||
* @return the x
|
* @return the x
|
||||||
*/
|
*/
|
||||||
public double getX() {
|
public T getX() {
|
||||||
return x;
|
return x;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -45,14 +45,14 @@ public final class Point {
|
|||||||
/**
|
/**
|
||||||
* @return the y
|
* @return the y
|
||||||
*/
|
*/
|
||||||
public double getY() {
|
public T getY() {
|
||||||
return y;
|
return y;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the z
|
* @return the z
|
||||||
*/
|
*/
|
||||||
public double getZ() {
|
public T getZ() {
|
||||||
return z;
|
return z;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user