room nullable..

This commit is contained in:
brenoepic 2022-04-29 22:42:14 -03:00
parent 607c29af07
commit 176cf2c218

View File

@ -36,7 +36,7 @@ public class InteractionWiredHighscore extends HabboItem {
try { try {
String name = this.getBaseItem().getName().split("_")[1].toUpperCase().split("\\*")[0]; String name = this.getBaseItem().getName().split("_")[1].toUpperCase().split("\\*")[0];
int ctype = Integer.valueOf(this.getBaseItem().getName().split("\\*")[1]) - 1; int ctype = Integer.parseInt(this.getBaseItem().getName().split("\\*")[1]) - 1;
this.scoreType = WiredHighscoreScoreType.valueOf(name); this.scoreType = WiredHighscoreScoreType.valueOf(name);
this.clearType = WiredHighscoreClearType.values()[ctype]; this.clearType = WiredHighscoreClearType.values()[ctype];
} catch (Exception e) { } catch (Exception e) {
@ -54,7 +54,7 @@ public class InteractionWiredHighscore extends HabboItem {
try { try {
String name = this.getBaseItem().getName().split("_")[1].toUpperCase().split("\\*")[0]; String name = this.getBaseItem().getName().split("_")[1].toUpperCase().split("\\*")[0];
int ctype = Integer.valueOf(this.getBaseItem().getName().split("\\*")[1]) - 1; int ctype = Integer.parseInt(this.getBaseItem().getName().split("\\*")[1]) - 1;
this.scoreType = WiredHighscoreScoreType.valueOf(name); this.scoreType = WiredHighscoreScoreType.valueOf(name);
this.clearType = WiredHighscoreClearType.values()[ctype]; this.clearType = WiredHighscoreClearType.values()[ctype];
} catch (Exception e) { } catch (Exception e) {
@ -81,7 +81,7 @@ public class InteractionWiredHighscore extends HabboItem {
@Override @Override
public void onClick(GameClient client, Room room, Object[] objects) throws Exception { public void onClick(GameClient client, Room room, Object[] objects) throws Exception {
if (!((client != null && room != null && room.hasRights(client.getHabbo())) || (objects.length >= 2 && objects[1] instanceof WiredEffectType))) if (room == null || !((client != null && room.hasRights(client.getHabbo())) || (objects.length >= 2 && objects[1] instanceof WiredEffectType)))
return; return;
if (this.getExtradata() == null || this.getExtradata().isEmpty() || this.getExtradata().length() == 0) { if (this.getExtradata() == null || this.getExtradata().isEmpty() || this.getExtradata().length() == 0) {
@ -89,7 +89,7 @@ public class InteractionWiredHighscore extends HabboItem {
} }
try { try {
int state = Integer.valueOf(this.getExtradata()); int state = Integer.parseInt(this.getExtradata());
this.setExtradata(Math.abs(state - 1) + ""); this.setExtradata(Math.abs(state - 1) + "");
room.updateItem(this); room.updateItem(this);
} catch (Exception e) { } catch (Exception e) {