From e43636b13df87957ed740e6bc900fba6e189d521 Mon Sep 17 00:00:00 2001 From: Christoph Date: Sat, 7 Oct 2017 18:19:08 +0200 Subject: [PATCH 1/6] Removed deprecated members and updated logger --- pom.xml | 38 +++++- .../shynixn/astraledit/api/AstralEditApi.java | 3 +- .../business/bukkit/AstralEditPlugin.java | 16 ++- .../worldedit/WorldEditConnection.java | 3 +- .../business/bukkit/nms/NMSRegistry.java | 4 +- .../business/logic/SelectionHolder.java | 25 ++-- .../business/logic/SelectionManager.java | 4 +- .../astraledit/lib/DirectionHelper.java | 68 --------- .../astraledit/lib/LocationBuilder.java | 24 ++-- .../astraledit/lib/SimpleCommandExecutor.java | 5 +- src/main/resources/plugin.yml | 2 +- .../shynixn/astraledit/DirectionTest.java | 129 ++++++++++++++++++ 12 files changed, 213 insertions(+), 108 deletions(-) delete mode 100644 src/main/java/com/github/shynixn/astraledit/lib/DirectionHelper.java create mode 100644 src/test/java/com/github/shynixn/astraledit/DirectionTest.java diff --git a/pom.xml b/pom.xml index 72b84d7..b6ce659 100644 --- a/pom.xml +++ b/pom.xml @@ -9,7 +9,7 @@ WorldEdit Extension to modify your world in a way you have not seen before. https://github.com/Shynixn/AstralEdit jar - 1.0.0 + 1.1.0-SNAPSHOT @@ -25,6 +25,7 @@ + D:/Temp/plugins UTF-8 UTF-8 @@ -38,12 +39,29 @@ attach-sources + verify jar-no-fork + + maven-surefire-plugin + 2.19.1 + + + org.junit.platform + junit-platform-surefire-provider + 1.0.0-M4 + + + org.junit.jupiter + junit-jupiter-engine + 5.0.0-M4 + + + org.apache.maven.plugins maven-javadoc-plugin @@ -51,6 +69,7 @@ attach-javadocs + verify jar @@ -64,7 +83,7 @@ sign-artifacts - verify + site sign @@ -91,7 +110,7 @@ - D:\Temp\plugins + ${astraledit.bukkit.test-server-path} jar-with-dependencies @@ -157,6 +176,18 @@ 1.0 ${basedir}/lib/spigot-1.12.jar + + org.mockito + mockito-core + RELEASE + test + + + org.junit.jupiter + junit-jupiter-api + 5.0.0-M4 + test + @@ -175,4 +206,5 @@ https://oss.sonatype.org/service/local/staging/deploy/maven2/ + \ No newline at end of file diff --git a/src/main/java/com/github/shynixn/astraledit/api/AstralEditApi.java b/src/main/java/com/github/shynixn/astraledit/api/AstralEditApi.java index a166360..ee01552 100644 --- a/src/main/java/com/github/shynixn/astraledit/api/AstralEditApi.java +++ b/src/main/java/com/github/shynixn/astraledit/api/AstralEditApi.java @@ -1,6 +1,7 @@ package com.github.shynixn.astraledit.api; import com.github.shynixn.astraledit.api.entity.Selection; +import com.github.shynixn.astraledit.business.bukkit.AstralEditPlugin; import com.github.shynixn.astraledit.business.bukkit.dependencies.worldedit.WorldEditConnection; import com.github.shynixn.astraledit.business.logic.SelectionManager; import org.bukkit.Bukkit; @@ -42,7 +43,7 @@ private static void shutdown() { manager = null; } } catch (final Exception e) { - Bukkit.getLogger().log(Level.WARNING, "Failed to clean up.", e); + AstralEditPlugin.logger().log(Level.WARNING, "Failed to clean up.", e); } } diff --git a/src/main/java/com/github/shynixn/astraledit/business/bukkit/AstralEditPlugin.java b/src/main/java/com/github/shynixn/astraledit/business/bukkit/AstralEditPlugin.java index 7465363..64a9439 100644 --- a/src/main/java/com/github/shynixn/astraledit/business/bukkit/AstralEditPlugin.java +++ b/src/main/java/com/github/shynixn/astraledit/business/bukkit/AstralEditPlugin.java @@ -11,6 +11,7 @@ import java.lang.reflect.InvocationTargetException; import java.util.logging.Level; +import java.util.logging.Logger; /** * Copyright 2017 Shynixn @@ -47,12 +48,14 @@ public class AstralEditPlugin extends JavaPlugin { public static final String PREFIX = ChatColor.DARK_RED + "" + ChatColor.BOLD + "[" + ChatColor.RED + "" + ChatColor.BOLD + ChatColor.ITALIC + "AE" + ChatColor.DARK_RED + "" + ChatColor.BOLD + "] " + ChatColor.RED; public static final String PREFIX_SUCCESS = PREFIX + ChatColor.GREEN; public static final String PREFIX_ERROR = PREFIX + ChatColor.RED; + private static Logger logger; /** * Enables the plugin */ @Override public void onEnable() { + logger = this.getLogger(); if (!VersionSupport.isServerVersionSupported(PLUGIN_NAME, PREFIX_CONSOLE) || !DependencySupport.areRequiredDependenciesInstalled(PLUGIN_NAME, PREFIX_CONSOLE)) { Bukkit.getPluginManager().disablePlugin(this); } else { @@ -62,7 +65,7 @@ public void onEnable() { ReflectionUtils.invokeMethodByClass(AstralEditApi.class, "initialize", new Class[]{Plugin.class}, new Object[]{this}); Bukkit.getServer().getConsoleSender().sendMessage(PREFIX_CONSOLE + ChatColor.GREEN + "Enabled AstralEdit " + this.getDescription().getVersion() + " by Shynixn"); } catch (NoSuchMethodException | InvocationTargetException | IllegalAccessException e) { - Bukkit.getLogger().log(Level.WARNING, "Failed to initialize plugin.", e); + AstralEditPlugin.logger().log(Level.WARNING, "Failed to initialize plugin.", e); } } } @@ -75,7 +78,16 @@ public void onDisable() { try { ReflectionUtils.invokeMethodByClass(AstralEditApi.class, "shutdown", new Class[0], new Object[0]); } catch (NoSuchMethodException | InvocationTargetException | IllegalAccessException e) { - Bukkit.getLogger().log(Level.WARNING, "Failed to initialize plugin.", e); + AstralEditPlugin.logger().log(Level.WARNING, "Failed to initialize plugin.", e); } } + + /** + * Returns the logger of the AstralEdit plugin + * + * @return logger + */ + public static Logger logger() { + return logger; + } } diff --git a/src/main/java/com/github/shynixn/astraledit/business/bukkit/dependencies/worldedit/WorldEditConnection.java b/src/main/java/com/github/shynixn/astraledit/business/bukkit/dependencies/worldedit/WorldEditConnection.java index 9ced411..1c5ad5f 100644 --- a/src/main/java/com/github/shynixn/astraledit/business/bukkit/dependencies/worldedit/WorldEditConnection.java +++ b/src/main/java/com/github/shynixn/astraledit/business/bukkit/dependencies/worldedit/WorldEditConnection.java @@ -1,5 +1,6 @@ package com.github.shynixn.astraledit.business.bukkit.dependencies.worldedit; +import com.github.shynixn.astraledit.business.bukkit.AstralEditPlugin; import com.github.shynixn.astraledit.lib.ReflectionUtils; import org.bukkit.Bukkit; import org.bukkit.Location; @@ -102,7 +103,7 @@ private static Location getSelection(Player player, String type) { if (object != null) return (Location) ReflectionUtils.invokeMethodByObject(object, type, new Class[0], new Object[0], Class.forName("com.sk89q.worldedit.bukkit.selections.RegionSelection")); } catch (NoSuchMethodException | InvocationTargetException | IllegalAccessException | ClassNotFoundException e) { - Bukkit.getLogger().log(Level.WARNING, "Cannot access WorldEdit.", e); + AstralEditPlugin.logger().log(Level.WARNING, "Cannot access WorldEdit.", e); } return null; } diff --git a/src/main/java/com/github/shynixn/astraledit/business/bukkit/nms/NMSRegistry.java b/src/main/java/com/github/shynixn/astraledit/business/bukkit/nms/NMSRegistry.java index d3fbeb7..a85eaa4 100644 --- a/src/main/java/com/github/shynixn/astraledit/business/bukkit/nms/NMSRegistry.java +++ b/src/main/java/com/github/shynixn/astraledit/business/bukkit/nms/NMSRegistry.java @@ -1,8 +1,8 @@ package com.github.shynixn.astraledit.business.bukkit.nms; import com.github.shynixn.astraledit.api.entity.PacketArmorstand; +import com.github.shynixn.astraledit.business.bukkit.AstralEditPlugin; import com.github.shynixn.astraledit.lib.ReflectionUtils; -import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.entity.Player; @@ -62,7 +62,7 @@ public static PacketArmorstand createPacketArmorstand(Player player, Location lo , new Class[]{Player.class, Location.class, int.class, byte.class, Set.class} , new Object[]{player, location, id, data, watchers}); } catch (IllegalAccessException | InvocationTargetException | InstantiationException | NoSuchMethodException | ClassNotFoundException e) { - Bukkit.getLogger().log(Level.WARNING, "Failed to create packetArmorstand.", e); + AstralEditPlugin.logger().log(Level.WARNING, "Failed to create packetArmorstand.", e); throw new RuntimeException("Failed to create packetArmorstand."); } } diff --git a/src/main/java/com/github/shynixn/astraledit/business/logic/SelectionHolder.java b/src/main/java/com/github/shynixn/astraledit/business/logic/SelectionHolder.java index 3cb09a2..ea07e5e 100644 --- a/src/main/java/com/github/shynixn/astraledit/business/logic/SelectionHolder.java +++ b/src/main/java/com/github/shynixn/astraledit/business/logic/SelectionHolder.java @@ -4,7 +4,6 @@ import com.github.shynixn.astraledit.api.entity.Selection; import com.github.shynixn.astraledit.business.bukkit.AstralEditPlugin; import com.github.shynixn.astraledit.business.bukkit.nms.NMSRegistry; -import com.github.shynixn.astraledit.lib.DirectionHelper; import com.github.shynixn.astraledit.lib.LocationBuilder; import org.bukkit.Location; import org.bukkit.Material; @@ -477,27 +476,27 @@ private void rotate(Location location) { for (int j = 0; j < this.getYWidth(); j++) { for (int k = 0; k < this.getZWidth(); k++) { if (this.stands[i][j][k] != null) { - Location location2; + final LocationBuilder location2 = new LocationBuilder(location); if (!this.isMirrored) { - location2 = DirectionHelper.getLocationTo(location, DirectionHelper.Direction.LEFT, i); + location2.relativePosition(i, LocationBuilder.Direction.LEFT); if (!this.flipped) { - location2 = DirectionHelper.getLocationTo(location2, DirectionHelper.Direction.UP, j); - location2 = DirectionHelper.getLocationTo(location2, DirectionHelper.Direction.FRONT, k); + location2.relativePosition(j, LocationBuilder.Direction.UP); + location2.relativePosition(k, LocationBuilder.Direction.FORWARD); } else { - location2 = DirectionHelper.getLocationTo(location2, DirectionHelper.Direction.FRONT, j); - location2 = DirectionHelper.getLocationTo(location2, DirectionHelper.Direction.UP, k); + location2.relativePosition(j, LocationBuilder.Direction.FORWARD); + location2.relativePosition(k, LocationBuilder.Direction.UP); } } else { - location2 = DirectionHelper.getLocationTo(location, DirectionHelper.Direction.FRONT, i); + location2.relativePosition(i, LocationBuilder.Direction.FORWARD); if (!this.flipped) { - location2 = DirectionHelper.getLocationTo(location2, DirectionHelper.Direction.UP, j); - location2 = DirectionHelper.getLocationTo(location2, DirectionHelper.Direction.LEFT, k); + location2.relativePosition(j, LocationBuilder.Direction.UP); + location2.relativePosition(k, LocationBuilder.Direction.LEFT); } else { - location2 = DirectionHelper.getLocationTo(location2, DirectionHelper.Direction.LEFT, j); - location2 = DirectionHelper.getLocationTo(location2, DirectionHelper.Direction.UP, k); + location2.relativePosition(j, LocationBuilder.Direction.LEFT); + location2.relativePosition(k, LocationBuilder.Direction.UP); } } - this.stands[i][j][k].teleport(location2); + this.stands[i][j][k].teleport(location2.toLocation()); } } } diff --git a/src/main/java/com/github/shynixn/astraledit/business/logic/SelectionManager.java b/src/main/java/com/github/shynixn/astraledit/business/logic/SelectionManager.java index 973ba7b..47afdf6 100644 --- a/src/main/java/com/github/shynixn/astraledit/business/logic/SelectionManager.java +++ b/src/main/java/com/github/shynixn/astraledit/business/logic/SelectionManager.java @@ -58,7 +58,7 @@ public void addSelection(Player player, Selection selection) { this.selections.put(player, (SelectionHolder) selection); } } catch (final Exception e) { - Bukkit.getLogger().log(Level.WARNING, "Failed to clear selection.", e); + AstralEditPlugin.logger().log(Level.WARNING, "Failed to clear selection.", e); } } @@ -97,7 +97,7 @@ public void clearSelection(Player player) { this.selections.remove(player); } } catch (final Exception e) { - Bukkit.getLogger().log(Level.WARNING, "Failed to clear selection.", e); + AstralEditPlugin.logger().log(Level.WARNING, "Failed to clear selection.", e); } } diff --git a/src/main/java/com/github/shynixn/astraledit/lib/DirectionHelper.java b/src/main/java/com/github/shynixn/astraledit/lib/DirectionHelper.java deleted file mode 100644 index 0a7f012..0000000 --- a/src/main/java/com/github/shynixn/astraledit/lib/DirectionHelper.java +++ /dev/null @@ -1,68 +0,0 @@ -package com.github.shynixn.astraledit.lib; - -import org.bukkit.Location; -import org.bukkit.entity.Entity; - -@Deprecated -public class DirectionHelper { - public static Location getLocationTo(Location location, Direction direction, double distance) { - if (direction == Direction.FRONT || direction == Direction.BACK) { - if (Direction.BACK == direction) { - distance = distance * -1; - } - return new Location(location.getWorld(), calcNewX(location, distance, 1), location.getY(), calcNewZ(location, distance, 1), location.getYaw(), location.getPitch()); - } else if (direction == Direction.LEFT || direction == Direction.RIGHT) { - if (Direction.RIGHT == direction) { - distance = distance * -1; - } - return new Location(location.getWorld(), calcNewX(location, distance, 0), location.getY(), calcNewZ(location, distance, 0), location.getYaw(), location.getPitch()); - } else if (direction == Direction.UP) { - return new Location(location.getWorld(), location.getX(), location.getY() + distance, location.getZ(), location.getYaw(), location.getPitch()); - } else if (direction == Direction.DOWN) { - distance = distance * -1; - return new Location(location.getWorld(), location.getX(), location.getY() + distance, location.getZ(), location.getYaw(), location.getPitch()); - } - return null; - } - - public static Location getLocationTo(Entity entity, Direction direction, double distance) { - return getLocationTo(entity.getLocation().clone(), direction, distance); - } - - public static Location getLocationTo(Entity entity, double frontback, double updown, double leftright) { - return getLocationTo(entity.getLocation().clone(), frontback, leftright, updown); - } - - public static Location getLocationTo(Location location, double frontback, double updown, double leftright) { - if (frontback < 0) - location = getLocationTo(location, Direction.BACK, frontback * -1); - else - location = getLocationTo(location, Direction.FRONT, frontback); - if (leftright < 0) - location = getLocationTo(location, Direction.LEFT, frontback * -1); - else - location = getLocationTo(location, Direction.RIGHT, frontback); - if (updown < 0) - location = getLocationTo(location, Direction.DOWN, frontback * -1); - else - location = getLocationTo(location, Direction.UP, frontback); - return location; - } - - private static double calcNewZ(Location location, double distance, int direction) { - return (location.getZ() + (distance * Math.sin(Math.toRadians(location.getYaw() + 90 * direction)))); - } - - private static double calcNewX(Location location, double distance, int direction) { - return (location.getX() + (distance * Math.cos(Math.toRadians(location.getYaw() + 90 * direction)))); - } - - public static enum Direction { - LEFT, - RIGHT, - DOWN, - UP, - FRONT, - BACK; - } -} diff --git a/src/main/java/com/github/shynixn/astraledit/lib/LocationBuilder.java b/src/main/java/com/github/shynixn/astraledit/lib/LocationBuilder.java index 8cd8351..e78ffb2 100644 --- a/src/main/java/com/github/shynixn/astraledit/lib/LocationBuilder.java +++ b/src/main/java/com/github/shynixn/astraledit/lib/LocationBuilder.java @@ -11,15 +11,13 @@ import java.util.Map; /** - * Copyright 2017 Shynixn + * Manages positions and relative locations. *

- * Do not remove this header! - *

- * Version 1.0 + * Version 1.1 *

* MIT License *

- * Copyright (c) 2016 + * Copyright (c) 2017 by Shynixn *

* Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -389,17 +387,17 @@ public EulerAngle toAngle() { */ public LocationBuilder relativePosition(double distance, Direction direction) { if (direction == Direction.FORWARD) { - this.x += (distance * Math.sin(Math.toRadians(this.yaw + 90))); - this.z += (distance * Math.cos(Math.toRadians(this.yaw + 90))); + this.x += (distance * Math.cos(Math.toRadians(this.yaw + 90))); + this.z += (distance * Math.sin(Math.toRadians(this.yaw + 90))); } else if (direction == Direction.BACKWARDS) { - this.x += (-1 * distance * Math.sin(Math.toRadians(this.yaw + 90))); - this.z += (-1 * distance * Math.cos(Math.toRadians(this.yaw + 90))); + this.x -= (distance * Math.cos(Math.toRadians(this.yaw + 90))); + this.z -= (distance * Math.sin(Math.toRadians(this.yaw + 90))); } else if (direction == Direction.LEFT) { - this.x += (distance * Math.sin(Math.toRadians(this.yaw))); - this.z += (distance * Math.cos(Math.toRadians(this.yaw))); + this.x += (distance * Math.cos(Math.toRadians(this.yaw))); + this.z += (distance * Math.sin(Math.toRadians(this.yaw))); } else if (direction == Direction.RIGHT) { - this.x += (-1 * distance * Math.sin(Math.toRadians(this.yaw))); - this.z += (-1 * distance * Math.cos(Math.toRadians(this.yaw))); + this.x -= (distance * Math.cos(Math.toRadians(this.yaw))); + this.z -= (distance * Math.sin(Math.toRadians(this.yaw))); } else if (direction == Direction.UP) { this.y += distance; } else if (direction == Direction.DOWN) { diff --git a/src/main/java/com/github/shynixn/astraledit/lib/SimpleCommandExecutor.java b/src/main/java/com/github/shynixn/astraledit/lib/SimpleCommandExecutor.java index 1aaa258..3489fb0 100644 --- a/src/main/java/com/github/shynixn/astraledit/lib/SimpleCommandExecutor.java +++ b/src/main/java/com/github/shynixn/astraledit/lib/SimpleCommandExecutor.java @@ -1,5 +1,6 @@ package com.github.shynixn.astraledit.lib; +import com.github.shynixn.astraledit.business.bukkit.AstralEditPlugin; import org.bukkit.Bukkit; import org.bukkit.command.Command; import org.bukkit.command.CommandExecutor; @@ -132,7 +133,7 @@ public UnRegistered(String command, String plugin) { */ public UnRegistered(String command, JavaPlugin plugin) { this(command, '/' + command, "", command + ".admin", "You are not allowed to use this command.", plugin); - Bukkit.getLogger().log(Level.WARNING, "This is only for production useage and should be replaced in the release version."); + AstralEditPlugin.logger().log(Level.WARNING, "This is only for production useage and should be replaced in the release version."); } /** @@ -233,7 +234,7 @@ private void registerDynamicCommand(String command) { final SimpleCommandMap map = (SimpleCommandMap) server.getClass().getDeclaredMethod("getCommandMap").invoke(server); map.register(command, this); } catch (final Exception ex) { - Bukkit.getLogger().log(Level.WARNING, "Cannot register dynamic command.", ex); + AstralEditPlugin.logger().log(Level.WARNING, "Cannot register dynamic command.", ex); } } diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index c783613..310b10b 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -1,5 +1,5 @@ name: AstralEdit -version: 1.0.0 +version: 1.1.0-SNAPSHOT author: Shynixn website: https://www.spigotmc.org/members/shynixn.63455/ main: com.github.shynixn.astraledit.business.bukkit.AstralEditPlugin diff --git a/src/test/java/com/github/shynixn/astraledit/DirectionTest.java b/src/test/java/com/github/shynixn/astraledit/DirectionTest.java new file mode 100644 index 0000000..fe86c8c --- /dev/null +++ b/src/test/java/com/github/shynixn/astraledit/DirectionTest.java @@ -0,0 +1,129 @@ +package com.github.shynixn.astraledit; + +import com.github.shynixn.astraledit.lib.LocationBuilder; +import org.bukkit.Location; +import org.bukkit.World; +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.mockito.Mockito.mock; + +/** + * Created by Shynixn 2017. + *

+ * Version 1.1 + *

+ * MIT License + *

+ * Copyright (c) 2017 by Shynixn + *

+ * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + *

+ * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + *

+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +public class DirectionTest { + + @Test + public void onRelativeRightDirectionTest() { + final World world = mock(World.class); + final Location location1 = new Location(world, 5, 282, 201.2); + final LocationBuilder location3 = new LocationBuilder(location1); + assertEquals(location1.getX(), location3.getX()); + location3.relativePosition(5, LocationBuilder.Direction.RIGHT); + + assertEquals(0.0, location3.getX()); + assertEquals(282.0, location3.getY()); + assertEquals(201.2, location3.getZ()); + assertEquals(0.0, location3.getYaw()); + assertEquals(0.0, location3.getPitch()); + } + + @Test + public void onRelativeLeftDirectionTest() { + final World world = mock(World.class); + final Location location1 = new Location(world, 5, 282, 201.2); + final LocationBuilder location3 = new LocationBuilder(location1); + assertEquals(location1.getX(), location3.getX()); + location3.relativePosition(7, LocationBuilder.Direction.LEFT); + + assertEquals(12.0, location3.getX()); + assertEquals(282.0, location3.getY()); + assertEquals(201.2, location3.getZ()); + assertEquals(0.0, location3.getYaw()); + assertEquals(0.0, location3.getPitch()); + } + + @Test + public void onRelativeForwardDirectionTest() { + final World world = mock(World.class); + final Location location1 = new Location(world, 5, 282, 201.2); + final LocationBuilder location3 = new LocationBuilder(location1); + assertEquals(location1.getX(), location3.getX()); + location3.relativePosition(18, LocationBuilder.Direction.FORWARD); + + assertEquals(5.000000000000001, location3.getX()); + assertEquals(282.0, location3.getY()); + assertEquals(219.2, location3.getZ()); + assertEquals(0.0, location3.getYaw()); + assertEquals(0.0, location3.getPitch()); + } + + @Test + public void onRelativeBackDirectionTest() { + final World world = mock(World.class); + final Location location1 = new Location(world, 5, 282, 201.2); + final LocationBuilder location3 = new LocationBuilder(location1); + assertEquals(location1.getX(), location3.getX()); + location3.relativePosition(9, LocationBuilder.Direction.BACKWARDS); + + assertEquals(4.999999999999999, location3.getX()); + assertEquals(282.0, location3.getY()); + assertEquals(192.2, location3.getZ()); + assertEquals(0.0, location3.getYaw()); + assertEquals(0.0, location3.getPitch()); + } + + @Test + public void onRelativeUpDirectionTest() { + final World world = mock(World.class); + final Location location1 = new Location(world, 5, 282, 201.2); + final LocationBuilder location3 = new LocationBuilder(location1); + assertEquals(location1.getX(), location3.getX()); + location3.relativePosition(11, LocationBuilder.Direction.UP); + + assertEquals(5.0, location3.getX()); + assertEquals(293.0, location3.getY()); + assertEquals(201.2, location3.getZ()); + assertEquals(0.0, location3.getYaw()); + assertEquals(0.0, location3.getPitch()); + } + + @Test + public void onRelativeDownDirectionTest() { + final World world = mock(World.class); + final Location location1 = new Location(world, 5, 282, 201.2); + final LocationBuilder location3 = new LocationBuilder(location1); + assertEquals(location1.getX(), location3.getX()); + location3.relativePosition(27, LocationBuilder.Direction.DOWN); + + assertEquals(5.0, location3.getX()); + assertEquals(255.0, location3.getY()); + assertEquals(201.2, location3.getZ()); + assertEquals(0.0, location3.getYaw()); + assertEquals(0.0, location3.getPitch()); + } +} From d39536435eca871f782422c45938677431568d0e Mon Sep 17 00:00:00 2001 From: Christoph Date: Sat, 7 Oct 2017 18:33:22 +0200 Subject: [PATCH 2/6] Fixed code style --- .../shynixn/astraledit/api/AstralEditApi.java | 1 - .../api/entity/PacketArmorstand.java | 1 - .../astraledit/api/entity/Selection.java | 2 +- .../business/bukkit/AstralEditPlugin.java | 2 +- .../business/bukkit/Permission.java | 18 +++++++++++++++- .../nms/v1_10_R1/DisplayArmorstand.java | 3 +-- .../nms/v1_11_R1/DisplayArmorstand.java | 3 +-- .../nms/v1_12_R1/DisplayArmorstand.java | 3 --- .../bukkit/nms/v1_8_R1/DisplayArmorstand.java | 2 +- .../bukkit/nms/v1_8_R2/DisplayArmorstand.java | 3 +-- .../bukkit/nms/v1_8_R3/DisplayArmorstand.java | 3 +-- .../bukkit/nms/v1_9_R1/DisplayArmorstand.java | 3 +-- .../bukkit/nms/v1_9_R2/DisplayArmorstand.java | 3 +-- .../astraledit/business/logic/Container.java | 6 +++--- .../business/logic/OperationType.java | 2 +- .../logic/SelectionCommandExecutor.java | 8 +++---- .../business/logic/SelectionHolder.java | 21 ++++++++++--------- .../business/logic/SelectionListener.java | 3 +-- .../business/logic/SelectionManager.java | 4 ++-- .../astraledit/lib/LocationBuilder.java | 19 ++--------------- .../astraledit/lib/SimpleCommandExecutor.java | 2 +- .../astraledit/lib/SimpleListener.java | 2 +- 22 files changed, 52 insertions(+), 62 deletions(-) diff --git a/src/main/java/com/github/shynixn/astraledit/api/AstralEditApi.java b/src/main/java/com/github/shynixn/astraledit/api/AstralEditApi.java index ee01552..55a369d 100644 --- a/src/main/java/com/github/shynixn/astraledit/api/AstralEditApi.java +++ b/src/main/java/com/github/shynixn/astraledit/api/AstralEditApi.java @@ -4,7 +4,6 @@ import com.github.shynixn.astraledit.business.bukkit.AstralEditPlugin; import com.github.shynixn.astraledit.business.bukkit.dependencies.worldedit.WorldEditConnection; import com.github.shynixn.astraledit.business.logic.SelectionManager; -import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.entity.Player; import org.bukkit.plugin.Plugin; diff --git a/src/main/java/com/github/shynixn/astraledit/api/entity/PacketArmorstand.java b/src/main/java/com/github/shynixn/astraledit/api/entity/PacketArmorstand.java index f927bcf..d2bd253 100644 --- a/src/main/java/com/github/shynixn/astraledit/api/entity/PacketArmorstand.java +++ b/src/main/java/com/github/shynixn/astraledit/api/entity/PacketArmorstand.java @@ -1,7 +1,6 @@ package com.github.shynixn.astraledit.api.entity; import org.bukkit.Location; -import org.bukkit.entity.Player; import org.bukkit.util.EulerAngle; /** diff --git a/src/main/java/com/github/shynixn/astraledit/api/entity/Selection.java b/src/main/java/com/github/shynixn/astraledit/api/entity/Selection.java index bb37dba..4c04e14 100644 --- a/src/main/java/com/github/shynixn/astraledit/api/entity/Selection.java +++ b/src/main/java/com/github/shynixn/astraledit/api/entity/Selection.java @@ -99,7 +99,7 @@ public interface Selection extends AutoCloseable { void upSideDown(); /** - * Mirros the selection + * Mirrors the selection */ void mirror(); diff --git a/src/main/java/com/github/shynixn/astraledit/business/bukkit/AstralEditPlugin.java b/src/main/java/com/github/shynixn/astraledit/business/bukkit/AstralEditPlugin.java index 64a9439..402ba87 100644 --- a/src/main/java/com/github/shynixn/astraledit/business/bukkit/AstralEditPlugin.java +++ b/src/main/java/com/github/shynixn/astraledit/business/bukkit/AstralEditPlugin.java @@ -45,7 +45,7 @@ public class AstralEditPlugin extends JavaPlugin { public static final String PLUGIN_NAME = "AstralEdit"; public static final String PREFIX_CONSOLE = ChatColor.LIGHT_PURPLE + "[AstralEdit] "; - public static final String PREFIX = ChatColor.DARK_RED + "" + ChatColor.BOLD + "[" + ChatColor.RED + "" + ChatColor.BOLD + ChatColor.ITALIC + "AE" + ChatColor.DARK_RED + "" + ChatColor.BOLD + "] " + ChatColor.RED; + public static final String PREFIX = ChatColor.DARK_RED + "" + ChatColor.BOLD + '[' + ChatColor.RED + "" + ChatColor.BOLD + ChatColor.ITALIC + "AE" + ChatColor.DARK_RED + "" + ChatColor.BOLD + "] " + ChatColor.RED; public static final String PREFIX_SUCCESS = PREFIX + ChatColor.GREEN; public static final String PREFIX_ERROR = PREFIX + ChatColor.RED; private static Logger logger; diff --git a/src/main/java/com/github/shynixn/astraledit/business/bukkit/Permission.java b/src/main/java/com/github/shynixn/astraledit/business/bukkit/Permission.java index 7c03768..e61bc3b 100644 --- a/src/main/java/com/github/shynixn/astraledit/business/bukkit/Permission.java +++ b/src/main/java/com/github/shynixn/astraledit/business/bukkit/Permission.java @@ -54,16 +54,32 @@ public enum Permission { HIDE_OTHER("astraledit.commands.hideother"), SHOW_OTHER("astraledit.commands.showother"),; - private String text; + private final String text; + /** + * Initializes a new permission + * + * @param text text + */ Permission(String text) { this.text = text; } + /** + * Returns if the given player has permissions + * + * @param player player + * @return has + */ public boolean hasPermission(Player player) { return player.hasPermission(this.text); } + /** + * Returns the text of the permission + * + * @return text + */ public String getText() { return this.text; } diff --git a/src/main/java/com/github/shynixn/astraledit/business/bukkit/nms/v1_10_R1/DisplayArmorstand.java b/src/main/java/com/github/shynixn/astraledit/business/bukkit/nms/v1_10_R1/DisplayArmorstand.java index df66401..c0a4012 100644 --- a/src/main/java/com/github/shynixn/astraledit/business/bukkit/nms/v1_10_R1/DisplayArmorstand.java +++ b/src/main/java/com/github/shynixn/astraledit/business/bukkit/nms/v1_10_R1/DisplayArmorstand.java @@ -14,7 +14,6 @@ import org.bukkit.entity.Player; import org.bukkit.util.EulerAngle; -import java.io.Closeable; import java.util.Set; /** @@ -52,7 +51,7 @@ public class DisplayArmorstand implements PacketArmorstand { private final EntityArmorStand armorStand; private int storedId; private byte storedData; - private Set watchers; + private final Set watchers; /** * Initializes the armorstand diff --git a/src/main/java/com/github/shynixn/astraledit/business/bukkit/nms/v1_11_R1/DisplayArmorstand.java b/src/main/java/com/github/shynixn/astraledit/business/bukkit/nms/v1_11_R1/DisplayArmorstand.java index 3df13dd..d0becb6 100644 --- a/src/main/java/com/github/shynixn/astraledit/business/bukkit/nms/v1_11_R1/DisplayArmorstand.java +++ b/src/main/java/com/github/shynixn/astraledit/business/bukkit/nms/v1_11_R1/DisplayArmorstand.java @@ -14,7 +14,6 @@ import org.bukkit.entity.Player; import org.bukkit.util.EulerAngle; -import java.io.Closeable; import java.util.Set; /** @@ -52,7 +51,7 @@ public class DisplayArmorstand implements PacketArmorstand { private final EntityArmorStand armorStand; private int storedId; private byte storedData; - private Set watchers; + private final Set watchers; /** * Initializes the armorstand diff --git a/src/main/java/com/github/shynixn/astraledit/business/bukkit/nms/v1_12_R1/DisplayArmorstand.java b/src/main/java/com/github/shynixn/astraledit/business/bukkit/nms/v1_12_R1/DisplayArmorstand.java index 737757c..b46ec13 100644 --- a/src/main/java/com/github/shynixn/astraledit/business/bukkit/nms/v1_12_R1/DisplayArmorstand.java +++ b/src/main/java/com/github/shynixn/astraledit/business/bukkit/nms/v1_12_R1/DisplayArmorstand.java @@ -3,7 +3,6 @@ import com.github.shynixn.astraledit.api.entity.PacketArmorstand; import com.github.shynixn.astraledit.business.bukkit.nms.NMSRegistry; import com.github.shynixn.astraledit.lib.ItemStackBuilder; -import com.github.shynixn.astraledit.lib.ReflectionUtils; import net.minecraft.server.v1_12_R1.*; import org.bukkit.Location; import org.bukkit.Material; @@ -15,8 +14,6 @@ import org.bukkit.entity.Player; import org.bukkit.util.EulerAngle; -import java.lang.reflect.InvocationTargetException; -import java.util.List; import java.util.Set; /** diff --git a/src/main/java/com/github/shynixn/astraledit/business/bukkit/nms/v1_8_R1/DisplayArmorstand.java b/src/main/java/com/github/shynixn/astraledit/business/bukkit/nms/v1_8_R1/DisplayArmorstand.java index 4a1cc6c..fe62fcc 100644 --- a/src/main/java/com/github/shynixn/astraledit/business/bukkit/nms/v1_8_R1/DisplayArmorstand.java +++ b/src/main/java/com/github/shynixn/astraledit/business/bukkit/nms/v1_8_R1/DisplayArmorstand.java @@ -51,7 +51,7 @@ public class DisplayArmorstand implements PacketArmorstand { private final EntityArmorStand armorStand; private int storedId; private byte storedData; - private Set watchers; + private final Set watchers; /** * Initializes the armorstand diff --git a/src/main/java/com/github/shynixn/astraledit/business/bukkit/nms/v1_8_R2/DisplayArmorstand.java b/src/main/java/com/github/shynixn/astraledit/business/bukkit/nms/v1_8_R2/DisplayArmorstand.java index 873aa7d..392611f 100644 --- a/src/main/java/com/github/shynixn/astraledit/business/bukkit/nms/v1_8_R2/DisplayArmorstand.java +++ b/src/main/java/com/github/shynixn/astraledit/business/bukkit/nms/v1_8_R2/DisplayArmorstand.java @@ -14,7 +14,6 @@ import org.bukkit.entity.Player; import org.bukkit.util.EulerAngle; -import java.io.Closeable; import java.util.Set; /** @@ -52,7 +51,7 @@ public class DisplayArmorstand implements PacketArmorstand { private final EntityArmorStand armorStand; private int storedId; private byte storedData; - private Set watchers; + private final Set watchers; /** * Initializes the armorstand diff --git a/src/main/java/com/github/shynixn/astraledit/business/bukkit/nms/v1_8_R3/DisplayArmorstand.java b/src/main/java/com/github/shynixn/astraledit/business/bukkit/nms/v1_8_R3/DisplayArmorstand.java index 73dcc22..4e6811c 100644 --- a/src/main/java/com/github/shynixn/astraledit/business/bukkit/nms/v1_8_R3/DisplayArmorstand.java +++ b/src/main/java/com/github/shynixn/astraledit/business/bukkit/nms/v1_8_R3/DisplayArmorstand.java @@ -14,7 +14,6 @@ import org.bukkit.entity.Player; import org.bukkit.util.EulerAngle; -import java.io.Closeable; import java.util.Set; /** @@ -52,7 +51,7 @@ public class DisplayArmorstand implements PacketArmorstand { private final EntityArmorStand armorStand; private int storedId; private byte storedData; - private Set watchers; + private final Set watchers; /** * Initializes the armorstand diff --git a/src/main/java/com/github/shynixn/astraledit/business/bukkit/nms/v1_9_R1/DisplayArmorstand.java b/src/main/java/com/github/shynixn/astraledit/business/bukkit/nms/v1_9_R1/DisplayArmorstand.java index cced26f..a44f63d 100644 --- a/src/main/java/com/github/shynixn/astraledit/business/bukkit/nms/v1_9_R1/DisplayArmorstand.java +++ b/src/main/java/com/github/shynixn/astraledit/business/bukkit/nms/v1_9_R1/DisplayArmorstand.java @@ -14,7 +14,6 @@ import org.bukkit.entity.Player; import org.bukkit.util.EulerAngle; -import java.io.Closeable; import java.util.Set; /** @@ -52,7 +51,7 @@ public class DisplayArmorstand implements PacketArmorstand { private final EntityArmorStand armorStand; private int storedId; private byte storedData; - private Set watchers; + private final Set watchers; /** * Initializes the armorstand diff --git a/src/main/java/com/github/shynixn/astraledit/business/bukkit/nms/v1_9_R2/DisplayArmorstand.java b/src/main/java/com/github/shynixn/astraledit/business/bukkit/nms/v1_9_R2/DisplayArmorstand.java index 5881fe3..8dae1aa 100644 --- a/src/main/java/com/github/shynixn/astraledit/business/bukkit/nms/v1_9_R2/DisplayArmorstand.java +++ b/src/main/java/com/github/shynixn/astraledit/business/bukkit/nms/v1_9_R2/DisplayArmorstand.java @@ -14,7 +14,6 @@ import org.bukkit.entity.Player; import org.bukkit.util.EulerAngle; -import java.io.Closeable; import java.util.Set; /** @@ -52,7 +51,7 @@ public class DisplayArmorstand implements PacketArmorstand { private final EntityArmorStand armorStand; private int storedId; private byte storedData; - private Set watchers; + private final Set watchers; /** * Initializes the armorstand diff --git a/src/main/java/com/github/shynixn/astraledit/business/logic/Container.java b/src/main/java/com/github/shynixn/astraledit/business/logic/Container.java index 41d96a3..237619f 100644 --- a/src/main/java/com/github/shynixn/astraledit/business/logic/Container.java +++ b/src/main/java/com/github/shynixn/astraledit/business/logic/Container.java @@ -32,9 +32,9 @@ * SOFTWARE. */ class Container { - int id; - byte data; - LocationBuilder location; + final int id; + final byte data; + final LocationBuilder location; /** * Initializes a new container diff --git a/src/main/java/com/github/shynixn/astraledit/business/logic/OperationType.java b/src/main/java/com/github/shynixn/astraledit/business/logic/OperationType.java index 1342e1a..6edb771 100644 --- a/src/main/java/com/github/shynixn/astraledit/business/logic/OperationType.java +++ b/src/main/java/com/github/shynixn/astraledit/business/logic/OperationType.java @@ -39,5 +39,5 @@ enum OperationType { COMBINE, PLACE, MOVE, - CONVERTOBLOCKS; + CONVERTOBLOCKS } diff --git a/src/main/java/com/github/shynixn/astraledit/business/logic/SelectionCommandExecutor.java b/src/main/java/com/github/shynixn/astraledit/business/logic/SelectionCommandExecutor.java index 6a8912a..cad9053 100644 --- a/src/main/java/com/github/shynixn/astraledit/business/logic/SelectionCommandExecutor.java +++ b/src/main/java/com/github/shynixn/astraledit/business/logic/SelectionCommandExecutor.java @@ -180,7 +180,7 @@ private void teleportPlayerToRenderCommand(Player player) { private void convertToRenderCommand(final Player player) { this.runAsyncTask(() -> { try { - player.sendMessage(AstralEditPlugin.PREFIX_SUCCESS + "Removing blocks and rendering selection asynchronly..."); + player.sendMessage(AstralEditPlugin.PREFIX_SUCCESS + "Removing blocks and rendering selection asynchronously..."); this.plugin.getServer().getScheduler().runTaskAsynchronously(this.plugin, () -> { AstralEditApi.renderAndDestroy(player); player.sendMessage(AstralEditPlugin.PREFIX_SUCCESS + "Finished converting selection."); @@ -339,7 +339,7 @@ private void flipRenderCommand(Player player) { } /** - * Mirros the given selection + * Mirrors the given selection * * @param player player */ @@ -470,7 +470,7 @@ private void combineCommand(Player player) { */ private void createRenderCommand(final Player player) { this.runAsyncTask(() -> { - player.sendMessage(AstralEditPlugin.PREFIX_SUCCESS + "Rendering WorldEdit-Selection asynchronly..."); + player.sendMessage(AstralEditPlugin.PREFIX_SUCCESS + "Rendering WorldEdit-Selection asynchronously..."); final Selection selection = AstralEditApi.render(player); if (selection == null) { player.sendMessage(AstralEditPlugin.PREFIX_ERROR + "Failed rendering WE selection!"); @@ -482,7 +482,7 @@ private void createRenderCommand(final Player player) { } /** - * Runs task asynchronly + * Runs task asynchronously * * @param runnable runnable */ diff --git a/src/main/java/com/github/shynixn/astraledit/business/logic/SelectionHolder.java b/src/main/java/com/github/shynixn/astraledit/business/logic/SelectionHolder.java index ea07e5e..38b3447 100644 --- a/src/main/java/com/github/shynixn/astraledit/business/logic/SelectionHolder.java +++ b/src/main/java/com/github/shynixn/astraledit/business/logic/SelectionHolder.java @@ -30,7 +30,6 @@ class SelectionHolder implements Selection { private PacketArmorstand[][][] stands; private Location lastLocation; private boolean isDestroyed = true; - private double yaw = -50; private boolean isMirrored; private boolean flipped; private boolean upSideDown; @@ -154,7 +153,7 @@ public void upSideDown() { } /** - * Mirros the selection + * Mirrors the selection */ @Override public void mirror() { @@ -372,11 +371,11 @@ List getTemporaryStorage() { } /** - * Rotates the selection unsecure + * Rotates the selection unSecure * * @param yaw yaw */ - void unsecureRotate(double yaw) { + void unSecureRotate(double yaw) { final Location location = this.getLocation(); location.setYaw((float) yaw); this.rotate(location); @@ -429,7 +428,9 @@ private void combineSelection() { for (int j = 0; j < this.getYWidth(); j++) { for (int k = 0; k < this.getZWidth(); k++) { if (this.stands[i][j][k] != null) { - double x = 0, y = 0, z = 0; + double x = 0; + double y = 0; + double z = 0; if (i > 0) x = -0.4 * i; if (j > 0) @@ -460,9 +461,9 @@ private Location setNewYaw(double amount) { yaw = 0; } yaw += amount; - this.yaw = yaw; + final double yaw1 = yaw; final Location location = this.getLocation(); - location.setYaw((float) this.yaw); + location.setYaw((float) yaw1); return location; } @@ -540,12 +541,12 @@ private void render(boolean destroy) { } /** - * Settter calculation + * Setter calculation * * @param a a * @param b b * @param c c - * @param counter coutner + * @param counter counter */ private void changeSetter(final int a, final int b, final int c, final int counter) { if (this.stands[a][b][c] != null) { @@ -565,7 +566,7 @@ private void changeSetter(final int a, final int b, final int c, final int count * @param a a * @param b b * @param c c - * @param counter coutner + * @param counter counter */ private void changeCalculation(final int a, final int b, final int c, final int counter) { if ((a + 1) < this.getXWidth()) { diff --git a/src/main/java/com/github/shynixn/astraledit/business/logic/SelectionListener.java b/src/main/java/com/github/shynixn/astraledit/business/logic/SelectionListener.java index 5ad017e..fa3377d 100644 --- a/src/main/java/com/github/shynixn/astraledit/business/logic/SelectionListener.java +++ b/src/main/java/com/github/shynixn/astraledit/business/logic/SelectionListener.java @@ -49,10 +49,9 @@ class SelectionListener extends SimpleListener { * Clears remaining data * * @param event event - * @throws Exception exception */ @EventHandler - public void onPlayerQuitEvent(PlayerQuitEvent event) throws Exception { + public void onPlayerQuitEvent(PlayerQuitEvent event) { this.manager.clearSelection(event.getPlayer()); this.manager.clearOperations(event.getPlayer()); } diff --git a/src/main/java/com/github/shynixn/astraledit/business/logic/SelectionManager.java b/src/main/java/com/github/shynixn/astraledit/business/logic/SelectionManager.java index 47afdf6..69c2742 100644 --- a/src/main/java/com/github/shynixn/astraledit/business/logic/SelectionManager.java +++ b/src/main/java/com/github/shynixn/astraledit/business/logic/SelectionManager.java @@ -152,7 +152,7 @@ boolean undoOperation(Player player) { } else if (operation.getType() == OperationType.COMBINE) { this.getSelection(player).tearApart(); } else if (operation.getType() == OperationType.ROTATE) { - this.selections.get(player).unsecureRotate((Double) operation.getOperationData()); + this.selections.get(player).unSecureRotate((Double) operation.getOperationData()); } else if (operation.getType() == OperationType.ANGLES) { this.getSelection(player).setBlockAngle((EulerAngle) operation.getOperationData()); } else if (operation.getType() == OperationType.PLACE || operation.getType() == OperationType.CONVERTOBLOCKS) { @@ -186,7 +186,7 @@ public void run() { selectionHolder.teleport(player.getLocation()); } if (selectionHolder.isAutoFollowRotateEnabled()) { - selectionHolder.unsecureRotate(player.getLocation().getYaw()); + selectionHolder.unSecureRotate(player.getLocation().getYaw()); } } } diff --git a/src/main/java/com/github/shynixn/astraledit/lib/LocationBuilder.java b/src/main/java/com/github/shynixn/astraledit/lib/LocationBuilder.java index e78ffb2..cdaa5ce 100644 --- a/src/main/java/com/github/shynixn/astraledit/lib/LocationBuilder.java +++ b/src/main/java/com/github/shynixn/astraledit/lib/LocationBuilder.java @@ -115,21 +115,6 @@ public LocationBuilder(Location location) { this.pitch = location.getPitch(); } - /** - * Parses the location out of the map - * - * @param items items - * @throws Exception mapParseException - */ - public LocationBuilder(Map items) throws Exception { - this.x = (double) items.get("x"); - this.y = (double) items.get("y"); - this.z = (double) items.get("z"); - this.yaw = (double) items.get("yaw"); - this.pitch = (double) items.get("pitch"); - this.world = (String) items.get("worldname"); - } - /** * Sets the coordinates x, y, z * @@ -430,8 +415,8 @@ public boolean equals(Object arg0) { @Override public String toString() { if (this.getWorld() == null) - return "location {" + " w unloaded" + " x " + this.getBlockX() + " y " + this.getBlockY() + " z " + this.getBlockZ() + "}"; - return "location {" + " w " + this.getWorldName() + " x " + this.getBlockX() + " y " + this.getBlockY() + " z " + this.getBlockZ() + "}"; + return "location {" + " w unloaded" + " x " + this.getBlockX() + " y " + this.getBlockY() + " z " + this.getBlockZ() + '}'; + return "location {" + " w " + this.getWorldName() + " x " + this.getBlockX() + " y " + this.getBlockY() + " z " + this.getBlockZ() + '}'; } /** diff --git a/src/main/java/com/github/shynixn/astraledit/lib/SimpleCommandExecutor.java b/src/main/java/com/github/shynixn/astraledit/lib/SimpleCommandExecutor.java index 3489fb0..dc97a05 100644 --- a/src/main/java/com/github/shynixn/astraledit/lib/SimpleCommandExecutor.java +++ b/src/main/java/com/github/shynixn/astraledit/lib/SimpleCommandExecutor.java @@ -177,7 +177,7 @@ public UnRegistered(String command, String useAge, String description, String pe this.plugin = plugin; this.setPermission(permission); this.setPermissionMessage(permissionMessage); - this.setAliases(new ArrayList()); + this.setAliases(new ArrayList<>()); this.registerDynamicCommand(command); } diff --git a/src/main/java/com/github/shynixn/astraledit/lib/SimpleListener.java b/src/main/java/com/github/shynixn/astraledit/lib/SimpleListener.java index 6d279e1..15944ee 100644 --- a/src/main/java/com/github/shynixn/astraledit/lib/SimpleListener.java +++ b/src/main/java/com/github/shynixn/astraledit/lib/SimpleListener.java @@ -52,7 +52,7 @@ public SimpleListener(Plugin plugin) { } /** - * Initializes a new listener by pluginname + * Initializes a new listener by pluginName * * @param plugin plugin */ From e3799a5e0c27068e10a4c2b7988c6b58cbe5c97a Mon Sep 17 00:00:00 2001 From: Christoph Date: Sat, 7 Oct 2017 18:39:59 +0200 Subject: [PATCH 3/6] Added metrics --- .../business/bukkit/AstralEditPlugin.java | 4 + .../astraledit/business/metrics/Metrics.java | 659 ++++++++++++++++++ src/main/resources/config.yml | 18 + 3 files changed, 681 insertions(+) create mode 100644 src/main/java/com/github/shynixn/astraledit/business/metrics/Metrics.java diff --git a/src/main/java/com/github/shynixn/astraledit/business/bukkit/AstralEditPlugin.java b/src/main/java/com/github/shynixn/astraledit/business/bukkit/AstralEditPlugin.java index 402ba87..3e82399 100644 --- a/src/main/java/com/github/shynixn/astraledit/business/bukkit/AstralEditPlugin.java +++ b/src/main/java/com/github/shynixn/astraledit/business/bukkit/AstralEditPlugin.java @@ -3,6 +3,7 @@ import com.github.shynixn.astraledit.api.AstralEditApi; import com.github.shynixn.astraledit.business.bukkit.dependencies.DependencySupport; import com.github.shynixn.astraledit.business.bukkit.nms.VersionSupport; +import com.github.shynixn.astraledit.business.metrics.Metrics; import com.github.shynixn.astraledit.lib.ReflectionUtils; import org.bukkit.Bukkit; import org.bukkit.ChatColor; @@ -62,6 +63,9 @@ public void onEnable() { try { Bukkit.getServer().getConsoleSender().sendMessage(PREFIX_CONSOLE + ChatColor.GREEN + "Loading AstralEdit ..."); this.saveDefaultConfig(); + if (this.getConfig().getBoolean("metrics")) { + new Metrics(this); + } ReflectionUtils.invokeMethodByClass(AstralEditApi.class, "initialize", new Class[]{Plugin.class}, new Object[]{this}); Bukkit.getServer().getConsoleSender().sendMessage(PREFIX_CONSOLE + ChatColor.GREEN + "Enabled AstralEdit " + this.getDescription().getVersion() + " by Shynixn"); } catch (NoSuchMethodException | InvocationTargetException | IllegalAccessException e) { diff --git a/src/main/java/com/github/shynixn/astraledit/business/metrics/Metrics.java b/src/main/java/com/github/shynixn/astraledit/business/metrics/Metrics.java new file mode 100644 index 0000000..c134882 --- /dev/null +++ b/src/main/java/com/github/shynixn/astraledit/business/metrics/Metrics.java @@ -0,0 +1,659 @@ +package com.github.shynixn.astraledit.business.metrics; + +import com.github.shynixn.astraledit.business.bukkit.AstralEditPlugin; +import org.bukkit.Bukkit; +import org.bukkit.configuration.file.YamlConfiguration; +import org.bukkit.entity.Player; +import org.bukkit.plugin.RegisteredServiceProvider; +import org.bukkit.plugin.ServicePriority; +import org.bukkit.plugin.java.JavaPlugin; +import org.json.simple.JSONArray; +import org.json.simple.JSONObject; + +import javax.net.ssl.HttpsURLConnection; +import java.io.ByteArrayOutputStream; +import java.io.DataOutputStream; +import java.io.File; +import java.io.IOException; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.net.URL; +import java.util.*; +import java.util.concurrent.Callable; +import java.util.logging.Level; +import java.util.zip.GZIPOutputStream; + +/** + * bStats collects some data for plugin authors. + *

+ * Check out https://bStats.org/ to learn more about bStats! + */ +public class Metrics { + + static { + // You can use the property to disable the check in your test environment + if (System.getProperty("bstats.relocatecheck") == null || !System.getProperty("bstats.relocatecheck").equals("false")) { + // Maven's Relocate is clever and changes strings, too. So we have to use this little "trick" ... :D + final String defaultPackage = new String( + new byte[]{'o', 'r', 'g', '.', 'b', 's', 't', 'a', 't', 's', '.', 'b', 'u', 'k', 'k', 'i', 't'}); + final String examplePackage = new String(new byte[]{'y', 'o', 'u', 'r', '.', 'p', 'a', 'c', 'k', 'a', 'g', 'e'}); + // We want to make sure nobody just copy & pastes the example and use the wrong package names + if (Metrics.class.getPackage().getName().equals(defaultPackage) || Metrics.class.getPackage().getName().equals(examplePackage)) { + throw new IllegalStateException("bStats Metrics class has not been relocated correctly!"); + } + } + } + + // The version of this bStats class + public static final int B_STATS_VERSION = 1; + + // The url to which the data is sent + private static final String URL = "https://bStats.org/submitData/bukkit"; + + // Should failed requests be logged? + private static boolean logFailedRequests; + + // The uuid of the server + private static String serverUUID; + + // The plugin + private final JavaPlugin plugin; + + // A list with all custom charts + private final List charts = new ArrayList<>(); + + /** + * Class constructor. + * + * @param plugin The plugin which stats should be submitted. + */ + public Metrics(JavaPlugin plugin) { + super(); + if (plugin == null) { + throw new IllegalArgumentException("Plugin cannot be null!"); + } + this.plugin = plugin; + + // Get the config file + final File bStatsFolder = new File(plugin.getDataFolder().getParentFile(), "bStats"); + final File configFile = new File(bStatsFolder, "config.yml"); + final YamlConfiguration config = YamlConfiguration.loadConfiguration(configFile); + + // Check if the config file exists + if (!config.isSet("serverUuid")) { + + // Add default values + config.addDefault("enabled", true); + // Every server gets it's unique random id. + config.addDefault("serverUuid", UUID.randomUUID().toString()); + // Should failed request be logged? + config.addDefault("logFailedRequests", false); + + // Inform the server owners about bStats + config.options().header( + "bStats collects some data for plugin authors like how many servers are using their plugins.\n" + + "To honor their work, you should not disable it.\n" + + "This has nearly no effect on the server performance!\n" + + "Check out https://bStats.org/ to learn more :)" + ).copyDefaults(true); + try { + config.save(configFile); + } catch (final IOException ignored) { + } + } + + // Load the data + serverUUID = config.getString("serverUuid"); + logFailedRequests = config.getBoolean("logFailedRequests", false); + if (config.getBoolean("enabled", true)) { + boolean found = false; + // Search for all other bStats Metrics classes to see if we are the first one + for (final Class service : Bukkit.getServicesManager().getKnownServices()) { + try { + service.getField("B_STATS_VERSION"); // Our identifier :) + found = true; // We aren't the first + break; + } catch (final NoSuchFieldException ignored) { + } + } + // Register our service + Bukkit.getServicesManager().register(Metrics.class, this, plugin, ServicePriority.Normal); + if (!found) { + // We are the first! + this.startSubmitting(); + } + } + } + + /** + * Adds a custom chart. + * + * @param chart The chart to add. + */ + public void addCustomChart(CustomChart chart) { + if (chart == null) { + throw new IllegalArgumentException("Chart cannot be null!"); + } + this.charts.add(chart); + } + + /** + * Starts the Scheduler which submits our data every 30 minutes. + */ + private void startSubmitting() { + final Timer timer = new Timer(true); // We use a timer cause the Bukkit scheduler is affected by server lags + timer.scheduleAtFixedRate(new TimerTask() { + @Override + public void run() { + if (!Metrics.this.plugin.isEnabled()) { // Plugin was disabled + timer.cancel(); + return; + } + // Nevertheless we want our code to run in the Bukkit main thread, so we have to use the Bukkit scheduler + // Don't be afraid! The connection to the bStats server is still async, only the stats collection is sync ;) + Bukkit.getScheduler().runTask(Metrics.this.plugin, Metrics.this::submitData); + } + }, 1000 * 60 * 5, 1000 * 60 * 30); + // Submit the data every 30 minutes, first time after 5 minutes to give other plugins enough time to start + // WARNING: Changing the frequency has no effect but your plugin WILL be blocked/deleted! + // WARNING: Just don't do it! + } + + /** + * Gets the plugin specific data. + * This method is called using Reflection. + * + * @return The plugin specific data. + */ + public JSONObject getPluginData() { + final JSONObject data = new JSONObject(); + + final String pluginName = this.plugin.getDescription().getName(); + final String pluginVersion = this.plugin.getDescription().getVersion(); + + data.put("pluginName", pluginName); // Append the name of the plugin + data.put("pluginVersion", pluginVersion); // Append the version of the plugin + final JSONArray customCharts = new JSONArray(); + for (final CustomChart customChart : this.charts) { + // Add the data of the custom charts + final JSONObject chart = customChart.getRequestJsonObject(); + if (chart == null) { // If the chart is null, we skip it + continue; + } + customCharts.add(chart); + } + data.put("customCharts", customCharts); + + return data; + } + + /** + * Gets the server specific data. + * + * @return The server specific data. + */ + private JSONObject getServerData() { + // Minecraft specific data + int playerAmount; + try { + // Around MC 1.8 the return type was changed to a collection from an array, + // This fixes java.lang.NoSuchMethodError: org.bukkit.Bukkit.getOnlinePlayers()Ljava/util/Collection; + final Method onlinePlayersMethod = Class.forName("org.bukkit.Server").getMethod("getOnlinePlayers"); + playerAmount = onlinePlayersMethod.getReturnType().equals(Collection.class) + ? ((Collection) onlinePlayersMethod.invoke(Bukkit.getServer())).size() + : ((Player[]) onlinePlayersMethod.invoke(Bukkit.getServer())).length; + } catch (final Exception e) { + playerAmount = Bukkit.getOnlinePlayers().size(); // Just use the new method if the Reflection failed + } + final int onlineMode = Bukkit.getOnlineMode() ? 1 : 0; + String bukkitVersion = Bukkit.getVersion(); + bukkitVersion = bukkitVersion.substring(bukkitVersion.indexOf("MC: ") + 4, bukkitVersion.length() - 1); + + // OS/Java specific data + final String javaVersion = System.getProperty("java.version"); + final String osName = System.getProperty("os.name"); + final String osArch = System.getProperty("os.arch"); + final String osVersion = System.getProperty("os.version"); + final int coreCount = Runtime.getRuntime().availableProcessors(); + + final JSONObject data = new JSONObject(); + + data.put("serverUUID", serverUUID); + + data.put("playerAmount", playerAmount); + data.put("onlineMode", onlineMode); + data.put("bukkitVersion", bukkitVersion); + + data.put("javaVersion", javaVersion); + data.put("osName", osName); + data.put("osArch", osArch); + data.put("osVersion", osVersion); + data.put("coreCount", coreCount); + + return data; + } + + /** + * Collects the data and sends it afterwards. + */ + private void submitData() { + final JSONObject data = this.getServerData(); + + final JSONArray pluginData = new JSONArray(); + // Search for all other bStats Metrics classes to get their plugin data + for (final Class service : Bukkit.getServicesManager().getKnownServices()) { + try { + service.getField("B_STATS_VERSION"); // Our identifier :) + + for (final RegisteredServiceProvider provider : Bukkit.getServicesManager().getRegistrations(service)) { + try { + pluginData.add(provider.getService().getMethod("getPluginData").invoke(provider.getProvider())); + } catch (NullPointerException | NoSuchMethodException | IllegalAccessException | InvocationTargetException ignored) { + } + } + } catch (final NoSuchFieldException ignored) { + } + } + + data.put("plugins", pluginData); + + // Create a new thread for the connection to the bStats server + new Thread(() -> { + try { + // Send the data + sendData(data); + } catch (Exception e) { + // Something went wrong! :( + if (logFailedRequests) { + Metrics.this.plugin.getLogger().log(Level.WARNING, "Could not submit plugin stats of " + Metrics.this.plugin.getName(), e); + } + } + }).start(); + } + + /** + * Sends the data to the bStats server. + * + * @param data The data to send. + * @throws Exception If the request failed. + */ + private static void sendData(JSONObject data) throws Exception { + if (data == null) { + throw new IllegalArgumentException("Data cannot be null!"); + } + if (Bukkit.isPrimaryThread()) { + throw new IllegalAccessException("This method must not be called from the main thread!"); + } + final HttpsURLConnection connection = (HttpsURLConnection) new URL(URL).openConnection(); + + // Compress the data to save bandwidth + final byte[] compressedData = compress(data.toString()); + + // Add headers + connection.setRequestMethod("POST"); + connection.addRequestProperty("Accept", "application/json"); + connection.addRequestProperty("Connection", "close"); + connection.addRequestProperty("Content-Encoding", "gzip"); // We gzip our request + connection.addRequestProperty("Content-Length", String.valueOf(compressedData.length)); + connection.setRequestProperty("Content-Type", "application/json"); // We send our data in JSON format + connection.setRequestProperty("User-Agent", "MC-Server/" + B_STATS_VERSION); + + // Send data + connection.setDoOutput(true); + try (DataOutputStream outputStream = new DataOutputStream(connection.getOutputStream())) { + outputStream.write(compressedData); + outputStream.flush(); + } + connection.getInputStream().close(); // We don't care about the response - Just send our data :) + } + + /** + * Gzips the given String. + * + * @param str The string to gzip. + * @return The gzipped String. + * @throws IOException If the compression failed. + */ + private static byte[] compress(final String str) throws IOException { + if (str == null) { + return null; + } + final ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); + try (GZIPOutputStream gzip = new GZIPOutputStream(outputStream)) { + gzip.write(str.getBytes("UTF-8")); + } + return outputStream.toByteArray(); + } + + /** + * Represents a custom chart. + */ + public static abstract class CustomChart { + + // The id of the chart + final String chartId; + + /** + * Class constructor. + * + * @param chartId The id of the chart. + */ + CustomChart(String chartId) { + super(); + if (chartId == null || chartId.isEmpty()) { + throw new IllegalArgumentException("ChartId cannot be null or empty!"); + } + this.chartId = chartId; + } + + private JSONObject getRequestJsonObject() { + final JSONObject chart = new JSONObject(); + chart.put("chartId", this.chartId); + try { + final JSONObject data = this.getChartData(); + if (data == null) { + // If the data is null we don't send the chart. + return null; + } + chart.put("data", data); + } catch (final Throwable t) { + if (logFailedRequests) { + AstralEditPlugin.logger().log(Level.WARNING, "Failed to get data for custom chart with id " + this.chartId, t); + } + return null; + } + return chart; + } + + protected abstract JSONObject getChartData() throws Exception; + + } + + /** + * Represents a custom simple pie. + */ + public static class SimplePie extends CustomChart { + + private final Callable callable; + + /** + * Class constructor. + * + * @param chartId The id of the chart. + * @param callable The callable which is used to request the chart data. + */ + public SimplePie(String chartId, Callable callable) { + super(chartId); + this.callable = callable; + } + + @Override + protected JSONObject getChartData() throws Exception { + final JSONObject data = new JSONObject(); + final String value = this.callable.call(); + if (value == null || value.isEmpty()) { + // Null = skip the chart + return null; + } + data.put("value", value); + return data; + } + } + + /** + * Represents a custom advanced pie. + */ + public static class AdvancedPie extends CustomChart { + + private final Callable> callable; + + /** + * Class constructor. + * + * @param chartId The id of the chart. + * @param callable The callable which is used to request the chart data. + */ + public AdvancedPie(String chartId, Callable> callable) { + super(chartId); + this.callable = callable; + } + + @Override + protected JSONObject getChartData() throws Exception { + final JSONObject data = new JSONObject(); + final JSONObject values = new JSONObject(); + final Map map = this.callable.call(); + if (map == null || map.isEmpty()) { + // Null = skip the chart + return null; + } + boolean allSkipped = true; + for (final Map.Entry entry : map.entrySet()) { + if (entry.getValue() == 0) { + continue; // Skip this invalid + } + allSkipped = false; + values.put(entry.getKey(), entry.getValue()); + } + if (allSkipped) { + // Null = skip the chart + return null; + } + data.put("values", values); + return data; + } + } + + /** + * Represents a custom drilldown pie. + */ + public static class DrilldownPie extends CustomChart { + + private final Callable>> callable; + + /** + * Class constructor. + * + * @param chartId The id of the chart. + * @param callable The callable which is used to request the chart data. + */ + public DrilldownPie(String chartId, Callable>> callable) { + super(chartId); + this.callable = callable; + } + + @Override + public JSONObject getChartData() throws Exception { + final JSONObject data = new JSONObject(); + final JSONObject values = new JSONObject(); + final Map> map = this.callable.call(); + if (map == null || map.isEmpty()) { + // Null = skip the chart + return null; + } + boolean reallyAllSkipped = true; + for (final Map.Entry> entryValues : map.entrySet()) { + final JSONObject value = new JSONObject(); + boolean allSkipped = true; + for (final Map.Entry valueEntry : map.get(entryValues.getKey()).entrySet()) { + value.put(valueEntry.getKey(), valueEntry.getValue()); + allSkipped = false; + } + if (!allSkipped) { + reallyAllSkipped = false; + values.put(entryValues.getKey(), value); + } + } + if (reallyAllSkipped) { + // Null = skip the chart + return null; + } + data.put("values", values); + return data; + } + } + + /** + * Represents a custom single line chart. + */ + public static class SingleLineChart extends CustomChart { + + private final Callable callable; + + /** + * Class constructor. + * + * @param chartId The id of the chart. + * @param callable The callable which is used to request the chart data. + */ + public SingleLineChart(String chartId, Callable callable) { + super(chartId); + this.callable = callable; + } + + @Override + protected JSONObject getChartData() throws Exception { + final JSONObject data = new JSONObject(); + final int value = this.callable.call(); + if (value == 0) { + // Null = skip the chart + return null; + } + data.put("value", value); + return data; + } + + } + + /** + * Represents a custom multi line chart. + */ + public static class MultiLineChart extends CustomChart { + + private final Callable> callable; + + /** + * Class constructor. + * + * @param chartId The id of the chart. + * @param callable The callable which is used to request the chart data. + */ + public MultiLineChart(String chartId, Callable> callable) { + super(chartId); + this.callable = callable; + } + + @Override + protected JSONObject getChartData() throws Exception { + final JSONObject data = new JSONObject(); + final JSONObject values = new JSONObject(); + final Map map = this.callable.call(); + if (map == null || map.isEmpty()) { + // Null = skip the chart + return null; + } + boolean allSkipped = true; + for (final Map.Entry entry : map.entrySet()) { + if (entry.getValue() == 0) { + continue; // Skip this invalid + } + allSkipped = false; + values.put(entry.getKey(), entry.getValue()); + } + if (allSkipped) { + // Null = skip the chart + return null; + } + data.put("values", values); + return data; + } + + } + + /** + * Represents a custom simple bar chart. + */ + public static class SimpleBarChart extends CustomChart { + + private final Callable> callable; + + /** + * Class constructor. + * + * @param chartId The id of the chart. + * @param callable The callable which is used to request the chart data. + */ + public SimpleBarChart(String chartId, Callable> callable) { + super(chartId); + this.callable = callable; + } + + @Override + protected JSONObject getChartData() throws Exception { + final JSONObject data = new JSONObject(); + final JSONObject values = new JSONObject(); + final Map map = this.callable.call(); + if (map == null || map.isEmpty()) { + // Null = skip the chart + return null; + } + for (final Map.Entry entry : map.entrySet()) { + final JSONArray categoryValues = new JSONArray(); + categoryValues.add(entry.getValue()); + values.put(entry.getKey(), categoryValues); + } + data.put("values", values); + return data; + } + + } + + /** + * Represents a custom advanced bar chart. + */ + public static class AdvancedBarChart extends CustomChart { + + private final Callable> callable; + + /** + * Class constructor. + * + * @param chartId The id of the chart. + * @param callable The callable which is used to request the chart data. + */ + public AdvancedBarChart(String chartId, Callable> callable) { + super(chartId); + this.callable = callable; + } + + @Override + protected JSONObject getChartData() throws Exception { + final JSONObject data = new JSONObject(); + final JSONObject values = new JSONObject(); + final Map map = this.callable.call(); + if (map == null || map.isEmpty()) { + // Null = skip the chart + return null; + } + boolean allSkipped = true; + for (final Map.Entry entry : map.entrySet()) { + if (entry.getValue().length == 0) { + continue; // Skip this invalid + } + allSkipped = false; + final JSONArray categoryValues = new JSONArray(); + for (final int categoryValue : entry.getValue()) { + categoryValues.add(categoryValue); + } + values.put(entry.getKey(), categoryValues); + } + if (allSkipped) { + // Null = skip the chart + return null; + } + data.put("values", values); + return data; + } + + } +} \ No newline at end of file diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index 3e7d2ca..49a8203 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -27,12 +27,30 @@ # admin Allows to hide your selection astraledit.commands.hideother # admin Allows to show your selection astraledit.commands.showother +############################ + +# Data-collecting settings + +# Settings to send anonymous stats to https://bstats.org/plugin/bukkit/AstralEdit. +# As this does not have an impact on your AstralEdit experience at all I would like you to set it on true as knowing that my +# plugin gets used by many server helps me focusing on new updates ;) + +############################ + +metrics: true + +############################ + # General settings +# Settings to manage performance and cache which the plugin can use. + # max-selected-blocks-amount: Amount of blocks which can be rendered at once. # As it's handled via packets the server won't lag at all but the client might crash if he selects too many blocks # max-undo-amount: Amount of operations per player which can be undone# +############################ + general: max-selected-blocks-amount: 10000 max-undo-amount: 10 From 81866b0de2f9b52c698c6ba129b043d20f331cf0 Mon Sep 17 00:00:00 2001 From: Christoph Date: Sat, 7 Oct 2017 18:42:06 +0200 Subject: [PATCH 4/6] Added update-checker --- .../business/bukkit/AstralEditPlugin.java | 10 ++ .../shynixn/astraledit/lib/UpdateUtils.java | 102 ++++++++++++++++++ 2 files changed, 112 insertions(+) create mode 100644 src/main/java/com/github/shynixn/astraledit/lib/UpdateUtils.java diff --git a/src/main/java/com/github/shynixn/astraledit/business/bukkit/AstralEditPlugin.java b/src/main/java/com/github/shynixn/astraledit/business/bukkit/AstralEditPlugin.java index 3e82399..28d7bb9 100644 --- a/src/main/java/com/github/shynixn/astraledit/business/bukkit/AstralEditPlugin.java +++ b/src/main/java/com/github/shynixn/astraledit/business/bukkit/AstralEditPlugin.java @@ -5,11 +5,13 @@ import com.github.shynixn.astraledit.business.bukkit.nms.VersionSupport; import com.github.shynixn.astraledit.business.metrics.Metrics; import com.github.shynixn.astraledit.lib.ReflectionUtils; +import com.github.shynixn.astraledit.lib.UpdateUtils; import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.plugin.Plugin; import org.bukkit.plugin.java.JavaPlugin; +import java.io.IOException; import java.lang.reflect.InvocationTargetException; import java.util.logging.Level; import java.util.logging.Logger; @@ -44,6 +46,7 @@ * SOFTWARE. */ public class AstralEditPlugin extends JavaPlugin { + private static final long SPIGOT_RESOURCEID = 11409; public static final String PLUGIN_NAME = "AstralEdit"; public static final String PREFIX_CONSOLE = ChatColor.LIGHT_PURPLE + "[AstralEdit] "; public static final String PREFIX = ChatColor.DARK_RED + "" + ChatColor.BOLD + '[' + ChatColor.RED + "" + ChatColor.BOLD + ChatColor.ITALIC + "AE" + ChatColor.DARK_RED + "" + ChatColor.BOLD + "] " + ChatColor.RED; @@ -66,6 +69,13 @@ public void onEnable() { if (this.getConfig().getBoolean("metrics")) { new Metrics(this); } + this.getServer().getScheduler().runTaskAsynchronously(this, () -> { + try { + UpdateUtils.checkPluginUpToDateAndPrintMessage(SPIGOT_RESOURCEID, PREFIX_CONSOLE, PLUGIN_NAME, AstralEditPlugin.this); + } catch (final IOException e) { + AstralEditPlugin.logger().log(Level.WARNING, "Failed to check for updates."); + } + }); ReflectionUtils.invokeMethodByClass(AstralEditApi.class, "initialize", new Class[]{Plugin.class}, new Object[]{this}); Bukkit.getServer().getConsoleSender().sendMessage(PREFIX_CONSOLE + ChatColor.GREEN + "Enabled AstralEdit " + this.getDescription().getVersion() + " by Shynixn"); } catch (NoSuchMethodException | InvocationTargetException | IllegalAccessException e) { diff --git a/src/main/java/com/github/shynixn/astraledit/lib/UpdateUtils.java b/src/main/java/com/github/shynixn/astraledit/lib/UpdateUtils.java new file mode 100644 index 0000000..cf0e7c8 --- /dev/null +++ b/src/main/java/com/github/shynixn/astraledit/lib/UpdateUtils.java @@ -0,0 +1,102 @@ +package com.github.shynixn.astraledit.lib; + +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.plugin.Plugin; + +import javax.net.ssl.HttpsURLConnection; +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.net.URL; + +/** + * Copyright 2017 Shynixn + *

+ * Do not remove this header! + *

+ * Version 1.0 + *

+ * MIT License + *

+ * Copyright (c) 2017 + *

+ * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + *

+ * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + *

+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +public class UpdateUtils { + + private static final String BASE_URL = "https://api.spigotmc.org/legacy/update.php?resource="; + + /** + * Checks if the given plugin version and spigot resource Id is the same by doing an webRequest + * + * @param resourceId spigot resourceId + * @param plugin plugin + * @return isUpToDate + * @throws IOException exception + */ + public static boolean isPluginUpToDate(long resourceId, Plugin plugin) throws IOException { + return plugin.getDescription().getVersion().equals(getLatestReleaseVersion(resourceId)); + } + + /** + * Checks if the given plugin version and spigot resource Id is the same by doing and webRequest and printing the result into the console + * + * @param resourceId spigot resourceId + * @param prefix prefix + * @param pluginName pluginName + * @param plugin plugin + * @throws IOException exception + */ + public static void checkPluginUpToDateAndPrintMessage(long resourceId, String prefix, String pluginName, Plugin plugin) throws IOException { + if (!isPluginUpToDate(resourceId, plugin)) { + if (plugin.getDescription().getVersion().endsWith("SNAPSHOT")) { + Bukkit.getServer().getConsoleSender().sendMessage(prefix + ChatColor.YELLOW + "================================================"); + Bukkit.getServer().getConsoleSender().sendMessage(prefix + ChatColor.YELLOW + "You are using a snapshot of " + pluginName); + Bukkit.getServer().getConsoleSender().sendMessage(prefix + ChatColor.YELLOW + "Please check regularly if there is a new version"); + Bukkit.getServer().getConsoleSender().sendMessage(prefix + ChatColor.YELLOW + "================================================"); + } else { + Bukkit.getServer().getConsoleSender().sendMessage(prefix + ChatColor.YELLOW + "================================================"); + Bukkit.getServer().getConsoleSender().sendMessage(prefix + ChatColor.YELLOW + pluginName + " is outdated"); + Bukkit.getServer().getConsoleSender().sendMessage(prefix + ChatColor.YELLOW + "Please download the latest version from spigotmc.org"); + Bukkit.getServer().getConsoleSender().sendMessage(prefix + ChatColor.YELLOW + "================================================"); + } + } + } + + /** + * Returns the latest version by a webRequest + * + * @param resourceId resource + * @return version + * @throws IOException exception + */ + private static String getLatestReleaseVersion(long resourceId) throws IOException { + final HttpsURLConnection httpsURLConnection = (HttpsURLConnection) new URL(BASE_URL + resourceId).openConnection(); + try (InputStream stream = httpsURLConnection.getInputStream()) { + try (InputStreamReader reader = new InputStreamReader(stream)) { + try (BufferedReader bufferedReader = new BufferedReader(reader)) { + return bufferedReader.readLine(); + } + } + } + } + +} From 5394c0d35e754ea91476b7ac8764d63e59aecf08 Mon Sep 17 00:00:00 2001 From: Christoph Date: Sat, 7 Oct 2017 18:44:09 +0200 Subject: [PATCH 5/6] Updated docs --- README.md | 7 +- docs/apidocs/allclasses-frame.html | 18 +- docs/apidocs/allclasses-noframe.html | 18 +- .../shynixn/astraledit/api/AstralEditApi.html | 8 +- .../api/class-use/AstralEditApi.html | 8 +- .../api/entity/PacketArmorstand.html | 8 +- .../astraledit/api/entity/Selection.html | 12 +- .../entity/class-use/PacketArmorstand.html | 8 +- .../api/entity/class-use/Selection.html | 8 +- .../astraledit/api/entity/package-frame.html | 6 +- .../api/entity/package-summary.html | 8 +- .../astraledit/api/entity/package-tree.html | 8 +- .../astraledit/api/entity/package-use.html | 8 +- .../shynixn/astraledit/api/package-frame.html | 6 +- .../astraledit/api/package-summary.html | 8 +- .../shynixn/astraledit/api/package-tree.html | 8 +- .../shynixn/astraledit/api/package-use.html | 8 +- .../business/bukkit/AstralEditPlugin.html | 38 +- .../business/bukkit/Permission.html | 28 +- .../bukkit/class-use/AstralEditPlugin.html | 8 +- .../business/bukkit/class-use/Permission.html | 8 +- .../dependencies/DependencySupport.html | 8 +- .../class-use/DependencySupport.html | 8 +- .../bukkit/dependencies/package-frame.html | 6 +- .../bukkit/dependencies/package-summary.html | 8 +- .../bukkit/dependencies/package-tree.html | 8 +- .../bukkit/dependencies/package-use.html | 8 +- .../worldedit/WorldEditConnection.html | 8 +- .../class-use/WorldEditConnection.html | 8 +- .../dependencies/worldedit/package-frame.html | 6 +- .../worldedit/package-summary.html | 8 +- .../dependencies/worldedit/package-tree.html | 8 +- .../dependencies/worldedit/package-use.html | 8 +- .../business/bukkit/nms/NMSRegistry.html | 8 +- .../business/bukkit/nms/VersionSupport.html | 8 +- .../bukkit/nms/class-use/NMSRegistry.html | 8 +- .../bukkit/nms/class-use/VersionSupport.html | 8 +- .../business/bukkit/nms/package-frame.html | 6 +- .../business/bukkit/nms/package-summary.html | 8 +- .../business/bukkit/nms/package-tree.html | 8 +- .../business/bukkit/nms/package-use.html | 8 +- .../nms/v1_10_R1/DisplayArmorstand.html | 8 +- .../v1_10_R1/class-use/DisplayArmorstand.html | 8 +- .../bukkit/nms/v1_10_R1/package-frame.html | 6 +- .../bukkit/nms/v1_10_R1/package-summary.html | 8 +- .../bukkit/nms/v1_10_R1/package-tree.html | 8 +- .../bukkit/nms/v1_10_R1/package-use.html | 8 +- .../nms/v1_11_R1/DisplayArmorstand.html | 8 +- .../v1_11_R1/class-use/DisplayArmorstand.html | 8 +- .../bukkit/nms/v1_11_R1/package-frame.html | 6 +- .../bukkit/nms/v1_11_R1/package-summary.html | 8 +- .../bukkit/nms/v1_11_R1/package-tree.html | 8 +- .../bukkit/nms/v1_11_R1/package-use.html | 8 +- .../nms/v1_12_R1/DisplayArmorstand.html | 8 +- .../v1_12_R1/class-use/DisplayArmorstand.html | 8 +- .../bukkit/nms/v1_12_R1/package-frame.html | 6 +- .../bukkit/nms/v1_12_R1/package-summary.html | 8 +- .../bukkit/nms/v1_12_R1/package-tree.html | 8 +- .../bukkit/nms/v1_12_R1/package-use.html | 8 +- .../bukkit/nms/v1_8_R1/DisplayArmorstand.html | 8 +- .../v1_8_R1/class-use/DisplayArmorstand.html | 8 +- .../bukkit/nms/v1_8_R1/package-frame.html | 6 +- .../bukkit/nms/v1_8_R1/package-summary.html | 8 +- .../bukkit/nms/v1_8_R1/package-tree.html | 8 +- .../bukkit/nms/v1_8_R1/package-use.html | 8 +- .../bukkit/nms/v1_8_R2/DisplayArmorstand.html | 8 +- .../v1_8_R2/class-use/DisplayArmorstand.html | 8 +- .../bukkit/nms/v1_8_R2/package-frame.html | 6 +- .../bukkit/nms/v1_8_R2/package-summary.html | 8 +- .../bukkit/nms/v1_8_R2/package-tree.html | 8 +- .../bukkit/nms/v1_8_R2/package-use.html | 8 +- .../bukkit/nms/v1_8_R3/DisplayArmorstand.html | 8 +- .../v1_8_R3/class-use/DisplayArmorstand.html | 8 +- .../bukkit/nms/v1_8_R3/package-frame.html | 6 +- .../bukkit/nms/v1_8_R3/package-summary.html | 8 +- .../bukkit/nms/v1_8_R3/package-tree.html | 8 +- .../bukkit/nms/v1_8_R3/package-use.html | 8 +- .../bukkit/nms/v1_9_R1/DisplayArmorstand.html | 8 +- .../v1_9_R1/class-use/DisplayArmorstand.html | 8 +- .../bukkit/nms/v1_9_R1/package-frame.html | 6 +- .../bukkit/nms/v1_9_R1/package-summary.html | 8 +- .../bukkit/nms/v1_9_R1/package-tree.html | 8 +- .../bukkit/nms/v1_9_R1/package-use.html | 8 +- .../bukkit/nms/v1_9_R2/DisplayArmorstand.html | 8 +- .../v1_9_R2/class-use/DisplayArmorstand.html | 8 +- .../bukkit/nms/v1_9_R2/package-frame.html | 6 +- .../bukkit/nms/v1_9_R2/package-summary.html | 8 +- .../bukkit/nms/v1_9_R2/package-tree.html | 8 +- .../bukkit/nms/v1_9_R2/package-use.html | 8 +- .../business/bukkit/package-frame.html | 6 +- .../business/bukkit/package-summary.html | 8 +- .../business/bukkit/package-tree.html | 8 +- .../business/bukkit/package-use.html | 8 +- .../business/logic/SelectionManager.html | 8 +- .../logic/class-use/SelectionManager.html | 8 +- .../business/logic/package-frame.html | 6 +- .../business/logic/package-summary.html | 12 +- .../business/logic/package-tree.html | 12 +- .../business/logic/package-use.html | 8 +- .../metrics/Metrics.AdvancedBarChart.html | 300 +++++++++++++ .../business/metrics/Metrics.AdvancedPie.html | 300 +++++++++++++ .../business/metrics/Metrics.CustomChart.html | 253 +++++++++++ .../metrics/Metrics.DrilldownPie.html | 300 +++++++++++++ .../metrics/Metrics.MultiLineChart.html | 300 +++++++++++++ .../metrics/Metrics.SimpleBarChart.html | 300 +++++++++++++ .../business/metrics/Metrics.SimplePie.html | 300 +++++++++++++ .../metrics/Metrics.SingleLineChart.html | 300 +++++++++++++ .../astraledit/business/metrics/Metrics.html | 414 ++++++++++++++++++ .../class-use/Metrics.AdvancedBarChart.html | 126 ++++++ .../class-use/Metrics.AdvancedPie.html | 126 ++++++ .../class-use/Metrics.CustomChart.html | 219 +++++++++ .../class-use/Metrics.DrilldownPie.html | 126 ++++++ .../class-use/Metrics.MultiLineChart.html | 126 ++++++ .../class-use/Metrics.SimpleBarChart.html | 126 ++++++ .../metrics/class-use/Metrics.SimplePie.html | 126 ++++++ .../class-use/Metrics.SingleLineChart.html | 126 ++++++ .../business/metrics/class-use/Metrics.html | 126 ++++++ .../business/metrics/package-frame.html | 29 ++ .../business/metrics/package-summary.html | 194 ++++++++ .../business/metrics/package-tree.html | 150 +++++++ .../business/metrics/package-use.html | 161 +++++++ .../lib/DirectionHelper.Direction.html | 395 ----------------- .../astraledit/lib/ItemStackBuilder.html | 12 +- .../lib/LocationBuilder.Direction.html | 8 +- .../astraledit/lib/LocationBuilder.html | 44 +- .../astraledit/lib/ReflectionUtils.html | 8 +- .../lib/SimpleCommandExecutor.Registered.html | 8 +- .../SimpleCommandExecutor.UnRegistered.html | 8 +- .../astraledit/lib/SimpleCommandExecutor.html | 8 +- .../astraledit/lib/SimpleListener.html | 16 +- ...{DirectionHelper.html => UpdateUtils.html} | 217 ++++----- .../class-use/DirectionHelper.Direction.html | 200 --------- .../lib/class-use/ItemStackBuilder.html | 8 +- .../class-use/LocationBuilder.Direction.html | 8 +- .../lib/class-use/LocationBuilder.html | 8 +- .../lib/class-use/ReflectionUtils.html | 8 +- .../SimpleCommandExecutor.Registered.html | 8 +- .../SimpleCommandExecutor.UnRegistered.html | 8 +- .../lib/class-use/SimpleCommandExecutor.html | 8 +- .../lib/class-use/SimpleListener.html | 8 +- ...{DirectionHelper.html => UpdateUtils.html} | 24 +- .../shynixn/astraledit/lib/package-frame.html | 9 +- .../astraledit/lib/package-summary.html | 44 +- .../shynixn/astraledit/lib/package-tree.html | 15 +- .../shynixn/astraledit/lib/package-use.html | 21 +- docs/apidocs/constant-values.html | 29 +- docs/apidocs/deprecated-list.html | 30 +- docs/apidocs/help-doc.html | 8 +- docs/apidocs/index-all.html | 183 +++++--- docs/apidocs/index.html | 4 +- docs/apidocs/overview-frame.html | 7 +- docs/apidocs/overview-summary.html | 14 +- docs/apidocs/overview-tree.html | 24 +- docs/apidocs/package-list | 1 + pom.xml | 2 +- src/main/resources/plugin.yml | 2 +- 156 files changed, 5398 insertions(+), 1378 deletions(-) create mode 100644 docs/apidocs/com/github/shynixn/astraledit/business/metrics/Metrics.AdvancedBarChart.html create mode 100644 docs/apidocs/com/github/shynixn/astraledit/business/metrics/Metrics.AdvancedPie.html create mode 100644 docs/apidocs/com/github/shynixn/astraledit/business/metrics/Metrics.CustomChart.html create mode 100644 docs/apidocs/com/github/shynixn/astraledit/business/metrics/Metrics.DrilldownPie.html create mode 100644 docs/apidocs/com/github/shynixn/astraledit/business/metrics/Metrics.MultiLineChart.html create mode 100644 docs/apidocs/com/github/shynixn/astraledit/business/metrics/Metrics.SimpleBarChart.html create mode 100644 docs/apidocs/com/github/shynixn/astraledit/business/metrics/Metrics.SimplePie.html create mode 100644 docs/apidocs/com/github/shynixn/astraledit/business/metrics/Metrics.SingleLineChart.html create mode 100644 docs/apidocs/com/github/shynixn/astraledit/business/metrics/Metrics.html create mode 100644 docs/apidocs/com/github/shynixn/astraledit/business/metrics/class-use/Metrics.AdvancedBarChart.html create mode 100644 docs/apidocs/com/github/shynixn/astraledit/business/metrics/class-use/Metrics.AdvancedPie.html create mode 100644 docs/apidocs/com/github/shynixn/astraledit/business/metrics/class-use/Metrics.CustomChart.html create mode 100644 docs/apidocs/com/github/shynixn/astraledit/business/metrics/class-use/Metrics.DrilldownPie.html create mode 100644 docs/apidocs/com/github/shynixn/astraledit/business/metrics/class-use/Metrics.MultiLineChart.html create mode 100644 docs/apidocs/com/github/shynixn/astraledit/business/metrics/class-use/Metrics.SimpleBarChart.html create mode 100644 docs/apidocs/com/github/shynixn/astraledit/business/metrics/class-use/Metrics.SimplePie.html create mode 100644 docs/apidocs/com/github/shynixn/astraledit/business/metrics/class-use/Metrics.SingleLineChart.html create mode 100644 docs/apidocs/com/github/shynixn/astraledit/business/metrics/class-use/Metrics.html create mode 100644 docs/apidocs/com/github/shynixn/astraledit/business/metrics/package-frame.html create mode 100644 docs/apidocs/com/github/shynixn/astraledit/business/metrics/package-summary.html create mode 100644 docs/apidocs/com/github/shynixn/astraledit/business/metrics/package-tree.html create mode 100644 docs/apidocs/com/github/shynixn/astraledit/business/metrics/package-use.html delete mode 100644 docs/apidocs/com/github/shynixn/astraledit/lib/DirectionHelper.Direction.html rename docs/apidocs/com/github/shynixn/astraledit/lib/{DirectionHelper.html => UpdateUtils.html} (53%) delete mode 100644 docs/apidocs/com/github/shynixn/astraledit/lib/class-use/DirectionHelper.Direction.html rename docs/apidocs/com/github/shynixn/astraledit/lib/class-use/{DirectionHelper.html => UpdateUtils.html} (80%) diff --git a/README.md b/README.md index 25f804c..4f9b2fe 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ WorldEdit Extension to modify your world in a way you have not seen before. * [Download the plugin AstralEdit](https://github.com/Shynixn/AstralEdit/releases) * Put the plugin into your plugin folder -* Start the server (1.8.0 - 1.12.1, Java 8) +* Start the server (1.8.0 - 1.12.2, Java 8/Java 9) * Join and play :) ## API @@ -35,7 +35,8 @@ WorldEdit Extension to modify your world in a way you have not seen before. com.github.shynixn astraledit - 1.0.0 + 1.1.0 + provided ``` @@ -43,7 +44,7 @@ WorldEdit Extension to modify your world in a way you have not seen before. ```xml dependencies { - compileOnly 'com.github.shynixn:astraledit:1.0.0' + compileOnly 'com.github.shynixn:astraledit:1.1.0' } ``` diff --git a/docs/apidocs/allclasses-frame.html b/docs/apidocs/allclasses-frame.html index c526c43..8aaa466 100644 --- a/docs/apidocs/allclasses-frame.html +++ b/docs/apidocs/allclasses-frame.html @@ -2,10 +2,10 @@ - + -All Classes (AstralEdit 1.0.0 API) - +All Classes (AstralEdit 1.1.0 API) + @@ -16,8 +16,6 @@

All Classes

  • AstralEditApi
  • AstralEditPlugin
  • DependencySupport
  • -
  • DirectionHelper
  • -
  • DirectionHelper.Direction
  • DisplayArmorstand
  • DisplayArmorstand
  • DisplayArmorstand
  • @@ -29,6 +27,15 @@

    All Classes

  • ItemStackBuilder
  • LocationBuilder
  • LocationBuilder.Direction
  • +
  • Metrics
  • +
  • Metrics.AdvancedBarChart
  • +
  • Metrics.AdvancedPie
  • +
  • Metrics.CustomChart
  • +
  • Metrics.DrilldownPie
  • +
  • Metrics.MultiLineChart
  • +
  • Metrics.SimpleBarChart
  • +
  • Metrics.SimplePie
  • +
  • Metrics.SingleLineChart
  • NMSRegistry
  • PacketArmorstand
  • Permission
  • @@ -39,6 +46,7 @@

    All Classes

  • SimpleCommandExecutor.Registered
  • SimpleCommandExecutor.UnRegistered
  • SimpleListener
  • +
  • UpdateUtils
  • VersionSupport
  • WorldEditConnection
  • diff --git a/docs/apidocs/allclasses-noframe.html b/docs/apidocs/allclasses-noframe.html index a2111e9..1a31806 100644 --- a/docs/apidocs/allclasses-noframe.html +++ b/docs/apidocs/allclasses-noframe.html @@ -2,10 +2,10 @@ - + -All Classes (AstralEdit 1.0.0 API) - +All Classes (AstralEdit 1.1.0 API) + @@ -16,8 +16,6 @@

    All Classes

  • AstralEditApi
  • AstralEditPlugin
  • DependencySupport
  • -
  • DirectionHelper
  • -
  • DirectionHelper.Direction
  • DisplayArmorstand
  • DisplayArmorstand
  • DisplayArmorstand
  • @@ -29,6 +27,15 @@

    All Classes

  • ItemStackBuilder
  • LocationBuilder
  • LocationBuilder.Direction
  • +
  • Metrics
  • +
  • Metrics.AdvancedBarChart
  • +
  • Metrics.AdvancedPie
  • +
  • Metrics.CustomChart
  • +
  • Metrics.DrilldownPie
  • +
  • Metrics.MultiLineChart
  • +
  • Metrics.SimpleBarChart
  • +
  • Metrics.SimplePie
  • +
  • Metrics.SingleLineChart
  • NMSRegistry
  • PacketArmorstand
  • Permission
  • @@ -39,6 +46,7 @@

    All Classes

  • SimpleCommandExecutor.Registered
  • SimpleCommandExecutor.UnRegistered
  • SimpleListener
  • +
  • UpdateUtils
  • VersionSupport
  • WorldEditConnection
  • diff --git a/docs/apidocs/com/github/shynixn/astraledit/api/AstralEditApi.html b/docs/apidocs/com/github/shynixn/astraledit/api/AstralEditApi.html index a601529..10cd6ad 100644 --- a/docs/apidocs/com/github/shynixn/astraledit/api/AstralEditApi.html +++ b/docs/apidocs/com/github/shynixn/astraledit/api/AstralEditApi.html @@ -2,10 +2,10 @@ - + -AstralEditApi (AstralEdit 1.0.0 API) - +AstralEditApi (AstralEdit 1.1.0 API) + @@ -13,7 +13,7 @@ @@ -13,7 +13,7 @@ @@ -13,7 +13,7 @@ @@ -13,7 +13,7 @@ @@ -13,7 +13,7 @@ @@ -13,7 +13,7 @@ diff --git a/docs/apidocs/com/github/shynixn/astraledit/api/entity/package-summary.html b/docs/apidocs/com/github/shynixn/astraledit/api/entity/package-summary.html index 98b0a8b..df9f85f 100644 --- a/docs/apidocs/com/github/shynixn/astraledit/api/entity/package-summary.html +++ b/docs/apidocs/com/github/shynixn/astraledit/api/entity/package-summary.html @@ -2,10 +2,10 @@ - + -com.github.shynixn.astraledit.api.entity (AstralEdit 1.0.0 API) - +com.github.shynixn.astraledit.api.entity (AstralEdit 1.1.0 API) + @@ -13,7 +13,7 @@ @@ -13,7 +13,7 @@ @@ -13,7 +13,7 @@ diff --git a/docs/apidocs/com/github/shynixn/astraledit/api/package-summary.html b/docs/apidocs/com/github/shynixn/astraledit/api/package-summary.html index 5e52f97..6abb876 100644 --- a/docs/apidocs/com/github/shynixn/astraledit/api/package-summary.html +++ b/docs/apidocs/com/github/shynixn/astraledit/api/package-summary.html @@ -2,10 +2,10 @@ - + -com.github.shynixn.astraledit.api (AstralEdit 1.0.0 API) - +com.github.shynixn.astraledit.api (AstralEdit 1.1.0 API) + @@ -13,7 +13,7 @@ @@ -13,7 +13,7 @@ @@ -13,7 +13,7 @@ @@ -13,14 +13,14 @@ @@ -13,7 +13,7 @@ @@ -13,7 +13,7 @@ @@ -13,7 +13,7 @@ @@ -13,7 +13,7 @@ @@ -13,7 +13,7 @@ diff --git a/docs/apidocs/com/github/shynixn/astraledit/business/bukkit/dependencies/package-summary.html b/docs/apidocs/com/github/shynixn/astraledit/business/bukkit/dependencies/package-summary.html index c0d34c7..a6afddf 100644 --- a/docs/apidocs/com/github/shynixn/astraledit/business/bukkit/dependencies/package-summary.html +++ b/docs/apidocs/com/github/shynixn/astraledit/business/bukkit/dependencies/package-summary.html @@ -2,10 +2,10 @@ - + -com.github.shynixn.astraledit.business.bukkit.dependencies (AstralEdit 1.0.0 API) - +com.github.shynixn.astraledit.business.bukkit.dependencies (AstralEdit 1.1.0 API) + @@ -13,7 +13,7 @@ @@ -13,7 +13,7 @@ @@ -13,7 +13,7 @@ @@ -13,7 +13,7 @@ @@ -13,7 +13,7 @@ diff --git a/docs/apidocs/com/github/shynixn/astraledit/business/bukkit/dependencies/worldedit/package-summary.html b/docs/apidocs/com/github/shynixn/astraledit/business/bukkit/dependencies/worldedit/package-summary.html index 4b93e69..f8c9a9e 100644 --- a/docs/apidocs/com/github/shynixn/astraledit/business/bukkit/dependencies/worldedit/package-summary.html +++ b/docs/apidocs/com/github/shynixn/astraledit/business/bukkit/dependencies/worldedit/package-summary.html @@ -2,10 +2,10 @@ - + -com.github.shynixn.astraledit.business.bukkit.dependencies.worldedit (AstralEdit 1.0.0 API) - +com.github.shynixn.astraledit.business.bukkit.dependencies.worldedit (AstralEdit 1.1.0 API) + @@ -13,7 +13,7 @@ @@ -13,7 +13,7 @@ @@ -13,7 +13,7 @@ @@ -13,7 +13,7 @@ @@ -13,7 +13,7 @@ @@ -13,7 +13,7 @@ @@ -13,7 +13,7 @@ diff --git a/docs/apidocs/com/github/shynixn/astraledit/business/bukkit/nms/package-summary.html b/docs/apidocs/com/github/shynixn/astraledit/business/bukkit/nms/package-summary.html index 2d27c6a..475901a 100644 --- a/docs/apidocs/com/github/shynixn/astraledit/business/bukkit/nms/package-summary.html +++ b/docs/apidocs/com/github/shynixn/astraledit/business/bukkit/nms/package-summary.html @@ -2,10 +2,10 @@ - + -com.github.shynixn.astraledit.business.bukkit.nms (AstralEdit 1.0.0 API) - +com.github.shynixn.astraledit.business.bukkit.nms (AstralEdit 1.1.0 API) + @@ -13,7 +13,7 @@ @@ -13,7 +13,7 @@ @@ -13,7 +13,7 @@ @@ -13,7 +13,7 @@ @@ -13,7 +13,7 @@ diff --git a/docs/apidocs/com/github/shynixn/astraledit/business/bukkit/nms/v1_10_R1/package-summary.html b/docs/apidocs/com/github/shynixn/astraledit/business/bukkit/nms/v1_10_R1/package-summary.html index de195fb..a1dcd21 100644 --- a/docs/apidocs/com/github/shynixn/astraledit/business/bukkit/nms/v1_10_R1/package-summary.html +++ b/docs/apidocs/com/github/shynixn/astraledit/business/bukkit/nms/v1_10_R1/package-summary.html @@ -2,10 +2,10 @@ - + -com.github.shynixn.astraledit.business.bukkit.nms.v1_10_R1 (AstralEdit 1.0.0 API) - +com.github.shynixn.astraledit.business.bukkit.nms.v1_10_R1 (AstralEdit 1.1.0 API) + @@ -13,7 +13,7 @@ @@ -13,7 +13,7 @@ @@ -13,7 +13,7 @@ @@ -13,7 +13,7 @@ @@ -13,7 +13,7 @@ diff --git a/docs/apidocs/com/github/shynixn/astraledit/business/bukkit/nms/v1_11_R1/package-summary.html b/docs/apidocs/com/github/shynixn/astraledit/business/bukkit/nms/v1_11_R1/package-summary.html index 5c5e60e..c86aae5 100644 --- a/docs/apidocs/com/github/shynixn/astraledit/business/bukkit/nms/v1_11_R1/package-summary.html +++ b/docs/apidocs/com/github/shynixn/astraledit/business/bukkit/nms/v1_11_R1/package-summary.html @@ -2,10 +2,10 @@ - + -com.github.shynixn.astraledit.business.bukkit.nms.v1_11_R1 (AstralEdit 1.0.0 API) - +com.github.shynixn.astraledit.business.bukkit.nms.v1_11_R1 (AstralEdit 1.1.0 API) + @@ -13,7 +13,7 @@ @@ -13,7 +13,7 @@ @@ -13,7 +13,7 @@ @@ -13,7 +13,7 @@ @@ -13,7 +13,7 @@ diff --git a/docs/apidocs/com/github/shynixn/astraledit/business/bukkit/nms/v1_12_R1/package-summary.html b/docs/apidocs/com/github/shynixn/astraledit/business/bukkit/nms/v1_12_R1/package-summary.html index 7b64af1..bda3c67 100644 --- a/docs/apidocs/com/github/shynixn/astraledit/business/bukkit/nms/v1_12_R1/package-summary.html +++ b/docs/apidocs/com/github/shynixn/astraledit/business/bukkit/nms/v1_12_R1/package-summary.html @@ -2,10 +2,10 @@ - + -com.github.shynixn.astraledit.business.bukkit.nms.v1_12_R1 (AstralEdit 1.0.0 API) - +com.github.shynixn.astraledit.business.bukkit.nms.v1_12_R1 (AstralEdit 1.1.0 API) + @@ -13,7 +13,7 @@ @@ -13,7 +13,7 @@ @@ -13,7 +13,7 @@ @@ -13,7 +13,7 @@ @@ -13,7 +13,7 @@ diff --git a/docs/apidocs/com/github/shynixn/astraledit/business/bukkit/nms/v1_8_R1/package-summary.html b/docs/apidocs/com/github/shynixn/astraledit/business/bukkit/nms/v1_8_R1/package-summary.html index 16618be..9b2462f 100644 --- a/docs/apidocs/com/github/shynixn/astraledit/business/bukkit/nms/v1_8_R1/package-summary.html +++ b/docs/apidocs/com/github/shynixn/astraledit/business/bukkit/nms/v1_8_R1/package-summary.html @@ -2,10 +2,10 @@ - + -com.github.shynixn.astraledit.business.bukkit.nms.v1_8_R1 (AstralEdit 1.0.0 API) - +com.github.shynixn.astraledit.business.bukkit.nms.v1_8_R1 (AstralEdit 1.1.0 API) + @@ -13,7 +13,7 @@ @@ -13,7 +13,7 @@ @@ -13,7 +13,7 @@ @@ -13,7 +13,7 @@ @@ -13,7 +13,7 @@ diff --git a/docs/apidocs/com/github/shynixn/astraledit/business/bukkit/nms/v1_8_R2/package-summary.html b/docs/apidocs/com/github/shynixn/astraledit/business/bukkit/nms/v1_8_R2/package-summary.html index 7ddf57b..b2298a9 100644 --- a/docs/apidocs/com/github/shynixn/astraledit/business/bukkit/nms/v1_8_R2/package-summary.html +++ b/docs/apidocs/com/github/shynixn/astraledit/business/bukkit/nms/v1_8_R2/package-summary.html @@ -2,10 +2,10 @@ - + -com.github.shynixn.astraledit.business.bukkit.nms.v1_8_R2 (AstralEdit 1.0.0 API) - +com.github.shynixn.astraledit.business.bukkit.nms.v1_8_R2 (AstralEdit 1.1.0 API) + @@ -13,7 +13,7 @@ @@ -13,7 +13,7 @@ @@ -13,7 +13,7 @@ @@ -13,7 +13,7 @@ @@ -13,7 +13,7 @@ diff --git a/docs/apidocs/com/github/shynixn/astraledit/business/bukkit/nms/v1_8_R3/package-summary.html b/docs/apidocs/com/github/shynixn/astraledit/business/bukkit/nms/v1_8_R3/package-summary.html index f0be014..4a50e58 100644 --- a/docs/apidocs/com/github/shynixn/astraledit/business/bukkit/nms/v1_8_R3/package-summary.html +++ b/docs/apidocs/com/github/shynixn/astraledit/business/bukkit/nms/v1_8_R3/package-summary.html @@ -2,10 +2,10 @@ - + -com.github.shynixn.astraledit.business.bukkit.nms.v1_8_R3 (AstralEdit 1.0.0 API) - +com.github.shynixn.astraledit.business.bukkit.nms.v1_8_R3 (AstralEdit 1.1.0 API) + @@ -13,7 +13,7 @@ @@ -13,7 +13,7 @@ @@ -13,7 +13,7 @@ @@ -13,7 +13,7 @@ @@ -13,7 +13,7 @@ diff --git a/docs/apidocs/com/github/shynixn/astraledit/business/bukkit/nms/v1_9_R1/package-summary.html b/docs/apidocs/com/github/shynixn/astraledit/business/bukkit/nms/v1_9_R1/package-summary.html index 4f7cbdb..417d904 100644 --- a/docs/apidocs/com/github/shynixn/astraledit/business/bukkit/nms/v1_9_R1/package-summary.html +++ b/docs/apidocs/com/github/shynixn/astraledit/business/bukkit/nms/v1_9_R1/package-summary.html @@ -2,10 +2,10 @@ - + -com.github.shynixn.astraledit.business.bukkit.nms.v1_9_R1 (AstralEdit 1.0.0 API) - +com.github.shynixn.astraledit.business.bukkit.nms.v1_9_R1 (AstralEdit 1.1.0 API) + @@ -13,7 +13,7 @@ @@ -13,7 +13,7 @@ @@ -13,7 +13,7 @@ @@ -13,7 +13,7 @@ @@ -13,7 +13,7 @@ diff --git a/docs/apidocs/com/github/shynixn/astraledit/business/bukkit/nms/v1_9_R2/package-summary.html b/docs/apidocs/com/github/shynixn/astraledit/business/bukkit/nms/v1_9_R2/package-summary.html index 3cbcdd6..78a3ee4 100644 --- a/docs/apidocs/com/github/shynixn/astraledit/business/bukkit/nms/v1_9_R2/package-summary.html +++ b/docs/apidocs/com/github/shynixn/astraledit/business/bukkit/nms/v1_9_R2/package-summary.html @@ -2,10 +2,10 @@ - + -com.github.shynixn.astraledit.business.bukkit.nms.v1_9_R2 (AstralEdit 1.0.0 API) - +com.github.shynixn.astraledit.business.bukkit.nms.v1_9_R2 (AstralEdit 1.1.0 API) + @@ -13,7 +13,7 @@ @@ -13,7 +13,7 @@ @@ -13,7 +13,7 @@ diff --git a/docs/apidocs/com/github/shynixn/astraledit/business/bukkit/package-summary.html b/docs/apidocs/com/github/shynixn/astraledit/business/bukkit/package-summary.html index 7d4c2fd..27cd1a4 100644 --- a/docs/apidocs/com/github/shynixn/astraledit/business/bukkit/package-summary.html +++ b/docs/apidocs/com/github/shynixn/astraledit/business/bukkit/package-summary.html @@ -2,10 +2,10 @@ - + -com.github.shynixn.astraledit.business.bukkit (AstralEdit 1.0.0 API) - +com.github.shynixn.astraledit.business.bukkit (AstralEdit 1.1.0 API) + @@ -13,7 +13,7 @@ @@ -13,7 +13,7 @@ @@ -13,7 +13,7 @@ @@ -13,7 +13,7 @@ @@ -13,7 +13,7 @@ diff --git a/docs/apidocs/com/github/shynixn/astraledit/business/logic/package-summary.html b/docs/apidocs/com/github/shynixn/astraledit/business/logic/package-summary.html index 76e2f87..bdc8bd0 100644 --- a/docs/apidocs/com/github/shynixn/astraledit/business/logic/package-summary.html +++ b/docs/apidocs/com/github/shynixn/astraledit/business/logic/package-summary.html @@ -2,10 +2,10 @@ - + -com.github.shynixn.astraledit.business.logic (AstralEdit 1.0.0 API) - +com.github.shynixn.astraledit.business.logic (AstralEdit 1.1.0 API) + @@ -13,7 +13,7 @@ @@ -13,7 +13,7 @@ @@ -13,7 +13,7 @@ + + + + + + + + + +
    +
    com.github.shynixn.astraledit.business.metrics
    +

    Class Metrics.AdvancedBarChart

    +
    +
    + +
    +
      +
    • +
      +
      Enclosing class:
      +
      Metrics
      +
      +
      +
      +
      public static class Metrics.AdvancedBarChart
      +extends Metrics.CustomChart
      +
      Represents a custom advanced bar chart.
      +
    • +
    +
    +
    + +
    +
    +
      +
    • + +
        +
      • + + +

        Constructor Detail

        + + + +
          +
        • +

          AdvancedBarChart

          +
          public AdvancedBarChart(String chartId,
          +                        Callable<Map<String,int[]>> callable)
          +
          Class constructor.
          +
          +
          Parameters:
          +
          chartId - The id of the chart.
          +
          callable - The callable which is used to request the chart data.
          +
          +
        • +
        +
      • +
      + + +
    • +
    +
    +
    + + + + + +

    Copyright © 2017. All rights reserved.

    + + diff --git a/docs/apidocs/com/github/shynixn/astraledit/business/metrics/Metrics.AdvancedPie.html b/docs/apidocs/com/github/shynixn/astraledit/business/metrics/Metrics.AdvancedPie.html new file mode 100644 index 0000000..7ddb0bc --- /dev/null +++ b/docs/apidocs/com/github/shynixn/astraledit/business/metrics/Metrics.AdvancedPie.html @@ -0,0 +1,300 @@ + + + + + + +Metrics.AdvancedPie (AstralEdit 1.1.0 API) + + + + + + + + + + + + +
    +
    com.github.shynixn.astraledit.business.metrics
    +

    Class Metrics.AdvancedPie

    +
    +
    + +
    +
      +
    • +
      +
      Enclosing class:
      +
      Metrics
      +
      +
      +
      +
      public static class Metrics.AdvancedPie
      +extends Metrics.CustomChart
      +
      Represents a custom advanced pie.
      +
    • +
    +
    +
    + +
    +
    +
      +
    • + +
        +
      • + + +

        Constructor Detail

        + + + +
          +
        • +

          AdvancedPie

          +
          public AdvancedPie(String chartId,
          +                   Callable<Map<String,Integer>> callable)
          +
          Class constructor.
          +
          +
          Parameters:
          +
          chartId - The id of the chart.
          +
          callable - The callable which is used to request the chart data.
          +
          +
        • +
        +
      • +
      + + +
    • +
    +
    +
    + + + + + +

    Copyright © 2017. All rights reserved.

    + + diff --git a/docs/apidocs/com/github/shynixn/astraledit/business/metrics/Metrics.CustomChart.html b/docs/apidocs/com/github/shynixn/astraledit/business/metrics/Metrics.CustomChart.html new file mode 100644 index 0000000..c65316b --- /dev/null +++ b/docs/apidocs/com/github/shynixn/astraledit/business/metrics/Metrics.CustomChart.html @@ -0,0 +1,253 @@ + + + + + + +Metrics.CustomChart (AstralEdit 1.1.0 API) + + + + + + + + + + + + +
    +
    com.github.shynixn.astraledit.business.metrics
    +

    Class Metrics.CustomChart

    +
    +
    +
      +
    • java.lang.Object
    • +
    • +
        +
      • com.github.shynixn.astraledit.business.metrics.Metrics.CustomChart
      • +
      +
    • +
    +
    + +
    +
    + +
    +
    +
      +
    • + +
        +
      • + + +

        Method Detail

        + + + +
          +
        • +

          getChartData

          +
          protected abstract org.json.simple.JSONObject getChartData()
          +                                                    throws Exception
          +
          +
          Throws:
          +
          Exception
          +
          +
        • +
        +
      • +
      +
    • +
    +
    +
    + + + + + +

    Copyright © 2017. All rights reserved.

    + + diff --git a/docs/apidocs/com/github/shynixn/astraledit/business/metrics/Metrics.DrilldownPie.html b/docs/apidocs/com/github/shynixn/astraledit/business/metrics/Metrics.DrilldownPie.html new file mode 100644 index 0000000..216f9e9 --- /dev/null +++ b/docs/apidocs/com/github/shynixn/astraledit/business/metrics/Metrics.DrilldownPie.html @@ -0,0 +1,300 @@ + + + + + + +Metrics.DrilldownPie (AstralEdit 1.1.0 API) + + + + + + + + + + + + +
    +
    com.github.shynixn.astraledit.business.metrics
    +

    Class Metrics.DrilldownPie

    +
    +
    + +
    +
      +
    • +
      +
      Enclosing class:
      +
      Metrics
      +
      +
      +
      +
      public static class Metrics.DrilldownPie
      +extends Metrics.CustomChart
      +
      Represents a custom drilldown pie.
      +
    • +
    +
    +
    + +
    +
    + +
    +
    + + + + + +

    Copyright © 2017. All rights reserved.

    + + diff --git a/docs/apidocs/com/github/shynixn/astraledit/business/metrics/Metrics.MultiLineChart.html b/docs/apidocs/com/github/shynixn/astraledit/business/metrics/Metrics.MultiLineChart.html new file mode 100644 index 0000000..5d0d61f --- /dev/null +++ b/docs/apidocs/com/github/shynixn/astraledit/business/metrics/Metrics.MultiLineChart.html @@ -0,0 +1,300 @@ + + + + + + +Metrics.MultiLineChart (AstralEdit 1.1.0 API) + + + + + + + + + + + + +
    +
    com.github.shynixn.astraledit.business.metrics
    +

    Class Metrics.MultiLineChart

    +
    +
    + +
    +
      +
    • +
      +
      Enclosing class:
      +
      Metrics
      +
      +
      +
      +
      public static class Metrics.MultiLineChart
      +extends Metrics.CustomChart
      +
      Represents a custom multi line chart.
      +
    • +
    +
    +
    + +
    +
    +
      +
    • + +
        +
      • + + +

        Constructor Detail

        + + + +
          +
        • +

          MultiLineChart

          +
          public MultiLineChart(String chartId,
          +                      Callable<Map<String,Integer>> callable)
          +
          Class constructor.
          +
          +
          Parameters:
          +
          chartId - The id of the chart.
          +
          callable - The callable which is used to request the chart data.
          +
          +
        • +
        +
      • +
      + + +
    • +
    +
    +
    + + + + + +

    Copyright © 2017. All rights reserved.

    + + diff --git a/docs/apidocs/com/github/shynixn/astraledit/business/metrics/Metrics.SimpleBarChart.html b/docs/apidocs/com/github/shynixn/astraledit/business/metrics/Metrics.SimpleBarChart.html new file mode 100644 index 0000000..1e1c1f0 --- /dev/null +++ b/docs/apidocs/com/github/shynixn/astraledit/business/metrics/Metrics.SimpleBarChart.html @@ -0,0 +1,300 @@ + + + + + + +Metrics.SimpleBarChart (AstralEdit 1.1.0 API) + + + + + + + + + + + + +
    +
    com.github.shynixn.astraledit.business.metrics
    +

    Class Metrics.SimpleBarChart

    +
    +
    + +
    +
      +
    • +
      +
      Enclosing class:
      +
      Metrics
      +
      +
      +
      +
      public static class Metrics.SimpleBarChart
      +extends Metrics.CustomChart
      +
      Represents a custom simple bar chart.
      +
    • +
    +
    +
    + +
    +
    +
      +
    • + +
        +
      • + + +

        Constructor Detail

        + + + +
          +
        • +

          SimpleBarChart

          +
          public SimpleBarChart(String chartId,
          +                      Callable<Map<String,Integer>> callable)
          +
          Class constructor.
          +
          +
          Parameters:
          +
          chartId - The id of the chart.
          +
          callable - The callable which is used to request the chart data.
          +
          +
        • +
        +
      • +
      + + +
    • +
    +
    +
    + + + + + +

    Copyright © 2017. All rights reserved.

    + + diff --git a/docs/apidocs/com/github/shynixn/astraledit/business/metrics/Metrics.SimplePie.html b/docs/apidocs/com/github/shynixn/astraledit/business/metrics/Metrics.SimplePie.html new file mode 100644 index 0000000..5fffd44 --- /dev/null +++ b/docs/apidocs/com/github/shynixn/astraledit/business/metrics/Metrics.SimplePie.html @@ -0,0 +1,300 @@ + + + + + + +Metrics.SimplePie (AstralEdit 1.1.0 API) + + + + + + + + + + + + +
    +
    com.github.shynixn.astraledit.business.metrics
    +

    Class Metrics.SimplePie

    +
    +
    + +
    +
      +
    • +
      +
      Enclosing class:
      +
      Metrics
      +
      +
      +
      +
      public static class Metrics.SimplePie
      +extends Metrics.CustomChart
      +
      Represents a custom simple pie.
      +
    • +
    +
    +
    + +
    +
    +
      +
    • + +
        +
      • + + +

        Constructor Detail

        + + + +
          +
        • +

          SimplePie

          +
          public SimplePie(String chartId,
          +                 Callable<String> callable)
          +
          Class constructor.
          +
          +
          Parameters:
          +
          chartId - The id of the chart.
          +
          callable - The callable which is used to request the chart data.
          +
          +
        • +
        +
      • +
      + + +
    • +
    +
    +
    + + + + + +

    Copyright © 2017. All rights reserved.

    + + diff --git a/docs/apidocs/com/github/shynixn/astraledit/business/metrics/Metrics.SingleLineChart.html b/docs/apidocs/com/github/shynixn/astraledit/business/metrics/Metrics.SingleLineChart.html new file mode 100644 index 0000000..7f9e0e0 --- /dev/null +++ b/docs/apidocs/com/github/shynixn/astraledit/business/metrics/Metrics.SingleLineChart.html @@ -0,0 +1,300 @@ + + + + + + +Metrics.SingleLineChart (AstralEdit 1.1.0 API) + + + + + + + + + + + + +
    +
    com.github.shynixn.astraledit.business.metrics
    +

    Class Metrics.SingleLineChart

    +
    +
    + +
    +
      +
    • +
      +
      Enclosing class:
      +
      Metrics
      +
      +
      +
      +
      public static class Metrics.SingleLineChart
      +extends Metrics.CustomChart
      +
      Represents a custom single line chart.
      +
    • +
    +
    +
    + +
    +
    +
      +
    • + +
        +
      • + + +

        Constructor Detail

        + + + +
          +
        • +

          SingleLineChart

          +
          public SingleLineChart(String chartId,
          +                       Callable<Integer> callable)
          +
          Class constructor.
          +
          +
          Parameters:
          +
          chartId - The id of the chart.
          +
          callable - The callable which is used to request the chart data.
          +
          +
        • +
        +
      • +
      + + +
    • +
    +
    +
    + + + + + +

    Copyright © 2017. All rights reserved.

    + + diff --git a/docs/apidocs/com/github/shynixn/astraledit/business/metrics/Metrics.html b/docs/apidocs/com/github/shynixn/astraledit/business/metrics/Metrics.html new file mode 100644 index 0000000..ce610d4 --- /dev/null +++ b/docs/apidocs/com/github/shynixn/astraledit/business/metrics/Metrics.html @@ -0,0 +1,414 @@ + + + + + + +Metrics (AstralEdit 1.1.0 API) + + + + + + + + + + + + +
    +
    com.github.shynixn.astraledit.business.metrics
    +

    Class Metrics

    +
    +
    +
      +
    • java.lang.Object
    • +
    • +
        +
      • com.github.shynixn.astraledit.business.metrics.Metrics
      • +
      +
    • +
    +
    +
      +
    • +
      +
      +
      public class Metrics
      +extends Object
      +
      bStats collects some data for plugin authors. +

      + Check out https://bStats.org/ to learn more about bStats!

      +
    • +
    +
    +
    + +
    +
    +
      +
    • + + + +
        +
      • + + +

        Constructor Detail

        + + + +
          +
        • +

          Metrics

          +
          public Metrics(org.bukkit.plugin.java.JavaPlugin plugin)
          +
          Class constructor.
          +
          +
          Parameters:
          +
          plugin - The plugin which stats should be submitted.
          +
          +
        • +
        +
      • +
      + +
        +
      • + + +

        Method Detail

        + + + +
          +
        • +

          addCustomChart

          +
          public void addCustomChart(Metrics.CustomChart chart)
          +
          Adds a custom chart.
          +
          +
          Parameters:
          +
          chart - The chart to add.
          +
          +
        • +
        + + + +
          +
        • +

          getPluginData

          +
          public org.json.simple.JSONObject getPluginData()
          +
          Gets the plugin specific data. + This method is called using Reflection.
          +
          +
          Returns:
          +
          The plugin specific data.
          +
          +
        • +
        +
      • +
      +
    • +
    +
    +
    + + + + + +

    Copyright © 2017. All rights reserved.

    + + diff --git a/docs/apidocs/com/github/shynixn/astraledit/business/metrics/class-use/Metrics.AdvancedBarChart.html b/docs/apidocs/com/github/shynixn/astraledit/business/metrics/class-use/Metrics.AdvancedBarChart.html new file mode 100644 index 0000000..e11af28 --- /dev/null +++ b/docs/apidocs/com/github/shynixn/astraledit/business/metrics/class-use/Metrics.AdvancedBarChart.html @@ -0,0 +1,126 @@ + + + + + + +Uses of Class com.github.shynixn.astraledit.business.metrics.Metrics.AdvancedBarChart (AstralEdit 1.1.0 API) + + + + + + + + + + + +
    +

    Uses of Class
    com.github.shynixn.astraledit.business.metrics.Metrics.AdvancedBarChart

    +
    +
    No usage of com.github.shynixn.astraledit.business.metrics.Metrics.AdvancedBarChart
    + + + + +

    Copyright © 2017. All rights reserved.

    + + diff --git a/docs/apidocs/com/github/shynixn/astraledit/business/metrics/class-use/Metrics.AdvancedPie.html b/docs/apidocs/com/github/shynixn/astraledit/business/metrics/class-use/Metrics.AdvancedPie.html new file mode 100644 index 0000000..6323ead --- /dev/null +++ b/docs/apidocs/com/github/shynixn/astraledit/business/metrics/class-use/Metrics.AdvancedPie.html @@ -0,0 +1,126 @@ + + + + + + +Uses of Class com.github.shynixn.astraledit.business.metrics.Metrics.AdvancedPie (AstralEdit 1.1.0 API) + + + + + + + + + + + +
    +

    Uses of Class
    com.github.shynixn.astraledit.business.metrics.Metrics.AdvancedPie

    +
    +
    No usage of com.github.shynixn.astraledit.business.metrics.Metrics.AdvancedPie
    + + + + +

    Copyright © 2017. All rights reserved.

    + + diff --git a/docs/apidocs/com/github/shynixn/astraledit/business/metrics/class-use/Metrics.CustomChart.html b/docs/apidocs/com/github/shynixn/astraledit/business/metrics/class-use/Metrics.CustomChart.html new file mode 100644 index 0000000..1f375b0 --- /dev/null +++ b/docs/apidocs/com/github/shynixn/astraledit/business/metrics/class-use/Metrics.CustomChart.html @@ -0,0 +1,219 @@ + + + + + + +Uses of Class com.github.shynixn.astraledit.business.metrics.Metrics.CustomChart (AstralEdit 1.1.0 API) + + + + + + + + + + + +
    +

    Uses of Class
    com.github.shynixn.astraledit.business.metrics.Metrics.CustomChart

    +
    +
    + +
    + + + + +

    Copyright © 2017. All rights reserved.

    + + diff --git a/docs/apidocs/com/github/shynixn/astraledit/business/metrics/class-use/Metrics.DrilldownPie.html b/docs/apidocs/com/github/shynixn/astraledit/business/metrics/class-use/Metrics.DrilldownPie.html new file mode 100644 index 0000000..95f1d8b --- /dev/null +++ b/docs/apidocs/com/github/shynixn/astraledit/business/metrics/class-use/Metrics.DrilldownPie.html @@ -0,0 +1,126 @@ + + + + + + +Uses of Class com.github.shynixn.astraledit.business.metrics.Metrics.DrilldownPie (AstralEdit 1.1.0 API) + + + + + + + + + + + +
    +

    Uses of Class
    com.github.shynixn.astraledit.business.metrics.Metrics.DrilldownPie

    +
    +
    No usage of com.github.shynixn.astraledit.business.metrics.Metrics.DrilldownPie
    + + + + +

    Copyright © 2017. All rights reserved.

    + + diff --git a/docs/apidocs/com/github/shynixn/astraledit/business/metrics/class-use/Metrics.MultiLineChart.html b/docs/apidocs/com/github/shynixn/astraledit/business/metrics/class-use/Metrics.MultiLineChart.html new file mode 100644 index 0000000..bca5ab9 --- /dev/null +++ b/docs/apidocs/com/github/shynixn/astraledit/business/metrics/class-use/Metrics.MultiLineChart.html @@ -0,0 +1,126 @@ + + + + + + +Uses of Class com.github.shynixn.astraledit.business.metrics.Metrics.MultiLineChart (AstralEdit 1.1.0 API) + + + + + + + + + + + +
    +

    Uses of Class
    com.github.shynixn.astraledit.business.metrics.Metrics.MultiLineChart

    +
    +
    No usage of com.github.shynixn.astraledit.business.metrics.Metrics.MultiLineChart
    + + + + +

    Copyright © 2017. All rights reserved.

    + + diff --git a/docs/apidocs/com/github/shynixn/astraledit/business/metrics/class-use/Metrics.SimpleBarChart.html b/docs/apidocs/com/github/shynixn/astraledit/business/metrics/class-use/Metrics.SimpleBarChart.html new file mode 100644 index 0000000..2f525fc --- /dev/null +++ b/docs/apidocs/com/github/shynixn/astraledit/business/metrics/class-use/Metrics.SimpleBarChart.html @@ -0,0 +1,126 @@ + + + + + + +Uses of Class com.github.shynixn.astraledit.business.metrics.Metrics.SimpleBarChart (AstralEdit 1.1.0 API) + + + + + + + + + + + +
    +

    Uses of Class
    com.github.shynixn.astraledit.business.metrics.Metrics.SimpleBarChart

    +
    +
    No usage of com.github.shynixn.astraledit.business.metrics.Metrics.SimpleBarChart
    + + + + +

    Copyright © 2017. All rights reserved.

    + + diff --git a/docs/apidocs/com/github/shynixn/astraledit/business/metrics/class-use/Metrics.SimplePie.html b/docs/apidocs/com/github/shynixn/astraledit/business/metrics/class-use/Metrics.SimplePie.html new file mode 100644 index 0000000..43f8cfd --- /dev/null +++ b/docs/apidocs/com/github/shynixn/astraledit/business/metrics/class-use/Metrics.SimplePie.html @@ -0,0 +1,126 @@ + + + + + + +Uses of Class com.github.shynixn.astraledit.business.metrics.Metrics.SimplePie (AstralEdit 1.1.0 API) + + + + + + + + + + + +
    +

    Uses of Class
    com.github.shynixn.astraledit.business.metrics.Metrics.SimplePie

    +
    +
    No usage of com.github.shynixn.astraledit.business.metrics.Metrics.SimplePie
    + + + + +

    Copyright © 2017. All rights reserved.

    + + diff --git a/docs/apidocs/com/github/shynixn/astraledit/business/metrics/class-use/Metrics.SingleLineChart.html b/docs/apidocs/com/github/shynixn/astraledit/business/metrics/class-use/Metrics.SingleLineChart.html new file mode 100644 index 0000000..9939ffd --- /dev/null +++ b/docs/apidocs/com/github/shynixn/astraledit/business/metrics/class-use/Metrics.SingleLineChart.html @@ -0,0 +1,126 @@ + + + + + + +Uses of Class com.github.shynixn.astraledit.business.metrics.Metrics.SingleLineChart (AstralEdit 1.1.0 API) + + + + + + + + + + + +
    +

    Uses of Class
    com.github.shynixn.astraledit.business.metrics.Metrics.SingleLineChart

    +
    +
    No usage of com.github.shynixn.astraledit.business.metrics.Metrics.SingleLineChart
    + + + + +

    Copyright © 2017. All rights reserved.

    + + diff --git a/docs/apidocs/com/github/shynixn/astraledit/business/metrics/class-use/Metrics.html b/docs/apidocs/com/github/shynixn/astraledit/business/metrics/class-use/Metrics.html new file mode 100644 index 0000000..cc9caac --- /dev/null +++ b/docs/apidocs/com/github/shynixn/astraledit/business/metrics/class-use/Metrics.html @@ -0,0 +1,126 @@ + + + + + + +Uses of Class com.github.shynixn.astraledit.business.metrics.Metrics (AstralEdit 1.1.0 API) + + + + + + + + + + + +
    +

    Uses of Class
    com.github.shynixn.astraledit.business.metrics.Metrics

    +
    +
    No usage of com.github.shynixn.astraledit.business.metrics.Metrics
    + + + + +

    Copyright © 2017. All rights reserved.

    + + diff --git a/docs/apidocs/com/github/shynixn/astraledit/business/metrics/package-frame.html b/docs/apidocs/com/github/shynixn/astraledit/business/metrics/package-frame.html new file mode 100644 index 0000000..cbc85b0 --- /dev/null +++ b/docs/apidocs/com/github/shynixn/astraledit/business/metrics/package-frame.html @@ -0,0 +1,29 @@ + + + + + + +com.github.shynixn.astraledit.business.metrics (AstralEdit 1.1.0 API) + + + + + +

    com.github.shynixn.astraledit.business.metrics

    + + + diff --git a/docs/apidocs/com/github/shynixn/astraledit/business/metrics/package-summary.html b/docs/apidocs/com/github/shynixn/astraledit/business/metrics/package-summary.html new file mode 100644 index 0000000..2be2406 --- /dev/null +++ b/docs/apidocs/com/github/shynixn/astraledit/business/metrics/package-summary.html @@ -0,0 +1,194 @@ + + + + + + +com.github.shynixn.astraledit.business.metrics (AstralEdit 1.1.0 API) + + + + + + + + + + + +
    +

    Package com.github.shynixn.astraledit.business.metrics

    +
    +
    + +
    + + + + +

    Copyright © 2017. All rights reserved.

    + + diff --git a/docs/apidocs/com/github/shynixn/astraledit/business/metrics/package-tree.html b/docs/apidocs/com/github/shynixn/astraledit/business/metrics/package-tree.html new file mode 100644 index 0000000..35745a0 --- /dev/null +++ b/docs/apidocs/com/github/shynixn/astraledit/business/metrics/package-tree.html @@ -0,0 +1,150 @@ + + + + + + +com.github.shynixn.astraledit.business.metrics Class Hierarchy (AstralEdit 1.1.0 API) + + + + + + + + + + + +
    +

    Hierarchy For Package com.github.shynixn.astraledit.business.metrics

    +Package Hierarchies: + +
    +
    +

    Class Hierarchy

    + +
    + + + + +

    Copyright © 2017. All rights reserved.

    + + diff --git a/docs/apidocs/com/github/shynixn/astraledit/business/metrics/package-use.html b/docs/apidocs/com/github/shynixn/astraledit/business/metrics/package-use.html new file mode 100644 index 0000000..e9b2a46 --- /dev/null +++ b/docs/apidocs/com/github/shynixn/astraledit/business/metrics/package-use.html @@ -0,0 +1,161 @@ + + + + + + +Uses of Package com.github.shynixn.astraledit.business.metrics (AstralEdit 1.1.0 API) + + + + + + + + + + + +
    +

    Uses of Package
    com.github.shynixn.astraledit.business.metrics

    +
    +
    + +
    + + + + +

    Copyright © 2017. All rights reserved.

    + + diff --git a/docs/apidocs/com/github/shynixn/astraledit/lib/DirectionHelper.Direction.html b/docs/apidocs/com/github/shynixn/astraledit/lib/DirectionHelper.Direction.html deleted file mode 100644 index d636a31..0000000 --- a/docs/apidocs/com/github/shynixn/astraledit/lib/DirectionHelper.Direction.html +++ /dev/null @@ -1,395 +0,0 @@ - - - - - - -DirectionHelper.Direction (AstralEdit 1.0.0 API) - - - - - - - - - - - - -
    -
    com.github.shynixn.astraledit.lib
    -

    Enum DirectionHelper.Direction

    -
    -
    - -
    - -
    -
    - -
    -
    -
      -
    • - - - -
        -
      • - - -

        Method Detail

        - - - -
          -
        • -

          values

          -
          public static DirectionHelper.Direction[] values()
          -
          Returns an array containing the constants of this enum type, in -the order they are declared. This method may be used to iterate -over the constants as follows: -
          -for (DirectionHelper.Direction c : DirectionHelper.Direction.values())
          -    System.out.println(c);
          -
          -
          -
          Returns:
          -
          an array containing the constants of this enum type, in the order they are declared
          -
          -
        • -
        - - - -
          -
        • -

          valueOf

          -
          public static DirectionHelper.Direction valueOf(String name)
          -
          Returns the enum constant of this type with the specified name. -The string must match exactly an identifier used to declare an -enum constant in this type. (Extraneous whitespace characters are -not permitted.)
          -
          -
          Parameters:
          -
          name - the name of the enum constant to be returned.
          -
          Returns:
          -
          the enum constant with the specified name
          -
          Throws:
          -
          IllegalArgumentException - if this enum type has no constant with the specified name
          -
          NullPointerException - if the argument is null
          -
          -
        • -
        -
      • -
      -
    • -
    -
    -
    - - - - - -

    Copyright © 2017. All rights reserved.

    - - diff --git a/docs/apidocs/com/github/shynixn/astraledit/lib/ItemStackBuilder.html b/docs/apidocs/com/github/shynixn/astraledit/lib/ItemStackBuilder.html index 50eb39f..f36cfcb 100644 --- a/docs/apidocs/com/github/shynixn/astraledit/lib/ItemStackBuilder.html +++ b/docs/apidocs/com/github/shynixn/astraledit/lib/ItemStackBuilder.html @@ -2,10 +2,10 @@ - + -ItemStackBuilder (AstralEdit 1.0.0 API) - +ItemStackBuilder (AstralEdit 1.1.0 API) + @@ -13,7 +13,7 @@ @@ -13,7 +13,7 @@ @@ -13,7 +13,7 @@ @@ -13,7 +13,7 @@ @@ -13,7 +13,7 @@ @@ -13,7 +13,7 @@ @@ -13,7 +13,7 @@ @@ -13,7 +13,7 @@ @@ -13,14 +13,14 @@ - - - - - - - - -
    -

    Uses of Class
    com.github.shynixn.astraledit.lib.DirectionHelper.Direction

    -
    -
    - -
    - - - - -

    Copyright © 2017. All rights reserved.

    - - diff --git a/docs/apidocs/com/github/shynixn/astraledit/lib/class-use/ItemStackBuilder.html b/docs/apidocs/com/github/shynixn/astraledit/lib/class-use/ItemStackBuilder.html index 36fefcf..720a059 100644 --- a/docs/apidocs/com/github/shynixn/astraledit/lib/class-use/ItemStackBuilder.html +++ b/docs/apidocs/com/github/shynixn/astraledit/lib/class-use/ItemStackBuilder.html @@ -2,10 +2,10 @@ - + -Uses of Class com.github.shynixn.astraledit.lib.ItemStackBuilder (AstralEdit 1.0.0 API) - +Uses of Class com.github.shynixn.astraledit.lib.ItemStackBuilder (AstralEdit 1.1.0 API) + @@ -13,7 +13,7 @@ @@ -13,7 +13,7 @@ @@ -13,7 +13,7 @@ @@ -13,7 +13,7 @@ @@ -13,7 +13,7 @@ @@ -13,7 +13,7 @@ @@ -13,7 +13,7 @@ @@ -13,7 +13,7 @@ @@ -13,7 +13,7 @@ @@ -14,7 +14,6 @@

    Classes

    Enums

    diff --git a/docs/apidocs/com/github/shynixn/astraledit/lib/package-summary.html b/docs/apidocs/com/github/shynixn/astraledit/lib/package-summary.html index aecd067..7fa6676 100644 --- a/docs/apidocs/com/github/shynixn/astraledit/lib/package-summary.html +++ b/docs/apidocs/com/github/shynixn/astraledit/lib/package-summary.html @@ -2,10 +2,10 @@ - + -com.github.shynixn.astraledit.lib (AstralEdit 1.0.0 API) - +com.github.shynixn.astraledit.lib (AstralEdit 1.1.0 API) + @@ -13,7 +13,7 @@ @@ -13,7 +13,7 @@ @@ -13,7 +13,7 @@ @@ -13,7 +13,7 @@ @@ -13,7 +13,7 @@ @@ -13,7 +13,7 @@ @@ -13,7 +13,7 @@ @@ -29,6 +29,7 @@

    Packages

  • com.github.shynixn.astraledit.business.bukkit.nms.v1_9_R1
  • com.github.shynixn.astraledit.business.bukkit.nms.v1_9_R2
  • com.github.shynixn.astraledit.business.logic
  • +
  • com.github.shynixn.astraledit.business.metrics
  • com.github.shynixn.astraledit.lib
  • diff --git a/docs/apidocs/overview-summary.html b/docs/apidocs/overview-summary.html index cfa50f5..9c44a5e 100644 --- a/docs/apidocs/overview-summary.html +++ b/docs/apidocs/overview-summary.html @@ -2,10 +2,10 @@ - + -Overview (AstralEdit 1.0.0 API) - +Overview (AstralEdit 1.1.0 API) + @@ -13,7 +13,7 @@ @@ -13,7 +13,7 @@