diff --git a/.idea/sqldialects.xml b/.idea/sqldialects.xml index 622a7a1..b8dfb29 100644 --- a/.idea/sqldialects.xml +++ b/.idea/sqldialects.xml @@ -1,6 +1,7 @@ + diff --git a/.travis.yml b/.travis.yml index 5ce66d4..d1eeef3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,9 @@ sudo: false language: java -jdk: openjdk8 +jdk: + - openjdk8 + - openjdk11 cache: directories: diff --git a/README.md b/README.md index 7de42b0..4380909 100644 --- a/README.md +++ b/README.md @@ -14,8 +14,8 @@ [licenseImg]: https://img.shields.io/github/license/GeorgH93/Minepacks.svg [ci]: https://ci.pcgamingfreaks.at/job/Minepacks/ [ciImg]: https://ci.pcgamingfreaks.at/job/Minepacks/badge/icon -[ciDev]: https://ci.pcgamingfreaks.at/job/Minepacks%20V2/ -[ciDevImg]: https://ci.pcgamingfreaks.at/job/Minepacks%20V2/badge/icon +[ciDev]: https://ci.pcgamingfreaks.at/job/Minepacks%20Dev/ +[ciDevImg]: https://ci.pcgamingfreaks.at/job/Minepacks%20Dev/badge/icon [apiVersionImg]: https://img.shields.io/badge/dynamic/xml.svg?label=api-version&query=%2F%2Frelease[1]&url=https%3A%2F%2Frepo.pcgamingfreaks.at%2Frepository%2Fmaven-releases%2Fat%2Fpcgamingfreaks%2FMinepacks-API%2Fmaven-metadata.xml [api]: https://github.com/GeorgH93/Minepacks/tree/API [apiJavaDoc]: https://ci.pcgamingfreaks.at/job/Minepacks%20API/javadoc/ diff --git a/pom.xml b/pom.xml index 9149249..3d5e661 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ 4.0.0 at.pcgamingfreaks Minepacks - 2.1-ALPHA + 2.2-ALPHA scm:git:git@github.com:GeorgH93/Minepacks.git @@ -78,7 +78,7 @@ at.pcgamingfreaks PluginLib - 1.0.17-SNAPSHOT + 1.0.19-SNAPSHOT @@ -111,7 +111,7 @@ maven-compiler-plugin - 3.1 + 3.8.1 1.8 1.8 diff --git a/resources/config.yml b/resources/config.yml index 504c073..a6f4c4a 100644 --- a/resources/config.yml +++ b/resources/config.yml @@ -61,6 +61,9 @@ Database: # true: format: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx # false: format: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx UseUUIDSeparators: false + # Options: auto, online, offline | auto will decide based on the server online mode option. + # If you are using BungeeCord, set it to whatever you use on your BungeeCord server!!! + UUID_Type: auto # Settings only for MySQL SQL: Host: localhost:3306 @@ -141,6 +144,30 @@ WorldSettings: # It will not disable the Shulkerboxes filter! BlacklistMode: "Message" +# Gives the players an item that they can interact with to open their backpack. Only works on MC 1.8 or newer +ItemShortcut: + # If enabled the players will be given an item they can interact with to open the backpack. + # The item may not be removed from their inventory as long as this option is enabled. + Enabled: true + # The name of the item in the inventory + ItemName: "&eBackpack" + # The texture value for the head. + # Heads can be found here: https://minecraft-heads.com/custom-heads/ + # The correct value is the one listed on the head page under Other/Value + HeadTextureValue: "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvOGRjYzZlYjQwZjNiYWRhNDFlNDMzOTg4OGQ2ZDIwNzQzNzU5OGJkYmQxNzVjMmU3MzExOTFkNWE5YTQyZDNjOCJ9fX0=" + +Sound: + # Enables all sound effects + Enabled: true + # The sound effect that should be played if the backpack is opened + # disabled or false to disable the sound effect + # auto will play the chest sound for minecraft versions older than 1.11 and the shulker-box sound for newer MC versions + OpenSound: auto + # The sound effect that should be played if the backpack is closed + # disabled or false to disable the sound effect + # auto will play the chest sound for minecraft versions older than 1.11 and the shulker-box sound for newer MC versions + CloseSound: auto + Misc: # Enables/Disables the auto-update function of the plugin. AutoUpdate: true @@ -148,4 +175,4 @@ Misc: UseBungeeCord: false # Config file version. Don't touch it! -Version: 21 \ No newline at end of file +Version: 22 \ No newline at end of file diff --git a/resources/lang/de.yml b/resources/lang/de.yml index e18f847..aca3b8b 100644 --- a/resources/lang/de.yml +++ b/resources/lang/de.yml @@ -13,6 +13,8 @@ Language: PlayerBackpackClose_SendMethod: "action_bar" InvalidBackpack: "Rucksack fehlerhaft." NotAllowedInBackpack: "&c{ItemName} ist im Rucksack nicht erlaubt." + DontRemoveShortcut: "&cDu darfst den Rucksack nicht aus deinem Inventar entfernen!" + DontRemoveShortcut_SendMethod: "action_bar" Clean: BackpackCleaned: "Rucksack gelehrt." Open: @@ -24,24 +26,15 @@ Language: Header: "&6### Minepacks Commands ###" Footer: "&6#############################" Reload: - Reloading: "&1Plugin wird neu geladen ..." - Reloaded: "&1Plugin neu geladen!" + Reloading: "&Minepacks wird neu geladen ..." + Reloaded: "&1Minepacks neu geladen!" Update: CheckingForUpdates: "&1Suche nach Aktualisierungen ..." Updated: "[\"\",{\"text\":\"Plugin wurde aktualisiert, Änderungen werden mit dem nächsten neustart übernommen.\",\"color\":\"yellow\"}]" NoUpdate: "[\"\",{\"text\":\"Plugin Aktualisierung verfügbar.\",\"color\":\"gold\"}]" UpdateFail: "[\"\",{\"text\":\"Es gab ein Problem bei der Suche nach Updates! Bitte prüfe das log für mehr details.\",\"color\":\"red\"}]" # You can change this message if you like to, but don't cry if the link isn't linking to the plugin anymore! - UpdateAvailable: "[{\"text\":\"Es ist eine Aktualisierung verfügbar! Bitte gehe auf \\\"\",\"color\":\"green\"},{\"text\":\"https://www.spigotmc.org/resources/19286/\",\"color\":\"yellow\",\"underlined\":true,\"clickEvent\":{\"action\":\"open_url\",\"value\":\"https://www.spigotmc.org/resources/19286/\"}},{\"text\":\"\\\" um es herunter zu laden!\"}]" - Admin: - Reloading: "&1Reloading ..." - Reloaded: "&1Reloaded!" - CheckingForUpdates: "&1Suche nach updates ..." - Updated: "[\"\",{\"text\":\"Update wurde heruntergeladen. Es wird beim nächsten neustart aktiviert.\",\"color\":\"yellow\"}]" - NoUpdate: "[\"\",{\"text\":\"Kein update verfügbar.\",\"color\":\"gold\"}]" - UpdateFail: "[\"\",{\"text\":\"Es ist ein fehler aufgetreten!\",\"color\":\"red\"}]" - # You can change this message if you like to, but don't cry if the link isn't linking to the plugin anymore! - UpdateAvailable: "[{\"text\":\"Es ist ein update verfügbar! Bitte downloade es von: \\\"\",\"color\":\"green\"},{\"text\":\"https://www.spigotmc.org/resources/19286/\",\"color\":\"yellow\",\"underlined\":true,\"clickEvent\":{\"action\":\"open_url\",\"value\":\"https://www.spigotmc.org/resources/19286/\"}},{\"text\":\"\\\"\"}]" + UpdateAvailable: "[{\"text\":\"Es ist eine Aktualisierung verfügbar! Bitte gehe auf \\\"\",\"color\":\"green\"},{\"text\":\"${project.url}\",\"color\":\"yellow\",\"underlined\":true,\"clickEvent\":{\"action\":\"open_url\",\"value\":\"${project.url}\"}},{\"text\":\"\\\" um es herunter zu laden!\"}]" Backup: Created: "Rucksack wurder gesichert." NoBackpack: "Der Spieler hat keinen Rucksack oder keine Items in seinem Rucksack." @@ -110,4 +103,4 @@ LanguageName: "german" Author: "GeorgH93" # Language file version. Don't touch it! -Version: 16 \ No newline at end of file +Version: 17 \ No newline at end of file diff --git a/resources/lang/en.yml b/resources/lang/en.yml index 64464f5..c864c9f 100644 --- a/resources/lang/en.yml +++ b/resources/lang/en.yml @@ -13,6 +13,9 @@ Language: PlayerBackpackClose_SendMethod: "action_bar" InvalidBackpack: "Invalid backpack." NotAllowedInBackpack: "&c{ItemName} is not allowed in the backpack." + NotAllowedInBackpack_SendMethod: "action_bar" + DontRemoveShortcut: "&cYou must not remove the backpack shortcut from your inventory!" + DontRemoveShortcut_SendMethod: "action_bar" Open: #Parameter: {TimeLeft} time in seconds till the backpack can be reopened, {TimeSpanLeft} time formatted as string till the backpack can be reopened Cooldown: "[{\"text\":\"Please wait \",\"color\":\"dark_green\"},{\"text\":\"{TimeSpanLeft}\",\"hoverEvent\":{\"action\":\"show_text\",\"value\":\"{TimeLeft} seconds\"}},{\"text\":\" till you reopen your backpack.\"}]" @@ -24,15 +27,15 @@ Language: Header: "&6### Minepacks Commands ###" Footer: "&6#############################" Reload: - Reloading: "&1Reloading ..." - Reloaded: "&1Reloaded!" + Reloading: "&1Reloading Minepacks ..." + Reloaded: "&1Minepacks reloaded!" Update: CheckingForUpdates: "&1Checking for updates ..." Updated: "[\"\",{\"text\":\"Plugin updated, will be loaded on next restart/reload.\",\"color\":\"yellow\"}]" NoUpdate: "[\"\",{\"text\":\"No plugin update available.\",\"color\":\"gold\"}]" UpdateFail: "[\"\",{\"text\":\"There was a problem looking for updates! Please check the console!\",\"color\":\"red\"}]" # You can change this message if you like to, but don't cry if the link isn't linking to the plugin anymore! - UpdateAvailable: "[{\"text\":\"There is an update available! Please go to \\\"\",\"color\":\"green\"},{\"text\":\"https://www.spigotmc.org/resources/19286/\",\"color\":\"yellow\",\"underlined\":true,\"clickEvent\":{\"action\":\"open_url\",\"value\":\"https://www.spigotmc.org/resources/19286/\"}},{\"text\":\"\\\" to download it!\"}]" + UpdateAvailable: "[{\"text\":\"There is an update available! Please go to \\\"\",\"color\":\"green\"},{\"text\":\"${project.url}\",\"color\":\"yellow\",\"underlined\":true,\"clickEvent\":{\"action\":\"open_url\",\"value\":\"${project.url}\"}},{\"text\":\"\\\" to download it!\"}]" Backup: Created: "The backpack has been backed up successful." NoBackpack: "The player doesn't have a backpack or his backpack is empty." @@ -96,4 +99,4 @@ LanguageName: "english" Author: "GeorgH93" # Language file version. Don't touch it! -Version: 16 \ No newline at end of file +Version: 17 \ No newline at end of file diff --git a/resources/lang/es.yml b/resources/lang/es.yml index 4ffcece..0c7bde0 100644 --- a/resources/lang/es.yml +++ b/resources/lang/es.yml @@ -1,5 +1,5 @@ -Version: 16 -# Para simplificar la personalización y traducción del plugin, por favor, échale un vistazo al editor: http://ptp.pcgamingfreaks.at +# To simplify the customisation and the translation process please check out the editor: http://ptp.pcgamingfreaks.at + Language: NotFromConsole: "&cEl comando no puede ser usado desde la consola." Ingame: @@ -8,20 +8,23 @@ Language: NaN: "[\"\",{\"text\":\"¡El valor introducido no es un número!\",\"color\":\"red\"}]" OwnBackpackClose: "¡Mochila cerrada!" OwnBackpackClose_SendMethod: "action_bar" - # Parametros: {OwnerName}, {OwnerDisplayName} + #Parameter: {OwnerName}, {OwnerDisplayName} PlayerBackpackClose: "¡La mochila de {OwnerName} fue cerrada!" PlayerBackpackClose_SendMethod: "action_bar" - InvalidBackpack: "Mochila no validad" + InvalidBackpack: "Mochila no válida" NotAllowedInBackpack: "&cNo está permitido almacenar el item {ItemName} en la mochila." + NotAllowedInBackpack_SendMethod: "action_bar" + DontRemoveShortcut: "&cNo puedes remover la mochila de tu hotbar o inventario!" + DontRemoveShortcut_SendMethod: "action_bar" Open: - # Parametro: {TimeLeft} tiempo en segundos hasta que la mochila se pueda volver a abrir, {TimeSpanLeft} lapso de tiempo desde que la mochila es formateada y pueda volver a abrise. + #Parameter: {TimeLeft} time in seconds till the backpack can be reopened, {TimeSpanLeft} time formatted as string till the backpack can be reopened Cooldown: "[{\"text\":\"Please wait \",\"color\":\"dark_green\"},{\"text\":\"{TimeSpanLeft}\",\"hoverEvent\":{\"action\":\"show_text\",\"value\":\"{TimeLeft} seconds\"}},{\"text\":\" till you reopen your backpack.\"}]" - # Parametros: {CurrentGameMode}, {AllowedGameModes} + #Parameter: {CurrentGameMode}, {AllowedGameModes} WrongGameMode: "No está permitido acceder a las mochilas en tu modo de juego actual." Clean: BackpackCleaned: "Mochila vaciada" Help: - Header: "&6### Comandos de Minepacks ###" + Header: "&6### Comandos Minepacks ###" Footer: "&6#############################" Reload: Reloading: "&1Actualizando..." @@ -31,13 +34,13 @@ Language: Updated: "[\"\",{\"text\":\"Plugin actualizado, será cargado en el siguiente reinicio/parada.\",\"color\":\"yellow\"}]" NoUpdate: "[\"\",{\"text\":\"No plugin update available.\",\"color\":\"gold\"}]" UpdateFail: "[\"\",{\"text\":\"¡Hubo un error comprando actualizaciones! ¡Por favor, revisa la consola!\",\"color\":\"red\"}]" - # Puedes cambiar este mensaje si lo deseas, ¡pero no llores si el enlace ya no está vinculado al plugin! - UpdateAvailable: "[{\"text\":\"¡Hay una actualización disponible! ¡Por favor, ve a \\\"\",\"color\":\"green\"},{\"text\":\"https://www.spigotmc.org/resources/19286/\",\"color\":\"yellow\",\"underlined\":true,\"clickEvent\":{\"action\":\"open_url\",\"value\":\"https://www.spigotmc.org/resources/19286/\"}},{\"text\":\"\\\" para descargarla!\"}]" + # You can change this message if you like to, but don't cry if the link isn't linking to the plugin anymore! + UpdateAvailable: "[{\"text\":\"¡Hay una actualización disponible! ¡Por favor, ve a \\\"\",\"color\":\"green\"},{\"text\":\"${project.url}\",\"color\":\"yellow\",\"underlined\":true,\"clickEvent\":{\"action\":\"open_url\",\"value\":\"${project.url}\"}},{\"text\":\"\\\" para descargarla!\"}]" Backup: Created: "La mochila fue respaldada con excito." NoBackpack: "El jugador no tiene mochila o bien está vacia." Restore: - BackupsPerPage: "10" + BackupsPerPage: 10 Headline: "[\"\",{\"text\":\"Backups\",\"color\":\"yellow\"},{\"text\":\" - \",\"color\":\"white\"},{\"text\":\"mostrando pág. {CurrentPage}/{MaxPage}\",\"color\":\"gold\"}]" Footer: "[{\"text\":\"<<< Anterior <<<\",\"color\":\"gray\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/{MainCommand} {SubCommand} {CurrentPage}--\"},\"hoverEvent\":{\"action\":\"show_text\",\"value\":\"/{MainCommand} {SubCommand} {CurrentPage}--\"}},{\"text\":\" Mostrando pág. {CurrentPage}/{MaxPage} \",\"color\":\"gold\"},{\"text\":\">>> Siguiente >>>\",\"color\":\"gray\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/{MainCommand} {SubCommand} {CurrentPage}++\"},\"hoverEvent\":{\"action\":\"show_text\",\"value\":\"/{MainCommand} {SubCommand} {CurrentPage}++\"}}]" BackupEntry: "[\"\",{\"text\":\"{BackupIdentifier}\",\"clickEvent\":{\"action\":\"suggest_command\",\"value\":\"/{MainCommand} {SubCommand} {BackupIdentifier}\"},\"hoverEvent\":{\"action\":\"show_text\",\"value\":\"User: {BackupPlayerName} ({BackupPlayerUUID})\\nCreated: {BackupDate}\"}}]" @@ -64,8 +67,7 @@ Language: RestoreList: "Lista de todas las mochilas disponibles." Help: "Muestra todos los comandos disponibles y sus descripciones." Migrate: " Migra la base de datos utilizada de un tipo a otro." -LanguageName: "es_es" -Author: "ThatOverPowered" + Command: Backpack: - backpack @@ -90,4 +92,11 @@ Command: Version: - version Help: - - help \ No newline at end of file + - help + +# Will be shown in the console during startup +LanguageName: "es_es" +Author: "ThatOverPowered" + +# Language file version. Don't touch it! +Version: 17 diff --git a/resources/lang/fr.yml b/resources/lang/fr.yml index 707414c..ce81b31 100644 --- a/resources/lang/fr.yml +++ b/resources/lang/fr.yml @@ -1,28 +1,99 @@ +# To simplify the customisation and the translation process please check out the editor: http://ptp.pcgamingfreaks.at + Language: - Console: - Enabled: MinePacks a été activé ! - Disabled: MinePacks a été désactivé. - NotFromConsole: Commande non utilisable depuis la console. - LangUpdated: Le fichier de langage a été mis à jour. - UpdateUUIDs: Commence la mise à jour de la base de données UUIDs ... - UpdatedUUIDs: 'Mise à jour de %s compte vers UUIDs.' + NotFromConsole: "&cCommande inutilisable depuis la console." Ingame: - NoPermission: "Vous n'avez pas la permissions de faire cela." - OwnBackPackClose: 'Votre sac à dos a été fermé !' - PlayerBackPackClose: "%s's sac à dos ont été fermés !" - InvalidBackpack: Sac à dos invalide. - BackpackCleaned: Sac à dos nétoyé. - Cooldown: "S'il vous plaît veuillez patienter avant de réouvrir votre sac à dos." - WrongGameMode: "Vous n'êtes pas autorisé à ouvrir votre sacà dos dans votre gamemode actuel." - Description: - Backpack: Ouverture de votre sac à dos. - Clean: Nétoyer votre sac à dos. - CleanOther: Nétoyer le sac à dos d'autres joueurs. - View: Voir le contenu du sac à dos des autres joueurs. + NoPermission: "&cVous n'avez pas la permission !" + WorldDisabled: "&cL'utilisation du sac à dos n'est pas autorisée dans ce monde." + NaN: "[\"\",{\"text\":\"La valeur saisie n'est pas un nombre !\",\"color\":\"red\"}]" + OwnBackpackClose: "Sac à dos fermé !" + OwnBackpackClose_SendMethod: "action_bar" + #Parameter: {OwnerName}, {OwnerDisplayName} + PlayerBackpackClose: "{OwnerName} sac à dos fermé !" + PlayerBackpackClose_SendMethod: "action_bar" + InvalidBackpack: "Sac à dos non valide." + NotAllowedInBackpack: "&c{ItemName} n'est pas autorisé dans le sac à dos." + Open: + #Parameter: {TimeLeft} time in seconds till the backpack can be reopened, {TimeSpanLeft} time formatted as string till the backpack can be reopened + Cooldown: "[{\"text\":\"Veuillez patienter \",\"color\":\"dark_green\"},{\"text\":\"{TimeSpanLeft}\",\"hoverEvent\":{\"action\":\"show_text\",\"value\":\"{TimeLeft} secondes\"}},{\"text\":\" till you reopen your backpack.\"}]" + #Parameter: {CurrentGameMode}, {AllowedGameModes} + WrongGameMode: "Vous n'êtes pas autorisé à ouvrir votre sac à dos dans votre mode de jeu actuel." + Clean: + BackpackCleaned: "Sac à dos nettoyé." + Help: + Header: "&6### Minepacks Commandes ###" + Footer: "&6#############################" + Reload: + Reloading: "&1Le plugin est en Rechargement ..." + Reloaded: "&1Le plugin a été Recharger !" + Update: + CheckingForUpdates: "&1Vérification des mises à jour ..." + Updated: "[\"\",{\"text\":\"Plugin mis à jour, sera chargé au prochain redémarrage/rechargement.\",\"color\":\"yellow\"}]" + NoUpdate: "[\"\",{\"text\":\"Aucune mise à jour du plugin disponible.\",\"color\":\"gold\"}]" + UpdateFail: "[\"\",{\"text\":\"Il y a eu un problème de recherche de mises à jour ! Vérifiez la console s'il vous plaît !\",\"color\":\"red\"}]" + # You can change this message if you like to, but don't cry if the link isn't linking to the plugin anymore! + UpdateAvailable: "[{\"text\":\"Il y a une mise à jour disponible ! Veuillez vous rendre à l'adresse suivante \\\"\",\"color\":\"green\"},{\"text\":\"${project.url}\",\"color\":\"yellow\",\"underlined\":true,\"clickEvent\":{\"action\":\"open_url\",\"value\":\"${project.url}\"}},{\"text\":\"\\\" pour la télécharger !\"}]" + Backup: + Created: "Le sac à dos a été sauvegardé avec succès." + NoBackpack: "Le joueur n'a pas de sac à dos ou son sac à dos est vide." + Restore: + BackupsPerPage: 10 + Headline: "[\"\",{\"text\":\"Backups\",\"color\":\"yellow\"},{\"text\":\" - \",\"color\":\"white\"},{\"text\":\"Page {CurrentPage}/{MaxPage}\",\"color\":\"gold\"}]" + Footer: "[{\"text\":\"<<< Previous <<<\",\"color\":\"gray\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/{MainCommand} {SubCommand} {CurrentPage}--\"},\"hoverEvent\":{\"action\":\"show_text\",\"value\":\"/{MainCommand} {SubCommand} {CurrentPage}--\"}},{\"text\":\" Page {CurrentPage}/{MaxPage} \",\"color\":\"gold\"},{\"text\":\">>> Next >>>\",\"color\":\"gray\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/{MainCommand} {SubCommand} {CurrentPage}++\"},\"hoverEvent\":{\"action\":\"show_text\",\"value\":\"/{MainCommand} {SubCommand} {CurrentPage}++\"}}]" + BackupEntry: "[\"\",{\"text\":\"{BackupIdentifier}\",\"clickEvent\":{\"action\":\"suggest_command\",\"value\":\"/{MainCommand} {SubCommand} {BackupIdentifier}\"},\"hoverEvent\":{\"action\":\"show_text\",\"value\":\"Utilisateur: {BackupPlayerName} ({BackupPlayerUUID})\\nCréé: {BackupDate}\"}}]" + NoValidBackup: "Aucune correspondance des sauvegardes {BackupIdentifier} trouvé." + NoUserToRestoreToFound: "Aucun utilisateur valide pour restaurer la sauvegarde sur trouvée" + # No Json!!! + ParameterBackupName: "backup_name" + # No Json!!! + DateFormat: "dd.MM.yyyy HH:mm:ss" + Restored: "La sauvegarde a été restaurée avec succès." + Commands: + HelpFormat: "[\"\",{\"text\":\"/{MainCommand} {SubCommand} {Parameters}\",\"clickEvent\":{\"action\":\"suggest_command\",\"value\":\"/{MainCommand} {SubCommand}\"}},{\"text\":\" - \",\"color\":\"white\"},{\"text\":\"{Description}\",\"color\":\"aqua\"}]" + PlayerNameVariable: "player_name" + Description: + Backpack: "Ouvre votre sac à dos." + Clean: "Nettoie votre sac à dos." + CleanOthers: "Nettoie le sac à dos d'un autre joueur." + OpenOthers: "Montre le sac à dos d'un autre joueur." + Reload: "Recharge la configuration du plugin." + Update: "Vérifie les nouvelles mises à jour des plugins." + Version: "Imprime les détails de la version du plugin et de ses dépendances." + Backup: "Crée une sauvegarde d'un sac à dos de joueur." + Restore: "Restaure une sauvegarde." + RestoreList: "Liste toutes les sauvegardes disponibles." + Help: "Affiche toutes les commandes disponibles et leur description." + Migrate: "Migre la base de données utilisée d'un type à un autre." + +Command: + Backpack: + - backpack + - bp + Open: + - open + Clean: + - clean + - clear + - empty + Reload: + - reload + - restart + Update: + - update + Backup: + - backup + Restore: + - restore + ListBackups: + - listbackups + Version: + - version + Help: + - help # Will be shown in the console during startup -LanguageName: "french" -Author: "Nogapra" +LanguageName: "Français" +Author: "HiiRaZ" -# Version de fichierde langage. A ne pas modifié ! -Version: 5 +# Language file version. Don't touch it! +Version: 16 \ No newline at end of file diff --git a/resources/lang/hu.yml b/resources/lang/hu.yml index f7a2bef..863417c 100644 --- a/resources/lang/hu.yml +++ b/resources/lang/hu.yml @@ -1,28 +1,102 @@ +# To simplify the customisation and the translation process please check out the editor: http://ptp.pcgamingfreaks.at + Language: - Console: - Enabled: A MinePacks engedélyezve! - Disabled: A MinePacks letiltva. - NotFromConsole: A konzolon nem használható parancs. - LangUpdated: A nyelvi fájl frissítve lett. - UpdateUUIDs: Indítsd el az adatbázis frissítését az UUID-okhoz ... - UpdatedUUIDs: 'Frissítve %s fiókok UUID-okhoz.' + NotFromConsole: "&cA parancs nem használható konzolból." Ingame: - NoPermission: Nincs jogod ehhez. - OwnBackPackClose: 'A hátizsák bezárva!' - PlayerBackPackClose: "%s hátizsákja bezárva!" - InvalidBackpack: Érvénytelen hátizsák. - BackpackCleaned: A hátizsák kitisztítva. - Cooldown: "Várjon, amíg újra nem nyitja ki a hátizsákot." - WrongGameMode: "A hátizsákot nem lehet megnyitni az aktuális játékmódban." - Description: - Backpack: Megnyitja a hátizsákod. - Clean: Kitisztítja a hátizsákod. - CleanOther: Kitisztítja a többi játékos hátizsákját. - View: Megmutatja a másik játékos hátizsákját. + NoPermission: "&cNincs jogod ezt megtenni." + WorldDisabled: "&cA hátizsák használata nem engedélyezett ebben a világban." + NaN: "[\"\",{\"text\":\"A beírt érték nem egy szám!\",\"color\":\"red\"}]" + OwnBackpackClose: "Hátizsák bezárva!" + OwnBackpackClose_SendMethod: "action_bar" + #Parameter: {OwnerName}, {OwnerDisplayName} + PlayerBackpackClose: "{OwnerName} hátizsákja bezárva!" + PlayerBackpackClose_SendMethod: "action_bar" + InvalidBackpack: "Érvénytelen hátizsák." + NotAllowedInBackpack: "&c{ItemName} nem engedélyezett a hátizsákban." + NotAllowedInBackpack_SendMethod: "action_bar" + DontRemoveShortcut: "&cNem szabad eltávolítani a hátizsák ikonját az eszköztárból!" + DontRemoveShortcut_SendMethod: "action_bar" + Open: + #Parameter: {TimeLeft} time in seconds till the backpack can be reopened, {TimeSpanLeft} time formatted as string till the backpack can be reopened + Cooldown: "[{\"text\":\"Várj \",\"color\":\"dark_green\"},{\"text\":\"{TimeSpanLeft}\",\"hoverEvent\":{\"action\":\"show_text\",\"value\":\"{TimeLeft} másodperc\"}},{\"text\":\", amíg újra nem nyitja a hátizsákot.\"}]" + #Parameter: {CurrentGameMode}, {AllowedGameModes} + WrongGameMode: "A jelenlegi játékmódban nem engedélyezett kinyitni a hátizsákot." + Clean: + BackpackCleaned: "Hátizsák kitisztítva." + Help: + Header: "&6### Minepacks parancsok ###" + Footer: "&6#############################" + Reload: + Reloading: "&1Minepacks újratöltése ..." + Reloaded: "&1Minepacks újratöltve!" + Update: + CheckingForUpdates: "&1Frissítések ellenőrzése ..." + Updated: "[\"\",{\"text\":\"Plugin frissítve, be lesz töltve a következő újraindítás/újratöltésnél.\",\"color\":\"yellow\"}]" + NoUpdate: "[\"\",{\"text\":\"Nincs plugin frissítés elérhető.\",\"color\":\"gold\"}]" + UpdateFail: "[\"\",{\"text\":\"Probléma volt a frissítések keresésekor! Kérlek, ellenőrizd a konzolt!\",\"color\":\"red\"}]" + # You can change this message if you like to, but don't cry if the link isn't linking to the plugin anymore! + UpdateAvailable: "[{\"text\":\"Van egy frissítés elérhető! Menj a(z) \\\"\",\"color\":\"green\"},{\"text\":\"${project.url}\",\"color\":\"yellow\",\"underlined\":true,\"clickEvent\":{\"action\":\"open_url\",\"value\":\"${project.url}\"}},{\"text\":\"\\\", hogy letöltsd!\"}]" + Backup: + Created: "A hátizsák sikeresen mentésre került." + NoBackpack: "A játékosnak nincs egy hátizsákja vagy a hátizsákja üres." + Restore: + BackupsPerPage: 10 + Headline: "[\"\",{\"text\":\"Mentések\",\"color\":\"yellow\"},{\"text\":\" - \",\"color\":\"white\"},{\"text\":\"oldal {CurrentPage}/{MaxPage}\",\"color\":\"gold\"}]" + Footer: "[{\"text\":\"<<< Előző <<<\",\"color\":\"gray\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/{MainCommand} {SubCommand} {CurrentPage}--\"},\"hoverEvent\":{\"action\":\"show_text\",\"value\":\"/{MainCommand} {SubCommand} {CurrentPage}--\"}},{\"text\":\" Oldal {CurrentPage}/{MaxPage} \",\"color\":\"gold\"},{\"text\":\">>> Következő >>>\",\"color\":\"gray\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/{MainCommand} {SubCommand} {CurrentPage}++\"},\"hoverEvent\":{\"action\":\"show_text\",\"value\":\"/{MainCommand} {SubCommand} {CurrentPage}++\"}}]" + BackupEntry: "[\"\",{\"text\":\"{BackupIdentifier}\",\"clickEvent\":{\"action\":\"suggest_command\",\"value\":\"/{MainCommand} {SubCommand} {BackupIdentifier}\"},\"hoverEvent\":{\"action\":\"show_text\",\"value\":\"Felhasználó: {BackupPlayerName} ({BackupPlayerUUID})\\nLétrehozva: {BackupDate}\"}}]" + NoValidBackup: "Nincs mentés találva {BackupIdentifier}" + NoUserToRestoreToFound: "Nincs érvényes felhasználó, aki visszaállíthatja a biztonsági másolatot" + # No Json!!! + ParameterBackupName: "backup_name" + # No Json!!! + DateFormat: "yyyy.MM.dd HH:mm:ss" + Restored: "Biztonsági mentés sikeresen visszaállítva." + Commands: + HelpFormat: "[\"\",{\"text\":\"/{MainCommand} {SubCommand} {Parameters}\",\"clickEvent\":{\"action\":\"suggest_command\",\"value\":\"/{MainCommand} {SubCommand}\"}},{\"text\":\" - \",\"color\":\"white\"},{\"text\":\"{Description}\",\"color\":\"aqua\"}]" + PlayerNameVariable: "player_name" + Description: + Backpack: "Megnyitja a hátizsákod." + Clean: "Törli a hátizsákod." + CleanOthers: "Törli más játékosok hátizsákját." + OpenOthers: "Megmutatja más játékosok hátizsákját." + Reload: "Újratölti a konfigot és a plugint." + Update: "Ellenőrzi a plugin új frissítéseit." + Version: "Kiírja a plugin verziójának részleteit és annak függőségeit." + Backup: "Létrehoz egy mentést a játékosok hátizsákjáról." + Restore: "Visszaállít egy mentést." + RestoreList: "Listázza az összes elérhető mentéseket." + Help: "Megmutatja az összes elérhető parancsokat és azok leírását." + Migrate: "A használt adatbázist áttelepíti egyik típusról a másikra." + +Command: + Backpack: + - backpack + - bp + Open: + - open + Clean: + - clean + - clear + - empty + Reload: + - reload + - restart + Update: + - update + Backup: + - backup + Restore: + - restore + ListBackups: + - listbackups + Version: + - version + Help: + - help # Will be shown in the console during startup LanguageName: "hungarian" Author: "montlikadani" # Language file version. Don't touch it! -Version: 5 +Version: 17 diff --git a/resources/lang/ja.yml b/resources/lang/ja.yml index f77a83a..f5d6cbe 100644 --- a/resources/lang/ja.yml +++ b/resources/lang/ja.yml @@ -10,6 +10,9 @@ Language: PlayerBackpackClose_SendMethod: "action_bar" InvalidBackpack: "バックパックが無効です。" NotAllowedInBackpack: "&c{ItemName}はバックパックに入れることができません。" + NotAllowedInBackpack_SendMethod: "action_bar" + DontRemoveShortcut: "&cバックパックショートカットをインベントリから削除しないでください!" + DontRemoveShortcut_SendMethod: "action_bar" Open: Cooldown: "&2バックパックを開くまで{TimeLeft}秒待ってください。" WrongGameMode: "現在のゲームモードでバックパックを開くことは許可されていません。" @@ -26,7 +29,7 @@ Language: Updated: "[\"\",{\"text\":\"更新されたプラグインは、次回の再起動/リロード時にロードされます。\",\"color\":\"yellow\"}]" NoUpdate: "[\"\",{\"text\":\"利用可能なプラグインの更新はありません。\",\"color\":\"gold\"}]" UpdateFail: "[\"\",{\"text\":\"アップデートの確認に問題がありました!コンソールを確認してください。\",\"color\":\"red\"}]" - UpdateAvailable: "[{\"text\":\"利用可能なアップデートがあります!\\\"\",\"color\":\"green\"},{\"text\":\"https://www.spigotmc.org/resources/19286/\",\"color\":\"yellow\",\"underlined\":true,\"clickEvent\":{\"action\":\"open_url\",\"value\":\"https://www.spigotmc.org/resources/19286/\"}},{\"text\":\"\\\" からダウンロードして下さい。\"}]" + UpdateAvailable: "[{\"text\":\"利用可能なアップデートがあります!\\\"\",\"color\":\"green\"},{\"text\":\"${project.url}\",\"color\":\"yellow\",\"underlined\":true,\"clickEvent\":{\"action\":\"open_url\",\"value\":\"${project.url}\"}},{\"text\":\"\\\" からダウンロードして下さい。\"}]" Backup: Created: "バックパックは正常にバックアップされました。" NoBackpack: "プレイヤーはバックパックを持っていないか、バックパックが空です。" @@ -84,6 +87,6 @@ Command: - help LanguageName: "japanese" -Author: "snake0053" +Author: "ethernetcat" -Version: 16 \ No newline at end of file +Version: 17 \ No newline at end of file diff --git a/resources/lang/pt.yml b/resources/lang/pt.yml new file mode 100644 index 0000000..f11b185 --- /dev/null +++ b/resources/lang/pt.yml @@ -0,0 +1,102 @@ +Version: 16 +# To simplify the customisation and the translation process please check out the editor: http://ptp.pcgamingfreaks.at +Language: + NotFromConsole: "&cO comando não pode ser usado no console." + Ingame: + NoPermission: "&cVocê não tem permissão para isso." + WorldDisabled: "&cVocê não pode usar a mochila nesse mundo." + NaN: "[\"\",{\"text\":\"Isso não é um número!\",\"color\":\"red\"}]" + OwnBackpackClose: "Mochila fechada!" + OwnBackpackClose_SendMethod: "action_bar" + # Parameter: {OwnerName}, {OwnerDisplayName} + PlayerBackpackClose: "Mochila de {OwnerName} fechada!" + PlayerBackpackClose_SendMethod: "action_bar" + InvalidBackpack: "Mochila inválida." + NotAllowedInBackpack: "&c{ItemName} não pode ficar na mochila." + Open: + # Parameter: {TimeLeft} time in seconds till the backpack can be reopened, {TimeSpanLeft} time formatted as string till the backpack can be reopened + Cooldown: "[{\"text\":\"Por favor, espere \",\"color\":\"dark_green\"},{\"text\":\"{TimeSpanLeft}\",\"hoverEvent\":{\"action\":\"show_text\",\"value\":\"{TimeLeft} seconds\"}},{\"text\":\" para abrir a mochila novamente.\"}]" + # Parameter: {CurrentGameMode}, {AllowedGameModes} + WrongGameMode: "Você não pode abrir a mochila nesse modo de jogo." + Clean: + BackpackCleaned: "Mochila limpa." + Help: + Header: "&6### Comandos Minepacks ###" + Footer: "&6#############################" + Reload: + Reloading: "&1Recarregando ..." + Reloaded: "&1Recarregado!" + Update: + CheckingForUpdates: "&1Procurando atualizações ..." + Updated: "[\"\",{\"text\":\"Plugin atualizado, será carregado no próximo restart/reload.\",\"color\":\"yellow\"}]" + NoUpdate: "[\"\",{\"text\":\"Plugin atualizado!\",\"color\":\"gold\"}]" + UpdateFail: "[\"\",{\"text\":\"Houve um problema ao procucurar atualizações, olhe o console!\",\"color\":\"red\"}]" + # You can change this message if you like to, but don't cry if the link isn't linking to the plugin anymore! + UpdateAvailable: "[{\"text\":\"Atualização disponível, vá até \\\"\",\"color\":\"green\"},{\"text\":\"${project.url}\",\"color\":\"yellow\",\"underlined\":true,\"clickEvent\":{\"action\":\"open_url\",\"value\":\"${project.url}\"}},{\"text\":\"\\\" para baixa-la!\"}]" + Backup: + Created: "Backup criado com sucesso." + NoBackpack: "O jogador não tem um backup ou a mochila está vazia." + Restore: + BackupsPerPage: "10" + Headline: "[\"\",{\"text\":\"Backups\",\"color\":\"yellow\"},{\"text\":\" - \",\"color\":\"white\"},{\"text\":\"página {CurrentPage}/{MaxPage}\",\"color\":\"gold\"}]" + Footer: "[{\"text\":\"<<< Anterior <<<\",\"color\":\"gray\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/{MainCommand} {SubCommand} {CurrentPage}--\"},\"hoverEvent\":{\"action\":\"show_text\",\"value\":\"/{MainCommand} {SubCommand} {CurrentPage}--\"}},{\"text\":\" Página {CurrentPage}/{MaxPage} \",\"color\":\"gold\"},{\"text\":\">>> Próximo >>>\",\"color\":\"gray\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/{MainCommand} {SubCommand} {CurrentPage}++\"},\"hoverEvent\":{\"action\":\"show_text\",\"value\":\"/{MainCommand} {SubCommand} {CurrentPage}++\"}}]" + BackupEntry: "[\"\",{\"text\":\"{BackupIdentifier}\",\"clickEvent\":{\"action\":\"suggest_command\",\"value\":\"/{MainCommand} {SubCommand} {BackupIdentifier}\"},\"hoverEvent\":{\"action\":\"show_text\",\"value\":\"User: {BackupPlayerName} ({BackupPlayerUUID})\\nCreated: {BackupDate}\"}}]" + NoValidBackup: "Nenhuma correspondência de backup {BackupIdentifier} encontrada" + NoUserToRestoreToFound: "Nenhum usuário válido para restaurar o backup encontrado" + # No Json!!! + ParameterBackupName: "backup_name" + # No Json!!! + DateFormat: "yyyy.MM.dd HH:mm:ss" + Restored: "Backup carregado com sucesso." + Commands: + HelpFormat: "[\"\",{\"text\":\"/{MainCommand} {SubCommand} {Parameters}\",\"clickEvent\":{\"action\":\"suggest_command\",\"value\":\"/{MainCommand} {SubCommand}\"}},{\"text\":\" - \",\"color\":\"white\"},{\"text\":\"{Description}\",\"color\":\"aqua\"}]" + PlayerNameVariable: "player_name" + Description: + Backpack: "Abre sua mochila." + Clean: "Limpa sua mochila." + CleanOthers: "Limpa a mochila de outros jogadores." + OpenOthers: "Abre a mochila de outro jogador." + Reload: "Recarrega a configuração do plugin." + Update: "Procura por novas atualizações." + Version: "Mostra detalhes da versão do plugin e suas dependências." + Backup: "Cria um backup da mochila dos jogadores." + Restore: "Restaura um backup." + RestoreList: "Mostra todos os backups disponíveis." + Help: "Mostra todos os comandos disponíveis e suas descrições." + Migrate: "Migra o banco de dados usado de um tipo para outro." +LanguageName: "Português" +Author: "dotJunyo" +Command: + Backpack: + - backpack + - bp + - mochila + Open: + - open + - abrir + Clean: + - clean + - clear + - empty + - limpar + Reload: + - reload + - restart + - recarregar + Update: + - update + - atualizar + Backup: + - backup + Restore: + - restore + - restaurar + ListBackups: + - listbackups + - listarbackups + Version: + - version + - versao + Help: + - help + - ajuda diff --git a/resources/lang/ru.yml b/resources/lang/ru.yml new file mode 100644 index 0000000..4386711 --- /dev/null +++ b/resources/lang/ru.yml @@ -0,0 +1,102 @@ +# To simplify the customisation and the translation process please check out the editor: http://ptp.pcgamingfreaks.at + +Language: + NotFromConsole: "&cЭту команду нельзя использовать в консоли." + Ingame: + NoPermission: "&cУ вас недостаточно прав для этого." + WorldDisabled: "&cИспользовать рюкзак не разрешено в этом мире." + NaN: "[\"\",{\"text\":\"Введенное значение не является числом!\",\"color\":\"red\"}]" + OwnBackpackClose: "Рюкзак закрыт!" + OwnBackpackClose_SendMethod: "action_bar" + #Parameter: {OwnerName}, {OwnerDisplayName} + PlayerBackpackClose: "Рюкзак {OwnerName} закрыт!" + PlayerBackpackClose_SendMethod: "action_bar" + InvalidBackpack: "Недействительный рюкзак." + NotAllowedInBackpack: "&c{ItemName} нельзя положить в рюкзак." + NotAllowedInBackpack_SendMethod: "action_bar" + DontRemoveShortcut: "&cВы не можете удалить иконку рюкзака из своего инвентаря!" + DontRemoveShortcut_SendMethod: "action_bar" + Open: + #Parameter: {TimeLeft} time in seconds till the backpack can be reopened, {TimeSpanLeft} time formatted as string till the backpack can be reopened + Cooldown: "[{\"text\":\"Пожалуйста подождите \",\"color\":\"dark_green\"},{\"text\":\"{TimeSpanLeft}\",\"hoverEvent\":{\"action\":\"show_text\",\"value\":\"{TimeLeft} секунд\"}},{\"text\":\", перед тем как снова открыть свой рюкзак.\"}]" + #Parameter: {CurrentGameMode}, {AllowedGameModes} + WrongGameMode: "Вам не разрешено открывать рюкзак в текущем режиме игры." + Clean: + BackpackCleaned: "Рюкзак очищен." + Help: + Header: "&6### Команды Minepacks ###" + Footer: "&6#############################" + Reload: + Reloading: "&1Перезагрузка..." + Reloaded: "&1Плагин успешно перезагружен!" + Update: + CheckingForUpdates: "&1Проверка обновлений..." + Updated: "[\"\",{\"text\":\"Плагин обновлён и будет загружен после следующей перезагрузки.\",\"color\":\"yellow\"}]" + NoUpdate: "[\"\",{\"text\":\"Нет доступных обновлений.\",\"color\":\"gold\"}]" + UpdateFail: "[\"\",{\"text\":\"При проверке обновлений произошла ошибка! Пожалуйста проверьте консоль!\",\"color\":\"red\"}]" + # You can change this message if you like to, but don't cry if the link isn't linking to the plugin anymore! + UpdateAvailable: "[{\"text\":\"Доступно обновление! Пожалуйста, посетите сайт \\\"\",\"color\":\"green\"},{\"text\":\"${project.url}\",\"color\":\"yellow\",\"underlined\":true,\"clickEvent\":{\"action\":\"open_url\",\"value\":\"${project.url}\"}},{\"text\":\"\\\" чтобы скачать его!\"}]" + Backup: + Created: "Рюкзак был успешно скопирован." + NoBackpack: "У игрока нет рюкзака, либо он пустой." + Restore: + BackupsPerPage: 10 + Headline: "[\"\",{\"text\":\"Резервные копии\",\"color\":\"yellow\"},{\"text\":\" - \",\"color\":\"white\"},{\"text\":\"страница {CurrentPage}/{MaxPage}\",\"color\":\"gold\"}]" + Footer: "[{\"text\":\"<<< Предыдущая <<<\",\"color\":\"gray\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/{MainCommand} {SubCommand} {CurrentPage}--\"},\"hoverEvent\":{\"action\":\"show_text\",\"value\":\"/{MainCommand} {SubCommand} {CurrentPage}--\"}},{\"text\":\" Страница {CurrentPage}/{MaxPage} \",\"color\":\"gold\"},{\"text\":\">>> Следующая >>>\",\"color\":\"gray\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/{MainCommand} {SubCommand} {CurrentPage}++\"},\"hoverEvent\":{\"action\":\"show_text\",\"value\":\"/{MainCommand} {SubCommand} {CurrentPage}++\"}}]" + BackupEntry: "[\"\",{\"text\":\"{BackupIdentifier}\",\"clickEvent\":{\"action\":\"suggest_command\",\"value\":\"/{MainCommand} {SubCommand} {BackupIdentifier}\"},\"hoverEvent\":{\"action\":\"show_text\",\"value\":\"Пользователь: {BackupPlayerName} ({BackupPlayerUUID})\\nСоздана: {BackupDate}\"}}]" + NoValidBackup: "Резервная копия {BackupIdentifier} не найдена" + NoUserToRestoreToFound: "Не найдено действительного пользователя или копии для восстановления" + # No Json!!! + ParameterBackupName: "backup_name" + # No Json!!! + DateFormat: "dd.MM.yy HH:mm:ss" + Restored: "Резервная копия успешно восстановлена." + Commands: + HelpFormat: "[\"\",{\"text\":\"/{MainCommand} {SubCommand} {Parameters}\",\"clickEvent\":{\"action\":\"suggest_command\",\"value\":\"/{MainCommand} {SubCommand}\"}},{\"text\":\" - \",\"color\":\"white\"},{\"text\":\"{Description}\",\"color\":\"aqua\"}]" + PlayerNameVariable: "player_name" + Description: + Backpack: "Открыть ваш рюкзак." + Clean: "Очистить ваш рюкзак." + CleanOthers: "Очистить рюкзак другого игрока." + OpenOthers: "Открыть рюкзак другого игрока." + Reload: "Перезагрузить конфигурацию плагина." + Update: "Проверить плагин на наличие новых версий." + Version: "Посмотреть информацию о плагине и о его зависимостях." + Backup: "Создать резервную копию рюкзака игрока." + Restore: "Восстановить резервную копию." + RestoreList: "Посмотреть список всех доступных резервных копий." + Help: "Посмотреть все команды и их описание." + Migrate: "Изменить тип используемой базы данных." + +Command: + Backpack: + - backpack + - bp + Open: + - open + Clean: + - clean + - clear + - empty + Reload: + - reload + - restart + Update: + - update + Backup: + - backup + Restore: + - restore + ListBackups: + - listbackups + Version: + - version + Help: + - help + +# Will be shown in the console during startup +LanguageName: "russian" +Author: "MrZillaGold" + +# Language file version. Don't touch it! +Version: 17 diff --git a/resources/lang/tr.yml b/resources/lang/tr.yml index 7a5a1e4..b068f5d 100644 --- a/resources/lang/tr.yml +++ b/resources/lang/tr.yml @@ -31,7 +31,7 @@ Language: NoUpdate: "[\"\",{\"text\":\"Eklenti güncellemesi bulunmuyor.\",\"color\":\"gold\"}]" UpdateFail: "[\"\",{\"text\":\"Güncelleme denetlenirken bir hata oluştu! Lütfen konsolu kontrol edin!\",\"color\":\"red\"}]" # You can change this message if you like to, but don't cry if the link isn't linking to the plugin anymore! - UpdateAvailable: "[{\"text\":\"Güncelleme mevcut! Yüklemek için \\\"\",\"color\":\"green\"},{\"text\":\"https://www.spigotmc.org/resources/19286/\",\"color\":\"yellow\",\"underlined\":true,\"clickEvent\":{\"action\":\"open_url\",\"value\":\"https://www.spigotmc.org/resources/19286/\"}},{\"text\":\"\\\" adresini kullanın!\"}]" + UpdateAvailable: "[{\"text\":\"Güncelleme mevcut! Yüklemek için \\\"\",\"color\":\"green\"},{\"text\":\"${project.url}\",\"color\":\"yellow\",\"underlined\":true,\"clickEvent\":{\"action\":\"open_url\",\"value\":\"${project.url}\"}},{\"text\":\"\\\" adresini kullanın!\"}]" Backup: Created: "Çanta yedeklendi." NoBackpack: "Oyuncunun bir çantası yok ya da çantası boş." diff --git a/resources/plugin.yml b/resources/plugin.yml index 1a96e42..031aab4 100644 --- a/resources/plugin.yml +++ b/resources/plugin.yml @@ -72,15 +72,6 @@ permissions: backpack.size.6: description: 6*9 backpack default: false - backpack.size.7: - description: 7*9 backpack (broken gui) - default: false - backpack.size.8: - description: 8*9 backpack (broken gui) - default: false - backpack.size.9: - description: 9*9 backpack (broken gui) - default: false backpack.clean: description: Allows the player to clean their own backpack. default: false diff --git a/src/at/pcgamingfreaks/Minepacks/Bukkit/Backpack.java b/src/at/pcgamingfreaks/Minepacks/Bukkit/Backpack.java index bb114e3..e67b92c 100644 --- a/src/at/pcgamingfreaks/Minepacks/Bukkit/Backpack.java +++ b/src/at/pcgamingfreaks/Minepacks/Bukkit/Backpack.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 GeorgH93 + * Copyright (C) 2020 GeorgH93 * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -19,6 +19,7 @@ import at.pcgamingfreaks.Bukkit.MCVersion; import at.pcgamingfreaks.Bukkit.NMSReflection; +import at.pcgamingfreaks.Minepacks.Bukkit.Database.Helper.InventoryCompressor; import at.pcgamingfreaks.StringUtils; import org.bukkit.Bukkit; @@ -90,6 +91,11 @@ public Backpack(OfflinePlayer owner, int size) public Backpack(OfflinePlayer owner, int size, int ID) { + if(MCVersion.isNewerOrEqualThan(MCVersion.MC_1_14) && size > 54) + { + size = 54; + Minepacks.getInstance().getLogger().warning("Backpacks with more than 6 rows are no longer supported on Minecraft 1.14 and up!"); + } this.owner = owner; titleOther = StringUtils.limitLength(String.format(titleOtherFormat, owner.getName()), 32); bp = Bukkit.createInventory(this, size, titleOther); @@ -107,9 +113,33 @@ public Backpack(OfflinePlayer owner, int size, int ID) ownerID = ID; } - public Backpack(OfflinePlayer owner, ItemStack[] backpack, int ID) + public Backpack(final OfflinePlayer owner, ItemStack[] backpack, final int ID) { this(owner, backpack.length, ID); + if(MCVersion.isNewerOrEqualThan(MCVersion.MC_1_14) && backpack.length > 54) + { // Try to optimize space usage to compress items into only 6 rows + InventoryCompressor compressor = new InventoryCompressor(backpack, 54); + final List toMuch = compressor.compress(); + backpack = compressor.getTargetStack(); + if(!toMuch.isEmpty()) + { + Minepacks.getInstance().getLogger().warning(owner.getName() + "'s backpack has to many items."); + if(owner.isOnline()) + { + Bukkit.getScheduler().runTask(Minepacks.getInstance(), () -> { + if(owner.isOnline()) + { + Player player = owner.getPlayer(); + assert player != null; + Map left = player.getInventory().addItem(toMuch.toArray(new ItemStack[0])); + left.forEach((id, stack) -> player.getWorld().dropItemNaturally(player.getLocation(), stack)); + this.setChanged(); + } + }); + } + else throw new RuntimeException("Backpack to big for MC 1.14 and up!"); + } + } bp.setContents(backpack); } diff --git a/src/at/pcgamingfreaks/Minepacks/Bukkit/Command/ReloadCommand.java b/src/at/pcgamingfreaks/Minepacks/Bukkit/Command/ReloadCommand.java index 9e984f1..7b7c5c0 100644 --- a/src/at/pcgamingfreaks/Minepacks/Bukkit/Command/ReloadCommand.java +++ b/src/at/pcgamingfreaks/Minepacks/Bukkit/Command/ReloadCommand.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 GeorgH93 + * Copyright (C) 2020 GeorgH93 * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -42,9 +42,9 @@ public ReloadCommand(Minepacks plugin) @Override public void execute(@NotNull CommandSender sender, @NotNull String mainCommandAlias, @NotNull String alias, @NotNull String[] args) { - messageReloading.broadcast(); + messageReloading.send(sender); ((Minepacks) plugin).reload(); - messageReloaded.broadcast(); + messageReloaded.send(sender); } @Override diff --git a/src/at/pcgamingfreaks/Minepacks/Bukkit/Database/Config.java b/src/at/pcgamingfreaks/Minepacks/Bukkit/Database/Config.java index 4bce6e2..c3cd032 100644 --- a/src/at/pcgamingfreaks/Minepacks/Bukkit/Database/Config.java +++ b/src/at/pcgamingfreaks/Minepacks/Bukkit/Database/Config.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 GeorgH93 + * Copyright (C) 2020 GeorgH93 * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -28,6 +28,7 @@ import org.bukkit.ChatColor; import org.bukkit.GameMode; +import org.bukkit.Sound; import org.bukkit.plugin.java.JavaPlugin; import org.jetbrains.annotations.NotNull; @@ -36,7 +37,7 @@ public class Config extends Configuration implements DatabaseConnectionConfiguration { - private static final int CONFIG_VERSION = 21, UPGRADE_THRESHOLD = 21; + private static final int CONFIG_VERSION = 22, UPGRADE_THRESHOLD = 22, PRE_V2_VERSION = 20; public Config(JavaPlugin plugin) { @@ -54,7 +55,7 @@ protected void doUpdate() @Override protected void doUpgrade(@NotNull YamlFileManager oldConfig) { - if(oldConfig.getVersion() < 20) // Pre V2.0 config file + if(oldConfig.getVersion() < PRE_V2_VERSION) // Pre V2.0 config file { OldFileUpdater.updateConfig(oldConfig.getYamlE(), getConfigE()); } @@ -109,6 +110,16 @@ public String getDBFields(String sub, String def) return getConfigE().getString("Database.Tables.Fields." + sub, def); } + public boolean useOnlineUUIDs() + { + String type = getConfigE().getString("Database.UUID_Type", "auto").toLowerCase(Locale.ENGLISH); + if(type.equals("auto")) + { + return plugin.getServer().getOnlineMode(); + } + return type.equals("online"); + } + public boolean getUseUUIDSeparators() { return getConfigE().getBoolean("Database.UseUUIDSeparators", false); @@ -147,7 +158,13 @@ public boolean getDropOnDeath() public int getBackpackMaxSize() { - return getConfigE().getInt("MaxSize", 6); + int size = getConfigE().getInt("MaxSize", 6); + if(MCVersion.isNewerOrEqualThan(MCVersion.MC_1_14)) size = Math.min(6, size); + if(size > 6) + { + logger.info("Starting with MC 1.14 backpacks with more than 6 rows will no longer be possible. A feature to allow bigger backpacks through multiple pages is currently in development."); + } + return Math.max(1, size); } public boolean getAutoUpdate() @@ -305,5 +322,51 @@ public WorldBlacklistMode getWorldBlacklistMode() return blacklistMode; } //endregion + + //region ItemShortcut settings + public boolean isItemShortcutEnabled() + { + return MCVersion.isNewerOrEqualThan(MCVersion.MC_1_8) && getConfigE().getBoolean("ItemShortcut.Enabled", true); + } + + public String getItemShortcutItemName() + { + return getConfigE().getString("ItemShortcut.ItemName", "&eBackpack"); + } + + public String getItemShortcutHeadValue() + { + return getConfigE().getString("ItemShortcut.HeadTextureValue", "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvOGRjYzZlYjQwZjNiYWRhNDFlNDMzOTg4OGQ2ZDIwNzQzNzU5OGJkYmQxNzVjMmU3MzExOTFkNWE5YTQyZDNjOCJ9fX0="); + } + //endregion + + //region Sound settings + private Sound getSound(String option, String autoValue) + { + if(!getConfigE().getBoolean("Sound.Enabled", true)) return null; + String soundName = getConfigE().getString("Sound." + option, "auto").toUpperCase(Locale.ENGLISH); + if(soundName.equals("AUTO")) soundName = autoValue; + if(soundName.equals("DISABLED") || soundName.equals("FALSE")) return null; + try + { + return Sound.valueOf(soundName); + } + catch(Exception ignored) + { + logger.warning("Unknown sound: " + soundName); + } + return null; + } + + public Sound getOpenSound() + { + return getSound("OpenSound", MCVersion.isNewerOrEqualThan(MCVersion.MC_1_11) ? "BLOCK_SHULKER_BOX_OPEN" : (MCVersion.isNewerOrEqualThan(MCVersion.MC_1_9_2) ? "BLOCK_CHEST_OPEN" : "CHEST_OPEN")); + } + + public Sound getCloseSound() + { + return getSound("CloseSound", MCVersion.isNewerOrEqualThan(MCVersion.MC_1_11) ? "BLOCK_SHULKER_BOX_CLOSE" : (MCVersion.isNewerOrEqualThan(MCVersion.MC_1_9_2) ? "BLOCK_CHEST_CLOSE" : "CHEST_CLOSE")); + } + //endregion //endregion } \ No newline at end of file diff --git a/src/at/pcgamingfreaks/Minepacks/Bukkit/Database/Database.java b/src/at/pcgamingfreaks/Minepacks/Bukkit/Database/Database.java index c1a4ee1..3787497 100644 --- a/src/at/pcgamingfreaks/Minepacks/Bukkit/Database/Database.java +++ b/src/at/pcgamingfreaks/Minepacks/Bukkit/Database/Database.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 GeorgH93 + * Copyright (C) 2020 GeorgH93 * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -50,7 +50,7 @@ public abstract class Database implements Listener protected final Minepacks plugin; protected final InventorySerializer itsSerializer; - protected final boolean bungeeCordMode; + protected final boolean onlineUUIDs, bungeeCordMode; protected boolean useUUIDSeparators, asyncSave = true; protected long maxAge; private final Map backpacks = new ConcurrentHashMap<>(); @@ -62,6 +62,7 @@ public Database(Minepacks mp) plugin = mp; itsSerializer = new InventorySerializer(plugin.getLogger()); useUUIDSeparators = plugin.getConfiguration().getUseUUIDSeparators(); + onlineUUIDs = plugin.getConfiguration().useOnlineUUIDs(); bungeeCordMode = plugin.getConfiguration().isBungeeCordModeEnabled(); maxAge = plugin.getConfiguration().getAutoCleanupMaxInactiveDays(); unCacheStrategie = bungeeCordMode ? new OnDisconnect(this) : UnCacheStrategie.getUnCacheStrategie(this); diff --git a/src/at/pcgamingfreaks/Minepacks/Bukkit/Database/Files.java b/src/at/pcgamingfreaks/Minepacks/Bukkit/Database/Files.java index df8d766..42536d4 100644 --- a/src/at/pcgamingfreaks/Minepacks/Bukkit/Database/Files.java +++ b/src/at/pcgamingfreaks/Minepacks/Bukkit/Database/Files.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016-2018 GeorgH93 + * Copyright (C) 2020 GeorgH93 * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -80,7 +80,7 @@ private void checkFiles() int len = file.getName().length() - EXT.length(); if(len <= 16) // It's a player name { - if(!file.renameTo(new File(saveFolder, UUIDConverter.getUUIDFromName(file.getName().substring(0, len), true, useUUIDSeparators) + EXT))) + if(!file.renameTo(new File(saveFolder, UUIDConverter.getUUIDFromName(file.getName().substring(0, len), onlineUUIDs, useUUIDSeparators) + EXT))) { plugin.getLogger().warning("Failed to rename file (" + file.getAbsolutePath() + ")."); } diff --git a/src/at/pcgamingfreaks/Minepacks/Bukkit/Database/Helper/InventoryCompressor.java b/src/at/pcgamingfreaks/Minepacks/Bukkit/Database/Helper/InventoryCompressor.java new file mode 100644 index 0000000..a55c364 --- /dev/null +++ b/src/at/pcgamingfreaks/Minepacks/Bukkit/Database/Helper/InventoryCompressor.java @@ -0,0 +1,77 @@ +/* + * Copyright (C) 2020 GeorgH93 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package at.pcgamingfreaks.Minepacks.Bukkit.Database.Helper; + +import org.bukkit.Material; +import org.bukkit.inventory.ItemStack; + +import java.util.ArrayList; +import java.util.List; + +public class InventoryCompressor +{ + private ItemStack[] targetStack, inputStack; + private int filled = 0; + + public InventoryCompressor(ItemStack[] stack, int targetSize) + { + inputStack = stack; + targetStack = new ItemStack[targetSize]; + } + + public List compress() + { + List toMuch = new ArrayList<>(inputStack.length - targetStack.length); + filled = 0; + for(ItemStack stack : inputStack) + { + if(stack == null || stack.getType() == Material.AIR) continue; + tryToStack(stack); + if(stack.getAmount() == 0) continue; + if(filled == targetStack.length) + { + toMuch.add(stack); + } + else + { + targetStack[filled++] = stack; + } + } + return toMuch; + } + + private void tryToStack(ItemStack stack) + { + if(stack.getAmount() >= stack.getMaxStackSize()) return; + for(int i = 0; i < filled && stack.getAmount() > 0; i++) + { + if(stack.isSimilar(targetStack[i]) && targetStack[i].getAmount() < targetStack[i].getMaxStackSize()) + { // Same material and none full stack + int move = targetStack[i].getMaxStackSize() - targetStack[i].getAmount(); + move = Math.min(stack.getAmount(), move); + targetStack[i].setAmount(targetStack[i].getAmount() + move); + stack.setAmount(stack.getAmount() - move); + } + } + } + + public ItemStack[] getTargetStack() + { + return targetStack; + } +} \ No newline at end of file diff --git a/src/at/pcgamingfreaks/Minepacks/Bukkit/Database/Language.java b/src/at/pcgamingfreaks/Minepacks/Bukkit/Database/Language.java index b82394b..9ca0f17 100644 --- a/src/at/pcgamingfreaks/Minepacks/Bukkit/Database/Language.java +++ b/src/at/pcgamingfreaks/Minepacks/Bukkit/Database/Language.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 GeorgH93 + * Copyright (C) 2020 GeorgH93 * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -28,7 +28,7 @@ public class Language extends at.pcgamingfreaks.Bukkit.Language { - private static final int LANG_VERSION = 16, UPGRADE_THRESHOLD = 16; + private static final int LANG_VERSION = 17, UPGRADE_THRESHOLD = 17; public Language(JavaPlugin plugin) { diff --git a/src/at/pcgamingfreaks/Minepacks/Bukkit/Database/SQL.java b/src/at/pcgamingfreaks/Minepacks/Bukkit/Database/SQL.java index f871c26..5770025 100644 --- a/src/at/pcgamingfreaks/Minepacks/Bukkit/Database/SQL.java +++ b/src/at/pcgamingfreaks/Minepacks/Bukkit/Database/SQL.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 GeorgH93 + * Copyright (C) 2020 GeorgH93 * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -149,7 +149,7 @@ public UpdateData(String uuid, int id) { if(toConvert.size() > 0) { - Map newUUIDs = UUIDConverter.getUUIDsFromNames(toConvert.keySet(), true, useUUIDSeparators); + Map newUUIDs = UUIDConverter.getUUIDsFromNames(toConvert.keySet(), onlineUUIDs, useUUIDSeparators); for(Map.Entry entry : newUUIDs.entrySet()) { UpdateData updateData = toConvert.get(entry.getKey().toLowerCase(Locale.ROOT)); diff --git a/src/at/pcgamingfreaks/Minepacks/Bukkit/Listener/BackpackEventListener.java b/src/at/pcgamingfreaks/Minepacks/Bukkit/Listener/BackpackEventListener.java index 12b303e..26cbe7a 100644 --- a/src/at/pcgamingfreaks/Minepacks/Bukkit/Listener/BackpackEventListener.java +++ b/src/at/pcgamingfreaks/Minepacks/Bukkit/Listener/BackpackEventListener.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016-2018 GeorgH93 + * Copyright (C) 2020 GeorgH93 * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -23,6 +23,7 @@ import org.bukkit.ChatColor; import org.bukkit.OfflinePlayer; +import org.bukkit.Sound; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; @@ -33,12 +34,14 @@ public class BackpackEventListener extends MinepacksListener { private final Message messageOwnBackpackClose, messageOtherBackpackClose; + private final Sound closeSound; public BackpackEventListener(Minepacks plugin) { super(plugin); messageOwnBackpackClose = plugin.getLanguage().getMessage("Ingame.OwnBackpackClose"); messageOtherBackpackClose = plugin.getLanguage().getMessage("Ingame.PlayerBackpackClose").replaceAll("\\{OwnerName\\}", "%1\\$s").replaceAll("\\{OwnerDisplayName\\}", "%2\\$s"); + closeSound = plugin.getConfiguration().getCloseSound(); } @EventHandler @@ -62,6 +65,10 @@ public void onClose(InventoryCloseEvent event) OfflinePlayer owner = backpack.getOwner(); messageOtherBackpackClose.send(closer, owner.getName(), owner.isOnline() ? owner.getPlayer().getDisplayName() : ChatColor.GRAY + owner.getName()); } + if(closeSound != null) + { + closer.getWorld().playSound(closer.getLocation(), closeSound, 1, 0); + } } } diff --git a/src/at/pcgamingfreaks/Minepacks/Bukkit/Listener/DisableShulkerboxes.java b/src/at/pcgamingfreaks/Minepacks/Bukkit/Listener/DisableShulkerboxes.java index 1ed7bf6..eea6e73 100644 --- a/src/at/pcgamingfreaks/Minepacks/Bukkit/Listener/DisableShulkerboxes.java +++ b/src/at/pcgamingfreaks/Minepacks/Bukkit/Listener/DisableShulkerboxes.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 GeorgH93 + * Copyright (C) 2020 GeorgH93 * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -20,7 +20,6 @@ import at.pcgamingfreaks.Bukkit.MCVersion; import at.pcgamingfreaks.Bukkit.Utils; import at.pcgamingfreaks.Minepacks.Bukkit.Minepacks; -import at.pcgamingfreaks.Reflection; import org.bukkit.Material; import org.bukkit.block.Block; @@ -64,7 +63,7 @@ public class DisableShulkerboxes extends MinepacksListener SHULKER_BOX_MATERIALS.add(Material.YELLOW_SHULKER_BOX); if(MCVersion.isOlderThan(MCVersion.MC_1_13)) { - SHULKER_BOX_MATERIALS.add((Material) Reflection.getEnum(Material.class, "SILVER_SHULKER_BOX")); + SHULKER_BOX_MATERIALS.add(Material.valueOf("SILVER_SHULKER_BOX")); } else { diff --git a/src/at/pcgamingfreaks/Minepacks/Bukkit/Listener/ItemFilter.java b/src/at/pcgamingfreaks/Minepacks/Bukkit/Listener/ItemFilter.java index 4c54eed..90b9f68 100644 --- a/src/at/pcgamingfreaks/Minepacks/Bukkit/Listener/ItemFilter.java +++ b/src/at/pcgamingfreaks/Minepacks/Bukkit/Listener/ItemFilter.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 GeorgH93 + * Copyright (C) 2020 GeorgH93 * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -96,10 +96,14 @@ public void onItemMove(InventoryClickEvent event) { if(event.getInventory().getHolder() instanceof Backpack) { - if(event.getAction() == InventoryAction.HOTBAR_MOVE_AND_READD && event.getHotbarButton() != -1) + if((event.getAction() == InventoryAction.HOTBAR_MOVE_AND_READD || event.getAction() == InventoryAction.HOTBAR_SWAP) && event.getHotbarButton() != -1) { ItemStack item = event.getWhoClicked().getInventory().getItem(event.getHotbarButton()); - if(item != null && isItemBlocked(item)) event.setCancelled(true); + if(item != null && isItemBlocked(item)) + { + event.setCancelled(true); + messageNotAllowedInBackpack.send(event.getView().getPlayer(), itemNameResolver.getName(item)); + } } else if(event.getCurrentItem() != null && isItemBlocked(event.getCurrentItem())) { diff --git a/src/at/pcgamingfreaks/Minepacks/Bukkit/Listener/ItemShortcut.java b/src/at/pcgamingfreaks/Minepacks/Bukkit/Listener/ItemShortcut.java new file mode 100644 index 0000000..854c0f7 --- /dev/null +++ b/src/at/pcgamingfreaks/Minepacks/Bukkit/Listener/ItemShortcut.java @@ -0,0 +1,213 @@ +/* + * Copyright (C) 2020 GeorgH93 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package at.pcgamingfreaks.Minepacks.Bukkit.Listener; + +import at.pcgamingfreaks.Bukkit.HeadUtils; +import at.pcgamingfreaks.Bukkit.MCVersion; +import at.pcgamingfreaks.Bukkit.Message.Message; +import at.pcgamingfreaks.Minepacks.Bukkit.Minepacks; + +import org.bukkit.ChatColor; +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.Listener; +import org.bukkit.event.block.Action; +import org.bukkit.event.entity.PlayerDeathEvent; +import org.bukkit.event.inventory.ClickType; +import org.bukkit.event.inventory.InventoryAction; +import org.bukkit.event.inventory.InventoryClickEvent; +import org.bukkit.event.inventory.InventoryDragEvent; +import org.bukkit.event.player.*; +import org.bukkit.inventory.EquipmentSlot; +import org.bukkit.inventory.ItemStack; +import org.jetbrains.annotations.Nullable; + +import java.util.Iterator; +import java.util.UUID; + +public class ItemShortcut implements Listener +{ + private static final UUID MINEPACKS_UUID = UUID.nameUUIDFromBytes("Minepacks".getBytes()); + private final String itemName, value; + private final Message messageDoNotRemoveItem; + + public ItemShortcut(Minepacks plugin) + { + itemName = ChatColor.translateAlternateColorCodes('&', plugin.getConfiguration().getItemShortcutItemName()); + value = plugin.getConfiguration().getItemShortcutHeadValue(); + messageDoNotRemoveItem = plugin.getLanguage().getMessage("Ingame.DontRemoveShortcut"); + } + + private boolean isItemShortcut(@Nullable ItemStack stack) + { + //noinspection ConstantConditions + return stack != null && stack.getType() == HeadUtils.HEAD_MATERIAL && stack.hasItemMeta() && stack.getItemMeta().getDisplayName().equals(itemName); + } + + private void addItem(Player player) + { + if(player.hasPermission("backpack.use")) + { + boolean empty = false, item = false; + for(ItemStack itemStack : player.getInventory()) + { + if(itemStack == null || itemStack.getType() == Material.AIR) empty = true; + else if(isItemShortcut(itemStack)) + { + item = true; + break; + } + } + if(!item && empty) player.getInventory().addItem(HeadUtils.fromBase64(value, itemName, MINEPACKS_UUID)); + } + } + + @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) + public void onJoin(PlayerJoinEvent event) + { + addItem(event.getPlayer()); + } + + @EventHandler(priority = EventPriority.LOWEST) + public void onItemInteract(PlayerInteractEvent event) + { + if ((event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK)) return; + if(isItemShortcut(event.getItem())) + { + event.getPlayer().performCommand("backpack open"); + event.setCancelled(true); + } + } + + @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) + public void onArmorStandManipulation(PlayerArmorStandManipulateEvent event) + { + if(isItemShortcut(event.getPlayerItem())) + { + event.getPlayer().performCommand("backpack open"); + event.setCancelled(true); + } + } + + private static final boolean DUAL_WIELDING_MC = MCVersion.isNewerOrEqualThan(MCVersion.MC_1_9); + + @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) + public void onItemFrameInteract(PlayerInteractEntityEvent event) + { + Player player = event.getPlayer(); + ItemStack item; + if(DUAL_WIELDING_MC) + { + item = (event.getHand() == EquipmentSlot.HAND) ? player.getInventory().getItemInMainHand() : player.getInventory().getItemInOffHand(); + } + else + { + item = player.getItemInHand(); + } + if(isItemShortcut(item)) + { + event.getPlayer().performCommand("backpack open"); + event.setCancelled(true); + } + } + + @EventHandler(priority = EventPriority.LOWEST) + public void onItemClick(InventoryClickEvent event) + { + if(event.getWhoClicked() instanceof Player) + { + if(isItemShortcut(event.getCurrentItem())) + { + if(event.getClick() == ClickType.RIGHT || event.getClick() == ClickType.SHIFT_RIGHT) + { + ((Player) event.getWhoClicked()).performCommand("backpack open"); + event.setCancelled(true); + } + else if(event.getAction() == InventoryAction.MOVE_TO_OTHER_INVENTORY) + { + event.setCancelled(true); + messageDoNotRemoveItem.send(event.getWhoClicked()); + } + } + else if((event.getAction() == InventoryAction.HOTBAR_MOVE_AND_READD || event.getAction() == InventoryAction.HOTBAR_SWAP) && event.getHotbarButton() != -1) + { + ItemStack item = event.getWhoClicked().getInventory().getItem(event.getHotbarButton()); + if(isItemShortcut(item)) + { + event.setCancelled(true); + messageDoNotRemoveItem.send(event.getWhoClicked()); + } + } + else if(isItemShortcut(event.getCursor()) && !event.getWhoClicked().getInventory().equals(event.getClickedInventory())) + { + event.setCancelled(true); + messageDoNotRemoveItem.send(event.getWhoClicked()); + } + } + } + + @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) + public void onItemDrag(InventoryDragEvent event) + { //TODO improve + if(!event.getInventory().equals(event.getWhoClicked().getInventory())) + { + if(isItemShortcut(event.getCursor())) + { + event.setCancelled(true); + messageDoNotRemoveItem.send(event.getWhoClicked()); + } + else if(isItemShortcut(event.getOldCursor())) + { + event.setCancelled(true); + messageDoNotRemoveItem.send(event.getWhoClicked()); + } + } + } + + @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) + public void onDeath(PlayerDeathEvent event) + { + Iterator itemStackIterator = event.getDrops().iterator(); + while(itemStackIterator.hasNext()) + { + if(isItemShortcut(itemStackIterator.next())) + { + itemStackIterator.remove(); + break; + } + } + } + + @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) + public void onSpawn(PlayerDropItemEvent event) + { + if(isItemShortcut(event.getItemDrop().getItemStack())) + { + event.setCancelled(true); + messageDoNotRemoveItem.send(event.getPlayer()); + } + } + + @EventHandler + public void onSpawn(PlayerRespawnEvent event) + { + addItem(event.getPlayer()); + } +} \ No newline at end of file diff --git a/src/at/pcgamingfreaks/Minepacks/Bukkit/MagicValues.java b/src/at/pcgamingfreaks/Minepacks/Bukkit/MagicValues.java new file mode 100644 index 0000000..a1a0a83 --- /dev/null +++ b/src/at/pcgamingfreaks/Minepacks/Bukkit/MagicValues.java @@ -0,0 +1,23 @@ +/* + * Copyright (C) 2020 GeorgH93 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package at.pcgamingfreaks.Minepacks.Bukkit; + +public class MagicValues +{ + public static final String MIN_PCGF_PLUGIN_LIB_VERSION = "1.0.19-SNAPSHOT"; +} \ No newline at end of file diff --git a/src/at/pcgamingfreaks/Minepacks/Bukkit/Minepacks.java b/src/at/pcgamingfreaks/Minepacks/Bukkit/Minepacks.java index 4da6489..95443d9 100644 --- a/src/at/pcgamingfreaks/Minepacks/Bukkit/Minepacks.java +++ b/src/at/pcgamingfreaks/Minepacks/Bukkit/Minepacks.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 GeorgH93 + * Copyright (C) 2020 GeorgH93 * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -31,10 +31,7 @@ import at.pcgamingfreaks.Minepacks.Bukkit.Database.Database; import at.pcgamingfreaks.Minepacks.Bukkit.Database.Helper.WorldBlacklistMode; import at.pcgamingfreaks.Minepacks.Bukkit.Database.Language; -import at.pcgamingfreaks.Minepacks.Bukkit.Listener.BackpackEventListener; -import at.pcgamingfreaks.Minepacks.Bukkit.Listener.DisableShulkerboxes; -import at.pcgamingfreaks.Minepacks.Bukkit.Listener.DropOnDeath; -import at.pcgamingfreaks.Minepacks.Bukkit.Listener.ItemFilter; +import at.pcgamingfreaks.Minepacks.Bukkit.Listener.*; import at.pcgamingfreaks.StringUtils; import at.pcgamingfreaks.Updater.UpdateProviders.BukkitUpdateProvider; import at.pcgamingfreaks.Updater.UpdateProviders.JenkinsUpdateProvider; @@ -44,6 +41,7 @@ import org.bukkit.Bukkit; import org.bukkit.GameMode; import org.bukkit.OfflinePlayer; +import org.bukkit.Sound; import org.bukkit.entity.Player; import org.bukkit.event.HandlerList; import org.bukkit.plugin.PluginManager; @@ -59,7 +57,7 @@ public class Minepacks extends JavaPlugin implements MinepacksPlugin { private static final int BUKKIT_PROJECT_ID = 83445; @SuppressWarnings("unused") - private static final String JENKINS_URL = "https://ci.pcgamingfreaks.at", JENKINS_JOB_DEV = "Minepacks V2", JENKINS_JOB_MASTER = "Minepacks", MIN_PCGF_PLUGIN_LIB_VERSION = "1.0.15-SNAPSHOT"; + private static final String JENKINS_URL = "https://ci.pcgamingfreaks.at", JENKINS_JOB_DEV = "Minepacks Dev", JENKINS_JOB_MASTER = "Minepacks"; private static Minepacks instance = null; private Config config; @@ -76,6 +74,7 @@ public class Minepacks extends JavaPlugin implements MinepacksPlugin private Collection gameModes; private CooldownManager cooldownManager = null; private ItemFilter itemFilter = null; + private Sound openSound = null; public static Minepacks getInstance() { @@ -104,7 +103,7 @@ public void onEnable() } else[STANDALONE]*/ // Not standalone so we should check the version of the PluginLib - if(at.pcgamingfreaks.PluginLib.Bukkit.PluginLib.getInstance().getVersion().olderThan(new Version(MIN_PCGF_PLUGIN_LIB_VERSION))) + if(at.pcgamingfreaks.PluginLib.Bukkit.PluginLib.getInstance().getVersion().olderThan(new Version(MagicValues.MIN_PCGF_PLUGIN_LIB_VERSION))) { getLogger().warning("You are using an outdated version of the PCGF PluginLib! Please update it!"); setEnabled(false); @@ -114,7 +113,7 @@ public void onEnable() //region Check compatibility with used minecraft version - if(MCVersion.is(MCVersion.UNKNOWN) || MCVersion.isNewerThan(MCVersion.MC_NMS_1_14_R1)) + if(MCVersion.is(MCVersion.UNKNOWN) || MCVersion.isNewerThan(MCVersion.MC_NMS_1_15_R1)) { this.warnOnVersionIncompatibility(); this.setEnabled(false); @@ -195,6 +194,7 @@ private void load() pluginManager.registerEvents(itemFilter, this); } if(config.isShulkerboxesDisable()) pluginManager.registerEvents(new DisableShulkerboxes(this), this); + if(config.isItemShortcutEnabled()) pluginManager.registerEvents(new ItemShortcut(this), this); //endregion if(config.getFullInvCollect()) collector = new ItemsCollector(this); worldBlacklist = config.getWorldBlacklist(); @@ -202,6 +202,8 @@ private void load() gameModes = config.getAllowedGameModes(); if(config.getCommandCooldown() > 0) cooldownManager = new CooldownManager(this); + + openSound = config.getOpenSound(); } private void unload() @@ -296,6 +298,12 @@ public void openBackpack(@NotNull Player opener, @Nullable Backpack backpack, bo messageInvalidBackpack.send(opener); return; } + //noinspection ObjectEquality + if(opener.getOpenInventory().getTopInventory().getHolder() == backpack) return; // == is fine as there is only one instance of each backpack + if(openSound != null) + { + opener.getWorld().playSound(opener.getLocation(), openSound, 1, 0); + } backpack.open(opener, editable); } diff --git a/src/at/pcgamingfreaks/Minepacks/Bukkit/MinepacksBadRabbit.java b/src/at/pcgamingfreaks/Minepacks/Bukkit/MinepacksBadRabbit.java index 4821475..9917e79 100644 --- a/src/at/pcgamingfreaks/Minepacks/Bukkit/MinepacksBadRabbit.java +++ b/src/at/pcgamingfreaks/Minepacks/Bukkit/MinepacksBadRabbit.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 GeorgH93 + * Copyright (C) 2020 GeorgH93 * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -18,8 +18,10 @@ package at.pcgamingfreaks.Minepacks.Bukkit; import at.pcgamingfreaks.BadRabbit.Bukkit.BadRabbit; +import at.pcgamingfreaks.Version; import org.bukkit.Bukkit; +import org.bukkit.plugin.Plugin; import org.bukkit.plugin.java.JavaPlugin; import org.jetbrains.annotations.NotNull; @@ -32,17 +34,28 @@ public class MinepacksBadRabbit extends BadRabbit @Override protected @NotNull JavaPlugin createInstance() throws Exception { - JavaPlugin newPluginInstance; - if(Bukkit.getPluginManager().getPlugin("PCGF_PluginLib") == null) + JavaPlugin newPluginInstance = null; + Plugin pcgfPluginLib = Bukkit.getPluginManager().getPlugin("PCGF_PluginLib"); + if(pcgfPluginLib != null) { - getLogger().info("PCGF-PluginLib not installed. Switching to standalone mode!"); - Class standaloneClass = Class.forName("at.pcgamingfreaks.MinepacksStandalone.Bukkit.Minepacks"); - newPluginInstance = (JavaPlugin) standaloneClass.newInstance(); + if(new Version(pcgfPluginLib.getDescription().getVersion()).olderThan(new Version(MagicValues.MIN_PCGF_PLUGIN_LIB_VERSION))) + { + getLogger().info("PCGF-PluginLib to old! Switching to standalone mode!"); + } + else + { + getLogger().info("PCGF-PluginLib installed. Switching to normal mode!"); + newPluginInstance = new Minepacks(); + } } else { - getLogger().info("PCGF-PluginLib installed. Switching to normal mode!"); - newPluginInstance = new Minepacks(); + getLogger().info("PCGF-PluginLib not installed. Switching to standalone mode!"); + } + if(newPluginInstance == null) + { + Class standaloneClass = Class.forName("at.pcgamingfreaks.MinepacksStandalone.Bukkit.Minepacks"); + newPluginInstance = (JavaPlugin) standaloneClass.newInstance(); } return newPluginInstance; }