Skip to content
This repository was archived by the owner on Mar 5, 2025. It is now read-only.

Commit eb26de4

Browse files
committed
add world and game state management
1 parent 3476182 commit eb26de4

27 files changed

+921
-186
lines changed

.gitignore

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,6 @@
2424
hs_err_pid*
2525
replay_pid*
2626

27-
# maven files
28-
settings.xml
27+
# gradle
28+
.gradle/
29+
build/

README.md

Lines changed: 28 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,60 @@
1-
![MineplexSK Banner](https://i.imgur.com/zO4o6Rb.png)
1+
![SKMineplex Banner](https://i.imgur.com/RO7AAD4.png)
22

3-
An unofficially supported Skript addon that allows you to use Skript within the Mineplex ecosystem, and interact with the special provided [Mineplex SDK](https://studio.mineplex.com/docs/sdk).
3+
An unofficially supported Skript addon that allows you to use Skript within the Mineplex ecosystem, and interact with
4+
the special provided [Mineplex SDK](https://studio.mineplex.com/docs/sdk).
45

56
> [!IMPORTANT]
6-
> This isn't an official addon provided by Mineplex itself. This is a community developed and supported addon. We rely on contributions for this!
7+
> This isn't an official addon provided by Mineplex itself. This is a community developed and supported addon. We rely
8+
> on contributions for this!
79
810
## Addon Documentation
9-
[Expressions](/docs/expressions.md)[Conditions](/docs/conditions.md)[Effects](/docs/effects.md)[Events](/docs/events.md)[Functions](/docs/functions.md)
1011

12+
[Expressions](/docs/expressions.md)[Conditions](/docs/conditions.md)[Effects](/docs/effects.md)
13+
[Events](/docs/events.md)[Functions](/docs/functions.md)[Examples](/docs/examples.md)
1114

1215
## Purpose
13-
This exists to make it easier for people without Java knowledge to setup and use the Mineplex ecosystem, with the goal being to make it far easier for people to manage and create their projects quickly.
16+
17+
This exists to make it easier for people without Java knowledge to setup and use the Mineplex ecosystem, with the goal
18+
being to make it far easier for people to manage and create their projects quickly.
1419
Our goal with this addon is to have this addon have full feature parity with the actual Mineplex Java SDK.
1520

1621
### Pre-requisites
17-
- You must have [Skript plugin](https://github.com/SkriptLang/Skript/releases) downloaded already, this addon requires it!
22+
23+
- You must have [Skript plugin](https://github.com/SkriptLang/Skript/releases) downloaded already, this addon requires
24+
it!
1825
- You must have a [Mineplex Studio project](https://studio.mineplex.com/docs/getting-started) created and ready to use
1926

2027
## How to install
28+
2129
- Add your **Skript** plugin into a directory within your Mineplex project named `external-plugins`
22-
- Download the [latest version](https://github.com/BillyDotWS/MineplexSK/releases) of the addon from the Releases.
30+
- Download the [latest version](https://github.com/BillyDotWS/MineplexSK/releases) of the addon from the Releases.
2331
- Add this addon jar into the same `external-plugins` directory
2432

2533
## How to use
26-
This Skript addon allows you to use the Skript 'way of coding' with the Mineplex SDK. In order to do this, it adds some custom language to Skript to allow for usage.
34+
35+
This Skript addon allows you to use the Skript 'way of coding' with the Mineplex SDK. In order to do this, it adds some
36+
custom language to Skript to allow for usage.
2737

2838
### Using skript within Mineplex projects
39+
2940
*Note: requires you to have followed the Installation steps first*
3041

31-
In order to use Skript scripts within a project, drop your skript's into a folder (within your project). Within `external-plugins`, create a directory called `Skript`, within this directory, create another called `scripts`.
42+
In order to use Skript scripts within a project, drop your skript's into a folder (within your project). Within
43+
`external-plugins`, create a directory called `Skript`, within this directory, create another called `scripts`.
3244

3345
Then create your Skript file (the same way as everywhere else): `scriptName.sk`
3446

3547
After that, use Skript the same way as normal, dropping extra scripts into the folder(s) and building your project!
3648

3749
## Contributing
50+
3851
> [!CAUTION]
39-
> This library enforces a licence, which states that you cannot create a private version of this work. Please contribute any improvements you make back to the base repository to assist in making it easier to use Skript on Mineplex for everyone! See [the license](/LICENSE) for more information.
52+
> This library enforces a licence, which states that you cannot create a private version of this work. Please contribute
53+
> any improvements you make back to the base repository to assist in making it easier to use Skript on Mineplex for
54+
> everyone! See [the license](/LICENSE) for more information.
4055
41-
We welcome contributions to improve this project! Please follow these guidelines to ensure a smooth contribution process:
56+
We welcome contributions to improve this project! Please follow these guidelines to ensure a smooth contribution
57+
process:
4258

4359
### How to Contribute
4460

@@ -60,7 +76,7 @@ We welcome contributions to improve this project! Please follow these guidelines
6076
5. **Run Tests**
6177
Run all tests to confirm that your changes do not break existing functionality:
6278
```bash
63-
mvn test
79+
./gradlew test
6480
```
6581
6. **Commit Your Changes**
6682
Write clear and concise commit messages:

build.gradle

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
plugins {
2+
id 'java'
3+
id 'com.mineplex.sdk.plugin' version "1.6.0"
4+
}
5+
6+
group = 'ws.billy.skmineplex'
7+
version = '1.0-SNAPSHOT'
8+
sourceCompatibility = '21'
9+
targetCompatibility = '21'
10+
11+
ext {
12+
spigotApiVersion = '1.21.1-R0.1-SNAPSHOT'
13+
lombokVersion = '1.18.30'
14+
jacksonCoreVersion = '2.15.2'
15+
jacksonDatabindVersion = '2.15.2'
16+
skriptVersion = '2.9.4'
17+
}
18+
19+
repositories {
20+
mavenCentral()
21+
maven { url 'https://repo.papermc.io/repository/maven-public/' }
22+
maven { url 'https://repo.skriptlang.org/releases' }
23+
}
24+
25+
dependencies {
26+
compileOnly "org.spigotmc:spigot-api:${spigotApiVersion}"
27+
compileOnly "org.projectlombok:lombok:${lombokVersion}"
28+
implementation "com.fasterxml.jackson.core:jackson-core:${jacksonCoreVersion}"
29+
implementation "com.fasterxml.jackson.core:jackson-databind:${jacksonDatabindVersion}"
30+
implementation "com.github.SkriptLang:Skript:${skriptVersion}"
31+
}
32+
33+
tasks.withType(JavaCompile).configureEach {
34+
options.encoding = 'UTF-8'
35+
}
36+
37+
tasks.register('shade', Jar) {
38+
archiveClassifier = 'all'
39+
from sourceSets.main.output
40+
dependsOn configurations.runtimeClasspath
41+
from { configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) } }
42+
duplicatesStrategy = DuplicatesStrategy.INCLUDE // or DuplicatesStrategy.IGNORE
43+
manifest {
44+
attributes(
45+
'Implementation-Title': project.name,
46+
'Implementation-Version': project.version
47+
)
48+
}
49+
}
50+
51+
build.dependsOn shade

docs/effects.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,11 @@
1-
## Effects
1+
# Effects
2+
3+
## Game
4+
5+
## World
6+
7+
### Create a world
8+
9+
```
10+
[create] mineplex world with template %string%
11+
```

docs/events.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,17 @@
1-
## Events
1+
# Events
2+
3+
## Game
4+
5+
### Game state change
6+
7+
```
8+
on game state change
9+
```
10+
11+
This also then exposes the previous and new state.
12+
13+
```
14+
on game state change:
15+
broadcast "%past event-gamestate%" # the previous state
16+
broadcast "%event-gamestate%" # the new state
17+
```

docs/examples.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# Examples
2+
3+
## World
4+
5+
### Loading a world
6+
7+
Load the world from a template name and save it to a variable for further usage
8+
9+
```
10+
set {_world} to "world-name" parsed as a mineplex world
11+
```
12+
13+
## Game
14+
15+
### Creating a game
16+
17+
Create a game and register it as the current game running on this server
18+
19+
```
20+
set {_game} to "Micro Battles" parsed as a mineplex game
21+
set {_game}'s game world to {_world}
22+
set {_game}'s maximum players to 20
23+
set {_game}'s minimum players to 4
24+
set the current game to {_game}
25+
```
26+
27+
### Starting a game
28+
29+
```
30+
on join:
31+
add player to {_players::*}
32+
33+
on player quit:
34+
remove player from {_players::*}
35+
36+
every 1 second:
37+
if size of {_players::*} is greater than or equal to {_game}'s minimum players:
38+
wait 10 seconds
39+
set game state of {_game} to "STARTED"
40+
clear {_players::*}
41+
```
42+
43+
### Game state changed
44+
45+
```
46+
on game state change:
47+
if event-gamestate = "STARTED":
48+
broadcast "The game has started!"
49+
```

docs/expressions.md

Lines changed: 45 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,45 @@
1-
## Expressions
1+
# Expressions
2+
3+
## Game
4+
5+
### Set game state
6+
7+
```
8+
set %game%'s game state to %state%
9+
```
10+
11+
State options: `PREPARING`, `PRE_START`, `STARTED`, `ENDED`
12+
13+
### Get current game state
14+
15+
```
16+
%game%'s game state
17+
```
18+
19+
### Set game world
20+
21+
```
22+
set %game%'s game world to %mineplex world%
23+
```
24+
25+
See effects -> Create a world for information
26+
27+
### Get game world
28+
29+
```
30+
%game%'s game world
31+
```
32+
33+
## Game Manager
34+
35+
### Set the current game of the server
36+
37+
```
38+
set [the] current game to {_game}
39+
```
40+
41+
### Get the current game
42+
43+
```
44+
[the] current game
45+
```
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.8-bin.zip
4+
networkTimeout=10000
5+
validateDistributionUrl=true
6+
zipStoreBase=GRADLE_USER_HOME
7+
zipStorePath=wrapper/dists

0 commit comments

Comments
 (0)