mirror of
https://github.com/YouHaveTrouble/Stand-in.git
synced 2026-05-12 06:26:56 +00:00
clean up prototype code
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user