Catch potential exception for number formatting for input dialogues.
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
package core.net.packet.in;
|
package core.net.packet.in;
|
||||||
|
|
||||||
|
import api.ContentAPI;
|
||||||
import core.game.node.entity.player.Player;
|
import core.game.node.entity.player.Player;
|
||||||
import core.game.node.entity.player.link.RunScript;
|
import core.game.node.entity.player.link.RunScript;
|
||||||
import core.net.packet.IncomingPacket;
|
import core.net.packet.IncomingPacket;
|
||||||
@@ -29,7 +30,11 @@ public class RunScriptPacketHandler implements IncomingPacket {
|
|||||||
} else {
|
} else {
|
||||||
value = buffer.getInt();
|
value = buffer.getInt();
|
||||||
}
|
}
|
||||||
script.invoke(value);
|
try {
|
||||||
|
script.invoke(value);
|
||||||
|
} catch (NumberFormatException nfe){
|
||||||
|
ContentAPI.sendDialogue(player, "That number's a bit large, don't you think?");
|
||||||
|
}
|
||||||
player.removeAttribute("runscript");
|
player.removeAttribute("runscript");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user