Files
src
build.gradle
Code
12 702
src/main/java/com/tsgod/sethome/SetHome.java
package com.tsgod.sethome;
import com.tsgod.sethome.commands.AuthorTsCommand;
import com.tsgod.sethome.commands.HomeCommand;
import com.tsgod.sethome.commands.HomesCommand;
import com.tsgod.sethome.commands.PlayerHomeEditCommand;
import com.tsgod.sethome.commands.SetHomeCommand;
import com.tsgod.sethome.data.DataManager;
import com.tsgod.sethome.gui.HomesGUI;
import lombok.Getter;
import org.bukkit.plugin.java.JavaPlugin;
@Getter
public class SetHome extends JavaPlugin {
private DataManager dataManager;
@Override
public void onEnable() {
saveDefaultConfig();
this.dataManager = new DataManager(this);
dataManager.loadAllData();
getServer().getPluginManager().registerEvents(new HomesGUI(this, null), this);
getCommand("sethome").setExecutor(new SetHomeCommand(this));
getCommand("home").setExecutor(new HomeCommand(this));
getCommand("homes").setExecutor(new HomesCommand(this));
getCommand("playerhomeedit").setExecutor(new PlayerHomeEditCommand(this));
getCommand("authorts").setExecutor(new AuthorTsCommand(this));
getLogger().info("SetHome plugin has been enabled!");
}
@Override
public void onDisable() {
if (dataManager != null) {
dataManager.saveAllData();
}
getLogger().info("SetHome plugin has been disabled!");
}
public String getMessage(String key) {
return getConfig().getString("messages." + key, "&cMessage not found: " + key)
.replace("&", "§");
}
public int getDefaultHomeLimit() {
return getConfig().getInt("default-home-limit", 20);
}
}