mirror of
https://github.com/JEFF-Media-GbR/ChestSort.git
synced 2024-12-04 16:44:00 +01:00
13.3.0 release
This commit is contained in:
parent
bf5906b4ec
commit
fd47607f69
@ -1,5 +1,8 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## 13.2.1
|
||||||
|
- Fixed exceptions when using the latest version of AdvancedChests
|
||||||
|
|
||||||
## 13.0.5
|
## 13.0.5
|
||||||
Sorry for 3 updates within 10 minutes!
|
Sorry for 3 updates within 10 minutes!
|
||||||
|
|
||||||
|
9
pom.xml
9
pom.xml
@ -9,7 +9,7 @@
|
|||||||
<name>ChestSort</name>
|
<name>ChestSort</name>
|
||||||
<url>https://www.chestsort.de</url>
|
<url>https://www.chestsort.de</url>
|
||||||
<description>Allows automatic chest sorting!</description>
|
<description>Allows automatic chest sorting!</description>
|
||||||
<version>13.2.0</version>
|
<version>13.3.0</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
@ -171,6 +171,11 @@
|
|||||||
<url>https://repo.codemc.org/repository/maven-public</url>
|
<url>https://repo.codemc.org/repository/maven-public</url>
|
||||||
</repository>
|
</repository>
|
||||||
|
|
||||||
|
<repository>
|
||||||
|
<id>jeff-media-public</id>
|
||||||
|
<url>https://hub.jeff-media.com/nexus/repository/jeff-media-public/</url>
|
||||||
|
</repository>
|
||||||
|
|
||||||
<repository>
|
<repository>
|
||||||
<id>pcgf-repo</id>
|
<id>pcgf-repo</id>
|
||||||
<url>https://repo.pcgamingfreaks.at/repository/maven-everything</url>
|
<url>https://repo.pcgamingfreaks.at/repository/maven-everything</url>
|
||||||
@ -202,7 +207,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>de.jeff_media</groupId>
|
<groupId>de.jeff_media</groupId>
|
||||||
<artifactId>JeffLib</artifactId>
|
<artifactId>JeffLib</artifactId>
|
||||||
<version>8.0.0-SNAPSHOT</version>
|
<version>9.0.0-SNAPSHOT</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
@ -29,7 +29,6 @@ package de.jeff_media.chestsort;
|
|||||||
|
|
||||||
import at.pcgamingfreaks.Minepacks.Bukkit.API.MinepacksPlugin;
|
import at.pcgamingfreaks.Minepacks.Bukkit.API.MinepacksPlugin;
|
||||||
import com.jeff_media.updatechecker.UpdateChecker;
|
import com.jeff_media.updatechecker.UpdateChecker;
|
||||||
import de.jeff_media.chestsort.commands.AdminCommand;
|
|
||||||
import de.jeff_media.chestsort.commands.ChestSortCommand;
|
import de.jeff_media.chestsort.commands.ChestSortCommand;
|
||||||
import de.jeff_media.chestsort.commands.InvSortCommand;
|
import de.jeff_media.chestsort.commands.InvSortCommand;
|
||||||
import de.jeff_media.chestsort.commands.TabCompleter;
|
import de.jeff_media.chestsort.commands.TabCompleter;
|
||||||
@ -48,7 +47,7 @@ import de.jeff_media.chestsort.handlers.Logger;
|
|||||||
import de.jeff_media.chestsort.hooks.EnderContainersHook;
|
import de.jeff_media.chestsort.hooks.EnderContainersHook;
|
||||||
import de.jeff_media.chestsort.hooks.GenericGUIHook;
|
import de.jeff_media.chestsort.hooks.GenericGUIHook;
|
||||||
import de.jeff_media.chestsort.hooks.PlayerVaultsHook;
|
import de.jeff_media.chestsort.hooks.PlayerVaultsHook;
|
||||||
import de.jeff_media.chestsort.listeners.Listener;
|
import de.jeff_media.chestsort.listeners.ChestSortListener;
|
||||||
import de.jeff_media.chestsort.placeholders.Placeholders;
|
import de.jeff_media.chestsort.placeholders.Placeholders;
|
||||||
import de.jeff_media.chestsort.utils.Utils;
|
import de.jeff_media.chestsort.utils.Utils;
|
||||||
import de.jeff_media.jefflib.JeffLib;
|
import de.jeff_media.jefflib.JeffLib;
|
||||||
@ -62,9 +61,7 @@ import org.bukkit.NamespacedKey;
|
|||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.HandlerList;
|
import org.bukkit.event.HandlerList;
|
||||||
import org.bukkit.plugin.Plugin;
|
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
import org.yaml.snakeyaml.Yaml;
|
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
@ -86,7 +83,7 @@ public class ChestSortPlugin extends JavaPlugin {
|
|||||||
private ArrayList<String> disabledWorlds;
|
private ArrayList<String> disabledWorlds;
|
||||||
private HashMap<UUID, Long> hotkeyCooldown;
|
private HashMap<UUID, Long> hotkeyCooldown;
|
||||||
private Logger lgr;
|
private Logger lgr;
|
||||||
private Listener listener;
|
private ChestSortListener chestSortListener;
|
||||||
// 1.14.4 = 1_14_R1
|
// 1.14.4 = 1_14_R1
|
||||||
// 1.8.0 = 1_8_R1
|
// 1.8.0 = 1_8_R1
|
||||||
private int mcMinorVersion; // 14 for 1.14, 13 for 1.13, ...
|
private int mcMinorVersion; // 14 for 1.14, 13 for 1.13, ...
|
||||||
@ -252,12 +249,12 @@ public class ChestSortPlugin extends JavaPlugin {
|
|||||||
this.lgr = lgr;
|
this.lgr = lgr;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Listener getListener() {
|
public ChestSortListener getListener() {
|
||||||
return listener;
|
return chestSortListener;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setListener(Listener listener) {
|
public void setListener(ChestSortListener chestSortListener) {
|
||||||
this.listener = listener;
|
this.chestSortListener = chestSortListener;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getMcMinorVersion() {
|
public int getMcMinorVersion() {
|
||||||
@ -492,7 +489,7 @@ public class ChestSortPlugin extends JavaPlugin {
|
|||||||
getLogger().severe("The Update Checker will NOT work when using CraftBukkit instead of Spigot/Paper!");
|
getLogger().severe("The Update Checker will NOT work when using CraftBukkit instead of Spigot/Paper!");
|
||||||
PaperLib.suggestPaper(this);
|
PaperLib.suggestPaper(this);
|
||||||
}
|
}
|
||||||
setListener(new Listener(this));
|
setListener(new ChestSortListener(this));
|
||||||
setHotkeyCooldown(new HashMap<>());
|
setHotkeyCooldown(new HashMap<>());
|
||||||
setPermissionsHandler(new ChestSortPermissionsHandler(this));
|
setPermissionsHandler(new ChestSortPermissionsHandler(this));
|
||||||
setUpdateCheckInterval(getConfig().getDouble("check-interval"));
|
setUpdateCheckInterval(getConfig().getDouble("check-interval"));
|
||||||
@ -699,7 +696,7 @@ public class ChestSortPlugin extends JavaPlugin {
|
|||||||
boolean changed;
|
boolean changed;
|
||||||
boolean hasSeenMessage;
|
boolean hasSeenMessage;
|
||||||
|
|
||||||
if (playerFile.exists() || !McVersion.isAtLeast(1,14,4)) {
|
if (playerFile.exists() || !McVersion.current().isAtLeast(1,14,4)) {
|
||||||
// If the player settings file does not exist for this player, set it to the
|
// If the player settings file does not exist for this player, set it to the
|
||||||
// default value
|
// default value
|
||||||
activeForThisPlayer = playerConfig.getBoolean("sortingEnabled");
|
activeForThisPlayer = playerConfig.getBoolean("sortingEnabled");
|
||||||
@ -715,7 +712,7 @@ public class ChestSortPlugin extends JavaPlugin {
|
|||||||
|
|
||||||
changed = true;
|
changed = true;
|
||||||
|
|
||||||
if (McVersion.isAtLeast(1,14,4)) {
|
if (McVersion.current().isAtLeast(1,14,4)) {
|
||||||
if (playerFile.delete()) {
|
if (playerFile.delete()) {
|
||||||
this.getLogger().info("Converted old .yml playerdata file to NBT tags for player " + p.getName());
|
this.getLogger().info("Converted old .yml playerdata file to NBT tags for player " + p.getName());
|
||||||
} else {
|
} else {
|
||||||
@ -752,7 +749,7 @@ public class ChestSortPlugin extends JavaPlugin {
|
|||||||
// when "show-message-again-after-logout" is enabled, we don't care if the
|
// when "show-message-again-after-logout" is enabled, we don't care if the
|
||||||
// player already saw the message
|
// player already saw the message
|
||||||
if (!getConfig().getBoolean("show-message-again-after-logout")) {
|
if (!getConfig().getBoolean("show-message-again-after-logout")) {
|
||||||
if (McVersion.isAtLeast(1,14,4) && !playerFile.exists()) {
|
if (McVersion.current().isAtLeast(1,14,4) && !playerFile.exists()) {
|
||||||
NBTAPI.getNBT(p, "hasSeenMessage", String.valueOf(false));
|
NBTAPI.getNBT(p, "hasSeenMessage", String.valueOf(false));
|
||||||
} else {
|
} else {
|
||||||
newSettings.hasSeenMessage = playerConfig.getBoolean("hasSeenMessage");
|
newSettings.hasSeenMessage = playerConfig.getBoolean("hasSeenMessage");
|
||||||
@ -926,7 +923,7 @@ public class ChestSortPlugin extends JavaPlugin {
|
|||||||
if (getPerPlayerSettings().containsKey(uniqueId.toString())) {
|
if (getPerPlayerSettings().containsKey(uniqueId.toString())) {
|
||||||
PlayerSetting setting = getPerPlayerSettings().get(p.getUniqueId().toString());
|
PlayerSetting setting = getPerPlayerSettings().get(p.getUniqueId().toString());
|
||||||
|
|
||||||
if (McVersion.isAtLeast(1,14,4)) {
|
if (McVersion.current().isAtLeast(1,14,4)) {
|
||||||
|
|
||||||
for(NamespacedKey key : p.getPersistentDataContainer().getKeys()) {
|
for(NamespacedKey key : p.getPersistentDataContainer().getKeys()) {
|
||||||
if(key.getKey().equals(new NamespacedKey(this,"test").getKey())) {
|
if(key.getKey().equals(new NamespacedKey(this,"test").getKey())) {
|
||||||
|
@ -14,45 +14,62 @@ public class AdvancedChestsHook {
|
|||||||
|
|
||||||
public AdvancedChestsHook(ChestSortPlugin plugin) {
|
public AdvancedChestsHook(ChestSortPlugin plugin) {
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
if(plugin.isHookAdvancedChests()){
|
try {
|
||||||
double version = Double.parseDouble(plugin.getServer().getPluginManager()
|
if (plugin.isHookAdvancedChests()) {
|
||||||
.getPlugin("AdvancedChests")
|
double version = Double.parseDouble(plugin.getServer().getPluginManager()
|
||||||
.getDescription().getVersion());
|
.getPlugin("AdvancedChests")
|
||||||
if(version >= 20.3) {
|
.getDescription().getVersion());
|
||||||
plugin.getLogger().info("Successfully hooked into AdvancedChests");
|
if (version >= 20.3) {
|
||||||
}else plugin.setHookAdvancedChests(false);
|
plugin.getLogger().info("Successfully hooked into AdvancedChests");
|
||||||
}
|
} else plugin.setHookAdvancedChests(false);
|
||||||
|
}
|
||||||
|
} catch (Throwable t) {
|
||||||
|
plugin.setHookAdvancedChests(false);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isAnAdvancedChest(Inventory inventory){
|
public boolean isAnAdvancedChest(Inventory inventory){
|
||||||
return plugin.isHookAdvancedChests()
|
try {
|
||||||
&& inventory != null
|
return plugin.isHookAdvancedChests()
|
||||||
&& AdvancedChestsAPI.getInventoryManager().getAdvancedChest(inventory) != null;
|
&& inventory != null
|
||||||
|
&& AdvancedChestsAPI.getInventoryManager().getAdvancedChest(inventory) != null;
|
||||||
|
} catch (Throwable ignored) {
|
||||||
|
return false; // TODO: Remove once everyone updated AC
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean handleAChestSortingIfPresent(Inventory inventory){
|
public boolean handleAChestSortingIfPresent(Inventory inventory){
|
||||||
if(!plugin.isHookAdvancedChests())return false;
|
if(!plugin.isHookAdvancedChests()) return false;
|
||||||
InteractiveInventory interactiveInventory = AdvancedChestsAPI.getInventoryManager().getInteractiveByBukkit(inventory);
|
try {
|
||||||
if(interactiveInventory != null) {
|
InteractiveInventory interactiveInventory = AdvancedChestsAPI.getInventoryManager().getInteractiveByBukkit(inventory);
|
||||||
if (interactiveInventory instanceof ChestPage) {
|
if (interactiveInventory != null) {
|
||||||
plugin.getOrganizer().sortInventory(inventory, 0, inventory.getSize() - 10);
|
if (interactiveInventory instanceof ChestPage) {
|
||||||
}
|
plugin.getOrganizer().sortInventory(inventory, 0, inventory.getSize() - 10);
|
||||||
return true;
|
}
|
||||||
}else {
|
return true;
|
||||||
return false;
|
} else {
|
||||||
}
|
return false;
|
||||||
|
}
|
||||||
|
} catch (Throwable ignored) {
|
||||||
|
return false; // TODO: Remove once everyone updated AC
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean handleAChestSortingIfPresent(Location location){
|
public boolean handleAChestSortingIfPresent(Location location){
|
||||||
if(!plugin.isHookAdvancedChests())return false;
|
if(!plugin.isHookAdvancedChests())return false;
|
||||||
AdvancedChest<?,?> chest = AdvancedChestsAPI.getChestManager().getAdvancedChest(location);
|
try {
|
||||||
if(chest != null){
|
AdvancedChest<?, ?> chest = AdvancedChestsAPI.getChestManager().getAdvancedChest(location);
|
||||||
for (ChestPage<?> page : chest.getPages()) {
|
if (chest != null) {
|
||||||
Inventory inventory = page.getBukkitInventory();
|
for (ChestPage<?> page : chest.getPages()) {
|
||||||
plugin.getOrganizer().sortInventory(inventory,0,inventory.getSize()-10);
|
Inventory inventory = page.getBukkitInventory();
|
||||||
}
|
plugin.getOrganizer().sortInventory(inventory, 0, inventory.getSize() - 10);
|
||||||
return true;
|
}
|
||||||
}
|
return true;
|
||||||
return false;
|
}
|
||||||
|
return false;
|
||||||
|
} catch (Throwable ignored) {
|
||||||
|
return false; // TODO: Remove once everyone updated AC
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,6 @@ import de.jeff_media.chestsort.data.PlayerSetting;
|
|||||||
import de.jeff_media.chestsort.hooks.*;
|
import de.jeff_media.chestsort.hooks.*;
|
||||||
import de.jeff_media.chestsort.utils.LlamaUtils;
|
import de.jeff_media.chestsort.utils.LlamaUtils;
|
||||||
import de.jeff_media.jefflib.ProtectionUtils;
|
import de.jeff_media.jefflib.ProtectionUtils;
|
||||||
import de.jeff_media.jefflib.data.ShadowPlayer;
|
|
||||||
import net.md_5.bungee.api.ChatMessageType;
|
import net.md_5.bungee.api.ChatMessageType;
|
||||||
import net.md_5.bungee.api.chat.TextComponent;
|
import net.md_5.bungee.api.chat.TextComponent;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
@ -39,7 +38,7 @@ import org.bukkit.inventory.ItemStack;
|
|||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
public class Listener implements org.bukkit.event.Listener {
|
public class ChestSortListener implements org.bukkit.event.Listener {
|
||||||
|
|
||||||
final ChestSortPlugin plugin;
|
final ChestSortPlugin plugin;
|
||||||
public final MinepacksHook minepacksHook;
|
public final MinepacksHook minepacksHook;
|
||||||
@ -49,7 +48,7 @@ public class Listener implements org.bukkit.event.Listener {
|
|||||||
|
|
||||||
private static Event ignoredEvent;
|
private static Event ignoredEvent;
|
||||||
|
|
||||||
public Listener(ChestSortPlugin plugin) {
|
public ChestSortListener(ChestSortPlugin plugin) {
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
this.minepacksHook = new MinepacksHook(plugin);
|
this.minepacksHook = new MinepacksHook(plugin);
|
||||||
this.headDatabaseHook = new HeadDatabaseHook(plugin);
|
this.headDatabaseHook = new HeadDatabaseHook(plugin);
|
||||||
@ -97,9 +96,14 @@ public class Listener implements org.bukkit.event.Listener {
|
|||||||
|
|
||||||
Container containerState = (Container) clickedBlock.getState();
|
Container containerState = (Container) clickedBlock.getState();
|
||||||
Inventory inventory = containerState.getInventory();
|
Inventory inventory = containerState.getInventory();
|
||||||
if(!advancedChestsHook.handleAChestSortingIfPresent(clickedBlock.getLocation())) {
|
|
||||||
plugin.getOrganizer().sortInventory(inventory);
|
try {
|
||||||
}
|
if (!advancedChestsHook.handleAChestSortingIfPresent(clickedBlock.getLocation())) {
|
||||||
|
plugin.getOrganizer().sortInventory(inventory);
|
||||||
|
}
|
||||||
|
} catch (Throwable ignored) {
|
||||||
|
// TODO: Remove when everyone updated AdvancedChests
|
||||||
|
}
|
||||||
event.getPlayer().spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText(Messages.MSG_CONTAINER_SORTED));
|
event.getPlayer().spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText(Messages.MSG_CONTAINER_SORTED));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -316,6 +320,10 @@ public class Listener implements org.bukkit.event.Listener {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (inventory.getHolder() != null && inventory.getHolder().getClass().getName().toLowerCase().contains("boat")) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
// Possible Fix for https://github.com/JEFF-Media-GbR/Spigot-ChestSort/issues/13
|
// Possible Fix for https://github.com/JEFF-Media-GbR/Spigot-ChestSort/issues/13
|
||||||
if (inventory.getHolder() == null) {
|
if (inventory.getHolder() == null) {
|
||||||
return false;
|
return false;
|
Loading…
Reference in New Issue
Block a user