Skip to content

Commit c3994f6

Browse files
0.5.1 - Merge pull request #42 from TechnicallyCoded/dev
Release 0.5.1
2 parents 8b091d0 + 37761fc commit c3994f6

File tree

24 files changed

+330
-220
lines changed

24 files changed

+330
-220
lines changed

README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,13 @@ plugins {
3939
4040
repositories {
4141
maven {
42-
name = "jitpack"
43-
url = "https://jitpack.io"
42+
name = "tcoded-releases"
43+
url = "https://repo.tcoded.com/releases"
4444
}
4545
}
4646
4747
dependencies {
48-
implementation("com.github.technicallycoded:FoliaLib:main-SNAPSHOT")
48+
implementation("com.tcoded:FoliaLib:SET_VERSION_HERE")
4949
}
5050
5151
shadowJar {
@@ -55,7 +55,7 @@ shadowJar {
5555
// Optional: If you use minimize, make sure you exclude FoliaLib
5656
// Do not uncomment this if you don't know what you are doing
5757
// minimize {
58-
// exclude dependency("com.github.technicallycoded:FoliaLib:.*")
58+
// exclude dependency("com.tcoded:FoliaLib:.*")
5959
// }
6060
}
6161
```
@@ -68,16 +68,16 @@ shadowJar {
6868
```xml
6969
<repositories>
7070
<repository>
71-
<id>jitpack</id>
72-
<url>https://jitpack.io</url>
71+
<id>tcoded-releases</id>
72+
<url>https://repo.tcoded.com/releases</url>
7373
</repository>
7474
</repositories>
7575

7676
<dependencies>
7777
<dependency>
78-
<groupId>com.github.technicallycoded</groupId>
78+
<groupId>com.tcoded</groupId>
7979
<artifactId>FoliaLib</artifactId>
80-
<version>main-SNAPSHOT</version>
80+
<version>SET_VERSION_HERE</version>
8181
<scope>compile</scope>
8282
</dependency>
8383
</dependencies>

build.gradle

Lines changed: 0 additions & 80 deletions
This file was deleted.

build.gradle.kts

Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
plugins {
2+
id("maven-publish")
3+
id("java")
4+
}
5+
6+
group = "com.tcoded"
7+
8+
allprojects {
9+
apply(plugin = "java")
10+
11+
version = "0.5.1"
12+
13+
repositories {
14+
mavenCentral()
15+
16+
maven {
17+
url = uri("https://hub.spigotmc.org/nexus/content/repositories/snapshots/")
18+
}
19+
20+
maven {
21+
url = uri("https://hub.spigotmc.org/nexus/content/repositories/public/")
22+
}
23+
24+
maven {
25+
url = uri("https://repo.papermc.io/repository/maven-public/")
26+
}
27+
28+
maven {
29+
url = uri("https://nexuslite.gcnt.net/repos/paper/")
30+
}
31+
}
32+
33+
java {
34+
sourceCompatibility = JavaVersion.VERSION_1_8
35+
targetCompatibility = JavaVersion.VERSION_1_8
36+
}
37+
38+
dependencies {
39+
implementation("org.jetbrains:annotations:23.0.0")
40+
41+
testImplementation(platform("org.junit:junit-bom:5.9.1"))
42+
testImplementation("org.junit.jupiter:junit-jupiter")
43+
}
44+
45+
tasks.test {
46+
useJUnitPlatform()
47+
}
48+
49+
tasks.compileJava {
50+
dependsOn(tasks.clean)
51+
}
52+
}
53+
54+
subprojects.forEach { subproject ->
55+
evaluationDependsOn(subproject.path)
56+
}
57+
58+
tasks.register<Jar>("allJar") {
59+
dependsOn(tasks.clean)
60+
dependsOn(subprojects.map { it.tasks.clean })
61+
dependsOn(tasks.compileJava)
62+
dependsOn(tasks.jar)
63+
dependsOn(subprojects.map { it.tasks.build })
64+
65+
subprojects.forEach { subproject ->
66+
from(subproject.tasks.jar.get().outputs.files.map {
67+
zipTree(it)
68+
})
69+
}
70+
}
71+
72+
val allJar: Task = tasks.named("allJar").get();
73+
74+
artifacts {
75+
add("archives", allJar)
76+
}
77+
78+
publishing {
79+
publications {
80+
create<MavenPublication>("mavenJavaLocal") {
81+
artifact(allJar.outputs.files.singleFile)
82+
}
83+
}
84+
}
85+
86+
tasks.named("generateMetadataFileForMavenJavaLocalPublication") {
87+
dependsOn(allJar)
88+
}
89+
90+
val enablePublishing: Boolean = project.findProperty("enableUploadPublish")?.toString()?.toBoolean() == true
91+
92+
if (enablePublishing) {
93+
publishing {
94+
repositories {
95+
maven {
96+
name = "reposilite"
97+
url = uri("https://repo.tcoded.com/releases")
98+
99+
credentials {
100+
username = project.findProperty("REPOSILITE_USER")?.toString()
101+
?: System.getenv("REPOSILITE_USER")
102+
?: error("REPOSILITE_USER property or environment variable is not set")
103+
password = project.findProperty("REPOSILITE_PASS")?.toString()
104+
?: System.getenv("REPOSILITE_PASS")
105+
?: error("REPOSILITE_PASS property or environment variable is not set")
106+
}
107+
108+
authentication {
109+
register<BasicAuthentication>("basic")
110+
}
111+
}
112+
}
113+
}
114+
115+
tasks.named("publishMavenJavaLocalPublicationToReposiliteRepository") {
116+
dependsOn(tasks.jar)
117+
dependsOn(allJar)
118+
}
119+
}

common/build.gradle

Lines changed: 0 additions & 7 deletions
This file was deleted.

common/build.gradle.kts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
group = "com.tcoded.folialib"
2+
3+
dependencies {
4+
compileOnly("org.spigotmc:spigot-api:1.8.8-R0.1-SNAPSHOT")
5+
6+
implementation(project(":platform:common"))
7+
}

common/src/main/java/com/tcoded/folialib/FoliaLib.java

Lines changed: 38 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import com.tcoded.folialib.enums.ImplementationType;
44
import com.tcoded.folialib.impl.PlatformScheduler;
5+
import com.tcoded.folialib.util.FoliaLibOptions;
56
import com.tcoded.folialib.util.InvalidTickDelayNotifier;
67
import org.bukkit.plugin.Plugin;
78

@@ -14,10 +15,22 @@ public class FoliaLib {
1415

1516
private final ImplementationType implementationType;
1617
private final PlatformScheduler scheduler;
18+
private FoliaLibOptions options;
19+
private InvalidTickDelayNotifier invalidTickDelayNotifier;
1720

1821
public FoliaLib(Plugin plugin) {
22+
this(plugin, new FoliaLibOptions());
23+
}
24+
25+
public FoliaLib(Plugin plugin, FoliaLibOptions customOptions) {
1926
this.plugin = plugin;
2027

28+
// Initialize options
29+
this.options = customOptions;
30+
31+
// Initialize the invalid tick delay notifier
32+
this.invalidTickDelayNotifier = new InvalidTickDelayNotifier(plugin.getLogger(), this.options);
33+
2134
// Find the implementation type based on the class names
2235
ImplementationType foundType = ImplementationType.UNKNOWN;
2336

@@ -48,7 +61,7 @@ public FoliaLib(Plugin plugin) {
4861
if (this.getClass().getName().startsWith(originalLocation)) {
4962
Logger logger = this.plugin.getLogger();
5063
logger.severe("****************************************************************");
51-
logger.severe("FoliaLib is not be relocated correctly! This will cause conflicts");
64+
logger.severe("FoliaLib is not relocated correctly! This will cause conflicts");
5265
logger.severe("with other plugins using FoliaLib. Please contact the developers");
5366
logger.severe(String.format("of '%s' and inform them of this issue immediately!", this.plugin.getDescription().getName()));
5467
logger.severe("****************************************************************");
@@ -101,18 +114,40 @@ public Plugin getPlugin() {
101114

102115
// Public Options
103116

117+
/**
118+
* Use {@link FoliaLib#getOptions()} instead.
119+
*/
104120
@SuppressWarnings("unused")
121+
@Deprecated
105122
public void disableInvalidTickValueWarning() {
106-
InvalidTickDelayNotifier.disableNotifications = true;
123+
getOptions().disableNotifications();
107124
}
108125

126+
/**
127+
* Use {@link FoliaLib#getOptions()} instead.
128+
*/
109129
@SuppressWarnings("unused")
130+
@Deprecated
110131
public void enableInvalidTickValueDebug() {
111-
InvalidTickDelayNotifier.debugMode = true;
132+
getOptions().enableInvalidTickDebugMode();
133+
}
134+
135+
public FoliaLibOptions getOptions() {
136+
return this.options;
112137
}
113138

114139
// Internal Utils
115140

141+
/**
142+
* This is an internal tool, do NOT use!
143+
* You're probably looking for {@link FoliaLib#getOptions()} instead.
144+
* **/
145+
@Deprecated
146+
@SuppressWarnings("DeprecatedIsStillUsed")
147+
public InvalidTickDelayNotifier getInvalidTickDelayNotifier() {
148+
return this.invalidTickDelayNotifier;
149+
}
150+
116151
private PlatformScheduler createServerImpl(String implName) {
117152
String basePackage = this.getClass().getPackage().getName() + ".impl.";
118153

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
package com.tcoded.folialib.util;
2+
3+
public class FoliaLibOptions {
4+
5+
// InvalidTickDelayNotifier
6+
private boolean disableNotifications = false;
7+
private boolean invalidTickDebugMode = false;
8+
9+
// isValid
10+
private boolean useIsValidOnNonFolia = false;
11+
12+
public boolean isDisableNotifications() {
13+
return disableNotifications;
14+
}
15+
16+
public void disableNotifications() {
17+
disableNotifications = true;
18+
}
19+
20+
public boolean isInvalidTickDebugMode() {
21+
return invalidTickDebugMode;
22+
}
23+
24+
public void enableInvalidTickDebugMode() {
25+
invalidTickDebugMode = true;
26+
}
27+
28+
public void disableInvalidTickDebugMode() {
29+
invalidTickDebugMode = false;
30+
}
31+
32+
public boolean useIsValidOnNonFolia() {
33+
return useIsValidOnNonFolia;
34+
}
35+
36+
/**
37+
* Warning: This will prevent entity based timers from ever automatically stopping.
38+
*/
39+
public void disableIsValidOnNonFolia() {
40+
useIsValidOnNonFolia = false;
41+
}
42+
43+
}

0 commit comments

Comments
 (0)