From 303a9cce8a19290fce261a22746f489abd877269 Mon Sep 17 00:00:00 2001 From: alisolarflare Date: Wed, 23 Aug 2017 15:49:49 -0400 Subject: [PATCH] Removed Components: Metrics, Persistence, RTP --- .../java/buttondevteam/presents/Main.java | 6 --- .../presents/metrics/MetricsComponent.java | 15 ------- .../presents/metrics/PlayerLogins.java | 38 ---------------- .../presents/metrics/PlayerLoginsPage.java | 28 ------------ .../presents/rtp/RandomTeleportComponent.java | 14 ------ .../java/buttondevteam/presents/rtp/Rtp.java | 45 ------------------- .../presents/test/PersistenceTest.java | 37 --------------- .../presents/test/TestComponent.java | 15 ------- 8 files changed, 198 deletions(-) delete mode 100644 src/main/java/buttondevteam/presents/metrics/MetricsComponent.java delete mode 100644 src/main/java/buttondevteam/presents/metrics/PlayerLogins.java delete mode 100644 src/main/java/buttondevteam/presents/metrics/PlayerLoginsPage.java delete mode 100644 src/main/java/buttondevteam/presents/rtp/RandomTeleportComponent.java delete mode 100644 src/main/java/buttondevteam/presents/rtp/Rtp.java delete mode 100644 src/main/java/buttondevteam/presents/test/PersistenceTest.java delete mode 100644 src/main/java/buttondevteam/presents/test/TestComponent.java diff --git a/src/main/java/buttondevteam/presents/Main.java b/src/main/java/buttondevteam/presents/Main.java index f472481..136f5a1 100644 --- a/src/main/java/buttondevteam/presents/Main.java +++ b/src/main/java/buttondevteam/presents/Main.java @@ -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()+ ")."); diff --git a/src/main/java/buttondevteam/presents/metrics/MetricsComponent.java b/src/main/java/buttondevteam/presents/metrics/MetricsComponent.java deleted file mode 100644 index 68dffbe..0000000 --- a/src/main/java/buttondevteam/presents/metrics/MetricsComponent.java +++ /dev/null @@ -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()); - } - -} diff --git a/src/main/java/buttondevteam/presents/metrics/PlayerLogins.java b/src/main/java/buttondevteam/presents/metrics/PlayerLogins.java deleted file mode 100644 index 95cf5dc..0000000 --- a/src/main/java/buttondevteam/presents/metrics/PlayerLogins.java +++ /dev/null @@ -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(); - } -} diff --git a/src/main/java/buttondevteam/presents/metrics/PlayerLoginsPage.java b/src/main/java/buttondevteam/presents/metrics/PlayerLoginsPage.java deleted file mode 100644 index 3d6e5ac..0000000 --- a/src/main/java/buttondevteam/presents/metrics/PlayerLoginsPage.java +++ /dev/null @@ -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 = "

Player Login Metrics Screen

"; - return outputString; - } - -} diff --git a/src/main/java/buttondevteam/presents/rtp/RandomTeleportComponent.java b/src/main/java/buttondevteam/presents/rtp/RandomTeleportComponent.java deleted file mode 100644 index 5c83043..0000000 --- a/src/main/java/buttondevteam/presents/rtp/RandomTeleportComponent.java +++ /dev/null @@ -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()); - } - -} diff --git a/src/main/java/buttondevteam/presents/rtp/Rtp.java b/src/main/java/buttondevteam/presents/rtp/Rtp.java deleted file mode 100644 index f74b9ea..0000000 --- a/src/main/java/buttondevteam/presents/rtp/Rtp.java +++ /dev/null @@ -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; - } - - -} diff --git a/src/main/java/buttondevteam/presents/test/PersistenceTest.java b/src/main/java/buttondevteam/presents/test/PersistenceTest.java deleted file mode 100644 index ff1b855..0000000 --- a/src/main/java/buttondevteam/presents/test/PersistenceTest.java +++ /dev/null @@ -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"); - } - } - -} diff --git a/src/main/java/buttondevteam/presents/test/TestComponent.java b/src/main/java/buttondevteam/presents/test/TestComponent.java deleted file mode 100644 index 6ed9dbf..0000000 --- a/src/main/java/buttondevteam/presents/test/TestComponent.java +++ /dev/null @@ -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()); - - } - -}