mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-20 18:07:43 +01:00
another 6 bite the dust
This commit is contained in:
@@ -0,0 +1,59 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: William Blake Galbreath <blake.galbreath@gmail.com>
|
||||
Date: Thu, 26 Dec 2019 22:08:37 -0600
|
||||
Subject: [PATCH] Add player death exp control options
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
index 1cc9291f14a4d655cb1b91479b954d76cc1fcf7f..ea613f494c9c6fbf1aea40eed5164217072ffdc9 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
@@ -194,6 +194,8 @@ public abstract class Player extends LivingEntity {
|
||||
// CraftBukkit end
|
||||
|
||||
// Purpur start
|
||||
+ private javax.script.ScriptEngine scriptEngine = new javax.script.ScriptEngineManager().getEngineByName("rhino");
|
||||
+
|
||||
public void setAfk(boolean afk) {
|
||||
}
|
||||
|
||||
@@ -1888,9 +1890,18 @@ public abstract class Player extends LivingEntity {
|
||||
@Override
|
||||
protected int getExperienceReward(Player player) {
|
||||
if (!this.level.getGameRules().getBoolean(GameRules.RULE_KEEPINVENTORY) && !this.isSpectator()) {
|
||||
- int i = this.experienceLevel * 7;
|
||||
-
|
||||
- return i > 100 ? 100 : i;
|
||||
+ // Purpur start
|
||||
+ int toDrop;
|
||||
+ try {
|
||||
+ scriptEngine.eval("expLevel = " + experienceLevel);
|
||||
+ scriptEngine.eval("expTotal = " + totalExperience);
|
||||
+ scriptEngine.eval("exp = " + experienceProgress);
|
||||
+ toDrop = (int) Math.round((Double) scriptEngine.eval(level.purpurConfig.playerDeathExpDropEquation));
|
||||
+ } catch (Exception ignore) {
|
||||
+ toDrop = experienceLevel * 7;
|
||||
+ }
|
||||
+ return Math.min(toDrop, level.purpurConfig.playerDeathExpDropMax);
|
||||
+ // Purpur end
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
index be27a1c47d17992cfc7927fc5f0e5df23a225d96..d993ddd69022f4d9d9ceb3c449fde504419d1709 100644
|
||||
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
@@ -157,6 +157,13 @@ public class PurpurWorldConfig {
|
||||
tridentLoyaltyVoidReturnHeight = getDouble("gameplay-mechanics.trident-loyalty-void-return-height", tridentLoyaltyVoidReturnHeight);
|
||||
}
|
||||
|
||||
+ public String playerDeathExpDropEquation = "expLevel * 7";
|
||||
+ public int playerDeathExpDropMax = 100;
|
||||
+ private void playerDeathExpSettings() {
|
||||
+ playerDeathExpDropEquation = getString("gameplay-mechanics.player.exp-dropped-on-death.equation", playerDeathExpDropEquation);
|
||||
+ playerDeathExpDropMax = getInt("gameplay-mechanics.player.exp-dropped-on-death.maximum", playerDeathExpDropMax);
|
||||
+ }
|
||||
+
|
||||
public int playerSpawnInvulnerableTicks = 60;
|
||||
public boolean playerInvulnerableWhileAcceptingResourcePack = false;
|
||||
private void playerInvulnerabilities() {
|
||||
Reference in New Issue
Block a user