-
Notifications
You must be signed in to change notification settings - Fork 5
MojangAPI and textures #102
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
9547b85
722e392
394a6cb
98123df
8f9a805
b62ec95
81f6708
387ffa4
f16ab7d
31c3c1d
e4c188f
c9d3396
0e0bc23
afa7b30
fa22fff
bc947a5
46dbdc0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
| @@ -1,3 +1,5 @@ | ||||||||
| import java.nio.file.Paths | ||||||||
|
|
||||||||
| plugins { | ||||||||
| id "io.freefair.lombok" version "5.3.3.3" apply false | ||||||||
| // spotless for license headers and linting | ||||||||
|
|
@@ -7,12 +9,14 @@ plugins { | |||||||
|
|
||||||||
| // pom packaging for root | ||||||||
| id "java-platform" | ||||||||
| id 'idea' | ||||||||
| } | ||||||||
|
|
||||||||
| allprojects { | ||||||||
| group = "com.dumbdogdiner" | ||||||||
| version = "3.0.3" | ||||||||
|
|
||||||||
| apply plugin: "idea" | ||||||||
| // java plugin is applied in subprojects | ||||||||
| apply plugin: "jacoco" | ||||||||
|
|
||||||||
|
|
@@ -157,6 +161,7 @@ subprojects { | |||||||
|
|
||||||||
| tasks.withType(JavaCompile) { | ||||||||
| options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation" << "-XDignore.symbol.file" | ||||||||
| dependsOn(processResources) | ||||||||
| } | ||||||||
|
|
||||||||
| configurations { | ||||||||
|
|
@@ -185,6 +190,10 @@ subprojects { | |||||||
| forRepositories(dddResources) | ||||||||
| filter { includeGroup("dumbdogdiner") } | ||||||||
| } | ||||||||
| maven { | ||||||||
| name = "HeadDatabase-API" | ||||||||
| url = uri("https://mvn.intellectualsites.com/content/repositories/thirdparty/") | ||||||||
| } | ||||||||
| } | ||||||||
|
|
||||||||
| dependencies { | ||||||||
|
|
@@ -231,7 +240,10 @@ subprojects { | |||||||
| delombok.encoding = "UTF-8" | ||||||||
| compileJava.options.encoding = "UTF-8" | ||||||||
| compileTestJava.options.encoding = "UTF-8" | ||||||||
| javadoc.options.encoding = "UTF-8" | ||||||||
| tasks.withType(Javadoc) { | ||||||||
| options.addBooleanOption("quiet", true) | ||||||||
| options.encoding = "UTF-8" | ||||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This doesn't need to be specified if it's in |
||||||||
| } | ||||||||
|
|
||||||||
| // Javadoc: Add rootproject name in title for consistency | ||||||||
| javadoc.title = "$rootProject.name-$project.name $project.version API" | ||||||||
|
|
@@ -275,6 +287,7 @@ task rootSources(type: Jar, dependsOn: subprojects.classes) { | |||||||
| dependsOn(":common:commonSources") | ||||||||
|
|
||||||||
| archiveClassifier.set("sources") | ||||||||
| duplicatesStrategy(DuplicatesStrategy.EXCLUDE) | ||||||||
| // Use source code from all subprojects for sources. | ||||||||
| // TODO: Use certain subprojects only to allow for multiple jar outputs | ||||||||
| from subprojects.sourceSets.main.allSource | ||||||||
|
|
@@ -344,15 +357,34 @@ aggregateJavadoc.options.encoding = "UTF-8" | |||||||
| // Root Javadoc: Set title and output dir | ||||||||
| aggregateJavadoc.title = "StickyAPI $project.version API (Aggregated)" | ||||||||
| aggregateJavadoc.destinationDir = file("$buildDir/docs/javadoc") | ||||||||
| /* | ||||||||
| Since JDK13 the javadoc html validator was changed, making it impossible to have javadocs | ||||||||
| that are valid on both pre-13 and post-13 java versions. | ||||||||
| The original workaround was suggested here: https://bugs.openjdk.java.net/browse/JDK-8223552 | ||||||||
| However, this workaround does not work for us since we are using aggregate-javadoc. | ||||||||
| So, we are using a workaround for the workaround from: | ||||||||
| original: https://blog.joda.org/2014/02/turning-off-doclint-in-jdk-8-javadoc.html | ||||||||
| archived: https://web.archive.org/web/20210117193942/https://blog.joda.org/2014/02/turning-off-doclint-in-jdk-8-javadoc.html | ||||||||
| which, in turn, references this: https://github.com/GPars/GPars/blob/7cddf7cf2fec1fd66ef800edccfc03315d078a2b/build.gradle#L209 | ||||||||
| */ | ||||||||
|
|
||||||||
| task browseJavadoc { | ||||||||
| dependsOn aggregateJavadoc | ||||||||
| allprojects { | ||||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Worth checking with @Prouser123 - not sure if you've done this already. |
||||||||
| tasks.withType(Javadoc) { | ||||||||
| options.addBooleanOption("Xdoclint:-html", JavaVersion.current().isJava11Compatible()) | ||||||||
| options.addBooleanOption("-frames", JavaVersion.current().isJava11()) | ||||||||
| options.memberLevel = JavadocMemberLevel.PRIVATE | ||||||||
| options.encoding = "UTF-8" | ||||||||
| } | ||||||||
| task browseJavadoc { | ||||||||
| dependsOn javadoc | ||||||||
| description "Browse javadoc" | ||||||||
| group = "documentation" | ||||||||
| doLast { | ||||||||
| java.awt.Desktop.desktop.browse new URI(("file:///" << System.getProperty("user.dir").replace('\\','/') << "/build/docs/javadoc/index.html").toString()) | ||||||||
| java.awt.Desktop.desktop.browse getProjectDir().toPath().resolve("build/docs/javadoc/index.html").toUri() | ||||||||
| } | ||||||||
| } | ||||||||
| } | ||||||||
|
|
||||||||
|
|
||||||||
| tasks.publish.dependsOn build | ||||||||
|
|
||||||||
|
|
@@ -364,4 +396,4 @@ publishing { | |||||||
| artifact rootSources // Publish the output of the (root) sources task | ||||||||
| } | ||||||||
| } | ||||||||
| } | ||||||||
| } | ||||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
|
|
@@ -51,6 +51,7 @@ test.jvmArgs = ["--add-opens=java.base/java.lang.reflect=ALL-UNNAMED"] | |||
| These is also an accompanying test at (test src) com.dumbdogdiner.stickyapi.StickyAPITest | ||||
| */ | ||||
|
|
||||
|
|
||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||
| // Set the timestamp format | ||||
| def dataBuildTimestamp = "yyyy-MM-dd'T'HH:mm:ss.SSSZ" | ||||
|
|
||||
|
|
@@ -81,12 +82,8 @@ task processSourceTokens(type: Sync) { | |||
| // Use the filter task as the input for compileJava | ||||
| compileJava.source = processSourceTokens.outputs | ||||
|
|
||||
|
|
||||
| /* | ||||
| Font Width Info | ||||
| ---------- | ||||
| This task serves to copy width data from the default Minecraft font into the final jar. | ||||
| This data is generated by <https://github.com/DumbDogDiner/mc-font-extractor>. | ||||
| /** | ||||
| * Task to clean generated resources | ||||
| */ | ||||
|
|
||||
| // Font Width Info | ||||
|
|
||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| /* | ||
| * Copyright (c) 2020-2021 DumbDogDiner <dumbdogdiner.com>. All rights reserved. | ||
| * Licensed under the MIT license, see LICENSE for more information... | ||
| */ | ||
| package com.dumbdogdiner.stickyapi.annotation; | ||
|
|
||
| /** | ||
| * Denotes a method, class, or interface that is currently broken. Optionally links to a page about the issue | ||
| */ | ||
| public @interface Broken { | ||
kaylendog marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| public String issuepage() default ""; | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| /* | ||
| * Copyright (c) 2020-2021 DumbDogDiner <dumbdogdiner.com>. All rights reserved. | ||
| * Licensed under the MIT license, see LICENSE for more information... | ||
| */ | ||
| package com.dumbdogdiner.stickyapi.annotation; | ||
|
|
||
| import java.lang.annotation.Documented; | ||
|
|
||
|
|
||
| /** | ||
| * Do not call a method annotated with this, it will do bad things | ||
| */ | ||
| @Documented | ||
| public @interface DoNotCall { | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why does this existtttt
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Check where it's used
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Point still stands? This isn't really something we need
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think its needed because if any of the methods are called, it will crash, so its for documentation, and can be used with google's errorprone (or that can be used) to make sure they are not called
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Okay, but please don't add things unrelated to a PR without asking the rest of the team - for future reference.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would also like to add that if you dont want a specific method to be called, please use the correct modifier for your use case instead of creating annotations that wont prevent the user from executing this method.
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I may be able to do stuff via refactor though
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Cloned from previous PR:
So yes, would be nice if you can refactor this in a way that doesn't cause this issue. |
||
|
|
||
| } | ||
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -4,7 +4,9 @@ | |||||||
| */ | ||||||||
| package com.dumbdogdiner.stickyapi.common.util; | ||||||||
|
|
||||||||
| import java.nio.charset.StandardCharsets; | ||||||||
| import java.text.DecimalFormat; | ||||||||
| import java.util.Base64; | ||||||||
| import java.util.HashMap; | ||||||||
| import java.util.Map; | ||||||||
| import java.util.UUID; | ||||||||
|
|
@@ -308,6 +310,43 @@ public static UUID hyphenateUUID(@NotNull String uuid) { | |||||||
| } | ||||||||
| } | ||||||||
|
|
||||||||
| /** | ||||||||
| * Remove hyphons from a UUID object and return a string | ||||||||
| * <p> | ||||||||
| * e.x. de8c89e1-2f25-424d-8078-c6ff58db7d6e -> | ||||||||
| * de8c89e12f25424d8078c6ff58db7d6e | ||||||||
| * | ||||||||
| * @param uuid the UUID to de-hyphenate | ||||||||
| * @return a string representation of the UUID, without any hyphens | ||||||||
| */ | ||||||||
| public static @NotNull String unhyphenateUUID(@NotNull UUID uuid){ | ||||||||
| return unhyphenate(uuid.toString()); | ||||||||
| } | ||||||||
|
|
||||||||
| public static @NotNull String unhyphenate(@NotNull String str){ | ||||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does this need to be its own method given it's such a tiny snippet? The snippet itself is a wonderful 3 characters longer...
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's a pair with hyphenate, for completeness
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Imo it's not really necessary |
||||||||
| return str.replace("-",""); | ||||||||
| } | ||||||||
|
|
||||||||
|
|
||||||||
| /** | ||||||||
| * Utility method to ensure Base64 encoding is done consistently. | ||||||||
| * @param str The {@link String} to be encoded | ||||||||
| * @return The encoded {@link String} | ||||||||
| */ | ||||||||
| public static @NotNull String encodeBase64(@NotNull String str) { | ||||||||
| return new String(Base64.getEncoder().encode(str.getBytes(StandardCharsets.UTF_8))); | ||||||||
| } | ||||||||
|
|
||||||||
| /** | ||||||||
| * Utility method to ensure Base64 decoding is done consistently. | ||||||||
| * @param str A {@link String} containing the Base64-encoded data | ||||||||
| * @return A string of UTF-8 Text decoded from the input | ||||||||
| * @throws IllegalArgumentException if the Base64 decoding fails | ||||||||
| */ | ||||||||
| public static @NotNull String decodeBase64(String str) throws IllegalArgumentException { | ||||||||
| return new String(Base64.getDecoder().decode(str), StandardCharsets.UTF_8); | ||||||||
| } | ||||||||
|
|
||||||||
| /** | ||||||||
| * Creates a random string of "magic" characters of characters | ||||||||
| * | ||||||||
|
|
@@ -369,5 +408,4 @@ public static String randomObfuscatedString(int min, int max, int minRunBeforeSp | |||||||
| public static String formatChatCodes(String input) { | ||||||||
| return input.replaceAll("&(?=([a-f]|[0-9]|[klmnor]))", Character.toString(ChatColor.COLOR_CHAR)); | ||||||||
| } | ||||||||
|
|
||||||||
| } | ||||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| repositories { | ||
| mavenCentral() | ||
| maven { url 'https://hub.spigotmc.org/nexus/content/repositories/public/' } | ||
| } | ||
|
|
||
| dependencies { | ||
| implementation project(":common") | ||
| testImplementation project(":common").sourceSets.test.output | ||
|
|
||
| implementation project(":bukkit") | ||
| testImplementation project(":bukkit").sourceSets.test.output | ||
|
|
||
| implementation project(":webapi") | ||
| testImplementation project(":webapi").sourceSets.test.output | ||
|
|
||
| implementation project(":textures") | ||
| testImplementation project(":textures").sourceSets.test.output | ||
|
|
||
| compileOnly "com.destroystokyo.paper:paper-api:1.16.5-R0.1-SNAPSHOT" | ||
|
|
||
| testImplementation 'com.github.seeseemelk:MockBukkit-v1.16:0.25.0' | ||
| testImplementation group: 'it.unimi.dsi', name: 'fastutil', version: '8.2.1' | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| # This file is generated by the 'io.freefair.lombok' Gradle plugin | ||
| config.stopBubbling = true | ||
| lombok.addLombokGeneratedAnnotation = true |

There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is up with all this spacing lul