Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2559a48
commit 0432b22
Showing
5 changed files
with
51 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
plugin/src/main/java/com/denizenscript/denizen/utilities/MultiVersionHelper1_19.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package com.denizenscript.denizen.utilities; | ||
|
||
import com.denizenscript.denizen.objects.properties.entity.EntityColor; | ||
import com.denizenscript.denizencore.objects.Mechanism; | ||
import com.denizenscript.denizencore.objects.core.ListTag; | ||
import org.bukkit.entity.*; | ||
|
||
public class MultiVersionHelper1_19 { | ||
|
||
public static boolean colorIsApplicable(EntityType type) { | ||
return type == EntityType.FROG; | ||
} | ||
|
||
public static String getColor(Entity entity) { | ||
if (entity instanceof Frog) { | ||
return ((Frog) entity).getVariant().name(); | ||
} | ||
return null; | ||
} | ||
|
||
public static ListTag getAllowedColors(EntityType type) { | ||
if (type == EntityType.FROG) { | ||
return EntityColor.listForEnum(Frog.Variant.values()); | ||
} | ||
return null; | ||
} | ||
|
||
public static void setColor(Entity entity, Mechanism mech) { | ||
if (entity instanceof Frog && mech.requireEnum(Frog.Variant.class)) { | ||
((Frog) entity).setVariant(Frog.Variant.valueOf(mech.getValue().asString().toUpperCase())); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters