9
0
mirror of https://github.com/WiIIiam278/HuskSync.git synced 2025-12-28 19:19:13 +00:00

Compare commits

...

16 Commits
2.2.5 ... 2.2.8

Author SHA1 Message Date
William
bd83c8935d Tweak database connection confirmation messages 2023-07-28 21:38:10 +01:00
William
62095364ce 2.2.8: Explicitly specify MariaDB Driver class name 2023-07-28 21:25:23 +01:00
William
304df9984c [ci skip] Bump to 2.2.7 2023-07-28 19:44:09 +01:00
William
b73de81519 Add missing Maria schema 2023-07-28 19:41:42 +01:00
William
12e882fe22 v2.2.6: Crafting inventory safety, Maria v11 support (#153)
* Clear player inventory crafting slots on sync

* Bundle Maria driver for v11 support
2023-07-28 16:50:52 +01:00
William
4ed8b94d55 docs: explicitly state compatibility with custom item plugins 2023-07-28 13:58:12 +01:00
dependabot[bot]
854bf37186 Bump org.junit.jupiter:junit-jupiter-api from 5.9.3 to 5.10.0 (#149)
Bumps [org.junit.jupiter:junit-jupiter-api](https://github.com/junit-team/junit5) from 5.9.3 to 5.10.0.
- [Release notes](https://github.com/junit-team/junit5/releases)
- [Commits](https://github.com/junit-team/junit5/compare/r5.9.3...r5.10.0)

---
updated-dependencies:
- dependency-name: org.junit.jupiter:junit-jupiter-api
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-07-24 19:38:08 +01:00
dependabot[bot]
8bab2a8123 Bump org.junit.jupiter:junit-jupiter-engine from 5.9.3 to 5.10.0 (#150)
Bumps [org.junit.jupiter:junit-jupiter-engine](https://github.com/junit-team/junit5) from 5.9.3 to 5.10.0.
- [Release notes](https://github.com/junit-team/junit5/releases)
- [Commits](https://github.com/junit-team/junit5/compare/r5.9.3...r5.10.0)

---
updated-dependencies:
- dependency-name: org.junit.jupiter:junit-jupiter-engine
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-07-24 19:37:29 +01:00
Joo200
97ad608d56 Add mariadb protocol option type (#145)
Co-authored-by: William <will27528@gmail.com>
2023-07-01 13:54:30 +01:00
William
f7419f7277 [ci skip] Update README footer 2023-07-01 13:43:54 +01:00
William
f0497f61f0 [ci skip] Update README headings 2023-07-01 13:43:06 +01:00
William
f6aab54d4d license: Relicense under Apache-2.0 2023-07-01 13:39:48 +01:00
kFor
c306d700ce Option to blacklist all commands (#138)
* Option to blacklist all commands

* blacklist all commands by default

---------

Co-authored-by: William <will27528@gmail.com>
2023-06-22 11:25:17 +01:00
Rafael Romão
bbcb091daf Fix locked map data saving (#140) 2023-06-21 10:45:17 +01:00
William
eb9e2491e5 docs: Fix songoda links 2023-06-11 13:13:23 +01:00
William
0250ad80c8 docs: Use new repo 2023-06-11 13:08:23 +01:00
91 changed files with 1500 additions and 725 deletions

20
HEADER
View File

@@ -1,10 +1,16 @@
This file is part of HuskSync by William278. Do not redistribute! This file is part of HuskSync, licensed under the Apache License 2.0.
Copyright (c) William278 <will27528@gmail.com> Copyright (c) William278 <will27528@gmail.com>
All rights reserved. Copyright (c) contributors
This source code is provided as reference to licensed individuals that have purchased the HuskSync Licensed under the Apache License, Version 2.0 (the "License");
plugin once from any of the official sources it is provided. The availability of this code does you may not use this file except in compliance with the License.
not grant you the rights to modify, re-distribute, compile or redistribute this source code or You may obtain a copy of the License at
"plugin" outside this intended purpose. This license does not cover libraries developed by third
parties that are utilised in the plugin. http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

217
LICENSE
View File

@@ -1,21 +1,202 @@
Copyright © William278 2023. All rights reserved
LICENSE Apache License
This source code is provided as reference to licensed individuals that have purchased the HuskSync Version 2.0, January 2004
plugin once from any of the official sources it is provided. The availability of this code does http://www.apache.org/licenses/
not grant you the rights to modify, re-distribute, compile or redistribute this source code or
"plugin" outside this intended purpose. This license does not cover libraries developed by third
parties that are utilised in the plugin.
CONTRIBUTOR AGREEMENT TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
By contributing code to this repository, contributors agree that they forfeit their contributions
to the copyright holder and only the copyright holder.
In exchange for contributing, the copyright holder may give, at their discretion, permission to use
the plugin in commercial contexts
DEFINITIONS 1. Definitions.
"plugin"; the jar file compiled from this source code
"source code"; the java source code and gradle configurations provided in this repository, however "License" shall mean the terms and conditions for use, reproduction,
excludes libraries and distribution as defined by Sections 1 through 9 of this document.
"copyright holder"; William278
"contributor(s)"; person(s) who submit (contribute) code through a pull request to this repository "Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

View File

@@ -51,22 +51,24 @@ Requires a MySQL (v8.0+) database, a Redis (v5.0+) server and any number of Spig
3. Navigate to the HuskSync config file on each server (~/plugins/HuskSync/config.yml) and fill in both the MySQL and Redis database credentials. 3. Navigate to the HuskSync config file on each server (~/plugins/HuskSync/config.yml) and fill in both the MySQL and Redis database credentials.
4. Start every server again and synchronization will begin. 4. Start every server again and synchronization will begin.
## Building ## Development
To build HuskSync, simply run the following in the root of the repository: To build HuskSync, simply run the following in the root of the repository:
```bash ```bash
./gradlew clean build ./gradlew clean build
``` ```
## License ### License
HuskSync is a premium resource. This source code is provided as reference only for those who have purchased the resource from an official source. HuskSync is licensed under the Apache 2.0 license.
- [License](https://github.com/WiIIiam278/HuskSync/blob/master/LICENSE) - [License](https://github.com/WiIIiam278/HuskSync/blob/master/LICENSE)
## Contributing Contributions to the project are welcome&mdash;feel free to open a pull request with new features, improvements and/or fixes!
A code bounty program is in place for HuskSync, where developers making significant code contributions to HuskSync may be entitled to a license at my discretion to use HuskSync in commercial contexts without having to purchase the resource. Please read the information for contributors in the LICENSE file before submitting a pull request.
## Translations ### Support
Due to its complexity, official support for HuskSync is provided through a paid model. This means that support is only available to users who have purchased a license to the plugin from Spigot, Polymart, or Craftaro and have provided proof of purchase. Please join our Discord server if you have done so and need help!
### Translations
Translations of the plugin locales are welcome to help make the plugin more accessible. Please submit a pull request with your translations as a `.yml` file. Translations of the plugin locales are welcome to help make the plugin more accessible. Please submit a pull request with your translations as a `.yml` file.
- [Locales Directory](https://github.com/WiIIiam278/HuskSync/tree/master/common/src/main/resources/languages) - [Locales Directory](https://github.com/WiIIiam278/HuskSync/tree/master/common/src/main/resources/languages)
@@ -74,10 +76,10 @@ Translations of the plugin locales are welcome to help make the plugin more acce
## Links ## Links
- [Docs](https://william278.net/docs/husksync/) &mdash; Read the plugin documentation! - [Docs](https://william278.net/docs/husksync/) &mdash; Read the plugin documentation!
- [Spigot](https://www.spigotmc.org/resources/husksync.97144/) &mdash; View the Spigot resource page (Also: [Polymart](https://polymart.org/resource/husksync.1634), [Craftaro](https://craftaro.com/marketplace/product/husksync.406)) - [Spigot](https://www.spigotmc.org/resources/husksync.97144/) &mdash; View the Spigot resource page (Also: [Polymart](https://polymart.org/resource/husksync.1634), [Craftaro](https://craftaro.com/marketplace/product/husksync.758))
- [Issues](https://github.com/WiIIiam278/HuskSync/issues) &mdash; File a bug report or feature request - [Issues](https://github.com/WiIIiam278/HuskSync/issues) &mdash; File a bug report or feature request
- [Discord](https://discord.gg/tVYhJfyDWG) &mdash; Get help, ask questions (Proof of purchase required) - [Discord](https://discord.gg/tVYhJfyDWG) &mdash; Get help, ask questions (Purchase required)
- [bStats](https://bstats.org/plugin/bukkit/HuskSync%20-%20Bukkit/13140) &mdash; View plugin metrics - [bStats](https://bstats.org/plugin/bukkit/HuskSync%20-%20Bukkit/13140) &mdash; View plugin metrics
--- ---
&copy; [William278](https://william278.net/), 2023. All rights reserved. &copy; [William278](https://william278.net/), 2023. Licensed under the Apache-2.0 License.

View File

@@ -14,8 +14,10 @@ defaultTasks 'licenseFormat', 'build'
ext { ext {
set 'version', version.toString() set 'version', version.toString()
set 'description', description.toString() set 'description', description.toString()
set 'jedis_version', jedis_version.toString() set 'jedis_version', jedis_version.toString()
set 'mysql_driver_version', mysql_driver_version.toString() set 'mysql_driver_version', mysql_driver_version.toString()
set 'mariadb_driver_version', mariadb_driver_version.toString()
set 'snappy_version', snappy_version.toString() set 'snappy_version', snappy_version.toString()
set 'commons_text_version', commons_text_version.toString() set 'commons_text_version', commons_text_version.toString()
} }
@@ -46,8 +48,8 @@ allprojects {
} }
dependencies { dependencies {
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.9.3' testImplementation 'org.junit.jupiter:junit-jupiter-api:5.10.0'
testImplementation 'org.junit.jupiter:junit-jupiter-engine:5.9.3' testImplementation 'org.junit.jupiter:junit-jupiter-engine:5.10.0'
} }
test { test {

View File

@@ -1,14 +1,20 @@
/* /*
* This file is part of HuskSync by William278. Do not redistribute! * This file is part of HuskSync, licensed under the Apache License 2.0.
* *
* Copyright (c) William278 <will27528@gmail.com> * Copyright (c) William278 <will27528@gmail.com>
* All rights reserved. * Copyright (c) contributors
* *
* This source code is provided as reference to licensed individuals that have purchased the HuskSync * Licensed under the Apache License, Version 2.0 (the "License");
* plugin once from any of the official sources it is provided. The availability of this code does * you may not use this file except in compliance with the License.
* not grant you the rights to modify, re-distribute, compile or redistribute this source code or * You may obtain a copy of the License at
* "plugin" outside this intended purpose. This license does not cover libraries developed by third *
* parties that are utilised in the plugin. * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/ */
package net.william278.husksync; package net.william278.husksync;
@@ -124,10 +130,12 @@ public class BukkitHuskSync extends JavaPlugin implements HuskSync {
// Prepare database connection // Prepare database connection
this.database = new MySqlDatabase(this); this.database = new MySqlDatabase(this);
log(Level.INFO, "Attempting to establish connection to the database..."); log(Level.INFO, String.format("Attempting to establish connection to the %s database...",
initialized.set(this.database.initialize()); settings.getDatabaseType().getDisplayName()));
this.database.initialize();
if (initialized.get()) { if (initialized.get()) {
log(Level.INFO, "Successfully established a connection to the database"); log(Level.INFO, String.format("Successfully established a connection to the %s database",
settings.getDatabaseType().getDisplayName()));
} else { } else {
throw new HuskSyncInitializationException("Failed to establish a connection to the database. " + throw new HuskSyncInitializationException("Failed to establish a connection to the database. " +
"Please check the supplied database credentials in the config file"); "Please check the supplied database credentials in the config file");
@@ -189,7 +197,7 @@ public class BukkitHuskSync extends JavaPlugin implements HuskSync {
"An update is available for HuskSync, v" + newVersion "An update is available for HuskSync, v" + newVersion
+ " (Currently running v" + getPluginVersion() + ")"))); + " (Currently running v" + getPluginVersion() + ")")));
} }
} catch (HuskSyncInitializationException exception) { } catch (IllegalStateException exception) {
log(Level.SEVERE, """ log(Level.SEVERE, """
*************************************************** ***************************************************

View File

@@ -1,14 +1,20 @@
/* /*
* This file is part of HuskSync by William278. Do not redistribute! * This file is part of HuskSync, licensed under the Apache License 2.0.
* *
* Copyright (c) William278 <will27528@gmail.com> * Copyright (c) William278 <will27528@gmail.com>
* All rights reserved. * Copyright (c) contributors
* *
* This source code is provided as reference to licensed individuals that have purchased the HuskSync * Licensed under the Apache License, Version 2.0 (the "License");
* plugin once from any of the official sources it is provided. The availability of this code does * you may not use this file except in compliance with the License.
* not grant you the rights to modify, re-distribute, compile or redistribute this source code or * You may obtain a copy of the License at
* "plugin" outside this intended purpose. This license does not cover libraries developed by third *
* parties that are utilised in the plugin. * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/ */
package net.william278.husksync.api; package net.william278.husksync.api;

View File

@@ -1,14 +1,20 @@
/* /*
* This file is part of HuskSync by William278. Do not redistribute! * This file is part of HuskSync, licensed under the Apache License 2.0.
* *
* Copyright (c) William278 <will27528@gmail.com> * Copyright (c) William278 <will27528@gmail.com>
* All rights reserved. * Copyright (c) contributors
* *
* This source code is provided as reference to licensed individuals that have purchased the HuskSync * Licensed under the Apache License, Version 2.0 (the "License");
* plugin once from any of the official sources it is provided. The availability of this code does * you may not use this file except in compliance with the License.
* not grant you the rights to modify, re-distribute, compile or redistribute this source code or * You may obtain a copy of the License at
* "plugin" outside this intended purpose. This license does not cover libraries developed by third *
* parties that are utilised in the plugin. * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/ */
package net.william278.husksync.command; package net.william278.husksync.command;

View File

@@ -1,14 +1,20 @@
/* /*
* This file is part of HuskSync by William278. Do not redistribute! * This file is part of HuskSync, licensed under the Apache License 2.0.
* *
* Copyright (c) William278 <will27528@gmail.com> * Copyright (c) William278 <will27528@gmail.com>
* All rights reserved. * Copyright (c) contributors
* *
* This source code is provided as reference to licensed individuals that have purchased the HuskSync * Licensed under the Apache License, Version 2.0 (the "License");
* plugin once from any of the official sources it is provided. The availability of this code does * you may not use this file except in compliance with the License.
* not grant you the rights to modify, re-distribute, compile or redistribute this source code or * You may obtain a copy of the License at
* "plugin" outside this intended purpose. This license does not cover libraries developed by third *
* parties that are utilised in the plugin. * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/ */
package net.william278.husksync.command; package net.william278.husksync.command;

View File

@@ -1,14 +1,20 @@
/* /*
* This file is part of HuskSync by William278. Do not redistribute! * This file is part of HuskSync, licensed under the Apache License 2.0.
* *
* Copyright (c) William278 <will27528@gmail.com> * Copyright (c) William278 <will27528@gmail.com>
* All rights reserved. * Copyright (c) contributors
* *
* This source code is provided as reference to licensed individuals that have purchased the HuskSync * Licensed under the Apache License, Version 2.0 (the "License");
* plugin once from any of the official sources it is provided. The availability of this code does * you may not use this file except in compliance with the License.
* not grant you the rights to modify, re-distribute, compile or redistribute this source code or * You may obtain a copy of the License at
* "plugin" outside this intended purpose. This license does not cover libraries developed by third *
* parties that are utilised in the plugin. * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/ */
package net.william278.husksync.command; package net.william278.husksync.command;

View File

@@ -1,14 +1,20 @@
/* /*
* This file is part of HuskSync by William278. Do not redistribute! * This file is part of HuskSync, licensed under the Apache License 2.0.
* *
* Copyright (c) William278 <will27528@gmail.com> * Copyright (c) William278 <will27528@gmail.com>
* All rights reserved. * Copyright (c) contributors
* *
* This source code is provided as reference to licensed individuals that have purchased the HuskSync * Licensed under the Apache License, Version 2.0 (the "License");
* plugin once from any of the official sources it is provided. The availability of this code does * you may not use this file except in compliance with the License.
* not grant you the rights to modify, re-distribute, compile or redistribute this source code or * You may obtain a copy of the License at
* "plugin" outside this intended purpose. This license does not cover libraries developed by third *
* parties that are utilised in the plugin. * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/ */
package net.william278.husksync.data; package net.william278.husksync.data;

View File

@@ -1,14 +1,20 @@
/* /*
* This file is part of HuskSync by William278. Do not redistribute! * This file is part of HuskSync, licensed under the Apache License 2.0.
* *
* Copyright (c) William278 <will27528@gmail.com> * Copyright (c) William278 <will27528@gmail.com>
* All rights reserved. * Copyright (c) contributors
* *
* This source code is provided as reference to licensed individuals that have purchased the HuskSync * Licensed under the Apache License, Version 2.0 (the "License");
* plugin once from any of the official sources it is provided. The availability of this code does * you may not use this file except in compliance with the License.
* not grant you the rights to modify, re-distribute, compile or redistribute this source code or * You may obtain a copy of the License at
* "plugin" outside this intended purpose. This license does not cover libraries developed by third *
* parties that are utilised in the plugin. * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/ */
package net.william278.husksync.data; package net.william278.husksync.data;
@@ -29,6 +35,7 @@ import org.jetbrains.annotations.Nullable;
import java.awt.*; import java.awt.*;
import java.io.IOException; import java.io.IOException;
import java.util.Objects; import java.util.Objects;
import java.util.concurrent.ExecutionException;
import java.util.logging.Level; import java.util.logging.Level;
/** /**
@@ -55,8 +62,14 @@ public class BukkitMapHandler {
} }
// Get the map view from the map // Get the map view from the map
final MapView mapView = mapMeta.getMapView(); final MapView mapView;
if (mapView == null || !mapView.isLocked() || mapView.isVirtual()) { try {
mapView = Bukkit.getScheduler().callSyncMethod(plugin, mapMeta::getMapView).get();
if (mapView == null || !mapView.isLocked() || mapView.isVirtual()) {
return;
}
} catch (InterruptedException | ExecutionException e) {
plugin.getLogger().log(Level.WARNING, "Failed to save map data for a player", e);
return; return;
} }

View File

@@ -1,14 +1,20 @@
/* /*
* This file is part of HuskSync by William278. Do not redistribute! * This file is part of HuskSync, licensed under the Apache License 2.0.
* *
* Copyright (c) William278 <will27528@gmail.com> * Copyright (c) William278 <will27528@gmail.com>
* All rights reserved. * Copyright (c) contributors
* *
* This source code is provided as reference to licensed individuals that have purchased the HuskSync * Licensed under the Apache License, Version 2.0 (the "License");
* plugin once from any of the official sources it is provided. The availability of this code does * you may not use this file except in compliance with the License.
* not grant you the rights to modify, re-distribute, compile or redistribute this source code or * You may obtain a copy of the License at
* "plugin" outside this intended purpose. This license does not cover libraries developed by third *
* parties that are utilised in the plugin. * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/ */
package net.william278.husksync.data; package net.william278.husksync.data;

View File

@@ -1,14 +1,20 @@
/* /*
* This file is part of HuskSync by William278. Do not redistribute! * This file is part of HuskSync, licensed under the Apache License 2.0.
* *
* Copyright (c) William278 <will27528@gmail.com> * Copyright (c) William278 <will27528@gmail.com>
* All rights reserved. * Copyright (c) contributors
* *
* This source code is provided as reference to licensed individuals that have purchased the HuskSync * Licensed under the Apache License, Version 2.0 (the "License");
* plugin once from any of the official sources it is provided. The availability of this code does * you may not use this file except in compliance with the License.
* not grant you the rights to modify, re-distribute, compile or redistribute this source code or * You may obtain a copy of the License at
* "plugin" outside this intended purpose. This license does not cover libraries developed by third *
* parties that are utilised in the plugin. * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/ */
package net.william278.husksync.data; package net.william278.husksync.data;

View File

@@ -1,14 +1,20 @@
/* /*
* This file is part of HuskSync by William278. Do not redistribute! * This file is part of HuskSync, licensed under the Apache License 2.0.
* *
* Copyright (c) William278 <will27528@gmail.com> * Copyright (c) William278 <will27528@gmail.com>
* All rights reserved. * Copyright (c) contributors
* *
* This source code is provided as reference to licensed individuals that have purchased the HuskSync * Licensed under the Apache License, Version 2.0 (the "License");
* plugin once from any of the official sources it is provided. The availability of this code does * you may not use this file except in compliance with the License.
* not grant you the rights to modify, re-distribute, compile or redistribute this source code or * You may obtain a copy of the License at
* "plugin" outside this intended purpose. This license does not cover libraries developed by third *
* parties that are utilised in the plugin. * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/ */
package net.william278.husksync.event; package net.william278.husksync.event;

View File

@@ -1,14 +1,20 @@
/* /*
* This file is part of HuskSync by William278. Do not redistribute! * This file is part of HuskSync, licensed under the Apache License 2.0.
* *
* Copyright (c) William278 <will27528@gmail.com> * Copyright (c) William278 <will27528@gmail.com>
* All rights reserved. * Copyright (c) contributors
* *
* This source code is provided as reference to licensed individuals that have purchased the HuskSync * Licensed under the Apache License, Version 2.0 (the "License");
* plugin once from any of the official sources it is provided. The availability of this code does * you may not use this file except in compliance with the License.
* not grant you the rights to modify, re-distribute, compile or redistribute this source code or * You may obtain a copy of the License at
* "plugin" outside this intended purpose. This license does not cover libraries developed by third *
* parties that are utilised in the plugin. * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/ */
package net.william278.husksync.event; package net.william278.husksync.event;

View File

@@ -1,14 +1,20 @@
/* /*
* This file is part of HuskSync by William278. Do not redistribute! * This file is part of HuskSync, licensed under the Apache License 2.0.
* *
* Copyright (c) William278 <will27528@gmail.com> * Copyright (c) William278 <will27528@gmail.com>
* All rights reserved. * Copyright (c) contributors
* *
* This source code is provided as reference to licensed individuals that have purchased the HuskSync * Licensed under the Apache License, Version 2.0 (the "License");
* plugin once from any of the official sources it is provided. The availability of this code does * you may not use this file except in compliance with the License.
* not grant you the rights to modify, re-distribute, compile or redistribute this source code or * You may obtain a copy of the License at
* "plugin" outside this intended purpose. This license does not cover libraries developed by third *
* parties that are utilised in the plugin. * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/ */
package net.william278.husksync.event; package net.william278.husksync.event;

View File

@@ -1,14 +1,20 @@
/* /*
* This file is part of HuskSync by William278. Do not redistribute! * This file is part of HuskSync, licensed under the Apache License 2.0.
* *
* Copyright (c) William278 <will27528@gmail.com> * Copyright (c) William278 <will27528@gmail.com>
* All rights reserved. * Copyright (c) contributors
* *
* This source code is provided as reference to licensed individuals that have purchased the HuskSync * Licensed under the Apache License, Version 2.0 (the "License");
* plugin once from any of the official sources it is provided. The availability of this code does * you may not use this file except in compliance with the License.
* not grant you the rights to modify, re-distribute, compile or redistribute this source code or * You may obtain a copy of the License at
* "plugin" outside this intended purpose. This license does not cover libraries developed by third *
* parties that are utilised in the plugin. * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/ */
package net.william278.husksync.event; package net.william278.husksync.event;

View File

@@ -1,14 +1,20 @@
/* /*
* This file is part of HuskSync by William278. Do not redistribute! * This file is part of HuskSync, licensed under the Apache License 2.0.
* *
* Copyright (c) William278 <will27528@gmail.com> * Copyright (c) William278 <will27528@gmail.com>
* All rights reserved. * Copyright (c) contributors
* *
* This source code is provided as reference to licensed individuals that have purchased the HuskSync * Licensed under the Apache License, Version 2.0 (the "License");
* plugin once from any of the official sources it is provided. The availability of this code does * you may not use this file except in compliance with the License.
* not grant you the rights to modify, re-distribute, compile or redistribute this source code or * You may obtain a copy of the License at
* "plugin" outside this intended purpose. This license does not cover libraries developed by third *
* parties that are utilised in the plugin. * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/ */
package net.william278.husksync.event; package net.william278.husksync.event;

View File

@@ -1,14 +1,20 @@
/* /*
* This file is part of HuskSync by William278. Do not redistribute! * This file is part of HuskSync, licensed under the Apache License 2.0.
* *
* Copyright (c) William278 <will27528@gmail.com> * Copyright (c) William278 <will27528@gmail.com>
* All rights reserved. * Copyright (c) contributors
* *
* This source code is provided as reference to licensed individuals that have purchased the HuskSync * Licensed under the Apache License, Version 2.0 (the "License");
* plugin once from any of the official sources it is provided. The availability of this code does * you may not use this file except in compliance with the License.
* not grant you the rights to modify, re-distribute, compile or redistribute this source code or * You may obtain a copy of the License at
* "plugin" outside this intended purpose. This license does not cover libraries developed by third *
* parties that are utilised in the plugin. * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/ */
package net.william278.husksync.event; package net.william278.husksync.event;

View File

@@ -1,14 +1,20 @@
/* /*
* This file is part of HuskSync by William278. Do not redistribute! * This file is part of HuskSync, licensed under the Apache License 2.0.
* *
* Copyright (c) William278 <will27528@gmail.com> * Copyright (c) William278 <will27528@gmail.com>
* All rights reserved. * Copyright (c) contributors
* *
* This source code is provided as reference to licensed individuals that have purchased the HuskSync * Licensed under the Apache License, Version 2.0 (the "License");
* plugin once from any of the official sources it is provided. The availability of this code does * you may not use this file except in compliance with the License.
* not grant you the rights to modify, re-distribute, compile or redistribute this source code or * You may obtain a copy of the License at
* "plugin" outside this intended purpose. This license does not cover libraries developed by third *
* parties that are utilised in the plugin. * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/ */
package net.william278.husksync.listener; package net.william278.husksync.listener;

View File

@@ -1,14 +1,20 @@
/* /*
* This file is part of HuskSync by William278. Do not redistribute! * This file is part of HuskSync, licensed under the Apache License 2.0.
* *
* Copyright (c) William278 <will27528@gmail.com> * Copyright (c) William278 <will27528@gmail.com>
* All rights reserved. * Copyright (c) contributors
* *
* This source code is provided as reference to licensed individuals that have purchased the HuskSync * Licensed under the Apache License, Version 2.0 (the "License");
* plugin once from any of the official sources it is provided. The availability of this code does * you may not use this file except in compliance with the License.
* not grant you the rights to modify, re-distribute, compile or redistribute this source code or * You may obtain a copy of the License at
* "plugin" outside this intended purpose. This license does not cover libraries developed by third *
* parties that are utilised in the plugin. * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/ */
package net.william278.husksync.listener; package net.william278.husksync.listener;
@@ -34,6 +40,7 @@ import org.bukkit.event.entity.PlayerDeathEvent;
import org.bukkit.event.entity.ProjectileLaunchEvent; import org.bukkit.event.entity.ProjectileLaunchEvent;
import org.bukkit.event.inventory.InventoryClickEvent; import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.event.inventory.InventoryOpenEvent; import org.bukkit.event.inventory.InventoryOpenEvent;
import org.bukkit.event.inventory.PrepareItemCraftEvent;
import org.bukkit.event.player.PlayerCommandPreprocessEvent; import org.bukkit.event.player.PlayerCommandPreprocessEvent;
import org.bukkit.event.player.PlayerDropItemEvent; import org.bukkit.event.player.PlayerDropItemEvent;
import org.bukkit.event.player.PlayerInteractEntityEvent; import org.bukkit.event.player.PlayerInteractEntityEvent;
@@ -166,6 +173,10 @@ public class BukkitEventListener extends EventListener implements BukkitJoinEven
event.setCancelled(cancelPlayerEvent(event.getWhoClicked().getUniqueId())); event.setCancelled(cancelPlayerEvent(event.getWhoClicked().getUniqueId()));
} }
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onCraftItem(@NotNull PrepareItemCraftEvent event) {
}
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onPlayerTakeDamage(@NotNull EntityDamageEvent event) { public void onPlayerTakeDamage(@NotNull EntityDamageEvent event) {
if (event.getEntity() instanceof Player player) { if (event.getEntity() instanceof Player player) {
@@ -178,7 +189,7 @@ public class BukkitEventListener extends EventListener implements BukkitJoinEven
String[] commandArgs = event.getMessage().substring(1).split(" "); String[] commandArgs = event.getMessage().substring(1).split(" ");
String commandLabel = commandArgs[0].toLowerCase(Locale.ENGLISH); String commandLabel = commandArgs[0].toLowerCase(Locale.ENGLISH);
if (blacklistedCommands.contains(commandLabel)) { if (blacklistedCommands.contains("*") || blacklistedCommands.contains(commandLabel)) {
event.setCancelled(cancelPlayerEvent(event.getPlayer().getUniqueId())); event.setCancelled(cancelPlayerEvent(event.getPlayer().getUniqueId()));
} }
} }

View File

@@ -1,14 +1,20 @@
/* /*
* This file is part of HuskSync by William278. Do not redistribute! * This file is part of HuskSync, licensed under the Apache License 2.0.
* *
* Copyright (c) William278 <will27528@gmail.com> * Copyright (c) William278 <will27528@gmail.com>
* All rights reserved. * Copyright (c) contributors
* *
* This source code is provided as reference to licensed individuals that have purchased the HuskSync * Licensed under the Apache License, Version 2.0 (the "License");
* plugin once from any of the official sources it is provided. The availability of this code does * you may not use this file except in compliance with the License.
* not grant you the rights to modify, re-distribute, compile or redistribute this source code or * You may obtain a copy of the License at
* "plugin" outside this intended purpose. This license does not cover libraries developed by third *
* parties that are utilised in the plugin. * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/ */
package net.william278.husksync.listener; package net.william278.husksync.listener;

View File

@@ -1,14 +1,20 @@
/* /*
* This file is part of HuskSync by William278. Do not redistribute! * This file is part of HuskSync, licensed under the Apache License 2.0.
* *
* Copyright (c) William278 <will27528@gmail.com> * Copyright (c) William278 <will27528@gmail.com>
* All rights reserved. * Copyright (c) contributors
* *
* This source code is provided as reference to licensed individuals that have purchased the HuskSync * Licensed under the Apache License, Version 2.0 (the "License");
* plugin once from any of the official sources it is provided. The availability of this code does * you may not use this file except in compliance with the License.
* not grant you the rights to modify, re-distribute, compile or redistribute this source code or * You may obtain a copy of the License at
* "plugin" outside this intended purpose. This license does not cover libraries developed by third *
* parties that are utilised in the plugin. * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/ */
package net.william278.husksync.listener; package net.william278.husksync.listener;

View File

@@ -1,14 +1,20 @@
/* /*
* This file is part of HuskSync by William278. Do not redistribute! * This file is part of HuskSync, licensed under the Apache License 2.0.
* *
* Copyright (c) William278 <will27528@gmail.com> * Copyright (c) William278 <will27528@gmail.com>
* All rights reserved. * Copyright (c) contributors
* *
* This source code is provided as reference to licensed individuals that have purchased the HuskSync * Licensed under the Apache License, Version 2.0 (the "License");
* plugin once from any of the official sources it is provided. The availability of this code does * you may not use this file except in compliance with the License.
* not grant you the rights to modify, re-distribute, compile or redistribute this source code or * You may obtain a copy of the License at
* "plugin" outside this intended purpose. This license does not cover libraries developed by third *
* parties that are utilised in the plugin. * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/ */
package net.william278.husksync.migrator; package net.william278.husksync.migrator;

View File

@@ -1,14 +1,20 @@
/* /*
* This file is part of HuskSync by William278. Do not redistribute! * This file is part of HuskSync, licensed under the Apache License 2.0.
* *
* Copyright (c) William278 <will27528@gmail.com> * Copyright (c) William278 <will27528@gmail.com>
* All rights reserved. * Copyright (c) contributors
* *
* This source code is provided as reference to licensed individuals that have purchased the HuskSync * Licensed under the Apache License, Version 2.0 (the "License");
* plugin once from any of the official sources it is provided. The availability of this code does * you may not use this file except in compliance with the License.
* not grant you the rights to modify, re-distribute, compile or redistribute this source code or * You may obtain a copy of the License at
* "plugin" outside this intended purpose. This license does not cover libraries developed by third *
* parties that are utilised in the plugin. * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/ */
package net.william278.husksync.migrator; package net.william278.husksync.migrator;

View File

@@ -1,14 +1,20 @@
/* /*
* This file is part of HuskSync by William278. Do not redistribute! * This file is part of HuskSync, licensed under the Apache License 2.0.
* *
* Copyright (c) William278 <will27528@gmail.com> * Copyright (c) William278 <will27528@gmail.com>
* All rights reserved. * Copyright (c) contributors
* *
* This source code is provided as reference to licensed individuals that have purchased the HuskSync * Licensed under the Apache License, Version 2.0 (the "License");
* plugin once from any of the official sources it is provided. The availability of this code does * you may not use this file except in compliance with the License.
* not grant you the rights to modify, re-distribute, compile or redistribute this source code or * You may obtain a copy of the License at
* "plugin" outside this intended purpose. This license does not cover libraries developed by third *
* parties that are utilised in the plugin. * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/ */
package net.william278.husksync.player; package net.william278.husksync.player;
@@ -30,6 +36,7 @@ import org.bukkit.advancement.AdvancementProgress;
import org.bukkit.attribute.Attribute; import org.bukkit.attribute.Attribute;
import org.bukkit.entity.EntityType; import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.inventory.InventoryType;
import org.bukkit.event.player.PlayerTeleportEvent; import org.bukkit.event.player.PlayerTeleportEvent;
import org.bukkit.inventory.Inventory; import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
@@ -49,7 +56,7 @@ import java.util.logging.Level;
* Bukkit implementation of an {@link OnlineUser} * Bukkit implementation of an {@link OnlineUser}
*/ */
public class BukkitPlayer extends OnlineUser { public class BukkitPlayer extends OnlineUser {
private final BukkitHuskSync plugin; private final BukkitHuskSync plugin;
private final Player player; private final Player player;
@@ -172,6 +179,7 @@ public class BukkitPlayer extends OnlineUser {
return BukkitSerializer.deserializeInventory(itemData.serializedItems).thenApplyAsync(contents -> { return BukkitSerializer.deserializeInventory(itemData.serializedItems).thenApplyAsync(contents -> {
final CompletableFuture<Void> inventorySetFuture = new CompletableFuture<>(); final CompletableFuture<Void> inventorySetFuture = new CompletableFuture<>();
Bukkit.getScheduler().runTask(plugin, () -> { Bukkit.getScheduler().runTask(plugin, () -> {
this.clearInventoryCraftingSlots();
player.setItemOnCursor(null); player.setItemOnCursor(null);
player.getInventory().setContents(contents.getContents()); player.getInventory().setContents(contents.getContents());
player.updateInventory(); player.updateInventory();
@@ -181,6 +189,16 @@ public class BukkitPlayer extends OnlineUser {
}); });
} }
// Clears any items the player may have in the crafting slots of their inventory
private void clearInventoryCraftingSlots() {
final Inventory inventory = player.getOpenInventory().getTopInventory();
if (inventory.getType() == InventoryType.CRAFTING) {
for (int slot = 0; slot < 5; slot++) {
inventory.setItem(slot, null);
}
}
}
@Override @Override
public CompletableFuture<ItemData> getEnderChest() { public CompletableFuture<ItemData> getEnderChest() {
final Inventory enderChest = player.getEnderChest(); final Inventory enderChest = player.getEnderChest();
@@ -494,7 +512,7 @@ public class BukkitPlayer extends OnlineUser {
.ifPresentOrElse(mapping -> mapping.setContainerValue(container, player, key), .ifPresentOrElse(mapping -> mapping.setContainerValue(container, player, key),
() -> plugin.log(Level.WARNING, () -> plugin.log(Level.WARNING,
"Could not set " + player.getName() + "'s persistent data key " + keyString + "Could not set " + player.getName() + "'s persistent data key " + keyString +
" as it has an invalid type. Skipping!")); " as it has an invalid type. Skipping!"));
} }
}); });
}).exceptionally(throwable -> { }).exceptionally(throwable -> {
@@ -511,7 +529,7 @@ public class BukkitPlayer extends OnlineUser {
public Audience getAudience() { public Audience getAudience() {
return plugin.getAudiences().player(player); return plugin.getAudiences().player(player);
} }
@Override @Override
public boolean isOffline() { public boolean isOffline() {
try { try {

View File

@@ -11,6 +11,7 @@ softdepend:
libraries: libraries:
- 'redis.clients:jedis:${jedis_version}' - 'redis.clients:jedis:${jedis_version}'
- 'com.mysql:mysql-connector-j:${mysql_driver_version}' - 'com.mysql:mysql-connector-j:${mysql_driver_version}'
- 'org.mariadb.jdbc:mariadb-java-client:${mariadb_driver_version}'
- 'org.xerial.snappy:snappy-java:${snappy_version}' - 'org.xerial.snappy:snappy-java:${snappy_version}'
- 'org.apache.commons:commons-text:${commons_text_version}' - 'org.apache.commons:commons-text:${commons_text_version}'

View File

@@ -1,14 +1,20 @@
/* /*
* This file is part of HuskSync by William278. Do not redistribute! * This file is part of HuskSync, licensed under the Apache License 2.0.
* *
* Copyright (c) William278 <will27528@gmail.com> * Copyright (c) William278 <will27528@gmail.com>
* All rights reserved. * Copyright (c) contributors
* *
* This source code is provided as reference to licensed individuals that have purchased the HuskSync * Licensed under the Apache License, Version 2.0 (the "License");
* plugin once from any of the official sources it is provided. The availability of this code does * you may not use this file except in compliance with the License.
* not grant you the rights to modify, re-distribute, compile or redistribute this source code or * You may obtain a copy of the License at
* "plugin" outside this intended purpose. This license does not cover libraries developed by third *
* parties that are utilised in the plugin. * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/ */
package net.william278.husksync; package net.william278.husksync;

View File

@@ -1,14 +1,20 @@
/* /*
* This file is part of HuskSync by William278. Do not redistribute! * This file is part of HuskSync, licensed under the Apache License 2.0.
* *
* Copyright (c) William278 <will27528@gmail.com> * Copyright (c) William278 <will27528@gmail.com>
* All rights reserved. * Copyright (c) contributors
* *
* This source code is provided as reference to licensed individuals that have purchased the HuskSync * Licensed under the Apache License, Version 2.0 (the "License");
* plugin once from any of the official sources it is provided. The availability of this code does * you may not use this file except in compliance with the License.
* not grant you the rights to modify, re-distribute, compile or redistribute this source code or * You may obtain a copy of the License at
* "plugin" outside this intended purpose. This license does not cover libraries developed by third *
* parties that are utilised in the plugin. * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/ */
package net.william278.husksync; package net.william278.husksync;
@@ -16,9 +22,9 @@ package net.william278.husksync;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
/** /**
* Indicates an exception occurred while initialising the HuskSync plugin * Indicates an exception occurred while initializing the HuskSync plugin
*/ */
public class HuskSyncInitializationException extends RuntimeException { public class HuskSyncInitializationException extends IllegalStateException {
public HuskSyncInitializationException(@NotNull String message) { public HuskSyncInitializationException(@NotNull String message) {
super(message); super(message);
} }

View File

@@ -1,14 +1,20 @@
/* /*
* This file is part of HuskSync by William278. Do not redistribute! * This file is part of HuskSync, licensed under the Apache License 2.0.
* *
* Copyright (c) William278 <will27528@gmail.com> * Copyright (c) William278 <will27528@gmail.com>
* All rights reserved. * Copyright (c) contributors
* *
* This source code is provided as reference to licensed individuals that have purchased the HuskSync * Licensed under the Apache License, Version 2.0 (the "License");
* plugin once from any of the official sources it is provided. The availability of this code does * you may not use this file except in compliance with the License.
* not grant you the rights to modify, re-distribute, compile or redistribute this source code or * You may obtain a copy of the License at
* "plugin" outside this intended purpose. This license does not cover libraries developed by third *
* parties that are utilised in the plugin. * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/ */
package net.william278.husksync.api; package net.william278.husksync.api;

View File

@@ -1,14 +1,20 @@
/* /*
* This file is part of HuskSync by William278. Do not redistribute! * This file is part of HuskSync, licensed under the Apache License 2.0.
* *
* Copyright (c) William278 <will27528@gmail.com> * Copyright (c) William278 <will27528@gmail.com>
* All rights reserved. * Copyright (c) contributors
* *
* This source code is provided as reference to licensed individuals that have purchased the HuskSync * Licensed under the Apache License, Version 2.0 (the "License");
* plugin once from any of the official sources it is provided. The availability of this code does * you may not use this file except in compliance with the License.
* not grant you the rights to modify, re-distribute, compile or redistribute this source code or * You may obtain a copy of the License at
* "plugin" outside this intended purpose. This license does not cover libraries developed by third *
* parties that are utilised in the plugin. * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/ */
package net.william278.husksync.command; package net.william278.husksync.command;

View File

@@ -1,14 +1,20 @@
/* /*
* This file is part of HuskSync by William278. Do not redistribute! * This file is part of HuskSync, licensed under the Apache License 2.0.
* *
* Copyright (c) William278 <will27528@gmail.com> * Copyright (c) William278 <will27528@gmail.com>
* All rights reserved. * Copyright (c) contributors
* *
* This source code is provided as reference to licensed individuals that have purchased the HuskSync * Licensed under the Apache License, Version 2.0 (the "License");
* plugin once from any of the official sources it is provided. The availability of this code does * you may not use this file except in compliance with the License.
* not grant you the rights to modify, re-distribute, compile or redistribute this source code or * You may obtain a copy of the License at
* "plugin" outside this intended purpose. This license does not cover libraries developed by third *
* parties that are utilised in the plugin. * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/ */
package net.william278.husksync.command; package net.william278.husksync.command;

View File

@@ -1,14 +1,20 @@
/* /*
* This file is part of HuskSync by William278. Do not redistribute! * This file is part of HuskSync, licensed under the Apache License 2.0.
* *
* Copyright (c) William278 <will27528@gmail.com> * Copyright (c) William278 <will27528@gmail.com>
* All rights reserved. * Copyright (c) contributors
* *
* This source code is provided as reference to licensed individuals that have purchased the HuskSync * Licensed under the Apache License, Version 2.0 (the "License");
* plugin once from any of the official sources it is provided. The availability of this code does * you may not use this file except in compliance with the License.
* not grant you the rights to modify, re-distribute, compile or redistribute this source code or * You may obtain a copy of the License at
* "plugin" outside this intended purpose. This license does not cover libraries developed by third *
* parties that are utilised in the plugin. * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/ */
package net.william278.husksync.command; package net.william278.husksync.command;

View File

@@ -1,14 +1,20 @@
/* /*
* This file is part of HuskSync by William278. Do not redistribute! * This file is part of HuskSync, licensed under the Apache License 2.0.
* *
* Copyright (c) William278 <will27528@gmail.com> * Copyright (c) William278 <will27528@gmail.com>
* All rights reserved. * Copyright (c) contributors
* *
* This source code is provided as reference to licensed individuals that have purchased the HuskSync * Licensed under the Apache License, Version 2.0 (the "License");
* plugin once from any of the official sources it is provided. The availability of this code does * you may not use this file except in compliance with the License.
* not grant you the rights to modify, re-distribute, compile or redistribute this source code or * You may obtain a copy of the License at
* "plugin" outside this intended purpose. This license does not cover libraries developed by third *
* parties that are utilised in the plugin. * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/ */
package net.william278.husksync.command; package net.william278.husksync.command;

View File

@@ -1,14 +1,20 @@
/* /*
* This file is part of HuskSync by William278. Do not redistribute! * This file is part of HuskSync, licensed under the Apache License 2.0.
* *
* Copyright (c) William278 <will27528@gmail.com> * Copyright (c) William278 <will27528@gmail.com>
* All rights reserved. * Copyright (c) contributors
* *
* This source code is provided as reference to licensed individuals that have purchased the HuskSync * Licensed under the Apache License, Version 2.0 (the "License");
* plugin once from any of the official sources it is provided. The availability of this code does * you may not use this file except in compliance with the License.
* not grant you the rights to modify, re-distribute, compile or redistribute this source code or * You may obtain a copy of the License at
* "plugin" outside this intended purpose. This license does not cover libraries developed by third *
* parties that are utilised in the plugin. * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/ */
package net.william278.husksync.command; package net.william278.husksync.command;

View File

@@ -1,14 +1,20 @@
/* /*
* This file is part of HuskSync by William278. Do not redistribute! * This file is part of HuskSync, licensed under the Apache License 2.0.
* *
* Copyright (c) William278 <will27528@gmail.com> * Copyright (c) William278 <will27528@gmail.com>
* All rights reserved. * Copyright (c) contributors
* *
* This source code is provided as reference to licensed individuals that have purchased the HuskSync * Licensed under the Apache License, Version 2.0 (the "License");
* plugin once from any of the official sources it is provided. The availability of this code does * you may not use this file except in compliance with the License.
* not grant you the rights to modify, re-distribute, compile or redistribute this source code or * You may obtain a copy of the License at
* "plugin" outside this intended purpose. This license does not cover libraries developed by third *
* parties that are utilised in the plugin. * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/ */
package net.william278.husksync.command; package net.william278.husksync.command;

View File

@@ -1,14 +1,20 @@
/* /*
* This file is part of HuskSync by William278. Do not redistribute! * This file is part of HuskSync, licensed under the Apache License 2.0.
* *
* Copyright (c) William278 <will27528@gmail.com> * Copyright (c) William278 <will27528@gmail.com>
* All rights reserved. * Copyright (c) contributors
* *
* This source code is provided as reference to licensed individuals that have purchased the HuskSync * Licensed under the Apache License, Version 2.0 (the "License");
* plugin once from any of the official sources it is provided. The availability of this code does * you may not use this file except in compliance with the License.
* not grant you the rights to modify, re-distribute, compile or redistribute this source code or * You may obtain a copy of the License at
* "plugin" outside this intended purpose. This license does not cover libraries developed by third *
* parties that are utilised in the plugin. * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/ */
package net.william278.husksync.command; package net.william278.husksync.command;

View File

@@ -1,14 +1,20 @@
/* /*
* This file is part of HuskSync by William278. Do not redistribute! * This file is part of HuskSync, licensed under the Apache License 2.0.
* *
* Copyright (c) William278 <will27528@gmail.com> * Copyright (c) William278 <will27528@gmail.com>
* All rights reserved. * Copyright (c) contributors
* *
* This source code is provided as reference to licensed individuals that have purchased the HuskSync * Licensed under the Apache License, Version 2.0 (the "License");
* plugin once from any of the official sources it is provided. The availability of this code does * you may not use this file except in compliance with the License.
* not grant you the rights to modify, re-distribute, compile or redistribute this source code or * You may obtain a copy of the License at
* "plugin" outside this intended purpose. This license does not cover libraries developed by third *
* parties that are utilised in the plugin. * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/ */
package net.william278.husksync.command; package net.william278.husksync.command;

View File

@@ -1,14 +1,20 @@
/* /*
* This file is part of HuskSync by William278. Do not redistribute! * This file is part of HuskSync, licensed under the Apache License 2.0.
* *
* Copyright (c) William278 <will27528@gmail.com> * Copyright (c) William278 <will27528@gmail.com>
* All rights reserved. * Copyright (c) contributors
* *
* This source code is provided as reference to licensed individuals that have purchased the HuskSync * Licensed under the Apache License, Version 2.0 (the "License");
* plugin once from any of the official sources it is provided. The availability of this code does * you may not use this file except in compliance with the License.
* not grant you the rights to modify, re-distribute, compile or redistribute this source code or * You may obtain a copy of the License at
* "plugin" outside this intended purpose. This license does not cover libraries developed by third *
* parties that are utilised in the plugin. * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/ */
package net.william278.husksync.config; package net.william278.husksync.config;
@@ -29,7 +35,7 @@ import java.util.Optional;
*/ */
@YamlFile(rootedMap = true, header = """ @YamlFile(rootedMap = true, header = """
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓ ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ HuskHomes Locales ┃ HuskSync Locales ┃
┃ Developed by William278 ┃ ┃ Developed by William278 ┃
┣━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ ┣━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
┣╸ See plugin about menu for international locale credits ┣╸ See plugin about menu for international locale credits

View File

@@ -1,14 +1,20 @@
/* /*
* This file is part of HuskSync by William278. Do not redistribute! * This file is part of HuskSync, licensed under the Apache License 2.0.
* *
* Copyright (c) William278 <will27528@gmail.com> * Copyright (c) William278 <will27528@gmail.com>
* All rights reserved. * Copyright (c) contributors
* *
* This source code is provided as reference to licensed individuals that have purchased the HuskSync * Licensed under the Apache License, Version 2.0 (the "License");
* plugin once from any of the official sources it is provided. The availability of this code does * you may not use this file except in compliance with the License.
* not grant you the rights to modify, re-distribute, compile or redistribute this source code or * You may obtain a copy of the License at
* "plugin" outside this intended purpose. This license does not cover libraries developed by third *
* parties that are utilised in the plugin. * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/ */
package net.william278.husksync.config; package net.william278.husksync.config;
@@ -16,6 +22,7 @@ package net.william278.husksync.config;
import net.william278.annotaml.YamlComment; import net.william278.annotaml.YamlComment;
import net.william278.annotaml.YamlFile; import net.william278.annotaml.YamlFile;
import net.william278.annotaml.YamlKey; import net.william278.annotaml.YamlKey;
import net.william278.husksync.database.Database;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import java.util.*; import java.util.*;
@@ -48,6 +55,10 @@ public class Settings {
// Database settings // Database settings
@YamlComment("Type of database to use (MYSQL, SQLITE)")
@YamlKey("database.type")
private Database.Type databaseType = Database.Type.MYSQL;
@YamlComment("Database connection settings") @YamlComment("Database connection settings")
@YamlKey("database.credentials.host") @YamlKey("database.credentials.host")
private String mySqlHost = "localhost"; private String mySqlHost = "localhost";
@@ -132,7 +143,7 @@ public class Settings {
private Map<String, Boolean> synchronizationFeatures = SynchronizationFeature.getDefaults(); private Map<String, Boolean> synchronizationFeatures = SynchronizationFeature.getDefaults();
@YamlKey("synchronization.blacklisted_commands_while_locked") @YamlKey("synchronization.blacklisted_commands_while_locked")
private List<String> blacklistedCommandsWhileLocked = new ArrayList<>(); private List<String> blacklistedCommandsWhileLocked = new ArrayList<>(List.of("*"));
@YamlKey("synchronization.event_priorities") @YamlKey("synchronization.event_priorities")
private Map<String, String> synchronizationEventPriorities = EventType.getDefaults(); private Map<String, String> synchronizationEventPriorities = EventType.getDefaults();
@@ -161,6 +172,12 @@ public class Settings {
return debugLogging; return debugLogging;
} }
@NotNull
public Database.Type getDatabaseType() {
return databaseType;
}
@NotNull @NotNull
public String getMySqlHost() { public String getMySqlHost() {
return mySqlHost; return mySqlHost;

View File

@@ -1,14 +1,20 @@
/* /*
* This file is part of HuskSync by William278. Do not redistribute! * This file is part of HuskSync, licensed under the Apache License 2.0.
* *
* Copyright (c) William278 <will27528@gmail.com> * Copyright (c) William278 <will27528@gmail.com>
* All rights reserved. * Copyright (c) contributors
* *
* This source code is provided as reference to licensed individuals that have purchased the HuskSync * Licensed under the Apache License, Version 2.0 (the "License");
* plugin once from any of the official sources it is provided. The availability of this code does * you may not use this file except in compliance with the License.
* not grant you the rights to modify, re-distribute, compile or redistribute this source code or * You may obtain a copy of the License at
* "plugin" outside this intended purpose. This license does not cover libraries developed by third *
* parties that are utilised in the plugin. * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/ */
package net.william278.husksync.data; package net.william278.husksync.data;

View File

@@ -1,14 +1,20 @@
/* /*
* This file is part of HuskSync by William278. Do not redistribute! * This file is part of HuskSync, licensed under the Apache License 2.0.
* *
* Copyright (c) William278 <will27528@gmail.com> * Copyright (c) William278 <will27528@gmail.com>
* All rights reserved. * Copyright (c) contributors
* *
* This source code is provided as reference to licensed individuals that have purchased the HuskSync * Licensed under the Apache License, Version 2.0 (the "License");
* plugin once from any of the official sources it is provided. The availability of this code does * you may not use this file except in compliance with the License.
* not grant you the rights to modify, re-distribute, compile or redistribute this source code or * You may obtain a copy of the License at
* "plugin" outside this intended purpose. This license does not cover libraries developed by third *
* parties that are utilised in the plugin. * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/ */
package net.william278.husksync.data; package net.william278.husksync.data;

View File

@@ -1,14 +1,20 @@
/* /*
* This file is part of HuskSync by William278. Do not redistribute! * This file is part of HuskSync, licensed under the Apache License 2.0.
* *
* Copyright (c) William278 <will27528@gmail.com> * Copyright (c) William278 <will27528@gmail.com>
* All rights reserved. * Copyright (c) contributors
* *
* This source code is provided as reference to licensed individuals that have purchased the HuskSync * Licensed under the Apache License, Version 2.0 (the "License");
* plugin once from any of the official sources it is provided. The availability of this code does * you may not use this file except in compliance with the License.
* not grant you the rights to modify, re-distribute, compile or redistribute this source code or * You may obtain a copy of the License at
* "plugin" outside this intended purpose. This license does not cover libraries developed by third *
* parties that are utilised in the plugin. * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/ */
package net.william278.husksync.data; package net.william278.husksync.data;

View File

@@ -1,14 +1,20 @@
/* /*
* This file is part of HuskSync by William278. Do not redistribute! * This file is part of HuskSync, licensed under the Apache License 2.0.
* *
* Copyright (c) William278 <will27528@gmail.com> * Copyright (c) William278 <will27528@gmail.com>
* All rights reserved. * Copyright (c) contributors
* *
* This source code is provided as reference to licensed individuals that have purchased the HuskSync * Licensed under the Apache License, Version 2.0 (the "License");
* plugin once from any of the official sources it is provided. The availability of this code does * you may not use this file except in compliance with the License.
* not grant you the rights to modify, re-distribute, compile or redistribute this source code or * You may obtain a copy of the License at
* "plugin" outside this intended purpose. This license does not cover libraries developed by third *
* parties that are utilised in the plugin. * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/ */
package net.william278.husksync.data; package net.william278.husksync.data;

View File

@@ -1,14 +1,20 @@
/* /*
* This file is part of HuskSync by William278. Do not redistribute! * This file is part of HuskSync, licensed under the Apache License 2.0.
* *
* Copyright (c) William278 <will27528@gmail.com> * Copyright (c) William278 <will27528@gmail.com>
* All rights reserved. * Copyright (c) contributors
* *
* This source code is provided as reference to licensed individuals that have purchased the HuskSync * Licensed under the Apache License, Version 2.0 (the "License");
* plugin once from any of the official sources it is provided. The availability of this code does * you may not use this file except in compliance with the License.
* not grant you the rights to modify, re-distribute, compile or redistribute this source code or * You may obtain a copy of the License at
* "plugin" outside this intended purpose. This license does not cover libraries developed by third *
* parties that are utilised in the plugin. * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/ */
package net.william278.husksync.data; package net.william278.husksync.data;

View File

@@ -1,14 +1,20 @@
/* /*
* This file is part of HuskSync by William278. Do not redistribute! * This file is part of HuskSync, licensed under the Apache License 2.0.
* *
* Copyright (c) William278 <will27528@gmail.com> * Copyright (c) William278 <will27528@gmail.com>
* All rights reserved. * Copyright (c) contributors
* *
* This source code is provided as reference to licensed individuals that have purchased the HuskSync * Licensed under the Apache License, Version 2.0 (the "License");
* plugin once from any of the official sources it is provided. The availability of this code does * you may not use this file except in compliance with the License.
* not grant you the rights to modify, re-distribute, compile or redistribute this source code or * You may obtain a copy of the License at
* "plugin" outside this intended purpose. This license does not cover libraries developed by third *
* parties that are utilised in the plugin. * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/ */
package net.william278.husksync.data; package net.william278.husksync.data;

View File

@@ -1,14 +1,20 @@
/* /*
* This file is part of HuskSync by William278. Do not redistribute! * This file is part of HuskSync, licensed under the Apache License 2.0.
* *
* Copyright (c) William278 <will27528@gmail.com> * Copyright (c) William278 <will27528@gmail.com>
* All rights reserved. * Copyright (c) contributors
* *
* This source code is provided as reference to licensed individuals that have purchased the HuskSync * Licensed under the Apache License, Version 2.0 (the "License");
* plugin once from any of the official sources it is provided. The availability of this code does * you may not use this file except in compliance with the License.
* not grant you the rights to modify, re-distribute, compile or redistribute this source code or * You may obtain a copy of the License at
* "plugin" outside this intended purpose. This license does not cover libraries developed by third *
* parties that are utilised in the plugin. * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/ */
package net.william278.husksync.data; package net.william278.husksync.data;

View File

@@ -1,14 +1,20 @@
/* /*
* This file is part of HuskSync by William278. Do not redistribute! * This file is part of HuskSync, licensed under the Apache License 2.0.
* *
* Copyright (c) William278 <will27528@gmail.com> * Copyright (c) William278 <will27528@gmail.com>
* All rights reserved. * Copyright (c) contributors
* *
* This source code is provided as reference to licensed individuals that have purchased the HuskSync * Licensed under the Apache License, Version 2.0 (the "License");
* plugin once from any of the official sources it is provided. The availability of this code does * you may not use this file except in compliance with the License.
* not grant you the rights to modify, re-distribute, compile or redistribute this source code or * You may obtain a copy of the License at
* "plugin" outside this intended purpose. This license does not cover libraries developed by third *
* parties that are utilised in the plugin. * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/ */
package net.william278.husksync.data; package net.william278.husksync.data;

View File

@@ -1,14 +1,20 @@
/* /*
* This file is part of HuskSync by William278. Do not redistribute! * This file is part of HuskSync, licensed under the Apache License 2.0.
* *
* Copyright (c) William278 <will27528@gmail.com> * Copyright (c) William278 <will27528@gmail.com>
* All rights reserved. * Copyright (c) contributors
* *
* This source code is provided as reference to licensed individuals that have purchased the HuskSync * Licensed under the Apache License, Version 2.0 (the "License");
* plugin once from any of the official sources it is provided. The availability of this code does * you may not use this file except in compliance with the License.
* not grant you the rights to modify, re-distribute, compile or redistribute this source code or * You may obtain a copy of the License at
* "plugin" outside this intended purpose. This license does not cover libraries developed by third *
* parties that are utilised in the plugin. * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/ */
package net.william278.husksync.data; package net.william278.husksync.data;

View File

@@ -1,14 +1,20 @@
/* /*
* This file is part of HuskSync by William278. Do not redistribute! * This file is part of HuskSync, licensed under the Apache License 2.0.
* *
* Copyright (c) William278 <will27528@gmail.com> * Copyright (c) William278 <will27528@gmail.com>
* All rights reserved. * Copyright (c) contributors
* *
* This source code is provided as reference to licensed individuals that have purchased the HuskSync * Licensed under the Apache License, Version 2.0 (the "License");
* plugin once from any of the official sources it is provided. The availability of this code does * you may not use this file except in compliance with the License.
* not grant you the rights to modify, re-distribute, compile or redistribute this source code or * You may obtain a copy of the License at
* "plugin" outside this intended purpose. This license does not cover libraries developed by third *
* parties that are utilised in the plugin. * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/ */
package net.william278.husksync.data; package net.william278.husksync.data;

View File

@@ -1,14 +1,20 @@
/* /*
* This file is part of HuskSync by William278. Do not redistribute! * This file is part of HuskSync, licensed under the Apache License 2.0.
* *
* Copyright (c) William278 <will27528@gmail.com> * Copyright (c) William278 <will27528@gmail.com>
* All rights reserved. * Copyright (c) contributors
* *
* This source code is provided as reference to licensed individuals that have purchased the HuskSync * Licensed under the Apache License, Version 2.0 (the "License");
* plugin once from any of the official sources it is provided. The availability of this code does * you may not use this file except in compliance with the License.
* not grant you the rights to modify, re-distribute, compile or redistribute this source code or * You may obtain a copy of the License at
* "plugin" outside this intended purpose. This license does not cover libraries developed by third *
* parties that are utilised in the plugin. * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/ */
package net.william278.husksync.data; package net.william278.husksync.data;

View File

@@ -1,14 +1,20 @@
/* /*
* This file is part of HuskSync by William278. Do not redistribute! * This file is part of HuskSync, licensed under the Apache License 2.0.
* *
* Copyright (c) William278 <will27528@gmail.com> * Copyright (c) William278 <will27528@gmail.com>
* All rights reserved. * Copyright (c) contributors
* *
* This source code is provided as reference to licensed individuals that have purchased the HuskSync * Licensed under the Apache License, Version 2.0 (the "License");
* plugin once from any of the official sources it is provided. The availability of this code does * you may not use this file except in compliance with the License.
* not grant you the rights to modify, re-distribute, compile or redistribute this source code or * You may obtain a copy of the License at
* "plugin" outside this intended purpose. This license does not cover libraries developed by third *
* parties that are utilised in the plugin. * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/ */
package net.william278.husksync.data; package net.william278.husksync.data;

View File

@@ -1,14 +1,20 @@
/* /*
* This file is part of HuskSync by William278. Do not redistribute! * This file is part of HuskSync, licensed under the Apache License 2.0.
* *
* Copyright (c) William278 <will27528@gmail.com> * Copyright (c) William278 <will27528@gmail.com>
* All rights reserved. * Copyright (c) contributors
* *
* This source code is provided as reference to licensed individuals that have purchased the HuskSync * Licensed under the Apache License, Version 2.0 (the "License");
* plugin once from any of the official sources it is provided. The availability of this code does * you may not use this file except in compliance with the License.
* not grant you the rights to modify, re-distribute, compile or redistribute this source code or * You may obtain a copy of the License at
* "plugin" outside this intended purpose. This license does not cover libraries developed by third *
* parties that are utilised in the plugin. * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/ */
package net.william278.husksync.data; package net.william278.husksync.data;

View File

@@ -1,14 +1,20 @@
/* /*
* This file is part of HuskSync by William278. Do not redistribute! * This file is part of HuskSync, licensed under the Apache License 2.0.
* *
* Copyright (c) William278 <will27528@gmail.com> * Copyright (c) William278 <will27528@gmail.com>
* All rights reserved. * Copyright (c) contributors
* *
* This source code is provided as reference to licensed individuals that have purchased the HuskSync * Licensed under the Apache License, Version 2.0 (the "License");
* plugin once from any of the official sources it is provided. The availability of this code does * you may not use this file except in compliance with the License.
* not grant you the rights to modify, re-distribute, compile or redistribute this source code or * You may obtain a copy of the License at
* "plugin" outside this intended purpose. This license does not cover libraries developed by third *
* parties that are utilised in the plugin. * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/ */
package net.william278.husksync.data; package net.william278.husksync.data;

View File

@@ -1,14 +1,20 @@
/* /*
* This file is part of HuskSync by William278. Do not redistribute! * This file is part of HuskSync, licensed under the Apache License 2.0.
* *
* Copyright (c) William278 <will27528@gmail.com> * Copyright (c) William278 <will27528@gmail.com>
* All rights reserved. * Copyright (c) contributors
* *
* This source code is provided as reference to licensed individuals that have purchased the HuskSync * Licensed under the Apache License, Version 2.0 (the "License");
* plugin once from any of the official sources it is provided. The availability of this code does * you may not use this file except in compliance with the License.
* not grant you the rights to modify, re-distribute, compile or redistribute this source code or * You may obtain a copy of the License at
* "plugin" outside this intended purpose. This license does not cover libraries developed by third *
* parties that are utilised in the plugin. * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/ */
package net.william278.husksync.data; package net.william278.husksync.data;

View File

@@ -1,14 +1,20 @@
/* /*
* This file is part of HuskSync by William278. Do not redistribute! * This file is part of HuskSync, licensed under the Apache License 2.0.
* *
* Copyright (c) William278 <will27528@gmail.com> * Copyright (c) William278 <will27528@gmail.com>
* All rights reserved. * Copyright (c) contributors
* *
* This source code is provided as reference to licensed individuals that have purchased the HuskSync * Licensed under the Apache License, Version 2.0 (the "License");
* plugin once from any of the official sources it is provided. The availability of this code does * you may not use this file except in compliance with the License.
* not grant you the rights to modify, re-distribute, compile or redistribute this source code or * You may obtain a copy of the License at
* "plugin" outside this intended purpose. This license does not cover libraries developed by third *
* parties that are utilised in the plugin. * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/ */
package net.william278.husksync.data; package net.william278.husksync.data;

View File

@@ -1,14 +1,20 @@
/* /*
* This file is part of HuskSync by William278. Do not redistribute! * This file is part of HuskSync, licensed under the Apache License 2.0.
* *
* Copyright (c) William278 <will27528@gmail.com> * Copyright (c) William278 <will27528@gmail.com>
* All rights reserved. * Copyright (c) contributors
* *
* This source code is provided as reference to licensed individuals that have purchased the HuskSync * Licensed under the Apache License, Version 2.0 (the "License");
* plugin once from any of the official sources it is provided. The availability of this code does * you may not use this file except in compliance with the License.
* not grant you the rights to modify, re-distribute, compile or redistribute this source code or * You may obtain a copy of the License at
* "plugin" outside this intended purpose. This license does not cover libraries developed by third *
* parties that are utilised in the plugin. * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/ */
package net.william278.husksync.data; package net.william278.husksync.data;

View File

@@ -1,14 +1,20 @@
/* /*
* This file is part of HuskSync by William278. Do not redistribute! * This file is part of HuskSync, licensed under the Apache License 2.0.
* *
* Copyright (c) William278 <will27528@gmail.com> * Copyright (c) William278 <will27528@gmail.com>
* All rights reserved. * Copyright (c) contributors
* *
* This source code is provided as reference to licensed individuals that have purchased the HuskSync * Licensed under the Apache License, Version 2.0 (the "License");
* plugin once from any of the official sources it is provided. The availability of this code does * you may not use this file except in compliance with the License.
* not grant you the rights to modify, re-distribute, compile or redistribute this source code or * You may obtain a copy of the License at
* "plugin" outside this intended purpose. This license does not cover libraries developed by third *
* parties that are utilised in the plugin. * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/ */
package net.william278.husksync.data; package net.william278.husksync.data;

View File

@@ -1,14 +1,20 @@
/* /*
* This file is part of HuskSync by William278. Do not redistribute! * This file is part of HuskSync, licensed under the Apache License 2.0.
* *
* Copyright (c) William278 <will27528@gmail.com> * Copyright (c) William278 <will27528@gmail.com>
* All rights reserved. * Copyright (c) contributors
* *
* This source code is provided as reference to licensed individuals that have purchased the HuskSync * Licensed under the Apache License, Version 2.0 (the "License");
* plugin once from any of the official sources it is provided. The availability of this code does * you may not use this file except in compliance with the License.
* not grant you the rights to modify, re-distribute, compile or redistribute this source code or * You may obtain a copy of the License at
* "plugin" outside this intended purpose. This license does not cover libraries developed by third *
* parties that are utilised in the plugin. * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/ */
package net.william278.husksync.data; package net.william278.husksync.data;

View File

@@ -1,14 +1,20 @@
/* /*
* This file is part of HuskSync by William278. Do not redistribute! * This file is part of HuskSync, licensed under the Apache License 2.0.
* *
* Copyright (c) William278 <will27528@gmail.com> * Copyright (c) William278 <will27528@gmail.com>
* All rights reserved. * Copyright (c) contributors
* *
* This source code is provided as reference to licensed individuals that have purchased the HuskSync * Licensed under the Apache License, Version 2.0 (the "License");
* plugin once from any of the official sources it is provided. The availability of this code does * you may not use this file except in compliance with the License.
* not grant you the rights to modify, re-distribute, compile or redistribute this source code or * You may obtain a copy of the License at
* "plugin" outside this intended purpose. This license does not cover libraries developed by third *
* parties that are utilised in the plugin. * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/ */
package net.william278.husksync.database; package net.william278.husksync.database;
@@ -69,10 +75,8 @@ public abstract class Database {
/** /**
* Initialize the database and ensure tables are present; create tables if they do not exist. * Initialize the database and ensure tables are present; create tables if they do not exist.
*
* @return A future returning boolean - if the connection could be established.
*/ */
public abstract boolean initialize(); public abstract void initialize();
/** /**
* Ensure a {@link User} has an entry in the database and that their username is up-to-date * Ensure a {@link User} has an entry in the database and that their username is up-to-date
@@ -185,4 +189,30 @@ public abstract class Database {
*/ */
public abstract void close(); public abstract void close();
/**
* Identifies types of databases
*/
public enum Type {
MYSQL("MySQL", "mysql"),
MARIADB("MariaDB", "mariadb");
private final String displayName;
private final String protocol;
Type(@NotNull String displayName, @NotNull String protocol) {
this.displayName = displayName;
this.protocol = protocol;
}
@NotNull
public String getDisplayName() {
return displayName;
}
@NotNull
public String getProtocol() {
return protocol;
}
}
} }

View File

@@ -1,21 +1,26 @@
/* /*
* This file is part of HuskSync by William278. Do not redistribute! * This file is part of HuskSync, licensed under the Apache License 2.0.
* *
* Copyright (c) William278 <will27528@gmail.com> * Copyright (c) William278 <will27528@gmail.com>
* All rights reserved. * Copyright (c) contributors
* *
* This source code is provided as reference to licensed individuals that have purchased the HuskSync * Licensed under the Apache License, Version 2.0 (the "License");
* plugin once from any of the official sources it is provided. The availability of this code does * you may not use this file except in compliance with the License.
* not grant you the rights to modify, re-distribute, compile or redistribute this source code or * You may obtain a copy of the License at
* "plugin" outside this intended purpose. This license does not cover libraries developed by third *
* parties that are utilised in the plugin. * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/ */
package net.william278.husksync.database; package net.william278.husksync.database;
import com.zaxxer.hikari.HikariDataSource; import com.zaxxer.hikari.HikariDataSource;
import net.william278.husksync.HuskSync; import net.william278.husksync.HuskSync;
import net.william278.husksync.config.Settings;
import net.william278.husksync.data.DataAdaptionException; import net.william278.husksync.data.DataAdaptionException;
import net.william278.husksync.data.DataSaveCause; import net.william278.husksync.data.DataSaveCause;
import net.william278.husksync.data.UserData; import net.william278.husksync.data.UserData;
@@ -34,51 +39,17 @@ import java.util.logging.Level;
public class MySqlDatabase extends Database { public class MySqlDatabase extends Database {
/**
* MySQL server hostname
*/
private final String mySqlHost;
/**
* MySQL server port
*/
private final int mySqlPort;
/**
* Database to use on the MySQL server
*/
private final String mySqlDatabaseName;
private final String mySqlUsername;
private final String mySqlPassword;
private final String mySqlConnectionParameters;
private final int hikariMaximumPoolSize;
private final int hikariMinimumIdle;
private final long hikariMaximumLifetime;
private final long hikariKeepAliveTime;
private final long hikariConnectionTimeOut;
private static final String DATA_POOL_NAME = "HuskSyncHikariPool"; private static final String DATA_POOL_NAME = "HuskSyncHikariPool";
private final String flavor;
/** private final String driverClass;
* The Hikari data source - a pool of database connections that can be fetched on-demand private HikariDataSource dataSource;
*/
private HikariDataSource connectionPool;
public MySqlDatabase(@NotNull HuskSync plugin) { public MySqlDatabase(@NotNull HuskSync plugin) {
super(plugin); super(plugin);
final Settings settings = plugin.getSettings(); this.flavor = plugin.getSettings().getDatabaseType() == Type.MARIADB
this.mySqlHost = settings.getMySqlHost(); ? "mariadb" : "mysql";
this.mySqlPort = settings.getMySqlPort(); this.driverClass = plugin.getSettings().getDatabaseType() == Type.MARIADB
this.mySqlDatabaseName = settings.getMySqlDatabase(); ? "org.mariadb.jdbc.Driver" : "com.mysql.cj.jdbc.Driver";
this.mySqlUsername = settings.getMySqlUsername();
this.mySqlPassword = settings.getMySqlPassword();
this.mySqlConnectionParameters = settings.getMySqlConnectionParameters();
this.hikariMaximumPoolSize = settings.getMySqlConnectionPoolSize();
this.hikariMinimumIdle = settings.getMySqlConnectionPoolIdle();
this.hikariMaximumLifetime = settings.getMySqlConnectionPoolLifetime();
this.hikariKeepAliveTime = settings.getMySqlConnectionPoolKeepAlive();
this.hikariConnectionTimeOut = settings.getMySqlConnectionPoolTimeout();
} }
/** /**
@@ -88,46 +59,69 @@ public class MySqlDatabase extends Database {
* @throws SQLException if the connection fails for some reason * @throws SQLException if the connection fails for some reason
*/ */
private Connection getConnection() throws SQLException { private Connection getConnection() throws SQLException {
return connectionPool.getConnection(); return dataSource.getConnection();
} }
@Override @Override
public boolean initialize() { public void initialize() throws IllegalStateException {
try { // Initialize the Hikari pooled connection
// Create jdbc driver connection url dataSource = new HikariDataSource();
final String jdbcUrl = "jdbc:mysql://" + mySqlHost + ":" + mySqlPort + "/" + mySqlDatabaseName + mySqlConnectionParameters; dataSource.setDriverClassName(driverClass);
connectionPool = new HikariDataSource(); dataSource.setJdbcUrl(String.format("jdbc:%s://%s:%s/%s%s",
connectionPool.setJdbcUrl(jdbcUrl); flavor,
plugin.getSettings().getMySqlHost(),
plugin.getSettings().getMySqlPort(),
plugin.getSettings().getMySqlDatabase(),
plugin.getSettings().getMySqlConnectionParameters()
));
// Authenticate // Authenticate with the database
connectionPool.setUsername(mySqlUsername); dataSource.setUsername(plugin.getSettings().getMySqlUsername());
connectionPool.setPassword(mySqlPassword); dataSource.setPassword(plugin.getSettings().getMySqlPassword());
// Set various additional parameters // Set connection pool options
connectionPool.setMaximumPoolSize(hikariMaximumPoolSize); dataSource.setMaximumPoolSize(plugin.getSettings().getMySqlConnectionPoolSize());
connectionPool.setMinimumIdle(hikariMinimumIdle); dataSource.setMinimumIdle(plugin.getSettings().getMySqlConnectionPoolIdle());
connectionPool.setMaxLifetime(hikariMaximumLifetime); dataSource.setMaxLifetime(plugin.getSettings().getMySqlConnectionPoolLifetime());
connectionPool.setKeepaliveTime(hikariKeepAliveTime); dataSource.setKeepaliveTime(plugin.getSettings().getMySqlConnectionPoolKeepAlive());
connectionPool.setConnectionTimeout(hikariConnectionTimeOut); dataSource.setConnectionTimeout(plugin.getSettings().getMySqlConnectionPoolTimeout());
connectionPool.setPoolName(DATA_POOL_NAME); dataSource.setPoolName(DATA_POOL_NAME);
// Prepare database schema; make tables if they don't exist // Set additional connection pool properties
try (Connection connection = connectionPool.getConnection()) { final Properties properties = new Properties();
// Load database schema CREATE statements from schema file properties.putAll(
final String[] databaseSchema = getSchemaStatements("database/mysql_schema.sql"); Map.of("cachePrepStmts", "true",
try (Statement statement = connection.createStatement()) { "prepStmtCacheSize", "250",
for (String tableCreationStatement : databaseSchema) { "prepStmtCacheSqlLimit", "2048",
statement.execute(tableCreationStatement); "useServerPrepStmts", "true",
} "useLocalSessionState", "true",
"useLocalTransactionState", "true"
));
properties.putAll(
Map.of(
"rewriteBatchedStatements", "true",
"cacheResultSetMetadata", "true",
"cacheServerConfiguration", "true",
"elideSetAutoCommits", "true",
"maintainTimeStats", "false")
);
dataSource.setDataSourceProperties(properties);
// Prepare database schema; make tables if they don't exist
try (Connection connection = dataSource.getConnection()) {
final String[] databaseSchema = getSchemaStatements(String.format("database/%s_schema.sql", flavor));
try (Statement statement = connection.createStatement()) {
for (String tableCreationStatement : databaseSchema) {
statement.execute(tableCreationStatement);
} }
return true; } catch (SQLException e) {
} catch (SQLException | IOException e) { throw new IllegalStateException("Failed to create database tables. Please ensure you are running MySQL v8.0+ " +
plugin.log(Level.SEVERE, "Failed to perform database setup: " + e.getMessage()); "and that your connecting user account has privileges to create tables.", e);
} }
} catch (Exception e) { } catch (SQLException | IOException e) {
plugin.log(Level.SEVERE, "An unhandled exception occurred during database setup!", e); throw new IllegalStateException("Failed to establish a connection to the MySQL database. " +
"Please check the supplied database credentials in the config file", e);
} }
return false;
} }
@Override @Override
@@ -433,9 +427,9 @@ public class MySqlDatabase extends Database {
@Override @Override
public void close() { public void close() {
if (connectionPool != null) { if (dataSource != null) {
if (!connectionPool.isClosed()) { if (!dataSource.isClosed()) {
connectionPool.close(); dataSource.close();
} }
} }
} }

View File

@@ -1,14 +1,20 @@
/* /*
* This file is part of HuskSync by William278. Do not redistribute! * This file is part of HuskSync, licensed under the Apache License 2.0.
* *
* Copyright (c) William278 <will27528@gmail.com> * Copyright (c) William278 <will27528@gmail.com>
* All rights reserved. * Copyright (c) contributors
* *
* This source code is provided as reference to licensed individuals that have purchased the HuskSync * Licensed under the Apache License, Version 2.0 (the "License");
* plugin once from any of the official sources it is provided. The availability of this code does * you may not use this file except in compliance with the License.
* not grant you the rights to modify, re-distribute, compile or redistribute this source code or * You may obtain a copy of the License at
* "plugin" outside this intended purpose. This license does not cover libraries developed by third *
* parties that are utilised in the plugin. * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/ */
package net.william278.husksync.event; package net.william278.husksync.event;

View File

@@ -1,14 +1,20 @@
/* /*
* This file is part of HuskSync by William278. Do not redistribute! * This file is part of HuskSync, licensed under the Apache License 2.0.
* *
* Copyright (c) William278 <will27528@gmail.com> * Copyright (c) William278 <will27528@gmail.com>
* All rights reserved. * Copyright (c) contributors
* *
* This source code is provided as reference to licensed individuals that have purchased the HuskSync * Licensed under the Apache License, Version 2.0 (the "License");
* plugin once from any of the official sources it is provided. The availability of this code does * you may not use this file except in compliance with the License.
* not grant you the rights to modify, re-distribute, compile or redistribute this source code or * You may obtain a copy of the License at
* "plugin" outside this intended purpose. This license does not cover libraries developed by third *
* parties that are utilised in the plugin. * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/ */
package net.william278.husksync.event; package net.william278.husksync.event;

View File

@@ -1,14 +1,20 @@
/* /*
* This file is part of HuskSync by William278. Do not redistribute! * This file is part of HuskSync, licensed under the Apache License 2.0.
* *
* Copyright (c) William278 <will27528@gmail.com> * Copyright (c) William278 <will27528@gmail.com>
* All rights reserved. * Copyright (c) contributors
* *
* This source code is provided as reference to licensed individuals that have purchased the HuskSync * Licensed under the Apache License, Version 2.0 (the "License");
* plugin once from any of the official sources it is provided. The availability of this code does * you may not use this file except in compliance with the License.
* not grant you the rights to modify, re-distribute, compile or redistribute this source code or * You may obtain a copy of the License at
* "plugin" outside this intended purpose. This license does not cover libraries developed by third *
* parties that are utilised in the plugin. * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/ */
package net.william278.husksync.event; package net.william278.husksync.event;

View File

@@ -1,14 +1,20 @@
/* /*
* This file is part of HuskSync by William278. Do not redistribute! * This file is part of HuskSync, licensed under the Apache License 2.0.
* *
* Copyright (c) William278 <will27528@gmail.com> * Copyright (c) William278 <will27528@gmail.com>
* All rights reserved. * Copyright (c) contributors
* *
* This source code is provided as reference to licensed individuals that have purchased the HuskSync * Licensed under the Apache License, Version 2.0 (the "License");
* plugin once from any of the official sources it is provided. The availability of this code does * you may not use this file except in compliance with the License.
* not grant you the rights to modify, re-distribute, compile or redistribute this source code or * You may obtain a copy of the License at
* "plugin" outside this intended purpose. This license does not cover libraries developed by third *
* parties that are utilised in the plugin. * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/ */
package net.william278.husksync.event; package net.william278.husksync.event;

View File

@@ -1,14 +1,20 @@
/* /*
* This file is part of HuskSync by William278. Do not redistribute! * This file is part of HuskSync, licensed under the Apache License 2.0.
* *
* Copyright (c) William278 <will27528@gmail.com> * Copyright (c) William278 <will27528@gmail.com>
* All rights reserved. * Copyright (c) contributors
* *
* This source code is provided as reference to licensed individuals that have purchased the HuskSync * Licensed under the Apache License, Version 2.0 (the "License");
* plugin once from any of the official sources it is provided. The availability of this code does * you may not use this file except in compliance with the License.
* not grant you the rights to modify, re-distribute, compile or redistribute this source code or * You may obtain a copy of the License at
* "plugin" outside this intended purpose. This license does not cover libraries developed by third *
* parties that are utilised in the plugin. * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/ */
package net.william278.husksync.event; package net.william278.husksync.event;

View File

@@ -1,14 +1,20 @@
/* /*
* This file is part of HuskSync by William278. Do not redistribute! * This file is part of HuskSync, licensed under the Apache License 2.0.
* *
* Copyright (c) William278 <will27528@gmail.com> * Copyright (c) William278 <will27528@gmail.com>
* All rights reserved. * Copyright (c) contributors
* *
* This source code is provided as reference to licensed individuals that have purchased the HuskSync * Licensed under the Apache License, Version 2.0 (the "License");
* plugin once from any of the official sources it is provided. The availability of this code does * you may not use this file except in compliance with the License.
* not grant you the rights to modify, re-distribute, compile or redistribute this source code or * You may obtain a copy of the License at
* "plugin" outside this intended purpose. This license does not cover libraries developed by third *
* parties that are utilised in the plugin. * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/ */
package net.william278.husksync.event; package net.william278.husksync.event;

View File

@@ -1,14 +1,20 @@
/* /*
* This file is part of HuskSync by William278. Do not redistribute! * This file is part of HuskSync, licensed under the Apache License 2.0.
* *
* Copyright (c) William278 <will27528@gmail.com> * Copyright (c) William278 <will27528@gmail.com>
* All rights reserved. * Copyright (c) contributors
* *
* This source code is provided as reference to licensed individuals that have purchased the HuskSync * Licensed under the Apache License, Version 2.0 (the "License");
* plugin once from any of the official sources it is provided. The availability of this code does * you may not use this file except in compliance with the License.
* not grant you the rights to modify, re-distribute, compile or redistribute this source code or * You may obtain a copy of the License at
* "plugin" outside this intended purpose. This license does not cover libraries developed by third *
* parties that are utilised in the plugin. * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/ */
package net.william278.husksync.event; package net.william278.husksync.event;

View File

@@ -1,14 +1,20 @@
/* /*
* This file is part of HuskSync by William278. Do not redistribute! * This file is part of HuskSync, licensed under the Apache License 2.0.
* *
* Copyright (c) William278 <will27528@gmail.com> * Copyright (c) William278 <will27528@gmail.com>
* All rights reserved. * Copyright (c) contributors
* *
* This source code is provided as reference to licensed individuals that have purchased the HuskSync * Licensed under the Apache License, Version 2.0 (the "License");
* plugin once from any of the official sources it is provided. The availability of this code does * you may not use this file except in compliance with the License.
* not grant you the rights to modify, re-distribute, compile or redistribute this source code or * You may obtain a copy of the License at
* "plugin" outside this intended purpose. This license does not cover libraries developed by third *
* parties that are utilised in the plugin. * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/ */
package net.william278.husksync.hook; package net.william278.husksync.hook;

View File

@@ -1,14 +1,20 @@
/* /*
* This file is part of HuskSync by William278. Do not redistribute! * This file is part of HuskSync, licensed under the Apache License 2.0.
* *
* Copyright (c) William278 <will27528@gmail.com> * Copyright (c) William278 <will27528@gmail.com>
* All rights reserved. * Copyright (c) contributors
* *
* This source code is provided as reference to licensed individuals that have purchased the HuskSync * Licensed under the Apache License, Version 2.0 (the "License");
* plugin once from any of the official sources it is provided. The availability of this code does * you may not use this file except in compliance with the License.
* not grant you the rights to modify, re-distribute, compile or redistribute this source code or * You may obtain a copy of the License at
* "plugin" outside this intended purpose. This license does not cover libraries developed by third *
* parties that are utilised in the plugin. * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/ */
package net.william278.husksync.hook; package net.william278.husksync.hook;

View File

@@ -1,14 +1,20 @@
/* /*
* This file is part of HuskSync by William278. Do not redistribute! * This file is part of HuskSync, licensed under the Apache License 2.0.
* *
* Copyright (c) William278 <will27528@gmail.com> * Copyright (c) William278 <will27528@gmail.com>
* All rights reserved. * Copyright (c) contributors
* *
* This source code is provided as reference to licensed individuals that have purchased the HuskSync * Licensed under the Apache License, Version 2.0 (the "License");
* plugin once from any of the official sources it is provided. The availability of this code does * you may not use this file except in compliance with the License.
* not grant you the rights to modify, re-distribute, compile or redistribute this source code or * You may obtain a copy of the License at
* "plugin" outside this intended purpose. This license does not cover libraries developed by third *
* parties that are utilised in the plugin. * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/ */
package net.william278.husksync.listener; package net.william278.husksync.listener;

View File

@@ -1,14 +1,20 @@
/* /*
* This file is part of HuskSync by William278. Do not redistribute! * This file is part of HuskSync, licensed under the Apache License 2.0.
* *
* Copyright (c) William278 <will27528@gmail.com> * Copyright (c) William278 <will27528@gmail.com>
* All rights reserved. * Copyright (c) contributors
* *
* This source code is provided as reference to licensed individuals that have purchased the HuskSync * Licensed under the Apache License, Version 2.0 (the "License");
* plugin once from any of the official sources it is provided. The availability of this code does * you may not use this file except in compliance with the License.
* not grant you the rights to modify, re-distribute, compile or redistribute this source code or * You may obtain a copy of the License at
* "plugin" outside this intended purpose. This license does not cover libraries developed by third *
* parties that are utilised in the plugin. * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/ */
package net.william278.husksync.migrator; package net.william278.husksync.migrator;

View File

@@ -1,14 +1,20 @@
/* /*
* This file is part of HuskSync by William278. Do not redistribute! * This file is part of HuskSync, licensed under the Apache License 2.0.
* *
* Copyright (c) William278 <will27528@gmail.com> * Copyright (c) William278 <will27528@gmail.com>
* All rights reserved. * Copyright (c) contributors
* *
* This source code is provided as reference to licensed individuals that have purchased the HuskSync * Licensed under the Apache License, Version 2.0 (the "License");
* plugin once from any of the official sources it is provided. The availability of this code does * you may not use this file except in compliance with the License.
* not grant you the rights to modify, re-distribute, compile or redistribute this source code or * You may obtain a copy of the License at
* "plugin" outside this intended purpose. This license does not cover libraries developed by third *
* parties that are utilised in the plugin. * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/ */
package net.william278.husksync.player; package net.william278.husksync.player;

View File

@@ -1,14 +1,20 @@
/* /*
* This file is part of HuskSync by William278. Do not redistribute! * This file is part of HuskSync, licensed under the Apache License 2.0.
* *
* Copyright (c) William278 <will27528@gmail.com> * Copyright (c) William278 <will27528@gmail.com>
* All rights reserved. * Copyright (c) contributors
* *
* This source code is provided as reference to licensed individuals that have purchased the HuskSync * Licensed under the Apache License, Version 2.0 (the "License");
* plugin once from any of the official sources it is provided. The availability of this code does * you may not use this file except in compliance with the License.
* not grant you the rights to modify, re-distribute, compile or redistribute this source code or * You may obtain a copy of the License at
* "plugin" outside this intended purpose. This license does not cover libraries developed by third *
* parties that are utilised in the plugin. * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/ */
package net.william278.husksync.player; package net.william278.husksync.player;

View File

@@ -1,14 +1,20 @@
/* /*
* This file is part of HuskSync by William278. Do not redistribute! * This file is part of HuskSync, licensed under the Apache License 2.0.
* *
* Copyright (c) William278 <will27528@gmail.com> * Copyright (c) William278 <will27528@gmail.com>
* All rights reserved. * Copyright (c) contributors
* *
* This source code is provided as reference to licensed individuals that have purchased the HuskSync * Licensed under the Apache License, Version 2.0 (the "License");
* plugin once from any of the official sources it is provided. The availability of this code does * you may not use this file except in compliance with the License.
* not grant you the rights to modify, re-distribute, compile or redistribute this source code or * You may obtain a copy of the License at
* "plugin" outside this intended purpose. This license does not cover libraries developed by third *
* parties that are utilised in the plugin. * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/ */
package net.william278.husksync.redis; package net.william278.husksync.redis;

View File

@@ -1,14 +1,20 @@
/* /*
* This file is part of HuskSync by William278. Do not redistribute! * This file is part of HuskSync, licensed under the Apache License 2.0.
* *
* Copyright (c) William278 <will27528@gmail.com> * Copyright (c) William278 <will27528@gmail.com>
* All rights reserved. * Copyright (c) contributors
* *
* This source code is provided as reference to licensed individuals that have purchased the HuskSync * Licensed under the Apache License, Version 2.0 (the "License");
* plugin once from any of the official sources it is provided. The availability of this code does * you may not use this file except in compliance with the License.
* not grant you the rights to modify, re-distribute, compile or redistribute this source code or * You may obtain a copy of the License at
* "plugin" outside this intended purpose. This license does not cover libraries developed by third *
* parties that are utilised in the plugin. * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/ */
package net.william278.husksync.redis; package net.william278.husksync.redis;

View File

@@ -1,14 +1,20 @@
/* /*
* This file is part of HuskSync by William278. Do not redistribute! * This file is part of HuskSync, licensed under the Apache License 2.0.
* *
* Copyright (c) William278 <will27528@gmail.com> * Copyright (c) William278 <will27528@gmail.com>
* All rights reserved. * Copyright (c) contributors
* *
* This source code is provided as reference to licensed individuals that have purchased the HuskSync * Licensed under the Apache License, Version 2.0 (the "License");
* plugin once from any of the official sources it is provided. The availability of this code does * you may not use this file except in compliance with the License.
* not grant you the rights to modify, re-distribute, compile or redistribute this source code or * You may obtain a copy of the License at
* "plugin" outside this intended purpose. This license does not cover libraries developed by third *
* parties that are utilised in the plugin. * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/ */
package net.william278.husksync.redis; package net.william278.husksync.redis;

View File

@@ -1,14 +1,20 @@
/* /*
* This file is part of HuskSync by William278. Do not redistribute! * This file is part of HuskSync, licensed under the Apache License 2.0.
* *
* Copyright (c) William278 <will27528@gmail.com> * Copyright (c) William278 <will27528@gmail.com>
* All rights reserved. * Copyright (c) contributors
* *
* This source code is provided as reference to licensed individuals that have purchased the HuskSync * Licensed under the Apache License, Version 2.0 (the "License");
* plugin once from any of the official sources it is provided. The availability of this code does * you may not use this file except in compliance with the License.
* not grant you the rights to modify, re-distribute, compile or redistribute this source code or * You may obtain a copy of the License at
* "plugin" outside this intended purpose. This license does not cover libraries developed by third *
* parties that are utilised in the plugin. * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/ */
package net.william278.husksync.redis; package net.william278.husksync.redis;

View File

@@ -1,14 +1,20 @@
/* /*
* This file is part of HuskSync by William278. Do not redistribute! * This file is part of HuskSync, licensed under the Apache License 2.0.
* *
* Copyright (c) William278 <will27528@gmail.com> * Copyright (c) William278 <will27528@gmail.com>
* All rights reserved. * Copyright (c) contributors
* *
* This source code is provided as reference to licensed individuals that have purchased the HuskSync * Licensed under the Apache License, Version 2.0 (the "License");
* plugin once from any of the official sources it is provided. The availability of this code does * you may not use this file except in compliance with the License.
* not grant you the rights to modify, re-distribute, compile or redistribute this source code or * You may obtain a copy of the License at
* "plugin" outside this intended purpose. This license does not cover libraries developed by third *
* parties that are utilised in the plugin. * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/ */
package net.william278.husksync.util; package net.william278.husksync.util;

View File

@@ -1,14 +1,20 @@
/* /*
* This file is part of HuskSync by William278. Do not redistribute! * This file is part of HuskSync, licensed under the Apache License 2.0.
* *
* Copyright (c) William278 <will27528@gmail.com> * Copyright (c) William278 <will27528@gmail.com>
* All rights reserved. * Copyright (c) contributors
* *
* This source code is provided as reference to licensed individuals that have purchased the HuskSync * Licensed under the Apache License, Version 2.0 (the "License");
* plugin once from any of the official sources it is provided. The availability of this code does * you may not use this file except in compliance with the License.
* not grant you the rights to modify, re-distribute, compile or redistribute this source code or * You may obtain a copy of the License at
* "plugin" outside this intended purpose. This license does not cover libraries developed by third *
* parties that are utilised in the plugin. * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/ */
package net.william278.husksync.util; package net.william278.husksync.util;

View File

@@ -0,0 +1,32 @@
-- Set the storage engine
SET DEFAULT_STORAGE_ENGINE = INNODB;
-- Enable foreign key constraints
SET FOREIGN_KEY_CHECKS = 1;
-- Create the users table if it does not exist
CREATE TABLE IF NOT EXISTS `%users_table%`
(
`uuid` char(36) NOT NULL UNIQUE,
`username` varchar(16) NOT NULL,
PRIMARY KEY (`uuid`)
) ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4
COLLATE = utf8mb4_unicode_ci;
CREATE INDEX IF NOT EXISTS `%users_table%_username` ON `%users_table%` (`username`);
-- Create the user data table if it does not exist
CREATE TABLE IF NOT EXISTS `%user_data_table%`
(
`version_uuid` char(36) NOT NULL UNIQUE,
`player_uuid` char(36) NOT NULL,
`timestamp` datetime NOT NULL,
`save_cause` varchar(32) NOT NULL,
`pinned` boolean NOT NULL DEFAULT FALSE,
`data` longblob NOT NULL,
PRIMARY KEY (`version_uuid`, `player_uuid`),
FOREIGN KEY (`player_uuid`) REFERENCES `%users_table%` (`uuid`) ON DELETE CASCADE
) ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4
COLLATE = utf8mb4_unicode_ci;

View File

@@ -1,14 +1,20 @@
/* /*
* This file is part of HuskSync by William278. Do not redistribute! * This file is part of HuskSync, licensed under the Apache License 2.0.
* *
* Copyright (c) William278 <will27528@gmail.com> * Copyright (c) William278 <will27528@gmail.com>
* All rights reserved. * Copyright (c) contributors
* *
* This source code is provided as reference to licensed individuals that have purchased the HuskSync * Licensed under the Apache License, Version 2.0 (the "License");
* plugin once from any of the official sources it is provided. The availability of this code does * you may not use this file except in compliance with the License.
* not grant you the rights to modify, re-distribute, compile or redistribute this source code or * You may obtain a copy of the License at
* "plugin" outside this intended purpose. This license does not cover libraries developed by third *
* parties that are utilised in the plugin. * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/ */
package net.william278.husksync; package net.william278.husksync;

View File

@@ -1,14 +1,20 @@
/* /*
* This file is part of HuskSync by William278. Do not redistribute! * This file is part of HuskSync, licensed under the Apache License 2.0.
* *
* Copyright (c) William278 <will27528@gmail.com> * Copyright (c) William278 <will27528@gmail.com>
* All rights reserved. * Copyright (c) contributors
* *
* This source code is provided as reference to licensed individuals that have purchased the HuskSync * Licensed under the Apache License, Version 2.0 (the "License");
* plugin once from any of the official sources it is provided. The availability of this code does * you may not use this file except in compliance with the License.
* not grant you the rights to modify, re-distribute, compile or redistribute this source code or * You may obtain a copy of the License at
* "plugin" outside this intended purpose. This license does not cover libraries developed by third *
* parties that are utilised in the plugin. * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/ */
package net.william278.husksync.data; package net.william278.husksync.data;

View File

@@ -1,14 +1,20 @@
/* /*
* This file is part of HuskSync by William278. Do not redistribute! * This file is part of HuskSync, licensed under the Apache License 2.0.
* *
* Copyright (c) William278 <will27528@gmail.com> * Copyright (c) William278 <will27528@gmail.com>
* All rights reserved. * Copyright (c) contributors
* *
* This source code is provided as reference to licensed individuals that have purchased the HuskSync * Licensed under the Apache License, Version 2.0 (the "License");
* plugin once from any of the official sources it is provided. The availability of this code does * you may not use this file except in compliance with the License.
* not grant you the rights to modify, re-distribute, compile or redistribute this source code or * You may obtain a copy of the License at
* "plugin" outside this intended purpose. This license does not cover libraries developed by third *
* parties that are utilised in the plugin. * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/ */
package net.william278.husksync.hook; package net.william278.husksync.hook;

View File

@@ -1,14 +1,20 @@
/* /*
* This file is part of HuskSync by William278. Do not redistribute! * This file is part of HuskSync, licensed under the Apache License 2.0.
* *
* Copyright (c) William278 <will27528@gmail.com> * Copyright (c) William278 <will27528@gmail.com>
* All rights reserved. * Copyright (c) contributors
* *
* This source code is provided as reference to licensed individuals that have purchased the HuskSync * Licensed under the Apache License, Version 2.0 (the "License");
* plugin once from any of the official sources it is provided. The availability of this code does * you may not use this file except in compliance with the License.
* not grant you the rights to modify, re-distribute, compile or redistribute this source code or * You may obtain a copy of the License at
* "plugin" outside this intended purpose. This license does not cover libraries developed by third *
* parties that are utilised in the plugin. * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/ */
package net.william278.husksync.player; package net.william278.husksync.player;

View File

@@ -1,11 +1,20 @@
[![HuskSync banner](https://raw.githubusercontent.com/WiIIiam278/HuskSync/master/images/banner.png)](https://github.com/WiIIiam278/HuskSync)
# HuskSync API v2
![](https://jitpack.io/v/WiIIiam278/HuskSync.svg)
The HuskSync API provides methods for retrieving and updating user data, as well as a number of events for tracking when user data is synced and saved. The HuskSync API provides methods for retrieving and updating user data, as well as a number of events for tracking when user data is synced and saved.
The API is distributed via [JitPack](https://jitpack.io/#net.william278/HuskSync). Please note that the HuskSync v1 API is not compatible. ## Compatibility
(Some) javadocs are also available to view on Jitpack [here](https://javadoc.jitpack.io/net/william278/HuskSync/latest/javadoc/). [![Maven](https://repo.william278.net/api/badge/latest/releases/net/william278/husksync?color=00fb9a&name=Maven&prefix=v)](https://repo.william278.net/#/releases/net/william278/husksync/)
The HuskSync API shares version numbering with the plugin itself for consistency and convenience. Please note minor and patch plugin releases may make API additions and deprecations, but will not introduce breaking changes without notice.
| API Version | HuskSync Versions | Supported |
|:-----------:|:--------------------:|:---------:|
| v2.x | _v2.0&mdash;Current_ | ✅ |
| v1.x | _v1.0&mdash;v1.4.1_ | ❌️ |
<details>
<summary>Targeting older versions</summary>
HuskSync versions prior to `v2.2.5` are distributed on [JitPack](https://jitpack.io/#/net/william278/HuskSync), and you will need to use the `https://jitpack.io` repository instead.
</details>
## Table of contents ## Table of contents
1. Adding the API to your project 1. Adding the API to your project
@@ -17,21 +26,21 @@ The API is distributed via [JitPack](https://jitpack.io/#net.william278/HuskSync
<details> <details>
<summary>Maven setup information</summary> <summary>Maven setup information</summary>
- Add the repository to your `pom.xml` as per below. Add the repository to your `pom.xml` as per below. You can alternatively specify `/snapshots` for the repository containing the latest development builds (not recommended).
```xml ```xml
<repositories> <repositories>
<repository> <repository>
<id>jitpack.io</id> <id>william278.net</id>
<url>https://jitpack.io</url> <url>https://repo.william278.net/releases</url>
</repository> </repository>
</repositories> </repositories>
``` ```
- Add the dependency to your `pom.xml` as per below. Replace `version` with the latest version of HuskSync (without the v): ![Latest version](https://img.shields.io/github/v/tag/WiIIiam278/HuskSync?color=%23282828&label=%20&style=flat-square) Add the dependency to your `pom.xml` as per below. Replace `VERSION` with the latest version of HuskSync (without the v): ![Latest version](https://img.shields.io/github/v/tag/WiIIiam278/HuskSync?color=%23282828&label=%20&style=flat-square)
```xml ```xml
<dependency> <dependency>
<groupId>net.william278</groupId> <groupId>net.william278</groupId>
<artifactId>HuskSync</artifactId> <artifactId>husksync</artifactId>
<version>version</version> <version>VERSION</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
``` ```
@@ -41,19 +50,19 @@ The API is distributed via [JitPack](https://jitpack.io/#net.william278/HuskSync
<details> <details>
<summary>Gradle setup information</summary> <summary>Gradle setup information</summary>
- Add the dependency like so to your `build.gradle`: Add the dependency as per below to your `build.gradle`. You can alternatively specify `/snapshots` for the repository containing the latest development builds (not recommended).
```groovy ```groovy
allprojects { allprojects {
repositories { repositories {
maven { url 'https://jitpack.io' } maven { url 'https://repo.william278.net/releases' }
} }
} }
``` ```
- Add the dependency as per below. Replace `version` with the latest version of HuskSync (without the v): ![Latest version](https://img.shields.io/github/v/tag/WiIIiam278/HuskSync?color=%23282828&label=%20&style=flat-square) Add the dependency as per below. Replace `VERSION` with the latest version of HuskSync (without the v): ![Latest version](https://img.shields.io/github/v/tag/WiIIiam278/HuskSync?color=%23282828&label=%20&style=flat-square)
```groovy ```groovy
dependencies { dependencies {
compileOnly 'net.william278:HuskSync:version' compileOnly 'net.william278:husksync:VERSION'
} }
``` ```
</details> </details>

View File

@@ -3,29 +3,43 @@ This page addresses a number of frequently asked questions about the plugin.
## Frequently Asked Questions ## Frequently Asked Questions
<details> <details>
<summary>&nbsp;<b>What data can be synchronised?</b></summary> <summary>&nbsp;<b>What data can be synchronized?</b></summary>
HuskSync supports synchronising a wide range of different data elements, each of which can be toggled to your liking. Please check out the [[Sync Features]] page for a full list. HuskSync supports synchronising a wide range of different data elements, each of which can be toggled to your liking. Please check out the [[Sync Features]] page for a full list.
</details> </details>
<details> <details>
<summary>&nbsp;<b>Is Redis required? What is Redis?</b></summary> <summary>&nbsp;<b>Are modded items supported?</b></summary>
HuskSync requires Redis to operate (for reasons demonstrated below). Redis is an in-memory database server used for caching data at scale and sending messages across a network. You have a Redis server in a similar fashion to the way you have a MySQL database server. If you're using a Minecraft hosting company, you'll want to contact their support and ask if they offer Redis. If you're looking for a host, I have a list of some popular hosts and whether or not they support Redis [available to read here.](https://william278.net/redis-hosts) Modded items are not supported.
</details> </details>
<details> <details>
<summary>&nbsp;<b>How does the plugin synchronise data?</b></summary> <summary>&nbsp;<b>Are MMOItems / SlimeFun items supported?</b></summary>
[![System diagram](https://raw.githubusercontent.com/WiIIiam278/HuskSync/master/images/system-diagram.png)](#) No. MMOItems and SlimeFun are not compatible with HuskSync due to the way they inject data directly into item NBT rather than the Spigot API's plugin-agnostic PersistentDataContainer.
</details>
<details>
<summary>&nbsp;<b>Is Redis required? What is Redis?</b></summary>
HuskSync requires Redis to operate (for reasons demonstrated below). Redis is an in-memory database server used for caching data at scale and sending messages across a network. You have a Redis server in a similar fashion to the way you have a MySQL database server. If you're using a Minecraft hosting company, you'll want to contact their support and ask if they offer Redis. If you're looking for a host, I have a list of some popular hosts and whether they support Redis [available to read here.](https://william278.net/redis-hosts)
</details>
<details>
<summary>&nbsp;<b>How does the plugin synchronize data?</b></summary>
![System diagram](https://raw.githubusercontent.com/WiIIiam278/HuskSync/master/images/system-diagram.png)
HuskSync makes use of both MySQL and Redis for optimal data synchronisation. HuskSync makes use of both MySQL and Redis for optimal data synchronisation.
When a user changes servers, in addition to data being saved to MySQL, it is also cached via the Redis server with a temproary expiry key. When changing servers, the receiving server detects the key and sets the user data from Redis. When a player rejoins the network, the system fetches the last-saved data snapshot from the MySQL Database. When a user changes servers, in addition to data being saved to MySQL, it is also cached via the Redis server with a temproary expiry key. When changing servers, the receiving server detects the key and sets the user data from Redis. When a player rejoins the network, the system fetches the last-saved data snapshot from the MySQL Database.
This approach is able to dramatically improve both synchronisation performance and reliability. A few other techniques are used to optimize this process, such as comrpessing the serialized user data json using Snappy. This approach is able to dramatically improve both synchronization performance and reliability. A few other techniques are used to optimize this process, such as compressing the serialized user data json using Snappy.
</details> </details>
@@ -47,7 +61,9 @@ As a result, I recommend using an economy plugin (that directly *implements* the
<details> <details>
<summary>&nbsp;<b>Is this better than MySQLPlayerDataBridge?</b></summary> <summary>&nbsp;<b>Is this better than MySQLPlayerDataBridge?</b></summary>
I can't provide a fair answer to this question! What I can say is that your mileage may vary. The performance improvements offered by HuskSync's synchronisation method will depend on your network environment and the economies of scale that come with your player count. I can't provide a fair answer to this question! What I can say is that your mileage may vary. The performance improvements offered by HuskSync's synchronization method will depend on your network environment and the economies of scale that come with your player count.
With that said, servers running plugins or mods that make use of custom items (such as MMOItems, SlimeFun) are not supported by HuskSync and so MySQLPlayerDataBridge may be a better choice for you.
A migrator from MPDB is built-in to HuskSync. A migrator from MPDB is built-in to HuskSync.

View File

@@ -27,5 +27,5 @@ Welcome! This is the plugin documentation for HuskSync v2.x+. Please click throu
* 📂 [Buy HuskSync](https://www.spigotmc.org/resources/husksync.97144/) * 📂 [Buy HuskSync](https://www.spigotmc.org/resources/husksync.97144/)
* 🛒 [Spigot](https://www.spigotmc.org/resources/husksync.97144/) * 🛒 [Spigot](https://www.spigotmc.org/resources/husksync.97144/)
* 🛒 [Polymart](https://polymart.org/resource/husksync.1634) * 🛒 [Polymart](https://polymart.org/resource/husksync.1634)
* 🛒 [Songoda](https://songoda.com/marketplace/product/husksync-a-modern-cross-server-player-data-synchronization-system.758) * 🛒 [Craftaro](https://craftaro.com/marketplace/product/husksync.758)
* 💬 [Discord Support](https://discord.gg/tVYhJfyDWG) * 💬 [Discord Support](https://discord.gg/tVYhJfyDWG)

View File

@@ -7,28 +7,30 @@ You can customise how much data HuskSync saves about a player by [turning each s
| Name | Description | Availability | | Name | Description | Availability |
|---------------------------|-------------------------------------------------------------|:------------:| |---------------------------|-------------------------------------------------------------|:------------:|
| Inventories | Items in player inventories & selected hotbar slot | ✅ | | Inventories | Items in player inventories & selected hotbar slot | ✅ |
| Ender chests | Items in ender chests&midast; | ✅ | | Ender chests | Items in ender chests&midast; | ✅ |
| Health | Player health points | ✅ | | Health | Player health points | ✅ |
| Max health | Player max health points and health scale | ✅ | | Max health | Player max health points and health scale | ✅ |
| Hunger | Player hunger, saturation & exhaustion | ✅ | | Hunger | Player hunger, saturation & exhaustion | ✅ |
| Experience | Player level, experience points & score | ✅ | | Experience | Player level, experience points & score | ✅ |
| Potion effects | Active status effects on players | ✅ | | Potion effects | Active status effects on players | ✅ |
| Advancements | Player advancements, recipes & progress | ✅ | | Advancements | Player advancements, recipes & progress | ✅ |
| Game modes | Player's current game mode | ✅ | | Game modes | Player's current game mode | ✅ |
| Statistics | Player's in-game stats (ESC -> Statistics) | ✅ | | Statistics | Player's in-game stats (ESC -> Statistics) | ✅ |
| Location | Player's current coordinate positon and world&dagger; | ✅ | | Location | Player's current coordinate positon and world&dagger; | ✅ |
| Persistent Data Container | Custom plugin persistent data key map | ⚠️ | | Persistent Data Container | Custom plugin persistent data key map | ⚠️ |
| Locked maps | Maps/treasure maps locked in a cartography table | ⚠️ | | Locked maps | Maps/treasure maps locked in a cartography table | ⚠️ |
| Unlocked maps | Regular, unlocked maps/treasure maps ([why?](#map-syncing)) | ❌ | | Unlocked maps | Regular, unlocked maps/treasure maps ([why?](#map-syncing)) | ❌ |
| Economy balances | Vault economy balance. ([why?](#economy-syncing)) | ❌ | | Economy balances | Vault economy balance. ([why?](#economy-syncing)) | ❌ |
What about modded items? Or custom item plugins such as MMOItems or SlimeFun? These items are **not compatible**&mdash;check the [[FAQs]] for more information.
&midast;Purpur's custom ender chest resizing feature is also supported. &midast;Purpur's custom ender chest resizing feature is also supported.
&dagger;This is intended for servers that have mirrorred worlds across instances (such as RPG servers). With this option enabled, players will be placed at the same coordinates when changing servers. &dagger;This is intended for servers that have mirrorred worlds across instances (such as RPG servers). With this option enabled, players will be placed at the same coordinates when changing servers.
### PersistentDataContainer tags ### PersistentDataContainer tags
The player [PersistentDataContainer](https://blog.jeff-media.com/persistent-data-container-the-better-alternative-to-nbt-tags/) is a part of the Spigot API that enables plugins to set custom data tags to players, entities & items and have them persist. HuskSync will synchronise this data cross-server. Plugins that use legacy or propietary forms of saving data, such as by modifying NBT directly, may not correctly synchronise. The player [PersistentDataContainer](https://blog.jeff-media.com/persistent-data-container-the-better-alternative-to-nbt-tags/) is a part of the Spigot API that enables plugins to set custom data tags to players, entities & items and have them persist. HuskSync will synchronise this data cross-server. Plugins that use legacy or proprietary forms of saving data, such as by modifying NBT directly, may not correctly synchronise.
### Custom enchantments ### Custom enchantments
Plugins that add custom enchantments by registering them to ItemStacks through setting them via the [EnchantmentStorageMeta](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/inventory/meta/EnchantmentStorageMeta.html) will work, but note that the plugin _must_ be lower on the load order than HuskSync; in other words, HuskSync should be on the plugin's `loadbefore:`. This is because Spigot's item serialization API requires that the plugin that registered the enchantment be online to serialize it due to how it reads from the enchantment registry and so if the plugin does not load before (and thus does not shut down after) HuskSync, it won't be able to serialize the custom enchantments in the event of a server shutdown with players online. Plugins that add custom enchantments by registering them to ItemStacks through setting them via the [EnchantmentStorageMeta](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/inventory/meta/EnchantmentStorageMeta.html) will work, but note that the plugin _must_ be lower on the load order than HuskSync; in other words, HuskSync should be on the plugin's `loadbefore:`. This is because Spigot's item serialization API requires that the plugin that registered the enchantment be online to serialize it due to how it reads from the enchantment registry and so if the plugin does not load before (and thus does not shut down after) HuskSync, it won't be able to serialize the custom enchantments in the event of a server shutdown with players online.
@@ -41,10 +43,10 @@ However, experimental support for synchronising locked map items&mdash;that is,
### Economy syncing ### Economy syncing
Although it's a common request, HuskSync doesn't synchronise economy data for a number of reasons! Although it's a common request, HuskSync doesn't synchronise economy data for a number of reasons!
I strongly reccommend making use of economy plugins that have cross-server economy balance synchronisation built-in, of which there are a multitude of options available. Please see our [[FAQs]] section for more details on this decision. I strongly recommend making use of economy plugins that have cross-server economy balance synchronisation built-in, of which there are a multitude of options available. Please see our [[FAQs]] section for more details on this decision.
## Toggling Sync Features ## Toggling Sync Features
All synchronisation features, except location and locked map synchronising, are enabled by default. To toggle a feature, navigate to the `features:` section in the `synchronisation:` part of your `config.yml` file, and change the option to `true`/`false` respectively. All synchronization features, except location and locked map synchronising, are enabled by default. To toggle a feature, navigate to the `features:` section in the `synchronisation:` part of your `config.yml` file, and change the option to `true`/`false` respectively.
<details> <details>
<summary>Example in config.yml</summary> <summary>Example in config.yml</summary>

View File

@@ -24,5 +24,5 @@
* 📂 [Buy HuskSync](https://www.spigotmc.org/resources/husksync.97144/) * 📂 [Buy HuskSync](https://www.spigotmc.org/resources/husksync.97144/)
* 🛒 [Spigot](https://www.spigotmc.org/resources/husksync.97144/) * 🛒 [Spigot](https://www.spigotmc.org/resources/husksync.97144/)
* 🛒 [Polymart](https://polymart.org/resource/husksync.1634) * 🛒 [Polymart](https://polymart.org/resource/husksync.1634)
* 🛒 [Songoda](https://songoda.com/marketplace/product/husksync-a-modern-cross-server-player-data-synchronization-system.758) * 🛒 [Craftaro](https://craftaro.com/marketplace/product/husksync.758)
* 💬 [Discord Support](https://discord.gg/tVYhJfyDWG) * 💬 [Discord Support](https://discord.gg/tVYhJfyDWG)

View File

@@ -3,11 +3,12 @@ org.gradle.jvmargs='-Dfile.encoding=UTF-8'
org.gradle.daemon=true org.gradle.daemon=true
javaVersion=16 javaVersion=16
plugin_version=2.2.5 plugin_version=2.2.8
plugin_archive=husksync plugin_archive=husksync
plugin_description=A modern, cross-server player data synchronization system plugin_description=A modern, cross-server player data synchronization system
jedis_version=4.3.2 jedis_version=4.3.2
mysql_driver_version=8.0.32 mysql_driver_version=8.1.0
mariadb_driver_version=3.1.4
snappy_version=1.1.9.1 snappy_version=1.1.9.1
commons_text_version=1.10.0 commons_text_version=1.10.0