SteamWar/SpigotCore
Archiviert
13
0

Add CaseInsensitiveCommandsListener
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Dieser Commit ist enthalten in:
yoyosource 2022-09-18 19:59:20 +02:00
Ursprung 5b3cfefaaf
Commit 4462c95607
4 geänderte Dateien mit 39 neuen und 6 gelöschten Zeilen

@ -1 +1 @@
Subproject commit 211f6258b5bd5a50253a21bd82804edb12f34e3e Subproject commit 1dea71993d897354d3f52a705f6e0e1e0c8ec580

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) @Register(help = true)
private void internalHelp(Player p, String... args) { public void internalHelp(Player p, String... args) {
if (message == null) { if (message == null) {
return; return;
} }

Datei anzeigen

@ -20,10 +20,7 @@
package de.steamwar.core; package de.steamwar.core;
import com.comphenix.tinyprotocol.TinyProtocol; import com.comphenix.tinyprotocol.TinyProtocol;
import de.steamwar.command.SWCommandUtils; import de.steamwar.command.*;
import de.steamwar.command.SWTypeMapperCreator;
import de.steamwar.command.TabCompletionCache;
import de.steamwar.command.TypeMapper;
import de.steamwar.core.authlib.AuthlibInjector; import de.steamwar.core.authlib.AuthlibInjector;
import de.steamwar.core.events.ChattingEvent; import de.steamwar.core.events.ChattingEvent;
import de.steamwar.core.events.PartialChunkFixer; import de.steamwar.core.events.PartialChunkFixer;
@ -118,6 +115,7 @@ public class Core extends JavaPlugin{
} }
}); });
Bukkit.getScheduler().runTaskTimer(this, TabCompletionCache::invalidateOldEntries, 20, 20); Bukkit.getScheduler().runTaskTimer(this, TabCompletionCache::invalidateOldEntries, 20, 20);
Bukkit.getPluginManager().registerEvents(new CaseInsensitiveCommandsListener(), this);
Bukkit.getPluginManager().registerEvents(new PlayerJoinedEvent(), this); Bukkit.getPluginManager().registerEvents(new PlayerJoinedEvent(), this);
Bukkit.getPluginManager().registerEvents(new ChattingEvent(), this); Bukkit.getPluginManager().registerEvents(new ChattingEvent(), this);