@@ -5,8 +5,6 @@ import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.bukkit.command.ConsoleCommandSender;
|
||||
import org.bukkit.command.PluginCommand;
|
||||
import org.bukkit.help.HelpTopic;
|
||||
|
||||
/**
|
||||
* Lacking an alternative, the help system will create instances of
|
||||
@@ -28,7 +26,7 @@ public class GenericCommandHelpTopic extends HelpTopic {
|
||||
}
|
||||
|
||||
// The short text is the first line of the description
|
||||
int i = command.getDescription().indexOf("\n");
|
||||
int i = command.getDescription().indexOf('\n');
|
||||
if (i > 1) {
|
||||
shortText = command.getDescription().substring(0, i - 1);
|
||||
} else {
|
||||
@@ -36,7 +34,7 @@ public class GenericCommandHelpTopic extends HelpTopic {
|
||||
}
|
||||
|
||||
// Build full text
|
||||
StringBuffer sb = new StringBuffer();
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
sb.append(ChatColor.GOLD);
|
||||
sb.append("Description: ");
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
package org.bukkit.help;
|
||||
|
||||
import org.bukkit.help.HelpTopic;
|
||||
|
||||
import java.util.Comparator;
|
||||
|
||||
/**
|
||||
@@ -11,18 +9,18 @@ import java.util.Comparator;
|
||||
* slash come after topics that don't.
|
||||
*/
|
||||
public class HelpTopicComparator implements Comparator<HelpTopic> {
|
||||
|
||||
|
||||
// Singleton implementations
|
||||
private static final TopicNameComparator tnc = new TopicNameComparator();
|
||||
public static TopicNameComparator topicNameComparatorInstance() {
|
||||
return tnc;
|
||||
}
|
||||
|
||||
|
||||
private static final HelpTopicComparator htc = new HelpTopicComparator();
|
||||
public static HelpTopicComparator helpTopicComparatorInstance() {
|
||||
return htc;
|
||||
}
|
||||
|
||||
|
||||
private HelpTopicComparator() {}
|
||||
|
||||
public int compare(HelpTopic lhs, HelpTopic rhs) {
|
||||
@@ -31,11 +29,11 @@ public class HelpTopicComparator implements Comparator<HelpTopic> {
|
||||
|
||||
public static class TopicNameComparator implements Comparator<String> {
|
||||
private TopicNameComparator(){}
|
||||
|
||||
|
||||
public int compare(String lhs, String rhs) {
|
||||
boolean lhsStartSlash = lhs.startsWith("/");
|
||||
boolean rhsStartSlash = rhs.startsWith("/");
|
||||
|
||||
|
||||
if (lhsStartSlash && !rhsStartSlash) {
|
||||
return 1;
|
||||
} else if (!lhsStartSlash && rhsStartSlash) {
|
||||
|
||||
Reference in New Issue
Block a user