mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-19 17:37:42 +01:00
Add portal permission bypass
This commit is contained in:
committed by
granny
parent
407adcda52
commit
d760f5436f
@@ -1,43 +0,0 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
||||||
From: William Blake Galbreath <blake.galbreath@gmail.com>
|
|
||||||
Date: Thu, 7 Dec 2023 14:53:48 -0800
|
|
||||||
Subject: [PATCH] Add portal permission bypass
|
|
||||||
|
|
||||||
|
|
||||||
diff --git a/net/minecraft/world/entity/player/Player.java b/net/minecraft/world/entity/player/Player.java
|
|
||||||
index a8b5869160cb75c314459403a0a229ec68b69086..ee88c493119a4a4629d6456c8698dd89e4f477f4 100644
|
|
||||||
--- a/net/minecraft/world/entity/player/Player.java
|
|
||||||
+++ b/net/minecraft/world/entity/player/Player.java
|
|
||||||
@@ -202,6 +202,7 @@ public abstract class Player extends LivingEntity {
|
|
||||||
public net.kyori.adventure.util.TriState flyingFallDamage = net.kyori.adventure.util.TriState.NOT_SET; // Paper - flying fall damage
|
|
||||||
public int sixRowEnderchestSlotCount = -1; // Purpur
|
|
||||||
public int burpDelay = 0; // Purpur
|
|
||||||
+ public boolean canPortalInstant = false; // Purpur
|
|
||||||
|
|
||||||
// CraftBukkit start
|
|
||||||
public boolean fauxSleeping;
|
|
||||||
diff --git a/net/minecraft/world/level/block/NetherPortalBlock.java b/net/minecraft/world/level/block/NetherPortalBlock.java
|
|
||||||
index 2d53c57c961fa8977e37931775863665381595eb..6c10860aee8b8fac4089fb7f1506c890fb3f5308 100644
|
|
||||||
--- a/net/minecraft/world/level/block/NetherPortalBlock.java
|
|
||||||
+++ b/net/minecraft/world/level/block/NetherPortalBlock.java
|
|
||||||
@@ -137,7 +137,7 @@ public class NetherPortalBlock extends Block implements Portal {
|
|
||||||
@Override
|
|
||||||
public int getPortalTransitionTime(ServerLevel world, Entity entity) {
|
|
||||||
if (entity instanceof Player entityhuman) {
|
|
||||||
- return Math.max(0, world.getGameRules().getInt(entityhuman.getAbilities().invulnerable ? GameRules.RULE_PLAYERS_NETHER_PORTAL_CREATIVE_DELAY : GameRules.RULE_PLAYERS_NETHER_PORTAL_DEFAULT_DELAY));
|
|
||||||
+ return Math.max(0, entityhuman.canPortalInstant ? 1 : world.getGameRules().getInt(entityhuman.getAbilities().invulnerable ? GameRules.RULE_PLAYERS_NETHER_PORTAL_CREATIVE_DELAY : GameRules.RULE_PLAYERS_NETHER_PORTAL_DEFAULT_DELAY)); // Purpur
|
|
||||||
} else {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
|
|
||||||
index e345cdbfab44a0f5da80d738798dbb4424b7ab5c..856f12eb276c214f2f57a58a89a4da9eea34db2d 100644
|
|
||||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
|
|
||||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
|
|
||||||
@@ -273,6 +273,7 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
|
|
||||||
@Override
|
|
||||||
public void recalculatePermissions() {
|
|
||||||
this.perm.recalculatePermissions();
|
|
||||||
+ getHandle().canPortalInstant = hasPermission("purpur.portal.instant"); // Purpur
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@@ -65,6 +65,8 @@ public final class PurpurPermissions {
|
|||||||
DefaultPermissions.registerPermission("allow.powered.creeper", "Allows the user to toggle creeper powered state", PermissionDefault.FALSE, powered);
|
DefaultPermissions.registerPermission("allow.powered.creeper", "Allows the user to toggle creeper powered state", PermissionDefault.FALSE, powered);
|
||||||
powered.recalculatePermissibles();
|
powered.recalculatePermissibles();
|
||||||
|
|
||||||
|
DefaultPermissions.registerPermission(PREFIX + "portal.instant", "Allows the user to bypass portal wait time", PermissionDefault.FALSE, purpur);
|
||||||
|
|
||||||
purpur.recalculatePermissibles();
|
purpur.recalculatePermissibles();
|
||||||
return purpur;
|
return purpur;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
--- a/net/minecraft/world/entity/player/Player.java
|
--- a/net/minecraft/world/entity/player/Player.java
|
||||||
+++ b/net/minecraft/world/entity/player/Player.java
|
+++ b/net/minecraft/world/entity/player/Player.java
|
||||||
@@ -200,11 +_,19 @@
|
@@ -200,11 +_,20 @@
|
||||||
private int currentImpulseContextResetGraceTime;
|
private int currentImpulseContextResetGraceTime;
|
||||||
public boolean affectsSpawning = true; // Paper - Affects Spawning API
|
public boolean affectsSpawning = true; // Paper - Affects Spawning API
|
||||||
public net.kyori.adventure.util.TriState flyingFallDamage = net.kyori.adventure.util.TriState.NOT_SET; // Paper - flying fall damage
|
public net.kyori.adventure.util.TriState flyingFallDamage = net.kyori.adventure.util.TriState.NOT_SET; // Paper - flying fall damage
|
||||||
+ public int burpDelay = 0; // Purpur - Burp delay
|
+ public int burpDelay = 0; // Purpur - Burp delay
|
||||||
|
+ public boolean canPortalInstant = false; // Purpur - Add portal permission bypass
|
||||||
|
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
public boolean fauxSleeping;
|
public boolean fauxSleeping;
|
||||||
|
|||||||
@@ -9,3 +9,12 @@
|
|||||||
while (level.getBlockState(pos).is(this)) {
|
while (level.getBlockState(pos).is(this)) {
|
||||||
pos = pos.below();
|
pos = pos.below();
|
||||||
}
|
}
|
||||||
|
@@ -129,7 +_,7 @@
|
||||||
|
@Override
|
||||||
|
public int getPortalTransitionTime(ServerLevel level, Entity entity) {
|
||||||
|
return entity instanceof Player player
|
||||||
|
- ? Math.max(
|
||||||
|
+ ? player.canPortalInstant ? 1 : Math.max( // Purpur - Add portal permission bypass
|
||||||
|
0,
|
||||||
|
level.getGameRules()
|
||||||
|
.getInt(
|
||||||
|
|||||||
@@ -0,0 +1,10 @@
|
|||||||
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
|
||||||
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
|
||||||
|
@@ -273,6 +_,7 @@
|
||||||
|
@Override
|
||||||
|
public void recalculatePermissions() {
|
||||||
|
this.perm.recalculatePermissions();
|
||||||
|
+ getHandle().canPortalInstant = hasPermission("purpur.portal.instant"); // Purpur - Add portal permission bypass
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
Reference in New Issue
Block a user