Archiviert
1
0

Fixing completely /local security

Dieser Commit ist enthalten in:
Lixfel 2019-12-20 11:10:17 +01:00
Ursprung 8814c6b6cc
Commit 1bf9f480bc

Datei anzeigen

@ -12,7 +12,6 @@ import net.md_5.bungee.api.ChatMessageType;
import net.md_5.bungee.api.ProxyServer;
import net.md_5.bungee.api.Title;
import net.md_5.bungee.api.chat.TextComponent;
import net.md_5.bungee.api.connection.Connection;
import net.md_5.bungee.api.connection.ProxiedPlayer;
import net.md_5.bungee.api.event.ChatEvent;
import net.md_5.bungee.api.event.TabCompleteEvent;
@ -25,7 +24,7 @@ import java.util.concurrent.TimeUnit;
public class ChatListener extends BasicListener {
private static Title LIXFEL = ProxyServer.getInstance().createTitle().fadeIn(5).fadeOut(20).stay(30).title(TextComponent.fromLegacyText("§4§lLIXFEL"));
private static final Title LIXFEL = ProxyServer.getInstance().createTitle().fadeIn(5).fadeOut(20).stay(30).title(TextComponent.fromLegacyText("§4§lLIXFEL"));
@EventHandler
public void onChatEvent(ChatEvent e){
@ -37,7 +36,9 @@ public class ChatListener extends BasicListener {
private void onCommand(ChatEvent e){
String [] command = e.getMessage().split(" ");
if(isBadCommand(e.getSender(), command[0])){
if(command[0].contains(":")){
if(e.getSender() instanceof ProxiedPlayer)
BungeeCore.send((ProxiedPlayer) e.getSender(), BungeeCore.CHAT_PREFIX + "§cUnbekannter Befehl.");
e.setCancelled(true);
return;
}
@ -149,7 +150,8 @@ public class ChatListener extends BasicListener {
return;
}
if(isBadCommand(sender, command[1])){
if(command[1].startsWith("/")){
BungeeCore.send(sender, "§Keine Befehle mit /local möglich.");
e.setCancelled(true);
return;
}
@ -157,15 +159,6 @@ public class ChatListener extends BasicListener {
e.setMessage(e.getMessage().substring(command[0].length() + 1));
}
private boolean isBadCommand(Connection connection, String command){
if(command.startsWith("/") && command.contains(":")){
if(connection instanceof ProxiedPlayer)
BungeeCore.send((ProxiedPlayer) connection, BungeeCore.CHAT_PREFIX + "§cUnbekannter Befehl.");
return true;
}
return false;
}
@EventHandler
public void onTabCompleteEvent(TabCompleteEvent e){
List<String> suggestions = e.getSuggestions();