Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
GliczDev committed Dec 11, 2024
0 parents commit 25161b7
Show file tree
Hide file tree
Showing 76 changed files with 2,683 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
* text=auto eol=lf
gradlew text eol=lf
*.sh text eol=lf
*.bat text eol=crlf
*.jar binary
31 changes: 31 additions & 0 deletions .github/workflows/build-gradle-project.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Build & Publish Gradle project

on:
push:
branches:
- main
- dev/dev

jobs:
build-gradle-project:
env:
REPO_USER: ${{ secrets.REPO_USERNAME }}
REPO_PASS: ${{ secrets.REPO_PASSWORD }}
runs-on: ubuntu-latest
steps:
- name: Checkout project sources
uses: actions/checkout@v4
- name: Setup JDK 21 for x64
uses: actions/setup-java@v4
with:
java-version: 21
distribution: corretto
architecture: x64
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
- name: Run shadowJar and publish with Gradle Wrapper
run: ./gradlew shadowJar publish -ProxymcUsername=${{ env.REPO_USER }} -ProxymcPassword=${{ env.REPO_PASS }}
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
path: paper/build/libs/SlimeIgnite-paper-*.jar
118 changes: 118 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
# User-specific stuff
.idea/

*.iml
*.ipr
*.iws

# IntelliJ
out/
# mpeltonen/sbt-idea plugin
.idea_modules/

# JIRA plugin
atlassian-ide-plugin.xml

# Compiled class file
*.class

# Log file
*.log

# BlueJ files
*.ctxt

# Package Files #
*.jar
*.war
*.nar
*.ear
*.zip
*.tar.gz
*.rar

# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*

*~

# temporary files which can be created if a process still has a handle open of a deleted file
.fuse_hidden*

# KDE directory preferences
.directory

# Linux trash folder which might appear on any partition or disk
.Trash-*

# .nfs files are created when an open file is removed but is still being accessed
.nfs*

# General
.DS_Store
.AppleDouble
.LSOverride

# Icon must end with two \r
Icon

# Thumbnails
._*

# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk

# Windows thumbnail cache files
Thumbs.db
Thumbs.db:encryptable
ehthumbs.db
ehthumbs_vista.db

# Dump file
*.stackdump

# Folder config file
[Dd]esktop.ini

# Recycle Bin used on file shares
$RECYCLE.BIN/

# Windows Installer files
*.cab
*.msi
*.msix
*.msm
*.msp

# Windows shortcuts
*.lnk

.gradle
build/

# Ignore Gradle GUI config
gradle-app.setting

# Cache of project
.gradletasknamecache

**/build/

# Common working directory
run/

# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)
!gradle-wrapper.jar
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024 RoxyMC

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
55 changes: 55 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# SlimeIgnite

An [Ignite](https://github.com/vectrix-space/ignite) mod implementation
of [SlimeLoader](https://github.com/roxymc-net/SlimeLoader) for [Paper](https://papermc.io/).

## Supported versions

| Mod version | Compatible Paper version |
|-------------|--------------------------|
| 0.1 | 1.21.3, 1.21.4 |

## Usage

### Mod installation

Firstly, follow the [Ignite installation instructions](https://github.com/vectrix-space/ignite#install).

Then, navigate to [releases](https://github.com/roxymc-net/SlimeIgnite/releases) or [actions](https://github.com/roxymc-net/SlimeIgnite/actions) page and download the latest mod artifact for your platform.

After downloading, place the mod jar file inside your server's `mods` directory.

Finally, you can simply launch your server just like before and enjoy your slime worlds!
(note: remember to launch the ignite jar, not your platform jar.)

### For developers (API)

SlimeIgnite API is available in our maven repository.

Depending on your target mod version, you would need:

```kts
repositories {
// for releases
maven("https://repo.roxymc.net/releases")

// for snapshots
maven("https://repo.roxymc.net/snapshots")
}
```

and

```kts
dependencies {
implementation("net.roxymc:slimeignite-api:VERSION")
}
```

## Compiling

To compile, navigate to project root directory and run:

```shell
./gradlew shadowJar
```
33 changes: 33 additions & 0 deletions api/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
plugins {
id("java-library")
id("maven-publish")
}

val minecraftVersion = project.property("minecraft-version")

dependencies {
compileOnly("io.papermc.paper:paper-api:$minecraftVersion-R0.1-SNAPSHOT")
api("net.roxymc.slimeloader:slime-loader:1.0-SNAPSHOT")
}

java {
withSourcesJar()
}

publishing {
repositories {
val repoType = if (version.toString().endsWith("-SNAPSHOT")) "snapshots" else "releases"
maven("https://repo.roxymc.net/${repoType}") {
name = "roxymc"
credentials(PasswordCredentials::class)
}
}

publications {
create<MavenPublication>("maven") {
artifactId = "${rootProject.name}-${project.name}".lowercase()

from(components["java"])
}
}
}
19 changes: 19 additions & 0 deletions api/src/main/java/net/roxymc/slime/ignite/LoadedSlimeWorld.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package net.roxymc.slime.ignite;

import net.roxymc.slime.ignite.storage.SlimeWorldStorage;
import org.bukkit.World;
import org.jspecify.annotations.NullMarked;

@NullMarked
public interface LoadedSlimeWorld extends SlimeWorldSkeleton {
boolean readOnly();

SlimeWorldStorage storage();

World serverWorld();

@Override
default boolean isLoaded() {
return true;
}
}
28 changes: 28 additions & 0 deletions api/src/main/java/net/roxymc/slime/ignite/SlimeWorldSkeleton.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package net.roxymc.slime.ignite;

import net.roxymc.slime.ignite.storage.SlimeWorldStorage;
import net.roxymc.slime.world.World;
import org.jspecify.annotations.NullMarked;

@NullMarked
public interface SlimeWorldSkeleton {
String name();

World data();

default SlimeWorldSkeleton snapshot() {
return snapshot(name());
}

SlimeWorldSkeleton snapshot(String name);

boolean isLoaded();

default LoadedSlimeWorld load(SlimeWorldStorage storage) {
return load(storage, false);
}

default LoadedSlimeWorld load(SlimeWorldStorage storage, boolean readOnly) {
return storage.loadWorld(this, readOnly);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package net.roxymc.slime.ignite;

import net.roxymc.slime.world.World;
import org.jspecify.annotations.NullMarked;

@NullMarked
public record SlimeWorldSkeletonImpl(String name, World data) implements SlimeWorldSkeleton {
@Override
public SlimeWorldSkeleton snapshot(String name) {
return new SlimeWorldSkeletonImpl(name, data);
}

@Override
public boolean isLoaded() {
return false;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package net.roxymc.slime.ignite.loader;

import net.roxymc.slime.ignite.LoadedSlimeWorld;
import net.roxymc.slime.ignite.SlimeWorldSkeleton;
import net.roxymc.slime.ignite.storage.SlimeWorldStorage;
import net.roxymc.slime.loader.SlimeLoader;
import org.bukkit.World;
import org.jetbrains.annotations.UnknownNullability;
import org.jspecify.annotations.NullMarked;
import org.jspecify.annotations.Nullable;

import java.io.IOException;
import java.util.Optional;
import java.util.ServiceLoader;
import java.util.Set;

@NullMarked
public abstract class SlimeWorldLoader {
@SuppressWarnings("OptionalUsedAsFieldOrParameterType")
private static final Optional<SlimeWorldLoader> INSTANCE = ServiceLoader.load(SlimeWorldLoader.class).findFirst();

SlimeWorldLoader() {
}

public static SlimeWorldLoader get() {
return INSTANCE.orElseThrow();
}

public abstract @Nullable LoadedSlimeWorld slimeWorld(World world);

public abstract Set<String> storages();

public abstract @UnknownNullability SlimeWorldStorage storage(String name);

public abstract boolean registerStorage(SlimeWorldStorage storage);

public abstract SlimeLoader slimeLoader();

public abstract SlimeWorldSkeleton createEmptyWorld(String name);

public abstract LoadedSlimeWorld loadWorld(SlimeWorldSkeleton world, SlimeWorldStorage storage, boolean readOnly) throws IOException;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
@NullMarked
package net.roxymc.slime.ignite.loader;

import org.jspecify.annotations.NullMarked;
4 changes: 4 additions & 0 deletions api/src/main/java/net/roxymc/slime/ignite/package-info.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
@NullMarked
package net.roxymc.slime.ignite;

import org.jspecify.annotations.NullMarked;
Loading

0 comments on commit 25161b7

Please sign in to comment.