Added command refresh after persmission change
This commit is contained in:
parent
de79433c32
commit
8fddabe00f
2
.gitignore
vendored
2
.gitignore
vendored
@ -28,4 +28,4 @@ replay_pid*
|
||||
|
||||
.idea
|
||||
.gradle
|
||||
build
|
||||
build/*
|
Binary file not shown.
@ -16,10 +16,10 @@ public class OpCommand extends Command {
|
||||
|
||||
addSyntax((sender, context) -> {
|
||||
Player target = MinecraftServer.getConnectionManager().getPlayer(context.getRaw("target"));
|
||||
if(target != null)
|
||||
if(target != null) {
|
||||
target.addPermission(new Permission("admin"));
|
||||
else
|
||||
new ChatMessage(Icon.ERROR).appendStatic("Spieler nicht gefunden").send(sender);
|
||||
target.refreshCommands();
|
||||
} else new ChatMessage(Icon.ERROR).appendStatic("Spieler nicht gefunden").send(sender);
|
||||
}, ArgumentType.Entity("target").onlyPlayers(true));
|
||||
}
|
||||
}
|
||||
|
@ -23,10 +23,7 @@ public class AddEntityToInstanceEventListener implements EventListener<AddEntity
|
||||
@Override
|
||||
public @NotNull Result run(@NotNull AddEntityToInstanceEvent event) {
|
||||
if(event.getEntity() instanceof Player p) {
|
||||
|
||||
MinecraftServer.getSchedulerManager().scheduleNextTick(p::refreshCommands, ExecutionType.ASYNC);
|
||||
new ActionBarMessage().appendStatic(Component.text("Instance: ", NamedTextColor.DARK_GRAY)).appendStatic(event.getInstance().getUniqueId().toString()).send(p);
|
||||
new ChatMessage(Icon.SCIENCE).appendStatic(Component.text(event.getInstance().getUniqueId().toString())).send(p);
|
||||
|
||||
p.addEffect(new Potion(PotionEffect.BLINDNESS, (byte) 1, 20)); //TODO Uncomment, currently buggy causes disconnect see https://github.com/Minestom/Minestom/discussions/1302
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user