[Fix] Allow players to move blocked items out of backpacks Fixes #37
[Fix] Problems when reloading the plugin while players have the backpack open on MC 1.14
[Fix] Missing messages in the language files
This commit is contained in:
GeorgH93 2019-06-08 00:25:30 +02:00
parent 6f1177df78
commit d8e11a41a6
No known key found for this signature in database
GPG Key ID: D1630D37F9E4B3C8
8 changed files with 27 additions and 11 deletions

View File

@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>at.pcgamingfreaks</groupId>
<artifactId>Minepacks</artifactId>
<version>2.0</version>
<version>2.0.1</version>
<scm>
<connection>scm:git:git@github.com:GeorgH93/Minepacks.git</connection>
@ -84,7 +84,8 @@
<dependency>
<groupId>at.pcgamingfreaks</groupId>
<artifactId>BadRabbit</artifactId>
<version>1.1.1</version>
<version>1.2.1</version>
<classifier>Bukkit</classifier>
</dependency>
</dependencies>

View File

@ -23,6 +23,16 @@ Language:
Help:
Header: "&6### Minepacks Commands ###"
Footer: "&6#############################"
Reload:
Reloading: "&1Plugin wird neu geladen ..."
Reloaded: "&1Plugin 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!"
@ -62,6 +72,7 @@ Language:
RestoreList: "Listet alle verfügbaren Sicherungskopien von Rucksäcken auf."
Version: "Gibt die Versionsdetails über das Plugin und seine Abhängigkeiten aus."
Help: "Zeigt die verfügbaren Befehle an."
Migrate: "Erlaubt das konvertieren der Datenbank in ein anderes Format."
Command:
Backpack:
@ -99,4 +110,4 @@ LanguageName: "german"
Author: "GeorgH93"
# Language file version. Don't touch it!
Version: 15
Version: 16

View File

@ -63,6 +63,7 @@ Language:
Restore: "Restores a backup."
RestoreList: "Lists all available backups."
Help: "Shows all available commands and their description."
Migrate: "Migrates the used database from one type to another."
Command:
Backpack:
@ -95,4 +96,4 @@ LanguageName: "english"
Author: "GeorgH93"
# Language file version. Don't touch it!
Version: 15
Version: 16

View File

@ -32,9 +32,10 @@
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
public class Backpack implements at.pcgamingfreaks.Minepacks.Bukkit.API.Backpack
{
@ -45,7 +46,7 @@ public class Backpack implements at.pcgamingfreaks.Minepacks.Bukkit.API.Backpack
private static String titleOtherFormat, titleOther;
private final OfflinePlayer owner;
private final Object titleOtherOBC;
private final HashMap<Player, Boolean> opened = new HashMap<>();
private final Map<Player, Boolean> opened = new ConcurrentHashMap<>(); //Thanks Minecraft 1.14
private Inventory bp;
private int size, ownerID;
private boolean hasChanged;

View File

@ -31,6 +31,7 @@
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
import java.util.Collection;
import java.util.List;
@ -41,7 +42,7 @@ public class CommandManager extends CommandExecutorWithSubCommandsGeneric<Minepa
private final RegisterablePluginCommand backpackCommand;
private final Message helpFormat;
public CommandManager(Minepacks plugin)
public CommandManager(@NotNull Minepacks plugin)
{
this.plugin = plugin;
// Registering the backpack command with the translated aliases
@ -88,7 +89,7 @@ public void close()
}
@Override
public boolean onCommand(CommandSender sender, Command command, String alias, String[] args)
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String alias, String[] args)
{
if(sender instanceof Player)
{
@ -108,7 +109,7 @@ public boolean onCommand(CommandSender sender, Command command, String alias, St
}
@Override
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args)
public List<String> onTabComplete(@NotNull CommandSender sender, @NotNull Command command, @NotNull String alias, String[] args)
{
if(sender instanceof Player)
{

View File

@ -50,7 +50,6 @@ public static void updateConfig(YAML oldYAML, YAML newYAML)
case "Misc.AutoUpdate": oldKey = "auto-update"; break;
case "Misc.UseBungeeCord": oldKey = "BungeeCordMode"; break;
case "Language.Language": oldKey = "Language"; break;
case "Language.UpdateMode": oldKey = "LanguageUpdateMode"; break;
case "Database.UseUUIDs": if(!oldYAML.isSet("Database.UseUUIDs") && oldYAML.isSet("UseUUIDs")) oldKey = "UseUUIDs"; break;
}
try

View File

@ -28,7 +28,7 @@
public class Language extends at.pcgamingfreaks.Bukkit.Language
{
private static final int LANG_VERSION = 15, UPGRADE_THRESHOLD = 15;
private static final int LANG_VERSION = 16, UPGRADE_THRESHOLD = 16;
public Language(JavaPlugin plugin)
{

View File

@ -94,6 +94,8 @@ public void onItemMove(InventoryClickEvent event)
{
if(event.getInventory().getHolder() instanceof Backpack && event.getCurrentItem() != null && blockedMaterials.contains(new MinecraftMaterial(event.getCurrentItem())))
{
if(event.getClickedInventory() != null && event.getClickedInventory().getHolder() instanceof Backpack) return; // Allow user to move blacklisted items out of the backpack
messageNotAllowedInBackpack.send(event.getView().getPlayer(), itemNameResolver.getName(event.getCurrentItem()));
event.setCancelled(true);
}