mirror of
https://github.com/PEXPlugins/Modifyworld.git
synced 2025-01-21 21:01:57 +01:00
Added digestion handler (food level change) - modifyworld.digestion
This commit is contained in:
commit
7579b1ef75
@ -24,6 +24,7 @@ import org.bukkit.ChatColor;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Event.Type;
|
||||
import org.bukkit.event.block.Action;
|
||||
import org.bukkit.event.entity.FoodLevelChangeEvent;
|
||||
import org.bukkit.event.player.*;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
@ -193,6 +194,17 @@ public class PlayerListener extends ModifyworldListener {
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(Type.FOOD_LEVEL_CHANGE)
|
||||
public void onFoodLevelChange(FoodLevelChangeEvent event){
|
||||
Player player = event.getEntity() instanceof Player ? (Player)event.getEntity() : null;
|
||||
|
||||
if(player == null) return;
|
||||
|
||||
if (!permissionsManager.has(player, "modifyworld.digestion")){
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
protected void checkPlayerInventory(Player player) {
|
||||
if (!checkInventory) {
|
||||
return;
|
||||
|
Loading…
Reference in New Issue
Block a user