mirror of
https://github.com/alexcrea/CustomAnvil.git
synced 2026-06-24 00:26:16 +02:00
Compare commits
2 commits
v1.x.x
...
v1.6.12-de
| Author | SHA1 | Date | |
|---|---|---|---|
| 5a2ec92217 | |||
| e003a23af1 |
3 changed files with 12 additions and 2 deletions
|
|
@ -16,7 +16,7 @@ plugins {
|
|||
}
|
||||
|
||||
group = "xyz.alexcrea"
|
||||
version = "1.6.11"
|
||||
version = "1.6.12-debug"
|
||||
|
||||
repositories {
|
||||
// EcoEnchants
|
||||
|
|
|
|||
|
|
@ -89,7 +89,11 @@ object EnchantmentUtil {
|
|||
// We test if it is allowed to merge at this level
|
||||
if(!bypassLevel){
|
||||
val maxBeforeDisabled = ConfigOptions.maxBeforeMergeDisabled(enchantment)
|
||||
if((maxBeforeDisabled > 0) && (oldLevel >= maxBeforeDisabled)) return@forEach
|
||||
if((maxBeforeDisabled > 0) && (oldLevel >= maxBeforeDisabled)) {
|
||||
CustomAnvil.verboseLog(
|
||||
"Reached max merge before disable for ${enchantment.key}: $oldLevel/$maxBeforeDisabled)")
|
||||
return@forEach
|
||||
}
|
||||
}
|
||||
|
||||
// Now we increase the enchantment level by 1
|
||||
|
|
|
|||
|
|
@ -52,6 +52,11 @@ class AnvilResultListener: Listener {
|
|||
val leftItem = inventory.getItem(ANVIL_INPUT_LEFT) ?: return
|
||||
val rightItem = inventory.getItem(ANVIL_INPUT_RIGHT)
|
||||
|
||||
if(!GameMode.CREATIVE.equals(player.gameMode) && inventory.repairCost >= inventory.maximumRepairCost) {
|
||||
event.result = Event.Result.DENY
|
||||
return
|
||||
}
|
||||
|
||||
// Test custom recipe
|
||||
val recipe = CustomRecipeUtil.getCustomRecipe(leftItem, rightItem)
|
||||
if(recipe != null){
|
||||
|
|
@ -107,6 +112,7 @@ class AnvilResultListener: Listener {
|
|||
val amount = CustomRecipeUtil.getCustomRecipeAmount(recipe, leftItem, rightItem)
|
||||
val xpCost = amount * recipe.xpCostPerCraft
|
||||
|
||||
CustomAnvil.log("gamemode: ${player.gameMode != GameMode.CREATIVE}, cost: $xpCost, level: ${player.level}, result: ${player.level < xpCost}")
|
||||
if ((player.gameMode != GameMode.CREATIVE) && (player.level < xpCost)) return
|
||||
|
||||
// We give the item manually
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue