clean up prototype code

This commit is contained in:
2025-11-23 17:59:54 +01:00
parent 4bb2d5937b
commit b6ebafff58
9 changed files with 338 additions and 367 deletions
@@ -1,30 +1,40 @@
package me.youhavetrouble.standin;
import me.youhavetrouble.standin.entity.ArmorStandHandler;
import me.youhavetrouble.standin.entity.EntityHandler;
import me.youhavetrouble.standin.entity.MannequinHandler;
import me.youhavetrouble.standin.stand.StandinInteractionListener;
import org.bukkit.NamespacedKey;
import org.bukkit.permissions.Permission;
import org.bukkit.permissions.PermissionDefault;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.plugin.java.JavaPlugin;
import java.util.List;
import javax.annotation.Nullable;
import java.util.HashMap;
import java.util.Map;
@SuppressWarnings("UnstableApiUsage")
public final class StandIn extends JavaPlugin {
public static final NamespacedKey KEY = new NamespacedKey("stand-in", "stand-in");
private final Map<EntityType, EntityHandler<? extends Entity>> entityHandlers = new HashMap<>();
@Override
public void onEnable() {
getServer().getPluginManager().addPermissions(
List.of(
new Permission("standin.edit.armor_stand", PermissionDefault.OP),
new Permission("standin.edit.mannequin", PermissionDefault.OP)
)
);
entityHandlers.put(EntityType.ARMOR_STAND, new ArmorStandHandler());
entityHandlers.put(EntityType.MANNEQUIN, new MannequinHandler());
getServer().getPluginManager().registerEvents(new StandinInteractionListener(), this);
}
/**
* Gets entity handler for given entity class
* @param entityType entity type to get handler for
* @return Entity handler or null
*/
public @Nullable EntityHandler<? extends Entity> getEntityHandler(EntityType entityType) {
return entityHandlers.get(entityType);
}
}