mirror of
https://github.com/JEFF-Media-GbR/ChestSort.git
synced 2024-12-02 15:43:22 +01:00
8.15.2-SNAPSHOT
This commit is contained in:
parent
d461084d5f
commit
ed7958540d
@ -1,5 +1,8 @@
|
||||
# Changelog
|
||||
|
||||
## 8.15.2
|
||||
- Added generic hook for 3rd plugin GUIs
|
||||
|
||||
## 8.15.1
|
||||
- Fixed dirt in containers being affected by the right-click hotkey even though the player had no dirt in his inventory
|
||||
|
||||
|
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.15.1</version>
|
||||
<version>8.15.2-SNAPSHOT</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<properties>
|
||||
|
@ -334,6 +334,13 @@ public class ChestSortListener implements Listener {
|
||||
|
||||
boolean isAPICall = isAPICall(event.getClickedInventory());
|
||||
|
||||
// Detect generic GUIs
|
||||
if(!isAPICall &&
|
||||
(plugin.genericHook.isPluginGUI(event.getInventory())
|
||||
|| plugin.genericHook.isPluginGUI(event.getInventory()))) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Possible fix for #57
|
||||
if (!isAPICall && (event.getClickedInventory().getHolder() != null
|
||||
&& event.getClickedInventory().getHolder() == p
|
||||
@ -445,6 +452,7 @@ public class ChestSortListener implements Listener {
|
||||
}
|
||||
|
||||
private boolean isAPICall(Inventory inv) {
|
||||
if(inv==null) return false;
|
||||
return inv.getHolder() instanceof ISortable;
|
||||
}
|
||||
|
||||
@ -497,6 +505,13 @@ public class ChestSortListener implements Listener {
|
||||
return;
|
||||
}
|
||||
|
||||
// Detect generic GUIs
|
||||
if(!isAPICall(e.getInventory()) && !isAPICall(e.getClickedInventory()) &&
|
||||
(plugin.genericHook.isPluginGUI(e.getInventory())
|
||||
|| plugin.genericHook.isPluginGUI(e.getInventory()))) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Don't sort inventories belonging to BossShopPro
|
||||
if (e.getInventory() != null && e.getInventory().getHolder() != null && e.getInventory().getHolder().getClass().getName().equalsIgnoreCase("org.black_ixx.bossshop.core.BSShopHolder")) {
|
||||
return;
|
||||
|
@ -41,6 +41,7 @@ import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
import de.jeff_media.ChestSort.hooks.GenericGUIHook;
|
||||
import de.jeff_media.PluginUpdateChecker.PluginUpdateChecker;
|
||||
import org.bstats.bukkit.Metrics;
|
||||
import org.bukkit.Bukkit;
|
||||
@ -68,7 +69,7 @@ public class ChestSortPlugin extends JavaPlugin implements de.jeff_media.ChestSo
|
||||
String sortingMethod;
|
||||
ArrayList<String> disabledWorlds;
|
||||
ChestSortAPIHandler api;
|
||||
final int currentConfigVersion = 37;
|
||||
final int currentConfigVersion = 38;
|
||||
boolean usingMatchingConfig = true;
|
||||
protected boolean debug = false;
|
||||
boolean verbose = true;
|
||||
@ -77,6 +78,8 @@ public class ChestSortPlugin extends JavaPlugin implements de.jeff_media.ChestSo
|
||||
public boolean hookCrackShot = false;
|
||||
public boolean hookInventoryPages = false;
|
||||
public boolean hookMinepacks = false;
|
||||
|
||||
public GenericGUIHook genericHook;
|
||||
|
||||
private static long updateCheckInterval = 4*60*60; // in seconds. We check on startup and every 4 hours
|
||||
|
||||
@ -125,6 +128,10 @@ public class ChestSortPlugin extends JavaPlugin implements de.jeff_media.ChestSo
|
||||
return perPlayerSettings.get(p.getUniqueId().toString()).sortingEnabled;
|
||||
}
|
||||
|
||||
public void debug(String t) {
|
||||
if(debug) getLogger().warning("[DEBUG] "+t);
|
||||
}
|
||||
|
||||
// Creates the default configuration file
|
||||
// Also checks the config-version of an already existing file. If the existing
|
||||
// config is too
|
||||
@ -199,6 +206,7 @@ public class ChestSortPlugin extends JavaPlugin implements de.jeff_media.ChestSo
|
||||
getConfig().addDefault("hook-crackshot-prefix", "crackshot_weapon");
|
||||
getConfig().addDefault("hook-inventorypages", true);
|
||||
getConfig().addDefault("hook-minepacks", true);
|
||||
getConfig().addDefault("hook-generic",true);
|
||||
|
||||
getConfig().addDefault("verbose", true); // Prints some information in onEnable()
|
||||
}
|
||||
@ -447,6 +455,8 @@ public class ChestSortPlugin extends JavaPlugin implements de.jeff_media.ChestSo
|
||||
hookMinepacks = getConfig().getBoolean("hook-minepacks")
|
||||
&& Bukkit.getPluginManager().getPlugin("Minepacks") instanceof MinepacksPlugin;
|
||||
|
||||
genericHook = new GenericGUIHook(this,getConfig().getBoolean("hook-generic"));
|
||||
|
||||
saveDefaultCategories();
|
||||
|
||||
verbose = getConfig().getBoolean("verbose");
|
||||
|
@ -0,0 +1,25 @@
|
||||
package de.jeff_media.ChestSort.hooks;
|
||||
|
||||
import de.jeff_media.ChestSort.ChestSortPlugin;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
|
||||
public class GenericGUIHook {
|
||||
|
||||
ChestSortPlugin main;
|
||||
boolean enabled;
|
||||
|
||||
public GenericGUIHook(ChestSortPlugin main, boolean enabled) {
|
||||
this.main=main;
|
||||
this.enabled=enabled;
|
||||
}
|
||||
|
||||
public boolean isPluginGUI(Inventory inv) {
|
||||
if(!enabled) return false;
|
||||
if(inv.getHolder()!=null && inv.getHolder().getClass().getName().contains("GUI")) {
|
||||
main.debug("Generic GUI detected by class name containing \"GUI\"");
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
@ -200,7 +200,8 @@ hook-headdatabase: true
|
||||
# 3rd party plugin's GUI and then prevents it from being sorted.
|
||||
# If you encounter any problems, like a sortable GUI inventory,
|
||||
# please open a new issue at Github:
|
||||
# https://github.com/JEFF-Media-GbR/Spigot-ChestSort/issues
|
||||
# https://github.com/JEFF-Media-GbR/Spigot-ChestSort/issues
|
||||
hook-generic: true
|
||||
|
||||
##########################
|
||||
##### Sorting Method #####
|
||||
@ -576,4 +577,4 @@ log: false
|
||||
|
||||
# Please DO NOT change the following line manually!
|
||||
# It is used by the automatic config updater.
|
||||
config-version: 37
|
||||
config-version: 38
|
||||
|
@ -1,6 +1,6 @@
|
||||
main: de.jeff_media.ChestSort.ChestSortPlugin
|
||||
name: ChestSort
|
||||
version: 8.15.1
|
||||
version: 8.15.2-SNAPSHOT
|
||||
api-version: "1.13"
|
||||
description: Allows automatic chest sorting
|
||||
author: mfnalex
|
||||
|
Loading…
Reference in New Issue
Block a user