Updated the command block whitelist to add functionality to restore, clear, and remove whitelisted blocks from specific players, or globaly. I also patched the full system check bug that left a residual command block.

This commit is contained in:
trouper
2024-05-31 13:30:55 -05:00
parent 76dee13cd0
commit 3cc69a9ae1
11 changed files with 217 additions and 55 deletions

View File

@@ -1,45 +1,43 @@
#!/bin/bash
# Run Gradle build
# Navigate to the directory containing the Gradle project
cd "/run/media/trouper/1TB drive/IJ/IdeaProjects/Sentinel/" || exit
# Run the Gradle build command
./gradlew build
# Check if the build was successful
if [ $? -eq 0 ]; then
echo "Gradle build successful."
# SFTP upload
SFTP_HOST="server"
SFTP_USER="trouper"
SFTP_REMOTE_DIR="/home/trouper/docker/data/plugins/"
# Create a temporary file with a unique name
TEMP_FILE=$(mktemp)
# Specify the local file to upload
LOCAL_FILE="/run/media/trouper/'1TB drive'/IJ/IdeaProjects/Sentinel/build/libs/Sentinel-0.2.5.jar"
# Write the SFTP commands to the temporary file
echo "put $LOCAL_FILE $SFTP_REMOTE_DIR" > "$TEMP_FILE"
echo "bye" >> "$TEMP_FILE"
# Use sftp non-interactively with the specified commands
sftp -oStrictHostKeyChecking=no -oBatchMode=no -b "$TEMP_FILE" "$SFTP_USER@$SFTP_HOST"
# Remove the temporary file
rm -f "$TEMP_FILE"
# SSH command to reload the plugin on the host
SSH_COMMANDS=(
"pm reload Sentinel"
"execute at @a run playsound minecraft:entity.experience_orb.pickup master @a \~ \~ \~ 100 1 1"
"tellraw @a '\"'[Server] Reload Complete, Upload Successful.'\"'"
)
for cmd in "${SSH_COMMANDS[@]}"; do
ssh -oStrictHostKeyChecking=no -oBatchMode=no "$SFTP_USER@$SFTP_HOST" "docker exec docker_mc_1 mc-send-to-console $cmd"
done
echo "Plugin reloaded."
else
echo "Gradle build failed."
if [ $? -ne 0 ]; then
echo "Gradle build failed"
exit 1
fi
# Specify the output file path (modify this according to your build configuration)
OUTPUT_FILE_PATH="/run/media/trouper/1TB drive/IJ/IdeaProjects/Sentinel/build/libs/Sentinel-0.2.6.jar"
# Check if the output file exists
if [ ! -f "$OUTPUT_FILE_PATH" ]; then
echo "Output file not found: $OUTPUT_FILE_PATH"
exit 1
fi
# Upload the file to the SFTP server
HOST="yessir.network"
PORT="2022"
USER="obvwolf.1f8509dc"
PASSWORD='^8u%eQ2u6^TyuDU&$NNmW52s' # Enclose the password in single quotes if it has special characters
REMOTE_DIR="/plugins/"
# Use 'lftp' to handle the SFTP upload
lftp -u "$USER","$PASSWORD" sftp://"$HOST":"$PORT" <<EOF
cd "$REMOTE_DIR"
put "$OUTPUT_FILE_PATH"
bye
EOF
if [ $? -ne 0 ]; then
echo "File upload failed"
exit 1
fi
echo "Build and upload completed successfully"