Skip to content

Commit 2df4e18

Browse files
committed
Init
0 parents  commit 2df4e18

File tree

19 files changed

+1018
-0
lines changed

19 files changed

+1018
-0
lines changed

.gitignore

Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
# User-specific stuff
2+
data/
3+
.idea/
4+
5+
*.iml
6+
*.ipr
7+
*.iws
8+
9+
# IntelliJ
10+
out/
11+
# mpeltonen/sbt-idea plugin
12+
.idea_modules/
13+
14+
# JIRA plugin
15+
atlassian-ide-plugin.xml
16+
17+
# Compiled class file
18+
*.class
19+
20+
# Log file
21+
*.log
22+
23+
# BlueJ files
24+
*.ctxt
25+
26+
# Package Files #
27+
*.jar
28+
*.war
29+
*.nar
30+
*.ear
31+
*.zip
32+
*.tar.gz
33+
*.rar
34+
35+
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
36+
hs_err_pid*
37+
38+
*~
39+
40+
# temporary files which can be created if a process still has a handle open of a deleted file
41+
.fuse_hidden*
42+
43+
# KDE directory preferences
44+
.directory
45+
46+
# Linux trash folder which might appear on any partition or disk
47+
.Trash-*
48+
49+
# .nfs files are created when an open file is removed but is still being accessed
50+
.nfs*
51+
52+
# General
53+
.DS_Store
54+
.AppleDouble
55+
.LSOverride
56+
57+
# Icon must end with two \r
58+
Icon
59+
60+
# Thumbnails
61+
._*
62+
63+
# Files that might appear in the root of a volume
64+
.DocumentRevisions-V100
65+
.fseventsd
66+
.Spotlight-V100
67+
.TemporaryItems
68+
.Trashes
69+
.VolumeIcon.icns
70+
.com.apple.timemachine.donotpresent
71+
72+
# Directories potentially created on remote AFP share
73+
.AppleDB
74+
.AppleDesktop
75+
Network Trash Folder
76+
Temporary Items
77+
.apdisk
78+
79+
# Windows thumbnail cache files
80+
Thumbs.db
81+
Thumbs.db:encryptable
82+
ehthumbs.db
83+
ehthumbs_vista.db
84+
85+
# Dump file
86+
*.stackdump
87+
88+
# Folder config file
89+
[Dd]esktop.ini
90+
91+
# Recycle Bin used on file shares
92+
$RECYCLE.BIN/
93+
94+
# Windows Installer files
95+
*.cab
96+
*.msi
97+
*.msix
98+
*.msm
99+
*.msp
100+
101+
# Windows shortcuts
102+
*.lnk
103+
104+
.gradle
105+
build/
106+
107+
# Ignore Gradle GUI config
108+
gradle-app.setting
109+
110+
# Cache of project
111+
.gradletasknamecache
112+
113+
**/build/
114+
115+
# Common working directory
116+
run/
117+
runs/
118+
119+
# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)
120+
!gradle-wrapper.jar

README.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# PterodactylPowerAction
2+
3+
A Velocity plugin to start and stop servers using the [Pterodactyl](https://pterodactyl.io/) client API.
4+
5+
## How it works
6+
7+
This plugin will stop a server after a given delay (1 hour by default) if it is empty after a player left or changed
8+
server.
9+
10+
When a player tries to connect to a stopped server, they will be redirected to a waiting server such
11+
as [Limbo](https://www.spigotmc.org/resources/82468/) and will be automatically redirected to the requested server once
12+
it is started.
13+
14+
If the player is already connected on the network, they will simply be informed by a message that they will be
15+
automatically redirected once the server is ready.
16+
17+
If the server fails to start, the player will be informed to try again.
18+
19+
## Configuration
20+
21+
You will need a Pterodactyl instance. First, create a client API key which can be found under "Account Settings" then "
22+
API Credentials", the URL path should be `/account/api`.
23+
24+
Configure a waiting server in your `velocity.toml` file, such as:
25+
26+
```toml
27+
[servers]
28+
limbo = "127.0.0.1:30066"
29+
```
30+
31+
Install the plugin on your Velocity proxy, a default configuration file will be created.
32+
33+
Edit the plugin's configuration file to include your Pterodactyl credentials.
34+
35+
## Motivations
36+
37+
I am running Minecraft servers on dedicated hardware at home, and I wanted to save energy costs by stopping empty
38+
servers.
39+
40+
My Limbo server is running on a low power ARM Single Board Computer to further save costs.

build.gradle

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
plugins {
2+
id 'java'
3+
id 'eclipse'
4+
id 'org.jetbrains.gradle.plugin.idea-ext' version '1.1.8'
5+
id 'xyz.jpenilla.run-velocity' version "2.3.1"
6+
}
7+
8+
group = 'fr.pickaria'
9+
version = '1.0-SNAPSHOT'
10+
11+
repositories {
12+
mavenCentral()
13+
maven {
14+
name = "papermc-repo"
15+
url = "https://repo.papermc.io/repository/maven-public/"
16+
}
17+
maven {
18+
name = "sonatype"
19+
url = "https://oss.sonatype.org/content/groups/public/"
20+
}
21+
}
22+
23+
dependencies {
24+
compileOnly("com.velocitypowered:velocity-api:3.4.0-SNAPSHOT")
25+
annotationProcessor("com.velocitypowered:velocity-api:3.4.0-SNAPSHOT")
26+
}
27+
28+
def targetJavaVersion = 17
29+
java {
30+
toolchain.languageVersion = JavaLanguageVersion.of(targetJavaVersion)
31+
}
32+
33+
tasks.withType(JavaCompile).configureEach {
34+
options.encoding = 'UTF-8'
35+
options.release.set(targetJavaVersion)
36+
}
37+
38+
tasks {
39+
runVelocity {
40+
// Configure the Velocity version for our task.
41+
// This is the only required configuration besides applying the plugin.
42+
// Your plugin's jar (or shadowJar if present) will be used automatically.
43+
velocityVersion("3.4.0-SNAPSHOT")
44+
}
45+
}
46+
47+
def templateSource = file('src/main/templates')
48+
def templateDest = layout.buildDirectory.dir('generated/sources/templates')
49+
def generateTemplates = tasks.register('generateTemplates', Copy) { task ->
50+
def props = ['version': project.version]
51+
task.inputs.properties props
52+
53+
task.from templateSource
54+
task.into templateDest
55+
task.expand props
56+
}
57+
58+
sourceSets.main.java.srcDir(generateTemplates.map { it.outputs })
59+
60+
project.idea.project.settings.taskTriggers.afterSync generateTemplates
61+
project.eclipse.synchronizationTasks(generateTemplates)

gradle.properties

Whitespace-only changes.

gradle/wrapper/gradle-wrapper.jar

42.4 KB
Binary file not shown.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
distributionBase=GRADLE_USER_HOME
2+
distributionPath=wrapper/dists
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10-bin.zip
4+
networkTimeout=10000
5+
validateDistributionUrl=true
6+
zipStoreBase=GRADLE_USER_HOME
7+
zipStorePath=wrapper/dists

0 commit comments

Comments
 (0)