Files
src
build.gradle
manifest.kod
README.md
settings.gradle
Code
20 1,786
src/main/java/com/mosssmp/MossSMP.java
package com.mosssmp;
import com.mosssmp.command.MossCommand;
import com.mosssmp.database.SQLiteStore;
import com.mosssmp.feature.CheckManager;
import com.mosssmp.feature.StaffTools;
import com.mosssmp.gui.MenuService;
import com.mosssmp.integration.LuckPermsHook;
import com.mosssmp.investigation.InvestigationService;
import com.mosssmp.listener.GameplayListener;
import com.mosssmp.listener.HistoryListener;
import com.mosssmp.report.ReportService;
import com.mosssmp.util.MessageService;
import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender;
import org.bukkit.plugin.java.JavaPlugin;
public final class MossSMP extends JavaPlugin {
private SQLiteStore store;
private MessageService messages;
private InvestigationService investigations;
private ReportService reports;
private StaffTools staffTools;
private CheckManager checks;
private MenuService menus;
private LuckPermsHook luckPerms;
@Override
public void onEnable() {
saveDefaultConfig();
saveResource("messages.yml", false);
this.messages = new MessageService(this);
this.store = new SQLiteStore(this);
this.store.open();
this.investigations = new InvestigationService(this, store, messages);
this.reports = new ReportService(this, store, messages);
this.staffTools = new StaffTools(this, store, messages);
this.checks = new CheckManager(this, messages, staffTools);
this.menus = new MenuService(this, reports, staffTools, investigations, checks, messages);
this.luckPerms = new LuckPermsHook(this, messages);
MossCommand command = new MossCommand(this);
getCommand("moss").setExecutor(command);
getCommand("moss").setTabCompleter(command);
Bukkit.getPluginManager().registerEvents(new HistoryListener(this, investigations), this);
Bukkit.getPluginManager().registerEvents(new GameplayListener(this, staffTools, checks, menus, investigations), this);
staffTools.applyVanishVisibility();
getLogger().info("MossSMP enabled.");
}
@Override
public void onDisable() {
if (checks != null) checks.restoreAll();
if (staffTools != null) staffTools.restoreAll();
if (store != null) store.close();
}
public SQLiteStore store() { return store; }
public MessageService messages() { return messages; }
public InvestigationService investigations() { return investigations; }
public ReportService reports() { return reports; }
public StaffTools staffTools() { return staffTools; }
public CheckManager checks() { return checks; }
public MenuService menus() { return menus; }
public LuckPermsHook luckPerms() { return luckPerms; }
public boolean hasPermission(CommandSender sender, String permission) {
return sender.hasPermission(permission) || (luckPerms != null && sender instanceof org.bukkit.entity.Player player && luckPerms.hasMappedPermission(player, permission));
}
}