LICENSE updated

minor code style improvements
This commit is contained in:
Paul Schulze 2013-02-24 10:16:56 +01:00
parent 6a218f97f0
commit a83c0fbab0
4 changed files with 13 additions and 6 deletions

View File

@ -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"

View File

@ -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 +

View File

@ -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);

View File

@ -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);