Skip to content

Commit 3c56d0a

Browse files
committed
Convert consumable effect tp cause
While Paper's new CONSUMABLE_EFFECT cause has a better name, this keeps the current CHORUS_FRUIT value to avoid breaking existing scripts for now.
1 parent fc18552 commit 3c56d0a

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

src/main/java/com/laytonsmith/abstraction/enums/bukkit/BukkitMCTeleportCause.java

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
package com.laytonsmith.abstraction.enums.bukkit;
22

33
import com.laytonsmith.abstraction.Implementation;
4+
import com.laytonsmith.abstraction.bukkit.BukkitMCServer;
45
import com.laytonsmith.abstraction.enums.EnumConvertor;
56
import com.laytonsmith.abstraction.enums.MCTeleportCause;
7+
import com.laytonsmith.abstraction.enums.MCVersion;
68
import com.laytonsmith.annotations.abstractionenum;
9+
import com.laytonsmith.core.Static;
710
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
811

912
@abstractionenum(
@@ -21,4 +24,23 @@ public static com.laytonsmith.abstraction.enums.bukkit.BukkitMCTeleportCause get
2124
}
2225
return instance;
2326
}
27+
28+
@Override
29+
protected MCTeleportCause getAbstractedEnumCustom(TeleportCause concrete) {
30+
if(Static.getServer().getMinecraftVersion().gte(MCVersion.MC1_21_5)
31+
&& concrete.name().equals("CONSUMABLE_EFFECT")) {
32+
return MCTeleportCause.CHORUS_FRUIT;
33+
}
34+
return super.getAbstractedEnumCustom(concrete);
35+
}
36+
37+
@Override
38+
protected TeleportCause getConcreteEnumCustom(MCTeleportCause abstracted) {
39+
BukkitMCServer server = (BukkitMCServer) Static.getServer();
40+
if(server.isPaper() && server.getMinecraftVersion().gte(MCVersion.MC1_21_5)
41+
&& abstracted == MCTeleportCause.CHORUS_FRUIT) {
42+
return TeleportCause.valueOf("CONSUMABLE_EFFECT");
43+
}
44+
return super.getConcreteEnumCustom(abstracted);
45+
}
2446
}

0 commit comments

Comments
 (0)