5 Commits
1.0.1 ... main

4 changed files with 283 additions and 276 deletions

View File

@@ -1,6 +1,6 @@
# 🧩 SurvivalPlus
**Version:** 1.0.0
**Version:** 1.0.1
**Autor:** M_Viper
**API-Version:** 1.21
**Beschreibung:**

View File

@@ -58,118 +58,122 @@ 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() {
updateConfigFiles(); // Config-Dateien aktualisieren
createHomesFile();
createGravesFile();
createBackpackFile();
createFriendsFile();
createLeashesFile();
createMobCapFile();
@Override
public void onEnable() {
updateConfigFiles(); // Config-Dateien aktualisieren
createHomesFile();
createGravesFile();
createBackpackFile();
createFriendsFile();
createLeashesFile();
createMobCapFile();
// FirstJoinListener registrieren
PluginManager pluginManager = getServer().getPluginManager();
pluginManager.registerEvents(new FirstJoinListener(), this);
// PluginManager holen
PluginManager pluginManager = getServer().getPluginManager();
// FriendCommand instanzieren für PlayerJoinListener
FriendCommand friendCommand = new FriendCommand(this, friendsConfig, langConfig, getLogger());
// FriendCommand instanzieren
FriendCommand friendCommand = new FriendCommand(this, friendsConfig, langConfig, getLogger());
// Commands
getCommand("gm").setExecutor(new GamemodeCommand(this));
getCommand("sp").setExecutor(new PluginCommand(this));
getCommand("sethome").setExecutor(new HomeCommand(this));
getCommand("delhome").setExecutor(new HomeCommand(this));
getCommand("homelist").setExecutor(new HomeCommand(this));
getCommand("inv").setExecutor(new InventoryCommand(this));
getCommand("ec").setExecutor(new EnderchestCommand(this));
getCommand("setspawn").setExecutor(new SetSpawnCommand(this));
getCommand("setworldspawn").setExecutor(new SetWorldSpawnCommand(this));
getCommand("clearchat").setExecutor(new ClearChatCommand());
getCommand("clearitems").setExecutor(new ClearItemsCommand(this));
getCommand("closedoors").setExecutor(new CloseDoorsCommand(this));
getCommand("sit").setExecutor(new SitCommand(this, sitListener));
getCommand("back").setExecutor(new BackCommand(this));
getCommand("friend").setExecutor(friendCommand);
getCommand("ir").setExecutor(new ItemRenameCommand(this));
getCommand("showarmorstands").setExecutor(new ShowArmorStandsCommand(this));
getCommand("cleardebugarmorstands").setExecutor(new ClearDebugArmorStandsCommand(this));
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));
// StatsManager vor den Listenern initialisieren
statsManager = new StatsManager(this);
// BlockManager erstellen
BlockManager blockManager = new BlockManager();
// Listener initialisieren (sitListener zuerst!)
sitListener = new SitListener(this);
afkListener = new AFKListener(this);
graveListener = new GraveListener(this);
playerJoinListener = new PlayerJoinListener(friendCommand);
// Konfiguration laden
FileConfiguration config = getConfig();
// Commands registrieren
getCommand("gm").setExecutor(new GamemodeCommand(this));
getCommand("sp").setExecutor(new PluginCommand(this));
getCommand("sethome").setExecutor(new HomeCommand(this));
getCommand("delhome").setExecutor(new HomeCommand(this));
getCommand("homelist").setExecutor(new HomeCommand(this));
getCommand("inv").setExecutor(new InventoryCommand(this));
getCommand("ec").setExecutor(new EnderchestCommand(this));
getCommand("setspawn").setExecutor(new SetSpawnCommand(this));
getCommand("setworldspawn").setExecutor(new SetWorldSpawnCommand(this));
getCommand("clearchat").setExecutor(new ClearChatCommand());
getCommand("clearitems").setExecutor(new ClearItemsCommand(this));
getCommand("closedoors").setExecutor(new CloseDoorsCommand(this));
getCommand("sit").setExecutor(new SitCommand(this, sitListener));
getCommand("back").setExecutor(new BackCommand(this));
getCommand("friend").setExecutor(friendCommand);
getCommand("ir").setExecutor(new ItemRenameCommand(this));
getCommand("showarmorstands").setExecutor(new ShowArmorStandsCommand(this));
getCommand("cleardebugarmorstands").setExecutor(new ClearDebugArmorStandsCommand(this));
getCommand("trash").setExecutor(new TrashCommand());
getCommand("workbench").setExecutor(new WorkbenchCommand());
getCommand("anvil").setExecutor(new AnvilCommand());
// Listener registrieren
BackpackRecipe.register(this, langConfig);
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);
sitListener = new SitListener(this);
afkListener = new AFKListener(this);
graveListener = new GraveListener(this);
playerJoinListener = new PlayerJoinListener(friendCommand); // PlayerJoinListener registrieren
getCommand("kit").setExecutor(new KitCommand(this));
pluginManager.registerEvents(new ChatBlockListener(blockManager), this);
pluginManager.registerEvents(new InventoryClickListener(this), this);
pluginManager.registerEvents(sitListener, this);
pluginManager.registerEvents(afkListener, this);
pluginManager.registerEvents(graveListener, this);
pluginManager.registerEvents(new BackpackListener(backpackConfig, langConfig, getLogger(), backpackFile), this);
pluginManager.registerEvents(new StatsListener(this, statsManager), this);
pluginManager.registerEvents(new LoginListener(this), this);
pluginManager.registerEvents(new DebugArmorStandListener(), this);
pluginManager.registerEvents(new ArmorStandDestroyListener(), this);
pluginManager.registerEvents(playerJoinListener, this); // Listener hinzufügen
// BlockManager erstellen
BlockManager blockManager = new BlockManager();
// 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));
// Konfiguration laden
FileConfiguration config = getConfig();
// Stats
statsManager = new StatsManager(this);
pluginManager.registerEvents(new StatsListener(this, statsManager), this);
getCommand("stats").setExecutor(new StatsCommand(this, statsManager));
// Listener registrieren
BackpackRecipe.register(this, langConfig);
sleepListener = new SleepListener(this);
pluginManager.registerEvents(sleepListener, this);
pluginManager.registerEvents(new ChatBlockListener(blockManager), this);
pluginManager.registerEvents(new InventoryClickListener(this), this);
pluginManager.registerEvents(sitListener, this);
pluginManager.registerEvents(afkListener, this);
pluginManager.registerEvents(graveListener, this);
pluginManager.registerEvents(new BackpackListener(backpackConfig, langConfig, getLogger(), backpackFile), this);
pluginManager.registerEvents(new StatsListener(this, statsManager), this);
pluginManager.registerEvents(new LoginListener(this), this);
pluginManager.registerEvents(new DebugArmorStandListener(), this);
pluginManager.registerEvents(new ArmorStandDestroyListener(), this);
pluginManager.registerEvents(new FirstJoinListener(), this);
pluginManager.registerEvents(playerJoinListener, this);
oreAlarmListener = new OreAlarmListener(this);
pluginManager.registerEvents(oreAlarmListener, 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));
mobLeashLimitListener = new MobLeashLimitListener(this, getConfig());
pluginManager.registerEvents(mobLeashLimitListener, this);
// Stats-Befehl registrieren
getCommand("stats").setExecutor(new StatsCommand(this, statsManager));
mobCapListener = new MobCapListener(this, getConfig());
pluginManager.registerEvents(mobCapListener, this);
sleepListener = new SleepListener(this);
pluginManager.registerEvents(sleepListener, this);
spawnProtectionListener = new SpawnProtectionListener(this);
pluginManager.registerEvents(spawnProtectionListener, this);
oreAlarmListener = new OreAlarmListener(this);
pluginManager.registerEvents(oreAlarmListener, this);
LockSystem lockSystem = new LockSystem(this);
pluginManager.registerEvents(lockSystem, this);
getCommand("lock").setExecutor(lockSystem);
mobLeashLimitListener = new MobLeashLimitListener(this, getConfig());
pluginManager.registerEvents(mobLeashLimitListener, this);
// AutoClear Task starten
startAutoClearTask();
mobCapListener = new MobCapListener(this, getConfig());
pluginManager.registerEvents(mobCapListener, this);
// Beispiel ArmorStand
spawnArmorStandExample();
spawnProtectionListener = new SpawnProtectionListener(this);
pluginManager.registerEvents(spawnProtectionListener, this);
getLogger().info(getMessage("plugin.enabled"));
}
LockSystem lockSystem = new LockSystem(this);
pluginManager.registerEvents(lockSystem, this);
getCommand("lock").setExecutor(lockSystem);
// AutoClear Task starten
startAutoClearTask();
// 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);

View File

@@ -45,9 +45,12 @@ public class SitCommand implements CommandExecutor {
return true;
}
// Setze den Spieler direkt auf dem Block
// Setze den Spieler mittig auf den Block und leicht oberhalb (Fix)
Location location = player.getLocation();
location.setY(location.getBlockY()); // Direkt auf dem Block (keine Y-Verschiebung)
location.setX(location.getBlockX() + 0.5);
location.setY(location.getBlockY() + 0.25);
location.setZ(location.getBlockZ() + 0.5);
sitListener.sitPlayer(player, location);
return true;
}