diff --git a/SpigotCore_8/src/de/steamwar/core/FlatteningWrapper8.java b/SpigotCore_8/src/de/steamwar/core/FlatteningWrapper8.java
index feb679e..ca0a636 100644
--- a/SpigotCore_8/src/de/steamwar/core/FlatteningWrapper8.java
+++ b/SpigotCore_8/src/de/steamwar/core/FlatteningWrapper8.java
@@ -59,7 +59,7 @@ public class FlatteningWrapper8 implements FlatteningWrapper.IFlatteningWrapper
public ItemStack setSkullOwner(String player) {
ItemStack head = new ItemStack(Material.SKULL_ITEM, 1, (short) 3);
SkullMeta headmeta = (SkullMeta) head.getItemMeta();
- headmeta.setOwner(player);
+ headmeta.setOwner(player.startsWith(".") ? player.substring(1) : player);
headmeta.setDisplayName(player);
head.setItemMeta(headmeta);
return head;
diff --git a/SpigotCore_Main/src/de/steamwar/command/CaseInsensitiveCommandsListener.java b/SpigotCore_Main/src/de/steamwar/command/CaseInsensitiveCommandsListener.java
new file mode 100644
index 0000000..a829308
--- /dev/null
+++ b/SpigotCore_Main/src/de/steamwar/command/CaseInsensitiveCommandsListener.java
@@ -0,0 +1,35 @@
+/*
+ * This file is a part of the SteamWar software.
+ *
+ * Copyright (C) 2020 SteamWar.de-Serverteam
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+
+package de.steamwar.command;
+
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.EventPriority;
+import org.bukkit.event.Listener;
+import org.bukkit.event.player.PlayerCommandPreprocessEvent;
+
+public class CaseInsensitiveCommandsListener implements Listener {
+
+ @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
+ public void onPlayerCommandPreprocess(PlayerCommandPreprocessEvent event) {
+ String[] strings = event.getMessage().split(" ");
+ strings[0] = strings[0].toLowerCase();
+ event.setMessage(String.join(" ", strings));
+ }
+}
diff --git a/SpigotCore_Main/src/de/steamwar/command/SWCommand.java b/SpigotCore_Main/src/de/steamwar/command/SWCommand.java
index cee412d..e0997f7 100644
--- a/SpigotCore_Main/src/de/steamwar/command/SWCommand.java
+++ b/SpigotCore_Main/src/de/steamwar/command/SWCommand.java
@@ -102,7 +102,7 @@ public class SWCommand extends AbstractSWCommand {
}
@Register(help = true)
- private void internalHelp(Player p, String... args) {
+ public void internalHelp(Player p, String... args) {
if (message == null) {
return;
}
diff --git a/SpigotCore_Main/src/de/steamwar/core/Core.java b/SpigotCore_Main/src/de/steamwar/core/Core.java
index c1d7d30..fe320b8 100644
--- a/SpigotCore_Main/src/de/steamwar/core/Core.java
+++ b/SpigotCore_Main/src/de/steamwar/core/Core.java
@@ -20,10 +20,7 @@
package de.steamwar.core;
import com.comphenix.tinyprotocol.TinyProtocol;
-import de.steamwar.command.SWCommandUtils;
-import de.steamwar.command.SWTypeMapperCreator;
-import de.steamwar.command.TabCompletionCache;
-import de.steamwar.command.TypeMapper;
+import de.steamwar.command.*;
import de.steamwar.core.authlib.AuthlibInjector;
import de.steamwar.core.events.ChattingEvent;
import de.steamwar.core.events.PartialChunkFixer;
@@ -108,6 +105,7 @@ public class Core extends JavaPlugin{
}
});
Bukkit.getScheduler().runTaskTimer(this, TabCompletionCache::invalidateOldEntries, 20, 20);
+ Bukkit.getPluginManager().registerEvents(new CaseInsensitiveCommandsListener(), this);
Bukkit.getPluginManager().registerEvents(new PlayerJoinedEvent(), this);
Bukkit.getPluginManager().registerEvents(new ChattingEvent(), this);
diff --git a/SpigotCore_Main/src/de/steamwar/core/CrashDetector.java b/SpigotCore_Main/src/de/steamwar/core/CrashDetector.java
index c267c1d..1320c2c 100644
--- a/SpigotCore_Main/src/de/steamwar/core/CrashDetector.java
+++ b/SpigotCore_Main/src/de/steamwar/core/CrashDetector.java
@@ -54,8 +54,12 @@ public class CrashDetector {
if(mainThread.isAlive()) {
SWException.log("Server hung for " + (curTime - lastTick.get()) + "ms", Arrays.stream(mainThread.getStackTrace()).map(StackTraceElement::toString).collect(Collectors.joining("\n")));
} else {
- SWException.log("Server thread already dead, stopping server", "");
- System.exit(0);
+ SWException.log("Server thread already dead, unclean server stop", "Core enabled: " + Core.getInstance().isEnabled());
+ if(Core.getInstance().isEnabled()) {
+ Core.getInstance().onDisable();
+ }
+ //System.exit(0); Does freeze, potential freezing issues: ConsoleRestoreHook, ApplicationShutdownHooks or DeleteOnExitHook
+ Runtime.getRuntime().halt(0);
}
lastTick.set(curTime);
}