Set up crazycore with paper api

This commit is contained in:
Ryder Belserion 2023-02-28 01:25:51 -05:00
parent b64e667ef0
commit cc10d4d653
No known key found for this signature in database
GPG Key ID: 8FC2E6C54BBF05FE
30 changed files with 109 additions and 178 deletions

View File

@ -14,7 +14,7 @@ val projectVersion = settings.versions.projectVersion.get()
val projectName = settings.versions.projectName.get()
val projectExt = settings.versions.projectExtension.get()
val finalVersion = if (isBeta) "$projectVersion+Beta" else projectVersion
val finalVersion = if (isBeta) "$projectVersion+beta" else projectVersion
val color = if (isBeta) betaUpdate else releaseUpdate
val repo = if (isBeta) "beta" else "releases"

View File

@ -13,6 +13,10 @@ project.version = finalVersion
dependencies {
//compileOnly(libs.adventure.api)
//compileOnly(libs.adventure.text)
compileOnly(libs.config.me)
compileOnly(libs.crazycore)
}
tasks {

View File

@ -6,27 +6,22 @@ paper = "1.19.3-R0.1-SNAPSHOT"
# Adventure
adventure = "4.12.0"
# RubyCore
ruby = "1.0.0.0"
# CrazyCore
crazycore = "1.1.0.0"
[libraries]
# Minecraft
papermc = { module = "io.papermc.paper:paper-api", version.ref = "paper" }
paper = { module = "io.papermc.paper:paper-api", version.ref = "paper" }
spigot = { module = "org.spigotmc:spigot-api", version.ref = "paper" }
# Adventure
adventure_api = { module = "net.kyori:adventure-api", version.ref = "adventure" }
adventure_text = { module = "net.kyori:adventure-text-minimessage", version.ref = "adventure" }
# RubyCore
ruby_api = { module = "net.dehya.ruby:ruby-core", version.ref = "ruby" }
ruby_paper = { module = "net.dehya.ruby:ruby-paper", version.ref = "ruby" }
ruby_spigot = { module = "net.dehya.ruby:ruby-spigot", version.ref = "ruby" }
# Configurations
yaml = { module = "me.carleslc.Simple-YAML:Simple-Yaml", version = "1.8.3" }
# CrazyCore
crazycore-paper = { module = "us.crazycrew.crazycore:crazycore-paper", version.ref = "crazycore" }
crazycore = { module = "us.crazycrew.crazycore:crazycore-core", version.ref = "crazycore" }
# Triumph Team
triumph_cmds = { module = "dev.triumphteam:triumph-cmd-bukkit", version = "2.0.0-SNAPSHOT" }

View File

@ -1,7 +1,7 @@
@Suppress("DSL_SCOPE_VIOLATION")
plugins {
id("crazyauctions.spigot-plugin")
id("crazyauctions.paper-plugin")
alias(settings.plugins.minotaur)
}
@ -11,24 +11,21 @@ repositories {
* PAPI Team
*/
maven("https://repo.extendedclip.com/content/repositories/placeholderapi/")
/**
* CrazyCrew Team
*/
maven("https://repo.crazycrew.us/libraries")
}
dependencies {
// api(project(":crazyauctions-core"))
api(project(":crazyauctions-core"))
compileOnly(libs.spigot)
compileOnly(libs.paper)
implementation(libs.ruby.spigot)
compileOnly(libs.crazycore.paper)
implementation(libs.triumph.gui)
implementation(libs.triumph.cmds)
compileOnly(libs.triumph.gui)
// implementation(libs.triumph.cmds)
implementation(libs.vault.api) {
compileOnly(libs.config.me)
compileOnly(libs.vault.api) {
exclude("org.bukkit", "bukkit")
}
}
@ -43,18 +40,17 @@ val isBeta = settings.versions.projectBeta.get().toBoolean()
val projectVersion = settings.versions.projectVersion.get()
val finalVersion = if (isBeta) "$projectVersion+Beta" else projectVersion
val finalVersion = if (isBeta) "$projectVersion+beta" else projectVersion
val repo = if (isBeta) "beta" else "releases"
val type = if (isBeta) "beta" else "release"
tasks {
shadowJar {
archiveFileName.set("${projectName}+$finalVersion.jar")
archiveFileName.set("${projectName}+${projectDir.name}+$finalVersion.jar")
listOf(
"org.bstats"
).forEach { relocate(it, "$projectGroup.plugin.library.$it") }
).forEach { relocate(it, "$projectGroup.library.$it") }
}
modrinth {
@ -70,24 +66,9 @@ tasks {
autoAddDependsOn.set(true)
gameVersions.addAll(
listOf(
"1.8",
"1.9",
"1.10",
"1.11",
"1.12",
"1.13",
"1.14",
"1.15",
"1.16",
"1.17",
"1.18",
"1.19"
)
)
gameVersions.addAll(listOf("1.19, 1.19.1, 1.19.2, 1.19.3"))
loaders.addAll(listOf("spigot", "paper", "purpur"))
loaders.addAll(listOf("paper", "purpur"))
//<h3>The first release for CrazyAuctions on Modrinth! 🎉🎉🎉🎉🎉<h3><br> If we want a header.
changelog.set(
@ -103,62 +84,20 @@ tasks {
}
processResources {
filesMatching("plugin.yml") {
filesMatching("paper-plugin.yml") {
expand(
"name" to projectName,
"group" to projectGroup,
"version" to finalVersion,
"description" to projectDescription,
"website" to "https://modrinth.com/$projectExt/${projectName.lowercase()}"
"description" to projectDescription
)
}
}
}
publishing {
publications {
create<MavenPublication>("maven") {
groupId = projectGroup
artifactId = "${projectName.lowercase()}-paper-api"
version = finalVersion
from(components["java"])
pom {
name.set(projectName)
description.set(projectDescription)
url.set(projectGithub)
licenses {
license {
name.set("MIT License")
url.set("https://www.opensource.org/licenses/mit-license.php")
}
}
developers {
developer {
id.set("ryderbelserion")
name.set("Ryder Belserion")
}
developer {
id.set("badbones69")
name.set("BadBones69")
}
}
scm {
connection.set("scm:git:git://github.com/Crazy-Crew/$projectName.git")
developerConnection.set("scm:git:ssh://github.com/Crazy-Crew/$projectName.git")
url.set(projectGithub)
}
}
}
}
repositories {
val repo = if (isBeta) "beta" else "releases"
maven("https://repo.crazycrew.us/$repo") {
name = "crazycrew"
// Used for locally publishing.
@ -170,4 +109,14 @@ publishing {
}
}
}
publications {
create<MavenPublication>("maven") {
groupId = projectGroup
artifactId = "${projectName.lowercase()}-${projectDir.name}"
version = finalVersion
from(components["java"])
}
}
}

View File

@ -1,8 +1,8 @@
package us.crazycrew.crazyauctions.api.auctionhouse.objects;
import us.crazycrew.crazyauctions.utils.ItemUtils;
import net.dehya.ruby.items.ItemBuilder;
import org.bukkit.configuration.file.FileConfiguration;
import us.crazycrew.crazycore.paper.items.ItemBuilder;
public class AuctionButtons {

View File

@ -1,8 +1,7 @@
package us.crazycrew.crazyauctions.api.auctionhouse.objects;
import net.dehya.ruby.items.ItemBuilder;
import org.bukkit.Material;
import us.crazycrew.crazycore.paper.items.ItemBuilder;
import java.util.List;
public class AuctionCategory {
@ -35,5 +34,4 @@ public class AuctionCategory {
public List<Material> getCategoryItemList() {
return categoryItemList;
}
}

View File

@ -9,7 +9,6 @@ import us.crazycrew.crazyauctions.utils.ItemUtils;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.configuration.file.FileConfiguration;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
@ -85,5 +84,4 @@ public class AuctionHouse {
AuctionAddEvent event = new AuctionAddEvent(auctionItem.getSeller(), this, auctionItem);
Bukkit.getServer().getPluginManager().callEvent(event);
}
}

View File

@ -3,7 +3,6 @@ package us.crazycrew.crazyauctions.api.economy;
import us.crazycrew.crazyauctions.CrazyAuctions;
import org.bukkit.OfflinePlayer;
import org.bukkit.entity.Player;
import java.util.UUID;
public class CurrencyAPI {
@ -23,17 +22,11 @@ public class CurrencyAPI {
Player player = plugin.getServer().getPlayer(uuid);
switch (currency) {
case VAULT: {
if (player != null) return (int) plugin.getVaultSupport().getVault().getBalance(player);
}
case VAULT: //if (player != null) return (int) plugin.getVaultSupport().getVault().getBalance(player);
case XP_LEVEL: {
if (player != null) return player.getLevel();
}
case XP_LEVEL: if (player != null) return player.getLevel();
case XP_TOTAL: {
if (player != null) return getTotalExperience(player);
}
case XP_TOTAL: if (player != null) return getTotalExperience(player);
}
} catch (Exception | NoClassDefFoundError ignored) {}
return 0;
@ -51,7 +44,7 @@ public class CurrencyAPI {
Player player = plugin.getServer().getPlayer(uuid);
switch (currency) {
case VAULT: if (player != null) plugin.getVaultSupport().getVault().withdrawPlayer(player, amount);
//case VAULT: if (player != null) plugin.getVaultSupport().getVault().withdrawPlayer(player, amount);
case XP_LEVEL: if (player != null) player.setLevel(player.getLevel() - amount);
case XP_TOTAL: if (player != null) takeTotalExperience(player, amount);
}
@ -70,7 +63,7 @@ public class CurrencyAPI {
Player player = plugin.getServer().getPlayer(uuid);
switch (currency) {
case VAULT: if (player != null) plugin.getVaultSupport().getVault().depositPlayer(player, amount);
//case VAULT: if (player != null) plugin.getVaultSupport().getVault().depositPlayer(player, amount);
case XP_LEVEL: if (player != null) player.setLevel(player.getLevel() + amount);
case XP_TOTAL: if (player != null) takeTotalExperience(player, -amount);
}

View File

@ -58,7 +58,7 @@ public class PluginSupport {
for (SupportedPlugins supportedPlugin : SupportedPlugins.values()) {
if (supportedPlugin.isPluginLoaded() && supportedPlugin.getLoadedPlugin().isEnabled()) {
switch (supportedPlugin) {
case VAULT: this.plugin.getStarter().setVaultSupport(new VaultSupport()).init();
//case VAULT: this.plugin.getStarter().setVaultSupport(new VaultSupport()).init();
}
return;
@ -84,7 +84,7 @@ public class PluginSupport {
private final CrazyAuctions plugin = CrazyAuctions.getPlugin();
private final PluginSupport pluginSupport = plugin.getPluginSupport();
//private final PluginSupport pluginSupport = plugin.getPluginSupport();
public boolean isPluginLoaded() {
return plugin.getServer().getPluginManager().getPlugin(pluginName) != null;
@ -95,19 +95,21 @@ public class PluginSupport {
}
public boolean isCachedPluginLoaded() {
return pluginSupport.cachedPlugins.get(this);
return true;
//return pluginSupport.cachedPlugins.get(this);
}
public void addPlugin(boolean value) {
pluginSupport.cachedPlugins.put(this, value);
//pluginSupport.cachedPlugins.put(this, value);
}
public void removePlugin() {
pluginSupport.cachedPlugins.remove(this);
//pluginSupport.cachedPlugins.remove(this);
}
public boolean isPluginEnabled() {
return pluginSupport.cachedPlugins.get(this);
return true;
//return pluginSupport.cachedPlugins.get(this);
}
}
}

View File

@ -1,8 +1,8 @@
package us.crazycrew.crazyauctions.utils;
import us.crazycrew.crazyauctions.api.enums.ServerVersion;
import net.dehya.ruby.items.ItemBuilder;
import org.bukkit.Material;
import us.crazycrew.crazycore.paper.items.ItemBuilder;
import java.util.Arrays;
public class ItemUtils {
@ -30,7 +30,7 @@ public class ItemUtils {
itemBuilder.setValue(value);
break;
case "name":
itemBuilder.setDisplayName(value);
//itemBuilder.setDisplayName(value);
break;
case "amount":
try {
@ -40,7 +40,7 @@ public class ItemUtils {
}
break;
case "lore":
itemBuilder.setLore(Arrays.asList(value.split(",")));
//itemBuilder.setLore(Arrays.asList(value.split(",")));
break;
case "player":
itemBuilder.setTexture(value);
@ -82,7 +82,7 @@ public class ItemUtils {
}
}
} catch (Exception e) {
ItemBuilder.setMaterial(Material.RED_TERRACOTTA).setDisplayName("&c&lERROR").setLore(Arrays.asList("&cThere is an error", "&cFor : &c"));
//ItemBuilder.setMaterial(Material.RED_TERRACOTTA).setDisplayName("&c&lERROR").setLore(Arrays.asList("&cThere is an error", "&cFor : &c"));
e.printStackTrace();
}

View File

@ -1,7 +1,6 @@
package us.crazycrew.crazyauctions.utils.utilities.misc;
import us.crazycrew.crazyauctions.api.enums.ServerVersion;
import us.crazycrew.crazyauctions.configs.Config;
import org.bukkit.ChatColor;
import org.bukkit.Color;
import java.util.List;
@ -14,7 +13,7 @@ public class ColorUtils {
public static String color(String message) {
if (ServerVersion.isAtLeast(ServerVersion.v1_15)) {
Matcher matcher = HEX_PATTERN.matcher(message);
StringBuffer buffer = new StringBuffer();
StringBuilder buffer = new StringBuilder();
while (matcher.find()) {
matcher.appendReplacement(buffer, ChatColor.valueOf(matcher.group()).toString());
@ -41,42 +40,25 @@ public class ColorUtils {
}
public static Color getColor(String color) {
switch (color.toUpperCase()) {
case "AQUA":
return Color.AQUA;
case "BLACK":
return Color.BLACK;
case "BLUE":
return Color.BLUE;
case "FUCHSIA":
return Color.FUCHSIA;
case "GRAY":
return Color.GRAY;
case "GREEN":
return Color.GREEN;
case "LIME":
return Color.LIME;
case "MAROON":
return Color.MAROON;
case "NAVY":
return Color.NAVY;
case "OLIVE":
return Color.OLIVE;
case "ORANGE":
return Color.ORANGE;
case "PURPLE":
return Color.PURPLE;
case "RED":
return Color.RED;
case "SILVER":
return Color.SILVER;
case "TEAL":
return Color.TEAL;
case "YELLOW":
return Color.YELLOW;
}
return Color.WHITE;
return switch (color.toUpperCase()) {
case "AQUA" -> Color.AQUA;
case "BLACK" -> Color.BLACK;
case "BLUE" -> Color.BLUE;
case "FUCHSIA" -> Color.FUCHSIA;
case "GRAY" -> Color.GRAY;
case "GREEN" -> Color.GREEN;
case "LIME" -> Color.LIME;
case "MAROON" -> Color.MAROON;
case "NAVY" -> Color.NAVY;
case "OLIVE" -> Color.OLIVE;
case "ORANGE" -> Color.ORANGE;
case "PURPLE" -> Color.PURPLE;
case "RED" -> Color.RED;
case "SILVER" -> Color.SILVER;
case "TEAL" -> Color.TEAL;
case "YELLOW" -> Color.YELLOW;
default -> Color.WHITE;
};
}
public static String removeColor(String msg) {
@ -84,7 +66,7 @@ public class ColorUtils {
}
public static String getPrefix(String string) {
return Config.PREFIX;
return "";
}
public static String getPrefix() {

View File

@ -18,29 +18,39 @@ public class NumberUtils {
* @return The roman numeral as a number.
*/
public static int convertLevelInteger(String level) {
switch (level) {
case "I": return 1;
case "I" -> {
return 1;
}
case "II" -> {
return 2;
}
case "III" -> {
return 3;
}
case "IV" -> {
return 4;
}
case "V" -> {
return 5;
}
case "VI" -> {
return 6;
}
case "VII" -> {
return 7;
}
case "VIII" -> {
return 8;
}
case "IX" -> {
return 9;
}
case "X" -> {
return 10;
}
case "II": return 2;
case "III": return 3;
case "IV": return 4;
case "V": return 5;
case "VI": return 6;
case "VII": return 7;
case "VIII": return 8;
case "IX": return 9;
case "X": return 10;
default: {
default -> {
if (isInt(level)) {
return Integer.parseInt(level);
} else {