Files
src
build.gradle
settings.gradle
Code
6 257
src/main/java/pl/plugincustomitems/PluginCustomItems.java
package pl.plugincustomitems;
import org.bukkit.command.PluginCommand;
import org.bukkit.plugin.java.JavaPlugin;
public final class PluginCustomItems extends JavaPlugin {
private ItemStorage itemStorage;
@Override
public void onEnable() {
this.itemStorage = new ItemStorage(this);
CustomItemCommand command = new CustomItemCommand(this, itemStorage);
registerCommand("plugincustomitems", command);
registerCommand("plugincustomitem", command);
getLogger().info("PluginCustomItems zostal wlaczony.");
}
private void registerCommand(String name, CustomItemCommand command) {
PluginCommand pluginCommand = getCommand(name);
if (pluginCommand == null) {
throw new IllegalStateException("Komenda " + name + " nie jest zdefiniowana w plugin.yml");
}
pluginCommand.setExecutor(command);
pluginCommand.setTabCompleter(command);
}
public ItemStorage getItemStorage() {
return itemStorage;
}
}