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

Commit

Permalink
[1.0.4] Allow/Disallow duping any rarity book/enchant book
Browse files Browse the repository at this point in the history
Notes:
- Added: Feature to allow or disallow duping any rarity book/enchant book
- Fixed: Some grammar
  • Loading branch information
Puyodead1 committed Aug 9, 2019
1 parent eca4953 commit 199cbe5
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 11 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>me.puyodead1.randomdupe</groupId>
<artifactId>RandomDupe</artifactId>
<version>1.0.3</version>
<version>1.0.4</version>
<name>RandomDupe</name>
<packaging>jar</packaging>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,20 @@ public boolean onCommand(CommandSender sender, Command cmd, String label, String
ItemStack is = player.getInventory().getItemInHand().clone();
CustomEnchant ce = CustomEnchant.valueOf(is);
EnchantRarity rarity = valueOfEnchantRarity(is);
if (rarity != null || ce != null) {
if(!blacklist.contains(ce != null ? ce.getIdentifier() : rarity.getIdentifier())) {
is.setAmount(rdConfig.getInt("settings.stack size") - player.getItemInHand().getAmount());
player.getInventory().addItem(is);
}else {
player.sendMessage(Utils.formatString(rdConfig.getString("messages.not dupeable")));
return false;
if (rarity != null && !rdConfig.getBoolean("settings.allow duping rarity books")
|| ce != null && !rdConfig.getBoolean("settings.allow duping enchant books")) {
player.sendMessage(Utils.formatString(rdConfig.getString("messages.not dupable")));
} else {

// TODO: This if statment may not be needed
if (rarity != null || ce != null) {
if (!blacklist.contains(ce != null ? ce.getIdentifier() : rarity.getIdentifier())) {
is.setAmount(rdConfig.getInt("settings.stack size") - player.getItemInHand().getAmount());
player.getInventory().addItem(is);
} else {
player.sendMessage(Utils.formatString(rdConfig.getString("messages.not dupable")));
return false;
}
}
}
return true;
Expand Down
8 changes: 5 additions & 3 deletions src/main/resources/config.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
messages:
no permission: "&c&l(!) You don't have permission!"
not dupeable: "&c&l(!) Not Dupeable."
not dupable: "&c&l(!) Not Dupable."

settings:
stack size: 64
allow duping rarity books: true
allow duping enchant books: true

blacklist:
- "RAGE"
- "OVERLOAD"
- "RAGE" # Prevents duping the rage enchant book
- "ELITE" # Prevents duping the (unopened) elite enchantment book

0 comments on commit 199cbe5

Please sign in to comment.