From 6f0fcafb7b7e553061ad03c421f473e57f9dc41f Mon Sep 17 00:00:00 2001 From: KrewsOrg Date: Fri, 17 Jan 2020 20:10:19 +0000 Subject: [PATCH] Final Patch to totems, resolves the NumberFormatException for all Totems. Added correct SQL for totems. --- pom.xml | 2 +- sqlupdates/2_2_1_TO_2_2_2.sql | 6 ++++++ src/main/java/com/eu/habbo/Emulator.java | 2 +- .../items/interactions/totems/InteractionTotemLegs.java | 7 ++++++- .../items/interactions/totems/InteractionTotemPlanet.java | 7 ++++++- 5 files changed, 20 insertions(+), 4 deletions(-) create mode 100644 sqlupdates/2_2_1_TO_2_2_2.sql diff --git a/pom.xml b/pom.xml index 33253bbb..557fc959 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.eu.habbo Habbo - 2.2.0 + 2.2.2 UTF-8 diff --git a/sqlupdates/2_2_1_TO_2_2_2.sql b/sqlupdates/2_2_1_TO_2_2_2.sql new file mode 100644 index 00000000..a336176c --- /dev/null +++ b/sqlupdates/2_2_1_TO_2_2_2.sql @@ -0,0 +1,6 @@ +UPDATE items_base SET interaction_type = 'totem_leg' WHERE item_name = 'totem_leg'; +UPDATE items_base SET interaction_type = 'totem_head' WHERE item_name = 'totem_head'; +UPDATE items_base SET interaction_type = 'totem_planet' WHERE item_name = 'totem_planet'; +UPDATE items_base SET interaction_modes_count = '3' WHERE item_name = 'totem_planet'; +UPDATE items_base SET interaction_modes_count = '12' WHERE item_name = 'totem_leg'; +UPDATE items_base SET interaction_modes_count = '9' WHERE item_name = 'totem_head'; diff --git a/src/main/java/com/eu/habbo/Emulator.java b/src/main/java/com/eu/habbo/Emulator.java index 1f75c11f..6392e58c 100644 --- a/src/main/java/com/eu/habbo/Emulator.java +++ b/src/main/java/com/eu/habbo/Emulator.java @@ -34,7 +34,7 @@ public final class Emulator { public final static int MINOR = 2; - public final static int BUILD = 1; + public final static int BUILD = 2; public final static String PREVIEW = "Stable"; diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/totems/InteractionTotemLegs.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/totems/InteractionTotemLegs.java index 4070a876..4555a2f9 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/totems/InteractionTotemLegs.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/totems/InteractionTotemLegs.java @@ -21,7 +21,12 @@ public class InteractionTotemLegs extends InteractionDefault { } public TotemType getTotemType() { - int extraData = Integer.parseInt(this.getExtradata()); + int extraData; + try { + extraData = Integer.parseInt(this.getExtradata()); + } catch(NumberFormatException ex) { + extraData = 0; + } return TotemType.fromInt((int)Math.ceil((extraData + 1) / 4.0f)); } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/totems/InteractionTotemPlanet.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/totems/InteractionTotemPlanet.java index 14d03271..75b48203 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/totems/InteractionTotemPlanet.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/totems/InteractionTotemPlanet.java @@ -22,7 +22,12 @@ public class InteractionTotemPlanet extends InteractionDefault { } public TotemPlanetType getPlanetType() { - int extraData = Integer.parseInt(this.getExtradata()); + int extraData; + try { + extraData = Integer.parseInt(this.getExtradata()); + } catch(NumberFormatException ex) { + extraData = 0; + } return TotemPlanetType.fromInt(extraData); }