Added Hello Players page

This commit is contained in:
alisolarflare 2017-06-10 09:49:10 -07:00
parent f8504c0264
commit b2d71bd785
3 changed files with 36 additions and 4 deletions

View file

@ -15,6 +15,7 @@ import buttondevteam.presents.hello.effects.HelloMagicPotato;
import buttondevteam.presents.hello.effects.HelloParticle;
import buttondevteam.presents.hello.effects.HelloSound;
import buttondevteam.presents.hello.pages.HelloDataPage;
import buttondevteam.presents.hello.pages.HelloPlayersPage;
import buttondevteam.presents.hello.pages.HelloWorldPage;
public class HelloComponent extends Component{
@ -35,5 +36,6 @@ public class HelloComponent extends Component{
this.addPage(plugin, new HelloWorldPage());
this.addPage(plugin, new HelloDataPage());
this.addPage(plugin, new HelloPlayersPage(plugin));
}
}

View file

@ -15,10 +15,7 @@ public class HelloDataPage extends Page{
@Override
public Response handlePage(HttpExchange exchange) {
String responseString =
"<h1>Come check out this data!</h1>"
+ "<p>" + data + "</p>"
+ "<p>This is not suspicious shit at all</p>";
String responseString = String.valueOf(data);
return new Response(200, responseString, exchange);
}

View file

@ -0,0 +1,33 @@
package buttondevteam.presents.hello.pages;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;
import com.sun.net.httpserver.HttpExchange;
import buttondevteam.website.io.Response;
import buttondevteam.website.page.Page;
public class HelloPlayersPage extends Page{
private JavaPlugin plugin;
public HelloPlayersPage(JavaPlugin plugin){
this.plugin = plugin;
}
@Override
public String GetName() {
// TODO Auto-generated method stub
return "ali/hello/players";
}
@Override
public Response handlePage(HttpExchange exchange) {
String playerList = "";
for(Player player : plugin.getServer().getOnlinePlayers()){
playerList += player.getPlayerListName() + "<br>";
}
return new Response(200, playerList, exchange);
}
}