-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSelectedStats.java
More file actions
54 lines (49 loc) · 1.46 KB
/
SelectedStats.java
File metadata and controls
54 lines (49 loc) · 1.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
package dime;
import net.minecraft.entity.player.EntityPlayer;
import javax.swing.text.html.parser.Entity;
import java.util.HashMap;
/**
* Created by OkuBlade.
*/
public class SelectedStats {
public HashMap<String, Selection> selectedPoints = new HashMap<String, Selection>();
public Selection getSelectionForPlayer(EntityPlayer p){
if(!selectedPoints.containsKey(p.getCommandSenderName())){
selectedPoints.put(p.getCommandSenderName(), new Selection());
}
return selectedPoints.get(p.getCommandSenderName());
}
public static class Selection {
public int pointToSet = 0;
public Point minSelection, maxSelection;
public Selection(){
reset();
}
public void setPoint(int x, int y, int z){
Point thePoint = pointToSet == 0? minSelection : maxSelection;
thePoint.set(x, y, z);
if(pointToSet > 0) {
pointToSet = 0;
}else{
pointToSet = 1;
}
}
public boolean isSet(){
return minSelection.isSet && maxSelection.isSet;
}
public void reset(){
minSelection = new Point();
maxSelection = new Point();
}
}
public static class Point {
public int x, y, z;
public boolean isSet = false;
public void set(int sx, int sy, int sz){
x = sx;
y = sy;
z = sz;
isSet = true;
}
}
}