/*
 * Copyright (c) 2016 MCPhoton <http://mcphoton.org> and contributors.
 *
 * This file is part of the Photon Server Implementation <https://github.com/mcphoton/Photon-Server>.
 *
 * The Photon Server Implementation is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * The Photon Server Implementation is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
 */
package org.mcphoton.impl.command;

import org.mcphoton.command.Command;
import org.mcphoton.impl.server.Main;
import org.mcphoton.messaging.Messageable;

public class ListCommand implements Command {

	@Override
	public void execute(Messageable source, String[] args) {
		
		switch(Main.SERVER.getOnlinePlayers().size()) {
		case 0:
			source.sendMessage("No player is connected.");
			break;
		case 1:
			source.sendMessage("There is 1 of " + Main.SERVER.getMaxPlayers() + " player connected.");
			break;
		default:
			source.sendMessage("There are " + Main.SERVER.getOnlinePlayers().size() + " of " + Main.SERVER.getMaxPlayers() + " players connected.");
			break;
		}
	}

	@Override
	public String getDescription() {
		return "Lists the connected players.";
	}

	@Override
	public String getName() {
		return "list";
	}

}

@@ -1085,17 +1085,16 @@
 mmand %7B%0A
-%0A
 %09@Overri
@@ -1154,18 +1154,16 @@
 args) %7B%0A
-%09%09
 %0A%09%09switc
@@ -1163,16 +1163,17 @@
 %09%09switch
+ 
 (Main.SE
@@ -1206,16 +1206,17 @@
 ze()) %7B%0A
+%09
 %09%09case 0
@@ -1216,24 +1216,25 @@
 %09case 0:%0A%09%09%09
+%09
 source.sendM
@@ -1271,23 +1271,25 @@
 .%22);%0A%09%09%09
+%09
 break;%0A
+%09
 %09%09case 1
@@ -1290,16 +1290,17 @@
 case 1:%0A
+%09
 %09%09%09sourc
@@ -1326,33 +1326,67 @@
 e is 1 o
-f %22 + Main.SERVER
+ut of %22%0A%09%09%09%09%09%09%09%09   + Main.SERVER.getConfiguration()
 .getMaxP
@@ -1385,32 +1385,43 @@
 .getMaxPlayers()
+%0A%09%09%09%09%09%09%09%09  
  + %22 player conn
@@ -1433,23 +1433,25 @@
 .%22);%0A%09%09%09
+%09
 break;%0A
+%09
 %09%09defaul
@@ -1456,16 +1456,17 @@
 ult:%0A%09%09%09
+%09
 source.s
@@ -1488,16 +1488,27 @@
 re are %22
+%0A%09%09%09%09%09%09%09%09  
  + Main.
@@ -1543,31 +1543,76 @@
 ze()
- + %22 of %22 + Main.SERVER
+%0A%09%09%09%09%09%09%09%09   + %22 out of %22%0A%09%09%09%09%09%09%09%09   + Main.SERVER.getConfiguration()
 .get
@@ -1623,16 +1623,27 @@
 layers()
+%0A%09%09%09%09%09%09%09%09  
  + %22 pla
@@ -1661,16 +1661,17 @@
 ted.%22);%0A
+%09
 %09%09%09break
@@ -1832,7 +1832,5 @@
 %0A%09%7D%0A
-%0A%7D%0A
+%7D

Fix /list