SteamWar/BauSystem2.0
Archiviert
12
0

Fix BindCommand and SteamWarLuaPlugin
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Dieser Commit ist enthalten in:
yoyosource 2024-02-16 08:24:42 +01:00
Ursprung 953db69425
Commit 21e7bd89af
2 geänderte Dateien mit 8 neuen und 13 gelöschten Zeilen

Datei anzeigen

@ -128,9 +128,6 @@ public class SteamWarLuaPlugin extends TwoArgFunction {
Bukkit.getLogger().log(Level.INFO, player.getName() + " dispatched command: " + command); Bukkit.getLogger().log(Level.INFO, player.getName() + " dispatched command: " + command);
String[] commandSplit = command.split(" "); String[] commandSplit = command.split(" ");
if (!commandSplit[0].equals("select") && hasFAWE && WorldEditListener.isWorldEditCommand("/" + commandSplit[0])) { if (!commandSplit[0].equals("select") && hasFAWE && WorldEditListener.isWorldEditCommand("/" + commandSplit[0])) {
if (!Permission.BUILD.hasPermission(player)) {
return NIL;
}
EditSession editSession = WorldEditUtils.getEditSession(player); EditSession editSession = WorldEditUtils.getEditSession(player);
Actor actor = BukkitAdapter.adapt(player); Actor actor = BukkitAdapter.adapt(player);
WorldEdit.getInstance().getPlatformManager().getPlatformCommandManager().handleCommandOnCurrentThread(new CommandEvent(actor, command, editSession)); WorldEdit.getInstance().getPlatformManager().getPlatformCommandManager().handleCommandOnCurrentThread(new CommandEvent(actor, command, editSession));

Datei anzeigen

@ -117,23 +117,21 @@ public class BindCommand extends SWCommand implements Listener {
event.setCancelled(true); event.setCancelled(true);
Bukkit.getScheduler().runTaskLater(BauSystem.getInstance(), () -> { Bukkit.getScheduler().runTaskLater(BauSystem.getInstance(), () -> {
PlayerCommandPreprocessEvent playerCommandPreprocessEvent = new PlayerCommandPreprocessEvent(event.getPlayer(), "/" + command); PlayerCommandPreprocessEvent preprocessEvent = new PlayerCommandPreprocessEvent(event.getPlayer(), "/" + command);
Bukkit.getPluginManager().callEvent(playerCommandPreprocessEvent); Bukkit.getPluginManager().callEvent(preprocessEvent);
if (playerCommandPreprocessEvent.isCancelled()) return; if (preprocessEvent.isCancelled()) return;
Bukkit.getLogger().log(Level.INFO, event.getPlayer().getName() + " dispatched command: " + command); String processedCommand = preprocessEvent.getMessage().substring(1);
String[] commandSplit = command.split(" "); Bukkit.getLogger().log(Level.INFO, event.getPlayer().getName() + " dispatched command: " + processedCommand);
String[] commandSplit = processedCommand.split(" ");
if (!commandSplit[0].equals("select") && hasFAWE && WorldEditListener.isWorldEditCommand("/" + commandSplit[0])) { if (!commandSplit[0].equals("select") && hasFAWE && WorldEditListener.isWorldEditCommand("/" + commandSplit[0])) {
if (!Permission.WORLDEDIT.hasPermission(event.getPlayer())) {
return;
}
EditSession editSession = WorldEditUtils.getEditSession(event.getPlayer()); EditSession editSession = WorldEditUtils.getEditSession(event.getPlayer());
Actor actor = BukkitAdapter.adapt(event.getPlayer()); Actor actor = BukkitAdapter.adapt(event.getPlayer());
WorldEdit.getInstance().getPlatformManager().getPlatformCommandManager().handleCommandOnCurrentThread(new CommandEvent(actor, command, editSession)); WorldEdit.getInstance().getPlatformManager().getPlatformCommandManager().handleCommandOnCurrentThread(new CommandEvent(actor, processedCommand, editSession));
editSession.flushSession(); editSession.flushSession();
WorldEditUtils.addToPlayer(event.getPlayer(), editSession); WorldEditUtils.addToPlayer(event.getPlayer(), editSession);
} else { } else {
Bukkit.getServer().dispatchCommand(event.getPlayer(), command); Bukkit.getServer().dispatchCommand(event.getPlayer(), processedCommand);
} }
}, 1); }, 1);
} }