Giter Club home page Giter Club logo

box's Introduction

Box

GitHub release (latest SemVer) GitHub Workflow Status GitHub

A Paper plugin to provide virtual containers that can store 2.1 billion items per item.

Requirements

  • Java 21+
  • Paper 1.20.5+

Installation

Please read Installation and Setup page on GitHub Wiki.

Compiling from source

git clone https://github.com/okocraft/Box.git
cd Box/
./gradlew build

You can find the bundled jar in the bundle/build/libs directory.

API

Javadocs

Usage

1. Add a repository

<repository>
    <id>okocraft-box-repo</id>
    <url>https://okocraft.github.io/Box/maven/</url>
</repository>
repositories {
    maven {
        url 'https://okocraft.github.io/Box/maven/'
    }
}
repositories {
    maven {
        url = uri("https://okocraft.github.io/Box/maven/")
    }
}

For snapshot version, use https://okocraft.github.io/Box/maven-snapshot/

2. Add to dependencies

<dependency>
    <groupId>net.okocraft.box</groupId>
    <artifactId>box-api</artifactId>
    <version>5.3.1</version>
    <scope>provided</scope>
</dependency>
dependencies {
    compileOnly 'net.okocraft.box:box-api:5.3.1'
}
dependencies {
    compileOnly("net.okocraft.box:box-api:5.3.1")
}

License

This project is under the GPL-3.0 license. Please see LICENSE for more info.

Copyright © 2019-2024, OKOCRAFT

box's People

Contributors

akaregi avatar dependabot[bot] avatar lazygon avatar renovate[bot] avatar siroshun09 avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Forkers

akaregi jukey17

box's Issues

任意のアイテムを box stick にできるようにする

Box Stick の判定は特定のキーがアイテムに含まれているかで行っているため
任意のアイテムにそのキーをセットすればそれを Box Stick と同等の機能をもたせることができる。

コマンド予定: /boxadmin customstick

v3.x.x ブランチの改名

v4.0.0 リリース後に実行

develop/master -> master にマージ
master -> v3/master

デフォルトブランチを v4/master にする

/box give GUI 化

レイアウト予定:

image

青/赤ガラス: 贈るアイテム量 増減
白ガラス: 増減単位変更
オーク扉隣の頭: 選択済み贈り先プレイヤー
土: 送るアイテム表示 & 確定ボタン

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Ignored or Blocked

These are blocked by an existing closed PR and will not be recreated unless you click a checkbox below.

Detected dependencies

github-actions
.github/workflows/deployment.yml
  • actions/checkout v4.1.7@692973e3d937129bcbf40652eb9f2f61becf3332
  • actions/setup-java v4.2.1@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9
  • gradle/actions v3.4.2@dbbdc275be76ac10734476cc723d82dfe7ec6eda
  • peaceiris/actions-gh-pages v4.0.0@4f9cc6602d3f66b9c108549d475ec49e8ef4d45e
.github/workflows/gradle.yml
  • okocraft/workflows v1
gradle
gradle.properties
settings.gradle.kts
build.gradle.kts
annotation-processor/build.gradle.kts
api/build.gradle.kts
build-logic/settings.gradle.kts
build-logic/build.gradle.kts
build-logic/src/main/kotlin/box.aggregate-javadocs.gradle.kts
build-logic/src/main/kotlin/box.common-conventions.gradle.kts
build-logic/src/main/kotlin/box.dependencies.gradle.kts
build-logic/src/main/kotlin/box.properties.gradle.kts
build-logic/src/main/kotlin/box.publication.gradle.kts
bundle/build.gradle.kts
core/build.gradle.kts
data-generator/build.gradle.kts
features/autostore/build.gradle.kts
features/bemode/build.gradle.kts
features/category/build.gradle.kts
features/command/build.gradle.kts
features/craft/build.gradle.kts
features/gui/build.gradle.kts
features/notifier/build.gradle.kts
features/stick/build.gradle.kts
gradle/libs.versions.toml
  • net.kyori:adventure-api 4.17.0
  • org.jetbrains:annotations 24.1.0
  • com.github.siroshun09.configapi:configapi-core 5.0.0-beta.2
  • com.github.siroshun09.configapi:configapi-format-yaml 5.0.0-beta.2
  • com.github.siroshun09.event4j:event4j 4.0.0-rc.1
  • it.unimi.dsi:fastutil 8.5.13
  • com.zaxxer:HikariCP 5.1.0
  • com.github.siroshun09.messages:messages-minimessage 0.8.0
  • org.yaml:snakeyaml 2.2
  • org.junit:junit-bom 5.10.3
  • org.junit.jupiter:junit-jupiter 5.10.3
  • com.github.siroshun09.configapi:configapi-test-shared-classes 5.0.0-beta.2
  • org.mockito:mockito-core 5.12.0
  • org.slf4j:slf4j-simple 2.0.13
  • org.xerial:sqlite-jdbc 3.46.0.0
  • io.papermc.paper:paper-api 1.20.6-R0.1-SNAPSHOT
  • net.coreprotect:coreprotect 22.4
  • com.griefcraft:lwc 2.4.0
  • org.popcraft:bolt-bukkit 1.1.17
  • org.popcraft:bolt-common 1.1.17
  • xyz.jpenilla.run-paper 2.3.0
  • io.github.goooler.shadow 8.1.8
storage/api/build.gradle.kts
storage/database/build.gradle.kts
storage/yaml/build.gradle.kts
test-shared-classes/build.gradle.kts
versions/common/build.gradle.kts
versions/paper-1_20_5/build.gradle.kts
gradle-wrapper
gradle/wrapper/gradle-wrapper.properties
  • gradle 8.8

  • Check this box to trigger a request for Renovate to run again on this repository

Version 5.5.0

New Feature

Support for Minecraft 1.20.2

Box works fine in Minecraft 1.20.2.

Click the item in the inventory to open its category menu

When the Box menu is open, clicking on an item in the player's inventory now opens the category menu to which that item belongs.

Add --page (-pa) argument for /box gui

For example, run /box gui --category stones --page 2 to open the stone category on page 2.

Accordingly, clickable category buttons in /box iteminfo will now take you to the page with the item.

API Changes

#257 (comment)

Notice of Box v6

We are planning to further improve performance/stability and to change the internal structure for it. The release date is not yet scheduled, but it will come in the not-distant future.

Background and For Developers

It has already been two years since our last major overhaul (Version 4.0.0). During these two years, Box has been running on our servers without any problems and still stores hundreds of millions of items.

Plugin development is entering a new era. First, the latest LTS version, Java 21, was recently released, adding several new features since Java 17 that are worth applying to Box. Second, PaperMC announced Folia, a multi-threaded server software in March. Box is experimentally supporting Folia, but there is still room for improvement. Finally, there are major changes planned for the widely used Bukkit API. This will provide backward compatibility, but in the medium to long term, Box will also be forced to make changes.

In addition to these environmental factors, my knowledge has grown over the past two years. The current Box implementation has good enough performance and stability, but we can improve them further. There are also a few headaches caused by the two-year-old design. These may not need to be resolved now, but will weigh heavily as technical debt as time goes on.

For these reasons, several branches are undergoing modifications for Box v6. It will include some breaking API changes. Developers of projects that depend on the Box API should check the API change notices in Box v5.5.x. In Box v5.5.x, APIs that will be changed or removed in v6 are marked with annotations such as @Deprecated, and some alternate APIs are also provided. This helps distribute the breaking changes made from v5 to v6 as much as possible.

Full Changelog: 5.4.2...main

Class GenerateItemConfig yields ClassCastException

Log:

[20:45:58 ERROR]: Could not pass event PlayerInteractEvent to Box v1.1.0-SNAPSHOT
java.lang.ClassCastException: org.bukkit.configuration.MemorySection cannot be cast to org.bukkit.configuration.Configuration
        at net.okocraft.box.listeners.GenerateItemConfig.onChestClick(GenerateItemConfig.java:109) ~[?:?]

messages.yml に存在しない・ハードコーディングのみのメッセージをどうにかする

TBA:

DatabaseConnectionReset

sender.sendMessage("§eデータベースへの接続をリセットしました。");

MapPlayersRecord

sender.sendMessage("記録されているプレイヤー");

MapColumnsList

sender.sendMessage("列リスト");

MapFormat

sender.sendMessage(String.format("%s - %s", columnName, columnType))

VersionInfo

sender.sendMessage(Box.getInstance().getVersion())

errorFetchCategoryName

System.out.println("カテゴリ名の取得に失敗しました。");

errorFetchItemConfig

System.out.println("アイテム設定の取得に失敗しました。");

errorFetchDisplayName

val categoryItemName          = Optional.ofNullable(section.getString("display_name"))
            .orElse("No display_name defined.")

Version 5.4.0

New Features

Add Support for Minecraft 1.20

Minecraft 1.20 has been released, and Box is now compatible Paper 1.20!

Note: Folia support is temporally dropped in this version. After Folia 1.20 released, we will added back support.

Improvements

Add item's categories for /box iteminfo

Category names are clickable. When clicked, it opens the category menu directly (Minecraft: Java Edition only).

image

Add arguments for /box gui

  • /box gui - Opens the Box menu
  • /box gui <player name> -> /box gui --player <player name> - Opens the Box menu with the specified player's stockholder
  • /box gui --category <category id> - Opens the specified category menu

Note: /box gui <player name> can still be used, but will be removed in the future.

Improve the default order of woods

image

Changes

Remove Categorizer

Categorizer is a system for automatically categorizing new items into the appropriate category. This system was implemented based on the name of the item and the item-tags. However, considering the planned changes to the Spigot/Paper API, we deemed difficult to maintain this system.

Instead, the default categories.yml is used to automatically categorize them into the category defined by default. While the Box is being maintained, new items are categorized in the same way as in the previous system. Items not defined in default categories.yml are categorized into the uncategorized category.

Note that if you do not manage categories yourself, it is recommended to delete plugins/Box/categories.yml and regenerate it after update (the order of items is not taken into account, both in the previous categoriser and after this change, which is ugly).

Fixes

  • Increase stock of ingredient's "crafting remaining item"

New API

PlayerCollectItemInfoEvent

This event called when the player collects item information after typing /box iteminfo.

Category#containsItem

Checks if the BoxItem is contained in the category.

API Changes

  • Add MCDataVersion#MC_1_20 and MCDataVersion#MC_1_20_1
  • Remove deprecated constructors of stock
  • Allow null for the permission node of TabCompleter#players
  • Add Javadoc for models of the craft feature

Release Version 6.0.0

New Features

Minecraft 1.20.5 Support

At the same time, Minecraft 1.20.4 or older support has been removed.

Add a new button to the craft menu for changing the order of ingredient

Demo Video

Deposit items from the player's inventory

In the Box menu, you can deposit items from your inventory by pressing shift + LMB to the item.

Demo Video

Changes

Box requires Java 21

The minimum Java version is updated to Java 21.

Restructured config.yml

Some settings are moved under the core section. The storage section is the same as v5.

#
# The core settings of Box.
#
core:
  # Settings related to player stock data.
  stock-data:
    # Number of seconds to unload the player's stock data after logging out.
    unload-time: 300
    # Interval in seconds to save player stock data.
    save-interval: 15
  # The list of worlds where Box cannot be used.
  disabled-worlds: []
  # Whether to enable debug mode or not.
  debug: false
  • disabled-features and stick.menu-command has been removed.

Message format is now MiniMessage

All of the messages have been reformatted using MiniMessage. Also, the default message files have changed to LOCALE.properties.

If you are using custom messages, you need to migrate to the new format/file manually.

Enhanced categories.yml

New format:

dirt:
  disabled: false
  icon: DIRT
  display-name:
    default: Dirt
    ja: 土類
  items: [ ]

Most of the settings are migrated automatically. However, the display-name of the default category uses the default name.
If you are using custom names for default categories, you need to redefine them. (Before auto-migration, the old categories.yml will be copied)

When the Minecraft version is updated, new items are automatically added to the default category. This process is done only once after the update.

Other Changes

  • Box is now Paper Plugin, so Box is no longer loaded on Bukkit/Spigot completely.
  • Experimental items are no longer loaded when the experimental feature is disabled.
  • Potion names have been renamed
    • Use Minecraft's potion name instead of Bukkit's one
    • Change extended/upgraded potion names
      • *_EXTENDED -> LONG_*
      • *_UPGRADED -> STRONG_*

API Changes

This changelog only lists changes under net.okocraft.box.api package. Other APIs such as feature's API and storage-api may have more breaking changes.

Added API

Dependency updates

  • ConfigAPI v4 -> v5
  • Event4J v3 -> v4

Newly exposed dependency

Removed API

All of the deprecated APIs in v5 have been removed. See #257.

  • ItemImportEvent.ItemType
  • Remove FeatureProvider from feature contexts
  • Folia

アイテム大量取得による負荷を軽減する

鯖内での検証の通り、
拾う → DBから元の値取得 → 元の値 + 拾った数 → DBに新しい値をセット → 書き込み → 拾う
というのを 1つ拾うごとに行っている ので拾い切るのに時間がかかる上に鯖が一瞬止まる。
負荷的観点や、鯖民でもアイテム大量に拾えば鯖を容易に落とすことも可能ではあるので、修正は必須と思われる。

Box 5.1.0 Release

New Features

  • Minecraft 1.19.3 Support (Added new items to default categories.yml)

    • Experimental Items that was added as experimentally are categorized dynamically to Experimental Items category
    • These items is not added to default categories.yml. When Mojang added them as officially, Box will add them to appropriate category
    • We have addressed this because it is not possible to exclude these items from Box, although future updates may make them incompatible
  • Box Stick: More containers (furnaces and a brewing stand) support

    • Furnace, BlastFurnace, and Smoker
      • If you don't have items in your main hand, take out the refined items from the furnace
      • If you have items that can be smelted or used as a fuel in your main hand, put them from Box into the furnace
    • Brewing Stand
      • If you don't have items in your main hand, take out the potions from the brewing stand
      • If you have potions or blaze powders in your main hand, put them from Box into the brewing stand

Changes

  • Unify the order of tree types in default "wood" category
  • Only in the creative mode, the click on the block with the Box Stick is now canceled.

API Changes

  • API: Expose MCDataVersion class (#166)
  • Auto Store: clarify that PerItemSetting#getEnabledItems is unmodifiable
  • Category: New Category API (see: #164)
    • net.okocraft.box.feature.category.model.Category and CategoryHolder are deprecated, and marked as for removal in the next major update.
  • Added Javadocs for autostore, category, and stick module

アクションバーへの通知機能を統一する

現在 AutoStore と Stick で別々に通知機能を備えているが、ストックの増え/減りイベントは共通で発火してるので、それをもとにアクションバーに通知するよう実装する

メッセージのハードコーディングを撲滅する

sender.sendMessage(
// FIXME: メッセージ取得時の @Nullable を潰す
// FIXME: メッセージがハードコーディングされている
Optional.ofNullable(messageConfig.getString("InvalidArgument"))
.orElse("&c引数が不正です。")
.replaceAll("&([a-f0-9])", "§$1")
);

こういうメッセージのハードコーディングを撲滅する。Optional<T> も同時に解決する。

#5 で解決予定。

String → 数値 の変換 (OtherUtil.java)

    public static int parseIntOrDefault(String number, int def) {
        try {
            return Integer.parseInt(number);
        } catch (NumberFormatException exception) {
            return def;
        }
    }

現在では例外を発生させることでデフォ値を返しているが、Spigot には commons-lang が入っているため、 NumberUtils#isNumber(String str) を使って判定したほうが適切

例外が発生したからデフォ値を返す ではなく、 数値ではないからデフォ値を返す の方が良い
(例外を発生させるコストも考えると特に。)

    public static int parseIntOrDefault(String number, int def) {
        if (NumberUtils.isNumber(number)) {
            return Integer.parseInt(number);
        } else {
            return def;
        }
    }

long への変換も同様

注:
NumberUtils#isNumber(str) は commons-lang3 では非推奨、4で廃止予定。
代替として NumberUtils#isCreatable(str) が用意されている。
なお、 spigot は 2.6 なので isCreatable() は存在しない。

Version 5.3.0

Features

New Player Command: /box stocklist

It has the same functionality as /boxadmin stock list, but the players can only see their own stock.

Box Stick: Click on a block to get its item

This is only available in Minecraft 1.19.4 (or later) because used API is added in that version.

Hold the Box Stick and click on the block while sneaking to withdraw the block's items from the Box to the main-hand.

The following list gives concrete specifications:

  • Box Stick is in the off-hand and the main-hand is empty
    • The item of the clicked block will be withdrawn from Box to the main-hand
    • Note: This method is already used for depositing/withdrawing items from/to the container, so the item of the container block cannot be deposited
  • Box Stick is in the main-hand and the off-hand is empty
    1. Box Stick will be moved to the off-hand
    2. The item of the clicked block will be withdrawn from Box to the main-hand
  • Box Stick is in the main-hand and the off-hand is not empty
    1. If the item in the off-hand can not be deposited to Box, nothing to happen
    2. When step 1 is passed, the item in the off-hand will be deposited to Box
    3. Box Stick will be moved to the off-hand
    4. The item of the clicked block will be withdrawn from Box to the main-hand

New Storage Feature

MySQL

MySQL (MariaDB) is now supported as a data storage.

To use MySQL, configure the following in config.yml:

storage:
  type: "mysql"
  mysql:
    table-prefix: "box_" # The prefix of the tables
    address: "localhost" # The host of the database
    port: 3306 # The port to connect to the database
    database-name: "box" # The database name (You need to create the database before starting the server)
    username: "" # The username to connect to the database
    password: "" # The password to connect to the database

Migrator

Added feature to migrate data between different storage types.

For more information, check wiki page (Japanese).

API

  • StockHolder#stockDataStream
  • InventoryTransaction#depositItemsInInventory(Inventory, Predicate)

Changes

  • Use sqlite.table-prefix instead of database.table_prefix in config.yml
    • database.table_prefix is still valid unless sqlite.table-prefix is not present
  • Delay player data loading to one second after logging in

Improvements

  • Set the initial capacity of the list and reduce the expansion of the list
  • Call InventoryClickEvent before depositing/withdrawing items from/to the inventory
  • Log picking up items to CoreProtect

Fixes

  • Don't set idleTimeout to SQLite connection config
  • Some fixes and improvements for language files

管理者コマンドを増やす

  • /ba reset <player> -> /ba reset confirm - 在庫をすべて 0 にする
  • /ba stockinfo <player> {sort} {page} -> 在庫情報を表示する ({sort} は多い順, 少ない順, A-Z 順をサポート)

Version 5.3.1

New Features

Add support for Folia

Added support for Folia, a multi-threaded server software by PaperMC. Please note that this is experimental and there may still be bugs.

Add goat horns

Removed the goat horn with no metadata (GOAT_HORN) from the default item and added goat horns available in normal survival.

  • Old goat horn (GOAT_HORN) will be converted to PONDER_GOAT_HORN automatically (same as the vanilla)
  • The new goat horns will be added to mob-drops category in default

API Changes

Deprecate some methods that are not working on Folia

  • TaskFactory#run and TaskFactory#supply have been deprecated (but not marked for removal)
    • These methods throw UnsupportedOperationException on Folia
  • For entity task, use TaskFactory#runEntityTask and TaskFactory#supplyFromEntity
  • Other operations are not provided in this API (as they are not used in this project)

Other

  • Add Folia class for checking if the server softwere is Folia
  • Add MCDataVersion#of and MCDataVersion#isBetween

Fixes

  • Ignore the illegal stack when withdrawing items to the inventory
  • Unload player data synchronously on disabling

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.