私はこのコードを持っています:
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 =などと表示され、ファイナルを削除するように指示されます。