1 |
package dk.thoerup.bukkit.hoeruputils.web; |
package dk.thoerup.bukkit.hoeruputils.web; |
2 |
|
|
3 |
import java.io.File; |
import java.io.IOException; |
4 |
import java.text.SimpleDateFormat; |
import java.text.SimpleDateFormat; |
5 |
import java.util.Date; |
import java.util.Date; |
6 |
import java.util.Set; |
|
|
import java.util.Map; |
|
|
import org.bukkit.Location; |
|
|
import org.bukkit.Server; |
|
7 |
import org.bukkit.OfflinePlayer; |
import org.bukkit.OfflinePlayer; |
8 |
import org.bukkit.entity.Player; |
import org.bukkit.Server; |
9 |
import org.bukkit.plugin.Plugin; |
import org.bukkit.plugin.Plugin; |
10 |
|
|
11 |
import org.bukkit.configuration.Configuration; |
import com.sun.net.httpserver.HttpExchange; |
12 |
|
import com.sun.net.httpserver.HttpHandler; |
13 |
|
|
|
/*import org.kokakiwi.apicraft.events.ApiEvent; |
|
|
import org.kokakiwi.apicraft.events.ApiListener;*/ |
|
|
import de.codeinfection.quickwango.ApiBukkit.ApiBukkit; |
|
|
import de.codeinfection.quickwango.ApiBukkit.ApiServer.*; |
|
14 |
|
|
15 |
|
|
16 |
@Controller( name = "bans", authenticate = false, serializer = "raw" ) |
public class BanListener implements HttpHandler { |
|
public class BanListener extends ApiController { |
|
17 |
|
|
18 |
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
19 |
|
|
23 |
String cachedText = ""; |
String cachedText = ""; |
24 |
|
|
25 |
public BanListener(Plugin plugin, Server server) { |
public BanListener(Plugin plugin, Server server) { |
|
super( new de.codeinfection.quickwango.Abstraction.Implementations.Bukkit.BukkitPlugin(plugin) ); |
|
|
//super( new de.codeinfection.quickwango.ApiBukkit.Abstraction.Implementations.Bukkit.BukkitPlugin(plugin) ); |
|
26 |
|
|
27 |
this.server = server; |
this.server = server; |
28 |
} |
} |
35 |
return format.format(d ); |
return format.format(d ); |
36 |
} |
} |
37 |
|
|
38 |
|
|
39 |
|
|
40 |
@Override |
@Override |
41 |
public void defaultAction(ApiRequest request, ApiResponse response) { |
public void handle(HttpExchange http) throws IOException { |
42 |
/* if(!event.path[0].equalsIgnoreCase("webstatus")) { |
/* if(!event.path[0].equalsIgnoreCase("webstatus")) { |
43 |
return; |
return; |
44 |
}*/ |
}*/ |
45 |
|
|
55 |
text = cachedText; |
text = cachedText; |
56 |
} |
} |
57 |
} |
} |
|
|
|
58 |
|
|
|
/* event.setResponse(xml); |
|
|
event.setActionTaken(true);*/ |
|
59 |
|
|
60 |
response.setContent( text ); |
http.getResponseBody().write( text.getBytes() ); |
61 |
} |
} |
62 |
|
|
63 |
private String buildText() { |
private String buildText() { |
83 |
|
|
84 |
} |
} |
85 |
|
|
86 |
|
|
87 |
|
|
88 |
} |
} |