mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-20 18:07:43 +01:00
Dont flip shits when javascript script engine isn't available
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
From 36589593a6ae2b75e7a175cefcc5e0ff3be9c07b Mon Sep 17 00:00:00 2001
|
From 31579dc05bedfcaa549efc5c7c89dc5edf69c713 Mon Sep 17 00:00:00 2001
|
||||||
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
|
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
|
||||||
Date: Sat, 30 Nov 2019 03:30:17 -0600
|
Date: Sat, 30 Nov 2019 03:30:17 -0600
|
||||||
Subject: [PATCH] Add sleep options
|
Subject: [PATCH] Add sleep options
|
||||||
@@ -9,7 +9,7 @@ Subject: [PATCH] Add sleep options
|
|||||||
2 files changed, 21 insertions(+), 2 deletions(-)
|
2 files changed, 21 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java
|
diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java
|
||||||
index 9d26bd1e4c..12e5ff43f9 100644
|
index 9d26bd1e4c..36582a80af 100644
|
||||||
--- a/src/main/java/net/minecraft/server/EntityHuman.java
|
--- a/src/main/java/net/minecraft/server/EntityHuman.java
|
||||||
+++ b/src/main/java/net/minecraft/server/EntityHuman.java
|
+++ b/src/main/java/net/minecraft/server/EntityHuman.java
|
||||||
@@ -143,6 +143,21 @@ public abstract class EntityHuman extends EntityLiving {
|
@@ -143,6 +143,21 @@ public abstract class EntityHuman extends EntityLiving {
|
||||||
@@ -24,7 +24,7 @@ index 9d26bd1e4c..12e5ff43f9 100644
|
|||||||
+ try {
|
+ try {
|
||||||
+ scriptEngine.eval("time = " + world.getDayTime());
|
+ scriptEngine.eval("time = " + world.getDayTime());
|
||||||
+ return !(Boolean) scriptEngine.eval(world.purpurConfig.playerSleepCondition);
|
+ return !(Boolean) scriptEngine.eval(world.purpurConfig.playerSleepCondition);
|
||||||
+ } catch (javax.script.ScriptException ignore) {
|
+ } catch (Exception ignore) {
|
||||||
+ }
|
+ }
|
||||||
+ }
|
+ }
|
||||||
+ return world.isDay();
|
+ return world.isDay();
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
From 28e2152ff57c891c2736b59121f6ba15471a4b5a Mon Sep 17 00:00:00 2001
|
From 8744eed26c1d415e410c070f23fda74b0a9fa902 Mon Sep 17 00:00:00 2001
|
||||||
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
|
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
|
||||||
Date: Thu, 26 Dec 2019 22:08:37 -0600
|
Date: Thu, 26 Dec 2019 22:08:37 -0600
|
||||||
Subject: [PATCH] Add player death exp control options
|
Subject: [PATCH] Add player death exp control options
|
||||||
@@ -9,7 +9,7 @@ Subject: [PATCH] Add player death exp control options
|
|||||||
2 files changed, 16 insertions(+), 3 deletions(-)
|
2 files changed, 16 insertions(+), 3 deletions(-)
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java
|
diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java
|
||||||
index 12e5ff43f9..427a32cdd7 100644
|
index 12e5ff43f9..5ffd2a2f51 100644
|
||||||
--- a/src/main/java/net/minecraft/server/EntityHuman.java
|
--- a/src/main/java/net/minecraft/server/EntityHuman.java
|
||||||
+++ b/src/main/java/net/minecraft/server/EntityHuman.java
|
+++ b/src/main/java/net/minecraft/server/EntityHuman.java
|
||||||
@@ -1862,9 +1862,18 @@ public abstract class EntityHuman extends EntityLiving {
|
@@ -1862,9 +1862,18 @@ public abstract class EntityHuman extends EntityLiving {
|
||||||
@@ -26,7 +26,7 @@ index 12e5ff43f9..427a32cdd7 100644
|
|||||||
+ scriptEngine.eval("expTotal = " + expTotal);
|
+ scriptEngine.eval("expTotal = " + expTotal);
|
||||||
+ scriptEngine.eval("exp = " + exp);
|
+ scriptEngine.eval("exp = " + exp);
|
||||||
+ toDrop = (int) Math.round((Double) scriptEngine.eval(world.purpurConfig.playerDeathExpDropEquation));
|
+ toDrop = (int) Math.round((Double) scriptEngine.eval(world.purpurConfig.playerDeathExpDropEquation));
|
||||||
+ } catch (javax.script.ScriptException ignore) {
|
+ } catch (Exception ignore) {
|
||||||
+ toDrop = expLevel * 7;
|
+ toDrop = expLevel * 7;
|
||||||
+ }
|
+ }
|
||||||
+ return Math.min(toDrop, world.purpurConfig.playerDeathExpDropMax);
|
+ return Math.min(toDrop, world.purpurConfig.playerDeathExpDropMax);
|
||||||
|
|||||||
Reference in New Issue
Block a user