-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Visual Prospecting/Journeymap Integration (#9)
* Add Journeymap integration * update bs * serverutilities.journeymap.enable can enable/disable chunks being sent to certain ranks/players. On by default. * remove old player rank file check, not used. * cache mod check
- Loading branch information
Showing
29 changed files
with
672 additions
and
41 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
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
12 changes: 12 additions & 0 deletions
12
src/main/java/serverutils/integration/vp/VPButtonManager.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 serverutils.integration.vp; | ||
|
||
import com.sinthoras.visualprospecting.integration.model.buttons.ButtonManager; | ||
|
||
public class VPButtonManager extends ButtonManager { | ||
|
||
public static final VPButtonManager INSTANCE = new VPButtonManager(); | ||
|
||
public VPButtonManager() { | ||
super("serverutilities.vp.button", "team"); | ||
} | ||
} |
121 changes: 121 additions & 0 deletions
121
src/main/java/serverutils/integration/vp/VPClaimsLocation.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,121 @@ | ||
package serverutils.integration.vp; | ||
|
||
import java.util.Collection; | ||
import java.util.Collections; | ||
|
||
import net.minecraft.util.EnumChatFormatting; | ||
import net.minecraft.world.ChunkCoordIntPair; | ||
|
||
import com.sinthoras.visualprospecting.Utils; | ||
import com.sinthoras.visualprospecting.integration.model.locations.IWaypointAndLocationProvider; | ||
import com.sinthoras.visualprospecting.integration.model.waypoints.Waypoint; | ||
|
||
import serverutils.client.gui.ClientClaimedChunks; | ||
import serverutils.lib.EnumTeamColor; | ||
import serverutils.lib.math.ChunkDimPos; | ||
import serverutils.net.MessageClaimedChunksModify; | ||
import serverutils.net.MessageJourneyMapRequest; | ||
|
||
public class VPClaimsLocation implements IWaypointAndLocationProvider { | ||
|
||
private final int blockX; | ||
private final int blockZ; | ||
private final int dimensionId; | ||
private final String teamName; | ||
private final boolean loaded; | ||
private final boolean ally; | ||
private final boolean member; | ||
private final EnumTeamColor color; | ||
|
||
public VPClaimsLocation(ChunkDimPos chunk, ClientClaimedChunks.ChunkData data) { | ||
blockX = Utils.coordChunkToBlock(chunk.posX); | ||
blockZ = Utils.coordChunkToBlock(chunk.posZ); | ||
dimensionId = chunk.dim; | ||
teamName = data.team.nameComponent.getUnformattedText(); | ||
loaded = data.isLoaded(); | ||
color = data.team.color; | ||
ally = data.team.isAlly; | ||
member = data.team.isMember; | ||
} | ||
|
||
public double getBlockX() { | ||
return blockX + 0.5; | ||
} | ||
|
||
public double getBlockZ() { | ||
return blockZ + 0.5; | ||
} | ||
|
||
public int getDimensionId() { | ||
return dimensionId; | ||
} | ||
|
||
public String getTeamName() { | ||
return color.getEnumChatFormatting() + teamName; | ||
} | ||
|
||
public boolean isLoaded() { | ||
return loaded; | ||
} | ||
|
||
public String loadedHint() { | ||
return isLoaded() ? EnumChatFormatting.GREEN + "Loaded" : ""; | ||
} | ||
|
||
public String teamHint() { | ||
if (member) { | ||
return EnumChatFormatting.DARK_AQUA + "Your Team"; | ||
} else if (ally) { | ||
return EnumChatFormatting.YELLOW + "Ally"; | ||
} else { | ||
return ""; | ||
} | ||
} | ||
|
||
public EnumTeamColor getTeamColor() { | ||
return color; | ||
} | ||
|
||
public void toggleLoaded() { | ||
// Double click loads/unloads the chunk | ||
int selectionMode = isLoaded() ? MessageClaimedChunksModify.UNLOAD : MessageClaimedChunksModify.LOAD; | ||
Collection<ChunkCoordIntPair> chunks = Collections | ||
.singleton(new ChunkCoordIntPair(Utils.coordBlockToChunk(blockX), Utils.coordBlockToChunk(blockZ))); | ||
new MessageClaimedChunksModify( | ||
Utils.coordBlockToChunk(blockX), | ||
Utils.coordBlockToChunk(blockZ), | ||
selectionMode, | ||
chunks).sendToServer(); | ||
new MessageJourneyMapRequest(blockX, blockX, blockZ, blockZ).sendToServer(); | ||
} | ||
|
||
public void removeClaim() { | ||
// Deplete/VP Action key unclaims the chunk | ||
int selectionMode = MessageClaimedChunksModify.UNCLAIM; | ||
Collection<ChunkCoordIntPair> chunks = Collections | ||
.singleton(new ChunkCoordIntPair(Utils.coordBlockToChunk(blockX), Utils.coordBlockToChunk(blockZ))); | ||
new MessageClaimedChunksModify( | ||
Utils.coordBlockToChunk(blockX), | ||
Utils.coordBlockToChunk(blockZ), | ||
selectionMode, | ||
chunks).sendToServer(); | ||
new MessageJourneyMapRequest(blockX, blockX, blockZ, blockZ).sendToServer(); | ||
} | ||
|
||
@Override | ||
public Waypoint toWaypoint() { | ||
toggleLoaded(); | ||
return null; | ||
} | ||
|
||
@Override | ||
public boolean isActiveAsWaypoint() { | ||
return false; | ||
} | ||
|
||
@Override | ||
public void onWaypointCleared() {} | ||
|
||
@Override | ||
public void onWaypointUpdated(Waypoint waypoint) {} | ||
} |
Oops, something went wrong.