Skip to content

The player does not receive information about whether he can execute commands that require the performer to be a player. #4245

Description

@SawFowl

Affected Product(s)

SpongeNeo

Version

1.21.1-21.1.35-12.0.3-RC2358

Operating System

Debian GNU/Linux 12 (bookworm) x86_64

Java Version

21.0.7

Plugins/Mods

Plugins (12): LogFilter, WorldEdit, LocaleAPI, Wasted, LuckPerms, H2Driver, MySQLDriver, CommandPack, RegionGuard, GuiShopManager, IslandWorlds, ClearLag.
Mods (12): Minecraft, Just Enough Items, Lithium, SpongeAPI, Sponge, NeoForge, SpongeNeo, ModernFix, Architectury, Accelerated Decay, Ferrite Core, AI-Improvements.

Describe the bug

The bug is not reproducible on SpongeVanilla.

You can check using this code. In the constructor of the command, use the method executionRequirements(cause -> ...).

	boolean canUse(CommandCause cause) {
		return cause.first(ServerPlayer.class).filter(player -> hasPermission(player)).isPresent();
			       // | ^ Optional is always empty here |
	}

	// This method will never be called.
	boolean hasPermission(ServerPlayer player) {
		return player.hasPermission("permission");
	}

That's what we get as a result. The player can execute a command if he has permission, but the client will always highlight it in red, since he does not know it, which means that tab-completion of the command and its arguments will not work.

Link to logs

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: needs triageThis label is automatically applied to new issues and pull requests to indicate they require triagetype: bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions