mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-18 00:47:42 +01:00
Upstream has released updates that appear to apply and compile correctly Paper Changes: 7232d8f2a EntityLoadCrossbowEvent#shouldConsumeItem 4740bd6c8 Mark PlayerInventory#getItem as nullable bd9ace578 Add a config option to limit the number of entities of each type to load/save in a chunk (#4792) 6bafeb5a9 Move logic from last patch into correct place 9668118fd disable entity ticking flag after watchdog obliteration
74 lines
3.8 KiB
Diff
74 lines
3.8 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: jmp <jasonpenilla2@me.com>
|
|
Date: Thu, 27 Aug 2020 13:48:52 -0700
|
|
Subject: [PATCH] Raid cooldown setting
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/PersistentRaid.java b/src/main/java/net/minecraft/server/PersistentRaid.java
|
|
index 826dcf9f7eedc3664d66170b97b2a19552a0dc60..807910c60e6cad58b91474b0477e6fc109eaf281 100644
|
|
--- a/src/main/java/net/minecraft/server/PersistentRaid.java
|
|
+++ b/src/main/java/net/minecraft/server/PersistentRaid.java
|
|
@@ -9,6 +9,7 @@ import javax.annotation.Nullable;
|
|
|
|
public class PersistentRaid extends PersistentBase {
|
|
|
|
+ public final Map<java.util.UUID, Integer> playerCooldowns = new java.util.HashMap<>(); // Purpur
|
|
public final Map<Integer, Raid> raids = Maps.newHashMap();
|
|
private final WorldServer b;
|
|
private int c;
|
|
@@ -27,6 +28,17 @@ public class PersistentRaid extends PersistentBase {
|
|
|
|
public void a() {
|
|
++this.d;
|
|
+ // Purpur start
|
|
+ if (b.purpurConfig.raidCooldownSeconds != 0 && this.d % 20 == 0) {
|
|
+ com.google.common.collect.ImmutableMap.copyOf(playerCooldowns).forEach((id, i) -> {
|
|
+ if (i < 1) {
|
|
+ playerCooldowns.remove(id);
|
|
+ } else {
|
|
+ playerCooldowns.put(id, i - 1);
|
|
+ }
|
|
+ });
|
|
+ }
|
|
+ // Purpur end
|
|
Iterator iterator = this.raids.values().iterator();
|
|
|
|
while (iterator.hasNext()) {
|
|
@@ -110,10 +122,15 @@ public class PersistentRaid extends PersistentBase {
|
|
|
|
if (flag) {
|
|
// CraftBukkit start
|
|
- if (!org.bukkit.craftbukkit.event.CraftEventFactory.callRaidTriggerEvent(raid, entityplayer)) {
|
|
+ if ((b.purpurConfig.raidCooldownSeconds != 0 && playerCooldowns.containsKey(entityplayer.getUniqueID())) || !org.bukkit.craftbukkit.event.CraftEventFactory.callRaidTriggerEvent(raid, entityplayer)) { // Purpur
|
|
entityplayer.removeEffect(MobEffects.BAD_OMEN);
|
|
return null;
|
|
}
|
|
+ // Purpur start
|
|
+ if (b.purpurConfig.raidCooldownSeconds != 0) {
|
|
+ playerCooldowns.put(entityplayer.getUniqueID(), b.purpurConfig.raidCooldownSeconds);
|
|
+ }
|
|
+ // Purpur end
|
|
|
|
if (!this.raids.containsKey(raid.getId())) {
|
|
this.raids.put(raid.getId(), raid);
|
|
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
|
index b0a0c6cc6b781130cbfd02edc6c5b511090099c0..8a2724489df13cf04200b1f34b3a76e0cdd679d3 100644
|
|
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
|
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
|
@@ -155,6 +155,7 @@ public class PurpurWorldConfig {
|
|
public boolean milkCuresBadOmen = true;
|
|
public double tridentLoyaltyVoidReturnHeight = 0.0D;
|
|
public double voidDamageHeight = -64.0D;
|
|
+ public int raidCooldownSeconds = 0;
|
|
private void miscGameplayMechanicsSettings() {
|
|
useBetterMending = getBoolean("gameplay-mechanics.use-better-mending", useBetterMending);
|
|
boatEjectPlayersOnLand = getBoolean("gameplay-mechanics.boat.eject-players-on-land", boatEjectPlayersOnLand);
|
|
@@ -164,6 +165,7 @@ public class PurpurWorldConfig {
|
|
milkCuresBadOmen = getBoolean("gameplay-mechanics.milk-cures-bad-omen", milkCuresBadOmen);
|
|
tridentLoyaltyVoidReturnHeight = getDouble("gameplay-mechanics.trident-loyalty-void-return-height", tridentLoyaltyVoidReturnHeight);
|
|
voidDamageHeight = getDouble("gameplay-mechanics.void-damage-height", voidDamageHeight);
|
|
+ raidCooldownSeconds = getInt("gameplay-mechanics.raid-cooldown-seconds", raidCooldownSeconds);
|
|
}
|
|
|
|
public boolean catSpawning;
|