Paper/src/org/bukkit/craftbukkit/CraftServer.java

52 lines
1.3 KiB
Java
Raw Normal View History

2010-12-21 17:52:15 +01:00
package org.bukkit.craftbukkit;
2010-12-22 16:22:23 +01:00
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import org.bukkit.*;
import net.minecraft.server.*;
2010-12-21 17:52:15 +01:00
public class CraftServer implements Server {
2010-12-22 16:22:23 +01:00
private final String serverName = "CraftBucket";
private final String serverVersion;
private final HashMap<String, Player> playerCache = new HashMap<String, Player>();
2010-12-21 17:52:15 +01:00
2010-12-22 16:22:23 +01:00
protected final MinecraftServer console;
protected final hl server;
public CraftServer(MinecraftServer instance, String ver) {
serverVersion = ver;
console = instance;
server = console.f;
2010-12-21 17:52:15 +01:00
}
public String getName() {
2010-12-22 16:22:23 +01:00
return serverName;
2010-12-21 17:52:15 +01:00
}
public String getVersion() {
2010-12-22 16:22:23 +01:00
return serverVersion;
}
public Player[] getOnlinePlayers() {
List<fi> online = server.b;
Player[] players = new Player[online.size()];
for (int i = 0; i < players.length; i++) {
String name = online.get(i).aw;
if (playerCache.containsKey(name)) {
players[i] = playerCache.get(name);
} else {
players[i] = new CraftPlayer(this, online.get(i));
playerCache.put(name, players[i]);
}
}
return players;
2010-12-21 17:52:15 +01:00
}
}