#Enums

1 messages ยท Page 1 of 1 (latest)

tidal tinsel
#
    ADMIN("dark_red"),
    VERY_SPECIAL("red"),
    SPECIAL("red"),
    DIVINE("aqua"),
    MYTHIC("light_purple"),
    LEGENDARY("gold"),
    EPIC("dark_purple"),
    RARE("dark_blue"),
    UNCOMMON("green"),
    COMMON("white"),
    ;``` lets say i have a element from this enum EPIC how can i get the one above it and below it?
slow geodeBOT
#

<@&987246399047479336> please have a look, thanks.

#

Here is an AI assisted attempt to answer your question ๐Ÿค–. Maybe it helps! In any case, a human is on the way ๐Ÿ‘. To continue talking to the AI, you can use </chatgpt:1108714622413963314>.

#
TJ-Bot
```java ADMIN("dark_red"), VERY_SPECIAL("red"), SPECIAL("red"), DIVINE("aqua"), MYTHIC("light_purple"), LEGENDARY("gold"), EPIC("dark_purple"), RARE("dark_blue"), UNCOMMON("green"), COMMON("white"), ;``` lets say

UNCOMMON("green"),
COMMON("white");

public enum Rarity {
ADMIN("dark_red"),
VERY_SPECIAL("red"),
SPECIAL("red"),
DIVINE("aqua"),
MYTHIC("light_purple"),
LEGENDARY("gold"),
EPIC("dark_purple"),
RARE("dark_blue"),
UNCOMMON("green"),
COMMON("white");

private final String color;

Rarity(String color) {
    this.color = color;
}

public String getColor() {
    return color;
}

}

// Each enum constant represents a rarity level with a corresponding color
// Can be used to assign colors to different rarity levels in a game or application

tidal tinsel
#

in what context ? You have for example epic and now f.e. your card gets a evolution and you want to turn it in Rare ?

#

Lets say i have EPIC and it gets upgraded i want LEGENDARY
Or i have EPIC and its get degraded i want RARE

#

just how to get the thing above and below it

wintry palm
#

U can implement it

#

Add smth like index in ur constructor

#

And implement methods like, getPreview, getNext

#

Rest is logic

tidal tinsel
#

hm

#
    /**
     * In case its already ADMIN it returns ADMIN
     * @return Upgraded rarity
     * @since 1.0.0
     */
    public Rarity upgrade() {
        if (this.ordinal() == Rarity.VERY_SPECIAL.ordinal()) return this;
        return values()[this.ordinal() - 1];
    }

    /**
     * In case its already COMMON it returns COMMON
     * @return Degraded rarity
     * @since 1.0.0
     */
    public Rarity degrade() {
        if (this.ordinal() == Rarity.COMMON.ordinal()) return this;
        return values()[this.ordinal() + 1];
    }``` i did this
slow geodeBOT
tidal tinsel
#

i think that should work

wintry palm
#

So u want to check it with statements?

#

Then u need to define statement for every case

#

Evry single one case

#

It should be dynamic

#

Automatic

#

Idk how to name it

#

Ah

#

I see

#

Nevermind

#

My bad. I read it wrong, then it should work

quartz stump
#

@tidal tinsel what u working on anyways hmm, it it like a hypixel skyblock clone

quartz stump
#

why not just make a plugin though

tidal tinsel
#

it is a plugin? ๐Ÿ‘€

quartz stump
#

well hypixel skyblock is a plugin

#

like a bukkit plugin i mean

tidal tinsel
#

yes it is a Bukkit Plugin

#

๐Ÿคท

#

it was made in Minestom intially but i got bored of minestom

#
  • bukkit is a bit easier to manage imma say
#

my only main task is to make it AS SCALABLE as possible

#

using inheritance for almost everything i can

#

@quartz stump what made u think its not bukkit peepo_think

quartz stump
#

@tidal tinsel do you use paper

tidal tinsel
#

yes

quartz stump
#

oh cool so you havethe minimessage api

tidal tinsel
#

someone has similar pfp to me? ๐Ÿ˜ณ

#

i drew this in paint in 2 seconds

tidal tinsel
quartz stump
#

this guy hah

tidal tinsel
#

nice

crystal viper
quartz stump
#

lkmao