From 2579f5301e115ce28aca663dacba935fed8bbebf Mon Sep 17 00:00:00 2001 From: Jerrylum Date: Sat, 16 Oct 2021 22:23:57 +0800 Subject: [PATCH 1/4] separate pom file --- .github/workflows/build.yml | 3 +- pom.xml | 6 +- pom1.17.xml | 177 ++++++++++++++++++ .../publicbin/test/mock/CustomPlayerMock.java | 8 +- 4 files changed, 186 insertions(+), 8 deletions(-) create mode 100644 pom1.17.xml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 362c7ad..7e4b8a0 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -16,9 +16,10 @@ jobs: - name: Set up JDK 1.16 uses: actions/setup-java@v2 with: + distribution: 'temurin' java-version: '16' - name: Build in Minecraft 1.17 - run: mvn package -Dspigot.api=1.17 -Dmockbukkit.api=1.17 -Dmockbukkit.version=1.7.0 --file pom.xml + run: mvn package -Dspigot.api=1.17 -Dmockbukkit.api=1.17 -Dmockbukkit.version=1.7.0 --file pom1.17.xml - name: Upload coverage to Codecov uses: codecov/codecov-action@v1 with: diff --git a/pom.xml b/pom.xml index d50b10c..f115774 100644 --- a/pom.xml +++ b/pom.xml @@ -15,11 +15,11 @@ UTF-8 - 1.17 + 1.16 ${spigot.api}.1 https://helpch.at/docs/${spigot.version}/ - 1.17 - 1.7.0 + 1.16 + 0.5.0 diff --git a/pom1.17.xml b/pom1.17.xml new file mode 100644 index 0000000..13ac787 --- /dev/null +++ b/pom1.17.xml @@ -0,0 +1,177 @@ + + 4.0.0 + com.jerryio.publicbin + PublicBin + + 1.1.0 + PublicBin + 2020 + jar + + PublicBin is a Spigot plugin that provides a place to discard unwanted items and retrieve items discarded by other players. + https://github.com/Jerrylum/PublicBin + + + UTF-8 + 1.17 + ${spigot.api}.1 + https://helpch.at/docs/${spigot.version}/ + 1.17 + 1.7.0 + 1.16 + 16 + 16 + + + + GitHub Issues + https://github.com/Jerrylum/PublicBin/issues + + + + + GNU General Public License v3.0 + https://github.com/Jerrylum/PublicBin/blob/main/LICENSE + repo + + + + + + spigot-repo + https://hub.spigotmc.org/nexus/content/repositories/snapshots + + + placeholderapi-repo + https://repo.extendedclip.com/content/repositories/placeholderapi + + + CodeMC + https://repo.codemc.org/repository/maven-public + + + jitpack.io + https://jitpack.io + + + + + ${project.basedir}/src/main/java + ${project.basedir}/src/test/java + clean package + + ${project.name}_v${project.version}_mc${spigot.api} + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.8.1 + + + **/package-info.java + + + + + org.apache.maven.plugins + maven-shade-plugin + 3.3.0-SNAPSHOT + + + + org.bstats + com.jerryio.publicbin.util + + + + + + package + + shade + + + + + + org.jacoco + jacoco-maven-plugin + 0.8.2 + + + + prepare-agent + + + + + report + test + + report + + + + + + + + + ${basedir}/src/main/resources + true + + + + + + + + apache.snapshots + https://repository.apache.org/snapshots/ + + + + + + org.spigotmc + spigot-api + ${spigot.version}-R0.1-SNAPSHOT + provided + + + me.clip + placeholderapi + 2.10.9 + provided + + + + + org.jetbrains + annotations + + + + + org.bstats + bstats-bukkit + 2.2.1 + compile + + + com.github.seeseemelk + MockBukkit-v${mockbukkit.api} + ${mockbukkit.version} + test + + + junit + junit + 4.13.2 + test + + + \ No newline at end of file diff --git a/src/test/java/com/jerryio/publicbin/test/mock/CustomPlayerMock.java b/src/test/java/com/jerryio/publicbin/test/mock/CustomPlayerMock.java index d6977ec..809b505 100644 --- a/src/test/java/com/jerryio/publicbin/test/mock/CustomPlayerMock.java +++ b/src/test/java/com/jerryio/publicbin/test/mock/CustomPlayerMock.java @@ -23,10 +23,10 @@ public void setLocale(String str) { locale = str; } - @Override - public org.bukkit.entity.Player.Spigot spigot() { - return new MockSpigot(); - } + // @Override + // public org.bukkit.entity.Player.Spigot spigot() { + // return new MockSpigot(); + // } @Override public void playSound(Location location, String sound, float volume, float pitch) { From ac91106e49d9aff6f4711f5a1492469cf054cade Mon Sep 17 00:00:00 2001 From: Jerrylum Date: Sat, 16 Oct 2021 22:28:29 +0800 Subject: [PATCH 2/4] remove custom pie --- src/main/java/com/jerryio/publicbin/PublicBinPlugin.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/jerryio/publicbin/PublicBinPlugin.java b/src/main/java/com/jerryio/publicbin/PublicBinPlugin.java index 2d71ebe..674b8a7 100644 --- a/src/main/java/com/jerryio/publicbin/PublicBinPlugin.java +++ b/src/main/java/com/jerryio/publicbin/PublicBinPlugin.java @@ -161,7 +161,7 @@ private void doMetricsSend() { Class.forName("com.google.gson.JsonElement"); if (System.getProperty("MockTest") == null) { Metrics metrics = new Metrics(this, 9744); - metrics.addCustomChart(new Metrics.SimplePie("using_mode", () -> setting.getMode().toString())); + // metrics.addCustomChart(new Metrics.SimplePie("using_mode", () -> setting.getMode().toString())); } } catch (Exception e) { // nothing to do From e25ac7ab31cf8c9b805bf5b9e752562a0d8b076d Mon Sep 17 00:00:00 2001 From: Jerrylum Date: Sat, 16 Oct 2021 22:54:39 +0800 Subject: [PATCH 3/4] fix surefire --- pom1.17.xml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/pom1.17.xml b/pom1.17.xml index 13ac787..83f5ab2 100644 --- a/pom1.17.xml +++ b/pom1.17.xml @@ -96,6 +96,16 @@ + + org.apache.maven.plugins + maven-surefire-plugin + 3.0.0-M1 + + 3 + true + -Xmx1024m -XX:MaxPermSize=256m + + org.jacoco jacoco-maven-plugin From 8567a1b025eca6d5179ad55d4b5029928362c9c6 Mon Sep 17 00:00:00 2001 From: Jerrylum Date: Sat, 16 Oct 2021 23:14:02 +0800 Subject: [PATCH 4/4] bump to 1.1.1 --- pom.xml | 2 +- pom1.17.xml | 2 +- .../jerryio/publicbin/disk/PluginSetting.java | 2 +- src/test/resources/config-1.1.0.yml | 68 +++++++++++++++++++ 4 files changed, 71 insertions(+), 3 deletions(-) create mode 100644 src/test/resources/config-1.1.0.yml diff --git a/pom.xml b/pom.xml index f115774..a82cd9a 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ com.jerryio.publicbin PublicBin - 1.1.0 + 1.1.1 PublicBin 2020 jar diff --git a/pom1.17.xml b/pom1.17.xml index 83f5ab2..730180c 100644 --- a/pom1.17.xml +++ b/pom1.17.xml @@ -5,7 +5,7 @@ com.jerryio.publicbin PublicBin - 1.1.0 + 1.1.1 PublicBin 2020 jar diff --git a/src/main/java/com/jerryio/publicbin/disk/PluginSetting.java b/src/main/java/com/jerryio/publicbin/disk/PluginSetting.java index 617f3c3..3679bc1 100644 --- a/src/main/java/com/jerryio/publicbin/disk/PluginSetting.java +++ b/src/main/java/com/jerryio/publicbin/disk/PluginSetting.java @@ -16,7 +16,7 @@ public class PluginSetting { public static final String[] OLD_CONFIG_MD5_CHECKSUMS = { - "1a3144fbbd4835c947010725b681e6c5" + "1a3144fbbd4835c947010725b681e6c5", "CD36233E47A5C216C3580FE5BB9CBF9A" }; private YamlConfiguration config; diff --git a/src/test/resources/config-1.1.0.yml b/src/test/resources/config-1.1.0.yml new file mode 100644 index 0000000..ef85f66 --- /dev/null +++ b/src/test/resources/config-1.1.0.yml @@ -0,0 +1,68 @@ +# Language used by the plugin, for example: en_US, zh_CN, zh_TW +lang: en_US + +# The inventory mode can be... +# - share (default, everyone using the same bin) +# - separate (everyone has their own bin) +mode: share + +# The number of rows in the bin +size: 6 + +# despawn after a certain amount of time +countdown-despawn: + enable: true + # The time a set of item disappear (in seconds) + time: 300 + +# Remove all items at regular intervals +clear-intervals: + enable: false + # The intervals (in seconds) on how often the bin will be cleared + time: 600 + # Display warning messages when the time to clear items is approaching + warnings: + # The warning message type can be... + # - actionbar (default) + # - chat + type: actionbar + # Output a clear warning whenever there is a certain amount of time + # remaining. (in seconds) + period: [60, 30, 10, 0] + +# Remove items when there is not much space left +remove-when-full: + enable: true + # When the number of remaining grids is less than this number, the item will + # be cleared + threshold: 6 + # Sort according to these principles, priority from top to bottom + # Item with the lower priority will be removed + order: + - metadata + - type + - durability + - amount + - time + +# Sort items in the bin automatically +smart-grouping: + enable: true + # Sort according to these principles, priority from top to bottom + # Item with the highest priority will be placed in the first grid + order: + - type + - metadata + - durability + - amount + - time + +# put all dropped items that are about to disappear in the server into the +# public trash bin +collect-despawn: + enable: false + +debug: false + +# Config version identifier. DO NOT CHANGE THIS +version: 1.1.0