SteamWar/SpigotCore
Archiviert
13
0

commonDB #211

Zusammengeführt
Lixfel hat 15 Commits von commonDB nach master 2022-11-22 11:36:14 +01:00 zusammengeführt
5 geänderte Dateien mit 45 neuen und 8 gelöschten Zeilen
Nur Änderungen aus Commit a267810cf6 werden angezeigt - Alle Commits anzeigen

Datei anzeigen

@ -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;

Datei anzeigen

@ -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 <https://www.gnu.org/licenses/>.
*/
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));
}
}

Datei anzeigen

@ -102,7 +102,7 @@ public class SWCommand extends AbstractSWCommand<CommandSender> {
}
@Register(help = true)
private void internalHelp(Player p, String... args) {
public void internalHelp(Player p, String... args) {
if (message == null) {
return;
}

Datei anzeigen

@ -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);

Datei anzeigen

@ -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);
}