mirror of
https://github.com/BentoBoxWorld/Challenges.git
synced 2024-12-29 04:28:03 +01:00
Apply new Utils methods in EditChallengesGUI
This commit is contained in:
parent
e900f1e665
commit
e5ec5d5825
@ -358,12 +358,16 @@ public class EditChallengeGUI extends CommonGUI
|
||||
if (clickType.isRightClick())
|
||||
{
|
||||
this.challenge.setChallengeType(
|
||||
this.getPreviousType(this.challenge.getChallengeType()));
|
||||
Utils.getPreviousValue(
|
||||
Challenge.ChallengeType.values(),
|
||||
this.challenge.getChallengeType()));
|
||||
}
|
||||
else
|
||||
{
|
||||
this.challenge.setChallengeType(
|
||||
this.getNextType(this.challenge.getChallengeType()));
|
||||
Utils.getNextValue(
|
||||
Challenge.ChallengeType.values(),
|
||||
this.challenge.getChallengeType()));
|
||||
}
|
||||
|
||||
this.build();
|
||||
@ -1205,62 +1209,6 @@ public class EditChallengeGUI extends CommonGUI
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This method returns next challenge type from given.
|
||||
* @param type Given challenge type.
|
||||
* @return Next Challenge Type.
|
||||
*/
|
||||
private Challenge.ChallengeType getNextType(Challenge.ChallengeType type)
|
||||
{
|
||||
Challenge.ChallengeType[] values = Challenge.ChallengeType.values();
|
||||
|
||||
for (int i = 0; i < values.length; i++)
|
||||
{
|
||||
if (values[i].equals(type))
|
||||
{
|
||||
if (i + 1 == values.length)
|
||||
{
|
||||
return values[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
return values[i + 1];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return type;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This method returns previous challenge type from given.
|
||||
* @param type Given challenge type.
|
||||
* @return Previous Challenge Type.
|
||||
*/
|
||||
private Challenge.ChallengeType getPreviousType(Challenge.ChallengeType type)
|
||||
{
|
||||
Challenge.ChallengeType[] values = Challenge.ChallengeType.values();
|
||||
|
||||
for (int i = 0; i < values.length; i++)
|
||||
{
|
||||
if (values[i].equals(type))
|
||||
{
|
||||
if (i > 0)
|
||||
{
|
||||
return values[i - 1];
|
||||
}
|
||||
else
|
||||
{
|
||||
return values[values.length - 1];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return type;
|
||||
}
|
||||
|
||||
|
||||
// ---------------------------------------------------------------------
|
||||
// Section: Enums
|
||||
// ---------------------------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user