3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-15 19:10:09 +01:00
Paper/Spigot-API-Patches/0104-PotionEffect-clone-methods.patch
Aikar 17b58d00d8
Unwrap Event Exceptions
This was a useless exception wrapper that ends up making
stack traces harder to read as well as the JVM cutting off
the important parts

Nothing catches this exception, so its safe to just get rid
of it and let the REAL exception bubble down
2019-02-23 12:17:41 -05:00

42 Zeilen
1.8 KiB
Diff

From 631b3e9d4a7a908df94994d6d25987747e313a54 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sun, 3 Jun 2018 04:10:13 -0400
Subject: [PATCH] PotionEffect clone methods
diff --git a/src/main/java/org/bukkit/potion/PotionEffect.java b/src/main/java/org/bukkit/potion/PotionEffect.java
index 86616f1b..efb55d29 100644
--- a/src/main/java/org/bukkit/potion/PotionEffect.java
+++ b/src/main/java/org/bukkit/potion/PotionEffect.java
@@ -100,6 +100,27 @@ public class PotionEffect implements ConfigurationSerializable {
this(getEffectType(map), getInt(map, DURATION), getInt(map, AMPLIFIER), getBool(map, AMBIENT, false), getBool(map, PARTICLES, true), getBool(map, ICON, getBool(map, PARTICLES, true)));
}
+ // Paper start
+ public PotionEffect withType(PotionEffectType type) {
+ return new PotionEffect(type, duration, amplifier, ambient, particles, icon);
+ }
+ public PotionEffect withDuration(int duration) {
+ return new PotionEffect(this.type, duration, amplifier, ambient, particles, icon);
+ }
+ public PotionEffect withAmplifier(int amplifier) {
+ return new PotionEffect(this.type, duration, amplifier, ambient, particles, icon);
+ }
+ public PotionEffect withAmbient(boolean ambient) {
+ return new PotionEffect(this.type, duration, amplifier, ambient, particles, icon);
+ }
+ public PotionEffect withParticles(boolean particles) {
+ return new PotionEffect(this.type, duration, amplifier, ambient, particles, icon);
+ }
+ public PotionEffect withIcon(boolean icon) {
+ return new PotionEffect(this.type, duration, amplifier, ambient, particles, icon);
+ }
+ // Paper end
+
private static PotionEffectType getEffectType(Map<?, ?> map) {
int type = getInt(map, TYPE);
PotionEffectType effect = PotionEffectType.getById(type);
--
2.20.1