我有这个代码:
public void onPlayerInteract(PlayerInteractEvent event) {
final Action action = event.getAction();
Location l1 = null;
Location l2 = null;
if (action == Action.LEFT_CLICK_BLOCK){
l1 = event.getClickedBlock().getLocation();
} else if (action == Action.RIGHT_CLICK_BLOCK) {
l2 = event.getClickedBlock().getLocation();
}
Thread t = new Thread() {
@Override
public void run() {
while(true) {
try {
Thread.sleep(1000*60*60);
Location maxx = l1.getX();
Location maxy = l1.getY();
Location maxz = l1.getZ();
Location minx = l2.getX();
Location miny = l2.getY();
Location minz = l2.getZ();
if(l1.getX() > l2.getX()){
//I can't execute this, errors!
}
} catch (InterruptedException ie) {
}
}
}
};
t.start();
它给了我错误,并说将 l1 和 l2 更改为决赛。如果我将 l1 和 l2 更改为决赛,它会给我另一个错误,它说 l1 = etc.,它说要删除决赛。