public void EnterRequest() {
boolean nochange = true;
final int tempX = (int) ((float) player.getX() / Float.parseFloat(String.valueOf(GeneralConstant.BLOC_WIDTH))) + 1;
final int tempY = (int) ((float) player.getY() / Float.parseFloat(String.valueOf(GeneralConstant.BLOC_HEIGHT))) + 1;
final Point playerPosition = new Point(tempX, tempY);
final EventBloc event;
final Point eventPosition;
switch (player.getOrientation()) {
case 0:
eventPosition = new Point(tempX, tempY);
event = manualEvent.get(new Point(tempX, tempY));
break;
case 1:
eventPosition = new Point(tempX + 1, tempY);
event = manualEvent.get(new Point(tempX + 1, tempY));
break;
case 2:
eventPosition = new Point(tempX, tempY + 2);
event = manualEvent.get(new Point(tempX, tempY + 2));
break;
case 3:
eventPosition = new Point(tempX - 1, tempY);
event = manualEvent.get(new Point(tempX - 1, tempY));
break;
default:
eventPosition = null;
event = null;
break;
}
if (event != null && event.getCurrentMode() == EventBlocType.ON) {
for (Objet objet : event.getContent()) {
player.addObjet(objet, 1);
}
messageBuffer.addAll(MessagePropertie.getMessage("potion"));
if (event.isColisionOff()) {
addColision(eventPosition, GeneralConstant.BLOC_WIDTH, GeneralConstant.BLOC_HEIGHT);
} else {
removeColision(eventPosition, GeneralConstant.BLOC_WIDTH, GeneralConstant.BLOC_HEIGHT);
}
nochange = false;
event.setCurrentMode(EventBlocType.OFF);
} else if (event != null && event.getCurrentMode() == EventBlocType.OFF && event.isCyclique()) {
if (event.isColisionOn()) {
addColision(eventPosition, GeneralConstant.BLOC_WIDTH, GeneralConstant.BLOC_HEIGHT);
} else {
removeColision(eventPosition, GeneralConstant.BLOC_WIDTH, GeneralConstant.BLOC_HEIGHT);
}
event.setCurrentMode(EventBlocType.ON);
}
if (nochange) {
if (!messageBuffer.isEmpty()) {
messageBuffer.remove(0);