mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-29 07:48:53 +01:00
PotionEffect clone methods
Help with modifying potion effects
This commit is contained in:
parent
0570490d2a
commit
5c8bd61d24
1 changed files with 44 additions and 0 deletions
44
Spigot-API-Patches/0108-PotionEffect-clone-methods.patch
Normal file
44
Spigot-API-Patches/0108-PotionEffect-clone-methods.patch
Normal file
|
@ -0,0 +1,44 @@
|
|||
From e2c45b3168b0755f4c5b7e7ec1961a43646b695d 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 e7b86f85..53fb428f 100644
|
||||
--- a/src/main/java/org/bukkit/potion/PotionEffect.java
|
||||
+++ b/src/main/java/org/bukkit/potion/PotionEffect.java
|
||||
@@ -99,6 +99,30 @@ public class PotionEffect implements ConfigurationSerializable {
|
||||
this(getEffectType(map), getInt(map, DURATION), getInt(map, AMPLIFIER), getBool(map, AMBIENT, false), getBool(map, PARTICLES, true));
|
||||
}
|
||||
|
||||
+ // 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);
|
||||
--
|
||||
2.17.1
|
||||
|
Loading…
Reference in a new issue