Showing with 21 additions and 22 deletions.
  1. +16 −18 src/main/java/com/nyancraft/reportrts/RTSFunctions.java
  2. +5 −4 src/main/java/com/nyancraft/reportrts/command/sub/ListStaff.java
@@ -23,29 +23,27 @@ public class RTSFunctions {
* Join a String[] into a single string with a joiner
*/
public static String implode( String[] array, String glue ) {

String out = "";

if( array.length == 0 ) {
return out;
}

for( String part : array ) {
if(part == null) continue;
out = out + part + glue;
}
out = out.substring(0, out.length() - glue.length() );

return out;
if (array.length == 0) {
return "";
}
StringBuilder out = new StringBuilder();
for (String part : array) {
if (part == null) continue;
out.append(part);
out.append(glue);
}
return out.substring(0, out.length() - glue.length());
}

public static String cleanUpSign(String[] lines) {

String out = "";
StringBuilder out = new StringBuilder();
for(String part : lines) {
if(!part.isEmpty()) out = out + part.trim() + " ";
if(part.length() > 0) {
out.append(part.trim());
out.append(" ");
}
}
return out;
return out.toString();
}
/***
* Message all online staff on the server
@@ -21,7 +21,7 @@ public static boolean handleCommand(CommandSender sender) {

// TODO: Possible to-do. No cross server functionality!
if(!RTSPermissions.canListStaff(sender)) return true;
String staff = "";
StringBuilder staff = new StringBuilder();
String separator = Message.staffListSeparator();

for(UUID uuid : plugin.staff) {
@@ -30,15 +30,16 @@ public static boolean handleCommand(CommandSender sender) {
if(plugin.vanishSupport && sender instanceof Player) {
if(!((Player) sender).canSee(player)) continue;
}
staff = staff + player.getDisplayName() + separator;
staff.append(player.getDisplayName());
staff.append(separator);
}
if(staff.isEmpty()) {
sender.sendMessage(Message.staffListEmpty());
return true;
}
staff = staff.substring(0, staff.length() - separator.length());
String staffString = staff.substring(0, staff.length() - separator.length());

sender.sendMessage(Message.staffListOnline(staff));
sender.sendMessage(Message.staffListOnline(staffString));
return true;
}
}