-
-
Save Licious17/c8002f5bdfb8540f5652d0db1783592e to your computer and use it in GitHub Desktop.
Proposition for improvements on Ribbon
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
package com.pixelmonmod.pixelmon.api.pokemon; | |
import com.google.common.collect.ImmutableSet; | |
import com.google.common.collect.Sets; | |
import com.pixelmonmod.pixelmon.enums.EnumRibbonType; | |
import java.util.EnumSet; | |
public class Pokemon { | |
private final EnumSet<EnumRibbonType> ribbons = EnumSet.noneOf(EnumRibbonType.class); | |
public boolean addRibbon(EnumRibbonType ribbon) { | |
return addRibbon(ribbon, true); | |
} | |
public boolean addRibbon(EnumRibbonType ribbon, boolean setDisplayed) { | |
if (ribbon.ordinal() >= EnumRibbonType.OA10712.ordinal()) { | |
StackTraceElement e = Thread.currentThread().getStackTrace()[2]; | |
if (!e.getFileName().contains("InteractionDeveloper")) { | |
return false; | |
} | |
} | |
if (setDisplayed) | |
this.setDisplayedRibbon(ribbon); | |
if (this.ribbons.contains(ribbon)) | |
return false; | |
ribbons.add(ribbon); | |
return true; | |
} | |
public ImmutableSet<EnumRibbonType> getRibbons() { | |
return Sets.immutableEnumSet(ribbons); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment