mirror of
https://github.com/GeorgH93/Minepacks.git
synced 2024-12-04 14:03:24 +01:00
Merge branch master into dev
This commit is contained in:
commit
59cc7f90cb
10
.github/workflows/release.yml
vendored
10
.github/workflows/release.yml
vendored
@ -28,11 +28,6 @@ jobs:
|
|||||||
mvn -B -s .github/workflows/settings.xml install --file pom.xml
|
mvn -B -s .github/workflows/settings.xml install --file pom.xml
|
||||||
cp Minepacks/target/M*.jar artifacts/
|
cp Minepacks/target/M*.jar artifacts/
|
||||||
|
|
||||||
- name: Publish to GitHub Packages Apache Maven
|
|
||||||
run: 'mvn deploy -pl Minepacks-API,Minepacks -s $GITHUB_WORKSPACE/settings.xml "-DaltDeploymentRepository=github::default::https://maven.pkg.github.com/GeorgH93/Minepacks"'
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ github.token }}
|
|
||||||
|
|
||||||
- name: Build with Maven (Standalone)
|
- name: Build with Maven (Standalone)
|
||||||
run: |
|
run: |
|
||||||
mvn -B -s .github/workflows/settings.xml clean install --file pom.xml -P Standalone,ExcludeBadRabbit
|
mvn -B -s .github/workflows/settings.xml clean install --file pom.xml -P Standalone,ExcludeBadRabbit
|
||||||
@ -49,3 +44,8 @@ jobs:
|
|||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
with:
|
with:
|
||||||
args: 'artifacts/M*'
|
args: 'artifacts/M*'
|
||||||
|
|
||||||
|
- name: Publish to GitHub Packages Apache Maven
|
||||||
|
run: 'mvn clean install deploy -pl Minepacks-API,Minepacks -s .github/workflows/settings.xml "-DaltDeploymentRepository=github::default::https://maven.pkg.github.com/GeorgH93/Minepacks"'
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ github.token }}
|
7
.github/workflows/settings.xml
vendored
7
.github/workflows/settings.xml
vendored
@ -8,4 +8,11 @@
|
|||||||
<mirrorOf>central,spigot-nexus,spigot-repo,placeholderapi,sonatype-nexus-snapshots,pcgf-repo,herocraftonline-repo,sk89q-repo,CodeMC,mvdw-software</mirrorOf>
|
<mirrorOf>central,spigot-nexus,spigot-repo,placeholderapi,sonatype-nexus-snapshots,pcgf-repo,herocraftonline-repo,sk89q-repo,CodeMC,mvdw-software</mirrorOf>
|
||||||
</mirror>
|
</mirror>
|
||||||
</mirrors>
|
</mirrors>
|
||||||
|
<servers>
|
||||||
|
<server>
|
||||||
|
<id>github</id>
|
||||||
|
<username>${env.GITHUB_ACTOR}</username>
|
||||||
|
<password>${env.GITHUB_TOKEN}</password>
|
||||||
|
</server>
|
||||||
|
</servers>
|
||||||
</settings>
|
</settings>
|
@ -184,7 +184,16 @@ default void getBackpack(@NotNull final OfflinePlayer owner, @NotNull final Call
|
|||||||
* Checks if an item is a backpack shortcut item.
|
* Checks if an item is a backpack shortcut item.
|
||||||
*
|
*
|
||||||
* @param itemStack item to check.
|
* @param itemStack item to check.
|
||||||
* @return True if the item is a backpack shortcut item.
|
* @return true if the item is a backpack shortcut item, false if not.
|
||||||
*/
|
*/
|
||||||
boolean isBackpackItem(final @Nullable ItemStack itemStack);
|
boolean isBackpackItem(final @Nullable ItemStack itemStack);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if a player can use the backpack at its current location (or if the world is disabled in the config).
|
||||||
|
* <b>Does not check if the player has the permission to use the backpack!!!</b>
|
||||||
|
*
|
||||||
|
* @param player The player that should be checked.
|
||||||
|
* @return The configured reason why the player can not access at its current location. {@link WorldBlacklistMode#None} if the player can use the backpack.
|
||||||
|
*/
|
||||||
|
@NotNull WorldBlacklistMode isDisabled(Player player);
|
||||||
}
|
}
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2018 GeorgH93
|
* Copyright (C) 2020 GeorgH93
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -15,7 +15,7 @@
|
|||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package at.pcgamingfreaks.Minepacks.Bukkit.Database.Helper;
|
package at.pcgamingfreaks.Minepacks.Bukkit.API;
|
||||||
|
|
||||||
public enum WorldBlacklistMode
|
public enum WorldBlacklistMode
|
||||||
{
|
{
|
118
Minepacks/resources/lang/cht.yml
Normal file
118
Minepacks/resources/lang/cht.yml
Normal file
@ -0,0 +1,118 @@
|
|||||||
|
# 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: "您所輸入的數值無效!"
|
||||||
|
OwnBackpackClose: "已關閉隨身背包"
|
||||||
|
OwnBackpackClose_SendMethod: "action_bar"
|
||||||
|
#Parameter: {OwnerName}, {OwnerDisplayName}
|
||||||
|
PlayerBackpackClose: "{OwnerName} 的隨身背包已關閉"
|
||||||
|
PlayerBackpackClose_SendMethod: "action_bar"
|
||||||
|
InvalidBackpack: "&c無效的隨身背包!"
|
||||||
|
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: "&e請等待 {TimeLeft} 秒再使用該指令"
|
||||||
|
#Parameter: {CurrentGameMode}, {AllowedGameModes}
|
||||||
|
WrongGameMode: "&c您將不被允許在此模式中開啟背包!"
|
||||||
|
Clean:
|
||||||
|
BackpackCleaned: "&e該隨身背包將已被清空~"
|
||||||
|
BackpackCleanedBy: "&e您的隨身背包已被 {DisplayName} &e清空~"
|
||||||
|
BackpackCleanedOther: "&c{DisplayName} &e的背包已被清空~"
|
||||||
|
Sort:
|
||||||
|
Sorted: "該隨身背包已分類"
|
||||||
|
Help:
|
||||||
|
Header: "&e----- &6隨身背包 指令列表 &e-----"
|
||||||
|
Footer: ""
|
||||||
|
Reload:
|
||||||
|
Reloading: "&6背包插件重載中!"
|
||||||
|
Reloaded: "&a已成功重載背包配置~"
|
||||||
|
Update:
|
||||||
|
CheckingForUpdates: "&e可用的更新檢查中..."
|
||||||
|
Updated: "插件已更新"
|
||||||
|
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!\"}]"
|
||||||
|
Backup:
|
||||||
|
Created: "The backpack has been backed up successful."
|
||||||
|
NoBackpack: "The player doesn't have a backpack or his backpack is empty."
|
||||||
|
Restore:
|
||||||
|
BackupsPerPage: 10
|
||||||
|
Headline: "[\"\",{\"text\":\"Backups\",\"color\":\"yellow\"},{\"text\":\" - \",\"color\":\"white\"},{\"text\":\"showing 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\":\" Showing 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\":\"User: {BackupPlayerName} ({BackupPlayerUUID})\\nCreated: {BackupDate}\"}}]"
|
||||||
|
NoValidBackup: "No backup matching {BackupIdentifier} found"
|
||||||
|
NoUserToRestoreToFound: "No valid user to restore backup to found"
|
||||||
|
# No Json!!!
|
||||||
|
ParameterBackupName: "backup_name"
|
||||||
|
# No Json!!!
|
||||||
|
DateFormat: "yyyy.MM.dd HH:mm:ss"
|
||||||
|
Restored: "Backup has been successful restored."
|
||||||
|
InventoryClear:
|
||||||
|
UnknownPlayer: "&cCould not find player {Name}!"
|
||||||
|
Cleared: "Inventory cleared."
|
||||||
|
ClearedOther: "{DisplayName}'s&r inventory has been cleared."
|
||||||
|
ClearedOtherTarget: "Your inventory has been cleared by {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:
|
||||||
|
- backpack
|
||||||
|
- bp
|
||||||
|
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: "danta"
|
||||||
|
|
||||||
|
# Language file version. Don't touch it!
|
||||||
|
Version: 18
|
@ -22,7 +22,7 @@ Language:
|
|||||||
#Parameter: {CurrentGameMode}, {AllowedGameModes}
|
#Parameter: {CurrentGameMode}, {AllowedGameModes}
|
||||||
WrongGameMode: "Vous n'êtes pas autorisé à ouvrir votre sac à dos dans votre mode de jeu actuel."
|
WrongGameMode: "Vous n'êtes pas autorisé à ouvrir votre sac à dos dans votre mode de jeu actuel."
|
||||||
Clean:
|
Clean:
|
||||||
BackpackCleaned: "Sac à dos nettoyé."s
|
BackpackCleaned: "Sac à dos nettoyé."
|
||||||
BackpackCleanedBy: "Votre sac à dos a été nettoyé par {DisplayName}&r."
|
BackpackCleanedBy: "Votre sac à dos a été nettoyé par {DisplayName}&r."
|
||||||
BackpackCleanedOther: "Sac à dos de {DisplayName} &rnettoyé."
|
BackpackCleanedOther: "Sac à dos de {DisplayName} &rnettoyé."
|
||||||
Sort:
|
Sort:
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2020 GeorgH93
|
* Copyright (C) 2021 GeorgH93
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -23,7 +23,7 @@
|
|||||||
import at.pcgamingfreaks.Bukkit.Message.Message;
|
import at.pcgamingfreaks.Bukkit.Message.Message;
|
||||||
import at.pcgamingfreaks.Command.HelpData;
|
import at.pcgamingfreaks.Command.HelpData;
|
||||||
import at.pcgamingfreaks.ConsoleColor;
|
import at.pcgamingfreaks.ConsoleColor;
|
||||||
import at.pcgamingfreaks.Minepacks.Bukkit.Database.Helper.WorldBlacklistMode;
|
import at.pcgamingfreaks.Minepacks.Bukkit.API.WorldBlacklistMode;
|
||||||
import at.pcgamingfreaks.Minepacks.Bukkit.ExtendedAPI.MinepacksCommand;
|
import at.pcgamingfreaks.Minepacks.Bukkit.ExtendedAPI.MinepacksCommand;
|
||||||
import at.pcgamingfreaks.Minepacks.Bukkit.ExtendedAPI.MinepacksCommandManager;
|
import at.pcgamingfreaks.Minepacks.Bukkit.ExtendedAPI.MinepacksCommandManager;
|
||||||
import at.pcgamingfreaks.Minepacks.Bukkit.Minepacks;
|
import at.pcgamingfreaks.Minepacks.Bukkit.Minepacks;
|
||||||
|
@ -38,7 +38,7 @@ public MySQL(@NotNull Minepacks plugin, @Nullable ConnectionProvider connectionP
|
|||||||
@Override
|
@Override
|
||||||
protected void updateQueriesForDialect()
|
protected void updateQueriesForDialect()
|
||||||
{
|
{
|
||||||
queryDeleteOldBackpacks = "DELETE FROM `{TableBackpacks}` WHERE `{FieldBPLastUpdate}` + INTERVAL {VarMaxAge} day < NOW()";
|
queryDeleteOldBackpacks = "DELETE FROM {TableBackpacks} WHERE {FieldBPLastUpdate} + INTERVAL {VarMaxAge} day < NOW()";
|
||||||
queryUpdateBp = queryUpdateBp.replaceAll("\\{NOW}", "NOW()");
|
queryUpdateBp = queryUpdateBp.replaceAll("\\{NOW}", "NOW()");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2020 GeorgH93
|
* Copyright (C) 2021 GeorgH93
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -22,12 +22,14 @@
|
|||||||
import at.pcgamingfreaks.Database.DBTools;
|
import at.pcgamingfreaks.Database.DBTools;
|
||||||
import at.pcgamingfreaks.Minepacks.Bukkit.Database.MinepacksPlayerData;
|
import at.pcgamingfreaks.Minepacks.Bukkit.Database.MinepacksPlayerData;
|
||||||
import at.pcgamingfreaks.Minepacks.Bukkit.Minepacks;
|
import at.pcgamingfreaks.Minepacks.Bukkit.Minepacks;
|
||||||
|
import at.pcgamingfreaks.Version;
|
||||||
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
|
import java.sql.ResultSet;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.sql.Statement;
|
import java.sql.Statement;
|
||||||
|
|
||||||
@ -81,6 +83,8 @@ protected void checkDB()
|
|||||||
{
|
{
|
||||||
try(Connection connection = getConnection(); Statement stmt = connection.createStatement())
|
try(Connection connection = getConnection(); Statement stmt = connection.createStatement())
|
||||||
{
|
{
|
||||||
|
Version dbVersion = getDatabaseVersion(stmt);
|
||||||
|
|
||||||
stmt.execute("CREATE TABLE IF NOT EXISTS `backpack_players` (`player_id` INTEGER PRIMARY KEY AUTOINCREMENT, `name` CHAR(16) NOT NULL , `uuid` CHAR(32) UNIQUE);");
|
stmt.execute("CREATE TABLE IF NOT EXISTS `backpack_players` (`player_id` INTEGER PRIMARY KEY AUTOINCREMENT, `name` CHAR(16) NOT NULL , `uuid` CHAR(32) UNIQUE);");
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -95,9 +99,11 @@ protected void checkDB()
|
|||||||
catch(SQLException ignored) {}
|
catch(SQLException ignored) {}
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
stmt.execute("ALTER TABLE `backpacks` ADD COLUMN `lastupdate` DATE DEFAULT '2020-04-20';");
|
stmt.execute("ALTER TABLE `backpacks` ADD COLUMN `lastupdate` DATE DEFAULT '2020-09-24';");
|
||||||
}
|
}
|
||||||
catch(SQLException ignored) {}
|
catch(SQLException ignored) {}
|
||||||
|
|
||||||
|
DBTools.runStatement(connection, "INSERT OR REPLACE INTO `minepacks_metadata` (`key`, `value`) VALUES ('db_version',?);", plugin.getDescription().getVersion());
|
||||||
}
|
}
|
||||||
catch(SQLException e)
|
catch(SQLException e)
|
||||||
{
|
{
|
||||||
@ -105,6 +111,16 @@ protected void checkDB()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private @NotNull Version getDatabaseVersion(final @NotNull Statement stmt) throws SQLException
|
||||||
|
{
|
||||||
|
stmt.execute("CREATE TABLE IF NOT EXISTS `minepacks_metadata` (`key` CHAR(32) PRIMARY KEY NOT NULL, `value` TEXT);");
|
||||||
|
try(ResultSet rs = stmt.executeQuery("SELECT `value` FROM `minepacks_metadata` WHERE `key`='db_version';"))
|
||||||
|
{
|
||||||
|
if(rs.next()) return new Version(rs.getString("value"));
|
||||||
|
}
|
||||||
|
return new Version("0");
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void updatePlayer(@NotNull Connection connection, @NotNull MinepacksPlayerData player) throws SQLException
|
protected void updatePlayer(@NotNull Connection connection, @NotNull MinepacksPlayerData player) throws SQLException
|
||||||
{
|
{
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2020 GeorgH93
|
* Copyright (C) 2021 GeorgH93
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -20,12 +20,13 @@
|
|||||||
import at.pcgamingfreaks.Bukkit.Configuration;
|
import at.pcgamingfreaks.Bukkit.Configuration;
|
||||||
import at.pcgamingfreaks.Bukkit.MCVersion;
|
import at.pcgamingfreaks.Bukkit.MCVersion;
|
||||||
import at.pcgamingfreaks.Bukkit.MinecraftMaterial;
|
import at.pcgamingfreaks.Bukkit.MinecraftMaterial;
|
||||||
|
import at.pcgamingfreaks.Bukkit.Util.Utils;
|
||||||
import at.pcgamingfreaks.ConsoleColor;
|
import at.pcgamingfreaks.ConsoleColor;
|
||||||
import at.pcgamingfreaks.Database.Cache.IUnCacheStrategyConfig;
|
import at.pcgamingfreaks.Database.Cache.IUnCacheStrategyConfig;
|
||||||
import at.pcgamingfreaks.Database.Cache.UnCacheStrategy;
|
import at.pcgamingfreaks.Database.Cache.UnCacheStrategy;
|
||||||
import at.pcgamingfreaks.Database.DatabaseConnectionConfiguration;
|
import at.pcgamingfreaks.Database.DatabaseConnectionConfiguration;
|
||||||
|
import at.pcgamingfreaks.Minepacks.Bukkit.API.WorldBlacklistMode;
|
||||||
import at.pcgamingfreaks.Minepacks.Bukkit.Database.Helper.OldFileUpdater;
|
import at.pcgamingfreaks.Minepacks.Bukkit.Database.Helper.OldFileUpdater;
|
||||||
import at.pcgamingfreaks.Minepacks.Bukkit.Database.Helper.WorldBlacklistMode;
|
|
||||||
import at.pcgamingfreaks.Minepacks.Bukkit.ShrinkApproach;
|
import at.pcgamingfreaks.Minepacks.Bukkit.ShrinkApproach;
|
||||||
import at.pcgamingfreaks.YamlFileManager;
|
import at.pcgamingfreaks.YamlFileManager;
|
||||||
|
|
||||||
@ -87,7 +88,7 @@ public int getAutoCleanupMaxInactiveDays()
|
|||||||
|
|
||||||
public @NotNull String getDatabaseTypeName()
|
public @NotNull String getDatabaseTypeName()
|
||||||
{
|
{
|
||||||
return getConfigE().getString("Database.Type", "sqlite");
|
return getConfigE().getString("Database.Type", "sqlite").toLowerCase(Locale.ENGLISH);
|
||||||
}
|
}
|
||||||
|
|
||||||
public @NotNull DatabaseType getDatabaseType()
|
public @NotNull DatabaseType getDatabaseType()
|
||||||
@ -209,7 +210,17 @@ public String getUpdateChannel()
|
|||||||
|
|
||||||
public boolean isBungeeCordModeEnabled()
|
public boolean isBungeeCordModeEnabled()
|
||||||
{
|
{
|
||||||
return getConfigE().getBoolean("Misc.UseBungeeCord", false);
|
boolean useBungee = getConfigE().getBoolean("Misc.UseBungeeCord", false);
|
||||||
|
boolean spigotUsesBungee = Utils.detectBungeeCord();
|
||||||
|
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.");
|
||||||
|
}
|
||||||
|
else if(!useBungee && spigotUsesBungee && getDatabaseType().equals("mysql"))
|
||||||
|
{
|
||||||
|
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.");
|
||||||
|
}
|
||||||
|
return useBungee;
|
||||||
}
|
}
|
||||||
//endregion
|
//endregion
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2020 GeorgH93
|
* Copyright (C) 2021 GeorgH93
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -22,7 +22,6 @@
|
|||||||
import at.pcgamingfreaks.Database.Cache.BaseUnCacheStrategy;
|
import at.pcgamingfreaks.Database.Cache.BaseUnCacheStrategy;
|
||||||
import at.pcgamingfreaks.Database.ConnectionProvider.ConnectionProvider;
|
import at.pcgamingfreaks.Database.ConnectionProvider.ConnectionProvider;
|
||||||
import at.pcgamingfreaks.Minepacks.Bukkit.API.Events.MinepacksPlayerJoinEvent;
|
import at.pcgamingfreaks.Minepacks.Bukkit.API.Events.MinepacksPlayerJoinEvent;
|
||||||
import at.pcgamingfreaks.Minepacks.Bukkit.API.MinepacksPlayer;
|
|
||||||
import at.pcgamingfreaks.Minepacks.Bukkit.Backpack;
|
import at.pcgamingfreaks.Minepacks.Bukkit.Backpack;
|
||||||
import at.pcgamingfreaks.Minepacks.Bukkit.Database.Backend.DatabaseBackend;
|
import at.pcgamingfreaks.Minepacks.Bukkit.Database.Backend.DatabaseBackend;
|
||||||
import at.pcgamingfreaks.Minepacks.Bukkit.Database.Backend.Files;
|
import at.pcgamingfreaks.Minepacks.Bukkit.Database.Backend.Files;
|
||||||
|
@ -17,32 +17,36 @@
|
|||||||
|
|
||||||
package at.pcgamingfreaks.Minepacks.Bukkit.Database;
|
package at.pcgamingfreaks.Minepacks.Bukkit.Database;
|
||||||
|
|
||||||
import at.pcgamingfreaks.Bukkit.ItemStackSerializer.BukkitItemStackSerializer;
|
|
||||||
import at.pcgamingfreaks.Bukkit.ItemStackSerializer.ItemStackSerializer;
|
import at.pcgamingfreaks.Bukkit.ItemStackSerializer.ItemStackSerializer;
|
||||||
import at.pcgamingfreaks.Bukkit.ItemStackSerializer.NBTItemStackSerializerGen2;
|
|
||||||
import at.pcgamingfreaks.Bukkit.MCVersion;
|
import at.pcgamingfreaks.Bukkit.MCVersion;
|
||||||
import at.pcgamingfreaks.ConsoleColor;
|
import at.pcgamingfreaks.ConsoleColor;
|
||||||
|
|
||||||
import org.bukkit.inventory.Inventory;
|
import org.bukkit.inventory.Inventory;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
public class InventorySerializer
|
public class InventorySerializer
|
||||||
{
|
{
|
||||||
private static final ItemStackSerializer BUKKIT_ITEM_STACK_SERIALIZER = new BukkitItemStackSerializer();
|
@SuppressWarnings("deprecation")
|
||||||
|
private static final ItemStackSerializer BUKKIT_ITEM_STACK_SERIALIZER = ItemStackSerializer.makeBukkitItemStackSerializer();
|
||||||
|
|
||||||
private final Logger logger;
|
private final Logger logger;
|
||||||
private ItemStackSerializer serializer;
|
private final ItemStackSerializer serializer;
|
||||||
private int usedSerializer = 2;
|
@Getter private final int usedSerializer;
|
||||||
|
|
||||||
public InventorySerializer(Logger logger)
|
public InventorySerializer(Logger logger)
|
||||||
{
|
{
|
||||||
this.logger = logger;
|
this.logger = logger;
|
||||||
|
ItemStackSerializer serializer = null;
|
||||||
|
int usedSerializer = 2;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if(NBTItemStackSerializerGen2.isMCVersionCompatible())
|
if(ItemStackSerializer.isNBTItemStackSerializerAvailable())
|
||||||
{
|
{
|
||||||
serializer = new NBTItemStackSerializerGen2(logger);
|
serializer = ItemStackSerializer.makeNBTItemStackSerializer(logger);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch(Exception e)
|
catch(Exception e)
|
||||||
@ -54,6 +58,8 @@ public InventorySerializer(Logger logger)
|
|||||||
usedSerializer = 0;
|
usedSerializer = 0;
|
||||||
serializer = BUKKIT_ITEM_STACK_SERIALIZER;
|
serializer = BUKKIT_ITEM_STACK_SERIALIZER;
|
||||||
}
|
}
|
||||||
|
this.serializer = serializer;
|
||||||
|
this.usedSerializer = usedSerializer;
|
||||||
}
|
}
|
||||||
|
|
||||||
public byte[] serialize(Inventory inv)
|
public byte[] serialize(Inventory inv)
|
||||||
@ -72,15 +78,10 @@ public ItemStack[] deserialize(byte[] data, int usedSerializer)
|
|||||||
switch(usedSerializer)
|
switch(usedSerializer)
|
||||||
{
|
{
|
||||||
case 0: return BUKKIT_ITEM_STACK_SERIALIZER.deserialize(data);
|
case 0: return BUKKIT_ITEM_STACK_SERIALIZER.deserialize(data);
|
||||||
case 1: if(MCVersion.isNewerOrEqualThan(MCVersion.MC_1_13)) logger.warning(ConsoleColor.YELLOW + "Backpack was created with an old version of minecraft. There is the chance that some items will disappear from it.");
|
case 1: if(MCVersion.isNewerOrEqualThan(MCVersion.MC_1_13)) logger.warning(ConsoleColor.YELLOW + "Backpack was created with an old version of minepacks and minecraft. There is the chance that some items will disappear from it." + ConsoleColor.RESET);
|
||||||
case 2: return serializer.deserialize(data);
|
case 2: return serializer.deserialize(data);
|
||||||
default: logger.warning(ConsoleColor.RED + "No compatible deserializer for backpack format available!" + ConsoleColor.RESET);
|
default: logger.warning(ConsoleColor.RED + "No compatible deserializer for backpack format available!" + ConsoleColor.RESET);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getUsedSerializer()
|
|
||||||
{
|
|
||||||
return usedSerializer;
|
|
||||||
}
|
|
||||||
}
|
}
|
@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
package at.pcgamingfreaks.Minepacks.Bukkit;
|
package at.pcgamingfreaks.Minepacks.Bukkit;
|
||||||
|
|
||||||
import at.pcgamingfreaks.Minepacks.Bukkit.Database.Helper.WorldBlacklistMode;
|
import at.pcgamingfreaks.Minepacks.Bukkit.API.WorldBlacklistMode;
|
||||||
import at.pcgamingfreaks.Minepacks.Bukkit.Listener.ItemFilter;
|
import at.pcgamingfreaks.Minepacks.Bukkit.Listener.ItemFilter;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2020 GeorgH93
|
* Copyright (C) 2021 GeorgH93
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -67,7 +67,7 @@ public void onClose(InventoryCloseEvent event)
|
|||||||
}
|
}
|
||||||
if(closeSound != null)
|
if(closeSound != null)
|
||||||
{
|
{
|
||||||
closer.getWorld().playSound(closer.getEyeLocation(), closeSound, 1, 0);
|
closer.playSound(closer.getEyeLocation(), closeSound, 1, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
import at.pcgamingfreaks.Minepacks.Bukkit.API.Backpack;
|
import at.pcgamingfreaks.Minepacks.Bukkit.API.Backpack;
|
||||||
import at.pcgamingfreaks.Minepacks.Bukkit.API.Callback;
|
import at.pcgamingfreaks.Minepacks.Bukkit.API.Callback;
|
||||||
import at.pcgamingfreaks.Minepacks.Bukkit.Database.Helper.WorldBlacklistMode;
|
import at.pcgamingfreaks.Minepacks.Bukkit.API.WorldBlacklistMode;
|
||||||
import at.pcgamingfreaks.Minepacks.Bukkit.Minepacks;
|
import at.pcgamingfreaks.Minepacks.Bukkit.Minepacks;
|
||||||
import at.pcgamingfreaks.Minepacks.Bukkit.Permissions;
|
import at.pcgamingfreaks.Minepacks.Bukkit.Permissions;
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2020 GeorgH93
|
* Copyright (C) 2021 GeorgH93
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -22,7 +22,7 @@
|
|||||||
import at.pcgamingfreaks.Bukkit.Util.InventoryUtils;
|
import at.pcgamingfreaks.Bukkit.Util.InventoryUtils;
|
||||||
import at.pcgamingfreaks.Minepacks.Bukkit.API.Backpack;
|
import at.pcgamingfreaks.Minepacks.Bukkit.API.Backpack;
|
||||||
import at.pcgamingfreaks.Minepacks.Bukkit.API.Events.InventoryClearedEvent;
|
import at.pcgamingfreaks.Minepacks.Bukkit.API.Events.InventoryClearedEvent;
|
||||||
import at.pcgamingfreaks.Minepacks.Bukkit.Database.Helper.WorldBlacklistMode;
|
import at.pcgamingfreaks.Minepacks.Bukkit.API.WorldBlacklistMode;
|
||||||
import at.pcgamingfreaks.Minepacks.Bukkit.Item.ItemConfig;
|
import at.pcgamingfreaks.Minepacks.Bukkit.Item.ItemConfig;
|
||||||
import at.pcgamingfreaks.Minepacks.Bukkit.Minepacks;
|
import at.pcgamingfreaks.Minepacks.Bukkit.Minepacks;
|
||||||
import at.pcgamingfreaks.Minepacks.Bukkit.Permissions;
|
import at.pcgamingfreaks.Minepacks.Bukkit.Permissions;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2020 GeorgH93
|
* Copyright (C) 2021 GeorgH93
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -25,17 +25,18 @@
|
|||||||
import at.pcgamingfreaks.Minepacks.Bukkit.API.Backpack;
|
import at.pcgamingfreaks.Minepacks.Bukkit.API.Backpack;
|
||||||
import at.pcgamingfreaks.Minepacks.Bukkit.API.Callback;
|
import at.pcgamingfreaks.Minepacks.Bukkit.API.Callback;
|
||||||
import at.pcgamingfreaks.Minepacks.Bukkit.API.MinepacksPlayer;
|
import at.pcgamingfreaks.Minepacks.Bukkit.API.MinepacksPlayer;
|
||||||
|
import at.pcgamingfreaks.Minepacks.Bukkit.API.*;
|
||||||
import at.pcgamingfreaks.Minepacks.Bukkit.Command.CommandManager;
|
import at.pcgamingfreaks.Minepacks.Bukkit.Command.CommandManager;
|
||||||
import at.pcgamingfreaks.Minepacks.Bukkit.Command.InventoryClearCommand;
|
import at.pcgamingfreaks.Minepacks.Bukkit.Command.InventoryClearCommand;
|
||||||
import at.pcgamingfreaks.Minepacks.Bukkit.Command.ShortcutCommand;
|
import at.pcgamingfreaks.Minepacks.Bukkit.Command.ShortcutCommand;
|
||||||
import at.pcgamingfreaks.Minepacks.Bukkit.Database.BackpacksConfig;
|
import at.pcgamingfreaks.Minepacks.Bukkit.Database.BackpacksConfig;
|
||||||
import at.pcgamingfreaks.Minepacks.Bukkit.Database.Config;
|
import at.pcgamingfreaks.Minepacks.Bukkit.Database.Config;
|
||||||
import at.pcgamingfreaks.Minepacks.Bukkit.Database.Database;
|
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.Database.Language;
|
||||||
import at.pcgamingfreaks.Minepacks.Bukkit.ExtendedAPI.MinepacksCommandManager;
|
import at.pcgamingfreaks.Minepacks.Bukkit.ExtendedAPI.MinepacksCommandManager;
|
||||||
import at.pcgamingfreaks.Minepacks.Bukkit.ExtendedAPI.MinepacksPlayerExtended;
|
import at.pcgamingfreaks.Minepacks.Bukkit.ExtendedAPI.MinepacksPlayerExtended;
|
||||||
import at.pcgamingfreaks.Minepacks.Bukkit.ExtendedAPI.MinepacksPluginExtended;
|
import at.pcgamingfreaks.Minepacks.Bukkit.ExtendedAPI.MinepacksPluginExtended;
|
||||||
|
import at.pcgamingfreaks.Minepacks.Bukkit.Listener.ItemFilter;
|
||||||
import at.pcgamingfreaks.Minepacks.Bukkit.Listener.*;
|
import at.pcgamingfreaks.Minepacks.Bukkit.Listener.*;
|
||||||
import at.pcgamingfreaks.Minepacks.Bukkit.SpecialInfoWorker.NoDatabaseWorker;
|
import at.pcgamingfreaks.Minepacks.Bukkit.SpecialInfoWorker.NoDatabaseWorker;
|
||||||
import at.pcgamingfreaks.StringUtils;
|
import at.pcgamingfreaks.StringUtils;
|
||||||
@ -119,7 +120,7 @@ public void onEnable()
|
|||||||
|
|
||||||
private boolean checkMcVersion()
|
private boolean checkMcVersion()
|
||||||
{
|
{
|
||||||
if(MCVersion.is(MCVersion.UNKNOWN) || MCVersion.isOlderThan(MCVersion.MC_1_8) || MCVersion.isNewerThan(MCVersion.MC_NMS_1_16_R2))
|
if(MCVersion.is(MCVersion.UNKNOWN) || MCVersion.isOlderThan(MCVersion.MC_1_8) || MCVersion.isNewerThan(MCVersion.MC_NMS_1_16_R3))
|
||||||
{
|
{
|
||||||
getLogger().warning(ConsoleColor.RED + "################################" + ConsoleColor.RESET);
|
getLogger().warning(ConsoleColor.RED + "################################" + ConsoleColor.RESET);
|
||||||
getLogger().warning(ConsoleColor.RED + String.format("Your server version (%1$s) is currently not compatible with your current version (%2$s) of the plugin. " +
|
getLogger().warning(ConsoleColor.RED + String.format("Your server version (%1$s) is currently not compatible with your current version (%2$s) of the plugin. " +
|
||||||
@ -299,7 +300,7 @@ public void openBackpack(final @NotNull Player opener, final @Nullable Backpack
|
|||||||
if(opener.getOpenInventory().getTopInventory().getHolder() == backpack) return; // == is fine as there is only one instance of each backpack
|
if(opener.getOpenInventory().getTopInventory().getHolder() == backpack) return; // == is fine as there is only one instance of each backpack
|
||||||
if(openSound != null)
|
if(openSound != null)
|
||||||
{
|
{
|
||||||
opener.getWorld().playSound(opener.getEyeLocation(), openSound, 1, 0);
|
opener.playSound(opener.getEyeLocation(), openSound, 1, 0);
|
||||||
}
|
}
|
||||||
backpack.open(opener, editable);
|
backpack.open(opener, editable);
|
||||||
}
|
}
|
||||||
@ -352,6 +353,7 @@ public int getBackpackPermSize(final @NotNull Player player)
|
|||||||
return 9;
|
return 9;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public @NotNull WorldBlacklistMode isDisabled(final @NotNull Player player)
|
public @NotNull WorldBlacklistMode isDisabled(final @NotNull Player player)
|
||||||
{
|
{
|
||||||
if(worldBlacklistMode == WorldBlacklistMode.None || (worldBlacklistMode != WorldBlacklistMode.NoPlugin && player.hasPermission(Permissions.IGNORE_WORLD_BLACKLIST))) return WorldBlacklistMode.None;
|
if(worldBlacklistMode == WorldBlacklistMode.None || (worldBlacklistMode != WorldBlacklistMode.NoPlugin && player.hasPermission(Permissions.IGNORE_WORLD_BLACKLIST))) return WorldBlacklistMode.None;
|
||||||
|
Loading…
Reference in New Issue
Block a user