Fix number formatting error in toggle furni effect

This commit is contained in:
Alejandro 2019-05-13 13:56:47 -04:00
parent 419c3d07af
commit 0e56cba7a1

View File

@ -146,7 +146,15 @@ public class WiredEffectToggleFurni extends InteractionWiredEffect
{ {
if (item.getBaseItem().getStateCount() > 1 || item instanceof InteractionGameTimer) if (item.getBaseItem().getStateCount() > 1 || item instanceof InteractionGameTimer)
{ {
item.onClick(habbo != null && !(item instanceof InteractionGameTimer) ? habbo.getClient() : null, room, new Object[]{item.getExtradata().length() == 0 ? 0 : Integer.valueOf(item.getExtradata()), this.getType()}); int state = 0;
if (!item.getExtradata().isEmpty()) {
try {
state = Integer.valueOf(item.getExtradata()); // assumes that extradata is state, could be something else for trophies etc.
} catch (NumberFormatException ignored) {
}
}
item.onClick(habbo != null && !(item instanceof InteractionGameTimer) ? habbo.getClient() : null, room, new Object[]{state, this.getType()});
} }
} }
catch (Exception e) catch (Exception e)