Skip to content
This repository has been archived by the owner on Mar 8, 2022. It is now read-only.

Commit

Permalink
prevent duplicate enchantment source
Browse files Browse the repository at this point in the history
  • Loading branch information
cyilin committed Aug 17, 2016
1 parent 08a7ae7 commit 883d010
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
4 changes: 4 additions & 0 deletions src/main/java/cat/nyaa/nyaautils/CommandHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ public String getHelpPrefix() {
@SubCommand(value = "addenchsrc", permission = "nu.addenchsrc")
public void commandAddEnchSrc(CommandSender sender, Arguments args) {
ItemStack item = getItemInHand(sender);
if(BasicItemMatcher.containsMatch(NyaaUtils.instance.cfg.enchantSrc, item)){
sender.sendMessage(I18n._("user.enchant.enchantsrc_already_exists"));
return;
}
BasicItemMatcher matcher = new BasicItemMatcher();
matcher.itemTemplate = item.clone();
matcher.enchantMatch = BasicItemMatcher.MatchingMode.ARBITRARY;
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/cat/nyaa/utils/CommandReceiver.java
Original file line number Diff line number Diff line change
Expand Up @@ -197,8 +197,8 @@ public void printHelp(CommandSender sender, Arguments args) {
List<String> cmds = getSubcommands();
String tmp = "";
for (String cmd : cmds) {
tmp += "\n " + cmd + ":\t" + getHelpContent("description", getHelpPrefix(), cmd);
tmp += "\n " + cmd + ":\t" + getHelpContent("usage", getHelpPrefix(), cmd);
tmp += "\n " + cmd + ": " + getHelpContent("description", getHelpPrefix(), cmd);
tmp += "\n " + cmd + ": " + getHelpContent("usage", getHelpPrefix(), cmd);
}
sender.sendMessage(tmp);
}
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/lang/en_US.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ user:
max_level: "(Max level: %d)"
success: "Enchantment success"
fail: "Enchantment failed"
enchantsrc_already_exists: "The enchantment source already exists"
launch:
usage: |
/nu launch <Yaw> <Pitch> <Speed> <Delay> [Player]
Expand Down

0 comments on commit 883d010

Please sign in to comment.