[317] [PI] Open Interface command

So I noticed there’s no command to be found to open a interface, so I took the honour and made it for you guys.

Command usage: ::intf [ID]

			if (playerCommand.startsWith("intf") && c.playerRights >= 3) {
				try {	
					String InterfaceId = playerCommand.substring(5);
					int ConvertedString = Integer.parseInt(InterfaceId);
					c.getPA().showInterface(ConvertedString);
				} catch(Exception e) {
					c.sendMessage("Interface error");
				}
			}

I know it’s not the most complicated code to write, but here it is.

Hope you enjoy,

I mean, thanks, but this isn’t really necessary. Besides, almost every PI server has a command very similar to this.

if (playerCommand.startsWith("interface")) { String[] args = playerCommand.split(" "); c.getPA().showInterface(Integer.parseInt(args[1])); }
(From a source I have on my computer)

Those conventions are horrible Alexander-Staneke…
Java Nuts and Bolts | Variables
Should look up on the conventions for variable naming.

[quote=“runescape sucks, post:2, topic:555598”]I mean, thanks, but this isn’t really necessary. Besides, almost every PI server has a command very similar to this.

if (playerCommand.startsWith("interface")) { String[] args = playerCommand.split(" "); c.getPA().showInterface(Integer.parseInt(args[1])); }
(From a source I have on my computer)[/quote]
Technically the OP’s is better because it has a try-catch that’d prevent an error for a player typing ::interface ABC.

if (playerCommand.startsWith("interface")) { try { int interfaceId = Integer.parseInt(playerCommand.split(" ")[1]); c.getPA().showInterface(interfaceId); } catch(Exception er) { c.sendMessage("Try the command as ::interface 1234"); } }