-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add team support for FTB Teams and Argonauts
- Loading branch information
1 parent
c37ae5b
commit 9c1e97e
Showing
13 changed files
with
126 additions
and
12 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
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
19 changes: 19 additions & 0 deletions
19
src/main/java/net/permutated/pylons/compat/teams/ArgonautTeamSupport.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,19 @@ | ||
package net.permutated.pylons.compat.teams; | ||
|
||
import earth.terrarium.argonauts.api.guild.Guild; | ||
import earth.terrarium.argonauts.api.guild.GuildApi; | ||
import net.minecraftforge.server.ServerLifecycleHooks; | ||
|
||
import java.util.UUID; | ||
|
||
public class ArgonautTeamSupport implements TeamSupport { | ||
@Override | ||
public boolean arePlayersInSameTeam(UUID player1, UUID player2) { | ||
Guild guild = GuildApi.API.getPlayerGuild(ServerLifecycleHooks.getCurrentServer(), player1); | ||
|
||
if (guild != null) { | ||
return guild.members().isMember(player2); | ||
} | ||
return false; | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
src/main/java/net/permutated/pylons/compat/teams/FTBTeamSupport.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,12 @@ | ||
package net.permutated.pylons.compat.teams; | ||
|
||
import dev.ftb.mods.ftbteams.api.FTBTeamsAPI; | ||
|
||
import java.util.UUID; | ||
|
||
public class FTBTeamSupport implements TeamSupport { | ||
@Override | ||
public boolean arePlayersInSameTeam(UUID player1, UUID player2) { | ||
return FTBTeamsAPI.api().getManager().arePlayersInSameTeam(player1, player2); | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
src/main/java/net/permutated/pylons/compat/teams/NoTeamSupport.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,10 @@ | ||
package net.permutated.pylons.compat.teams; | ||
|
||
import java.util.UUID; | ||
|
||
public class NoTeamSupport implements TeamSupport { | ||
@Override | ||
public boolean arePlayersInSameTeam(UUID player1, UUID player2) { | ||
return false; | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
src/main/java/net/permutated/pylons/compat/teams/TeamCompat.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,21 @@ | ||
package net.permutated.pylons.compat.teams; | ||
|
||
import net.minecraftforge.fml.ModList; | ||
|
||
public class TeamCompat { | ||
private TeamCompat() { | ||
// nothing to do | ||
} | ||
private static TeamSupport instance = new NoTeamSupport(); | ||
public static TeamSupport getInstance() { | ||
return instance; | ||
} | ||
|
||
public static void init() { | ||
if (ModList.get().isLoaded("ftbteams")) { | ||
instance = new FTBTeamSupport(); | ||
} else if (ModList.get().isLoaded("argonauts")) { | ||
instance = new ArgonautTeamSupport(); | ||
} | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
src/main/java/net/permutated/pylons/compat/teams/TeamSupport.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,7 @@ | ||
package net.permutated.pylons.compat.teams; | ||
|
||
import java.util.UUID; | ||
|
||
public interface TeamSupport { | ||
boolean arePlayersInSameTeam(UUID player1, UUID player2); | ||
} |
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