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,7 +58,7 @@ 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() {
@@ -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,7 +169,7 @@ public class SurvivalPlus extends JavaPlugin {
// AutoClear Task starten
startAutoClearTask();
// Beispiel ArmorStand
// Beispiel ArmorStand spawnen
spawnArmorStandExample();
getLogger().info(getMessage("plugin.enabled"));
@@ -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;
}