Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: Nevakanezah/HorseEnhancer
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v2.0.1
Choose a base ref
...
head repository: Nevakanezah/HorseEnhancer
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref

Commits on Nov 23, 2022

  1. Update README.md

    Until we fix the imports, this plugin is a chonky boi
    Nevakanezah authored Nov 23, 2022
    Copy the full SHA
    91615db View commit details
  2. Update README.md

    Nevakanezah authored Nov 23, 2022
    Copy the full SHA
    a24a251 View commit details
  3. Update README.md

    Nevakanezah authored Nov 23, 2022
    Copy the full SHA
    c235db2 View commit details

Commits on Nov 24, 2022

  1. Copy the full SHA
    3d378c6 View commit details
  2. Copy the full SHA
    917118c View commit details
  3. Copy the full SHA
    98f2d18 View commit details
  4. Refactor code

    Removed redundant function
    A-Flying-Poro committed Nov 24, 2022
    Copy the full SHA
    317076b View commit details
  5. Added documentation

    Added commands and permissions table
    A-Flying-Poro committed Nov 24, 2022
    Copy the full SHA
    5c8f41a View commit details

Commits on Jan 5, 2023

  1. Update dependency

    Kotlin - 1.7.20 > 1.7.22
    Flyway - 9.8.2 > 9.10.1
    SQLite - 3.39.4.1 > 3.40.0.0
    Kotlin-CSV - 1.6.0 > 1.7.0
    MCCoroutine - 2.6.0 > 2.9.0
    A-Flying-Poro committed Jan 5, 2023
    Copy the full SHA
    30d82fe View commit details
  2. Migrate chat system to Kyori Adventure

    Migrated BungeeCord chat to Kyori Adventure for compatibility with PaperMC
    A-Flying-Poro committed Jan 5, 2023
    Copy the full SHA
    bda82a0 View commit details
  3. Copy the full SHA
    ef3d7cf View commit details
  4. Copy the full SHA
    20e8542 View commit details

Commits on Jan 6, 2023

  1. Copy the full SHA
    7a2f994 View commit details
  2. Updated dependency resolver

    Moved to Bukkit library resolver:
    - Kotlin
    - Text library
    
    Removed from Bukkit library resolver:
    - Kotlin-CSV (method signatures mismatch)
    A-Flying-Poro committed Jan 6, 2023
    Copy the full SHA
    eb851b2 View commit details
  3. Version bump to v2.1.0

    A-Flying-Poro committed Jan 6, 2023
    Copy the full SHA
    3776252 View commit details
  4. Revert "Removed testing tools"

    This reverts commit 20e8542.
    A-Flying-Poro committed Jan 6, 2023
    Copy the full SHA
    6291296 View commit details
  5. Fix missing message for summon command

    Converts message component to builder, as trailing options not appended due to immutability
    
    Fixes #51
    A-Flying-Poro committed Jan 6, 2023
    Copy the full SHA
    524d0f9 View commit details
  6. Copy the full SHA
    48ab19c View commit details

Commits on Jan 7, 2023

  1. Added custom name to horse component

    Added custom name as prefix if it exists to the horse text component
    Suppressed deprecation for backwards compatibility with Spigot
    A-Flying-Poro committed Jan 7, 2023
    Copy the full SHA
    48896f1 View commit details
  2. Copy the full SHA
    edc1c20 View commit details

Commits on Jan 8, 2023

  1. Added unique handling for unique horses

    Added check for if a unique horse/mule has already spawned
    A-Flying-Poro committed Jan 8, 2023
    Copy the full SHA
    a648a7f View commit details

Commits on Jan 10, 2023

  1. Copy the full SHA
    56ef070 View commit details
  2. Update test cases

    A-Flying-Poro committed Jan 10, 2023
    Copy the full SHA
    44e9d67 View commit details
  3. Copy the full SHA
    706015e View commit details

Commits on Jan 11, 2023

  1. Copy the full SHA
    83d9bbb View commit details
  2. Copy the full SHA
    9810670 View commit details
  3. Copy the full SHA
    be9e026 View commit details
  4. Copy the full SHA
    5229461 View commit details
  5. Fix test case race condition

    Added delay between each test cases to hopefully fix race condition while clearing Horse table
    A-Flying-Poro committed Jan 11, 2023
    Copy the full SHA
    5ddce67 View commit details

Commits on Jan 14, 2023

  1. Copy the full SHA
    47fb4f0 View commit details

Commits on Jan 15, 2023

  1. Version bump

    A-Flying-Poro committed Jan 15, 2023
    Copy the full SHA
    65ec310 View commit details
  2. Fix race conditions in unit test

    Added delays after clearing database table to prevent race conditions
    A-Flying-Poro committed Jan 15, 2023
    Copy the full SHA
    a4dada3 View commit details

Commits on Jan 18, 2023

  1. Copy the full SHA
    ac07060 View commit details
  2. Copy the full SHA
    6ffb9d4 View commit details
  3. Potential fix for SQLite race condition

    Removed access to SQLite before each test case to hopefully prevent race condition
    A-Flying-Poro committed Jan 18, 2023
    Copy the full SHA
    ff873f4 View commit details
  4. Version bump

    A-Flying-Poro committed Jan 18, 2023
    Copy the full SHA
    5d105b6 View commit details
Showing with 1,857 additions and 529 deletions.
  1. +29 −0 .github/workflows/publish.yml
  2. +38 −0 .idea/runConfigurations/Build_JAR.xml
  3. +34 −5 README.md
  4. +42 −12 pom.xml
  5. +18 −3 src/main/java/com/nevakanezah/horseenhancer/HorseEnhancerMain.kt
  6. +35 −54 src/main/java/com/nevakanezah/horseenhancer/command/CommandHandler.kt
  7. +8 −7 src/main/java/com/nevakanezah/horseenhancer/command/subcommand/HelpSubcommand.kt
  8. +21 −15 src/main/java/com/nevakanezah/horseenhancer/command/subcommand/InspectSubcommand.kt
  9. +16 −17 src/main/java/com/nevakanezah/horseenhancer/command/subcommand/ListSubcommand.kt
  10. +8 −7 src/main/java/com/nevakanezah/horseenhancer/command/subcommand/ReloadSubcommand.kt
  11. +186 −173 src/main/java/com/nevakanezah/horseenhancer/command/subcommand/SummonSubcommand.kt
  12. +1 −1 src/main/java/com/nevakanezah/horseenhancer/command/subcommand/TeleportHereSubcommand.kt
  13. +37 −27 src/main/java/com/nevakanezah/horseenhancer/command/subcommand/TeleportSubcommand.kt
  14. +24 −18 src/main/java/com/nevakanezah/horseenhancer/command/subcommand/UpdateSubcommand.kt
  15. +1 −1 src/main/java/com/nevakanezah/horseenhancer/config/Config.kt
  16. +50 −34 src/main/java/com/nevakanezah/horseenhancer/listener/HorseEventListener.kt
  17. +2 −1 src/main/java/com/nevakanezah/horseenhancer/model/HorseGender.kt
  18. +79 −53 src/main/java/com/nevakanezah/horseenhancer/util/HorseUtil.kt
  19. +5 −2 src/main/java/com/nevakanezah/horseenhancer/util/SecretHorses.kt
  20. +23 −27 src/main/java/com/nevakanezah/horseenhancer/util/TextComponentUtils.kt
  21. +5 −4 src/main/resources/plugin.yml
  22. +129 −0 src/test/java/com/nevakanezah/horseenhancer/listener/HorseBreedingTest.kt
  23. +214 −0 src/test/java/com/nevakanezah/horseenhancer/listener/HorseInspectionTest.kt
  24. +415 −0 src/test/java/com/nevakanezah/horseenhancer/listener/UniqueHorseTest.kt
  25. +26 −0 ...st/java/com/nevakanezah/horseenhancer/test/mccoroutine/dispatcher/TestAsyncCoroutineDispatcher.kt
  26. +32 −0 ...ava/com/nevakanezah/horseenhancer/test/mccoroutine/dispatcher/TestMinecraftCoroutineDispatcher.kt
  27. +78 −0 src/test/java/com/nevakanezah/horseenhancer/test/mccoroutine/impl/TestCoroutineSessionImpl.kt
  28. +14 −0 ...test/java/com/nevakanezah/horseenhancer/test/mccoroutine/impl/TestMCCoroutineConfigurationImpl.kt
  29. +26 −0 src/test/java/com/nevakanezah/horseenhancer/test/mccoroutine/impl/TestMCCoroutineImpl.kt
  30. +261 −0 src/test/java/com/nevakanezah/horseenhancer/test/mccoroutine/service/TestEventServiceImpl.kt
  31. +0 −68 src/test/java/com/nevakanezah/horseenhancer/util/TextComponentUtilsTest.kt
29 changes: 29 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Publish JAR releases

on:
push:
tags:
- "v[0-9]+.[0-9]+.[0-9]+"

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Cache
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'
cache: 'maven'

- name: Build JAR
run: 'mvn -B clean package'

- name: Release
uses: softprops/action-gh-release@v1
with:
files: |
target/HorseEnhancer.jar
38 changes: 38 additions & 0 deletions .idea/runConfigurations/Build_JAR.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

39 changes: 34 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@
*All-natural horse enhancement, adding horse genders, lineage tracking, better breeding, and powerful commands!*

# What is HorseEnhancer?
Horse enhancer is a light Spigot/Bukkit plugin that modifies the behaviour of horses in Minecraft in order to enhance horse-related gameplay, and enable an equestrian economy.
Horse enhancer is a Spigot/Bukkit plugin that modifies the behaviour of horses in Minecraft in order to enhance horse-related gameplay, and enable an equestrian economy.
The plugin has been tested for Minecraft versions 1.12 - 1.14.
Improvements include:
* Horses now have genders, and require compatible mates to procreate.
@@ -15,22 +15,51 @@ Improvements include:
* Disables shooting your own mount in the back of the head.

# How to install
Download the latest HorseEnhancer jar file, and copy it into your `plugins` folder.
Download the [latest](https://github.com/Nevakanezah/HorseEnhancer/releases/latest) `HorseEnhancer.jar` file, and copy it into your server's `plugins` folder.

# Commands

| Command | Description | Permission |
|:-----------------------:|------------------------------------------------------|---------------------------------|
| `/he help` | Shows the list of subcommands and their description. | --- |
| `/he summon [gender]` | Summon horse with specified gender and attributes. | `horseenhancer.command.summon` |
| `/he update [horseID]` | Modify an existing horse's attributes. | `horseenhancer.command.update` |
| `/he inspect [horseID]` | Show inspection details for the specified horse. | `horseenhancer.command.inspect` |
| `/he list` | List all registered horse IDs. | `horseenhancer.command.list` |
| `/he reload` | Reload plugin configuration. | `horseenhancer.command.reload` |
| `/he tp` | Teleport yourself to the specified horse. | `horseenhancer.command.tp` |
| `/he tphere` | Teleport the specified horse to you. | `horseenhancer.command.tphere` |

# Permissions
The following table includes all the permissions used within the plugin:

| Permission | Description |
|:-------------------------------------:|---------------------------------------------------------------------------------------------------|
| `horseenhancer.command.summon` | Ability to use `summon` subcommand. |
| `horseenhancer.command.update` | Ability to use `update` subcommand. |
| `horseenhancer.command.inspect` | Ability to use `inspect` subcommand. |
| `horseenhancer.command.list` | Ability to use `list` subcommand. |
| `horseenhancer.command.reload` | Ability to use `reload` subcommand. |
| `horseenhancer.command.tp` | Ability to use `teleport` subcommand. |
| `horseenhancer.command.tphere` | Ability to use `teleporthere` subcommand. |
| `horseenhancer.inspection.wild` | Informs the player if the horse has a gender but is not tamed. |
| `horseenhancer.inspection.others` | Allows player to inspect horses that does not belong to them. |
| `horseenhancer.inspection.attributes` | Shows additional detailed stats for the horse during inspection. |
| `horseenhancer.testing.reset` | Used by admins, allows access to reset the horse's owner and tamed state to wild. |
| `horseenhancer.testing.taming` | Used by admins, allows access to make horses easier to tame by setting taming meter to `max - 1`. |

# Issues
For bug reports and feature suggestions, please [submit an issue via GitHub.](https://github.com/Nevakanezah/HorseEnhancer/issues)

# Future Releases
The following features are planned for addition in later updates to the plugin:
* Permissions support.
* Horse tamer can control who may ride their horse, or transfer ownership.
* Option to refund the breeding item when incompatible horses attempt to breed.
* Different horse breeds have different attribute trends.
* Support for additional Minecraft versions.

# Special Thanks
Special thanks to the following plugin authors, whose work was an invaluable resource:
* A Flying Poro, for offering both her StorableHashMap utility and her ever-friendly advice.
* A Flying Poro, for her extensive assistance.
* [AnomalyTea's Horse Inspector](https://github.com/AnomalyTea/Horse-Inspector) - From whom I drew much inspiration on how to design this plugin.
* [Soiyeruda's Better Horses](https://www.spigotmc.org/resources/better-horses.2477/) - Whose attribute determination formula I used in this plugin.
* The human-readable [ProQuints IDs](https://arxiv.org/html/0901.4016) project on Arxiv; whose work was adapted for use in generating horseIDs, and whose authors I've avoided naming for fear of impinging upon their software license.
54 changes: 42 additions & 12 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -7,12 +7,12 @@
<groupId>com.nevakanezah</groupId>
<artifactId>HorseEnhancer</artifactId>
<packaging>jar</packaging>
<version>2.0.1</version>
<version>2.1.3</version>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<kotlin.code.style>official</kotlin.code.style>
<kotlin.version>1.7.20</kotlin.version>
<kotlin.version>1.7.22</kotlin.version>

<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
@@ -27,6 +27,10 @@
<id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
<repository>
<id>papermc</id>
<url>https://repo.papermc.io/repository/maven-public/</url>
</repository>
</repositories>

<build>
@@ -129,15 +133,15 @@
<plugin>
<groupId>org.flywaydb</groupId>
<artifactId>flyway-maven-plugin</artifactId>
<version>9.8.2</version>
<version>9.10.1</version>
<configuration>
<url>jdbc:sqlite:database.sqlite3</url>
</configuration>
<dependencies>
<dependency>
<groupId>org.xerial</groupId>
<artifactId>sqlite-jdbc</artifactId>
<version>3.39.4.1</version>
<version>3.40.0.0</version>
</dependency>
</dependencies>
</plugin>
@@ -146,19 +150,32 @@

<dependencies>
<!-- Spigot -->
<dependency>
<!--<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.18.2-R0.1-SNAPSHOT</version>
<version>1.19.3-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>-->
<!-- PaperMC -->
<dependency>
<groupId>io.papermc.paper</groupId>
<artifactId>paper-api</artifactId>
<version>1.19.3-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<!-- Chat Text Component -->
<dependency>
<groupId>net.kyori</groupId>
<artifactId>adventure-platform-bukkit</artifactId>
<version>4.2.0</version>
<scope>provided</scope>
</dependency>

<!-- CSV Reader -->
<dependency>
<groupId>com.github.doyaaaaaken</groupId>
<artifactId>kotlin-csv-jvm</artifactId>
<version>1.6.0</version>
<scope>provided</scope>
<version>1.7.0</version>
</dependency>

<!-- YAML Parser / Writer -->
@@ -173,7 +190,7 @@
<dependency>
<groupId>org.xerial</groupId>
<artifactId>sqlite-jdbc</artifactId>
<version>3.39.4.1</version>
<version>3.40.0.0</version>
<scope>provided</scope>
</dependency>
<dependency>
@@ -195,7 +212,7 @@
<dependency>
<groupId>org.flywaydb</groupId>
<artifactId>flyway-core</artifactId>
<version>9.8.2</version>
<version>9.10.2</version>
<scope>provided</scope>
</dependency>

@@ -204,6 +221,7 @@
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib-jdk8</artifactId>
<version>${kotlin.version}</version>
<scope>provided</scope>
</dependency>

<!-- Coroutines -->
@@ -215,15 +233,27 @@
<dependency>
<groupId>com.github.shynixn.mccoroutine</groupId>
<artifactId>mccoroutine-bukkit-api</artifactId>
<version>2.6.0</version>
<version>2.9.0</version>
</dependency>
<dependency>
<groupId>com.github.shynixn.mccoroutine</groupId>
<artifactId>mccoroutine-bukkit-core</artifactId>
<version>2.6.0</version>
<version>2.9.0</version>
</dependency>

<!-- Testing frameworks -->
<dependency>
<groupId>com.github.shynixn.mccoroutine</groupId>
<artifactId>mccoroutine-bukkit-test</artifactId>
<version>2.9.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.github.seeseemelk</groupId>
<artifactId>MockBukkit-v1.19</artifactId>
<version>2.143.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-test-junit5</artifactId>
21 changes: 18 additions & 3 deletions src/main/java/com/nevakanezah/horseenhancer/HorseEnhancerMain.kt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@file:Suppress("removal")

package com.nevakanezah.horseenhancer

import com.github.shynixn.mccoroutine.bukkit.launch
@@ -8,15 +10,25 @@ import com.nevakanezah.horseenhancer.command.CommandHandler
import com.nevakanezah.horseenhancer.config.ConfigHandler
import com.nevakanezah.horseenhancer.database.SQLiteDatabase
import com.nevakanezah.horseenhancer.listener.HorseEventListener
import net.kyori.adventure.platform.bukkit.BukkitAudiences
import org.bukkit.plugin.PluginDescriptionFile
import org.bukkit.plugin.ServicePriority
import org.bukkit.plugin.java.JavaPlugin
import org.bukkit.plugin.java.JavaPluginLoader
import java.io.File

class HorseEnhancerMain : JavaPlugin() {
private lateinit var database: SQLiteDatabase
class HorseEnhancerMain : JavaPlugin {
internal lateinit var database: SQLiteDatabase
val configHandler: ConfigHandler = ConfigHandler(this)
internal val eventListener: HorseEventListener by lazy { HorseEventListener(this@HorseEnhancerMain) }
internal lateinit var audience: BukkitAudiences

constructor() : super()
constructor(loader: JavaPluginLoader, description: PluginDescriptionFile, dataFolder: File, file: File) : super(loader, description, dataFolder, file)

override fun onEnable() {
audience = BukkitAudiences.create(this)

val databaseFile = File(this.dataFolder, "database.sqlite3")
databaseFile.parentFile.mkdirs()
database = SQLiteDatabase(databaseFile, this).apply {
@@ -35,13 +47,16 @@ class HorseEnhancerMain : JavaPlugin() {
}

server.pluginManager.apply {
registerSuspendingEvents(HorseEventListener(this@HorseEnhancerMain), this@HorseEnhancerMain)
registerSuspendingEvents(eventListener, this@HorseEnhancerMain)
}
}

override fun onDisable() {
if (this::database.isInitialized) {
database.close()
}
if (this::audience.isInitialized) {
audience.close()
}
}
}
Loading