Commit 78f9f38d authored by leMaik's avatar leMaik
Browse files

Fix MapConfigHandler.

parent 38171881
package net.cubespace.dynmap.multiserver.GSON;
import java.util.List;
/**
* @author geNAZt (fabian.fassbender42@googlemail.com)
*/
......@@ -10,7 +12,7 @@ public class DynmapWorldConfig {
private Boolean isThundering;
private Integer servertime;
private Integer currentcount;
private Player[] players;
private List<Player> players;
private Integer confighash;
public Long getTimestamp() {
......@@ -37,7 +39,7 @@ public class DynmapWorldConfig {
return currentcount;
}
public Player[] getPlayers() {
public List<Player> getPlayers() {
return players;
}
......@@ -69,7 +71,7 @@ public class DynmapWorldConfig {
this.currentcount = currentcount;
}
public void setPlayers(Player[] players) {
public void setPlayers(List<Player> players) {
this.players = players;
}
......
......@@ -14,9 +14,7 @@ import net.cubespace.dynmap.multiserver.GSON.DynmapWorldConfig;
import net.cubespace.dynmap.multiserver.HTTP.HandlerUtil;
import net.cubespace.dynmap.multiserver.Main;
import static io.netty.handler.codec.http.HttpHeaders.Names.CONNECTION;
import static io.netty.handler.codec.http.HttpHeaders.Names.CONTENT_LENGTH;
import static io.netty.handler.codec.http.HttpHeaders.Names.CONTENT_TYPE;
import static io.netty.handler.codec.http.HttpHeaders.Names.*;
import static io.netty.handler.codec.http.HttpResponseStatus.NOT_FOUND;
import static io.netty.handler.codec.http.HttpResponseStatus.OK;
import static io.netty.handler.codec.http.HttpVersion.HTTP_1_1;
......@@ -31,14 +29,14 @@ public class MapConfigHandler implements IHandler {
public void handle(ChannelHandlerContext ctx, FullHttpRequest request) throws Exception {
//Get the correct DynmapServer
String world = request.getUri().split("/")[3].split("\\.")[0];
for(DynmapServer dynmapServer : Main.getDynmapServers()) {
for(DynmapWorld dynmapWorld : dynmapServer.getWorlds()) {
if(dynmapWorld.getName().equals(world)) {
for (DynmapServer dynmapServer : Main.getDynmapServers()) {
for (DynmapWorld dynmapWorld : dynmapServer.getWorlds()) {
if (dynmapWorld.getName().equals(world)) {
DynmapWorldConfig dynmapWorldConfig = dynmapServer.getWorldConfig(dynmapWorld.getName());
dynmapWorldConfig.setConfighash(0);
dynmapWorldConfig.setPlayers(Main.getPlayers());
dynmapWorldConfig.setCurrentcount(dynmapWorldConfig.getPlayers().length);
dynmapWorldConfig.setCurrentcount(dynmapWorldConfig.getPlayers().size());
String responseStr = gson.toJson(dynmapWorldConfig);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment