Skip to content

Commit

Permalink
Update to 3.1 (#740)
Browse files Browse the repository at this point in the history
  • Loading branch information
ryderbelserion authored Jun 13, 2024
1 parent d461e88 commit a1dddb2
Show file tree
Hide file tree
Showing 62 changed files with 1,468 additions and 428 deletions.
16 changes: 10 additions & 6 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
## Fixes:
* Fix files not loading on linux ( I love file systems! )
* Uppercase player name in default files to avoid some stupid error.
### Added:
- Ability to set update intervals for holograms, -1 disables it.
- /crazycrates migrate <crate> <type> which should update materials/enchants/trim materials to mojang mapped,

## Other:
* [Feature Requests](https://github.com/Crazy-Crew/CrazyCrates/discussions/categories/features)
* [Bug Reports](https://github.com/Crazy-Crew/CrazyCrates/issues)
### Changes:
- Bumped crazycrates api to 0.7
- War/Cosmic Crate listeners for PlayerCloseEvent have been combined and had unnecessary method calls reduced.
- Updated to [2.2.0](https://modrinth.com/plugin/fancyholograms/version/2.2.0) FancyHolograms, they made a breaking change in the api so all previous versions of FancyHolograms will no longer work.

### Fixed:
- War Crate no longer bugs out if you close the inventory.
94 changes: 94 additions & 0 deletions api/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
plugins {
alias(libs.plugins.shadowJar)

`java-plugin`
}

project.group = "us.crazycrew.crazycrates"
project.version = "0.7"

repositories {
mavenCentral()
}

dependencies {
compileOnly("net.kyori", "adventure-api", "4.17.0")
}

val javaComponent: SoftwareComponent = components["java"]

tasks {
val sourcesJar by creating(Jar::class) {
archiveClassifier.set("sources")
from(sourceSets.main.get().allSource)
}

val javadocJar by creating(Jar::class) {
dependsOn.add(javadoc)
archiveClassifier.set("javadoc")
from(javadoc)
}

publishing {
repositories {
maven {
url = uri("https://repo.crazycrew.us/releases")

credentials {
this.username = System.getenv("gradle_username")
this.password = System.getenv("gradle_password")
}

//isAllowInsecureProtocol = true
}
}

publications {
create<MavenPublication>("maven") {
artifactId = "api"

from(javaComponent)

artifact(sourcesJar)
artifact(javadocJar)

versionMapping {
usage("java-api") {
fromResolutionOf("runtimeClasspath")
}

usage("java-runtime") {
fromResolutionResult()
}
}

pom {
name.set("CrazyCrates API")
description.set("The official API of CrazyCrates")
url.set("https://modrinth.com/plugin/crazycrates")

licenses {
licenses {
name.set("MIT")
url.set("https://opensource.org/licenses/MIT")
}
}

developers {
developer {
id.set("ryderbelserion")
name.set("Ryder Belserion")
email.set("[email protected]")
}
}

scm {
connection.set("scm:git:git://github.com/Crazy-Crew/CrazyCrates")
developerConnection.set("scm:git:ssh://github.com/Crazy-Crew/CrazyCrates")
url.set("https://github.com/Crazy-Crew/CrazyCrates")
}
}
}
}
}
}
54 changes: 54 additions & 0 deletions api/src/main/java/us/crazycrew/crazycrates/CratesProvider.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
package us.crazycrew.crazycrates;

import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
import us.crazycrew.crazycrates.platform.IServer;

/**
* A class used to initialize the api so other plugins can use it.
*
* @author Ryder Belserion
* @version 0.7
* @since 0.4
*/
public class CratesProvider {

private static IServer instance;

/**
* @return {@link IServer}
* @since 0.4
*/
public static IServer get() {
if (instance == null) {
throw new IllegalStateException("CrazyCrates API is not loaded.");
}

return instance;
}

@ApiStatus.Internal
private CratesProvider() {
throw new UnsupportedOperationException("This class cannot be instantiated");
}

/**
* Creates {@link IServer} instance.
*
* @param instance the {@link IServer} instance
*/
@ApiStatus.Internal
public static void register(@NotNull final IServer instance) {
if (CratesProvider.instance != null) return;

CratesProvider.instance = instance;
}

/**
* Unregisters {@link IServer} instance.
*/
@ApiStatus.Internal
public static void unregister() {
CratesProvider.instance = null;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
package us.crazycrew.crazycrates.api.enums.types;

/**
* An enum class that contains all our current crate types.
*
* @author Ryder Belserion
* @version 0.7
* @since 0.1
*/
public enum CrateType {

/**
* The menu i.e. /crates menu
*/
menu("Menu"),
/**
* The cosmic crate type
*/
cosmic("Cosmic"),
/**
* CrateOnTheGo which allows players to be given crates that can be opened anywhere instantly.
*/
crate_on_the_go("CrateOnTheGo"),
/**
* CSGO Crate, A crate type that mimics the infamous CSGO Crate! SHOCKING
*/
csgo("CSGO"),
/**
* Casino Crate like a slots machine in a casino.
*/
casino("Casino"),
/**
* FireCracker, A simple variant of QuickCrate that launches fireworks.
*/
fire_cracker("FireCracker"),
/**
* A crate that spawns a schematic in the physical world with 4 chests that spawn on each corner.
*/
quad_crate("QuadCrate"),
/**
* A crate that opens up quickly
*/
quick_crate("QuickCrate"),
/**
* It's a roulette crate.
*/
roulette("Roulette"),
/**
* Spin the wheel!
*/
wheel("Wheel"),
/**
* Makes you wonder what you're going to get!
*/
wonder("Wonder"),
/**
* Definitely going to war over what you win.
*/
war("War");

private final String name;

/**
* A constructor to build a {@link CrateType} reference.
*
* @param name the name of the {@link CrateType}
* @since 0.1
*/
CrateType(String name) {
this.name = name;
}

/**
* Get the {@link CrateType} by name.
*
* @param name the name of the crate
* @return {@link CrateType}
* @since 0.1
*/
public static CrateType getFromName(String name) {
if (name.isEmpty()) return CrateType.csgo;

for (CrateType crate : CrateType.values()) {
if (crate.getName().equalsIgnoreCase(name)) return crate;
}

return CrateType.csgo;
}

/**
* Get the name of the crate.
*
* @return the crate name
*/
public String getName() {
return this.name;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
package us.crazycrew.crazycrates.api.enums.types;

/**
* An enum class that contains all our current key types.
*
* @author Ryder Belserion
* @version 0.7
* @since 0.1
*/
public enum KeyType {

/**
* A physical key
*/
physical_key("physical_key", "Physical Key"),
/**
* A virtual key
*/
virtual_key("virtual_key", "Virtual Key"),
/**
* A free key
*/
free_key("free_key", "Free Key");

private final String name;
private final String friendlyName;

/**
* A constructor to build a {@link KeyType} reference.
*
* @param name name of the {@link KeyType}
* @since 0.1
*/
KeyType(String name, String friendlyName) {
this.friendlyName = friendlyName;
this.name = name;
}

/**
* Get the {@link KeyType} by name.
*
* @param type the name of the {@link KeyType}
* @return the {@link KeyType}
* @since 0.1
*/
public static KeyType getFromName(String type) {
if (type.isEmpty()) return KeyType.virtual_key;

if (type.equalsIgnoreCase("virtual") || type.equalsIgnoreCase("v")) {
return KeyType.virtual_key;
} else if (type.equalsIgnoreCase("physical") || type.equalsIgnoreCase("p")) {
return KeyType.physical_key;
} else if (type.equalsIgnoreCase("free") || type.equalsIgnoreCase("f")) {
return KeyType.free_key;
}

return KeyType.virtual_key;
}

/**
* Get a message friendly version of the {@link KeyType}.
*
* @return the name of the {@link KeyType}
* @since 0.1
*/
public String getFriendlyName() {
return this.friendlyName;
}

/**
* Get the name of the {@link KeyType}.
*
* @return the name of the {@link KeyType}
* @since 0.1
*/
public String getName() {
return this.name;
}
}
Loading

0 comments on commit a1dddb2

Please sign in to comment.