diff --git a/build.gradle b/build.gradle index 4a90c84..136cec9 100644 --- a/build.gradle +++ b/build.gradle @@ -1,5 +1,6 @@ plugins { id 'java' + id 'org.hidetake.ssh' version '2.10.1' } group = 'com.simolzimol.levelcraft' @@ -25,4 +26,37 @@ tasks.withType(JavaCompile).configureEach { processResources { from("plugin.yml") +} + +// SSH Konfiguration für Server Upload +remotes { + server { + host = '195.201.241.113' + user = 'root' + // Option 1: Passwort (funktioniert zuverlässig) + password = System.getProperty('server.password') ?: System.getenv('SERVER_PASSWORD') + + // Option 2: SSH Key (Gradle Plugin hat Kompatibilitätsprobleme) + // identity = file("${System.getProperty('user.home')}/.ssh/levelcraft_server_key_rsa") + + // Host Key Verification deaktivieren (für Tests) + knownHosts = allowAnyHosts + } +} + +// Upload Task - nur hochladen, kein Server-Neustart +task uploadPlugin(dependsOn: jar) { + group = 'deployment' + description = 'Lädt das Plugin auf den Server hoch' + + doLast { + ssh.run { + session(remotes.server) { + println "Uploading plugin to server..." + put from: jar.archiveFile.get().asFile, + into: '/home/CloudNet/local/templates/develop/default/plugins/LevelCraft.jar' + println "Plugin successfully uploaded!" + } + } + } } \ No newline at end of file diff --git a/deploy.ps1 b/deploy.ps1 new file mode 100644 index 0000000..6fa666a --- /dev/null +++ b/deploy.ps1 @@ -0,0 +1,29 @@ +# LevelCraft Plugin Deploy Script +param( + [switch]$UsePassword, + [string]$Password = $null +) + +Write-Host "LevelCraft Plugin Deployment" -ForegroundColor Green +Write-Host "="*40 -ForegroundColor Green + +if ($UsePassword) { + if (!$Password) { + $SecurePassword = Read-Host "Server Password" -AsSecureString + $Password = [Runtime.InteropServices.Marshal]::PtrToStringAuto([Runtime.InteropServices.Marshal]::SecureStringToBSTR($SecurePassword)) + } + + Write-Host "Using password authentication..." -ForegroundColor Yellow + $env:SERVER_PASSWORD = $Password + ./gradlew uploadPlugin + Remove-Item Env:SERVER_PASSWORD -ErrorAction SilentlyContinue +} else { + Write-Host "Using SSH key authentication..." -ForegroundColor Yellow + ./gradlew uploadPlugin +} + +if ($LASTEXITCODE -eq 0) { + Write-Host "`nDeployment successful! ✅" -ForegroundColor Green +} else { + Write-Host "`nDeployment failed! ❌" -ForegroundColor Red +} \ No newline at end of file diff --git a/quick-deploy.ps1 b/quick-deploy.ps1 new file mode 100644 index 0000000..a32188c --- /dev/null +++ b/quick-deploy.ps1 @@ -0,0 +1,44 @@ +# Einfaches Deploy Script für LevelCraft +param( + [switch]$SavePassword, + [switch]$Build +) + +Write-Host "🚀 LevelCraft Quick Deploy" -ForegroundColor Green +Write-Host "=========================" -ForegroundColor Green + +# Prüfe ob Passwort bereits gesetzt ist +if (-not $env:SERVER_PASSWORD) { + Write-Host "⚠️ Server-Passwort nicht gesetzt." -ForegroundColor Yellow + + if ($SavePassword) { + Write-Host "💾 Passwort wird für diese PowerShell Session gespeichert..." -ForegroundColor Cyan + } + + $securePassword = Read-Host "🔐 Server Passwort eingeben" -AsSecureString + $env:SERVER_PASSWORD = [Runtime.InteropServices.Marshal]::PtrToStringAuto([Runtime.InteropServices.Marshal]::SecureStringToBSTR($securePassword)) + + if ($SavePassword) { + Write-Host "✅ Passwort gesetzt! Du musst es in dieser Session nicht mehr eingeben." -ForegroundColor Green + Write-Host "💡 Tipp: Verwende einfach './quick-deploy.ps1' für weitere Uploads." -ForegroundColor Cyan + } +} + +if ($Build) { + Write-Host "🔨 Building plugin..." -ForegroundColor Yellow + ./gradlew clean build + if ($LASTEXITCODE -ne 0) { + Write-Host "❌ Build failed!" -ForegroundColor Red + exit 1 + } +} + +Write-Host "📤 Uploading plugin..." -ForegroundColor Yellow +./gradlew uploadPlugin + +if ($LASTEXITCODE -eq 0) { + Write-Host "✅ Plugin successfully deployed!" -ForegroundColor Green + Write-Host "📁 Location: /home/CloudNet/local/templates/develop/default/plugins/LevelCraft.jar" -ForegroundColor Cyan +} else { + Write-Host "❌ Upload failed!" -ForegroundColor Red +} \ No newline at end of file