Fixing completely /local security
Dieser Commit ist enthalten in:
Ursprung
8814c6b6cc
Commit
1bf9f480bc
@ -12,7 +12,6 @@ import net.md_5.bungee.api.ChatMessageType;
|
|||||||
import net.md_5.bungee.api.ProxyServer;
|
import net.md_5.bungee.api.ProxyServer;
|
||||||
import net.md_5.bungee.api.Title;
|
import net.md_5.bungee.api.Title;
|
||||||
import net.md_5.bungee.api.chat.TextComponent;
|
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.connection.ProxiedPlayer;
|
||||||
import net.md_5.bungee.api.event.ChatEvent;
|
import net.md_5.bungee.api.event.ChatEvent;
|
||||||
import net.md_5.bungee.api.event.TabCompleteEvent;
|
import net.md_5.bungee.api.event.TabCompleteEvent;
|
||||||
@ -25,7 +24,7 @@ import java.util.concurrent.TimeUnit;
|
|||||||
|
|
||||||
public class ChatListener extends BasicListener {
|
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
|
@EventHandler
|
||||||
public void onChatEvent(ChatEvent e){
|
public void onChatEvent(ChatEvent e){
|
||||||
@ -37,7 +36,9 @@ public class ChatListener extends BasicListener {
|
|||||||
|
|
||||||
private void onCommand(ChatEvent e){
|
private void onCommand(ChatEvent e){
|
||||||
String [] command = e.getMessage().split(" ");
|
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);
|
e.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -149,7 +150,8 @@ public class ChatListener extends BasicListener {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(isBadCommand(sender, command[1])){
|
if(command[1].startsWith("/")){
|
||||||
|
BungeeCore.send(sender, "§Keine Befehle mit /local möglich.");
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -157,15 +159,6 @@ public class ChatListener extends BasicListener {
|
|||||||
e.setMessage(e.getMessage().substring(command[0].length() + 1));
|
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
|
@EventHandler
|
||||||
public void onTabCompleteEvent(TabCompleteEvent e){
|
public void onTabCompleteEvent(TabCompleteEvent e){
|
||||||
List<String> suggestions = e.getSuggestions();
|
List<String> suggestions = e.getSuggestions();
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren