2019-03-20 01:28:15 +01:00
|
|
|
From 8d34f2367c37cd9a2f1e78b4698332157ae7b670 Mon Sep 17 00:00:00 2001
|
2018-06-04 07:55:52 +02:00
|
|
|
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
|
2019-03-20 01:28:15 +01:00
|
|
|
index d57450c95..4125a024e 100644
|
2018-06-04 07:55:52 +02:00
|
|
|
--- a/src/main/java/org/bukkit/potion/PotionEffect.java
|
|
|
|
+++ b/src/main/java/org/bukkit/potion/PotionEffect.java
|
2019-03-20 01:28:15 +01:00
|
|
|
@@ -103,6 +103,33 @@ public class PotionEffect implements ConfigurationSerializable {
|
2018-08-04 02:31:44 +02:00
|
|
|
this(getEffectType(map), getInt(map, DURATION), getInt(map, AMPLIFIER), getBool(map, AMBIENT, false), getBool(map, PARTICLES, true), getBool(map, ICON, getBool(map, PARTICLES, true)));
|
2018-06-04 07:55:52 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
+ // Paper start
|
2019-03-20 01:28:15 +01:00
|
|
|
+ @NotNull
|
|
|
|
+ public PotionEffect withType(@NotNull PotionEffectType type) {
|
2018-08-04 03:23:57 +02:00
|
|
|
+ return new PotionEffect(type, duration, amplifier, ambient, particles, icon);
|
2018-06-04 07:55:52 +02:00
|
|
|
+ }
|
2019-03-20 01:28:15 +01:00
|
|
|
+ @NotNull
|
2018-06-04 07:55:52 +02:00
|
|
|
+ public PotionEffect withDuration(int duration) {
|
2018-08-04 03:23:57 +02:00
|
|
|
+ return new PotionEffect(this.type, duration, amplifier, ambient, particles, icon);
|
2018-06-04 07:55:52 +02:00
|
|
|
+ }
|
2019-03-20 01:28:15 +01:00
|
|
|
+ @NotNull
|
2018-06-04 07:55:52 +02:00
|
|
|
+ public PotionEffect withAmplifier(int amplifier) {
|
2018-08-04 03:23:57 +02:00
|
|
|
+ return new PotionEffect(this.type, duration, amplifier, ambient, particles, icon);
|
2018-06-04 07:55:52 +02:00
|
|
|
+ }
|
2019-03-20 01:28:15 +01:00
|
|
|
+ @NotNull
|
2018-06-04 07:55:52 +02:00
|
|
|
+ public PotionEffect withAmbient(boolean ambient) {
|
2018-08-04 03:23:57 +02:00
|
|
|
+ return new PotionEffect(this.type, duration, amplifier, ambient, particles, icon);
|
2018-06-04 07:55:52 +02:00
|
|
|
+ }
|
2019-03-20 01:28:15 +01:00
|
|
|
+ @NotNull
|
2018-06-04 07:55:52 +02:00
|
|
|
+ public PotionEffect withParticles(boolean particles) {
|
2018-08-04 03:23:57 +02:00
|
|
|
+ return new PotionEffect(this.type, duration, amplifier, ambient, particles, icon);
|
2018-06-04 07:55:52 +02:00
|
|
|
+ }
|
2019-03-20 01:28:15 +01:00
|
|
|
+ @NotNull
|
2018-08-04 03:23:57 +02:00
|
|
|
+ public PotionEffect withIcon(boolean icon) {
|
|
|
|
+ return new PotionEffect(this.type, duration, amplifier, ambient, particles, icon);
|
2018-06-04 07:55:52 +02:00
|
|
|
+ }
|
|
|
|
+ // Paper end
|
|
|
|
+
|
2019-03-20 01:28:15 +01:00
|
|
|
@NotNull
|
|
|
|
private static PotionEffectType getEffectType(@NotNull Map<?, ?> map) {
|
2018-06-04 07:55:52 +02:00
|
|
|
int type = getInt(map, TYPE);
|
|
|
|
--
|
2019-03-20 01:28:15 +01:00
|
|
|
2.21.0
|
2018-06-04 07:55:52 +02:00
|
|
|
|