-
-
Notifications
You must be signed in to change notification settings - Fork 48
Setting up
Ali edited this page Nov 21, 2023
·
2 revisions
We will use the following:
- Gradle (Groovy) v8.2
- Java 17
- Spigot 1.17
- IntelliJ IDEA
First, we will create a new project in IntelliJ IDEA.
- Pick a name. We will go with
sun-bans
for this project (Sun because Lamp!)- Make sure you choose "Java", "Gradle", "JDK 17" and "Groovy".
- You can optionally choose to create a Git repository
- We do not want sample code.
- Press
Create
to create a new project.
- Head straight to
build.gradle
- We want to add the JitPack repository, as well as Spigot repositories.
Add the following to your
build.gradle
:
repositories {
mavenCentral()
// The JitPack repository, where Lamp is hosted
maven { url = "https://jitpack.io/" }
// Repositories required for Spigot
maven { url = "https://hub.spigotmc.org/nexus/content/repositories/snapshots/" }
maven { url = "https://oss.sonatype.org/content/groups/public/" }
}
- We also want to add our dependencies. Add the following to your
build.gradle
:
dependencies {
// The lamp version. This will allow us to easily
// update it in the future.
def lamp_version = "3.1.8"
// Required for all platforms
implementation("com.github.Revxrsal.Lamp:common:${lamp_version}")
// The Bukkit API for Lamp
implementation("com.github.Revxrsal.Lamp:bukkit:${lamp_version}")
// The Spigot API.
compileOnly("org.spigotmc:spigot-api:1.17-R0.1-SNAPSHOT")
// The adventure API. It may be required at compile-time
compileOnly("net.kyori:adventure-platform-bukkit:4.1.2")
}
- Because we need Lamp to be present when the plugin is running, we have to bundle it in our plugin. For this, we will use the
ShadowJar
plugin.
plugins {
id "com.github.johnrengelman.shadow" version "7.1.2"
// ^^ add this to your plugins {} block
id "java"
}
- We also want to add parameter naming. This will preserve our parameter names when the plugin runs, allowing Lamp to automatically generate usages and parameter names.
To do this, add the following:
compileJava {
options.compilerArgs += ["-parameters"]
}
We're done with our build.gradle! Your file should look like this:
plugins {
id "com.github.johnrengelman.shadow" version "7.1.2"
id "java"
}
group = "org.example"
version = "1.0"
sourceCompatibility = 17
targetCompatibility = 17
repositories {
mavenCentral()
// The JitPack repository, where Lamp is hosted
maven { url = "https://jitpack.io/" }
// Repositories required for Spigot
maven { url = "https://hub.spigotmc.org/nexus/content/repositories/snapshots/" }
maven { url = "https://oss.sonatype.org/content/groups/public/" }
}
dependencies {
// The lamp version. This will allow us to easily
// update it in the future.
def lamp_version = "3.1.8"
// Required for all platforms
implementation("com.github.Revxrsal.Lamp:common:${lamp_version}")
// The Bukkit API for Lamp
implementation("com.github.Revxrsal.Lamp:bukkit:${lamp_version}")
// The Spigot API
compileOnly("org.spigotmc:spigot-api:1.17-R0.1-SNAPSHOT")
// The adventure API. It may be required at compile-time
compileOnly("net.kyori:adventure-platform-bukkit:4.1.2")
}
// Preserve parameter names in command usage
compileJava {
options.compilerArgs += ["-parameters"]
}
👋 If you're having trouble, need support, or just feel like chatting, feel free to hop by our Discord server!