diff --git a/LICENSE b/LICENSE.md similarity index 83% rename from LICENSE rename to LICENSE.md index a919a6f..7278fc7 100644 --- a/LICENSE +++ b/LICENSE.md @@ -3,9 +3,11 @@ * src/main/java/de/craftinc/borderprotection/BorderManager.java * src/main/java/de/craftinc/borderprotection/Commands.java * src/main/java/de/craftinc/borderprotection/Messages.java +* src/main/java/de/craftinc/borderprotection/PlayerLoginListener.java * src/main/java/de/craftinc/borderprotection/PlayerMoveListener.java * src/main/java/de/craftinc/borderprotection/PlayerTeleportListener.java * src/main/java/de/craftinc/borderprotection/Plugin.java +* src/main/java/de/craftinc/borderprotection/UpdateHelper.java * src/main/resources/plugin.yml full text of GPLv3 can be found in the file "GPLv3" diff --git a/src/main/java/de/craftinc/borderprotection/Messages.java b/src/main/java/de/craftinc/borderprotection/Messages.java index 8e35632..231c528 100644 --- a/src/main/java/de/craftinc/borderprotection/Messages.java +++ b/src/main/java/de/craftinc/borderprotection/Messages.java @@ -22,6 +22,8 @@ public class Messages { private static final String NEWLINE = "\n"; + private static final String pluginName = Plugin.getPlugin().getDescription().getName(); + private static String makeCmd( String command, String explanation, String... args ) { StringBuilder sb = new StringBuilder(); @@ -66,7 +68,7 @@ public class Messages makeCmd("/cibp get", "shows the borders of the current world"); public static String helpGeneral = - ChatColor.GREEN + "CraftInc BorderProtection - Usage:" + NEWLINE + + ChatColor.GREEN + pluginName + " - Usage:" + NEWLINE + makeCmd("help", "shows this help") + makeCmd("get | info", "shows the border of the current world") + makeCmd("on | off", "enables/disables the border of the current world") + @@ -80,7 +82,7 @@ public class Messages ChatColor.YELLOW + "!"; public static String commandIssuedByNonPlayer - = ChatColor.RED + "Only a player can use CraftInc BorderProtection commands!"; + = ChatColor.RED + "Only a player can use " + pluginName + " commands!"; public static String borderInfo( String worldName, String borderDef, Boolean isBorderEnabled ) { @@ -117,9 +119,9 @@ public class Messages public static String borderEnableDisableException = ChatColor.RED + "Error: Could not save border state on server. After the next reload this border state will be lost!"; - public static String UpdateMessage( String newVersion, String curVersion ) + public static String updateMessage( String newVersion, String curVersion ) { - return ChatColor.RED + "Craft Inc. BorderProtection: New version available!" + NEWLINE + + return ChatColor.RED + pluginName + ": New version available!" + NEWLINE + ChatColor.YELLOW + "Current version: " + ChatColor.WHITE + curVersion + NEWLINE + ChatColor.YELLOW + "New version: " + ChatColor.WHITE + newVersion + NEWLINE + ChatColor.YELLOW + "Please visit:" + NEWLINE + diff --git a/src/main/java/de/craftinc/borderprotection/PlayerLoginListener.java b/src/main/java/de/craftinc/borderprotection/PlayerLoginListener.java index 0286300..8e00653 100644 --- a/src/main/java/de/craftinc/borderprotection/PlayerLoginListener.java +++ b/src/main/java/de/craftinc/borderprotection/PlayerLoginListener.java @@ -25,6 +25,7 @@ import org.bukkit.event.player.PlayerLoginEvent; public class PlayerLoginListener implements Listener { + @SuppressWarnings("unused") @EventHandler(priority = EventPriority.LOWEST) public void onPlayerLogin( PlayerLoginEvent e ) { @@ -40,7 +41,7 @@ public class PlayerLoginListener implements Listener @Override public void run() { - player.sendMessage(Messages.UpdateMessage(UpdateHelper.cachedLatestVersion, + player.sendMessage(Messages.updateMessage(UpdateHelper.cachedLatestVersion, UpdateHelper.getCurrentVersion())); } }, 20L); diff --git a/src/main/java/de/craftinc/borderprotection/Plugin.java b/src/main/java/de/craftinc/borderprotection/Plugin.java index 5510721..2b7baa0 100644 --- a/src/main/java/de/craftinc/borderprotection/Plugin.java +++ b/src/main/java/de/craftinc/borderprotection/Plugin.java @@ -46,6 +46,8 @@ public class Plugin extends JavaPlugin Plugin.cibpPlugin = this; BorderManager borderManager = new BorderManager(); + + // create listeners PlayerMoveListener playerMoveListener = new PlayerMoveListener(borderManager); PlayerTeleportListener playerTeleportListener = new PlayerTeleportListener(borderManager); PlayerLoginListener playerLoginListener = new PlayerLoginListener(); @@ -54,7 +56,7 @@ public class Plugin extends JavaPlugin Commands commandExecutor = new Commands(borderManager); getCommand("cibp").setExecutor(commandExecutor); - // listeners + // register listeners PluginManager pm = this.getServer().getPluginManager(); pm.registerEvents(playerMoveListener, this); pm.registerEvents(playerTeleportListener, this);