9 Commits

Author SHA1 Message Date
a5649106b4 Reorganizes docs.
Some checks failed
Java CI with Gradle / build (push) Has been cancelled
2026-09-28 00:19:14 -07:00
a7d828daeb Adds tests to github actions and a build badge.
Some checks failed
Java CI with Gradle / build (push) Has been cancelled
2026-09-28 00:12:16 -07:00
db43411628 Updates spotless and adds a license header. 2026-09-27 02:29:43 -07:00
39998917ab Removes dependabot submissions.
Some checks failed
Java CI with Gradle / build (push) Has been cancelled
2026-09-27 01:26:48 -07:00
cd3c58c942 Updates to docs and ci. 2026-09-27 01:14:52 -07:00
676407dbcb Fixes dependabot includes. 2026-09-27 00:25:52 -07:00
186afc7813 Adds modrinth dependency for ScoreKeeper. 2026-09-26 23:57:24 -07:00
c2abca419f Adds github actions to build and archive the jar. 2026-09-26 23:48:13 -07:00
9c69197e7f Adds tasks. 2026-09-26 23:47:13 -07:00
21 changed files with 595 additions and 491 deletions

View File

@@ -8,6 +8,7 @@ PAPER_USER_AGENT="majinnaibu-plugin-dev/1.0 (https://github.com/majinnaibu)"
JAVA_OPTS="-Xms2G -Xmx2G" JAVA_OPTS="-Xms2G -Xmx2G"
STOP_TIMEOUT=60 STOP_TIMEOUT=60
MINECRAFT_SERVER_JAR=paper-26.2-129.jar MINECRAFT_SERVER_JAR=paper-26.2-129.jar
# Relative paths are resolved from the project root; ~/ is expanded. # Relative paths are resolved from the project root; ~/ is expanded.
MINECRAFT_SERVER_PATH=./server MINECRAFT_SERVER_PATH=./server
MINECRAFT_BACKUP_PATH=./backups MINECRAFT_BACKUP_PATH=./backups
@@ -16,9 +17,10 @@ MINECRAFT_BACKUP_PATH=./backups
# Release version is read from Gradle and checked against the jar's plugin.yml. # Release version is read from Gradle and checked against the jar's plugin.yml.
MODRINTH_TOKEN= MODRINTH_TOKEN=
MODRINTH_PROJECT_ID=mob-scores MODRINTH_PROJECT_ID=mob-scores
# Optional Markdown override; empty generates notes from commits since the last tag.
MODRINTH_CHANGELOG= MODRINTH_CHANGELOG=
MODRINTH_GAME_VERSIONS=1.21,1.21.1,1.21.2,1.21.3,1.21.4,1.21.5,1.21.6,1.21.7 MODRINTH_GAME_VERSIONS=26.2,26.3
MODRINTH_LOADERS=paper MODRINTH_LOADERS=paper
MODRINTH_VERSION_TYPE= MODRINTH_VERSION_TYPE=
MODRINTH_DEPENDENCIES= MODRINTH_DEPENDENCIES='[{"project_id":"5NYwxysp","version_id":null,"file_name":null,"dependency_type":"required"}]'
MODRINTH_FILE= MODRINTH_FILE=

View File

@@ -1,23 +1,59 @@
name: Gradle Build name: Java CI with Gradle
on: on:
push: push:
branches: [ "develop" ]
pull_request: pull_request:
branches: [ "develop" ]
jobs: jobs:
build: build:
runs-on: ubuntu-latest runs-on: ubuntu-latest
permissions:
contents: read
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v7
- uses: actions/checkout@v4
- name: Set up JDK 25
uses: actions/setup-java@v6
with: with:
repository: headhunter45/ScoreKeeper
path: ScoreKeeper
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: '25' java-version: '25'
- uses: gradle/actions/setup-gradle@v4 distribution: 'temurin'
- run: ./gradlew publishToMavenLocal
working-directory: ScoreKeeper - name: Setup Gradle 9.8.0
- run: ./gradlew test build uses: gradle/actions/setup-gradle@v5
with:
gradle-version: '9.8.0'
cache-read-only: ${{ github.ref != 'refs/heads/develop' }}
- name: Run Unit Tests
run: ./gradlew test
- name: Upload Test Report
if: always()
uses: actions/upload-artifact@v7
with:
name: MobScores-test-report
path: |
build/reports/tests/test
build/test-results/test
if-no-files-found: ignore
retention-days: 14
- name: Build with Gradle Wrapper
run: ./tools/build-plugin.sh
- name: Extract Project Version
id: project_info
run: |
VERSION=$(./gradlew properties --no-daemon -q | awk -F ': ' '$1 == "version" {print $2}')
echo "version=$VERSION" >> $GITHUB_OUTPUT
- name: Upload Plugin Artifact
uses: actions/upload-artifact@v7
with:
name: MobScores-${{ steps.project_info.outputs.version }}
path: build/libs/*.jar
if-no-files-found: error
retention-days: 14

View File

@@ -1,2 +0,0 @@
Manifest-Version: 1.0

View File

@@ -1,19 +0,0 @@
<?xml version="1.0" encoding="WINDOWS-1252" standalone="no"?>
<jardesc>
<jar path="C:/Users/Tom/Desktop/Minecraft/Server (Bukkit) - Copy/plugins/MobScores.jar"/>
<options buildIfNeeded="true" compress="true" descriptionLocation="/MobScores/MobScores.jardesc" exportErrors="true" exportWarnings="true" includeDirectoryEntries="false" overwrite="false" saveDescription="true" storeRefactorings="false" useSourceFolders="false"/>
<storedRefactorings deprecationInfo="true" structuralOnly="false"/>
<selectedProjects/>
<manifest generateManifest="false" manifestLocation="/MobScores/Manifest.MF" manifestVersion="1.0" reuseManifest="true" saveManifest="true" usesManifest="true">
<sealing sealJar="false">
<packagesToSeal/>
<packagesToUnSeal/>
</sealing>
</manifest>
<selectedElements exportClassFiles="true" exportJavaFiles="false" exportOutputFolder="false">
<file path="/MobScores/.classpath"/>
<javaElement handleIdentifier="=MobScores/\/ScoreKeeper\/bin"/>
<javaElement handleIdentifier="=MobScores/src"/>
<file path="/MobScores/.project"/>
</selectedElements>
</jardesc>

View File

@@ -1,23 +0,0 @@
{
"id": "mob-scores",
"title": "MobScores",
"description": "Legacy Bukkit plugin that awards configurable scores for killing mobs.",
"docId": "MobScores",
"image": {
"url": "Retro Minecraft Bukkit server plugin artwork showing a blocky player defeating a hostile zombie, floating score numbers, a simple scoreboard motif, pixel-art style, dark forest-green and charcoal palette, no words or logos.",
"alt": "Pixel-art scene of a Minecraft player defeating a zombie with score numbers floating nearby",
"prompt": "Retro Minecraft Bukkit server plugin artwork showing a blocky player defeating a hostile zombie, floating score numbers, a simple scoreboard motif, pixel-art style, dark forest-green and charcoal palette, no words or logos.",
"width": 0,
"height": 0,
"backgroundClassName": "bg-surface"
},
"url": "/projects/mob-scores",
"tags": ["open-source"],
"source": {
"type": "",
"url": ""
},
"feedback": {
"url": ""
}
}

View File

@@ -1,16 +0,0 @@
# MobScores
MobScores is a legacy Bukkit plugin that awards configurable scores to players for killing mobs. It works with the `ScoreKeeper` plugin, records the player who last damaged a mob, and awards the configured value when that mob dies.
## Details
- Platform: Bukkit/Minecraft server plugin
- Language: Java
- Dependency: ScoreKeeper
- Configuration: `plugins/MobScores/config.yml`
- Commands: None
- License: GNU Affero General Public License v3
## Image prompt
Retro Minecraft Bukkit server plugin artwork showing a blocky player defeating a hostile zombie, floating score numbers, a simple scoreboard motif, pixel-art style, dark forest-green and charcoal palette, no words or logos.

View File

@@ -1,18 +1,20 @@
# MobScores # MobScores
MobScores awards ScoreKeeper points for configured mob kills. It is a Paper plugin and requires the ScoreKeeper plugin to be installed and enabled first. [![Java CI with Gradle](https://github.com/headhunter45/MobScores/actions/workflows/gradle.yml/badge.svg)](https://github.com/headhunter45/MobScores/actions/workflows/gradle.yml)
MobScores awards ScoreKeeper points for configured mob kills. It is a Paper-only plugin for Paper 26.2 and 26.3, and requires the ScoreKeeper plugin to be installed and enabled first.
## Requirements ## Requirements
- Paper 1.21.7 or a compatible newer server. - Paper 26.2 or 26.3.
- Java 25 to build the plugin. - Java 25 to build the plugin.
- ScoreKeeper 0.2.2 or newer. - ScoreKeeper 0.2.2 or newer.
Install both plugin JARs in the server's `plugins` directory. MobScores declares ScoreKeeper as a hard dependency, so it will not enable without it. Install both plugin JARs in the server's `plugins` directory. MobScores declares ScoreKeeper as a hard dependency, so it will not enable without it. Bukkit and Spigot servers are not supported.
## Score Table ## Score Table
On first startup, MobScores creates `plugins/MobScores/config.yml` with default scores for supported entity types. Edit the `ScoreTable` mapping to change points; keys are Bukkit `EntityType` names and values are integer points: On first startup, MobScores creates `plugins/MobScores/config.yml` with default scores for supported entity types. Edit the `ScoreTable` mapping to change points; keys are Paper API `EntityType` names and values are integer points:
```yaml ```yaml
ScoreTable: ScoreTable:
@@ -21,7 +23,7 @@ ScoreTable:
SILVERFISH: 0 SILVERFISH: 0
``` ```
Restart the server after editing the configuration. A configured value of `0` suppresses that entity from the score table shown to players when they join. Restart the server after editing the configuration. A configured value of `0` suppresses that entity from the score table shown to players when they join. Entity type keys use the Paper API's `EntityType` names.
MobScores has no commands of its own. It records credit for configured entity types damaged directly by a player or by a projectile fired by a player. Other mob attribution is not currently handled. Points go into ScoreKeeper's dedicated `mob-scores` bucket and are tracked by player UUID. Use `/score-bucket mob-scores` before `/score-get` to view mob points; MobScores does not change the player's active bucket automatically. MobScores has no commands of its own. It records credit for configured entity types damaged directly by a player or by a projectile fired by a player. Other mob attribution is not currently handled. Points go into ScoreKeeper's dedicated `mob-scores` bucket and are tracked by player UUID. Use `/score-bucket mob-scores` before `/score-get` to view mob points; MobScores does not change the player's active bucket automatically.

View File

@@ -5,6 +5,7 @@
*/ */
plugins { plugins {
id 'com.diffplug.spotless' version '8.10.3'
id 'java-library' id 'java-library'
id 'maven-publish' id 'maven-publish'
id 'org.danilopianini.git-sensitive-semantic-versioning' version '7.0.24' id 'org.danilopianini.git-sensitive-semantic-versioning' version '7.0.24'
@@ -18,17 +19,31 @@ gitSemVer {
repositories { repositories {
mavenCentral() mavenCentral()
maven { url = 'https://repo.papermc.io/repository/maven-public/' } maven { url = 'https://repo.papermc.io/repository/maven-public/' }
// Modrinth Maven repository for ScoreKeeper
exclusiveContent {
forRepository {
maven {
name = 'Modrinth'
url = 'https://api.modrinth.com/maven'
}
}
filter {
includeGroup 'maven.modrinth'
}
}
mavenLocal() mavenLocal()
} }
dependencies { dependencies {
compileOnly 'com.majinnaibu.minecraft.plugins:ScoreKeeper:0.2.2' // Group is always 'maven.modrinth', module is your project slug/id
compileOnly 'io.papermc.paper:paper-api:1.21.7-R0.1-SNAPSHOT' compileOnly 'maven.modrinth:scorekeeper:0.2.2'
compileOnly 'io.papermc.paper:paper-api:26.2.build.129-stable'
testImplementation libs.junit.junit testImplementation libs.junit.junit
} }
group = 'com.majinnaibu.minecraft.plugins' group = 'com.majinnaibu.minecraft.plugins'
description = 'MobScores' description = 'MobScores'
@@ -77,3 +92,14 @@ processResources {
expand(version: pluginVersion) expand(version: pluginVersion)
} }
} }
spotless {
java {
googleJavaFormat('1.36.1')
importOrder 'java', 'javax', 'com', 'net', 'org', ''
licenseHeaderFile 'config/license-header.txt'
target 'src/**/*.java'
removeUnusedImports()
toggleOffOn()
}
}

View File

@@ -12,6 +12,6 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details. GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License You should have received a copy of the GNU Affero General Public License
along with MobScores. If not, see <http://www.gnu.org/licenses/>. along with Mob Scores. If not, see <https://www.gnu.org/licenses/agpl-3.0.txt>.
*/ */

41
docs/human-tests.md Normal file
View File

@@ -0,0 +1,41 @@
# MobScores Human Testing
Use this checklist on a disposable Paper 26.2 or 26.3 server with Java 25+, MobScores, and ScoreKeeper 0.2.2 or newer installed. MobScores depends on ScoreKeeper for its `mob-scores` bucket, and its main behavior is driven by real combat and player-join events.
## Test Setup
- Back up the world and both plugin data folders. Configure a test server with the same plugin versions intended for production.
- Use at least two ordinary player accounts and an operator for setup. Keep the server log visible to catch dependency, config, and offline-award warnings.
- Save the generated `plugins/MobScores/config.yml` before changing it. Restart after config edits; MobScores reads the score table during plugin startup.
- Record player UUIDs, mob types, configured values, active score buckets, and scores before and after each kill.
## Human Checklist
### Plugin loading and configuration
- Start with both plugins installed. Confirm ScoreKeeper loads before MobScores, MobScores enables, and the `mob-scores` bucket exists with the expected labels and initial value.
- On a disposable server, test startup without ScoreKeeper and with a ScoreKeeper version older than 0.2.2. Paper should reject the missing hard dependency; MobScores should disable itself with a version warning for an outdated dependency. Then restore the supported version.
- On first startup, inspect the generated `ScoreTable`. Confirm the documented default entity values are present, including a zero-valued entry.
- Change a few values, restart, and verify they are loaded and preserved. Include a zero value and an unknown entity key; confirm zero-valued entities are omitted from join messages and invalid entries are logged without preventing valid entries from loading.
- Confirm the table uses Paper `EntityType` names and that malformed values or a missing score-table section are handled as intended.
### Kill credit and scoring
- As a player, kill configured entities using direct melee damage and player-fired projectiles. Confirm the expected points are added to that player's `mob-scores` score.
- Check the boundary cases: a non-player attacker, environmental death, an entity type absent from the table, and a configured zero-point entity. Confirm no unintended points are awarded.
- Have two players damage the same mob before it dies. The current implementation records the most recent direct or player-projectile attacker; verify that this credit policy matches the server's expectations.
- Damage a mob with a player, then let it die from fall, fire, or another environmental cause. Confirm whether retaining that player's credit is the intended behavior; the current implementation keeps the last recorded player attribution until the mob dies.
- Test a player who disconnects after damaging the mob but before it dies. The current implementation cannot award an offline player and logs a warning; confirm this is acceptable and that no other player's score changes.
- Check mob death without any previous qualifying player damage, and verify no stale or reused entity attribution grants points.
### Player messaging and ScoreKeeper workflows
- Join with a player account. Confirm the MobScores score table is sent once, includes configured nonzero entity types with the right values, and excludes zero-valued types.
- Run `/score-bucket mob-scores` followed by `/score-get`. Confirm the score reflects kills and the bucket switch message uses the expected singular/plural label. Verify MobScores does not change the player's active bucket automatically on join or kill.
- Give two players different kill totals and switch between `mob-scores` and another ScoreKeeper bucket. Confirm each bucket retains its own value and MobScores awards only to `mob-scores`.
- Restart the server and verify MobScores retains its configured table and ScoreKeeper retains the players' mob scores. Reconnect and confirm the join table still matches the active config.
- Exercise normal gameplay around claimed mobs: unload/reload chunks, kill several entities rapidly, and test multiplayer combat. Watch for missed, duplicated, or cross-player awards.
## Automated Coverage
There are currently no Java test sources in MobScores and no `integrationTest` source set/task. Although Gradle declares JUnit, `./gradlew test` currently has no MobScores behavior tests. The testing tasks marked “Ready” in `TODO.md` have not been implemented. Build success alone does not verify real event attribution or compatibility with the installed ScoreKeeper jar.

View File

@@ -4,15 +4,17 @@ MobScores awards ScoreKeeper points for configured mob kills. Set a score for ea
## Requirements ## Requirements
- Paper 1.21.7 or a compatible newer server. - Paper 26.2 or 26.3.
- Java 25 or newer at runtime and for building. - Java 25 or newer at runtime and for building.
- ScoreKeeper 0.2.2 or newer. - ScoreKeeper 0.2.2 or newer.
Install ScoreKeeper and MobScores in the server's `plugins` directory. ScoreKeeper is a required dependency and must be enabled for MobScores to load. Install ScoreKeeper and MobScores in the server's `plugins` directory. ScoreKeeper is a required dependency and must be enabled for MobScores to load.
MobScores targets Paper only; Bukkit and Spigot servers are not supported.
## Configuration ## Configuration
MobScores creates `plugins/MobScores/config.yml` from its defaults. Edit `ScoreTable` to configure point values by Bukkit `EntityType` name: MobScores creates `plugins/MobScores/config.yml` from its defaults. Edit `ScoreTable` to configure point values by Paper API `EntityType` name:
```yaml ```yaml
ScoreTable: ScoreTable:

View File

@@ -0,0 +1,23 @@
{
"id": "mob-scores",
"title": "MobScores",
"description": "A Paper 26.2/26.3 integration plugin that attributes mob kills, including projectile kills, and awards configurable ScoreKeeper points by entity type.",
"docId": "MobScores",
"image": {
"url": "Retro Minecraft Paper server plugin artwork showing a blocky player defeating a hostile zombie, floating score numbers, a simple scoreboard motif, pixel-art style, dark forest-green and charcoal palette, no words or logos.",
"alt": "Pixel-art scene of a Minecraft player defeating a zombie with score numbers floating nearby",
"prompt": "Retro Minecraft Paper server plugin artwork showing a blocky player defeating a hostile zombie, floating score numbers, a simple scoreboard motif, pixel-art style, dark forest-green and charcoal palette, no words or logos.",
"width": 0,
"height": 0,
"backgroundClassName": "bg-surface"
},
"url": "/projects/mob-scores",
"tags": ["open-source"],
"source": {
"type": "",
"url": ""
},
"feedback": {
"url": ""
}
}

View File

@@ -0,0 +1,12 @@
# MobScores
MobScores turns combat into a configurable scoring system. When a player damages a tracked mob, the plugin remembers the attribution and awards the matching ScoreKeeper bucket when that mob dies, including projectile kills.
It is a deliberately small Paper integration plugin with a clear boundary: Paper entity events on one side, ScoreKeeper's public scoring API on the other. The per-entity score table is configurable, zero-value entries can be disabled, and players see the active mob-score table when they join. It targets Paper 26.2 and 26.3 only, not Bukkit or Spigot.
## Engineering Notes
- Built for modern Paper with Java 25 and Gradle.
- Uses UUID-safe player attribution.
- Depends on ScoreKeeper 0.2.2 or newer.
- Tested through the standard server-free build workflow.

View File

@@ -1,5 +1,5 @@
org.gradle.configuration-cache=true
org.gradle.daemon=true
org.gradle.java.installations.auto-download=true org.gradle.java.installations.auto-download=true
org.gradle.java.installations.auto-detect=false org.gradle.java.installations.auto-detect=false
org.gradle.java.installations.fromEnv=JAVA_HOME org.gradle.java.installations.fromEnv=JAVA_HOME
org.gradle.configuration-cache=true
org.gradle.daemon=true

View File

@@ -12,16 +12,21 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details. GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License You should have received a copy of the GNU Affero General Public License
along with MobScores. If not, see <http://www.gnu.org/licenses/>. along with Mob Scores. If not, see <https://www.gnu.org/licenses/agpl-3.0.txt>.
*/ */
package com.majinnaibu.minecraft.plugins.mobscores; package com.majinnaibu.minecraft.plugins.mobscores;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.Objects;
import java.util.UUID; import java.util.UUID;
import java.util.logging.Level; import java.util.logging.Level;
import com.majinnaibu.minecraft.plugins.mobscores.listeners.MobDeathListener;
import com.majinnaibu.minecraft.plugins.mobscores.listeners.PlayerConnectListener;
import com.majinnaibu.minecraft.plugins.scorekeeper.ScoreKeeperPlugin;
import net.kyori.adventure.text.Component; import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.format.NamedTextColor; import net.kyori.adventure.text.format.NamedTextColor;
@@ -31,10 +36,6 @@ import org.bukkit.entity.Player;
import org.bukkit.plugin.PluginManager; import org.bukkit.plugin.PluginManager;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
import com.majinnaibu.minecraft.plugins.mobscores.listeners.MobDeathListener;
import com.majinnaibu.minecraft.plugins.mobscores.listeners.PlayerConnectListener;
import com.majinnaibu.minecraft.plugins.scorekeeper.ScoreKeeperPlugin;
public class MobScoresPlugin extends JavaPlugin { public class MobScoresPlugin extends JavaPlugin {
private static final String SCORE_BUCKET_ID = "mob-scores"; private static final String SCORE_BUCKET_ID = "mob-scores";
private static final String MIN_SCORE_KEEPER_VERSION = "0.2.2"; private static final String MIN_SCORE_KEEPER_VERSION = "0.2.2";
@@ -44,7 +45,8 @@ public class MobScoresPlugin extends JavaPlugin {
private ScoreKeeperPlugin _scoreKeeper = null; private ScoreKeeperPlugin _scoreKeeper = null;
private final String _logPrefix = "[MobScores] "; private final String _logPrefix = "[MobScores] ";
private final Component _messagePrefix = Component.text("[") private final Component _messagePrefix =
Component.text("[")
.append(Component.text("MobScores").color(NamedTextColor.AQUA)) .append(Component.text("MobScores").color(NamedTextColor.AQUA))
.append(Component.text("] ").color(NamedTextColor.WHITE)); .append(Component.text("] ").color(NamedTextColor.WHITE));
@@ -61,7 +63,8 @@ public class MobScoresPlugin extends JavaPlugin {
// Load our score table from config or set defaults. // Load our score table from config or set defaults.
if (getConfig().isConfigurationSection("ScoreTable")) { if (getConfig().isConfigurationSection("ScoreTable")) {
_scoreTable = deserializeScoreTable(getConfig().getConfigurationSection("ScoreTable").getValues(false)); _scoreTable =
deserializeScoreTable(getConfig().getConfigurationSection("ScoreTable").getValues(false));
} else { } else {
_scoreTable = getDefaultScoreTable(); _scoreTable = getDefaultScoreTable();
getConfig().set("ScoreTable", serializeScoreTable(_scoreTable)); getConfig().set("ScoreTable", serializeScoreTable(_scoreTable));
@@ -96,7 +99,8 @@ public class MobScoresPlugin extends JavaPlugin {
pm.registerEvents(new MobDeathListener(this), this); pm.registerEvents(new MobDeathListener(this), this);
pm.registerEvents(new PlayerConnectListener(this), this); pm.registerEvents(new PlayerConnectListener(this), this);
logInfo(getPluginMeta().getName() + " version " + getPluginMeta().getVersion() + " is enabled!"); logInfo(
getPluginMeta().getName() + " version " + getPluginMeta().getVersion() + " is enabled!");
} }
private HashMap<EntityType, Integer> getDefaultScoreTable() { private HashMap<EntityType, Integer> getDefaultScoreTable() {
@@ -155,9 +159,11 @@ public class MobScoresPlugin extends JavaPlugin {
for (Map.Entry<EntityType, Integer> entry : _scoreTable.entrySet()) { for (Map.Entry<EntityType, Integer> entry : _scoreTable.entrySet()) {
if (entry.getValue() != 0) { if (entry.getValue() != 0) {
EntityType type = entry.getKey(); EntityType type = entry.getKey();
Component message = Component.translatable(type.translationKey()) Component message =
Component.translatable(Objects.requireNonNull(type.translationKey()))
.append(Component.text(" = ")) .append(Component.text(" = "))
.append(Component.text(String.valueOf(entry.getValue())) .append(
Component.text(Objects.requireNonNull(String.valueOf(entry.getValue())))
.color(NamedTextColor.GREEN)); .color(NamedTextColor.GREEN));
sendPlayerMessage(player, message); sendPlayerMessage(player, message);
} }
@@ -192,11 +198,11 @@ public class MobScoresPlugin extends JavaPlugin {
} }
public void sendPlayerMessage(Player player, Component message) { public void sendPlayerMessage(Player player, Component message) {
player.sendMessage(_messagePrefix.append(message)); player.sendMessage(_messagePrefix.append(Objects.requireNonNull(message)));
} }
public void sendPlayerMessage(Player player, String message) { public void sendPlayerMessage(Player player, String message) {
player.sendMessage(_messagePrefix.append(Component.text(message))); player.sendMessage(_messagePrefix.append(Component.text(Objects.requireNonNull(message))));
} }
public void logError(Exception ex) { public void logError(Exception ex) {

View File

@@ -12,22 +12,22 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details. GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License You should have received a copy of the GNU Affero General Public License
along with MobScores. If not, see <http://www.gnu.org/licenses/>. along with Mob Scores. If not, see <https://www.gnu.org/licenses/agpl-3.0.txt>.
*/ */
package com.majinnaibu.minecraft.plugins.mobscores.listeners; package com.majinnaibu.minecraft.plugins.mobscores.listeners;
import com.majinnaibu.minecraft.plugins.mobscores.MobScoresPlugin;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.entity.Projectile; import org.bukkit.entity.Projectile;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityDamageByEntityEvent; import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.event.entity.EntityDamageEvent; import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.entity.EntityDeathEvent; import org.bukkit.event.entity.EntityDeathEvent;
import org.bukkit.event.entity.EntityExplodeEvent; import org.bukkit.event.entity.EntityExplodeEvent;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import com.majinnaibu.minecraft.plugins.mobscores.MobScoresPlugin;
public class MobDeathListener implements Listener { public class MobDeathListener implements Listener {
private MobScoresPlugin _plugin = null; private MobScoresPlugin _plugin = null;
@@ -60,7 +60,5 @@ public class MobDeathListener implements Listener {
} }
@EventHandler @EventHandler
public void onEntityExplode(EntityExplodeEvent event) { public void onEntityExplode(EntityExplodeEvent event) {}
}
} }

View File

@@ -12,17 +12,17 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details. GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License You should have received a copy of the GNU Affero General Public License
along with MobScores. If not, see <http://www.gnu.org/licenses/>. along with Mob Scores. If not, see <https://www.gnu.org/licenses/agpl-3.0.txt>.
*/ */
package com.majinnaibu.minecraft.plugins.mobscores.listeners; package com.majinnaibu.minecraft.plugins.mobscores.listeners;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.Listener;
import org.bukkit.event.EventHandler;
import com.majinnaibu.minecraft.plugins.mobscores.MobScoresPlugin; import com.majinnaibu.minecraft.plugins.mobscores.MobScoresPlugin;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent;
public class PlayerConnectListener implements Listener { public class PlayerConnectListener implements Listener {
private MobScoresPlugin _plugin = null; private MobScoresPlugin _plugin = null;

View File

@@ -2,4 +2,4 @@ name: MobScores
main: com.majinnaibu.minecraft.plugins.mobscores.MobScoresPlugin main: com.majinnaibu.minecraft.plugins.mobscores.MobScoresPlugin
depend: [ScoreKeeper] depend: [ScoreKeeper]
version: ${version} version: ${version}
api-version: 1.21 api-version: '26.2'

View File

@@ -40,8 +40,24 @@ load_project_env
MODRINTH_TOKEN="${MODRINTH_TOKEN:-}" MODRINTH_TOKEN="${MODRINTH_TOKEN:-}"
MODRINTH_PROJECT_ID="${MODRINTH_PROJECT_ID:-mob-scores}" MODRINTH_PROJECT_ID="${MODRINTH_PROJECT_ID:-mob-scores}"
MODRINTH_CHANGELOG="${MODRINTH_CHANGELOG:-Auto release via publish-modrinth.sh}" generate_changelog() {
MODRINTH_GAME_VERSIONS="${MODRINTH_GAME_VERSIONS:-1.21,1.21.1,1.21.2,1.21.3,1.21.4,1.21.5,1.21.6,1.21.7}" local current_tag previous_tag range commits
current_tag=$(git -C "$PROJECT_ROOT" describe --tags --exact-match HEAD 2>/dev/null || true)
if [[ -n "$current_tag" ]]; then
previous_tag=$(git -C "$PROJECT_ROOT" describe --tags --abbrev=0 "${current_tag}^" 2>/dev/null || true)
range="${previous_tag:+$previous_tag..}$current_tag"
else
previous_tag=$(git -C "$PROJECT_ROOT" describe --tags --abbrev=0 2>/dev/null || true)
range="${previous_tag:+$previous_tag..}HEAD"
fi
commits=$(git -C "$PROJECT_ROOT" log --no-merges --format='- %s (%h)' "$range" 2>/dev/null || true)
if [[ -z "$commits" ]]; then
commits='- No commit messages found for this release.'
fi
printf '%s\n\n%s\n' "## What's Changed" "$commits"
}
MODRINTH_CHANGELOG="${MODRINTH_CHANGELOG:-$(generate_changelog)}"
MODRINTH_GAME_VERSIONS="${MODRINTH_GAME_VERSIONS:-26.2,26.3}"
MODRINTH_LOADERS="${MODRINTH_LOADERS:-paper}" MODRINTH_LOADERS="${MODRINTH_LOADERS:-paper}"
MODRINTH_VERSION_TYPE="${MODRINTH_VERSION_TYPE:-}" MODRINTH_VERSION_TYPE="${MODRINTH_VERSION_TYPE:-}"
MODRINTH_FILE="${MODRINTH_FILE:-}" MODRINTH_FILE="${MODRINTH_FILE:-}"