mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-02 21:22:05 -07:00
Add UnknownCommandEvent
Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
This commit is contained in:
@@ -17,7 +17,7 @@
|
||||
|
||||
public CommandSourceStack(CommandSource output, Vec3 pos, Vec2 rot, ServerLevel world, int level, String name, Component displayName, MinecraftServer server, @Nullable Entity entity) {
|
||||
this(output, pos, rot, world, level, name, displayName, server, entity, false, CommandResultCallback.EMPTY, EntityAnchorArgument.Anchor.FEET, CommandSigningContext.ANONYMOUS, TaskChainer.immediate(server));
|
||||
@@ -171,9 +174,23 @@
|
||||
@@ -171,8 +174,22 @@
|
||||
|
||||
@Override
|
||||
public boolean hasPermission(int level) {
|
||||
@@ -30,18 +30,17 @@
|
||||
+
|
||||
return this.permissionLevel >= level;
|
||||
}
|
||||
|
||||
+
|
||||
+ // CraftBukkit start
|
||||
+ public boolean hasPermission(int i, String bukkitPermission) {
|
||||
+ // World is null when loading functions
|
||||
+ return ((this.getLevel() == null || !this.getLevel().getCraftServer().ignoreVanillaPermissions) && this.permissionLevel >= i) || this.getBukkitSender().hasPermission(bukkitPermission);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
|
||||
public Vec3 getPosition() {
|
||||
return this.worldPosition;
|
||||
}
|
||||
@@ -302,13 +319,13 @@
|
||||
@@ -302,21 +319,26 @@
|
||||
while (iterator.hasNext()) {
|
||||
ServerPlayer entityplayer = (ServerPlayer) iterator.next();
|
||||
|
||||
@@ -57,7 +56,21 @@
|
||||
this.server.sendSystemMessage(ichatmutablecomponent);
|
||||
}
|
||||
|
||||
@@ -400,4 +417,10 @@
|
||||
}
|
||||
|
||||
public void sendFailure(Component message) {
|
||||
+ // Paper start - Add UnknownCommandEvent
|
||||
+ this.sendFailure(message, true);
|
||||
+ }
|
||||
+ public void sendFailure(Component message, boolean withStyle) {
|
||||
+ // Paper end - Add UnknownCommandEvent
|
||||
if (this.source.acceptsFailure() && !this.silent) {
|
||||
- this.source.sendSystemMessage(Component.empty().append(message).withStyle(ChatFormatting.RED));
|
||||
+ this.source.sendSystemMessage(withStyle ? Component.empty().append(message).withStyle(ChatFormatting.RED) : message); // Paper - Add UnknownCommandEvent
|
||||
}
|
||||
|
||||
}
|
||||
@@ -400,4 +422,10 @@
|
||||
public boolean isSilent() {
|
||||
return this.silent;
|
||||
}
|
||||
|
Reference in New Issue
Block a user