zyrokill2.0
📎 1 file 1,591 chars
📄
pasted-code-1782055233636.txt
txt 62 lines
▶
# =========================
# MOB COLLECTOR PLUGIN
# =========================

options:
  item-name: &aMob Capsule
  lore1: &7Right click mob to capture
  lore2: &7Right click ground to release

# =========================
# GIVE ITEM COMMAND
# =========================

command /mobcapsule:
    permission: mobcollector.give
    trigger:
        give player 1 nether star named "{@item-name}" with lore "{@lore1}", "{@lore2}"
        send "&aYou received a Mob Capsule!"

# =========================
# CAPTURE MOB
# =========================

on right click on entity:
    player is holding nether star named "{@item-name}":
        cancel event

        if {mob::%player%} is set:
            send "&cYou already have a captured mob!"
            stop

        set {mob::%player%} to type of clicked entity

        remove clicked entity

        send "&aYou captured a &e%{mob::%player%}%&a!"

# =========================
# RELEASE MOB
# =========================

on right click:
    player is holding nether star named "{@item-name}":
        cancel event

        if {mob::%player%} is not set:
            send "&cYou don't have any mob captured!"
            stop

        spawn {mob::%player%} at location of player
        send "&aYou released a &e%{mob::%player%}%&a!"

        delete {mob::%player%}

# =========================
# PREVENT ABUSE (OPTIONAL)
# =========================

on death of entity:
    if attacker is player:
        if {mob::%attacker%} is type of victim:
            delete {mob::%attacker%}
Kodari AI
KodariJun 21 at 3:22 pm 13

I’ll create a Java Bukkit plugin that replicates your Skript mob collector functionality.

MobCollector
A plugin that allows players to capture and release mobs using special capsule items. Players right-click mobs with a Nether Star capsule to capture them, storing one mob at a time. Right-clicking again releases the captured mob at the player's location. Includes admin command to give capsules and prevents capturing multiple mobs simultaneously.
zyrokill2.0

The compilation failed with this error:

code
Compilation failed with 1 error(s):

ERROR in src/main/java/com/example/mobcollector/MobCollector.java at line 4: cannot find symbol
import com.example.mobcollector.listeners.MobCapsuleListener;
                                         ^
  symbol: class MobCapsuleListener
  location: package com.example.mobcollector.listeners


=== COMPILATION ERROR ANALYSIS ===

MISSING CLASSES:
  - MobCapsuleListener
ACTION: Create these classes or check imports

FILES TO INVESTIGATE:
  - src/main/java/com/example/mobcollector/MobCollector.java

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

Kodari AI
KodariJun 21 at 3:25 pm 9

I’ll fix the import error. Let me read the main plugin file first.

The main plugin is trying to import MobCapsuleListener but I created MobCaptureListener. I’ll fix the import.

Fixed! The plugin was importing the wrong listener class name. It now correctly imports and registers MobCaptureListener.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
Code
8 330
src/main/java/com/example/mobcollector/MobCollector.java
package com.example.mobcollector;

import com.example.mobcollector.commands.MobCapsuleCommand;
import com.example.mobcollector.listeners.MobCaptureListener;
import org.bukkit.Bukkit;
import org.bukkit.entity.EntityType;
import org.bukkit.plugin.java.JavaPlugin;

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

public class MobCollector extends JavaPlugin {
    private final Map<UUID, EntityType> capturedMobs = new HashMap<>();
    
    @Override
    public void onEnable() {
        saveDefaultConfig();
        
        getCommand("mobcapsule").setExecutor(new MobCapsuleCommand(this));
        
        Bukkit.getPluginManager().registerEvents(new MobCaptureListener(this), this);
        
        getLogger().info("MobCollector has been enabled!");
    }
    
    @Override
    public void onDisable() {
        capturedMobs.clear();
        getLogger().info("MobCollector has been disabled!");
    }
    
    public Map<UUID, EntityType> getCapturedMobs() {
        return capturedMobs;
    }
    
    public String getMessage(String path) {
        return getConfig().getString("messages." + path, "&cMessage not found: " + path)
                .replace("&", "§");
    }
    
    public String getCapsuleName() {
        return getConfig().getString("capsule.name", "&aMob Capsule").replace("&", "§");
    }
}