diff --git a/src/de/steamwar/lobby/portal/CommandPortal.java b/src/de/steamwar/lobby/portal/CommandPortal.java index ae8563f..ac560a4 100644 --- a/src/de/steamwar/lobby/portal/CommandPortal.java +++ b/src/de/steamwar/lobby/portal/CommandPortal.java @@ -45,7 +45,7 @@ public class CommandPortal implements PortalHandler { int[] stackIds = new int[parts.length-1]; int maxId = 0; for(int i = 1; i < parts.length; i++) { - stackIds[i-1] = Integer.getInteger(String.valueOf(parts[i].charAt(0))); + stackIds[i-1] = Integer.parseInt(parts[i].substring(0, 1)); if(stackIds[i-1] > maxId) maxId = stackIds[i-1]; } @@ -53,6 +53,11 @@ public class CommandPortal implements PortalHandler { Deque stack = Portals.getStack(player); String[] pieces = new String[stackIds.length]; while (maxId > 0) { + if(stack.isEmpty()) { + player.sendMessage("Fehlende Stackinhalte für den command"); + return; + } + Portal portal = stack.pop(); if(portal.type() == PortalType.STACK) { for(int i = 0; i < stackIds.length; i++) { @@ -67,7 +72,7 @@ public class CommandPortal implements PortalHandler { StringBuilder cmd = new StringBuilder(parts[0]); for(int i = 0; i < pieces.length; i++) { - cmd.append(pieces[i]).append(parts[i+1]); + cmd.append(pieces[i]).append(parts[i+1].substring(1)); } player.sendMessage("Folgender Command wäre jetzt ausgeführt worden, könnte der Bungee das schon: " + cmd);