mirror of
https://github.com/PikaMug/Quests.git
synced 2024-11-21 18:15:32 +01:00
Argument check and debug cleanup
This commit is contained in:
parent
92eac0e943
commit
94d55c3be7
@ -67,7 +67,7 @@ public class BukkitQuestadminFinishCommand extends BukkitQuestsSubCommand {
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender cs, String[] args) {
|
||||
if (args.length == 1) {
|
||||
if (args.length < 3) {
|
||||
// Shows command usage
|
||||
return;
|
||||
}
|
||||
|
@ -66,7 +66,7 @@ public class BukkitQuestadminGiveCommand extends BukkitQuestsSubCommand {
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender cs, String[] args) {
|
||||
if (args.length == 1) {
|
||||
if (args.length < 3) {
|
||||
// Shows command usage
|
||||
return;
|
||||
}
|
||||
|
@ -64,7 +64,7 @@ public class BukkitQuestadminGivepointsCommand extends BukkitQuestsSubCommand {
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender cs, String[] args) {
|
||||
if (args.length == 1) {
|
||||
if (args.length < 3) {
|
||||
// Shows command usage
|
||||
return;
|
||||
}
|
||||
|
@ -67,7 +67,8 @@ public class BukkitQuestadminNextstageCommand extends BukkitQuestsSubCommand {
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender cs, String[] args) {
|
||||
if (args.length == 1) {
|
||||
if (args.length < 3) {
|
||||
System.out.println(args.length);
|
||||
// Shows command usage
|
||||
return;
|
||||
}
|
||||
|
@ -64,7 +64,7 @@ public class BukkitQuestadminPointsCommand extends BukkitQuestsSubCommand {
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender cs, String[] args) {
|
||||
if (args.length == 1) {
|
||||
if (args.length < 3) {
|
||||
// Shows command usage
|
||||
return;
|
||||
}
|
||||
|
@ -67,7 +67,7 @@ public class BukkitQuestadminQuitCommand extends BukkitQuestsSubCommand {
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender cs, String[] args) {
|
||||
if (args.length == 1) {
|
||||
if (args.length < 3) {
|
||||
// Shows command usage
|
||||
return;
|
||||
}
|
||||
|
@ -67,7 +67,7 @@ public class BukkitQuestadminRemoveCommand extends BukkitQuestsSubCommand {
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender cs, String[] args) {
|
||||
if (args.length == 1) {
|
||||
if (args.length < 3) {
|
||||
// Shows command usage
|
||||
return;
|
||||
}
|
||||
|
@ -67,7 +67,7 @@ public class BukkitQuestadminSetstageCommand extends BukkitQuestsSubCommand {
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender cs, String[] args) {
|
||||
if (args.length == 1) {
|
||||
if (args.length < 4) {
|
||||
// Shows command usage
|
||||
return;
|
||||
}
|
||||
|
@ -64,7 +64,7 @@ public class BukkitQuestadminTakepointsCommand extends BukkitQuestsSubCommand {
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender cs, String[] args) {
|
||||
if (args.length == 1) {
|
||||
if (args.length < 3) {
|
||||
// Shows command usage
|
||||
return;
|
||||
}
|
||||
|
@ -3191,7 +3191,6 @@ public class BukkitQuester implements Quester {
|
||||
String message = formatCompletedObjectiveMessage("craftItem", goal.getAmount());
|
||||
if (plugin.getConfigSettings().canTranslateNames() && !goal.hasItemMeta()
|
||||
&& !goal.getItemMeta().hasDisplayName()) {
|
||||
plugin.getLogger().info(goal.getType().name());
|
||||
// Bukkit version is 1.9+
|
||||
if (goal.getType().name().equals("TIPPED_ARROW")) {
|
||||
final String level = BukkitItemUtil.getPrettyPotionLevel(goal.getItemMeta());
|
||||
@ -3324,8 +3323,8 @@ public class BukkitQuester implements Quester {
|
||||
final String message = formatCompletedObjectiveMessage("killPlayer", goal.getAmount());
|
||||
sendMessage(message);
|
||||
} else if (type.equals(ObjectiveType.TALK_TO_NPC)) {
|
||||
final String message = ChatColor.GREEN + "(" + BukkitLang.get(p, "completed") + ") "
|
||||
+ BukkitLang.get(p, "talkTo").replace("<npc>", plugin.getDependencies().getNpcName(npc));
|
||||
final String message = formatCompletedObjectiveMessage("talkTo", goal.getAmount())
|
||||
.replace("<npc>", plugin.getDependencies().getNpcName(npc));
|
||||
sendMessage(message);
|
||||
} else if (type.equals(ObjectiveType.KILL_NPC)) {
|
||||
final String message = formatCompletedObjectiveMessage("kill", goal.getAmount());
|
||||
@ -3396,7 +3395,7 @@ public class BukkitQuester implements Quester {
|
||||
* @return Formatted message
|
||||
*/
|
||||
private String formatCompletedObjectiveMessage(final String langKey, final int goal) {
|
||||
String message = ChatColor.GREEN + "(" + BukkitLang.get("completed") + ") " + BukkitLang.get(langKey);
|
||||
String message = ChatColor.GREEN + "(" + BukkitLang.get(getPlayer(), "completed") + ") " + BukkitLang.get(langKey);
|
||||
if (message.contains("<count>")) {
|
||||
message = message.replace("<count>", goal + "/" + goal);
|
||||
}
|
||||
|
@ -788,8 +788,7 @@ public class BukkitQuestYamlStorage implements QuestStorageImpl {
|
||||
@SuppressWarnings({ "unchecked", "unused"})
|
||||
private void loadQuestStages(final Quest quest, final FileConfiguration config, final String questKey)
|
||||
throws StageFormatException, ActionFormatException, ConditionFormatException {
|
||||
final ConfigurationSection ordered = config.getConfigurationSection("quests." + questKey
|
||||
+ ".stages.ordered");
|
||||
final ConfigurationSection ordered = config.getConfigurationSection("quests." + questKey + ".stages.ordered");
|
||||
if (ordered == null) {
|
||||
plugin.getLogger().severe(ChatColor.RED + questKey + " must have at least one stage!");
|
||||
return;
|
||||
|
@ -46,7 +46,7 @@ public class BukkitLang {
|
||||
private static Quests plugin;
|
||||
private static final LinkedHashMap<String, String> defaultLang = new LinkedHashMap<>();
|
||||
private static final LinkedHashMap<String, LinkedHashMap<String, String>> otherLang = new LinkedHashMap<>();
|
||||
private static final Pattern hexPattern = Pattern.compile("(?i)%#([0-9A-F]{6})%");
|
||||
private static final Pattern hexPattern = Pattern.compile("(?i)%#([0-9a-fA-F]{6})%");
|
||||
|
||||
public static Collection<String> values() {
|
||||
return defaultLang.values();
|
||||
@ -393,8 +393,8 @@ public class BukkitLang {
|
||||
final StringBuilder hex = new StringBuilder();
|
||||
hex.append(ChatColor.COLOR_CHAR + "x");
|
||||
final char[] chars = matcher.group(1).toCharArray();
|
||||
for (final char aChar : chars) {
|
||||
hex.append(ChatColor.COLOR_CHAR).append(Character.toLowerCase(aChar));
|
||||
for (final char c : chars) {
|
||||
hex.append(ChatColor.COLOR_CHAR).append(Character.toLowerCase(c));
|
||||
}
|
||||
s = s.replace(matcher.group(), hex.toString());
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user