Skip to content

Commit

Permalink
Small cleanup
Browse files Browse the repository at this point in the history
Removed unused dependencies/modules from build.gradle
Formatting fixes
Switched to String.format for large string concatenations
  • Loading branch information
tajobe committed Apr 25, 2016
1 parent 25d51b0 commit d1f5274
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 55 deletions.
Empty file modified .gitignore
100644 → 100755
Empty file.
Empty file modified README.md
100644 → 100755
Empty file.
13 changes: 0 additions & 13 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
plugins {
id 'java'
id 'maven'
id 'com.github.johnrengelman.shadow' version '1.2.2' // port of maven shade
}

group 'org.simplemc'
Expand All @@ -24,17 +23,5 @@ repositories {

dependencies {
compile 'org.spigotmc:spigot-api:1.8.8-R0.1-SNAPSHOT'
compile 'com.google.guava:guava'
compile 'org.apache.commons:commons-lang3:3.4'
testCompile group: 'junit', name: 'junit', version: '4.11'
}

shadowJar {
dependencies {
// do not build spigot into jar
exclude(dependency('org.spigotmc:spigot-api'))
}
}

// create shadowed(shaded) build
build.dependsOn(shadowJar)
70 changes: 32 additions & 38 deletions src/main/java/org/simplemc/simplereserve/SimpleReserve.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,14 @@
public class SimpleReserve extends JavaPlugin
{
/**
* set up the block listener and Permissions on enable
* Set up the block listener and Permissions on enable
*/
public void onEnable()
{
loadConfig();

getLogger().info(getDescription().getName() + " version " + getDescription().getVersion() + " enabled!");
getLogger().info(
String.format("%s version %s enabled!", getDescription().getName(), getDescription().getVersion()));
}

/**
Expand Down Expand Up @@ -86,10 +87,15 @@ public boolean onCommand(CommandSender sender, Command command, String label, St
// help command
else
{
sender.sendMessage(ChatColor.AQUA + "/" + getCommand("simplereserve").getName() + ChatColor.WHITE
+ " | " + ChatColor.BLUE
+ getCommand("simplereserve").getDescription());
sender.sendMessage("Usage: " + ChatColor.GRAY + getCommand("simplereserve").getUsage());
sender.sendMessage(
String.format("%s/%s%s | %s%s",
ChatColor.AQUA,
getCommand("simplereserve").getName(),
ChatColor.WHITE,
ChatColor.BLUE,
getCommand("simplereserve").getDescription()));
sender.sendMessage(
String.format("Usage: %s%s", ChatColor.GRAY, getCommand("simplereserve").getUsage()));
}
}
else
Expand Down Expand Up @@ -157,37 +163,25 @@ private void validateConfig()
if (updated)
{
// set header for information
config
.options()
.header(
"Config nodes:\n"
+
"\n"
+
"reserve.type(enum/string): Type of reserve slots, options:\n"
+
" full,kick,both,none\n"
+
"reserve.full.cap(int): Max players allowed over capacity if using 'full' method, 0 for no max\n"
+
"reserve.full.reverttokick(boolean): Should we fall back to kick method if we reach max over capacity using full?\n"
+
"kick-message(string): Message player will recieve when kicked to let reserve in\n"
+
"full-message(string): Message player will recieve when unable to join full server\n"
+
"reserve-full-message(string): Message player with reserve privileges will recieve when all reserve slots are full\n"
+
"\n" +
"Reserve Types Overview:\n" +
"-----------------------\n" +
"\n" +
"Full: Allow reserves to log on past the server limit\n" +
"Kick: Attempt to kick a player without kick immunity to make room\n" +
"Both: Both methods of reservation based on Permission\n" +
" NOTE: If a player has permission for kick and full, full applies\n" +
"None: No reservation. Effectively disables mod without needing to remove\n" +
"");
config.options().header("Config nodes:\n" +
"\n" +
"reserve.type(enum/string): Type of reserve slots, options:\n" +
" full,kick,both,none\n" +
"reserve.full.cap(int): Max players allowed over capacity if using 'full' method, 0 for no max\n" +
"reserve.full.reverttokick(boolean): Should we fall back to kick method if we reach max over capacity using full?\n" +
"kick-message(string): Message player will recieve when kicked to let reserve in\n" +
"full-message(string): Message player will recieve when unable to join full server\n" +
"reserve-full-message(string): Message player with reserve privileges will recieve when all reserve slots are full\n" +
"\n" +
"Reserve Types Overview:\n" +
"-----------------------\n" +
"\n" +
"Full: Allow reserves to log on past the server limit\n" +
"Kick: Attempt to kick a player without kick immunity to make room\n" +
"Both: Both methods of reservation based on Permission\n" +
" NOTE: If a player has permission for kick and full, full applies\n" +
"None: No reservation. Effectively disables mod without needing to remove\n" +
"");

// save
saveConfig();
Expand All @@ -196,7 +190,7 @@ private void validateConfig()
}

/**
* plugin disabled
* Plugin disabled
*/
public void onDisable()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
import org.bukkit.event.player.PlayerLoginEvent;
import org.bukkit.event.player.PlayerLoginEvent.Result;

import java.util.Collection;

/**
* Listener for simple reserve plugin to handle logins
*
Expand Down Expand Up @@ -134,9 +132,10 @@ private void kickJoin(Player player, PlayerLoginEvent event)
{
toKick.kickPlayer(kickMessage);
event.allow();

plugin.getLogger().info(
"Allowed player " + player.getDisplayName() + " to join full server by kicking player "
+ toKick.getDisplayName() + "!");
String.format("Allowed player %s to join full server by kicking player %s!",
player.getDisplayName(), toKick.getDisplayName()));
}
else
{
Expand Down

0 comments on commit d1f5274

Please sign in to comment.