Fixes command context for bukkit console command sender (#2193)

This commit is contained in:
Phillipp Glanz 2023-05-12 13:12:08 +02:00 committed by GitHub
parent dd6197922c
commit c57fee5b86
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 2 deletions

View File

@ -112,11 +112,15 @@ public class WorldEditPlugin extends JavaPlugin {
private BukkitServerInterface platform; private BukkitServerInterface platform;
private BukkitConfiguration config; private BukkitConfiguration config;
private BukkitPermissionAttachmentManager permissionAttachmentManager; private BukkitPermissionAttachmentManager permissionAttachmentManager;
// Fawe start
private BukkitCommandSender bukkitConsoleCommandSender;
// Fawe end
@Override @Override
public void onLoad() { public void onLoad() {
//FAWE start //FAWE start
this.bukkitConsoleCommandSender = new BukkitCommandSender(this, Bukkit.getConsoleSender());
// This is already covered by Spigot, however, a more pesky warning with a proper explanation over "Ambiguous plugin name..." can't hurt. // This is already covered by Spigot, however, a more pesky warning with a proper explanation over "Ambiguous plugin name..." can't hurt.
Plugin[] plugins = Bukkit.getServer().getPluginManager().getPlugins(); Plugin[] plugins = Bukkit.getServer().getPluginManager().getPlugins();
for (Plugin p : plugins) { for (Plugin p : plugins) {
@ -594,7 +598,7 @@ public class WorldEditPlugin extends JavaPlugin {
return new BukkitBlockCommandSender(this, (BlockCommandSender) sender); return new BukkitBlockCommandSender(this, (BlockCommandSender) sender);
} }
return new BukkitCommandSender(this, sender); return bukkitConsoleCommandSender;
} }
public BukkitServerInterface getInternalPlatform() { public BukkitServerInterface getInternalPlatform() {

View File

@ -24,7 +24,7 @@ public class ConfirmHandler implements CommandCallListener {
} }
Optional<Actor> actorOpt = parameters.injectedValue(Key.of(Actor.class)); Optional<Actor> actorOpt = parameters.injectedValue(Key.of(Actor.class));
if (!actorOpt.isPresent()) { if (actorOpt.isEmpty()) {
return; return;
} }
Actor actor = actorOpt.get(); Actor actor = actorOpt.get();