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