LICENSE updated
minor code style improvements
This commit is contained in:
parent
6a218f97f0
commit
a83c0fbab0
@ -3,9 +3,11 @@
|
|||||||
* src/main/java/de/craftinc/borderprotection/BorderManager.java
|
* src/main/java/de/craftinc/borderprotection/BorderManager.java
|
||||||
* src/main/java/de/craftinc/borderprotection/Commands.java
|
* src/main/java/de/craftinc/borderprotection/Commands.java
|
||||||
* src/main/java/de/craftinc/borderprotection/Messages.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/PlayerMoveListener.java
|
||||||
* src/main/java/de/craftinc/borderprotection/PlayerTeleportListener.java
|
* src/main/java/de/craftinc/borderprotection/PlayerTeleportListener.java
|
||||||
* src/main/java/de/craftinc/borderprotection/Plugin.java
|
* src/main/java/de/craftinc/borderprotection/Plugin.java
|
||||||
|
* src/main/java/de/craftinc/borderprotection/UpdateHelper.java
|
||||||
* src/main/resources/plugin.yml
|
* src/main/resources/plugin.yml
|
||||||
|
|
||||||
full text of GPLv3 can be found in the file "GPLv3"
|
full text of GPLv3 can be found in the file "GPLv3"
|
@ -22,6 +22,8 @@ public class Messages
|
|||||||
{
|
{
|
||||||
private static final String NEWLINE = "\n";
|
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 )
|
private static String makeCmd( String command, String explanation, String... args )
|
||||||
{
|
{
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
@ -66,7 +68,7 @@ public class Messages
|
|||||||
makeCmd("/cibp get", "shows the borders of the current world");
|
makeCmd("/cibp get", "shows the borders of the current world");
|
||||||
|
|
||||||
public static String helpGeneral =
|
public static String helpGeneral =
|
||||||
ChatColor.GREEN + "CraftInc BorderProtection - Usage:" + NEWLINE +
|
ChatColor.GREEN + pluginName + " - Usage:" + NEWLINE +
|
||||||
makeCmd("help", "shows this help") +
|
makeCmd("help", "shows this help") +
|
||||||
makeCmd("get | info", "shows the border of the current world") +
|
makeCmd("get | info", "shows the border of the current world") +
|
||||||
makeCmd("on | off", "enables/disables 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 + "!";
|
ChatColor.YELLOW + "!";
|
||||||
|
|
||||||
public static String commandIssuedByNonPlayer
|
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 )
|
public static String borderInfo( String worldName, String borderDef, Boolean isBorderEnabled )
|
||||||
{
|
{
|
||||||
@ -117,9 +119,9 @@ public class Messages
|
|||||||
public static String borderEnableDisableException =
|
public static String borderEnableDisableException =
|
||||||
ChatColor.RED + "Error: Could not save border state on server. After the next reload this border state will be lost!";
|
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 + "Current version: " + ChatColor.WHITE + curVersion + NEWLINE +
|
||||||
ChatColor.YELLOW + "New version: " + ChatColor.WHITE + newVersion + NEWLINE +
|
ChatColor.YELLOW + "New version: " + ChatColor.WHITE + newVersion + NEWLINE +
|
||||||
ChatColor.YELLOW + "Please visit:" + NEWLINE +
|
ChatColor.YELLOW + "Please visit:" + NEWLINE +
|
||||||
|
@ -25,6 +25,7 @@ import org.bukkit.event.player.PlayerLoginEvent;
|
|||||||
|
|
||||||
public class PlayerLoginListener implements Listener
|
public class PlayerLoginListener implements Listener
|
||||||
{
|
{
|
||||||
|
@SuppressWarnings("unused")
|
||||||
@EventHandler(priority = EventPriority.LOWEST)
|
@EventHandler(priority = EventPriority.LOWEST)
|
||||||
public void onPlayerLogin( PlayerLoginEvent e )
|
public void onPlayerLogin( PlayerLoginEvent e )
|
||||||
{
|
{
|
||||||
@ -40,7 +41,7 @@ public class PlayerLoginListener implements Listener
|
|||||||
@Override
|
@Override
|
||||||
public void run()
|
public void run()
|
||||||
{
|
{
|
||||||
player.sendMessage(Messages.UpdateMessage(UpdateHelper.cachedLatestVersion,
|
player.sendMessage(Messages.updateMessage(UpdateHelper.cachedLatestVersion,
|
||||||
UpdateHelper.getCurrentVersion()));
|
UpdateHelper.getCurrentVersion()));
|
||||||
}
|
}
|
||||||
}, 20L);
|
}, 20L);
|
||||||
|
@ -46,6 +46,8 @@ public class Plugin extends JavaPlugin
|
|||||||
Plugin.cibpPlugin = this;
|
Plugin.cibpPlugin = this;
|
||||||
|
|
||||||
BorderManager borderManager = new BorderManager();
|
BorderManager borderManager = new BorderManager();
|
||||||
|
|
||||||
|
// create listeners
|
||||||
PlayerMoveListener playerMoveListener = new PlayerMoveListener(borderManager);
|
PlayerMoveListener playerMoveListener = new PlayerMoveListener(borderManager);
|
||||||
PlayerTeleportListener playerTeleportListener = new PlayerTeleportListener(borderManager);
|
PlayerTeleportListener playerTeleportListener = new PlayerTeleportListener(borderManager);
|
||||||
PlayerLoginListener playerLoginListener = new PlayerLoginListener();
|
PlayerLoginListener playerLoginListener = new PlayerLoginListener();
|
||||||
@ -54,7 +56,7 @@ public class Plugin extends JavaPlugin
|
|||||||
Commands commandExecutor = new Commands(borderManager);
|
Commands commandExecutor = new Commands(borderManager);
|
||||||
getCommand("cibp").setExecutor(commandExecutor);
|
getCommand("cibp").setExecutor(commandExecutor);
|
||||||
|
|
||||||
// listeners
|
// register listeners
|
||||||
PluginManager pm = this.getServer().getPluginManager();
|
PluginManager pm = this.getServer().getPluginManager();
|
||||||
pm.registerEvents(playerMoveListener, this);
|
pm.registerEvents(playerMoveListener, this);
|
||||||
pm.registerEvents(playerTeleportListener, this);
|
pm.registerEvents(playerTeleportListener, this);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user