generated from jaredlll08/MultiLoader-Template
-
Notifications
You must be signed in to change notification settings - Fork 3
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
cc79b7c
commit d58a813
Showing
10 changed files
with
154 additions
and
79 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
56 changes: 56 additions & 0 deletions
56
common/src/main/java/net/mysticdrew/journeymapteams/handlers/AbstractHandler.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,56 @@ | ||
package net.mysticdrew.journeymapteams.handlers; | ||
|
||
import net.minecraft.world.entity.player.Player; | ||
import net.mysticdrew.journeymapteams.handlers.properties.DefaultHandlerProperties; | ||
import net.mysticdrew.journeymapteams.handlers.properties.Properties; | ||
|
||
public abstract class AbstractHandler implements Handler | ||
{ | ||
protected final Properties properties; | ||
|
||
public AbstractHandler(String categoryToken, String categoryKey) | ||
{ | ||
this.properties = new DefaultHandlerProperties(categoryToken, categoryKey); | ||
} | ||
|
||
public AbstractHandler(Properties properties) | ||
{ | ||
this.properties = properties; | ||
} | ||
|
||
@Override | ||
public int getRemotePlayerNameColor(Player remotePlayer, int currentColor) | ||
{ | ||
if (this.properties.getShowNameColor()) | ||
{ | ||
return getRemotePlayerColor(remotePlayer); | ||
} | ||
return currentColor; | ||
} | ||
|
||
@Override | ||
public int getRemotePlayerIconColor(Player remotePlayer, int currentColor) | ||
{ | ||
if (this.properties.getShowIconColor()) | ||
{ | ||
return getRemotePlayerColor(remotePlayer); | ||
} | ||
return currentColor; | ||
} | ||
|
||
public int getColor(boolean teammates, boolean allied, int teamColor) | ||
{ | ||
if (allied) | ||
{ | ||
return properties.getForceAllyColor() ? properties.getAllyColor() : teamColor; | ||
} | ||
|
||
if (teammates) | ||
{ | ||
return properties.getForceTeamColor() ? properties.getTeamColor() : teamColor; | ||
} | ||
return properties.getTeamColor(); | ||
} | ||
|
||
protected abstract int getRemotePlayerColor(Player remotePlayer); | ||
} |
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
59 changes: 59 additions & 0 deletions
59
...ain/java/net/mysticdrew/journeymapteams/handlers/properties/DefaultHandlerProperties.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,59 @@ | ||
package net.mysticdrew.journeymapteams.handlers.properties; | ||
|
||
import journeymap.client.api.option.BooleanOption; | ||
import journeymap.client.api.option.EnumOption; | ||
import journeymap.client.api.option.OptionCategory; | ||
|
||
import static net.mysticdrew.journeymapteams.Constants.MOD_ID; | ||
|
||
public class DefaultHandlerProperties implements Properties | ||
{ | ||
private final OptionCategory category; | ||
private final EnumOption<Color> teamColor; | ||
private final EnumOption<Color> allyColor; | ||
private final BooleanOption forceAllyColor; | ||
private final BooleanOption forceTeamColor; | ||
private final BooleanOption showIconColor; | ||
private final BooleanOption showNameColor; | ||
|
||
public DefaultHandlerProperties(String token, String labelKey) | ||
{ | ||
this.category = new OptionCategory(MOD_ID + "-" + token, labelKey); | ||
this.teamColor = new EnumOption<>(category, "team-color", "prop.option.label.team_color", Color.GREEN); | ||
this.allyColor = new EnumOption<>(category, "ally-color", "prop.option.label.ally_color", Color.BLUE); | ||
this.forceAllyColor = new BooleanOption(category, "force-ally-color", "prop.option.label.force_ally", false); | ||
this.forceTeamColor = new BooleanOption(category, "force-team-color", "prop.option.label.force_team", false); | ||
this.showIconColor = new BooleanOption(category, "show-icon-color", "prop.option.label.show_icon_color", true); | ||
this.showNameColor = new BooleanOption(category, "show-name-color", "prop.option.label.show_name_color", true); | ||
} | ||
|
||
public int getTeamColor() | ||
{ | ||
return teamColor.get().getColor(); | ||
} | ||
|
||
public int getAllyColor() | ||
{ | ||
return allyColor.get().getColor(); | ||
} | ||
|
||
public boolean getForceAllyColor() | ||
{ | ||
return forceAllyColor.get(); | ||
} | ||
|
||
public boolean getForceTeamColor() | ||
{ | ||
return forceTeamColor.get(); | ||
} | ||
|
||
public boolean getShowIconColor() | ||
{ | ||
return showIconColor.get(); | ||
} | ||
|
||
public boolean getShowNameColor() | ||
{ | ||
return showNameColor.get(); | ||
} | ||
} |
23 changes: 0 additions & 23 deletions
23
...in/java/net/mysticdrew/journeymapteams/handlers/properties/FTBTeamsHandlerProperties.java
This file was deleted.
Oops, something went wrong.
16 changes: 16 additions & 0 deletions
16
common/src/main/java/net/mysticdrew/journeymapteams/handlers/properties/Properties.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,16 @@ | ||
package net.mysticdrew.journeymapteams.handlers.properties; | ||
|
||
public interface Properties | ||
{ | ||
int getTeamColor(); | ||
|
||
int getAllyColor(); | ||
|
||
boolean getForceAllyColor(); | ||
|
||
boolean getForceTeamColor(); | ||
|
||
boolean getShowIconColor(); | ||
|
||
boolean getShowNameColor(); | ||
} |
23 changes: 0 additions & 23 deletions
23
...ain/java/net/mysticdrew/journeymapteams/handlers/properties/VanillaHandlerProperties.java
This file was deleted.
Oops, something went wrong.
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