Split project
This commit is contained in:
parent
259e806d59
commit
bde0f5d040
|
|
@ -10,7 +10,7 @@ Downloads can be obtained on GitHub actions page.
|
||||||
Clone the repo using `git clone https://github.com/Altitude-Devs/PlayerShops.git`.
|
Clone the repo using `git clone https://github.com/Altitude-Devs/PlayerShops.git`.
|
||||||
|
|
||||||
#### Building
|
#### Building
|
||||||
Use the command `./gradlew build --stacktrace` in the project root directory.
|
Use the command `./gradlew shadowJar --stacktrace` in the project root directory.
|
||||||
The compiled jar will be placed in directory `/build/libs/`.
|
The compiled jar will be placed in directory `/build/libs/`.
|
||||||
|
|
||||||
## **Commands**
|
## **Commands**
|
||||||
|
|
|
||||||
23
api/build.gradle.kts
Normal file
23
api/build.gradle.kts
Normal file
|
|
@ -0,0 +1,23 @@
|
||||||
|
plugins {
|
||||||
|
`maven-publish`
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
compileOnly("com.alttd:Galaxy-API:1.18.2-R0.1-SNAPSHOT")
|
||||||
|
}
|
||||||
|
|
||||||
|
publishing {
|
||||||
|
publications {
|
||||||
|
create<MavenPublication>("mavenJava") {
|
||||||
|
from(components["java"])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
repositories{
|
||||||
|
maven {
|
||||||
|
name = "maven"
|
||||||
|
url = uri("https://repo.destro.xyz/snapshots")
|
||||||
|
credentials(PasswordCredentials::class)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
package com.alttd.playershops.api;
|
package com.alttd.playershops.api;
|
||||||
|
|
||||||
import com.alttd.playershops.shop.ShopType;
|
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
15
api/src/main/java/com/alttd/playershops/api/ShopType.java
Normal file
15
api/src/main/java/com/alttd/playershops/api/ShopType.java
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
package com.alttd.playershops.api;
|
||||||
|
|
||||||
|
public enum ShopType {
|
||||||
|
|
||||||
|
SELL,
|
||||||
|
BUY,
|
||||||
|
GAMBLE,
|
||||||
|
BARTER;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return name().toLowerCase();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -1,53 +1,35 @@
|
||||||
import java.io.ByteArrayOutputStream
|
import java.io.ByteArrayOutputStream
|
||||||
import java.io.FileOutputStream
|
|
||||||
import java.net.URL
|
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
id("java")
|
id("java")
|
||||||
id("net.minecrell.plugin-yml.bukkit") version "0.5.1"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
group = "com.alttd.playershops"
|
allprojects {
|
||||||
version = "1.0-SNAPSHOT"
|
group = "com.alttd.playershops"
|
||||||
|
version = "1.0-SNAPSHOT"
|
||||||
apply<JavaLibraryPlugin>()
|
description = "Player Shop plugin for Altitude."
|
||||||
|
|
||||||
java {
|
|
||||||
toolchain {
|
|
||||||
languageVersion.set(JavaLanguageVersion.of(17))
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks {
|
subprojects {
|
||||||
withType<JavaCompile> {
|
apply<JavaLibraryPlugin>()
|
||||||
options.encoding = Charsets.UTF_8.name()
|
|
||||||
|
java {
|
||||||
|
toolchain {
|
||||||
|
languageVersion.set(JavaLanguageVersion.of(17))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
withType<Javadoc> {
|
tasks {
|
||||||
options.encoding = Charsets.UTF_8.name()
|
withType<JavaCompile> {
|
||||||
|
options.encoding = Charsets.UTF_8.name()
|
||||||
|
}
|
||||||
|
|
||||||
|
withType<Javadoc> {
|
||||||
|
options.encoding = Charsets.UTF_8.name()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
|
||||||
compileOnly("com.alttd:Galaxy-API:1.18.2-R0.1-SNAPSHOT")
|
|
||||||
compileOnly("com.github.milkbowl:VaultAPI:1.7") {
|
|
||||||
exclude("org.bukkit","bukkit")
|
|
||||||
}
|
|
||||||
compileOnly("com.github.TechFortress:GriefPrevention:16.17.1")
|
|
||||||
|
|
||||||
compileOnly("org.projectlombok:lombok:1.18.24")
|
|
||||||
annotationProcessor("org.projectlombok:lombok:1.18.24")
|
|
||||||
}
|
|
||||||
|
|
||||||
bukkit {
|
|
||||||
name = rootProject.name
|
|
||||||
main = "$group.${rootProject.name}"
|
|
||||||
version = "${rootProject.version}-${gitCommit()}"
|
|
||||||
apiVersion = "1.18"
|
|
||||||
authors = listOf("destro174")
|
|
||||||
depend = listOf("Vault")
|
|
||||||
}
|
|
||||||
|
|
||||||
fun gitCommit(): String {
|
fun gitCommit(): String {
|
||||||
val os = ByteArrayOutputStream()
|
val os = ByteArrayOutputStream()
|
||||||
project.exec {
|
project.exec {
|
||||||
|
|
|
||||||
50
plugin/build.gradle.kts
Normal file
50
plugin/build.gradle.kts
Normal file
|
|
@ -0,0 +1,50 @@
|
||||||
|
import java.io.ByteArrayOutputStream
|
||||||
|
|
||||||
|
plugins {
|
||||||
|
id("java")
|
||||||
|
id("net.minecrell.plugin-yml.bukkit") version "0.5.1"
|
||||||
|
id("com.github.johnrengelman.shadow") version "7.1.0"
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
implementation(project(":api"))
|
||||||
|
|
||||||
|
compileOnly("com.alttd:Galaxy-API:1.18.2-R0.1-SNAPSHOT")
|
||||||
|
compileOnly("com.github.milkbowl:VaultAPI:1.7") {
|
||||||
|
exclude("org.bukkit","bukkit")
|
||||||
|
}
|
||||||
|
compileOnly("com.github.TechFortress:GriefPrevention:16.17.1")
|
||||||
|
|
||||||
|
compileOnly("org.projectlombok:lombok:1.18.24")
|
||||||
|
annotationProcessor("org.projectlombok:lombok:1.18.24")
|
||||||
|
}
|
||||||
|
|
||||||
|
bukkit {
|
||||||
|
name = rootProject.name
|
||||||
|
main = "$group.${rootProject.name}"
|
||||||
|
version = "${rootProject.version}-${gitCommit()}"
|
||||||
|
apiVersion = "1.18"
|
||||||
|
authors = listOf("destro174")
|
||||||
|
depend = listOf("Vault")
|
||||||
|
}
|
||||||
|
|
||||||
|
fun gitCommit(): String {
|
||||||
|
val os = ByteArrayOutputStream()
|
||||||
|
project.exec {
|
||||||
|
commandLine = "git rev-parse --short HEAD".split(" ")
|
||||||
|
standardOutput = os
|
||||||
|
}
|
||||||
|
return String(os.toByteArray()).trim()
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks {
|
||||||
|
|
||||||
|
shadowJar {
|
||||||
|
archiveFileName.set("${rootProject.name}-${project.version}.jar")
|
||||||
|
}
|
||||||
|
|
||||||
|
build {
|
||||||
|
dependsOn(shadowJar)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -1,10 +1,10 @@
|
||||||
package com.alttd.playershops;
|
package com.alttd.playershops;
|
||||||
|
|
||||||
import com.alttd.playershops.api.ShopHandler;
|
import com.alttd.playershops.api.ShopHandler;
|
||||||
import com.alttd.playershops.config.Config;
|
|
||||||
import com.alttd.playershops.handler.ShopHandlerImpl;
|
|
||||||
import com.alttd.playershops.listener.PlayerListener;
|
import com.alttd.playershops.listener.PlayerListener;
|
||||||
import com.alttd.playershops.listener.ShopListener;
|
import com.alttd.playershops.listener.ShopListener;
|
||||||
|
import com.alttd.playershops.config.Config;
|
||||||
|
import com.alttd.playershops.handler.ShopHandlerImpl;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import net.milkbowl.vault.economy.Economy;
|
import net.milkbowl.vault.economy.Economy;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
|
|
@ -1,18 +1,22 @@
|
||||||
package com.alttd.playershops.config;
|
package com.alttd.playershops.config;
|
||||||
|
|
||||||
import com.alttd.galaxy.configuration.AbstractConfiguration;
|
import com.alttd.galaxy.configuration.AbstractConfiguration;
|
||||||
|
import com.alttd.playershops.api.Shop;
|
||||||
|
import com.alttd.playershops.api.ShopType;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.util.HashMap;
|
||||||
|
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
public class Config extends AbstractConfiguration {
|
public class Config extends AbstractConfiguration {
|
||||||
|
|
||||||
private Config() {
|
private Config() {
|
||||||
super(new File(System.getProperty("user.home") + File.separator + "share" + File.separator + "configs" + File.separator + "playershops"), "config");
|
super(new File(System.getProperty("user.home") + File.separator + "share" + File.separator + "configs" + File.separator + "com/alttd/playershops"), "config");
|
||||||
}
|
}
|
||||||
|
|
||||||
static Config config;
|
static Config config;
|
||||||
static int version;
|
static int version;
|
||||||
|
static HashMap<ShopType, ShopTypeConfig> shopTypeConfigs;
|
||||||
|
|
||||||
public static void reload() {
|
public static void reload() {
|
||||||
config = new Config();
|
config = new Config();
|
||||||
|
|
@ -21,6 +25,11 @@ public class Config extends AbstractConfiguration {
|
||||||
config.set("config-version", 1);
|
config.set("config-version", 1);
|
||||||
|
|
||||||
config.readConfig(Config.class, null);
|
config.readConfig(Config.class, null);
|
||||||
|
|
||||||
|
shopTypeConfigs = new HashMap<>();
|
||||||
|
for (ShopType shopType : ShopType.values()) {
|
||||||
|
shopTypeConfigs.put(shopType, new ShopTypeConfig(shopType.toString()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int shopLimit = 100;
|
public static int shopLimit = 100;
|
||||||
|
|
@ -1,10 +1,9 @@
|
||||||
package com.alttd.playershops.handler;
|
package com.alttd.playershops.handler;
|
||||||
|
|
||||||
import com.alttd.playershops.PlayerShops;
|
import com.alttd.playershops.PlayerShops;
|
||||||
|
import com.alttd.playershops.config.Config;
|
||||||
import com.alttd.playershops.api.Shop;
|
import com.alttd.playershops.api.Shop;
|
||||||
import com.alttd.playershops.api.ShopHandler;
|
import com.alttd.playershops.api.ShopHandler;
|
||||||
import com.alttd.playershops.config.Config;
|
|
||||||
import com.alttd.playershops.shop.AbstractShop;
|
|
||||||
import it.unimi.dsi.fastutil.objects.Object2IntMap;
|
import it.unimi.dsi.fastutil.objects.Object2IntMap;
|
||||||
import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap;
|
import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
|
@ -4,7 +4,6 @@ import com.alttd.playershops.PlayerShops;
|
||||||
import com.alttd.playershops.api.Shop;
|
import com.alttd.playershops.api.Shop;
|
||||||
import com.alttd.playershops.api.ShopHandler;
|
import com.alttd.playershops.api.ShopHandler;
|
||||||
import com.alttd.playershops.config.Config;
|
import com.alttd.playershops.config.Config;
|
||||||
import com.alttd.playershops.shop.AbstractShop;
|
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.block.Sign;
|
import org.bukkit.block.Sign;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
package com.alttd.playershops.shop;
|
package com.alttd.playershops.shop;
|
||||||
|
|
||||||
import com.alttd.playershops.api.Shop;
|
import com.alttd.playershops.api.Shop;
|
||||||
|
import com.alttd.playershops.api.ShopType;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
package com.alttd.playershops.shop;
|
package com.alttd.playershops.shop;
|
||||||
|
|
||||||
|
import com.alttd.playershops.api.ShopType;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
package com.alttd.playershops.shop;
|
package com.alttd.playershops.shop;
|
||||||
|
|
||||||
|
import com.alttd.playershops.api.ShopType;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
package com.alttd.playershops.shop;
|
package com.alttd.playershops.shop;
|
||||||
|
|
||||||
|
import com.alttd.playershops.api.ShopType;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
package com.alttd.playershops.shop;
|
package com.alttd.playershops.shop;
|
||||||
|
|
||||||
|
import com.alttd.playershops.api.ShopType;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
@ -1,5 +1,8 @@
|
||||||
rootProject.name = "PlayerShops"
|
rootProject.name = "PlayerShops"
|
||||||
|
|
||||||
|
include(":api")
|
||||||
|
include(":plugin")
|
||||||
|
|
||||||
dependencyResolutionManagement {
|
dependencyResolutionManagement {
|
||||||
repositories {
|
repositories {
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
|
|
@ -17,4 +20,6 @@ pluginManagement {
|
||||||
repositories {
|
repositories {
|
||||||
gradlePluginPortal()
|
gradlePluginPortal()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
include("api")
|
||||||
|
include("plugin")
|
||||||
|
|
|
||||||
|
|
@ -1,23 +0,0 @@
|
||||||
package com.alttd.playershops.shop;
|
|
||||||
|
|
||||||
import com.alttd.playershops.config.ShopTypeConfig;
|
|
||||||
|
|
||||||
public enum ShopType {
|
|
||||||
|
|
||||||
SELL,
|
|
||||||
BUY,
|
|
||||||
GAMBLE,
|
|
||||||
BARTER;
|
|
||||||
|
|
||||||
private final ShopTypeConfig shopTypeConfig;
|
|
||||||
|
|
||||||
ShopType() {
|
|
||||||
this.shopTypeConfig = new ShopTypeConfig(toString());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return name().toLowerCase();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
Loading…
Reference in New Issue
Block a user