Skip to content

Commit

Permalink
Fix permissions for command dialogue trigger
Browse files Browse the repository at this point in the history
  • Loading branch information
kirderf1 committed Apr 14, 2024
1 parent 4c89d18 commit 7fecb79
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).

- More logging for grist cost generator to help identify bottlenecks
- Perfectly generic and cindered signs work again
- Fixed execution permissions for the `minestuck:command` dialogue trigger

## [1.20.1-1.12.0.0] - 2024-04-13

Expand Down
12 changes: 5 additions & 7 deletions src/main/java/com/mraof/minestuck/entity/dialogue/Trigger.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
import com.mraof.minestuck.util.PreservingOptionalFieldCodec;
import net.minecraft.MethodsReturnNonnullByDefault;
import net.minecraft.Util;
import net.minecraft.commands.CommandSourceStack;
import net.minecraft.commands.Commands;
import net.minecraft.network.chat.Component;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.server.level.ServerLevel;
Expand All @@ -23,7 +25,6 @@
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.storage.loot.LootParams;
import net.minecraft.world.level.storage.loot.parameters.LootContextParamSets;
import net.minecraft.world.level.storage.loot.parameters.LootContextParams;
Expand Down Expand Up @@ -156,12 +157,9 @@ public void triggerEffect(LivingEntity entity, ServerPlayer player)
if(player == null)
return;

Level level = player.level();
if(!level.isClientSide)
{
//TODO using the entity for this instead of the player failed
level.getServer().getCommands().performPrefixedCommand(player.createCommandSourceStack(), this.commandText);
}
//TODO using the entity for this instead of the player failed
CommandSourceStack sourceStack = player.createCommandSourceStack().withSuppressedOutput().withPermission(Commands.LEVEL_GAMEMASTERS);
player.server.getCommands().performPrefixedCommand(sourceStack, this.commandText);
}
}

Expand Down

0 comments on commit 7fecb79

Please sign in to comment.