Skip to content

Commit

Permalink
Some fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Dreeam-qwq committed Jun 21, 2024
1 parent 11cbe4a commit 8826f78
Show file tree
Hide file tree
Showing 4 changed files with 87 additions and 135 deletions.
67 changes: 52 additions & 15 deletions patches/server/0010-Purpur-Server-Changes.patch
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,32 @@ Remove-Timings.patch
Remove-Mojang-Profiler.patch
MC-121706-Fix-mobs-not-looking-up-and-down-when-stra.patch

diff --git a/build.gradle.kts b/build.gradle.kts
index 397d93b63e412abb96cc8366c51c3927d760afb8..8c4d68b7293aba6622689b81c8b7cab08b4b92dc 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -57,6 +57,12 @@ dependencies {
runtimeOnly("org.apache.maven.resolver:maven-resolver-connector-basic:1.9.18")
runtimeOnly("org.apache.maven.resolver:maven-resolver-transport-http:1.9.18")

+ // Purpur start
+ implementation("org.mozilla:rhino-runtime:1.7.15")
+ implementation("org.mozilla:rhino-engine:1.7.15")
+ implementation("dev.omega24:upnp4j:1.0")
+ // Purpur end
+
testImplementation("io.github.classgraph:classgraph:4.8.47") // Paper - mob goal test
testImplementation("org.junit.jupiter:junit-jupiter:5.10.2")
testImplementation("org.hamcrest:hamcrest:2.2")
@@ -164,7 +170,7 @@ fun TaskContainer.registerRunTask(
name: String,
block: JavaExec.() -> Unit
): TaskProvider<JavaExec> = register<JavaExec>(name) {
- group = "paper"
+ group = "paperweight" // Purpur
mainClass.set("org.bukkit.craftbukkit.Main")
standardInput = System.`in`
workingDir = rootProject.layout.projectDirectory
diff --git a/src/log4jPlugins/java/org/purpurmc/purpur/gui/HighlightErrorConverter.java b/src/log4jPlugins/java/org/purpurmc/purpur/gui/HighlightErrorConverter.java
new file mode 100644
index 0000000000000000000000000000000000000000..15a226e3854d731f7724025ea3459c8ace07630c
Expand Down Expand Up @@ -136,6 +162,18 @@ index 06455d65c4605ce092bf5300d432087f24186741..750fd2809f6d5d5896904cad0f65029b

ignored.add("goal_selector_1");
ignored.add("goal_selector_2");
diff --git a/src/main/java/io/papermc/paper/ServerBuildInfoImpl.java b/src/main/java/io/papermc/paper/ServerBuildInfoImpl.java
index 023016de1732f0b299428ec0544128cc17407333..9d003c2ae45a057c0274a34fe5012cf17d1a2681 100644
--- a/src/main/java/io/papermc/paper/ServerBuildInfoImpl.java
+++ b/src/main/java/io/papermc/paper/ServerBuildInfoImpl.java
@@ -32,6 +32,7 @@ public record ServerBuildInfoImpl(

private static final String BRAND_PAPER_NAME = "Paper";
private static final String BRAND_GALE_NAME = "Gale"; // Gale - branding changes
+ private static final String BRAND_PURPUR_NAME = "Purpur"; // Purpur
private static final String BRAND_LEAF_NAME = "Leaf"; // Leaf

private static final String BUILD_DEV = "DEV";
diff --git a/src/main/java/io/papermc/paper/command/PaperPluginsCommand.java b/src/main/java/io/papermc/paper/command/PaperPluginsCommand.java
index f0fce4113fb07c64adbec029d177c236cbdcbae8..e94224ed280247ee69dfdff8dc960f2b8729be33 100644
--- a/src/main/java/io/papermc/paper/command/PaperPluginsCommand.java
Expand Down Expand Up @@ -1587,25 +1625,25 @@ index a720a05c47b2137a07515461960603cc5c939d16..b66fdb789fcb460d63fd81540112d655
try {
String channels = payload.toString(com.google.common.base.Charsets.UTF_8);
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index deb4282880aa5f28100a202c73514c892f487be0..dc4a4d7de838d8756b0f5cbbc149b1d5cd2b4dd6 100644
index deb4282880aa5f28100a202c73514c892f487be0..554bff40f0dab4f49ed201cc6d6508ec0ec70f0a 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -337,6 +337,20 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
private boolean justTeleported = false;
// CraftBukkit end

+ // Purpur start
+ // Purpur start
+ private final com.google.common.cache.LoadingCache<CraftPlayer, Boolean> kickPermissionCache = com.google.common.cache.CacheBuilder.newBuilder()
+ .maximumSize(1000)
+ .expireAfterWrite(1, java.util.concurrent.TimeUnit.MINUTES)
+ .build(
+ new com.google.common.cache.CacheLoader<>() {
+ @Override
+ public Boolean load(CraftPlayer player) {
+ return player.hasPermission("purpur.bypassIdleKick");
+ }
+ }
+ );
+ .maximumSize(1000)
+ .expireAfterWrite(1, java.util.concurrent.TimeUnit.MINUTES)
+ .build(
+ new com.google.common.cache.CacheLoader<>() {
+ @Override
+ public Boolean load(CraftPlayer player) {
+ return player.hasPermission("purpur.bypassIdleKick");
+ }
+ }
+ );
+ // Purpur end
+
@Override
Expand Down Expand Up @@ -2574,10 +2612,10 @@ index 15844971ce2cca8c679ad3aaa2dfe160e6d0b564..3003f2ab38008b761bee49823b49edae
if (optional.isPresent()) {
ItemStack itemstack = ((EnchantedItemInUse) optional.get()).itemStack();
diff --git a/src/main/java/net/minecraft/world/entity/GlowSquid.java b/src/main/java/net/minecraft/world/entity/GlowSquid.java
index 09fdea983772612ef3fff6b2da3cf469a34e4ec0..3e2ea26c23e88c395856b65001f2895db6a52bd4 100644
index 09fdea983772612ef3fff6b2da3cf469a34e4ec0..b69d924fa8034eabbf4aab8d3434f4f4e2529373 100644
--- a/src/main/java/net/minecraft/world/entity/GlowSquid.java
+++ b/src/main/java/net/minecraft/world/entity/GlowSquid.java
@@ -23,6 +23,39 @@ public class GlowSquid extends Squid {
@@ -23,6 +23,38 @@ public class GlowSquid extends Squid {
super(type, world);
}

Expand All @@ -2587,7 +2625,6 @@ index 09fdea983772612ef3fff6b2da3cf469a34e4ec0..3e2ea26c23e88c395856b65001f2895d
+ return level().purpurConfig.glowSquidRidable;
+ }
+
+
+ @Override
+ public boolean isControllable() {
+ return level().purpurConfig.glowSquidControllable;
Expand Down
14 changes: 8 additions & 6 deletions patches/server/0011-Fix-Pufferfish-and-Purpur-patches.patch
Original file line number Diff line number Diff line change
Expand Up @@ -86,15 +86,16 @@ index 096c89bd01cec2abd151bf6fffc4847d1bcd548f..cd0a8a6a1be75cab8bbb8ee3ac17bb73
this.values[this.vp++ & 0xFF] = (int)(l * 100L / Runtime.getRuntime().maxMemory());
this.repaint();
diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
index 8367edebdfa2f022bcda1ec2b0e7881285d8bb9c..e1d2c90295580e130c7f317fa1164c395caea85f 100644
index 8367edebdfa2f022bcda1ec2b0e7881285d8bb9c..023533e9ea342c8ff0d993544c45416af88bf5ab 100644
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
@@ -458,7 +458,7 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon
@@ -458,7 +458,8 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon
this.lastSpawnState = spawnercreature_d;
// Gale start - MultiPaper - skip unnecessary mob spawning computations
} else {
- spawnercreature_d = null;
+ lastSpawnState = null; // Leaf - Pufferfish - Optimize mob spawning
+ spawnercreature_d = null; // Dreeam TODO
+ //lastSpawnState = null; // Leaf - Pufferfish - Optimize mob spawning // Dreeam TODO
}
// Gale end - MultiPaper - skip unnecessary mob spawning computations

Expand Down Expand Up @@ -293,15 +294,16 @@ index 1e1824eb80696452951cdbbdacad952ae0a7482b..b38110d4f01cae6746ccd38b5ae047cf
@Override
protected void registerGoals() {
diff --git a/src/main/java/net/minecraft/world/entity/npc/VillagerProfession.java b/src/main/java/net/minecraft/world/entity/npc/VillagerProfession.java
index 3ca83269311cbc18c9ef3ce62cff6a2d4dc0a683..a636ab87d21c67b152b40b77e62fa8043ca4211e 100644
index 3ca83269311cbc18c9ef3ce62cff6a2d4dc0a683..28f6b54e16fa49388690679fb7a25941d0868add 100644
--- a/src/main/java/net/minecraft/world/entity/npc/VillagerProfession.java
+++ b/src/main/java/net/minecraft/world/entity/npc/VillagerProfession.java
@@ -31,7 +31,7 @@ public record VillagerProfession(
@@ -31,7 +31,8 @@ public record VillagerProfession(
public static final VillagerProfession ARMORER = register("armorer", PoiTypes.ARMORER, SoundEvents.VILLAGER_WORK_ARMORER);
public static final VillagerProfession BUTCHER = register("butcher", PoiTypes.BUTCHER, SoundEvents.VILLAGER_WORK_BUTCHER);
public static final VillagerProfession CARTOGRAPHER = register("cartographer", PoiTypes.CARTOGRAPHER, SoundEvents.VILLAGER_WORK_CARTOGRAPHER);
- public static final VillagerProfession CLERIC = register("cleric", PoiTypes.CLERIC, ImmutableSet.of(Items.NETHER_WART), ImmutableSet.of(Blocks.SOUL_SAND), SoundEvents.VILLAGER_WORK_CLERIC); // Purpur
+ public static final VillagerProfession CLERIC = register("cleric", PoiTypes.CLERIC, new Item[] {Items.NETHER_WART}, Blocks.SOUL_SAND, SoundEvents.VILLAGER_WORK_CLERIC); // Purpur // Leaf - sync with Gale's Optimize-villager-data-storage.patch
+ public static final VillagerProfession CLERIC = register("cleric", PoiTypes.CLERIC, ImmutableSet.of(Items.NETHER_WART), ImmutableSet.of(Blocks.SOUL_SAND), SoundEvents.VILLAGER_WORK_CLERIC); // Purpur // Dreeam TODO
+ //public static final VillagerProfession CLERIC = register("cleric", PoiTypes.CLERIC, new Item[] {Items.NETHER_WART}, Blocks.SOUL_SAND, SoundEvents.VILLAGER_WORK_CLERIC); // Purpur // Leaf - sync with Gale's Optimize-villager-data-storage.patch // Dreeam TODO
public static final VillagerProfession FARMER = register(
"farmer",
PoiTypes.FARMER,
Expand Down
Loading

0 comments on commit 8826f78

Please sign in to comment.