elBukkit / MagicPlugin

A Bukkit plugin for spells, wands and other magic
http://mine.elmakers.com
MIT License
239 stars 148 forks source link

Drop Rule Exploit (?) #1137

Open NightScythe1 opened 1 year ago

NightScythe1 commented 1 year ago

Working on making custom drops- I'm trying to replace emerald ore's drop with my own custom drop 'Mystite' with this in a World config-

  block_break:
    mystite_ore:
      class: Drop
      types:
        - emerald_ore
        - deepslate_emerald_ore
      items:
        mystite: 1

It works, however- A) I'm unsure how to 'replace' the drop- I can only add the Mystite drop, but it still drops an emerald. B) There's a duplication exploit here- Players can use Silk Touch on the Ore and simply keep replacing it over and over again to get the added drop. Unless I'm missing a tag to prevent this?

NathanWolf commented 1 year ago

I was just about to "fix" this but oops I think there's support for what you want to do already.

Try adding result: remove_drops

If that works, please let me know and I'll revert the change I just made!

EDIT, to be clear, like this:

 block_break:
    mystite_ore:
      class: Drop
      result: remove_drops
      types:
        - emerald_ore
        - deepslate_emerald_ore
      items:
        mystite: 1
NightScythe1 commented 1 year ago

"result: remove_drops" worked a charm, thank you!! it now drops the Mystite even if silk touch is used, and doesn't drop emerald ore, is that intended? (it works for me either way!)

NightScythe1 commented 1 year ago

Are there other flags that can be used for the Drop Rule? Such as "amount" for dropping multiple, or dependant on Fortune such as "amount: rand(1,fortune+1)" or such...? I haven't been able to find much info on it so far

NathanWolf commented 1 year ago

I love that idea, but sadly no. I think it's doable but not easily, like not via the normal way of config processing since these rules only get parsed once, not in the context of the player (how you'd normally get attributes and enchants).

EDIT: And yeah silk touch shouldn't matter if you're replacing the drops

NightScythe1 commented 1 year ago

ahh okay that makes sense, well- thanks for the info!