angad5061
๐Ÿ“Ž 1 file 2,703 chars
๐Ÿ“„
pasted-code-1782471549692.txt
txt 133 lines
โ–ถ
Create an advanced, premium-quality Minecraft Paper/Purpur/Spigot plugin called "AngadTPA" for Minecraft 1.21.x.

Requirements:
- Java 21
- Maven project
- Clean OOP structure
- Production-ready code
- No code placeholders
- Fully functional source code
- Optimized for large servers

Core Commands:
- /tpa 
- /tpahere 
- /tpaccept
- /tpdeny
- /tpcancel
- /tpatoggle
- /tpareload
- /tpahelp

Teleport System:
- Request expiration timer (configurable)
- Teleport warmup (configurable)
- Cooldown system (configurable)
- Movement cancellation during warmup
- Damage cancellation option
- Cross-world support
- Offline player handling
- Duplicate request prevention
- Multiple request queue support

INVENTORY GUI System:
- Modern Inventory INVENTORY GUI
- Accept Button (Green)
- Deny Button (Red)
- Player Head Display
- Request Information Lore
- Sound Effects
- INVENTORY GUI auto-opens when request received
- Configurable INVENTORY GUI title
- Configurable INVENTORY GUI items

MySQL Support:
- HikariCP Connection Pool
- SQLite fallback support
- Automatic table creation
- Store:
  - Player UUID
  - Toggle Status
  - Total Requests Sent
  - Total Requests Accepted
  - Last Seen
- Async database operations
- Database migration support

LuckPerms Integration:
- Detect LuckPerms automatically
- Group-based cooldowns
- Group-based limits
- VIP cooldown reduction
- Admin bypass permission
- Support custom groups

Permissions:
- angadtpa.use
- angadtpa.accept
- angadtpa.deny
- angadtpa.tpahere
- angadtpa.toggle
- angadtpa.admin
- angadtpa.bypass.cooldown
- angadtpa.bypass.warmup
- angadtpa.bypass.toggle

Messages:
- Fully configurable messages.yml
- MiniMessage support
- HEX color support
- Placeholder support

Placeholders:
- %player%
- %target%
- %cooldown%
- %time%
- %requests%

PlaceholderAPI Integration:
- %angadtpa_requests_sent%
- %angadtpa_requests_accepted%
- %angadtpa_toggle_status%

Config Features:
- request-expiry
- teleport-warmup
- cooldown-seconds
- cancel-on-move
- cancel-on-damage
- INVENTORY GUI-enabled
- mysql-enabled

Admin Features:
- /tpareload
- /tpa stats 
- /tpa reset 
- /tpa debug

Performance:
- Async tasks where possible
- Cache system
- Memory leak prevention
- Thread-safe collections

Files to Generate:
- Full Java source code
- plugin.yml
- config.yml
- messages.yml
- INVENTORY GUI.yml
- pom.xml
- README.md

Package:
me.angad.angadtpa

Plugin Author:
Angad_OG

Plugin Version:
1.0.0

The plugin must compile successfully without errors and work on Paper/Purpur/Spigot 1.21.x servers.
angad5061

The compilation failed with this error:

code
Compilation failed with 2 error(s):

ERROR in src/main/java/com/angad/whitebeardfruit/WhitebeardFruit.java at line 118: cannot find symbol
                living.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 200, 2)); // 10 seconds
                                                                        ^
  symbol: variable SLOW
  location: class PotionEffectType

ERROR in src/main/java/com/angad/whitebeardfruit/WhitebeardFruit.java at line 119: cannot find symbol
                living.addPotionEffect(new PotionEffect(PotionEffectType.CONFUSION, 200, 1)); // 10 seconds
                                                                        ^
  symbol: variable CONFUSION
  location: class PotionEffectType


=== COMPILATION ERROR ANALYSIS ===

FILES TO INVESTIGATE:
  - src/main/java/com/angad/whitebeardfruit/WhitebeardFruit.java

Please fix this error by creating a new artifact with the corrected code.

Kodari can make mistakes. Review important code before using.
Files
src
config.yml
plugin.yml
Code
3 146
src/main/java/com/angad/whitebeardfruit/WhitebeardFruit.java
package com.angad.whitebeardfruit;

import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.block.Action;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;

import java.util.HashMap;
import java.util.UUID;

public class WhitebeardFruit extends JavaPlugin implements Listener {

    private final HashMap<UUID, Long> cooldownsTremor = new HashMap<>();
    private final HashMap<UUID, Long> cooldownsConquerors = new HashMap<>();

    @Override
    public void onEnable() {
        saveDefaultConfig();
        getServer().getPluginManager().registerEvents(this, this);
        this.getCommand("giveguragura").setExecutor(new GiveFruitCommand());
        getLogger().info("Gura Gura No Mi with Haki enabled!");
    }

    public class GiveFruitCommand implements CommandExecutor {
        @Override
        public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
            if (!(sender instanceof Player)) return true;
            if (args.length < 1) return false;
            Player target = Bukkit.getPlayer(args[0]);
            if (target == null) return true;

            String mat = getConfig().getString("fruit.item_material");
            int modelData = getConfig().getInt("fruit.custom_model_data");
            String name = getConfig().getString("fruit.name");

            ItemStack fruit = new ItemStack(Material.valueOf(mat));
            ItemMeta meta = fruit.getItemMeta();
            meta.setDisplayName(name);
            meta.setCustomModelData(modelData);
            fruit.setItemMeta(meta);

            target.getInventory().addItem(fruit);
            return true;
        }
    }

    @EventHandler
    public void onPlayerUse(PlayerInteractEvent event) {
        Player player = event.getPlayer();
        ItemStack item = event.getItem();

        if (item != null && item.getType() == Material.valueOf(getConfig().getString("fruit.item_material")) &&
            item.hasItemMeta() && item.getItemMeta().hasCustomModelData() &&
            item.getItemMeta().getCustomModelData() == getConfig().getInt("fruit.custom_model_data")) {

            if (event.getAction() == Action.LEFT_CLICK_AIR || event.getAction() == Action.LEFT_CLICK_BLOCK) {
                // Left Click = Tremor Attack
                handleTremor(player);
            } else if (event.getAction() == Action.RIGHT_CLICK_AIR || event.getAction() == Action.RIGHT_CLICK_BLOCK) {
                // Right Click = Conquerors Haki
                handleConquerorsHaki(player);
            }
        }
    }

    private void handleTremor(Player player) {
        if (cooldownsTremor.containsKey(player.getUniqueId())) {
            long timeLeft = (cooldownsTremor.get(player.getUniqueId()) / 1000) + getConfig().getInt("fruit.cooldown_tremor") - (System.currentTimeMillis() / 1000);
            if (timeLeft > 0) {
                player.sendMessage("Tremor Cooldown: " + timeLeft + " seconds left.");
                return;
            }
        }

        double range = getConfig().getDouble("fruit.power_range");
        double damage = getConfig().getDouble("fruit.power_damage");

        player.sendMessage("Tremor unleashed!");
        player.getWorld().createExplosion(player.getLocation(), 0, false, false);

        for (Entity entity : player.getNearbyEntities(range, range, range)) {
            if (entity instanceof LivingEntity && entity != player) {
                ((LivingEntity) entity).damage(damage, player);
            }
        }
        cooldownsTremor.put(player.getUniqueId(), System.currentTimeMillis());
    }

    private void handleConquerorsHaki(Player player) {
        if (cooldownsConquerors.containsKey(player.getUniqueId())) {
            long timeLeft = (cooldownsConquerors.get(player.getUniqueId()) / 1000) + getConfig().getInt("fruit.cooldown_conquerors") - (System.currentTimeMillis() / 1000);
            if (timeLeft > 0) {
                player.sendMessage("Conquerors Haki Cooldown: " + timeLeft + " seconds left.");
                return;
            }
        }

        double range = getConfig().getDouble("fruit.conquerors_range");
        player.sendMessage("Conquerors Haki activated!");

        for (Entity entity : player.getNearbyEntities(range, range, range)) {
            if (entity instanceof LivingEntity && entity != player) {
                LivingEntity living = (LivingEntity) entity;
                // Simple effect: Apply Slow and Confusion
                living.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 200, 2)); // 10 seconds
                living.addPotionEffect(new PotionEffect(PotionEffectType.CONFUSION, 200, 1)); // 10 seconds
            }
        }
        cooldownsConquerors.put(player.getUniqueId(), System.currentTimeMillis());
    }
}