Skip to content

Commit 5a6ab97

Browse files
authored
Add config to remove player as vehicle restriction in /ride (#12327)
1 parent 515e12c commit 5a6ab97

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
--- a/net/minecraft/server/commands/RideCommand.java
2+
+++ b/net/minecraft/server/commands/RideCommand.java
3+
@@ -58,7 +_,7 @@
4+
Entity vehicle1 = target.getVehicle();
5+
if (vehicle1 != null) {
6+
throw ERROR_ALREADY_RIDING.create(target.getDisplayName(), vehicle1.getDisplayName());
7+
- } else if (vehicle.getType() == EntityType.PLAYER) {
8+
+ } else if (vehicle.getType() == EntityType.PLAYER && !io.papermc.paper.configuration.GlobalConfiguration.get().commands.rideCommandAllowPlayerAsVehicle) { // Paper - allow player as vehicle
9+
throw ERROR_MOUNTING_PLAYER.create();
10+
} else if (target.getSelfAndPassengers().anyMatch(passenger -> passenger == vehicle)) {
11+
throw ERROR_MOUNTING_LOOP.create();

paper-server/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
import net.minecraft.network.protocol.Packet;
1313
import net.minecraft.network.protocol.game.ServerboundPlaceRecipePacket;
1414
import net.minecraft.resources.ResourceLocation;
15-
import net.minecraft.world.item.Items;
1615
import org.jspecify.annotations.Nullable;
1716
import org.slf4j.Logger;
1817
import org.spongepowered.configurate.objectmapping.ConfigSerializable;
@@ -202,6 +201,8 @@ public enum CompressionFormat {
202201
public class Commands extends ConfigurationPart {
203202
public boolean suggestPlayerNamesWhenNullTabCompletions = true;
204203
public boolean timeCommandAffectsAllWorlds = false;
204+
@Comment("Allow mounting entities to a player in the Vanilla '/ride' command.")
205+
public boolean rideCommandAllowPlayerAsVehicle = false;
205206
}
206207

207208
public Logging logging;

0 commit comments

Comments
 (0)