Removed Components: Metrics, Persistence, RTP

This commit is contained in:
alisolarflare 2017-08-23 15:49:49 -04:00
parent f51ccc9113
commit 303a9cce8a
8 changed files with 0 additions and 198 deletions

View file

@ -7,10 +7,7 @@ import org.bukkit.plugin.java.JavaPlugin;
import buttondevteam.presents.dictionary.DictionaryComponent;
import buttondevteam.presents.magic.MagicComponent;
import buttondevteam.presents.metrics.MetricsComponent;
import buttondevteam.presents.rtp.RandomTeleportComponent;
import buttondevteam.presents.spawn.SpawnComponent;
import buttondevteam.presents.test.TestComponent;
public class Main extends JavaPlugin{
public void onEnable(){
@ -20,10 +17,7 @@ public class Main extends JavaPlugin{
logger.info(pdfFile.getName() + " has been started (V." + pdfFile.getVersion()+ ").");
new DictionaryComponent().register(this);
new RandomTeleportComponent().register(this);
new MetricsComponent().register(this);
new SpawnComponent().register(this);
new TestComponent().register(this);
new MagicComponent().register(this);
logger.info(pdfFile.getName() + " has fully registered (V." + pdfFile.getVersion()+ ").");

View file

@ -1,15 +0,0 @@
package buttondevteam.presents.metrics;
import org.bukkit.plugin.java.JavaPlugin;
import buttondevteam.presents.architecture.Component;
public class MetricsComponent extends Component{
@Override
public void register(JavaPlugin plugin) {
registerListener(plugin, new PlayerLogins(plugin));
addPage(plugin, new PlayerLoginsPage());
}
}

View file

@ -1,38 +0,0 @@
package buttondevteam.presents.metrics;
import java.util.Objects;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerLoginEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.plugin.java.JavaPlugin;
public class PlayerLogins implements Listener {
private JavaPlugin plugin;
public PlayerLogins(JavaPlugin plugin) {
this.plugin = plugin;
}
@EventHandler
public void onPlayerLogin(PlayerLoginEvent event){
String[] array = {
event.getPlayer().getName(),
"login"
};
plugin.getConfig().set("metrics.logins." + Objects.toString(System.currentTimeMillis()), array);
plugin.saveConfig();
}
@EventHandler
public void onPlayerLogout(PlayerQuitEvent event){
String[] array = {
event.getPlayer().getName(),
"logout"
};
plugin.getConfig().set("metrics.logins." + Objects.toString(System.currentTimeMillis()), array);
plugin.saveConfig();
}
}

View file

@ -1,28 +0,0 @@
package buttondevteam.presents.metrics;
import com.sun.net.httpserver.HttpExchange;
import buttondevteam.website.io.Response;
import buttondevteam.website.page.Page;
public class PlayerLoginsPage extends Page {
@Override
public String GetName() {
// TODO Auto-generated method stub
return "/ali/metrics/logins";
}
@Override
public Response handlePage(HttpExchange exchange) {
return new Response(200, responseString(), exchange);
}
private String responseString() {
String outputString = "<h1>Player Login Metrics Screen</h1>";
return outputString;
}
}

View file

@ -1,14 +0,0 @@
package buttondevteam.presents.rtp;
import org.bukkit.plugin.java.JavaPlugin;
import buttondevteam.presents.architecture.Component;
public class RandomTeleportComponent extends Component {
@Override
public void register(JavaPlugin plugin) {
this.registerCommand(plugin, new Rtp());
}
}

View file

@ -1,45 +0,0 @@
package buttondevteam.presents.rtp;
import org.bukkit.entity.Player;
import buttondevteam.lib.chat.CommandClass;
import buttondevteam.presents.architecture.commands.PlayerCommand;
@CommandClass(path = "rtp")
public class Rtp extends PlayerCommand {
private int currentplace = 0;
private final coordinate[] teleportLocations = {
new coordinate(-582,72),
new coordinate(-838,226),
new coordinate(-282, 444), //star island
new coordinate(-654, 202),
new coordinate(250, 542),
new coordinate(370, 514),
new coordinate(-317, 431),
new coordinate(-273, 556),
new coordinate(-737, 217)
};
private class coordinate{
final int x;
final int z;
coordinate(int x, int z){
this.x = x;
this.z = z;
}
}
@Override
public boolean OnCommand(Player player, String alias, String[] args) {
player.sendMessage("Teleporting...");
coordinate currentCoordinate = teleportLocations[currentplace];
player.teleport(player.getWorld().getHighestBlockAt(currentCoordinate.x, currentCoordinate.z).getLocation());
currentplace = (int) (currentplace + Math.floor(Math.random()*5 - 1)) % teleportLocations.length;
return true;
}
}

View file

@ -1,37 +0,0 @@
package buttondevteam.presents.test;
import org.bukkit.command.CommandSender;
import buttondevteam.presents.architecture.commands.UniversalCommand;
public class PersistenceTest extends UniversalCommand {
final private String path = "test.presistence.data";
public PersistenceTest(){
runTest();
}
@Override
public boolean OnCommand(CommandSender sender, String alias, String[] args) {
if(runTest()){
sender.sendMessage("Everything seems pretty fine");
sender.sendMessage(path + " contains the String");
sender.sendMessage(this.getPlugin().getConfig().getString(path));
return true;
}else{
sender.sendMessage("[ButtonPresents] Persistence Test Failed! Button Presents may have an erased config.yml");
return true;
}
}
private boolean runTest(){
boolean test = this.getPlugin().getConfig().contains(path);
if(test){
return true;
}else{
this.getPlugin().getConfig().set(path, "Lorem Ipsum");
throw new AssertionError("[ButtonPresents] Persistence Test Failed! Button Presents may have an erased config.yml");
}
}
}

View file

@ -1,15 +0,0 @@
package buttondevteam.presents.test;
import org.bukkit.plugin.java.JavaPlugin;
import buttondevteam.presents.architecture.Component;
public class TestComponent extends Component{
@Override
public void register(JavaPlugin plugin) {
this.registerCommand(plugin, new PersistenceTest());
}
}