forked from SteamWar/SteamWar
Format code
This commit is contained in:
@@ -48,27 +48,27 @@ public class CommandPortal implements PortalHandler {
|
||||
public void handle(Player player, Location loc) {
|
||||
String[] parts = command.split("\\\\");
|
||||
|
||||
int[] stackIds = new int[parts.length-1];
|
||||
int[] stackIds = new int[parts.length - 1];
|
||||
int maxId = 0;
|
||||
for(int i = 1; i < parts.length; i++) {
|
||||
stackIds[i-1] = Integer.parseInt(parts[i].substring(0, 1));
|
||||
if(stackIds[i-1] > maxId)
|
||||
maxId = stackIds[i-1];
|
||||
for (int i = 1; i < parts.length; i++) {
|
||||
stackIds[i - 1] = Integer.parseInt(parts[i].substring(0, 1));
|
||||
if (stackIds[i - 1] > maxId)
|
||||
maxId = stackIds[i - 1];
|
||||
}
|
||||
|
||||
Iterator<Portal> stack = Portals.getStack(player).iterator();
|
||||
String[] pieces = new String[stackIds.length];
|
||||
while (maxId > 0) {
|
||||
if(!stack.hasNext()) {
|
||||
if (!stack.hasNext()) {
|
||||
LobbySystem.getInstance().getLogger().log(Level.WARNING, "Stackportal with missing elements: " + player.getName() + " /" + command);
|
||||
player.sendMessage("§cEigentlich solltest du gerade gar nicht durch dieses Portal durchgehen können...");
|
||||
return;
|
||||
}
|
||||
|
||||
Portal portal = stack.next();
|
||||
if(portal.type() == PortalType.STACK) {
|
||||
for(int i = 0; i < stackIds.length; i++) {
|
||||
if(stackIds[i] == maxId) {
|
||||
if (portal.type() == PortalType.STACK) {
|
||||
for (int i = 0; i < stackIds.length; i++) {
|
||||
if (stackIds[i] == maxId) {
|
||||
pieces[i] = ((StackPortal) portal.getHandler()).getText();
|
||||
}
|
||||
}
|
||||
@@ -78,11 +78,11 @@ 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].substring(1));
|
||||
for (int i = 0; i < pieces.length; i++) {
|
||||
cmd.append(pieces[i]).append(parts[i + 1].substring(1));
|
||||
}
|
||||
|
||||
if(ModifyCommand.modifying(player))
|
||||
if (ModifyCommand.modifying(player))
|
||||
player.sendMessage("/" + cmd);
|
||||
NetworkSender.send(new ExecuteCommandPacket(SteamwarUser.get(player.getUniqueId()).getId(), cmd.toString()));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user