-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
# Conflicts: # README.md # src/main/java/com/minelittlepony/unicopia/client/gui/TribeConfirmationScreen.java # src/main/java/com/minelittlepony/unicopia/client/minelittlepony/Main.java
- Loading branch information
Showing
91 changed files
with
961 additions
and
189 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
package com.minelittlepony.unicopia; | ||
|
||
import java.util.Set; | ||
|
||
public class AllowList { | ||
public static final AllowList INSTANCE = new AllowList(); | ||
|
||
public AllowList() { | ||
|
||
} | ||
|
||
public boolean disable() { | ||
if (!isEnabled()) { | ||
return false; | ||
} | ||
Unicopia.getConfig().speciesWhiteList.get().clear(); | ||
Unicopia.getConfig().save(); | ||
return true; | ||
} | ||
|
||
public boolean isEnabled() { | ||
return !Unicopia.getConfig().speciesWhiteList.get().isEmpty(); | ||
} | ||
|
||
public boolean add(Race race) { | ||
if (race.isUnset() || race.isHuman()) { | ||
return false; | ||
} | ||
Set<String> values = Unicopia.getConfig().speciesWhiteList.get(); | ||
boolean added = values.add(race.getId().toString()); | ||
Unicopia.getConfig().save(); | ||
return added; | ||
} | ||
|
||
public boolean remove(Race race) { | ||
Set<String> values = Unicopia.getConfig().speciesWhiteList.get(); | ||
if (values.isEmpty()) { | ||
for (Race r : Race.REGISTRY) { | ||
if (!r.isUnset() && r != race) { | ||
values.add(r.getId().toString()); | ||
} | ||
} | ||
Unicopia.getConfig().save(); | ||
return true; | ||
} | ||
boolean removed = values.remove(race.getId().toString()); | ||
Unicopia.getConfig().save(); | ||
return removed; | ||
} | ||
|
||
public boolean permits(Race race) { | ||
return race.isUnset() | ||
|| race.isHuman() | ||
|| !isEnabled() | ||
|| Unicopia.getConfig().speciesWhiteList.get().contains(race.getId().toString()); | ||
} | ||
} |
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
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
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
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
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
Oops, something went wrong.