1
mirror of https://github.com/StarWishsama/Slimefun4.git synced 2024-09-19 19:25:48 +00:00
This commit is contained in:
TheBusyBiscuit 2020-10-14 14:56:52 +02:00
parent 42f849d891
commit b88bad3ef6
3 changed files with 20 additions and 0 deletions

View File

@ -91,6 +91,7 @@
* Fixed #2457
* Fixed #2411
* Fixed #2423
* Fixed #2452
## Release Candidate 16 (07 Sep 2020)
https://thebusybiscuit.github.io/builds/TheBusyBiscuit/Slimefun4/stable/#16

View File

@ -5,11 +5,15 @@ import javax.annotation.Nonnull;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.inventory.ItemStack;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.events.skills.salvage.McMMOPlayerSalvageCheckEvent;
import io.github.thebusybiscuit.slimefun4.api.events.BlockPlacerPlaceEvent;
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
import io.github.thebusybiscuit.slimefun4.implementation.items.VanillaItem;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
class McMMOIntegration implements Listener {
@ -23,4 +27,18 @@ class McMMOIntegration implements Listener {
mcMMO.getPlaceStore().setTrue(e.getBlock());
}
@EventHandler(ignoreCancelled = true)
public void onItemSalvage(McMMOPlayerSalvageCheckEvent e) {
// Prevent Slimefun items from being salvaged
if (!isSalvageable(e.getSalvageItem())) {
e.setCancelled(true);
SlimefunPlugin.getLocalization().sendMessage(e.getPlayer(), "anvil.mcmmo-salvaging");
}
}
private boolean isSalvageable(@Nonnull ItemStack item) {
SlimefunItem sfItem = SlimefunItem.getByItem(item);
return sfItem == null || sfItem instanceof VanillaItem;
}
}

View File

@ -261,6 +261,7 @@ machines:
anvil:
not-working: '&4You cannot use Slimefun items in an anvil!'
mcmmo-salvaging: '&4You cannot salvage Slimefun items!'
brewing_stand:
not-working: '&4You cannot use Slimefun items in a brewing stand!'