aboutsummaryrefslogtreecommitdiffhomepage
path: root/patch-remap/mache-spigotflower/net/minecraft/server/commands/EffectCommands.java.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patch-remap/mache-spigotflower/net/minecraft/server/commands/EffectCommands.java.patch')
-rw-r--r--patch-remap/mache-spigotflower/net/minecraft/server/commands/EffectCommands.java.patch190
1 files changed, 190 insertions, 0 deletions
diff --git a/patch-remap/mache-spigotflower/net/minecraft/server/commands/EffectCommands.java.patch b/patch-remap/mache-spigotflower/net/minecraft/server/commands/EffectCommands.java.patch
new file mode 100644
index 0000000000..1af9a53d4d
--- /dev/null
+++ b/patch-remap/mache-spigotflower/net/minecraft/server/commands/EffectCommands.java.patch
@@ -0,0 +1,190 @@
+--- a/net/minecraft/server/commands/EffectCommands.java
++++ b/net/minecraft/server/commands/EffectCommands.java
+@@ -13,7 +13,6 @@
+ import javax.annotation.Nullable;
+ import net.minecraft.commands.CommandBuildContext;
+ import net.minecraft.commands.CommandSourceStack;
+-import net.minecraft.commands.Commands;
+ import net.minecraft.commands.arguments.EntityArgument;
+ import net.minecraft.commands.arguments.ResourceArgument;
+ import net.minecraft.core.Holder;
+@@ -32,60 +31,60 @@
+
+ public EffectCommands() {}
+
+- public static void register(CommandDispatcher<CommandSourceStack> commanddispatcher, CommandBuildContext commandbuildcontext) {
+- commanddispatcher.register((LiteralArgumentBuilder) ((LiteralArgumentBuilder) ((LiteralArgumentBuilder) Commands.literal("effect").requires((commandsourcestack) -> {
+- return commandsourcestack.hasPermission(2);
+- })).then(((LiteralArgumentBuilder) Commands.literal("clear").executes((commandcontext) -> {
++ public static void register(CommandDispatcher<CommandSourceStack> dispatcher, CommandBuildContext context) {
++ dispatcher.register((LiteralArgumentBuilder) ((LiteralArgumentBuilder) ((LiteralArgumentBuilder) net.minecraft.commands.Commands.literal("effect").requires((commandlistenerwrapper) -> {
++ return commandlistenerwrapper.hasPermission(2);
++ })).then(((LiteralArgumentBuilder) net.minecraft.commands.Commands.literal("clear").executes((commandcontext) -> {
+ return clearEffects((CommandSourceStack) commandcontext.getSource(), ImmutableList.of(((CommandSourceStack) commandcontext.getSource()).getEntityOrException()));
+- })).then(((RequiredArgumentBuilder) Commands.argument("targets", EntityArgument.entities()).executes((commandcontext) -> {
++ })).then(((RequiredArgumentBuilder) net.minecraft.commands.Commands.argument("targets", EntityArgument.entities()).executes((commandcontext) -> {
+ return clearEffects((CommandSourceStack) commandcontext.getSource(), EntityArgument.getEntities(commandcontext, "targets"));
+- })).then(Commands.argument("effect", ResourceArgument.resource(commandbuildcontext, Registries.MOB_EFFECT)).executes((commandcontext) -> {
++ })).then(net.minecraft.commands.Commands.argument("effect", ResourceArgument.resource(context, Registries.MOB_EFFECT)).executes((commandcontext) -> {
+ return clearEffect((CommandSourceStack) commandcontext.getSource(), EntityArgument.getEntities(commandcontext, "targets"), ResourceArgument.getMobEffect(commandcontext, "effect"));
+- }))))).then(Commands.literal("give").then(Commands.argument("targets", EntityArgument.entities()).then(((RequiredArgumentBuilder) ((RequiredArgumentBuilder) Commands.argument("effect", ResourceArgument.resource(commandbuildcontext, Registries.MOB_EFFECT)).executes((commandcontext) -> {
++ }))))).then(net.minecraft.commands.Commands.literal("give").then(net.minecraft.commands.Commands.argument("targets", EntityArgument.entities()).then(((RequiredArgumentBuilder) ((RequiredArgumentBuilder) net.minecraft.commands.Commands.argument("effect", ResourceArgument.resource(context, Registries.MOB_EFFECT)).executes((commandcontext) -> {
+ return giveEffect((CommandSourceStack) commandcontext.getSource(), EntityArgument.getEntities(commandcontext, "targets"), ResourceArgument.getMobEffect(commandcontext, "effect"), (Integer) null, 0, true);
+- })).then(((RequiredArgumentBuilder) Commands.argument("seconds", IntegerArgumentType.integer(1, 1000000)).executes((commandcontext) -> {
++ })).then(((RequiredArgumentBuilder) net.minecraft.commands.Commands.argument("seconds", IntegerArgumentType.integer(1, 1000000)).executes((commandcontext) -> {
+ return giveEffect((CommandSourceStack) commandcontext.getSource(), EntityArgument.getEntities(commandcontext, "targets"), ResourceArgument.getMobEffect(commandcontext, "effect"), IntegerArgumentType.getInteger(commandcontext, "seconds"), 0, true);
+- })).then(((RequiredArgumentBuilder) Commands.argument("amplifier", IntegerArgumentType.integer(0, 255)).executes((commandcontext) -> {
++ })).then(((RequiredArgumentBuilder) net.minecraft.commands.Commands.argument("amplifier", IntegerArgumentType.integer(0, 255)).executes((commandcontext) -> {
+ return giveEffect((CommandSourceStack) commandcontext.getSource(), EntityArgument.getEntities(commandcontext, "targets"), ResourceArgument.getMobEffect(commandcontext, "effect"), IntegerArgumentType.getInteger(commandcontext, "seconds"), IntegerArgumentType.getInteger(commandcontext, "amplifier"), true);
+- })).then(Commands.argument("hideParticles", BoolArgumentType.bool()).executes((commandcontext) -> {
++ })).then(net.minecraft.commands.Commands.argument("hideParticles", BoolArgumentType.bool()).executes((commandcontext) -> {
+ return giveEffect((CommandSourceStack) commandcontext.getSource(), EntityArgument.getEntities(commandcontext, "targets"), ResourceArgument.getMobEffect(commandcontext, "effect"), IntegerArgumentType.getInteger(commandcontext, "seconds"), IntegerArgumentType.getInteger(commandcontext, "amplifier"), !BoolArgumentType.getBool(commandcontext, "hideParticles"));
+- }))))).then(((LiteralArgumentBuilder) Commands.literal("infinite").executes((commandcontext) -> {
++ }))))).then(((LiteralArgumentBuilder) net.minecraft.commands.Commands.literal("infinite").executes((commandcontext) -> {
+ return giveEffect((CommandSourceStack) commandcontext.getSource(), EntityArgument.getEntities(commandcontext, "targets"), ResourceArgument.getMobEffect(commandcontext, "effect"), -1, 0, true);
+- })).then(((RequiredArgumentBuilder) Commands.argument("amplifier", IntegerArgumentType.integer(0, 255)).executes((commandcontext) -> {
++ })).then(((RequiredArgumentBuilder) net.minecraft.commands.Commands.argument("amplifier", IntegerArgumentType.integer(0, 255)).executes((commandcontext) -> {
+ return giveEffect((CommandSourceStack) commandcontext.getSource(), EntityArgument.getEntities(commandcontext, "targets"), ResourceArgument.getMobEffect(commandcontext, "effect"), -1, IntegerArgumentType.getInteger(commandcontext, "amplifier"), true);
+- })).then(Commands.argument("hideParticles", BoolArgumentType.bool()).executes((commandcontext) -> {
++ })).then(net.minecraft.commands.Commands.argument("hideParticles", BoolArgumentType.bool()).executes((commandcontext) -> {
+ return giveEffect((CommandSourceStack) commandcontext.getSource(), EntityArgument.getEntities(commandcontext, "targets"), ResourceArgument.getMobEffect(commandcontext, "effect"), -1, IntegerArgumentType.getInteger(commandcontext, "amplifier"), !BoolArgumentType.getBool(commandcontext, "hideParticles"));
+ }))))))));
+ }
+
+- private static int giveEffect(CommandSourceStack commandsourcestack, Collection<? extends Entity> collection, Holder<MobEffect> holder, @Nullable Integer integer, int i, boolean flag) throws CommandSyntaxException {
+- MobEffect mobeffect = (MobEffect) holder.value();
++ private static int giveEffect(CommandSourceStack source, Collection<? extends Entity> targets, Holder<MobEffect> effect, @Nullable Integer seconds, int amplifier, boolean showParticles) throws CommandSyntaxException {
++ MobEffect mobeffectlist = (MobEffect) effect.value();
+ int j = 0;
+ int k;
+
+- if (integer != null) {
+- if (mobeffect.isInstantenous()) {
+- k = integer;
+- } else if (integer == -1) {
++ if (seconds != null) {
++ if (mobeffectlist.isInstantenous()) {
++ k = seconds;
++ } else if (seconds == -1) {
+ k = -1;
+ } else {
+- k = integer * 20;
++ k = seconds * 20;
+ }
+- } else if (mobeffect.isInstantenous()) {
++ } else if (mobeffectlist.isInstantenous()) {
+ k = 1;
+ } else {
+ k = 600;
+ }
+
+- Iterator iterator = collection.iterator();
++ Iterator iterator = targets.iterator();
+
+ while (iterator.hasNext()) {
+ Entity entity = (Entity) iterator.next();
+
+ if (entity instanceof LivingEntity) {
+- MobEffectInstance mobeffectinstance = new MobEffectInstance(mobeffect, k, i, false, flag);
++ MobEffectInstance mobeffect = new MobEffectInstance(mobeffectlist, k, amplifier, false, showParticles);
+
+- if (((LivingEntity) entity).addEffect(mobeffectinstance, commandsourcestack.getEntity())) {
++ if (((LivingEntity) entity).addEffect(mobeffect, source.getEntity(), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.COMMAND)) { // CraftBukkit
+ ++j;
+ }
+ }
+@@ -94,13 +93,13 @@
+ if (j == 0) {
+ throw EffectCommands.ERROR_GIVE_FAILED.create();
+ } else {
+- if (collection.size() == 1) {
+- commandsourcestack.sendSuccess(() -> {
+- return Component.translatable("commands.effect.give.success.single", mobeffect.getDisplayName(), ((Entity) collection.iterator().next()).getDisplayName(), k / 20);
++ if (targets.size() == 1) {
++ source.sendSuccess(() -> {
++ return Component.translatable("commands.effect.give.success.single", mobeffectlist.getDisplayName(), ((Entity) targets.iterator().next()).getDisplayName(), k / 20);
+ }, true);
+ } else {
+- commandsourcestack.sendSuccess(() -> {
+- return Component.translatable("commands.effect.give.success.multiple", mobeffect.getDisplayName(), collection.size(), k / 20);
++ source.sendSuccess(() -> {
++ return Component.translatable("commands.effect.give.success.multiple", mobeffectlist.getDisplayName(), targets.size(), k / 20);
+ }, true);
+ }
+
+@@ -108,14 +107,14 @@
+ }
+ }
+
+- private static int clearEffects(CommandSourceStack commandsourcestack, Collection<? extends Entity> collection) throws CommandSyntaxException {
++ private static int clearEffects(CommandSourceStack source, Collection<? extends Entity> targets) throws CommandSyntaxException {
+ int i = 0;
+- Iterator iterator = collection.iterator();
++ Iterator iterator = targets.iterator();
+
+ while (iterator.hasNext()) {
+ Entity entity = (Entity) iterator.next();
+
+- if (entity instanceof LivingEntity && ((LivingEntity) entity).removeAllEffects()) {
++ if (entity instanceof LivingEntity && ((LivingEntity) entity).removeAllEffects(org.bukkit.event.entity.EntityPotionEffectEvent.Cause.COMMAND)) { // CraftBukkit
+ ++i;
+ }
+ }
+@@ -123,13 +122,13 @@
+ if (i == 0) {
+ throw EffectCommands.ERROR_CLEAR_EVERYTHING_FAILED.create();
+ } else {
+- if (collection.size() == 1) {
+- commandsourcestack.sendSuccess(() -> {
+- return Component.translatable("commands.effect.clear.everything.success.single", ((Entity) collection.iterator().next()).getDisplayName());
++ if (targets.size() == 1) {
++ source.sendSuccess(() -> {
++ return Component.translatable("commands.effect.clear.everything.success.single", ((Entity) targets.iterator().next()).getDisplayName());
+ }, true);
+ } else {
+- commandsourcestack.sendSuccess(() -> {
+- return Component.translatable("commands.effect.clear.everything.success.multiple", collection.size());
++ source.sendSuccess(() -> {
++ return Component.translatable("commands.effect.clear.everything.success.multiple", targets.size());
+ }, true);
+ }
+
+@@ -137,15 +136,15 @@
+ }
+ }
+
+- private static int clearEffect(CommandSourceStack commandsourcestack, Collection<? extends Entity> collection, Holder<MobEffect> holder) throws CommandSyntaxException {
+- MobEffect mobeffect = (MobEffect) holder.value();
++ private static int clearEffect(CommandSourceStack source, Collection<? extends Entity> targets, Holder<MobEffect> effect) throws CommandSyntaxException {
++ MobEffect mobeffectlist = (MobEffect) effect.value();
+ int i = 0;
+- Iterator iterator = collection.iterator();
++ Iterator iterator = targets.iterator();
+
+ while (iterator.hasNext()) {
+ Entity entity = (Entity) iterator.next();
+
+- if (entity instanceof LivingEntity && ((LivingEntity) entity).removeEffect(mobeffect)) {
++ if (entity instanceof LivingEntity && ((LivingEntity) entity).removeEffect(mobeffectlist, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.COMMAND)) { // CraftBukkit
+ ++i;
+ }
+ }
+@@ -153,13 +152,13 @@
+ if (i == 0) {
+ throw EffectCommands.ERROR_CLEAR_SPECIFIC_FAILED.create();
+ } else {
+- if (collection.size() == 1) {
+- commandsourcestack.sendSuccess(() -> {
+- return Component.translatable("commands.effect.clear.specific.success.single", mobeffect.getDisplayName(), ((Entity) collection.iterator().next()).getDisplayName());
++ if (targets.size() == 1) {
++ source.sendSuccess(() -> {
++ return Component.translatable("commands.effect.clear.specific.success.single", mobeffectlist.getDisplayName(), ((Entity) targets.iterator().next()).getDisplayName());
+ }, true);
+ } else {
+- commandsourcestack.sendSuccess(() -> {
+- return Component.translatable("commands.effect.clear.specific.success.multiple", mobeffect.getDisplayName(), collection.size());
++ source.sendSuccess(() -> {
++ return Component.translatable("commands.effect.clear.specific.success.multiple", mobeffectlist.getDisplayName(), targets.size());
+ }, true);
+ }
+