Kamp Gradle Plugins

Gradle plugins for Kamp

License

License

GroupId

GroupId

ch.leadrian.samp.kamp
ArtifactId

ArtifactId

kamp-server-starter
Last Version

Last Version

1.0.0-rc2
Release Date

Release Date

Type

Type

jar
Description

Description

Kamp Gradle Plugins
Gradle plugins for Kamp
Project URL

Project URL

https://github.com/Double-O-Seven/kamp-server-starter
Source Code Management

Source Code Management

https://github.com/Double-O-Seven/kamp-server-starter

Download kamp-server-starter

How to add to project

<!-- https://jarcasting.com/artifacts/ch.leadrian.samp.kamp/kamp-server-starter/ -->
<dependency>
    <groupId>ch.leadrian.samp.kamp</groupId>
    <artifactId>kamp-server-starter</artifactId>
    <version>1.0.0-rc2</version>
</dependency>
// https://jarcasting.com/artifacts/ch.leadrian.samp.kamp/kamp-server-starter/
implementation 'ch.leadrian.samp.kamp:kamp-server-starter:1.0.0-rc2'
// https://jarcasting.com/artifacts/ch.leadrian.samp.kamp/kamp-server-starter/
implementation ("ch.leadrian.samp.kamp:kamp-server-starter:1.0.0-rc2")
'ch.leadrian.samp.kamp:kamp-server-starter:jar:1.0.0-rc2'
<dependency org="ch.leadrian.samp.kamp" name="kamp-server-starter" rev="1.0.0-rc2">
  <artifact name="kamp-server-starter" type="jar" />
</dependency>
@Grapes(
@Grab(group='ch.leadrian.samp.kamp', module='kamp-server-starter', version='1.0.0-rc2')
)
libraryDependencies += "ch.leadrian.samp.kamp" % "kamp-server-starter" % "1.0.0-rc2"
[ch.leadrian.samp.kamp/kamp-server-starter "1.0.0-rc2"]

Dependencies

runtime (5)

Group / Artifact Type Version
org.jetbrains.kotlin : kotlin-gradle-plugin jar 1.3.11
org.jetbrains.kotlin : kotlin-stdlib-jdk8 jar 1.3.11
de.undercouch : gradle-download-task jar 3.4.3
org.apache.commons : commons-lang3 jar 3.8.1
com.google.guava : guava jar 26.0-jre

Project Modules

There are no modules declared in this project.

Build Status Gradle Plugins Release

Kamp Server Starter Gradle Plugin

A simple Gradle plugin to configure and start a SA-MP server running the Kamp plugin.

The plugin provides 2 relevant tasks:

  • configureServer: Fully configures a runnable SA-MP server by performing the following steps:
    • Download the SA-MP server package from www.sa-mp.com
    • Adding all required plugin binaries (SAMPGDK and Kamp)
    • If configured, add additional third-party native plugins (ColAndreas for example)
    • Write server.cfg based on the configuration given by the serverStarter Gradle extension
    • Set up the Kamp directory structure
    • Copy all runtime classpath dependencies of the gamemode into server's directory
    • Configure config.properties
    • Configure jvmopts.txt
  • startServer: Start a SA-MP server with the gamemode project, depends on configureServer

The plugin also provides the serverStarter extension.

A minimal extension configuration should look like this:

plugins {
    id("ch.leadrian.samp.kamp.kamp-server-starter") version "1.0.0-rc4"
}

serverStarter {
    gameModeClassName = "ch.leadrian.samp.sadm.SanAndreasDeathmatchGameMode"
}

However, it is recommended to configure at least the following options:

plugins {
    id("ch.leadrian.samp.kamp.kamp-server-starter") version "1.0.0-rc4"
}

serverStarter {
    gameModeClassName = "ch.leadrian.samp.sadm.SanAndreasDeathmatchGameMode"
    // Careful! Do not configure the RCON password here if you want to configure your productive server
    rconPassword = "test1234"
    jvmOption("-Xmx1G")
}

Sometimes, it could happen that you want to upgrade to a newer Kamp version, however, the binary SA-MP plugin is not updated yet for some reason (you are compiling it yourself and haven't done so yet). In that case, you will get a version mismatching exception when starting your server which will prevent server start up. To disable this behaviour, you may set the config property kamp.ignore.version.mismatch to true (which is not recommended):

plugins {
    id("ch.leadrian.samp.kamp.kamp-server-starter") version "1.0.0-rc4"
}

serverStarter {
    gameModeClassName = "ch.leadrian.samp.sadm.SanAndreasDeathmatchGameMode"
    // Only receive version mismatch warning on server start up, of the binary SA-MP plugin's version does not match the versions of the Kamp JAR files you're using
    configProperty("kamp.ignore.version.mismatch", true)
    rconPassword = "test1234"
}

A complete configuration will look this:

plugins {
    id("ch.leadrian.samp.kamp.kamp-server-starter") version "1.0.0-rc4"
}

serverStarter {
    gameModeClassName = "ch.leadrian.samp.sadm.SanAndreasDeathmatchGameMode"
    
    // Add a value for an injectable property value,see https://github.com/Netflix/governator/wiki/Configuration-Mapping
    configProperty("my.anti.spam.system.max.messages.per.second", 1)
    
    // Default value is OperatingSystem.current() which depends on your machine
    // Override this value if you want to configure your productive Linux server on a Windows machien for example
    operatingSystem = OperatingSystem.WINDOWS
    
    // Override the download URL if you don't want to use the default download URL
    windowsServerDownloadUrl = "http://files.sa-mp.com/samp037_svr_R2-1-1_win32.zip"

    // Override the download URL if you don't want to use the default download URL
    linuxServerDownloadUrl = "http://files.sa-mp.com/samp037svr_R2-1.tar.gz"

    // Override this if you want to use a Kamp native plugin binary you compiled yourself
    // By default the kamp.so packaged with this Gradle plugin will be deployed, it should contain the newest version
    linuxKampPluginFile = file("path/to/alternative/plugin/binary")
    
    // Override this if you want to use a Kamp native plugin binary you compiled yourself
    // By default the kamp.dll packaged with this Gradle plugin will be deployed, it should contain the newest version
    windowsKampPluginFile = file("path/to/alternative/plugin/binary")

    // Add additional native plugin binaries that will be add to the plugins folder and to server.cfg
    additionalWindowsPlugins(file("path/to/FCNPC.dll"), file("path/to/ColAndreas.dll"))
    
    // Add additional native plugin binaries that will be add to the plugins folder and to server.cfg
    additionalLinuxPlugins(file("path/to/FCNPC.so"), file("path/to/ColAndreas.so"))

    // Add a single JVM option
    jvmOption("-Xmx1G")
    
    // Add multiple JVM options
    jvmOptions("-Xms100M", "-Xmx1G")
    
    // The following properties can be used to configure the corresponding server.cfg values

    lanMode = false
    
    // By default, a random password will be generated
    rconPassword = "supersecretpassword"

    maxPlayers = 100

    port = 7777

    hostName = "San Andreas Deathmatch"

    announce = false

    chatLogging = false

    webUrl = "www.sa-mp.com"

    onFootRate = 40

    inCarRate = 40

    weaponRate = 40

    streamDistance = 300f

    streamRate = 1000

    maxNPCs = 0

    logTimeFormat = "[%H:%M:%S]"

    language = "English"
    
    // Add additional server.cfg values that are not supported by the extension
    additionalServerCfgValue("useartwork", 1)
}

For working examples have a look at the kamp-examples repository which contains several example gamemodes.

Versions

Version
1.0.0-rc2
1.0.0-rc1