[ELYSIUM] Anti Crop Stamp icon

[ELYSIUM] Anti Crop Stamp -----

Prevents crops from being stamped if you have Feather Falling



This plugin is very simple. It makes it so that when you land on crops, they do not get stamped out if you are wearing Feather Falling. More technical details below :)


Code for this plugin:
Code (Text):
package com.tiptow;

import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityChangeBlockEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.java.JavaPlugin;

public final class Main extends JavaPlugin implements Listener {

    @Override
    public void onEnable() {
        Bukkit.getServer().getConsoleSender().sendMessage(ChatColor.GOLD + "[ELYSIUM] " + ChatColor.AQUA + "AntiCropStamp Enabled!");
        Bukkit.getServer().getConsoleSender().sendMessage(ChatColor.GOLD + "[ELYSIUM] " + ChatColor.GREEN + "Author: Timo :)");

        // Register the event listener
        Bukkit.getPluginManager().registerEvents(this, this);
    }

    @Override
    public void onDisable() {
        Bukkit.getServer().getConsoleSender().sendMessage(ChatColor.GOLD + "[ELYSIUM] " + ChatColor.BLUE + "AntiCropStamp Disabled!");
        Bukkit.getServer().getConsoleSender().sendMessage(ChatColor.GOLD + "[ELYSIUM] " + ChatColor.GREEN + "Author: Timo :)");
    }

    @EventHandler
    public void onEntityChangeBlock(EntityChangeBlockEvent e) {
        Entity entity = e.getEntity();

        if (entity instanceof Player) {
            Player player = (Player) entity;

            Material blockType = e.getBlock().getType();
            // Check if the block type is changing to DIRT
            if (blockType == Material.FARMLAND && e.getTo() == Material.DIRT) {
                ItemStack boots = player.getInventory().getBoots();
                if (boots != null && boots.containsEnchantment(Enchantment.PROTECTION_FALL)) {
                    e.setCancelled(true);
                }
            }
        }
    }
}
 
Resource Information
Author:
----------
Total Downloads: 20
First Release: Jul 25, 2024
Last Update: Jul 25, 2024
Category: ---------------
All-Time Rating:
0 ratings
Version -----
Released: --------------------
Downloads: ------
Version Rating:
----------------------
-- ratings