Search in sources :

Example 1 with SpongeProxySource

use of org.spongepowered.common.command.SpongeProxySource in project SpongeCommon by SpongePowered.

the class MixinCommandSenderWrapper method onInit.

@Inject(method = "<init>", at = @At("RETURN"))
private void onInit(ICommandSender delegateIn, Vec3d positionVectorIn, BlockPos positionIn, Integer permissionLevelIn, Entity entityIn, Boolean sendCommandFeedbackIn, CallbackInfo ci) {
    CommandSource wrappedDelegate = WrapperCommandSource.of(this.delegate);
    Subject subjectDelegate;
    if (this.permissionLevel == null) {
        subjectDelegate = wrappedDelegate;
    } else {
        subjectDelegate = new AndPermissionLevelSubject(this, wrappedDelegate);
    }
    if (this.positionVector != null || wrappedDelegate instanceof Locatable) {
        this.sponge = new SpongeProxySource.Located(this, wrappedDelegate, subjectDelegate);
    } else {
        this.sponge = new SpongeProxySource(this, wrappedDelegate, subjectDelegate);
    }
}
Also used : SpongeProxySource(org.spongepowered.common.command.SpongeProxySource) WrapperCommandSource(org.spongepowered.common.command.WrapperCommandSource) CommandSource(org.spongepowered.api.command.CommandSource) AndPermissionLevelSubject(org.spongepowered.common.command.AndPermissionLevelSubject) AndPermissionLevelSubject(org.spongepowered.common.command.AndPermissionLevelSubject) Subject(org.spongepowered.api.service.permission.Subject) Locatable(org.spongepowered.api.world.Locatable) Inject(org.spongepowered.asm.mixin.injection.Inject)

Aggregations

CommandSource (org.spongepowered.api.command.CommandSource)1 Subject (org.spongepowered.api.service.permission.Subject)1 Locatable (org.spongepowered.api.world.Locatable)1 Inject (org.spongepowered.asm.mixin.injection.Inject)1 AndPermissionLevelSubject (org.spongepowered.common.command.AndPermissionLevelSubject)1 SpongeProxySource (org.spongepowered.common.command.SpongeProxySource)1 WrapperCommandSource (org.spongepowered.common.command.WrapperCommandSource)1