|
|
|
@@ -58,10 +58,10 @@ public class SurvivalPlus extends JavaPlugin {
|
|
|
|
|
private AFKListener afkListener;
|
|
|
|
|
private GraveListener graveListener;
|
|
|
|
|
private SitListener sitListener;
|
|
|
|
|
private PlayerJoinListener playerJoinListener; // Neuer Listener
|
|
|
|
|
private PlayerJoinListener playerJoinListener;
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void onEnable() {
|
|
|
|
|
@Override
|
|
|
|
|
public void onEnable() {
|
|
|
|
|
updateConfigFiles(); // Config-Dateien aktualisieren
|
|
|
|
|
createHomesFile();
|
|
|
|
|
createGravesFile();
|
|
|
|
@@ -70,14 +70,22 @@ public class SurvivalPlus extends JavaPlugin {
|
|
|
|
|
createLeashesFile();
|
|
|
|
|
createMobCapFile();
|
|
|
|
|
|
|
|
|
|
// FirstJoinListener registrieren
|
|
|
|
|
// PluginManager holen
|
|
|
|
|
PluginManager pluginManager = getServer().getPluginManager();
|
|
|
|
|
pluginManager.registerEvents(new FirstJoinListener(), this);
|
|
|
|
|
|
|
|
|
|
// FriendCommand instanzieren für PlayerJoinListener
|
|
|
|
|
// FriendCommand instanzieren
|
|
|
|
|
FriendCommand friendCommand = new FriendCommand(this, friendsConfig, langConfig, getLogger());
|
|
|
|
|
|
|
|
|
|
// Commands
|
|
|
|
|
// StatsManager vor den Listenern initialisieren
|
|
|
|
|
statsManager = new StatsManager(this);
|
|
|
|
|
|
|
|
|
|
// Listener initialisieren (sitListener zuerst!)
|
|
|
|
|
sitListener = new SitListener(this);
|
|
|
|
|
afkListener = new AFKListener(this);
|
|
|
|
|
graveListener = new GraveListener(this);
|
|
|
|
|
playerJoinListener = new PlayerJoinListener(friendCommand);
|
|
|
|
|
|
|
|
|
|
// Commands registrieren
|
|
|
|
|
getCommand("gm").setExecutor(new GamemodeCommand(this));
|
|
|
|
|
getCommand("sp").setExecutor(new PluginCommand(this));
|
|
|
|
|
getCommand("sethome").setExecutor(new HomeCommand(this));
|
|
|
|
@@ -99,12 +107,14 @@ public class SurvivalPlus extends JavaPlugin {
|
|
|
|
|
getCommand("trash").setExecutor(new TrashCommand());
|
|
|
|
|
getCommand("workbench").setExecutor(new WorkbenchCommand());
|
|
|
|
|
getCommand("anvil").setExecutor(new AnvilCommand());
|
|
|
|
|
|
|
|
|
|
TeleportCommands teleportCommands = new TeleportCommands(this);
|
|
|
|
|
getCommand("tp").setExecutor(teleportCommands);
|
|
|
|
|
getCommand("tphere").setExecutor(teleportCommands);
|
|
|
|
|
getCommand("tpa").setExecutor(teleportCommands);
|
|
|
|
|
getCommand("tpaccept").setExecutor(teleportCommands);
|
|
|
|
|
getCommand("tpdeny").setExecutor(teleportCommands);
|
|
|
|
|
|
|
|
|
|
getCommand("kit").setExecutor(new KitCommand(this));
|
|
|
|
|
|
|
|
|
|
// BlockManager erstellen
|
|
|
|
@@ -116,11 +126,6 @@ public class SurvivalPlus extends JavaPlugin {
|
|
|
|
|
// Listener registrieren
|
|
|
|
|
BackpackRecipe.register(this, langConfig);
|
|
|
|
|
|
|
|
|
|
sitListener = new SitListener(this);
|
|
|
|
|
afkListener = new AFKListener(this);
|
|
|
|
|
graveListener = new GraveListener(this);
|
|
|
|
|
playerJoinListener = new PlayerJoinListener(friendCommand); // PlayerJoinListener registrieren
|
|
|
|
|
|
|
|
|
|
pluginManager.registerEvents(new ChatBlockListener(blockManager), this);
|
|
|
|
|
pluginManager.registerEvents(new InventoryClickListener(this), this);
|
|
|
|
|
pluginManager.registerEvents(sitListener, this);
|
|
|
|
@@ -131,16 +136,15 @@ public class SurvivalPlus extends JavaPlugin {
|
|
|
|
|
pluginManager.registerEvents(new LoginListener(this), this);
|
|
|
|
|
pluginManager.registerEvents(new DebugArmorStandListener(), this);
|
|
|
|
|
pluginManager.registerEvents(new ArmorStandDestroyListener(), this);
|
|
|
|
|
pluginManager.registerEvents(playerJoinListener, this); // Listener hinzufügen
|
|
|
|
|
pluginManager.registerEvents(new FirstJoinListener(), this);
|
|
|
|
|
pluginManager.registerEvents(playerJoinListener, this);
|
|
|
|
|
|
|
|
|
|
// Befehle mit BlockManager und Konfiguration registrieren
|
|
|
|
|
getCommand("block").setExecutor(new BlockCommand(blockManager, config));
|
|
|
|
|
getCommand("blocklist").setExecutor(new BlockListCommand(blockManager, config));
|
|
|
|
|
getCommand("unblock").setExecutor(new UnblockCommand(blockManager, config));
|
|
|
|
|
|
|
|
|
|
// Stats
|
|
|
|
|
statsManager = new StatsManager(this);
|
|
|
|
|
pluginManager.registerEvents(new StatsListener(this, statsManager), this);
|
|
|
|
|
// Stats-Befehl registrieren
|
|
|
|
|
getCommand("stats").setExecutor(new StatsCommand(this, statsManager));
|
|
|
|
|
|
|
|
|
|
sleepListener = new SleepListener(this);
|
|
|
|
@@ -165,11 +169,11 @@ public class SurvivalPlus extends JavaPlugin {
|
|
|
|
|
// AutoClear Task starten
|
|
|
|
|
startAutoClearTask();
|
|
|
|
|
|
|
|
|
|
// Beispiel ArmorStand
|
|
|
|
|
// Beispiel ArmorStand spawnen
|
|
|
|
|
spawnArmorStandExample();
|
|
|
|
|
|
|
|
|
|
getLogger().info(getMessage("plugin.enabled"));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void spawnArmorStandExample() {
|
|
|
|
|
World world = Bukkit.getWorld("world");
|
|
|
|
@@ -605,7 +609,7 @@ public class SurvivalPlus extends JavaPlugin {
|
|
|
|
|
sitListener = new SitListener(this);
|
|
|
|
|
pm.registerEvents(sitListener, this);
|
|
|
|
|
|
|
|
|
|
playerJoinListener = new PlayerJoinListener(friendCommand); // PlayerJoinListener neu registrieren
|
|
|
|
|
playerJoinListener = new PlayerJoinListener(friendCommand);
|
|
|
|
|
pm.registerEvents(playerJoinListener, this);
|
|
|
|
|
|
|
|
|
|
pm.registerEvents(new InventoryClickListener(this), this);
|
|
|
|
|