Compare commits
21 Commits
Author | SHA1 | Date |
---|---|---|
GeorgH93 | c2972c56ef | |
GeorgH93 | b2221b26eb | |
GeorgH93 | 0e53b1f41d | |
GeorgH93 | 41644b2ac9 | |
GeorgH93 | 0811e56b26 | |
GeorgH93 | 212e1b207d | |
GeorgH93 | 48157c0d8e | |
snyk-bot | 02e7e42dbd | |
GeorgH93 | c3ac9b63d9 | |
GeorgH93 | 0b9ec74747 | |
GeorgH93 | f759a4b799 | |
GeorgH93 | 1d3e3fa464 | |
GeorgH93 | 582ada4657 | |
GeorgH93 | e4ecb9919c | |
GeorgH93 | 2fdb20b464 | |
GeorgH93 | a4148d5772 | |
GeorgH93 | 9528030055 | |
GeorgH93 | 5604b1b5ee | |
GeorgH93 | 12c0892419 | |
GeorgH93 | e50c92f603 | |
GeorgH93 | 6d0022e413 |
|
@ -10,7 +10,7 @@ jobs:
|
|||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
java-version: [ 8, 11, 17 ]
|
||||
java-version: [ 8, 11, 17, 21 ]
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
|
|
|
@ -13,10 +13,10 @@ jobs:
|
|||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Set up JDK 17
|
||||
- name: Set up JDK 21
|
||||
uses: actions/setup-java@v3
|
||||
with:
|
||||
java-version: 17
|
||||
java-version: 21
|
||||
distribution: temurin
|
||||
server-id: github
|
||||
settings-path: ${{ github.workspace }} # location for the settings.xml file
|
||||
|
|
|
@ -14,10 +14,10 @@ jobs:
|
|||
- uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
|
||||
- name: Set up JDK 17
|
||||
- name: Set up JDK 21
|
||||
uses: actions/setup-java@v3
|
||||
with:
|
||||
java-version: 17
|
||||
java-version: 21
|
||||
distribution: temurin
|
||||
- name: Cache SonarCloud packages
|
||||
uses: actions/cache@v3
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
<dependency>
|
||||
<groupId>at.pcgamingfreaks</groupId>
|
||||
<artifactId>PluginLib</artifactId>
|
||||
<version>1.0.17-SNAPSHOT</version>
|
||||
<version>${pcgfPluginLibVersion}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
|
|
@ -186,7 +186,7 @@ public abstract class MinepacksCommand extends SubCommand
|
|||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
plugin.getLogger().log(Level.SEVERE, e, () -> { return "Failed to execute command " + usedMainCommandAlias; });
|
||||
plugin.getLogger().log(Level.SEVERE, e, () -> "Failed to execute command " + usedMainCommandAlias);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -16,6 +16,7 @@ Language:
|
|||
NotAllowedInBackpack_SendMethod: "action_bar"
|
||||
DontRemoveShortcut: "&cYou must not remove the backpack shortcut from your inventory!"
|
||||
DontRemoveShortcut_SendMethod: "action_bar"
|
||||
BackpackShrunk: "&cYour backpack shrunk! Some items fell to the ground!"
|
||||
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.\"}]"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2020 GeorgH93
|
||||
* Copyright (C) 2024 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
|
||||
|
@ -12,18 +12,17 @@
|
|||
* 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 <https://www.gnu.org/licenses/>.
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package at.pcgamingfreaks.Minepacks.Bukkit;
|
||||
|
||||
import at.pcgamingfreaks.Bukkit.MCVersion;
|
||||
import at.pcgamingfreaks.Bukkit.Message.Message;
|
||||
import at.pcgamingfreaks.Bukkit.Util.InventoryUtils;
|
||||
import at.pcgamingfreaks.Minepacks.Bukkit.Database.Helper.InventoryCompressor;
|
||||
import at.pcgamingfreaks.Util.StringUtils;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
|
@ -33,6 +32,10 @@ import org.bukkit.inventory.ItemStack;
|
|||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import lombok.AccessLevel;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
@ -42,8 +45,10 @@ import java.util.concurrent.ConcurrentHashMap;
|
|||
public class Backpack implements at.pcgamingfreaks.Minepacks.Bukkit.API.Backpack
|
||||
{
|
||||
@Setter(AccessLevel.PACKAGE) private static ShrinkApproach shrinkApproach = ShrinkApproach.COMPRESS;
|
||||
private static Object titleOwn;
|
||||
private static String titleOtherFormat;
|
||||
@Setter(AccessLevel.PACKAGE) private static Message messageBackpackShrunk = new Message("Backpack shrunk!");
|
||||
private static Object titleOwnGlobal;
|
||||
private static String titleFormat, titleOtherFormat;
|
||||
private final Object titleOwn;
|
||||
private final String titleOther;
|
||||
@Getter private final UUID ownerId;
|
||||
private final Map<Player, Boolean> opened = new ConcurrentHashMap<>(); //Thanks Minecraft 1.14
|
||||
|
@ -54,7 +59,8 @@ public class Backpack implements at.pcgamingfreaks.Minepacks.Bukkit.API.Backpack
|
|||
|
||||
public static void setTitle(final @NotNull String title, final @NotNull String titleOther)
|
||||
{
|
||||
titleOwn = InventoryUtils.prepareTitleForOpenInventoryWithCustomTitle(title);
|
||||
titleOwnGlobal = title.contains("%s") ? null : InventoryUtils.prepareTitleForOpenInventoryWithCustomTitle(title);
|
||||
titleFormat = title;
|
||||
titleOtherFormat = titleOther;
|
||||
}
|
||||
|
||||
|
@ -80,6 +86,9 @@ public class Backpack implements at.pcgamingfreaks.Minepacks.Bukkit.API.Backpack
|
|||
bp = Bukkit.createInventory(this, size, titleOther);
|
||||
this.size = size;
|
||||
ownerDatabaseId = ID;
|
||||
|
||||
if (titleOwnGlobal != null) titleOwn = titleOwnGlobal;
|
||||
else titleOwn = InventoryUtils.prepareTitleForOpenInventoryWithCustomTitle(String.format(titleFormat, owner.getName()));
|
||||
}
|
||||
|
||||
public Backpack(final OfflinePlayer owner, ItemStack[] backpack, final int ID)
|
||||
|
@ -135,14 +144,20 @@ public class Backpack implements at.pcgamingfreaks.Minepacks.Bukkit.API.Backpack
|
|||
int size = Minepacks.getInstance().getBackpackPermSize(owner);
|
||||
if(size != bp.getSize())
|
||||
{
|
||||
boolean dropped = false;
|
||||
List<ItemStack> items = setSize(size);
|
||||
for(ItemStack i : items)
|
||||
{
|
||||
if(i != null)
|
||||
{
|
||||
owner.getWorld().dropItemNaturally(owner.getLocation(), i);
|
||||
dropped = true;
|
||||
}
|
||||
}
|
||||
if (dropped)
|
||||
{
|
||||
messageBackpackShrunk.send(owner);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2023 GeorgH93
|
||||
* Copyright (C) 2024 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
|
||||
|
@ -37,6 +37,7 @@ import org.jetbrains.annotations.NotNull;
|
|||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.logging.Level;
|
||||
|
||||
public class CommandManager extends CommandExecutorWithSubCommandsGeneric<MinepacksCommand> /*if_not[STANDALONE]*/ implements MinepacksCommandManager /*end[STANDALONE]*/
|
||||
{
|
||||
|
@ -67,8 +68,7 @@ public class CommandManager extends CommandExecutorWithSubCommandsGeneric<Minepa
|
|||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
plugin.getLogger().warning(ConsoleColor.RED + "Unable to set the help format. Default format will be used.\nMore details:" + ConsoleColor.RESET);
|
||||
e.printStackTrace();
|
||||
plugin.getLogger().log(Level.SEVERE, e, () -> ConsoleColor.RED + "Unable to set the help format. Default format will be used.\nMore details:" + ConsoleColor.RESET);
|
||||
}
|
||||
|
||||
// Init backpack commands
|
||||
|
@ -126,11 +126,8 @@ public class CommandManager extends CommandExecutorWithSubCommandsGeneric<Minepa
|
|||
WorldBlacklistMode disabled = plugin.isDisabled((Player) sender);
|
||||
if(disabled != WorldBlacklistMode.None)
|
||||
{
|
||||
switch(disabled)
|
||||
{
|
||||
case Message: plugin.messageWorldDisabled.send(sender); break;
|
||||
case MissingPermission: plugin.messageNoPermission.send(sender); break;
|
||||
}
|
||||
if (disabled == WorldBlacklistMode.Message) plugin.messageWorldDisabled.send(sender);
|
||||
else if (disabled == WorldBlacklistMode.MissingPermission) plugin.messageNoPermission.send(sender);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -64,42 +64,52 @@ public class OpenCommand extends MinepacksCommand
|
|||
Player player = (Player) sender;
|
||||
if(args.length == 0)
|
||||
{
|
||||
if(getMinepacksPlugin().isPlayerGameModeAllowed(player))
|
||||
{
|
||||
if(plugin.getCooldownManager() != null && !player.hasPermission(Permissions.NO_COOLDOWN))
|
||||
{
|
||||
long cd = plugin.getCooldownManager().getRemainingCooldown(player);
|
||||
if(cd > 0)
|
||||
{
|
||||
TimeSpan ts = TimeSpan.fromMilliseconds(cd);
|
||||
messageCooldown.send(sender, cd / 1000f, ts.toString());
|
||||
return;
|
||||
}
|
||||
plugin.getCooldownManager().setCooldown(player);
|
||||
}
|
||||
plugin.openBackpack(player, player, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
messageWrongGameMode.send(player, player.getGameMode());
|
||||
}
|
||||
executeSelf(player);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(player.hasPermission(Permissions.OTHERS))
|
||||
executeOther(player, args[0]);
|
||||
}
|
||||
}
|
||||
|
||||
void executeSelf(Player player)
|
||||
{
|
||||
if(getMinepacksPlugin().isPlayerGameModeAllowed(player))
|
||||
{
|
||||
if(plugin.getCooldownManager() != null && !player.hasPermission(Permissions.NO_COOLDOWN))
|
||||
{
|
||||
OfflinePlayer target = Bukkit.getPlayer(args[0]);
|
||||
if(target == null)
|
||||
long cd = plugin.getCooldownManager().getRemainingCooldown(player);
|
||||
if(cd > 0)
|
||||
{
|
||||
//noinspection deprecation
|
||||
target = Bukkit.getOfflinePlayer(args[0]);
|
||||
TimeSpan ts = TimeSpan.fromMilliseconds(cd);
|
||||
messageCooldown.send(player, cd / 1000f, ts.toString());
|
||||
return;
|
||||
}
|
||||
plugin.openBackpack(player, target, player.hasPermission(Permissions.OTHERS_EDIT));
|
||||
plugin.getCooldownManager().setCooldown(player);
|
||||
}
|
||||
else
|
||||
plugin.openBackpack(player, player, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
messageWrongGameMode.send(player, player.getGameMode());
|
||||
}
|
||||
}
|
||||
|
||||
void executeOther(Player player, String name)
|
||||
{
|
||||
if(player.hasPermission(Permissions.OTHERS))
|
||||
{
|
||||
OfflinePlayer target = Bukkit.getPlayer(name);
|
||||
if(target == null)
|
||||
{
|
||||
plugin.messageNoPermission.send(player);
|
||||
//noinspection deprecation
|
||||
target = Bukkit.getOfflinePlayer(name);
|
||||
}
|
||||
plugin.openBackpack(player, target, player.hasPermission(Permissions.OTHERS_EDIT));
|
||||
}
|
||||
else
|
||||
{
|
||||
plugin.messageNoPermission.send(player);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ public class ShortcutCommand extends MinepacksCommand
|
|||
|
||||
public ShortcutCommand(Minepacks plugin, final @NotNull ItemShortcut itemShortcut)
|
||||
{
|
||||
super(plugin, "shortcut", plugin.getLanguage().getTranslated("Commands.Description.Shortcut"), Permissions.USE, true, plugin.getLanguage().getCommandAliases("Shortcut"));
|
||||
super(plugin, "shortcut", ""/*plugin.getLanguage().getTranslated("Commands.Description.Shortcut")*/, Permissions.USE, true, plugin.getLanguage().getCommandAliases("Shortcut"));
|
||||
this.itemShortcut = itemShortcut;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2023 GeorgH93
|
||||
* Copyright (C) 2024 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
|
||||
|
@ -12,7 +12,7 @@
|
|||
* 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 <https://www.gnu.org/licenses/>.
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package at.pcgamingfreaks.Minepacks.Bukkit.Database;
|
||||
|
@ -31,6 +31,7 @@ import at.pcgamingfreaks.Minepacks.Bukkit.Minepacks;
|
|||
import at.pcgamingfreaks.Minepacks.Bukkit.ShrinkApproach;
|
||||
import at.pcgamingfreaks.Minepacks.MagicValues;
|
||||
import at.pcgamingfreaks.Version;
|
||||
|
||||
import org.bukkit.*;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
|
@ -175,7 +176,7 @@ public class Config extends Configuration implements DatabaseConnectionConfigura
|
|||
|
||||
public String getBPTitle()
|
||||
{
|
||||
return ChatColor.translateAlternateColorCodes('&', getConfigE().getString("BackpackTitle", "Backpack"));
|
||||
return ChatColor.translateAlternateColorCodes('&', getConfigE().getString("BackpackTitle", "Backpack").replace("%", "%%").replace("{OwnerName}", "%s"));
|
||||
}
|
||||
|
||||
public boolean getDropOnDeath()
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2020 GeorgH93
|
||||
* Copyright (C) 2024 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
|
||||
|
@ -12,7 +12,7 @@
|
|||
* 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 <https://www.gnu.org/licenses/>.
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package at.pcgamingfreaks.Minepacks.Bukkit.Database;
|
||||
|
@ -20,7 +20,8 @@ package at.pcgamingfreaks.Minepacks.Bukkit.Database;
|
|||
import at.pcgamingfreaks.Minepacks.Bukkit.API.Callback;
|
||||
import at.pcgamingfreaks.Minepacks.Bukkit.Backpack;
|
||||
import at.pcgamingfreaks.Minepacks.Bukkit.Minepacks;
|
||||
import at.pcgamingfreaks.UUIDConverter;
|
||||
import at.pcgamingfreaks.UUID.UuidConverter;
|
||||
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
@ -39,10 +40,12 @@ public class Files extends Database
|
|||
public static final String EXT = ".backpack", EXT_REGEX = "\\.backpack", FOLDER_NAME = "backpacks";
|
||||
|
||||
private final File saveFolder;
|
||||
private final UuidConverter converter;
|
||||
|
||||
public Files(Minepacks plugin)
|
||||
{
|
||||
super(plugin);
|
||||
converter = new UuidConverter(plugin.getLogger());
|
||||
maxAge *= 24 * 3600000L;
|
||||
saveFolder = new File(this.plugin.getDataFolder(), FOLDER_NAME);
|
||||
if(!saveFolder.exists())
|
||||
|
@ -64,6 +67,21 @@ public class Files extends Database
|
|||
// Files are stored with the users name or the uuid, there is no reason to update anything
|
||||
}
|
||||
|
||||
private String getUuidFromFileName(String fileName)
|
||||
{
|
||||
String name = fileName.substring(0, fileName.length() - EXT.length());
|
||||
UUID uuid = (onlineUUIDs) ? converter.getUUID(name, true) : UuidConverter.getOfflineModeUUID(name);
|
||||
return getPlayerFormattedUUID(uuid);
|
||||
}
|
||||
|
||||
private void tryRename(File file, File newFileName)
|
||||
{
|
||||
if (!file.renameTo(newFileName))
|
||||
{
|
||||
plugin.getLogger().log(Level.WARNING, () -> "Failed to rename file (" + file.getAbsolutePath() + " to " + newFileName.getAbsolutePath() + ").");
|
||||
}
|
||||
}
|
||||
|
||||
private void checkFiles()
|
||||
{
|
||||
File[] allFiles = saveFolder.listFiles((dir, name) -> name.endsWith(EXT));
|
||||
|
@ -81,32 +99,20 @@ public class Files extends Database
|
|||
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), onlineUUIDs, useUUIDSeparators) + EXT)))
|
||||
{
|
||||
plugin.getLogger().warning("Failed to rename file (" + file.getAbsolutePath() + ").");
|
||||
}
|
||||
tryRename(file, new File(saveFolder, getUuidFromFileName(file.getName()) + EXT));
|
||||
}
|
||||
else // It's an UUID
|
||||
else // It's a UUID
|
||||
{
|
||||
if(file.getName().contains("-"))
|
||||
{
|
||||
if(!useUUIDSeparators)
|
||||
{
|
||||
if(!file.renameTo(new File(saveFolder, file.getName().replaceAll("-", ""))))
|
||||
{
|
||||
plugin.getLogger().warning("Failed to rename file (" + file.getAbsolutePath() + ").");
|
||||
}
|
||||
tryRename(file, new File(saveFolder, file.getName().replaceAll("-", "")));
|
||||
}
|
||||
}
|
||||
else
|
||||
else if(useUUIDSeparators)
|
||||
{
|
||||
if(useUUIDSeparators)
|
||||
{
|
||||
if(!file.renameTo(new File(saveFolder, file.getName().replaceAll("(\\w{8})(\\w{4})(\\w{4})(\\w{4})(\\w{12})" + EXT_REGEX, "$1-$2-$3-$4-$5" + EXT))))
|
||||
{
|
||||
plugin.getLogger().warning("Failed to rename file (" + file.getAbsolutePath() + ").");
|
||||
}
|
||||
}
|
||||
tryRename(file, new File(saveFolder, file.getName().replaceAll("(\\w{8})(\\w{4})(\\w{4})(\\w{4})(\\w{12})" + EXT_REGEX, "$1-$2-$3-$4-$5" + EXT)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2023 GeorgH93
|
||||
* Copyright (C) 2024 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
|
||||
|
@ -65,7 +65,7 @@ public abstract class SQL extends Database
|
|||
}
|
||||
catch(SQLException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
plugin.getLogger().log(Level.SEVERE, "Failed to delete old backpacks! Error: {0}", e.getMessage());
|
||||
}
|
||||
}
|
||||
// Delete old cooldowns
|
||||
|
@ -73,11 +73,11 @@ public abstract class SQL extends Database
|
|||
{
|
||||
try(Connection connection = getConnection())
|
||||
{
|
||||
DBTools.runStatement(connection, queryDeleteOldCooldowns, System.currentTimeMillis());
|
||||
DBTools.runStatement(connection, queryDeleteOldCooldowns, new Timestamp(System.currentTimeMillis()));
|
||||
}
|
||||
catch(SQLException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
plugin.getLogger().log(Level.SEVERE, "Failed to delete cooldowns! Error: {0}", e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -116,7 +116,7 @@ public abstract class SQL extends Database
|
|||
}
|
||||
catch(SQLException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
plugin.getLogger().log(Level.SEVERE, "Failed to check UUIDs! Error: {0}", e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -236,8 +236,7 @@ public abstract class SQL extends Database
|
|||
}
|
||||
catch(SQLException e)
|
||||
{
|
||||
plugin.getLogger().warning("Failed to save backpack in database! Error: " + e.getMessage());
|
||||
e.printStackTrace();
|
||||
plugin.getLogger().log(Level.SEVERE, "Failed to save backpack in database! Error: {0}", e.getMessage());
|
||||
writeBackup(name, nameOrUUID, usedSerializer, data);
|
||||
}
|
||||
};
|
||||
|
@ -289,7 +288,7 @@ public abstract class SQL extends Database
|
|||
}
|
||||
catch(SQLException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
plugin.getLogger().log(Level.SEVERE, "Failed to load backpack! Error: {0}", e.getMessage());
|
||||
plugin.getServer().getScheduler().runTask(plugin, callback::onFail);
|
||||
}
|
||||
});
|
||||
|
@ -317,7 +316,7 @@ public abstract class SQL extends Database
|
|||
}
|
||||
catch(SQLException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
plugin.getLogger().log(Level.SEVERE, "Failed to load cooldown! Error: {0}", e.getMessage());
|
||||
plugin.getServer().getScheduler().runTask(plugin, () -> callback.onResult(0L));
|
||||
}
|
||||
});
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2023 GeorgH93
|
||||
* Copyright (C) 2024 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
|
||||
|
@ -38,10 +38,10 @@ import at.pcgamingfreaks.Minepacks.Bukkit.SpecialInfoWorker.NoDatabaseWorker;
|
|||
import at.pcgamingfreaks.Minepacks.MagicValues;
|
||||
import at.pcgamingfreaks.Plugin.IPlugin;
|
||||
import at.pcgamingfreaks.ServerType;
|
||||
import at.pcgamingfreaks.Util.StringUtils;
|
||||
import at.pcgamingfreaks.Updater.UpdateResponseCallback;
|
||||
import at.pcgamingfreaks.Util.StringUtils;
|
||||
import at.pcgamingfreaks.Version;
|
||||
import lombok.Getter;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
|
@ -54,6 +54,8 @@ import org.bukkit.plugin.java.JavaPlugin;
|
|||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Collection;
|
||||
import java.util.Locale;
|
||||
|
@ -121,7 +123,12 @@ public class Minepacks extends JavaPlugin implements MinepacksPlugin, IPlugin
|
|||
|
||||
private boolean checkMcVersion()
|
||||
{
|
||||
if(MCVersion.is(MCVersion.UNKNOWN) || !MCVersion.isUUIDsSupportAvailable() || MCVersion.isNewerThan(MCVersion.MC_NMS_1_20_R3))
|
||||
if (MCVersion.isNewerThan(MCVersion.MC_NMS_1_20_R3) && ServerType.isPaperCompatible())
|
||||
{
|
||||
getLogger().warning("Paper support is experimental! Use at your own risk!");
|
||||
getLogger().warning("No guarantee for data integrity! Backup constantly!");
|
||||
}
|
||||
if (MCVersion.is(MCVersion.UNKNOWN) || !MCVersion.isUUIDsSupportAvailable() || MCVersion.isNewerThan(MCVersion.MC_NMS_1_20_R4))
|
||||
{
|
||||
this.warnOnVersionIncompatibility();
|
||||
this.setEnabled(false);
|
||||
|
@ -193,6 +200,7 @@ public class Minepacks extends JavaPlugin implements MinepacksPlugin, IPlugin
|
|||
maxSize = config.getBackpackMaxSize();
|
||||
at.pcgamingfreaks.Minepacks.Bukkit.Backpack.setShrinkApproach(config.getShrinkApproach());
|
||||
at.pcgamingfreaks.Minepacks.Bukkit.Backpack.setTitle(config.getBPTitle(), config.getBPTitleOther());
|
||||
at.pcgamingfreaks.Minepacks.Bukkit.Backpack.setMessageBackpackShrunk(lang.getMessage("Ingame.BackpackShrunk"));
|
||||
messageNotFromConsole = lang.getMessage("NotFromConsole");
|
||||
messageNoPermission = lang.getMessage("Ingame.NoPermission");
|
||||
messageInvalidBackpack = lang.getMessage("Ingame.InvalidBackpack");
|
||||
|
@ -262,11 +270,9 @@ public class Minepacks extends JavaPlugin implements MinepacksPlugin, IPlugin
|
|||
|
||||
public void warnOnVersionIncompatibility()
|
||||
{
|
||||
String name = Bukkit.getServer().getClass().getPackage().getName();
|
||||
String[] version = name.substring(name.lastIndexOf('.') + 2).split("_");
|
||||
getLogger().warning(ConsoleColor.RED + "################################" + ConsoleColor.RESET);
|
||||
getLogger().warning(ConsoleColor.RED + String.format("Your minecraft version (MC %1$s) is currently not compatible with this plugins version (%2$s). " +
|
||||
"Please check for updates!", version[0] + "." + version[1], getDescription().getVersion()) + ConsoleColor.RESET);
|
||||
"Please check for updates!", Bukkit.getServer().getVersion(), getDescription().getVersion()) + ConsoleColor.RESET);
|
||||
getLogger().warning(ConsoleColor.RED + "################################" + ConsoleColor.RESET);
|
||||
Utils.blockThread(5);
|
||||
}
|
||||
|
@ -305,12 +311,8 @@ public class Minepacks extends JavaPlugin implements MinepacksPlugin, IPlugin
|
|||
WorldBlacklistMode disabled = isDisabled(opener);
|
||||
if(disabled != WorldBlacklistMode.None)
|
||||
{
|
||||
switch(disabled)
|
||||
{
|
||||
case Message: messageWorldDisabled.send(opener); break;
|
||||
case MissingPermission: messageNoPermission.send(opener); break;
|
||||
default: //Nothing special to do
|
||||
}
|
||||
if (disabled == WorldBlacklistMode.Message) messageWorldDisabled.send(opener);
|
||||
else if (disabled == WorldBlacklistMode.MissingPermission) messageNoPermission.send(opener);
|
||||
return;
|
||||
}
|
||||
if(backpack == null)
|
||||
|
|
10
pom.xml
10
pom.xml
|
@ -7,16 +7,16 @@
|
|||
<packaging>pom</packaging>
|
||||
|
||||
<properties>
|
||||
<revision>2.4.25</revision>
|
||||
<revision>2.4.30</revision>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||
|
||||
<configFileVersion>34</configFileVersion>
|
||||
<languageFileVersion>20</languageFileVersion>
|
||||
<pcgfPluginLibVersion>1.0.39.3-SNAPSHOT</pcgfPluginLibVersion>
|
||||
<languageFileVersion>21</languageFileVersion>
|
||||
<pcgfPluginLibVersion>1.0.39.6-SNAPSHOT</pcgfPluginLibVersion>
|
||||
|
||||
<bukkitVersion>1.15.2-R0.1-SNAPSHOT</bukkitVersion>
|
||||
<mavenShade.version>3.4.1</mavenShade.version>
|
||||
<mavenShade.version>3.5.3</mavenShade.version>
|
||||
|
||||
<author>GeorgH93</author>
|
||||
<maven.build.timestamp.format>yyyyMMddHHmmss</maven.build.timestamp.format>
|
||||
|
@ -81,7 +81,7 @@
|
|||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<version>1.18.30</version>
|
||||
<version>1.18.32</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
|
Loading…
Reference in New Issue