Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions config.example.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,11 @@
"getBlockTypes": false,
"listBlocks": false,
"getWorldInfo": false,
"getServerInfo": false
"getServerInfo": false,
"getBlock": false,
"breakBlock": false,
"scanRegion": false,
"getHeightmap": false
},
"admins": {
"listPlayers": true,
Expand All @@ -33,8 +37,14 @@
"getBlockTypes": true,
"listBlocks": true,
"getWorldInfo": true,
"getServerInfo": true
"getServerInfo": true,
"getBlock": true,
"breakBlock": true,
"scanRegion": true,
"getHeightmap": true
},
"maxBlocksBatch": 1000
"maxBlocksBatch": 1000,
"maxScanVolume": 32768,
"maxHeightmapSamples": 10000
}
}
31 changes: 31 additions & 0 deletions deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/bash
# Builds and deploys the MCP plugin jar to Willikins, backing up the previous
# jar first (timestamped, inside the container), and restarts the server.
# Run from anywhere - paths are relative to this script's own location.
#
# Usage: deploy.sh
set -e

HOST="chad@willikins.cetacean-cloud.ts.net"
PLUGIN_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
JAR_NAME="MCP-0.2.0.jar"

echo "Building..."
(cd "$PLUGIN_DIR" && mvn -q -f pom.xml package)

echo "Backing up previous jar (if any)..."
ssh "$HOST" "docker exec hytale sh -c 'test -f /home/hytale/server-files/mods/$JAR_NAME && cp /home/hytale/server-files/mods/$JAR_NAME /home/hytale/server-files/mods/$JAR_NAME.bak-\$(date +%Y%m%d-%H%M%S) || true'"

echo "Copying jar to server..."
scp -q "$PLUGIN_DIR/target/$JAR_NAME" "$HOST":~/"$JAR_NAME"

echo "Installing jar and restarting..."
ssh "$HOST" "docker cp ~/$JAR_NAME hytale:/home/hytale/server-files/mods/$JAR_NAME && docker restart hytale"

echo "Waiting for server to come back up..."
sleep 14
ssh "$HOST" "docker ps | grep hytale"

echo ""
echo "Recent log lines (check for a clean init):"
ssh "$HOST" "docker exec hytale sh -c 'LOG=\$(ls -t /home/hytale/server-files/logs/*_server.log | head -1); grep -iE \"MCP\\|P\" \"\$LOG\" | tail -15'"
25 changes: 25 additions & 0 deletions src/main/java/com/top_serveurs/hytale/plugins/mcp/McpPlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -81,17 +81,42 @@ private void registerFeatures() {
featureRegistry.registerFeature(new ListPlayersFeature(logger));
featureRegistry.registerFeature(new GetPlayerPositionFeature(logger));
featureRegistry.registerFeature(new ListBlocksFeature(logger));
featureRegistry.registerFeature(new GetBlockFeature(logger));
featureRegistry.registerFeature(new ScanRegionFeature(logger, config));
featureRegistry.registerFeature(new ReplaceBlocksInRegionFeature(logger, config));
featureRegistry.registerFeature(new GetHeightmapFeature(logger, config));
featureRegistry.registerFeature(new ExecuteCommandFeature(logger, config));
featureRegistry.registerFeature(new GiveItemFeature(logger, config));
featureRegistry.registerFeature(new BroadcastMessageFeature(logger, config));
featureRegistry.registerFeature(new SetBlockFeature(logger));
featureRegistry.registerFeature(new BreakBlockFeature(logger));
featureRegistry.registerFeature(new BreakBlocksBatchFeature(logger, config));
featureRegistry.registerFeature(new SetBlocksBatchFeature(logger, config));
featureRegistry.registerFeature(new FlattenTerrainFeature(logger, config));
featureRegistry.registerFeature(new GetBuildingGuideFeature(logger, config));
featureRegistry.registerFeature(new GetWorldInfoFeature(logger));
featureRegistry.registerFeature(new GetServerInfoFeature(logger, config, getIdentifier()));
featureRegistry.registerFeature(new SendChatMessageFeature(logger));
featureRegistry.registerFeature(new GetLogsFeature(logger));
featureRegistry.registerFeature(new AddWaypointFeature(logger));
featureRegistry.registerFeature(new RemoveWaypointFeature(logger));
featureRegistry.registerFeature(new ListWaypointsFeature(logger));
featureRegistry.registerFeature(new VerifyPlacementFeature(logger, config));
featureRegistry.registerFeature(new GenerateRoadCorridorFeature(logger, config));
featureRegistry.registerFeature(new ListNpcRolesFeature(logger, config));
featureRegistry.registerFeature(new ListModelsFeature(logger, config));
featureRegistry.registerFeature(new SpawnNpcFeature(logger, config));
featureRegistry.registerFeature(new DespawnNpcFeature(logger, config));
featureRegistry.registerFeature(new SetNpcPathFeature(logger, config));
featureRegistry.registerFeature(new GetNpcPositionFeature(logger, config));
featureRegistry.registerFeature(new SetNpcFlagFeature(logger, config));
featureRegistry.registerFeature(new StartNpcTraceFeature(logger, config));
featureRegistry.registerFeature(new StopNpcTraceFeature(logger, config));
featureRegistry.registerFeature(new ListItemsFeature(logger, config));
featureRegistry.registerFeature(new GenerateSphereFeature(logger, config));
featureRegistry.registerFeature(new GenerateCylinderFeature(logger, config));
featureRegistry.registerFeature(new GenerateLatticeColumnFeature(logger, config));
featureRegistry.registerFeature(new GenerateStaircaseFeature(logger, config));

logger.atInfo().log("Registered " + featureRegistry.toString() + " features");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,9 @@ public static class FeaturesConfig {
private FeaturePermissions players = new FeaturePermissions();
private FeaturePermissions admins = new FeaturePermissions();
private int maxBlocksBatch = 1000;
private int maxScanVolume = 32768;
private int maxHeightmapSamples = 10000;
private int maxReplaceVolume = 500000;

public FeaturePermissions getPlayers() {
return players;
Expand All @@ -165,6 +168,30 @@ public int getMaxBlocksBatch() {
public void setMaxBlocksBatch(int maxBlocksBatch) {
this.maxBlocksBatch = maxBlocksBatch;
}

public int getMaxScanVolume() {
return maxScanVolume;
}

public void setMaxScanVolume(int maxScanVolume) {
this.maxScanVolume = maxScanVolume;
}

public int getMaxHeightmapSamples() {
return maxHeightmapSamples;
}

public void setMaxHeightmapSamples(int maxHeightmapSamples) {
this.maxHeightmapSamples = maxHeightmapSamples;
}

public int getMaxReplaceVolume() {
return maxReplaceVolume;
}

public void setMaxReplaceVolume(int maxReplaceVolume) {
this.maxReplaceVolume = maxReplaceVolume;
}
}

public static class FeaturePermissions {
Expand All @@ -179,6 +206,20 @@ public static class FeaturePermissions {
private boolean getWorldInfo = false;
private boolean getServerInfo = false;
private boolean listBlocks = false;
private boolean getBlock = false;
private boolean breakBlock = false;
private boolean scanRegion = false;
private boolean getHeightmap = false;
private boolean addWaypoint = false;
private boolean removeWaypoint = false;
private boolean listWaypoints = false;
private boolean listNpcRoles = false;
private boolean spawnNpc = false;
private boolean listModels = false;
private boolean getNpcPosition = false;
private boolean npcTrace = false;
private boolean listItems = false;
private boolean replaceBlocksInRegion = false;

public boolean canListPlayers() {
return listPlayers;
Expand Down Expand Up @@ -267,5 +308,117 @@ public boolean canListBlocks() {
public void setListBlocks(boolean listBlocks) {
this.listBlocks = listBlocks;
}

public boolean canGetBlock() {
return getBlock;
}

public void setGetBlock(boolean getBlock) {
this.getBlock = getBlock;
}

public boolean canBreakBlock() {
return breakBlock;
}

public void setBreakBlock(boolean breakBlock) {
this.breakBlock = breakBlock;
}

public boolean canScanRegion() {
return scanRegion;
}

public void setScanRegion(boolean scanRegion) {
this.scanRegion = scanRegion;
}

public boolean canGetHeightmap() {
return getHeightmap;
}

public void setGetHeightmap(boolean getHeightmap) {
this.getHeightmap = getHeightmap;
}

public boolean canAddWaypoint() {
return addWaypoint;
}

public void setAddWaypoint(boolean addWaypoint) {
this.addWaypoint = addWaypoint;
}

public boolean canRemoveWaypoint() {
return removeWaypoint;
}

public void setRemoveWaypoint(boolean removeWaypoint) {
this.removeWaypoint = removeWaypoint;
}

public boolean canListWaypoints() {
return listWaypoints;
}

public void setListWaypoints(boolean listWaypoints) {
this.listWaypoints = listWaypoints;
}

public boolean canListNpcRoles() {
return listNpcRoles;
}

public void setListNpcRoles(boolean listNpcRoles) {
this.listNpcRoles = listNpcRoles;
}

public boolean canSpawnNpc() {
return spawnNpc;
}

public void setSpawnNpc(boolean spawnNpc) {
this.spawnNpc = spawnNpc;
}

public boolean canListModels() {
return listModels;
}

public void setListModels(boolean listModels) {
this.listModels = listModels;
}

public boolean canGetNpcPosition() {
return getNpcPosition;
}

public void setGetNpcPosition(boolean getNpcPosition) {
this.getNpcPosition = getNpcPosition;
}

public boolean canNpcTrace() {
return npcTrace;
}

public void setNpcTrace(boolean npcTrace) {
this.npcTrace = npcTrace;
}

public boolean canListItems() {
return listItems;
}

public void setListItems(boolean listItems) {
this.listItems = listItems;
}

public boolean canReplaceBlocksInRegion() {
return replaceBlocksInRegion;
}

public void setReplaceBlocksInRegion(boolean replaceBlocksInRegion) {
this.replaceBlocksInRegion = replaceBlocksInRegion;
}
}
}
Loading