Skip to content

Commit

Permalink
[release] v2.2.0: New config option for bad connections; temporary co…
Browse files Browse the repository at this point in the history
…mmand/world fix; buildscript improvement; license headers
  • Loading branch information
triphora committed Aug 5, 2021
1 parent 24a9b94 commit 525ead6
Show file tree
Hide file tree
Showing 43 changed files with 1,002 additions and 92 deletions.
37 changes: 15 additions & 22 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,28 +1,21 @@
name: Build EMC Utilities
on: [ pull_request, push ]
name: Build and/or Release EMC Utilities
on: [ push ]

jobs:
build:
strategy:
matrix:
java: [ 16 ]
os: [ ubuntu-latest, windows-latest, macos-latest ]
runs-on: ${{ matrix.os }}
runs-on: ubuntu-20.04
container:
image: adoptopenjdk:16-jdk
options: --user root
steps:
- name: 1 - Checkout repository
uses: actions/checkout@v2
- name: 2 - Validate Gradle wrapper
uses: gradle/wrapper-validation-action@v1
- name: 3 - Set up JDK ${{ matrix.java }}
uses: actions/setup-java@v2
- run: apt update && apt install git -y && git --version
- uses: actions/checkout@v2
- uses: gradle/wrapper-validation-action@v1
- uses: actions/setup-java@v2
with:
distribution: adopt
java-version: ${{ matrix.java }}
- name: 4 - Build
run: ./gradlew build
- name: 5 - Capture & upload build artifacts
if: ${{ runner.os == 'Linux' }}
uses: actions/upload-artifact@v2
with:
name: Artifacts
path: build/libs/
java-version: 16
- run: ./gradlew build modrinth
if: "contains(github.event.head_commit.message, '[release]')"
env:
MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }}
22 changes: 18 additions & 4 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,7 +1,21 @@
Copyright 2021 MrFrydae
Copyright (c) 2021 MrFrydae
Copyright (c) 2021 wafflecoffee
Copyright (c) 2021 djlawler

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
57 changes: 40 additions & 17 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,17 +1,28 @@
// Inspired in part by the buildscripts of FabricMC/fabric

plugins {
id "fabric-loom" version "0.9-SNAPSHOT"
id 'io.github.juuxel.loom-quiltflower' version '1.1.3'
id "fabric-loom" version "0.9.+"
id "com.modrinth.minotaur" version "1.2.+"
id "org.cadixdev.licenser" version "0.6.+"
id "io.github.juuxel.loom-quiltflower" version "1.2.+"
}

sourceCompatibility = JavaVersion.VERSION_16
targetCompatibility = JavaVersion.VERSION_16
String mod_version = "2.2.0"
String release_title = "Important bug fix & new config option for slow connections"
String changelog = "- update deps, add quiltflower (wafflecoffee)\n- [release] v2.2.0: New config option for bad connections; temporary command/world fix; buildscript improvement; license headers (wafflecoffee)"

String minecraft_version = "1.17.1" // https://fabricmc.net/versions.html
String yarn_mappings = "32" // https://fabricmc.net/versions.html
String loader_version = "0.11.6" // https://fabricmc.net/versions.html
String fabric_version = "0.37.1+1.17" // https://fabricmc.net/versions.html
String modmenu_version = "2.0.4" // https://modrinth.com/mod/modmenu/versions
String lombok_version = "1.18.20" // https://mvnrepository.com/artifact/org.projectlombok/lombok

archivesBaseName = "emcutils-${project.minecraft_version}"
version = project.mod_version
archivesBaseName = "emcutils-${minecraft_version}"
version = mod_version

repositories {
maven { url "https://api.modrinth.com/maven" }
maven { url "https://maven.shedaniel.me" }
maven { url "https://maven.terraformersmc.com" }
maven { url "https://www.cursemaven.com" }
}

Expand All @@ -24,24 +35,23 @@ Set<String> apiModules = [
]

dependencies {
minecraft "com.mojang:minecraft:${project.minecraft_version}"
mappings "net.fabricmc:yarn:${project.minecraft_version}+build.${project.yarn_mappings}:v2"
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
minecraft "com.mojang:minecraft:${minecraft_version}"
mappings "net.fabricmc:yarn:${minecraft_version}+build.${yarn_mappings}:v2"
modImplementation "net.fabricmc:fabric-loader:${loader_version}"
apiModules.forEach { include(modImplementation(fabricApi.module(it, fabric_version))) }

modImplementation "maven.modrinth:modmenu:${project.modmenu_version}"
modImplementation "com.terraformersmc:modmenu:${modmenu_version}"

implementation "org.projectlombok:lombok:${project.lombok_version}"
annotationProcessor "org.projectlombok:lombok:${project.lombok_version}"
testImplementation "org.projectlombok:lombok:${project.lombok_version}"
testAnnotationProcessor "org.projectlombok:lombok:${project.lombok_version}"
implementation "org.projectlombok:lombok:${lombok_version}"
annotationProcessor "org.projectlombok:lombok:${lombok_version}"
testImplementation "org.projectlombok:lombok:${lombok_version}"
testAnnotationProcessor "org.projectlombok:lombok:${lombok_version}"

modImplementation "curse.maven:voxelmap-225179:3345206"
}

processResources {
inputs.property "version", project.version

filesMatching("fabric.mod.json") {
expand "version": project.version
}
Expand All @@ -50,3 +60,16 @@ processResources {
tasks.withType(JavaCompile) { it.options.encoding = "UTF-8" }

jar { from("LICENSE") }

import com.modrinth.minotaur.TaskModrinthUpload

task modrinth(type: TaskModrinthUpload) {
onlyIf { System.getenv().MODRINTH_TOKEN }
token = System.getenv().MODRINTH_TOKEN
projectId = "QYTT62S0"
versionNumber = version
versionName = release_title
changelog = changelog as String
uploadFile = file("${project.buildDir}/libs/${archivesBaseName}-${version}.jar")
addGameVersion(minecraft_version)
}
16 changes: 3 additions & 13 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,13 +1,3 @@
# Done to increase the memory available to gradle.
# suppress inspection "UnusedProperty"
org.gradle.jvmargs=-Xmx1G
# Fabric Properties - check these on <https://fabricmc.net/versions.html>
minecraft_version=1.17.1
yarn_mappings=30
loader_version=0.11.6
fabric_version=0.37.1+1.17
# Mod Properties
mod_version=2.1.4
# Dependencies
modmenu_version=2.0.2
lombok_version=1.18.20
# file suppress inspection "UnusedProperty"
org.gradle.jvmargs=-Xmx2G
org.gradle.parallel=true
39 changes: 33 additions & 6 deletions src/main/java/dev/frydae/emcutils/EmpireMinecraftUtilities.java
Original file line number Diff line number Diff line change
@@ -1,3 +1,27 @@
/*
* Copyright (c) 2021 MrFrydae
* Copyright (c) 2021 wafflecoffee
* Copyright (c) 2021 djlawler
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/

package dev.frydae.emcutils;

import dev.frydae.emcutils.containers.EmpireServer;
Expand Down Expand Up @@ -49,7 +73,7 @@ public static void onPostJoinEmpireMinecraft() {
() -> Util.getInstance().setShouldRunTasks(false));
}

if (Util.HAS_VOXELMAP) {
if (Util.hasVoxelMap) {
Tasks.runTasks(
new GetLocationTask(),
new VoxelMapIntegration()
Expand All @@ -61,17 +85,20 @@ public static void onPostJoinEmpireMinecraft() {
public void onInitializeClient() {
instance = this;

ExecutorService executor = Executors.newCachedThreadPool();
IntStream.rangeClosed(1, 10).forEach(i -> executor.submit(() -> EmpireServer.getById(i).collectResidences()));
executor.shutdown();
MidnightConfig.init(MODID, Config.class);

if (!Config.isDontRunResidenceCollector()) {
ExecutorService executor = Executors.newCachedThreadPool();
IntStream.rangeClosed(1, 10).forEach(i -> executor.submit(() -> EmpireServer.getById(i).collectResidences()));
executor.shutdown();
}
else LogManager.getLogger(MODID).info(MODID + " is not going to run the residence collector - some features will not work as intended. Disable 'Don't run residence collector' to get rid of this message.");

HandledScreens.register(VaultButtons.GENERIC_9X7, VaultScreen::new);

Util.getOnJoinCommandQueue();
Util.hasVoxelMap();

MidnightConfig.init(MODID, Config.class);

LogManager.getLogger(MODID).info("Initialized " + MODID);
}
}
24 changes: 24 additions & 0 deletions src/main/java/dev/frydae/emcutils/containers/EmpireResidence.java
Original file line number Diff line number Diff line change
@@ -1,3 +1,27 @@
/*
* Copyright (c) 2021 MrFrydae
* Copyright (c) 2021 wafflecoffee
* Copyright (c) 2021 djlawler
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/

package dev.frydae.emcutils.containers;

import com.google.gson.JsonObject;
Expand Down
43 changes: 30 additions & 13 deletions src/main/java/dev/frydae/emcutils/containers/EmpireServer.java
Original file line number Diff line number Diff line change
@@ -1,3 +1,27 @@
/*
* Copyright (c) 2021 MrFrydae
* Copyright (c) 2021 wafflecoffee
* Copyright (c) 2021 djlawler
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/

package dev.frydae.emcutils.containers;

import com.google.common.collect.Lists;
Expand Down Expand Up @@ -38,6 +62,7 @@ public enum EmpireServer {
@Getter private final char tabListDisplay;
@Getter private final String command;
@Getter private final List<EmpireResidence> residences;
private static boolean didConnectionFail = false;

EmpireServer(int id, String name, int tabListRank, char tabListDisplay) {
this.id = id;
Expand Down Expand Up @@ -135,20 +160,12 @@ public void collectResidences() {
.getAsJsonObject("empire.residences")
.getAsJsonObject("areas");

object.entrySet().forEach(e -> {
if (e.getValue().getAsJsonObject().get("desc").getAsString().contains("EmpireMinecraft") ||
e.getValue().getAsJsonObject().get("desc").getAsString().contains("Aikar") ||
e.getValue().getAsJsonObject().get("desc").getAsString().contains("Krysyy") ||
e.getValue().getAsJsonObject().get("desc").getAsString().contains("Maxarias")) {
return;
}

residences.add(new EmpireResidence(this, e.getValue().getAsJsonObject()));
});
} catch (IOException e) {
e.printStackTrace();
object.entrySet().forEach(e -> residences.add(new EmpireResidence(this, e.getValue().getAsJsonObject())));
} catch (IOException ioException) {
didConnectionFail = true;
}

LogManager.getLogger(EmpireMinecraftUtilities.MODID).info("Loaded Residences for: " + name.toLowerCase());
if (!didConnectionFail) LogManager.getLogger(EmpireMinecraftUtilities.MODID).info("Loaded Residences for: " + name.toLowerCase());
else LogManager.getLogger(EmpireMinecraftUtilities.MODID).info("Residence collector for " + name.toLowerCase() + " failed; you may find the 'Don't run residence collector' option to be useful. This option will prevent the residence collector from running at all, which, on very slow connections, will help prevent requests which will fail anyway.");
}
}
28 changes: 26 additions & 2 deletions src/main/java/dev/frydae/emcutils/features/ChatChannels.java
Original file line number Diff line number Diff line change
@@ -1,3 +1,27 @@
/*
* Copyright (c) 2021 MrFrydae
* Copyright (c) 2021 wafflecoffee
* Copyright (c) 2021 djlawler
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/

package dev.frydae.emcutils.features;

import dev.frydae.emcutils.utils.Config;
Expand Down Expand Up @@ -26,7 +50,7 @@ public class ChatChannels {
private static long lastClickedButtonTime = 0L;

public static void handleChatScreenRender(Screen screen, MatrixStack matrices, CallbackInfo info) {
if (Util.IS_ON_EMC) {
if (Util.isOnEMC) {
for (ChatChannel channel : ChatChannel.values()) {
if (channel == ChatChannel.SUPPORTER && Util.getPlayerGroupId() < 2) break;
if (channel == ChatChannel.MODERATOR && Util.getPlayerGroupId() < 5) break;
Expand All @@ -40,7 +64,7 @@ public static void handleChatScreenRender(Screen screen, MatrixStack matrices, C
}

public static void handleChatScreenMouseClicked(Screen screen, double mouseX, double mouseY, int button, CallbackInfoReturnable<Boolean> cir) {
if (Util.IS_ON_EMC) {
if (Util.isOnEMC) {
for (ChatChannel channel : ChatChannel.values()) {
if (channel == ChatChannel.SUPPORTER && Util.getPlayerGroupId() < 2) break;
if (channel == ChatChannel.MODERATOR && Util.getPlayerGroupId() < 5) break;
Expand Down
Loading

0 comments on commit 525ead6

Please sign in to comment.