Move to configurate for paper.yml (#7609)
This commit is contained in:
parent
da8027352c
commit
172d260d67
872 changed files with 5923 additions and 5664 deletions
|
@ -10,37 +10,6 @@ can automatically replenish after a given time.
|
|||
This feature is good for long term worlds so that newer players
|
||||
do not suffer with "Every chest has been looted"
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
index 2c7cdf91288eb9a88d1d453accc87a8d77e6daac..a491af30f70f41e5f7b198ae4d40acfb6eec9b38 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
@@ -325,4 +325,26 @@ public class PaperWorldConfig {
|
||||
this.frostedIceDelayMax = this.getInt("frosted-ice.delay.max", this.frostedIceDelayMax);
|
||||
log("Frosted Ice: " + (this.frostedIceEnabled ? "enabled" : "disabled") + " / delay: min=" + this.frostedIceDelayMin + ", max=" + this.frostedIceDelayMax);
|
||||
}
|
||||
+
|
||||
+ public boolean autoReplenishLootables;
|
||||
+ public boolean restrictPlayerReloot;
|
||||
+ public boolean changeLootTableSeedOnFill;
|
||||
+ public int maxLootableRefills;
|
||||
+ public int lootableRegenMin;
|
||||
+ public int lootableRegenMax;
|
||||
+ private void enhancedLootables() {
|
||||
+ autoReplenishLootables = getBoolean("lootables.auto-replenish", false);
|
||||
+ restrictPlayerReloot = getBoolean("lootables.restrict-player-reloot", true);
|
||||
+ changeLootTableSeedOnFill = getBoolean("lootables.reset-seed-on-fill", true);
|
||||
+ maxLootableRefills = getInt("lootables.max-refills", -1);
|
||||
+ lootableRegenMin = PaperConfig.getSeconds(getString("lootables.refresh-min", "12h"));
|
||||
+ lootableRegenMax = PaperConfig.getSeconds(getString("lootables.refresh-max", "2d"));
|
||||
+ if (autoReplenishLootables) {
|
||||
+ log("Lootables: Replenishing every " +
|
||||
+ PaperConfig.timeSummary(lootableRegenMin) + " to " +
|
||||
+ PaperConfig.timeSummary(lootableRegenMax) +
|
||||
+ (restrictPlayerReloot ? " (restricting reloot)" : "")
|
||||
+ );
|
||||
+ }
|
||||
+ }
|
||||
}
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/loottable/PaperContainerEntityLootableInventory.java b/src/main/java/com/destroystokyo/paper/loottable/PaperContainerEntityLootableInventory.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..88e32ed64f90bfd277dac84ba4bd84f0d943f5f8
|
||||
|
@ -185,7 +154,7 @@ index 0000000000000000000000000000000000000000..2fba5bc0f982e143ad5f5bda55d768ed
|
|||
+}
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/loottable/PaperLootableInventory.java b/src/main/java/com/destroystokyo/paper/loottable/PaperLootableInventory.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..16b3527d7bc782c47e6f6c3ecd7165bd16b0ab0a
|
||||
index 0000000000000000000000000000000000000000..ce135d990c785b02df468391ea622aa236290f07
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/loottable/PaperLootableInventory.java
|
||||
@@ -0,0 +1,70 @@
|
||||
|
@ -208,7 +177,7 @@ index 0000000000000000000000000000000000000000..16b3527d7bc782c47e6f6c3ecd7165bd
|
|||
+
|
||||
+ @Override
|
||||
+ default boolean isRefillEnabled() {
|
||||
+ return getNMSWorld().paperConfig.autoReplenishLootables;
|
||||
+ return getNMSWorld().paperConfig().lootables.autoReplenish;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
|
@ -261,13 +230,13 @@ index 0000000000000000000000000000000000000000..16b3527d7bc782c47e6f6c3ecd7165bd
|
|||
+}
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/loottable/PaperLootableInventoryData.java b/src/main/java/com/destroystokyo/paper/loottable/PaperLootableInventoryData.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..20cfe7b9b7127ddeb97aa91d759fc17b4a548eaf
|
||||
index 0000000000000000000000000000000000000000..e5ea9f27a1936ed9e329e74317c91c5df89b9fbd
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/loottable/PaperLootableInventoryData.java
|
||||
@@ -0,0 +1,179 @@
|
||||
+package com.destroystokyo.paper.loottable;
|
||||
+
|
||||
+import com.destroystokyo.paper.PaperWorldConfig;
|
||||
+import io.papermc.paper.configuration.WorldConfiguration;
|
||||
+import org.bukkit.entity.Player;
|
||||
+import org.bukkit.loot.LootTable;
|
||||
+import javax.annotation.Nullable;
|
||||
|
@ -315,7 +284,7 @@ index 0000000000000000000000000000000000000000..20cfe7b9b7127ddeb97aa91d759fc17b
|
|||
+ }
|
||||
+
|
||||
+ // ALWAYS process the first fill or if the feature is disabled
|
||||
+ if (this.lastFill == -1 || !this.lootable.getNMSWorld().paperConfig.autoReplenishLootables) {
|
||||
+ if (this.lastFill == -1 || !this.lootable.getNMSWorld().paperConfig().lootables.autoReplenish) {
|
||||
+ return true;
|
||||
+ }
|
||||
+
|
||||
|
@ -329,10 +298,10 @@ index 0000000000000000000000000000000000000000..20cfe7b9b7127ddeb97aa91d759fc17b
|
|||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ final PaperWorldConfig paperConfig = this.lootable.getNMSWorld().paperConfig;
|
||||
+ final WorldConfiguration paperConfig = this.lootable.getNMSWorld().paperConfig();
|
||||
+
|
||||
+ // Check if max refills has been hit
|
||||
+ if (paperConfig.maxLootableRefills != -1 && this.numRefills >= paperConfig.maxLootableRefills) {
|
||||
+ if (paperConfig.lootables.maxRefills != -1 && this.numRefills >= paperConfig.lootables.maxRefills) {
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
|
@ -344,20 +313,20 @@ index 0000000000000000000000000000000000000000..20cfe7b9b7127ddeb97aa91d759fc17b
|
|||
+
|
||||
+ final Player bukkitPlayer = (Player) player.getBukkitEntity();
|
||||
+ LootableInventoryReplenishEvent event = new LootableInventoryReplenishEvent(bukkitPlayer, lootable.getAPILootableInventory());
|
||||
+ if (paperConfig.restrictPlayerReloot && hasPlayerLooted(player.getUUID())) {
|
||||
+ if (paperConfig.lootables.restrictPlayerReloot && hasPlayerLooted(player.getUUID())) {
|
||||
+ event.setCancelled(true);
|
||||
+ }
|
||||
+ return event.callEvent();
|
||||
+ }
|
||||
+ public void processRefill(@Nullable net.minecraft.world.entity.player.Player player) {
|
||||
+ this.lastFill = System.currentTimeMillis();
|
||||
+ final PaperWorldConfig paperConfig = this.lootable.getNMSWorld().paperConfig;
|
||||
+ if (paperConfig.autoReplenishLootables) {
|
||||
+ int min = paperConfig.lootableRegenMin;
|
||||
+ int max = paperConfig.lootableRegenMax;
|
||||
+ this.nextRefill = this.lastFill + (min + RANDOM.nextInt(max - min + 1)) * 1000L;
|
||||
+ final WorldConfiguration paperConfig = this.lootable.getNMSWorld().paperConfig();
|
||||
+ if (paperConfig.lootables.autoReplenish) {
|
||||
+ long min = paperConfig.lootables.refreshMin.seconds();
|
||||
+ long max = paperConfig.lootables.refreshMax.seconds();
|
||||
+ this.nextRefill = this.lastFill + (min + RANDOM.nextLong(max - min + 1)) * 1000L;
|
||||
+ this.numRefills++;
|
||||
+ if (paperConfig.changeLootTableSeedOnFill) {
|
||||
+ if (paperConfig.lootables.resetSeedOnFill) {
|
||||
+ this.lootable.setSeed(0);
|
||||
+ }
|
||||
+ if (player != null) { // This means that numRefills can be incremented without a player being in the lootedPlayers list - Seems to be EntityMinecartChest specific
|
||||
|
@ -516,7 +485,7 @@ index 0000000000000000000000000000000000000000..3377b86c337d0234bbb9b0349e4034a7
|
|||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index 3e0f58a928931fd1b3ee32f9dadf65288d8798d6..cd4b9b659904e587933b83616dfdcffb2de8bea5 100644
|
||||
index e3fe98ef3a7537d3717824d3357cc84c632ee0ea..3d84055afbe0392ca1abf5628b3b621b8833265a 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -226,6 +226,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue