Skip to content

Commit

Permalink
GH-87 Finish sending logic (#91)
Browse files Browse the repository at this point in the history
* Add ItemStorage logic

* Change default database type to SQLITE

* GH-89 Update lite commands version and all commands

* Update lite commands version and all commands. Fix issues

* Update src/main/java/com/eternalcode/parcellockers/parcel/command/ParcelCommand.java

---------

Co-authored-by: Jakubk15 <[email protected]>

* Update item handling in Parcel GUI and make other code improvements. Add Optional GSON serializer.

* Update item handling in Parcel GUI and make other code improvements. Add Optional GSON serializer.

* Bump litecommands

* Bump litecommands

* Add configurable options for selected size packages in SendingGUI.

* Add ItemStorage logic

* Simplify available commands, in future LC update add optional aliases highlighted in the commands

* (WIP) Add InventoryUtil and GsonItemSerializer

* Try Base64 ItemStack serialization (WIP)

* Fix JSON serialization

* Remove parseStringList method

* Fix serialization (WIP)

* Add illegal items (Closes #70)

* Update README.md

* Add priority item selector, beautify the selected items lore

* Remove cancel button, optimize database methods, and many more...

* Fix build

* Fix ParcelListGUI and refactor code

* Fix parcel item storage GUI size

* Code-only changes

* Code-only changes, register LockerArgument

* Add parcel submit button, fix UUID filtering

* Refactor GUI packages

* Remove unused arguments. Add User domain. Use interface where possible. Add spotify completable-futures. Fix NPE issue in placeholders formatter method.

* Remove unnecessary TODO tasks. Start beautifying the PluginConfiguration

* Initialize UserRepository table, add fancy symbols to PluginConfiguration messages.

* Fix typo in PluginConfiguration

* Rearrange and cleanup code in PluginConfiguration

* Start working on introducing user-parcel tables

* Make UserRepositoryImpl less cache-dependent, fix placeholder replacement

* Huge README.md revamp

* Bump gradle and certain dependencies

* Update gradle.yml

* Minor README touchups

* Update CODEOWNERS

* Java 21 and MC 1.21 support, add ParcelContent object and its subclasses. Add update() methods

* Prepare for Java 21, update config. Refactor code, update GUIs. Adjust SQL syntax.

* Add more GUIs

* Receiver selection logic (WIP), fix SignAPI shading. Add more utility methods to the Position class. Improve UserRepository

* Rename config entry, use method references

* Refactor exception handling, better gui refreshing (WIP). Fix SkullAPI skull fetching

Shoutout to @Rollczi for the immense help! 🎉

Co-Authored-By: Norbert Dejlich <[email protected]>

* Use type parameter in GuiRefresher. Change field name, create toItem() method in ParcelSendingGUI

* Move duplicate methods to ItemUtil class.

* Fix ConcurrentModificationException

* Revert GuiRefresher to previous state and rename it to PaginatedGuiRefresher

* Add "this" keywords

* Reformat code

* Adjust codestyle

* Use ExceptionHandler class, replace whenComplete with thenAccept

* Fix receiver GUI selector.

* MC 1.21 in runPaper, fix lore override bug, fix ArrayIndexOutOfBoundsException, send message to player when receiver is set.

* Use ParcelSendingGUIState to store parcel properties such as name, description, receiver

* Move close gui action to bottom

* WIP: Destination locker selection GUI

* Make ConfigItem Cloneable, fix GUI stuff

* Use states instead of fields where possible.

* Code cleanup

* Fix build

* Fix build

* Update README.md

* Update README.md

* Update README.md

* Update src/main/java/com/eternalcode/parcellockers/gui/implementation/locker/ParcelSendingGUIState.java

* Update src/main/java/com/eternalcode/parcellockers/gui/implementation/locker/ReceiverSelectionGui.java

* Update build.gradle.kts

* Apply review suggestions

* Cleanup DestinationSelectionGUI#toItem

* Don't mutate lore in config item.

* Cleanup lore

* Use #clone on ConfigItems and add config message to illegal items

---------

Co-authored-by: Rollczi <[email protected]>
Co-authored-by: Michał Wojtas <[email protected]>
Co-authored-by: CitralFlo <[email protected]>
  • Loading branch information
4 people authored Sep 21, 2024
1 parent 020f064 commit cd2b601
Show file tree
Hide file tree
Showing 77 changed files with 3,010 additions and 1,327 deletions.
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1 +1 @@
* @EternalCodeTeam/eternalcodeteam-maintainers @Jakubk15
* @EternalCodeTeam/team @Jakubk15
106 changes: 61 additions & 45 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,84 +1,89 @@
# ParcelLockers

### ParcelLockers is a user plugin, dedicated for Spigot-based servers.

<div align="center">

![ParcelLockers.svg](assets/ParcelLockers.svg)

[![Supports Paper](https://raw.githubusercontent.com/intergrav/devins-badges/v3/assets/cozy/supported/paper_vector.svg)](https://papermc.io)
[![Supports Spigot](https://raw.githubusercontent.com/intergrav/devins-badges/v3/assets/cozy/supported/spigot_vector.svg)](https://spigotmc.org)

[![Patreon](https://raw.githubusercontent.com/intergrav/devins-badges/v3/assets/cozy/donate/patreon-plural_vector.svg)](https://www.patreon.com/eternalcode)
[![Website](https://raw.githubusercontent.com/intergrav/devins-badges/v3/assets/cozy/documentation/website_vector.svg)](https://eternalcode.pl/)
[![Discord](https://raw.githubusercontent.com/intergrav/devins-badges/v3/assets/cozy/social/discord-plural_vector.svg)](https://discord.gg/FQ7jmGBd6c)
[![Chat on Discord](https://raw.githubusercontent.com/vLuckyyy/badges/main//chat-with-us-on-discord.svg)](https://discord.com/invite/FQ7jmGBd6c)

[![Gradle](https://raw.githubusercontent.com/intergrav/devins-badges/v3/assets/cozy/built-with/gradle_vector.svg)](https://gradle.org/)
[![Java](https://raw.githubusercontent.com/intergrav/devins-badges/v3/assets/cozy/built-with/java17_vector.svg)](https://www.java.com/)

</div>

# Warning ❗
# Welcome to ParcelLockers! 🚀

ParcelLockers is a minecraft plugin, dedicated for Spigot-based servers.. 💎 Crafted with care, ParcelLockers
is dedicated to incorporating highly practical server function of transfering items across the Minecraft world,
especially on long distances.

## ℹ️ Information

- ParcelLockers fully supports Minecraft's latest minor versions starting from each major version, starting from 1.17
onward, e.g. `1.17.1`, `1.18.2`, `1.19.4`, `1.20.6`, `1.21.1`.
- Requires **Java 17 or later** to work properly. For older versions of Java, this may affect the functionality of the
plugin.
- If you have any questions, you can ask us about it on our [Discord server](https://discord.gg/FQ7jmGBd6c).

## ❗Warning

ParcelLockers is at an very early stage of development, and you use it at your own risk.

# Building
## 🏗️ Compiling JAR from Source

To build ParcelLockers, follow these steps (Make sure you have **JDK 21 or higher**):

To build ParcelLockers execute this command using Gradle (Make sure you are using JDK 8 for maximum compatibility)
```shell
./gradlew clean shadowJar
```

`./gradlew clean shadowJar`
- The output file will be located at `build/libs`.
- When you build the plugin for the first time, it might take a while to download all the dependencies.

When you build it for the first time, it may take a little longer.
## 🛠️ Development builds

# Development builds
🤫 Want to be a few steps ahead of others? You can gather our freshly squeezed builds from GitHub
Actions [here](https://github.com/EternalCodeTeam/ParcelLockers/actions).

You can gather the development builds from [GitHub Actions](https://github.com/EternalCodeTeam/ParcelLockers/actions)
## :octocat: Contributing

# Contributing
🧩 Are you a developer and want to add something?

Create a [public fork of the repository](https://github.com/EternalCodeTeam/ParcelLockers/fork), modify it with
appropriate
changes and then create a Pull Request.
See [CONTRIBUTING.md](https://github.com/EternalCodeTeam/ParcelLockers/blob/master/.github/CONTRIBUTING.md) to find out
more.

## TODO
- [ ] Add support for more databases (H2, PostgreSQL, MongoDB?)
- [ ] Add translation system, more languages
- [ ] Add delivery codes, so any person knowing the code can pick up the parcel
- [ ] Add delivery time, so the parcel can be picked up only in a specific time
- [ ] Parcel permissions for user
- [ ] Parcel return logic
- [ ] Banned parcel items (configurable)
- [ ] Parcel fee
- [ ] Rewrite database to ORMLite (far in future)
- [x] Add "business" logic
- [ ] Add more parcel types (fragile, etc...)
- [ ] Add option to config for parcel locker space (e.g. max parcels within a locker)
- [x] Rewrite Position class to use Integers instead of Doubles
- [ ] Finish GUIs
- [ ] Add more GUIs (admin GUI, parcel create GUI, etc.)
- [ ] Add Discord integration (bot, webhooks, etc...)
- [ ] Add more commands
- [x] Isolate cache into separate classes
- [x] Extract database service methods into repositories (interfaces)
- [x] Delete cyclic dependency (Parcel <-> ParcelLocker), switch to UUID instead of object references

# License

#### ParcelLockers is published under the GNU GPL-v3 license. In particular, the developer:
## 🐛 Issues

Found a bug? Report it [here](https://github.com/EternalCodeTeam/ParcelLockers/issues). If you are not sure if that's an
intended behavior or not, feel free to ask on our [Discord](https://discord.com/invite/FQ7jmGBd6c) 😅

Additionally, if you enable automatic Sentry bug
reporting in your config.yml file (we strongly advise to do so), errors will be automatically sent to us, which will
greatly accelerate the bug fixing process 🥳

## 📜 License

### ParcelLockers is published under the GNU GPL-v3 license. In particular, the developer:

- Is freely allowed to modify and improve the code
- Can distribute production versions
- He must publish any changes made, ie. the public fork of this repository
- Cannot change the license or copyright

#### Additionally:
### Additionally:

- It is forbidden to modify or remove the code responsible for the compliance of production versions with the license.
- The authors of this project are not responsible for using the application, modifying and distributing it.
- Trademarks appearing in this project and this document belong to their rightful owners and are used for informational
purposes only.

# Other dependencies usages
## ❤️ Other dependencies usages

- [LiteCommands (by Rollczi ❤️)](https://github.com/Rollczi/LiteCommands)
- [Adventure API & MiniMessage](https://docs.adventure.kyori.net/)
Expand All @@ -88,13 +93,24 @@ more.
- [Spigot API](https://www.spigotmc.org/wiki/spigot-maven/#build-gradle)
- [expressible](https://github.com/dzikoysk/expressible)
- [panda-utilities](https://github.com/panda-lang/panda)
- [Errorprone](https://github.com/google/error-prone)
- [TriumphGUI](https://github.com/TriumphTeam/triumph-gui)
- [bStats](https://bstats.org/)
- [jackson-bukkit](https://github.com/eldoriarpg/jackson-bukkit)
- [SignGUI](https://github.com/Rapha149/SignGUI)

## :heart: Special Thanks

[<img src="https://user-images.githubusercontent.com/65517973/210912946-447a6b9a-2685-4796-9482-a44bffc727ce.png" alt="JetBrains" width="150">](https://www.jetbrains.com)
![sentry.svg](assets/sentry.svg)

We express our gratitude to JetBrains for providing [Open Source Licenses](https://www.jetbrains.com/opensource/) for
their outstanding tools. We recommend using [IntelliJ IDEA](https://www.jetbrains.com/idea/) to work with our projects
and boost your productivity!

ParcelLockers is a advanced user delivery plugin, dedicated for Spigot-based servers.
We also thank [Sentry](https://sentry.io) for providing us with
a [Open-Source Sponsorship plan](https://sentry.io/for/open-source/) for error tracking. We recommend using
[Sentry](https://sentry.io) to track
errors in
your projects and improve the quality of your software.

🚫 Found an issue? Report it [here](https://github.com/EternalCodeTeam/ParcelLockers/issues).

🧩 Are you a developer and want to add something? Feel free
to [create a pull request](https://github.com/EternalCodeTeam/ParcelLockers/pulls).
17 changes: 17 additions & 0 deletions TODO.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
## 📝 TODO

- [ ] Add support for more databases (H2, PostgreSQL, MongoDB?)
- [ ] Add translation system, more languages
- [ ] Add delivery codes, so any person knowing the code can pick up the parcel
- [ ] Add delivery time, so the parcel can be picked up only in a specific time
- [ ] Parcel permissions for user
- [ ] Parcel return logic
- [x] Banned parcel items (configurable)
- [ ] Parcel fee
- [ ] Rewrite database to ORMLite (far in future)
- [ ] Add more parcel types (fragile, etc...)
- [ ] Add option to config for parcel locker space (e.g. max parcels within a locker)
- [ ] Finish GUIs
- [ ] Add more GUIs (admin GUI, parcel create GUI, etc.)
- [ ] Add Discord integration (bot, webhooks, etc...)
- [ ] Add more commands
44 changes: 44 additions & 0 deletions assets/ParcelLockers.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions assets/sentry.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
35 changes: 25 additions & 10 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ plugins {
checkstyle
id("net.minecrell.plugin-yml.bukkit") version "0.6.0"
id("xyz.jpenilla.run-paper") version "2.3.1"
id("com.github.johnrengelman.shadow") version "8.1.1"
id("com.gradleup.shadow") version "8.3.0"
}

group = "com.eternalcode"
Expand All @@ -22,14 +22,16 @@ repositories {
maven { url = uri("https://papermc.io/repo/repository/maven-public/") }
maven { url = uri("https://repo.eternalcode.pl/releases") }
maven { url = uri("https://repository.minecodes.pl/releases") }
maven { url = uri("https://jitpack.io") }
}

dependencies {
// minecraft development api
compileOnly("org.spigotmc:spigot-api:1.20.5-R0.1-SNAPSHOT")
compileOnly("org.spigotmc:spigot-api:1.21-R0.1-SNAPSHOT")
implementation("net.kyori:adventure-platform-bukkit:4.3.4")
implementation("net.kyori:adventure-text-minimessage:4.17.0")
implementation("dev.rollczi.litecommands:bukkit-adventure:2.8.9")
implementation("dev.rollczi:litecommands-bukkit:3.1.0")
implementation("dev.rollczi:litecommands-adventure:3.1.0")

// skull api
implementation("dev.rollczi:liteskullapi:1.3.0")
Expand Down Expand Up @@ -66,9 +68,18 @@ dependencies {
// paperlib
implementation("io.papermc:paperlib:1.0.8")

// signgui
implementation("de.rapha149.signgui:signgui:2.4.1")

// panda-utilities
implementation("org.panda-lang:panda-utilities:0.5.2-alpha")

// jackson-bukkit
implementation("de.eldoria.jacksonbukkit:paper:1.2.0")

// completable-futures
implementation("com.spotify:completable-futures:0.3.6")

testImplementation("org.junit.jupiter:junit-jupiter-api:5.11.0")
testImplementation("org.junit.jupiter:junit-jupiter-params:5.11.0")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.11.0")
Expand All @@ -79,7 +90,7 @@ dependencies {
}

java {
toolchain.languageVersion.set(JavaLanguageVersion.of(17))
toolchain.languageVersion.set(JavaLanguageVersion.of(21))
}

checkstyle {
Expand All @@ -95,31 +106,32 @@ bukkit {
main = "com.eternalcode.parcellockers.ParcelLockers"
apiVersion = "1.13"
prefix = "ParcelLockers"
author = "Jakubk15"
author = "EternalCodeTeam"
name = "ParcelLockers"
description =
"Plugin that provides functionality of parcel lockers in Minecraft, allowing players to send and receive parcels safely."
website = "https://github.com/EternalCodeTeam/ParcelLockers"
version = "1.0.0-SNAPSHOT"
depend = listOf("Vault")
}

tasks.withType<JavaCompile> {
options.encoding = "UTF-8"
options.setIncremental(true)
options.compilerArgs.add("-parameters")
options.release = 17
}

tasks {
runServer {
minecraftVersion("1.20.2")
minecraftVersion("1.21.1")
}

test {
useJUnitPlatform()
}

shadowJar {
archiveFileName.set("ParcelLockers v${project.version} (MC 1.8.8-1.20.x).jar")
archiveFileName.set("ParcelLockers v${project.version} (MC 1.8.8-1.21.x).jar")

exclude(
"org/intellij/lang/annotations/**",
Expand All @@ -129,7 +141,9 @@ tasks {
)

mergeServiceFiles()
minimize()
minimize {
exclude(dependency("de\\.rapha149\\.signgui:signgui:.*")) // https://github.com/Rapha149/SignGUI/issues/15
}

val prefix = "com.eternalcode.parcellockers.libs"
listOf(
Expand All @@ -141,7 +155,8 @@ tasks {
"dev.rollczi",
"net.kyori",
"org.json",
"com.fasterxml"
"com.fasterxml",
"de.rapha149"
).forEach { relocate(it, prefix) }
}
}
Loading

0 comments on commit cd2b601

Please sign in to comment.