2018-08-04 00:31:44 +00:00
|
|
|
From fa0d7b6333526b569fbbcb238d570f0ae7949651 Mon Sep 17 00:00:00 2001
|
2018-06-04 05:55:52 +00: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
|
2018-08-04 00:31:44 +00:00
|
|
|
index 86616f1b8..35984ef6c 100644
|
2018-06-04 05:55:52 +00:00
|
|
|
--- a/src/main/java/org/bukkit/potion/PotionEffect.java
|
|
|
|
+++ b/src/main/java/org/bukkit/potion/PotionEffect.java
|
2018-08-04 00:31:44 +00:00
|
|
|
@@ -100,6 +100,30 @@ 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)));
|
2018-06-04 05:55:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
+ // Paper start
|
|
|
|
+ public PotionEffect withType(PotionEffectType type) {
|
|
|
|
+ return new PotionEffect(type, duration, amplifier, ambient, particles, color);
|
|
|
|
+ }
|
|
|
|
+ public PotionEffect withDuration(int duration) {
|
|
|
|
+ return new PotionEffect(this.type, duration, amplifier, ambient, particles, color);
|
|
|
|
+ }
|
|
|
|
+ public PotionEffect withAmplifier(int amplifier) {
|
|
|
|
+ return new PotionEffect(this.type, duration, amplifier, ambient, particles, color);
|
|
|
|
+ }
|
|
|
|
+ public PotionEffect withAmbient(boolean ambient) {
|
|
|
|
+ return new PotionEffect(this.type, duration, amplifier, ambient, particles, color);
|
|
|
|
+ }
|
|
|
|
+ public PotionEffect withParticles(boolean particles) {
|
|
|
|
+ return new PotionEffect(this.type, duration, amplifier, ambient, particles, color);
|
|
|
|
+ }
|
|
|
|
+ public PotionEffect withParticles(boolean particles, Color color) {
|
|
|
|
+ return new PotionEffect(this.type, duration, amplifier, ambient, particles, color);
|
|
|
|
+ }
|
|
|
|
+ public PotionEffect withColor(Color color) {
|
|
|
|
+ return new PotionEffect(this.type, duration, amplifier, ambient, particles, color);
|
|
|
|
+ }
|
|
|
|
+ // Paper end
|
|
|
|
+
|
|
|
|
private static PotionEffectType getEffectType(Map<?, ?> map) {
|
|
|
|
int type = getInt(map, TYPE);
|
|
|
|
PotionEffectType effect = PotionEffectType.getById(type);
|
|
|
|
--
|
2018-07-15 01:53:17 +00:00
|
|
|
2.18.0
|
2018-06-04 05:55:52 +00:00
|
|
|
|