Files
src
build.gradle
Code
15 1,214
src/main/java/com/theboysmc/TheBoys.java
package com.theboysmc;
import com.theboysmc.commands.TheBoysCommand;
import com.theboysmc.commands.PowersCommand;
import com.theboysmc.commands.SupeCommand;
import com.theboysmc.listeners.CompoundVListener;
import com.theboysmc.listeners.PowerListener;
import com.theboysmc.listeners.VirusListener;
import com.theboysmc.managers.PowerManager;
import com.theboysmc.managers.DataManager;
import com.theboysmc.managers.ItemManager;
import lombok.Getter;
import org.bukkit.plugin.java.JavaPlugin;
@Getter
public class TheBoys extends JavaPlugin {
private PowerManager powerManager;
private DataManager dataManager;
private ItemManager itemManager;
@Override
public void onEnable() {
saveDefaultConfig();
this.dataManager = new DataManager(this);
this.powerManager = new PowerManager(this);
this.itemManager = new ItemManager(this);
dataManager.loadAllData();
getCommand("theboys").setExecutor(new TheBoysCommand(this));
getCommand("powers").setExecutor(new PowersCommand(this));
getCommand("supe").setExecutor(new SupeCommand(this));
getServer().getPluginManager().registerEvents(new CompoundVListener(this), this);
getServer().getPluginManager().registerEvents(new PowerListener(this), this);
getServer().getPluginManager().registerEvents(new VirusListener(this), this);
getLogger().info("The Boys Plugin has been enabled!");
getLogger().info("Vought Corporation is ready for business.");
}
@Override
public void onDisable() {
if (dataManager != null) {
dataManager.saveAllData();
}
getLogger().info("The Boys Plugin has been disabled!");
}
public String getMessage(String key) {
String prefix = getConfig().getString("messages.prefix", "&c&l[VOUGHT] &r");
String message = getConfig().getString("messages." + key, "&cMessage not found: " + key);
return colorize(prefix + message);
}
public String getMessage(String key, String placeholder, String value) {
return getMessage(key).replace("{" + placeholder + "}", value);
}
public String colorize(String text) {
return org.bukkit.ChatColor.translateAlternateColorCodes('&', text);
}
}