Merge commit master into dev

This commit is contained in:
GeorgH93 2021-08-25 17:41:11 +02:00
commit a42d8ca028
No known key found for this signature in database
GPG Key ID: D1630D37F9E4B3C8
6 changed files with 137 additions and 7 deletions

View File

@ -220,7 +220,13 @@
<pattern>at.pcgamingfreaks</pattern> <pattern>at.pcgamingfreaks</pattern>
<shadedPattern>at.pcgamingfreaks.MinepacksStandalone.libs.at.pcgamingfreaks</shadedPattern> <shadedPattern>at.pcgamingfreaks.MinepacksStandalone.libs.at.pcgamingfreaks</shadedPattern>
<excludes> <excludes>
<exclude>at.pcgamingfreaks.Minepacks.Bukkit.API.**</exclude> <exclude>at.pcgamingfreaks.Minepacks.Bukkit.API.Backpack</exclude>
<exclude>at.pcgamingfreaks.Minepacks.Bukkit.API.Callback</exclude>
<exclude>at.pcgamingfreaks.Minepacks.Bukkit.API.MinepacksPlugin</exclude>
<exclude>at.pcgamingfreaks.Minepacks.Bukkit.API.MinepacksCommandManager</exclude>
<exclude>at.pcgamingfreaks.Minepacks.Bukkit.API.WorldBlacklistMode</exclude>
<exclude>at.pcgamingfreaks.Minepacks.Bukkit.API.ItemFilter</exclude>
<exclude>at.pcgamingfreaks.Minepacks.Bukkit.API.Events.*</exclude>
</excludes> </excludes>
</relocation> </relocation>
</relocations> </relocations>

View File

@ -175,7 +175,7 @@ ItemShortcut:
AllowPlayersToDisableItem: true AllowPlayersToDisableItem: true
# Prevents the backpack from being used as a hat # Prevents the backpack from being used as a hat
BlockAsHat: false BlockAsHat: false
# Opens a container if right clicked while holding the backpack shortcut in the hand. This option will only work on MC 1.13 or newer. # Opens a container if right-clicked while holding the backpack shortcut in the hand. This option will only work on MC 1.13 or newer.
OpenContainerOnRightClick: false OpenContainerOnRightClick: false
# The id of the slot that should be preferred when giving a player the shortcut item # The id of the slot that should be preferred when giving a player the shortcut item
PreferredSlotId: -1 PreferredSlotId: -1
@ -213,7 +213,7 @@ Misc:
# When auto update is disabled you still can use the build in update function manually with /backpack update # When auto update is disabled you still can use the build in update function manually with /backpack update
Enabled: true Enabled: true
Channel: ${updateChannel} Channel: ${updateChannel}
# Enable this option if you are using a BungeeCord setup! # Enable this option if you are using a BungeeCord setup and want to share the plugin's database across multiple servers.
UseBungeeCord: false UseBungeeCord: false
# Config file version. Don't touch it! # Config file version. Don't touch it!

View File

@ -0,0 +1,117 @@
# To simplify the customisation and translation process please check out the editor: https://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: "背包已清空"
BackpackCleanedBy: "您的背包已被清空 {DisplayName}&r."
BackpackCleanedOther: "{DisplayName}'s&r 背包已清空."
Sort:
Sorted: "整理背包."
Help:
Header: "&6### 擴充背包 指令幫助 ###"
Footer: "&6#############################"
Reload:
Reloading: "&3正在重新讀取 Minepacks ..."
Reloaded: "&3Minepacks 重新讀取完畢! 翻譯版本 2.4.2 Specialbase#0428"
Update:
CheckingForUpdates: "&1檢查更新 ..."
Updated: "[\"\",{\"text\":\"插件已經更新,重新啟動伺服器後生效/reload.\",\"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\":\"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!\"}]"
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\":\" Showing page {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\":\"User: {BackupPlayerName} ({BackupPlayerUUID})\\nCreated: {BackupDate}\"}}]"
NoValidBackup: "無法尋找備份 {BackupIdentifier} "
NoUserToRestoreToFound: "找不到可將備份還原到的有效用戶"
# No Json!!!
ParameterBackupName: "backup_name"
# No Json!!!
DateFormat: "yyyy.MM.dd HH:mm:ss"
Restored: "還原備份成功"
InventoryClear:
UnknownPlayer: "&c找不到玩家 {Name}!"
Cleared: "清空背包."
ClearedOther: "{DisplayName}&r 已清空背包."
ClearedOtherTarget: "你的背包已遭清空 {DisplayName}&r."
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: "開啟你的背包"
Sort: "整理你的背包"
Clean: "清空你的背包"
CleanOthers: "清理其他玩家的背包"
OpenOthers: "看茶另一個玩家的背包"
Reload: "重新整理這個插件"
Update: "檢查更新"
Version: "列出有關插件及其依賴項的版本詳細信息"
Backup: "新增玩家背包的備份."
Restore: "恢復備份."
RestoreList: "列出所有玩家的備份."
Help: "顯示此指令表."
Migrate: "將使用的數據庫從一種類型遷移到另一種類型."
Command:
Backpack:
- bag
Open:
- open
Sort:
- sort
Clean:
- clean
- clear
- empty
Reload:
- reload
- restart
Update:
- update
Backup:
- backup
Restore:
- restore
ListBackups:
- listbackups
Version:
- version
Help:
- help
InventoryClear:
- clear
- inventoryclear
- clean
# Will be shown in the console during startup
LanguageName: "繁體中文"
Author: "Specialbase#0428"
# Language file version. Don't touch it!
Version: 18

View File

@ -120,6 +120,7 @@ public void execute(@NotNull CommandSender commandSender, @NotNull String mainCo
{ {
writer.flush(); writer.flush();
writer.close(); writer.close();
writer = null;
} }
catch(Exception e) {e.printStackTrace();} catch(Exception e) {e.printStackTrace();}
sender.getInventory().setItem(0, slot); sender.getInventory().setItem(0, slot);

View File

@ -240,13 +240,19 @@ public boolean isBungeeCordModeEnabled()
{ {
boolean useBungee = getConfigE().getBoolean("Misc.UseBungeeCord", false); boolean useBungee = getConfigE().getBoolean("Misc.UseBungeeCord", false);
boolean spigotUsesBungee = Utils.detectBungeeCord(); boolean spigotUsesBungee = Utils.detectBungeeCord();
boolean shareableDB = getDatabaseType().equals("mysql") || getDatabaseType().equals("global");
if(useBungee && !spigotUsesBungee) if(useBungee && !spigotUsesBungee)
{ {
logger.warning("You have BungeeCord enabled, but it looks like you have not enabled it in your spigot.yml! You probably should check your configuration."); logger.warning("You have BungeeCord enabled for the plugin, but it looks like you have not enabled it in your spigot.yml! You probably should check your configuration.");
} }
else if(!useBungee && spigotUsesBungee && getDatabaseType() == DatabaseType.MYSQL) else if(!useBungee && spigotUsesBungee && shareableDB)
{ {
logger.warning("Your server is running behind a BungeeCord server. If you are using the plugin on more than one server please make sure to also enable the 'UseBungeeCord' config option."); logger.warning("Your server is running behind a BungeeCord server. If you are using the plugin on more than one server with a shared database, please make sure to also enable the 'UseBungeeCord' config option.");
}
else if(useBungee && !shareableDB)
{
logger.info("You have enabled BungeeCord mode for the plugin, but are not using a shared MySQL database.");
return false; // No need to enable BungeeCord mode if the database does not support it
} }
return useBungee; return useBungee;
} }

View File

@ -304,7 +304,7 @@ public void onItemClick(InventoryClickEvent event)
} }
else if(event.getClick() == ClickType.RIGHT || event.getClick() == ClickType.SHIFT_RIGHT) else if(event.getClick() == ClickType.RIGHT || event.getClick() == ClickType.SHIFT_RIGHT)
{ {
player.performCommand(openCommand); plugin.getServer().getScheduler().runTask(plugin, () -> { player.performCommand(openCommand); });
event.setCancelled(true); event.setCancelled(true);
} }
else if(event.getAction() == InventoryAction.MOVE_TO_OTHER_INVENTORY) else if(event.getAction() == InventoryAction.MOVE_TO_OTHER_INVENTORY)