diff --git a/src/main/java/buttondevteam/presents/hello/pages/HelloLocationPage.java b/src/main/java/buttondevteam/presents/hello/pages/HelloLocationPage.java new file mode 100644 index 0000000..edaa424 --- /dev/null +++ b/src/main/java/buttondevteam/presents/hello/pages/HelloLocationPage.java @@ -0,0 +1,40 @@ +package buttondevteam.presents.hello.pages; + +import org.bukkit.Location; +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 HelloLocationPage extends Page{ + JavaPlugin plugin; + + public HelloLocationPage(JavaPlugin plugin){ + this.plugin = plugin; + } + @Override + public String GetName() { + // TODO Auto-generated method stub + return "ali/hello/location"; + } + + @Override + public Response handlePage(HttpExchange exchange) { + //Returns the location of all players in table form + String responseString = ""; + for(Player player : plugin.getServer().getOnlinePlayers()){ + Location loc = player.getLocation(); + responseString += ""; + responseString += loc.getBlockX() + " "; + responseString += loc.getBlockY() + " "; + responseString += loc.getBlockZ() + " "; + responseString += ""; + } + responseString += "
"; + return new Response(200, responseString, exchange); + } + +}