mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-17 16:37:43 +01:00
Add permissions for sign color codes
This commit is contained in:
@@ -45,3 +45,12 @@ need to be granted the permissions you want them to have using a permissions plu
|
||||
* **purpur.sign.click.opens.editor**
|
||||
- **description**: Allows players to open the sign editor when right clicking a sign
|
||||
while holding a sign.
|
||||
|
||||
* **purpur.sign.color**
|
||||
- **description**: Allows players to use color codes on signs
|
||||
|
||||
* **purpur.sign.style**
|
||||
- **description**: Allows players to use style codes on signs (except the magic/obfuscated code)
|
||||
|
||||
* **purpur.sign.magic**
|
||||
- **description**: Allows players to use the magic/obfuscated style code on signs
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
From 5ea636f8b88a6d8259fb3a9a5c77e5deb3ede4bb Mon Sep 17 00:00:00 2001
|
||||
From 9cb17aad55df0f36335066132488c86a802cfdae Mon Sep 17 00:00:00 2001
|
||||
From: William Blake Galbreath <blake.galbreath@gmail.com>
|
||||
Date: Thu, 6 Jun 2019 17:40:30 -0500
|
||||
Subject: [PATCH] Allow color codes on signs
|
||||
|
||||
---
|
||||
.../java/net/minecraft/server/EntityPlayer.java | 1 +
|
||||
.../net/minecraft/server/PlayerConnection.java | 1 +
|
||||
.../net/minecraft/server/PlayerConnection.java | 8 ++++++++
|
||||
.../java/net/minecraft/server/TileEntitySign.java | 14 ++++++++++++++
|
||||
.../java/net/pl3x/purpur/PurpurWorldConfig.java | 5 +++++
|
||||
4 files changed, 21 insertions(+)
|
||||
4 files changed, 28 insertions(+)
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java
|
||||
index 5c4a4be1b..af3c7e595 100644
|
||||
index 7801879c8..e0e94ca11 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityPlayer.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityPlayer.java
|
||||
@@ -1120,6 +1120,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
||||
@@ -23,14 +23,21 @@ index 5c4a4be1b..af3c7e595 100644
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
|
||||
index e7b8b2e99..520490d59 100644
|
||||
index e7b8b2e99..3405e8a85 100644
|
||||
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
|
||||
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
|
||||
@@ -2561,6 +2561,7 @@ public class PlayerConnection implements PacketListenerPlayIn {
|
||||
@@ -2561,6 +2561,14 @@ public class PlayerConnection implements PacketListenerPlayIn {
|
||||
}
|
||||
}
|
||||
// Paper end
|
||||
+ if (worldserver.purpurConfig.allowSignColors) lines[i] = org.bukkit.ChatColor.translateAlternateColorCodes('&', astring[i]); else // Purpur - allow sign colors
|
||||
+ // Purpur start
|
||||
+ if (worldserver.purpurConfig.allowSignColors) {
|
||||
+ lines[i] = astring[i];
|
||||
+ if (player.hasPermission("purpur.sign.color")) lines[i] = lines[i].replaceAll("(?i)&([0-9a-fr])", "\u00a7$1");
|
||||
+ if (player.hasPermission("purpur.sign.style")) lines[i] = lines[i].replaceAll("(?i)&([l-or])", "\u00a7$1");
|
||||
+ if (player.hasPermission("purpur.sign.magic")) lines[i] = lines[i].replaceAll("(?i)&([kr])", "\u00a7$1");
|
||||
+ } else
|
||||
+ // Purpur end
|
||||
lines[i] = SharedConstants.a(astring[i]); //Paper - Replaced with anvil color stripping method to stop exploits that allow colored signs to be created.
|
||||
}
|
||||
SignChangeEvent event = new SignChangeEvent((org.bukkit.craftbukkit.block.CraftBlock) player.getWorld().getBlockAt(x, y, z), this.server.getPlayer(this.player), lines);
|
||||
@@ -60,7 +67,7 @@ index 0a8d9b52d..65771ed9e 100644
|
||||
@Override
|
||||
public PacketPlayOutTileEntityData getUpdatePacket() {
|
||||
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
index 383e7d5d5..f455c5f67 100644
|
||||
index 383e7d5d5..fe0136c63 100644
|
||||
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
@@ -98,4 +98,9 @@ public class PurpurWorldConfig {
|
||||
@@ -68,7 +75,7 @@ index 383e7d5d5..f455c5f67 100644
|
||||
campfiresGoOutInRain = getBoolean("campfires-go-out-in-rain", campfiresGoOutInRain);
|
||||
}
|
||||
+
|
||||
+ public boolean allowSignColors = true;
|
||||
+ public boolean allowSignColors = false;
|
||||
+ private void allowSignColors() {
|
||||
+ allowSignColors = getBoolean("allow-sign-colors", allowSignColors);
|
||||
+ }
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
From 681f21db603f6b0553f3bd9dedbbfb8a76a5a044 Mon Sep 17 00:00:00 2001
|
||||
From 241a8e7f7837df2514070aada717cae3c338c50c Mon Sep 17 00:00:00 2001
|
||||
From: William Blake Galbreath <blake.galbreath@gmail.com>
|
||||
Date: Fri, 21 Jun 2019 14:37:10 -0500
|
||||
Subject: [PATCH] Allow soil to moisten from water directly under it
|
||||
@@ -9,7 +9,7 @@ Subject: [PATCH] Allow soil to moisten from water directly under it
|
||||
2 files changed, 12 insertions(+), 12 deletions(-)
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/BlockSoil.java b/src/main/java/net/minecraft/server/BlockSoil.java
|
||||
index 2fc6e210..54f91390 100644
|
||||
index 2fc6e210d..54f913901 100644
|
||||
--- a/src/main/java/net/minecraft/server/BlockSoil.java
|
||||
+++ b/src/main/java/net/minecraft/server/BlockSoil.java
|
||||
@@ -112,19 +112,14 @@ public class BlockSoil extends Block {
|
||||
@@ -40,7 +40,7 @@ index 2fc6e210..54f91390 100644
|
||||
|
||||
@Override
|
||||
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
index bc782e2f..ed42fe32 100644
|
||||
index 2c13d1a0c..1605b7707 100644
|
||||
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
@@ -99,6 +99,11 @@ public class PurpurWorldConfig {
|
||||
@@ -52,9 +52,9 @@ index bc782e2f..ed42fe32 100644
|
||||
+ allowMoistSoilFromWaterBelow = getBoolean("allow-moist-soil-from-water-below", allowMoistSoilFromWaterBelow);
|
||||
+ }
|
||||
+
|
||||
public boolean allowSignColors = true;
|
||||
public boolean allowSignColors = false;
|
||||
private void allowSignColors() {
|
||||
allowSignColors = getBoolean("allow-sign-colors", allowSignColors);
|
||||
--
|
||||
2.20.1
|
||||
2.23.0.rc1
|
||||
|
||||
|
||||
Reference in New Issue
Block a user