mirror of
https://github.com/JEFF-Media-GbR/ChestSort.git
synced 2024-12-02 15:43:22 +01:00
8.17.7 release
This commit is contained in:
parent
127cbb2e1c
commit
0f85944e06
@ -1,5 +1,8 @@
|
||||
# Changelog
|
||||
|
||||
## 8.17.7-SNAPSHOT
|
||||
- Fixed InventoryPages hook when using colored item names
|
||||
|
||||
## 8.17.6
|
||||
- Fixed exception and hotbar being filled up with barrier blocks when using the addition right-click-hotkey on MC 1.8
|
||||
|
||||
|
2
pom.xml
2
pom.xml
@ -9,7 +9,7 @@
|
||||
<name>ChestSort</name>
|
||||
<url>https://www.chestsort.de</url>
|
||||
<description>Automatically sorts your chests!</description>
|
||||
<version>8.17.6</version>
|
||||
<version>8.17.7</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<properties>
|
||||
|
@ -86,22 +86,46 @@ public class ChestSortListener implements Listener {
|
||||
@EventHandler
|
||||
public void onPlayerInventoryClose(InventoryCloseEvent event) {
|
||||
|
||||
if(!plugin.getConfig().getBoolean("allow-automatic-inventory-sorting")) return;
|
||||
plugin.debug("Attempt to automatically sort a player inventory");
|
||||
|
||||
if (event.getInventory().getHolder() == null) return;
|
||||
if (event.getInventory().getHolder() == null) {
|
||||
plugin.debug("Abort: holder == null");
|
||||
return;
|
||||
}
|
||||
// Might be obsolete, because its @NotNull in 1.15, but who knows if thats for 1.8
|
||||
if (event.getInventory().getType() == null) return;
|
||||
if (event.getInventory().getType() != InventoryType.CRAFTING)
|
||||
if (event.getInventory().getType() == null) {
|
||||
plugin.debug("Abort: type == null");
|
||||
return;
|
||||
}
|
||||
if (event.getInventory().getType() != InventoryType.CRAFTING) {
|
||||
plugin.debug("Abort: type != CRAFTING, but "+event.getInventory().getType().name());
|
||||
return; // Weird! Returns CRAFTING instead of PLAYER
|
||||
if (!(event.getInventory().getHolder() instanceof Player)) return;
|
||||
}
|
||||
|
||||
if (!(event.getInventory().getHolder() instanceof Player)) {
|
||||
plugin.debug("Abort: holder ! instanceof Player");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if(!plugin.getConfig().getBoolean("allow-automatic-inventory-sorting")) {
|
||||
plugin.debug("allow-automatic-inventory-sorting is false");
|
||||
return;
|
||||
}
|
||||
|
||||
Player p = (Player) event.getInventory().getHolder();
|
||||
|
||||
if (!p.hasPermission("chestsort.use.inventory")) return;
|
||||
if (!p.hasPermission("chestsort.use.inventory")) {
|
||||
plugin.debug("Missing permission chestsort.use.inventory");
|
||||
return;
|
||||
}
|
||||
plugin.registerPlayerIfNeeded(p);
|
||||
|
||||
ChestSortPlayerSetting setting = plugin.perPlayerSettings.get(p.getUniqueId().toString());
|
||||
if (!setting.invSortingEnabled) return;
|
||||
if (!setting.invSortingEnabled) {
|
||||
plugin.debug("auto inv sorting not enabled for player "+p.getName());
|
||||
return;
|
||||
}
|
||||
|
||||
plugin.lgr.logSort(p, ChestSortLogger.SortCause.INV_CLOSE);
|
||||
|
||||
@ -157,6 +181,8 @@ public class ChestSortListener implements Listener {
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
public void onChestOpen(InventoryOpenEvent event) {
|
||||
|
||||
plugin.debug("onChestOpen (InventoryOpenEvent");
|
||||
|
||||
if(!plugin.getConfig().getBoolean("allow-automatic-sorting")) return;
|
||||
|
||||
if (!(plugin.getConfig().getString("sort-time").equalsIgnoreCase("open")
|
||||
|
@ -2,6 +2,7 @@ package de.jeff_media.ChestSort.hooks;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
@ -9,7 +10,6 @@ import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.PlayerInventory;
|
||||
|
||||
import de.jeff_media.ChestSort.ChestSortPlugin;
|
||||
import net.md_5.bungee.api.ChatColor;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class InventoryPagesHook {
|
||||
@ -60,20 +60,20 @@ public class InventoryPagesHook {
|
||||
}
|
||||
|
||||
// When using &f as color, we manually have to add this to the string because it gets removed by InventoryPages
|
||||
if(prevName.startsWith("§f")) prevName = prevName.substring(2);
|
||||
if(nextName.startsWith("§f")) nextName = nextName.substring(2);
|
||||
if(noPageName.startsWith("§f")) noPageName = noPageName.substring(2);
|
||||
//if(prevName.startsWith("§f")) prevName = prevName.substring(2);
|
||||
//if(nextName.startsWith("§f")) nextName = nextName.substring(2);
|
||||
//if(noPageName.startsWith("§f")) noPageName = noPageName.substring(2);
|
||||
|
||||
if(slot == prevSlot ) {
|
||||
if(item.getType() == prevMat && (item.getItemMeta().getDisplayName().equals(prevName))) {
|
||||
if(item.getType() == prevMat && (ChatColor.stripColor(item.getItemMeta().getDisplayName()).equals(ChatColor.stripColor(prevName)))) {
|
||||
return true;
|
||||
} else return item.getType() == noPageMat && item.getItemMeta().getDisplayName().equals(noPageName);
|
||||
} else return item.getType() == noPageMat && ChatColor.stripColor(item.getItemMeta().getDisplayName()).equals(ChatColor.stripColor(noPageName));
|
||||
}
|
||||
|
||||
if(slot == nextSlot ) {
|
||||
if(item.getType() == nextMat && item.getItemMeta().getDisplayName().equals(nextName)) {
|
||||
if(item.getType() == nextMat && ChatColor.stripColor(item.getItemMeta().getDisplayName()).equals(ChatColor.stripColor(nextName))) {
|
||||
return true;
|
||||
} else return item.getType() == noPageMat && item.getItemMeta().getDisplayName().equals(noPageName);
|
||||
} else return item.getType() == noPageMat && ChatColor.stripColor(item.getItemMeta().getDisplayName()).equals(ChatColor.stripColor(noPageName));
|
||||
}
|
||||
|
||||
return false;
|
||||
|
@ -1,6 +1,6 @@
|
||||
main: de.jeff_media.ChestSort.ChestSortPlugin
|
||||
name: ChestSort
|
||||
version: 8.17.6
|
||||
version: 8.17.7
|
||||
api-version: "1.13"
|
||||
description: Allows automatic chest sorting
|
||||
author: mfnalex
|
||||
|
Loading…
Reference in New Issue
Block a user