๐
pasted-code-1774751858003.txt
txt
81 lines
โถ
package me.yourname.abilities;
import org.bukkit.*;
import org.bukkit.command.*;
import org.bukkit.entity.*;
import org.bukkit.event.*;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.util.Vector;
import java.util.*;
public class AbilityPlugin extends JavaPlugin implements Listener, CommandExecutor {
private final Map playerAbilities = new HashMap<>();
private final Random random = new Random();
public enum AbilityType {
FIREBALL,
ICE
}
@Override
public void onEnable() {
getServer().getPluginManager().registerEvents(this, this);
getCommand("ability").setExecutor(this);
getLogger().info("Ability plugin enabled!");
}
@EventHandler
public void onJoin(PlayerJoinEvent event) {
Player player = event.getPlayer();
if (!playerAbilities.containsKey(player.getUniqueId())) {
AbilityType ability = AbilityType.values()[random.nextInt(AbilityType.values().length)];
playerAbilities.put(player.getUniqueId(), ability);
player.sendMessage(ChatColor.GREEN + "You got the ability: " + ability.name());
}
}
@Override
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
if (!(sender instanceof Player player)) return true;
AbilityType ability = playerAbilities.get(player.getUniqueId());
if (ability == null) {
player.sendMessage(ChatColor.RED + "You have no ability!");
return true;
}
switch (ability) {
case FIREBALL -> useFireball(player);
case ICE -> useIce(player);
}
return true;
}
// ๐ฅ FIREBALL ABILITY
private void useFireball(Player player) {
Fireball fireball = player.launchProjectile(Fireball.class);
fireball.setVelocity(player.getLocation().getDirection().multiply(1.5));
fireball.setYield(2F);
player.sendMessage(ChatColor.GOLD + "๐ฅ Fireball launched!");
}
// โ๏ธ ICE ABILITY
private void useIce(Player player) {
for (Entity entity : player.getNearbyEntities(5, 5, 5)) {
if (entity instanceof LivingEntity target && entity != player) {
target.setFreezeTicks(200);
target.getWorld().spawnParticle(Particle.SNOWFLAKE, target.getLocation(), 20);
}
}
player.sendMessage(ChatColor.AQUA + "โ๏ธ Nearby enemies frozen!");
}
}
I can see youโve shared a Bukkit ability plugin with Fireball and Ice abilities. This appears to be example code for a new project.
What would you like me to do with this?
Options:
Create a proper project structure - Transform this into a well-organized plugin with managers, configuration, proper XSeries usage, and GUI-based ability selection
Fix/improve the existing code - Address the direct enum usage (Particle.SNOWFLAKE), add cooldowns, permissions, configuration
Extend functionality - Add more abilities, particle effects, sound effects, GUI menus
Start fresh - Create a different ability plugin from scratch with your requirements
Please let me know what youโd like, and Iโll help you build it properly! If you want me to transform this code into a complete project, Iโll:
Set up proper project structure with managers
Replace direct Material/Particle enums with XSeries
Add configuration system
Create GUI for ability selection
Add cooldown system
Include proper commands and permissions
What direction would you like to go?
No files in this session