Spigot Plugin
IkaFoodPlugin
make me 5 custom foods with all them made "ike" behind their color, for example: red ike blue ike green ike etc. and have it so when you first join, a text pops up with all the ikes on your screen and when it lands on the ike you got, eat the ike you gain the abilites. red ike: strength ability 1: Surge, a powerful surge of strength ability 2: ravage, lets out a steam of crit hits for 3 seconds
src/main/java/eu/codexe/ikafoodplugin/IkaFoodPlugin.java
package eu.codexe.ikafoodplugin;
import eu.codexe.ikafoodplugin.commands.IkaCommand;
import eu.codexe.ikafoodplugin.listeners.PlayerJoinListener;
import eu.codexe.ikafoodplugin.listeners.PlayerUseItemListener;
import eu.codexe.ikafoodplugin.managers.IkaManager;
import eu.codexe.ikafoodplugin.managers.MessageManager;
import org.bukkit.NamespacedKey;
import org.bukkit.command.PluginCommand;
import org.bukkit.plugin.java.JavaPlugin;
import java.util.Objects;
public final class IkaFoodPlugin extends JavaPlugin {
private MessageManager messageManager;
private IkaManager ikaManager;
private NamespacedKey ikaKey;
private NamespacedKey assignedKey;
@Override
public void onEnable() {
saveDefaultConfig();
this.ikaKey = new NamespacedKey(this, "ika_type");
this.assignedKey = new NamespacedKey(this, "ika_assigned");
this.messageManager = new MessageManager(this);
this.ikaManager = new IkaManager(this, messageManager, ikaKey, assignedKey);
registerCommands();
registerListeners();
getLogger().info("IkaFoodPlugin enabled.");
}
@Override
public void onDisable() {
getLogger().info("IkaFoodPlugin disabled.");
}
private void registerCommands() {
PluginCommand command = Objects.requireNonNull(getCommand("ika"), "Command /ika is missing from plugin.yml");
IkaCommand executor = new IkaCommand(this, ikaManager, messageManager);
command.setExecutor(executor);
command.setTabCompleter(executor);
}
private void registerListeners() {
getServer().getPluginManager().registerEvents(new PlayerJoinListener(this, ikaManager, messageManager), this);
getServer().getPluginManager().registerEvents(new PlayerUseItemListener(this, ikaManager, messageManager), this);
}
public MessageManager getMessageManager() {
return messageManager;
}
public IkaManager getIkaManager() {
return ikaManager;
}