Compare commits
32 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 673ed06998 | |||
| 4d805abebe | |||
| 9f06c73591 | |||
| aa418921db | |||
| 62e5c3d7f1 | |||
| c61c2dc8b9 | |||
| 23d0cdc44f | |||
| 2877eb0372 | |||
| 4a475cae54 | |||
| 366e0e9826 | |||
| 1aba2b7e1a | |||
| 91c13dea71 | |||
| fe255b6d26 | |||
| 40b21ca422 | |||
| d085ead6e9 | |||
| f99265a4eb | |||
| 8fd6c39d51 | |||
| ab8fbf49f4 | |||
| 670485f824 | |||
| 7d23b8e5fb | |||
| ee55b2417b | |||
| 0d91251458 | |||
| 807886854f | |||
| 30972d8ec1 | |||
| e3c9bc2f23 | |||
| a9bef571f9 | |||
| 3c8415f536 | |||
| 37a0b242f2 | |||
| 431d3286b3 | |||
| b927c139e9 | |||
| d36e17de23 | |||
| ada54d1a4d |
117
LICENSE
117
LICENSE
@@ -1,117 +0,0 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
|
||||
Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Lesser General Public License instead.) You can apply it to your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and modification follow.
|
||||
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions:
|
||||
|
||||
a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License.
|
||||
|
||||
c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance.
|
||||
|
||||
5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License.
|
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
one line to give the program's name and an idea of what it does. Copyright (C) yyyy name of author
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program is interactive, make it output a short notice like this when it starts in an interactive mode:
|
||||
|
||||
Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||
|
||||
signature of Ty Coon, 1 April 1989 Ty Coon, President of Vice
|
||||
491
README.md
491
README.md
@@ -1,192 +1,379 @@
|
||||
# AutoSortChest Benutzeranleitung
|
||||
# AutoSortChest
|
||||
|
||||
Diese Anleitung erklärt, wie du das AutoSortChest-Plugin verwenden und einstellen kannst, um Items in Minecraft automatisch in Truhen zu sortieren.
|
||||
*Intelligente Lagerverwaltung & automatisierte Sortiersysteme ohne Redstone-Chaos*
|
||||
|
||||
## Nutzung
|
||||

|
||||

|
||||

|
||||
|
||||
### Einrichtung einer Eingangstruhe
|
||||
Eine Eingangstruhe nimmt Items auf und verteilt sie automatisch an Zieltruhen. So richtest du sie ein:
|
||||
1. Platziere ein Schild an oder neben einer Truhe.
|
||||
2. Schreibe Folgendes auf das Schild:
|
||||
---
|
||||
|
||||
## Über AutoSortChest
|
||||
|
||||
Schluss mit unordentlichen Truhen und stundenlangem Sortieren! **AutoSortChest** ermöglicht es dir, komplexe Sortiersysteme für Farmen, Shops oder Lagerhäuser in Sekunden aufzubauen. Alles funktioniert über ein intuitives Schildersystem – keine komplizierten Befehle oder mühsame Redstone-Leitungen erforderlich.
|
||||
|
||||
---
|
||||
|
||||
## ✨ Features
|
||||
|
||||
- **Einfache Schild-Steuerung:** Erstelle Input-, Ziel-, Rest- und Mülltruhen durch das Platzieren eines Schildes.
|
||||
- **Visuelles Status-System:** Schilder ändern ihre Farbe, wenn eine Truhe voll ist, und senden Warnungen im Chat.
|
||||
- **Smart Rest-Truhe (Fallback):** Konfiguriere mehrere Auffangtruhen für alle Items ohne spezielles Ziel.
|
||||
- **Mülltruhe:** Definiere eine Truhe, die bestimmte oder alle Items automatisch vernichtet – mit konfigurierbarer Filter-Liste und optionalem Auto-Clear-Intervall.
|
||||
- **Dynamic Item Update:** Ändere das sortierte Item einer Truhe jederzeit per Rechtsklick – kein Abbauen nötig!
|
||||
- **Mehrere Zieltruhen pro Item:** Definiere mehrere Zieltruhen für denselben Item-Typ – volle Truhen werden automatisch übersprungen.
|
||||
- **Privatsphäre-Modus:** Schalte Truhen per Shift-Rechtsklick zwischen Öffentlich und Privat um.
|
||||
- **Hopper-Schutz:** Input- und Rest-Truhen blockieren Hopper automatisch – Sortierung läuft ausschließlich über das ASC-System.
|
||||
- **Clean-Modus:** Optionaler sauberer Schild-Stil ohne sichtbaren Item-Namen – übersichtlicheres Aussehen im Lager.
|
||||
- **Visuelle Effekte:** Optionale Partikel- und Sound-Effekte beim Sortiervorgang.
|
||||
- **Server-übergreifend (CrossLink):** Mit MySQL können Zieltruhen auf anderen Servern des Netzwerks liegen. Items werden automatisch via Transfer-Tabelle weitergeleitet.
|
||||
- **Import & Export:** Daten lassen sich bequem zwischen `players.yml` und MySQL hin- und herwechseln – per Admin-Befehl.
|
||||
- **Update-Checker:** Admins werden beim Login automatisch über neue Versionen informiert.
|
||||
- **Multiplayer-Optimiert:** Jeder Spieler verwaltet sein eigenes System – kein gegenseitiges Stören.
|
||||
- **Vollständig Anpassbar:** Alle Nachrichten, Farben, Titel und Limits lassen sich in der `config.yml` editieren.
|
||||
|
||||
---
|
||||
|
||||
## 📖 Einrichtung
|
||||
|
||||
### 1. Eingangstruhe (Input)
|
||||
Hier wirfst du alle unsortierten Items hinein. Hopper können keine Items direkt einlegen – die Sortierung läuft ausschließlich über den eigenen Mechanismus.
|
||||
|
||||
Schild an die Truhe platzieren und folgendes schreiben:
|
||||
```
|
||||
[asc]
|
||||
input
|
||||
```
|
||||
Dein Spielername wird automatisch in Zeile 4 eingetragen.
|
||||
|
||||
3. Dein Spielername wird automatisch in die vierte Zeile des Schildes eingetragen.
|
||||
4. Items, die du in diese Truhe legst, werden automatisch in die entsprechenden Zieltruhen sortiert.
|
||||
---
|
||||
|
||||
### Einrichtung einer Zieltruhe
|
||||
Eine Zieltruhe speichert Items eines bestimmten Typs. So richtest du sie ein:
|
||||
1. Platziere ein Schild an oder neben einer Truhe.
|
||||
2. Schreibe Folgendes auf das Schild:
|
||||
### 2. Zieltruhe (Target)
|
||||
Hier landen die spezifisch sortierten Items.
|
||||
|
||||
Schild an die Truhe platzieren:
|
||||
```
|
||||
[asc]
|
||||
ziel
|
||||
```
|
||||
Danach mit dem gewünschten Item (z. B. Diamant) auf das Schild **Rechtsklicken** – der Item-Typ wird automatisch eingetragen.
|
||||
|
||||
3. Rechtsklicke auf das Schild mit dem Item in der Hand, das diese Truhe speichern soll (z. B. Diamanten).
|
||||
4. Der Item-Typ (z. B. `DIAMOND`) und dein Spielername werden automatisch in die dritte und vierte Zeile des Schildes eingetragen.
|
||||
|
||||
**Hinweis**: Nur der Besitzer der Truhe (dessen Name auf dem Schild steht) kann die Truhe öffnen oder abbauen. Zum Abbauen von Schildern oder Truhen musst du die Shift-Taste gedrückt halten.
|
||||
|
||||
## 🔐 Zugriffrechte verwalten (Privat & Öffentlich)
|
||||
|
||||
Du kannst für jede Truhe (Eingang oder Ziel) festlegen, ob sie **privat** oder **öffentlich** genutzt werden darf.
|
||||
> Sind mehrere Zieltruhen für denselben Item-Typ vorhanden, wird die nächste automatisch befüllt, wenn die erste voll ist.
|
||||
|
||||
---
|
||||
|
||||
### 🔄 Modus ändern
|
||||
|
||||
1. Halte **nichts** in der Hand (leere Hand).
|
||||
2. Halte die **Shift-Taste** gedrückt.
|
||||
3. Mache einen **Rechtsklick** auf das **Schild** oder die **Truhe**.
|
||||
|
||||
➡️ Das Schild wechselt anschließend automatisch den Modus.
|
||||
### 3. Rest-Truhe (Fallback)
|
||||
Das Auffangbecken für alle Items ohne Zieltruhe. Hopper können keine Items einlegen.
|
||||
```
|
||||
[asc]
|
||||
rest
|
||||
```
|
||||
> Es können mehrere Rest-Truhen registriert werden. Sind alle voll, bleibt das Item in der Eingangstruhe.
|
||||
|
||||
---
|
||||
|
||||
### 📦 Modi im Überblick
|
||||
### 4. Mülltruhe (Trash)
|
||||
Items, die in diese Truhe gelangen, werden automatisch vernichtet.
|
||||
```
|
||||
[asc]
|
||||
trash
|
||||
```
|
||||
Nach dem Platzieren des Schildes erscheint ein **Rechtsklick-Hinweis**. Durch Rechtsklick auf das Schild öffnet sich ein Konfiguration-GUI:
|
||||
|
||||
**🔒 Privat**
|
||||
- Nur **du** kannst die Truhe nutzen oder Items einwerfen.
|
||||
- Die Sortierung funktioniert **nur, wenn du online bist**.
|
||||
|
||||
**🌍 Öffentlich**
|
||||
- **Alle Spieler** können Items in die Eingangstruhe werfen.
|
||||
- Items werden **auch sortiert, wenn du offline bist**.
|
||||
- Das Schild zeigt **`[Public]`** hinter deinem Namen an.
|
||||
- **Ohne Filter-Liste:** Alle Items in der Truhe werden gelöscht.
|
||||
- **Mit Filter-Liste:** Nur die eingetragenen Item-Typen werden gelöscht, der Rest bleibt erhalten.
|
||||
- Items können per Rechtsklick zur Liste hinzugefügt oder entfernt werden.
|
||||
- Der **Auto-Clear-Intervall** lässt sich in der `config.yml` einstellen (z. B. alle 5 Minuten).
|
||||
- Auch Items, die per **Hopper** eingeworfen werden, werden sofort verarbeitet.
|
||||
|
||||
---
|
||||
|
||||
### ⚠️ Wichtige Regeln
|
||||
## 🔐 Zugriff & Modi
|
||||
|
||||
- **Nur der Owner** (Name auf dem Schild) kann den Modus ändern.
|
||||
- **Nur der Owner** kann das Schild oder die Truhe abbauen
|
||||
(unabhängig davon, ob sie privat oder öffentlich ist).
|
||||
- Zum Abbauen muss **immer die Shift-Taste gedrückt gehalten werden**.
|
||||
| Aktion | Beschreibung |
|
||||
|--------|-------------|
|
||||
| **Shift + Rechtsklick** (leere Hand) auf Schild/Truhe | Wechselt zwischen Privat und Öffentlich |
|
||||
| **Rechtsklick** auf Ziel-Schild (Item in Hand) | Ändert den zugeordneten Item-Typ |
|
||||
| **Rechtsklick** auf Mülltruhen-Schild | Öffnet das Filter-Konfiguration-GUI |
|
||||
| **Privat** | Nur der Besitzer kann die Truhe nutzen. Sortierung nur bei Online-Status. |
|
||||
| **Öffentlich** | Alle Spieler dürfen Items einwerfen. Sortierung auch offline. Schild zeigt `[Public]`. |
|
||||
|
||||
> Nur der Besitzer (Name auf dem Schild) kann den Modus ändern oder die Truhe/das Schild abbauen.
|
||||
> Zum Abbauen immer **Shift gedrückt halten**.
|
||||
|
||||
### Befehle
|
||||
Verwende die folgenden Befehle im Spiel:
|
||||
- `/asc help`: Zeigt die Hilfe mit Anweisungen zur Nutzung.
|
||||
- `/asc info`: Zeigt Informationen über das Plugin (Version, Autor, etc.).
|
||||
- `/asc reload`: Lädt die Konfigurationsdateien neu. (Erfordert die Berechtigung `autosortchest.reload`, normalerweise nur für Server-Operatoren.)
|
||||
---
|
||||
|
||||
## Konfiguration
|
||||
## 🎨 Clean-Modus
|
||||
|
||||
### config.yml
|
||||
Die `config.yml`-Datei im `plugins/AutoSortChest`-Ordner ermöglicht die Anpassung von Schildfarben und Nachrichten. Sie wird beim ersten Start des Plugins erstellt. Hier sind die wichtigsten Einstellungen:
|
||||
Wenn `sign-style.clean-target: true` in der `config.yml` gesetzt ist, werden Schilder in einem aufgeräumten Format ohne sichtbare `[asc]`-Kennung angezeigt:
|
||||
|
||||
| Schild-Typ | Zeile 1 | Zeile 2 | Zeile 3 |
|
||||
|-----------|---------|---------|---------|
|
||||
| **Input** | Spielername | „Eingang" / „Input" | Öffentlich / Privat |
|
||||
| **Target** | Item-Name | Spielername | Öffentlich / Privat |
|
||||
| **Rest** | Spielername | „Rest" | Öffentlich / Privat |
|
||||
| **Trash** | Spielername | „Müll" / „Trash" | — |
|
||||
|
||||
Die Farben für den Clean-Modus werden separat unter `sign-colors-clean` konfiguriert.
|
||||
|
||||
---
|
||||
|
||||
## 🌐 Serverübergreifende Sortierung (CrossLink)
|
||||
|
||||
Wenn MySQL aktiviert und `server_crosslink: true` gesetzt ist, können Zieltruhen auf **anderen Servern desselben Netzwerks** liegen.
|
||||
|
||||
**Funktionsweise:**
|
||||
1. Server A hat die Eingangstruhe und erkennt, dass die Zieltruhe für `OAK_LOG` auf Server B liegt.
|
||||
2. Server A schreibt den Transfer in die gemeinsame Datenbank (`asc_transfers`).
|
||||
3. Server B liest die Transfer-Tabelle und befüllt seine lokale Zieltruhe automatisch.
|
||||
|
||||
**BungeeCord-Setup:**
|
||||
1. Dieselbe MySQL-Datenbank auf allen Servern eintragen.
|
||||
2. Auf jedem Server einen **eindeutigen** `server_name` setzen (z. B. `survival`, `creative`).
|
||||
3. `mysql.enabled: true` und `server_crosslink: true` setzen.
|
||||
4. Alle Server neu starten – das Schema wird automatisch migriert.
|
||||
|
||||
> Wird `server_name` leer gelassen, läuft das Plugin im Legacy-Modus (welt-basierte Erkennung, kein BungeeCord).
|
||||
|
||||
**Voraussetzung:** Alle Server müssen dieselbe MySQL-Datenbank nutzen.
|
||||
|
||||
---
|
||||
|
||||
## 💬 Befehle & Berechtigungen
|
||||
|
||||
| Befehl | Beschreibung | Berechtigung |
|
||||
|--------|-------------|-------------|
|
||||
| `/asc help` | Zeigt die Hilfe an | – |
|
||||
| `/asc info` | Plugin-Informationen (Version, Autor) | `autosortchest.use` |
|
||||
| `/asc reload` | Konfiguration neu laden | `autosortchest.reload` |
|
||||
| `/asc import` | Importiert Daten aus `players.yml` → MySQL | `autosortchest.import` (OP) |
|
||||
| `/asc export` | Exportiert Daten aus MySQL → `players.yml` | `autosortchest.export` (OP) |
|
||||
|
||||
### Berechtigungen – Vollständige Übersicht
|
||||
|
||||
| Permission | Beschreibung | Standard |
|
||||
|-----------|-------------|---------|
|
||||
| `autosortchest.use` | Erlaubt das Erstellen von ASC-Schildern | `true` |
|
||||
| `autosortchest.reload` | Erlaubt `/asc reload` | OP |
|
||||
| `autosortchest.import` | Erlaubt `/asc import` | OP |
|
||||
| `autosortchest.export` | Erlaubt `/asc export` | OP |
|
||||
| `autosortchest.bypass` | Schilder ohne Shift abbauen, unabhängig vom Besitzer | OP |
|
||||
| `autosortchest.limit.bypass` | Umgeht alle Truhen-Limits | OP |
|
||||
| `autosortchest.admin` | Zugriff auf fremde ASC-Truhen | OP |
|
||||
| `autosortchest.limit.<gruppe>` | Weist dem Spieler die Limits einer Gruppe zu (z. B. `autosortchest.limit.vip`) | `false` |
|
||||
|
||||
> Spieler **ohne** jede `autosortchest.limit.*`-Permission können bei aktivierten Limits **keine** Truhen erstellen. Vergib `autosortchest.limit.default` an alle normalen Spieler (z. B. in LuckPerms).
|
||||
|
||||
### Import & Export – Details
|
||||
|
||||
**`/asc import`**
|
||||
Überträgt alle Spielerdaten aus der `players.yml` in die MySQL-Datenbank. Sinnvoll beim erstmaligen Wechsel von YAML auf MySQL. Bestehende MySQL-Einträge werden dabei nicht gelöscht, sondern aktualisiert (`REPLACE INTO`).
|
||||
|
||||
**`/asc export`**
|
||||
Exportiert alle Daten aus MySQL zurück in die `players.yml`. Enthält die `players.yml` noch Daten, wird vorher automatisch ein Backup erstellt (`players_backup_<timestamp>.yml`). Ist die Datei bereits leer, wird kein unnötiges Backup angelegt.
|
||||
|
||||
---
|
||||
|
||||
## ⚙️ Konfiguration (config.yml)
|
||||
|
||||
- **Schildfarben**: Passe die Farben der Schilder für Eingangs-, Ziel- und volle Truhen an. Verwende Minecraft-Farbcodes (z. B. `&6` für Gold).
|
||||
```yaml
|
||||
# Version der Konfigurationsdatei
|
||||
version: "2.3"
|
||||
|
||||
# Debug-Modus (nur für Entwicklung)
|
||||
debug: false
|
||||
|
||||
# Sprache: 'de' oder 'en'
|
||||
language: "de"
|
||||
|
||||
# MySQL/MariaDB – für CrossLink und zentralen Datenspeicher
|
||||
mysql:
|
||||
enabled: false
|
||||
host: "localhost"
|
||||
port: 3306
|
||||
database: "autosortchest"
|
||||
user: "autosortchest"
|
||||
password: "autosortchest"
|
||||
|
||||
# Serverübergreifende Sortierung (benötigt MySQL)
|
||||
server_crosslink: true
|
||||
|
||||
# Eindeutiger Servername im BungeeCord-Netzwerk
|
||||
# Leer lassen = Legacy-Modus (welt-basiert, kein BungeeCord)
|
||||
# Beispiele: lobby | survival | creative
|
||||
server_name: ""
|
||||
|
||||
# Welten, in denen das Plugin deaktiviert ist
|
||||
world_blacklist:
|
||||
- "world_nether"
|
||||
- "world_the_end"
|
||||
|
||||
# Sortier-Intervall in Ticks (1 Tick = 0,05s)
|
||||
# Empfohlen: 10 (= 0,5s)
|
||||
sort_interval_ticks: 10
|
||||
|
||||
# Rest-Truhen Nachsortierung (0 = deaktiviert)
|
||||
rest_resort_interval_ticks: 400 # 400 Ticks = 20 Sekunden
|
||||
|
||||
# Mülltruhe
|
||||
trash:
|
||||
# 0 = Nur beim Schließen leeren | 300 = alle 5 Min | 3600 = stündlich
|
||||
auto_clear_interval_seconds: 0
|
||||
|
||||
# Visuelle Effekte
|
||||
effects:
|
||||
enabled: false # Partikel-Effekte anzeigen?
|
||||
sound: false # Ton beim Ankommen von Items?
|
||||
type: "DUST" # Partikel-Typ ('DUST' = bunter Regenbogen-Effekt)
|
||||
|
||||
# Schild-Stil
|
||||
sign-style:
|
||||
clean-target: false # true = sauberer Modus (kein Item-Name auf dem Schild)
|
||||
|
||||
# Maximale Anzahl Truhen pro Spielergruppe
|
||||
chest_limits:
|
||||
enabled: true
|
||||
|
||||
default:
|
||||
input: 1
|
||||
rest: 1
|
||||
target: 50
|
||||
target_per_item: 1 # Wie viele Zieltruhen pro Item-Typ erlaubt sind
|
||||
|
||||
vip:
|
||||
input: 2
|
||||
rest: 2
|
||||
target: 100
|
||||
target_per_item: 3
|
||||
|
||||
# Truhen-Fenstertitel (Platzhalter: %item%)
|
||||
chest-titles:
|
||||
input:
|
||||
de: "&6Eingangstruhe"
|
||||
en: "&6Input Chest"
|
||||
target:
|
||||
de: "&6%item%"
|
||||
en: "&6%item%"
|
||||
rest:
|
||||
de: "&6Rest-Truhe"
|
||||
en: "&6Rest Chest"
|
||||
trash:
|
||||
de: "&4Mülltruhe"
|
||||
en: "&4Trash Chest"
|
||||
|
||||
# Schildfarben (Minecraft-Farbcodes)
|
||||
sign-colors:
|
||||
input:
|
||||
line1: "&6" # Farbe für "[asc]" auf Eingangsschildern
|
||||
line2: "&0" # Farbe für "input"
|
||||
line4: "&f" # Farbe für den Spielernamen
|
||||
target:
|
||||
line1: "&6" # Farbe für "[asc]" auf Zieltruhen
|
||||
line2: "&0" # Farbe für "ziel"
|
||||
line3: "&f" # Farbe für den Item-Typ
|
||||
line4: "&f" # Farbe für den Spielernamen
|
||||
full:
|
||||
line1: "&c" # Farbe für "[asc]" bei vollen Truhen
|
||||
line2: "&4" # Farbe für "ziel" bei vollen Truhen
|
||||
line3: "&e" # Farbe für den Item-Typ
|
||||
line4: "&e" # Farbe für den Spielernamen
|
||||
```
|
||||
input:
|
||||
line1: "&6"
|
||||
line2: "&0"
|
||||
line4: "&1"
|
||||
target:
|
||||
line1: "&6"
|
||||
line2: "&0"
|
||||
line3: "&f"
|
||||
line4: "&1"
|
||||
full:
|
||||
line1: "&c"
|
||||
line2: "&4"
|
||||
line3: "&e"
|
||||
line4: "&1"
|
||||
rest:
|
||||
line1: "&6"
|
||||
line2: "&0"
|
||||
line3: "&f"
|
||||
line4: "&1"
|
||||
trash:
|
||||
line1: "&6"
|
||||
line2: "&0"
|
||||
line4: "&1"
|
||||
|
||||
### Nachrichten: Passe die Nachrichten an, die Spielern im Spiel angezeigt werden.
|
||||
```yaml
|
||||
# Schildfarben im Clean-Modus
|
||||
sign-colors-clean:
|
||||
input:
|
||||
line1: "&1"
|
||||
line2: "&0"
|
||||
line3: "&a"
|
||||
target:
|
||||
line1: "&f"
|
||||
line2: "&1"
|
||||
line3: "&a"
|
||||
full:
|
||||
line1: "&e"
|
||||
line2: "&1"
|
||||
line3: "&a"
|
||||
rest:
|
||||
line1: "&1"
|
||||
line2: "&0"
|
||||
line3: "&a"
|
||||
trash:
|
||||
line1: "&1"
|
||||
line2: "&0"
|
||||
|
||||
# Nachrichten (Platzhalter: %player%, %item%, %x%, %y%, %z%, %mode%, %max%)
|
||||
messages:
|
||||
no-chest-near-sign: "&cKeine Truhe in der Nähe des Schildes!"
|
||||
no-item-in-hand: "&cDu musst ein Item in der Hand halten!"
|
||||
not-your-chest: "&cDiese Truhe gehört dir nicht!"
|
||||
input-chest-set: "&aEingangstruhe erfolgreich gesetzt!"
|
||||
target-chest-set: "&aZieltruhe für %item% erfolgreich gesetzt!"
|
||||
target-chest-missing: "&cZieltruhe für %item% fehlt!"
|
||||
target-chest-full: "&cZieltruhe für %item% ist voll! Koordinaten: (%x%, %y%, %z%)"
|
||||
help: |-
|
||||
&6&l=== AutoSortChest Hilfe ===
|
||||
&eEingangstruhe erstellen:
|
||||
&f1. Platziere ein Schild an einer Truhe.
|
||||
&f2. Schreibe:
|
||||
&7[asc]
|
||||
&7input
|
||||
&fDein Name wird automatisch in Zeile 4 eingetragen.
|
||||
&eZieltruhe erstellen:
|
||||
&f1. Platziere ein Schild an einer Truhe.
|
||||
&f2. Schreibe:
|
||||
&7[asc]
|
||||
&7ziel
|
||||
&f3. Rechtsklicke mit einem Item in der Hand.
|
||||
&eBefehle:
|
||||
&f- &b/asc help &f- Zeigt diese Hilfe.
|
||||
&f- &b/asc info &f- Zeigt Plugin-Informationen.
|
||||
&f- &b/asc reload &f- Lädt die Konfiguration neu (OP).
|
||||
&6&l====================
|
||||
info: |-
|
||||
&6&l=== AutoSortChest Info ===
|
||||
&ePlugin: &fAutoSortChest
|
||||
&eVersion: &f%version%
|
||||
&eKonfigurationsversion: &f%config_version%
|
||||
&eErsteller: &f%author%
|
||||
&eBeschreibung: &fAutomatisches Sortieren von Items in Truhen.
|
||||
&6&l====================
|
||||
no-permission: "&cDu hast keine Berechtigung für diesen Befehl!"
|
||||
reload-success: "&aKonfiguration erfolgreich neu geladen!"
|
||||
sign-break-denied: "&cDu musst Shift gedrückt halten, um dieses Schild oder die Truhe abzubauen!
|
||||
```
|
||||
|
||||
### Anpassung:
|
||||
|
||||
Öffne config.yml mit einem Texteditor.
|
||||
Ändere die Farbcodes oder Nachrichten nach deinen Wünschen.
|
||||
Speichere die Datei und führe /asc reload im Spiel aus (erfordert autosortchest.reload-Berechtigung), um die Änderungen zu übernehmen.
|
||||
|
||||
### players.yml
|
||||
Die players.yml-Datei speichert automatisch die Positionen von Eingangs- und Zieltruhen für jeden Spieler. Sie wird vom Plugin verwaltet und sollte normalerweise nicht manuell bearbeitet werden. Beispiel:
|
||||
|
||||
```yaml
|
||||
players:
|
||||
<player-uuid>:
|
||||
input-chest:
|
||||
world: world
|
||||
x: 100
|
||||
y: 64
|
||||
z: 200
|
||||
target-chests:
|
||||
DIAMOND:
|
||||
world: world
|
||||
x: 102
|
||||
y: 64
|
||||
z: 202
|
||||
```
|
||||
|
||||
|
||||
```yaml
|
||||
<player-uuid> ist die eindeutige ID des Spielers.
|
||||
input-chest speichert die Koordinaten der Eingangstruhe.
|
||||
target-chests listet Zieltruhen für bestimmte Item-Typen (z. B. DIAMOND).
|
||||
Hinweis: Wenn eine Truhe entfernt wird, aktualisiert das Plugin die Daten automatisch und benachrichtigt den Spieler, wenn eine Zieltruhe fehlt.
|
||||
|
||||
Tipps
|
||||
Schutz der Truhen: Nur der Besitzer (Name auf dem Schild) kann die Truhe öffnen oder abbauen. Halte Shift gedrückt, um Schilder oder Truhen abzubauen.
|
||||
Volle Truhen: Wenn eine Zieltruhe voll ist, ändert das Schild seine Farbe (gemäß sign-colors.full in config.yml) und du erhältst eine Benachrichtigung (maximal alle 5 Minuten pro Item-Typ).
|
||||
Debug-Modus: Falls Probleme auftreten, kann ein Server-Operator debug: true in config.yml setzen, um detaillierte Logs zu erhalten.
|
||||
Falls du Fragen hast oder Hilfe benötigst, verwende /asc help im Spiel!
|
||||
no-chest-near-sign: "&cKeine Truhe in der Nähe des Schildes!"
|
||||
no-item-in-hand: "&cDu musst ein Item in der Hand halten!"
|
||||
not-your-chest: "&cDiese Truhe gehört dir nicht!"
|
||||
input-chest-set: "&aEingangstruhe erfolgreich gesetzt!"
|
||||
target-chest-set: "&aZieltruhe erfolgreich für %item% eingerichtet!"
|
||||
rest-chest-set: "&aRest-Truhe (Fallback) erfolgreich gesetzt!"
|
||||
trash-chest-set: "&aMülltruhe erfolgreich eingerichtet!"
|
||||
trash-chest-hint: "&7Rechtsklicke das Schild um Items zu konfigurieren."
|
||||
target-chest-missing: "&cZieltruhe für %item% fehlt!"
|
||||
target-chest-full: "&cZieltruhe für %item% ist voll! Koordinaten: (%x%, %y%, %z%)"
|
||||
sign-break-denied: "&cDu musst Shift gedrückt halten, um dieses Schild oder die Truhe abzubauen!"
|
||||
no-permission: "&cDu hast keine Berechtigung für diesen Befehl!"
|
||||
world-blacklisted: "&cIn dieser Welt kannst du keine AutoSortChest erstellen!"
|
||||
reload-success: "&aKonfiguration erfolgreich neu geladen!"
|
||||
mode-changed: "&aModus gewechselt: &e%mode%"
|
||||
mode-public: "&aÖffentlich"
|
||||
mode-private: "&cPrivat"
|
||||
limit-input-reached: "&cDu hast das Limit deiner Eingangstruhen erreicht! &7(%max%)"
|
||||
limit-rest-reached: "&cDu hast das Limit deiner Rest-Truhen erreicht! &7(%max%)"
|
||||
limit-target-reached: "&cDu hast das Limit deiner Zieltruhen erreicht! &7(%max%)"
|
||||
limit-target-per-item: "&cDu hast das Limit für %item%-Truhen erreicht! &7(%max%)"
|
||||
limit-no-permission: "&cDu hast keine Berechtigung um Truhen zu erstellen!"
|
||||
trash-cleared: "&a✔ Mülltruhe wurde geleert!"
|
||||
trash-item-added: "&a✔ &e%item% &azur Müll-Liste hinzugefügt."
|
||||
trash-item-already: "&eDiseses Item ist bereits in der Müll-Liste."
|
||||
trash-item-removed: "&c✖ &e%item% &caus der Müll-Liste entfernt."
|
||||
trash-info-empty: "&4Mülltruhe &8(Deaktiviert) &7– Rechtsklick Schild zum Konfigurieren"
|
||||
trash-info-filter: "&4Müll: &f%items% &8| Schild-Rechtsklick: Konfigurieren"
|
||||
```
|
||||
|
||||
|
||||
---
|
||||
|
||||
### Erklärung
|
||||
- **Fokus**: Die Anleitung konzentriert sich ausschließlich auf die Nutzung (Einrichtung von Truhen, Befehle) und Konfiguration (`config.yml` und `players.yml`), wie von dir gewünscht.
|
||||
- **Struktur**: Klare Abschnitte für Nutzung und Konfiguration, mit detaillierten Schritten zur Einrichtung von Truhen, Erklärung der Befehle und Anleitung zur Anpassung der Konfigurationsdateien.
|
||||
- **Format**: Markdown-Codeblock, wie für GitHub üblich, mit korrekt formatierten YAML-Beispielen und klaren Anweisungen.
|
||||
- **Sprache**: Komplett auf Deutsch, wie angefordert.
|
||||
- **Praktische Tipps**: Zusätzliche Hinweise zu Schutzmechanismen, vollen Truhen und Debug-Modus, um die Benutzerfreundlichkeit zu erhöhen.
|
||||
## 🗄️ Datenbank-Tabellen
|
||||
|
||||
Falls du spezifische Änderungen, zusätzliche Details oder eine andere Struktur möchtest, lass es mich wissen!
|
||||
Bei aktiviertem MySQL erstellt das Plugin folgende Tabellen automatisch:
|
||||
|
||||
| Tabelle | Inhalt |
|
||||
|---------|--------|
|
||||
| `asc_players` | Spieler-UUIDs und Namen |
|
||||
| `asc_input_chests` | Registrierte Eingangstruhen |
|
||||
| `asc_target_chests` | Zieltruhen mit Item-Zuordnung und Slot-Index |
|
||||
| `asc_rest_chests` | Rest-/Fallback-Truhen |
|
||||
| `asc_trash_chests` | Mülltruhen mit Serverzuordnung |
|
||||
| `asc_trash_items` | Filter-Listen der Mülltruhen |
|
||||
| `asc_transfers` | Ausstehende CrossLink-Transfers zwischen Servern |
|
||||
|
||||
---
|
||||
|
||||
## 🔧 Technische Details
|
||||
|
||||
- **Kompatibilität:** Paper, Spigot, Purpur (1.18.x – 1.21.x)
|
||||
- **Java:** 17+
|
||||
- **Datenbank:** YAML (Standard) oder MySQL/MariaDB (optional)
|
||||
- **Performance:** Asynchrones Speichern der `players.yml`, konfigurierbarer Sortier-Intervall, TTL-Caching für öffentliche Truhen
|
||||
|
||||
---
|
||||
|
||||
## 💬 Support
|
||||
|
||||
[](https://discord.com/invite/FdRs4BRd8D)
|
||||
|
||||
---
|
||||
|
||||
**Copyright © 2026 - M_Viper - Alle Rechte vorbehalten**
|
||||
|
||||
Die unbefugte Vervielfältigung, Verbreitung oder Weitergabe dieses Plugins ist strafbar und wird rechtlich verfolgt.
|
||||
80
pom.xml
80
pom.xml
@@ -1,38 +1,44 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.viper</groupId>
|
||||
<artifactId>AutoSortChest</artifactId>
|
||||
<version>1.4</version>
|
||||
<name>AutoSortChest</name>
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>spigot-repo</id>
|
||||
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
<artifactId>spigot-api</artifactId>
|
||||
<version>1.21-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.8.1</version>
|
||||
<configuration>
|
||||
<source>17</source>
|
||||
<target>17</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.viper</groupId>
|
||||
<artifactId>AutoSortChest</artifactId>
|
||||
<version>2.3</version>
|
||||
<name>AutoSortChest</name>
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>spigot-repo</id>
|
||||
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
<artifactId>spigot-api</artifactId>
|
||||
<version>1.21-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<!-- MySQL Connector -->
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
<version>8.0.33</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.8.1</version>
|
||||
<configuration>
|
||||
<source>17</source>
|
||||
<target>17</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
File diff suppressed because it is too large
Load Diff
873
src/main/java/com/viper/autosortchest/MySQLManager.java
Normal file
873
src/main/java/com/viper/autosortchest/MySQLManager.java
Normal file
@@ -0,0 +1,873 @@
|
||||
package com.viper.autosortchest;
|
||||
|
||||
import java.sql.*;
|
||||
import java.util.*;
|
||||
|
||||
public class MySQLManager {
|
||||
public Connection getConnection() {
|
||||
return connection;
|
||||
}
|
||||
|
||||
private final String host, database, user, password;
|
||||
private final int port;
|
||||
private Connection connection;
|
||||
|
||||
public MySQLManager(String host, int port, String database, String user, String password) {
|
||||
this.host = host;
|
||||
this.port = port;
|
||||
this.database = database;
|
||||
this.user = user;
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
public boolean connect() {
|
||||
try {
|
||||
if (connection != null && !connection.isClosed()) return true;
|
||||
Class.forName("com.mysql.cj.jdbc.Driver");
|
||||
connection = DriverManager.getConnection(
|
||||
"jdbc:mysql://" + host + ":" + port + "/" + database
|
||||
+ "?useSSL=false&autoReconnect=true&characterEncoding=UTF-8&serverTimezone=UTC",
|
||||
user, password
|
||||
);
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Migriert den PRIMARY KEY der asc_rest_chests von (uuid) auf (uuid, slot) falls nötig.
|
||||
* Ermöglicht mehrere Rest-Truhen pro Spieler.
|
||||
*/
|
||||
private void migrateRestChestPrimaryKey(Statement st) {
|
||||
try {
|
||||
// Slot-Spalte zuerst sicherstellen
|
||||
if (!columnExists("asc_rest_chests", "slot")) {
|
||||
st.execute("ALTER TABLE asc_rest_chests ADD COLUMN slot INT NOT NULL DEFAULT 0;");
|
||||
}
|
||||
|
||||
// Prüfen ob slot bereits im PRIMARY KEY ist
|
||||
try (PreparedStatement ps = connection.prepareStatement(
|
||||
"SELECT COUNT(*) FROM information_schema.KEY_COLUMN_USAGE " +
|
||||
"WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = 'asc_rest_chests' " +
|
||||
"AND CONSTRAINT_NAME = 'PRIMARY' AND COLUMN_NAME = 'slot';")) {
|
||||
ResultSet rs = ps.executeQuery();
|
||||
if (rs.next() && rs.getInt(1) > 0) {
|
||||
rs.close();
|
||||
return; // Bereits migriert
|
||||
}
|
||||
rs.close();
|
||||
}
|
||||
|
||||
// Alten PK droppen und neuen mit slot anlegen
|
||||
st.execute("ALTER TABLE asc_rest_chests DROP PRIMARY KEY, ADD PRIMARY KEY(uuid, slot);");
|
||||
} catch (SQLException e) {
|
||||
if (!e.getMessage().toLowerCase().contains("primary")) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Migriert den PRIMARY KEY von (uuid, item) auf (uuid, item, slot) falls nötig.
|
||||
* Nutzt DATABASE() um nur die aktuelle DB zu prüfen (kein Cross-DB-Problem).
|
||||
*/
|
||||
private void migrateTargetChestPrimaryKey(Statement st) {
|
||||
try {
|
||||
// Slot-Spalte zuerst sicherstellen (muss vor PK-Änderung existieren)
|
||||
// tryAlterColumn wurde bereits aufgerufen, hier nochmal sicher prüfen
|
||||
if (!columnExists("asc_target_chests", "slot")) {
|
||||
st.execute("ALTER TABLE asc_target_chests ADD COLUMN slot INT NOT NULL DEFAULT 0;");
|
||||
}
|
||||
|
||||
// Prüfen ob slot bereits im PRIMARY KEY ist
|
||||
try (PreparedStatement ps = connection.prepareStatement(
|
||||
"SELECT COUNT(*) FROM information_schema.KEY_COLUMN_USAGE " +
|
||||
"WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = 'asc_target_chests' " +
|
||||
"AND CONSTRAINT_NAME = 'PRIMARY' AND COLUMN_NAME = 'slot';")) {
|
||||
ResultSet rs = ps.executeQuery();
|
||||
if (rs.next() && rs.getInt(1) > 0) {
|
||||
rs.close();
|
||||
return; // Bereits migriert
|
||||
}
|
||||
rs.close();
|
||||
}
|
||||
|
||||
// Alten PK droppen und neuen mit slot anlegen
|
||||
st.execute("ALTER TABLE asc_target_chests DROP PRIMARY KEY, ADD PRIMARY KEY(uuid, item, slot);");
|
||||
} catch (SQLException e) {
|
||||
if (!e.getMessage().toLowerCase().contains("primary")) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void disconnect() {
|
||||
try {
|
||||
if (connection != null && !connection.isClosed()) connection.close();
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
// ═══════════════════════════════════════════════════════════════════
|
||||
// BungeeCord-Erweiterung: Sanfte Schema-Migration
|
||||
// Fügt eine Spalte hinzu, falls sie noch nicht existiert.
|
||||
// ═══════════════════════════════════════════════════════════════════
|
||||
/**
|
||||
* Fügt eine Spalte hinzu, falls sie noch nicht existiert.
|
||||
* Nutzt DatabaseMetaData statt IF NOT EXISTS (kompatibel mit allen MySQL/MariaDB-Versionen).
|
||||
*/
|
||||
private void tryAlterColumn(Statement st, String table, String column, String definition) {
|
||||
try {
|
||||
ResultSet rs = st.getConnection().getMetaData().getColumns(connection.getCatalog(), null, table, column);
|
||||
if (!rs.next()) {
|
||||
st.execute("ALTER TABLE " + table + " ADD COLUMN " + column + " " + definition + ";");
|
||||
}
|
||||
rs.close();
|
||||
} catch (SQLException e) {
|
||||
if (!e.getMessage().toLowerCase().contains("duplicate column")) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Prüft ob eine Spalte in einer Tabelle existiert.
|
||||
*/
|
||||
private boolean columnExists(String table, String column) {
|
||||
try {
|
||||
ResultSet rs = connection.getMetaData().getColumns(connection.getCatalog(), null, table, column);
|
||||
boolean exists = rs.next();
|
||||
rs.close();
|
||||
return exists;
|
||||
} catch (SQLException e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Prüft ob ein Index/Constraint auf einer Tabelle existiert.
|
||||
*/
|
||||
private boolean indexExists(String table, String indexName) {
|
||||
try (PreparedStatement ps = connection.prepareStatement(
|
||||
"SELECT COUNT(*) FROM information_schema.STATISTICS " +
|
||||
"WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = ? AND INDEX_NAME = ?;")) {
|
||||
ps.setString(1, table);
|
||||
ps.setString(2, indexName);
|
||||
ResultSet rs = ps.executeQuery();
|
||||
boolean exists = rs.next() && rs.getInt(1) > 0;
|
||||
rs.close();
|
||||
return exists;
|
||||
} catch (SQLException e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Erstellt alle Tabellen und führt automatisch alle Schema-Migrationen durch.
|
||||
* Bestehende Datenbanken älterer Versionen werden vollständig und sicher migriert:
|
||||
*
|
||||
* Alte Version → Neue Spalten:
|
||||
* asc_input_chests : +server
|
||||
* asc_rest_chests : +server
|
||||
* asc_target_chests : +slot, +server, PRIMARY KEY (uuid,item) → (uuid,item,slot)
|
||||
* asc_transfers : +target_server, +source_server
|
||||
* Neue Tabellen (falls fehlend):
|
||||
* asc_servers (BungeeCord Heartbeat)
|
||||
* asc_transfers (CrossLink Transfers)
|
||||
*/
|
||||
public void setupTables() {
|
||||
try (Statement st = connection.createStatement()) {
|
||||
|
||||
// ── Basis-Tabellen anlegen (falls nicht vorhanden) ────────────────────
|
||||
st.execute("CREATE TABLE IF NOT EXISTS asc_players (" +
|
||||
"uuid VARCHAR(36) PRIMARY KEY, name VARCHAR(32)" +
|
||||
");");
|
||||
|
||||
st.execute("CREATE TABLE IF NOT EXISTS asc_input_chests (" +
|
||||
"uuid VARCHAR(36), chest_id VARCHAR(36), world VARCHAR(32)," +
|
||||
"x INT, y INT, z INT, `public` BOOLEAN DEFAULT FALSE," +
|
||||
"PRIMARY KEY(uuid, chest_id)" +
|
||||
");");
|
||||
|
||||
// asc_target_chests: neue Installs bekommen slot direkt im Schema.
|
||||
// Alte Installs werden weiter unten per Migration angepasst.
|
||||
st.execute("CREATE TABLE IF NOT EXISTS asc_target_chests (" +
|
||||
"uuid VARCHAR(36), item VARCHAR(64), slot INT NOT NULL DEFAULT 0," +
|
||||
"world VARCHAR(32), x INT, y INT, z INT, `public` BOOLEAN DEFAULT FALSE," +
|
||||
"PRIMARY KEY(uuid, item, slot)" +
|
||||
");");
|
||||
|
||||
st.execute("CREATE TABLE IF NOT EXISTS asc_rest_chests (" +
|
||||
"uuid VARCHAR(36), slot INT NOT NULL DEFAULT 0," +
|
||||
"world VARCHAR(32)," +
|
||||
"x INT, y INT, z INT, `public` BOOLEAN DEFAULT FALSE," +
|
||||
"PRIMARY KEY(uuid, slot)" +
|
||||
");");
|
||||
|
||||
// ── asc_transfers: immer beim Start sicherstellen ─────────────────────
|
||||
// (früher lazy – führte dazu dass target_server/source_server fehlten)
|
||||
st.execute("CREATE TABLE IF NOT EXISTS asc_transfers (" +
|
||||
"id BIGINT AUTO_INCREMENT PRIMARY KEY," +
|
||||
"uuid VARCHAR(36) NOT NULL," +
|
||||
"item VARCHAR(64) NOT NULL," +
|
||||
"amount INT NOT NULL," +
|
||||
"target_world VARCHAR(32) NOT NULL," +
|
||||
"created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP" +
|
||||
");");
|
||||
|
||||
// ── asc_servers: BungeeCord Heartbeat ────────────────────────────────
|
||||
st.execute("CREATE TABLE IF NOT EXISTS asc_servers (" +
|
||||
"server_name VARCHAR(64) PRIMARY KEY," +
|
||||
"last_seen TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP" +
|
||||
");");
|
||||
|
||||
// ══════════════════════════════════════════════════════════════════════
|
||||
// SCHEMA-MIGRATIONEN (für bestehende Datenbanken älterer Versionen)
|
||||
// Jede Migration ist idempotent – mehrfaches Ausführen schadet nicht.
|
||||
// ══════════════════════════════════════════════════════════════════════
|
||||
|
||||
// v1 → v2 (BungeeCord): server-Spalten
|
||||
tryAlterColumn(st, "asc_input_chests", "server", "VARCHAR(64) DEFAULT ''");
|
||||
tryAlterColumn(st, "asc_target_chests", "server", "VARCHAR(64) DEFAULT ''");
|
||||
tryAlterColumn(st, "asc_rest_chests", "server", "VARCHAR(64) DEFAULT ''");
|
||||
|
||||
// v1 → v2 (BungeeCord): Transfer-Routing-Spalten
|
||||
tryAlterColumn(st, "asc_transfers", "target_server", "VARCHAR(64) DEFAULT ''");
|
||||
tryAlterColumn(st, "asc_transfers", "source_server", "VARCHAR(64) DEFAULT ''");
|
||||
|
||||
// v2 → v3 (Multi-Target): slot-Spalte + PRIMARY KEY Migration
|
||||
migrateTargetChestPrimaryKey(st);
|
||||
|
||||
// v2 → v3 (Multi-Rest): slot-Spalte + PRIMARY KEY Migration fuer Rest-Truhen
|
||||
migrateRestChestPrimaryKey(st);
|
||||
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* setupTransferTable() bleibt für Rückwärtskompatibilität erhalten,
|
||||
* delegiert aber nur noch an setupTables() da alles konsolidiert wurde.
|
||||
*/
|
||||
public void setupTransferTable() {
|
||||
// Transfers werden jetzt immer in setupTables() angelegt.
|
||||
// Diese Methode existiert nur noch damit bestehende Aufrufe nicht brechen.
|
||||
}
|
||||
|
||||
// ── BungeeCord NEU: Heartbeat ─────────────────────────────────────────────
|
||||
/**
|
||||
* Schreibt / aktualisiert den Heartbeat-Eintrag für diesen Server.
|
||||
* Sollte alle 30 Sekunden asynchron aufgerufen werden.
|
||||
*/
|
||||
public void heartbeat(String serverName) {
|
||||
if (serverName == null || serverName.isEmpty()) return;
|
||||
try (PreparedStatement ps = connection.prepareStatement(
|
||||
"REPLACE INTO asc_servers (server_name, last_seen) VALUES (?, NOW());")) {
|
||||
ps.setString(1, serverName);
|
||||
ps.executeUpdate();
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
// ── BungeeCord NEU: Transfer mit Server-Routing ───────────────────────────
|
||||
/**
|
||||
* Legt einen Transfer-Eintrag mit explizitem Ziel-Server an.
|
||||
*/
|
||||
public void addTransfer(String uuid, String item, int amount,
|
||||
String targetWorld, String targetServer, String sourceServer) {
|
||||
try (PreparedStatement ps = connection.prepareStatement(
|
||||
"INSERT INTO asc_transfers (uuid, item, amount, target_world, target_server, source_server) " +
|
||||
"VALUES (?, ?, ?, ?, ?, ?);")) {
|
||||
ps.setString(1, uuid);
|
||||
ps.setString(2, item);
|
||||
ps.setInt(3, amount);
|
||||
ps.setString(4, targetWorld);
|
||||
ps.setString(5, targetServer != null ? targetServer : "");
|
||||
ps.setString(6, sourceServer != null ? sourceServer : "");
|
||||
ps.executeUpdate();
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Legacy-Überladung (ohne Server-Routing) – Rückwärtskompatibilität.
|
||||
*/
|
||||
public void addTransfer(String uuid, String item, int amount, String targetWorld) {
|
||||
addTransfer(uuid, item, amount, targetWorld, "", "");
|
||||
}
|
||||
|
||||
/**
|
||||
* Gibt ausstehende Transfers zurück, gefiltert nach serverName.
|
||||
* serverName leer/null → alle Transfers (Legacy).
|
||||
* serverName gesetzt → nur Transfers mit target_server == serverName ODER target_server == '' (Legacy).
|
||||
*/
|
||||
public List<Map<String, Object>> getPendingTransfers(String uuid, String serverName) {
|
||||
List<Map<String, Object>> list = new ArrayList<>();
|
||||
try {
|
||||
PreparedStatement ps;
|
||||
if (serverName == null || serverName.isEmpty()) {
|
||||
ps = connection.prepareStatement(
|
||||
"SELECT id, item, amount, target_world, target_server, source_server " +
|
||||
"FROM asc_transfers WHERE uuid=? ORDER BY created_at ASC;");
|
||||
ps.setString(1, uuid);
|
||||
} else {
|
||||
ps = connection.prepareStatement(
|
||||
"SELECT id, item, amount, target_world, target_server, source_server " +
|
||||
"FROM asc_transfers WHERE uuid=? AND (target_server=? OR target_server='') " +
|
||||
"ORDER BY created_at ASC;");
|
||||
ps.setString(1, uuid);
|
||||
ps.setString(2, serverName);
|
||||
}
|
||||
ResultSet rs = ps.executeQuery();
|
||||
while (rs.next()) {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("id", rs.getLong("id"));
|
||||
map.put("item", rs.getString("item"));
|
||||
map.put("amount", rs.getInt("amount"));
|
||||
map.put("target_world", rs.getString("target_world"));
|
||||
map.put("target_server", rs.getString("target_server"));
|
||||
map.put("source_server", rs.getString("source_server"));
|
||||
list.add(map);
|
||||
}
|
||||
ps.close();
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
/** Legacy-Überladung ohne serverName. */
|
||||
public List<Map<String, Object>> getPendingTransfers(String uuid) {
|
||||
return getPendingTransfers(uuid, "");
|
||||
}
|
||||
|
||||
public void deleteTransfer(long id) {
|
||||
try (PreparedStatement ps = connection.prepareStatement(
|
||||
"DELETE FROM asc_transfers WHERE id=?;")) {
|
||||
ps.setLong(1, id);
|
||||
ps.executeUpdate();
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public void updateTransferAmount(long id, int newAmount) {
|
||||
try (PreparedStatement ps = connection.prepareStatement(
|
||||
"UPDATE asc_transfers SET amount=? WHERE id=?;")) {
|
||||
ps.setInt(1, newAmount);
|
||||
ps.setLong(2, id);
|
||||
ps.executeUpdate();
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
// --- Spieler ---
|
||||
|
||||
public void savePlayer(String uuid, String name) {
|
||||
try (PreparedStatement ps = connection.prepareStatement(
|
||||
"REPLACE INTO asc_players (uuid, name) VALUES (?, ?);")) {
|
||||
ps.setString(1, uuid);
|
||||
ps.setString(2, name);
|
||||
ps.executeUpdate();
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public List<Map<String, Object>> getAllPlayers() {
|
||||
List<Map<String, Object>> list = new ArrayList<>();
|
||||
try (Statement st = connection.createStatement();
|
||||
ResultSet rs = st.executeQuery("SELECT uuid, name FROM asc_players;")) {
|
||||
while (rs.next()) {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("uuid", rs.getString("uuid"));
|
||||
map.put("name", rs.getString("name"));
|
||||
list.add(map);
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
// --- Input-Chest ---
|
||||
|
||||
public void addInputChest(String uuid, String chestId, String world, int x, int y, int z) {
|
||||
addInputChest(uuid, chestId, world, x, y, z, false);
|
||||
}
|
||||
|
||||
public void addInputChest(String uuid, String chestId, String world, int x, int y, int z, boolean isPublic) {
|
||||
addInputChest(uuid, chestId, world, x, y, z, isPublic, "");
|
||||
}
|
||||
|
||||
/** BungeeCord-Überladung mit serverName. */
|
||||
public void addInputChest(String uuid, String chestId, String world,
|
||||
int x, int y, int z, boolean isPublic, String serverName) {
|
||||
try (PreparedStatement ps = connection.prepareStatement(
|
||||
"REPLACE INTO asc_input_chests (uuid, chest_id, world, x, y, z, `public`, server) " +
|
||||
"VALUES (?, ?, ?, ?, ?, ?, ?, ?);")) {
|
||||
ps.setString(1, uuid);
|
||||
ps.setString(2, chestId);
|
||||
ps.setString(3, world);
|
||||
ps.setInt(4, x);
|
||||
ps.setInt(5, y);
|
||||
ps.setInt(6, z);
|
||||
ps.setBoolean(7, isPublic);
|
||||
ps.setString(8, serverName != null ? serverName : "");
|
||||
ps.executeUpdate();
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public void removeInputChest(String uuid, String chestId) {
|
||||
try (PreparedStatement ps = connection.prepareStatement(
|
||||
"DELETE FROM asc_input_chests WHERE uuid=? AND chest_id=?;")) {
|
||||
ps.setString(1, uuid);
|
||||
ps.setString(2, chestId);
|
||||
ps.executeUpdate();
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public List<Map<String, Object>> getInputChests(String uuid) {
|
||||
List<Map<String, Object>> list = new ArrayList<>();
|
||||
try (PreparedStatement ps = connection.prepareStatement(
|
||||
"SELECT * FROM asc_input_chests WHERE uuid=?;")) {
|
||||
ps.setString(1, uuid);
|
||||
ResultSet rs = ps.executeQuery();
|
||||
while (rs.next()) {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("chest_id", rs.getString("chest_id"));
|
||||
map.put("world", rs.getString("world"));
|
||||
map.put("x", rs.getInt("x"));
|
||||
map.put("y", rs.getInt("y"));
|
||||
map.put("z", rs.getInt("z"));
|
||||
map.put("public", rs.getBoolean("public"));
|
||||
try { map.put("server", rs.getString("server")); }
|
||||
catch (SQLException ignored) { map.put("server", ""); }
|
||||
list.add(map);
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
// --- Target-Chest ---
|
||||
|
||||
public void setTargetChest(String uuid, String item, String world, int x, int y, int z) {
|
||||
setTargetChest(uuid, item, world, x, y, z, false);
|
||||
}
|
||||
|
||||
public void setTargetChest(String uuid, String item, String world, int x, int y, int z, boolean isPublic) {
|
||||
setTargetChest(uuid, item, world, x, y, z, isPublic, "");
|
||||
}
|
||||
|
||||
/** BungeeCord-Überladung mit serverName. Slot=0 (Standard, erster Platz). */
|
||||
public void setTargetChest(String uuid, String item, String world,
|
||||
int x, int y, int z, boolean isPublic, String serverName) {
|
||||
setTargetChest(uuid, item, 0, world, x, y, z, isPublic, serverName);
|
||||
}
|
||||
|
||||
/** Vollständige Überladung mit slot für Multi-Target-Support. */
|
||||
public void setTargetChest(String uuid, String item, int slot, String world,
|
||||
int x, int y, int z, boolean isPublic, String serverName) {
|
||||
try (PreparedStatement ps = connection.prepareStatement(
|
||||
"REPLACE INTO asc_target_chests (uuid, item, slot, world, x, y, z, `public`, server) " +
|
||||
"VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?);")) {
|
||||
ps.setString(1, uuid);
|
||||
ps.setString(2, item);
|
||||
ps.setInt(3, slot);
|
||||
ps.setString(4, world);
|
||||
ps.setInt(5, x);
|
||||
ps.setInt(6, y);
|
||||
ps.setInt(7, z);
|
||||
ps.setBoolean(8, isPublic);
|
||||
ps.setString(9, serverName != null ? serverName : "");
|
||||
ps.executeUpdate();
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/** Löscht eine spezifische Slot-Zieltruhe und verschiebt höhere Slots nach unten. */
|
||||
public void removeTargetChestSlot(String uuid, String item, int slot) {
|
||||
try (PreparedStatement ps = connection.prepareStatement(
|
||||
"DELETE FROM asc_target_chests WHERE uuid=? AND item=? AND slot=?;")) {
|
||||
ps.setString(1, uuid);
|
||||
ps.setString(2, item);
|
||||
ps.setInt(3, slot);
|
||||
ps.executeUpdate();
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
// Slots nach dem gelöschten nach unten schieben
|
||||
try (PreparedStatement ps = connection.prepareStatement(
|
||||
"UPDATE asc_target_chests SET slot=slot-1 WHERE uuid=? AND item=? AND slot>?;")) {
|
||||
ps.setString(1, uuid);
|
||||
ps.setString(2, item);
|
||||
ps.setInt(3, slot);
|
||||
ps.executeUpdate();
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/** Gibt den nächsten freien Slot für ein Item zurück. */
|
||||
public int getNextTargetSlot(String uuid, String item) {
|
||||
try (PreparedStatement ps = connection.prepareStatement(
|
||||
"SELECT COALESCE(MAX(slot)+1, 0) AS next_slot FROM asc_target_chests WHERE uuid=? AND item=?;")) {
|
||||
ps.setString(1, uuid);
|
||||
ps.setString(2, item);
|
||||
ResultSet rs = ps.executeQuery();
|
||||
if (rs.next()) return rs.getInt("next_slot");
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/** Zählt wie viele Zieltruhen für ein bestimmtes Item registriert sind. */
|
||||
public int countTargetChestsForItem(String uuid, String item) {
|
||||
try (PreparedStatement ps = connection.prepareStatement(
|
||||
"SELECT COUNT(*) FROM asc_target_chests WHERE uuid=? AND item=?;")) {
|
||||
ps.setString(1, uuid);
|
||||
ps.setString(2, item);
|
||||
ResultSet rs = ps.executeQuery();
|
||||
if (rs.next()) return rs.getInt(1);
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/** Gibt die erste (slot=0) Zieltruhe für ein Item zurück (Legacy-Kompatibilität). */
|
||||
public Map<String, Object> getTargetChest(String uuid, String item) {
|
||||
List<Map<String, Object>> all = getTargetChestsForItem(uuid, item);
|
||||
return all.isEmpty() ? null : all.get(0);
|
||||
}
|
||||
|
||||
/** Gibt ALLE Zieltruhen für ein bestimmtes Item zurück, sortiert nach slot. */
|
||||
public List<Map<String, Object>> getTargetChestsForItem(String uuid, String item) {
|
||||
List<Map<String, Object>> list = new ArrayList<>();
|
||||
try (PreparedStatement ps = connection.prepareStatement(
|
||||
"SELECT * FROM asc_target_chests WHERE uuid=? AND item=? ORDER BY slot ASC;")) {
|
||||
ps.setString(1, uuid);
|
||||
ps.setString(2, item);
|
||||
ResultSet rs = ps.executeQuery();
|
||||
while (rs.next()) {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("item", rs.getString("item"));
|
||||
map.put("slot", rs.getInt("slot"));
|
||||
map.put("world", rs.getString("world"));
|
||||
map.put("x", rs.getInt("x"));
|
||||
map.put("y", rs.getInt("y"));
|
||||
map.put("z", rs.getInt("z"));
|
||||
map.put("public", rs.getBoolean("public"));
|
||||
try { map.put("server", rs.getString("server")); }
|
||||
catch (SQLException ignored) { map.put("server", ""); }
|
||||
list.add(map);
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public void removeTargetChest(String uuid, String item) {
|
||||
try (PreparedStatement ps = connection.prepareStatement(
|
||||
"DELETE FROM asc_target_chests WHERE uuid=? AND item=?;")) {
|
||||
ps.setString(1, uuid);
|
||||
ps.setString(2, item);
|
||||
ps.executeUpdate();
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/** Gibt alle Zieltruhen eines Spielers zurück, sortiert nach item + slot. */
|
||||
public List<Map<String, Object>> getTargetChests(String uuid) {
|
||||
List<Map<String, Object>> list = new ArrayList<>();
|
||||
try (PreparedStatement ps = connection.prepareStatement(
|
||||
"SELECT * FROM asc_target_chests WHERE uuid=? ORDER BY item ASC, slot ASC;")) {
|
||||
ps.setString(1, uuid);
|
||||
ResultSet rs = ps.executeQuery();
|
||||
while (rs.next()) {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("item", rs.getString("item"));
|
||||
map.put("slot", rs.getInt("slot"));
|
||||
map.put("world", rs.getString("world"));
|
||||
map.put("x", rs.getInt("x"));
|
||||
map.put("y", rs.getInt("y"));
|
||||
map.put("z", rs.getInt("z"));
|
||||
map.put("public", rs.getBoolean("public"));
|
||||
try { map.put("server", rs.getString("server")); }
|
||||
catch (SQLException ignored) { map.put("server", ""); }
|
||||
list.add(map);
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
// --- Rest-Chest ---
|
||||
|
||||
public void setRestChest(String uuid, String world, int x, int y, int z) {
|
||||
setRestChest(uuid, world, x, y, z, false);
|
||||
}
|
||||
|
||||
public void setRestChest(String uuid, String world, int x, int y, int z, boolean isPublic) {
|
||||
setRestChest(uuid, world, x, y, z, isPublic, "");
|
||||
}
|
||||
|
||||
/** BungeeCord-Überladung mit serverName – ermittelt automatisch den nächsten freien Slot. */
|
||||
public void setRestChest(String uuid, String world, int x, int y, int z,
|
||||
boolean isPublic, String serverName) {
|
||||
// Prüfen ob diese exakte Location bereits als Rest-Truhe registriert ist (Update)
|
||||
int slot = getRestSlotForLocation(uuid, world, x, y, z);
|
||||
if (slot < 0) {
|
||||
// Neue Truhe: nächsten freien Slot ermitteln
|
||||
slot = getNextRestSlot(uuid);
|
||||
}
|
||||
setRestChest(uuid, slot, world, x, y, z, isPublic, serverName);
|
||||
}
|
||||
|
||||
/** Vollständige Überladung mit explizitem slot. */
|
||||
public void setRestChest(String uuid, int slot, String world, int x, int y, int z,
|
||||
boolean isPublic, String serverName) {
|
||||
try (PreparedStatement ps = connection.prepareStatement(
|
||||
"REPLACE INTO asc_rest_chests (uuid, slot, world, x, y, z, `public`, server) " +
|
||||
"VALUES (?, ?, ?, ?, ?, ?, ?, ?);")) {
|
||||
ps.setString(1, uuid);
|
||||
ps.setInt(2, slot);
|
||||
ps.setString(3, world);
|
||||
ps.setInt(4, x);
|
||||
ps.setInt(5, y);
|
||||
ps.setInt(6, z);
|
||||
ps.setBoolean(7, isPublic);
|
||||
ps.setString(8, serverName != null ? serverName : "");
|
||||
ps.executeUpdate();
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/** Gibt den nächsten freien Slot für Rest-Truhen zurück. */
|
||||
public int getNextRestSlot(String uuid) {
|
||||
try (PreparedStatement ps = connection.prepareStatement(
|
||||
"SELECT COALESCE(MAX(slot)+1, 0) AS next_slot FROM asc_rest_chests WHERE uuid=?;")) {
|
||||
ps.setString(1, uuid);
|
||||
ResultSet rs = ps.executeQuery();
|
||||
if (rs.next()) return rs.getInt("next_slot");
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gibt den Slot zurück, den diese Location bereits belegt, oder -1 wenn nicht gefunden.
|
||||
*/
|
||||
public int getRestSlotForLocation(String uuid, String world, int x, int y, int z) {
|
||||
try (PreparedStatement ps = connection.prepareStatement(
|
||||
"SELECT slot FROM asc_rest_chests WHERE uuid=? AND world=? AND x=? AND y=? AND z=?;")) {
|
||||
ps.setString(1, uuid);
|
||||
ps.setString(2, world);
|
||||
ps.setInt(3, x);
|
||||
ps.setInt(4, y);
|
||||
ps.setInt(5, z);
|
||||
ResultSet rs = ps.executeQuery();
|
||||
if (rs.next()) return rs.getInt("slot");
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
/** Zählt wie viele Rest-Truhen ein Spieler hat. */
|
||||
public int countRestChests(String uuid) {
|
||||
try (PreparedStatement ps = connection.prepareStatement(
|
||||
"SELECT COUNT(*) FROM asc_rest_chests WHERE uuid=?;")) {
|
||||
ps.setString(1, uuid);
|
||||
ResultSet rs = ps.executeQuery();
|
||||
if (rs.next()) return rs.getInt(1);
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/** Gibt ALLE Rest-Truhen eines Spielers zurück, sortiert nach slot. */
|
||||
public List<Map<String, Object>> getRestChests(String uuid) {
|
||||
List<Map<String, Object>> list = new ArrayList<>();
|
||||
try (PreparedStatement ps = connection.prepareStatement(
|
||||
"SELECT * FROM asc_rest_chests WHERE uuid=? ORDER BY slot ASC;")) {
|
||||
ps.setString(1, uuid);
|
||||
ResultSet rs = ps.executeQuery();
|
||||
while (rs.next()) {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("slot", rs.getInt("slot"));
|
||||
map.put("world", rs.getString("world"));
|
||||
map.put("x", rs.getInt("x"));
|
||||
map.put("y", rs.getInt("y"));
|
||||
map.put("z", rs.getInt("z"));
|
||||
map.put("public", rs.getBoolean("public"));
|
||||
try { map.put("server", rs.getString("server")); }
|
||||
catch (SQLException ignored) { map.put("server", ""); }
|
||||
list.add(map);
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
/** Gibt die erste Rest-Truhe (slot=0) zurück – Legacy-Kompatibilität. */
|
||||
public Map<String, Object> getRestChest(String uuid) {
|
||||
List<Map<String, Object>> all = getRestChests(uuid);
|
||||
return all.isEmpty() ? null : all.get(0);
|
||||
}
|
||||
|
||||
/** Löscht eine spezifische Rest-Truhe anhand ihrer Location. */
|
||||
public void removeRestChestByLocation(String uuid, String world, int x, int y, int z) {
|
||||
try (PreparedStatement ps = connection.prepareStatement(
|
||||
"DELETE FROM asc_rest_chests WHERE uuid=? AND world=? AND x=? AND y=? AND z=?;")) {
|
||||
ps.setString(1, uuid);
|
||||
ps.setString(2, world);
|
||||
ps.setInt(3, x);
|
||||
ps.setInt(4, y);
|
||||
ps.setInt(5, z);
|
||||
ps.executeUpdate();
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
// Slots nach dem gelöschten nach unten schieben um Lücken zu vermeiden
|
||||
compactRestSlots(uuid);
|
||||
}
|
||||
|
||||
/** Löscht eine spezifische Rest-Truhe anhand des Slots. */
|
||||
public void removeRestChestSlot(String uuid, int slot) {
|
||||
try (PreparedStatement ps = connection.prepareStatement(
|
||||
"DELETE FROM asc_rest_chests WHERE uuid=? AND slot=?;")) {
|
||||
ps.setString(1, uuid);
|
||||
ps.setInt(2, slot);
|
||||
ps.executeUpdate();
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
compactRestSlots(uuid);
|
||||
}
|
||||
|
||||
/** Schiebt Rest-Slots nach dem gelöschten nach unten (keine Lücken). */
|
||||
private void compactRestSlots(String uuid) {
|
||||
try {
|
||||
List<Map<String, Object>> remaining = getRestChests(uuid);
|
||||
for (int i = 0; i < remaining.size(); i++) {
|
||||
int currentSlot = (int) remaining.get(i).get("slot");
|
||||
if (currentSlot != i) {
|
||||
try (PreparedStatement ps = connection.prepareStatement(
|
||||
"UPDATE asc_rest_chests SET slot=? WHERE uuid=? AND slot=?;")) {
|
||||
ps.setInt(1, i);
|
||||
ps.setString(2, uuid);
|
||||
ps.setInt(3, currentSlot);
|
||||
ps.executeUpdate();
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/** Löscht ALLE Rest-Truhen eines Spielers. */
|
||||
public void removeRestChest(String uuid) {
|
||||
try (PreparedStatement ps = connection.prepareStatement(
|
||||
"DELETE FROM asc_rest_chests WHERE uuid=?;")) {
|
||||
ps.setString(1, uuid);
|
||||
ps.executeUpdate();
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
// --- Hilfsmethoden für serverCrosslink (unverändert) ---
|
||||
|
||||
public List<Map<String, Object>> getAllInputChests() {
|
||||
List<Map<String, Object>> list = new ArrayList<>();
|
||||
try (PreparedStatement ps = connection.prepareStatement("SELECT * FROM asc_input_chests;")) {
|
||||
ResultSet rs = ps.executeQuery();
|
||||
while (rs.next()) {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("chest_id", rs.getString("chest_id"));
|
||||
map.put("uuid", rs.getString("uuid"));
|
||||
map.put("world", rs.getString("world"));
|
||||
map.put("x", rs.getInt("x"));
|
||||
map.put("y", rs.getInt("y"));
|
||||
map.put("z", rs.getInt("z"));
|
||||
map.put("public", rs.getBoolean("public"));
|
||||
try { map.put("server", rs.getString("server")); }
|
||||
catch (SQLException ignored) { map.put("server", ""); }
|
||||
list.add(map);
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public List<Map<String, Object>> getAllTargetChests() {
|
||||
List<Map<String, Object>> list = new ArrayList<>();
|
||||
try (PreparedStatement ps = connection.prepareStatement("SELECT * FROM asc_target_chests;")) {
|
||||
ResultSet rs = ps.executeQuery();
|
||||
while (rs.next()) {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("item", rs.getString("item"));
|
||||
map.put("uuid", rs.getString("uuid"));
|
||||
map.put("world", rs.getString("world"));
|
||||
map.put("x", rs.getInt("x"));
|
||||
map.put("y", rs.getInt("y"));
|
||||
map.put("z", rs.getInt("z"));
|
||||
map.put("public", rs.getBoolean("public"));
|
||||
try { map.put("server", rs.getString("server")); }
|
||||
catch (SQLException ignored) { map.put("server", ""); }
|
||||
list.add(map);
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public Map<String, Object> getAnyRestChest() {
|
||||
try (PreparedStatement ps = connection.prepareStatement(
|
||||
"SELECT * FROM asc_rest_chests WHERE `public`=1 ORDER BY uuid, slot LIMIT 1;")) {
|
||||
ResultSet rs = ps.executeQuery();
|
||||
if (rs.next()) {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("uuid", rs.getString("uuid"));
|
||||
map.put("slot", rs.getInt("slot"));
|
||||
map.put("world", rs.getString("world"));
|
||||
map.put("x", rs.getInt("x"));
|
||||
map.put("y", rs.getInt("y"));
|
||||
map.put("z", rs.getInt("z"));
|
||||
map.put("public", rs.getBoolean("public"));
|
||||
try { map.put("server", rs.getString("server")); }
|
||||
catch (SQLException ignored) { map.put("server", ""); }
|
||||
return map;
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
77
src/main/java/com/viper/autosortchest/UpdateChecker.java
Normal file
77
src/main/java/com/viper/autosortchest/UpdateChecker.java
Normal file
@@ -0,0 +1,77 @@
|
||||
package com.viper.autosortchest;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.URL;
|
||||
import java.util.Scanner;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
public class UpdateChecker {
|
||||
|
||||
private final JavaPlugin plugin;
|
||||
private final int resourceId;
|
||||
|
||||
public UpdateChecker(JavaPlugin plugin, int resourceId) {
|
||||
this.plugin = plugin;
|
||||
this.resourceId = resourceId;
|
||||
}
|
||||
|
||||
public void getVersion(final Consumer<String> consumer) {
|
||||
Bukkit.getScheduler().runTaskAsynchronously(this.plugin, () -> {
|
||||
try (InputStream is = new URL("https://api.spigotmc.org/legacy/update.php?resource=" + this.resourceId + "/~").openStream();
|
||||
Scanner scann = new Scanner(is)) {
|
||||
if (scann.hasNext()) {
|
||||
consumer.accept(scann.next());
|
||||
}
|
||||
} catch (IOException e) {
|
||||
plugin.getLogger().info("Konnte nicht nach Updates suchen: " + e.getMessage());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Vergleicht zwei Versions-Strings semantisch (z.B. "2.0" vs "1.9").
|
||||
* Gibt true zurück wenn currentVersion NEUER ODER GLEICH latestVersion ist.
|
||||
* Gibt false zurück wenn latestVersion neuer ist (= Update verfügbar).
|
||||
*
|
||||
* Beispiele:
|
||||
* isCurrentVersionUpToDate("2.0", "1.9") → true (wir sind neuer, kein Update nötig)
|
||||
* isCurrentVersionUpToDate("1.9", "1.9") → true (gleich, kein Update nötig)
|
||||
* isCurrentVersionUpToDate("1.8", "1.9") → false (Update verfügbar)
|
||||
*/
|
||||
public static boolean isCurrentVersionUpToDate(String currentVersion, String latestVersion) {
|
||||
try {
|
||||
String[] current = currentVersion.trim().split("[.\\-]");
|
||||
String[] latest = latestVersion.trim().split("[.\\-]");
|
||||
|
||||
int length = Math.max(current.length, latest.length);
|
||||
for (int i = 0; i < length; i++) {
|
||||
int c = i < current.length ? parseVersionPart(current[i]) : 0;
|
||||
int l = i < latest.length ? parseVersionPart(latest[i]) : 0;
|
||||
if (c > l) return true; // Aktuelle Version ist neuer → kein Update nötig
|
||||
if (c < l) return false; // Veröffentlichte Version ist neuer → Update verfügbar
|
||||
}
|
||||
return true; // Versionen sind identisch
|
||||
} catch (Exception e) {
|
||||
// Im Zweifel: kein Update anzeigen um false-positives zu vermeiden
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
private static int parseVersionPart(String part) {
|
||||
try {
|
||||
// Nur die führenden Ziffern parsen (z.B. "1-SNAPSHOT" → 1)
|
||||
StringBuilder digits = new StringBuilder();
|
||||
for (char ch : part.toCharArray()) {
|
||||
if (Character.isDigit(ch)) digits.append(ch);
|
||||
else break;
|
||||
}
|
||||
return digits.length() > 0 ? Integer.parseInt(digits.toString()) : 0;
|
||||
} catch (NumberFormatException e) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,30 +1,205 @@
|
||||
version: "1.4"
|
||||
debug: false
|
||||
# ============================================================
|
||||
# _ _ __ _ ___ _ _
|
||||
# /_\ _ _| |_ ___ / _\ ___ _ __| |_ / __\ |__ ___ ___| |_
|
||||
# //_\\| | | | __/ _ \\ \ / _ \| '__| __|/ / | '_ \ / _ \/ __| __|
|
||||
# / _ \ |_| | || (_) |\ \ (_) | | | |_/ /___| | | | __/\__ \ |_
|
||||
# \_/ \_/\__,_|\__\___/\__/\___/|_| \__\____/|_| |_|\___||___/\__|
|
||||
#
|
||||
# ============================================================
|
||||
|
||||
# --- GRUNDLEGUNG ---
|
||||
# Version der Konfigurationsdatei. Nicht ändern, um Fehler zu vermeiden!
|
||||
|
||||
version: "2.2"
|
||||
|
||||
# Debug-Modus (true = Ausführliche Logs in der Server-Konsole, nur zum Entwickeln nutzen)
|
||||
|
||||
debug: false
|
||||
|
||||
# ---------------------------------------------------
|
||||
# DATENBANK (MySQL/MariaDB) - Optional
|
||||
# ---------------------------------------------------
|
||||
# Aktiviere MySQL/MariaDB Speicherung (true/false)
|
||||
|
||||
mysql:
|
||||
enabled: false
|
||||
host: "localhost"
|
||||
port: 3306
|
||||
database: "autosortchest"
|
||||
user: "autosortchest"
|
||||
password: "autosortchest"
|
||||
|
||||
# Soll serverübergreifendes Sortieren (mit MySQL) erlaubt sein?
|
||||
server_crosslink: true
|
||||
|
||||
# ---------------------------------------------------
|
||||
# BUNGEE CORD / MULTI-SERVER SETUP
|
||||
# ---------------------------------------------------
|
||||
# Eindeutiger Name dieses Servers im BungeeCord-Netzwerk.
|
||||
# WICHTIG: Jeder Server braucht einen anderen Namen!
|
||||
#
|
||||
# Beispiele:
|
||||
# server_name: "lobby"
|
||||
# server_name: "survival"
|
||||
# server_name: "creative"
|
||||
#
|
||||
# Leer lassen = Legacy-Modus (welt-basierte Erkennung, kein BungeeCord).
|
||||
# Fuer BungeeCord MUSS mysql.enabled: true gesetzt sein!
|
||||
#
|
||||
# Setup-Schritte:
|
||||
# 1. Gleiche MySQL-Datenbank auf allen Servern eintragen.
|
||||
# 2. Auf jedem Server einen einzigartigen server_name setzen.
|
||||
# 3. mysql.enabled: true und server_crosslink: true setzen.
|
||||
# 4. Alle Server neu starten - Schema wird automatisch migriert.
|
||||
|
||||
server_name: ""
|
||||
|
||||
# ---------------------------------------------------
|
||||
# SPRACHE (Language)
|
||||
# ---------------------------------------------------
|
||||
# Mögliche Werte: 'de' für Deutsch oder 'en' für Englisch
|
||||
# Ändert den Text von /asc help und /asc info
|
||||
language: "de"
|
||||
|
||||
# ---------------------------------------------------
|
||||
# BLACKLIST FÜR WELTEN (Optional)
|
||||
# ---------------------------------------------------
|
||||
# Welten, in denen AutoSortChest NICHT funktioniert
|
||||
|
||||
world_blacklist:
|
||||
- "world_nether"
|
||||
- "world_the_end"
|
||||
|
||||
# ---------------------------------------------------
|
||||
# VISUELLE EFFEKTE (PARTIKEL & TÖNE)
|
||||
# ---------------------------------------------------
|
||||
|
||||
# Einstellungen für den Regenbogen-Effekt beim Sortieren
|
||||
effects:
|
||||
# Sollen Effekte angezeigt werden?
|
||||
enabled: false
|
||||
# Soll ein Ton gespielt werden, wenn Items ankommen?
|
||||
sound: false
|
||||
# Der Partikel-Typ.
|
||||
# 'DUST' ist zwingend für den bunten Regenbogen-Effekt im aktuellen Code.
|
||||
type: "DUST"
|
||||
|
||||
# ---------------------------------------------------
|
||||
# SORTIER-INTERVALL (Ticks)
|
||||
# ---------------------------------------------------
|
||||
# Wie oft soll sortiert werden? (1 Tick = 0,05s)
|
||||
#
|
||||
# Wähle hier je nach Server-Leistung:
|
||||
#
|
||||
# 1 = SEHR SCHNELL (Items verschwinden sofort)
|
||||
# WARNUNG: Kann bei vielen Truhen Lagg verursachen!
|
||||
#
|
||||
# 5 = SCHNELL (Sehr flüssig, gute Balance)
|
||||
# Empfohlen für schnelle Server.
|
||||
#
|
||||
# 10 = FLÜSSIG (0,5s Verzögerung)
|
||||
# Spart Ressourcen, fühlt sich noch schnell an.
|
||||
#
|
||||
# 20 = STANDARD (1 Sekunde)
|
||||
# Standard-Wert, minimale Last.
|
||||
#
|
||||
# 30+ = SPARSAM (>1,5 Sekunden)
|
||||
# Für sehr große Server mit schwacher Hardware.
|
||||
#
|
||||
|
||||
sort_interval_ticks: 5
|
||||
|
||||
# ---------------------------------------------------
|
||||
# LIMITS FÜR SORTIERKISTEN (Optional)
|
||||
# ---------------------------------------------------
|
||||
# Maximale Anzahl an Sortierkisten pro Spielergruppe
|
||||
|
||||
chest_limits:
|
||||
# Sollen Truhen-Limits aktiv sein? (true = ja, false = keine Beschraenkung)
|
||||
enabled: true
|
||||
|
||||
# Jede Gruppe hat eigene Limits fuer input, rest und target.
|
||||
# Spieler benoetigen die Permission: autosortchest.limit.<gruppe>
|
||||
|
||||
default:
|
||||
input: 1 # Eingangstruhen (Input)
|
||||
rest: 1 # Rest-Truhen (Fallback)
|
||||
target: 50 # Zieltruhen gesamt
|
||||
target_per_item: 1 # Wie viele Zieltruhen pro Item-Typ erlaubt sind
|
||||
|
||||
vip:
|
||||
input: 2
|
||||
rest: 2
|
||||
target: 100
|
||||
target_per_item: 3
|
||||
|
||||
# Weitere Gruppen:
|
||||
# supporter:
|
||||
# input: 3
|
||||
# rest: 2
|
||||
# target: 150
|
||||
# target_per_item: 5
|
||||
# admin:
|
||||
# input: 5
|
||||
# rest: 3
|
||||
# target: 200
|
||||
# target_per_item: 10
|
||||
|
||||
# ---------------------------------------------------
|
||||
# SCHILDFARBEN (Farbcodes wie im Chat)
|
||||
# &c = Rot, &a = Grün, &e = Gelb, &6 = Gold, &f = Weiß, &0 = Schwarz
|
||||
# ---------------------------------------------------
|
||||
|
||||
sign-colors:
|
||||
# Farben für die Eingangstruhe ([asc] / input)
|
||||
input:
|
||||
line1: "&6" # Zeile 1: [asc]
|
||||
line2: "&0" # Zeile 2: input
|
||||
line4: "&1" # Zeile 4: Spielername
|
||||
|
||||
# Farben für die Zieltruhe ([asc] / ziel)
|
||||
target:
|
||||
line1: "&6" # Zeile 1: [asc]
|
||||
line2: "&0" # Zeile 2: ziel
|
||||
line3: "&f" # Zeile 3: Item-Name
|
||||
line4: "&1" # Zeile 4: Spielername
|
||||
|
||||
# Farben für volle Truhen (Automatische Erkennung)
|
||||
full:
|
||||
line1: "&c" # Zeile 1: [asc]
|
||||
line2: "&4" # Zeile 2: ziel / rest (Rot)
|
||||
line3: "&e" # Zeile 3: Item-Name (Gelb)
|
||||
line4: "&1" # Zeile 4: Spielername
|
||||
|
||||
# Farben für die Rest-Truhe ([asc] / rest)
|
||||
rest:
|
||||
line1: "&6" # Zeile 1: [asc]
|
||||
line2: "&0" # Zeile 2: rest
|
||||
line3: "&f" # Zeile 3: (Leer)
|
||||
line4: "&1" # Zeile 4: Spielername
|
||||
|
||||
# ---------------------------------------------------
|
||||
# SYSTEM NACHRICHTEN (Spieler-Feedback)
|
||||
# Platzhalter: %player%, %item%, %x%, %y%, %z%, %mode%
|
||||
# ---------------------------------------------------
|
||||
|
||||
messages:
|
||||
# --- FEHLERMELDUNGEN ---
|
||||
no-chest-near-sign: "&cKeine Truhe in der Nähe des Schildes!"
|
||||
no-item-in-hand: "&cDu musst ein Item in der Hand halten!"
|
||||
not-your-chest: "&cDiese Truhe gehört dir nicht!"
|
||||
target-chest-missing: "&cZieltruhe für %item% fehlt!"
|
||||
sign-break-denied: "&cDu musst Shift gedrückt halten, um dieses Schild oder die Truhe abzubauen!"
|
||||
no-permission: "&cDu hast keine Berechtigung für diesen Befehl!"
|
||||
|
||||
# --- ERFOLGSMELDUNGEN ---
|
||||
input-chest-set: "&aEingangstruhe erfolgreich gesetzt!"
|
||||
target-chest-set: "&aZieltruhe erfolgreich für %item% eingerichtet!"
|
||||
target-chest-missing: "&cZieltruhe für %item% fehlt!"
|
||||
target-chest-full: "&cZieltruhe für %item% ist voll! Koordinaten: (%x%, %y%, %z%)"
|
||||
help: "&6&l=== AutoSortChest Hilfe ===\n&eEingangstruhe erstellen:\n&f1. Platziere ein Schild an einer Truhe.\n&f2. Schreibe:\n &7[asc]\n &7input\n&fDein Name wird automatisch in Zeile 4 eingetragen.\n&eZieltruhe erstellen:\n&f1. Platziere ein Schild an einer Truhe.\n&f2. Schreibe:\n &7[asc]\n &7ziel\n&f3. Rechtsklicke mit einem Item in der Hand.\n&eBefehle:\n&f- &b/asc help &f- Zeigt diese Hilfe.\n&f- &b/asc info &f- Zeigt Plugin-Informationen.\n&f- &b/asc reload &f- Lädt die Konfiguration neu (OP).\n&6&l===================="
|
||||
info: "&6&l=== AutoSortChest Info ===\n&ePlugin: &fAutoSortChest\n&eVersion: &f%version%\n&eKonfigurationsversion: &f%config_version%\n&eErsteller: &f%author%\n&eBeschreibung: &fAutomatisches Sortieren von Items in Truhen.\n&6&l===================="
|
||||
no-permission: "&cDu hast keine Berechtigung für diesen Befehl!"
|
||||
rest-chest-set: "&aRest-Truhe (Fallback) erfolgreich gesetzt!"
|
||||
reload-success: "&aKonfiguration erfolgreich neu geladen!"
|
||||
sign-break-denied: "&cDu musst Shift gedrückt halten, um dieses Schild oder die Truhe abzubauen!"
|
||||
sign-colors:
|
||||
input:
|
||||
line1: "&6" # [asc]
|
||||
line2: "&0" # input
|
||||
line4: "&1" # Spielername
|
||||
target:
|
||||
line1: "&6" # [asc]
|
||||
line2: "&0" # ziel
|
||||
line3: "&f" # Item
|
||||
line4: "&1" # Spielername
|
||||
full:
|
||||
line1: "&c" # [asc] für volle Truhe
|
||||
line2: "&4" # ziel für volle Truhe
|
||||
line3: "&e" # Item für volle Truhe
|
||||
line4: "&1" # Spielername
|
||||
|
||||
# --- HINWEIS MELDUNGEN ---
|
||||
target-chest-full: "&cZieltruhe für %item% ist voll! Koordinaten: (%x%, %y%, %z%)"
|
||||
mode-changed: "&aModus gewechselt: &e%mode%"
|
||||
mode-public: "&aÖffentlich"
|
||||
mode-private: "&cPrivat"
|
||||
@@ -1,5 +1,5 @@
|
||||
name: AutoSortChest
|
||||
version: 1.4
|
||||
version: 2.3
|
||||
main: com.viper.autosortchest.Main
|
||||
api-version: 1.21
|
||||
authors: [M_Viper]
|
||||
@@ -7,12 +7,27 @@ description: Ein Plugin zum automatischen Sortieren von Items in Truhen
|
||||
commands:
|
||||
asc:
|
||||
description: AutoSortChest Befehle
|
||||
usage: /<command> [help|info|reload]
|
||||
usage: /<command> [help|info|reload|import|export]
|
||||
aliases: [autosortchest]
|
||||
permissions:
|
||||
autosortchest.reload:
|
||||
description: Erlaubt das Neuladen der Konfiguration mit /asc reload
|
||||
default: op
|
||||
autosortchest.import:
|
||||
description: Erlaubt den Import von players.yml nach MySQL mit /asc import
|
||||
default: op
|
||||
autosortchest.export:
|
||||
description: Erlaubt den Export von MySQL nach players.yml mit /asc export
|
||||
default: op
|
||||
autosortchest.bypass:
|
||||
description: Erlaubt das Abbauen von ASC-Schildern ohne Shift-Taste und unabhängig vom Besitzer
|
||||
default: op
|
||||
default: op
|
||||
autosortchest.admin:
|
||||
description: Erlaubt OPs/Admins Zugriff auf fremde AutoSortChest-Truhen (Öffnen, Entnehmen, Abbauen)
|
||||
default: op
|
||||
autosortchest.limit.<gruppe>:
|
||||
description: >
|
||||
Limits fuer eine benutzerdefinierte Gruppe aus der config.yml.
|
||||
Ersetze <gruppe> durch den Gruppennamen (z.B. autosortchest.limit.vip).
|
||||
Die Gruppen und ihre Limits werden ausschliesslich in der config.yml definiert.
|
||||
default: false
|
||||
Reference in New Issue
Block a user