From 704e4b12f82183d0046f655076f10bf555d35a76 Mon Sep 17 00:00:00 2001 From: William Date: Fri, 20 May 2022 17:30:24 +0100 Subject: [PATCH] Remove old files --- .github/FUNDING.yml | 4 - .github/dependabot.yml | 11 - .github/workflows/maven.yml | 25 - .gitignore | 141 +-- .jitpack/ensure-java-16 | 19 - README.md | 72 -- jitpack.yml | 9 - pom.xml | 214 ----- .../me/william278/huskhomes2/HuskHomes.java | 305 ------ .../huskhomes2/api/HuskHomesAPI.java | 266 ------ .../PlayerChangeHomeDescriptionEvent.java | 44 - .../PlayerChangeWarpDescriptionEvent.java | 44 - .../api/events/PlayerDeleteHomeEvent.java | 20 - .../api/events/PlayerDeleteWarpEvent.java | 20 - .../api/events/PlayerHomeUpdateEvent.java | 61 -- .../events/PlayerMakeHomePrivateEvent.java | 20 - .../api/events/PlayerMakeHomePublicEvent.java | 20 - .../api/events/PlayerPreTeleportEvent.java | 64 -- .../api/events/PlayerRelocateHomeEvent.java | 45 - .../api/events/PlayerRelocateWarpEvent.java | 45 - .../api/events/PlayerRenameHomeEvent.java | 44 - .../api/events/PlayerRenameWarpEvent.java | 44 - .../api/events/PlayerSetHomeEvent.java | 58 -- .../api/events/PlayerSetWarpEvent.java | 58 -- .../api/events/PlayerWarpUpdateEvent.java | 62 -- .../huskhomes2/commands/BackCommand.java | 32 - .../huskhomes2/commands/CommandBase.java | 52 -- .../huskhomes2/commands/DelHomeCommand.java | 37 - .../huskhomes2/commands/DelWarpCommand.java | 29 - .../huskhomes2/commands/EditHomeCommand.java | 344 ------- .../huskhomes2/commands/EditWarpCommand.java | 221 ----- .../huskhomes2/commands/HomeCommand.java | 110 --- .../huskhomes2/commands/HomeListCommand.java | 98 -- .../huskhomes2/commands/HuskHomesCommand.java | 197 ---- .../commands/PublicHomeCommand.java | 157 ---- .../commands/PublicHomeListCommand.java | 74 -- .../huskhomes2/commands/RtpCommand.java | 46 - .../huskhomes2/commands/SetHomeCommand.java | 40 - .../huskhomes2/commands/SetSpawnCommand.java | 25 - .../huskhomes2/commands/SetWarpCommand.java | 20 - .../huskhomes2/commands/SpawnCommand.java | 46 - .../huskhomes2/commands/TpAcceptCommand.java | 19 - .../huskhomes2/commands/TpAllCommand.java | 21 - .../huskhomes2/commands/TpCommand.java | 381 -------- .../huskhomes2/commands/TpDenyCommand.java | 20 - .../huskhomes2/commands/TpHereCommand.java | 38 - .../huskhomes2/commands/TpIgnoreCommand.java | 45 - .../huskhomes2/commands/TpOfflineCommand.java | 33 - .../huskhomes2/commands/TpaAllCommand.java | 14 - .../huskhomes2/commands/TpaCommand.java | 20 - .../huskhomes2/commands/TpaHereCommand.java | 20 - .../huskhomes2/commands/WarpCommand.java | 154 --- .../huskhomes2/commands/WarpListCommand.java | 82 -- .../huskhomes2/config/Settings.java | 599 ------------ .../huskhomes2/data/DataManager.java | 876 ------------------ .../message/CrossServerMessageHandler.java | 121 --- .../huskhomes2/data/message/Message.java | 93 -- .../message/pluginmessage/PluginMessage.java | 95 -- .../pluginmessage/PluginMessageReceiver.java | 68 -- .../data/message/redis/RedisMessage.java | 50 - .../data/message/redis/RedisReceiver.java | 124 --- .../huskhomes2/data/sql/Database.java | 30 - .../william278/huskhomes2/data/sql/MySQL.java | 126 --- .../huskhomes2/data/sql/SQLite.java | 158 ---- .../integrations/VanishChecker.java | 18 - .../integrations/VaultIntegration.java | 38 - .../huskhomes2/integrations/map/BlueMap.java | 199 ---- .../huskhomes2/integrations/map/DynMap.java | 151 --- .../huskhomes2/integrations/map/Map.java | 84 -- .../integrations/map/SquareMap.java | 207 ----- .../huskhomes2/listeners/PlayerListener.java | 138 --- .../migrators/EssentialsMigrator.java | 214 ----- .../huskhomes2/migrators/UpgradeDatabase.java | 117 --- .../huskhomes2/teleport/SettingHandler.java | 480 ---------- .../huskhomes2/teleport/TeleportManager.java | 338 ------- .../huskhomes2/teleport/TeleportRequest.java | 40 - .../teleport/TeleportRequestHandler.java | 246 ----- .../huskhomes2/teleport/TimedTeleport.java | 210 ----- .../huskhomes2/teleport/points/Home.java | 190 ---- .../teleport/points/RandomPoint.java | 124 --- .../huskhomes2/teleport/points/SetPoint.java | 82 -- .../teleport/points/TeleportationPoint.java | 163 ---- .../huskhomes2/teleport/points/Warp.java | 66 -- .../william278/huskhomes2/util/ChatList.java | 71 -- .../huskhomes2/util/EditingHandler.java | 64 -- .../huskhomes2/util/MessageManager.java | 143 --- .../huskhomes2/util/NameAutoCompleter.java | 40 - .../huskhomes2/util/PlayerList.java | 56 -- .../william278/huskhomes2/util/RegexUtil.java | 11 - .../huskhomes2/util/UpdateChecker.java | 57 -- src/main/resources/config.yml | 98 -- src/main/resources/languages/de-de.yml | 153 --- src/main/resources/languages/en-gb.yml | 153 --- src/main/resources/languages/es-es.yml | 153 --- src/main/resources/languages/it-it.yml | 153 --- src/main/resources/languages/pl.yml | 153 --- src/main/resources/languages/zh-cn.yml | 153 --- src/main/resources/languages/zh-tw.yml | 153 --- .../resources/marker-icons/public_home.png | Bin 661 -> 0 bytes src/main/resources/marker-icons/warp.png | Bin 663 -> 0 bytes src/main/resources/plugin.yml | 281 ------ 101 files changed, 36 insertions(+), 11391 deletions(-) delete mode 100644 .github/FUNDING.yml delete mode 100644 .github/dependabot.yml delete mode 100644 .github/workflows/maven.yml delete mode 100644 .jitpack/ensure-java-16 delete mode 100644 README.md delete mode 100644 jitpack.yml delete mode 100644 pom.xml delete mode 100644 src/main/java/me/william278/huskhomes2/HuskHomes.java delete mode 100644 src/main/java/me/william278/huskhomes2/api/HuskHomesAPI.java delete mode 100644 src/main/java/me/william278/huskhomes2/api/events/PlayerChangeHomeDescriptionEvent.java delete mode 100644 src/main/java/me/william278/huskhomes2/api/events/PlayerChangeWarpDescriptionEvent.java delete mode 100644 src/main/java/me/william278/huskhomes2/api/events/PlayerDeleteHomeEvent.java delete mode 100644 src/main/java/me/william278/huskhomes2/api/events/PlayerDeleteWarpEvent.java delete mode 100644 src/main/java/me/william278/huskhomes2/api/events/PlayerHomeUpdateEvent.java delete mode 100644 src/main/java/me/william278/huskhomes2/api/events/PlayerMakeHomePrivateEvent.java delete mode 100644 src/main/java/me/william278/huskhomes2/api/events/PlayerMakeHomePublicEvent.java delete mode 100644 src/main/java/me/william278/huskhomes2/api/events/PlayerPreTeleportEvent.java delete mode 100644 src/main/java/me/william278/huskhomes2/api/events/PlayerRelocateHomeEvent.java delete mode 100644 src/main/java/me/william278/huskhomes2/api/events/PlayerRelocateWarpEvent.java delete mode 100644 src/main/java/me/william278/huskhomes2/api/events/PlayerRenameHomeEvent.java delete mode 100644 src/main/java/me/william278/huskhomes2/api/events/PlayerRenameWarpEvent.java delete mode 100644 src/main/java/me/william278/huskhomes2/api/events/PlayerSetHomeEvent.java delete mode 100644 src/main/java/me/william278/huskhomes2/api/events/PlayerSetWarpEvent.java delete mode 100644 src/main/java/me/william278/huskhomes2/api/events/PlayerWarpUpdateEvent.java delete mode 100644 src/main/java/me/william278/huskhomes2/commands/BackCommand.java delete mode 100644 src/main/java/me/william278/huskhomes2/commands/CommandBase.java delete mode 100644 src/main/java/me/william278/huskhomes2/commands/DelHomeCommand.java delete mode 100644 src/main/java/me/william278/huskhomes2/commands/DelWarpCommand.java delete mode 100644 src/main/java/me/william278/huskhomes2/commands/EditHomeCommand.java delete mode 100644 src/main/java/me/william278/huskhomes2/commands/EditWarpCommand.java delete mode 100644 src/main/java/me/william278/huskhomes2/commands/HomeCommand.java delete mode 100644 src/main/java/me/william278/huskhomes2/commands/HomeListCommand.java delete mode 100644 src/main/java/me/william278/huskhomes2/commands/HuskHomesCommand.java delete mode 100644 src/main/java/me/william278/huskhomes2/commands/PublicHomeCommand.java delete mode 100644 src/main/java/me/william278/huskhomes2/commands/PublicHomeListCommand.java delete mode 100644 src/main/java/me/william278/huskhomes2/commands/RtpCommand.java delete mode 100644 src/main/java/me/william278/huskhomes2/commands/SetHomeCommand.java delete mode 100644 src/main/java/me/william278/huskhomes2/commands/SetSpawnCommand.java delete mode 100644 src/main/java/me/william278/huskhomes2/commands/SetWarpCommand.java delete mode 100644 src/main/java/me/william278/huskhomes2/commands/SpawnCommand.java delete mode 100644 src/main/java/me/william278/huskhomes2/commands/TpAcceptCommand.java delete mode 100644 src/main/java/me/william278/huskhomes2/commands/TpAllCommand.java delete mode 100644 src/main/java/me/william278/huskhomes2/commands/TpCommand.java delete mode 100644 src/main/java/me/william278/huskhomes2/commands/TpDenyCommand.java delete mode 100644 src/main/java/me/william278/huskhomes2/commands/TpHereCommand.java delete mode 100644 src/main/java/me/william278/huskhomes2/commands/TpIgnoreCommand.java delete mode 100644 src/main/java/me/william278/huskhomes2/commands/TpOfflineCommand.java delete mode 100644 src/main/java/me/william278/huskhomes2/commands/TpaAllCommand.java delete mode 100644 src/main/java/me/william278/huskhomes2/commands/TpaCommand.java delete mode 100644 src/main/java/me/william278/huskhomes2/commands/TpaHereCommand.java delete mode 100644 src/main/java/me/william278/huskhomes2/commands/WarpCommand.java delete mode 100644 src/main/java/me/william278/huskhomes2/commands/WarpListCommand.java delete mode 100644 src/main/java/me/william278/huskhomes2/config/Settings.java delete mode 100644 src/main/java/me/william278/huskhomes2/data/DataManager.java delete mode 100644 src/main/java/me/william278/huskhomes2/data/message/CrossServerMessageHandler.java delete mode 100644 src/main/java/me/william278/huskhomes2/data/message/Message.java delete mode 100644 src/main/java/me/william278/huskhomes2/data/message/pluginmessage/PluginMessage.java delete mode 100644 src/main/java/me/william278/huskhomes2/data/message/pluginmessage/PluginMessageReceiver.java delete mode 100644 src/main/java/me/william278/huskhomes2/data/message/redis/RedisMessage.java delete mode 100644 src/main/java/me/william278/huskhomes2/data/message/redis/RedisReceiver.java delete mode 100644 src/main/java/me/william278/huskhomes2/data/sql/Database.java delete mode 100644 src/main/java/me/william278/huskhomes2/data/sql/MySQL.java delete mode 100644 src/main/java/me/william278/huskhomes2/data/sql/SQLite.java delete mode 100644 src/main/java/me/william278/huskhomes2/integrations/VanishChecker.java delete mode 100644 src/main/java/me/william278/huskhomes2/integrations/VaultIntegration.java delete mode 100644 src/main/java/me/william278/huskhomes2/integrations/map/BlueMap.java delete mode 100644 src/main/java/me/william278/huskhomes2/integrations/map/DynMap.java delete mode 100644 src/main/java/me/william278/huskhomes2/integrations/map/Map.java delete mode 100644 src/main/java/me/william278/huskhomes2/integrations/map/SquareMap.java delete mode 100644 src/main/java/me/william278/huskhomes2/listeners/PlayerListener.java delete mode 100644 src/main/java/me/william278/huskhomes2/migrators/EssentialsMigrator.java delete mode 100644 src/main/java/me/william278/huskhomes2/migrators/UpgradeDatabase.java delete mode 100644 src/main/java/me/william278/huskhomes2/teleport/SettingHandler.java delete mode 100644 src/main/java/me/william278/huskhomes2/teleport/TeleportManager.java delete mode 100644 src/main/java/me/william278/huskhomes2/teleport/TeleportRequest.java delete mode 100644 src/main/java/me/william278/huskhomes2/teleport/TeleportRequestHandler.java delete mode 100644 src/main/java/me/william278/huskhomes2/teleport/TimedTeleport.java delete mode 100644 src/main/java/me/william278/huskhomes2/teleport/points/Home.java delete mode 100644 src/main/java/me/william278/huskhomes2/teleport/points/RandomPoint.java delete mode 100644 src/main/java/me/william278/huskhomes2/teleport/points/SetPoint.java delete mode 100644 src/main/java/me/william278/huskhomes2/teleport/points/TeleportationPoint.java delete mode 100644 src/main/java/me/william278/huskhomes2/teleport/points/Warp.java delete mode 100644 src/main/java/me/william278/huskhomes2/util/ChatList.java delete mode 100644 src/main/java/me/william278/huskhomes2/util/EditingHandler.java delete mode 100644 src/main/java/me/william278/huskhomes2/util/MessageManager.java delete mode 100644 src/main/java/me/william278/huskhomes2/util/NameAutoCompleter.java delete mode 100644 src/main/java/me/william278/huskhomes2/util/PlayerList.java delete mode 100644 src/main/java/me/william278/huskhomes2/util/RegexUtil.java delete mode 100644 src/main/java/me/william278/huskhomes2/util/UpdateChecker.java delete mode 100644 src/main/resources/config.yml delete mode 100644 src/main/resources/languages/de-de.yml delete mode 100644 src/main/resources/languages/en-gb.yml delete mode 100644 src/main/resources/languages/es-es.yml delete mode 100644 src/main/resources/languages/it-it.yml delete mode 100644 src/main/resources/languages/pl.yml delete mode 100644 src/main/resources/languages/zh-cn.yml delete mode 100644 src/main/resources/languages/zh-tw.yml delete mode 100644 src/main/resources/marker-icons/public_home.png delete mode 100644 src/main/resources/marker-icons/warp.png delete mode 100644 src/main/resources/plugin.yml diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml deleted file mode 100644 index 4022a0da..00000000 --- a/.github/FUNDING.yml +++ /dev/null @@ -1,4 +0,0 @@ -# These are supported funding model platforms - -github: WiIIiam278 -custom: https://www.buymeacoffee.com/william278 diff --git a/.github/dependabot.yml b/.github/dependabot.yml deleted file mode 100644 index 76e22beb..00000000 --- a/.github/dependabot.yml +++ /dev/null @@ -1,11 +0,0 @@ -# To get started with Dependabot version updates, you'll need to specify which -# package ecosystems to update and where the package manifests are located. -# Please see the documentation for all configuration options: -# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates - -version: 2 -updates: - - package-ecosystem: "maven" # See documentation for possible values - directory: "/" # Location of package manifests - schedule: - interval: "daily" diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml deleted file mode 100644 index d5f93ce3..00000000 --- a/.github/workflows/maven.yml +++ /dev/null @@ -1,25 +0,0 @@ -# This workflow will build a Java project with Maven -# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven - -name: Java CI with Maven - -on: - push: - branches: [ master ] - pull_request: - branches: [ master ] - -jobs: - build: - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - name: Set up JDK 16 - uses: actions/setup-java@v2 - with: - java-version: '16' - distribution: 'adopt' - - name: Build with Maven - run: mvn -B clean package --file pom.xml diff --git a/.gitignore b/.gitignore index 87d4436c..75481bd6 100644 --- a/.gitignore +++ b/.gitignore @@ -1,113 +1,44 @@ -# User-specific stuff -.idea/ +.gradle +build/ +!gradle/wrapper/gradle-wrapper.jar +!**/src/main/**/build/ +!**/src/test/**/build/ +### IntelliJ IDEA ### +.idea/modules.xml +.idea/jarRepositories.xml +.idea/compiler.xml +.idea/libraries/ +*.iws *.iml *.ipr -*.iws - -# IntelliJ out/ +!**/src/main/**/out/ +!**/src/test/**/out/ +/.idea/ +/target/ -# Compiled class file -*.class +### Eclipse ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache +bin/ +!**/src/main/**/bin/ +!**/src/test/**/bin/ -# Log file -*.log +### NetBeans ### +/nbproject/private/ +/nbbuild/ +/dist/ +/nbdist/ +/.nb-gradle/ -# BlueJ files -*.ctxt +### VS Code ### +.vscode/ -# Package Files # -*.jar -*.war -*.nar -*.ear -*.zip -*.tar.gz -*.rar - -# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml -hs_err_pid* - -*~ - -# temporary files which can be created if a process still has a handle open of a deleted file -.fuse_hidden* - -# KDE directory preferences -.directory - -# Linux trash folder which might appear on any partition or disk -.Trash-* - -# .nfs files are created when an open file is removed but is still being accessed -.nfs* - -# General -.DS_Store -.AppleDouble -.LSOverride - -# Icon must end with two \r -Icon - -# Thumbnails -._* - -# Files that might appear in the root of a volume -.DocumentRevisions-V100 -.fseventsd -.Spotlight-V100 -.TemporaryItems -.Trashes -.VolumeIcon.icns -.com.apple.timemachine.donotpresent - -# Directories potentially created on remote AFP share -.AppleDB -.AppleDesktop -Network Trash Folder -Temporary Items -.apdisk - -# Windows thumbnail cache files -Thumbs.db -Thumbs.db:encryptable -ehthumbs.db -ehthumbs_vista.db - -# Dump file -*.stackdump - -# Folder config file -[Dd]esktop.ini - -# Recycle Bin used on file shares -$RECYCLE.BIN/ - -# Windows Installer files -*.cab -*.msi -*.msix -*.msm -*.msp - -# Windows shortcuts -*.lnk - -target/ - -pom.xml.tag -pom.xml.releaseBackup -pom.xml.versionsBackup -pom.xml.next - -release.properties -dependency-reduced-pom.xml -buildNumber.properties -.mvn/timing.properties -.mvn/wrapper/maven-wrapper.jar -.flattened-pom.xml - -# Common working directory -run/ \ No newline at end of file +### Mac OS ### +.DS_Store \ No newline at end of file diff --git a/.jitpack/ensure-java-16 b/.jitpack/ensure-java-16 deleted file mode 100644 index 9bb37ccc..00000000 --- a/.jitpack/ensure-java-16 +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/bash - -JV=$(java -version 2>&1 >/dev/null | head -1) -echo "$JV" | sed -E 's/^.*version "([^".]*)\.[^"]*".*$/\1/' - -if [ "$JV" != 16 ]; then - case "$1" in - install) - echo "installing sdkman..." - curl -s "https://get.sdkman.io" | bash - source ~/.sdkman/bin/sdkman-init.sh - sdk install java 16.0.1-open - ;; - use) - echo "must source ~/.sdkman/bin/sdkman-init.sh" - exit 1 - ;; - esac -fi \ No newline at end of file diff --git a/README.md b/README.md deleted file mode 100644 index ed1a5059..00000000 --- a/README.md +++ /dev/null @@ -1,72 +0,0 @@ -[![Header](https://i.imgur.com/jh0IKyM.png "Header")](https://www.spigotmc.org/resources/huskhomes.83767/) -# HuskHomes -[![Maven CI](https://github.com/WiIIiam278/HuskHomes2/actions/workflows/maven.yml/badge.svg)](https://github.com/WiIIiam278/HuskHomes2/actions/workflows/maven.yml) -[![Jitpack](https://jitpack.io/v/WiIIiam278/HuskHomes2.svg)](https://jitpack.io/#WiIIiam278/HuskHomes2) -[![GitLocalized](https://gitlocalize.com/repo/6997/whole_project/badge.svg)](https://gitlocalize.com/repo/6997/whole_project?utm_source=badge) -[![Discord](https://img.shields.io/discord/818135932103557162?color=7289da&logo=discord)](https://discord.gg/tVYhJfyDWG) - -**HuskHomes** is a powerful, intuitive and flexible teleportation plugin for SpigotMC Minecraft servers. The plugin supports a wide array of features; from teleporting between players, teleport requests, public and private homes, warps, random teleporting and more. It also supports this between multiple Spigot servers on a Bungee network. - -## Features -* Supports a wide array of commands players will understand in seconds. -* Simple and intuitive interface; no clunky chest GUIs! Instead, a robust clickable JSON chat link system to view and edit homes and warps. -* Supports teleporting to homes and players across multiple servers on a Bungee network. -* Teleport requests (/tpa; /tpahere; /tpaccept; /tpdeny), supported through multiple servers. -* Has a /back command to let players return to their previous position, or where they died if they have the right permissions -* Show the location of public homes and warps on your server's Dynmap, BlueMap or Squaremap -* Integrate your economy by setting costs to set homes, make them public and random teleporting costs -* Fully customisable plugin messages, with multi-language and custom hexadecimal color support via MineDown formatting -* Set warps for your server with the /setwarp and /warp commands -* Set a /spawn location per server where players will also be put when they first join -* Configurable random teleport command allowing players to get out into the wild quickly -* Full TAB completion support across all commands to make it even easier and faster to use -* Easily fine-tune each feature to your server's needs with permission nodes and a well-documented plugin Wiki -* Supports migration from EssentialsX - -## Showcase -[](https://i.imgur.com/nDpxLgZ.mp4) - -[](https://i.imgur.com/uvqnC5q.mp4) - -[](https://i.imgur.com/4oyTN7x.mp4) - -## Commands -* /home, /sethome, /edithome, /homelist -* /publichome, /publichomelist -* /warp, /setwarp, /editwarp, /warplist -* /tpa, /tpahere, /tpaccept, /tpdeny -* /tp, /tphere, /tpall, /tpaall -* /spawn, /rtp -* And more... - -## Setup -### Setup for a single server -1. Download HuskHomes.jar from the resource page -2. Place HuskHomes.jar in your server's plugin folder -3. (re)Start the server, then stop it again -4. Make configuration changes to the HuskHomes/config.yml file as neccessary -5. If you're using a permissions plugin, ensure permissions are set correctly -6. Start the server again and you are good to start using HuskHomes! - -### Setup for a Bungee network -You will need a mySQL Database setup to enable Bungee features -1. Download HuskHomes.jar from the resource page -2. Place the plugin in the plugin folders of **all** the servers you wish to run HuskHomes on -3. (re)Start all the servers you added the HuskHomes.jar to, then turn them off again -4. For each server, navigate to HuskHomes/config.yml and change the following settings - 1. Under `data_storage_options`, change the `storage_type` from `SQLite` to `mySQL` - 2. Fill in your mySQL credentials under `mysql_credentials` - 3. Under `bungee_options:`, set `enable_bungee_mode` to `true` and change the `server_id` to match the name of that server on the bungee network (e.g if you move to it using /server lobby, put "lobby" there) - 4. Modify other settings as appropriate -5. If you're using a permissions plugin, ensure permissions are set correctly -6. Start the servers you installed HuskHomes on and you should be good to go! - -### bStats -This plugin uses bStats to provide me with metrics about it's usage. You can turn this off by navigating to `plugins/bStats/config.yml` and editing the config to disable plugin metrics. - -View bStats metrics: [Click to View](https://bstats.org/plugin/bukkit/HuskHomes/8430) - -### Help and Support -* Report bugs: [Click here](https://github.com/WiIIiam278/HuskHomes2/issues) -* Check the HuskHomes Wiki: [Click here](https://github.com/WiIIiam278/HuskHomes2/wiki) -* If you still need support, join the [HuskHelp Discord](https://discord.gg/tVYhJfyDWG)! diff --git a/jitpack.yml b/jitpack.yml deleted file mode 100644 index 83ba24b8..00000000 --- a/jitpack.yml +++ /dev/null @@ -1,9 +0,0 @@ -# This file ensures jitpack builds HuskHomes correctly by setting the JDK to 16 -jdk: - - openjdk16 -before_install: - - bash ./.jitpack/ensure-java-16 install -install: - - if ! ./.jitpack/ensure-java-16 use; then source ~/.sdkman/bin/sdkman-init.sh; fi - - java -version - - mvn install -DskipTests \ No newline at end of file diff --git a/pom.xml b/pom.xml deleted file mode 100644 index f8929476..00000000 --- a/pom.xml +++ /dev/null @@ -1,214 +0,0 @@ - - - 4.0.0 - - me.William278 - HuskHomes - 2.12 - jar - - HuskHomes - A powerful, intuitive and flexible teleportation suite - https://timetobattle.net - - - 16 - UTF-8 - 4.1.1 - - - - - apache.snapshots - https://repository.apache.org/snapshots/ - - - - - - - org.apache.maven.plugins - maven-compiler-plugin - 3.10.1 - - ${java.version} - ${java.version} - - - - org.apache.maven.plugins - maven-shade-plugin - 3.3.1-SNAPSHOT - - - - org.jetbrains - me.william278.huskhomes2.libraries.annotations - - - com.zaxxer - me.william278.huskhomes2.libraries.hikaricp - - - io.papermc - me.william278.huskhomes2.libraries.paperlib - - - org.bstats - me.william278.huskhomes2.libraries.bstats - - - de.themoep - me.william278.huskhomes2.libraries.minedown - - - - - - package - - shade - - - false - - - - - - org.apache.maven.plugins - maven-javadoc-plugin - 3.3.2 - - false - -Xdoclint:none - UTF-8 - - ${project.build.directory}/javadoc-bundle-options/maven-javadoc-plugin-stale-data.txt - - - - - attach-javadocs - - jar - - - - - - - - src/main/resources - true - - - - - - - spigotmc-repo - https://hub.spigotmc.org/nexus/content/repositories/snapshots/ - - - papermc - https://papermc.io/repo/repository/maven-public/ - - - sonatype - https://oss.sonatype.org/content/groups/public/ - - - dynmap-repo - https://repo.mikeprimm.com/ - - - jitpack.io - https://jitpack.io - - - codemc - https://repo.codemc.org/repository/maven-public - - - minebench-repo - https://repo.minebench.de/ - - - squaremap-snapshots - https://repo.jpenilla.xyz/snapshots/ - - - - - - org.spigotmc - spigot-api - 1.16.5-R0.1-SNAPSHOT - provided - - - us.dynmap - dynmap-api - 3.1 - provided - - - com.github.BlueMap-Minecraft - BlueMapAPI - 1.7.0 - provided - - - xyz.jpenilla - squaremap-api - 1.1.2 - provided - - - com.github.MilkBowl - VaultAPI - 1.7.1 - provided - - - de.themoep - minedown - 1.7.1-SNAPSHOT - compile - - - org.bstats - bstats-bukkit - 3.0.0 - compile - - - io.papermc - paperlib - 1.0.7 - compile - - - redis.clients - jedis - ${jedis.version} - jar - provided - - - com.zaxxer - HikariCP - 5.0.1 - compile - - - org.jetbrains - annotations - 23.0.0 - compile - - - diff --git a/src/main/java/me/william278/huskhomes2/HuskHomes.java b/src/main/java/me/william278/huskhomes2/HuskHomes.java deleted file mode 100644 index 2c3ec586..00000000 --- a/src/main/java/me/william278/huskhomes2/HuskHomes.java +++ /dev/null @@ -1,305 +0,0 @@ -package me.william278.huskhomes2; - -import me.william278.huskhomes2.api.HuskHomesAPI; -import me.william278.huskhomes2.commands.*; -import me.william278.huskhomes2.config.Settings; -import me.william278.huskhomes2.data.sql.Database; -import me.william278.huskhomes2.data.sql.MySQL; -import me.william278.huskhomes2.data.sql.SQLite; -import me.william278.huskhomes2.data.message.redis.RedisReceiver; -import me.william278.huskhomes2.integrations.map.BlueMap; -import me.william278.huskhomes2.integrations.map.DynMap; -import me.william278.huskhomes2.integrations.map.Map; -import me.william278.huskhomes2.integrations.VaultIntegration; -import me.william278.huskhomes2.integrations.map.SquareMap; -import me.william278.huskhomes2.listeners.PlayerListener; -import me.william278.huskhomes2.data.message.pluginmessage.PluginMessageReceiver; -import me.william278.huskhomes2.migrators.UpgradeDatabase; -import me.william278.huskhomes2.teleport.SettingHandler; -import me.william278.huskhomes2.util.MessageManager; -import me.william278.huskhomes2.util.PlayerList; -import me.william278.huskhomes2.util.UpdateChecker; -import org.bstats.bukkit.Metrics; -import org.bstats.charts.SimplePie; -import org.bukkit.Bukkit; -import org.bukkit.plugin.java.JavaPlugin; - -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStreamReader; -import java.net.URL; -import java.net.URLConnection; -import java.sql.Connection; -import java.sql.SQLException; -import java.util.HashSet; -import java.util.UUID; -import java.util.logging.Level; - -public final class HuskHomes extends JavaPlugin { - - // Instance getting - private static HuskHomes instance; - public static HuskHomes getInstance() { - return instance; - } - - // Database handling - private static Database database; - public static Connection getConnection() throws SQLException { - return database.getConnection(); - } - public static void backupDatabase() { database.backup(); } - - // Map integration handling - private static Map map; - public static Map getMap() { return map; } - - // Settings data - private static Settings settings; - public static Settings getSettings() { - return settings; - } - - // Player list managing - private static PlayerList playerList; - public static PlayerList getPlayerList() { return playerList; } - - // Ignoring teleport requests handler - private static final HashSet ignoringTeleportRequests = new HashSet<>(); - public static boolean isIgnoringTeleportRequests(UUID uuid) { return ignoringTeleportRequests.contains(uuid); } - public static void setIgnoringTeleportRequests(UUID uuid) { - ignoringTeleportRequests.add(uuid); - } - public static void setNotIgnoringTeleportRequests(UUID uuid) { - ignoringTeleportRequests.remove(uuid); - } - - // Ignoring teleport requests handler - private static final HashSet teleportingPlayers = new HashSet<>(); - public static boolean isTeleporting(UUID uuid) { return teleportingPlayers.contains(uuid); } - public static void setTeleporting(UUID uuid) { - teleportingPlayers.add(uuid); - } - public static void setNotTeleporting(UUID uuid) { - teleportingPlayers.remove(uuid); - } - - // Metrics ID for bStats integration - private static final int METRICS_PLUGIN_ID = 8430; - - /** - * Returns the HuskHomes API - * @deprecated Use {@link HuskHomesAPI#getInstance()} instead - * @return an instance of the HuskHomes API - * @see HuskHomesAPI - */ - public HuskHomesAPI getAPI() { - return HuskHomesAPI.getInstance(); - } - - - public static void disablePlugin(String reason) { - instance.getLogger().severe("Disabling HuskHomes plugin because:\n" + reason); - Bukkit.getPluginManager().disablePlugin(instance); - } - - // Initialise the database - private void initializeDatabase() { - String dataStorageType = HuskHomes.getSettings().getDatabaseType().toLowerCase(); - switch (dataStorageType) { - case "mysql" -> { - database = new MySQL(getInstance()); - database.load(); - } - case "sqlite" -> { - database = new SQLite(getInstance()); - database.load(); - } - default -> { - getLogger().log(Level.WARNING, "An invalid data storage type was specified in config.yml; defaulting to SQLite"); - database = new SQLite(getInstance()); - database.load(); - } - } - } - - private void setupMessagingChannels() { - Bukkit.getMessenger().registerOutgoingPluginChannel(this, "BungeeCord"); - if (getSettings().getMessengerType().equalsIgnoreCase("pluginmessage")) { - Bukkit.getMessenger().registerIncomingPluginChannel(this, "BungeeCord", new PluginMessageReceiver()); - } else { - RedisReceiver.initialize(); - RedisReceiver.listen(); - } - } - - private void registerCommands() { - HomeCommand.Tab homeTab = new HomeCommand.Tab(); - new HomeCommand().register(getCommand("home")).setTabCompleter(homeTab); - new DelHomeCommand().register(getCommand("delhome")).setTabCompleter(homeTab); - - WarpCommand.Tab warpTab = new WarpCommand.Tab(); - new WarpCommand().register(getCommand("warp")).setTabCompleter(warpTab); - new DelWarpCommand().register(getCommand("delwarp")).setTabCompleter(warpTab); - - new PublicHomeCommand().register(getCommand("publichome")); - new EditHomeCommand().register(getCommand("edithome")); - new EditWarpCommand().register(getCommand("editwarp")); - new HuskHomesCommand().register(getCommand("huskhomes")); - - TpCommand.Tab tpTab = new TpCommand.Tab(); - new TpCommand().register(getCommand("tp")).setTabCompleter(tpTab); - new TpaCommand().register(getCommand("tpa")).setTabCompleter(tpTab); - new TpHereCommand().register(getCommand("tphere")).setTabCompleter(tpTab); - new TpaHereCommand().register(getCommand("tpahere")).setTabCompleter(tpTab); - - CommandBase.EmptyTab emptyTab = new CommandBase.EmptyTab(); - new TpAcceptCommand().register(getCommand("tpaccept")).setTabCompleter(emptyTab); - new TpDenyCommand().register(getCommand("tpdeny")).setTabCompleter(emptyTab); - new TpIgnoreCommand().register(getCommand("tpignore")).setTabCompleter(emptyTab); - new WarpListCommand().register(getCommand("warplist")).setTabCompleter(emptyTab); - new HomeListCommand().register(getCommand("homelist")).setTabCompleter(emptyTab); - new PublicHomeListCommand().register(getCommand("publichomelist")).setTabCompleter(emptyTab); - new RtpCommand().register(getCommand("rtp")).setTabCompleter(emptyTab); - new SpawnCommand().register(getCommand("spawn")).setTabCompleter(emptyTab); - new SetSpawnCommand().register(getCommand("setspawn")).setTabCompleter(emptyTab); - new SetHomeCommand().register(getCommand("sethome")).setTabCompleter(emptyTab); - new SetWarpCommand().register(getCommand("setwarp")).setTabCompleter(emptyTab); - new BackCommand().register(getCommand("back")).setTabCompleter(emptyTab); - new TpOfflineCommand().register(getCommand("tpoffline")).setTabCompleter(emptyTab); - new TpaAllCommand().register(getCommand("tpaall")).setTabCompleter(emptyTab); - new TpAllCommand().register(getCommand("tpall")).setTabCompleter(emptyTab); - - // Update caches - PublicHomeCommand.updatePublicHomeTabCache(); - WarpCommand.Tab.updateWarpsTabCache(); - } - - // Register events - private static void registerEvents(HuskHomes plugin) { - plugin.getServer().getPluginManager().registerEvents(new PlayerListener(), plugin); - } - - @Override - public void onLoad() { - // Set instance for easy cross-class referencing - instance = this; - settings = new Settings(this); - } - - @Override - public void onEnable() { - // Fetch config file - saveDefaultConfig(); - getConfig().options().copyDefaults(true); - saveConfig(); - settings.reload(); - - // Load the messages (in the right language) - MessageManager.loadMessages(HuskHomes.getSettings().getLanguage()); - - // Check for updates via console - if (HuskHomes.getSettings().doStartupUpdateChecks()) { - new UpdateChecker(this).logToConsole(); - } - - // Initialize the database - initializeDatabase(); - - // Upgrade Database if needed - UpgradeDatabase.upgradeDatabase(); - - // Fetch spawn location if set - SettingHandler.fetchSpawnLocation(); - - // Set up the map integration with the correct plugin - if (HuskHomes.getSettings().doMapIntegration()) { - String mapPlugin = HuskHomes.getSettings().getMapPlugin(); - switch (mapPlugin) { - case "dynmap" -> map = new DynMap(); - case "bluemap" -> map = new BlueMap(); - case "squaremap" -> map = new SquareMap(); - } - map.initialize(); - } - - // Setup economy if it is enabled - if (HuskHomes.getSettings().doEconomy()) { - VaultIntegration.initializeEconomy(); - } - - // Set up bungee channels if bungee mode is enabled - if (getSettings().doBungee()) { - setupMessagingChannels(); - } - - // Register commands and tab completion handlers - registerCommands(); - - // Register events - registerEvents(this); - - // bStats initialisation - try { - Metrics metrics = new Metrics(this, METRICS_PLUGIN_ID); - metrics.addCustomChart(new SimplePie("bungee_mode", () -> Boolean.toString(getSettings().doBungee()))); - if (getSettings().doBungee()) { - metrics.addCustomChart(new SimplePie("messenger_type", () -> getSettings().getMessengerType().toLowerCase())); - } - metrics.addCustomChart(new SimplePie("language", () -> getSettings().getLanguage())); - metrics.addCustomChart(new SimplePie("database_type", () -> getSettings().getDatabaseType().toLowerCase())); - metrics.addCustomChart(new SimplePie("using_economy", () -> Boolean.toString(getSettings().doEconomy()))); - metrics.addCustomChart(new SimplePie("using_map", () -> Boolean.toString(getSettings().doMapIntegration()))); - if (getSettings().doMapIntegration()) { - metrics.addCustomChart(new SimplePie("map_type", () -> getSettings().getMapPlugin())); - } - } catch (Exception e) { - getLogger().warning("An exception occurred initialising metrics; skipping."); - } - - // Setup player list - playerList = new PlayerList(); - playerList.initialize(); - - // Log a message - getLogger().info("Enabled HuskHomes version " + this.getDescription().getVersion()); - } - - @Override - public void onDisable() { - if (HuskHomes.getSettings().doBungee()) { - if (!HuskHomes.getSettings().getMessengerType().equalsIgnoreCase("pluginmessage")) { - RedisReceiver.terminate(); - } - } - - // Terminate the Hikari data source - database.close(); - - // Cancel remaining tasks - Bukkit.getServer().getScheduler().cancelTasks(this); - - // Log a message - getLogger().info("Disabled HuskHomes version " + this.getDescription().getVersion()); - } - - public static String getVersionCheckString() { - try { - URL url = new URL("https://api.spigotmc.org/legacy/update.php?resource=83767"); // Numbers = Spigot Project ID! - URLConnection urlConnection = url.openConnection(); - String latestVersion = new BufferedReader(new InputStreamReader(urlConnection.getInputStream())).readLine(); - String pluginVersion = instance.getDescription().getVersion(); - if (!latestVersion.equals(pluginVersion)) { - if (pluginVersion.contains("dev")) { - return "You are running a development build of HuskHomes. The latest stable version is " + latestVersion + "."; - } else { - return "An update for HuskHomes is available; v" + latestVersion + " (Currently running v" + pluginVersion + ")"; - } - } else { - return "HuskHomes is up to date! (Version " + pluginVersion + ")"; - } - } catch (IOException e) { - return "Error retrieving version information!"; - } - } -} diff --git a/src/main/java/me/william278/huskhomes2/api/HuskHomesAPI.java b/src/main/java/me/william278/huskhomes2/api/HuskHomesAPI.java deleted file mode 100644 index b8626ea1..00000000 --- a/src/main/java/me/william278/huskhomes2/api/HuskHomesAPI.java +++ /dev/null @@ -1,266 +0,0 @@ -package me.william278.huskhomes2.api; - -import me.william278.huskhomes2.HuskHomes; -import me.william278.huskhomes2.data.DataManager; -import me.william278.huskhomes2.teleport.TeleportManager; -import me.william278.huskhomes2.teleport.points.Home; -import me.william278.huskhomes2.teleport.points.TeleportationPoint; -import me.william278.huskhomes2.teleport.points.Warp; -import org.bukkit.Bukkit; -import org.bukkit.entity.Player; - -import java.sql.Connection; -import java.sql.SQLException; -import java.util.List; -import java.util.Optional; -import java.util.logging.Level; - -/** - * The HuskHomes API - * Only use methods/events found within the API package - */ -public class HuskHomesAPI { - private static HuskHomesAPI instance; - private final HuskHomes huskHomes; - - private HuskHomesAPI() { - huskHomes = HuskHomes.getInstance(); - } - - public static HuskHomesAPI getInstance() { - if (instance == null) { - instance = new HuskHomesAPI(); - } - return instance; - } - - /** - * Returns a Home set by a player, or NULL if it does not exist - * - * @param player A player - * @param homeName Name of the player's home you wish to retrieve - * @return the player's Home, or NULL if it does not exist - * @see Home - */ - public Home getHome(Player player, String homeName) { - return getHome(player.getName(), homeName); - } - - /** - * Returns a Home set by a player, or NULL if it does not exist - * - * @param ownerUsername Username of the player - * @param homeName Name of the player's home you wish to retrieve - * @return the player's Home, or NULL if it does not exist - * @see Home - */ - public Home getHome(String ownerUsername, String homeName) { - try (Connection connection = HuskHomes.getConnection()) { - return DataManager.getHome(ownerUsername, homeName, connection); - } catch (SQLException e) { - huskHomes.getLogger().log(Level.WARNING, "An SQL exception occurred retrieving data for API access", e); - return null; - } - } - - /** - * Returns a Warp set on the server, or NULL if it does not exist - * - * @param warpName Name of the warp - * @return a Warp, or NULL if it does not exist - * @see Warp - */ - public Warp getWarp(String warpName) { - try (Connection connection = HuskHomes.getConnection()) { - return DataManager.getWarp(warpName, connection); - } catch (SQLException e) { - huskHomes.getLogger().log(Level.WARNING, "An SQL exception occurred retrieving data for API access", e); - return null; - } - } - - /** - * Returns an ArrayList of homes set by a Player - * - * @param player A Player - * @return an ArrayList of Homes - * @see Home - */ - public List getHomes(Player player) { - return getHomes(player.getName()); - } - - /** - * Returns an ArrayList of homes set by a player - * - * @param ownerUsername Username of the player who's homes you want to get - * @return an ArrayList of Homes - * @see Home - */ - public List getHomes(String ownerUsername) { - try (Connection connection = HuskHomes.getConnection()) { - return DataManager.getPlayerHomes(ownerUsername, connection); - } catch (SQLException e) { - huskHomes.getLogger().log(Level.WARNING, "An SQL exception occurred retrieving data for API access", e); - return null; - } - } - - /** - * Returns how many Homes a given Player has set - * - * @param player the Player being checked - * @return an integer of how many homes a player has set - * @see Home - */ - public int getHomeCount(Player player) { - return getHomes(player).size(); - } - - /** - * Returns the maximum number of homes a player can set - * - * @param player the Player being checked - * @return the maximum homes a player can set - */ - public int getMaxSetHomes(Player player) { - return Home.getSetHomeLimit(player); - } - - /** - * Returns the number of homes a player can set for free - * - * @param player the Player being checked - * @return the number of free homes a player can set - */ - public int getFreeSetHomes(Player player) { - return Home.getFreeHomes(player); - } - - /** - * Returns an ArrayList of all the public homes set - * - * @return an ArrayList of Homes - * @see Home - */ - public List getPublicHomes() { - try (Connection connection = HuskHomes.getConnection()) { - return DataManager.getPublicHomes(connection); - } catch (SQLException e) { - huskHomes.getLogger().log(Level.WARNING, "An SQL exception occurred retrieving data for API access", e); - return null; - } - } - - /** - * Returns how many public Homes there are - * - * @return an integer of how many public homes there are - * @see Home - */ - public int getPublicHomeCount() { - return getPublicHomes().size(); - } - - /** - * Returns an ArrayList of all the warps set - * - * @return an ArrayList of Warps - * @see Warp - */ - public List getWarps() { - try (Connection connection = HuskHomes.getConnection()) { - return DataManager.getWarps(connection); - } catch (SQLException e) { - huskHomes.getLogger().log(Level.WARNING, "An SQL exception occurred retrieving data for API access", e); - return null; - } - } - - /** - * Returns how many Warps have been set - * - * @return an integer of how many warps have been set - * @see Warp - */ - public int getWarpCount() { - return getWarps().size(); - } - - /** - * Returns an {@link Optional} that will contain the spawn position set on the server, as a {@link TeleportationPoint}. - *

- *

    - *
  • To check if the spawn position is present: {@code #getServerSpawnPosition().isPresent()}
  • - *
  • To get the spawn position, if it is present: {@code #getServerSpawnPosition().get()}
  • - *
  • To get a runnable, if it is present: {@code #getServerSpawnPosition().get()}
  • - *
- * - * @return an {@link Optional} that will contain the server's {@link TeleportationPoint} spawn position if it has been set (empty otherwise) - */ - public Optional getServerSpawnPosition() { - return TeleportManager.getSpawnLocation(); - } - - /** - * Returns the current spawn position as a TeleportationPoint - * - * @return the spawn position as a {@link TeleportationPoint}; {@code null otherwise} - * @deprecated Use {@link #getServerSpawnPosition()} that returns an {@code Optional} instead - */ - @Deprecated - public TeleportationPoint getSpawnPosition() { - return TeleportManager.getSpawnLocation().isPresent() ? TeleportManager.getSpawnLocation().get() : null; - } - - /** - * Updates a player's last position on the server - * - * @param player The {@link Player} who's last position you wish to update - * @param point the {@link TeleportationPoint} to set as their new last position - */ - public void updatePlayerLastPosition(Player player, TeleportationPoint point) { - Bukkit.getScheduler().runTaskAsynchronously(huskHomes, () -> { - try (Connection connection = HuskHomes.getConnection()) { - DataManager.setPlayerLastPosition(player, point, connection); - } catch (SQLException e) { - huskHomes.getLogger().severe("An SQL exception occurred updating a player's last position via the API."); - } - }); - } - - /** - * Teleport a {@link Player} to a specific {@link TeleportationPoint} - * - * @param player The {@link Player} to be teleported - * @param point The target {@link TeleportationPoint} - * @param timed Whether the teleport should be timed; have a warmup countdown - */ - public void teleportPlayer(Player player, TeleportationPoint point, boolean timed) { - Bukkit.getScheduler().runTask(huskHomes, () -> { - if (timed) { - TeleportManager.queueTimedTeleport(player, point); - } else { - TeleportManager.teleportPlayer(player, point); - } - }); - } - - /** - * Teleport a {@link Player} to a specific {@link TeleportationPoint} - * - * @param player The {@link Player} to be teleported - * @param targetPlayerName The target {@link Player}'s username - * @param timed Whether the teleport should be timed; have a warmup countdown - */ - public void teleportPlayer(Player player, String targetPlayerName, boolean timed) { - Bukkit.getScheduler().runTask(huskHomes, () -> { - if (timed) { - TeleportManager.queueTimedTeleport(player, targetPlayerName); - } else { - TeleportManager.teleportPlayer(player, targetPlayerName); - } - }); - } - -} \ No newline at end of file diff --git a/src/main/java/me/william278/huskhomes2/api/events/PlayerChangeHomeDescriptionEvent.java b/src/main/java/me/william278/huskhomes2/api/events/PlayerChangeHomeDescriptionEvent.java deleted file mode 100644 index 7499dd6d..00000000 --- a/src/main/java/me/william278/huskhomes2/api/events/PlayerChangeHomeDescriptionEvent.java +++ /dev/null @@ -1,44 +0,0 @@ -package me.william278.huskhomes2.api.events; - -import me.william278.huskhomes2.teleport.points.Home; -import org.bukkit.entity.Player; - -/** - * An event, fired when a player changes the description of a home. - */ -public class PlayerChangeHomeDescriptionEvent extends PlayerHomeUpdateEvent { - private final String oldDescription; - private final String newDescription; - - /** - * An event, fired when a player changes the description of a home. - * - * @param player The Player who is changing the home's description - * @param home The Home being changed - * @param newDescription The new description being set - * @see PlayerHomeUpdateEvent - */ - public PlayerChangeHomeDescriptionEvent(Player player, Home home, String newDescription) { - super(player, home); - this.oldDescription = home.getDescription(); - this.newDescription = newDescription; - } - - /** - * Returns the old description of the home - * - * @return the old description String - */ - public String getOldDescription() { - return oldDescription; - } - - /** - * Returns the new description being set to the home - * - * @return the new description String - */ - public String getNewDescription() { - return newDescription; - } -} diff --git a/src/main/java/me/william278/huskhomes2/api/events/PlayerChangeWarpDescriptionEvent.java b/src/main/java/me/william278/huskhomes2/api/events/PlayerChangeWarpDescriptionEvent.java deleted file mode 100644 index a0c3eba4..00000000 --- a/src/main/java/me/william278/huskhomes2/api/events/PlayerChangeWarpDescriptionEvent.java +++ /dev/null @@ -1,44 +0,0 @@ -package me.william278.huskhomes2.api.events; - -import me.william278.huskhomes2.teleport.points.Warp; -import org.bukkit.entity.Player; - -/** - * An event, fired when a player changes the description of a warp. - */ -public class PlayerChangeWarpDescriptionEvent extends PlayerWarpUpdateEvent { - private final String oldDescription; - private final String newDescription; - - /** - * An event, fired when a player changes the description of a warp. - * - * @param player The Player who is changing the warp's description - * @param warp The Warp being changed - * @param newDescription The new description being set - * @see PlayerWarpUpdateEvent - */ - public PlayerChangeWarpDescriptionEvent(Player player, Warp warp, String newDescription) { - super(player, warp); - this.oldDescription = warp.getDescription(); - this.newDescription = newDescription; - } - - /** - * Returns the old description of the home - * - * @return the old description String - */ - public String getOldDescription() { - return oldDescription; - } - - /** - * Returns the new description being set to the home - * - * @return the new description String - */ - public String getNewDescription() { - return newDescription; - } -} \ No newline at end of file diff --git a/src/main/java/me/william278/huskhomes2/api/events/PlayerDeleteHomeEvent.java b/src/main/java/me/william278/huskhomes2/api/events/PlayerDeleteHomeEvent.java deleted file mode 100644 index d3624f87..00000000 --- a/src/main/java/me/william278/huskhomes2/api/events/PlayerDeleteHomeEvent.java +++ /dev/null @@ -1,20 +0,0 @@ -package me.william278.huskhomes2.api.events; - -import me.william278.huskhomes2.teleport.points.Home; -import org.bukkit.entity.Player; - -/** - * An event, fired when a player deletes a home - */ -public class PlayerDeleteHomeEvent extends PlayerHomeUpdateEvent { - /** - * An event, fired when a player deletes a home - * - * @param player The Player who is deleting the home - * @param home The Home being deleted - * @see PlayerHomeUpdateEvent - */ - public PlayerDeleteHomeEvent(Player player, Home home) { - super(player, home); - } -} \ No newline at end of file diff --git a/src/main/java/me/william278/huskhomes2/api/events/PlayerDeleteWarpEvent.java b/src/main/java/me/william278/huskhomes2/api/events/PlayerDeleteWarpEvent.java deleted file mode 100644 index c310d6ef..00000000 --- a/src/main/java/me/william278/huskhomes2/api/events/PlayerDeleteWarpEvent.java +++ /dev/null @@ -1,20 +0,0 @@ -package me.william278.huskhomes2.api.events; - -import me.william278.huskhomes2.teleport.points.Warp; -import org.bukkit.entity.Player; - -/** - * An event, fired when a player deletes a warp - */ -public class PlayerDeleteWarpEvent extends PlayerWarpUpdateEvent { - /** - * An event, fired when a player deletes a warp - * - * @param player The Player who is deleting the warp - * @param warp The Warp being deleted - * @see PlayerWarpUpdateEvent - */ - public PlayerDeleteWarpEvent(Player player, Warp warp) { - super(player, warp); - } -} \ No newline at end of file diff --git a/src/main/java/me/william278/huskhomes2/api/events/PlayerHomeUpdateEvent.java b/src/main/java/me/william278/huskhomes2/api/events/PlayerHomeUpdateEvent.java deleted file mode 100644 index 8d1972a5..00000000 --- a/src/main/java/me/william278/huskhomes2/api/events/PlayerHomeUpdateEvent.java +++ /dev/null @@ -1,61 +0,0 @@ -package me.william278.huskhomes2.api.events; - -import me.william278.huskhomes2.teleport.points.Home; -import org.bukkit.entity.Player; -import org.bukkit.event.Cancellable; -import org.bukkit.event.HandlerList; -import org.bukkit.event.player.PlayerEvent; -import org.jetbrains.annotations.NotNull; - -/** - * An event, fired when a home is updated - * Fires when a player renames a Home, updates its' location, changes its' name, changes whether or not it is public/private. - * Also fires when it is deleted - */ -public class PlayerHomeUpdateEvent extends PlayerEvent implements Cancellable { - private final Home home; - private static final HandlerList HANDLER_LIST = new HandlerList(); - private boolean isCancelled; - - /** - * An event, fired when a home is updated - * Fires when a player renames a Home, updates its' location, changes its' name, changes whether or not it is public/private, or when it is deleted - * Does not fire when a player sets a Home - * - * @param player The Player who is updating the Home - * @param home The Home being changed - */ - public PlayerHomeUpdateEvent(Player player, Home home) { - super(player); - this.home = home; - this.isCancelled = false; - } - - @Override - public @NotNull HandlerList getHandlers() { - return HANDLER_LIST; - } - - public static HandlerList getHandlerList() { - return HANDLER_LIST; - } - - /** - * Gets the {@link Home} being updated - * - * @return the {@link Home} - */ - public Home getHome() { - return home; - } - - @Override - public boolean isCancelled() { - return isCancelled; - } - - @Override - public void setCancelled(boolean cancel) { - isCancelled = cancel; - } -} diff --git a/src/main/java/me/william278/huskhomes2/api/events/PlayerMakeHomePrivateEvent.java b/src/main/java/me/william278/huskhomes2/api/events/PlayerMakeHomePrivateEvent.java deleted file mode 100644 index ded03264..00000000 --- a/src/main/java/me/william278/huskhomes2/api/events/PlayerMakeHomePrivateEvent.java +++ /dev/null @@ -1,20 +0,0 @@ -package me.william278.huskhomes2.api.events; - -import me.william278.huskhomes2.teleport.points.Home; -import org.bukkit.entity.Player; - -/** - * An event, fired when a player makes a home private - */ -public class PlayerMakeHomePrivateEvent extends PlayerHomeUpdateEvent { - /** - * An event, fired when a player makes a home private - * - * @param player The Player who is making the Home private - * @param home The Home being changed - * @see PlayerHomeUpdateEvent - */ - public PlayerMakeHomePrivateEvent(Player player, Home home) { - super(player, home); - } -} \ No newline at end of file diff --git a/src/main/java/me/william278/huskhomes2/api/events/PlayerMakeHomePublicEvent.java b/src/main/java/me/william278/huskhomes2/api/events/PlayerMakeHomePublicEvent.java deleted file mode 100644 index 7ab2cce6..00000000 --- a/src/main/java/me/william278/huskhomes2/api/events/PlayerMakeHomePublicEvent.java +++ /dev/null @@ -1,20 +0,0 @@ -package me.william278.huskhomes2.api.events; - -import me.william278.huskhomes2.teleport.points.Home; -import org.bukkit.entity.Player; - -/** - * An event, fired when a player makes a home public - */ -public class PlayerMakeHomePublicEvent extends PlayerHomeUpdateEvent { - /** - * An event, fired when a player makes a home public - * - * @param player The Player who is making the Home public - * @param home The Home being changed - * @see PlayerHomeUpdateEvent - */ - public PlayerMakeHomePublicEvent(Player player, Home home) { - super(player, home); - } -} \ No newline at end of file diff --git a/src/main/java/me/william278/huskhomes2/api/events/PlayerPreTeleportEvent.java b/src/main/java/me/william278/huskhomes2/api/events/PlayerPreTeleportEvent.java deleted file mode 100644 index 50bba608..00000000 --- a/src/main/java/me/william278/huskhomes2/api/events/PlayerPreTeleportEvent.java +++ /dev/null @@ -1,64 +0,0 @@ -package me.william278.huskhomes2.api.events; - -import me.william278.huskhomes2.teleport.points.TeleportationPoint; -import org.bukkit.entity.Player; -import org.bukkit.event.Cancellable; -import org.bukkit.event.HandlerList; -import org.bukkit.event.player.PlayerEvent; -import org.jetbrains.annotations.NotNull; - -public class PlayerPreTeleportEvent extends PlayerEvent implements Cancellable { - - private TeleportationPoint targetPoint; - private static final HandlerList HANDLER_LIST = new HandlerList(); - private boolean isCancelled; - - /** - * An event, fired before a player is teleported by HuskHomes for any reason - * - * @param player The Player who is updating the Home - * @param targetPoint The Player's teleport destination - */ - public PlayerPreTeleportEvent(Player player, TeleportationPoint targetPoint) { - super(player); - this.targetPoint = targetPoint; - this.isCancelled = false; - } - - @Override - public @NotNull HandlerList getHandlers() { - return HANDLER_LIST; - } - - public static HandlerList getHandlerList() { - return HANDLER_LIST; - } - - /** - * Get the Player's teleportation destination {@link TeleportationPoint} - * - * @return the {@link TeleportationPoint} - */ - public TeleportationPoint getTargetPoint() { - return targetPoint; - } - - /** - * Set's the Player's teleportation destination {@link TeleportationPoint} - * - * @param targetPoint Where the player will be teleported to as a {@link TeleportationPoint} - */ - public void setTargetPoint(TeleportationPoint targetPoint) { - this.targetPoint = targetPoint; - } - - @Override - public boolean isCancelled() { - return isCancelled; - } - - @Override - public void setCancelled(boolean cancel) { - isCancelled = cancel; - } -} diff --git a/src/main/java/me/william278/huskhomes2/api/events/PlayerRelocateHomeEvent.java b/src/main/java/me/william278/huskhomes2/api/events/PlayerRelocateHomeEvent.java deleted file mode 100644 index 20337e84..00000000 --- a/src/main/java/me/william278/huskhomes2/api/events/PlayerRelocateHomeEvent.java +++ /dev/null @@ -1,45 +0,0 @@ -package me.william278.huskhomes2.api.events; - -import me.william278.huskhomes2.teleport.points.Home; -import me.william278.huskhomes2.teleport.points.TeleportationPoint; -import org.bukkit.entity.Player; - -/** - * An event, fired when a player edits a Warp to change it's location - */ -public class PlayerRelocateHomeEvent extends PlayerHomeUpdateEvent { - private final TeleportationPoint oldTeleportationPoint; - private final TeleportationPoint newTeleportationPoint; - - /** - * An event, fired when a player relocates a home - * - * @param player The Player who is relocating the Home - * @param home The Home being moved - * @param newTeleportationPoint The new teleportation position of the Home - * @see PlayerWarpUpdateEvent - */ - public PlayerRelocateHomeEvent(Player player, Home home, TeleportationPoint newTeleportationPoint) { - super(player, home); - this.oldTeleportationPoint = home; - this.newTeleportationPoint = newTeleportationPoint; - } - - /** - * Returns the teleportation position of the Home before it is updated - * - * @return the pre-update teleportation position - */ - public TeleportationPoint getOldTeleportationPoint() { - return oldTeleportationPoint; - } - - /** - * Returns the updated teleportation position of the Home - * - * @return the updated teleportation position - */ - public TeleportationPoint getNewTeleportationPoint() { - return newTeleportationPoint; - } -} diff --git a/src/main/java/me/william278/huskhomes2/api/events/PlayerRelocateWarpEvent.java b/src/main/java/me/william278/huskhomes2/api/events/PlayerRelocateWarpEvent.java deleted file mode 100644 index ae7d710c..00000000 --- a/src/main/java/me/william278/huskhomes2/api/events/PlayerRelocateWarpEvent.java +++ /dev/null @@ -1,45 +0,0 @@ -package me.william278.huskhomes2.api.events; - -import me.william278.huskhomes2.teleport.points.TeleportationPoint; -import me.william278.huskhomes2.teleport.points.Warp; -import org.bukkit.entity.Player; - -/** - * An event, fired when a player edits a Warp to change it's location - */ -public class PlayerRelocateWarpEvent extends PlayerWarpUpdateEvent { - private final TeleportationPoint oldTeleportationPoint; - private final TeleportationPoint newTeleportationPoint; - - /** - * An event, fired when a player relocates a warp - * - * @param player The Player who is relocating the Warp - * @param warp The Warp being moved - * @param newTeleportationPoint The new teleportation position of the Warp - * @see PlayerWarpUpdateEvent - */ - public PlayerRelocateWarpEvent(Player player, Warp warp, TeleportationPoint newTeleportationPoint) { - super(player, warp); - this.oldTeleportationPoint = warp; - this.newTeleportationPoint = newTeleportationPoint; - } - - /** - * Returns the teleportation position of the Warp before it is updated - * - * @return the pre-update teleportation position - */ - public TeleportationPoint getOldTeleportationPoint() { - return oldTeleportationPoint; - } - - /** - * Returns the updated teleportation position of the Warp - * - * @return the updated teleportation position - */ - public TeleportationPoint getNewTeleportationPoint() { - return newTeleportationPoint; - } -} diff --git a/src/main/java/me/william278/huskhomes2/api/events/PlayerRenameHomeEvent.java b/src/main/java/me/william278/huskhomes2/api/events/PlayerRenameHomeEvent.java deleted file mode 100644 index ad6f78e5..00000000 --- a/src/main/java/me/william278/huskhomes2/api/events/PlayerRenameHomeEvent.java +++ /dev/null @@ -1,44 +0,0 @@ -package me.william278.huskhomes2.api.events; - -import me.william278.huskhomes2.teleport.points.Home; -import org.bukkit.entity.Player; - -/** - * An event, fired when a player renames a home - */ -public class PlayerRenameHomeEvent extends PlayerHomeUpdateEvent { - private final String oldName; - private final String newName; - - /** - * An event, fired when a player changes the name of a home - * - * @param player The Player who is changing the Home's name - * @param home The Home being changed - * @param newName The new name of the home - * @see PlayerHomeUpdateEvent - */ - public PlayerRenameHomeEvent(Player player, Home home, String newName) { - super(player, home); - this.oldName = home.getName(); - this.newName = newName; - } - - /** - * Get the name of the Home pre-update - * - * @return the name of the Home before it is updated - */ - public String getOldName() { - return oldName; - } - - /** - * Get the changed name of the Home - * - * @return the new name of the Home - */ - public String getNewName() { - return newName; - } -} diff --git a/src/main/java/me/william278/huskhomes2/api/events/PlayerRenameWarpEvent.java b/src/main/java/me/william278/huskhomes2/api/events/PlayerRenameWarpEvent.java deleted file mode 100644 index 5a7e7904..00000000 --- a/src/main/java/me/william278/huskhomes2/api/events/PlayerRenameWarpEvent.java +++ /dev/null @@ -1,44 +0,0 @@ -package me.william278.huskhomes2.api.events; - -import me.william278.huskhomes2.teleport.points.Warp; -import org.bukkit.entity.Player; - -/** - * An event, fired when a player renames a warp - */ -public class PlayerRenameWarpEvent extends PlayerWarpUpdateEvent { - private final String oldName; - private final String newName; - - /** - * An event, fired when a player changes the name of a warp - * - * @param player The Player who is changing the Warp's name - * @param warp The Warp being changed - * @param newName The new name of the warp - * @see PlayerWarpUpdateEvent - */ - public PlayerRenameWarpEvent(Player player, Warp warp, String newName) { - super(player, warp); - this.oldName = warp.getName(); - this.newName = newName; - } - - /** - * Get the name of the Warp pre-update - * - * @return the name of the Warp before it is updated - */ - public String getOldName() { - return oldName; - } - - /** - * Get the changed name of the Warp - * - * @return the new name of the Warp - */ - public String getNewName() { - return newName; - } -} \ No newline at end of file diff --git a/src/main/java/me/william278/huskhomes2/api/events/PlayerSetHomeEvent.java b/src/main/java/me/william278/huskhomes2/api/events/PlayerSetHomeEvent.java deleted file mode 100644 index 64eafee3..00000000 --- a/src/main/java/me/william278/huskhomes2/api/events/PlayerSetHomeEvent.java +++ /dev/null @@ -1,58 +0,0 @@ -package me.william278.huskhomes2.api.events; - -import me.william278.huskhomes2.teleport.points.Home; -import org.bukkit.entity.Player; -import org.bukkit.event.Cancellable; -import org.bukkit.event.HandlerList; -import org.bukkit.event.player.PlayerEvent; -import org.jetbrains.annotations.NotNull; - -/** - * An event, fired when a player sets a new home - */ -public class PlayerSetHomeEvent extends PlayerEvent implements Cancellable { - - private final Home home; - private static final HandlerList HANDLER_LIST = new HandlerList(); - private boolean isCancelled; - - /** - * An event, fired when a player sets a {@link Home} - * - * @param player the {@link Player} setting the Home - * @param home the {@link Home} being set - */ - public PlayerSetHomeEvent(Player player, Home home) { - super(player); - this.home = home; - this.isCancelled = false; - } - - @Override - public @NotNull HandlerList getHandlers() { - return HANDLER_LIST; - } - - public static HandlerList getHandlerList() { - return HANDLER_LIST; - } - - /** - * Get the Home being set - * - * @return the {@link Home} - */ - public Home getHome() { - return home; - } - - @Override - public boolean isCancelled() { - return isCancelled; - } - - @Override - public void setCancelled(boolean cancel) { - isCancelled = cancel; - } -} diff --git a/src/main/java/me/william278/huskhomes2/api/events/PlayerSetWarpEvent.java b/src/main/java/me/william278/huskhomes2/api/events/PlayerSetWarpEvent.java deleted file mode 100644 index 35f30181..00000000 --- a/src/main/java/me/william278/huskhomes2/api/events/PlayerSetWarpEvent.java +++ /dev/null @@ -1,58 +0,0 @@ -package me.william278.huskhomes2.api.events; - -import me.william278.huskhomes2.teleport.points.Warp; -import org.bukkit.entity.Player; -import org.bukkit.event.Cancellable; -import org.bukkit.event.HandlerList; -import org.bukkit.event.player.PlayerEvent; -import org.jetbrains.annotations.NotNull; - -/** - * An event, fired when a player sets a new warp - */ -public class PlayerSetWarpEvent extends PlayerEvent implements Cancellable { - - private final Warp warp; - private static final HandlerList HANDLER_LIST = new HandlerList(); - private boolean isCancelled; - - /** - * An event, fired when a Player sets a Warp - * - * @param player the {@link Player} setting the warp - * @param warp the {@link Warp} being set - */ - public PlayerSetWarpEvent(Player player, Warp warp) { - super(player); - this.warp = warp; - this.isCancelled = false; - } - - @Override - public @NotNull HandlerList getHandlers() { - return HANDLER_LIST; - } - - public static HandlerList getHandlerList() { - return HANDLER_LIST; - } - - /** - * Get the Warp being set - * - * @return the {@link Warp} - */ - public Warp getWarp() { - return warp; - } - - @Override - public boolean isCancelled() { - return isCancelled; - } - - @Override - public void setCancelled(boolean cancel) { - isCancelled = cancel; - } -} diff --git a/src/main/java/me/william278/huskhomes2/api/events/PlayerWarpUpdateEvent.java b/src/main/java/me/william278/huskhomes2/api/events/PlayerWarpUpdateEvent.java deleted file mode 100644 index 37a90f18..00000000 --- a/src/main/java/me/william278/huskhomes2/api/events/PlayerWarpUpdateEvent.java +++ /dev/null @@ -1,62 +0,0 @@ -package me.william278.huskhomes2.api.events; - -import me.william278.huskhomes2.teleport.points.Warp; -import org.bukkit.entity.Player; -import org.bukkit.event.Cancellable; -import org.bukkit.event.HandlerList; -import org.bukkit.event.player.PlayerEvent; -import org.jetbrains.annotations.NotNull; - -/** - * An event, fired when a warp is updated - * Fires when a player renames a Warp, updates its' location or changes its' name. - * Also fires when a warp is deleted - */ -public class PlayerWarpUpdateEvent extends PlayerEvent implements Cancellable { - - private final Warp warp; - private static final HandlerList HANDLER_LIST = new HandlerList(); - private boolean isCancelled; - - /** - * An event, fired when a {@link Warp} is updated. - * Fires when a player renames a Warp, updates its' location, changes its' name or when it is deleted. - * Does not fire when a player sets a Warp. - * - * @param player The Player who is updating the Warp - * @param warp The Warp being changed - */ - public PlayerWarpUpdateEvent(Player player, Warp warp) { - super(player); - this.warp = warp; - this.isCancelled = false; - } - - @Override - public @NotNull HandlerList getHandlers() { - return HANDLER_LIST; - } - - public static HandlerList getHandlerList() { - return HANDLER_LIST; - } - - /** - * Get the {@link Warp} being updated - * - * @return the {@link Warp} - */ - public Warp getWarp() { - return warp; - } - - @Override - public boolean isCancelled() { - return isCancelled; - } - - @Override - public void setCancelled(boolean cancel) { - isCancelled = cancel; - } -} diff --git a/src/main/java/me/william278/huskhomes2/commands/BackCommand.java b/src/main/java/me/william278/huskhomes2/commands/BackCommand.java deleted file mode 100644 index 00958656..00000000 --- a/src/main/java/me/william278/huskhomes2/commands/BackCommand.java +++ /dev/null @@ -1,32 +0,0 @@ -package me.william278.huskhomes2.commands; - -import me.william278.huskhomes2.HuskHomes; -import me.william278.huskhomes2.util.MessageManager; -import me.william278.huskhomes2.teleport.TeleportManager; -import org.bukkit.Bukkit; -import org.bukkit.command.Command; -import org.bukkit.entity.Player; - -import java.sql.Connection; -import java.sql.SQLException; -import java.util.logging.Level; - -public class BackCommand extends CommandBase { - - private static final HuskHomes plugin = HuskHomes.getInstance(); - - @Override - protected void onCommand(Player p, Command command, String label, String[] args) { - if (HuskHomes.getSettings().getDoBackCommand()) { - Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> { - try (Connection connection = HuskHomes.getConnection()) { - TeleportManager.queueBackTeleport(p, connection); - } catch (SQLException e) { - plugin.getLogger().log(Level.SEVERE, "An SQL exception occurred teleporting you back"); - } - }); - } else { - MessageManager.sendMessage(p, "error_command_disabled"); - } - } -} diff --git a/src/main/java/me/william278/huskhomes2/commands/CommandBase.java b/src/main/java/me/william278/huskhomes2/commands/CommandBase.java deleted file mode 100644 index 3ad28b28..00000000 --- a/src/main/java/me/william278/huskhomes2/commands/CommandBase.java +++ /dev/null @@ -1,52 +0,0 @@ -package me.william278.huskhomes2.commands; - -import me.william278.huskhomes2.util.MessageManager; -import org.bukkit.command.*; -import org.bukkit.entity.Player; -import org.jetbrains.annotations.NotNull; - -import java.util.Collections; -import java.util.List; -import java.util.Objects; - -public abstract class CommandBase implements CommandExecutor { - - @Override - public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) { - if (sender instanceof Player) { - onCommand((Player) sender, command, label, args); - return true; - } - return false; - } - - protected abstract void onCommand(Player player, Command command, String label, String[] args); - - /** - * Register base for bukkit command - * - * @param command Command for registration - */ - public PluginCommand register(PluginCommand command) { - Objects.requireNonNull(command); - - // Set command executor - command.setExecutor(this); - - // Set the appropriate tab completer - if (this instanceof TabCompleter) { - command.setTabCompleter((TabCompleter) this); - } - - // Get localised command description - command.setDescription(MessageManager.getRawMessage(command.getName() + "_command_description")); - return command; - } - - public static class EmptyTab implements TabCompleter { - @Override - public List onTabComplete(@NotNull CommandSender commandSender, @NotNull Command command, @NotNull String s, String[] strings) { - return Collections.emptyList(); - } - } -} diff --git a/src/main/java/me/william278/huskhomes2/commands/DelHomeCommand.java b/src/main/java/me/william278/huskhomes2/commands/DelHomeCommand.java deleted file mode 100644 index fdd33711..00000000 --- a/src/main/java/me/william278/huskhomes2/commands/DelHomeCommand.java +++ /dev/null @@ -1,37 +0,0 @@ -package me.william278.huskhomes2.commands; - -import me.william278.huskhomes2.util.MessageManager; -import me.william278.huskhomes2.teleport.SettingHandler; -import me.william278.huskhomes2.util.RegexUtil; -import org.bukkit.command.Command; -import org.bukkit.entity.Player; - -public class DelHomeCommand extends CommandBase { - - @Override - protected void onCommand(Player p, Command command, String label, String[] args) { - if (args.length == 1) { - String homeArgument = args[0]; - if (RegexUtil.OWNER_NAME_PATTERN.matcher(homeArgument).matches()) { - String[] split = homeArgument.split("\\."); - final String ownerName = split[0]; - final String homeName = split[1]; - SettingHandler.deleteHome(p, ownerName, homeName); - } else { - SettingHandler.deleteHome(p, homeArgument); - } - return; - } else if (args.length == 2) { - if (args[0].equalsIgnoreCase("all") && args[1].equalsIgnoreCase("confirm")) { - if (p.hasPermission("huskhomes.delhome.all")) { - SettingHandler.deleteAllHomes(p); - } else { - MessageManager.sendMessage(p, "error_no_permission"); - } - return; - } - } - MessageManager.sendMessage(p, "error_invalid_syntax", command.getUsage()); - } - -} diff --git a/src/main/java/me/william278/huskhomes2/commands/DelWarpCommand.java b/src/main/java/me/william278/huskhomes2/commands/DelWarpCommand.java deleted file mode 100644 index fb2d8213..00000000 --- a/src/main/java/me/william278/huskhomes2/commands/DelWarpCommand.java +++ /dev/null @@ -1,29 +0,0 @@ -package me.william278.huskhomes2.commands; - -import me.william278.huskhomes2.util.MessageManager; -import me.william278.huskhomes2.teleport.SettingHandler; -import org.bukkit.command.Command; -import org.bukkit.entity.Player; - -public class DelWarpCommand extends CommandBase { - - @Override - protected void onCommand(Player p, Command command, String label, String[] args) { - if (args.length == 1) { - String warpName = args[0]; - SettingHandler.deleteWarp(p, warpName); - return; - } else if (args.length == 2) { - if (args[0].equalsIgnoreCase("all") && args[1].equalsIgnoreCase("confirm")) { - if (p.hasPermission("huskhomes.delwarp.all")) { - SettingHandler.deleteAllWarps(p); - } else { - MessageManager.sendMessage(p, "error_no_permission"); - } - return; - } - } - MessageManager.sendMessage(p, "error_invalid_syntax", command.getUsage()); - } - -} diff --git a/src/main/java/me/william278/huskhomes2/commands/EditHomeCommand.java b/src/main/java/me/william278/huskhomes2/commands/EditHomeCommand.java deleted file mode 100644 index fef95ef4..00000000 --- a/src/main/java/me/william278/huskhomes2/commands/EditHomeCommand.java +++ /dev/null @@ -1,344 +0,0 @@ -package me.william278.huskhomes2.commands; - -import de.themoep.minedown.MineDown; -import me.william278.huskhomes2.util.EditingHandler; -import me.william278.huskhomes2.HuskHomes; -import me.william278.huskhomes2.util.MessageManager; -import me.william278.huskhomes2.api.events.*; -import me.william278.huskhomes2.data.DataManager; -import me.william278.huskhomes2.integrations.VaultIntegration; -import me.william278.huskhomes2.teleport.points.Home; -import me.william278.huskhomes2.teleport.points.TeleportationPoint; -import me.william278.huskhomes2.util.RegexUtil; -import org.bukkit.Bukkit; -import org.bukkit.Location; -import org.bukkit.command.Command; -import org.bukkit.command.CommandSender; -import org.bukkit.command.TabCompleter; -import org.bukkit.entity.Player; -import org.bukkit.util.StringUtil; -import org.jetbrains.annotations.NotNull; - -import java.sql.Connection; -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.Locale; -import java.util.logging.Level; -import java.util.stream.Stream; - -public class EditHomeCommand extends CommandBase implements TabCompleter { - - private static final HuskHomes plugin = HuskHomes.getInstance(); - - @Override - protected void onCommand(Player p, Command command, String label, String[] args) { - if (args.length == 0) { - MessageManager.sendMessage(p, "error_invalid_syntax", command.getUsage()); - return; - } - - Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> { - String homeName = args[0]; - String ownerName = p.getName(); - if (RegexUtil.OWNER_NAME_PATTERN.matcher(args[0]).matches()) { - ownerName = args[0].split("\\.")[0]; - homeName = args[0].split("\\.")[1]; - } - if (!ownerName.equalsIgnoreCase(p.getName())) { - if (!p.hasPermission("huskhomes.edithome.other")) { - MessageManager.sendMessage(p, "error_no_permission"); - return; - } - } - - try (Connection connection = HuskHomes.getConnection()) { - if (!DataManager.homeExists(ownerName, homeName, connection)) { - if (!ownerName.equalsIgnoreCase(p.getName())) { - MessageManager.sendMessage(p, "error_home_invalid_other", ownerName, homeName); - } else { - MessageManager.sendMessage(p, "error_home_invalid", homeName); - } - return; - } - Home home = DataManager.getHome(ownerName, homeName, connection); - assert home != null; - - if (args.length == 1) { - EditingHandler.showEditHomeOptions(p, home); - return; - } - - switch (args[1].toLowerCase(Locale.ENGLISH)) { - case "location" -> editHomeLocation(p, home); - case "public" -> editHomePrivacy(p, home, true); - case "private" -> editHomePrivacy(p, home, false); - case "description" -> { - if (args.length >= 3) { - // Get the new description - editHomeDescription(p, home, buildDescription(args)); - } else { - MessageManager.sendMessage(p, "error_invalid_syntax", "/edithome description "); - } - } - case "rename" -> { - if (args.length >= 3) { - editHomeName(p, home, args[2], connection); - } else { - MessageManager.sendMessage(p, "error_invalid_syntax", "/edithome rename "); - } - } - default -> MessageManager.sendMessage(p, "error_invalid_syntax", command.getUsage()); - } - } catch (SQLException e) { - plugin.getLogger().log(Level.SEVERE, "An SQL exception occurred editing a home."); - } - }); - } - - public static String buildDescription(String[] args) { - StringBuilder newDescription = new StringBuilder(); - for (int i = 2; i < args.length; i++) { - if (i > 2) { - newDescription.append(" ").append(args[i]); - } else { - newDescription = new StringBuilder(args[i]); - } - } - return newDescription.toString(); - } - - private void editHomeLocation(Player p, Home locationMovedHome) throws SQLException { - Location newLocation = p.getLocation(); - TeleportationPoint newTeleportLocation = new TeleportationPoint(newLocation, HuskHomes.getSettings().getServerID()); - - assert locationMovedHome != null; - PlayerRelocateHomeEvent relocateHomeEvent = new PlayerRelocateHomeEvent(p, locationMovedHome, newTeleportLocation); - Bukkit.getScheduler().runTask(plugin, () -> { - Bukkit.getPluginManager().callEvent(relocateHomeEvent); - if (relocateHomeEvent.isCancelled()) { - return; - } - try (Connection connection = HuskHomes.getConnection()) { - // Remove old marker on map - if (locationMovedHome.isPublic() && HuskHomes.getSettings().doMapIntegration() && HuskHomes.getSettings().showPublicHomesOnMap()) { - HuskHomes.getMap().removePublicHomeMarker(locationMovedHome.getName(), locationMovedHome.getOwnerUsername()); - } - - DataManager.updateHomeLocation(locationMovedHome.getOwnerUsername(), locationMovedHome.getName(), newLocation, connection); - MessageManager.sendMessage(p, "edit_home_update_location", locationMovedHome.getName()); - - // Add new updated marker on map - locationMovedHome.setLocation(newLocation, HuskHomes.getSettings().getServerID()); - if (locationMovedHome.isPublic() && HuskHomes.getSettings().doMapIntegration() && HuskHomes.getSettings().showPublicHomesOnMap()) { - HuskHomes.getMap().addPublicHomeMarker(locationMovedHome); - } - } catch (SQLException e) { - plugin.getLogger().log(Level.SEVERE, "An SQL exception occurred updating a home's location."); - } - }); - } - - private void editHomeDescription(Player p, Home descriptionChangedHome, String newDescriptionString) throws SQLException { - assert descriptionChangedHome != null; - PlayerChangeHomeDescriptionEvent changeHomeDescriptionEvent = new PlayerChangeHomeDescriptionEvent(p, descriptionChangedHome, newDescriptionString); - Bukkit.getScheduler().runTask(plugin, () -> { - Bukkit.getPluginManager().callEvent(changeHomeDescriptionEvent); - if (changeHomeDescriptionEvent.isCancelled()) { - return; - } - Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> { - try (Connection connection = HuskHomes.getConnection()) { - // Check the description is valid - if (newDescriptionString.length() > 255) { - MessageManager.sendMessage(p, "error_edit_home_description_length"); - return; - } - if (!HuskHomes.getSettings().doUnicodeInDescriptions()) { - if (!RegexUtil.DESCRIPTION_PATTERN.matcher(newDescriptionString).matches()) { - MessageManager.sendMessage(p, "error_edit_home_description_characters"); - return; - } - } - - // Remove old marker if using a map integration - if (descriptionChangedHome.isPublic() && HuskHomes.getSettings().doMapIntegration() && HuskHomes.getSettings().showPublicHomesOnMap()) { - HuskHomes.getMap().removePublicHomeMarker(descriptionChangedHome.getName(), descriptionChangedHome.getOwnerUsername()); - } - - // Update description - DataManager.updateHomeDescription(descriptionChangedHome.getOwnerUsername(), descriptionChangedHome.getName(), newDescriptionString, connection); - - // Add new marker if using a map integration - descriptionChangedHome.setDescription(newDescriptionString); - if (descriptionChangedHome.isPublic() && HuskHomes.getSettings().doMapIntegration() && HuskHomes.getSettings().showPublicHomesOnMap()) { - HuskHomes.getMap().addPublicHomeMarker(descriptionChangedHome); - } - - // Confirmation message - MessageManager.sendMessage(p, "edit_home_update_description", descriptionChangedHome.getName(), MineDown.escape(newDescriptionString).replace("]", "\\]").replace("[", "\\[").replace("(", "\\(").replace(")", "\\)")); - } catch (SQLException e) { - plugin.getLogger().log(Level.SEVERE, "An SQL exception occurred editing a home description."); - } - }); - }); - } - - private void editHomeName(Player p, Home renamedHome, String newName, Connection connection) throws SQLException { - if (newName.length() > 16) { - MessageManager.sendMessage(p, "error_set_home_invalid_length"); - return; - } - if (!RegexUtil.NAME_PATTERN.matcher(newName).matches()) { - MessageManager.sendMessage(p, "error_set_home_invalid_characters"); - return; - } - if (DataManager.homeExists(renamedHome.getOwnerUsername(), newName, connection)) { - MessageManager.sendMessage(p, "error_set_home_name_taken"); - return; - } - final String oldHomeName = renamedHome.getName(); - PlayerRenameHomeEvent renameHomeEvent = new PlayerRenameHomeEvent(p, renamedHome, newName); - Bukkit.getScheduler().runTask(plugin, () -> { - Bukkit.getPluginManager().callEvent(renameHomeEvent); - if (renameHomeEvent.isCancelled()) { - return; - } - Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> { - try (Connection connection1 = HuskHomes.getConnection()) { - if (renamedHome.isPublic()) { - if (HuskHomes.getSettings().doMapIntegration() && HuskHomes.getSettings().showPublicHomesOnMap()) { - HuskHomes.getMap().removePublicHomeMarker(oldHomeName, renamedHome.getOwnerUsername()); - } - DataManager.updateHomeName(renamedHome.getOwnerUsername(), oldHomeName, newName, connection1); - PublicHomeCommand.updatePublicHomeTabCache(); - } else { - DataManager.updateHomeName(renamedHome.getOwnerUsername(), oldHomeName, newName, connection1); - } - renamedHome.setName(newName); - if (renamedHome.isPublic() && HuskHomes.getSettings().doMapIntegration() && HuskHomes.getSettings().showPublicHomesOnMap()) { - HuskHomes.getMap().addPublicHomeMarker(renamedHome); - } - HomeCommand.Tab.updatePlayerHomeCache(p); - MessageManager.sendMessage(p, "edit_home_update_name", oldHomeName, newName); - } catch (SQLException e) { - plugin.getLogger().log(Level.SEVERE, "An SQL exception occurred editing a home name."); - } - }); - }); - } - - private void editHomePrivacy(Player p, Home privacyUpdatingHome, boolean makingHomePublic) throws SQLException { - assert privacyUpdatingHome != null; - if (makingHomePublic) { - // Making a private home - if (!privacyUpdatingHome.isPublic()) { - PlayerMakeHomePublicEvent makeHomePublicEvent = new PlayerMakeHomePublicEvent(p, privacyUpdatingHome); - Bukkit.getScheduler().runTask(plugin, () -> { - Bukkit.getPluginManager().callEvent(makeHomePublicEvent); - if (makeHomePublicEvent.isCancelled()) { - return; - } - Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> { - // Check the player is allowed to set an additional public home - try (Connection connection = HuskHomes.getConnection()) { - final Stream playerHomes = DataManager.getPlayerHomes(p.getName(), connection).stream().filter(Home::isPublic); - final int publicHomeLimit = Home.getPublicHomeLimit(p); - if ((playerHomes.count() + 1) > publicHomeLimit) { - MessageManager.sendMessage(p, "error_edit_home_maximum_public_homes", Integer.toString(publicHomeLimit)); - return; - } - } catch (SQLException e) { - plugin.getLogger().log(Level.SEVERE, "An SQL exception occurred editing a home's privacy."); - return; - } - - // Check the player has enough money to make the home public - if (HuskHomes.getSettings().doEconomy()) { - double publicHomeCost = HuskHomes.getSettings().getPublicHomeCost(); - if (publicHomeCost > 0) { - if (!VaultIntegration.takeMoney(p, publicHomeCost)) { - MessageManager.sendMessage(p, "error_insufficient_funds", VaultIntegration.format(publicHomeCost)); - return; - } else { - MessageManager.sendMessage(p, "edit_home_privacy_public_success_economy", privacyUpdatingHome.getName(), VaultIntegration.format(publicHomeCost)); - } - } else { - MessageManager.sendMessage(p, "edit_home_privacy_public_success", privacyUpdatingHome.getName()); - } - } else { - MessageManager.sendMessage(p, "edit_home_privacy_public_success", privacyUpdatingHome.getName()); - } - try (Connection connection = HuskHomes.getConnection()) { - DataManager.updateHomePrivacy(privacyUpdatingHome.getOwnerUsername(), privacyUpdatingHome.getName(), true, connection); - PublicHomeCommand.updatePublicHomeTabCache(); - if (HuskHomes.getSettings().doMapIntegration() && HuskHomes.getSettings().showPublicHomesOnMap()) { - HuskHomes.getMap().addPublicHomeMarker(privacyUpdatingHome); - } - } catch (SQLException e) { - plugin.getLogger().log(Level.SEVERE, "An SQL exception occurred editing a home's privacy."); - } - }); - }); - } else { - MessageManager.sendMessage(p, "error_edit_home_privacy_already_public", privacyUpdatingHome.getName()); - } - } else { - if (privacyUpdatingHome.isPublic()) { - PlayerMakeHomePrivateEvent makeHomePrivateEvent = new PlayerMakeHomePrivateEvent(p, privacyUpdatingHome); - Bukkit.getScheduler().runTask(plugin, () -> { - Bukkit.getPluginManager().callEvent(makeHomePrivateEvent); - if (makeHomePrivateEvent.isCancelled()) { - return; - } - Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> { - try (Connection connection = HuskHomes.getConnection()) { - DataManager.updateHomePrivacy(privacyUpdatingHome.getOwnerUsername(), privacyUpdatingHome.getName(), false, connection); - MessageManager.sendMessage(p, "edit_home_privacy_private_success", privacyUpdatingHome.getName()); - if (HuskHomes.getSettings().doMapIntegration() && HuskHomes.getSettings().showPublicHomesOnMap()) { - HuskHomes.getMap().removePublicHomeMarker(privacyUpdatingHome.getName(), privacyUpdatingHome.getOwnerUsername()); - } - PublicHomeCommand.updatePublicHomeTabCache(); - } catch (SQLException e) { - plugin.getLogger().log(Level.SEVERE, "An SQL exception occurred editing a home's privacy."); - } - }); - }); - } else { - MessageManager.sendMessage(p, "error_edit_home_privacy_already_private", privacyUpdatingHome.getName()); - } - } - } - - @Override - public List onTabComplete(@NotNull CommandSender sender, @NotNull Command command, @NotNull String alias, String[] args) { - Player p = (Player) sender; - if (!p.hasPermission("huskhomes.edithome")) { - return Collections.emptyList(); - } - if (args.length == 1) { - final List tabCompletions = new ArrayList<>(); - final List homes = HomeCommand.Tab.getHomeTabCache().get(p.getUniqueId()); - if (homes == null) { - HomeCommand.Tab.updatePlayerHomeCache(p); - return Collections.emptyList(); - } - StringUtil.copyPartialMatches(args[0], homes, tabCompletions); - Collections.sort(tabCompletions); - return tabCompletions; - } else if (args.length == 2) { - List editHomeOptions = new ArrayList<>(); - editHomeOptions.add("rename"); - editHomeOptions.add("location"); - editHomeOptions.add("description"); - if (sender.hasPermission("huskhomes.edithome.public")) { - editHomeOptions.add("public"); - editHomeOptions.add("private"); - } - return editHomeOptions; - } else { - return Collections.emptyList(); - } - } -} diff --git a/src/main/java/me/william278/huskhomes2/commands/EditWarpCommand.java b/src/main/java/me/william278/huskhomes2/commands/EditWarpCommand.java deleted file mode 100644 index aa608561..00000000 --- a/src/main/java/me/william278/huskhomes2/commands/EditWarpCommand.java +++ /dev/null @@ -1,221 +0,0 @@ -package me.william278.huskhomes2.commands; - -import de.themoep.minedown.MineDown; -import me.william278.huskhomes2.util.EditingHandler; -import me.william278.huskhomes2.HuskHomes; -import me.william278.huskhomes2.util.MessageManager; -import me.william278.huskhomes2.api.events.PlayerChangeWarpDescriptionEvent; -import me.william278.huskhomes2.api.events.PlayerRelocateWarpEvent; -import me.william278.huskhomes2.api.events.PlayerRenameWarpEvent; -import me.william278.huskhomes2.data.DataManager; -import me.william278.huskhomes2.teleport.points.TeleportationPoint; -import me.william278.huskhomes2.teleport.points.Warp; -import me.william278.huskhomes2.util.RegexUtil; -import org.bukkit.Bukkit; -import org.bukkit.Location; -import org.bukkit.command.Command; -import org.bukkit.command.CommandSender; -import org.bukkit.command.TabCompleter; -import org.bukkit.entity.Player; -import org.bukkit.util.StringUtil; -import org.jetbrains.annotations.NotNull; - -import java.sql.Connection; -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.Locale; -import java.util.logging.Level; - -public class EditWarpCommand extends CommandBase implements TabCompleter { - - private static final HuskHomes plugin = HuskHomes.getInstance(); - - @Override - protected void onCommand(Player p, Command command, String label, String[] args) { - if (args.length == 0) { - MessageManager.sendMessage(p, "error_invalid_syntax", command.getUsage()); - return; - } - - String warpName = args[0]; - Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> { - try (Connection connection = HuskHomes.getConnection()) { - if (!DataManager.warpExists(warpName, connection)) { - MessageManager.sendMessage(p, "error_warp_invalid", warpName); - return; - } - - if (args.length == 1) { - final Warp warp = DataManager.getWarp(warpName, connection); - assert warp != null; - EditingHandler.showEditWarpOptions(p, warp); - return; - } - - switch (args[1].toLowerCase(Locale.ENGLISH)) { - case "location" -> editWarpLocation(p, warpName, connection); - case "description" -> { - if (args.length >= 3) { - // Get the new description - editWarpDescription(p, warpName, EditHomeCommand.buildDescription(args), connection); - } else { - MessageManager.sendMessage(p, "error_invalid_syntax", "/editwarp description "); - } - } - case "rename" -> { - if (args.length >= 3) { - editWarpName(p, warpName, args[2], connection); - } else { - MessageManager.sendMessage(p, "error_invalid_syntax", "/editwarp rename "); - } - } - default -> MessageManager.sendMessage(p, "error_invalid_syntax", command.getUsage()); - } - } catch (SQLException e) { - plugin.getLogger().log(Level.SEVERE, "An SQL exception occurred editing a warp."); - } - }); - } - - private void editWarpLocation(Player p, String warpName, Connection connection) throws SQLException { - Location newLocation = p.getLocation(); - TeleportationPoint newTeleportLocation = new TeleportationPoint(newLocation, HuskHomes.getSettings().getServerID()); - - Warp locationMovedWarp = DataManager.getWarp(warpName, connection); - assert locationMovedWarp != null; - PlayerRelocateWarpEvent relocateWarpEvent = new PlayerRelocateWarpEvent(p, locationMovedWarp, newTeleportLocation); - Bukkit.getScheduler().runTask(plugin, () -> { - Bukkit.getPluginManager().callEvent(relocateWarpEvent); - if (relocateWarpEvent.isCancelled()) { - return; - } - try (Connection connection1 = HuskHomes.getConnection()) { - // Remove old marker on map - if (HuskHomes.getSettings().doMapIntegration() && HuskHomes.getSettings().showWarpsOnMap()) { - HuskHomes.getMap().removeWarpMarker(warpName); - } - - DataManager.updateWarpLocation(warpName, newLocation, connection1); - MessageManager.sendMessage(p, "edit_warp_update_location", warpName); - - // Add new updated marker on map - locationMovedWarp.setLocation(newLocation, HuskHomes.getSettings().getServerID()); - if (HuskHomes.getSettings().doMapIntegration() && HuskHomes.getSettings().showWarpsOnMap()) { - HuskHomes.getMap().addWarpMarker(locationMovedWarp); - } - } catch (SQLException e) { - plugin.getLogger().log(Level.SEVERE, "An SQL exception occurred updating a warp's location."); - } - }); - } - - private void editWarpDescription(Player p, String warpName, String newDescriptionString, Connection connection) throws SQLException { - Warp descriptionChangedWarp = DataManager.getWarp(warpName, connection); - assert descriptionChangedWarp != null; - PlayerChangeWarpDescriptionEvent changeWarpDescriptionEvent = new PlayerChangeWarpDescriptionEvent(p, descriptionChangedWarp, newDescriptionString); - Bukkit.getScheduler().runTask(plugin, () -> { - Bukkit.getPluginManager().callEvent(changeWarpDescriptionEvent); - if (changeWarpDescriptionEvent.isCancelled()) { - return; - } - Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> { - try (Connection connection1 = HuskHomes.getConnection()) { - // Check the description is valid - if (newDescriptionString.length() > 255) { - MessageManager.sendMessage(p, "error_edit_warp_description_length"); - return; - } - if (!HuskHomes.getSettings().doUnicodeInDescriptions()) { - if (!RegexUtil.DESCRIPTION_PATTERN.matcher(newDescriptionString).matches()) { - MessageManager.sendMessage(p, "error_edit_warp_description_characters"); - return; - } - } - - // Remove old marker if on map - if (HuskHomes.getSettings().doMapIntegration() && HuskHomes.getSettings().showWarpsOnMap()) { - HuskHomes.getMap().removeWarpMarker(warpName); - } - - // Update description - DataManager.updateWarpDescription(warpName, newDescriptionString, connection1); - - // Add new marker to map if applicable - descriptionChangedWarp.setDescription(newDescriptionString); - if (HuskHomes.getSettings().doMapIntegration() && HuskHomes.getSettings().showWarpsOnMap()) { - HuskHomes.getMap().addWarpMarker(descriptionChangedWarp); - } - - // Confirmation message - MessageManager.sendMessage(p, "edit_warp_update_description", warpName, MineDown.escape(newDescriptionString).replace("]", "\\]").replace("[", "\\[").replace("(", "\\(").replace(")", "\\)")); - } catch (SQLException e) { - plugin.getLogger().log(Level.SEVERE, "An SQL exception occurred editing a warp's description."); - } - }); - }); - } - - private void editWarpName(Player p, String warpName, String newName, Connection connection) throws SQLException { - if (newName.length() > 16) { - MessageManager.sendMessage(p, "error_set_warp_invalid_length"); - return; - } - if (!RegexUtil.NAME_PATTERN.matcher(newName).matches()) { - MessageManager.sendMessage(p, "error_set_warp_invalid_characters"); - return; - } - if (DataManager.warpExists(newName, connection)) { - MessageManager.sendMessage(p, "error_set_warp_name_taken"); - return; - } - Warp renamedWarp = DataManager.getWarp(warpName, connection); - assert renamedWarp != null; - PlayerRenameWarpEvent renameWarpEvent = new PlayerRenameWarpEvent(p, renamedWarp, newName); - Bukkit.getScheduler().runTask(plugin, () -> { - Bukkit.getPluginManager().callEvent(renameWarpEvent); - if (renameWarpEvent.isCancelled()) { - return; - } - Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> { - try (Connection connection1 = HuskHomes.getConnection()) { - if (HuskHomes.getSettings().doMapIntegration() && HuskHomes.getSettings().showWarpsOnMap()) { - HuskHomes.getMap().removeWarpMarker(warpName); - } - DataManager.updateWarpName(warpName, newName, connection1); - WarpCommand.Tab.updateWarpsTabCache(); - renamedWarp.setName(newName); - if (HuskHomes.getSettings().doMapIntegration() && HuskHomes.getSettings().showWarpsOnMap()) { - HuskHomes.getMap().addWarpMarker(renamedWarp); - } - MessageManager.sendMessage(p, "edit_warp_update_name", warpName, newName); - } catch (SQLException e) { - plugin.getLogger().log(Level.SEVERE, "An SQL exception occurred editing a warp name."); - } - }); - }); - } - - @Override - public List onTabComplete(@NotNull CommandSender sender, @NotNull Command command, @NotNull String alias, String[] args) { - Player p = (Player) sender; - if (!p.hasPermission("huskhomes.editwarp")) { - return Collections.emptyList(); - } - if (args.length == 1) { - final List tabCompletions = new ArrayList<>(); - StringUtil.copyPartialMatches(args[0], WarpCommand.Tab.warpsTabCache, tabCompletions); - Collections.sort(tabCompletions); - return tabCompletions; - } else if (args.length == 2) { - List editWarpOptions = new ArrayList<>(); - editWarpOptions.add("rename"); - editWarpOptions.add("location"); - editWarpOptions.add("description"); - return editWarpOptions; - } else { - return Collections.emptyList(); - } - } -} diff --git a/src/main/java/me/william278/huskhomes2/commands/HomeCommand.java b/src/main/java/me/william278/huskhomes2/commands/HomeCommand.java deleted file mode 100644 index 71b20450..00000000 --- a/src/main/java/me/william278/huskhomes2/commands/HomeCommand.java +++ /dev/null @@ -1,110 +0,0 @@ -package me.william278.huskhomes2.commands; - -import me.william278.huskhomes2.HuskHomes; -import me.william278.huskhomes2.util.MessageManager; -import me.william278.huskhomes2.data.DataManager; -import me.william278.huskhomes2.teleport.TeleportManager; -import me.william278.huskhomes2.teleport.points.Home; -import me.william278.huskhomes2.util.RegexUtil; -import org.bukkit.Bukkit; -import org.bukkit.command.Command; -import org.bukkit.command.CommandSender; -import org.bukkit.command.TabCompleter; -import org.bukkit.entity.Player; -import org.bukkit.util.StringUtil; -import org.jetbrains.annotations.NotNull; - -import java.sql.Connection; -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.UUID; -import java.util.logging.Level; - -public class HomeCommand extends CommandBase { - - private static final HuskHomes plugin = HuskHomes.getInstance(); - - @Override - protected void onCommand(Player p, Command command, String label, String[] args) { - Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> { - try(Connection connection = HuskHomes.getConnection()) { - if (args.length == 1) { - String homeArgument = args[0]; - if (RegexUtil.OWNER_NAME_PATTERN.matcher(homeArgument).matches()) { - PublicHomeCommand.queueHomeTeleport(p, homeArgument); - } else if (DataManager.homeExists(p, homeArgument, connection)) { - Home home = DataManager.getHome(p.getName(), homeArgument, connection); - TeleportManager.queueTimedTeleport(p, home); - } else { - MessageManager.sendMessage(p, "error_home_invalid", homeArgument); - } - } else { - List homes = DataManager.getPlayerHomes(p.getName(), connection); - if (homes.size() == 1) { - // Teleport the player if they only have one home - TeleportManager.queueTimedTeleport(p, homes.get(0)); - return; - } - HomeListCommand.displayPlayerHomeList(p, p.getName(), 1); - } - } catch (SQLException e) { - plugin.getLogger().log(Level.SEVERE, "An SQL exception occurred teleporting home.", e); - } - }); - } - - public static class Tab implements TabCompleter { - - // Owner UUID, Home Name - private static final Map> homeTabCache = new HashMap<>(); - - // This method updates a player's home cache. - public static void updatePlayerHomeCache(Player p) { - UUID uuid = p.getUniqueId(); - Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> { - try(Connection connection = HuskHomes.getConnection()) { - List playerHomes = DataManager.getPlayerHomes(p.getName(), connection); - List homeNames = new ArrayList<>(); - for (Home home : playerHomes) { - homeNames.add(home.getName()); - } - homeTabCache.put(uuid, homeNames); - } catch (SQLException e) { - plugin.getLogger().log(Level.WARNING, "An SQL exception occurred updating the player home cache", e); - } - }); - } - - @Override - public List onTabComplete(CommandSender sender, @NotNull Command command, @NotNull String alias, String[] args) { - Player p = (Player) sender; - if (!sender.hasPermission("huskhomes.home")) { - return Collections.emptyList(); - } - if (args.length == 1) { - final List tabCompletions = new ArrayList<>(); - - List homes = homeTabCache.get(p.getUniqueId()); - if (homes == null) { - updatePlayerHomeCache(p); - return Collections.emptyList(); - } - StringUtil.copyPartialMatches(args[0], homes, tabCompletions); - - Collections.sort(tabCompletions); - - return tabCompletions; - } else { - return Collections.emptyList(); - } - } - - public static Map> getHomeTabCache() { - return homeTabCache; - } - } -} \ No newline at end of file diff --git a/src/main/java/me/william278/huskhomes2/commands/HomeListCommand.java b/src/main/java/me/william278/huskhomes2/commands/HomeListCommand.java deleted file mode 100644 index 963b4dfa..00000000 --- a/src/main/java/me/william278/huskhomes2/commands/HomeListCommand.java +++ /dev/null @@ -1,98 +0,0 @@ -package me.william278.huskhomes2.commands; - -import de.themoep.minedown.MineDown; -import me.william278.huskhomes2.HuskHomes; -import me.william278.huskhomes2.util.MessageManager; -import me.william278.huskhomes2.data.DataManager; -import me.william278.huskhomes2.teleport.points.Home; -import me.william278.huskhomes2.util.ChatList; -import org.bukkit.Bukkit; -import org.bukkit.command.Command; -import org.bukkit.entity.Player; - -import java.sql.Connection; -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.List; -import java.util.logging.Level; - -public class HomeListCommand extends CommandBase { - - private static final HuskHomes plugin = HuskHomes.getInstance(); - - @Override - protected void onCommand(Player p, Command command, String label, String[] args) { - int pageNo = 1; - String homeOwnerName = p.getName(); - if (args.length == 1 || args.length == 2) { - try { - pageNo = Integer.parseInt(args[0]); - } catch (NumberFormatException numberFormatException) { - homeOwnerName = args[0]; - if (args.length == 2) { - try { - pageNo = Integer.parseInt(args[1]); - } catch (NumberFormatException numberFormatException2) { - MessageManager.sendMessage(p, "error_invalid_syntax", command.getUsage()); - return; - } - } - } - } - displayPlayerHomeList(p, homeOwnerName, pageNo); - } - - public static void displayPlayerHomeList(Player player, String homeOwnerName, int pageNumber) { - Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> { - if (!player.getName().equalsIgnoreCase(homeOwnerName)) { - if (!player.hasPermission("huskhomes.home.other")) { - MessageManager.sendMessage(player, "error_no_permission"); - return; - } - } - try(Connection connection = HuskHomes.getConnection()) { - if (!DataManager.playerExists(homeOwnerName, connection)) { - MessageManager.sendMessage(player, "error_invalid_player"); - return; - } - List homes = DataManager.getPlayerHomes(homeOwnerName, connection); - if (homes.isEmpty()) { - if (!player.getName().equalsIgnoreCase(homeOwnerName)) { - MessageManager.sendMessage(player, "error_no_homes_set_other", homeOwnerName); - } else { - MessageManager.sendMessage(player, "error_no_homes_set"); - } - return; - } - - ArrayList homeList = new ArrayList<>(); - for (Home home : homes) { - homeList.add(MessageManager.getRawMessage("home_list_item", home.getName(), home.getOwnerUsername(), MineDown.escape(home.getDescription()) - .replace("]", "\\]") - .replace("[", "\\[") - .replace("(", "\\(") - .replace(")", "\\)"))); - } - - final int itemsPerPage = HuskHomes.getSettings().getPrivateHomesPerPage(); - final int homeLowerBound = (pageNumber - 1) * itemsPerPage; - int homeUpperBound = pageNumber * itemsPerPage; - if (homeUpperBound > homeList.size()) { - homeUpperBound = homeList.size(); - } - - ChatList homeChatList = new ChatList(homeList, itemsPerPage, "/huskhomes:homelist " + homeOwnerName, MessageManager.getRawMessage("list_item_divider"), true); - if (homeChatList.doesNotContainPage(pageNumber)) { - MessageManager.sendMessage(player, "error_invalid_page_number"); - return; - } - - MessageManager.sendMessage(player, "private_home_list_page_top", homeOwnerName, Integer.toString(homeLowerBound + 1), Integer.toString(homeUpperBound), Integer.toString(homeList.size())); - player.spigot().sendMessage(homeChatList.getPage(pageNumber)); - } catch (SQLException e) { - plugin.getLogger().log(Level.SEVERE, "An SQL exception occurred!", e); - } - }); - } - -} diff --git a/src/main/java/me/william278/huskhomes2/commands/HuskHomesCommand.java b/src/main/java/me/william278/huskhomes2/commands/HuskHomesCommand.java deleted file mode 100644 index e0f73664..00000000 --- a/src/main/java/me/william278/huskhomes2/commands/HuskHomesCommand.java +++ /dev/null @@ -1,197 +0,0 @@ -package me.william278.huskhomes2.commands; - -import de.themoep.minedown.MineDown; -import me.william278.huskhomes2.HuskHomes; -import me.william278.huskhomes2.util.MessageManager; -import me.william278.huskhomes2.migrators.EssentialsMigrator; -import me.william278.huskhomes2.util.ChatList; -import me.william278.huskhomes2.util.UpdateChecker; -import net.md_5.bungee.api.ChatColor; -import org.bukkit.Bukkit; -import org.bukkit.command.Command; -import org.bukkit.command.CommandSender; -import org.bukkit.command.TabCompleter; -import org.bukkit.entity.Player; -import org.bukkit.util.StringUtil; -import org.jetbrains.annotations.NotNull; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.List; - -public class HuskHomesCommand extends CommandBase implements TabCompleter { - - private static final HuskHomes plugin = HuskHomes.getInstance(); - private static final StringBuilder PLUGIN_INFORMATION = new StringBuilder() - .append("[HuskHomes](#00fb9a bold) [| Version ").append(plugin.getDescription().getVersion()).append("](#00fb9a)\n") - .append("[").append(plugin.getDescription().getDescription()).append("](gray)\n") - .append("[• Author:](white) [William278](gray show_text=&7Click to visit website open_url=https://william278.net)\n") - .append("[• Contributors:](white) [imDaniX](gray show_text=&7Code, refactoring), [Log1x](gray show_text=&7Code)\n") - .append("[• Translators:](white) [SnivyJ](gray show_text=&7Simplified Chinese, zh-cn), [TonyPak](gray show_text=&7Traditional Chinese, zh-tw), [Villag3r_](gray show_text=&7Italian, it-it), [xF3d3](gray show_text=&7Italian, it-it), [ReferTV](gray show_text=&7Polish, pl), [anchelthe](gray show_text=&7Spanish, es-es), [Ceddix](gray show_text=&7German, de-de) \n") - .append("[• Help Wiki:](white) [[Link]](#00fb9a show_text=&7Click to open link open_url=https://github.com/WiIIiam278/HuskHomes2/wiki/)\n") - .append("[• Report Issues:](white) [[Link]](#00fb9a show_text=&7Click to open link open_url=https://github.com/WiIIiam278/HuskHomes2/issues)\n") - .append("[• Support Discord:](white) [[Link]](#00fb9a show_text=&7Click to join open_url=https://discord.gg/tVYhJfyDWG)"); - - // Show users a list of available commands - public static void showHelpMenu(Player player, int pageNumber) { - ArrayList commandDisplay = new ArrayList<>(); - for (String commandName : plugin.getDescription().getCommands().keySet()) { - Command command = plugin.getCommand(commandName); - if (command == null) { - continue; - } - if (commandName.equals("huskhomes") && HuskHomes.getSettings().hideHuskHomesCommandFromHelpMenu()) { - continue; - } - if (HuskHomes.getSettings().hideCommandsFromHelpMenuWithoutPermission()) { - String permission = command.getPermission(); - if (permission != null) { - if (!player.hasPermission(permission)) { - continue; - } - } - } - commandDisplay.add(MessageManager.getRawMessage("command_list_item", commandName, - command.getUsage(), command.getDescription())); - } - - MessageManager.sendMessage(player, "command_list_header"); - ChatList helpList = new ChatList(commandDisplay, 10, "/huskhomes help", "\n", false); - if (helpList.doesNotContainPage(pageNumber)) { - MessageManager.sendMessage(player, "error_invalid_page_number"); - return; - } - player.spigot().sendMessage(helpList.getPage(pageNumber)); - } - - @Override - public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) { - if (args.length == 0) { - if (sender instanceof Player) { - showHelpMenu((Player) sender, 1); - } else { - sender.spigot().sendMessage(new MineDown(PLUGIN_INFORMATION.toString()).toComponent()); - } - return true; - } - - switch (args[0]) { - case "about", "info" -> { - if (sender.hasPermission("huskhomes.about")) { - sender.spigot().sendMessage(new MineDown(PLUGIN_INFORMATION.toString()).toComponent()); - } else { - sender.spigot().sendMessage(new MineDown(MessageManager.getRawMessage("error_no_permission")).toComponent()); - } - return true; - } - case "update" -> { - if (sender.hasPermission("huskhomes.version_checker")) { - sender.spigot().sendMessage(new MineDown("[Checking for HuskHomes updates...](gray)").toComponent()); - Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> { - UpdateChecker updateChecker = new UpdateChecker(plugin); - if (updateChecker.isUpToDate()) { - sender.spigot().sendMessage(new MineDown("[HuskHomes](#00fb9a bold) [| HuskHomes is up-to-date, running Version " + updateChecker.getLatestVersion() + "](#00fb9a)").toComponent()); - } else { - sender.spigot().sendMessage( - new MineDown("[HuskHomes](#00fb9a bold) [| A new update is available:](#00fb9a) [HuskHomes " + updateChecker.getLatestVersion() + "](#00fb9a bold)" + - "\n[•](white) [Currently running:](#00fb9a) [Version " + updateChecker.getCurrentVersion() + "](gray)" + - "\n[•](white) [Download links:](#00fb9a) [[⏩ Spigot]](gray open_url=https://www.spigotmc.org/resources/huskhomes.83767/updates) [•](#262626) [[⏩ Polymart]](gray open_url=https://polymart.org/resource/huskhomes.284/updates)").toComponent()); - } - }); - } else { - sender.spigot().sendMessage(new MineDown(MessageManager.getRawMessage("error_no_permission")).toComponent()); - } - return true; - } - case "reload" -> { - if (sender instanceof Player p) { - if (p.hasPermission("huskhomes.reload")) { - HuskHomes.getSettings().reload(); - MessageManager.loadMessages(HuskHomes.getSettings().getLanguage()); - sender.spigot().sendMessage(new MineDown("[HuskHomes](#00fb9a bold) �fb9a&| Reloaded config & message files.").toComponent()); - } else { - MessageManager.sendMessage(p, "error_no_permission"); - } - return true; - } else { - HuskHomes.getSettings().reload(); - MessageManager.loadMessages(HuskHomes.getSettings().getLanguage()); - plugin.getLogger().info("Reloaded config and message files."); - } - return true; - } - case "migrate" -> { - if (sender instanceof Player p) { - MessageManager.sendMessage(p, "error_console_only"); - return true; - } - if (args.length >= 2) { - if (args[1].equalsIgnoreCase("essentialsx")) { - sender.spigot().sendMessage(new MineDown("[HuskHomes](#00fb9a bold) �fb9a&| Starting data migration from EssentialsX...").toComponent()); - if (args.length == 4) { - EssentialsMigrator.migrate(args[2].toLowerCase(), args[3].toLowerCase()); - } else if (args.length == 2) { - EssentialsMigrator.migrate(); - } else { - sender.sendMessage(ChatColor.RED + "Invalid syntax! Usage: /huskhomes migrate essentialsX [world filter] [target server]"); - } - } else { - sender.sendMessage(ChatColor.RED + "Invalid argument! Usage: /huskhomes migrate essentialsX"); - } - } else { - sender.sendMessage(ChatColor.RED + "Invalid syntax! Usage: /huskhomes migrate essentialsX"); - } - return true; - } - case "help" -> { - if (sender instanceof Player p) { - if (args.length == 2) { - try { - int pageNo = Integer.parseInt(args[1]); - showHelpMenu(p, pageNo); - } catch (NumberFormatException ex) { - MessageManager.sendMessage(p, "error_invalid_page_number"); - } - } else { - showHelpMenu(p, 1); - } - } - return true; - } - default -> { - if (sender instanceof Player) { - showHelpMenu((Player) sender, 1); - } else { - sender.spigot().sendMessage(new MineDown(PLUGIN_INFORMATION.toString()).toComponent()); - } - return true; - } - } - } - - @Override - protected void onCommand(Player player, Command command, String label, String[] args) { - // Console is fine too - } - - final static String[] COMMAND_TAB_ARGS = {"help", "about", "update", "reload"}; - - @Override - public List onTabComplete(@NotNull CommandSender sender, Command command, @NotNull String alias, String[] args) { - Player p = (Player) sender; - if (command.getPermission() != null) { - if (!p.hasPermission(command.getPermission())) { - return Collections.emptyList(); - } - } - if (args.length == 1) { - final List tabCompletions = new ArrayList<>(); - StringUtil.copyPartialMatches(args[0], Arrays.asList(COMMAND_TAB_ARGS), tabCompletions); - Collections.sort(tabCompletions); - return tabCompletions; - } else { - return Collections.emptyList(); - } - } -} diff --git a/src/main/java/me/william278/huskhomes2/commands/PublicHomeCommand.java b/src/main/java/me/william278/huskhomes2/commands/PublicHomeCommand.java deleted file mode 100644 index 2dccc60d..00000000 --- a/src/main/java/me/william278/huskhomes2/commands/PublicHomeCommand.java +++ /dev/null @@ -1,157 +0,0 @@ -package me.william278.huskhomes2.commands; - -import me.william278.huskhomes2.HuskHomes; -import me.william278.huskhomes2.util.MessageManager; -import me.william278.huskhomes2.data.DataManager; -import me.william278.huskhomes2.teleport.TeleportManager; -import me.william278.huskhomes2.teleport.points.Home; -import me.william278.huskhomes2.util.RegexUtil; -import org.bukkit.Bukkit; -import org.bukkit.command.Command; -import org.bukkit.command.CommandSender; -import org.bukkit.command.TabCompleter; -import org.bukkit.entity.Player; -import org.bukkit.util.StringUtil; -import org.jetbrains.annotations.NotNull; - -import java.sql.Connection; -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.logging.Level; - -public class PublicHomeCommand extends CommandBase implements TabCompleter { - - // TODO Remove it - // Cached HashMap of public homes - // HomeName, OwnerName - private static final Map publicHomeTabCache = new HashMap<>(); - - private static final HuskHomes plugin = HuskHomes.getInstance(); - - // Updates the public home cache - public static void updatePublicHomeTabCache() { - publicHomeTabCache.clear(); - Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> { - try (Connection connection = HuskHomes.getConnection()) { - for (Home home : DataManager.getPublicHomes(connection)) { - publicHomeTabCache.put(home.getName(), home.getOwnerUsername()); - } - } catch (SQLException exception) { - plugin.getLogger().log(Level.SEVERE, "An SQL exception occurred updating the public home tab cache"); - } - }); - } - - public static void queueHomeTeleport(Player p, String publicHome) { - Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> { - try (Connection connection = HuskHomes.getConnection()) { - String[] split = publicHome.split("\\."); - String ownerName = split[0]; - String homeName = split[1]; - if (DataManager.homeExists(ownerName, homeName, connection)) { - Home home = DataManager.getHome(ownerName, homeName, connection); - assert home != null; - if (home.isPublic() || p.getName().equalsIgnoreCase(ownerName) || p.hasPermission("huskhomes.home.other")) { - TeleportManager.queueTimedTeleport(p, home); - } else { - MessageManager.sendMessage(p, "error_public_home_invalid", ownerName, homeName); - } - } else { - MessageManager.sendMessage(p, "error_public_home_invalid", ownerName, homeName); - } - } catch (SQLException e) { - plugin.getLogger().log(Level.SEVERE, "An exception occurred teleporting to a public home."); - } - }); - } - - @Override - public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) { - if (!(sender instanceof Player p)) { - handleConsolePublicHomeTeleport(sender, args); - return true; - } - if (args.length == 0) { - PublicHomeListCommand.displayPublicHomeList(p, 1); - return true; - } - String publicHome = args[0]; - if (RegexUtil.OWNER_NAME_PATTERN.matcher(publicHome).matches()) { - queueHomeTeleport(p, publicHome); - } else { - MessageManager.sendMessage(p, "error_invalid_syntax", command.getUsage()); - } - return true; - } - - // Handle a warp from console - public static void handleConsolePublicHomeTeleport(CommandSender sender, String[] args) { - String publicHomeName; - Player targetPlayer; - if (args.length == 2) { - publicHomeName = args[0]; - targetPlayer = Bukkit.getPlayer(args[1]); - if (targetPlayer != null) { - if (RegexUtil.OWNER_NAME_PATTERN.matcher(publicHomeName).matches()) { - String[] split = publicHomeName.split("\\."); - String ownerName = split[0]; - String homeName = split[1]; - Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> { - try (Connection connection = HuskHomes.getConnection()) { - if (DataManager.homeExists(ownerName, homeName, connection)) { - Home home = DataManager.getHome(ownerName, homeName, connection); - assert home != null; - if (!home.isPublic()) { - sender.sendMessage("Warning: Bypassed home security (" + home.getName() + " was not set to public by " + home.getOwnerUsername() + ")"); - } - TeleportManager.teleportPlayer(targetPlayer, home); - sender.sendMessage("Successfully teleported player!"); - MessageManager.sendMessage(targetPlayer, "teleporting_complete_console", (home.getOwnerUsername() + "." + homeName)); - } else { - sender.sendMessage("Error: Invalid home \"" + publicHomeName + "\" specified"); - } - } catch (SQLException e) { - plugin.getLogger().log(Level.SEVERE, "An SQL exception occurred handling a consome phome teleport"); - } - }); - } else { - sender.sendMessage("Error: Invalid public home format: /warp "); - } - } else { - sender.sendMessage("Error: Invalid player specified (are they online?)"); - } - } else { - sender.sendMessage("Console Public Home Usage: /phome "); - } - } - - @Override - protected void onCommand(Player player, Command command, String label, String[] args) { - // Accept console input - } - - @Override - public List onTabComplete(CommandSender sender, @NotNull Command command, @NotNull String alias, String[] args) { - if (!sender.hasPermission("huskhomes.publichome")) { - return Collections.emptyList(); - } - if (args.length == 1) { - final List sortedHomeNames = new ArrayList<>(); - StringUtil.copyPartialMatches(args[0], publicHomeTabCache.keySet(), sortedHomeNames); - Collections.sort(sortedHomeNames); - - final List finalCompletions = new ArrayList<>(); - for (String homeName : sortedHomeNames) { - finalCompletions.add(publicHomeTabCache.get(homeName) + "." + homeName); - } - return finalCompletions; - - } else { - return Collections.emptyList(); - } - } -} diff --git a/src/main/java/me/william278/huskhomes2/commands/PublicHomeListCommand.java b/src/main/java/me/william278/huskhomes2/commands/PublicHomeListCommand.java deleted file mode 100644 index 4792eb49..00000000 --- a/src/main/java/me/william278/huskhomes2/commands/PublicHomeListCommand.java +++ /dev/null @@ -1,74 +0,0 @@ -package me.william278.huskhomes2.commands; - -import de.themoep.minedown.MineDown; -import me.william278.huskhomes2.HuskHomes; -import me.william278.huskhomes2.util.MessageManager; -import me.william278.huskhomes2.data.DataManager; -import me.william278.huskhomes2.teleport.points.Home; -import me.william278.huskhomes2.util.ChatList; -import org.bukkit.Bukkit; -import org.bukkit.command.Command; -import org.bukkit.entity.Player; - -import java.sql.Connection; -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.List; -import java.util.logging.Level; - -public class PublicHomeListCommand extends CommandBase { - - private static final HuskHomes plugin = HuskHomes.getInstance(); - - @Override - protected void onCommand(Player p, Command command, String label, String[] args) { - int pageNo = 1; - if (args.length == 1) { - try { - pageNo = Integer.parseInt(args[0]); - } catch (Exception e) { - MessageManager.sendMessage(p, "error_invalid_syntax", command.getUsage()); - return; - } - } - displayPublicHomeList(p, pageNo); - } - - public static void displayPublicHomeList(Player player, int pageNumber) { - Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> { - try (Connection connection = HuskHomes.getConnection()) { - List homes = DataManager.getPublicHomes(connection); - if (homes.isEmpty()) { - MessageManager.sendMessage(player, "error_no_public_homes_set"); - return; - } - ArrayList publicHomeList = new ArrayList<>(); - for (Home home : homes) { - publicHomeList.add(MessageManager.getRawMessage("public_home_list_item", home.getName(), home.getOwnerUsername(), MineDown.escape(home.getDescription()).replace("]", "\\]") - .replace("[", "\\[") - .replace("(", "\\(") - .replace(")", "\\)"))); - } - - final int itemsPerPage = HuskHomes.getSettings().getPublicHomesPerPage(); - final int homeLowerBound = (pageNumber - 1) * itemsPerPage; - int homeUpperBound = pageNumber * itemsPerPage; - if (homeUpperBound > publicHomeList.size()) { - homeUpperBound = publicHomeList.size(); - } - - ChatList homeChatList = new ChatList(publicHomeList, itemsPerPage, "/huskhomes:publichomelist", MessageManager.getRawMessage("list_item_divider"), true); - if (homeChatList.doesNotContainPage(pageNumber)) { - MessageManager.sendMessage(player, "error_invalid_page_number"); - return; - } - - MessageManager.sendMessage(player, "public_home_list_page_top", Integer.toString(homeLowerBound + 1), Integer.toString(homeUpperBound), Integer.toString(publicHomeList.size())); - player.spigot().sendMessage(homeChatList.getPage(pageNumber)); - } catch (SQLException e) { - plugin.getLogger().log(Level.SEVERE, "An SQL exception occurred!", e); - } - }); - } - -} diff --git a/src/main/java/me/william278/huskhomes2/commands/RtpCommand.java b/src/main/java/me/william278/huskhomes2/commands/RtpCommand.java deleted file mode 100644 index cbf790a8..00000000 --- a/src/main/java/me/william278/huskhomes2/commands/RtpCommand.java +++ /dev/null @@ -1,46 +0,0 @@ -package me.william278.huskhomes2.commands; - -import me.william278.huskhomes2.HuskHomes; -import me.william278.huskhomes2.util.MessageManager; -import me.william278.huskhomes2.teleport.TeleportManager; -import org.bukkit.Bukkit; -import org.bukkit.World; -import org.bukkit.command.Command; -import org.bukkit.entity.Player; - -import java.sql.Connection; -import java.sql.SQLException; -import java.util.StringJoiner; -import java.util.logging.Level; - -public class RtpCommand extends CommandBase { - - private static final HuskHomes plugin = HuskHomes.getInstance(); - - @Override - protected void onCommand(Player p, Command command, String label, String[] args) { - if (HuskHomes.getSettings().doRtpCommand()) { - if (p.getWorld().getEnvironment() == World.Environment.NORMAL) { - Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> { - try (Connection connection = HuskHomes.getConnection()) { - TeleportManager.queueRandomTeleport(p, connection); - } catch (SQLException e) { - plugin.getLogger().log(Level.SEVERE, "An SQL exception occurred queuing a Random teleport", e); - } - }); - } else { - MessageManager.sendMessage(p, "error_rtp_invalid_dimension"); - } - } else if (Bukkit.getPluginManager().getPlugin("HuskBungeeRTP") != null) { - StringJoiner commandForward = new StringJoiner(" ").add("huskbungeertp:rtp"); - for (String argument : args) { - commandForward.add(argument); - } - p.performCommand(commandForward.toString()); - } else { - MessageManager.sendMessage(p, "error_command_disabled"); - } - } -} - - diff --git a/src/main/java/me/william278/huskhomes2/commands/SetHomeCommand.java b/src/main/java/me/william278/huskhomes2/commands/SetHomeCommand.java deleted file mode 100644 index 0713a62f..00000000 --- a/src/main/java/me/william278/huskhomes2/commands/SetHomeCommand.java +++ /dev/null @@ -1,40 +0,0 @@ -package me.william278.huskhomes2.commands; - -import me.william278.huskhomes2.HuskHomes; -import me.william278.huskhomes2.util.MessageManager; -import me.william278.huskhomes2.data.DataManager; -import me.william278.huskhomes2.teleport.SettingHandler; -import org.bukkit.Bukkit; -import org.bukkit.command.Command; -import org.bukkit.entity.Player; - -import java.sql.Connection; -import java.sql.SQLException; -import java.util.logging.Level; - -public class SetHomeCommand extends CommandBase { - - private static final HuskHomes plugin = HuskHomes.getInstance(); - - @Override - protected void onCommand(Player p, Command command, String label, String[] args) { - if (args.length == 1) { - String homeName = args[0]; - SettingHandler.setHome(p.getLocation(), p, homeName); - } else { - Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> { - try (Connection connection = HuskHomes.getConnection()) { - if (DataManager.getPlayerHomes(p.getName(), connection).size() == 0) { - // If the player hasn't set a home yet, set one called "home" - SettingHandler.setHome(p.getLocation(), p, "home"); - } else { - MessageManager.sendMessage(p, "error_invalid_syntax", command.getUsage()); - } - } catch (SQLException e) { - plugin.getLogger().log(Level.SEVERE, "An exception occurred setting your first home"); - } - }); - } - } - -} diff --git a/src/main/java/me/william278/huskhomes2/commands/SetSpawnCommand.java b/src/main/java/me/william278/huskhomes2/commands/SetSpawnCommand.java deleted file mode 100644 index e6d204fb..00000000 --- a/src/main/java/me/william278/huskhomes2/commands/SetSpawnCommand.java +++ /dev/null @@ -1,25 +0,0 @@ -package me.william278.huskhomes2.commands; - -import me.william278.huskhomes2.HuskHomes; -import me.william278.huskhomes2.util.MessageManager; -import me.william278.huskhomes2.teleport.SettingHandler; -import org.bukkit.command.Command; -import org.bukkit.entity.Player; - -public class SetSpawnCommand extends CommandBase { - - @Override - protected void onCommand(Player p, Command command, String label, String[] args) { - if (HuskHomes.getSettings().doSpawnCommand()) { - if (HuskHomes.getSettings().doCrossServerSpawn()) { - SettingHandler.updateCrossServerSpawnWarp(p); - return; - } - SettingHandler.setSpawnLocation(p.getLocation()); - p.getWorld().setSpawnLocation(p.getLocation()); - MessageManager.sendMessage(p, "set_spawn_success"); - } else { - MessageManager.sendMessage(p, "error_command_disabled"); - } - } -} diff --git a/src/main/java/me/william278/huskhomes2/commands/SetWarpCommand.java b/src/main/java/me/william278/huskhomes2/commands/SetWarpCommand.java deleted file mode 100644 index 8f14dcaf..00000000 --- a/src/main/java/me/william278/huskhomes2/commands/SetWarpCommand.java +++ /dev/null @@ -1,20 +0,0 @@ -package me.william278.huskhomes2.commands; - -import me.william278.huskhomes2.util.MessageManager; -import me.william278.huskhomes2.teleport.SettingHandler; -import org.bukkit.command.Command; -import org.bukkit.entity.Player; - -public class SetWarpCommand extends CommandBase { - - @Override - protected void onCommand(Player p, Command command, String label, String[] args) { - if (args.length == 1) { - String warpName = args[0]; - SettingHandler.setWarp(p.getLocation(), p, warpName); - } else { - MessageManager.sendMessage(p, "error_invalid_syntax", command.getUsage()); - } - } - -} diff --git a/src/main/java/me/william278/huskhomes2/commands/SpawnCommand.java b/src/main/java/me/william278/huskhomes2/commands/SpawnCommand.java deleted file mode 100644 index 8b9b026b..00000000 --- a/src/main/java/me/william278/huskhomes2/commands/SpawnCommand.java +++ /dev/null @@ -1,46 +0,0 @@ -package me.william278.huskhomes2.commands; - -import me.william278.huskhomes2.HuskHomes; -import me.william278.huskhomes2.data.DataManager; -import me.william278.huskhomes2.teleport.TeleportManager; -import me.william278.huskhomes2.util.MessageManager; -import org.bukkit.Bukkit; -import org.bukkit.command.Command; -import org.bukkit.entity.Player; - -import java.sql.Connection; -import java.sql.SQLException; -import java.util.logging.Level; - -public class SpawnCommand extends CommandBase { - - private final static HuskHomes plugin = HuskHomes.getInstance(); - - @Override - protected void onCommand(Player p, Command command, String label, String[] args) { - if (HuskHomes.getSettings().doSpawnCommand()) { - String spawnWarpName = HuskHomes.getSettings().getSpawnWarpName(); - Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> { - try (Connection connection = HuskHomes.getConnection()) { - // Cross server spawn teleport - if (HuskHomes.getSettings().doCrossServerSpawn()) { - if (DataManager.warpExists(spawnWarpName, connection)) { - TeleportManager.queueTimedTeleport(p, DataManager.getWarp(spawnWarpName, connection)); - } else { - MessageManager.sendMessage(p, "error_spawn_undefined"); - } - return; - } - - // Teleport the player to spawn if it has been set - TeleportManager.getSpawnLocation().ifPresentOrElse(teleportationPoint -> TeleportManager.queueTimedTeleport(p, teleportationPoint), - () -> MessageManager.sendMessage(p, "error_spawn_undefined")); - } catch (SQLException e) { - plugin.getLogger().log(Level.SEVERE, "An exception occurred returning back to spawn"); - } - }); - } else { - MessageManager.sendMessage(p, "error_command_disabled"); - } - } -} diff --git a/src/main/java/me/william278/huskhomes2/commands/TpAcceptCommand.java b/src/main/java/me/william278/huskhomes2/commands/TpAcceptCommand.java deleted file mode 100644 index a41bdf0a..00000000 --- a/src/main/java/me/william278/huskhomes2/commands/TpAcceptCommand.java +++ /dev/null @@ -1,19 +0,0 @@ -package me.william278.huskhomes2.commands; - -import me.william278.huskhomes2.teleport.TeleportRequestHandler; -import me.william278.huskhomes2.util.NameAutoCompleter; -import org.bukkit.command.Command; -import org.bukkit.entity.Player; - -public class TpAcceptCommand extends CommandBase { - - @Override - protected void onCommand(Player p, Command command, String label, String[] args) { - if (args.length == 1) { - String targetPlayer = args[0]; - TeleportRequestHandler.replyTpRequest(p, NameAutoCompleter.getAutoCompletedName(targetPlayer), true); - } else { - TeleportRequestHandler.replyTpRequest(p, true); - } - } -} \ No newline at end of file diff --git a/src/main/java/me/william278/huskhomes2/commands/TpAllCommand.java b/src/main/java/me/william278/huskhomes2/commands/TpAllCommand.java deleted file mode 100644 index ef92d494..00000000 --- a/src/main/java/me/william278/huskhomes2/commands/TpAllCommand.java +++ /dev/null @@ -1,21 +0,0 @@ -package me.william278.huskhomes2.commands; - -import me.william278.huskhomes2.HuskHomes; -import me.william278.huskhomes2.util.MessageManager; -import me.william278.huskhomes2.teleport.TeleportManager; -import org.bukkit.command.Command; -import org.bukkit.entity.Player; - -public class TpAllCommand extends CommandBase { - - @Override - protected void onCommand(Player p, Command command, String label, String[] args) { - if (HuskHomes.getPlayerList().getPlayers().size() <= 1) { - MessageManager.sendMessage(p, "error_no_other_online_players"); - return; - } - TeleportManager.teleportAllHere(p); - MessageManager.sendMessage(p, "teleporting_all_players"); - } - -} \ No newline at end of file diff --git a/src/main/java/me/william278/huskhomes2/commands/TpCommand.java b/src/main/java/me/william278/huskhomes2/commands/TpCommand.java deleted file mode 100644 index daaa6435..00000000 --- a/src/main/java/me/william278/huskhomes2/commands/TpCommand.java +++ /dev/null @@ -1,381 +0,0 @@ -package me.william278.huskhomes2.commands; - -import de.themoep.minedown.MineDown; -import me.william278.huskhomes2.HuskHomes; -import me.william278.huskhomes2.util.MessageManager; -import me.william278.huskhomes2.teleport.TeleportManager; -import me.william278.huskhomes2.teleport.points.TeleportationPoint; -import me.william278.huskhomes2.util.NameAutoCompleter; -import org.bukkit.Bukkit; -import org.bukkit.World; -import org.bukkit.command.Command; -import org.bukkit.command.CommandSender; -import org.bukkit.command.TabCompleter; -import org.bukkit.entity.Player; -import org.bukkit.util.StringUtil; -import org.jetbrains.annotations.NotNull; - -import java.util.*; - -public class TpCommand extends CommandBase { - - private static final HuskHomes plugin = HuskHomes.getInstance(); - - private static final HashSet inputHandlers = new HashSet<>(); - - public TpCommand() { - inputHandlers.add(new TpCommandInputHandler(false, "")); - inputHandlers.add(new TpCommandInputHandler(true, "", "")); - inputHandlers.add(new TpCommandInputHandler(false, "", "", "")); - inputHandlers.add(new TpCommandInputHandler(false, "", "", "", "")); - inputHandlers.add(new TpCommandInputHandler(false, "", "", "", "", "")); - inputHandlers.add(new TpCommandInputHandler(false, "", "", "", "", "", "")); - inputHandlers.add(new TpCommandInputHandler(true, "", "", "", "")); - inputHandlers.add(new TpCommandInputHandler(true, "", "", "", "", "")); - inputHandlers.add(new TpCommandInputHandler(true, "", "", "", "", "", "")); - inputHandlers.add(new TpCommandInputHandler(true, "", "", "", "", "", "", "")); - - if (HuskHomes.getSettings().doBungee()) { - inputHandlers.add(new TpCommandInputHandler(false, "", "", "", "", "")); - inputHandlers.add(new TpCommandInputHandler(true, "", "", "", "", "", "")); - inputHandlers.add(new TpCommandInputHandler(true, "", "", "", "", "", "", "", "")); - } - } - - @Override - public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) { - TpCommandInputHandler.HandlerResponse response = null; - for (TpCommandInputHandler inputHandler : inputHandlers) { - response = inputHandler.handleInput(args, sender); - switch (response) { - case CAN_HANDLE -> { - inputHandler.executeTeleport(sender); - return true; - } - case CANNOT_HANDLE_HANDLED_BY_TP_HERE -> { - return true; - } - } - } - assert response != null; - switch (response) { - case CANNOT_HANDLE_BY_CONSOLE -> { - sender.spigot().sendMessage(new MineDown(MessageManager.getRawMessage("error_invalid_syntax", - "/tp " + getClosestUsage(true, sender, args))).toComponent()); - return true; - } - case CANNOT_HANDLE_INVALID_WORLD -> { - sender.spigot().sendMessage(new MineDown(MessageManager.getRawMessage("error_tp_invalid_world")).toComponent()); - return true; - } - case CANNOT_HANDLE_INVALID_PLAYER -> { - sender.spigot().sendMessage(new MineDown(MessageManager.getRawMessage("error_invalid_player")).toComponent()); - return true; - } - } - sender.spigot().sendMessage(new MineDown(MessageManager.getRawMessage("error_invalid_syntax", - "/tp " + getClosestUsage((!(sender instanceof Player)), sender, args))).toComponent()); - return true; - } - - @Override - protected void onCommand(Player player, Command command, String label, String[] args) { - // Accept console input - } - - public static class Tab implements TabCompleter { - @Override - public List onTabComplete(@NotNull CommandSender sender, @NotNull Command command, @NotNull String alias, String[] args) { - String[] closestArgs = getClosestArgs(false, args); - final int currentArgIndex = Math.max(args.length - 1, 0); - if (currentArgIndex >= closestArgs.length) { - return Collections.emptyList(); - } - - final ArrayList possibleTabCompletions = new ArrayList<>(); - final String argToReturn = closestArgs[currentArgIndex]; - - switch (argToReturn) { - case "", "", "" -> possibleTabCompletions.add("~"); - case "", "" -> { - for (int i = -180; i <= 180; i += 45) { - possibleTabCompletions.add(Integer.toString(i)); - } - } - case "" -> { - final ArrayList onlinePlayers = new ArrayList<>(); - for (Player player : Bukkit.getOnlinePlayers()) { - onlinePlayers.add(player.getName()); - } - StringUtil.copyPartialMatches(args[currentArgIndex], onlinePlayers, possibleTabCompletions); - } - case "" -> { - final ArrayList globalPlayers = new ArrayList<>(HuskHomes.getPlayerList().getPlayers()); - StringUtil.copyPartialMatches(args[currentArgIndex], globalPlayers, possibleTabCompletions); - } - case "" -> { - final ArrayList worlds = new ArrayList<>(); - for (World world : Bukkit.getWorlds()) { - worlds.add(world.getName()); - } - StringUtil.copyPartialMatches(args[currentArgIndex], worlds, possibleTabCompletions); - } - default -> possibleTabCompletions.add(argToReturn); - } - - Collections.sort(possibleTabCompletions); - return possibleTabCompletions; - } - } - - public static String getClosestUsage(boolean filterOnlyConsoleExecutable, CommandSender sender, String... inputArgs) { - StringJoiner joiner = new StringJoiner(" "); - for (String argument : getClosestArgs(filterOnlyConsoleExecutable, inputArgs)) { - joiner.add(argument); - } - return joiner.toString(); - } - - public static String[] getClosestArgs(boolean filterOnlyConsoleExecutable, String... inputArgs) { - String[] closestArgs = new String[]{"[player] [|] [] [] [yaw] [pitch] [world] [server]"}; - int difference = Integer.MAX_VALUE; - for (TpCommandInputHandler handler : inputHandlers) { - if (filterOnlyConsoleExecutable) { - if (!handler.consoleExecutable) { - continue; - } - } - int argLengthDifference = handler.arguments.length - inputArgs.length; - if (argLengthDifference < 0) { - continue; - } - if (argLengthDifference < difference) { - closestArgs = handler.arguments; - } - } - return closestArgs; - } - - public static class TpCommandInputHandler { - - private String target; - private Player player; - private Double x; - private Double y; - private Double z; - private Float yaw; - private Float pitch; - private String worldName; - private String serverId; - - private String tpHereTarget; - - public final String[] arguments; - public final boolean consoleExecutable; - - public TpCommandInputHandler(boolean consoleExecutable, String... arguments) { - this.consoleExecutable = consoleExecutable; - this.arguments = arguments; - } - - public HandlerResponse handleInput(String[] inputArguments, CommandSender inputExecutor) { - if (!(inputExecutor instanceof Player) && !consoleExecutable) { - return HandlerResponse.CANNOT_HANDLE_BY_CONSOLE; - } - if (inputArguments.length == arguments.length) { - return getHandleable(inputArguments, inputExecutor); - } - return HandlerResponse.CANNOT_HANDLE_SYNTAX_LENGTH_MISMATCH; - } - - private HandlerResponse getHandleable(String[] inputArguments, CommandSender inputExecutor) { - int argumentIndex = 0; - for (String inputArgument : inputArguments) { - if (argumentIndex >= arguments.length) break; - final HandlerResponse argumentResponse = handleArg(inputArgument, argumentIndex, inputExecutor); - if (argumentResponse != HandlerResponse.CAN_HANDLE) { - return argumentResponse; - } - argumentIndex++; - } - if (player == null) { - if (inputExecutor instanceof Player commandDispatcher) { - player = commandDispatcher; - } else { - return HandlerResponse.CANNOT_HANDLE_BY_CONSOLE; - } - } - return HandlerResponse.CAN_HANDLE; - } - - public void executeTeleport(CommandSender sender) { - // Handle teleportation to a target player - if (target != null) { - final String targetName = NameAutoCompleter.getAutoCompletedName(target); - TeleportManager.teleportPlayer(player, targetName); - if (sender instanceof Player sendingPlayer) { - if (!sendingPlayer.getUniqueId().equals(player.getUniqueId())) { - sender.spigot().sendMessage(new MineDown(MessageManager.getRawMessage("teleporting_complete")).toComponent()); - } - } else { - sender.spigot().sendMessage(new MineDown(MessageManager.getRawMessage("teleporting_complete")).toComponent()); - player.spigot().sendMessage(new MineDown(MessageManager.getRawMessage("teleporting_complete_console", targetName)).toComponent()); - } - return; - } - - // Handle teleportation - final TeleportationPoint teleportationPoint = new TeleportationPoint( - (worldName != null ? worldName : player.getWorld().getName()), - (x != null ? x : player.getLocation().getX()), - (y != null ? y : player.getLocation().getY()), - (z != null ? z : player.getLocation().getZ()), - (yaw != null ? yaw : player.getLocation().getYaw()), - (pitch != null ? pitch : player.getLocation().getPitch()), - serverId != null || HuskHomes.getSettings().doBungee() ? serverId : HuskHomes.getSettings().getServerID()); - - Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> { - TeleportManager.teleportPlayer(player, teleportationPoint); - if (sender instanceof Player sendingPlayer) { - if (!sendingPlayer.getUniqueId().equals(player.getUniqueId())) { - sender.spigot().sendMessage(new MineDown(MessageManager.getRawMessage("teleporting_complete")).toComponent()); - } - } else { - sender.spigot().sendMessage(new MineDown(MessageManager.getRawMessage("teleporting_complete")).toComponent()); - player.spigot().sendMessage(new MineDown(MessageManager.getRawMessage("teleporting_complete_console", teleportationPoint.toString())).toComponent()); - } - }); - } - - private boolean isCrossServerInput() { - boolean isCrossServer = false; - for (String argument : arguments) { - if (argument.equalsIgnoreCase("")) { - isCrossServer = true; - break; - } - } - return isCrossServer; - } - - public HandlerResponse handleArg(String inputArgument, int argumentIndex, CommandSender inputExecutor) { - final String expectedArgument = arguments[argumentIndex]; - switch (expectedArgument) { - case "", "", "" -> { - try { - double value; - if (inputArgument.startsWith("~")) { - if (inputExecutor instanceof Player player) { - value = switch (expectedArgument) { - case "" -> player.getLocation().getX(); - case "" -> player.getLocation().getY(); - case "" -> player.getLocation().getZ(); - default -> 0; - }; - } else { - return HandlerResponse.CANNOT_HANDLE_BY_CONSOLE; - } - if (inputArgument.length() > 1) { - inputArgument = inputArgument.substring(1); - value += Double.parseDouble(inputArgument); - } - } else { - value = Double.parseDouble(inputArgument); - } - switch (expectedArgument) { - case "" -> x = value; - case "" -> y = value; - case "" -> z = value; - } - return HandlerResponse.CAN_HANDLE; - } catch (NumberFormatException e) { - return HandlerResponse.CANNOT_HANDLE_SYNTAX_MISMATCH; - } - } - case "", "" -> { - try { - float value; - if (inputArgument.startsWith("~")) { - if (inputExecutor instanceof Player player) { - value = switch (expectedArgument) { - case "" -> player.getLocation().getYaw(); - case "" -> player.getLocation().getPitch(); - default -> 0; - }; - } else { - return HandlerResponse.CANNOT_HANDLE_BY_CONSOLE; - } - if (inputArgument.length() > 1) { - inputArgument = inputArgument.substring(1); - value += Double.parseDouble(inputArgument); - } - } else { - value = Float.parseFloat(inputArgument); - } - switch (expectedArgument) { - case "" -> yaw = value; - case "" -> pitch = value; - } - return HandlerResponse.CAN_HANDLE; - } catch (NumberFormatException e) { - return HandlerResponse.CANNOT_HANDLE_SYNTAX_MISMATCH; - } - } - case "" -> { - if (isCrossServerInput()) { - worldName = inputArgument; - return HandlerResponse.CAN_HANDLE; - } else { - if (Bukkit.getWorld(inputArgument) != null) { - worldName = inputArgument; - return HandlerResponse.CAN_HANDLE; - } - return HandlerResponse.CANNOT_HANDLE_INVALID_WORLD; - } - } - case "" -> { - serverId = inputArgument; - return HandlerResponse.CAN_HANDLE; - } - case "" -> { - target = inputArgument; - if (arguments.length == 2) { - if (inputExecutor instanceof Player playerExecutor) { - if (NameAutoCompleter.getAutoCompletedName(target).equalsIgnoreCase(playerExecutor.getName()) && tpHereTarget != null) { - TpHereCommand.executeTpHere(playerExecutor, tpHereTarget); - return HandlerResponse.CANNOT_HANDLE_HANDLED_BY_TP_HERE; - } - } - } - return HandlerResponse.CAN_HANDLE; - } - case "" -> { - Player teleportingPlayer = Bukkit.getPlayerExact(inputArgument); - if (teleportingPlayer != null) { - player = teleportingPlayer; - return HandlerResponse.CAN_HANDLE; - } - if (arguments.length == 2) { - if (arguments[1].equalsIgnoreCase("")) { - tpHereTarget = inputArgument; - return HandlerResponse.CAN_HANDLE; - } - } - return HandlerResponse.CANNOT_HANDLE_INVALID_PLAYER; - } - } - return HandlerResponse.CANNOT_HANDLE_INVALID_EXPECTED_ARGUMENT; - } - - public enum HandlerResponse { - CAN_HANDLE, - CANNOT_HANDLE_HANDLED_BY_TP_HERE, - CANNOT_HANDLE_INVALID_WORLD, - CANNOT_HANDLE_INVALID_PLAYER, - CANNOT_HANDLE_BY_CONSOLE, - CANNOT_HANDLE_SYNTAX_MISMATCH, - CANNOT_HANDLE_SYNTAX_LENGTH_MISMATCH, - CANNOT_HANDLE_INVALID_EXPECTED_ARGUMENT - } - } -} \ No newline at end of file diff --git a/src/main/java/me/william278/huskhomes2/commands/TpDenyCommand.java b/src/main/java/me/william278/huskhomes2/commands/TpDenyCommand.java deleted file mode 100644 index b0598ada..00000000 --- a/src/main/java/me/william278/huskhomes2/commands/TpDenyCommand.java +++ /dev/null @@ -1,20 +0,0 @@ -package me.william278.huskhomes2.commands; - -import me.william278.huskhomes2.teleport.TeleportRequestHandler; -import me.william278.huskhomes2.util.NameAutoCompleter; -import org.bukkit.command.Command; -import org.bukkit.entity.Player; - -public class TpDenyCommand extends CommandBase { - - @Override - protected void onCommand(Player p, Command command, String label, String[] args) { - if (args.length == 1) { - String targetPlayer = args[0]; - TeleportRequestHandler.replyTpRequest(p, - NameAutoCompleter.getAutoCompletedName(targetPlayer), false); - } else { - TeleportRequestHandler.replyTpRequest(p, false); - } - } -} \ No newline at end of file diff --git a/src/main/java/me/william278/huskhomes2/commands/TpHereCommand.java b/src/main/java/me/william278/huskhomes2/commands/TpHereCommand.java deleted file mode 100644 index 9c279722..00000000 --- a/src/main/java/me/william278/huskhomes2/commands/TpHereCommand.java +++ /dev/null @@ -1,38 +0,0 @@ -package me.william278.huskhomes2.commands; - -import me.william278.huskhomes2.HuskHomes; -import me.william278.huskhomes2.util.MessageManager; -import me.william278.huskhomes2.teleport.TeleportManager; -import me.william278.huskhomes2.util.NameAutoCompleter; -import org.bukkit.Bukkit; -import org.bukkit.command.Command; -import org.bukkit.entity.Player; - -import java.sql.SQLException; -import java.util.logging.Level; - -public class TpHereCommand extends CommandBase { - - private static final HuskHomes plugin = HuskHomes.getInstance(); - - @Override - protected void onCommand(Player p, Command command, String label, String[] args) { - if (args.length == 1) { - String targetPlayer = args[0]; - executeTpHere(p, targetPlayer); - } else { - MessageManager.sendMessage(p, "error_invalid_syntax", command.getUsage()); - } - } - - // Execute the tp here operation - public static void executeTpHere(Player player, String targetPlayer) { - Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> { - try { - TeleportManager.teleportHere(player, NameAutoCompleter.getAutoCompletedName(targetPlayer)); - } catch (SQLException e) { - plugin.getLogger().log(Level.SEVERE, "An SQL exception occurred using /tphere"); - } - }); - } -} diff --git a/src/main/java/me/william278/huskhomes2/commands/TpIgnoreCommand.java b/src/main/java/me/william278/huskhomes2/commands/TpIgnoreCommand.java deleted file mode 100644 index 1ad09e70..00000000 --- a/src/main/java/me/william278/huskhomes2/commands/TpIgnoreCommand.java +++ /dev/null @@ -1,45 +0,0 @@ -package me.william278.huskhomes2.commands; - -import me.william278.huskhomes2.HuskHomes; -import me.william278.huskhomes2.util.MessageManager; -import me.william278.huskhomes2.data.DataManager; -import org.bukkit.Bukkit; -import org.bukkit.command.Command; -import org.bukkit.entity.Player; - -import java.sql.Connection; -import java.sql.SQLException; - -public class TpIgnoreCommand extends CommandBase { - - private static final HuskHomes plugin = HuskHomes.getInstance(); - - @Override - protected void onCommand(Player p, Command command, String label, String[] args) { - boolean ignoring; - if (HuskHomes.isIgnoringTeleportRequests(p.getUniqueId())) { - MessageManager.sendMessage(p, "tpignore_toggle_off"); - ignoring = false; - } else { - MessageManager.sendMessage(p, "tpignore_toggle_on"); - ignoring = true; - } - setIgnoringRequestsData(p, ignoring); - } - - private void setIgnoringRequestsData(Player player, boolean ignoring) { - Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> { - try (Connection connection = HuskHomes.getConnection()) { - DataManager.setPlayerIgnoringRequests(player, ignoring, connection); - if (ignoring) { - HuskHomes.setIgnoringTeleportRequests(player.getUniqueId()); - } else { - HuskHomes.setNotIgnoringTeleportRequests(player.getUniqueId()); - } - } catch (SQLException e) { - e.printStackTrace(); - } - }); - } - -} diff --git a/src/main/java/me/william278/huskhomes2/commands/TpOfflineCommand.java b/src/main/java/me/william278/huskhomes2/commands/TpOfflineCommand.java deleted file mode 100644 index 07f72c3a..00000000 --- a/src/main/java/me/william278/huskhomes2/commands/TpOfflineCommand.java +++ /dev/null @@ -1,33 +0,0 @@ -package me.william278.huskhomes2.commands; - -import me.william278.huskhomes2.HuskHomes; -import me.william278.huskhomes2.util.MessageManager; -import me.william278.huskhomes2.teleport.TeleportManager; -import org.bukkit.Bukkit; -import org.bukkit.command.Command; -import org.bukkit.entity.Player; - -import java.sql.Connection; -import java.sql.SQLException; -import java.util.logging.Level; - -public class TpOfflineCommand extends CommandBase { - - private static final HuskHomes plugin = HuskHomes.getInstance(); - - @Override - protected void onCommand(Player p, Command command, String label, String[] args) { - if (args.length == 1) { - final String targetPlayer = args[0]; - Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> { - try (Connection connection = HuskHomes.getConnection()) { - TeleportManager.teleportToOfflinePlayer(p, targetPlayer, connection); - } catch (SQLException e) { - plugin.getLogger().log(Level.SEVERE, "An SQL exception occurred teleporting you to a player's offline position"); - } - }); - } else { - MessageManager.sendMessage(p, "error_invalid_syntax", command.getUsage()); - } - } -} diff --git a/src/main/java/me/william278/huskhomes2/commands/TpaAllCommand.java b/src/main/java/me/william278/huskhomes2/commands/TpaAllCommand.java deleted file mode 100644 index 034f25e0..00000000 --- a/src/main/java/me/william278/huskhomes2/commands/TpaAllCommand.java +++ /dev/null @@ -1,14 +0,0 @@ -package me.william278.huskhomes2.commands; - -import me.william278.huskhomes2.teleport.TeleportRequestHandler; -import org.bukkit.command.Command; -import org.bukkit.entity.Player; - -public class TpaAllCommand extends CommandBase { - - @Override - protected void onCommand(Player p, Command command, String label, String[] args) { - TeleportRequestHandler.sendTeleportAllHereRequest(p); - } - -} \ No newline at end of file diff --git a/src/main/java/me/william278/huskhomes2/commands/TpaCommand.java b/src/main/java/me/william278/huskhomes2/commands/TpaCommand.java deleted file mode 100644 index b5022883..00000000 --- a/src/main/java/me/william278/huskhomes2/commands/TpaCommand.java +++ /dev/null @@ -1,20 +0,0 @@ -package me.william278.huskhomes2.commands; - -import me.william278.huskhomes2.util.MessageManager; -import me.william278.huskhomes2.teleport.TeleportRequestHandler; -import me.william278.huskhomes2.util.NameAutoCompleter; -import org.bukkit.command.Command; -import org.bukkit.entity.Player; - -public class TpaCommand extends CommandBase { - - @Override - protected void onCommand(Player p, Command command, String label, String[] args) { - if (args.length == 1) { - String targetPlayer = args[0]; - TeleportRequestHandler.sendTeleportToRequest(p, NameAutoCompleter.getAutoCompletedName(targetPlayer)); - } else { - MessageManager.sendMessage(p, "error_invalid_syntax", command.getUsage()); - } - } -} diff --git a/src/main/java/me/william278/huskhomes2/commands/TpaHereCommand.java b/src/main/java/me/william278/huskhomes2/commands/TpaHereCommand.java deleted file mode 100644 index 272e6825..00000000 --- a/src/main/java/me/william278/huskhomes2/commands/TpaHereCommand.java +++ /dev/null @@ -1,20 +0,0 @@ -package me.william278.huskhomes2.commands; - -import me.william278.huskhomes2.util.MessageManager; -import me.william278.huskhomes2.teleport.TeleportRequestHandler; -import me.william278.huskhomes2.util.NameAutoCompleter; -import org.bukkit.command.Command; -import org.bukkit.entity.Player; - -public class TpaHereCommand extends CommandBase { - - @Override - protected void onCommand(Player p, Command command, String label, String[] args) { - if (args.length == 1) { - String targetPlayer = args[0]; - TeleportRequestHandler.sendTeleportHereRequest(p, NameAutoCompleter.getAutoCompletedName(targetPlayer)); - } else { - MessageManager.sendMessage(p, "error_invalid_syntax", command.getUsage()); - } - } -} diff --git a/src/main/java/me/william278/huskhomes2/commands/WarpCommand.java b/src/main/java/me/william278/huskhomes2/commands/WarpCommand.java deleted file mode 100644 index b57e827e..00000000 --- a/src/main/java/me/william278/huskhomes2/commands/WarpCommand.java +++ /dev/null @@ -1,154 +0,0 @@ -package me.william278.huskhomes2.commands; - -import me.william278.huskhomes2.HuskHomes; -import me.william278.huskhomes2.util.MessageManager; -import me.william278.huskhomes2.data.DataManager; -import me.william278.huskhomes2.teleport.TeleportManager; -import me.william278.huskhomes2.teleport.points.Warp; -import org.bukkit.Bukkit; -import org.bukkit.command.Command; -import org.bukkit.command.CommandSender; -import org.bukkit.command.TabCompleter; -import org.bukkit.entity.Player; -import org.bukkit.util.StringUtil; -import org.jetbrains.annotations.NotNull; - -import java.sql.Connection; -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashSet; -import java.util.List; -import java.util.Set; -import java.util.logging.Level; - -public class WarpCommand extends CommandBase { - - private static final HuskHomes plugin = HuskHomes.getInstance(); - - @Override - public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) { - if (!(sender instanceof Player p)) { - handleConsoleWarp(sender, args); - return true; - } - if (!HuskHomes.getSettings().doWarpCommand()) { - MessageManager.sendMessage(p, "error_command_disabled"); - return true; - } - if (args.length == 1) { - String warpName = args[0]; - Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> { - try (Connection connection = HuskHomes.getConnection()) { - if (DataManager.warpExists(warpName, connection)) { - if (Warp.getWarpCanUse(p, warpName)) { - Warp warp = DataManager.getWarp(warpName, connection); - TeleportManager.queueTimedTeleport(p, warp); - } else { - MessageManager.sendMessage(p, "error_permission_restricted_warp", warpName); - } - } else { - MessageManager.sendMessage(p, "error_warp_invalid", warpName); - } - } catch (SQLException e) { - plugin.getLogger().log(Level.SEVERE, "An SQL exception occurred using /tphere"); - } - }); - } else { - WarpListCommand.displayWarpList(p, 1); - } - return true; - } - - @Override - protected void onCommand(Player player, Command command, String label, String[] args) { - // Accept console input - } - - // Handle a warp from console - public static void handleConsoleWarp(CommandSender sender, String[] args) { - String warpName; - Player targetPlayer; - if (args.length == 2) { - warpName = args[0]; - targetPlayer = Bukkit.getPlayer(args[1]); - if (targetPlayer != null) { - - Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> { - try (Connection connection = HuskHomes.getConnection()) { - if (DataManager.warpExists(warpName, connection)) { - Warp warp = DataManager.getWarp(warpName, connection); - TeleportManager.teleportPlayer(targetPlayer, warp); - sender.sendMessage("Successfully warped player!"); - MessageManager.sendMessage(targetPlayer, "teleporting_complete_console", warpName); - } else { - sender.sendMessage("Error: Invalid warp \"" + warpName + "\" specified"); - } - } catch (SQLException e) { - plugin.getLogger().log(Level.SEVERE, "An SQL exception occurred using /tphere"); - } - }); - } else { - sender.sendMessage("Error: Invalid player specified (are they online?)"); - } - } else { - sender.sendMessage("Console Warp Usage: /warp "); - } - } - - public static class Tab implements TabCompleter { - - // TODO Remove - // Cached HashMap of warps - public static final Set warpsTabCache = new HashSet<>(); - - // Updates the public home cache - public static void updateWarpsTabCache() { - warpsTabCache.clear(); - Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> { - try (Connection connection = HuskHomes.getConnection()) { - for (Warp warp : DataManager.getWarps(connection)) { - warpsTabCache.add(warp.getName()); - } - } catch (SQLException e) { - plugin.getLogger().log(Level.WARNING, "An SQL exception occurred updating the warp cache", e); - } - }); - } - - - @Override - public List onTabComplete(CommandSender sender, @NotNull Command command, @NotNull String alias, String[] args) { - if (!sender.hasPermission("huskhomes.warp")) { - return Collections.emptyList(); - } - if (args.length == 1) { - final List tabCompletions = new ArrayList<>(); - - // Filter warps if they are permission restricted - final HashSet cachedWarps = new HashSet<>(warpsTabCache); - if (sender instanceof Player player) { - if (HuskHomes.getSettings().doPermissionRestrictedWarps()) { - if (HuskHomes.getSettings().doHideRestrictedWarps()) { - cachedWarps.clear(); - for (String warp : warpsTabCache) { - if (Warp.getWarpCanUse(player, warp)) { - cachedWarps.add(warp); - } - } - } - } - } - - // Sort warps based on tab arguments - StringUtil.copyPartialMatches(args[0], cachedWarps, tabCompletions); - Collections.sort(tabCompletions); - return tabCompletions; - - } else { - return Collections.emptyList(); - } - } - - } -} diff --git a/src/main/java/me/william278/huskhomes2/commands/WarpListCommand.java b/src/main/java/me/william278/huskhomes2/commands/WarpListCommand.java deleted file mode 100644 index c3af6ba1..00000000 --- a/src/main/java/me/william278/huskhomes2/commands/WarpListCommand.java +++ /dev/null @@ -1,82 +0,0 @@ -package me.william278.huskhomes2.commands; - -import de.themoep.minedown.MineDown; -import me.william278.huskhomes2.HuskHomes; -import me.william278.huskhomes2.util.MessageManager; -import me.william278.huskhomes2.data.DataManager; -import me.william278.huskhomes2.teleport.points.Warp; -import me.william278.huskhomes2.util.ChatList; -import org.bukkit.Bukkit; -import org.bukkit.command.Command; -import org.bukkit.entity.Player; - -import java.sql.Connection; -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.List; -import java.util.logging.Level; - -public class WarpListCommand extends CommandBase { - - private static final HuskHomes plugin = HuskHomes.getInstance(); - - @Override - protected void onCommand(Player p, Command command, String label, String[] args) { - int pageNo = 1; - if (args.length == 1) { - try { - pageNo = Integer.parseInt(args[0]); - } catch (Exception e) { - MessageManager.sendMessage(p, "error_invalid_syntax", command.getUsage()); - return; - } - } - displayWarpList(p, pageNo); - } - - public static void displayWarpList(Player player, int pageNumber) { - Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> { - try (Connection connection = HuskHomes.getConnection()) { - List warps = DataManager.getWarps(connection); - ArrayList warpList = new ArrayList<>(); - for (Warp warp : warps) { - if (HuskHomes.getSettings().doPermissionRestrictedWarps()) { - if (HuskHomes.getSettings().doHideRestrictedWarps()) { - if (!warp.canUse(player)) { - continue; - } - } - } - warpList.add(MessageManager.getRawMessage("warp_list_item", warp.getName(), - MineDown.escape(warp.getDescription()).replace("]", "\\]") - .replace("[", "\\[") - .replace("(", "\\(") - .replace(")", "\\)"))); - } - if (warpList.isEmpty()) { - MessageManager.sendMessage(player, "error_no_warps_set"); - return; - } - - final int itemsPerPage = HuskHomes.getSettings().getWarpsPerPage(); - final int homeLowerBound = (pageNumber - 1) * itemsPerPage; - int warpsUpperBound = pageNumber * itemsPerPage; - if (warpsUpperBound > warpList.size()) { - warpsUpperBound = warpList.size(); - } - - ChatList homeChatList = new ChatList(warpList, itemsPerPage, "/huskhomes:warplist", MessageManager.getRawMessage("list_item_divider"), true); - if (homeChatList.doesNotContainPage(pageNumber)) { - MessageManager.sendMessage(player, "error_invalid_page_number"); - return; - } - - MessageManager.sendMessage(player, "warp_list_page_top", Integer.toString(homeLowerBound + 1), Integer.toString(warpsUpperBound), Integer.toString(warpList.size())); - player.spigot().sendMessage(homeChatList.getPage(pageNumber)); - } catch (SQLException e) { - plugin.getLogger().log(Level.SEVERE, "An SQL exception occurred!", e); - } - }); - } - -} diff --git a/src/main/java/me/william278/huskhomes2/config/Settings.java b/src/main/java/me/william278/huskhomes2/config/Settings.java deleted file mode 100644 index bf5dac25..00000000 --- a/src/main/java/me/william278/huskhomes2/config/Settings.java +++ /dev/null @@ -1,599 +0,0 @@ -package me.william278.huskhomes2.config; - -import me.william278.huskhomes2.HuskHomes; -import org.bukkit.Bukkit; -import org.bukkit.Sound; -import org.bukkit.configuration.file.FileConfiguration; -import org.bukkit.plugin.Plugin; -import org.bukkit.plugin.PluginManager; - -import javax.annotation.Nullable; - -public class Settings { - - private final Plugin plugin; - - // Message language setting - private String language; - - // Automatically check for updates on startup - private boolean doStartupUpdateChecks; - - // Bungee settings - private boolean doBungee; - private int clusterId; - private String server; - private boolean doCrossServerTabCompletion; - private int crossServerTabUpdateDelay; - private String messengerType; - - // Data storage settings - private String storageType; - private String playerDataTable; - private String locationsDataTable; - private String homesDataTable; - private String warpsDataTable; - - // Connection settings for MySQL - private int mySQLPort; - private String mySQLHost; - private String mySQLDatabase; - private String mySQLUsername; - private String mySQLPassword; - private String mySQLParams; - - // Hikari connection pool options - private int hikariMaximumPoolSize; - private int hikariMinimumIdle; - private long hikariMaximumLifetime; - private long hikariKeepAliveTime; - private long hikariConnectionTimeOut; - - // Redis connection settings - private int redisPort; - private String redisHost; - private String redisPassword; - private boolean redisSSL; - - // Map plugin integration settings - private boolean doMapIntegration; - private String mapPlugin; - private boolean mapPublicHomes; - private boolean mapWarps; - private String mapPublicHomeMarkerSet; - private String mapWarpMarkerSet; - - // Economy (Vault) integration settings - private boolean doEconomy; - private int freeHomeSlots; - private double setHomeCost; - private double publicHomeCost; - private double rtpCost; - private double backCost; - - // Allow UTF-8 (Unicode) characters in descriptions? - private boolean allowUnicodeInDescriptions; - - // Vanished player checks - private boolean checkVanishedPlayers; - - // Use PaperLib if available - private boolean usePaperLibIfAvailable; - - // Time and maximum home settings - private int maximumHomes; - private int teleportRequestExpiryTime; - private int teleportWarmupTime; - private DisplayStyle teleportWarmupDisplayStyle; - - // Back command - private boolean doBackCommand; - - // Sounds - private Sound teleportationCompleteSound; - private Sound teleportWarmupSound; - private Sound teleportCancelledSound; - - // Number of items per page on lists - private int privateHomesPerPage; - private int publicHomesPerPage; - private int warpsPerPage; - - // Help menu options - private boolean hideCommandsFromHelpMenuWithoutPermission; - private boolean hideHuskHomesCommandFromHelpMenu; - - // Whether to autocomplete player names for tpa (e.g /tpa William will assume you mean /tpa William278) - private boolean autoCompletePlayerNames; - - // Whether to stack limit permissions (add them) if a user has multiple. By default, the highest one will be returned - private boolean homeLimitPermissionStacking; - - // RTP command settings - private boolean doRtpCommand; - private int rtpRange; - private int rtpCoolDown; - - // Spawn command settings - private boolean doSpawnCommand; - private boolean doCrossServerSpawn; - private String crossServerSpawnWarpName; - private boolean forceSpawnOnLogin; - - // Warp command settings - private boolean doWarpCommand; - private boolean doPermissionRestrictedWarps; - private boolean hideRestrictedWarps; - private String warpRestrictionPermissionFormat; - - public Settings(Plugin plugin) { - this.plugin = plugin; - } - - // (Re-)Load the config file - public void reload() { - plugin.reloadConfig(); - reloadFromFile(plugin.getConfig()); - } - - public void reloadFromFile(FileConfiguration config) { - try { - this.language = config.getString("language", "en-gb"); - - this.doStartupUpdateChecks = config.getBoolean("check_for_updates", true); - - this.doBungee = config.getBoolean("bungee_options.enable_bungee_mode", false); - this.server = config.getString("bungee_options.server_id", "server"); - this.clusterId = config.getInt("bungee_options.cluster_id", 0); - this.doCrossServerTabCompletion = config.getBoolean("bungee_options.tab_complete_cross_server.enabled", true); - this.crossServerTabUpdateDelay = config.getInt("bungee_options.tab_complete_cross_server.delay", 60); - this.messengerType = config.getString("bungee_options.messenger_type", "pluginmessage"); - - this.storageType = config.getString("data_storage_options.storage_type", "SQLite"); - this.playerDataTable = config.getString("data_storage_options.table_names.player_data", "huskhomes_player_data"); - this.locationsDataTable = config.getString("data_storage_options.table_names.locations_data", "huskhomes_location_data"); - this.homesDataTable = config.getString("data_storage_options.table_names.homes_data", "huskhomes_home_data"); - this.warpsDataTable = config.getString("data_storage_options.table_names.warps_data", "huskhomes_warp_data"); - - // Resolve conflict between storage type and bungee mode - if (storageType.equalsIgnoreCase("SQLite") && doBungee) { - Bukkit.getLogger().warning("Bungee mode was set in config to be enabled but storage type was set to SQLite!"); - Bukkit.getLogger().warning("A mySQL Database is required to utilise Bungee mode, so bungee mode has been disabled."); - Bukkit.getLogger().warning("To use Bungee mode and cross-server teleportation, please update your data storage settings to use \"mysql\" and update the connection credentials accordingly."); - this.doBungee = false; - } - - this.mySQLHost = config.getString("data_storage_options.mysql_credentials.host", "localhost"); - this.mySQLDatabase = config.getString("data_storage_options.mysql_credentials.database", "HuskHomes"); - this.mySQLUsername = config.getString("data_storage_options.mysql_credentials.username", "root"); - this.mySQLPassword = config.getString("data_storage_options.mysql_credentials.password", "pa55w0rd"); - this.mySQLPort = config.getInt("data_storage_options.mysql_credentials.port", 3306); - this.mySQLParams = config.getString("data_storage_options.mysql_credentials.params", "?autoReconnect=true&useSSL=false"); - - this.hikariMaximumPoolSize = config.getInt("data_storage_options.connection_pool_options.maximum_pool_size", 10); - this.hikariMinimumIdle = config.getInt("data_storage_options.connection_pool_options.minimum_idle", 10); - this.hikariMaximumLifetime = config.getLong("data_storage_options.connection_pool_options.maximum_lifetime", 1800000); - this.hikariKeepAliveTime = config.getLong("data_storage_options.connection_pool_options.keepalive_time", 0); - this.hikariConnectionTimeOut = config.getLong("data_storage_options.connection_pool_options.connection_timeout", 5000); - - this.redisHost = config.getString("bungee_options.redis_credentials.host", "localhost"); - this.redisPort = config.getInt("bungee_options.redis_credentials.port", 6379); - this.redisPassword = config.getString("bungee_options.redis_credentials.password", ""); - this.redisSSL = config.getBoolean("bungee_options.redis_credentials.use_ssl", false); - - this.doMapIntegration = config.getBoolean("map_integration.enabled", false); - this.mapPlugin = config.getString("map_integration.plugin", "dynmap"); - - if (this.doMapIntegration) { - PluginManager pluginManager = HuskHomes.getInstance().getServer().getPluginManager(); - switch (mapPlugin.toLowerCase()) { - case "dynmap", "bluemap", "squaremap" -> { - Plugin mapSpigotPlugin = pluginManager.getPlugin(mapPlugin.toLowerCase()); - if (mapSpigotPlugin == null) { - Bukkit.getLogger().warning(mapPlugin + " integration was enabled in config, but the " + mapPlugin + " plugin could not be found!"); - Bukkit.getLogger().warning("The map integration setting has been disabled. Please ensure " + mapPlugin + " is installed and restart the server."); - this.doMapIntegration = false; - plugin.getConfig().set("map_integration.enabled", false); - plugin.saveConfig(); - } - } - default -> { - Bukkit.getLogger().warning("Map integration was enabled in config, but the map plugin type was invalid."); - Bukkit.getLogger().warning("The map integration setting has been disabled. Please ensure you specify a valid map plugin type."); - this.doMapIntegration = false; - plugin.getConfig().set("map_integration.enabled", false); - plugin.saveConfig(); - } - } - } - - this.mapPublicHomes = config.getBoolean("map_integration.markers.public_homes.show", true); - this.mapWarps = config.getBoolean("map_integration.markers.warps.show", true); - this.mapPublicHomeMarkerSet = config.getString("map_integration.markers.public_homes.set_name", "Public Homes"); - this.mapWarpMarkerSet = config.getString("map_integration.markers.warps.set_name", "Warps"); - - this.doEconomy = config.getBoolean("economy_integration.enabled", false); - - if (this.doEconomy) { - PluginManager pluginManager = HuskHomes.getInstance().getServer().getPluginManager(); - Plugin vault = pluginManager.getPlugin("Vault"); - if (vault == null) { - Bukkit.getLogger().warning("Economy integration was enabled in config, but the Vault plugin could not be found!"); - Bukkit.getLogger().warning("Economy features have been disabled. Please ensure both Vault and an economy plugin are installed and restart the server."); - this.doEconomy = false; - } - } - - this.freeHomeSlots = config.getInt("economy_integration.free_home_slots", 5); - this.setHomeCost = config.getDouble("economy_integration.costs.additional_home_slot", 100D); - this.publicHomeCost = config.getDouble("economy_integration.costs.make_home_public", 50D); - this.rtpCost = config.getDouble("economy_integration.costs.random_teleport", 20D); - this.backCost = config.getDouble("economy_integration.costs.back", 0D); - - // Retrieve sounds used in plugin; if invalid, use defaults. - try { - this.teleportationCompleteSound = Sound.valueOf(config.getString("general.sounds.teleportation_complete", "ENTITY_ENDERMAN_TELEPORT")); - } catch (IllegalArgumentException exception) { - Bukkit.getLogger().severe("Invalid sound specified for teleportation_complete, using no sound instead"); - this.teleportationCompleteSound = null; - } - - try { - this.teleportWarmupSound = Sound.valueOf(config.getString("general.sounds.teleportation_warmup", "BLOCK_NOTE_BLOCK_BANJO")); - } catch (IllegalArgumentException exception) { - Bukkit.getLogger().severe("Invalid sound specified for teleportation_warmup, using no sound instead"); - this.teleportWarmupSound = null; - } - - try { - this.teleportCancelledSound = Sound.valueOf(config.getString("general.sounds.teleportation_cancelled", "ENTITY_ITEM_BREAK")); - } catch (IllegalArgumentException exception) { - Bukkit.getLogger().severe("Invalid sound specified for teleportation_cancelled, using no sound instead"); - this.teleportCancelledSound = null; - } - - this.allowUnicodeInDescriptions = config.getBoolean("allow_unicode_descriptions", true); - - this.checkVanishedPlayers = config.getBoolean("handle_vanished_players", true); - - this.usePaperLibIfAvailable = config.getBoolean("general.use_paperlib_if_available", true); - - this.doSpawnCommand = config.getBoolean("spawn_command.enabled", true); - this.doCrossServerSpawn = config.getBoolean("spawn_command.bungee_network_spawn.enabled", false); - this.crossServerSpawnWarpName = config.getString("spawn_command.bungee_network_spawn.warp_name", "Spawn"); - this.forceSpawnOnLogin = config.getBoolean("spawn_command.force_teleport_on_login", false); - - this.doWarpCommand = config.getBoolean("warp_command.enabled", true); - this.doPermissionRestrictedWarps = config.getBoolean("warp_command.permission_restrictions.require_permission", false); - this.warpRestrictionPermissionFormat = config.getString("warp_command.permission_restrictions.format", "huskhomes.warp."); - this.hideRestrictedWarps = config.getBoolean("warp_command.permission_restrictions.hide_restricted_warps", true); - - this.autoCompletePlayerNames = config.getBoolean("general.auto_complete_player_names", true); - - this.homeLimitPermissionStacking = config.getBoolean("general.home_limit_permission_stacking", false); - - this.doRtpCommand = config.getBoolean("random_teleport_command.enabled", true); - this.rtpRange = config.getInt("random_teleport_command.range", 5000); - this.rtpCoolDown = config.getInt("random_teleport_command.cooldown", 30); - - this.doBackCommand = config.getBoolean("general.enable_back_command", true); - - this.privateHomesPerPage = config.getInt("general.lists.private_homes_per_page", 10); - this.publicHomesPerPage = config.getInt("general.lists.public_homes_per_page", 10); - this.warpsPerPage = config.getInt("general.lists.warps_per_page", 10); - - this.hideCommandsFromHelpMenuWithoutPermission = config.getBoolean("general.help_menu.hide_commands_without_permission", true); - this.hideHuskHomesCommandFromHelpMenu = config.getBoolean("general.help_menu.hide_huskhomes_command", false); - - this.maximumHomes = config.getInt("general.max_sethomes", 10); - this.teleportRequestExpiryTime = config.getInt("general.teleport_request_expiry_time", 60); - this.teleportWarmupTime = config.getInt("general.teleport_warmup_time", 5); - this.teleportWarmupDisplayStyle = DisplayStyle.valueOf(config.getString("general.teleport_warmup_display", "ACTION_BAR")); - - } catch (Exception e) { - HuskHomes.disablePlugin("An error occurred loading the HuskHomes config (" + e.getCause() + ")"); - e.printStackTrace(); - } - } - - public String getMapPlugin() { - return mapPlugin; - } - - public boolean showPublicHomesOnMap() { - return mapPublicHomes; - } - - public boolean showWarpsOnMap() { - return mapWarps; - } - - public String getMapPublicHomeMarkerSet() { - return mapPublicHomeMarkerSet; - } - - public String getMapWarpMarkerSet() { - return mapWarpMarkerSet; - } - - public boolean doMapIntegration() { - return doMapIntegration; - } - - public int getTeleportWarmupTime() { - return teleportWarmupTime; - } - - public String getDatabaseType() { - return storageType; - } - - public boolean isCheckVanishedPlayers() { - return checkVanishedPlayers; - } - - public String getLanguage() { - return language; - } - - public String getServerID() { - return server; - } - - public int getClusterId() { - return clusterId; - } - - public boolean doBungee() { - return doBungee; - } - - public int getMaximumHomes() { - return maximumHomes; - } - - public int getRtpCoolDown() { - return rtpCoolDown; - } - - public int getTeleportRequestExpiryTime() { - return teleportRequestExpiryTime; - } - - public int getRtpRange() { - return rtpRange; - } - - public boolean doRtpCommand() { - return doRtpCommand; - } - - public String getPlayerDataTable() { - return playerDataTable; - } - - public String getLocationsDataTable() { - return locationsDataTable; - } - - public String getHomesDataTable() { - return homesDataTable; - } - - public String getWarpsDataTable() { - return warpsDataTable; - } - - public int getMySQLPort() { - return mySQLPort; - } - - public String getMySQLHost() { - return mySQLHost; - } - - public String getMySQLDatabase() { - return mySQLDatabase; - } - - public String getMySQLUsername() { - return mySQLUsername; - } - - public String getMySQLPassword() { - return mySQLPassword; - } - - public String getMySQLParams() { - return mySQLParams; - } - - public boolean doSpawnCommand() { - return doSpawnCommand; - } - - public boolean doCrossServerSpawn() { - return doCrossServerSpawn; - } - - public String getSpawnWarpName() { - return crossServerSpawnWarpName; - } - - public boolean doForceSpawnOnLogin() { - return forceSpawnOnLogin; - } - - public boolean doEconomy() { - return doEconomy; - } - - public int getFreeHomeSlots() { - return freeHomeSlots; - } - - public double getSetHomeCost() { - return setHomeCost; - } - - public double getBackCost() { - return backCost; - } - - public double getPublicHomeCost() { - return publicHomeCost; - } - - public double getRtpCost() { - return rtpCost; - } - - public int getPrivateHomesPerPage() { - return privateHomesPerPage; - } - - public int getPublicHomesPerPage() { - return publicHomesPerPage; - } - - public int getWarpsPerPage() { - return warpsPerPage; - } - - @Nullable - public Sound getTeleportationCompleteSound() { - return teleportationCompleteSound; - } - - @Nullable - public Sound getTeleportWarmupSound() { - return teleportWarmupSound; - } - - @Nullable - public Sound getTeleportCancelledSound() { - return teleportCancelledSound; - } - - public boolean doStartupUpdateChecks() { - return doStartupUpdateChecks; - } - - public boolean doCrossServerTabCompletion() { - return doCrossServerTabCompletion; - } - - public int getCrossServerTabUpdateDelay() { - return crossServerTabUpdateDelay; - } - - public boolean doWarpCommand() { - return doWarpCommand; - } - - public boolean doPermissionRestrictedWarps() { - return doPermissionRestrictedWarps; - } - - public String getWarpRestrictionPermissionFormat() { - return warpRestrictionPermissionFormat; - } - - public boolean doHideRestrictedWarps() { - return hideRestrictedWarps; - } - - public boolean hideCommandsFromHelpMenuWithoutPermission() { - return hideCommandsFromHelpMenuWithoutPermission; - } - - public boolean hideHuskHomesCommandFromHelpMenu() { - return hideHuskHomesCommandFromHelpMenu; - } - - public boolean doUnicodeInDescriptions() { - return allowUnicodeInDescriptions; - } - - public String getMessengerType() { - return messengerType; - } - - public int getRedisPort() { - return redisPort; - } - - public String getRedisHost() { - return redisHost; - } - - public String getRedisPassword() { - return redisPassword; - } - - public boolean getRedisSSL() { - return redisSSL; - } - - public boolean getDoBackCommand() { - return doBackCommand; - } - - public int getHikariMaximumPoolSize() { - return hikariMaximumPoolSize; - } - - public int getHikariMinimumIdle() { - return hikariMinimumIdle; - } - - public long getHikariMaximumLifetime() { - return hikariMaximumLifetime; - } - - public long getHikariKeepAliveTime() { - return hikariKeepAliveTime; - } - - public long getHikariConnectionTimeOut() { - return hikariConnectionTimeOut; - } - - public boolean doAutoCompletePlayerNames() { - return autoCompletePlayerNames; - } - - public boolean doHomeLimitPermissionStacking() { - return homeLimitPermissionStacking; - } - - public boolean doUsePaperLibIfAvailable() { - return usePaperLibIfAvailable; - } - - public DisplayStyle getWarmupDisplayStyle() { - return teleportWarmupDisplayStyle; - } - - /** - * Used to define where messages should appear - */ - public enum DisplayStyle { - /** - * In the action bar (above the hotbar) - */ - ACTION_BAR, - /** - * In the title slot in the middle of the player's screen - */ - TITLE, - /** - * In the subtitle slot, just below the title - */ - SUBTITLE, - /** - * In chat - */ - CHAT - } -} diff --git a/src/main/java/me/william278/huskhomes2/data/DataManager.java b/src/main/java/me/william278/huskhomes2/data/DataManager.java deleted file mode 100644 index e384bda3..00000000 --- a/src/main/java/me/william278/huskhomes2/data/DataManager.java +++ /dev/null @@ -1,876 +0,0 @@ -package me.william278.huskhomes2.data; - -import me.william278.huskhomes2.HuskHomes; -import me.william278.huskhomes2.util.MessageManager; -import me.william278.huskhomes2.teleport.points.Home; -import me.william278.huskhomes2.teleport.points.TeleportationPoint; -import me.william278.huskhomes2.teleport.points.Warp; -import org.bukkit.Bukkit; -import org.bukkit.Location; -import org.bukkit.entity.Player; - -import java.sql.*; -import java.time.Instant; -import java.util.ArrayList; -import java.util.List; -import java.util.UUID; - -public class DataManager { - - // Return a player's ID from their UUID - private static Integer getPlayerId(UUID uuid, Connection connection) throws SQLException { - try (PreparedStatement statement = connection.prepareStatement( - "SELECT * FROM " + HuskHomes.getSettings().getPlayerDataTable() + " WHERE `user_uuid`=?;")) { - statement.setString(1, uuid.toString()); - ResultSet resultSet = statement.executeQuery(); - - if (resultSet.next()) { - final int playerID = resultSet.getInt("player_id"); - statement.close(); - return playerID; - } - - } - return null; - } - - // Return a player's ID from their UUID - public static Integer getPlayerId(String playerUsername, Connection connection) throws SQLException { - try (PreparedStatement statement = connection.prepareStatement( - "SELECT * FROM " + HuskHomes.getSettings().getPlayerDataTable() + " WHERE `username`=?;")) { - statement.setString(1, playerUsername); - ResultSet resultSet = statement.executeQuery(); - if (resultSet.next()) { - final int playerID = resultSet.getInt("player_id"); - statement.close(); - return playerID; - } - - } - return null; - } - - // Return an integer from the player table from a player ID - private static Integer getPlayerInteger(Integer playerID, String column, Connection connection) throws SQLException { - try (PreparedStatement statement = connection.prepareStatement( - "SELECT * FROM " + HuskHomes.getSettings().getPlayerDataTable() + " WHERE `player_id`=?;")) { - statement.setInt(1, playerID); - ResultSet resultSet = statement.executeQuery(); - if (resultSet.next()) { - final int playerInteger = resultSet.getInt(column); - statement.close(); - return playerInteger; - } - - } - return null; - } - - // Return an integer from the player table from a player object - private static Integer getPlayerInteger(Player p, String column, Connection connection) throws SQLException { - return getPlayerInteger(getPlayerId(p.getUniqueId(), connection), column, connection); - } - - // Return a string from the player table from a player ID - private static String getPlayerString(Integer playerID, String column, Connection connection) throws SQLException { - try (PreparedStatement statement = connection.prepareStatement( - "SELECT * FROM " + HuskHomes.getSettings().getPlayerDataTable() + " WHERE `player_id`=?;")) { - statement.setInt(1, playerID); - ResultSet resultSet = statement.executeQuery(); - if (resultSet.next()) { - final String playerString = resultSet.getString(column); - statement.close(); - return playerString; - } - - } - return null; - } - - // Return if the player is teleporting - public static Boolean isPlayerTeleporting(UUID uuid, Connection connection) throws SQLException { - try (PreparedStatement statement = connection.prepareStatement( - "SELECT * FROM " + HuskHomes.getSettings().getPlayerDataTable() + " WHERE `user_uuid`=?;")) { - statement.setString(1, uuid.toString()); - ResultSet resultSet = statement.executeQuery(); - if (resultSet.next()) { - final boolean isTeleporting = resultSet.getBoolean("is_teleporting"); - statement.close(); - return isTeleporting; - } - - } - return null; - } - - // Return if the player is ignoring teleport requests - public static Boolean isPlayerIgnoringRequests(UUID uuid, Connection connection) throws SQLException { - try (PreparedStatement statement = connection.prepareStatement( - "SELECT * FROM " + HuskHomes.getSettings().getPlayerDataTable() + " WHERE `user_uuid`=?;")) { - statement.setString(1, uuid.toString()); - ResultSet resultSet = statement.executeQuery(); - if (resultSet.next()) { - final boolean isIgnoringRequests = resultSet.getBoolean("is_ignoring_requests"); - statement.close(); - return isIgnoringRequests; - } - - } - return null; - } - - // Return a player's UUID - public static UUID getPlayerUUID(int playerID, Connection connection) throws SQLException { - String uuidString = getPlayerString(playerID, "user_uuid", connection); - if (uuidString != null) { - return UUID.fromString(uuidString); - } else { - return null; - } - } - - // Return a player's username - public static String getPlayerUsername(int playerID, Connection connection) throws SQLException { - return getPlayerString(playerID, "username", connection); - } - - // Return how many homes the player has set - public static int getPlayerHomeCount(Player p, Connection connection) throws SQLException { - return getPlayerHomes(p.getName(), connection).size(); - } - - // Increment the number of home slots a player has - public static void incrementPlayerHomeSlots(Player p, Connection connection) throws SQLException { - setPlayerHomeSlots(p.getUniqueId(), (getPlayerHomeSlots(p, connection) + 1), connection); - } - - // Return how many home slots a player has - public static Integer getPlayerHomeSlots(Player p, Connection connection) throws SQLException { - return getPlayerInteger(p, "home_slots", connection); - } - - // Return how many home slots a player has - public static Long getPlayerRtpCoolDown(Player p, Connection connection) throws SQLException { - return (long) getPlayerInteger(p, "rtp_cooldown", connection); - } - - // Returns a list of a player's homes - public static List getPlayerHomes(String playerName, Connection connection) throws SQLException { - final List playerHomes = new ArrayList<>(); - try (PreparedStatement statement = connection.prepareStatement( - "SELECT * FROM " + HuskHomes.getSettings().getHomesDataTable() + " WHERE `player_id`=(SELECT `player_id` FROM " + HuskHomes.getSettings().getPlayerDataTable() + " WHERE `username`=?);")) { - statement.setString(1, playerName); - ResultSet resultSet = statement.executeQuery(); - while (resultSet.next()) { - int locationID = resultSet.getInt("location_id"); - TeleportationPoint teleportationPoint = getTeleportationPoint(locationID, connection); - long epochTime = 0; - final Timestamp timestamp = resultSet.getTimestamp("creation_time"); - if (timestamp != null) { - epochTime = timestamp.getTime(); - } - playerHomes.add(new Home(teleportationPoint, - playerName, - getPlayerUUID(resultSet.getInt("player_id"), connection), - resultSet.getString("name"), - resultSet.getString("description"), - resultSet.getBoolean("public"), - epochTime)); - } - - } - return playerHomes; - } - - // Return all the public homes - public static List getPublicHomes(Connection connection) throws SQLException { - final List publicHomes = new ArrayList<>(); - try (PreparedStatement statement = connection.prepareStatement( - "SELECT * FROM " + HuskHomes.getSettings().getHomesDataTable() + " WHERE `public`;")) { - ResultSet resultSet = statement.executeQuery(); - while (resultSet.next()) { - int playerID = resultSet.getInt("player_id"); - int locationID = resultSet.getInt("location_id"); - TeleportationPoint teleportationPoint = getTeleportationPoint(locationID, connection); - long epochTime = 0; - final Timestamp timestamp = resultSet.getTimestamp("creation_time"); - if (timestamp != null) { - epochTime = timestamp.getTime(); - } - publicHomes.add(new Home(teleportationPoint, - getPlayerUsername(playerID, connection), - getPlayerUUID(playerID, connection), - resultSet.getString("name"), - resultSet.getString("description"), true, - epochTime)); - } - - } - return publicHomes; - } - - // Return an array of all the warps - public static List getWarps(Connection connection) throws SQLException { - final List warps = new ArrayList<>(); - try (PreparedStatement statement = connection.prepareStatement("SELECT * FROM " + HuskHomes.getSettings().getWarpsDataTable() + " ORDER BY `name` ASC;")) { - ResultSet resultSet = statement.executeQuery(); - if (resultSet != null) { - while (resultSet.next()) { - int locationID = resultSet.getInt("location_id"); - TeleportationPoint teleportationPoint = getTeleportationPoint(locationID, connection); - long epochTime = 0; - final Timestamp timestamp = resultSet.getTimestamp("creation_time"); - if (timestamp != null) { - epochTime = timestamp.getTime(); - } - warps.add(new Warp(teleportationPoint, - resultSet.getString("name"), - resultSet.getString("description"), - epochTime)); - } - } else { - Bukkit.getLogger().severe("Result set of warps returned null!"); - } - } - return warps; - } - - // Return a warp with a given name (warp names are unique) - public static Warp getWarp(String name, Connection connection) throws SQLException { - try (PreparedStatement statement = (connection.prepareStatement( - "SELECT * FROM " + HuskHomes.getSettings().getWarpsDataTable() + " WHERE `name`=?;"))) { - statement.setString(1, name); - ResultSet resultSet = statement.executeQuery(); - if (resultSet.next()) { - int locationID = resultSet.getInt("location_id"); - TeleportationPoint teleportationPoint = getTeleportationPoint(locationID, connection); - long epochTime = 0; - final Timestamp timestamp = resultSet.getTimestamp("creation_time"); - if (timestamp != null) { - epochTime = timestamp.getTime(); - } - return new Warp(teleportationPoint, - resultSet.getString("name"), - resultSet.getString("description"), - epochTime); - } - } - return null; - } - - // Obtain the teleportation location ID from a home - public static Integer getHomeLocationID(int ownerID, String homeName, Connection connection) throws SQLException { - try (PreparedStatement statement = connection.prepareStatement( - "SELECT * FROM " + HuskHomes.getSettings().getHomesDataTable() + " WHERE `player_id`=? AND `name`=?;")) { - statement.setInt(1, ownerID); - statement.setString(2, homeName); - ResultSet resultSet = statement.executeQuery(); - if (resultSet != null) { - if (resultSet.next()) { - final int locationID = resultSet.getInt("location_id"); - statement.close(); - return locationID; - } - } else { - Bukkit.getLogger().severe("Failed to obtain home teleportation location ID"); - } - } - return null; - } - - // Delete a home's corresponding home teleport location - public static void deleteHomeTeleportLocation(int ownerID, String homeName, Connection connection) throws SQLException { - Integer locationID = getHomeLocationID(ownerID, homeName, connection); - if (locationID != null) { - deleteTeleportationPoint(locationID, connection); - } - } - - // Update a home's teleport location (deletion of the old one is done afterward to prevent cascading deletion from wiping the home - public static void updateHomeTeleportLocation(int ownerID, String homeName, TeleportationPoint teleportationPoint, Connection connection) throws SQLException { - Integer oldLocationID = getHomeLocationID(ownerID, homeName, connection); - setHomeTeleportPoint(homeName, ownerID, teleportationPoint, connection); - if (oldLocationID != null) { - deleteTeleportationPoint(oldLocationID, connection); - } - } - - // Get the ID of the teleportation point of the warp - public static Integer getWarpLocationID(String warpName, Connection connection) throws SQLException { - try (PreparedStatement statement = connection.prepareStatement( - "SELECT * FROM " + HuskHomes.getSettings().getWarpsDataTable() + " WHERE `name`=?;")) { - statement.setString(1, warpName); - ResultSet resultSet = statement.executeQuery(); - if (resultSet != null) { - if (resultSet.next()) { - final int locationID = resultSet.getInt("location_id"); - statement.close(); - return locationID; - } - } - } - return null; - } - - // Delete a warp - public static void deleteWarp(String warpName, Connection connection) throws SQLException { - Integer warpLocationID = getWarpLocationID(warpName, connection); - if (warpLocationID != null) { - deleteTeleportationPoint(warpLocationID, connection); - - // Delete the warp with the given name - try (PreparedStatement statement = connection.prepareStatement( - "DELETE FROM " + HuskHomes.getSettings().getWarpsDataTable() + " WHERE `name`=?;")) { - statement.setString(1, warpName); - statement.executeUpdate(); - } - } - } - - - // Delete the home with the given name and player ID - public static void deleteHome(String homeName, String ownerUsername, Connection connection) throws SQLException { - try (PreparedStatement statement = connection.prepareStatement("DELETE FROM " + HuskHomes.getSettings().getHomesDataTable() + " WHERE `name`=? AND `player_id`=(SELECT `player_id` FROM " + HuskHomes.getSettings().getPlayerDataTable() + " WHERE `username`=?);")) { - statement.setString(1, homeName); - statement.setString(2, ownerUsername); - statement.executeUpdate(); - } - } - - public static void addPlayer(Player p, Connection connection) throws SQLException { - addPlayer(p.getUniqueId(), p.getName(), connection); - } - - // Insert a player into the database - public static void addPlayer(UUID playerUUID, String playerName, Connection connection) throws SQLException { - try (PreparedStatement statement = connection.prepareStatement( - "INSERT INTO " + HuskHomes.getSettings().getPlayerDataTable() + " (user_uuid,username,home_slots,rtp_cooldown,is_teleporting) VALUES(?,?,?,0,?);")) { - statement.setString(1, playerUUID.toString()); - statement.setString(2, playerName); - statement.setInt(3, HuskHomes.getSettings().getFreeHomeSlots()); - statement.setBoolean(4, false); - statement.executeUpdate(); - } - } - - public static void updatePlayerUsername(UUID uuid, String newName, Connection connection) throws SQLException { - try (PreparedStatement statement = connection.prepareStatement("UPDATE " + HuskHomes.getSettings().getPlayerDataTable() + " SET `username`=? WHERE `user_uuid`=?;")) { - statement.setString(1, newName); - statement.setString(2, uuid.toString()); - statement.executeUpdate(); - } - } - - private static void setPlayerTeleportingData(UUID uuid, boolean value, Connection connection) throws SQLException { - try (PreparedStatement statement = connection.prepareStatement("UPDATE " + HuskHomes.getSettings().getPlayerDataTable() + " SET `is_teleporting`=? WHERE `user_uuid`=?;")) { - statement.setBoolean(1, value); - statement.setString(2, uuid.toString()); - statement.executeUpdate(); - } - } - - private static void setPlayerIgnoringRequestsData(UUID uuid, boolean value, Connection connection) throws SQLException { - try (PreparedStatement statement = connection.prepareStatement( - "UPDATE " + HuskHomes.getSettings().getPlayerDataTable() + " SET `is_ignoring_requests`=? WHERE `user_uuid`=?;")) { - statement.setBoolean(1, value); - statement.setString(2, uuid.toString()); - statement.executeUpdate(); - } - } - - public static void setPlayerHomeSlots(UUID uuid, int newValue, Connection connection) throws SQLException { - try (PreparedStatement statement = connection.prepareStatement( - "UPDATE " + HuskHomes.getSettings().getPlayerDataTable() + " SET `home_slots`=? WHERE `user_uuid`=?;")) { - statement.setInt(1, newValue); - statement.setString(2, uuid.toString()); - statement.executeUpdate(); - } - } - - public static void setRtpCoolDown(UUID uuid, int newTime, Connection connection) throws SQLException { - try (PreparedStatement statement = connection.prepareStatement( - "UPDATE " + HuskHomes.getSettings().getPlayerDataTable() + " SET `rtp_cooldown`=? WHERE `user_uuid`=?;")) { - statement.setInt(1, newTime); - statement.setString(2, uuid.toString()); - statement.executeUpdate(); - } - } - - - // Update the privacy of a home - public static void setHomePrivacy(String homeName, String ownerName, boolean isPublic, Connection connection) throws SQLException { - try (PreparedStatement statement = connection.prepareStatement( - "UPDATE " + HuskHomes.getSettings().getHomesDataTable() + " SET `public`=? WHERE `name`=? AND `player_id`=(SELECT `player_id` FROM " + HuskHomes.getSettings().getPlayerDataTable() + " WHERE `username`=?);")) { - statement.setBoolean(1, isPublic); - statement.setString(2, homeName); - statement.setString(3, ownerName); - statement.executeUpdate(); - } - } - - - // Update the location of a home - public static void setWarpTeleportPoint(String warpName, TeleportationPoint point, Connection connection) throws SQLException { - // Set the warp location ID to a new teleport point - try (PreparedStatement statement = connection.prepareStatement( - "UPDATE " + HuskHomes.getSettings().getWarpsDataTable() + " SET `location_id`=? WHERE `name`=?;")) { - statement.setInt(1, addTeleportationPoint(point, connection)); - statement.setString(2, warpName); - statement.executeUpdate(); - } - } - - // Update the description of a home - public static void setHomeDescription(String homeName, String ownerName, String newDescription, Connection connection) throws SQLException { - try (PreparedStatement statement = connection.prepareStatement( - "UPDATE " + HuskHomes.getSettings().getHomesDataTable() + " SET `description`=? WHERE `name`=? AND `player_id`=(SELECT `player_id` FROM " + HuskHomes.getSettings().getPlayerDataTable() + " WHERE `username`=?);")) { - statement.setString(1, newDescription); - statement.setString(2, homeName); - statement.setString(3, ownerName); - statement.executeUpdate(); - } - } - - // Update the description of a warp - public static void setWarpDescription(String warpName, String newDescription, Connection connection) throws SQLException { - try (PreparedStatement statement = connection.prepareStatement( - "UPDATE " + HuskHomes.getSettings().getWarpsDataTable() + " SET `description`=? WHERE `name`=?;")) { - statement.setString(1, newDescription); - statement.setString(2, warpName); - statement.executeUpdate(); - } - } - - // Update the name of a home - public static void setHomeName(String oldHomeName, String ownerName, String newHomeName, Connection connection) throws SQLException { - try (PreparedStatement statement = connection.prepareStatement( - "UPDATE " + HuskHomes.getSettings().getHomesDataTable() + " SET `name`=? WHERE `name`=? AND `player_id`=(SELECT `player_id` FROM " + HuskHomes.getSettings().getPlayerDataTable() + " WHERE `username`=?);")) { - statement.setString(1, newHomeName); - statement.setString(2, oldHomeName); - statement.setString(3, ownerName); - statement.executeUpdate(); - } - } - - // Update the name of a warp - public static void setWarpName(String oldWarpName, String newWarpName, Connection connection) throws SQLException { - try (PreparedStatement statement = connection.prepareStatement("UPDATE " + HuskHomes.getSettings().getWarpsDataTable() + " SET `name`=? WHERE `name`=?;")) { - statement.setString(1, newWarpName); - statement.setString(2, oldWarpName); - statement.executeUpdate(); - } - } - - // Update a player's destination teleport point - public static void setTeleportationDestinationData(String username, TeleportationPoint point, Connection connection) throws SQLException { - try (PreparedStatement statement = connection.prepareStatement( - "UPDATE " + HuskHomes.getSettings().getPlayerDataTable() + " SET `dest_location_id`=? WHERE `username`=?;")) { - // Set the destination location with the location_id of the last inserted teleport point - statement.setInt(1, addTeleportationPoint(point, connection)); - statement.setString(2, username); - statement.executeUpdate(); - } - } - - // Update a warp's teleport location (deletion of the old one is done afterward to prevent cascading deletion from wiping the warp - public static void updateWarpTeleportLocation(String warpName, TeleportationPoint teleportationPoint, Connection connection) throws SQLException { - Integer oldLocationID = getWarpLocationID(warpName, connection); - setWarpTeleportPoint(warpName, teleportationPoint, connection); - if (oldLocationID != null) { - deleteTeleportationPoint(oldLocationID, connection); - } - } - - public static void updateHomePrivacy(String ownerName, String homeName, boolean isPublic, Connection connection) throws SQLException { - setHomePrivacy(homeName, ownerName, isPublic, connection); - } - - public static void updateHomeName(String ownerName, String homeName, String newName, Connection connection) throws SQLException { - setHomeName(homeName, ownerName, newName, connection); - } - - public static void updateHomeDescription(String ownerName, String homeName, String newDescription, Connection connection) throws SQLException { - setHomeDescription(homeName, ownerName, newDescription, connection); - } - - public static void updateHomeLocation(String ownerName, String homeName, Location newLocation, Connection connection) throws SQLException { - Integer playerID = getPlayerId(ownerName, connection); - if (playerID != null) { - updateHomeTeleportLocation(playerID, homeName, new TeleportationPoint(newLocation, - HuskHomes.getSettings().getServerID()), connection); - } - } - - public static void updateWarpName(String warpName, String newName, Connection connection) throws SQLException { - setWarpName(warpName, newName, connection); - } - - public static void updateWarpDescription(String warpName, String newDescription, Connection connection) throws SQLException { - setWarpDescription(warpName, newDescription, connection); - } - - public static void updateWarpLocation(String warpName, Location newLocation, Connection connection) throws SQLException { - updateWarpTeleportLocation(warpName, new TeleportationPoint(newLocation, - HuskHomes.getSettings().getServerID()), connection); - } - - // Return a home with a given owner username and home name - public static Home getHome(String ownerUsername, String homeName, Connection connection) throws SQLException { - try (PreparedStatement statement = connection.prepareStatement( - "SELECT * FROM " + HuskHomes.getSettings().getHomesDataTable() + " WHERE `player_id`=(SELECT `player_id` FROM " + HuskHomes.getSettings().getPlayerDataTable() + " WHERE `username`=?) AND `name`=?;")) { - statement.setString(1, ownerUsername); - statement.setString(2, homeName); - ResultSet resultSet = statement.executeQuery(); - if (resultSet != null) { - if (resultSet.next()) { - final int locationID = resultSet.getInt("location_id"); - final TeleportationPoint teleportationPoint = getTeleportationPoint(locationID, connection); - long epochTime = 0; - final Timestamp timestamp = resultSet.getTimestamp("creation_time"); - if (timestamp != null) { - epochTime = timestamp.getTime(); - } - final Home home = new Home(teleportationPoint, - ownerUsername, - getPlayerUUID(resultSet.getInt("player_id"), connection), - resultSet.getString("name"), - resultSet.getString("description"), - resultSet.getBoolean("public"), - epochTime); - statement.close(); - return home; - } - } - } - return null; - } - - public static boolean warpExists(String warpName, Connection connection) throws SQLException { - try (PreparedStatement statement = connection.prepareStatement( - "SELECT * FROM " + HuskHomes.getSettings().getWarpsDataTable() + " WHERE `name`=?;")) { - statement.setString(1, warpName); - ResultSet resultSet = statement.executeQuery(); - final boolean warpExists = resultSet.next(); - statement.close(); - return warpExists; - } - } - - public static Boolean homeExists(Player owner, String homeName, Connection connection) throws SQLException { - return homeExists(owner.getName(), homeName, connection); - } - - public static Boolean homeExists(String ownerName, String homeName, Connection connection) throws SQLException { - try (PreparedStatement statement = connection.prepareStatement( - "SELECT * FROM " + HuskHomes.getSettings().getHomesDataTable() + " WHERE `player_id`=(SELECT `player_id` FROM " + HuskHomes.getSettings().getPlayerDataTable() + " WHERE `username`=?) AND `name`=?;")) { - statement.setString(1, ownerName); - statement.setString(2, homeName); - ResultSet resultSet = statement.executeQuery(); - final boolean homeExists = resultSet.next(); - statement.close(); - return homeExists; - } - } - - public static Boolean playerExists(Player player, Connection connection) throws SQLException { - return playerExists(player.getUniqueId(), connection); - } - - public static Boolean playerExists(UUID playerUUID, Connection connection) throws SQLException { - try (PreparedStatement statement = connection.prepareStatement( - "SELECT * FROM " + HuskHomes.getSettings().getPlayerDataTable() + " WHERE `user_uuid`=?;")) { - statement.setString(1, playerUUID.toString()); - ResultSet resultSet = statement.executeQuery(); - final boolean exists = resultSet.next(); - statement.close(); - return exists; - } - } - - public static Boolean playerExists(String username, Connection connection) throws SQLException { - try (PreparedStatement statement = connection.prepareStatement( - "SELECT * FROM " + HuskHomes.getSettings().getPlayerDataTable() + " WHERE `username`=?;")) { - statement.setString(1, username); - ResultSet resultSet = statement.executeQuery(); - final boolean exists = resultSet.next(); - statement.close(); - return exists; - } - } - - public static TeleportationPoint getTeleportationPoint(Integer locationID, Connection connection) throws SQLException, IllegalArgumentException { - try (PreparedStatement statement = connection.prepareStatement( - "SELECT * FROM " + HuskHomes.getSettings().getLocationsDataTable() + " WHERE `location_id`=?;")) { - statement.setInt(1, locationID); - ResultSet resultSet = statement.executeQuery(); - if (resultSet.next()) { - final TeleportationPoint point = new TeleportationPoint( - resultSet.getString("world"), - resultSet.getDouble("x"), - resultSet.getDouble("y"), - resultSet.getDouble("z"), - resultSet.getFloat("yaw"), - resultSet.getFloat("pitch"), - resultSet.getString("server")); - statement.close(); - return point; - } else { - statement.close(); - throw new IllegalArgumentException("Could not return a teleportationPoint from the locations data table at (ID#" + locationID + ")"); - } - } - } - - public static TeleportationPoint getPlayerDestination(Player p, Connection connection) throws SQLException { - Integer locationID = getPlayerInteger(p, "dest_location_id", connection); - if (locationID != null) { - return getTeleportationPoint(locationID, connection); - } else { - return null; - } - } - - public static TeleportationPoint getPlayerLastPosition(Player p, Connection connection) throws SQLException { - Integer locationID = getPlayerInteger(p, "last_location_id", connection); - if (locationID != null) { - return getTeleportationPoint(locationID, connection); - } else { - return null; - } - } - - public static TeleportationPoint getPlayerOfflinePosition(int playerID, Connection connection) throws SQLException { - try { - Integer locationID = getPlayerInteger(playerID, "offline_location_id", connection); - if (locationID != null) { - return getTeleportationPoint(locationID, connection); - } else { - return null; - } - } catch (IllegalArgumentException e) { - return null; - } - } - - // Insert a teleportation point, returns generated id - public static Integer addTeleportationPoint(TeleportationPoint point, Connection connection) throws SQLException { - try (PreparedStatement statement = connection.prepareStatement( - "INSERT INTO " + HuskHomes.getSettings().getLocationsDataTable() + " (world,server,x,y,z,yaw,pitch) VALUES(?,?,?,?,?,?,?);", Statement.RETURN_GENERATED_KEYS)) { - statement.setString(1, point.getWorldName()); - statement.setString(2, point.getServer()); - statement.setDouble(3, point.getX()); - statement.setDouble(4, point.getY()); - statement.setDouble(5, point.getZ()); - statement.setFloat(6, point.getYaw()); - statement.setFloat(7, point.getPitch()); - statement.executeUpdate(); - ResultSet resultSet = statement.getGeneratedKeys(); - resultSet.next(); - final int pointID = resultSet.getInt(1); - statement.close(); - return pointID; - } - } - - // Update a player's offline position teleport point - public static void setTeleportationOfflinePositionData(UUID uuid, TeleportationPoint point, Connection connection) throws SQLException { - // Set the destination location with the location_id of the newly inserted teleport point - try (PreparedStatement statement = connection.prepareStatement( - "UPDATE " + HuskHomes.getSettings().getPlayerDataTable() + " SET `offline_location_id`=? WHERE `user_uuid`=?;")) { - statement.setInt(1, addTeleportationPoint(point, connection)); - statement.setString(2, uuid.toString()); - statement.executeUpdate(); - } - } - - // Update a player's last position location on SQL - public static void setPlayerOfflinePosition(UUID uuid, TeleportationPoint point, Connection connection) throws SQLException { - deletePlayerOfflinePosition(uuid, connection); - setTeleportationOfflinePositionData(uuid, point, connection); - } - - // Update a player's last position teleport point - public static void setTeleportationLastPositionData(UUID uuid, TeleportationPoint point, Connection connection) throws SQLException { - // Set the destination location with the location_id of the last inserted teleport point - try (PreparedStatement statement = connection.prepareStatement( - "UPDATE " + HuskHomes.getSettings().getPlayerDataTable() + " SET `last_location_id`=? WHERE `user_uuid`=?;")) { - statement.setInt(1, addTeleportationPoint(point, connection)); - statement.setString(2, uuid.toString()); - statement.executeUpdate(); - } - } - - // Update a player's last position location on SQL - public static void setPlayerLastPosition(Player p, TeleportationPoint point, Connection connection) throws SQLException { - deletePlayerLastPosition(p, connection); - setTeleportationLastPositionData(p.getUniqueId(), point, connection); - } - - // Update a player's destination location on SQL - public static void setPlayerDestinationLocation(String playerName, TeleportationPoint point, Connection connection) throws SQLException { - deletePlayerDestination(playerName, connection); - setTeleportationDestinationData(playerName, point, connection); - } - - // Update a player's destination location on SQL - public static void setPlayerDestinationLocation(Player p, TeleportationPoint point, Connection connection) throws SQLException { - setPlayerDestinationLocation(p.getName(), point, connection); - } - - public static void setPlayerTeleporting(Player p, boolean teleporting, Connection connection) throws SQLException { - if (teleporting) { - HuskHomes.setTeleporting(p.getUniqueId()); - } else { - HuskHomes.setNotTeleporting(p.getUniqueId()); - } - setPlayerTeleportingData(p.getUniqueId(), teleporting, connection); - } - - public static void setPlayerIgnoringRequests(Player p, boolean ignoringRequests, Connection connection) throws SQLException { - setPlayerIgnoringRequestsData(p.getUniqueId(), ignoringRequests, connection); - } - - public static void updateRtpCoolDown(Player p, Connection connection) throws SQLException { - long currentTime = Instant.now().getEpochSecond(); - int newCoolDownTime = (int) currentTime + (60 * HuskHomes.getSettings().getRtpCoolDown()); - setRtpCoolDown(p.getUniqueId(), newCoolDownTime, connection); - } - - public static void deletePlayerDestination(String playerName, Connection connection) throws SQLException { - Integer destinationID = getPlayerInteger(getPlayerId(playerName, connection), "dest_location_id", connection); - if (destinationID != null) { - deleteTeleportationPoint(destinationID, connection); - clearPlayerDestData(playerName, connection); - } - } - - // Delete a teleportation point from SQL - public static void deleteTeleportationPoint(int locationID, Connection connection) throws SQLException { - try (PreparedStatement statement = connection.prepareStatement( - "DELETE FROM " + HuskHomes.getSettings().getLocationsDataTable() + " WHERE `location_id`=?;")) { - statement.setInt(1, locationID); - statement.executeUpdate(); - } - } - - public static void deletePlayerLastPosition(Player p, Connection connection) throws SQLException { - Integer lastPositionID = getPlayerInteger(p, "last_location_id", connection); - if (lastPositionID != null) { - deleteTeleportationPoint(lastPositionID, connection); - clearPlayerLastData(p.getUniqueId(), connection); - } - } - - public static void deletePlayerOfflinePosition(UUID uuid, Connection connection) throws SQLException { - Integer offlineLocationId = getPlayerInteger(getPlayerId(uuid, connection), "offline_location_id", connection); - if (offlineLocationId != null) { - deleteTeleportationPoint(offlineLocationId, connection); - clearPlayerOfflineData(uuid, connection); - } - } - - // Update the location of a home - public static void setHomeTeleportPoint(String homeName, int ownerID, TeleportationPoint point, Connection connection) throws SQLException { - // Set the home location ID to the new teleport point for the given home - try (PreparedStatement statement = connection.prepareStatement("UPDATE " + HuskHomes.getSettings().getHomesDataTable() + " SET `location_id`=? WHERE `name`=? AND `player_id`=?;")) { - statement.setInt(1, addTeleportationPoint(point, connection)); - statement.setString(2, homeName); - statement.setInt(3, ownerID); - statement.executeUpdate(); - } - } - - // Clear a player's destination - public static void clearPlayerDestData(String playerName, Connection connection) throws SQLException { - try (PreparedStatement statement = (connection.prepareStatement( - "UPDATE " + HuskHomes.getSettings().getPlayerDataTable() + " SET `dest_location_id`=NULL WHERE `username`=?;"))) { - statement.setString(1, playerName); - statement.executeUpdate(); - } - } - - // Clear a player's last position - public static void clearPlayerLastData(UUID uuid, Connection connection) throws SQLException { - try (PreparedStatement statement = connection.prepareStatement( - "UPDATE " + HuskHomes.getSettings().getPlayerDataTable() + " SET `last_location_id`=NULL WHERE `user_uuid`=?;")) { - statement.setString(1, uuid.toString()); - statement.executeUpdate(); - } - } - - // Clear a player's last position - public static void clearPlayerOfflineData(UUID uuid, Connection connection) throws SQLException { - try (PreparedStatement statement = connection.prepareStatement( - "UPDATE " + HuskHomes.getSettings().getPlayerDataTable() + " SET `offline_location_id`=NULL WHERE `user_uuid`=?;")) { - statement.setString(1, uuid.toString()); - statement.executeUpdate(); - } - } - - // Insert the warp with the location_id of the last inserted teleport point - public static void addWarp(Warp warp, Connection connection) throws SQLException { - try (PreparedStatement statement = connection.prepareStatement( - "INSERT INTO " + HuskHomes.getSettings().getWarpsDataTable() + " (location_id,name,description,creation_time) VALUES(?,?,?,?);")) { - statement.setInt(1, addTeleportationPoint(warp, connection)); - statement.setString(2, warp.getName()); - statement.setString(3, warp.getDescription()); - statement.setTimestamp(4, new Timestamp(warp.getCreationTime())); - statement.executeUpdate(); - } - } - - public static void addHome(Home home, UUID playerUUID, Connection connection) throws SQLException { - Integer playerID = getPlayerId(playerUUID, connection); - if (playerID != null) { - try (PreparedStatement statement = connection.prepareStatement( - "INSERT INTO " + HuskHomes.getSettings().getHomesDataTable() + " (player_id,location_id,name,description,public,creation_time) VALUES(?,?,?,?,?,?);")) { - statement.setInt(1, playerID); - statement.setInt(2, addTeleportationPoint(home, connection)); - statement.setString(3, home.getName()); - statement.setString(4, home.getDescription()); - statement.setBoolean(5, home.isPublic()); - statement.setTimestamp(6, new Timestamp(home.getCreationTime())); - statement.executeUpdate(); - } - } - } - - public static void addHome(Home home, Player p, Connection connection) throws SQLException { - addHome(home, p.getUniqueId(), connection); - } - - public static void deleteHome(Player p, String homeName, Connection connection) throws SQLException { - deleteHome(p, p.getName(), homeName, connection); - } - - public static void deleteHome(Player deleter, String ownerName, String homeName, Connection connection) throws SQLException { - if (!homeExists(ownerName, homeName, connection)) { - MessageManager.sendMessage(deleter, "error_invalid_home"); - return; - } - Integer playerID = getPlayerId(ownerName, connection); - if (playerID != null) { - deleteHomeTeleportLocation(playerID, homeName, connection); - deleteHome(homeName, ownerName, connection); - } else { - MessageManager.sendMessage(deleter, "error_invalid_player"); - } - } - - public static void createPlayer(Player p, Connection connection) throws SQLException { - addPlayer(p, connection); - } - - public static void createPlayer(UUID playerUUID, String playerUsername, Connection connection) throws SQLException { - addPlayer(playerUUID, playerUsername, connection); - } - - public static void checkPlayerNameChange(Player p, Connection connection) throws SQLException { - final Integer playerID = getPlayerId(p.getUniqueId(), connection); - if (playerID != null) { - if (!getPlayerUsername(playerID, connection).equals(p.getName())) { - updatePlayerUsername(p.getUniqueId(), p.getName(), connection); - } - } - } -} \ No newline at end of file diff --git a/src/main/java/me/william278/huskhomes2/data/message/CrossServerMessageHandler.java b/src/main/java/me/william278/huskhomes2/data/message/CrossServerMessageHandler.java deleted file mode 100644 index d3b54db6..00000000 --- a/src/main/java/me/william278/huskhomes2/data/message/CrossServerMessageHandler.java +++ /dev/null @@ -1,121 +0,0 @@ -package me.william278.huskhomes2.data.message; - -import me.william278.huskhomes2.HuskHomes; -import me.william278.huskhomes2.util.MessageManager; -import me.william278.huskhomes2.data.DataManager; -import me.william278.huskhomes2.data.message.pluginmessage.PluginMessage; -import me.william278.huskhomes2.data.message.redis.RedisMessage; -import me.william278.huskhomes2.integrations.VanishChecker; -import me.william278.huskhomes2.teleport.TeleportManager; -import me.william278.huskhomes2.teleport.TeleportRequest; -import me.william278.huskhomes2.teleport.TeleportRequestHandler; -import me.william278.huskhomes2.teleport.points.TeleportationPoint; -import org.bukkit.Bukkit; -import org.bukkit.entity.Player; - -import java.sql.Connection; -import java.sql.SQLException; -import java.util.StringJoiner; -import java.util.logging.Level; - -public class CrossServerMessageHandler { - - private static final HuskHomes plugin = HuskHomes.getInstance(); - - public static void handlePluginMessage(Message receivedMessage, Player recipient) { - switch (receivedMessage.getMessageType()) { - case SET_TP_DESTINATION -> Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> { - try (Connection connection = HuskHomes.getConnection()) { - DataManager.setPlayerDestinationLocation(receivedMessage.getMessageData(), - new TeleportationPoint(recipient.getLocation(), HuskHomes.getSettings().getServerID()), connection); - CrossServerMessageHandler.getMessage(receivedMessage.getMessageData(), Message.MessageType.CONFIRM_DESTINATION_SET, "confirmed").send(recipient); - } catch (SQLException e) { - plugin.getLogger().log(Level.SEVERE, "An SQL exception occurred responding to a plugin message teleport destination update"); - } - }); - case CONFIRM_DESTINATION_SET -> { - if (receivedMessage.getMessageData().equals("confirmed")) { - TeleportManager.teleportPlayer(recipient); - } - } - case TPA_REQUEST -> { - if (!VanishChecker.isVanished(recipient)) { - if (!HuskHomes.isIgnoringTeleportRequests(recipient.getUniqueId())) { - if (TeleportRequestHandler.isDuplicateRequest(receivedMessage.getMessageData(), recipient)) { - return; // Prevent request spam - } - TeleportRequestHandler.teleportRequests.get(recipient).put(receivedMessage.getMessageData(), - new TeleportRequest(receivedMessage.getMessageData(), TeleportRequest.RequestType.TPA)); - MessageManager.sendMessage(recipient, "tpa_request_ask", receivedMessage.getMessageData()); - MessageManager.sendMessage(recipient, "teleport_request_options", receivedMessage.getMessageData()); - } - } - } - case TPA_HERE_REQUEST -> { - if (!VanishChecker.isVanished(recipient)) { - if (!HuskHomes.isIgnoringTeleportRequests(recipient.getUniqueId())) { - if (TeleportRequestHandler.isDuplicateRequest(receivedMessage.getMessageData(), recipient)) { - return; // Prevent request spam - } - TeleportRequestHandler.teleportRequests.get(recipient).put(receivedMessage.getMessageData(), - new TeleportRequest(receivedMessage.getMessageData(), TeleportRequest.RequestType.TPA_HERE)); - MessageManager.sendMessage(recipient, "tpahere_request_ask", receivedMessage.getMessageData()); - MessageManager.sendMessage(recipient, "teleport_request_options", receivedMessage.getMessageData()); - } - } - } - case TPA_REQUEST_REPLY -> { - final String tpaReplierName = receivedMessage.getMessageDataItems()[0]; - final boolean tpaAccepted = Boolean.parseBoolean(receivedMessage.getMessageDataItems()[1]); - if (tpaAccepted) { - MessageManager.sendMessage(recipient, "tpa_has_accepted", tpaReplierName); - Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> TeleportManager.queueTimedTeleport(recipient, tpaReplierName)); - } else { - MessageManager.sendMessage(recipient, "tpa_has_declined", tpaReplierName); - } - } - case TPA_HERE_REQUEST_REPLY -> { - final String tpaHereReplierName = receivedMessage.getMessageDataItems()[0]; - final boolean tpaHereAccepted = Boolean.parseBoolean(receivedMessage.getMessageDataItems()[1]); - if (tpaHereAccepted) { - MessageManager.sendMessage(recipient, "tpa_has_accepted", tpaHereReplierName); - } else { - MessageManager.sendMessage(recipient, "tpa_has_declined", tpaHereReplierName); - } - } - case TELEPORT_TO_ME -> Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> TeleportManager.teleportPlayer(recipient, receivedMessage.getMessageData())); - case GET_PLAYER_LIST -> { - final String requestingServer = receivedMessage.getMessageData(); - StringJoiner playerList = new StringJoiner("£"); - for (Player p : Bukkit.getOnlinePlayers()) { - playerList.add(p.getName()); - } - if (playerList.toString().equals("")) { - return; - } - CrossServerMessageHandler.getMessage(Message.MessageType.RETURN_PLAYER_LIST, playerList.toString()).sendToServer(recipient, requestingServer); - } - case RETURN_PLAYER_LIST -> { - final String[] returningPlayers = receivedMessage.getMessageData().split("£"); - HuskHomes.getPlayerList().addPlayers(returningPlayers); - } - default -> HuskHomes.getInstance().getLogger().log(Level.WARNING, "Received a HuskHomes plugin message with an unrecognised type. Is your version of HuskHomes up to date?"); - } - } - - public static Message getMessage(String targetPlayerName, Message.MessageType pluginMessageType, String... messageData) { - return switch (HuskHomes.getSettings().getMessengerType().toLowerCase()) { - case "pluginmessage" -> new PluginMessage(targetPlayerName, pluginMessageType, messageData); - case "redis" -> new RedisMessage(targetPlayerName, pluginMessageType, messageData); - default -> null; - }; - } - - public static Message getMessage(Message.MessageType pluginMessageType, String... messageData) { - return switch (HuskHomes.getSettings().getMessengerType().toLowerCase()) { - case "pluginmessage" -> new PluginMessage(pluginMessageType, messageData); - case "redis" -> new RedisMessage(pluginMessageType, messageData); - default -> null; - }; - } -} diff --git a/src/main/java/me/william278/huskhomes2/data/message/Message.java b/src/main/java/me/william278/huskhomes2/data/message/Message.java deleted file mode 100644 index 96a58b5d..00000000 --- a/src/main/java/me/william278/huskhomes2/data/message/Message.java +++ /dev/null @@ -1,93 +0,0 @@ -package me.william278.huskhomes2.data.message; - -import me.william278.huskhomes2.HuskHomes; -import org.bukkit.entity.Player; - -import java.util.Locale; -import java.util.StringJoiner; - -public abstract class Message { - - private static final String MESSAGE_DATA_SEPARATOR = "$"; - - private final int clusterId; - private final Message.MessageType messageType; - private final String targetPlayerName; - private final String messageData; - - public Message(String targetPlayerName, MessageType pluginMessageType, String... messageData) { - this.clusterId = HuskHomes.getSettings().getClusterId(); - this.messageType = pluginMessageType; - StringJoiner newMessageData = new StringJoiner(MESSAGE_DATA_SEPARATOR); - for (String dataItem : messageData) { - newMessageData.add(dataItem); - } - this.messageData = newMessageData.toString(); - this.targetPlayerName = targetPlayerName; - } - - public Message(MessageType pluginMessageType, String... messageData) { - this.clusterId = HuskHomes.getSettings().getClusterId(); - this.messageType = pluginMessageType; - StringJoiner newMessageData = new StringJoiner(MESSAGE_DATA_SEPARATOR); - for (String dataItem : messageData) { - newMessageData.add(dataItem); - } - this.messageData = newMessageData.toString(); - this.targetPlayerName = null; - } - - public Message(int clusterId, String targetPlayerName, String pluginMessageType, String... messageData) { - this.clusterId = clusterId; - this.messageType = MessageType.valueOf(pluginMessageType.toUpperCase(Locale.ENGLISH)); - StringJoiner newMessageData = new StringJoiner(MESSAGE_DATA_SEPARATOR); - for (String dataItem : messageData) { - newMessageData.add(dataItem); - } - this.messageData = newMessageData.toString(); - this.targetPlayerName = targetPlayerName; - } - - // Get the string version of the plugin message type - protected String getPluginMessageString(Message.MessageType type) { - return type.name().toLowerCase(Locale.ENGLISH); - } - - public int getClusterId() { - return clusterId; - } - - public Message.MessageType getMessageType() { - return messageType; - } - - public String getTargetPlayerName() { - return targetPlayerName; - } - - public String getMessageData() { - return messageData; - } - - public String[] getMessageDataItems() { - return messageData.split("\\" + MESSAGE_DATA_SEPARATOR); - } - - public abstract void send(Player sender); - - public abstract void sendToAllServers(Player sender); - - public abstract void sendToServer(Player sender, String server); - - public enum MessageType { - SET_TP_DESTINATION, - CONFIRM_DESTINATION_SET, - TPA_REQUEST, - TPA_HERE_REQUEST, - TPA_REQUEST_REPLY, - TPA_HERE_REQUEST_REPLY, - TELEPORT_TO_ME, - GET_PLAYER_LIST, - RETURN_PLAYER_LIST - } -} diff --git a/src/main/java/me/william278/huskhomes2/data/message/pluginmessage/PluginMessage.java b/src/main/java/me/william278/huskhomes2/data/message/pluginmessage/PluginMessage.java deleted file mode 100644 index a2efca91..00000000 --- a/src/main/java/me/william278/huskhomes2/data/message/pluginmessage/PluginMessage.java +++ /dev/null @@ -1,95 +0,0 @@ -package me.william278.huskhomes2.data.message.pluginmessage; - -import com.google.common.io.ByteArrayDataOutput; -import com.google.common.io.ByteStreams; -import me.william278.huskhomes2.HuskHomes; -import me.william278.huskhomes2.data.message.Message; -import org.bukkit.Bukkit; -import org.bukkit.entity.Player; - -import java.io.ByteArrayOutputStream; -import java.io.DataOutputStream; -import java.io.IOException; - -public class PluginMessage extends Message { - - private static final HuskHomes plugin = HuskHomes.getInstance(); - - public PluginMessage(String targetPlayerName, MessageType pluginMessageType, String... messageData) { - super(targetPlayerName, pluginMessageType, messageData); - } - - public PluginMessage(MessageType pluginMessageType, String... messageData) { - super(pluginMessageType, messageData); - } - - public PluginMessage(int clusterID, String targetPlayerName, String pluginMessageType, String... messageData) { - super(clusterID, targetPlayerName, pluginMessageType, messageData); - } - - @SuppressWarnings("UnstableApiUsage") - public void send(Player sender) { - Bukkit.getScheduler().runTask(plugin, () -> { - ByteArrayDataOutput out = ByteStreams.newDataOutput(); - - // Send a plugin message to the specified player name - out.writeUTF("ForwardToPlayer"); - out.writeUTF(getTargetPlayerName()); - - // Send the HuskHomes message with a specific type - out.writeUTF("HuskHomes:" + getClusterId() + ":" + getPluginMessageString(getMessageType())); - ByteArrayOutputStream messageBytes = new ByteArrayOutputStream(); - DataOutputStream messageOut = new DataOutputStream(messageBytes); - - // Send the message data; output an exception if there's an error - try { - messageOut.writeUTF(getMessageData()); - } catch (IOException e) { - plugin.getLogger().warning("An error occurred trying to send a plugin message (" + e.getCause() + ")"); - e.printStackTrace(); - } - - // Write the messages to the output packet - out.writeShort(messageBytes.toByteArray().length); - out.write(messageBytes.toByteArray()); - - // Send the constructed plugin message packet - sender.sendPluginMessage(plugin, "BungeeCord", out.toByteArray()); - }); - } - - public void sendToAllServers(Player sender) { - sendToServer(sender, "ALL"); - } - - @SuppressWarnings("UnstableApiUsage") - public void sendToServer(Player sender, String server) { - Bukkit.getScheduler().runTask(plugin, () -> { - ByteArrayDataOutput out = ByteStreams.newDataOutput(); - - // Send a plugin message to the specified player name - out.writeUTF("Forward"); - out.writeUTF(server); - - // Send the HuskHomes message with a specific type - out.writeUTF("HuskHomes:" + getClusterId() + ":" + getPluginMessageString(getMessageType())); - ByteArrayOutputStream messageBytes = new ByteArrayOutputStream(); - DataOutputStream messageOut = new DataOutputStream(messageBytes); - - // Send the message data; output an exception if there's an error - try { - messageOut.writeUTF(getMessageData()); - } catch (IOException e) { - plugin.getLogger().warning("An error occurred trying to send a plugin message to a server (" + e.getCause() + ")"); - e.printStackTrace(); - } - - // Write the messages to the output packet - out.writeShort(messageBytes.toByteArray().length); - out.write(messageBytes.toByteArray()); - - // Send the constructed plugin message packet - sender.sendPluginMessage(plugin, "BungeeCord", out.toByteArray()); - }); - } -} diff --git a/src/main/java/me/william278/huskhomes2/data/message/pluginmessage/PluginMessageReceiver.java b/src/main/java/me/william278/huskhomes2/data/message/pluginmessage/PluginMessageReceiver.java deleted file mode 100644 index 98994baf..00000000 --- a/src/main/java/me/william278/huskhomes2/data/message/pluginmessage/PluginMessageReceiver.java +++ /dev/null @@ -1,68 +0,0 @@ -package me.william278.huskhomes2.data.message.pluginmessage; - -import com.google.common.io.ByteArrayDataInput; -import com.google.common.io.ByteStreams; -import me.william278.huskhomes2.HuskHomes; -import me.william278.huskhomes2.data.message.CrossServerMessageHandler; -import org.bukkit.Bukkit; -import org.bukkit.entity.Player; -import org.bukkit.plugin.messaging.PluginMessageListener; -import org.jetbrains.annotations.NotNull; - -import java.io.ByteArrayInputStream; -import java.io.DataInputStream; -import java.io.IOException; - -public class PluginMessageReceiver implements PluginMessageListener { - - @Override @SuppressWarnings("UnstableApiUsage") - public void onPluginMessageReceived(String channel, @NotNull Player player, byte[] message) { - // Return if the message is not a Bungee message - if (!channel.equals("BungeeCord")) { - return; - } - ByteArrayDataInput input = ByteStreams.newDataInput(message); - - // Plugin messages are formatted as such: - // HuskHomes::, followed by the message arguments and data. - String messageType = input.readUTF(); - int clusterID; - - // Return if the message was not sent by HuskHomes - if (!messageType.contains("HuskHomes:")) { - return; - } - - // Ensure the cluster ID matches - try { - clusterID = Integer.parseInt(messageType.split(":")[1]); - } catch (Exception e) { - // In case the message is malformed or the cluster ID is invalid - HuskHomes.getInstance().getLogger().warning("Received a HuskHomes plugin message with an invalid server Cluster ID! \n" + - "Please ensure that the cluster ID is set to a valid integer on all servers."); - return; - } - if (HuskHomes.getSettings().getClusterId() != clusterID) { - return; - } - - // Get the message data packets - String messageData = ""; - short messageLength = input.readShort(); - byte[] messageBytes = new byte[messageLength]; - input.readFully(messageBytes); - DataInputStream messageIn = new DataInputStream(new ByteArrayInputStream(messageBytes)); - - // Get the message data string from the packets received - try { - messageData = messageIn.readUTF(); - } catch (IOException e) { - Bukkit.getLogger().warning("An error occurred trying to read a plugin message (" + e.getCause() + ")"); - e.printStackTrace(); - } - - // Handle the plugin message appropriately - CrossServerMessageHandler.handlePluginMessage(new PluginMessage(clusterID, player.getName(), messageType.split(":")[2], messageData), player); - } - -} diff --git a/src/main/java/me/william278/huskhomes2/data/message/redis/RedisMessage.java b/src/main/java/me/william278/huskhomes2/data/message/redis/RedisMessage.java deleted file mode 100644 index 3fa846ae..00000000 --- a/src/main/java/me/william278/huskhomes2/data/message/redis/RedisMessage.java +++ /dev/null @@ -1,50 +0,0 @@ -package me.william278.huskhomes2.data.message.redis; - -import me.william278.huskhomes2.HuskHomes; -import me.william278.huskhomes2.data.message.Message; -import org.bukkit.Bukkit; -import org.bukkit.entity.Player; -import redis.clients.jedis.Jedis; - -public class RedisMessage extends Message { - - public static final String REDIS_MESSAGE_HEADER_SEPARATOR = "£"; - private static final HuskHomes plugin = HuskHomes.getInstance(); - - public RedisMessage(String targetPlayerName, MessageType pluginMessageType, String... messageData) { - super(targetPlayerName, pluginMessageType, messageData); - } - - public RedisMessage(MessageType pluginMessageType, String... messageData) { - super(pluginMessageType, messageData); - } - - public RedisMessage(int clusterId, String targetPlayerName, String pluginMessageType, String... messageData) { - super(clusterId, targetPlayerName, pluginMessageType, messageData); - } - - private void dispatchRedisMessage(String target) { - Bukkit.getScheduler().runTask(plugin, () -> { - try (Jedis publisher = RedisReceiver.getJedis()) { - publisher.publish(RedisReceiver.REDIS_CHANNEL, - getClusterId() + ":" + getPluginMessageString(getMessageType()) + ":" - + target + REDIS_MESSAGE_HEADER_SEPARATOR + getMessageData()); - } - }); - } - - @Override - public void send(Player sender) { - dispatchRedisMessage(getTargetPlayerName()); - } - - @Override - public void sendToAllServers(Player sender) { - dispatchRedisMessage("-all-"); - } - - @Override - public void sendToServer(Player sender, String server) { - dispatchRedisMessage("server-" + server + ""); - } -} diff --git a/src/main/java/me/william278/huskhomes2/data/message/redis/RedisReceiver.java b/src/main/java/me/william278/huskhomes2/data/message/redis/RedisReceiver.java deleted file mode 100644 index 80e79acc..00000000 --- a/src/main/java/me/william278/huskhomes2/data/message/redis/RedisReceiver.java +++ /dev/null @@ -1,124 +0,0 @@ -package me.william278.huskhomes2.data.message.redis; - -import me.william278.huskhomes2.HuskHomes; -import me.william278.huskhomes2.data.message.CrossServerMessageHandler; -import org.bukkit.Bukkit; -import org.bukkit.entity.Player; -import redis.clients.jedis.Jedis; -import redis.clients.jedis.JedisPool; -import redis.clients.jedis.JedisPoolConfig; -import redis.clients.jedis.JedisPubSub; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.logging.Level; - -public class RedisReceiver { - - private static JedisPool jedisPool; - - public static Jedis getJedis() { - return jedisPool.getResource(); - } - - // Initialize a JedisPool that can be drawn from on demand - public static void initialize() { - if (HuskHomes.getSettings().getRedisPassword().isEmpty()) { - jedisPool = new JedisPool(new JedisPoolConfig(), - HuskHomes.getSettings().getRedisHost(), - HuskHomes.getSettings().getRedisPort(), - 0, - HuskHomes.getSettings().getRedisSSL()); - } else { - jedisPool = new JedisPool(new JedisPoolConfig(), - HuskHomes.getSettings().getRedisHost(), - HuskHomes.getSettings().getRedisPort(), - 0, - HuskHomes.getSettings().getRedisPassword(), - HuskHomes.getSettings().getRedisSSL()); - } - } - - // Close the connection - public static void terminate() { - jedisPool.close(); - } - - private static final HuskHomes plugin = HuskHomes.getInstance(); - public static final String REDIS_CHANNEL = "HuskHomes"; - - // Get a player to act as the "target" (ensure compatability with Plugin Messaging) - private static Player getRandomReceiver() { - ArrayList players = new ArrayList<>(Bukkit.getOnlinePlayers()); - if (players.isEmpty()) { - return null; - } - Collections.shuffle(players); - return players.get(0); - } - - public static void listen() { - new Thread(() -> { - try (Jedis jedis = getJedis()) { - jedis.subscribe(new JedisPubSub() { - @Override - public void onMessage(String channel, String message) { - if (!channel.equals(REDIS_CHANNEL)) { - return; - } - - /* HuskHomes Redis messages have a header formatted as such: - * ::£ followed by the message arguments and data. */ - final String[] splitMessage = message.split(RedisMessage.REDIS_MESSAGE_HEADER_SEPARATOR); - final String messageHeader = splitMessage[0]; - int clusterID; - - // Ensure the cluster ID matches - try { - clusterID = Integer.parseInt(messageHeader.split(":")[0]); - } catch (Exception e) { - // In case the message is malformed or the cluster ID is invalid - HuskHomes.getInstance().getLogger().warning("Received a Redis message on the HuskHomes channel with an invalid server Cluster ID! \n" + - "Please ensure that the cluster ID is set to a valid integer on all servers."); - return; - } - if (HuskHomes.getSettings().getClusterId() != clusterID) { - return; - } - - // Get the type of redis message - final String messageType = messageHeader.split(":")[1]; - - // Get the player targeted by the message and make sure they are online - final String target = messageHeader.split(":")[2]; - Player receiver = Bukkit.getPlayerExact(target); - - // If the redis message was targeting this server - if (target.equalsIgnoreCase("-all-")) { - receiver = getRandomReceiver(); - } else if (target.contains("server-")) { //todo In the future, allow redis messages to execute without a player online. For now it's duplicating the behaviour of plugin messages for consistency. - if (target.split("-")[1].equalsIgnoreCase(HuskHomes.getSettings().getServerID())) { - receiver = getRandomReceiver(); - } else { - return; // The message was targeting another server; ignore - } - } - - // Return if the target is not available - if (receiver == null) { - return; - } - if (!receiver.isOnline()) { - return; - } - - final String messageData = splitMessage[1]; - CrossServerMessageHandler.handlePluginMessage(new RedisMessage(clusterID, receiver.getName(), messageType, messageData), receiver); - } - }, REDIS_CHANNEL); - } catch (Exception e) { - plugin.getLogger().log(Level.SEVERE, "An exception occurred in the Jedis subscriber", e); - } - }, "Redis Subscriber").start(); - } -} diff --git a/src/main/java/me/william278/huskhomes2/data/sql/Database.java b/src/main/java/me/william278/huskhomes2/data/sql/Database.java deleted file mode 100644 index 9b093729..00000000 --- a/src/main/java/me/william278/huskhomes2/data/sql/Database.java +++ /dev/null @@ -1,30 +0,0 @@ -package me.william278.huskhomes2.data.sql; - -import me.william278.huskhomes2.HuskHomes; - -import java.sql.Connection; -import java.sql.SQLException; - -public abstract class Database { - protected HuskHomes plugin; - - public final static String DATA_POOL_NAME = "HuskHomesHikariPool"; - - public Database(HuskHomes instance) { - plugin = instance; - } - - public abstract Connection getConnection() throws SQLException; - - public abstract void load(); - - public abstract void backup(); - - public abstract void close(); - - public final int hikariMaximumPoolSize = HuskHomes.getSettings().getHikariMaximumPoolSize(); - public final int hikariMinimumIdle = HuskHomes.getSettings().getHikariMinimumIdle(); - public final long hikariMaximumLifetime = HuskHomes.getSettings().getHikariMaximumLifetime(); - public final long hikariKeepAliveTime = HuskHomes.getSettings().getHikariKeepAliveTime(); - public final long hikariConnectionTimeOut = HuskHomes.getSettings().getHikariConnectionTimeOut(); -} diff --git a/src/main/java/me/william278/huskhomes2/data/sql/MySQL.java b/src/main/java/me/william278/huskhomes2/data/sql/MySQL.java deleted file mode 100644 index a21f9e9e..00000000 --- a/src/main/java/me/william278/huskhomes2/data/sql/MySQL.java +++ /dev/null @@ -1,126 +0,0 @@ -package me.william278.huskhomes2.data.sql; - -import com.zaxxer.hikari.HikariDataSource; -import me.william278.huskhomes2.HuskHomes; - -import java.sql.Connection; -import java.sql.SQLException; -import java.sql.Statement; -import java.util.logging.Level; - -public class MySQL extends Database { - - final static String[] SQL_SETUP_STATEMENTS = { - "CREATE TABLE IF NOT EXISTS " + HuskHomes.getSettings().getLocationsDataTable() + " (" + - "`location_id` integer AUTO_INCREMENT," + - "`server` text NOT NULL," + - "`world` text NOT NULL," + - "`x` double NOT NULL," + - "`y` double NOT NULL," + - "`z` double NOT NULL," + - "`yaw` float NOT NULL," + - "`pitch` float NOT NULL," + - - "PRIMARY KEY (`location_id`)" + - ");", - - "CREATE TABLE IF NOT EXISTS " + HuskHomes.getSettings().getPlayerDataTable() + " (" + - "`player_id` integer AUTO_INCREMENT," + - "`user_uuid` char(36) NOT NULL UNIQUE," + - "`username` varchar(16) NOT NULL," + - "`home_slots` integer NOT NULL," + - "`rtp_cooldown` integer NOT NULL DEFAULT 0," + - "`is_teleporting` boolean NOT NULL DEFAULT 0," + - "`dest_location_id` integer NULL," + - "`last_location_id` integer NULL," + - "`offline_location_id` integer NULL," + - "`is_ignoring_requests` boolean NOT NULL DEFAULT 0," + - - "PRIMARY KEY (`player_id`)," + - "FOREIGN KEY (`offline_location_id`) REFERENCES " + HuskHomes.getSettings().getLocationsDataTable() + " (`location_id`) ON DELETE SET NULL ON UPDATE NO ACTION," + - "FOREIGN KEY (`dest_location_id`) REFERENCES " + HuskHomes.getSettings().getLocationsDataTable() + " (`location_id`) ON DELETE SET NULL ON UPDATE NO ACTION," + - "FOREIGN KEY (`last_location_id`) REFERENCES " + HuskHomes.getSettings().getLocationsDataTable() + " (`location_id`) ON DELETE SET NULL ON UPDATE NO ACTION" + - ");", - - "CREATE TABLE IF NOT EXISTS " + HuskHomes.getSettings().getHomesDataTable() + " (" + - "`player_id` integer NOT NULL," + - "`location_id` integer NOT NULL," + - "`name` varchar(16) NOT NULL," + - "`description` varchar(255) NOT NULL," + - "`public` boolean NOT NULL," + - "`creation_time` timestamp NULL," + - "PRIMARY KEY (`player_id`, `name`)," + - "FOREIGN KEY (`player_id`) REFERENCES " + HuskHomes.getSettings().getPlayerDataTable() + " (`player_id`) ON DELETE CASCADE ON UPDATE NO ACTION," + - "FOREIGN KEY (`location_id`) REFERENCES " + HuskHomes.getSettings().getLocationsDataTable() + " (`location_id`) ON DELETE CASCADE ON UPDATE NO ACTION" + - ");", - - "CREATE TABLE IF NOT EXISTS " + HuskHomes.getSettings().getWarpsDataTable() + " (" + - "`location_id` integer NOT NULL," + - "`name` varchar(16) NOT NULL UNIQUE," + - "`description` varchar(255) NOT NULL," + - "`creation_time` timestamp NULL," + - "PRIMARY KEY (`location_id`)," + - "FOREIGN KEY (`location_id`) REFERENCES " + HuskHomes.getSettings().getLocationsDataTable() + " (`location_id`) ON DELETE CASCADE ON UPDATE NO ACTION" + - ");" - }; - - final String host = HuskHomes.getSettings().getMySQLHost(); - final int port = HuskHomes.getSettings().getMySQLPort(); - final String database = HuskHomes.getSettings().getMySQLDatabase(); - final String username = HuskHomes.getSettings().getMySQLUsername(); - final String password = HuskHomes.getSettings().getMySQLPassword(); - final String params = HuskHomes.getSettings().getMySQLParams(); - - private HikariDataSource dataSource; - - public MySQL(HuskHomes instance) { - super(instance); - } - - @Override - public Connection getConnection() throws SQLException { - return dataSource.getConnection(); - } - - @Override - public void load() { - // Create new HikariCP data source - final String jdbcUrl = "jdbc:mysql://" + host + ":" + port + "/" + database + params; - dataSource = new HikariDataSource(); - dataSource.setJdbcUrl(jdbcUrl); - - dataSource.setUsername(username); - dataSource.setPassword(password); - - // Set various additional parameters - dataSource.setMaximumPoolSize(hikariMaximumPoolSize); - dataSource.setMinimumIdle(hikariMinimumIdle); - dataSource.setMaxLifetime(hikariMaximumLifetime); - dataSource.setKeepaliveTime(hikariKeepAliveTime); - dataSource.setConnectionTimeout(hikariConnectionTimeOut); - dataSource.setPoolName(DATA_POOL_NAME); - - // Create tables - try (Connection connection = dataSource.getConnection()) { - try (Statement statement = connection.createStatement()) { - for (String tableCreationStatement : SQL_SETUP_STATEMENTS) { - statement.execute(tableCreationStatement); - } - } - } catch (SQLException e) { - plugin.getLogger().log(Level.SEVERE, "An error occurred creating tables on the MySQL database: ", e); - } - } - - @Override - public void close() { - if (dataSource != null) { - dataSource.close(); - } - } - - @Override - public void backup() { - plugin.getLogger().info("Remember to make backups of your HuskHomes Database before updating the plugin!"); - } -} diff --git a/src/main/java/me/william278/huskhomes2/data/sql/SQLite.java b/src/main/java/me/william278/huskhomes2/data/sql/SQLite.java deleted file mode 100644 index be9a07fe..00000000 --- a/src/main/java/me/william278/huskhomes2/data/sql/SQLite.java +++ /dev/null @@ -1,158 +0,0 @@ -package me.william278.huskhomes2.data.sql; - -import com.zaxxer.hikari.HikariDataSource; -import me.william278.huskhomes2.HuskHomes; - -import java.io.File; -import java.io.IOException; -import java.nio.file.Files; -import java.nio.file.StandardCopyOption; -import java.sql.Connection; -import java.sql.SQLException; -import java.sql.Statement; -import java.time.Instant; -import java.time.ZoneId; -import java.time.format.DateTimeFormatter; -import java.util.Locale; -import java.util.logging.Level; - -public class SQLite extends Database { - - final static String[] SQL_SETUP_STATEMENTS = { - "PRAGMA foreign_keys = ON;", - "PRAGMA encoding = 'UTF-8';", - - "CREATE TABLE IF NOT EXISTS " + HuskHomes.getSettings().getLocationsDataTable() + " (" + - "`location_id` integer PRIMARY KEY," + - "`server` text NOT NULL," + - "`world` text NOT NULL," + - "`x` double NOT NULL," + - "`y` double NOT NULL," + - "`z` double NOT NULL," + - "`yaw` float NOT NULL," + - "`pitch` float NOT NULL" + - ");", - - "CREATE TABLE IF NOT EXISTS " + HuskHomes.getSettings().getPlayerDataTable() + " (" + - "`player_id` integer NOT NULL," + - "`user_uuid` char(36) NOT NULL UNIQUE," + - "`username` varchar(16) NOT NULL," + - "`home_slots` integer NOT NULL," + - "`rtp_cooldown` integer NOT NULL DEFAULT 0," + - "`is_teleporting` boolean NOT NULL DEFAULT 0," + - "`dest_location_id` integer NULL," + - "`last_location_id` integer NULL," + - "`offline_location_id` integer NULL," + - "`is_ignoring_requests` boolean NOT NULL DEFAULT 0," + - "PRIMARY KEY (`player_id`)," + - "FOREIGN KEY (`offline_location_id`) REFERENCES " + HuskHomes.getSettings().getLocationsDataTable() + " (`location_id`) ON DELETE SET NULL ON UPDATE NO ACTION," + - "FOREIGN KEY (`dest_location_id`) REFERENCES " + HuskHomes.getSettings().getLocationsDataTable() + " (`location_id`) ON DELETE SET NULL ON UPDATE NO ACTION," + - "FOREIGN KEY (`last_location_id`) REFERENCES " + HuskHomes.getSettings().getLocationsDataTable() + " (`location_id`) ON DELETE SET NULL ON UPDATE NO ACTION" + - ");", - - "CREATE TABLE IF NOT EXISTS " + HuskHomes.getSettings().getHomesDataTable() + " (" + - "`player_id` integer NOT NULL," + - "`location_id` integer NOT NULL," + - "`name` varchar(16) NOT NULL," + - "`description` varchar(255) NOT NULL," + - "`public` boolean NOT NULL," + - "`creation_time` timestamp NULL," + - "PRIMARY KEY (`player_id`, `name`)," + - "FOREIGN KEY (`player_id`) REFERENCES " + HuskHomes.getSettings().getPlayerDataTable() + " (`player_id`) ON DELETE CASCADE ON UPDATE NO ACTION," + - "FOREIGN KEY (`location_id`) REFERENCES " + HuskHomes.getSettings().getLocationsDataTable() + " (`location_id`) ON DELETE CASCADE ON UPDATE NO ACTION" + - ");", - - "CREATE TABLE IF NOT EXISTS " + HuskHomes.getSettings().getWarpsDataTable() + " (" + - "`location_id` integer NOT NULL," + - "`name` varchar(16) NOT NULL UNIQUE," + - "`description` varchar(255) NOT NULL," + - "`creation_time` timestamp NULL," + - "PRIMARY KEY (`location_id`)," + - "FOREIGN KEY (`location_id`) REFERENCES " + HuskHomes.getSettings().getLocationsDataTable() + " (`location_id`) ON DELETE CASCADE ON UPDATE NO ACTION" + - ");" - }; - - private static final String DATABASE_NAME = "HuskHomesData"; - - private HikariDataSource dataSource; - - public SQLite(HuskHomes instance) { - super(instance); - } - - // Create the database file if it does not exist yet - private void createDatabaseFileIfNotExist() { - File databaseFile = new File(plugin.getDataFolder(), DATABASE_NAME + ".db"); - if (!databaseFile.exists()) { - try { - if (!databaseFile.createNewFile()) { - plugin.getLogger().log(Level.SEVERE, "Failed to write new file: " + DATABASE_NAME + ".db (file already exists)"); - } - } catch (IOException e) { - plugin.getLogger().log(Level.SEVERE, "An error occurred writing a file: " + DATABASE_NAME + ".db (" + e.getCause() + ")"); - } - } - } - - @Override - public Connection getConnection() throws SQLException { - return dataSource.getConnection(); - } - - @Override - public void load() { - // Make SQLite database file - createDatabaseFileIfNotExist(); - - // Create new HikariCP data source - final String jdbcUrl = "jdbc:sqlite:" + plugin.getDataFolder().getAbsolutePath() + "/" + DATABASE_NAME + ".db"; - dataSource = new HikariDataSource(); - dataSource.setJdbcUrl(jdbcUrl); - - // Set various additional parameters - dataSource.setMaximumPoolSize(hikariMaximumPoolSize); - dataSource.setMinimumIdle(hikariMinimumIdle); - dataSource.setMaxLifetime(hikariMaximumLifetime); - dataSource.setKeepaliveTime(hikariKeepAliveTime); - dataSource.setConnectionTimeout(hikariConnectionTimeOut); - dataSource.setPoolName(DATA_POOL_NAME); - - // Create tables - try (Connection connection = dataSource.getConnection()) { - try (Statement statement = connection.createStatement()) { - for (String tableCreationStatement : SQL_SETUP_STATEMENTS) { - statement.execute(tableCreationStatement); - } - } - } catch (SQLException e) { - plugin.getLogger().log(Level.SEVERE, "An error occurred creating tables on the SQLite database: ", e); - } - } - - @Override - public void close() { - if (dataSource != null) { - dataSource.close(); - } - } - - @Override - public void backup() { - final String BACKUPS_FOLDER_NAME = "database-backups"; - final String backupFileName = DATABASE_NAME + "Backup_" + DateTimeFormatter.ofPattern("yyyy-MM-dd_HH-mm-ss-SS") - .withLocale(Locale.getDefault()) - .withZone(ZoneId.systemDefault()) - .format(Instant.now()).replaceAll(" ", "-") + ".db"; - final File databaseFile = new File(plugin.getDataFolder(), DATABASE_NAME + ".db"); - if (new File(plugin.getDataFolder(), BACKUPS_FOLDER_NAME).mkdirs()) { - plugin.getLogger().info("Created backups directory in HuskHomes plugin data folder."); - } - final File backUpFile = new File(plugin.getDataFolder(), BACKUPS_FOLDER_NAME + File.separator + backupFileName); - try { - Files.copy(databaseFile.toPath(), backUpFile.toPath(), StandardCopyOption.REPLACE_EXISTING); - plugin.getLogger().info("Created a backup of your database."); - } catch (IOException iox) { - plugin.getLogger().log(Level.WARNING, "An error occurred making a database backup", iox); - } - } -} diff --git a/src/main/java/me/william278/huskhomes2/integrations/VanishChecker.java b/src/main/java/me/william278/huskhomes2/integrations/VanishChecker.java deleted file mode 100644 index 7e4666b2..00000000 --- a/src/main/java/me/william278/huskhomes2/integrations/VanishChecker.java +++ /dev/null @@ -1,18 +0,0 @@ -package me.william278.huskhomes2.integrations; - -import me.william278.huskhomes2.HuskHomes; -import org.bukkit.entity.Player; -import org.bukkit.metadata.MetadataValue; - -public class VanishChecker { - - public static boolean isVanished(Player player) { - if (HuskHomes.getSettings().isCheckVanishedPlayers()) { - for (MetadataValue meta : player.getMetadata("vanished")) { - if (meta.asBoolean()) return true; - } - } - return false; - } - -} diff --git a/src/main/java/me/william278/huskhomes2/integrations/VaultIntegration.java b/src/main/java/me/william278/huskhomes2/integrations/VaultIntegration.java deleted file mode 100644 index a7423c2d..00000000 --- a/src/main/java/me/william278/huskhomes2/integrations/VaultIntegration.java +++ /dev/null @@ -1,38 +0,0 @@ -package me.william278.huskhomes2.integrations; - -import me.william278.huskhomes2.HuskHomes; -import net.milkbowl.vault.economy.Economy; -import org.bukkit.entity.Player; -import org.bukkit.plugin.RegisteredServiceProvider; - -public class VaultIntegration { - private static Economy economy = null; - private static final HuskHomes plugin = HuskHomes.getInstance(); - - public static void initializeEconomy() { - RegisteredServiceProvider economyProvider = - plugin.getServer().getServicesManager().getRegistration(net.milkbowl.vault.economy.Economy.class); - if (economyProvider != null) { - economy = economyProvider.getProvider(); - } - } - - public static String format(double monetaryValue) { - return economy.format(monetaryValue); - } - - public static boolean hasMoney(Player p, Double amount) { - Economy e = economy; - return e.getBalance(p) >= amount; - } - - public static boolean takeMoney(Player p, Double amount) { - Economy e = economy; - if (e.getBalance(p) >= amount) { - e.withdrawPlayer(p, amount); - return true; - } else { - return false; - } - } -} diff --git a/src/main/java/me/william278/huskhomes2/integrations/map/BlueMap.java b/src/main/java/me/william278/huskhomes2/integrations/map/BlueMap.java deleted file mode 100644 index 6c212481..00000000 --- a/src/main/java/me/william278/huskhomes2/integrations/map/BlueMap.java +++ /dev/null @@ -1,199 +0,0 @@ -package me.william278.huskhomes2.integrations.map; - -import de.bluecolored.bluemap.api.BlueMapAPI; -import de.bluecolored.bluemap.api.BlueMapMap; -import de.bluecolored.bluemap.api.marker.*; -import me.william278.huskhomes2.HuskHomes; -import me.william278.huskhomes2.data.DataManager; -import me.william278.huskhomes2.teleport.points.Home; -import me.william278.huskhomes2.teleport.points.Warp; -import org.bukkit.Bukkit; -import org.bukkit.World; - -import java.io.IOException; -import java.sql.Connection; -import java.sql.SQLException; -import java.util.HashMap; -import java.util.logging.Level; - -public class BlueMap extends Map { - - private static final HuskHomes plugin = HuskHomes.getInstance(); - private static final HashMap queuedWarps = new HashMap<>(); - private static final HashMap queuedPublicHomes = new HashMap<>(); - private static String warpMarkerImageAddress; - private static String publicHomeMarkerImageAddress; - - private void executeQueuedOperations() { - try (Connection connection = HuskHomes.getConnection()) { - for (String warpName : queuedWarps.keySet()) { - boolean add = queuedWarps.get(warpName); - if (add) { - Warp warpToAdd = DataManager.getWarp(warpName, connection); - if (warpToAdd != null) { - addWarpMarker(warpToAdd); - } - } else { - removeWarpMarker(warpName); - } - } - for (String fullHomeName : queuedPublicHomes.keySet()) { - boolean add = queuedPublicHomes.get(fullHomeName); - String ownerName = fullHomeName.split("\\.")[0]; - String homeName = fullHomeName.split("\\.")[1]; - if (add) { - Home homeToAdd = DataManager.getHome(ownerName, homeName, connection); - if (homeToAdd != null) { - addPublicHomeMarker(homeToAdd); - } - } else { - removePublicHomeMarker(homeName, ownerName); - } - } - } catch (SQLException e) { - plugin.getLogger().log(Level.WARNING, "An SQL exception occurred retrieving warp and home data when updating the BlueMap.", e); - } - } - - @Override - public void addWarpMarker(Warp warp) { - World world = warp.getLocation().getWorld(); - if (world == null) { - return; - } - Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> BlueMapAPI.getInstance().ifPresentOrElse(api -> { - try { - MarkerAPI markerAPI = api.getMarkerAPI(); - markerAPI.getMarkerSet(WARPS_MARKER_SET_ID).ifPresent(markerSet -> api.getWorld(world.getUID()).ifPresent(blueMapWorld -> { - String markerId = getWarpMarkerName(warp.getName()); - for (BlueMapMap map : blueMapWorld.getMaps()) { - POIMarker marker = markerSet.createPOIMarker(markerId, map, warp.getX(), warp.getY(), warp.getZ()); - marker.setLabel(getWarpInfoMenu(warp)); - if (warpMarkerImageAddress != null) { - marker.setIcon(warpMarkerImageAddress, marker.getAnchor()); - } - } - try { - markerAPI.save(); - } catch (IOException ignored) { - } - })); - } catch (IOException ignored) { - } - }, () -> queuedWarps.put(warp.getName(), true))); - } - - @Override - public void removeWarpMarker(String warpName) { - Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> { - // Remove the marker - BlueMapAPI.getInstance().ifPresentOrElse(api -> { - try { - MarkerAPI markerAPI = api.getMarkerAPI(); - markerAPI.getMarkerSet(WARPS_MARKER_SET_ID).ifPresent(markerSet -> { - String markerId = getWarpMarkerName(warpName); - markerSet.removeMarker(markerId); - try { - markerAPI.save(); - } catch (IOException ignored) { - } - }); - } catch (IOException ignored) { - } - }, () -> queuedWarps.put(warpName, false)); - }); - } - - @Override - public void addPublicHomeMarker(Home home) { - World world = home.getLocation().getWorld(); - if (world == null) { - return; - } - Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> BlueMapAPI.getInstance().ifPresentOrElse(api -> { - try { - MarkerAPI markerAPI = api.getMarkerAPI(); - markerAPI.getMarkerSet(PUBLIC_HOMES_MARKER_SET_ID).ifPresent(markerSet -> api.getWorld(world.getUID()).ifPresent(blueMapWorld -> { - String markerId = getPublicHomeMarkerName(home.getOwnerUsername(), home.getName()); - for (BlueMapMap map : blueMapWorld.getMaps()) { - POIMarker marker = markerSet.createPOIMarker(markerId, map, home.getX(), home.getY(), home.getZ()); - marker.setLabel(getPublicHomeInfoMenu(home)); - if (publicHomeMarkerImageAddress != null) { - marker.setIcon(publicHomeMarkerImageAddress, marker.getAnchor()); - } - } - try { - markerAPI.save(); - } catch (IOException ignored) { - } - })); - } catch (IOException ignored) { - } - }, () -> queuedPublicHomes.put(home.getOwnerUsername() + "." + home.getName(), true))); - } - - @Override - public void removePublicHomeMarker(String homeName, String ownerName) { - Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> { - // Remove the marker - BlueMapAPI.getInstance().ifPresentOrElse(api -> { - try { - MarkerAPI markerAPI = api.getMarkerAPI(); - markerAPI.getMarkerSet(PUBLIC_HOMES_MARKER_SET_ID).ifPresent(markerSet -> { - String markerId = getPublicHomeMarkerName(ownerName, homeName); - markerSet.removeMarker(markerId); - try { - markerAPI.save(); - } catch (IOException ignored) { - } - }); - } catch (IOException ignored) { - } - }, () -> queuedPublicHomes.put(ownerName + "." + homeName, false)); - }); - } - - @Override - public void initialize() { - plugin.getLogger().info("Initializing BlueMap integration"); - Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> { - try (Connection connection = HuskHomes.getConnection()) { - for (Home home : DataManager.getPublicHomes(connection)) { - if (!HuskHomes.getSettings().doBungee() || home.getServer().equals(HuskHomes.getSettings().getServerID())) { - addPublicHomeMarker(home); - } - } - for (Warp warp : DataManager.getWarps(connection)) { - if (!HuskHomes.getSettings().doBungee() || warp.getServer().equals(HuskHomes.getSettings().getServerID())) { - addWarpMarker(warp); - } - } - } catch (SQLException e) { - plugin.getLogger().log(Level.WARNING, "An SQL exception occurred initialising homes and warps onto the BlueMap"); - } - - // Create Marker Set - BlueMapAPI.onEnable(api -> { - try { - publicHomeMarkerImageAddress = api.createImage(getPublicHomeIcon(), "huskhomes/" + PUBLIC_HOME_MARKER_IMAGE_NAME); - warpMarkerImageAddress = api.createImage(getWarpIcon(), "huskhomes/" + WARP_MARKER_IMAGE_NAME); - - MarkerAPI markerAPI = api.getMarkerAPI(); - - MarkerSet publicHomeMarkerSet = markerAPI.getMarkerSet(PUBLIC_HOMES_MARKER_SET_ID).orElse(markerAPI.createMarkerSet(PUBLIC_HOMES_MARKER_SET_ID)); - publicHomeMarkerSet.setLabel(HuskHomes.getSettings().getMapPublicHomeMarkerSet()); - - MarkerSet warpsMarkerSet = markerAPI.getMarkerSet(WARPS_MARKER_SET_ID).orElse(markerAPI.createMarkerSet(WARPS_MARKER_SET_ID)); - warpsMarkerSet.setLabel(HuskHomes.getSettings().getMapWarpMarkerSet()); - - markerAPI.save(); - plugin.getLogger().info("Enabled BlueMap integration!"); - - executeQueuedOperations(); - } catch (IOException e) { - plugin.getLogger().warning("An exception occurred initialising BlueMap."); - } - }); - }); - } -} diff --git a/src/main/java/me/william278/huskhomes2/integrations/map/DynMap.java b/src/main/java/me/william278/huskhomes2/integrations/map/DynMap.java deleted file mode 100644 index 8f8d36a9..00000000 --- a/src/main/java/me/william278/huskhomes2/integrations/map/DynMap.java +++ /dev/null @@ -1,151 +0,0 @@ -package me.william278.huskhomes2.integrations.map; - -import me.william278.huskhomes2.HuskHomes; -import me.william278.huskhomes2.data.DataManager; -import me.william278.huskhomes2.teleport.points.Home; -import me.william278.huskhomes2.teleport.points.Warp; -import org.bukkit.Bukkit; -import org.bukkit.plugin.Plugin; -import org.dynmap.DynmapAPI; -import org.dynmap.markers.Marker; -import org.dynmap.markers.MarkerIcon; -import org.dynmap.markers.MarkerSet; - -import javax.imageio.ImageIO; -import java.awt.geom.AffineTransform; -import java.awt.image.AffineTransformOp; -import java.awt.image.BufferedImage; -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.sql.Connection; -import java.sql.SQLException; -import java.util.Set; -import java.util.logging.Level; - -public class DynMap extends Map { - - private static Plugin dynMap; - private static final HuskHomes plugin = HuskHomes.getInstance(); - private static final double MARKER_ICON_SCALE = 0.5; - - // Returns the marker icons from the plugin resources in the correct format and scaled to look good with DynMap - private InputStream getScaledMarkerIconStream(BufferedImage image) { - try { - BufferedImage scaledImage = new BufferedImage((int)(32 * MARKER_ICON_SCALE), (int)(32 * MARKER_ICON_SCALE), BufferedImage.TYPE_INT_ARGB); - AffineTransform scaleInstance = AffineTransform.getScaleInstance(MARKER_ICON_SCALE, MARKER_ICON_SCALE); - AffineTransformOp scaleOp = new AffineTransformOp(scaleInstance, AffineTransformOp.TYPE_NEAREST_NEIGHBOR); - scaleOp.filter(image, scaledImage); - ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); - ImageIO.write(scaledImage, "png", outputStream); - return new ByteArrayInputStream(outputStream.toByteArray()); - } catch (IOException e) { - plugin.getLogger().log(Level.SEVERE, "An exception occurred converting marker icon image data!", e); - return null; - } - } - - @Override - public void removeWarpMarker(String warpName) { - String markerId = getWarpMarkerName(warpName); - DynmapAPI dynmapAPI = (DynmapAPI) dynMap; - - MarkerSet markerSet = dynmapAPI.getMarkerAPI().getMarkerSet("huskhomes.warps"); - for (Marker m : markerSet.getMarkers()) { - if (m.getMarkerID().equals(markerId)) { - m.deleteMarker(); - } - } - } - - @Override - public void removePublicHomeMarker(String homeName, String ownerName) { - String markerId = getPublicHomeMarkerName(ownerName, homeName); - DynmapAPI dynmapAPI = (DynmapAPI) dynMap; - - MarkerSet markerSet = dynmapAPI.getMarkerAPI().getMarkerSet("huskhomes.public_homes"); - for (Marker m : markerSet.getMarkers()) { - if (m.getMarkerID().equals(markerId)) { - m.deleteMarker(); - } - } - } - - @Override - public void addWarpMarker(Warp warp) { - try { - String markerId = getWarpMarkerName(warp.getName()); - DynmapAPI dynmapAPI = (DynmapAPI) dynMap; - - MarkerSet markerSet = dynmapAPI.getMarkerAPI().getMarkerSet(WARPS_MARKER_SET_ID); - Marker m = markerSet.createMarker(markerId, warp.getName(), warp.getWorldName(), warp.getX(), warp.getY(), warp.getZ(), dynmapAPI.getMarkerAPI().getMarkerIcon(WARP_MARKER_IMAGE_NAME), false); - - m.setDescription(getWarpInfoMenu(warp)); - } catch (Exception e) { - plugin.getLogger().severe("Error adding warp marker to the Dynamic Map (" + e.getCause() + ")"); - plugin.getLogger().warning("This may be because you reloaded the server instead of restarting!"); - } - } - - @Override - public void addPublicHomeMarker(Home home) { - try { - String markerId = getPublicHomeMarkerName(home.getOwnerUsername(), home.getName()); - DynmapAPI dynmapAPI = (DynmapAPI) dynMap; - - MarkerSet markerSet = dynmapAPI.getMarkerAPI().getMarkerSet(PUBLIC_HOMES_MARKER_SET_ID); - Marker m = markerSet.createMarker(markerId, home.getName(), home.getWorldName(), home.getX(), home.getY(), home.getZ(), dynmapAPI.getMarkerAPI().getMarkerIcon(PUBLIC_HOME_MARKER_IMAGE_NAME), false); - - m.setDescription(getPublicHomeInfoMenu(home)); - } catch (Exception e) { - plugin.getLogger().severe("Error adding public home marker to the Dynamic Map (" + e.getCause() + ")"); - plugin.getLogger().warning("This may be because you reloaded the server instead of restarting!"); - } - } - - @Override - public void initialize() { - dynMap = plugin.getServer().getPluginManager().getPlugin("dynmap"); - plugin.getLogger().info("Initializing Dynmap integration"); - DynmapAPI dynmapAPI = (DynmapAPI) dynMap; - - if (dynmapAPI == null) { - return; - } - - final Set markerIconSet = dynmapAPI.getMarkerAPI().getMarkerIcons(); - for (MarkerIcon icon : markerIconSet) { - if (icon.getMarkerIconID().equals(WARP_MARKER_IMAGE_NAME) || icon.getMarkerIconID().equalsIgnoreCase(PUBLIC_HOME_MARKER_IMAGE_NAME)) { - dynmapAPI.getMarkerAPI().getMarkerIcons().remove(icon); - } - } - dynmapAPI.getMarkerAPI().createMarkerIcon(WARP_MARKER_IMAGE_NAME, "Warp", getScaledMarkerIconStream(getWarpIcon())); - dynmapAPI.getMarkerAPI().createMarkerIcon(PUBLIC_HOME_MARKER_IMAGE_NAME, "Public Home", getScaledMarkerIconStream(getPublicHomeIcon())); - - Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> { - try (Connection connection = HuskHomes.getConnection()) { - if (HuskHomes.getSettings().showPublicHomesOnMap()) { - dynmapAPI.getMarkerAPI().createMarkerSet(PUBLIC_HOMES_MARKER_SET_ID, HuskHomes.getSettings().getMapPublicHomeMarkerSet(), dynmapAPI.getMarkerAPI().getMarkerIcons(), false); - for (Home home : DataManager.getPublicHomes(connection)) { - if (!HuskHomes.getSettings().doBungee() || home.getServer().equals(HuskHomes.getSettings().getServerID())) { - Bukkit.getScheduler().runTask(plugin, () -> addPublicHomeMarker(home)); - } - } - } - if (HuskHomes.getSettings().showWarpsOnMap()) { - dynmapAPI.getMarkerAPI().createMarkerSet(WARPS_MARKER_SET_ID, HuskHomes.getSettings().getMapWarpMarkerSet(), dynmapAPI.getMarkerAPI().getMarkerIcons(), false); - for (Warp warp : DataManager.getWarps(connection)) { - if (!HuskHomes.getSettings().doBungee() || warp.getServer().equals(HuskHomes.getSettings().getServerID())) { - Bukkit.getScheduler().runTask(plugin, () -> addWarpMarker(warp)); - } - } - } - } catch (SQLException e) { - plugin.getLogger().log(Level.WARNING, "An SQL exception occurred adding homes and warps to the DynMap", e); - } - }); - - } - -} diff --git a/src/main/java/me/william278/huskhomes2/integrations/map/Map.java b/src/main/java/me/william278/huskhomes2/integrations/map/Map.java deleted file mode 100644 index 4febd662..00000000 --- a/src/main/java/me/william278/huskhomes2/integrations/map/Map.java +++ /dev/null @@ -1,84 +0,0 @@ -package me.william278.huskhomes2.integrations.map; - -import me.william278.huskhomes2.HuskHomes; -import me.william278.huskhomes2.teleport.points.Home; -import me.william278.huskhomes2.teleport.points.Warp; - -import javax.imageio.ImageIO; -import java.awt.image.BufferedImage; -import java.io.File; -import java.io.IOException; -import java.util.logging.Level; - -import static org.apache.commons.lang.StringEscapeUtils.escapeHtml; - -public abstract class Map { - - public Map() { - } - - private static final HuskHomes plugin = HuskHomes.getInstance(); - - public static final String PUBLIC_HOMES_MARKER_SET_ID = "huskhomes.public_homes"; - public static final String WARPS_MARKER_SET_ID = "huskhomes.warps"; - - public static final String PUBLIC_HOME_MARKER_IMAGE_NAME = "public_home"; - public static final String WARP_MARKER_IMAGE_NAME = "warp"; - - public BufferedImage getWarpIcon() { - return getMarkerIcon(WARP_MARKER_IMAGE_NAME); - } - - public BufferedImage getPublicHomeIcon() { - return getMarkerIcon(PUBLIC_HOME_MARKER_IMAGE_NAME); - } - - private BufferedImage getMarkerIcon(String name) { - final String filePath = "marker-icons" + File.separator + name + ".png"; - File file = new File(plugin.getDataFolder(), filePath); - if (!file.exists()) { - plugin.saveResource(filePath, false); - } - BufferedImage image = null; - try { - image = ImageIO.read(file); - } catch (IOException e) { - plugin.getLogger().log(Level.SEVERE, "Failed to load " + name + " marker icon image!", e); - } - return image; - } - - public abstract void addWarpMarker(Warp warp); - - public abstract void removeWarpMarker(String warpName); - - public abstract void addPublicHomeMarker(Home home); - - public abstract void removePublicHomeMarker(String homeName, String ownerName); - - public abstract void initialize(); - - public String getPublicHomeMarkerName(String ownerName, String homeName) { - return PUBLIC_HOMES_MARKER_SET_ID + "." + ownerName + "." + homeName; - } - - public String getWarpMarkerName(String warpName) { - return WARPS_MARKER_SET_ID + "." + warpName; - } - - public String getWarpInfoMenu(Warp warp) { - String warpPopup = "
/warp %WARP_NAME%
Description: %DESCRIPTION%
"; - warpPopup = warpPopup.replace("%WARP_NAME%", escapeHtml(warp.getName())); - warpPopup = warpPopup.replace("%DESCRIPTION%", escapeHtml(warp.getDescription())); - return warpPopup; - } - - public String getPublicHomeInfoMenu(Home home) { - String publicHomePopup = "
/phome %OWNER%.%HOME_NAME%
Owner: %OWNER%
Description: %DESCRIPTION%
"; - publicHomePopup = publicHomePopup.replace("%HOME_NAME%", escapeHtml(home.getName())); - publicHomePopup = publicHomePopup.replace("%OWNER%", escapeHtml(home.getOwnerUsername())); - publicHomePopup = publicHomePopup.replace("%DESCRIPTION%", escapeHtml(home.getDescription())); - return publicHomePopup; - } - -} diff --git a/src/main/java/me/william278/huskhomes2/integrations/map/SquareMap.java b/src/main/java/me/william278/huskhomes2/integrations/map/SquareMap.java deleted file mode 100644 index 92694050..00000000 --- a/src/main/java/me/william278/huskhomes2/integrations/map/SquareMap.java +++ /dev/null @@ -1,207 +0,0 @@ -package me.william278.huskhomes2.integrations.map; - -import me.william278.huskhomes2.HuskHomes; -import me.william278.huskhomes2.data.DataManager; -import me.william278.huskhomes2.teleport.points.Home; -import me.william278.huskhomes2.teleport.points.Warp; -import org.bukkit.Bukkit; -import org.bukkit.World; -import org.bukkit.event.EventHandler; -import org.bukkit.event.Listener; -import org.bukkit.event.world.WorldLoadEvent; -import xyz.jpenilla.squaremap.api.*; -import xyz.jpenilla.squaremap.api.marker.Icon; -import xyz.jpenilla.squaremap.api.marker.Marker; -import xyz.jpenilla.squaremap.api.marker.MarkerOptions; - -import java.sql.Connection; -import java.sql.SQLException; -import java.util.HashMap; -import java.util.logging.Level; - -public class SquareMap extends Map { - - private final HashMap publicHomeProviders = new HashMap<>(); - private final HashMap warpProviders = new HashMap<>(); - private final static int MARKER_SIZE = 20; - private final static HuskHomes plugin = HuskHomes.getInstance(); - - @Override - public void addWarpMarker(Warp warp) { - World world = Bukkit.getWorld(warp.getWorldName()); - if (world != null) { - for (WorldIdentifier worldIdentifier : warpProviders.keySet()) { - if (worldIdentifier.value().equals(world.getName())) { - Icon marker = Marker.icon( - Point.of(warp.getX(), warp.getZ()), - Key.of(WARP_MARKER_IMAGE_NAME), - MARKER_SIZE); - marker.markerOptions(MarkerOptions.builder() - .hoverTooltip(warp.getName()) - .clickTooltip(getWarpInfoMenu(warp)) - .build()); - warpProviders.get(worldIdentifier).addMarker(Key.of(getWarpMarkerName(warp.getName())), marker); - break; - } - } - } - } - - @Override - public void removeWarpMarker(String warpName) { - final Key warpMarkerKey = Key.of(getWarpMarkerName(warpName)); - removeMarker(warpMarkerKey, warpProviders); - } - - @Override - public void addPublicHomeMarker(Home home) { - World world = Bukkit.getWorld(home.getWorldName()); - if (world != null) { - for (WorldIdentifier worldIdentifier : publicHomeProviders.keySet()) { - if (worldIdentifier.value().equals(world.getName())) { - Icon marker = Marker.icon( - Point.of(home.getX(), home.getZ()), - Key.of(PUBLIC_HOME_MARKER_IMAGE_NAME), - MARKER_SIZE); - marker.markerOptions(MarkerOptions.builder() - .hoverTooltip(home.getName()) - .clickTooltip(getPublicHomeInfoMenu(home)) - .build()); - publicHomeProviders.get(worldIdentifier).addMarker( - Key.of(getPublicHomeMarkerName(home.getOwnerUsername(), home.getName())), marker); - break; - } - } - } - } - - @Override - public void removePublicHomeMarker(String homeName, String ownerName) { - final Key publicHomeMarkerKey = Key.of(getPublicHomeMarkerName(ownerName, homeName)); - removeMarker(publicHomeMarkerKey, publicHomeProviders); - } - - @Override - public void initialize() { - Squaremap mapAPI = SquaremapProvider.get(); - plugin.getServer().getPluginManager().registerEvents(new SquareMapWorldLoadListener(), plugin); - plugin.getLogger().info("Initializing Squaremap integration"); - - final Key publicHomeMarkerIconKey = Key.of(PUBLIC_HOME_MARKER_IMAGE_NAME); - final Key warpMarkerIconKey = Key.of(WARP_MARKER_IMAGE_NAME); - - // Make sure markers are unregistered, then register marker icon keys - if (SquaremapProvider.get().iconRegistry().hasEntry(publicHomeMarkerIconKey)) { - SquaremapProvider.get().iconRegistry().unregister(publicHomeMarkerIconKey); - } - SquaremapProvider.get().iconRegistry().register(publicHomeMarkerIconKey, getPublicHomeIcon()); - if (SquaremapProvider.get().iconRegistry().hasEntry(warpMarkerIconKey)) { - SquaremapProvider.get().iconRegistry().unregister(warpMarkerIconKey); - } - SquaremapProvider.get().iconRegistry().register(warpMarkerIconKey, getWarpIcon()); - - for (MapWorld world : mapAPI.mapWorlds()) { - loadWorld(world); - } - - // Populate map with markers - Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> { - try (Connection connection = HuskHomes.getConnection()) { - if (HuskHomes.getSettings().showPublicHomesOnMap()) { - for (Home home : DataManager.getPublicHomes(connection)) { - if (!HuskHomes.getSettings().doBungee() || home.getServer().equals(HuskHomes.getSettings().getServerID())) { - Bukkit.getScheduler().runTask(plugin, () -> addPublicHomeMarker(home)); - } - } - } - if (HuskHomes.getSettings().showWarpsOnMap()) { - for (Warp warp : DataManager.getWarps(connection)) { - if (!HuskHomes.getSettings().doBungee() || warp.getServer().equals(HuskHomes.getSettings().getServerID())) { - Bukkit.getScheduler().runTask(plugin, () -> addWarpMarker(warp)); - } - } - } - } catch (SQLException e) { - plugin.getLogger().log(Level.WARNING, "An SQL exception occurred adding homes and warps to the Squaremap"); - } - }); - } - - // Removes a marker from the Squaremap Marker API - private void removeMarker(Key markerKey, HashMap layerProviders) { - WorldIdentifier markerWorld = null; - for (WorldIdentifier worldIdentifier : layerProviders.keySet()) { - SimpleLayerProvider warpProvider = layerProviders.get(worldIdentifier); - if (warpProvider.hasMarker(markerKey)) { - markerWorld = worldIdentifier; - break; - } - } - if (markerWorld != null) { - layerProviders.get(markerWorld).removeMarker(markerKey); - } - } - - // Loads the world - private void loadWorld(MapWorld world) { - // Register public home map layer - SimpleLayerProvider publicHomeProvider = - SimpleLayerProvider.builder(HuskHomes.getSettings().getMapPublicHomeMarkerSet()) - .showControls(true) - .defaultHidden(false) - .layerPriority(6) - .zIndex(250) - .build(); - world.layerRegistry().register(Key.of(PUBLIC_HOMES_MARKER_SET_ID), publicHomeProvider); - publicHomeProviders.put(world.identifier(), publicHomeProvider); - - // Register warps map layer - SimpleLayerProvider warpProvider = - SimpleLayerProvider.builder(HuskHomes.getSettings().getMapWarpMarkerSet()) - .showControls(true) - .defaultHidden(false) - .layerPriority(7) - .zIndex(250) - .build(); - world.layerRegistry().register(Key.of(WARPS_MARKER_SET_ID), warpProvider); - warpProviders.put(world.identifier(), warpProvider); - - } - - public class SquareMapWorldLoadListener implements Listener { - - @EventHandler - public void onWorldLoad(WorldLoadEvent e) { - Squaremap mapAPI = SquaremapProvider.get(); - mapAPI.getWorldIfEnabled(BukkitAdapter.worldIdentifier(e.getWorld())).ifPresent(SquareMap.this::loadWorld); - - // Populate map with markers - Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> { - try (Connection connection = HuskHomes.getConnection()) { - if (HuskHomes.getSettings().showPublicHomesOnMap()) { - for (Home home : DataManager.getPublicHomes(connection)) { - if (home.getWorldName().equals(e.getWorld().getName())) { - if (!HuskHomes.getSettings().doBungee() || home.getServer().equals(HuskHomes.getSettings().getServerID())) { - Bukkit.getScheduler().runTask(plugin, () -> addPublicHomeMarker(home)); - } - } - } - } - if (HuskHomes.getSettings().showWarpsOnMap()) { - for (Warp warp : DataManager.getWarps(connection)) { - if (warp.getWorldName().equals(e.getWorld().getName())) { - if (!HuskHomes.getSettings().doBungee() || warp.getServer().equals(HuskHomes.getSettings().getServerID())) { - Bukkit.getScheduler().runTask(plugin, () -> addWarpMarker(warp)); - } - } - } - } - } catch (SQLException exception) { - plugin.getLogger().log(Level.WARNING, "An SQL exception occurred adding homes and warps to the Squaremap"); - } - }); - } - - } - -} diff --git a/src/main/java/me/william278/huskhomes2/listeners/PlayerListener.java b/src/main/java/me/william278/huskhomes2/listeners/PlayerListener.java deleted file mode 100644 index 4e5e6fff..00000000 --- a/src/main/java/me/william278/huskhomes2/listeners/PlayerListener.java +++ /dev/null @@ -1,138 +0,0 @@ -package me.william278.huskhomes2.listeners; - -import me.william278.huskhomes2.HuskHomes; -import me.william278.huskhomes2.util.MessageManager; -import me.william278.huskhomes2.commands.HomeCommand; -import me.william278.huskhomes2.data.DataManager; -import me.william278.huskhomes2.teleport.TeleportManager; -import me.william278.huskhomes2.teleport.points.TeleportationPoint; -import org.bukkit.Bukkit; -import org.bukkit.Location; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.Listener; -import org.bukkit.event.entity.PlayerDeathEvent; -import org.bukkit.event.player.PlayerJoinEvent; -import org.bukkit.event.player.PlayerQuitEvent; - -import java.sql.Connection; -import java.sql.SQLException; -import java.util.UUID; -import java.util.logging.Level; - -public class PlayerListener implements Listener { - - private static final HuskHomes plugin = HuskHomes.getInstance(); - - @EventHandler - public void onPlayerDie(PlayerDeathEvent e) { - Player p = e.getEntity(); - if (p.hasPermission("huskhomes.back.death")) { - Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> { - try (Connection connection = HuskHomes.getConnection()) { - DataManager.setPlayerLastPosition(p, new TeleportationPoint(p.getLocation(), HuskHomes.getSettings().getServerID()), connection); - MessageManager.sendMessage(p, "return_by_death"); - } catch (SQLException sqlException) { - plugin.getLogger().log(Level.SEVERE, "An SQL error occurred updating the last position of a player when they died", sqlException); - } - }); - } - } - - @EventHandler - public void onPlayerJoin(PlayerJoinEvent e) { - Player p = e.getPlayer(); - - // Create player on SQL if they don't exist already - try { - Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> { - try (Connection connection = HuskHomes.getConnection()) { - if (!DataManager.playerExists(p, connection)) { - DataManager.createPlayer(p, connection); - if (TeleportManager.getSpawnLocation().isPresent()) { - teleportToSpawn(p); - return; - } - } else { - // Check if they've changed their name and update if so - DataManager.checkPlayerNameChange(p, connection); - - // Update their TAB cache for /home command - HomeCommand.Tab.updatePlayerHomeCache(p); - } - - final Boolean isIgnoringRequests = DataManager.isPlayerIgnoringRequests(p.getUniqueId(), connection); - if (isIgnoringRequests != null) { - if (isIgnoringRequests) { - HuskHomes.setIgnoringTeleportRequests(p.getUniqueId()); - MessageManager.sendMessage(p, "tpignore_on_reminder"); - } - } - - // If bungee mode, check if the player joined the server from a teleport and act accordingly - if (HuskHomes.getSettings().doBungee()) { - final Boolean isTeleporting = DataManager.isPlayerTeleporting(p.getUniqueId(), connection); - if (isTeleporting != null) { - if (isTeleporting) { - TeleportManager.teleportPlayer(p); - } else { - if (HuskHomes.getSettings().doForceSpawnOnLogin()) { - teleportToSpawn(p); - } - } - } - } else { - if (HuskHomes.getSettings().doForceSpawnOnLogin()) { - if (TeleportManager.getSpawnLocation().isPresent()) { - teleportToSpawn(p); - } - } - } - } catch (SQLException sqlException) { - plugin.getLogger().log(Level.SEVERE, "An SQL error handling a joining player", sqlException); - } - }); - } catch (NullPointerException ignored) { - } // Ignore NullPointerExceptions from players that execute this event and return null (e.g Citizens). - - // Update the player list - if (HuskHomes.getSettings().doBungee()) { - HuskHomes.getPlayerList().updateList(p); - } else { - if (Bukkit.getOnlinePlayers().size() == 1) { - HuskHomes.getPlayerList().updateList(p); - } else { - HuskHomes.getPlayerList().addPlayer(p.getName()); - } - } - } - - private void teleportToSpawn(Player player) { - TeleportManager.getSpawnLocation().ifPresent(teleportationPoint -> { - final Location spawnLocation = teleportationPoint.getLocation(); - if (spawnLocation.isWorldLoaded()) { - TeleportManager.teleportLocally(player, spawnLocation, false); - } - }); - } - - @EventHandler - public void onPlayerQuit(PlayerQuitEvent e) { - Player p = e.getPlayer(); - final UUID uuid = p.getUniqueId(); - if (!HuskHomes.isTeleporting(uuid)) { - final Location logOutLocation = p.getLocation(); - Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> { - try (Connection connection = HuskHomes.getConnection()) { - DataManager.setPlayerOfflinePosition(uuid, - new TeleportationPoint(logOutLocation, HuskHomes.getSettings().getServerID()), - connection); - } catch (SQLException ex) { - Bukkit.getLogger().severe("An SQL exception occurred in retrieving if a warp exists from the table."); - } - }); - } else { - HuskHomes.setNotTeleporting(uuid); - } - } -} diff --git a/src/main/java/me/william278/huskhomes2/migrators/EssentialsMigrator.java b/src/main/java/me/william278/huskhomes2/migrators/EssentialsMigrator.java deleted file mode 100644 index f9d6d313..00000000 --- a/src/main/java/me/william278/huskhomes2/migrators/EssentialsMigrator.java +++ /dev/null @@ -1,214 +0,0 @@ -package me.william278.huskhomes2.migrators; - -import me.william278.huskhomes2.HuskHomes; -import me.william278.huskhomes2.util.MessageManager; -import me.william278.huskhomes2.data.DataManager; -import me.william278.huskhomes2.teleport.SettingHandler; -import me.william278.huskhomes2.teleport.TeleportManager; -import me.william278.huskhomes2.teleport.points.Home; -import me.william278.huskhomes2.teleport.points.TeleportationPoint; -import me.william278.huskhomes2.teleport.points.Warp; -import org.bukkit.Bukkit; -import org.bukkit.Location; -import org.bukkit.World; -import org.bukkit.configuration.ConfigurationSection; -import org.bukkit.configuration.file.FileConfiguration; - -import java.io.File; -import java.sql.Connection; -import java.sql.SQLException; -import java.time.Instant; -import java.util.Set; -import java.util.UUID; -import java.util.logging.Level; - -import static org.bukkit.configuration.file.YamlConfiguration.loadConfiguration; - -public class EssentialsMigrator { - - private static final HuskHomes plugin = HuskHomes.getInstance(); - - public static void migrate() { - migrate(null, HuskHomes.getSettings().getServerID()); - } - - // Migrate data from EssentialsX - public static void migrate(final String worldFilter, final String targetServer) { - Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> { - HuskHomes.backupDatabase(); - final File essentialsDataFolder = new File(Bukkit.getWorldContainer() + File.separator + "plugins" + File.separator + "Essentials"); - - if (essentialsDataFolder.exists()) { - plugin.getLogger().info("Essentials plugin data found!"); - if (worldFilter != null) { - plugin.getLogger().info("Started Filtered Migration from EssentialsX:\n• World to migrate from: " + worldFilter + "\n• Target server: " + targetServer); - } else { - plugin.getLogger().info("Started Migration from EssentialsX...\n"); - } - - // Migrate user data - File essentialsPlayerDataFolder = new File(Bukkit.getWorldContainer() + File.separator + "plugins" + File.separator + "Essentials" + File.separator + "userdata"); - if (essentialsPlayerDataFolder.exists()) { - File[] playerFiles = essentialsPlayerDataFolder.listFiles(); - if (playerFiles != null) { - for (File playerFile : playerFiles) { - try { - final String fileName = playerFile.getName(); - final UUID playerUUID = UUID.fromString(fileName.substring(0, fileName.lastIndexOf("."))); - FileConfiguration playerFileConfig = loadConfiguration(playerFile); - final String playerName = playerFileConfig.getString("last-account-name", playerFileConfig.getString("lastAccountName")); - try { - try (Connection connection = HuskHomes.getConnection()) { - if (!DataManager.playerExists(playerUUID, connection)) { - DataManager.createPlayer(playerUUID, playerName, connection); - } - final ConfigurationSection homesSection = playerFileConfig.getConfigurationSection("homes"); - if (homesSection != null) { - Set essentialsHomes = homesSection.getKeys(false); - for (String homeName : essentialsHomes) { - try { - String worldID = playerFileConfig.getString("homes." + homeName + ".world", "world"); - try { - final UUID worldUUID = UUID.fromString(worldID); - final World world = Bukkit.getWorld(worldUUID); - if (world != null) { - worldID = world.getName(); - } else { - plugin.getLogger().warning("✖ Could not migrate " + homeName + " as the world value was a UUID and is not loaded on this server."); - continue; - } - } catch (IllegalArgumentException ignored) { } - if (worldFilter != null) { - if (!worldFilter.equalsIgnoreCase(worldID)) { - continue; - } - } - final double x = playerFileConfig.getDouble("homes." + homeName + ".x"); - final double y = playerFileConfig.getDouble("homes." + homeName + ".y"); - final double z = playerFileConfig.getDouble("homes." + homeName + ".z"); - final float pitch = (float) playerFileConfig.getDouble("homes." + homeName + ".pitch"); - final float yaw = (float) playerFileConfig.getDouble("homes." + homeName + ".yaw"); - final String homeDescription = MessageManager.getRawMessage("home_default_description", playerName); - - if (DataManager.homeExists(playerName, homeName, connection)) { - plugin.getLogger().warning("✖ Failed to migrate home " + homeName + " (Already exists!)"); - continue; - } - DataManager.addHome(new Home(new TeleportationPoint(worldID, x, y, z, yaw, pitch, targetServer), - playerName, playerUUID, homeName, homeDescription, false, Instant.now().getEpochSecond()), playerUUID, connection); - - plugin.getLogger().info("→ Migrated home " + homeName); - } catch (NullPointerException | IllegalArgumentException e) { - plugin.getLogger().warning("✖ Failed to migrate home " + homeName + "!"); - e.printStackTrace(); - } - } - } - } catch (SQLException e) { - plugin.getLogger().log(Level.SEVERE, "An SQL exception occurred migrating Essentials home data.", e); - } - - } catch (NullPointerException ignored) { } - } catch (IllegalArgumentException ignored) { } - } - } - } - - // Migrate warps - File essentialsWarpsFolder = new File(Bukkit.getWorldContainer() + File.separator + "plugins" + File.separator + "Essentials" + File.separator + "warps"); - if (essentialsWarpsFolder.exists()) { - final File[] warpFiles = essentialsWarpsFolder.listFiles(); - - if (warpFiles != null) { - for (File warpFile : warpFiles) { - try (Connection connection = HuskHomes.getConnection()) { - final FileConfiguration warpFileConfig = loadConfiguration(warpFile); - final String warpName = warpFileConfig.getString("name"); - String worldID = warpFileConfig.getString("world", "world"); - try { - final UUID worldUUID = UUID.fromString(worldID); - final World world = Bukkit.getWorld(worldUUID); - if (world != null) { - worldID = world.getName(); - } else { - plugin.getLogger().warning("✖ Could not migrate " + warpName + " as the world value was a UUID and is not loaded on this server."); - continue; - } - } catch (IllegalArgumentException ignored) { } - if (worldFilter != null) { - if (!worldFilter.equalsIgnoreCase(worldID)) { - continue; - } - } - final double x = warpFileConfig.getDouble("x"); - final double y = warpFileConfig.getDouble("y"); - final double z = warpFileConfig.getDouble("z"); - final float yaw = (float) warpFileConfig.getDouble("yaw"); - final float pitch = (float) warpFileConfig.getDouble("pitch"); - - if (DataManager.warpExists(warpName, connection)) { - plugin.getLogger().warning("✖ Failed to migrate warp " + warpName + " (Already exists!)"); - continue; - } - - DataManager.addWarp(new Warp(new TeleportationPoint(worldID, x, y, z, yaw, pitch, targetServer), - warpName, MessageManager.getRawMessage("warp_default_description"), Instant.now().getEpochSecond()), connection); - plugin.getLogger().info("→ Migrated warp " + warpName); - } catch (NullPointerException | IllegalArgumentException e) { - plugin.getLogger().warning("✖ Failed to migrate warp " + warpFile.getName()); - } catch (SQLException e) { - plugin.getLogger().log(Level.SEVERE, "An SQL exception occurred migrating Essentials warp data!", e); - return; - } - } - } - } - - // Migrate /spawn position - if (TeleportManager.getSpawnLocation() == null && HuskHomes.getSettings().doCrossServerSpawn()) { - File essentialsSpawnData = new File(Bukkit.getWorldContainer() + File.separator + "plugins" + File.separator + "Essentials" + File.separator + "spawn.yml"); - if (essentialsSpawnData.exists()) { - plugin.getLogger().info("Migrating /spawn position from Essentials..."); - - FileConfiguration spawnConfig = loadConfiguration(essentialsSpawnData); - try { - String worldID = spawnConfig.getString("spawns.all.world", "world"); - try { - final UUID worldUUID = UUID.fromString(worldID); - final World world = Bukkit.getWorld(worldUUID); - if (world != null) { - worldID = world.getName(); - } else { - plugin.getLogger().warning("✖ Could not migrate the spawn position as the world value was a UUID and is not loaded on this server."); - return; - } - } catch (IllegalArgumentException ignored) { } - if (worldFilter != null) { - if (!worldFilter.equalsIgnoreCase(worldID)) { - plugin.getLogger().warning("✖ Did not migrate the /spawn position as the world filter did not match."); - return; - } - } - final double x = spawnConfig.getDouble("spawns.all.x"); - final double y = spawnConfig.getDouble("spawns.all.y"); - final double z = spawnConfig.getDouble("spawns.all.z"); - final float yaw = (float) spawnConfig.getDouble("spawns.all.yaw"); - final float pitch = (float) spawnConfig.getDouble("spawns.all.pitch"); - - Location spawnLocation = new Location(Bukkit.getWorld(worldID), x, y, z, yaw, pitch); - SettingHandler.setSpawnLocation(spawnLocation); - plugin.getLogger().info("→ /spawn position has been migrated!\n"); - } catch (NullPointerException | IllegalArgumentException e) { - plugin.getLogger().warning("✖ Failed to migrate the /spawn position.\n"); - } - } - } else { - plugin.getLogger().info("✖ /spawn position migration from EssentialsX has been skipped as it has already been set or Cross Server Spawn has been enabled. Please re-set it again manually if you want."); - } - } else { - plugin.getLogger().warning("Failed to Migrate from Essentials!"); - Bukkit.getLogger().warning("Could not find Essentials plugin data to migrate!"); - } - }); - } -} diff --git a/src/main/java/me/william278/huskhomes2/migrators/UpgradeDatabase.java b/src/main/java/me/william278/huskhomes2/migrators/UpgradeDatabase.java deleted file mode 100644 index d81a5b9c..00000000 --- a/src/main/java/me/william278/huskhomes2/migrators/UpgradeDatabase.java +++ /dev/null @@ -1,117 +0,0 @@ -package me.william278.huskhomes2.migrators; - -import me.william278.huskhomes2.HuskHomes; -import org.checkerframework.checker.units.qual.C; - -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.SQLException; - -public class UpgradeDatabase { - - private static final HuskHomes plugin = HuskHomes.getInstance(); - - private static final String[] mySQLUpgradeStatements = { - "ALTER TABLE " + HuskHomes.getSettings().getPlayerDataTable() - + " ADD `is_ignoring_requests` boolean NOT NULL DEFAULT 0, " - + "ADD `offline_location_id` integer NULL DEFAULT NULL, " - + "ADD FOREIGN KEY (`offline_location_id`) REFERENCES " + HuskHomes.getSettings().getLocationsDataTable() + " (`location_id`) ON DELETE SET NULL ON UPDATE NO ACTION;"}; - - private static final String[] SQLiteUpgradeStatements = { - "ALTER TABLE " + HuskHomes.getSettings().getPlayerDataTable() + " ADD `is_ignoring_requests` boolean NOT NULL DEFAULT 0;", - - "ALTER TABLE " + HuskHomes.getSettings().getPlayerDataTable() + " ADD `offline_location_id` integer NULL DEFAULT NULL;", - - "CREATE TABLE " + HuskHomes.getSettings().getPlayerDataTable() + "_dg_tmp (" + - "`player_id` integer NOT NULL PRIMARY KEY," + - "`user_uuid` char(36) NOT NULL UNIQUE," + - "`username` varchar(16) NOT NULL," + - "`home_slots` integer NOT NULL," + - "`rtp_cooldown` integer NOT NULL," + - "`is_teleporting` boolean NOT NULL," + - "`dest_location_id` integer REFERENCES " + HuskHomes.getSettings().getLocationsDataTable() + " ON DELETE SET NULL," + - "`last_location_id` integer REFERENCES " + HuskHomes.getSettings().getLocationsDataTable() + " ON DELETE SET NULL," + - "`offline_location_id` integer DEFAULT NULL CONSTRAINT " + HuskHomes.getSettings().getPlayerDataTable() + "_" + HuskHomes.getSettings().getLocationsDataTable() + "_location_id_fk REFERENCES " + HuskHomes.getSettings().getLocationsDataTable() + "," + - "`is_ignoring_requests` boolean DEFAULT false NOT NULL" + - ");", - - "INSERT INTO " + HuskHomes.getSettings().getPlayerDataTable() + "_dg_tmp(player_id, user_uuid, username, home_slots, rtp_cooldown, is_teleporting, dest_location_id, last_location_id, offline_location_id, is_ignoring_requests) select player_id, user_uuid, username, home_slots, rtp_cooldown, is_teleporting, dest_location_id, last_location_id, offline_location_id, is_ignoring_requests FROM " + HuskHomes.getSettings().getPlayerDataTable() + ";", - - "PRAGMA foreign_keys = OFF;", - - "DROP TABLE " + HuskHomes.getSettings().getPlayerDataTable() + ";", - - "ALTER TABLE " + HuskHomes.getSettings().getPlayerDataTable() + "_dg_tmp RENAME TO " + HuskHomes.getSettings().getPlayerDataTable() + ";", - - "PRAGMA foreign_keys = ON;" - }; - - // Upgrade the database system if the config file version is not high enough - public static void upgradeDatabase() { - plugin.reloadConfig(); //todo fix broken upgrade from v2.7 (config version 6) - if (plugin.getConfig().getInt("config_file_version", 1) <= 5) { - plugin.getLogger().info("Database upgrade needed: Adding logout position tracking and ignoring request data..."); - HuskHomes.backupDatabase(); // Backup database before upgrades are carried out! - String[] statements = SQLiteUpgradeStatements; - if (HuskHomes.getSettings().getDatabaseType().equalsIgnoreCase("mysql")) { - statements = mySQLUpgradeStatements; - } - int i = 1; - for (String statement : statements) { - try (Connection connection = HuskHomes.getConnection()) { - try (PreparedStatement tableUpdateStatement = connection.prepareStatement(statement)) { - tableUpdateStatement.execute(); - plugin.getLogger().info("Database upgrade in progress... (" + i + "/" + statements.length + ")"); - i++; - } - } catch (SQLException e) { - plugin.getLogger().info("Skipped performing the database upgrade: " + e.getCause() + ". This might be because another server on your HuskHomes network already carried out the upgrade - in which case you can safely ignore this warning."); - e.printStackTrace(); - break; - } - - } - - // Update the config file version - plugin.getLogger().info("Logout position and ignoring request database upgrade complete! (v7)"); - plugin.getConfig().set("config_file_version", 7); - plugin.saveConfig(); - } - - if (plugin.getConfig().getInt("config_file_version", 1) <= 7) { - plugin.getLogger().info("Database upgrade needed: Adding creation timestamps to homes and warps..."); - HuskHomes.backupDatabase(); // Backup database before upgrades are carried out! - - try (Connection connection = HuskHomes.getConnection()) { - try (PreparedStatement tableUpdateStatement = connection.prepareStatement( - "ALTER TABLE " + HuskHomes.getSettings().getHomesDataTable() - + " ADD `creation_time` timestamp NULL DEFAULT NULL;")) { - tableUpdateStatement.execute(); - plugin.getLogger().info("Database upgrade in progress... (1/2)"); - } - } catch (SQLException e) { - plugin.getLogger().info("Skipped performing the database upgrade: " + e.getCause() + ". This might be because another server on your HuskHomes network already carried out the upgrade - in which case you can safely ignore this warning."); - e.printStackTrace(); - } - - try (Connection connection = HuskHomes.getConnection()) { - try (PreparedStatement tableUpdateStatement = connection.prepareStatement( - "ALTER TABLE " + HuskHomes.getSettings().getWarpsDataTable() - + " ADD `creation_time` timestamp NULL DEFAULT NULL;")) { - tableUpdateStatement.execute(); - plugin.getLogger().info("Database upgrade in progress... (2/2)"); - } - } catch (SQLException e) { - plugin.getLogger().info("Skipped performing the database upgrade: " + e.getCause() + ". This might be because another server on your HuskHomes network already carried out the upgrade - in which case you can safely ignore this warning."); - e.printStackTrace(); - } - plugin.getLogger().info("Creation timestamp upgrade complete! (v8)"); - - // Update the config file version - plugin.getLogger().info("All database upgrades have been completed!"); - plugin.getConfig().set("config_file_version", 8); - plugin.saveConfig(); - } - } - -} diff --git a/src/main/java/me/william278/huskhomes2/teleport/SettingHandler.java b/src/main/java/me/william278/huskhomes2/teleport/SettingHandler.java deleted file mode 100644 index ddb83879..00000000 --- a/src/main/java/me/william278/huskhomes2/teleport/SettingHandler.java +++ /dev/null @@ -1,480 +0,0 @@ -package me.william278.huskhomes2.teleport; - -import me.william278.huskhomes2.HuskHomes; -import me.william278.huskhomes2.util.MessageManager; -import me.william278.huskhomes2.api.events.PlayerDeleteHomeEvent; -import me.william278.huskhomes2.api.events.PlayerDeleteWarpEvent; -import me.william278.huskhomes2.api.events.PlayerSetHomeEvent; -import me.william278.huskhomes2.api.events.PlayerSetWarpEvent; -import me.william278.huskhomes2.commands.HomeCommand; -import me.william278.huskhomes2.commands.PublicHomeCommand; -import me.william278.huskhomes2.commands.WarpCommand; -import me.william278.huskhomes2.data.DataManager; -import me.william278.huskhomes2.integrations.VaultIntegration; -import me.william278.huskhomes2.teleport.points.Home; -import me.william278.huskhomes2.teleport.points.TeleportationPoint; -import me.william278.huskhomes2.teleport.points.Warp; -import me.william278.huskhomes2.util.RegexUtil; -import org.bukkit.Bukkit; -import org.bukkit.Location; -import org.bukkit.configuration.file.FileConfiguration; -import org.bukkit.entity.Player; - -import java.sql.Connection; -import java.sql.SQLException; -import java.util.logging.Level; - -// This class handles setting homes, warps and the spawn location. -public class SettingHandler { - - private static final HuskHomes plugin = HuskHomes.getInstance(); - - // Set a home at the specified position - public static void setHome(Location location, Player player, String name) { - Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> { - try (Connection connection = HuskHomes.getConnection()) { - SetHomeConditions setHomeConditions = new SetHomeConditions(player, name, connection); - if (setHomeConditions.areConditionsMet()) { - Home home = new Home(location, HuskHomes.getSettings().getServerID(), player, name, false); - Bukkit.getScheduler().runTask(plugin, () -> { - PlayerSetHomeEvent event = new PlayerSetHomeEvent(player, home); - Bukkit.getPluginManager().callEvent(event); - if (event.isCancelled()) { - return; - } - Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> { - try (Connection connection1 = HuskHomes.getConnection()) { - DataManager.addHome(home, player, connection1); - MessageManager.sendMessage(player, "set_home_success", name); - HomeCommand.Tab.updatePlayerHomeCache(player); - } catch (SQLException e) { - plugin.getLogger().log(Level.SEVERE, "An SQL exception occurred!", e); - } - }); - }); - } else { - switch (setHomeConditions.getConditionsNotMetReason()) { - case "error_set_home_maximum_homes" -> MessageManager.sendMessage(player, "error_set_home_maximum_homes", Integer.toString(Home.getSetHomeLimit(player))); - case "error_insufficient_funds" -> MessageManager.sendMessage(player, "error_insufficient_funds", VaultIntegration.format(HuskHomes.getSettings().getSetHomeCost())); - default -> MessageManager.sendMessage(player, setHomeConditions.getConditionsNotMetReason()); - } - } - } catch (SQLException e) { - plugin.getLogger().log(Level.SEVERE, "An SQL exception occurred!", e); - } - }); - } - - public static void updateCrossServerSpawnWarp(Player p) { - Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> { - try (Connection connection = HuskHomes.getConnection()) { - if (SettingHandler.setCrossServerSpawnWarp(p.getLocation(), p, connection)) { - SettingHandler.setSpawnLocation(p.getLocation()); - p.getWorld().setSpawnLocation(p.getLocation()); - MessageManager.sendMessage(p, "set_spawn_success"); - } - } catch (SQLException e) { - plugin.getLogger().log(Level.SEVERE, "An SQL exception occurred!", e); - } - }); - } - - // Set a new server spawn (override existing one if exists) - public static boolean setCrossServerSpawnWarp(Location location, Player player, Connection connection) throws SQLException { - String spawnWarpName = HuskHomes.getSettings().getSpawnWarpName(); - - // Delete the old spawn warp - if (DataManager.warpExists(spawnWarpName, connection)) { - DataManager.deleteWarp(spawnWarpName, connection); - if (HuskHomes.getSettings().doMapIntegration() && HuskHomes.getSettings().showWarpsOnMap()) { - HuskHomes.getMap().removeWarpMarker(spawnWarpName); - } - } - - // Set a new warp for the spawn position - SetWarpConditions setWarpConditions = new SetWarpConditions(spawnWarpName, connection); - if (setWarpConditions.areConditionsMet()) { - Warp spawnWarp = new Warp(location, HuskHomes.getSettings().getServerID(), spawnWarpName); - spawnWarp.setDescription(MessageManager.getRawMessage("spawn_warp_default_description")); - DataManager.addWarp(spawnWarp, connection); - if (HuskHomes.getSettings().doMapIntegration() && HuskHomes.getSettings().showWarpsOnMap()) { - HuskHomes.getMap().addWarpMarker(spawnWarp); - } - WarpCommand.Tab.updateWarpsTabCache(); - } else { - MessageManager.sendMessage(player, setWarpConditions.getConditionsNotMetReason()); - return false; - } - return true; - } - - // Set a warp at the specified position - public static void setWarp(Location location, Player player, String name) { - Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> { - try (Connection connection = HuskHomes.getConnection()) { - SetWarpConditions setWarpConditions = new SetWarpConditions(name, connection); - if (setWarpConditions.areConditionsMet()) { - Warp warp = new Warp(location, HuskHomes.getSettings().getServerID(), name); - Bukkit.getScheduler().runTask(plugin, () -> { - PlayerSetWarpEvent event = new PlayerSetWarpEvent(player, warp); - Bukkit.getPluginManager().callEvent(event); - if (event.isCancelled()) { - return; - } - Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> { - try (Connection connection1 = HuskHomes.getConnection()) { - DataManager.addWarp(warp, connection1); - MessageManager.sendMessage(player, "set_warp_success", name); - if (HuskHomes.getSettings().doMapIntegration() && HuskHomes.getSettings().showWarpsOnMap()) { - HuskHomes.getMap().addWarpMarker(warp); - } - WarpCommand.Tab.updateWarpsTabCache(); - } catch (SQLException e) { - plugin.getLogger().log(Level.SEVERE, "An SQL exception occurred!", e); - } - }); - }); - } else { - MessageManager.sendMessage(player, setWarpConditions.getConditionsNotMetReason()); - } - } catch (SQLException e) { - plugin.getLogger().log(Level.SEVERE, "An SQL exception occurred!", e); - } - }); - } - - // Delete all of a player's homes - public static void deleteAllHomes(Player player) { - Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> { - try (Connection connection = HuskHomes.getConnection()) { - int homesDeleted = 0; - for (Home home : DataManager.getPlayerHomes(player.getName(), connection)) { - if (home != null) { - Bukkit.getScheduler().runTask(plugin, () -> { - PlayerDeleteHomeEvent event = new PlayerDeleteHomeEvent(player, home); - Bukkit.getPluginManager().callEvent(event); - if (!event.isCancelled()) { - Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> { - try (Connection connection1 = HuskHomes.getConnection()) { - deleteHomeData(player, home, connection1); - } catch (SQLException e) { - plugin.getLogger().log(Level.SEVERE, "An SQL exception occurred!", e); - } - }); - } - }); - } - homesDeleted++; - } - if (homesDeleted == 0) { - MessageManager.sendMessage(player, "error_no_homes_set"); - return; - } - - HomeCommand.Tab.updatePlayerHomeCache(player); - MessageManager.sendMessage(player, "delete_all_homes_success", Integer.toString(homesDeleted)); - } catch (SQLException e) { - plugin.getLogger().log(Level.SEVERE, "An SQL exception occurred!", e); - } - }); - } - - public static void deleteHome(Player player, String homeName) { - deleteHome(player, player.getName(), homeName); - } - - // Delete a home - public static void deleteHome(Player player, String ownerName, String homeName) { - if (!ownerName.equalsIgnoreCase(player.getName())) { - if (!player.hasPermission("huskhomes.delhome.other")) { - MessageManager.sendMessage(player, "error_no_permission"); - return; - } - } - Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> { - try (Connection connection = HuskHomes.getConnection()) { - if (DataManager.homeExists(ownerName, homeName, connection)) { - Home home = DataManager.getHome(ownerName, homeName, connection); - if (home != null) { - Bukkit.getScheduler().runTask(plugin, () -> { - PlayerDeleteHomeEvent event = new PlayerDeleteHomeEvent(player, home); - Bukkit.getPluginManager().callEvent(event); - if (!event.isCancelled()) { - Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> { - try (Connection connection1 = HuskHomes.getConnection()) { - deleteHomeData(player, home, connection1); - if (home.getOwnerUsername().equalsIgnoreCase(player.getName())) { - HomeCommand.Tab.updatePlayerHomeCache(player); - MessageManager.sendMessage(player, "home_deleted", homeName); - } else { - Player homeOwner = Bukkit.getPlayerExact(ownerName); - if (homeOwner != null) { - HomeCommand.Tab.updatePlayerHomeCache(homeOwner); - } - MessageManager.sendMessage(player, "home_deleted_other", ownerName, homeName); - } - } catch (SQLException e) { - plugin.getLogger().log(Level.SEVERE, "An SQL exception occurred!", e); - } - }); - } - }); - } else { - if (!ownerName.equalsIgnoreCase(player.getName())) { - MessageManager.sendMessage(player, "error_home_invalid_other", ownerName, homeName); - } else { - MessageManager.sendMessage(player, "error_home_invalid", homeName); - } - } - } else { - if (homeName.equalsIgnoreCase("all")) { - if (!player.hasPermission("huskhomes.delhome.all")) { - MessageManager.sendMessage(player, "error_no_permission"); - return; - } - if (DataManager.getPlayerHomes(ownerName, connection).size() == 0) { - MessageManager.sendMessage(player, "error_no_homes_set"); - return; - } - MessageManager.sendMessage(player, "delete_all_homes_confirm"); - return; - } - MessageManager.sendMessage(player, "error_home_invalid", homeName); - } - } catch (SQLException e) { - plugin.getLogger().log(Level.SEVERE, "An SQL exception occurred!", e); - } - }); - } - - private static void deleteHomeData(Player player, Home home, Connection connection) throws SQLException { - if (home.isPublic()) { - // Delete Map marker if needed & if the home is public - if (HuskHomes.getSettings().doMapIntegration() && HuskHomes.getSettings().showPublicHomesOnMap()) { - HuskHomes.getMap().removePublicHomeMarker(home.getName(), home.getOwnerUsername()); - } - DataManager.deleteHome(player, home.getOwnerUsername(), home.getName(), connection); - PublicHomeCommand.updatePublicHomeTabCache(); - } else { - DataManager.deleteHome(player, home.getOwnerUsername(), home.getName(), connection); - } - } - - // Delete all server warps - public static void deleteAllWarps(Player player) { - Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> { - try (Connection connection = HuskHomes.getConnection()) { - int warpsDeleted = 0; - for (Warp warp : DataManager.getWarps(connection)) { - if (warp != null) { - String warpName = warp.getName(); - Bukkit.getScheduler().runTask(plugin, () -> { - PlayerDeleteWarpEvent event = new PlayerDeleteWarpEvent(player, warp); - Bukkit.getPluginManager().callEvent(event); - if (!event.isCancelled()) { - Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> { - try (Connection connection1 = HuskHomes.getConnection()) { - DataManager.deleteWarp(warpName, connection1); - if (HuskHomes.getSettings().doMapIntegration() && HuskHomes.getSettings().showWarpsOnMap()) { - HuskHomes.getMap().removeWarpMarker(warpName); - } - } catch (SQLException e) { - plugin.getLogger().log(Level.SEVERE, "An SQL exception occurred!", e); - } - }); - } - }); - WarpCommand.Tab.updateWarpsTabCache(); - } - warpsDeleted++; - } - if (warpsDeleted == 0) { - MessageManager.sendMessage(player, "error_no_warps_set"); - return; - } - - HomeCommand.Tab.updatePlayerHomeCache(player); - MessageManager.sendMessage(player, "delete_all_warps_success", Integer.toString(warpsDeleted)); - } catch (SQLException e) { - plugin.getLogger().log(Level.SEVERE, "An SQL exception occurred!", e); - } - }); - } - - // Delete a warp - public static void deleteWarp(Player player, String warpName) { - Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> { - try (Connection connection = HuskHomes.getConnection()) { - if (DataManager.warpExists(warpName, connection)) { - Warp warp = DataManager.getWarp(warpName, connection); - Bukkit.getScheduler().runTask(plugin, () -> { - PlayerDeleteWarpEvent event = new PlayerDeleteWarpEvent(player, warp); - Bukkit.getPluginManager().callEvent(event); - if (!event.isCancelled()) { - Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> { - try (Connection connection1 = HuskHomes.getConnection()) { - DataManager.deleteWarp(warpName, connection1); - MessageManager.sendMessage(player, "warp_deleted", warpName); - if (HuskHomes.getSettings().doMapIntegration() && HuskHomes.getSettings().showWarpsOnMap()) { - HuskHomes.getMap().removeWarpMarker(warpName); - } - WarpCommand.Tab.updateWarpsTabCache(); - } catch (SQLException e) { - plugin.getLogger().log(Level.SEVERE, "An SQL exception occurred!", e); - } - }); - } - }); - - } else { - if (warpName.equalsIgnoreCase("all")) { - if (!player.hasPermission("huskhomes.delwarp.all")) { - MessageManager.sendMessage(player, "error_no_permission"); - return; - } - if (DataManager.getWarps(connection).size() == 0) { - MessageManager.sendMessage(player, "error_no_warps_set"); - return; - } - MessageManager.sendMessage(player, "delete_all_warps_confirm"); - return; - } - MessageManager.sendMessage(player, "error_warp_invalid", warpName); - } - } catch (SQLException e) { - plugin.getLogger().log(Level.SEVERE, "An SQL exception occurred!", e); - } - }); - } - - // Set spawn location - public static void setSpawnLocation(Location location) { - // Don't set the spawn location in an invalid world - if (location.getWorld() == null) { - return; - } - Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> { - // Write the new location to config - FileConfiguration config = plugin.getConfig(); - config.set("spawn_command.position.world", location.getWorld().getName()); - config.set("spawn_command.position.x", location.getX()); - config.set("spawn_command.position.y", location.getY()); - config.set("spawn_command.position.z", location.getZ()); - config.set("spawn_command.position.yaw", (double) location.getYaw()); - config.set("spawn_command.position.pitch", (double) location.getPitch()); - plugin.saveConfig(); - - // Update the current spawn location - TeleportManager.setSpawnLocation(new TeleportationPoint(location, HuskHomes.getSettings().getServerID())); - }); - } - - // Update current spawn location from config - public static void fetchSpawnLocation() { - Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> TeleportManager.setSpawnLocation(getSpawnLocation())); - } - - // Get spawn location from config - private static TeleportationPoint getSpawnLocation() { - String server = HuskHomes.getSettings().getServerID(); - try { - FileConfiguration config = plugin.getConfig(); - String worldName = (config.getString("spawn_command.position.world")); - if (worldName == null || worldName.equals("")) { - return null; - } - double x = (config.getDouble("spawn_command.position.x")); - double y = (config.getDouble("spawn_command.position.y")); - double z = (config.getDouble("spawn_command.position.z")); - float yaw = (float) (config.getDouble("spawn_command.position.yaw")); - float pitch = (float) (config.getDouble("spawn_command.position.pitch")); - return new TeleportationPoint(worldName, x, y, z, yaw, pitch, server); - } catch (Exception e) { - return null; - } - } - - private static class SetWarpConditions { - - private boolean conditionsMet; - private String conditionsNotMetReason; - - public SetWarpConditions(String warpName, Connection connection) throws SQLException { - conditionsMet = false; - if (DataManager.warpExists(warpName, connection)) { - conditionsNotMetReason = "error_set_warp_name_taken"; - return; - } - if (warpName.length() > 16) { - conditionsNotMetReason = "error_set_warp_invalid_length"; - return; - } - if (!RegexUtil.NAME_PATTERN.matcher(warpName).matches()) { - conditionsNotMetReason = "error_set_warp_invalid_characters"; - return; - } - conditionsMet = true; - } - - public boolean areConditionsMet() { - return conditionsMet; - } - - public String getConditionsNotMetReason() { - return conditionsNotMetReason; - } - } - - private static class SetHomeConditions { - - private boolean conditionsMet; - private String conditionsNotMetReason; - - public SetHomeConditions(Player player, String homeName, Connection connection) throws SQLException { - conditionsMet = false; - int currentHomeCount = DataManager.getPlayerHomeCount(player, connection); - if (currentHomeCount > (Home.getSetHomeLimit(player) - 1)) { - conditionsNotMetReason = "error_set_home_maximum_homes"; - return; - } - if (DataManager.homeExists(player, homeName, connection)) { - conditionsNotMetReason = "error_set_home_name_taken"; - return; - } - if (homeName.length() > 16) { - conditionsNotMetReason = "error_set_home_invalid_length"; - return; - } - if (!RegexUtil.NAME_PATTERN.matcher(homeName).matches()) { - conditionsNotMetReason = "error_set_home_invalid_characters"; - return; - } - if (HuskHomes.getSettings().doEconomy()) { - double setHomeCost = HuskHomes.getSettings().getSetHomeCost(); - if (setHomeCost > 0) { - int currentPlayerHomeSlots = DataManager.getPlayerHomeSlots(player, connection); - if (currentHomeCount > (currentPlayerHomeSlots - 1)) { - if (!VaultIntegration.takeMoney(player, setHomeCost)) { - conditionsNotMetReason = "error_insufficient_funds"; - return; - } else { - DataManager.incrementPlayerHomeSlots(player, connection); - MessageManager.sendMessage(player, "set_home_spent_money", VaultIntegration.format(setHomeCost)); - } - } else if (currentHomeCount == (currentPlayerHomeSlots - 1)) { - MessageManager.sendMessage(player, "set_home_used_free_slots", Integer.toString(Home.getFreeHomes(player)), VaultIntegration.format(setHomeCost)); - } - } - } - conditionsMet = true; - } - - public boolean areConditionsMet() { - return conditionsMet; - } - - public String getConditionsNotMetReason() { - return conditionsNotMetReason; - } - } -} diff --git a/src/main/java/me/william278/huskhomes2/teleport/TeleportManager.java b/src/main/java/me/william278/huskhomes2/teleport/TeleportManager.java deleted file mode 100644 index b310786d..00000000 --- a/src/main/java/me/william278/huskhomes2/teleport/TeleportManager.java +++ /dev/null @@ -1,338 +0,0 @@ -package me.william278.huskhomes2.teleport; - -import com.google.common.io.ByteArrayDataOutput; -import com.google.common.io.ByteStreams; -import io.papermc.lib.PaperLib; -import me.william278.huskhomes2.HuskHomes; -import me.william278.huskhomes2.api.events.PlayerPreTeleportEvent; -import me.william278.huskhomes2.data.DataManager; -import me.william278.huskhomes2.data.message.CrossServerMessageHandler; -import me.william278.huskhomes2.data.message.Message; -import me.william278.huskhomes2.integrations.VaultIntegration; -import me.william278.huskhomes2.teleport.points.RandomPoint; -import me.william278.huskhomes2.teleport.points.TeleportationPoint; -import me.william278.huskhomes2.util.MessageManager; -import org.bukkit.Bukkit; -import org.bukkit.Location; -import org.bukkit.entity.Player; - -import java.sql.Connection; -import java.sql.SQLException; -import java.time.Instant; -import java.util.Optional; -import java.util.logging.Level; - -public class TeleportManager { - - private static final HuskHomes plugin = HuskHomes.getInstance(); - - private static TeleportationPoint spawnLocation; - - // Fires the PreTeleportEvent; returns true if the event is cancelled - private static PlayerPreTeleportEvent getPreTeleportEvent(Player player, TeleportationPoint targetPoint) { - PlayerPreTeleportEvent preTeleportEvent = new PlayerPreTeleportEvent(player, targetPoint); - Bukkit.getPluginManager().callEvent(preTeleportEvent); - return preTeleportEvent; - } - - // Teleport a player to a player by name - public static void teleportPlayer(Player player, String targetPlayer) { - try (Connection connection = HuskHomes.getConnection()) { - DataManager.setPlayerLastPosition(player, new TeleportationPoint(player.getLocation(), - HuskHomes.getSettings().getServerID()), connection); - setPlayerDestinationFromTargetPlayer(player, targetPlayer, connection); - } catch (SQLException e) { - plugin.getLogger().log(Level.SEVERE, "An SQL exception occurred teleporting a player.", e); - } - } - - // Teleport a player to a location on the server or proxy server network - public static void teleportPlayer(Player player, TeleportationPoint targetPoint) { - final TeleportationPoint currentPosition = new TeleportationPoint(player.getLocation(), - HuskHomes.getSettings().getServerID()); - - // Safety checks - if (Math.abs(targetPoint.getX()) > 30000000 || Math.abs(targetPoint.getZ()) > 30000000 || Math.abs(targetPoint.getY()) > 30000000) { - MessageManager.sendMessage(player, "error_invalid_coordinates"); - return; - } - - // Execute teleport - try (Connection connection = HuskHomes.getConnection()) { - DataManager.setPlayerLastPosition(player, currentPosition, connection); - DataManager.setPlayerDestinationLocation(player, targetPoint, connection); - teleportPlayer(player); - } catch (SQLException e) { - plugin.getLogger().log(Level.SEVERE, "An SQL exception occurred teleporting a player.", e); - } - } - - // Move a player to a different server in the bungee network - @SuppressWarnings("UnstableApiUsage") - private static void movePlayerServer(Player p, String targetServer) { - Bukkit.getScheduler().runTask(plugin, () -> { - ByteArrayDataOutput out = ByteStreams.newDataOutput(); - out.writeUTF("Connect"); - out.writeUTF(targetServer); - p.sendPluginMessage(plugin, "BungeeCord", out.toByteArray()); - }); - } - - public static void teleportPlayer(Player player) { - Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> { - TeleportationPoint teleportationPoint = null; - try (Connection connection = HuskHomes.getConnection()) { - teleportationPoint = DataManager.getPlayerDestination(player, connection); - } catch (SQLException sqlException) { - plugin.getLogger().log(Level.SEVERE, "An SQL exception occurred fetching a player's destination", sqlException); - } - if (teleportationPoint != null) { - final TeleportationPoint[] targetPoint = {teleportationPoint}; - Bukkit.getScheduler().runTask(plugin, () -> { - PlayerPreTeleportEvent preTeleportEvent = getPreTeleportEvent(player, targetPoint[0]); - if (preTeleportEvent.isCancelled()) { - return; - } - targetPoint[0] = preTeleportEvent.getTargetPoint(); - Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> { - try (Connection connection = HuskHomes.getConnection()) { - String server = targetPoint[0].getServer(); - if (!HuskHomes.getSettings().doBungee() || server.equals(HuskHomes.getSettings().getServerID())) { - DataManager.setPlayerTeleporting(player, false, connection); - DataManager.deletePlayerDestination(player.getName(), connection); - - final Location targetLocation = targetPoint[0].getLocation(); - teleportLocally(player, targetLocation, true); - } else if (HuskHomes.getSettings().doBungee()) { - DataManager.setPlayerDestinationLocation(player, targetPoint[0], connection); - DataManager.setPlayerTeleporting(player, true, connection); - movePlayerServer(player, server); - } - } catch (SQLException sqlException) { - plugin.getLogger().log(Level.SEVERE, "An SQL exception occurred teleporting a player", sqlException); - } catch (IllegalStateException illegalStateException) { - MessageManager.sendMessage(player, "error_invalid_on_arrival"); - } - }); - }); - } - }); - } - - /** - * Teleport a player locally on the server via PaperLib - * - * @param player The {@link Player} to teleport - * @param targetLocation The target {@link Location} - * @param notify Whether to notify the player of teleportation completion or failure through sounds and messages - */ - public static void teleportLocally(Player player, Location targetLocation, boolean notify) { - Bukkit.getScheduler().runTask(plugin, () -> { - if (!player.isEmpty()) { - player.eject(); // Eject passengers before teleporting - } - if (!targetLocation.isWorldLoaded()) { - if (notify) { - MessageManager.sendMessage(player, "error_invalid_on_arrival"); - } - return; - } - if (HuskHomes.getSettings().doUsePaperLibIfAvailable()) { - PaperLib.teleportAsync(player, targetLocation).thenAccept(succeeded -> { - if (!succeeded) { - player.teleport(targetLocation); // Teleport normally if paperlib fails - } - }); - } else { - player.teleport(targetLocation); - } - - // Send teleportation complete sound - if (notify) { - if (HuskHomes.getSettings().getTeleportationCompleteSound() != null) { - player.playSound(targetLocation, HuskHomes.getSettings().getTeleportationCompleteSound(), 1, 1); - } - MessageManager.sendMessage(player, "teleporting_complete"); - } - }); - } - - public static void queueTimedTeleport(Player player, String targetPlayer) { - if (player.hasPermission("huskhomes.bypass_timer") || HuskHomes.getSettings().getTeleportWarmupTime() <= 0) { - teleportPlayer(player, targetPlayer); - return; - } - - new TimedTeleport(player, targetPlayer).begin(); - } - - public static void queueTimedTeleport(Player player, TeleportationPoint point) { - if (player.hasPermission("huskhomes.bypass_timer") || HuskHomes.getSettings().getTeleportWarmupTime() <= 0) { - teleportPlayer(player, point); - return; - } - - new TimedTeleport(player, point, TimedTeleport.TargetType.POINT).begin(); - } - - public static void teleportToOfflinePlayer(Player player, String targetPlayer, Connection connection) throws SQLException { - final Integer playerID = DataManager.getPlayerId(targetPlayer, connection); - if (playerID == null) { - MessageManager.sendMessage(player, "error_player_not_found", targetPlayer); - return; - } - TeleportationPoint offlinePoint = DataManager.getPlayerOfflinePosition(playerID, connection); - if (offlinePoint == null) { - MessageManager.sendMessage(player, "error_no_offline_position", targetPlayer); - return; - } - MessageManager.sendMessage(player, "teleporting_offline_player", targetPlayer); - teleportPlayer(player, offlinePoint); - } - - public static void queueBackTeleport(Player player, Connection connection) throws SQLException { - try { - TeleportationPoint lastPosition = DataManager.getPlayerLastPosition(player, connection); - if (lastPosition != null) { - if (HuskHomes.getSettings().doEconomy()) { - double backCost = HuskHomes.getSettings().getBackCost(); - if (backCost > 0) { - if (!VaultIntegration.hasMoney(player, backCost)) { - MessageManager.sendMessage(player, "error_insufficient_funds", VaultIntegration.format(backCost)); - return; - } - } - } - if (player.hasPermission("huskhomes.bypass_timer") || HuskHomes.getSettings().getTeleportWarmupTime() <= 0) { - if (HuskHomes.getSettings().doEconomy()) { - double backCost = HuskHomes.getSettings().getRtpCost(); - if (backCost > 0) { - VaultIntegration.takeMoney(player, backCost); - MessageManager.sendMessage(player, "back_spent_money", VaultIntegration.format(backCost)); - } - } - teleportPlayer(player, lastPosition); - return; - } - - new TimedTeleport(player, lastPosition, TimedTeleport.TargetType.BACK).begin(); - } else { - MessageManager.sendMessage(player, "error_no_last_position"); - } - } catch (IllegalArgumentException e) { - MessageManager.sendMessage(player, "error_no_last_position"); - } - - } - - public static void queueRandomTeleport(Player player, Connection connection) throws SQLException { - if (!player.hasPermission("huskhomes.rtp.bypass_cooldown")) { - long currentTime = Instant.now().getEpochSecond(); - long coolDownTime = DataManager.getPlayerRtpCoolDown(player, connection); - if (currentTime < coolDownTime) { - long timeRemaining = coolDownTime - currentTime; - long timeRemainingMinutes = timeRemaining / 60; - MessageManager.sendMessage(player, "error_rtp_cooldown", Long.toString(timeRemainingMinutes)); - return; - } - } - if (HuskHomes.getSettings().doEconomy()) { - double rtpCost = HuskHomes.getSettings().getRtpCost(); - if (rtpCost > 0) { - if (!VaultIntegration.hasMoney(player, rtpCost)) { - MessageManager.sendMessage(player, "error_insufficient_funds", VaultIntegration.format(rtpCost)); - return; - } - } - } - if (player.hasPermission("huskhomes.bypass_timer") || HuskHomes.getSettings().getTeleportWarmupTime() <= 0) { - RandomPoint randomPoint = new RandomPoint(player); - if (randomPoint.hasFailed()) { - return; - } - if (HuskHomes.getSettings().doEconomy()) { - double rtpCost = HuskHomes.getSettings().getRtpCost(); - if (rtpCost > 0) { - VaultIntegration.takeMoney(player, rtpCost); - MessageManager.sendMessage(player, "rtp_spent_money", VaultIntegration.format(rtpCost)); - } - } - teleportPlayer(player, randomPoint); - DataManager.updateRtpCoolDown(player, connection); - return; - } - new TimedTeleport(player).begin(); - } - - public static void teleportAllHere(Player requester) { - for (String playerName : HuskHomes.getPlayerList().getPlayers()) { - if (playerName.equals(requester.getName())) { - continue; - } - Player targetPlayer = Bukkit.getPlayerExact(playerName); - if (targetPlayer != null) { - teleportPlayer(targetPlayer, requester.getName()); - } else { - if (HuskHomes.getSettings().doBungee()) { - teleportHereCrossServer(requester, playerName); - } - } - } - } - - public static void teleportHere(Player requester, String targetPlayerName) throws SQLException { - Player targetPlayer = Bukkit.getPlayerExact(targetPlayerName); - if (targetPlayer != null) { - if (targetPlayer.getUniqueId() != requester.getUniqueId()) { - teleportPlayer(targetPlayer, requester.getName()); - } else { - MessageManager.sendMessage(requester, "error_tp_self"); - } - } else { - if (HuskHomes.getSettings().doBungee()) { - teleportHereCrossServer(requester, targetPlayerName); - return; - } - MessageManager.sendMessage(requester, "error_player_not_found", targetPlayerName); - } - } - - private static void teleportHereCrossServer(Player requester, String targetPlayerName) { - CrossServerMessageHandler.getMessage(targetPlayerName, Message.MessageType.TELEPORT_TO_ME, requester.getName()).send(requester); - } - - private static void setTeleportationDestinationCrossServer(Player requester, String targetPlayerName) { - CrossServerMessageHandler.getMessage(targetPlayerName, Message.MessageType.SET_TP_DESTINATION, requester.getName()).send(requester); - } - - public static void setPlayerDestinationFromTargetPlayer(Player requester, String targetPlayerName, Connection connection) throws SQLException { - Player targetPlayer = Bukkit.getPlayerExact(targetPlayerName); - if (targetPlayer != null) { - if (requester.getUniqueId() != targetPlayer.getUniqueId()) { - DataManager.setPlayerDestinationLocation(requester, - new TeleportationPoint(targetPlayer.getLocation(), HuskHomes.getSettings().getServerID()), connection); - teleportPlayer(requester); - } else { - MessageManager.sendMessage(requester, "error_tp_self"); - } - } else { - if (HuskHomes.getSettings().doBungee()) { - setTeleportationDestinationCrossServer(requester, targetPlayerName); - return; - } - MessageManager.sendMessage(requester, "error_player_not_found", targetPlayerName); - } - } - - public static Optional getSpawnLocation() { - if (spawnLocation == null) { - return Optional.empty(); - } else { - return Optional.of(spawnLocation); - } - } - - public static void setSpawnLocation(TeleportationPoint spawnPoint) { - spawnLocation = spawnPoint; - } -} diff --git a/src/main/java/me/william278/huskhomes2/teleport/TeleportRequest.java b/src/main/java/me/william278/huskhomes2/teleport/TeleportRequest.java deleted file mode 100644 index 0666ffd9..00000000 --- a/src/main/java/me/william278/huskhomes2/teleport/TeleportRequest.java +++ /dev/null @@ -1,40 +0,0 @@ -package me.william278.huskhomes2.teleport; - -import me.william278.huskhomes2.HuskHomes; - -import java.time.Instant; - -public class TeleportRequest { - - private final String senderName; - private final long requestExpiryTime; - private final long requestTime; - private final RequestType requestType; - - public TeleportRequest(String senderName, RequestType requestType) { - this.senderName = senderName; - this.requestType = requestType; - this.requestTime = Instant.now().getEpochSecond(); - requestExpiryTime = requestTime + HuskHomes.getSettings().getTeleportRequestExpiryTime(); - } - - public String getSenderName() { - return senderName; - } - - public RequestType getRequestType() { - return requestType; - } - - public long getRequestTime() { return requestTime; } - - public boolean isExpired() { - long currentUnixTime = Instant.now().getEpochSecond(); - return currentUnixTime > requestExpiryTime; - } - - public enum RequestType { - TPA, - TPA_HERE - } -} \ No newline at end of file diff --git a/src/main/java/me/william278/huskhomes2/teleport/TeleportRequestHandler.java b/src/main/java/me/william278/huskhomes2/teleport/TeleportRequestHandler.java deleted file mode 100644 index 6561cfc6..00000000 --- a/src/main/java/me/william278/huskhomes2/teleport/TeleportRequestHandler.java +++ /dev/null @@ -1,246 +0,0 @@ -package me.william278.huskhomes2.teleport; - -import me.william278.huskhomes2.HuskHomes; -import me.william278.huskhomes2.util.MessageManager; -import me.william278.huskhomes2.data.message.CrossServerMessageHandler; -import me.william278.huskhomes2.data.message.Message; -import me.william278.huskhomes2.integrations.VanishChecker; -import org.bukkit.Bukkit; -import org.bukkit.entity.Player; - -import java.util.HashMap; - -public class TeleportRequestHandler { - - private static final HuskHomes plugin = HuskHomes.getInstance(); - - // Target player and teleport request(s) to them hashmap - public static HashMap> teleportRequests = new HashMap<>(); - - private static void sendTeleportRequestCrossServer(Player requester, String targetPlayerName, TeleportRequest.RequestType requestType) { - if (requestType == TeleportRequest.RequestType.TPA) { - CrossServerMessageHandler.getMessage(targetPlayerName, Message.MessageType.TPA_REQUEST, requester.getName()).send(requester); - } else if (requestType == TeleportRequest.RequestType.TPA_HERE) { - CrossServerMessageHandler.getMessage(targetPlayerName, Message.MessageType.TPA_HERE_REQUEST, requester.getName()).send(requester); - } - } - - private static void replyTeleportRequestCrossServer(Player replier, String requesterName, TeleportRequest.RequestType requestType, boolean accepted) { - if (requestType == TeleportRequest.RequestType.TPA) { - CrossServerMessageHandler.getMessage(requesterName, Message.MessageType.TPA_REQUEST_REPLY, replier.getName(), Boolean.toString(accepted)).send(replier); - } else if (requestType == TeleportRequest.RequestType.TPA_HERE) { - CrossServerMessageHandler.getMessage(requesterName, Message.MessageType.TPA_HERE_REQUEST_REPLY, replier.getName(), Boolean.toString(accepted)).send(replier); - } - } - - public static void sendTeleportToRequest(Player requester, String targetPlayerName) { - Player targetPlayer = Bukkit.getPlayerExact(targetPlayerName); - if (targetPlayer != null) { - if (targetPlayer.getUniqueId() != requester.getUniqueId()) { - if (!VanishChecker.isVanished(targetPlayer)) { - MessageManager.sendMessage(requester, "tpa_request_sent", targetPlayerName); - if (!HuskHomes.isIgnoringTeleportRequests(targetPlayer.getUniqueId())) { - if (isDuplicateRequest(targetPlayerName, targetPlayer)) { - return; - } - teleportRequests.get(targetPlayer).put(requester.getName(), new TeleportRequest(requester.getName(), - TeleportRequest.RequestType.TPA)); - MessageManager.sendMessage(targetPlayer, "tpa_request_ask", requester.getName()); - MessageManager.sendMessage(targetPlayer, "teleport_request_options", requester.getName()); - } - } else { - MessageManager.sendMessage(requester, "error_player_not_found", targetPlayerName); - } - } else { - MessageManager.sendMessage(requester, "error_tp_self"); - } - } else { - if (HuskHomes.getSettings().doBungee()) { - sendTeleportRequestCrossServer(requester, targetPlayerName, TeleportRequest.RequestType.TPA); - MessageManager.sendMessage(requester, "tpa_request_sent", targetPlayerName); - } else { - MessageManager.sendMessage(requester, "error_player_not_found", targetPlayerName); - } - } - } - - public static void sendTeleportAllHereRequest(Player requester) { - if (HuskHomes.getPlayerList().getPlayers().size() <= 1) { - MessageManager.sendMessage(requester, "error_no_other_online_players"); - return; - } - for (String playerName : HuskHomes.getPlayerList().getPlayers()) { - if (playerName.equals(requester.getName())) { - continue; - } - final Player targetPlayer = Bukkit.getPlayerExact(playerName); - if (targetPlayer != null) { - sendLocalTpaHereRequest(requester, playerName, targetPlayer); - } else { - if (HuskHomes.getSettings().doBungee()) { - sendTeleportRequestCrossServer(requester, playerName, TeleportRequest.RequestType.TPA_HERE); - } - } - } - MessageManager.sendMessage(requester, "tpaall_request_sent"); - } - - // Send the local tpa here request, provided the user is not ignoring requests - private static void sendLocalTpaHereRequest(Player requester, String playerName, Player targetPlayer) { - if (!HuskHomes.isIgnoringTeleportRequests(targetPlayer.getUniqueId())) { - if (isDuplicateRequest(playerName, targetPlayer)) { - return; - } - teleportRequests.get(targetPlayer).put(requester.getName(), new TeleportRequest(requester.getName(), - TeleportRequest.RequestType.TPA_HERE)); - MessageManager.sendMessage(targetPlayer, "tpahere_request_ask", requester.getName()); - MessageManager.sendMessage(targetPlayer, "teleport_request_options", requester.getName()); - } - } - - public static void sendTeleportHereRequest(Player requester, String targetPlayerName) { - Player targetPlayer = Bukkit.getPlayerExact(targetPlayerName); - if (targetPlayer != null) { - if (targetPlayer.getUniqueId() != requester.getUniqueId()) { - sendLocalTpaHereRequest(requester, targetPlayerName, targetPlayer); - MessageManager.sendMessage(requester, "tpahere_request_sent", targetPlayerName); - } else { - MessageManager.sendMessage(requester, "error_tp_self"); - } - } else { - if (HuskHomes.getSettings().doBungee()) { - sendTeleportRequestCrossServer(requester, targetPlayerName, TeleportRequest.RequestType.TPA_HERE); - MessageManager.sendMessage(requester, "tpahere_request_sent", targetPlayerName); - } else { - MessageManager.sendMessage(requester, "error_player_not_found", targetPlayerName); - } - } - } - - private static void handleRequestReply(Player p, TeleportRequest teleportRequest, boolean accepted) { - if (teleportRequest.isExpired()) { - teleportRequests.get(p).remove(teleportRequest.getSenderName()); - if (teleportRequests.get(p).isEmpty()) { - teleportRequests.remove(p); - } - MessageManager.sendMessage(p, "error_tp_request_expired"); - return; - } - String requesterName = teleportRequest.getSenderName(); - TeleportRequest.RequestType requestType = teleportRequest.getRequestType(); - Player requester = Bukkit.getPlayer(requesterName); - - Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> { - if (requester != null) { - if (accepted) { - MessageManager.sendMessage(p, "tpa_you_accepted", requesterName); - MessageManager.sendMessage(requester, "tpa_has_accepted", p.getName()); - - if (requestType == TeleportRequest.RequestType.TPA) { - TeleportManager.queueTimedTeleport(requester, p.getName()); - } else if (requestType == TeleportRequest.RequestType.TPA_HERE) { - TeleportManager.queueTimedTeleport(p, requesterName); - } - } else { - MessageManager.sendMessage(p, "tpa_you_declined", requesterName); - MessageManager.sendMessage(requester, "tpa_has_declined", p.getName()); - } - } else { - if (HuskHomes.getSettings().doBungee()) { - if (accepted) { - MessageManager.sendMessage(p, "tpa_you_accepted", requesterName); - replyTeleportRequestCrossServer(p, requesterName, requestType, true); - if (requestType == TeleportRequest.RequestType.TPA_HERE) { - TeleportManager.queueTimedTeleport(p, requesterName); - } - } else { - replyTeleportRequestCrossServer(p, requesterName, requestType, false); - MessageManager.sendMessage(p, "tpa_you_declined", requesterName); - } - } else { - MessageManager.sendMessage(p, "error_player_not_found", requesterName); - } - } - teleportRequests.get(p).remove(teleportRequest.getSenderName()); - if (teleportRequests.get(p).isEmpty()) { - teleportRequests.remove(p); - } - }); - } - - public static void replyTpRequest(Player p, boolean accepted) { - if (!teleportRequests.containsKey(p)) { - MessageManager.sendMessage(p, "error_tpa_no_pending_request"); - return; - } - if (teleportRequests.get(p).isEmpty()) { - MessageManager.sendMessage(p, "error_tpa_no_pending_request"); - return; - } - if (HuskHomes.isIgnoringTeleportRequests(p.getUniqueId())) { - MessageManager.sendMessage(p, "error_ignoring_teleport_requests"); - return; - } - HashMap playerRequests = teleportRequests.get(p); - long firstRequestTime = Long.MAX_VALUE; - TeleportRequest targetRequest = null; - for (String playerName : playerRequests.keySet()) { - TeleportRequest request = playerRequests.get(playerName); - if (request.getRequestTime() < firstRequestTime) { - targetRequest = request; - firstRequestTime = targetRequest.getRequestTime(); - } - } - if (targetRequest == null) { - MessageManager.sendMessage(p, "error_tpa_no_pending_request"); - return; - } - handleRequestReply(p, targetRequest, accepted); - } - - public static void replyTpRequest(Player p, String requesterName, boolean accepted) { - if (!teleportRequests.containsKey(p)) { - MessageManager.sendMessage(p, "error_tpa_no_pending_request"); - return; - } - if (teleportRequests.get(p).isEmpty()) { - MessageManager.sendMessage(p, "error_tpa_no_pending_request"); - return; - } - if (HuskHomes.isIgnoringTeleportRequests(p.getUniqueId())) { - MessageManager.sendMessage(p, "error_ignoring_teleport_requests"); - return; - } - HashMap playerRequests = teleportRequests.get(p); - TeleportRequest targetRequest = null; - for (String playerName : playerRequests.keySet()) { - TeleportRequest request = playerRequests.get(playerName); - if (request.getSenderName().equalsIgnoreCase(requesterName)) { - targetRequest = request; - break; - } - } - if (targetRequest == null) { - MessageManager.sendMessage(p, "error_invalid_player"); - return; - } - handleRequestReply(p, targetRequest, accepted); - } - - // Handle an incoming request; if it's a duplicate, return true, otherwise allow the new request (return false) - public static boolean isDuplicateRequest(String senderName, Player recipient) { - if (teleportRequests.containsKey(recipient)) { - if (teleportRequests.get(recipient).containsKey(senderName)) { - TeleportRequest request = teleportRequests.get(recipient).get(senderName); - if (!request.isExpired()) { - return true; - } else { - teleportRequests.get(recipient).remove(senderName); - } - } - } else { - teleportRequests.put(recipient, new HashMap<>()); - } - return false; - } -} diff --git a/src/main/java/me/william278/huskhomes2/teleport/TimedTeleport.java b/src/main/java/me/william278/huskhomes2/teleport/TimedTeleport.java deleted file mode 100644 index a3102998..00000000 --- a/src/main/java/me/william278/huskhomes2/teleport/TimedTeleport.java +++ /dev/null @@ -1,210 +0,0 @@ -package me.william278.huskhomes2.teleport; - -import de.themoep.minedown.MineDown; -import me.william278.huskhomes2.HuskHomes; -import me.william278.huskhomes2.util.MessageManager; -import me.william278.huskhomes2.data.DataManager; -import me.william278.huskhomes2.integrations.VaultIntegration; -import me.william278.huskhomes2.teleport.points.RandomPoint; -import me.william278.huskhomes2.teleport.points.TeleportationPoint; -import net.md_5.bungee.api.chat.TextComponent; -import org.bukkit.Bukkit; -import org.bukkit.Location; -import org.bukkit.entity.Player; -import org.bukkit.scheduler.BukkitRunnable; - -import java.sql.Connection; -import java.sql.SQLException; -import java.util.logging.Level; - -public class TimedTeleport { - - private static final HuskHomes plugin = HuskHomes.getInstance(); - - private final TargetType targetType; - - private TeleportationPoint targetPoint; - private String targetPlayerName; - - private final Player player; - private final Location initialLocation; - private final double initialHealth; - - private final int warmupTime = HuskHomes.getSettings().getTeleportWarmupTime(); - - public TimedTeleport(Player player, TeleportationPoint targetPoint, TargetType targetType) { - this.player = player; - this.initialLocation = player.getLocation(); - this.initialHealth = player.getHealth(); - this.targetType = targetType; - this.targetPoint = targetPoint; - - MessageManager.sendMessage(player, "teleporting_countdown_start", Integer.toString(this.warmupTime)); - MessageManager.sendMessage(player, "teleporting_please_stand_still"); - } - - public TimedTeleport(Player player) { - this.player = player; - this.initialLocation = player.getLocation(); - this.initialHealth = player.getHealth(); - this.targetType = TargetType.RANDOM; - - MessageManager.sendMessage(player, "teleporting_countdown_start", Integer.toString(this.warmupTime)); - MessageManager.sendMessage(player, "teleporting_please_stand_still"); - } - - public TimedTeleport(Player player, String targetPlayerName) { - this.player = player; - this.initialLocation = player.getLocation(); - this.initialHealth = player.getHealth(); - this.targetType = TargetType.PLAYER; - this.targetPlayerName = targetPlayerName; - - MessageManager.sendMessage(player, "teleporting_countdown_start", Integer.toString(this.warmupTime)); - MessageManager.sendMessage(player, "teleporting_please_stand_still"); - } - - public void begin() { - final int[] i = {HuskHomes.getSettings().getTeleportWarmupTime() + 1}; - new BukkitRunnable() { - @Override - public void run() { - Player executablePlayer = Bukkit.getPlayer(player.getUniqueId()); - if (executablePlayer == null) { - cancel(); - return; - } - if (hasMoved(executablePlayer)) { - cancel(); - if (HuskHomes.getSettings().getTeleportCancelledSound() != null) { - executablePlayer.playSound(executablePlayer.getLocation(), HuskHomes.getSettings().getTeleportCancelledSound(), 1, 1); - } - MessageManager.sendMessage(player, "teleporting_cancelled_movement"); - sendWarmupMessage(player, "teleporting_action_bar_cancelled"); - return; - } - if (hasLostHealth(executablePlayer)) { - cancel(); - if (HuskHomes.getSettings().getTeleportCancelledSound() != null) { - executablePlayer.playSound(executablePlayer.getLocation(), HuskHomes.getSettings().getTeleportCancelledSound(), 1, 1); - } - MessageManager.sendMessage(player, "teleporting_cancelled_damage"); - sendWarmupMessage(player, "teleporting_action_bar_cancelled"); - return; - } - i[0] = i[0] - 1; - if (i[0] == 0) { - cancel(); - Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> { - try (Connection connection = HuskHomes.getConnection()) { - // Execute the teleport - switch (getTargetType()) { - case POINT -> TeleportManager.teleportPlayer(player, targetPoint); - case BACK -> { - if (HuskHomes.getSettings().doEconomy()) { - double backCost = HuskHomes.getSettings().getBackCost(); - if (backCost > 0) { - if (!VaultIntegration.takeMoney(player, backCost)) { - MessageManager.sendMessage(player, "error_insufficient_funds", VaultIntegration.format(backCost)); - break; - } else { - MessageManager.sendMessage(player, "back_spent_money", VaultIntegration.format(backCost)); - } - } - } - TeleportManager.teleportPlayer(player, getTargetPoint()); - } - case PLAYER -> TeleportManager.teleportPlayer(player, getTargetPlayerName()); - case RANDOM -> { - RandomPoint randomPoint = new RandomPoint(player); - if (randomPoint.hasFailed()) { - return; - } - if (HuskHomes.getSettings().doEconomy()) { - double rtpCost = HuskHomes.getSettings().getRtpCost(); - if (rtpCost > 0) { - if (!VaultIntegration.takeMoney(player, rtpCost)) { - MessageManager.sendMessage(player, "error_insufficient_funds", VaultIntegration.format(rtpCost)); - break; - } else { - MessageManager.sendMessage(player, "rtp_spent_money", VaultIntegration.format(rtpCost)); - } - } - } - TeleportManager.teleportPlayer(player, randomPoint); - DataManager.updateRtpCoolDown(player, connection); - } - } - } catch (SQLException e) { - plugin.getLogger().log(Level.SEVERE, "An SQL exception occurred carrying out a timed teleport"); - } - }); - return; - } - sendWarmupMessage(executablePlayer, "teleporting_action_bar_countdown", Integer.toString(i[0])); - if (HuskHomes.getSettings().getTeleportWarmupSound() != null) { - executablePlayer.playSound(executablePlayer.getLocation(), HuskHomes.getSettings().getTeleportWarmupSound(), 1, 1); - } - } - }.runTaskTimer(plugin, 0, 20L); - } - - public TargetType getTargetType() { - return targetType; - } - - public TeleportationPoint getTargetPoint() { - return targetPoint; - } - - public String getTargetPlayerName() { - return targetPlayerName; - } - - private static void sendWarmupMessage(Player player, String messageID, String... replacements) { - switch (HuskHomes.getSettings().getWarmupDisplayStyle()) { - case ACTION_BAR -> MessageManager.sendActionBar(player, messageID, replacements); - case TITLE -> player.sendTitle(TextComponent.toLegacyText(new MineDown(MessageManager.getRawMessage(messageID, replacements)).toComponent()), "", 20, 60, 20); - case SUBTITLE -> player.sendTitle("", TextComponent.toLegacyText(new MineDown(MessageManager.getRawMessage(messageID, replacements)).toComponent()), 20, 60, 20); - case CHAT -> MessageManager.sendMessage(player, messageID, replacements); - } - } - - // This converts a negative to a positive double, used in checking if a player has moved - private static double makePositive(double d) { - if (d < 0) { - d = d * -1D; - } - return d; - } - - // This returns if the player has lost health during a timed teleport - public boolean hasLostHealth(Player p) { - return p.getHealth() < initialHealth; - } - - // This returns if the player has moved during a timed teleport - public boolean hasMoved(Player p) { - Location currentLocation = p.getLocation(); - final double movementThreshold = 0.1; - - double xDiff = makePositive(initialLocation.getX() - currentLocation.getX()); - double yDiff = makePositive(initialLocation.getY() - currentLocation.getY()); - double zDiff = makePositive(initialLocation.getZ() - currentLocation.getZ()); - double totalDiff = xDiff + yDiff + zDiff; - - return totalDiff > movementThreshold; - } - - public Player getPlayer() { - return player; - } - - public enum TargetType { - POINT, - BACK, - PLAYER, - RANDOM - } - -} diff --git a/src/main/java/me/william278/huskhomes2/teleport/points/Home.java b/src/main/java/me/william278/huskhomes2/teleport/points/Home.java deleted file mode 100644 index 46833012..00000000 --- a/src/main/java/me/william278/huskhomes2/teleport/points/Home.java +++ /dev/null @@ -1,190 +0,0 @@ -package me.william278.huskhomes2.teleport.points; - -import me.william278.huskhomes2.HuskHomes; -import me.william278.huskhomes2.util.MessageManager; -import org.bukkit.Bukkit; -import org.bukkit.Location; -import org.bukkit.entity.Player; -import org.bukkit.permissions.PermissionAttachmentInfo; - -import java.util.UUID; -import java.util.regex.PatternSyntaxException; - -/** - * An object representing a Player's home in-game - * - * @author William - */ -public class Home extends SetPoint { - - private boolean isPublic; - private UUID ownerUUID; - private String ownerUsername; - - /** - * An object representing a Player's home in-game - * - * @param location The Bukkit {@link Location} of the home - * @param server The Bungee server ID of the home - * @param homeOwner The Player who owns the home - * @param name The name of the home - * @param isPublic Whether the home is public - */ - public Home(Location location, String server, Player homeOwner, String name, boolean isPublic) { - super(location, server, name, MessageManager.getRawMessage("home_default_description", homeOwner.getName())); - this.ownerUUID = homeOwner.getUniqueId(); - this.ownerUsername = homeOwner.getName(); - this.isPublic = isPublic; - } - - /** - * An object representing a Player's home in-game - * - * @param teleportationPoint The {@link TeleportationPoint} position of the home - * @param ownerUsername The username of the owner - * @param ownerUUID The UUID string of the owner - * @param name The name of the home - * @param description The description of the home - * @param isPublic Whether the home is public - * @deprecated Use other method that accepts UUID instead of UUID-string - */ - public Home(TeleportationPoint teleportationPoint, String ownerUsername, String ownerUUID, String name, String description, boolean isPublic, long creationTime) throws IllegalArgumentException { - super(teleportationPoint.worldName, teleportationPoint.x, teleportationPoint.y, teleportationPoint.z, teleportationPoint.yaw, teleportationPoint.pitch, teleportationPoint.server, name, description, creationTime); - this.ownerUsername = ownerUsername; - this.ownerUUID = UUID.fromString(ownerUUID); - this.isPublic = isPublic; - } - - /** - * An object representing a Player's home in-game - * - * @param teleportationPoint The {@link TeleportationPoint} position of the home - * @param ownerUsername The username of the owner - * @param ownerUUID The {@link UUID} of the owner - * @param name The name of the home - * @param description The description of the home - * @param isPublic Whether the home is public - */ - public Home(TeleportationPoint teleportationPoint, String ownerUsername, UUID ownerUUID, String name, String description, boolean isPublic, long creationTime) { - super(teleportationPoint.worldName, teleportationPoint.x, teleportationPoint.y, teleportationPoint.z, teleportationPoint.yaw, teleportationPoint.pitch, teleportationPoint.server, name, description, creationTime); - this.ownerUsername = ownerUsername; - this.ownerUUID = ownerUUID; - this.isPublic = isPublic; - } - - /** - * Returns whether the Home is public - * - * @return if the Home is public - */ - public boolean isPublic() { - return isPublic; - } - - /** - * Set the privacy of the home - * - * @param isPublic should the home be public? - */ - public void setPublic(boolean isPublic) { - this.isPublic = isPublic; - } - - /** - * Returns the UUID of the Home's owner - * - * @return the owner's UUID - */ - public UUID getOwnerUUID() { - return ownerUUID; - } - - /** - * Returns the username of the Home's owner - * - * @return the owner's username - */ - public String getOwnerUsername() { - return ownerUsername; - } - - /** - * Returns the Player who owns the home - * - * @return the Player owner of the home - */ - public Player getOwner() { - Player player = Bukkit.getPlayer(ownerUUID); - if (player != null) { - return player; - } else { - throw new IllegalStateException("The home owner is not online"); - } - } - - /** - * Set the owner of the home - * - * @param player The new owner of the home - */ - public void setOwner(Player player) { - this.ownerUUID = player.getUniqueId(); - this.ownerUsername = player.getName(); - } - - /* - * Static methods for fetching player set home limits - */ - - // Returns the maximum number of set homes a player can make - public static int getSetHomeLimit(Player player) { - int maxSetHomes = getLimitFromPermissions(player, "huskhomes.max_sethomes."); - if (maxSetHomes != -1) { - return maxSetHomes; - } - return HuskHomes.getSettings().getMaximumHomes(); - } - - // Returns the number of set homes a player can set for free - public static int getFreeHomes(Player player) { - int freeSetHomes = getLimitFromPermissions(player, "huskhomes.free_sethomes."); - if (freeSetHomes != -1) { - return freeSetHomes; - } - return HuskHomes.getSettings().getFreeHomeSlots(); - } - - // Returns the number of homes a player can make public; unlimited if not set - public static int getPublicHomeLimit(Player player) { - int maxPublicHomes = getLimitFromPermissions(player, "huskhomes.max_public_homes."); - if (maxPublicHomes != -1) { - return maxPublicHomes; - } - return Integer.MAX_VALUE; - } - - // Return the value from the player's permissions - private static int getLimitFromPermissions(Player player, String permissionPrefix) { - player.recalculatePermissions(); - int limit = -1; - for (PermissionAttachmentInfo permissionAI : player.getEffectivePermissions()) { - String permission = permissionAI.getPermission(); - if (permission.contains(permissionPrefix)) { - try { - int value = Integer.parseInt(permission.split("\\.")[2]); - if (HuskHomes.getSettings().doHomeLimitPermissionStacking()) { - if (limit == -1) { - limit++; - } - limit += value; - } else { - if (value > limit) { - limit = value; - } - } - } catch (NumberFormatException | PatternSyntaxException ignored) {} - } - } - return limit; - } -} diff --git a/src/main/java/me/william278/huskhomes2/teleport/points/RandomPoint.java b/src/main/java/me/william278/huskhomes2/teleport/points/RandomPoint.java deleted file mode 100644 index 9d285840..00000000 --- a/src/main/java/me/william278/huskhomes2/teleport/points/RandomPoint.java +++ /dev/null @@ -1,124 +0,0 @@ -package me.william278.huskhomes2.teleport.points; - -import me.william278.huskhomes2.HuskHomes; -import me.william278.huskhomes2.util.MessageManager; -import org.bukkit.Location; -import org.bukkit.Material; -import org.bukkit.World; -import org.bukkit.block.Block; -import org.bukkit.entity.Player; - -import java.util.Collections; -import java.util.EnumSet; -import java.util.Random; -import java.util.Set; -import java.util.concurrent.ThreadLocalRandom; - -public class RandomPoint extends TeleportationPoint { - - // List containing all unsafe blocks - private static final Set UNSAFE_BLOCKS = Collections.unmodifiableSet(EnumSet.of( - Material.LAVA, Material.FIRE, Material.MAGMA_BLOCK, Material.CACTUS, Material.WATER, Material.OBSIDIAN, - Material.JUNGLE_LEAVES, Material.SPRUCE_LEAVES, Material.OAK_LEAVES, - Material.BIRCH_LEAVES, Material.ACACIA_LEAVES, Material.DARK_OAK_LEAVES - )); - - // Maximum number of attempts to find a random location - private static final int MAX_RANDOM_ATTEMPTS = 8; - private static boolean hasFailed; - - public RandomPoint(Player player) { - super(player.getLocation(), HuskHomes.getSettings().getServerID()); - hasFailed = false; - Location randomLocation = getRandomLocation(player.getWorld()); - if (randomLocation != null) { - setLocation(randomLocation, HuskHomes.getSettings().getServerID()); - } else { - hasFailed = true; - MessageManager.sendMessage(player, "error_rtp_randomization_timeout"); - } - } - - private Location randomLocation(World world) { - // Generate a random location - Random random = ThreadLocalRandom.current(); - - int x; - int y = 64; - int z; - double blockCenterX = 0.5; - double blockCenterZ = 0.5; - - // The furthest distance at which a player can be teleported to - int rtpRange = Math.min( - HuskHomes.getSettings().getRtpRange(), - (int) world.getWorldBorder().getSize() - 1 - ); - - // Calculate random X and Z coords - x = random.nextInt(rtpRange); - z = random.nextInt(rtpRange); - - // Determine if the plugin should teleport to positive or negative Z - if (random.nextBoolean()) { - x *= -1; - blockCenterX *= -1; - } - if (random.nextBoolean()) { - z *= -1; - blockCenterZ *= -1; - } - - // Put together random location, get the highest block plus one to determine Y - Location randomLocation = new Location(world, (x + blockCenterX), y, (z + blockCenterZ)); - y = world.getHighestBlockYAt(randomLocation) + 1; - randomLocation.setY(y); - - return randomLocation; - } - - // Checks to see if the location is safe to teleport to - private boolean isLocationSafe(Location location) { - int x = location.getBlockX(); - int y = location.getBlockY()-1; - int z = location.getBlockZ(); - - World world = location.getWorld(); - - // Failsafe check in case the world is null - if (world != null) { - // Ensure we are inside of the world border. - if (!world.getWorldBorder().isInside(location)) { - return false; - } - - // Get instances of the blocks around where the player would teleport - Block block = world.getBlockAt(x, y, z); - Block below = world.getBlockAt(x, y - 1, z); - Block above = world.getBlockAt(x, y + 1, z); - - // Check to see if those blocks are safe to teleport to - if (!UNSAFE_BLOCKS.contains(block.getType()) && block.getType().isSolid()) { - if (!UNSAFE_BLOCKS.contains(above.getType())) { - return !UNSAFE_BLOCKS.contains(below.getType()); - } - } - } - return false; - } - - private Location getRandomLocation(World world) { - for (int i = 0; i < MAX_RANDOM_ATTEMPTS; i++) { - Location randomLocation = randomLocation(world); - if (isLocationSafe(randomLocation)) { - return randomLocation; - } - } - - return null; - } - - public boolean hasFailed() { - return hasFailed; - } -} diff --git a/src/main/java/me/william278/huskhomes2/teleport/points/SetPoint.java b/src/main/java/me/william278/huskhomes2/teleport/points/SetPoint.java deleted file mode 100644 index c4238db9..00000000 --- a/src/main/java/me/william278/huskhomes2/teleport/points/SetPoint.java +++ /dev/null @@ -1,82 +0,0 @@ -package me.william278.huskhomes2.teleport.points; - -import org.bukkit.Location; -import java.time.Instant; -import java.time.ZoneId; -import java.time.format.DateTimeFormatter; -import java.time.format.FormatStyle; -import java.util.Locale; - -public class SetPoint extends TeleportationPoint { - - private String name; - private String description; - private final long creationTime; - - public SetPoint(String worldName, double x, double y, double z, float yaw, float pitch, String server, String name, String description, long creationTime) { - super(worldName, x, y, z, yaw, pitch, server); - this.name = name; - this.description = description; - this.creationTime = creationTime; - } - - public SetPoint(Location location, String serverName, String name, String description) { - super(location, serverName); - this.name = name; - this.description = description; - this.creationTime = Instant.now().getEpochSecond(); - } - - /** - * Returns the name of the point - * @return the point name - */ - public String getName() { - return name; - } - - /** - * Returns the description of the point - * @return the point description - */ - public String getDescription() { - return description; - } - - /** - * Set the name of the point - * @param name the new point name - */ - public void setName(String name) { - this.name = name; - } - - /** - * Set the description of the point - * @param description the new point description - */ - public void setDescription(String description) { - this.description = description; - } - - /** - * Get the creation time epoch seconds of the point - */ - public long getCreationTime() { - return creationTime; - } - - /** - * Return a formatted string displaying the time this point was created - * @return The formatted creation time string - */ - public String getFormattedCreationTime() { - if (creationTime == 0) { - return "N/A"; - } - return DateTimeFormatter.ofLocalizedDateTime(FormatStyle.MEDIUM, FormatStyle.SHORT) - .withLocale(Locale.getDefault()) - .withZone(ZoneId.systemDefault()) - .format(Instant.ofEpochSecond(creationTime)); - } -} diff --git a/src/main/java/me/william278/huskhomes2/teleport/points/TeleportationPoint.java b/src/main/java/me/william278/huskhomes2/teleport/points/TeleportationPoint.java deleted file mode 100644 index 1297793e..00000000 --- a/src/main/java/me/william278/huskhomes2/teleport/points/TeleportationPoint.java +++ /dev/null @@ -1,163 +0,0 @@ -package me.william278.huskhomes2.teleport.points; - -import me.william278.huskhomes2.HuskHomes; -import org.bukkit.Bukkit; -import org.bukkit.Location; -import org.bukkit.World; - -/** - * HuskHomes' position representation object; represents an in-game location on a server - */ -public class TeleportationPoint { - - protected String server; - protected String worldName; - protected double x; - protected double y; - protected double z; - protected float yaw; - protected float pitch; - - /** - * Update the location of a TeleportationPoint - * - * @param location a new Bukkit location - * @param server a new Bungee server ID - * @throws IllegalStateException if the location supplied has an unloaded world - */ - public void setLocation(Location location, String server) throws IllegalStateException { - if (!location.isWorldLoaded()) { - throw new IllegalStateException("The location provided has a world not loaded"); - } - assert location.getWorld() != null; - - worldName = location.getWorld().getName(); - x = location.getX(); - y = location.getY(); - z = location.getZ(); - yaw = location.getYaw(); - pitch = location.getPitch(); - this.server = server; - } - - /** - * HuskHomes' position representation object; represents an in-game location on a server - * - * @param location The Bukkit location - * @param server The Bungee server ID which the location is on - */ - public TeleportationPoint(Location location, String server) { - if (!location.isWorldLoaded()) { - throw new IllegalStateException("The location provided has a world not loaded"); - } - setLocation(location, server); - } - - /** - * HuskHomes' position representation object; represents an in-game location on a server - * - * @param worldName The name of the location's world - * @param x The location's x-coordinate - * @param y The location's y-coordinate - * @param z The location's z-coordinate - * @param yaw The location's yaw angle - * @param pitch The location's pitch angle - * @param server The Bungee server ID which the location is on - */ - public TeleportationPoint(String worldName, double x, double y, double z, float yaw, float pitch, String server) { - this.server = server; - this.worldName = worldName; - this.x = x; - this.y = y; - this.z = z; - this.yaw = yaw; - this.pitch = pitch; - } - - /** - * Get the Bukkit {@link Location} from a TeleportationPoint - * - * @return the Bukkit location on the server from a TeleportationPoint - * @throws IllegalStateException if the location is not valid on the server - */ - public Location getLocation() { - World world = Bukkit.getWorld(worldName); - if (world == null) { - throw new IllegalStateException(worldName + " is not loaded on this server; failed to fetch location"); - } - return new Location(world, x, y, z, yaw, pitch); - } - - /** - * Get the name of the world from a TeleportationPoint - * - * @return the name of the world the position is on from a TeleportationPoint - */ - public String getWorldName() { - return worldName; - } - - /** - * Get the Bungee server ID from a TeleportationPoint - * - * @return the TeleportationPoint's Bungee server ID - */ - public String getServer() { - return server; - } - - /** - * Get the x-coordinate of a TeleportationPoint - * - * @return the x-coordinate - */ - public double getX() { - return x; - } - - /** - * Get the y-coordinate of a TeleportationPoint - * - * @return the y-coordinate - */ - public double getY() { - return y; - } - - /** - * Get the z-coordinate of a TeleportationPoint - * - * @return the z-coordinate - */ - public double getZ() { - return z; - } - - /** - * Get the yaw angle of a TeleportationPoint - * - * @return the yaw angle - */ - public float getYaw() { - return yaw; - } - - /** - * Get the pitch angle of a TeleportationPoint - * - * @return the pitch angle - */ - public float getPitch() { - return pitch; - } - - /** - * Returns the TeleportationPoint as a formatted string - * - * @return the TeleportationPoint - */ - @Override - public String toString() { - return x + ", " + y + ", " + z + " (" + worldName + (HuskHomes.getSettings().doBungee() ? "/" + server : "") + ")"; - } -} diff --git a/src/main/java/me/william278/huskhomes2/teleport/points/Warp.java b/src/main/java/me/william278/huskhomes2/teleport/points/Warp.java deleted file mode 100644 index 7609b544..00000000 --- a/src/main/java/me/william278/huskhomes2/teleport/points/Warp.java +++ /dev/null @@ -1,66 +0,0 @@ -package me.william278.huskhomes2.teleport.points; - -import me.william278.huskhomes2.HuskHomes; -import me.william278.huskhomes2.util.MessageManager; -import org.apache.commons.lang.StringUtils; -import org.bukkit.Location; -import org.bukkit.entity.Player; -import org.bukkit.permissions.PermissionAttachmentInfo; - -/** - * An object representing an in-game warp - * @author William - */ -public class Warp extends SetPoint { - - /** - * An object representing an in-game warp - * @param location the Bukkit location of the Warp - * @param server The Bungee server ID of the Warp - * @param name The name of the Warp - */ - public Warp(Location location, String server, String name) { - super(location, server, name, MessageManager.getRawMessage("warp_default_description")); - } - - /** - * An object representing an in-game warp - * @param teleportationPoint The position of the Warp - * @param name The name of the Warp - * @param description The description of the Warp - */ - public Warp(TeleportationPoint teleportationPoint, String name, String description, long creationTime) { - super(teleportationPoint.worldName, teleportationPoint.x, teleportationPoint.y, teleportationPoint.z, teleportationPoint.yaw, teleportationPoint.pitch, teleportationPoint.server, name, description, creationTime); - } - - /** - * Whether the player can use the warp - * @param player The player - * @return boolean; whether they can use the warp - */ - public boolean canUse(Player player) { - return getWarpCanUse(player, getName()); - } - - // Returns if the player has permission to access the warp - public static boolean getWarpCanUse(Player p, String warpName) { - if (!HuskHomes.getSettings().doPermissionRestrictedWarps()) { - return true; - } - p.recalculatePermissions(); - String permissionFormat = HuskHomes.getSettings().getWarpRestrictionPermissionFormat(); - if (p.hasPermission("huskhomes.warp.*") || p.hasPermission(permissionFormat + "*")) { return true; } // Always return true if they have the wildcard - for (PermissionAttachmentInfo permissionAI : p.getEffectivePermissions()) { - String permission = permissionAI.getPermission(); - if (permission.contains(permissionFormat)) { - try { - if (permission.split("\\.")[StringUtils.countMatches(permissionFormat, ".")].equalsIgnoreCase(warpName)) { - return permissionAI.getValue(); - } - } catch (Exception ignored) {} - } - } - return false; - } - -} diff --git a/src/main/java/me/william278/huskhomes2/util/ChatList.java b/src/main/java/me/william278/huskhomes2/util/ChatList.java deleted file mode 100644 index 439f5fd3..00000000 --- a/src/main/java/me/william278/huskhomes2/util/ChatList.java +++ /dev/null @@ -1,71 +0,0 @@ -package me.william278.huskhomes2.util; - -import de.themoep.minedown.MineDown; -import net.md_5.bungee.api.chat.BaseComponent; - -import java.util.ArrayList; - -public class ChatList { - - private final ArrayList items; - private final String pageChangeCommand; - private final int itemsPerPage; - private final int maxPage; - private final String itemSeparator; - private final boolean spacePageOptions; - - public ChatList(ArrayList items, int itemsPerPage, String pageChangeCommand, String itemSeparator, boolean spacePageOptions) { - this.pageChangeCommand = pageChangeCommand; - this.items = new ArrayList<>(); - this.itemsPerPage = itemsPerPage; - this.items.addAll(items); - this.maxPage = (int) Math.ceil(((double) items.size()) / itemsPerPage); - this.itemSeparator = itemSeparator; - this.spacePageOptions = spacePageOptions; - } - - public boolean doesNotContainPage(int pageNo) { - return pageNo > items.size(); - } - - public BaseComponent[] getPage(int pageNo) { - StringBuilder builder = new StringBuilder(); - int indexStart = ((pageNo - 1) * itemsPerPage) + 1; - int indexEnd = (indexStart - 1) + itemsPerPage; - - for (int i = indexStart - 1; (i < indexEnd) && (i <= (items.size() - 1)); i++) { - String item = items.get(i); - builder.append(item); - if ((i < (indexEnd - 1)) && (i < (items.size() - 1))) { - builder.append(itemSeparator); - } - } - - // Send a message if there's no items on the page - if (builder.toString().equals("")) { - builder.append(MessageManager.getRawMessage("page_no_items")); - } - builder.append("\n"); - if (spacePageOptions) { - builder.append("\n"); - } - - if (pageNo == 1) { - if (pageNo == maxPage) { - builder.append(MessageManager.getRawMessage("page_options_min_max", - Integer.toString(pageNo), Integer.toString(maxPage))); - } else { - builder.append(MessageManager.getRawMessage("page_options_min", - Integer.toString(pageNo), Integer.toString(maxPage), pageChangeCommand + " " + (pageNo + 1))); - } - } else if (pageNo == maxPage) { - builder.append(MessageManager.getRawMessage("page_options_max", - pageChangeCommand + " " + (pageNo - 1), Integer.toString(pageNo), Integer.toString(maxPage))); - } else { - builder.append(MessageManager.getRawMessage("page_options", - pageChangeCommand + " " + (pageNo - 1), Integer.toString(pageNo), - Integer.toString(maxPage), pageChangeCommand + " " + (pageNo + 1))); - } - return new MineDown(builder.toString()).toComponent(); - } -} diff --git a/src/main/java/me/william278/huskhomes2/util/EditingHandler.java b/src/main/java/me/william278/huskhomes2/util/EditingHandler.java deleted file mode 100644 index 5e1ef535..00000000 --- a/src/main/java/me/william278/huskhomes2/util/EditingHandler.java +++ /dev/null @@ -1,64 +0,0 @@ -package me.william278.huskhomes2.util; - -import de.themoep.minedown.MineDown; -import me.william278.huskhomes2.HuskHomes; -import me.william278.huskhomes2.teleport.points.Home; -import me.william278.huskhomes2.teleport.points.SetPoint; -import me.william278.huskhomes2.teleport.points.Warp; -import org.bukkit.entity.Player; - -public class EditingHandler { - - public static void showEditHomeOptions(Player p, Home home) { - if (home.getOwnerUsername().equalsIgnoreCase(p.getName())) { - MessageManager.sendMessage(p, "edit_home_title", home.getName()); - } else { - MessageManager.sendMessage(p, "edit_home_title_other", home.getOwnerUsername(), home.getName()); - } - showPointDetails(p, home); - if (!home.isPublic()) { - if (home.getOwnerUsername().equalsIgnoreCase(p.getName())) { - MessageManager.sendMessage(p, "edit_home_privacy_private"); - } else { - MessageManager.sendMessage(p, "edit_home_privacy_private_other", home.getOwnerUsername()); - } - } else { - MessageManager.sendMessage(p, "edit_home_privacy_public"); - } - - if (p.hasPermission("huskhomes.edithome.public")) { - if (home.isPublic()) { - MessageManager.sendMessage(p, "edit_home_options_make_private", home.getOwnerUsername(), home.getName()); - } else { - MessageManager.sendMessage(p, "edit_home_options_make_public", home.getOwnerUsername(), home.getName()); - } - } else { - MessageManager.sendMessage(p, "edit_home_options", home.getOwnerUsername(), home.getName()); - } - } - - public static void showEditWarpOptions(Player p, Warp warp) { - MessageManager.sendMessage(p, "edit_warp_title", warp.getName()); - showPointDetails(p, warp); - - MessageManager.sendMessage(p, "edit_warp_options", warp.getName()); - } - - private static void showPointDetails(Player p, SetPoint point) { - MessageManager.sendMessage(p, "edit_description", MineDown.escape(point.getDescription() - .replace("]", "\\]") - .replace("[", "\\[") - .replace("(", "\\(") - .replace(")", "\\)"))); - MessageManager.sendMessage(p, "edit_timestamp", point.getFormattedCreationTime()); - MessageManager.sendMessage(p, "edit_location", - Integer.toString((int) point.getX()), - Integer.toString((int) point.getY()), - Integer.toString((int) point.getZ())); - MessageManager.sendMessage(p, "edit_world", point.getWorldName()); - if (HuskHomes.getSettings().doBungee()) { - MessageManager.sendMessage(p, "edit_server", point.getServer()); - } - } - -} \ No newline at end of file diff --git a/src/main/java/me/william278/huskhomes2/util/MessageManager.java b/src/main/java/me/william278/huskhomes2/util/MessageManager.java deleted file mode 100644 index 9bec1360..00000000 --- a/src/main/java/me/william278/huskhomes2/util/MessageManager.java +++ /dev/null @@ -1,143 +0,0 @@ -package me.william278.huskhomes2.util; - -import de.themoep.minedown.MineDown; -import me.william278.huskhomes2.HuskHomes; -import net.md_5.bungee.api.ChatMessageType; -import org.apache.commons.lang.StringEscapeUtils; -import org.apache.commons.lang.StringUtils; -import org.bukkit.Bukkit; -import org.bukkit.configuration.file.FileConfiguration; -import org.bukkit.configuration.file.YamlConfiguration; -import org.bukkit.entity.Player; - -import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.nio.charset.StandardCharsets; -import java.util.HashMap; -import java.util.Map; - -import static org.bukkit.configuration.file.YamlConfiguration.loadConfiguration; - -public class MessageManager { - - private static final Map messages = new HashMap<>(); - - private static final HuskHomes plugin = HuskHomes.getInstance(); - - // Create a new file, at the pointer specified - private static void createFile(File f) { - try { - if (!f.createNewFile()) { - Bukkit.getLogger().severe("Failed to create messages.yml file!"); - } - } catch (IOException e) { - Bukkit.getLogger().severe("An error occurred while creating the messages.yml file!"); - e.printStackTrace(); - } - } - - // Save the config file specified to the file at the pointer specified - private static void saveFile(FileConfiguration config, File f) { - try { - config.save(f); - } catch (IOException e) { - Bukkit.getLogger().severe("An error occurred while saving the messages.yml file!"); - } - } - - // (Re-)Load the messages file with the correct language - public static void loadMessages(String language) { - File f = new File(plugin.getDataFolder() + File.separator + "messages_" + language + ".yml"); - - if (!f.exists()) { - createFile(f); - } - FileConfiguration config = loadConfiguration(f); - config.options().header( - """ - ------------------------------\s - | HuskHomes Messages | - | Developed by William278 | - ------------------------------\s - If you'd like to use a different language, you can change it in the config.yml\s - Change the appearance/text of messages in the plugin using this config.\s - This config makes use of MineDown formatting, with extensive support for custom colors & formats.\s - For formatting help, see: https://github.com/Phoenix616/MineDown or check the HuskHomes Wiki."""); - InputStream defaultMessageFile = plugin.getResource("languages/" + language + ".yml"); - if (defaultMessageFile != null) { - YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(new InputStreamReader(defaultMessageFile, StandardCharsets.UTF_8)); - config.setDefaults(yamlConfiguration); - config.options().copyHeader(true).copyDefaults(true); - } - saveFile(config, f); - messages.clear(); - for (String message : config.getKeys(false)) { - messages.put(message, StringEscapeUtils.unescapeJava(config.getString(message))); - } - } - - // Send a message with multiple placeholders - public static void sendMessage(Player p, String messageID, String... placeholderReplacements) { - sendMessage(p, ChatMessageType.CHAT, messageID, placeholderReplacements); - } - - // Send a message with multiple placeholders - public static void sendActionBar(Player p, String messageID, String... placeholderReplacements) { - sendMessage(p, ChatMessageType.ACTION_BAR, messageID, placeholderReplacements); - } - - // Send a message to the correct channel - private static void sendMessage(Player p, ChatMessageType chatMessageType, String messageID, String... placeholderReplacements) { - String message = getRawMessage(messageID); - - // Don't send empty messages - if (StringUtils.isEmpty(message)) { - return; - } - - int replacementIndexer = 1; - - // Replace placeholders - for (String replacement : placeholderReplacements) { - String replacementString = "%" + replacementIndexer + "%"; - message = message.replace(replacementString, replacement); - replacementIndexer = replacementIndexer + 1; - } - - // Convert to baseComponents[] via MineDown formatting and send - p.spigot().sendMessage(chatMessageType, new MineDown(message).replace().toComponent()); - } - - // Send a message with no placeholder parameters - public static void sendMessage(Player p, String messageID) { - String message = getRawMessage(messageID); - - // Don't send empty messages - if (StringUtils.isEmpty(message)) { - return; - } - - // Convert to baseComponents[] via MineDown formatting and send - p.spigot().sendMessage(new MineDown(message).replace().toComponent()); - } - - public static String getRawMessage(String messageID) { - return messages.get(messageID); - } - - public static String getRawMessage(String messageID, String... placeholderReplacements) { - String message = messages.get(messageID); - int replacementIndexer = 1; - - // Replace placeholders - for (String replacement : placeholderReplacements) { - String replacementString = "%" + replacementIndexer + "%"; - message = message.replace(replacementString, replacement); - replacementIndexer = replacementIndexer + 1; - } - return message; - } - -} diff --git a/src/main/java/me/william278/huskhomes2/util/NameAutoCompleter.java b/src/main/java/me/william278/huskhomes2/util/NameAutoCompleter.java deleted file mode 100644 index 53c52f2f..00000000 --- a/src/main/java/me/william278/huskhomes2/util/NameAutoCompleter.java +++ /dev/null @@ -1,40 +0,0 @@ -package me.william278.huskhomes2.util; - -import me.william278.huskhomes2.HuskHomes; -import org.bukkit.Bukkit; -import org.bukkit.entity.Player; - -public class NameAutoCompleter { - - /* - * Auto complete a player's name - */ - public static String getAutoCompletedName(String inputName) { - if (!HuskHomes.getSettings().doAutoCompletePlayerNames()) { - return inputName; - } - String found = inputName; - - // Try for an exact match first. - Player localPlayer = Bukkit.getPlayerExact(inputName); - if (localPlayer != null) { - return localPlayer.getName(); - } - - // Iterate through players in the PlayerList to find a match - String lowerName = inputName.toLowerCase(); - int delta = Integer.MAX_VALUE; - for (String playerName : HuskHomes.getPlayerList().getPlayers()) { - if (playerName.toLowerCase().startsWith(lowerName)) { - int currentDelta = Math.abs(playerName.length() - lowerName.length()); - if (currentDelta < delta) { - found = playerName; - delta = currentDelta; - } - if (currentDelta == 0) break; - } - } - return found; - } - -} diff --git a/src/main/java/me/william278/huskhomes2/util/PlayerList.java b/src/main/java/me/william278/huskhomes2/util/PlayerList.java deleted file mode 100644 index cdf59409..00000000 --- a/src/main/java/me/william278/huskhomes2/util/PlayerList.java +++ /dev/null @@ -1,56 +0,0 @@ -package me.william278.huskhomes2.util; - -import me.william278.huskhomes2.HuskHomes; -import me.william278.huskhomes2.data.message.CrossServerMessageHandler; -import me.william278.huskhomes2.data.message.Message; -import org.bukkit.Bukkit; -import org.bukkit.entity.Player; - -import java.util.Arrays; -import java.util.HashSet; - -public class PlayerList { - - private static final HuskHomes plugin = HuskHomes.getInstance(); - private static final long playerListUpdateTime = HuskHomes.getSettings().getCrossServerTabUpdateDelay() * 20L; - - private static HashSet players; - - public PlayerList() { - players = new HashSet<>(); - } - - public void initialize() { - Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> Bukkit.getScheduler().runTaskTimer(plugin, () -> { - for (Player p : Bukkit.getOnlinePlayers()) { - updateList(p); - break; - } - }, 0, playerListUpdateTime)); - } - - public void updateList(Player updateRequester) { - Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> { - players.clear(); - if (HuskHomes.getSettings().doBungee() && HuskHomes.getSettings().doCrossServerTabCompletion()) { - Bukkit.getScheduler().runTask(plugin, () -> CrossServerMessageHandler.getMessage(Message.MessageType.GET_PLAYER_LIST, HuskHomes.getSettings().getServerID()).sendToAllServers(updateRequester)); - } - for (Player player : Bukkit.getOnlinePlayers()) { - players.add(player.getName()); - } - }); - } - - public HashSet getPlayers() { - return players; - } - - public void addPlayer(String player) { - players.add(player); - } - - public void addPlayers(String[] playerList) { - players.addAll(Arrays.asList(playerList)); - } - -} diff --git a/src/main/java/me/william278/huskhomes2/util/RegexUtil.java b/src/main/java/me/william278/huskhomes2/util/RegexUtil.java deleted file mode 100644 index f3fa0d94..00000000 --- a/src/main/java/me/william278/huskhomes2/util/RegexUtil.java +++ /dev/null @@ -1,11 +0,0 @@ -package me.william278.huskhomes2.util; - -import java.util.regex.Pattern; - -public final class RegexUtil { - - public static final Pattern DESCRIPTION_PATTERN = Pattern.compile("[a-zA-Z0-9\\d\\-_\\s]+"); - public static final Pattern NAME_PATTERN = Pattern.compile("[A-Za-z0-9_\\-]+"); - public static final Pattern OWNER_NAME_PATTERN = Pattern.compile("[A-Za-z0-9_]+\\.[A-Za-z0-9_\\-]+"); - -} diff --git a/src/main/java/me/william278/huskhomes2/util/UpdateChecker.java b/src/main/java/me/william278/huskhomes2/util/UpdateChecker.java deleted file mode 100644 index e185a22f..00000000 --- a/src/main/java/me/william278/huskhomes2/util/UpdateChecker.java +++ /dev/null @@ -1,57 +0,0 @@ -package me.william278.huskhomes2.util; -import me.william278.huskhomes2.HuskHomes; - -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStreamReader; -import java.net.URL; -import java.net.URLConnection; -import java.util.logging.Level; - -public class UpdateChecker { - - private final static int SPIGOT_PROJECT_ID = 83767; - private final String currentVersion; - private String latestVersion; - private final HuskHomes plugin; - - public UpdateChecker(HuskHomes plugin) { - this.plugin = plugin; - this.currentVersion = this.plugin.getDescription().getVersion(); - - try { - final URL url = new URL("https://api.spigotmc.org/legacy/update.php?resource=" + SPIGOT_PROJECT_ID); - URLConnection urlConnection = url.openConnection(); - this.latestVersion = new BufferedReader(new InputStreamReader(urlConnection.getInputStream())).readLine(); - } catch (IOException e) { - this.plugin.getLogger().log(Level.WARNING, "An IOException occurred when trying to check for updates."); - this.latestVersion = "Unknown"; - } catch (Exception e) { - this.plugin.getLogger().log(Level.WARNING, "An exception occurred when trying to check for updates."); - this.latestVersion = "Unknown"; - } - } - - public boolean isUpToDate() { - if (latestVersion.equalsIgnoreCase("Unknown")) { - return true; - } - return latestVersion.equals(currentVersion); - } - - public String getLatestVersion() { - return latestVersion; - } - - public String getCurrentVersion() { - return currentVersion; - } - - public void logToConsole() { - if (!isUpToDate()) { - plugin.getLogger().log(Level.WARNING, "A new version of HuskHomes is available: Version " - + latestVersion + " (Currently running: " + currentVersion + ")"); - } - } -} - diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml deleted file mode 100644 index e180ad3b..00000000 --- a/src/main/resources/config.yml +++ /dev/null @@ -1,98 +0,0 @@ -# ------------------------------ -# | HuskHomes Config | -# | Developed by William278 | -# ------------------------------ -# Configuration guide: https://github.com/WiIIiam278/HuskHomes2/wiki/Config-File - -language: 'en-gb' -check_for_updates: true -data_storage_options: - storage_type: 'SQLite' - mysql_credentials: - host: localhost - port: 3306 - database: HuskHomes - username: root - password: pa55w0rd - params: '?autoReconnect=true&useSSL=false&zeroDateTimeBehavior=convertToNull' - connection_pool_options: - maximum_pool_size: 10 - minimum_idle: 10 - maximum_lifetime: 1800000 - keepalive_time: 0 - connection_timeout: 5000 - table_names: - player_data: 'huskhomes_player_data' - locations_data: 'huskhomes_location_data' - homes_data: 'huskhomes_home_data' - warps_data: 'huskhomes_warp_data' -general: - max_sethomes: 10 - auto_complete_player_names: true - home_limit_permission_stacking: false - teleport_warmup_time: 5 - teleport_warmup_display: ACTION_BAR - teleport_request_expiry_time: 60 - allow_unicode_descriptions: true - enable_back_command: true - use_paperlib_if_available: true - sounds: - teleportation_complete: 'ENTITY_ENDERMAN_TELEPORT' - teleportation_warmup: 'BLOCK_NOTE_BLOCK_BANJO' - teleportation_cancelled: 'ENTITY_ITEM_BREAK' - lists: - private_homes_per_page: 10 - public_homes_per_page: 10 - warps_per_page: 10 - help_menu: - hide_commands_without_permission: true - hide_huskhomes_command: false -bungee_options: - enable_bungee_mode: false - server_id: 'server' - cluster_id: 0 - messenger_type: 'pluginmessage' - redis_credentials: - host: localhost - port: 6379 - password: '' - use_ssl: false - tab_complete_cross_server: - enabled: true - delay: 60 -warp_command: - enabled: true - permission_restrictions: - require_permission: false - format: 'huskhomes.warp.' - hide_restricted_warps: true -spawn_command: - enabled: true - force_teleport_on_login: false - bungee_network_spawn: - enabled: false - warp_name: 'Spawn' -random_teleport_command: - enabled: true - cooldown: 30 - range: 5000 -map_integration: - enabled: false - plugin: 'dynmap' - markers: - public_homes: - show: true - set_name: 'Public Homes' - warps: - show: true - set_name: 'Warps' -economy_integration: - enabled: false - free_home_slots: 5 - costs: - additional_home_slot: 100 - make_home_public: 50 - random_teleport: 20 - back: 0 -handle_vanished_players: true -config_file_version: 9 \ No newline at end of file diff --git a/src/main/resources/languages/de-de.yml b/src/main/resources/languages/de-de.yml deleted file mode 100644 index 9d22909a..00000000 --- a/src/main/resources/languages/de-de.yml +++ /dev/null @@ -1,153 +0,0 @@ -error_no_permission: '[Fehler:](#ff3300) [Du hast nicht die benötigten Berechtigungen, um diesen Befehl auszuführen.](#ff7e5e)' -error_no_last_position: '[Fehler:](#ff3300) [Du hast keine letzte Position, zu der du zurückkehren kannst!](#ff7e5e)' -teleporting_last_position: '[Rückkehr zu deiner letzten Position in](#00fb9a) [%1%](#00fb9a bold) [Sekunden](#00fb9a)' -teleporting_offline_player: '[Du wirst dorthin teleportiert, wo sich %1% zuletzt ausgeloggt hat...](#00fb9a)' -teleporting_countdown_start: '[Du wirst teleportiert in](#00fb9a) [%1%](#00fb9a bold) [Sekunden](#00fb9a)' -teleporting_cancelled_movement: '[Teleportation abgebrochen; du hast dich bewegt!](#ff7e5e)' -teleporting_cancelled_damage: '[Teleportation abgebrochen; du hast Schaden erhalten!](#ff7e5e)' -teleporting_complete: '[Teleportation abgeschlossen!](#00fb9a)' -teleporting_action_bar_countdown: '[Teleportation in](#00fb9a) [%1%](#00fb9a bold)[...](#00fb9a)' -teleporting_action_bar_cancelled: '[Teleportation abgebrochen!](#ff7e5e)' -teleporting_please_stand_still: '[Die Teleportation wird abgebrochen, wenn du dich bewegst oder Schaden nimmst.](gray)' -home_deleted: '[Du hast dein Home namens](#00fb9a) [%1%](#00fb9a bold) [erfolgreich gelöscht](#00fb9a)' -home_deleted_other: '[Du hast das Home von %1% namens](#00fb9a) [%2%](#00fb9a bold) [erfolgreich gelöscht](#00fb9a)' -warp_deleted: '[Du hast den Warp namens](#00fb9a) [%1%](#00fb9a bold) [erfolgreich gelöscht](#00fb9a)' -error_home_invalid: '[Fehler:](#ff3300) [Du hast kein Home mit namens "%1%"](#ff7e5e)' -error_warp_invalid: '[Fehler:](#ff3300) [Es existiert kein Warp namens "%1%"](#ff7e5e)' -error_invalid_syntax: '[Fehler:](#ff3300) [Falscher Syntax. Nutze: %1%](#ff7e5e)' -edit_home_title: '\n[Ändere Home Details für dein Home namens](#00fb9a) [%1%](#00fb9a bold)[:](#00fb9a)' -edit_home_title_other: '\n[Ändere Home Details für das Home von %1% namens](#00fb9a) [%2%](#00fb9a bold)[:](#00fb9a)' -edit_home_options: '\n[[Teleport]](green show_text=&7Teleportiere dich zu diesem Home run_command=/huskhomes:home %1%.%2%) [[Löschen]](red show_text=&7Lösche dieses Home run_command=/huskhomes:delhome %1%.%2%) [[Position ändern]](blue show_text=&7Ändere die Position dieses Homes run_command=/huskhomes:edithome %1%.%2% location)\n[[Umbenennen]](yellow show_text=&7Ändere den Namen dieses Homes suggest_command=/huskhomes:edithome %1%.%2% rename ) [[Beschreibung ändern]](gold show_text=&7Ändere die Beschreibung dieses Homes suggest_command=/huskhomes:edithome %1%.%2% description )\n' -edit_home_options_make_public: '\n[[Teleport]](green show_text=&7Teleportiere dich zu diesem Home run_command=/huskhomes:home %1%.%2%) [[Löschen]](red show_text=&7Lösche dieses Home run_command=/huskhomes:delhome %1%.%2%) [[Position ändern]](blue show_text=&7Ändere die Position dieses Homes run_command=/huskhomes:edithome %1%.%2% location)\n[[Umbenennen]](yellow show_text=&7Ändere den Namen dieses Homes suggest_command=/huskhomes:edithome %1%.%2% rename ) [[Beschreibung ändern]](gold show_text=&7Ändere die Beschreibung dieses Homes suggest_command=/huskhomes:edithome %1%.%2% description ) [[Öffentlich stellen]](dark_green show_text=&7Mache dieses Home öffentlich sichtbar run_command=/huskhomes:edithome %1%.%2% public)\n' -edit_home_options_make_private: '\n[[Teleport]](green show_text=&7Teleportiere dich zu diesem Home run_command=/huskhomes:home %1%.%2%) [[Löschen]](red show_text=&7Lösche dieses Home run_command=/huskhomes:delhome %1%.%2%) [[Position ändern]](blue show_text=&7Ändere die Position dieses Homes run_command=/huskhomes:edithome %1%.%2% location)\n[[Umbenennen]](yellow show_text=&7Ändere den Namen dieses Homes suggest_command=/huskhomes:edithome %1%.%2% rename ) [[Beschreibung ändern]](gold show_text=&7Ändere die Beschreibung dieses Homes suggest_command=/huskhomes:edithome %1%.%2% description ) [[Privat stellen]](dark_red show_text=&7Mache dieses Home privat run_command=/huskhomes:edithome %1%.%2% private)\n' -edit_home_privacy_private: '• Zugang: &#ff7e5e&Privat &7(Nur du kannst dieses Home benutzen)' -edit_home_privacy_private_other: '• Zugang: &#ff7e5e&Privat &7(Nur %1% kann dieses Home benutzen)' -edit_home_privacy_public: '• Zugang: &aÖffentlich &7(Jeder kann dieses Home benutzen)' -edit_home_privacy_public_success: '[Du hast dein Home](#00fb9a) [%1%](#00fb9a bold) [öffentlich sichtbar gemacht.](#00fb9a)' -edit_home_privacy_public_success_economy: '[Du hast dein Home](#00fb9a) [%1%](#00fb9a bold)[öffentlich sichtbar gemacht für %2%.](#00fb9a)' -edit_home_privacy_private_success: '[Du hast dein Home](#00fb9a) [%1%](#00fb9a bold) [auf privat gestellt.](#00fb9a)' -error_edit_home_privacy_already_public: '[Fehler:](#ff3300) [Dieses Home ist bereits öffentlich.](#ff7e5e)' -error_edit_home_privacy_already_private: '[Fehler:](#ff3300) [Dieses Home ist bereits privat.](#ff7e5e)' -error_edit_home_privacy_no_permission: '[Fehler:](#ff3300) [Du hast nicht die benötigten Berechtigungen um Homes öffentlich zu machen.](#ff7e5e)' -error_edit_home_description_length: '[Fehler:](#ff3300) [Die Beschreibung eines Homes muss weniger als 255 Zeichen lang sein.](#ff7e5e)' -error_edit_home_description_characters: '[Fehler:](#ff3300) [Die Beschreibung eines Homes darf nur alphanumerische (A-Z, 0-9) Zeichen, Bindestriche (-) und Unterstriche (_) beinhalten.](#ff7e5e)' -edit_home_update_location: '[Der Standort des Homes](#00fb9a) [%1%](#00fb9a bold) [wurde zu deiner aktuellen Position geändert.](#00fb9a)' -edit_home_update_description: '[Die Beschreibung für das Home](#00fb9a) [%1%](#00fb9a bold) [wurde zu "%2%" geändert.](#00fb9a)' -edit_home_update_name: '[Der Name deines Homes wurde erfolgreich geändert: %1% →](#00fb9a) [%2%](#00fb9a bold)' -edit_warp_title: '\n[Ändere Details für den Warp](#00fb9a) [%1%](#00fb9a bold)[:](#00fb9a)' -edit_warp_options: '\n[[Teleport]](green show_text=&7Teleportiere dich zu diesem Warp run_command=/huskhomes:warp %1%) [[Löschen]](red show_text=&7Lösche diesen Warp run_command=/huskhomes:delwarp %1%) [[Position ändern]](blue show_text=&7Ändere die Position dieses Warps run_command=/huskhomes:editwarp %1% location)\n[[Umbenennen]](yellow show_text=&7Änderen den Namen dieses Warps suggest_command=/huskhomes:editwarp %1% rename ) [[Beschreibung ändern]](gold show_text=&7Ändere die Beschreibung dieses Warps suggest_command=/huskhomes:editwarp %1% description )\n' -error_edit_warp_description_length: '[Fehler:](#ff3300) [Die Beschreibung eines Warps muss weniger als 255 Zeichen lang sein.](#ff7e5e)' -error_edit_warp_description_characters: '[Fehler:](#ff3300) [Die Beschreibung eines Warps darf nur alphanumerische (A-Z, 0-9) Zeichen, Bindestriche (-) und Unterstriche (_) beinhalten.](#ff7e5e)' -edit_warp_update_location: '[Der Standort des Warpes](#00fb9a) [%1%](#00fb9a bold) [wurde zu deiner aktuellen Position geändert.](#00fb9a)' -edit_warp_update_description: '[Die Beschreibung für den Warp](#00fb9a) [%1%](#00fb9a bold) [wurde zu "%2%" geändert.](#00fb9a)' -edit_warp_update_name: '[Der Name des Warps wurde erfolgreich geändert: %1% →](#00fb9a) [%2%](#00fb9a bold)' -edit_description: '• Beschreibung: &7%1%' -edit_location: '• Position: &7%1%, %2%, %3%' -edit_world: '• Welt: &7%1%' -edit_server: '• Server: &7%1%' -edit_timestamp: '• Erstellt: &7%1%' -error_no_homes_set: '[Fehler:](#ff3300) [Du hast noch keine Homes gesetzt!](#ff7e5e)' -error_no_public_homes_set: '[Fehler:](#ff3300) [Es existiert kein öffentliches Home!](#ff7e5e)' -error_no_warps_set: '[Fehler:](#ff3300) [Ex existiert kein Warp!](#ff7e5e)' -private_home_list_page_top: '\n[Homes von %1%:](#00fb9a) [(](#00fb9a)[%2%-%3%](#00fb9a bold) [von](#00fb9a) [%4%](#00fb9a bold)[)](#00fb9a)\n' -public_home_list_page_top: '\n[Öffentliche Homes:](#00fb9a) [(](#00fb9a)[%1%-%2%](#00fb9a bold) [von](#00fb9a) [%3%](#00fb9a bold)[)](#00fb9a)\n' -warp_list_page_top: '\n[Warps:](#00fb9a) [(](#00fb9a)[%1%-%2%](#00fb9a bold) [von](#00fb9a) [%3%](#00fb9a bold)[)](#00fb9a)\n' -error_public_home_invalid: '[Fehler:](#ff3300) [Es wurde kein öffentliches Home von %1% namens %2% gefunden.](#ff7e5e)' -error_set_home_invalid_characters: '[Fehler:](#ff3300) [Homenamen müssen alphanumerisch sein (A-Z, 0-9, -_)](#ff7e5e)' -error_set_home_invalid_length: '[Fehler:](#ff3300) [Homenamen dürfen nur bis zu 16 Zeichen enthalten!](#ff7e5e)' -error_set_warp_invalid_characters: '[Fehler:](#ff3300) [Warpnamen müssen alphanumerisch sein (A-Z,0-9, -_)](#ff7e5e)' -error_set_warp_invalid_length: '[Fehler:](#ff3300) [Warpnamen dürfen nur bis zu 16 Zeichen enthalten!](#ff7e5e)' -error_set_home_maximum_homes: '[Fehler:](#ff3300) [Du darfst nicht mehr als %1% Homes setzen!](#ff7e5e)' -error_insufficient_funds: '[Fehler:](#ff3300) [Du hast nicht genug Geld! (Kosten: %1%)](#ff7e5e)' -set_home_spent_money: '[Erfolgreich %1% ausgegeben, für ein zusätzliches Home!](gray)' -set_home_used_free_slots: '[Du hast alle deine kostenlose Homeslots aufgebraucht (%1%); zusätzliche Homes kosten jeweils %2%.](gray)' -set_home_success: '[Erfolgreich ein neues Home namens](#00fb9a) [%1%](#00fb9a bold) [gesetzt.](#00fb9a)' -set_warp_success: '[Erfolgreich ein neues Warp namens](#00fb9a) [%1%](#00fb9a bold) [gesetzt.](#00fb9a)' -error_set_home_name_taken: '[Fehler:](#ff3300) [Du besitzt bereits ein Home mit diesem Namen.](#ff7e5e)' -error_set_warp_name_taken: '[Fehler:](#ff3300) [Es existiert bereits ein Warp mit diesem Namen.](#ff7e5e)' -set_spawn_success: '[Die Spawn-Position für diesen Server wurde auf deinen aktuellen Standort aktualisiert.](#00fb9a)' -error_spawn_undefined: '[Fehler:](#ff3300) [Auf diesem Server ist keine Spawn-Position definiert.](#ff7e5e)' -error_tpa_no_pending_request: '[Fehler:](#ff3300) [Du hast keine ausstehende Teleportanfrage.](#ff7e5e)' -error_tpa_request_expired: '[Fehler:](#ff3300) [Deine ausstehende Teleportanfrage ist abgelaufen.](#ff7e5e)' -error_player_not_found: '[Fehler:](#ff3300) [Der Spieler %1% konnte nicht gefunden werden.](#ff7e5e)' -return_by_death: '[Dorthin zurückkehren, wo du gestorben bist?](gray) [/back](#00fb9a show_text=�fb9a&Klicke um zu deinem Todespunkt zurückzukehren run_command=/back)' -teleport_request_options: '[Eine Option anklicken:](gray) [[Akzeptieren]](#00fb9a show_text=�fb9a&Akzeptiere die Teleportanfrage; /tpaccept %1% run_command=/tpaccept %1%) [•](gray) [[Ablehnen]](#ff7e5e show_text=&#ff7e5e&Lehnre die Teleportanfrage ab; /tpdeny %1% run_command=/tpdeny %1%)' -tpa_you_accepted: '[Du hast die Teleportanfrage von %1% akzeptiert](#00fb9a)' -tpa_you_declined: '[Du hast die Teleportanfrage von %1% abgelehnt](#ff7e5e)' -tpa_has_accepted: '[%1% hat deine Teleportanfrage akzeptiert](#00fb9a)' -tpa_has_declined: '[%1% hat deine Teleportanfrage abgelehnt](#ff7e5e)' -tpa_request_sent: '[Du hast](#00fb9a) [%1%](#00fb9a bold) [eine Teleportanfrage zu seiner Position gesendet](#00fb9a)' -tpa_request_ask: '[%1%](#00fb9a bold) [hat dir eine Teleportanfrage zu deiner Position gesendet](#00fb9a)' -tpahere_request_sent: '[Du hast](#00fb9a) [%1%](#00fb9a bold) [eine Teleportanfrage zu deiner Position gesendet](#00fb9a)' -tpahere_request_ask: '[%1%](#00fb9a bold) [hat dir eine Teleportanfrage zu seiner Position gesendet](#00fb9a)' -error_tp_self: '[Fehler:](#ff3300) [Du kannst dich nicht zu dir selbst teleportieren!](#ff7e5e)' -error_rtp_invalid_dimension: '[Fehler:](#ff3300) [Du kannst dich nur in der Oberwelt zufällig teleportieren!](#ff7e5e)' -error_rtp_cooldown: '[Fehler:](#ff3300) [Du musst %1% Minuten warten, bevor du dich wieder zufällig teleportieren kannst.](#ff7e5e)' -rtp_spent_money: '[Du hast %1% ausgegeben, um zufällig zu teleportieren.](gray)' -back_spent_money: '[Du hast %1% ausgegeben, um zu deiner letzten Position zurückzukehren.](gray)' -error_command_disabled: '[Fehler:](#ff3300) [Dieser Befehl ist deaktiviert!](#ff7e5e)' -error_console_only: '[Fehler:](#ff3300) [Dieser Befehl kann nur über die Serverkonsole ausgeführt werden.](#ff7e5e)' -error_tp_invalid_world: '[Fehler:](#ff3300) [Bitte gib eine gültige Welt auf diesem Server an.](#ff7e5e)' -error_rtp_randomization_timeout: '[Fehler:](#ff3300) [Es ist nicht gelungen, einen sicheren zufälligen Ort zu finden, um dich zu teleportieren.](#ff7e5e)' -list_item_divider: ' [•](gray) ' -home_list_item: '[[%1%]](show_text=&7%3% run_command=/huskhomes:edithome %2%.%1%)' -public_home_list_item: '[[%1%]](show_text=�fb9a&%2%: &7%3% run_command=/huskhomes:phome %2%.%1%)' -warp_list_item: '[[%1%]](show_text=&7%2% run_command=/huskhomes:warp %1%)' -home_default_description: 'Home von %1%' -warp_default_description: 'Ein öffentlich zugänglicher Warp' -delete_all_homes_confirm: '[Warnung:](#ff3300) [Bist du dir sicher, dass du alle deine Homes löschen möchtest?](#ff7e5e)\n[Sobald dies bestätigt wurde, ist es nicht mehr möglich, sie wiederherzustellen.](gray)\n[→](gray) [[Bestätigen]](#ff3300 show_text=&#ff3300&Klicke um die Löschung zu bestätigen. Dies kann nicht rückgängig gemacht werden! run_command=/delhome all confirm)' -delete_all_warps_confirm: '[Warnung:](#ff3300) [Bist du dir sicher, dass du alle Warps löschen möchtest?](#ff7e5e)\n[Sobald dies bestätigt wurde, ist es nicht mehr möglich, sie wiederherzustellen.](gray)\n[→](gray) [[Bestätigen]](#ff3300 show_text=&#ff3300&Klicke um die Löschung zu bestätigen. Dies kann nicht rückgängig gemacht werden! run_command=/delwarp all confirm)' -delete_all_homes_success: '[Erfolgreich alle](#00fb9a) [%1%](#00fb9a bold) [Home(s) gelöscht.](#00fb9a)' -delete_all_warps_success: '[Erfolgreich alle](#00fb9a) [%1%](#00fb9a bold) [Warp(s) gelöscht.](#00fb9a)' -error_permission_restricted_warp: '[Fehler:](#ff3300) [Du hast nicht die Erlaubnis, nach %1% zu warpen!](#ff7e5e)' -teleporting_complete_console: '[Die Konsole hat dich zu %1% teleportiert.](gray)' -spawn_warp_default_description: 'Die /spawn-Position des Servers' -error_invalid_page_number: '[Fehler:](#ff3300) [Bitte gib eine gültige Seitenzahl an.](#ff7e5e)' -page_options: '[←](gray show_text=&7Sehe vorherige Seite run_command=%1%) [Seite %2%/%3%](#00fb9a) [→](gray show_text=&7Sehe nächste Seite run_command=%4%)' -page_options_min: '[Seite %1%/%2%](#00fb9a) [→](gray show_text=&7Sehe nächste Seite run_command=%3%)' -page_options_min_max: '[Seite %1%/%2%](#00fb9a)' -page_options_max: '[←](gray show_text=&7Sehe vorherige Seite run_command=%1%) [Seite %2%/%3%](#00fb9a)' -page_no_items: '[(Nichts kann auf dieser Seite angezeigt werden)](gray show_text=&7Versuche eine andere Seitenzahl)' -command_list_header: '\n[HuskHomes](#00fb9a bold) [| Befehlsliste](#00fb9a)' -command_list_item: '[/%1%](#00fb9a show_text=�fb9a&%2% suggest_command=/%1%) [•](white) [%3%](gray)' -error_invalid_on_arrival: '[Fehler:](#ff3300) [Die Teleportation konnte nicht abgeschlossen werden, da die Zielwelt nicht gefunden werden konnte.](#ff7e5e)' -tpignore_toggle_on: '[Du](#00fb9a) [ignorierst](#00fb9a bold) [aktuell eingehende Teleportanfragen.](#00fb9a) [(Klicke zum Umschalten)](gray show_text=&7Klicke um eingehende Teleportanfragen zu erhalten. run_command=/huskhomes:tpignore)' -tpignore_toggle_off: '[Du](#00fb9a) [erhältst](#00fb9a bold) [aktuell eingehende Teleportanfragen.](#00fb9a) [(Klicke zum Umschalten)](gray show_text=&7Klicke um eingehende Teleportanfragen zu ignorieren. run_command=/huskhomes:tpignore)' -tpignore_on_reminder: '[Du ignorierst aktuell eingehende Teleportanfragen!](gray) [(Klicke zum Umschalten)](gray show_text=&7Klicke um eingehende Teleportanfragen zu erhalten. run_command=/huskhomes:tpignore)' -error_ignoring_teleport_requests: '[Fehler:](#ff3300) [Du ignorierst aktuell eingehende Teleportanfragen!](#ff7e5e) [(Klicke zum Umschalten)](#ff7e5e show_text=&#ff7e5e&Klicke um eingehende Teleportanfragen zu erhalten. run_command=/huskhomes:tpignore)' -error_no_offline_position: '[Fehler:](#ff3300) [Konnte nicht herausfinden, wo sich %1% zuletzt ausgeloggt hat.](#ff7e5e)' -error_invalid_player: '[Fehler:](#ff3300) [Bitte gib den Namen eines gültigen Spielers an!](#ff7e5e)' -error_no_homes_set_other: '[Fehler:](#ff3300) [%1% hat keine Homes gesetzt!](#ff7e5e)' -error_home_invalid_other: '[Fehler:](#ff3300) [%1% hat kein Home mit dem Namen "%2%" gesetzt](#ff7e5e)' -error_edit_home_maximum_public_homes: '[Fehler:](#ff3300) [Du kannst maximal %1% Homes öffentlich sichtbar machen.](#ff7e5e)' -tpaall_request_sent: '[Du hast eine Teleportanfrage gestellt und alle gebeten, sich zu dir zu teleportieren!](#00fb9a)' -error_no_other_online_players: '[Fehler:](#ff3300) [Es gibt keine anderen Spieler, die online sind und sich zu dir teleportieren können.](#ff7e5e)' -teleporting_all_players: '[Teleportiere alle Spieler zu deiner Position...](#00fb9a)' -error_illegal_target_coordinates: '[Fehler:](#ff3300) [Teleport abgebrochen, da er die möglichen Grenzen der Welt überschreitet.](#ff7e5e)' -home_command_description: 'Teleportiere dich zu einem deiner Homes' -sethome_command_description: 'Setze ein neues Home mit dem angegebenen Namen' -delhome_command_description: 'Lösche ein Home, welches du vorher gesetzt hast' -edithome_command_description: 'Ändere eins deiner Homes' -warp_command_description: 'Teleportiere dich zu einem Warp' -setwarp_command_description: 'Setze ein neues Warp mit dem angegebenen Namen' -delwarp_command_description: 'Lösche ein Warp' -editwarp_command_description: 'Ändere ein Warp' -back_command_description: 'Kehre zu deiner letzten Position oder zu deinem Todespunkt zurück.' -homelist_command_description: 'Erhalte eine Liste deiner Homes' -warplist_command_description: 'Siehe die Liste der Warps' -publichomelist_command_description: 'Siehe die Liste der öffentlichen Homes' -publichome_command_description: 'Teleportiere dich zu einem öffentlichen Home' -tp_command_description: 'Teleportiere dich zu einem anderen Spieler oder eine Position' -tphere_command_description: 'Teleportiere einen Spieler zu dir' -tpa_command_description: 'Frage einem Spieler sich zu ihm zu teleportieren' -tpahere_command_description: 'Frage einem Spieler sich zu dir zu teleportieren' -tpaccept_command_description: 'Akzeptiere eine Teleportanfrage' -tpdeny_command_description: 'Lehne eine Teleportanfrage ab' -tpignore_command_description: 'Ignoriere einkommende Teleportanfragen' -tpoffline_command_description: 'Teleportiere dich an die letzte Position eines Spielers' -rtp_command_description: 'Teleportiere dich an eine zufällige Position' -spawn_command_description: 'Teleportiere dich zum Spawn' -setspawn_command_description: 'Setze die Spawnposition' -tpaall_command_description: 'Frage alle Spieler sich zu dir zu teleportieren' -tpall_command_description: 'Teleportiere alle Spieler zu dir' -huskhomes_command_description: 'Siehe Plugin-Information und lade die Config-Dateien neu' diff --git a/src/main/resources/languages/en-gb.yml b/src/main/resources/languages/en-gb.yml deleted file mode 100644 index b5962741..00000000 --- a/src/main/resources/languages/en-gb.yml +++ /dev/null @@ -1,153 +0,0 @@ -error_no_permission: '[Error:](#ff3300) [You do not have permission to execute that command.](#ff7e5e)' -error_no_last_position: '[Error:](#ff3300) [You have no last position to return to!](#ff7e5e)' -teleporting_last_position: '[Returning to your last position in](#00fb9a) [%1%](#00fb9a bold) [seconds](#00fb9a)' -teleporting_offline_player: '[Teleporting you to where %1% last logged out...](#00fb9a)' -teleporting_countdown_start: '[You will be teleported in](#00fb9a) [%1%](#00fb9a bold) [seconds](#00fb9a)' -teleporting_cancelled_movement: '[Teleportation cancelled; you moved!](#ff7e5e)' -teleporting_cancelled_damage: '[Teleportation cancelled; you took damage!](#ff7e5e)' -teleporting_complete: '[Teleportation complete!](#00fb9a)' -teleporting_action_bar_countdown: '[Teleporting in](#00fb9a) [%1%](#00fb9a bold)[...](#00fb9a)' -teleporting_action_bar_cancelled: '[Teleportation cancelled!](#ff7e5e)' -teleporting_please_stand_still: '[Teleportation will be cancelled if you move or take damage.](gray)' -home_deleted: '[Successfully deleted the home called](#00fb9a) [%1%](#00fb9a bold)' -home_deleted_other: '[Successfully deleted %1%''s home,](#00fb9a) [%2%](#00fb9a bold)' -warp_deleted: '[Successfully deleted the warp called](#00fb9a) [%1%](#00fb9a bold)' -error_home_invalid: '[Error:](#ff3300) [You do not have a home named "%1%"](#ff7e5e)' -error_warp_invalid: '[Error:](#ff3300) [There is no warp set named "%1%"](#ff7e5e)' -error_invalid_syntax: '[Error:](#ff3300) [Incorrect syntax. Usage: %1%](#ff7e5e)' -edit_home_title: '\n[Edit home details for](#00fb9a) [%1%](#00fb9a bold)[:](#00fb9a)' -edit_home_title_other: '\n[Edit home details for %1%''s home,](#00fb9a) [%2%](#00fb9a bold)[:](#00fb9a)' -edit_home_options: '\n[[Teleport]](green show_text=&7Teleport to this home run_command=/huskhomes:home %1%.%2%) [[Delete]](red show_text=&7Delete this home run_command=/huskhomes:delhome %1%.%2%) [[Relocate]](blue show_text=&7Update this home''s location run_command=/huskhomes:edithome %1%.%2% location)\n[[Rename]](yellow show_text=&7Change the name of this home suggest_command=/huskhomes:edithome %1%.%2% rename ) [[Edit Description]](gold show_text=&7Update the description of this home suggest_command=/huskhomes:edithome %1%.%2% description )\n' -edit_home_options_make_public: '\n[[Teleport]](green show_text=&7Teleport to this home run_command=/huskhomes:home %1%.%2%) [[Delete]](red show_text=&7Delete this home run_command=/huskhomes:delhome %1%.%2%) [[Relocate]](blue show_text=&7Update this home''s location run_command=/huskhomes:edithome %1%.%2% location)\n[[Rename]](yellow show_text=&7Change the name of this home suggest_command=/huskhomes:edithome %1%.%2% rename ) [[Edit Description]](gold show_text=&7Update the description of this home suggest_command=/huskhomes:edithome %1%.%2% description ) [[Make Public]](dark_green show_text=&7Open this home to the public run_command=/huskhomes:edithome %1%.%2% public)\n' -edit_home_options_make_private: '\n[[Teleport]](green show_text=&7Teleport to this home run_command=/huskhomes:home %1%.%2%) [[Delete]](red show_text=&7Delete this home run_command=/huskhomes:delhome %1%.%2%) [[Relocate]](blue show_text=&7Update this home''s location run_command=/huskhomes:edithome %1%.%2% location)\n[[Rename]](yellow show_text=&7Change the name of this home suggest_command=/huskhomes:edithome %1%.%2% rename ) [[Edit Description]](gold show_text=&7Update the description of this home suggest_command=/huskhomes:edithome %1%.%2% description ) [[Make Private]](dark_red show_text=&7Make this home private run_command=/huskhomes:edithome %1%.%2% private)\n' -edit_home_privacy_private: '• Access: &#ff7e5e&Private &7(Only you can use it)' -edit_home_privacy_private_other: '• Access: &#ff7e5e&Private &7(Only %1% can use it)' -edit_home_privacy_public: '• Access: &aPublic &7(Anyone can use it)' -edit_home_privacy_public_success: '[Successfully made the home,](#00fb9a) [%1%](#00fb9a bold)[, open to the public.](#00fb9a)' -edit_home_privacy_public_success_economy: '[Successfully made the home,](#00fb9a) [%1%](#00fb9a bold)[, open to the public for %2%.](#00fb9a)' -edit_home_privacy_private_success: '[Successfully made the home,](#00fb9a) [%1%](#00fb9a bold)[, private.](#00fb9a)' -error_edit_home_privacy_already_public: '[Error:](#ff3300) [This home is already set as public.](#ff7e5e)' -error_edit_home_privacy_already_private: '[Error:](#ff3300) [This home is already set as private.](#ff7e5e)' -error_edit_home_privacy_no_permission: '[Error:](#ff3300) [You do not have permission to make homes public.](#ff7e5e)' -error_edit_home_description_length: '[Error:](#ff3300) [Home descriptions must be less than 255 characters in length.](#ff7e5e)' -error_edit_home_description_characters: '[Error:](#ff3300) [Home descriptions may only contain alphanumeric (A-Z, 0-9) characters, hyphens (-) and underscores (_)](#ff7e5e)' -edit_home_update_location: '[Re-located](#00fb9a) [%1%](#00fb9a bold) [to your current position.](#00fb9a)' -edit_home_update_description: '[Changed the description for](#00fb9a) [%1%](#00fb9a bold) [to "%2%"](#00fb9a)' -edit_home_update_name: '[Successfully changed your home''s name: %1% →](#00fb9a) [%2%](#00fb9a bold)' -edit_warp_title: '\n[Edit details for the warp](#00fb9a) [%1%](#00fb9a bold)[:](#00fb9a)' -edit_warp_options: '\n[[Teleport]](green show_text=&7Teleport to this warp run_command=/huskhomes:warp %1%) [[Delete]](red show_text=&7Delete this warp run_command=/huskhomes:delwarp %1%) [[Relocate]](blue show_text=&7Update this warp''s location run_command=/huskhomes:editwarp %1% location)\n[[Rename]](yellow show_text=&7Change the name of this warp suggest_command=/huskhomes:editwarp %1% rename ) [[Edit Description]](gold show_text=&7Update this warp''s description suggest_command=/huskhomes:editwarp %1% description )\n' -error_edit_warp_description_length: '[Error:](#ff3300) [Warp descriptions must be less than 255 characters in length.](#ff7e5e)' -error_edit_warp_description_characters: '[Error:](#ff3300) [Warp descriptions may only contain alphanumeric (A-Z, 0-9) characters, hyphens (-) and underscores (_)](#ff7e5e)' -edit_warp_update_location: '[Re-located the warp](#00fb9a) [%1%](#00fb9a bold) [to your current position.](#00fb9a)' -edit_warp_update_description: '[Changed the description for the warp](#00fb9a) [%1%](#00fb9a bold) [to "%2%".](#00fb9a)' -edit_warp_update_name: '[Successfully changed a warp''s name: %1% →](#00fb9a) [%2%](#00fb9a bold)' -edit_description: '• Description: &7%1%' -edit_location: '• Location: &7%1%, %2%, %3%' -edit_world: '• World: &7%1%' -edit_server: '• Server: &7%1%' -edit_timestamp: '• Created: &7%1%' -error_no_homes_set: '[Error:](#ff3300) [You haven''t set any homes!](#ff7e5e)' -error_no_public_homes_set: '[Error:](#ff3300) [There aren''t any public homes set!](#ff7e5e)' -error_no_warps_set: '[Error:](#ff3300) [There aren''t any warps set!](#ff7e5e)' -private_home_list_page_top: '\n[%1%''s Homes:](#00fb9a) [(](#00fb9a)[%2%-%3%](#00fb9a bold) [of](#00fb9a) [%4%](#00fb9a bold)[)](#00fb9a)\n' -public_home_list_page_top: '\n[Public Homes:](#00fb9a) [(](#00fb9a)[%1%-%2%](#00fb9a bold) [of](#00fb9a) [%3%](#00fb9a bold)[)](#00fb9a)\n' -warp_list_page_top: '\n[Warps:](#00fb9a) [(](#00fb9a)[%1%-%2%](#00fb9a bold) [of](#00fb9a) [%3%](#00fb9a bold)[)](#00fb9a)\n' -error_public_home_invalid: '[Error:](#ff3300) [Could not find a public home owned by %1% called %2%.](#ff7e5e)' -error_set_home_invalid_characters: '[Error:](#ff3300) [Home names must be alphanumeric (A-Z, 0-9, -_)](#ff7e5e)' -error_set_home_invalid_length: '[Error:](#ff3300) [Home names can only contain up to 16 characters!](#ff7e5e)' -error_set_warp_invalid_characters: '[Error:](#ff3300) [Warp names must be alphanumeric (A-Z,0-9, -_)](#ff7e5e)' -error_set_warp_invalid_length: '[Error:](#ff3300) [Warp names can only contain up to 16 characters!](#ff7e5e)' -error_set_home_maximum_homes: '[Error:](#ff3300) [You can only set a maximum of %1% homes!](#ff7e5e)' -error_insufficient_funds: '[Error:](#ff3300) [You do not have enough money! (Cost: %1%)](#ff7e5e)' -set_home_spent_money: '[Successfully spent %1% to set an additional home!](gray)' -set_home_used_free_slots: '[You''ve used all of your free set home slots (%1%); setting additional homes will cost %2% each.](gray)' -set_home_success: '[Successfully set a new home called](#00fb9a) [%1%](#00fb9a bold)' -set_warp_success: '[Successfully set a new warp called](#00fb9a) [%1%](#00fb9a bold)' -error_set_home_name_taken: '[Error:](#ff3300) [You already have a home set with that name.](#ff7e5e)' -error_set_warp_name_taken: '[Error:](#ff3300) [There is already a warp set with that name.](#ff7e5e)' -set_spawn_success: '[Updated spawn position for this server to your current location.](#00fb9a)' -error_spawn_undefined: '[Error:](#ff3300) [There is no spawn position defined on this server.](#ff7e5e)' -error_tpa_no_pending_request: '[Error:](#ff3300) [You do not have a pending teleport request.](#ff7e5e)' -error_tpa_request_expired: '[Error:](#ff3300) [Your pending teleport request has expired.](#ff7e5e)' -error_player_not_found: '[Error:](#ff3300) [Could not find the player %1%.](#ff7e5e)' -return_by_death: '[Return to where you died?](gray) [/back](#00fb9a show_text=�fb9a&Click to return to where you died run_command=/back)' -teleport_request_options: '[Click an option:](gray) [[Accept]](#00fb9a show_text=�fb9a&Accept the teleport request; /tpaccept %1% run_command=/tpaccept %1%) [•](gray) [[Decline]](#ff7e5e show_text=&#ff7e5e&Decline the teleport request; /tpdeny %1% run_command=/tpdeny %1%)' -tpa_you_accepted: '[You accepted %1%''s teleport request](#00fb9a)' -tpa_you_declined: '[You declined %1%''s teleport request](#ff7e5e)' -tpa_has_accepted: '[%1% accepted your teleport request](#00fb9a)' -tpa_has_declined: '[%1% declined your teleport request](#ff7e5e)' -tpa_request_sent: '[You sent a teleport request to teleport to](#00fb9a) [%1%](#00fb9a bold)' -tpa_request_ask: '[%1%](#00fb9a bold) [has requested to teleport to you](#00fb9a)' -tpahere_request_sent: '[You sent a teleport request asking](#00fb9a) [%1%](#00fb9a bold) [to teleport to you](#00fb9a)' -tpahere_request_ask: '[%1%](#00fb9a bold) [has requested that you teleport to them](#00fb9a)' -error_tp_self: '[Error:](#ff3300) [You can''t teleport to yourself!](#ff7e5e)' -error_rtp_invalid_dimension: '[Error:](#ff3300) [You can only randomly teleport in the overworld!](#ff7e5e)' -error_rtp_cooldown: '[Error:](#ff3300) [You must wait %1% minutes before randomly teleporting again.](#ff7e5e)' -rtp_spent_money: '[Spent %1% to randomly teleport.](gray)' -back_spent_money: '[Spent %1% to return to your last position.](gray)' -error_command_disabled: '[Error:](#ff3300) [That command is disabled!](#ff7e5e)' -error_console_only: '[Error:](#ff3300) [That command can only be run from the server console.](#ff7e5e)' -error_tp_invalid_world: '[Error:](#ff3300) [Please specify a valid server world.](#ff7e5e)' -error_rtp_randomization_timeout: '[Error:](#ff3300) [Failed to find a safe random location to teleport you.](#ff7e5e)' -list_item_divider: ' [•](gray) ' -home_list_item: '[[%1%]](show_text=&7%3% run_command=/huskhomes:edithome %2%.%1%)' -public_home_list_item: '[[%1%]](show_text=�fb9a&%2%: &7%3% run_command=/huskhomes:phome %2%.%1%)' -warp_list_item: '[[%1%]](show_text=&7%2% run_command=/huskhomes:warp %1%)' -home_default_description: '%1%''s home' -warp_default_description: 'A publicly accessible warp' -delete_all_homes_confirm: '[Warning:](#ff3300) [Are you sure you want to delete all of your homes?](#ff7e5e)\n[Once you confirm, it will not be possible to recover them.](gray)\n[→](gray) [[Confirm]](#ff3300 show_text=&#ff3300&Click to confirm deletion. This cannot be undone. run_command=/delhome all confirm)' -delete_all_warps_confirm: '[Warning:](#ff3300) [Are you sure you want to delete every warp?](#ff7e5e)\n[Once you confirm, it will not be possible to recover them.](gray)\n[→](gray) [[Confirm]](#ff3300 show_text=&#ff3300&Click to confirm deletion. This cannot be undone. run_command=/delwarp all confirm)' -delete_all_homes_success: '[Successfully deleted your](#00fb9a) [%1%](#00fb9a bold) [home(s).](#00fb9a)' -delete_all_warps_success: '[Successfully deleted all](#00fb9a) [%1%](#00fb9a bold) [server warp(s).](#00fb9a)' -error_permission_restricted_warp: '[Error:](#ff3300) [You do not have permission to warp to %1%!](#ff7e5e)' -teleporting_complete_console: '[Console teleported you to %1%.](gray)' -spawn_warp_default_description: 'The /spawn position of the server' -error_invalid_page_number: '[Error:](#ff3300) [Please specify a valid page number.](#ff7e5e)' -page_options: '[←](gray show_text=&7View previous page run_command=%1%) [Viewing Page %2%/%3%](#00fb9a) [→](gray show_text=&7View next page run_command=%4%)' -page_options_min: '[Viewing Page %1%/%2%](#00fb9a) [→](gray show_text=&7View next page run_command=%3%)' -page_options_min_max: '[Viewing Page %1%/%2%](#00fb9a)' -page_options_max: '[←](gray show_text=&7View previous page run_command=%1%) [Viewing Page %2%/%3%](#00fb9a)' -page_no_items: '[(No items to display on this page)](gray show_text=&7Try a different page number)' -command_list_header: '\n[HuskHomes](#00fb9a bold) [| Command List](#00fb9a)' -command_list_item: '[/%1%](#00fb9a show_text=�fb9a&%2% suggest_command=/%1%) [•](white) [%3%](gray)' -error_invalid_on_arrival: '[Error:](#ff3300) [Failed to finish your teleportation as the target world could not be found.](#ff7e5e)' -tpignore_toggle_on: '[You are now](#00fb9a) [ignoring](#00fb9a bold) [incoming teleport requests.](#00fb9a) [(Click to toggle)](gray show_text=&7Click to listen for incoming teleport requests run_command=/huskhomes:tpignore)' -tpignore_toggle_off: '[You are now](#00fb9a) [listening](#00fb9a bold) [to any incoming teleport requests.](#00fb9a) [(Click to toggle)](gray show_text=&7Click to ignore incoming teleport requests run_command=/huskhomes:tpignore)' -tpignore_on_reminder: '[You are currently ignoring incoming teleport requests!](gray) [(Click to toggle)](gray show_text=&7Click to listen for incoming teleport requests run_command=/huskhomes:tpignore)' -error_ignoring_teleport_requests: '[Error:](#ff3300) [You are currently ignoring teleport requests!](#ff7e5e) [(Click to toggle)](#ff7e5e show_text=&#ff7e5e&Click to listen for incoming teleport requests run_command=/huskhomes:tpignore)' -error_no_offline_position: '[Error:](#ff3300) [Could not find where %1% last logged out.](#ff7e5e)' -error_invalid_player: '[Error:](#ff3300) [Please specify the name of a valid player!](#ff7e5e)' -error_no_homes_set_other: '[Error:](#ff3300) [%1% hasn''t set any homes!](#ff7e5e)' -error_home_invalid_other: '[Error:](#ff3300) [%1% doesn''t have a home set named "%2%"](#ff7e5e)' -error_edit_home_maximum_public_homes: '[Error:](#ff3300) [You can only make a maximum of %1% homes public.](#ff7e5e)' -tpaall_request_sent: '[You sent a teleport request asking everyone to teleport to you!](#00fb9a)' -error_no_other_online_players: '[Error:](#ff3300) [There are no other online players who could teleport to you.](#ff7e5e)' -teleporting_all_players: '[Teleporting all players to your position...](#00fb9a)' -error_illegal_target_coordinates: '[Error:](#ff3300) [Aborted teleport as it exceeds the possible game world limits.](#ff7e5e)' -home_command_description: 'Teleport to one of your homes' -sethome_command_description: 'Set a new home with given name' -delhome_command_description: 'Delete a home you previously set' -edithome_command_description: 'Edit one of your homes' -warp_command_description: 'Teleport to a warp' -setwarp_command_description: 'Set a new warp with given name' -delwarp_command_description: 'Delete a warp' -editwarp_command_description: 'Edit a warp' -back_command_description: 'Return to your previous position, or where you died' -homelist_command_description: 'Get a list of your homes' -warplist_command_description: 'View the list of warps' -publichomelist_command_description: 'View the list of public homes' -publichome_command_description: 'Teleport to a public home' -tp_command_description: 'Teleport to another player or location' -tphere_command_description: 'Teleport another player to you' -tpa_command_description: 'Request to teleport to another player' -tpahere_command_description: 'Request another player to teleport to you' -tpaccept_command_description: 'Accept a teleport request' -tpdeny_command_description: 'Deny a teleport request' -tpignore_command_description: 'Ignore incoming teleport requests' -tpoffline_command_description: 'Teleport to where a player was last online' -rtp_command_description: 'Teleport randomly into the wild' -spawn_command_description: 'Teleport to spawn' -setspawn_command_description: 'Set the spawn position' -tpaall_command_description: 'Request that everyone teleports to you' -tpall_command_description: 'Teleport everyone to your position' -huskhomes_command_description: 'View plugin information & reload configs' \ No newline at end of file diff --git a/src/main/resources/languages/es-es.yml b/src/main/resources/languages/es-es.yml deleted file mode 100644 index a4209cc6..00000000 --- a/src/main/resources/languages/es-es.yml +++ /dev/null @@ -1,153 +0,0 @@ -error_no_permission: '[Error:](#ff3300) [No tienes permiso para ejecutar este comando.](#ff7e5e)' -error_no_last_position: '[Error:](#ff3300) [No puedes volver a ninguna de tus ubicaciones anteriores!](#ff7e5e)' -teleporting_last_position: '[Volviendo a tu última ubicación en](#00fb9a) [%1%](#00fb9a bold) [segundos](#00fb9a)' -teleporting_offline_player: '[Teletransportandote a donde %1% se ha desconectado...](#00fb9a)' -teleporting_countdown_start: '[Serás teletransportado en](#00fb9a) [%1%](#00fb9a bold) [segundos](#00fb9a)' -teleporting_cancelled_movement: '[Teletransporte cancelado; te has movido!](#ff7e5e)' -teleporting_cancelled_damage: '[Teletransporte cancelado; Has recibido daño!](#ff7e5e)' -teleporting_complete: '[Teletransporte completado!](#00fb9a)' -teleporting_action_bar_countdown: '[Teletransporte en](#00fb9a) [%1%](#00fb9a bold)[...](#00fb9a)' -teleporting_action_bar_cancelled: '[Teletransporte cancelado!](#ff7e5e)' -teleporting_please_stand_still: '[El teletransporte será cancelado si te mueves o recibes daño.](gray)' -home_deleted: '[Se ha eliminado satisfactoriamente la casa llamada](#00fb9a) [%1%](#00fb9a bold)' -home_deleted_other: '[Has eliminado la casa de %1%,](#00fb9a) [%2%](#00fb9a bold)' -warp_deleted: '[Has eliminado el warp](#00fb9a) [%1%](#00fb9a bold)' -error_home_invalid: '[Error:](#ff3300) [No tienes ninguna casa con nombre "%1%"](#ff7e5e)' -error_warp_invalid: '[Error:](#ff3300) [No hay ningún warp con nombre "%1%"](#ff7e5e)' -error_invalid_syntax: '[Error:](#ff3300) [Sintaxis incorrecto. Uso: %1%](#ff7e5e)' -edit_home_title: '\n[Edita los detalles de la casa para](#00fb9a) [%1%](#00fb9a bold)[:](#00fb9a)' -edit_home_title_other: '\n[Edita los detalles de la casa de %1%,](#00fb9a) [%2%](#00fb9a bold)[:](#00fb9a)' -edit_home_options: '\n[[Teletransportarse]](green show_text=&7Teletransportate a esta casa run_command=/huskhomes:home %1%.%2%) [[Eliminar]](red show_text=&7Elimina esta casa run_command=/huskhomes:delhome %1%.%2%) [[Mover]](blue show_text=&7Cambia la ubicación de la casa run_command=/huskhomes:edithome %1%.%2% location)\n[[Renombrar]](yellow show_text=&7Cambia el nombre de esta casa suggest_command=/huskhomes:edithome %1%.%2% rename ) [[Editar Descripción]](gold show_text=&7Cambia la descripción de esta casa suggest_command=/huskhomes:edithome %1%.%2% description )\n' -edit_home_options_make_public: '\n[[Teletransportarse]](green show_text=&7Teletransportate a esta casa run_command=/huskhomes:home %1%.%2%) [[Eliminar]](red show_text=&7Elimina esta casa run_command=/huskhomes:delhome %1%.%2%) [[Mover]](blue show_text=&7Cambia la ubicación de la casa run_command=/huskhomes:edithome %1%.%2% location)\n[[Renombrar]](yellow show_text=&7Cambia el nombre de esta casa suggest_command=/huskhomes:edithome %1%.%2% rename ) [[Editar Descripción]](gold show_text=&7Cambia la descripción de esta casa suggest_command=/huskhomes:edithome %1%.%2% description ) [[Hacer Pública]](dark_green show_text=&7Haz que esta casa sea pública run_command=/huskhomes:edithome %1%.%2% public)\n' -edit_home_options_make_private: '\n[[Teletransportarse]](green show_text=&7Teletransportate a esta casa run_command=/huskhomes:home %1%.%2%) [[Eliminar]](red show_text=&7Elimina esta casa run_command=/huskhomes:delhome %1%.%2%) [[Mover]](blue show_text=&7Cambia la ubicación de la casa run_command=/huskhomes:edithome %1%.%2% location)\n[[Renombrar]](yellow show_text=&7Cambia el nombre de esta casa suggest_command=/huskhomes:edithome %1%.%2% rename ) [[Editar Descripción]](gold show_text=&7Cambia la descripción de esta casa suggest_command=/huskhomes:edithome %1%.%2% description ) [[Hacer Privada]](dark_red show_text=&7Haz que tu casa sea privada run_command=/huskhomes:edithome %1%.%2% private)\n' -edit_home_privacy_private: '• Acceso: &#ff7e5e&Privado &7(Solo tu puedes usarlo)' -edit_home_privacy_private_other: '• Acceso: &#ff7e5e&Privado &7(Solo %1% puede usarlo)' -edit_home_privacy_public: '• Acceso: &aPúblico &7(Todo el mundo puede usarlo)' -edit_home_privacy_public_success: '[Se ha abierto al público la casa](#00fb9a) [%1%](#00fb9a bold)[, satisfactoriamente.](#00fb9a)' -edit_home_privacy_public_success_economy: '[Se ha abierto al público la casa,](#00fb9a) [%1%](#00fb9a bold)[, satisfactoriamente por %2%.](#00fb9a)' -edit_home_privacy_private_success: '[La casa](#00fb9a) [%1%](#00fb9a bold)[ha sido establecida como privada](#00fb9a)' -error_edit_home_privacy_already_public: '[Error:](#ff3300) [Esta casa ya está establecida como pública .](#ff7e5e)' -error_edit_home_privacy_already_private: '[Error:](#ff3300) [Esta casa ya está establecida como privada.](#ff7e5e)' -error_edit_home_privacy_no_permission: '[Error:](#ff3300) [No tienes permiso para hacer las casas públicas.](#ff7e5e)' -error_edit_home_description_length: '[Error:](#ff3300) [La descripción de la casa tiene que tener como máximo 255 caracteres de longitud.](#ff7e5e)' -error_edit_home_description_characters: '[Error:](#ff3300) [La descripción de la casa solo puede contener caracteres alfanuméricos (A-Z, 0-9), guiones (-) y guiones bajos (_)](#ff7e5e)' -edit_home_update_location: '[La casa](#00fb9a) [%1%](#00fb9a bold) [ha sido reubicada a tu posición actual.](#00fb9a)' -edit_home_update_description: '[La descripción de la casa ha sido cambiada de](#00fb9a) [%1%](#00fb9a bold) [a "%2%"](#00fb9a)' -edit_home_update_name: '[Has cambiado el nombre de tu casa satisfactoriamente: %1% →](#00fb9a) [%2%](#00fb9a bold)' -edit_warp_title: '\n[Edita detalles del warp](#00fb9a) [%1%](#00fb9a bold)[:](#00fb9a)' -edit_warp_options: '\n[[Teletransportarse]](green show_text=&7Teletransportate a este warp run_command=/huskhomes:warp %1%) [[Eliminar]](red show_text=&7Elimina este warp run_command=/huskhomes:delwarp %1%) [[Mover]](blue show_text=&7Cambia la ubicación del warp run_command=/huskhomes:editwarp %1% location)\n[[Renombrar]](yellow show_text=&7Cambia el nombre de este warp suggest_command=/huskhomes:editwarp %1% rename ) [[Editar Descripción]](gold show_text=&7Cambia la descripción de este warp suggest_command=/huskhomes:editwarp %1% description )\n' -error_edit_warp_description_length: '[Error:](#ff3300) [La descripción del warp tiene que tener como máximo 255 caracteres de longitud.](#ff7e5e)' -error_edit_warp_description_characters: '[Error:](#ff3300) [La descripción del warp solo puede contener caracteres alfanuméricos (A-Z, 0-9), guiones (-) y guiones bajos (_)](#ff7e5e)' -edit_warp_update_location: '[El warp](#00fb9a) [%1%](#00fb9a bold) [ha sido reubicado a tu posición actual.](#00fb9a)' -edit_warp_update_description: '[La descripción de la casa ha sido cambiada de](#00fb9a) [%1%](#00fb9a bold) [a "%2%".](#00fb9a)' -edit_warp_update_name: '[Has cambiado el nombre del warp satisfactoriamente: %1% →](#00fb9a) [%2%](#00fb9a bold)' -edit_description: '• Descripción: &7%1%' -edit_location: '• Ubicación: &7%1%, %2%, %3%' -edit_world: '• Mundo: &7%1%' -edit_server: '• Servidor: &7%1%' -edit_timestamp: '• Crado: &7%1%' -error_no_homes_set: '[Error:](#ff3300) [Aún no has establecido ninguna casa!](#ff7e5e)' -error_no_public_homes_set: '[Error:](#ff3300) [No hay ninguna casa pública establecida!](#ff7e5e)' -error_no_warps_set: '[Error:](#ff3300) [No hay warps establecidos!](#ff7e5e)' -private_home_list_page_top: '\n[Casas de %1%:](#00fb9a) [(](#00fb9a)[%2%-%3%](#00fb9a bold) [de](#00fb9a) [%4%](#00fb9a bold)[)](#00fb9a)\n' -public_home_list_page_top: '\n[Casas públicas:](#00fb9a) [(](#00fb9a)[%1%-%2%](#00fb9a bold) [of](#00fb9a) [%3%](#00fb9a bold)[)](#00fb9a)\n' -warp_list_page_top: '\n[Warps:](#00fb9a) [(](#00fb9a)[%1%-%2%](#00fb9a bold) [of](#00fb9a) [%3%](#00fb9a bold)[)](#00fb9a)\n' -error_public_home_invalid: '[Error:](#ff3300) [No se ha podido encontrar una casa pública de %1% llamada %2%.](#ff7e5e)' -error_set_home_invalid_characters: '[Error:](#ff3300) [Los nombres de las casas deben ser alfanuméricos (A-Z, 0-9, -_)](#ff7e5e)' -error_set_home_invalid_length: '[Error:](#ff3300) [Los nombres de las casas solo pueden contener hasta 16 caracteres!](#ff7e5e)' -error_set_warp_invalid_characters: '[Error:](#ff3300) [Los nombres de los warps solo pueden ser alfanuméricos (A-Z,0-9, -_)](#ff7e5e)' -error_set_warp_invalid_length: '[Error:](#ff3300) [Los nombres de los warps solo pueden contener hasta 16 caracteres!](#ff7e5e)' -error_set_home_maximum_homes: '[Error:](#ff3300) [Puedes establecer un máximo de %1% casas!](#ff7e5e)' -error_insufficient_funds: '[Error:](#ff3300) [No tienes suficiente dinero! (Precio: %1%)](#ff7e5e)' -set_home_spent_money: '[Has gastado %1% para establecer una casa adicional!](gray)' -set_home_used_free_slots: '[Has establecido todas tus casas gratis (%1%); establecer más casas costará %2% cada una.](gray)' -set_home_success: '[Se ha establecido con éxito una nueva casa llamada](#00fb9a) [%1%](#00fb9a bold)' -set_warp_success: '[Se ha establecido con éxito un nuevo warp llamada](#00fb9a) [%1%](#00fb9a bold)' -error_set_home_name_taken: '[Error:](#ff3300) [Ya tienes una casa con ese nombre.](#ff7e5e)' -error_set_warp_name_taken: '[Error:](#ff3300) [Ya existe un warp con ese nombre.](#ff7e5e)' -set_spawn_success: '[La posición de aparición de este servidor ha sido establecida a tu ubicación actual.](#00fb9a)' -error_spawn_undefined: '[Error:](#ff3300) [No hay una posición de aparición establecida en este servidor.](#ff7e5e)' -error_tpa_no_pending_request: '[Error:](#ff3300) [No tienes ninguna solicitud de teletransporte pendiente.](#ff7e5e)' -error_tpa_request_expired: '[Error:](#ff3300) [Tu solicitud de teletransporte pendiente ha caducado.](#ff7e5e)' -error_player_not_found: '[Error:](#ff3300) [No se ha podido encontrar al jugador %1%.](#ff7e5e)' -return_by_death: '[Quieres regresar a donde moriste?](gray) [/back](#00fb9a show_text=�fb9a&Click para regresar al punto en el que moriste run_command=/back)' -teleport_request_options: '[Click en una opción:](gray) [[Aceptar]](#00fb9a show_text=�fb9a&Acepta la solicitud de teletransporte; /tpaccept %1% run_command=/tpaccept %1%) [•](gray) [[Rechazar]](#ff7e5e show_text=&#ff7e5e&Rechaza la solicitud de teletransporte; /tpdeny %1% run_command=/tpdeny %1%)' -tpa_you_accepted: '[Has rechazado la solicitud de teletransporte de %1%] (#00fb9a)' -tpa_you_declined: '[Has rechazado la solicitud de teletransporte de %1%] (#ff7e5e)' -tpa_has_accepted: '[%1% ha aceptado tu solicitud de teletransporte](#00fb9a)' -tpa_has_declined: '[%1% ha rechazado tu solicitud de teletransporte](#ff7e5e)' -tpa_request_sent: '[Has enviado una solicitud para teletransportarte a](#00fb9a) [%1%](#00fb9a bold)' -tpa_request_ask: '[%1%](#00fb9a bold) [ha enviado una solicitud para teletransportarse a ti](#00fb9a)' -tpahere_request_sent: '[Has enviado una solicitud de teletransporte pidiendo a](#00fb9a) [%1%](#00fb9a bold) [que se teletransporte a ti](#00fb9a)' -tpahere_request_ask: '[%1%](#00fb9a bold) [ha solicitado que te teletransportes a el](#00fb9a)' -error_tp_self: '[Error:](#ff3300) [No puedes teletransportarte a ti mismo!](#ff7e5e)' -error_rtp_invalid_dimension: '[Error:](#ff3300) [Solo puedes teletransportarte aleatoriamente en el mundo normal!](#ff7e5e)' -error_rtp_cooldown: '[Error:](#ff3300) [Debes esperar %1% minutos antes de volver a teletransportarte a una ubicación aleatoria.](#ff7e5e)' -rtp_spent_money: '[Gasta %1% para teletransportarte a un lugar aleatorio.](gray)' -back_spent_money: '[Gasta %1% para volver a tu última ubicación.](gray)' -error_command_disabled: '[Error:](#ff3300) [Ese comando está desactivado!](#ff7e5e)' -error_console_only: '[Error:](#ff3300) [Ese comando solo puede ser ejecutado por la consola.](#ff7e5e)' -error_tp_invalid_world: '[Error:](#ff3300) [Por favor, especifica un mundo de servidor válido.](#ff7e5e)' -error_rtp_randomization_timeout: '[Error:](#ff3300) [Ha habido un problema al encontrar una localización segura a la que teletransportarte aleatoriamente.](#ff7e5e)' -list_item_divider: ' [•](gray) ' -home_list_item: '[[%1%]](show_text=&7%3% run_command=/huskhomes:edithome %2%.%1%)' -public_home_list_item: '[[%1%]](show_text=�fb9a&%2%: &7%3% run_command=/huskhomes:phome %2%.%1%)' -warp_list_item: '[[%1%]](show_text=&7%2% run_command=/huskhomes:warp %1%)' -home_default_description: 'Casa de %1%' -warp_default_description: 'Un warp de acceso público' -delete_all_homes_confirm: '[Advertencia:](#ff3300) [Estás seguro de que quieres borrar todas tus casas?](#ff7e5e)\n[Una vez confirmado, no será posible recuperarlas.](gray)\n[→](gray) [[Confirmar]] (#ff3300 show_text=&#ff3300&Click para confirmar. Esta acción es permanente. run_command=/delhome all confirm)' -delete_all_warps_confirm: '[Advertencia:](#ff3300) [Estás seguro de que quieres borrar todos los warps?] (#ff7e5e)\n[Una vez confirmado, no será posible recuperarlos.](gray)\n[→](gray) [[Confirmar]](#ff3300 show_text=&#ff3300&Click para confirmar. Esta acción es permanente. run_command=/delwarp all confirm)' -delete_all_homes_success: '[Has eliminado todas tus casas satisfactoriamente](#00fb9a) [%1%](#00fb9a bold) [.](#00fb9a)' -delete_all_warps_success: '[Se han eliminado todos los warps del servidor](#00fb9a) [%1%](#00fb9a bold) .](#00fb9a)' -error_permission_restricted_warp: '[Error:](#ff3300) [No tienes permiso para ir al warp %1%!](#ff7e5e)' -teleporting_complete_console: '[La consola te ha teletransportado a %1%.](gray)' -spawn_warp_default_description: 'El /spawn del servidor' -error_invalid_page_number: '[Error:](#ff3300) [Por favor, especifica un número de página válido.](#ff7e5e)' -page_options: '[←](gray show_text=&7Página anterior run_command=%1%) [Viewing Page %2%/%3%](#00fb9a) [→](gray show_text=&7Página siguiente run_command=%4%)' -page_options_min: '[Página %1%/%2%](#00fb9a) [→](gray show_text=&7Página Siguiente run_command=%3%)' -page_options_min_max: '[Página %1%/%2%](#00fb9a)' -page_options_max: '[←](gray show_text=&7Página Anterior run_command=%1%) [Página %2%/%3%](#00fb9a)' -page_no_items: '[(No hay ningún item para mostrar en esta página)](gray show_text=&7Prueba en otra página)' -command_list_header: '\n[](#00fb9a bold) [Lista de Comandos](#00fb9a)' -command_list_item: '[/%1%](#00fb9a show_text=�fb9a&%2% suggest_command=/%1%) [•](white) [%3%](gray)' -error_invalid_on_arrival: '[Error:](#ff3300) [Ha habido un error al completar tu teletransporte. Inténtalo de nuevo más tarde.](#ff7e5e)' -tpignore_toggle_on: '[Ahora estás](#00fb9a) [ignorando](#00fb9a bold) [las solicitudes de teletransporte entrantes.](#00fb9a) [(Click to cambiar)](gray show_text=&7Click para recibir solicitudes de teletransporte run_command=/huskhomes:tpignore)' -tpignore_toggle_off: '[Ahora](#00fb9a) [recibirás](#00fb9a bold) [todas las solicitudes de teletransporte entrantes.](#00fb9a) [(Click para cambiar)](gray show_text=&7Click para ignorar solicitudes de teletransporte entrantes run_command=/huskhomes:tpignore)' -tpignore_on_reminder: '[Actualmente estás ignorando las solicitudes de teletransporte entrantes!](gray) [(Click para cambiar)](gray show_text=&7Click para recibir solicitudes de teletransporte entrantes run_command=/huskhomes:tpignore)' -error_ignoring_teleport_requests: '[Error:](#ff3300) [Actualmetne estás ignorando las solicitudes de teletransporte!](#ff7e5e) [(Click para cambiar)](#ff7e5e show_text=&#ff7e5e&Click para recibir solicitudes de teletransporte entrantes run_command=/huskhomes:tpignore)' -error_no_offline_position: '[Error:](#ff3300) [No se ha podido encontrar donde %1% se ha conectado por última vez.](#ff7e5e)' -error_invalid_player: '[Error:](#ff3300) [Por favor, especifica el nombre de un jugador válido!](#ff7e5e)' -error_no_homes_set_other: '[Error:](#ff3300) [%1% no tiene ninguna casa!](#ff7e5e)' -error_home_invalid_other: '[Error:](#ff3300) [%1% no tiene ninguna casa llamada "%2%"](#ff7e5e)' -error_edit_home_maximum_public_homes: '[Error:](#ff3300) [Solo puedes tener %1% casas públicas.](#ff7e5e)' -tpaall_request_sent: '[Has enviado una solicitud de teletransporte a todo el mundo para que se teletransporten a ti!](#00fb9a)' -error_no_other_online_players: '[Error:](#ff3300) [No hay jugadores conectados que puedan teletransportarse a ti.](#ff7e5e)' -teleporting_all_players: '[Teletransportando a todos los jugadores a tu posición...](#00fb9a)' -error_illegal_target_coordinates: '[Error:](#ff3300) [Aborted teleport as it exceeds the possible game world limits.](#ff7e5e)' -home_command_description: 'Teletransportate a una de tus casas' -sethome_command_description: 'Establece una casa con el nombre dado' -delhome_command_description: 'Elimina una casa establecida previamente' -edithome_command_description: 'Edita una de tus casas' -warp_command_description: 'Teletransportate a un warp' -setwarp_command_description: 'Establece un warp con el nombre dado' -delwarp_command_description: 'Elimina un warp' -editwarp_command_description: 'Edita un warp' -back_command_description: 'Regresa a tu posición anterior o donde moriste' -homelist_command_description: 'Muestra una lista de tus casas' -warplist_command_description: 'Muestra la lista de warps' -publichomelist_command_description: 'Muestra la lista de casas públicas' -publichome_command_description: 'Teletransporteate a una casa pública' -tp_command_description: 'Teletransportate a otro jugador o localización' -tphere_command_description: 'Teletransporta a otro jugador a ti' -tpa_command_description: 'Solicita a otro jugador teletransporte' -tpahere_command_description: 'Solicita a otro jugador que se teletransporte a ti' -tpaccept_command_description: 'Acepta una solicitud de teletransporte' -tpdeny_command_description: 'Deniega una solicitud de teletransporte' -tpignore_command_description: 'Ignora las solicitudes de teletransporte entrantes' -tpoffline_command_description: 'Teletransportate a la última ubicación de un jugador' -rtp_command_description: 'Teletransportate aleatoriamente' -spawn_command_description: 'Teletransportate al spawn' -setspawn_command_description: 'Establece una posición de spawn' -tpaall_command_description: 'Solicita a todo el mundo que te teletransporten a ti' -tpall_command_description: 'Teletransporta a todo el mundo a tu ubicación' -huskhomes_command_description: 'Muestra la información del plugin y recarga la configuración' \ No newline at end of file diff --git a/src/main/resources/languages/it-it.yml b/src/main/resources/languages/it-it.yml deleted file mode 100644 index be8bcbc4..00000000 --- a/src/main/resources/languages/it-it.yml +++ /dev/null @@ -1,153 +0,0 @@ -error_no_permission: '[Errore:](#ff3300) [Non hai il permesso di eseguire questo comando.](#ff7e5e)' -error_no_last_position: '[Errore:](#ff3300) [Non hai nessuna posizione precedente salvata!](#ff7e5e)' -teleporting_last_position: '[Teletrasporto alla posizione precedente tra](#00fb9a) [%1%](#00fb9a bold) [secondi](#00fb9a)' -teleporting_offline_player: '[Teletrasporto alla posizione in cui %1% è uscito l''ultima volta in corso...](#00fb9a)' -teleporting_countdown_start: '[Verrai teletrasportato tra](#00fb9a) [%1%](#00fb9a bold) [secondi](#00fb9a)' -teleporting_cancelled_movement: '[Teletrasporto cancellato: ti sei mosso!](#ff7e5e)' -teleporting_cancelled_damage: '[Teletrasporto cancellato: hai preso danno!](#ff7e5e)' -teleporting_complete: '[Teletrasporto completato!](#00fb9a)' -teleporting_action_bar_countdown: '[Teletrasporto tra](#00fb9a) [%1%](#00fb9a bold) [secondi...](#00fb9a)' -teleporting_action_bar_cancelled: '[Teletrasporto cancellato!](#ff7e5e)' -teleporting_please_stand_still: '[Il teletrasporto verrà cancellato se ti muoverai o prenderai danno.](gray)' -home_deleted: '[Hai cancellato la home:](#00fb9a) [%1%](#00fb9a bold)' -warp_deleted: '[Hai cancellato il warp:](#00fb9a) [%1%](#00fb9a bold)' -error_home_invalid: '[Errore:](#ff3300) [Non hai nessuna home chiamata "%1%"](#ff7e5e)' -error_warp_invalid: '[Errore:](#ff3300) [Non esiste nessun warp chiamato "%1%"](#ff7e5e)' -error_invalid_syntax: '[Errore:](#ff3300) [Comando non riconosciuto. Utilizza: %1%](#ff7e5e)' -edit_home_title: '\n[Modifica della home](#00fb9a) [%1%](#00fb9a bold)[:](#00fb9a)' -edit_home_title_other: '\n[Modificando la home di %1%,](#00fb9a) [%2%](#00fb9a bold)[:](#00fb9a)' -edit_home_options: '\n[[Teletrasporto]](green show_text=&7Teletrasportati alla tua home run_command=/huskhomes:home %1%.%2%) [[Cancella]](red show_text=&7Cancella la tua home run_command=/huskhomes:delhome %1%.%2%) [[Riposiziona]](blue show_text=&7Aggiorna le coordinate della tua home run_command=/huskhomes:edithome %1%.%2% location)\n[[Rinomina]](yellow show_text=&7Cambia il nome della tua home suggest_command=/huskhomes:edithome %1%.%2% tua home suggest_command=/huskhomes:edithome %1%.%2% description )\n' -edit_home_options_make_public: '\n[[Teletrasporto]](green show_text=&7Teletrasportati alla tua home run_command=/huskhomes:home %1%.%2%) [[Cancella]](red show_text=&7Cancella la tua home run_command=/huskhomes:delhome %1%.%2%) [[Riposiziona]](blue show_text=&7Aggiorna le coordinate della tua home run_command=/huskhomes:edithome %1%.%2% location)\n[[Rinomina]](yellow show_text=&7Cambia il nome della tua home suggest_command=/huskhomes:edithome %1%.%2% rename ) [[Modifica Descrizione]](gold show_text=&7Aggiorna la descrizione della tua home suggest_command=/huskhomes:edithome %1%.%2% description ) [[Rendi Pubblica]](dark_green show_text=&7Rendi la tua home pubblica run_command=/huskhomes:edithome %1%.%2% public)\n' -edit_home_options_make_private: '\n[[Teletrasporto]](green show_text=&7Teletrasportati alla tua home run_command=/huskhomes:home %1%.%2%) [[Cancella]](red show_text=&7Cancella la tua home run_command=/huskhomes:delhome %1%.%2%) [[Riposiziona]](blue show_text=&7Aggiorna le coordinate della tua home run_command=/huskhomes:edithome %1%.%2% location)\n[[Rinomina]](yellow show_text=&7Cambia il nome della tua home suggest_command=/huskhomes:edithome %1%.%2% rename ) [[Modifica Descrizione]](gold show_text=&7Aggiorna la descrizione della tua home suggest_command=/huskhomes:edithome %1%.%2% description ) [[Rendi Privata]](dark_red show_text=&7Rendi la tua home privata run_command=/huskhomes:edithome %1%.%2% private)\n' -edit_home_privacy_private: '• Accesso: &#ff7e5e&Privata &7(Solo tu puoi usarla)' -edit_home_privacy_public: '• Accesso: &aPubblica &7(Tutti possono usarla)' -edit_home_privacy_public_success: '[Hai impostato la privacy della tua home](#00fb9a) [%1%](#00fb9a bold) [come pubblica.](#00fb9a)' -edit_home_privacy_public_success_economy: '[Hai impostato la privacy della tua home](#00fb9a) [%1%](#00fb9a bold) [come pubblica. Il costo di accesso sarà: %2%.](#00fb9a)' -edit_home_privacy_private_success: '[Hai impostato la privacy della tua home](#00fb9a) [%1%](#00fb9a bold) [come privata.](#00fb9a)' -error_edit_home_privacy_already_public: '[Errore:](#ff3300) [La tua home è già pubblica.](#ff7e5e)' -error_edit_home_privacy_already_private: '[Errore:](#ff3300) [La tua home è già privata.](#ff7e5e)' -error_edit_home_privacy_no_permission: '[Errore:](#ff3300) [Non hai il permesso di impostare la privacy della tua home.](#ff7e5e)' -error_edit_home_description_length: '[Errore:](#ff3300) [Le descrizioni delle home devono essere inferiori ai 255 caratteri.](#ff7e5e)' -error_edit_home_description_characters: '[Errore:](#ff3300) [Le descrizioni delle home possono contenere solo caratteri alfanumerici, numeri (A-Z, 0-9), trattini (-) e trattini bassi (_)](#ff7e5e)' -edit_home_update_location: '[Hai riposizionato la home](#00fb9a) [%1%](#00fb9a bold) [nella tua posizione corrente.](#00fb9a)' -edit_home_update_description: '[Hai cambiato la descrizione di](#00fb9a) [%1%](#00fb9a bold) [in "%2%"](#00fb9a)' -edit_home_update_name: '[Hai cambiato il nome della tua home: %1% →](#00fb9a) [%2%](#00fb9a bold)' -edit_warp_title: '\n[Modifica dettagli del warp](#00fb9a) [%1%](#00fb9a bold)[:](#00fb9a)' -edit_warp_options: '\n[[Teletrasporto]](green show_text=&7Teletrasportati al warp run_command=/huskhomes:warp %1%) [[Cancella]](red show_text=&7Cancella il warp run_command=/huskhomes:delwarp %1%) [[Riposiziona]](blue show_text=&7Aggiorna le coordinate del warp run_command=/huskhomes:editwarp %1% location)\n[[Rinomina]](yellow show_text=&7Cambia il nome del warp suggest_command=/huskhomes:editwarp %1% rename ) [[Modifica Descrizione]](gold show_text=&7Aggiorna la descrizione del warp suggest_command=/huskhomes:editwarp %1% description )\n' -error_edit_warp_description_length: '[Errore:](#ff3300) [Le descrizioni dei warp devono essere inferiori ai 255 caratteri.](#ff7e5e)' -error_edit_warp_description_characters: '[Errore:](#ff3300) [Le descrizioni dei warp possono contenere solo caratteri alfanumerici, numeri (A-Z, 0-9), trattini (-) e trattini bassi (_)](#ff7e5e)' -edit_warp_update_location: '[Riposizionato il warp](#00fb9a) [%1%](#00fb9a bold) [alla tua posizione attuale.](#00fb9a)' -edit_warp_update_description: '[Cambiata la descrizione del warp](#00fb9a) [%1%](#00fb9a bold) [to "%2%".](#00fb9a)' -edit_warp_update_name: '[Cambiato con successo il nome del warp: %1% →](#00fb9a) [%2%](#00fb9a bold)' -edit_description: '• Descrizione: &7%1%' -edit_location: '• Posizione: &7%1%, %2%, %3%' -edit_world: '• Mondo: &7%1%' -edit_server: '• Server: &7%1%' -edit_timestamp: '• Creata: &7%1%' -error_no_homes_set: '[Errore:](#ff3300) [Non hai impostato nessuna home! Scegli un luogo sicuro e digita /sethome ](#ff7e5e)' -error_no_public_homes_set: '[Errore:](#ff3300) [Non ci sono home pubbliche!](#ff7e5e)' -error_no_warps_set: '[Errore:](#ff3300) [Non esiste alcun warp!](#ff7e5e)' -private_home_list_page_top: '\n[Home di %1%:](#00fb9a) [(](#00fb9a)[%2%-%3%](#00fb9a bold) [di](#00fb9a) [%4%](#00fb9a bold)[)](#00fb9a)\n' -public_home_list_page_top: '\n[Home pubbliche:](#00fb9a) [(](#00fb9a)[%1%-%2%](#00fb9a bold) [di](#00fb9a) [%3%](#00fb9a bold)[)](#00fb9a)\n' -warp_list_page_top: '\n[Warp:](#00fb9a) [(](#00fb9a)[%1%-%2%](#00fb9a bold) [di](#00fb9a) [%3%](#00fb9a bold)[)](#00fb9a)\n' -error_public_home_invalid: '[Errore:](#ff3300) [Non trovo la home di %1% chiamata %2%.](#ff7e5e)' -error_set_home_invalid_characters: '[Errore:](#ff3300) [I nomi delle home possono contenere solo caratteri alfanumerici (A-Z, 0-9) e trattini (-_)](#ff7e5e)' -error_set_home_invalid_length: '[Errore:](#ff3300) [I nomi delle home non possono essere lunghi più di 16 caratteri!](#ff7e5e)' -error_set_warp_invalid_characters: '[Errore:](#ff3300) [I nomi dei warp possono contenere solo caratteri alfanumerici (A-Z, 0-9) e trattini (-_)](#ff7e5e)' -error_set_warp_invalid_length: '[Errore:](#ff3300) [I nomi dei warp non possono essere più lunghi di 16 caratteri!](#ff7e5e)' -error_set_home_maximum_homes: '[Errore:](#ff3300) [Puoi impostare un massimo di %1% home!](#ff7e5e)' -error_insufficient_funds: '[Errore:](#ff3300) [Non hai abbastanza soldi! (Costo: %1%)](#ff7e5e)' -set_home_spent_money: '[Hai pagato %1% per impostare una nuova home!](gray)' -set_home_used_free_slots: '[Hai utilizzato tutte le slot delle home gratuite (%1%); se vuoi impostare una nuova home, dovrai pagare %2%.](gray)' -set_home_success: '[Hai impostato la home:](#00fb9a) [%1%](#00fb9a bold)' -set_warp_success: '[Hai impostato il warp:](#00fb9a) [%1%](#00fb9a bold)' -error_set_home_name_taken: '[Errore:](#ff3300) [Hai già una home impostata con quel nome.](#ff7e5e)' -error_set_warp_name_taken: '[Errore:](#ff3300) [C’’è già un warp impostato con quel nome.](#ff7e5e)' -set_spawn_success: '[Hai reimpostato la posizione di /spawn.](#00fb9a)' -error_spawn_undefined: '[Errore:](#ff3300) [Non c’’è nessun punto di spawn impostato.](#ff7e5e)' -error_tpa_no_pending_request: '[Errore:](#ff3300) [Non hai una richiesta di teletrasporto in sospeso.](#ff7e5e)' -error_tpa_request_expired: '[Errore:](#ff3300) [La tua richiesta di teletrasporto è scaduta.](#ff7e5e)' -error_player_not_found: '[Errore:](#ff3300) [Non trovo il giocatore: %1%.](#ff7e5e)' -return_by_death: '[Torna dove sei morto.](gray) [/back](#00fb9a show_text=�fb9a&Clicca per tornare al tuo punto di morte run_command=/back)' -teleport_request_options: '[Scegli se:](gray) [[Accettare]](#00fb9a show_text=�fb9a&Accetta la richiesta; /tpaccept %1% run_command=/tpaccept %1%) [•](gray) [[Rifiutare]](#ff7e5e show_text=&#ff7e5e&Declina la richiesta; /tpdeny %1% run_command=/tpdeny %1%)' -tpa_you_accepted: '[Hai accettato la richiesta di teletrasporto di %1%](#00fb9a)' -tpa_you_declined: '[Hai rifiutato la richiesta di teletrasporto di %1%](#ff7e5e)' -tpa_has_accepted: '[%1% ha accettato la tua richiesta di teletrasporto.](#00fb9a)' -tpa_has_declined: '[%1% ha declinato la tua richiesta di teletrasporto.](#ff7e5e)' -tpa_request_sent: '[Hai inviato una richiesta di teletrasporto a](#00fb9a) [%1%](#00fb9a bold)' -tpa_request_ask: '[%1%](#00fb9a bold) [ha richiesto di teletrasportarsi da te.](#00fb9a)' -tpahere_request_sent: '[Hai chiesto a](#00fb9a) [%1%](#00fb9a bold) [di teletrasportarsi da te.](#00fb9a)' -tpahere_request_ask: '[%1%](#00fb9a bold) [ha richiesto di teletrasportarsi da lui.](#00fb9a)' -error_tp_self: '[Errore:](#ff3300) [Non puoi teletrasportarti da te stesso!](#ff7e5e)' -error_rtp_invalid_dimension: '[Errore:](#ff3300) [Puoi utilizzare l’’/rtp solo nell’’overworld!](#ff7e5e)' -error_rtp_cooldown: '[Errore:](#ff3300) [Devi aspettare %1% minuti prima di utilizzare nuovamente l’’/rtp.](#ff7e5e)' -rtp_spent_money: '[Hai speso %1% per teletrasportati randomicamente.](gray)' -back_spent_money: '[Hai speso %1% per teletrasportati alla tua posizione precedente.](gray)' -error_command_disabled: '[Errore:](#ff3300) [Questo comando è disabilitato!](#ff7e5e)' -error_console_only: '[Errore:](#ff3300) [Quel comando può essere eseguito solo da Console.](#ff7e5e)' -error_tp_invalid_world: '[Errore:](#ff3300) [Per favore, specifica un mondo valido nel server.](#ff7e5e)' -error_rtp_randomization_timeout: '[Errore:](#ff3300) [Non sono riuscito a trovare una posizione sicura, riprova.](#ff7e5e)' -list_item_divider: ' [•](gray) ' -home_list_item: '[[%1%]](show_text=&7%3% run_command=/huskhomes:edithome %2%.%1%)' -public_home_list_item: '[[%1%]](show_text=�fb9a&%2%: &7%3% run_command=/huskhomes:phome %2%.%1%)' -warp_list_item: '[[%1%]](show_text=&7%2% run_command=/huskhomes:warp %1%)' -home_default_description: 'Home di %1%' -warp_default_description: 'Warp accessibile a tutti!' -delete_all_homes_confirm: '[Attenzione:](#ff3300) [Sei sicuro di voler eliminare tutte le home?](#ff7e5e\n[Una volta confermato non sarà possibile recuperarli.](gray)\n[→](gray) [[Conferma]](#ff3300 show_text=&#ff3300&Clicca per confermare. AZIONE IRREVERSIBILE. run_command=/delhome all confirm)' -delete_all_warps_confirm: '[Attenzione:](#ff3300) [Sei sicuro di voler eliminare tutti i warp?](#ff7e5e)\n[Una volta confermato non sarà possibile recuperarli.](gray)\n[→](gray) [[Conferma]](#ff3300 show_text=&#ff3300&Clicca per confermare. AZIONE IRREVERSIBILE. run_command=/delwarp all confirm)' -delete_all_homes_success: '[Eliminata con successo la](#00fb9a) [%1%](#00fb9a bold) [home.](#00fb9a)' -delete_all_warps_success: '[Eliminati con successo tutti i](#00fb9a) [%1%](#00fb9a bold) [warp.](#00fb9a)' -error_permission_restricted_warp: '[Errore:](#ff3300) [Non hai i permessi per usare il warp %1%!](#ff7e5e)' -teleporting_complete_console: '[La console ti ha teletrasportato a %1%.](gray)' -spawn_warp_default_description: 'La posizione di /spawn del server' -error_invalid_page_number: '[Errore:](#ff3300) [Specifica un numero di pagina corretto.](#ff7e5e)' -page_options: '[←](gray show_text=&7Pagina precedente run_command=%1%) [Pagina %2%/%3%](#00fb9a) [→](gray show_text=&7Pagina successiva run_command=%4%)' -page_options_min: '[Pagina %1%/%2%](#00fb9a) [→](gray show_text=&7Pagina successiva run_command=%3%)' -page_options_min_max: '[Pagina %1%/%2%](#00fb9a)' -page_options_max: '[←](gray show_text=&7Pagina precedente run_command=%1%) [Pagina %2%/%3%](#00fb9a)' -page_no_items: '[(Nessun oggetto visibile in questa pagina)](gray show_text=&7Prova un numero differente)' -command_list_header: '\n[HuskHomes](#00fb9a bold) [| Comandi](#00fb9a)' -command_list_item: '[/%1%](#00fb9a show_text=�fb9a&%2% suggest_command=/%1%) [•](white) [%3%](gray)' -error_invalid_on_arrival: '[Errore:](#ff3300) [Non sono riuscito a teletrasportarti perché il mondo non è caricato correttamente.](#ff7e5e)' -tpignore_toggle_on: '[Ora stai](#00fb9a) [ignorando](#00fb9a bold) [tutte le richieste di teletrasporto.](#00fb9a) [(Clicca per abilitarle)](gray show_text=&7Clicca per abilitare le richieste di teletrasporto run_command=/huskhomes:tpignore)' -tpignore_toggle_off: '[Ora stai](#00fb9a) [ricevendo](#00fb9a bold) [tutte le richieste di teletrasporto.](#00fb9a) [(Clicca per disabilitarle)](gray show_text=&7Clicca per disabilitare le richieste di teletrasporto run_command=/huskhomes:tpignore)' -tpignore_on_reminder: '[Le richieste di teletrasporto sono disabilitate!](gray) [(Clicca per abilitarle)](gray show_text=&7Clicca per abilitare le richieste di teletrasporto run_command=/huskhomes:tpignore)' -error_ignoring_teleport_requests: '[Errore:](#ff3300) [Le richieste di teletrasporto sono disabilitate!](#ff7e5e) [(Clicca per abilitarle)](#ff7e5e show_text=&#ff7e5e&Clicca per abilitare le richieste di teletrasporto run_command=/huskhomes:tpignore)' -error_no_offline_position: '[Errore:](#ff3300) [Non trovo la posizione in cui %1% è sloggato l''ultima volta.](#ff7e5e)' -error_invalid_player: '[Errore:](#ff3300) [Specifica un nome valido!](#ff7e5e)' -error_no_homes_set_other: '[Errore:](#ff3300) [%1% non ha nessuna home!](#ff7e5e)' -error_home_invalid_other: '[Errore:](#ff3300) [%1% non ha una home chiamata "%2%"](#ff7e5e)' -home_deleted_other: '[Hai cancellato la home](#00fb9a)[%2%](#00fb9a bold)[di %1%](#00fb9a) ' -edit_home_privacy_private_other: '• Accesso: &#ff7e5e&Privato &7(Solo %1% può usarla)' -error_edit_home_maximum_public_homes: '[Errore:](#ff3300) [Puoi creare un messimo di %1% home pubbliche.](#ff7e5e)' -tpaall_request_sent: '[Hai mandato una richiesta di teletrasporto a tutti chiedendogli di teletrasportarsi da te.](#00fb9a)' -error_no_other_online_players: '[Errore:](#ff3300) [Non ci sono altri giocatori online che potrebbero teletrasportarsi da te.](#ff7e5e)' -teleporting_all_players: '[Stai teletrasportando tutti i giocatori alla tua posizione...](#00fb9a)' -error_illegal_target_coordinates: '[Errore:](#ff3300) [Teletrasporto interrotto perché supera i limiti possibili del mondo di gioco.](#ff7e5e)' -home_command_description: 'Teletrasportati in una delle tue home' -sethome_command_description: 'Crea un nuova home col nome dato' -delhome_command_description: 'Cancella una delle tue home' -edithome_command_description: 'Modifica una delle tue home' -warp_command_description: 'Teletrasportati in un warp' -setwarp_command_description: 'Crea un nuovo warp col nome dato' -delwarp_command_description: 'Cancella un warp' -editwarp_command_description: 'Modifica un warp' -back_command_description: 'Ritorna in una tua posizione precedente, o dove sei morto.' -homelist_command_description: 'Ricevi una lista delle tue home' -warplist_command_description: 'Ricevi una lista dei warp esistenti' -publichomelist_command_description: 'Ricevi una lista delle home pubbliche' -publichome_command_description: 'Teletrasportati in una home pubblica' -tp_command_description: 'Teletrasportati nella posizione di un altro giocatore' -tphere_command_description: 'Teletrasporta un altro giocatore da te' -tpa_command_description: 'Richiedi ad un altro giocatore di teletrasportarti da lui' -tpahere_command_description: 'Richiedi ad un altro giocatore di teletrasportarsi da te' -tpaccept_command_description: 'Accetta una richiesta di teletrasporto' -tpdeny_command_description: 'Rifiuta una richiesta di teletrasporto' -tpignore_command_description: 'Ignora le richieste di teletrasporto in arrivo' -tpoffline_command_description: 'Teletrasportati nella posizione in cui un giocatore è uscito dal server' -rtp_command_description: 'Teletrasportati in una posizione a caso' -spawn_command_description: 'Teletrasportati allo spawn' -setspawn_command_description: 'Setta la posizione di spawn' -tpaall_command_description: 'Richiedi a tutti i giocatori di teletrasportarsi da te' -tpall_command_description: 'Teletrasporta tutti i giocatori alla tua posizione' -huskhomes_command_description: 'Vedi le informazioni del plugin & ricarica la configurazione' \ No newline at end of file diff --git a/src/main/resources/languages/pl.yml b/src/main/resources/languages/pl.yml deleted file mode 100644 index e15d14d4..00000000 --- a/src/main/resources/languages/pl.yml +++ /dev/null @@ -1,153 +0,0 @@ -error_no_permission: '[Błąd:](#ff3300) [Nie masz uprawnień do tego polecenia.](#ff7e5e)' -error_no_last_position: '[Błąd:](#ff3300) [Nie masz żadnej wcześniejszej lokalizacji aby powrócić!](#ff7e5e)' -teleporting_last_position: '[Powrót do ostatniej pozycji nastąpi w ciągu](#00fb9a) [%1%](#00fb9a bold) [sekund](#00fb9a)' -teleporting_offline_player: '[Zostałeś przeteleportowany do miejsca gdzie %1% wylogował się](#00fb9a)' -teleporting_countdown_start: '[Zostaniesz przeteleportowany za](#00fb9a) [%1%](#00fb9a bold) [sekund](#00fb9a)' -teleporting_cancelled_movement: '[Teleportacja została anulowana!](#ff7e5e)' -teleporting_cancelled_damage: '[Teleportacja została anulowana, otrzymałeś obrażenia!](#ff7e5e)' -teleporting_complete: '[Przeteleportowano!](#00fb9a)' -teleporting_action_bar_countdown: '[Teleportacja w](#00fb9a) [%1%](#00fb9a bold)[...](#00fb9a)' -teleporting_action_bar_cancelled: '[Teleportacja anulowana!](#ff7e5e)' -teleporting_please_stand_still: 'Teleportacja zanuluje się gdy się ruszysz.](gray)' -home_deleted: '[Pomyślnie usunięto dom,](#00fb9a) [%1%](#00fb9a bold)' -warp_deleted: '[Pomyślnie usunięto warp,](#00fb9a) [%1%](#00fb9a bold)' -error_home_invalid: '[Błądr:](#ff3300) [Nie masz domu o nazwie "%1%"](#ff7e5e)' -error_warp_invalid: '[Błąd:](#ff3300) [Nie ma warpu o nazwie "%1%"](#ff7e5e)' -error_invalid_syntax: '[Błąd:](#ff3300) [Niepoprawna składnia. Wpisz: %1%](#ff7e5e)' -edit_home_title: '\n[Edytuj właściwości domu](#00fb9a) [%1%](#00fb9a bold)[:](#00fb9a)' -edit_home_title_other: '\n[Edit home details for %1%''s home,](#00fb9a) [%2%](#00fb9a bold)[:](#00fb9a)' -edit_home_options: '\n[[Teleportuj]](green show_text=&Przeteleportuj się do swojego domu run_command=/huskhomes:home %1%.%2%) [[ Usuń]](red show_text=&7Usuń swój dom run_command=/huskhomes:delhome %1%.%2%) [[Relocate]](blue show_text=&7Zaktualizuj lokalizację domu run_command=/huskhomes:edithome %1%.%2% location)\n[[Zmień nazwę]](yellow show_text=&7Zmień nazwe domu suggest_command=/huskhomes:edithome %1%.%2% rename ) [[Edytuj opis]](gold show_text=&7Zaktualizuj opis domu suggest_command=/huskhomes:edithome %1%.%2% description )\n' -edit_home_options_make_public: '\n[[Teleport]](green show_text=&7Przeteleportuj się do swojego domu run_command=/huskhomes:home %1%.%2%) [[Usuń]](red show_text=&7Usuń swój dom run_command=/huskhomes:delhome %1%.%2%) [[Relocate]](blue show_text=&7Zaktualizuj lokalizację domu run_command=/huskhomes:edithome %1%.%2% location)\n[[Zmień nazwę]](yellow show_text=&7Zmień nazwe domu suggest_command=/huskhomes:edithome %1%.%2% rename ) [[Edytuj opis]](gold show_text=&7Zaktualizuj opis domu suggest_command=/huskhomes:edithome %1%.%2% description ) [[Ustaw jako publiczny]](dark_green show_text=&7Ustaw swój d0m jako publiczny run_command=/huskhomes:edithome %1%.%2% public)\n' -edit_home_options_make_private: '\n[[Teleport]](green show_text=&7Przeteleportuj się do swojego domu run_command=/huskhomes:home %1%.%2%) [[Usuń]](red show_text=&7Usuń swój dom run_command=/huskhomes:delhome %1%.%2%) [[Relocate]](blue show_text=&7Zaktualizuj lokalizację domu run_command=/huskhomes:edithome %1%.%2% location)\n[[Zmień nazwę]](yellow show_text=&7Zmień nazwe domu suggest_command=/huskhomes:edithome %1%.%2% rename ) [[Edytuj opis]](gold show_text=&7Zaktualizuj opis domu suggest_command=/huskhomes:edithome %1%.%2% description ) [[Ustaw jako prywatny]](dark_red show_text=&7Ustaw swój dom jako prywatny run_command=/huskhomes:edithome %1%.%2% private)\n' -edit_home_privacy_private: '• Dostęp: &#ff7e5e&Prywatny &7(Tylko ty możesz go użyć)' -edit_home_privacy_public: '• Dostęp: &aPubliczny &7(Każdy może go użyć)' -edit_home_privacy_public_success: '[Pomyślnie utworzono dom,](#00fb9a) [%1%](#00fb9a bold)[, otwórz jako publiczny.](#00fb9a)' -edit_home_privacy_public_success_economy: '[Pomyślnie utworzono twój dom,](#00fb9a) [%1%](#00fb9a bold)[, otwórz go jako publiczny za %2%.](#00fb9a)' -edit_home_privacy_private_success: '[Pomyślnie utworzono twój dom,](#00fb9a) [%1%](#00fb9a bold)[, prywanty.](#00fb9a)' -error_edit_home_privacy_already_public: '[Błąd:](#ff3300) [Twój dom jest już ustawiony jako publiczny.](#ff7e5e)' -error_edit_home_privacy_already_private: '[Błąd:](#ff3300) [Twój dom jest już ustawiony jako prywatny.](#ff7e5e)' -error_edit_home_privacy_no_permission: '[Błąd:](#ff3300) [Nie masz uprawnień do tworzenia publicznych domów.](#ff7e5e)' -error_edit_home_description_length: '[Błąd:](#ff3300) [Opis domu nie może wynieść więcej niż 255 znaków.](#ff7e5e)' -error_edit_home_description_characters: '[Błąd:](#ff3300) [Opisy domu mogą tylko zawierać litery i cyfty (A-Z, 0-9), myślniki (-) oraz podkreślniki (_)](#ff7e5e)' -edit_home_update_location: '[Przemieszczenie](#00fb9a) [%1%](#00fb9a bold) [do twojej aktualnej pozycji.](#00fb9a)' -edit_home_update_description: '[Zmieniono opis na](#00fb9a) [%1%](#00fb9a bold) [to "%2%"](#00fb9a)' -edit_home_update_name: '[Pomyślnie zmieniono nazwę domu na: %1% →](#00fb9a) [%2%](#00fb9a bold)' -edit_warp_title: '\n[Edyuj właściwości warpu](#00fb9a) [%1%](#00fb9a bold)[:](#00fb9a)' -edit_warp_options: '\n[[Teleport]](green show_text=&7Teleportuj się na ten warp run_command=/huskhomes:warp %1%) [[Usuń]](red show_text=&7Usuń ten warp run_command=/huskhomes:delwarp %1%) [[Relocate]](blue show_text=&7Update this warp''s location run_command=/huskhomes:editwarp %1% location)\n[[Rename]](yellow show_text=&7Change the name of this warp suggest_command=/huskhomes:editwarp %1% rename ) [[Edit Description]](gold show_text=&7Update this warp''s description suggest_command=/huskhomes:editwarp %1% description )\n' -error_edit_warp_description_length: '[Błąd:](#ff3300) [Opis warpu nie może przekroczyć 255 znaków.](#ff7e5e)' -error_edit_warp_description_characters: '[Błąd:](#ff3300) [Warp descriptions may only contain alphanumeric (A-Z, 0-9) characters, hyphens (-) and underscores (_)](#ff7e5e)' -edit_warp_update_location: '[Przemieszczono](#00fb9a) [%1%](#00fb9a bold) [do twojej obecnej pozycji.](#00fb9a)' -edit_warp_update_description: '[Zmieniono opis](#00fb9a) [%1%](#00fb9a bold) [na "%2%".](#00fb9a)' -edit_warp_update_name: '[Pomyślnie zmieniono nazwę warpu: %1% →](#00fb9a) [%2%](#00fb9a bold)' -edit_description: '• Opis: &7%1%' -edit_location: '• Lokalizacja: &7%1%, %2%, %3%' -edit_world: '• Świat: &7%1%' -edit_server: '• Serwer: &7%1%' -edit_timestamp: '• Utworzone: &7%1%' -error_no_homes_set: '[Błąd:](#ff3300) [Nie masz żadnych domów!](#ff7e5e)' -error_no_public_homes_set: '[Błąd](#ff3300) [Nie ma żadnych publicznych domów](#ff7e5e)' -error_no_warps_set: '[Błąd:](#ff3300) [Nie ma żadnych warpów!](#ff7e5e)' -private_home_list_page_top: '\n[Domy %1%:](#00fb9a) [(](#00fb9a)[%2%-%3%](#00fb9a bold) [z](#00fb9a) [%4%](#00fb9a bold)[)](#00fb9a)\n' -public_home_list_page_top: '\n[Public Homes:](#00fb9a) [(](#00fb9a)[%1%-%2%](#00fb9a bold) [of](#00fb9a) [%3%](#00fb9a bold)[)](#00fb9a)\n' -warp_list_page_top: '\n[Warpy:](#00fb9a) [(](#00fb9a)[%1%-%2%](#00fb9a bold) [z](#00fb9a) [%3%](#00fb9a bold)[)](#00fb9a)\n' -error_public_home_invalid: '[Błąd:](#ff3300) [Nie mogę znaleśc domu publicznego zajętego przez %1% o nazwie %2%.](#ff7e5e)' -error_set_home_invalid_characters: '[Błąd:](#ff3300) [Nazwy domów muszą zawierać litery lub cyfry (A-Z, 0-9, -_)](#ff7e5e)' -error_set_home_invalid_length: '[Błąd:](#ff3300) [Nazwy domów mogą mieć maksymalnie 16 znaków!](#ff7e5e)' -error_set_warp_invalid_characters: '[Błąd:](#ff3300) [Nazwy warpów muszą zawierać litry lub cyfry (A-Z,0-9, -_)](#ff7e5e)' -error_set_warp_invalid_length: '[Błąd:](#ff3300) [Nazwy warpów mogą mieć maksylanie 16 znaków!](#ff7e5e)' -error_set_home_maximum_homes: '[Błąd:](#ff3300) [Możesz maksymalnie ustawić %1% domów!](#ff7e5e)' -error_insufficient_funds: '[Błąd:](#ff3300) [Nie wystarczająca liczba monet! (Koszt: %1%)](#ff7e5e)' -set_home_spent_money: '[Wydałeś %1% na ustawienie dodatkowego domu!](gray)' -set_home_used_free_slots: '[Wykorzystałeś limit domów (%1%); Kolejne domy kosztują %2% monet.](gray)' -set_home_success: '[Pomyślnie ustawiono dom](#00fb9a) [%1%](#00fb9a bold)' -set_warp_success: '[Pomyślnie ustawiono warp](#00fb9a) [%1%](#00fb9a bold)' -error_set_home_name_taken: '[Błąd:](#ff3300) [Masz już dom o takiej nazwie.](#ff7e5e)' -error_set_warp_name_taken: '[Błąd:](#ff3300) [Istnieje już warp o takiej nazwie.](#ff7e5e)' -set_spawn_success: '[Zaktualizowano spawn do twojej obecnej lokalizacji.](#00fb9a)' -error_spawn_undefined: '[Błąd:](#ff3300) [Pozycja spawnu nie jest zdefiniowana na tym serwerze.](#ff7e5e)' -error_tpa_no_pending_request: '[Błąd:](#ff3300) [Nie masz oczekujących próśb o teleporacje.](#ff7e5e)' -error_tpa_request_expired: '[Błąd:](#ff3300) [Twoja prośba o teleporacje wygasła.](#ff7e5e)' -error_player_not_found: '[Błąd:](#ff3300) [Nie odnalazłem gracza %1%.](#ff7e5e)' -return_by_death: '[Powrót w miejsce śmierci?](gray) [/back](#00fb9a show_text=�fb9a&Kliknij aby wrócić do ostatniej pozycji smierci. run_command=/back)' -teleport_request_options: '[Wybierz opcję:](gray) [[Zaakceptuj]](#00fb9a show_text=�fb9a&Zaakceptuj prośbę o teleporacje; /tpaccept %1% run_command=/tpaccept %1%) [•](gray) [[Decline]](#ff7e5e show_text=&#ff7e5e&Odrzuć prośbę o teleportacje; /tpdeny %1% run_command=/tpdeny %1%)' -tpa_you_accepted: '[Zaakceptowałeś prośbę o teleportacje od %1%](#00fb9a)' -tpa_you_declined: '[Odrzuciłeś prośbę o teleporacje od %1%''](#ff7e5e)' -tpa_has_accepted: '[%1% zaakceptował twoją prośbę o teleportacje](#00fb9a)' -tpa_has_declined: '[%1% odrzucił twoją prośbę o teleportacje](#ff7e5e)' -tpa_request_sent: '[Wysłałeś prośbę o teleportacje do](#00fb9a) [%1%](#00fb9a bold)' -tpa_request_ask: '[%1%](#00fb9a bold) [chce się do Ciebie przeteleportować](#00fb9a)' -tpahere_request_sent: '[Wysłałeś prośbę o teleportacje do Ciebie do gracza](#00fb9a) [%1%](#00fb9a bold)(#00fb9a)' -tpahere_request_ask: '[%1%](#00fb9a bold) [poprosił, abyś się do niego teleportował](#00fb9a)' -error_tp_self: '[Błąd:](#ff3300) [Nie możesz przeteleportować się do siebie!](#ff7e5e)' -error_rtp_invalid_dimension: '[Błąd:](#ff3300) [Możesz losowo teleportować się tylko w głównym świecie!](#ff7e5e)' -error_rtp_cooldown: '[Błąd:](#ff3300) [Odczekaj %1% minut przed kolejną teleportacją.](#ff7e5e)' -rtp_spent_money: '[Wydałeś %1% na losowy teleport.](gray)' -back_spent_money: '[Wydałeś %1% aby wrócić do ostatniej pozycji.](gray)' -error_command_disabled: '[Błąd:](#ff3300) [To polecenie jest wyłączone!](#ff7e5e)' -error_console_only: '[Błąd:](#ff3300) [To polecenie możesz wykonać tylko z konsoli.](#ff7e5e)' -error_tp_invalid_world: '[Błąd:](#ff3300) [Podałeś niepoprwawny świat.](#ff7e5e)' -error_rtp_randomization_timeout: '[Błąd:](#ff3300) [Nie mogę znaleśc bezpiecznej lokalizacji dla Ciebie.](#ff7e5e)' -list_item_divider: ' [•](gray) ' -home_list_item: '[[%1%]](show_text=&7%3% run_command=/huskhomes:edithome %2%.%1%)' -public_home_list_item: '[[%1%]](show_text=�fb9a&%2%: &7%3% run_command=/huskhomes:phome %2%.%1%)' -warp_list_item: '[[%1%]](show_text=&7%2% run_command=/huskhomes:warp %1%)' -home_default_description: 'Dom %1%' -warp_default_description: 'Publiczny warp' -delete_all_homes_confirm: '[Ostrzeżenie:](#ff3300) [Czy chcesz skasować wszystkie domy?](#ff7e5e)\n[Jest to nie odwracalna zmiana.](gray)\n[→](gray) [[Potwierdź]](#ff3300 show_text=&#ff3300&Potwierdź usunięcie, nie da się tego przywrócić. run_command=/delhome all confirm)' -delete_all_warps_confirm: '[Ostrzeżenie:](#ff3300) [Czy chcesz skasować wszystkie warpy?](#ff7e5e)\n[Jest to nie odwracalna zmiana.](gray)\n[→](gray) [[Potwierdź]](#ff3300 show_text=&#ff3300&Potwierdź usunięcie, nie da się tego przywrócić. run_command=/delwarp all confirm)' -delete_all_homes_success: '[Pomyślnie usunąłem twoje](#00fb9a) [%1%](#00fb9a bold) [domy.](#00fb9a)' -delete_all_warps_success: '[Pomyślnie usunąłem wszyskie](#00fb9a) [%1%](#00fb9a bold) [warpów.](#00fb9a)' -error_permission_restricted_warp: '[Błąd:](#ff3300) [Nie masz uprawnień do warpu %1%!](#ff7e5e)' -teleporting_complete_console: '[Konsola przeteleportowała Cię %1%.](gray)' -spawn_warp_default_description: 'Serwerowa pozycja spawnu' -error_invalid_page_number: '[Błąd:](#ff3300) [Podaj poprawny numer strony.](#ff7e5e)' -page_options: '[←](gray show_text=&7View previous page run_command=%1%) [Przeglądanie strony %2%/%3%](#00fb9a) [→](gray show_text=&7View next page run_command=%4%)' -page_options_min: '[Przeglądanie strony %1%/%2%](#00fb9a) [→](gray show_text=&7View next page run_command=%3%)' -page_options_min_max: '[Przeglądanie strony %1%/%2%](#00fb9a)' -page_options_max: '[←](gray show_text=&7Zobacz poprzednią stronę run_command=%1%) [Oglądasz stronę %2%/%3%](#00fb9a)' -page_no_items: '[(Brak rzeczy do wyświetlenia)](gray show_text=&7Spróboj podać numer innej strony)' -command_list_header: '\n[HuskHomes](#00fb9a bold) [| Lista poleceń](#00fb9a)' -command_list_item: '[/%1%](#00fb9a show_text=�fb9a&%2% suggest_command=/%1%) [•](white) [%3%](gray)' -error_invalid_on_arrival: '[Błąd:](#ff3300) [Nie udało się zakończyć teleportacji, ponieważ nie można znaleźć świata docelowego.](#ff7e5e)' -tpignore_toggle_on: '[Jesteś teraz](#00fb9a) [ignoring](#00fb9a bold) [przychodzące żądania teleportu.](#00fb9a) [(Kliknij aby zmienić)](gray show_text=&7Kliknij, aby nasłuchiwać przychodzących żądań teleportu run_command=/huskhomes:tpignore)' -tpignore_toggle_off: '[Jesteś teraz](#00fb9a) [listening](#00fb9a bold) [na wszystkie przychodzące żądania teleportu.](#00fb9a) [(Click to toggle)](gray show_text=&7Kliknij, aby nasłuchiwać przychodzących żądań teleportu run_command=/huskhomes:tpignore)' -tpignore_on_reminder: '[Obecnie ignorujesz przychodzące żądania teleportu.!](gray) [(Kliknij aby zmienić)](gray show_text=&7Kliknij, aby nasłuchiwać przychodzących żądań teleportu run_command=/huskhomes:tpignore)' -error_ignoring_teleport_requests: '[Błąd:](#ff3300) [Obecnie ignorujesz prośby o teleport.!](#ff7e5e) [(Kliknij aby zmienić)](#ff7e5e show_text=&#ff7e5e&Kliknij, aby nasłuchiwać przychodzących żądań teleportu run_command=/huskhomes:tpignore)' -error_no_offline_position: '[Błąd:](#ff3300) [Nie mogę znaleźć, gdzie ostatnio wylogował się%1%.](#ff7e5e)' -error_invalid_player: '[Błąd:](#ff3300) [Proszę uwzględnić prawdziwą nazwę użytkownika!](#ff7e5e)' -error_no_homes_set_other: '[Błąd:](#ff3300) [%1% nie ma żadnych domów!](#ff7e5e)' -error_home_invalid_other: '[Błąd:](#ff3300) [%1% nie ma domu nazwanego "%2%"](#ff7e5e)' -home_deleted_other: '[Pomyślnie usunięto dom %1%,](#00fb9a) [%2%](#00fb9a bold)' -edit_home_privacy_private_other: '• Dostęp: &#ff7e5e&Prywatny &7(Tylko %1% może to użyć)' -error_edit_home_maximum_public_homes: '[Błąd:](#ff3300) [Możesz maksymalnie utworzyć %1% publicznych domów.](#ff7e5e)' -tpaall_request_sent: '[You sent a teleport request asking everyone to teleport to you!](#00fb9a)' -error_no_other_online_players: '[Error:](#ff3300) [There are no other online players who could teleport to you.](#ff7e5e)' -teleporting_all_players: '[Teleporting all players to your position...](#00fb9a)' -error_illegal_target_coordinates: '[Error:](#ff3300) [Aborted teleport as it exceeds the possible game world limits.](#ff7e5e)' -home_command_description: 'Teleport to one of your homes' -sethome_command_description: 'Set a new home with given name' -delhome_command_description: 'Delete a home you previously set' -edithome_command_description: 'Edit one of your homes' -warp_command_description: 'Teleport to a warp' -setwarp_command_description: 'Set a new warp with given name' -delwarp_command_description: 'Delete a warp' -editwarp_command_description: 'Edit a warp' -back_command_description: 'Return to your previous position, or where you died' -homelist_command_description: 'Get a list of your homes' -warplist_command_description: 'View the list of warps' -publichomelist_command_description: 'View the list of public homes' -publichome_command_description: 'Teleport to a public home' -tp_command_description: 'Teleport to another player or location' -tphere_command_description: 'Teleport another player to you' -tpa_command_description: 'Request to teleport to another player' -tpahere_command_description: 'Request another player to teleport to you' -tpaccept_command_description: 'Accept a teleport request' -tpdeny_command_description: 'Deny a teleport request' -tpignore_command_description: 'Ignore incoming teleport requests' -tpoffline_command_description: 'Teleport to where a player was last online' -rtp_command_description: 'Teleport randomly into the wild' -spawn_command_description: 'Teleport to spawn' -setspawn_command_description: 'Set the spawn position' -tpaall_command_description: 'Request that everyone teleports to you' -tpall_command_description: 'Teleport everyone to your position' -huskhomes_command_description: 'View plugin information & reload configs' \ No newline at end of file diff --git a/src/main/resources/languages/zh-cn.yml b/src/main/resources/languages/zh-cn.yml deleted file mode 100644 index 7482166d..00000000 --- a/src/main/resources/languages/zh-cn.yml +++ /dev/null @@ -1,153 +0,0 @@ -error_no_permission: '[错误:](#ff3300) [你没有权限去完成这个指令](#ff7e5e)' -error_no_last_position: '[错误:](#ff3300) [你没有最后一个可用传送点来返回](#ff7e5e)' -teleporting_last_position: '[在](#00fb9a) [%1%](#00fb9a bold) [秒内返回你上一个传送点](#00fb9a)' -teleporting_offline_player: '[传送你到 %1% 最后离线的位置...](#00fb9a)' -teleporting_countdown_start: '[你将在](#00fb9a) [%1%](#00fb9a bold) [秒后被传送](#00fb9a)' -teleporting_cancelled_movement: '[传送失败; 请不要在传送过程中移动!](#ff7e5e)' -teleporting_cancelled_damage: '[传送失败; 请不要在传送过程中受到伤害!](#ff7e5e)' -teleporting_complete: '[传送成功!](#00fb9a)' -teleporting_action_bar_countdown: '[传送在](#00fb9a) [%1%](#00fb9a bold)[...](#00fb9a)' -teleporting_action_bar_cancelled: '[传送取消!](#ff7e5e)' -teleporting_please_stand_still: '[请不要在传送过程中移动或收到伤害.](gray)' -home_deleted: '[成功删除](#00fb9a) [%1%](#00fb9a bold) [这个家](#00fb9a)' -warp_deleted: '[成功删除](#00fb9a) [%1%](#00fb9a bold) [这个传送点](#00fb9a)' -error_home_invalid: '[错误:](#ff3300) [你没有叫 “%1%” 的家](#ff7e5e)' -error_warp_invalid: '[错误:](#ff3300) [没有叫做 “%1%” 的传送点](#ff7e5e)' -error_invalid_syntax: '[错误:](#ff3300) [语法不正确.使用: %1%](#ff7e5e)' -edit_home_title: '\n[编辑家的详细信息](#00fb9a) [%1%](#00fb9a bold)[:](#00fb9a)' -edit_home_title_other: '\n[编辑%1%家的详细信息,](#00fb9a) [%2%](#00fb9a bold)[:](#00fb9a)' -edit_home_options: '\n[[传送]](green show_text=&7传送到你的家 run_command=/huskhomes:home %1%.%2%) [[删除]](red show_text=&7删除你的家 run_command=/huskhomes:delhome %1%.%2%) [[更新位置]](blue show_text=&7更新家的坐标到 run_command=/huskhomes:edithome %1%.%2% location)\n[[更改名字]](yellow show_text=&7更改家的名字 suggest_command=/huskhomes:edithome %1%.%2% rename ) [[编辑描述]](gold show_text=&7更改家的描述 suggest_command=/huskhomes:edithome %1%.%2% description )\n' -edit_home_options_make_public: '\n[[传送]](green show_text=&7传送到你的家 run_command=/huskhomes:home %1%.%2%) [[删除]](red show_text=&7删除你的家 run_command=/huskhomes:delhome %1%.%2%) [[更新位置]](blue show_text=&7更新家的坐标到 run_command=/huskhomes:edithome %1%.%2% location)\n[[更改名字]](yellow show_text=&7更改家的名字 suggest_command=/huskhomes:edithome %1%.%2% rename ) [[编辑描述]](gold show_text=&7更改家的描述 suggest_command=/huskhomes:edithome %1%.%2% description ) [[更改隐私为公共]](dark_green show_text=&7开放家的传送到全部人 run_command=/huskhomes:edithome %1%.%2% public)\n' -edit_home_options_make_private: '\n[[传送]](green show_text=&7传送到你的家 run_command=/huskhomes:home %1%.%2%) [[删除]](red show_text=&7删除你的家 run_command=/huskhomes:delhome %1%.%2%) [[更新位置]](blue show_text=&7更新家的坐标到 run_command=/huskhomes:edithome %1%.%2% location)\n[[更改名字]](yellow show_text=&7更改家的名字 suggest_command=/huskhomes:edithome %1%.%2% rename ) [[编辑描述]](gold show_text=&7更改家的描述 suggest_command=/huskhomes:edithome %1%.%2% description ) [[更改隐私为私人]](dark_red show_text=&7更改家的传送为近自己可见 run_command=/huskhomes:edithome %1%.%2% private)\n' -edit_home_privacy_private: '• 访问: &#ff7e5e&私人住宅 &7(只有你可以访问)' -edit_home_privacy_public: '• 访问: &a公共 &7(所有人都可以访问)' -edit_home_privacy_public_success: '[成功更改家 ](#00fb9a) [%1%](#00fb9a bold)[ 的设置为开放到所有人.](#00fb9a)' -edit_home_privacy_public_success_economy: '[成功更改家 ](#00fb9a) [%1%](#00fb9a bold)[的设置为付费参观,价格: %2%.](#00fb9a)' -edit_home_privacy_private_success: '[成功更改家 ](#00fb9a) [%1%](#00fb9a bold)[ 的设置为私人.](#00fb9a)' -error_edit_home_privacy_already_public: '[错误:](#ff3300) [你的家已经设置为公共的了.](#ff7e5e)' -error_edit_home_privacy_already_private: '[错误:](#ff3300) [你的家已经设置为私人的了.](#ff7e5e)' -error_edit_home_privacy_no_permission: '[错误:](#ff3300) [你没有权限去更改家为公共.](#ff7e5e)' -error_edit_home_description_length: '[错误:](#ff3300) [家的描述必须小于255个字符.](#ff7e5e)' -error_edit_home_description_characters: '[错误:](#ff3300) [家名字的字符仅支持“A-Z”和“0-9”](#ff7e5e)' -edit_home_update_location: '[更改位置](#00fb9a) [%1%](#00fb9a bold) [到你现在的位置.](#00fb9a)' -edit_home_update_description: '[更改描述](#00fb9a) [%1%](#00fb9a bold) [为 "%2%"](#00fb9a)' -edit_home_update_name: '[成功更改家的名字: %1% →](#00fb9a) [%2%](#00fb9a bold)' -edit_warp_title: '\n[编辑传送点的详细信息](#00fb9a) [%1%](#00fb9a bold)[:](#00fb9a)' -edit_warp_options: '\n[[传送]](green show_text=&7传送你到这个传送点 run_command=/huskhomes:warp %1%) [[删除]](red show_text=&7删除这个传送点 run_command=/huskhomes:delwarp %1%) [[更新位置]](blue show_text=&7更改这个传送点的位置 run_command=/huskhomes:editwarp %1% location)\n[[更改名字]](yellow show_text=&7更改这个传送点的名字 suggest_command=/huskhomes:editwarp %1% rename ) [[编辑描述]](gold show_text=&7更改传送点的描述 suggest_command=/huskhomes:editwarp %1% description )\n' -error_edit_warp_description_length: '[错误:](#ff3300) [传送点的描述必须小于255个字符.](#ff7e5e)' -error_edit_warp_description_characters: '[错误:](#ff3300) [传送点名字的字符仅支持“A-Z”和“0-9”](#ff7e5e)' -edit_warp_update_location: '[更改传送点的位置](#00fb9a) [%1%](#00fb9a bold) [到你现在的位置.](#00fb9a)' -edit_warp_update_description: '[更改描述](#00fb9a) [%1%](#00fb9a bold) [to "%2%".](#00fb9a)' -edit_warp_update_name: '[成功更改传送点的名字. %1% →](#00fb9a) [%2%](#00fb9a bold)' -edit_description: '• 描述: &7%1%' -edit_location: '• 坐标: &7%1%, %2%, %3%' -edit_world: '• 世界: &7%1%' -edit_server: '• 服务器: &7%1%' -edit_timestamp: '• Created: &7%1%' -error_no_homes_set: '[错误:](#ff3300) [你还没有设置任何一个家!](#ff7e5e)' -error_no_public_homes_set: '[错误:](#ff3300) [没有公共的家被设置!](#ff7e5e)' -error_no_warps_set: '[错误:](#ff3300) [没有地标被设置!](#ff7e5e)' -private_home_list_page_top: '\n[%1%’的家:](#00fb9a) [(](#00fb9a)[%2%-%3%](#00fb9a bold) [在](#00fb9a) [%4%](#00fb9a bold)[)](#00fb9a)\n' -public_home_list_page_top: '\n[公共的家:](#00fb9a) [(](#00fb9a)[%1%-%2%](#00fb9a bold) [在](#00fb9a) [%3%](#00fb9a bold)[)](#00fb9a)\n' -warp_list_page_top: '\n[传送点:](#00fb9a) [(](#00fb9a)[%1%-%2%](#00fb9a bold) [在](#00fb9a) [%3%](#00fb9a bold)[)](#00fb9a)\n' -error_public_home_invalid: '[错误:](#ff3300) [没有找到 %1% 的名为 %2% 的公共房屋.](#ff7e5e)' -error_set_home_invalid_characters: '[错误:](#ff3300) [家的字符暂不支持中文(生草)](#ff7e5e)' -error_set_home_invalid_length: '[错误:](#ff3300) [家的名字最多支持16个字符](#ff7e5e)' -error_set_warp_invalid_characters: '[错误:](#ff3300) [传送点的字符暂不支持中文(生草)](#ff7e5e)' -error_set_warp_invalid_length: '[错误:](#ff3300) [传送点的名字最多支持16个字符](#ff7e5e)' -error_set_home_maximum_homes: '[错误:](#ff3300) [你最多可以设置 %1% 个家!](#ff7e5e)' -error_insufficient_funds: '[错误:](#ff3300) [你没有足够的钱! (需要花费: %1%)](#ff7e5e)' -set_home_spent_money: '[成功花费 %1% 去设置了一个额外的家!](gray)' -set_home_used_free_slots: '[你已经耗尽了所有可设置的家 (%1%); 设置额外的家需要花费 %2% .](gray)' -set_home_success: '[成功地设置了一个名](#00fb9a) [%1%](#00fb9a bold) [的家](#00fb9a)' -set_warp_success: '[成功地设置了一个名](#00fb9a) [%1%](#00fb9a bold) [的传送点](#00fb9a)' -error_set_home_name_taken: '[错误:](#ff3300) [这个名字已经被你用过了.](#ff7e5e)' -error_set_warp_name_taken: '[错误:](#ff3300) [这个传送点的名字已经被用过了.](#ff7e5e)' -set_spawn_success: '[成功设置该服务器的出生点为你现在的位置.](#00fb9a)' -error_spawn_undefined: '[错误:](#ff3300) [这个服务器没有设置出生点.](#ff7e5e)' -error_tpa_no_pending_request: '[错误:](#ff3300) [你没有需要处理的传送请求.](#ff7e5e)' -error_tpa_request_expired: '[错误:](#ff3300) [你的传送请求已经过期.](#ff7e5e)' -error_player_not_found: '[错误:](#ff3300) [没有找到玩家 %1%.](#ff7e5e)' -return_by_death: '[回到上一个死亡点?](gray) [/back](#00fb9a show_text=�fb9a&点击来回到上一次死亡的地点 run_command=/back)' -teleport_request_options: '[传送请求:](gray) [[同意传送]](#00fb9a show_text=�fb9a&同意这次传送; /tpaccept %1% run_command=/tpaccept %1%) [•](gray) [[残忍拒绝]](#ff7e5e show_text=&#ff7e5e&拒绝本次传送; /tpdeny %1% run_command=/tpdeny %1%)' -tpa_you_accepted: '[你接受了 %1% 的传送请求](#00fb9a)' -tpa_you_declined: '[你拒绝了 %1% 的传送请求](#ff7e5e)' -tpa_has_accepted: '[%1% 接受了你的传送请求](#00fb9a)' -tpa_has_declined: '[%1% 拒绝了你的传送请求](#ff7e5e)' -tpa_request_sent: '[你发送传送请求给](#00fb9a) [%1%](#00fb9a bold)' -tpa_request_ask: '[%1%](#00fb9a bold) [请求传送到你](#00fb9a)' -tpahere_request_sent: '[你发送了一个传送请求给](#00fb9a) [%1%](#00fb9a bold) [来传送到你](#00fb9a)' -tpahere_request_ask: '[%1%](#00fb9a bold) [请求你传送到他们那里](#00fb9a)' -error_tp_self: '[错误:](#ff3300) [你不能自己传送自己!](#ff7e5e)' -error_rtp_invalid_dimension: '[错误:](#ff3300) [你不能在这个维度使用随机传送!](#ff7e5e)' -error_rtp_cooldown: '[错误:](#ff3300) [你必须等待 %1% 分钟才能再次随机传送.](#ff7e5e)' -rtp_spent_money: '[花费 %1% 随机传送.](gray)' -back_spent_money: '[花费 %1% 回到你的上一个地点.](gray)' -error_command_disabled: '[错误:](#ff3300) [该命令已禁用!](#ff7e5e)' -error_console_only: '[错误:](#ff3300) [该命令只能从服务器控制台运行.](#ff7e5e)' -error_tp_invalid_world: '[错误:](#ff3300) [请指定有效的服务器世界.](#ff7e5e)' -error_rtp_randomization_timeout: '[错误:](#ff3300) [找不到安全的随机位置传送你.](#ff7e5e)' -list_item_divider: ' [•](gray) ' -home_list_item: '[[%1%]](show_text=&7%3% run_command=/huskhomes:edithome %2%.%1%)' -public_home_list_item: '[[%1%]](show_text=�fb9a&%2%: &7%3% run_command=/huskhomes:phome %2%.%1%)' -warp_list_item: '[[%1%]](show_text=&7%2% run_command=/huskhomes:warp %1%)' -home_default_description: '%1% 的家' -warp_default_description: '可公开访问的地标' -delete_all_homes_confirm: '[严重警告:](#ff3300) [你确定要删除这个家么?](#ff7e5e)\n[一旦你确认,就无法恢复它们.](gray)\n[→](gray) [[确认]](#ff3300 show_text=&#ff3300&点击来确认本次删除操作.这个操作是不可逆的. run_command=/delhome all confirm)' -delete_all_warps_confirm: '[严重警告:](#ff3300) [你确定要删除这个传送点么?](#ff7e5e)\n[一旦你确认,就无法恢复它们.](gray)\n[→](gray) [[确认]](#ff3300 show_text=&#ff3300&点击来确认本次删除操作.这个操作是不可逆的. run_command=/delwarp all confirm)' -delete_all_homes_success: '[成功删除](#00fb9a) [%1%](#00fb9a bold) [家.](#00fb9a)' -delete_all_warps_success: '[成功删除所有](#00fb9a) [%1%](#00fb9a bold) [服务器传送点](#00fb9a)' -error_permission_restricted_warp: '[错误:](#ff3300) [你没有权限去传送到 %1% 这个传送点!](#ff7e5e)' -teleporting_complete_console: '[控制台传送你到 %1%.](gray)' -spawn_warp_default_description: '这个服务器的 /spawn 位置' -error_invalid_page_number: '[错误:](#ff3300) [请指定有效的页码.](#ff7e5e)' -page_options: '[←](gray show_text=&7查看上一页 page run_command=%1%) [查看页面 %2%/%3%](#00fb9a) [→](gray show_text=&7查看下一页 page run_command=%4%)' -page_options_min: '[查看页面 %1%/%2%](#00fb9a) [→](gray show_text=&7查看下一页 page run_command=%3%)' -page_options_min_max: '[查看页面 %1%/%2%](#00fb9a)' -page_options_max: '[←](gray show_text=&7查看上一页 run_command=%1%) [查看页面 %2%/%3%](#00fb9a)' -page_no_items: '[(此页上没有要显示的项目)](gray show_text=&7请尝试其他页码)' -command_list_header: '\n[HuskHomes](#00fb9a bold) [| 指令列表](#00fb9a)' -command_list_item: '[/%1%](#00fb9a show_text=�fb9a&%2% suggest_command=/%1%) [•](white) [%3%](gray)' -error_invalid_on_arrival: '[错误:](#ff3300) [无法完成你的指定传送,因为找不到目标世界。](#ff7e5e)' -tpignore_toggle_on: '[你现在是](#00fb9a) [勿扰模式](#00fb9a bold) [拒绝所有的传送请求.](#00fb9a) [(点击来切换)](gray show_text=&7单击以开启接受传送请求 run_command=/huskhomes:tpignore)' -tpignore_toggle_off: '[你现在是](#00fb9a) [正常模式](#00fb9a bold) [接受所有的传送请求.](#00fb9a) [(点击来切换)](gray show_text=&7单击以关闭接受传送请求 run_command=/huskhomes:tpignore)' -tpignore_on_reminder: '[您当前正在忽略接受传送请求!](gray) [(点击来切换)](gray show_text=&7单击以开启接受传送请求run_command=/huskhomes:tpignore)' -error_ignoring_teleport_requests: '[错误:](#ff3300) [你当前正在忽略传送请求!](#ff7e5e) [(点击来切换)](#ff7e5e show_text=&#ff7e5e&单击以开启接受传送请求 run_command=/huskhomes:tpignore)' -error_no_offline_position: '[错误:](#ff3300) [找不到 %1% 上次离线的位置.](#ff7e5e)' -error_invalid_player: '[错误:](#ff3300) [请指定一个有效的玩家名称!](#ff7e5e)' -error_no_homes_set_other: '[错误:](#ff3300) [%1% 没有设置任何一个家!](#ff7e5e)' -error_home_invalid_other: '[错误:](#ff3300) [%1% 没有叫做 "%2%" 的家](#ff7e5e)' -home_deleted_other: '[成功删除了 %1% 的名字叫](#00fb9a) [%2%](#00fb9a bold) [的家](#00fb9a)' -edit_home_privacy_private_other: '• 隐私性: &#ff7e5e&私有的 &7(只有 %1% 可以使用该家)' -error_edit_home_maximum_public_homes: '[错误:](#ff3300) [您最多只能公开 %1% 的家。.](#ff7e5e)' -tpaall_request_sent: '[你发送了一个传送请求,要求所有人都传送到你这里。!](#00fb9a)' -error_no_other_online_players: '[错误:](#ff3300) [没有在线玩家可以传送到你的位置](#ff7e5e)' -teleporting_all_players: '[正在将所有人都传送到你的位置...](#00fb9a)' -error_illegal_target_coordinates: '[错误:](#ff3300) 中止传送,因为它可能超出了世界限制.](#ff7e5e)' -home_command_description: '传送回家' -sethome_command_description: '设置一个带有名称的家园' -delhome_command_description: '删除家园' -edithome_command_description: '编辑家园' -warp_command_description: '传送到传送点' -setwarp_command_description: '设置一个带有名称的传送点' -delwarp_command_description: '删除传送点' -editwarp_command_description: '编辑传送点' -back_command_description: '返回到上次传送或死亡的位置' -homelist_command_description: '你的家园列表' -warplist_command_description: '传送点列表' -publichomelist_command_description: '公开家园列表' -publichome_command_description: '传送至公开家园' -tp_command_description: '传送到该玩家或该地点' -tphere_command_description: '将该玩家传送至你的位置' -tpa_command_description: '请求传送到该玩家的位置' -tpahere_command_description: '要求其他玩家传送到你的位置' -tpaccept_command_description: '接受传送请求' -tpdeny_command_description: '拒绝传送请求' -tpignore_command_description: '忽略传送请求' -tpoffline_command_description: '传送到该玩家最后在线的位置' -rtp_command_description: '在野外随机传送' -spawn_command_description: '传送回出生点' -setspawn_command_description: '设置出生点位置' -tpaall_command_description: '要求所有人都传送到你的位置' -tpall_command_description: '将所有人传送到你的位置' -huskhomes_command_description: '查看插件信息 & 重载配置文件' diff --git a/src/main/resources/languages/zh-tw.yml b/src/main/resources/languages/zh-tw.yml deleted file mode 100644 index fcad7986..00000000 --- a/src/main/resources/languages/zh-tw.yml +++ /dev/null @@ -1,153 +0,0 @@ -error_no_permission: '[錯誤:](#ff3300) [你沒有權限執行這個指令](#ff7e5e)' -error_no_last_position: '[錯誤:](#ff3300) [無法回到你的上一個地點](#ff7e5e)' -teleporting_last_position: '[在](#00fb9a) [%1%](#00fb9a bold) [秒內返回你上一個地點](#00fb9a)' -teleporting_offline_player: '[傳送你到 %1% 最後離線的位置...](#00fb9a)' -teleporting_countdown_start: '[你將在](#00fb9a) [%1%](#00fb9a bold) [秒後被傳送](#00fb9a)' -teleporting_cancelled_movement: '[傳送失敗; 請不要在傳送過程中移動!](#ff7e5e)' -teleporting_cancelled_damage: '[傳送失敗; 傳送過程中受到傷害!](#ff7e5e)' -teleporting_complete: '[傳送成功!](#00fb9a)' -teleporting_action_bar_countdown: '[傳送到](#00fb9a) [%1%](#00fb9a bold)[...](#00fb9a)' -teleporting_action_bar_cancelled: '[傳送取消!](#ff7e5e)' -teleporting_please_stand_still: '[請不要在傳送過程中移動或收到傷害.](gray)' -home_deleted: '[成功刪除](#00fb9a) [%1%](#00fb9a bold) [這個家](#00fb9a)' -warp_deleted: '[成功刪除](#00fb9a) [%1%](#00fb9a bold) [這個地標](#00fb9a)' -error_home_invalid: '[錯誤:](#ff3300) [你沒有叫 "%1%" 的家](#ff7e5e)' -error_warp_invalid: '[錯誤:](#ff3300) [沒有叫做 "%1%" 的地標](#ff7e5e)' -error_invalid_syntax: '[錯誤:](#ff3300) [語法不正確.請使用: %1%](#ff7e5e)' -edit_home_title: '\n[編輯家的詳細信息](#00fb9a) [%1%](#00fb9a bold)[:](#00fb9a)' -edit_home_options: '\n[[傳送]](green show_text=&7傳送到你的家 run_command=/huskhomes:home %1%.%2%) [[刪除]](red show_text=&7刪除你的家 run_command=/huskhomes:delhome %1%.%2%) [[更新位置]](blue show_text=&7更新家的位置 run_command=/huskhomes:edithome %1%.%2% location)\n[[更改名字]](yellow show_text=&7更改家的名字 suggest_command=/huskhomes:edithome %1%.%2% rename ) [[編輯描述]](gold show_text=&7更改家的描述 suggest_command=/huskhomes:edithome %1%.%2% description )\n' -edit_home_options_make_public: '\n[[傳送]](green show_text=&7傳送到你的家 run_command=/huskhomes:home %1%.%2%) [[刪除]](red show_text=&7刪除你的家 run_command=/huskhomes:delhome %1%.%2%) [[更新位置]](blue show_text=&7更新家的位置 run_command=/huskhomes:edithome %1%.%2% location)\n[[更改名字]](yellow show_text=&7更改家的名字 suggest_command=/huskhomes:edithome %1%.%2% rename ) [[編輯描述]](gold show_text=&7更改家的描述 suggest_command=/huskhomes:edithome %1%.%2% description ) [[更改訪問權限為公開]](dark_green show_text=&7開放家的傳送權限 run_command=/huskhomes:edithome %1%.%2% public)\n' -edit_home_options_make_private: '\n[[傳送]](green show_text=&7傳送到你的家 run_command=/huskhomes:home %1%.%2%) [[刪除]](red show_text=&7刪除你的家 run_command=/huskhomes:delhome %1%.%2%) [[更新位置]](blue show_text=&7更新家的位置 run_command=/huskhomes:edithome %1%.%2% location)\n[[更改名字]](yellow show_text=&7更改家的名字 suggest_command=/huskhomes:edithome %1%.%2% rename ) [[編輯描述]](gold show_text=&7更改家的描述 suggest_command=/huskhomes:edithome %1%.%2% description ) [[更改訪問權限為私人]](dark_red show_text=&7關閉家的傳送權限 run_command=/huskhomes:edithome %1%.%2% private)\n' -edit_home_privacy_private: '• 訪問權: &#ff7e5e&私人 &7(只有你可以訪問)' -edit_home_privacy_public: '• 訪問權: &a公開 &7(所有人都可以訪問)' -edit_home_privacy_public_success: '[成功將](#00fb9a) [%1%](#00fb9a bold)[ 的訪問權限改為公開.](#00fb9a)' -edit_home_privacy_public_success_economy: '[成功將](#00fb9a) [%1%](#00fb9a bold)[ 的訪問權限設為公開,價格: %2%.](#00fb9a)' -edit_home_privacy_private_success: '[成功將](#00fb9a) [%1%](#00fb9a bold)[ 的訪問權限設為私人.](#00fb9a)' -error_edit_home_privacy_already_public: '[錯誤:](#ff3300) [你的家已經設為公開了.](#ff7e5e)' -error_edit_home_privacy_already_private: '[錯誤:](#ff3300) [你的家已經設為私人了.](#ff7e5e)' -error_edit_home_privacy_no_permission: '[錯誤:](#ff3300) [你沒有權限更改家的訪問權.](#ff7e5e)' -error_edit_home_description_length: '[錯誤:](#ff3300) [描述必須小於255個字符.](#ff7e5e)' -error_edit_home_description_characters: '[錯誤:](#ff3300) [家的字符暫不支持中文](#ff7e5e)' -edit_home_update_location: '[成功將](#00fb9a) [%1%](#00fb9a bold) [的位置改到你現在的位置.](#00fb9a)' -edit_home_update_description: '[成功更改](#00fb9a) [%1%](#00fb9a bold) [的描述為 "%2%"](#00fb9a)' -edit_home_update_name: '[成功更改家的名字: %1% →](#00fb9a) [%2%](#00fb9a bold)' -edit_warp_title: '\n[編輯地標的詳細信息](#00fb9a) [%1%](#00fb9a bold)[:](#00fb9a)' -edit_warp_options: '\n[[傳送]](green show_text=&7傳送到這個地標 run_command=/huskhomes:warp %1%) [[刪除]](red show_text=&7刪除這個地標 run_command=/huskhomes:delwarp %1%) [[更新位置]](blue show_text=&7更改這個地標的位置 run_command=/huskhomes:editwarp %1% location)\n[[更改名字]](yellow show_text=&7更改這個地標的名字 suggest_command=/huskhomes:editwarp %1% rename ) [[編輯描述]](gold show_text=&7更改地標的描述 suggest_command=/huskhomes:editwarp %1% description )\n' -error_edit_warp_description_length: '[錯誤:](#ff3300) [地標的描述必須小於255個字符.](#ff7e5e)' -error_edit_warp_description_characters: '[錯誤:](#ff3300) [地標的字符暫不支持中文](#ff7e5e)' -edit_warp_update_location: '[成功更改地標的位置](#00fb9a) [%1%](#00fb9a bold) [到你現在的位置.](#00fb9a)' -edit_warp_update_description: '[成功更改](#00fb9a) [%1%](#00fb9a bold) [的描述為 "%2%".](#00fb9a)' -edit_warp_update_name: '[成功更改地標的名字. %1% →](#00fb9a) [%2%](#00fb9a bold)' -edit_description: '• 描述: &7%1%' -edit_location: '• 坐標: &7%1%, %2%, %3%' -edit_world: '• 世界: &7%1%' -edit_server: '• 伺服器: &7%1%' -edit_timestamp: '• 創建時間: &7%1%' -error_no_homes_set: '[錯誤:](#ff3300) [你還沒有設置任何一個家!](#ff7e5e)' -error_no_public_homes_set: '[錯誤:](#ff3300) [目前沒有公開的家可傳送!](#ff7e5e)' -error_no_warps_set: '[錯誤:](#ff3300) [目前沒有可傳送的地標!](#ff7e5e)' -private_home_list_page_top: '\n[%1%的家:](#00fb9a) [(](#00fb9a)[目前顯示 %2%-%3%](#00fb9a bold) [總共有](#00fb9a) [%4% 個家](#00fb9a bold)[)](#00fb9a)\n' -public_home_list_page_top: '\n[開放的家:](#00fb9a) [(](#00fb9a)[目前顯示 %1%-%2%](#00fb9a bold) [總共有](#00fb9a) [%3% 個開放的家](#00fb9a bold)[)](#00fb9a)\n' -warp_list_page_top: '\n[地標:](#00fb9a) [(](#00fb9a)[目前顯示 %1%-%2%](#00fb9a bold) [總共有](#00fb9a) [%3% 個地標](#00fb9a bold)[)](#00fb9a)\n' -error_public_home_invalid: '[錯誤:](#ff3300) [沒有在 %1% 名下找到名為 %2% 的公開傳點.](#ff7e5e)' -error_set_home_invalid_characters: '[錯誤:](#ff3300) [家的字符暫不支持中文](#ff7e5e)' -error_set_home_invalid_length: '[錯誤:](#ff3300) [家的名字最多只能有16個字符](#ff7e5e)' -error_set_warp_invalid_characters: '[錯誤:](#ff3300) [地標的字符暫不支持中文](#ff7e5e)' -error_set_warp_invalid_length: '[錯誤:](#ff3300) [地標的名字最多只能有16個字符](#ff7e5e)' -error_set_home_maximum_homes: '[錯誤:](#ff3300) [你最多可以設置 %1% 個家!](#ff7e5e)' -error_insufficient_funds: '[錯誤:](#ff3300) [你沒有足夠的錢! (需要花費: %1%)](#ff7e5e)' -set_home_spent_money: '[成功花費 %1% 去設置了一個額外的家!](gray)' -set_home_used_free_slots: '[你已經耗盡了免費的設置額度 (%1%); 設置額外的家需要花費 %2% .](gray)' -set_home_success: '[成功設置一個名為](#00fb9a) [%1%](#00fb9a bold) [的家](#00fb9a)' -set_warp_success: '[成功設置一個名為](#00fb9a) [%1%](#00fb9a bold) [的地標](#00fb9a)' -error_set_home_name_taken: '[錯誤:](#ff3300) [這個名字已經被你用過了.](#ff7e5e)' -error_set_warp_name_taken: '[錯誤:](#ff3300) [這個地標的名字已經被用過了.](#ff7e5e)' -set_spawn_success: '[成功設置伺服器的重生點為你現在的位置.](#00fb9a)' -error_spawn_undefined: '[錯誤:](#ff3300) [這個伺服器沒有設置重生點.](#ff7e5e)' -error_tpa_no_pending_request: '[錯誤:](#ff3300) [你沒有需要處理的傳送請求.](#ff7e5e)' -error_tpa_request_expired: '[錯誤:](#ff3300) [你的傳送請求已經逾時.](#ff7e5e)' -error_player_not_found: '[錯誤:](#ff3300) [沒有找到玩家 %1%.](#ff7e5e)' -return_by_death: '[回到上一個死亡點?](gray) [/back](#00fb9a show_text=�fb9a&點擊來回到上一次死亡的地點 run_command=/back)' -teleport_request_options: '[傳送請求:](gray) [[同意傳送]](#00fb9a show_text=�fb9a&同意這次傳送 request; /tpaccept %1% run_command=/tpaccept %1%) [•](gray) [[殘忍拒絕]](#ff7e5e show_text=&#ff7e5e&拒絕本次傳送 request; /tpdeny %1% run_command=/tpdeny %1%)' -tpa_you_accepted: '[你接受了 %1% 的傳送請求](#00fb9a)' -tpa_you_declined: '[你拒絕了 %1% 的傳送請求](#ff7e5e)' -tpa_has_accepted: '[%1% 接受了你的傳送請求](#00fb9a)' -tpa_has_declined: '[%1% 拒絕了你的傳送請求](#ff7e5e)' -tpa_request_sent: '[你發送傳送請求給](#00fb9a) [%1%](#00fb9a bold)' -tpa_request_ask: '[%1%](#00fb9a bold) [請求傳送到你身邊](#00fb9a)' -tpahere_request_sent: '[你發送了一個傳送請求給](#00fb9a) [%1%](#00fb9a bold) [來傳送到你身邊](#00fb9a)' -tpahere_request_ask: '[%1%](#00fb9a bold) [請求你傳送到他身邊](#00fb9a)' -error_tp_self: '[錯誤:](#ff3300) [你不能自己傳送自己!](#ff7e5e)' -error_rtp_invalid_dimension: '[錯誤:](#ff3300) [你不能在這個世界使用隨機傳送!](#ff7e5e)' -error_rtp_cooldown: '[錯誤:](#ff3300) [你必須等待 %1% 分鐘才能再次隨機傳送.](#ff7e5e)' -rtp_spent_money: '[花費 %1% 隨機傳送.](gray)' -back_spent_money: '[花費 %1% 回到你的上一個地點.](gray)' -error_command_disabled: '[錯誤:](#ff3300) [該命令已禁用!](#ff7e5e)' -error_console_only: '[錯誤:](#ff3300) [該命令只能從伺服器後台執行.](#ff7e5e)' -error_tp_invalid_world: '[錯誤:](#ff3300) [請指定有效的伺服器與世界.](#ff7e5e)' -error_rtp_randomization_timeout: '[錯誤:](#ff3300) [找不到安全的位置,你可以稍後再試試看.](#ff7e5e)' -list_item_divider: ' [•](gray) ' -home_list_item: '[[%1%]](show_text=&7%3% run_command=/huskhomes:edithome %2%.%1%)' -public_home_list_item: '[[%1%]](show_text=�fb9a&%2%: &7%3% run_command=/huskhomes:phome %2%.%1%)' -warp_list_item: '[[%1%]](show_text=&7%2% run_command=/huskhomes:warp %1%)' -home_default_description: '%1% 的家' -warp_default_description: '可公開訪問的地標' -delete_all_homes_confirm: '[警告:](#ff3300) [你確定要刪除全部的家嗎?](#ff7e5e)\n[一旦你確認,就無法恢復它們.](gray)\n[→](gray) [[確認]](#ff3300 show_text=&#ff3300&點擊來確認本次刪除操作.這個操作是不可逆的. run_command=/delhome all confirm)' -delete_all_warps_confirm: '[警告:](#ff3300) [你確定要刪除全部的地標嗎?](#ff7e5e)\n[一旦你確認,就無法恢復它們.](gray)\n[→](gray) [[確認]](#ff3300 show_text=&#ff3300&點擊來確認本次刪除操作.這個操作是不可逆的. run_command=/delwarp all confirm)' -delete_all_homes_success: '[成功刪除](#00fb9a) [%1%](#00fb9a bold) [個家.](#00fb9a)' -delete_all_warps_success: '[成功刪除](#00fb9a) [%1%](#00fb9a bold) [個伺服器地標](#00fb9a)' -error_permission_restricted_warp: '[錯誤:](#ff3300) [你沒有權限傳送至地標 %1%!](#ff7e5e)' -teleporting_complete_console: '[後台傳送你到 %1%.](gray)' -spawn_warp_default_description: '這個伺服器的 /spawn 位置' -error_invalid_page_number: '[錯誤:](#ff3300) [請指定有效的頁碼.](#ff7e5e)' -page_options: '\n[←](gray show_text=&7查看上一頁 run_command=%1%) [目前頁數 %2%/%3%](#00fb9a) [→](gray show_text=&7查看下一頁 run_command=%4%)' -page_options_min: '\n[目前頁數 %1%/%2%](#00fb9a) [→](gray show_text=&7查看下一頁 run_command=%3%)' -page_options_min_max: '\n[目前頁數 %1%/%2%](#00fb9a)' -page_options_max: '\n[←](gray show_text=&7查看上一頁 run_command=%1%) [目前頁數 %2%/%3%](#00fb9a)' -page_no_items: '[(此頁沒有可顯示的項目)](gray show_text=&7請嘗試其他頁碼)' -command_list_header: '\n[HuskHomes](#00fb9a bold) [| 指令列表](#00fb9a)' -error_invalid_on_arrival: '[錯誤:](#ff3300) [無法完成傳送,因為找不到目標世界。](#ff7e5e)' -tpignore_toggle_on: '[你現在是](#00fb9a) [勿擾模式](#e64545 bold) [拒絕所有的傳送請求.](#00fb9a) [(點擊來切換)](gray show_text=&7點擊切換為正常模式 run_command=/huskhomes:tpignore)' -tpignore_toggle_off: '[你現在是](#00fb9a) [正常模式](#00fb9a bold) [接受所有的傳送請求.](#00fb9a) [(點擊來切換)](gray show_text=&7點擊切換為勿擾模式 run_command=/huskhomes:tpignore)' -tpignore_on_reminder: '[歡迎回來!](gray) [你現在是](#00fb9a) [勿擾模式](#e64545 bold) [拒絕所有的傳送請求.](#00fb9a) [(點擊來切換)](gray show_text=&7點擊切換為正常模式 run_command=/huskhomes:tpignore)' -error_ignoring_teleport_requests: '[錯誤:](#ff3300) [你當前正在忽略傳送請求!](#ff7e5e) [(點擊來切換)](#ff7e5e show_text=&#ff7e5e&點擊切換為正常模式 run_command=/huskhomes:tpignore)' -error_no_offline_position: '[錯誤:](#ff3300) [找不到 %1% 離線的位置.](#ff7e5e)' -error_invalid_player: '[錯誤:](#ff3300) [請輸入有效的玩家ID!](#ff7e5e)' -error_no_homes_set_other: '[錯誤:](#ff3300) [%1% 還沒設置任何家!](#ff7e5e)' -error_home_invalid_other: '[錯誤:](#ff3300) [%1% 沒有名為 "%2%" 的家](#ff7e5e)' -home_deleted_other: '[成功刪除 %1% 的家](#00fb9a) [%2%](#00fb9a bold)' -edit_home_privacy_private_other: '• 訪問權: &#ff7e5e&私人 &7(只有 %1% 可以使用)' -edit_home_title_other: '\n[編輯 %1% 家的詳細信息](#00fb9a) [%2%](#00fb9a bold)[:](#00fb9a)' -command_list_item: '[/%1%](#00fb9a show_text=�fb9a&%2% suggest_command=/%1%) [•](white) [%3%](gray)' -error_edit_home_maximum_public_homes: '[錯誤:](#ff3300) [你最多只能將 %1% 個家設為公開.](#ff7e5e)' -tpaall_request_sent: '[你向所有玩家發送了一個傳送請求,要求所有人傳送到你身邊!](#00fb9a)' -error_no_other_online_players: '[錯誤:](#ff3300) [沒有其他在線上的玩家可以傳送到你身邊!](#ff7e5e)' -teleporting_all_players: '[將所有玩家傳送到你的身邊...](#00fb9a)' -error_illegal_target_coordinates: '[錯誤:](#ff3300) [中止傳送,因為它超出了可能的遊戲世界限制.](#ff7e5e)' -home_command_description: '傳送到你的家' -sethome_command_description: '設定一個新的家' -delhome_command_description: '刪除一個家' -edithome_command_description: '編輯你的家' -warp_command_description: '傳送至地標' -setwarp_command_description: '設定一個新的地標' -delwarp_command_description: '刪除地標' -editwarp_command_description: '編輯地標' -back_command_description: '回到你以前的位置,或者你死去的地方' -homelist_command_description: '列出所有的家' -warplist_command_description: '列出所有的地標' -publichomelist_command_description: '查看開啟訪問權限的家' -publichome_command_description: '傳送到開啟訪問權限的家' -tp_command_description: '傳送到另一個玩家或世界座標' -tphere_command_description: '將另一個玩家傳送至你的身邊' -tpa_command_description: '請求傳送到另一個玩家身邊' -tpahere_command_description: '請求其他玩家傳送到你的身邊' -tpaccept_command_description: '接受傳送請求' -tpdeny_command_description: '拒絕傳送請求' -tpignore_command_description: '忽略所有傳送請求 (切換 勿擾/正常 模式)' -tpoffline_command_description: '傳送至該玩家離線的位置' -rtp_command_description: '隨機傳送' -spawn_command_description: '傳送至重生點' -setspawn_command_description: '設置重生點位置' -tpaall_command_description: '請求所有玩家傳送至你的身邊' -tpall_command_description: '強制將所有玩家傳送至你的身邊' -huskhomes_command_description: '查看插件信息並重新加載配置' \ No newline at end of file diff --git a/src/main/resources/marker-icons/public_home.png b/src/main/resources/marker-icons/public_home.png deleted file mode 100644 index 6cfb88098a6931d43093a4de0b012421661ababc..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 661 zcmV;G0&4w4Tx04UFukv&MmP!xqvQ^g`x2RmqS$WWauh>AE$6pLV?v=v%)FnQ@8G-*gu zTpR`0f`dPcRR<1NmzidDO#qs1 zo5`3YX0oed&ntWwMn3`w%gi$3sl_xp*4I7Vrn-yrEc~zf)SSftpGZ8%4AUmwAfDN@ z4bJ<-Ay$-C;&bA0lNuy`Et|dh*&JNvC_t@XllgM#1U1~DPPEV zta9Gstd*;**(ZNtFsHAixK3*XF)SgD1VkvPqJ%PRL}}Mav5=&5se?c4`V-_*$W;O( z#{w$QAiI9>KlnXcD?c^qB?Tp*`^9lSMuDDPpiy(2?_(i|qi@OrgSSBMnm4!RIZhvdG|g)H1~@nb z#tM|Z-r?PW_PPCe$DJRfA4R`%l@Cy|KL7v#2~bQ_MF0Q*|Ns900048wgK+==00VSV zPE-H?0N2V5K>z>%32;bRa{vGf6951U69E94oEQKA0Fp^WK~y+T#g9P}fG`LHvHyRx zBmtF9u{YfV)nsw3jV0#9la2}WVN8N@v%`^51uj}ITt$e?IE7~t0)?CeHFC`O5>j>` zs#bUwn6pqe*;nDNL5ggme-~;El%z2210^h1`#>p##XeBl)*zIvfNykyqo3>r-a_|K vP)~NB3dui$8&C3G6=yN>oka>g8)1wSF#!Zu`1Tg^00000NkvXXu0mjfokAGE diff --git a/src/main/resources/marker-icons/warp.png b/src/main/resources/marker-icons/warp.png deleted file mode 100644 index 7e4358fa21067b9d900b5a5d7d4dd62b5f5179fe..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 663 zcmV;I0%-k-P)4Tx04UFukv&MmP!xqvQ^g`x2RmqS$WWauh>AE$6pLV?v=v%)FnQ@8G-*gu zTpR`0f`dPcRR<1NmzidDO#qs1 zo5`3YX0oed&ntWwMn3`w%gi$3sl_xp*4I7Vrn-yrEc~zf)SSftpGZ8%4AUmwAfDN@ z4bJ<-Ay$-C;&bA0lNuy`Et|dh*&JNvC_t@XllgM#1U1~DPPEV zta9Gstd*;**(ZNtFsHAixK3*XF)SgD1VkvPqJ%PRL}}Mav5=&5se?c4`V-_*$W;O( z#{w$QAiI9>KlnXcD?c^qB?Tp*`^9lSMuDDPpiy(2?_(i|qi@OrgSSBMnm4!RIZhvdG|g)H1~@nb z#tM|Z-r?PW_PPCe$DJRfA4R`%l@Cy|KL7v#2~bQ_MF0Q*|Ns900048wgK+==00VSV zPE-H?0N2V5K>z>%32;bRa{vGf6951U69E94oEQKA0F+5YK~y+T#g9=Az#s@infE{R z#8N0O*~enCehAWMgEmyQ6c?!7;CDhVX4g_9q@Pa-=rn4*cL|YQzIRCmn~G!AgTQ4C)VH5`yF(1ZWxM9|dX) x*`NWLq5fe2TeJ-}U}bcF13Y7&M5Q)=j2qyz1%X&RpP>K%002ovPDHLkV1lW<8lM0F diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml deleted file mode 100644 index 176c5ad3..00000000 --- a/src/main/resources/plugin.yml +++ /dev/null @@ -1,281 +0,0 @@ -name: HuskHomes -version: '${project.version}' -main: me.william278.huskhomes2.HuskHomes -api-version: 1.16 -authors: [William278] -softdepend: [dynmap, Vault, BlueMap, Squaremap] -description: A powerful, intuitive and flexible teleportation suite -website: 'https://william278.net' -libraries: - - 'redis.clients:jedis:${jedis.version}' - -commands: - home: - usage: / - permission: huskhomes.home - sethome: - usage: / - permission: huskhomes.sethome - delhome: - usage: / - permission: huskhomes.delhome - edithome: - usage: / [arguments] - permission: huskhomes.edithome - warp: - usage: / - permission: huskhomes.warp - setwarp: - usage: / - permission: huskhomes.setwarp - delwarp: - usage: / - permission: huskhomes.delwarp - editwarp: - usage: / [arguments] - permission: huskhomes.editwarp - back: - usage: / - permission: huskhomes.back - homelist: - usage: / - permission: huskhomes.home - aliases: [homes, listhomes] - warplist: - usage: / - permission: huskhomes.warp - aliases: [warps, listwarps] - publichomelist: - usage: / - permission: huskhomes.publichome - aliases: [phomes, phomelist, listphomes, listpublichomes] - publichome: - usage: / - permission: huskhomes.publichome - aliases: [phome] - tp: - usage: / [player] [|] [] [] [yaw] [pitch] [world] [server] - permission: huskhomes.tp - aliases: [tpo] - tphere: - usage: / - permission: huskhomes.tphere - aliases: [tpohere] - tpa: - usage: / - permission: huskhomes.tpa - aliases: [tprequest, tpask] - tpahere: - usage: / - permission: huskhomes.tpahere - aliases: [tphererequest, tpaskhere] - tpaccept: - usage: / [player] - permission: huskhomes.tpaccept - aliases: [tpyes] - tpdeny: - usage: / [player] - permission: huskhomes.tpdeny - aliases: [tpno] - tpignore: - usage: / - permission: huskhomes.tpignore - aliases: [tpaignore, ignoretprequests] - tpoffline: - usage: / - permission: huskhomes.tpoffline - rtp: - usage: / - permission: huskhomes.rtp - aliases: [randomtp, randomteleport, wild] - spawn: - usage: / - permission: huskhomes.spawn - setspawn: - usage: / - permission: huskhomes.spawn.set - tpaall: - usage: / - aliases: [tpaallhere, tpahereall, tprequestall] - permission: huskhomes.tpaall - tpall: - usage: / - aliases: [tphereall, tpallhere] - permission: huskhomes.tpall - huskhomes: - usage: / - -permissions: - huskhomes.*: - description: Grants all HuskHomes permissions - children: - huskhomes.bypass_timers: true - huskhomes.commands: true - huskhomes.private_home_admin: true - huskhomes.private_home_admin: - description: Lets you access and edit private homes - children: - huskhomes.home.other: true - huskhomes.edithome.other: true - huskhomes.delhome.other: true - huskhomes.bypass_timers: - description: Bypass all timer restrictions. - children: - huskhomes.bypass_timer: true - huskhomes.rtp.bypass_cooldown: true - huskhomes.basic: - description: Access a basic pack of commands, good for Survival servers - children: - huskhomes.home: true - huskhomes.sethome: true - huskhomes.delhome: true - huskhomes.edithome: true - huskhomes.edithome.public: true - huskhomes.publichome: true - huskhomes.back: true - huskhomes.back.death: true - huskhomes.tpa: true - huskhomes.tpahere: true - huskhomes.spawn: true - huskhomes.warp: true - huskhomes.commands: - description: Access all HuskHomes commands - children: - huskhomes.home: true - huskhomes.sethome: true - huskhomes.delhome: true - huskhomes.edithome: true - huskhomes.edithome.public: true - huskhomes.publichome: true - huskhomes.back: true - huskhomes.back.death: true - huskhomes.tp: true - huskhomes.tphere: true - huskhomes.tpa: true - huskhomes.tpahere: true - huskhomes.spawn: true - huskhomes.spawn.set: true - huskhomes.warp: true - huskhomes.setwarp: true - huskhomes.delwarp: true - huskhomes.editwarp: true - huskhomes.rtp: true - huskhomes.about: true - huskhomes.version_checker: true - huskhomes.reload: true - huskhomes.bypass_timer: - description: Allows you to bypass the teleportation timer - default: false - huskhomes.home: - description: Allows you to teleport to a home - default: true - huskhomes.home.other: - description: Allows you to teleport to all player homes - default: op - huskhomes.sethome: - description: Allows you to set homes - default: true - huskhomes.delhome: - description: Allows you to delete a home - default: true - huskhomes.delhome.other: - description: Allows you to delete any player home - default: op - huskhomes.delhome.all: - description: Allows you to delete all your homes - default: true - huskhomes.warp: - description: Allows you to teleport to a warp - default: true - huskhomes.warp.*: - description: Lets you access all warps even if permission-restricted - default: op - huskhomes.setwarp: - description: Allows you to set server warps - default: op - huskhomes.delwarp: - description: Allows you to delete a server warp - default: op - huskhomes.delwarp.all: - description: Allows you to delete all server warps - default: op - huskhomes.publichome: - description: Allows you to teleport to public homes - default: true - huskhomes.edithome: - description: Allows you to edit home settings - default: true - huskhomes.edithome.other: - description: Allows you to edit home settings for any home - default: op - huskhomes.editwarp: - description: Allows you to edit home information - default: op - huskhomes.back: - description: Allows you to return to your last position - default: true - huskhomes.rtp: - description: Allows you to randomly teleport - default: true - huskhomes.rtp.bypass_cooldown: - description: Allows you to bypass the /rtp cooldown - default: false - huskhomes.about: - description: View information about the plugin - default: true - huskhomes.reload: - description: Reload the plugin configuration & messages files - default: op - huskhomes.version_checker: - description: Check if the plugin is up-to-date - default: op - huskhomes.tp: - description: Allows you to directly teleport to players or locations - default: op - huskhomes.tphere: - description: Allows you to teleport players directly to your location - default: op - huskhomes.tprequest: - description: Allows you to request to teleport to a player - default: false - children: - - huskhomes.tpa - - huskhomes.tpahere - - huskhomes.tpaccept - - huskhomes.tpdeny - huskhomes.tpaccept: - description: Allows you to accept teleport requests - default: true - huskhomes.tpdeny: - description: Allows you to decline teleport requests - default: true - huskhomes.tpa: - description: Allows you to request to teleport to a player - default: true - huskhomes.tpahere: - description: Allows you to request a player to teleport to you - default: true - huskhomes.tpignore: - description: Allows you to ingore teleport requests - default: true - huskhomes.tpoffline: - description: Allows you to teleport to where players logged off - default: op - huskhomes.back.death: - description: Allows you to return to where you died - default: true - huskhomes.spawn: - description: Allows you to teleport to spawn - default: true - huskhomes.spawn.set: - description: Allows you to set the spawn location - default: op - huskhomes.edithome.public: - description: Allows you to make a home public - default: true - huskhomes.tpaall: - description: Allows you to request everyone to teleport to you - default: op - huskhomes.tpall: - description: Allows you to teleport everyone to you - default: op \ No newline at end of file