mirror of
https://github.com/JEFF-Media-GbR/ChestSort.git
synced 2025-01-21 07:31:58 +01:00
8.6 update
This commit is contained in:
parent
e47b5ef4ff
commit
b760ab4290
@ -1,4 +1,7 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
## 8.6
|
||||||
|
- Added support for Minepacks
|
||||||
|
|
||||||
## 8.5
|
## 8.5
|
||||||
- Prevent Right-Click-Hotkey from putting items in the hotbar
|
- Prevent Right-Click-Hotkey from putting items in the hotbar
|
||||||
- Fixed InventoryPages support: when using &f at the beginning of button names, it was not detected by ChestSort as button
|
- Fixed InventoryPages support: when using &f at the beginning of button names, it was not detected by ChestSort as button
|
||||||
|
@ -131,6 +131,12 @@ All CrackShot weapons will be grouped together and will be put into the default
|
|||||||
[B]InventoryPages[/B]
|
[B]InventoryPages[/B]
|
||||||
ChestSort will ignore the "Next Page" and "Prev. Page" buttons when you have InventoryPages installed, so that your GUI does not get messed up.
|
ChestSort will ignore the "Next Page" and "Prev. Page" buttons when you have InventoryPages installed, so that your GUI does not get messed up.
|
||||||
|
|
||||||
|
[B]Better Shulker Boxes / Minepacks / ShulkerPacks[/B][/SIZE]
|
||||||
|
[SIZE=4]Sort your backpacks just like every other chest! Should work with almost every backpack plugin.
|
||||||
|
|
||||||
|
[B]Plugins using GUI inventories[/B]
|
||||||
|
ChestSort tries to detect GUI inventories created by 3rd party plugins. If this detection fails, please message me at GitHub so that I can add support for that plugin.
|
||||||
|
|
||||||
[SIZE=6]API for plugin developers[/SIZE][/SIZE]
|
[SIZE=6]API for plugin developers[/SIZE][/SIZE]
|
||||||
[SIZE=4]ChestSort provides a method to sort any Inventory instance, using the advanced grouping features that ChestSort provides! Read more about the API [URL='https://github.com/JEFF-Media-GbR/Spigot-ChestSort/blob/master/HOW_TO_USE_API.md']here[/URL].
|
[SIZE=4]ChestSort provides a method to sort any Inventory instance, using the advanced grouping features that ChestSort provides! Read more about the API [URL='https://github.com/JEFF-Media-GbR/Spigot-ChestSort/blob/master/HOW_TO_USE_API.md']here[/URL].
|
||||||
|
|
||||||
|
19
pom.xml
19
pom.xml
@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
<groupId>de.jeffclan</groupId>
|
<groupId>de.jeffclan</groupId>
|
||||||
<artifactId>JeffChestSort</artifactId>
|
<artifactId>JeffChestSort</artifactId>
|
||||||
<version>8.5</version>
|
<version>8.6</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<name>JeffChestSort</name>
|
<name>JeffChestSort</name>
|
||||||
@ -77,6 +77,10 @@
|
|||||||
<id>CodeMC</id>
|
<id>CodeMC</id>
|
||||||
<url>https://repo.codemc.org/repository/maven-public</url>
|
<url>https://repo.codemc.org/repository/maven-public</url>
|
||||||
</repository>
|
</repository>
|
||||||
|
<repository>
|
||||||
|
<id>pcgf-repo</id>
|
||||||
|
<url>https://repo.pcgamingfreaks.at/repository/maven-everything</url>
|
||||||
|
</repository>
|
||||||
</repositories>
|
</repositories>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
@ -86,12 +90,8 @@
|
|||||||
<version>1.15.2-R0.1-SNAPSHOT</version>
|
<version>1.15.2-R0.1-SNAPSHOT</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!-- <dependency>
|
<!-- <dependency> <groupId>net.md-5</groupId> <artifactId>bungeecord-api</artifactId>
|
||||||
<groupId>net.md-5</groupId>
|
<version>1.15-SNAPSHOT</version> <scope>compile</scope> </dependency> -->
|
||||||
<artifactId>bungeecord-api</artifactId>
|
|
||||||
<version>1.15-SNAPSHOT</version>
|
|
||||||
<scope>compile</scope>
|
|
||||||
</dependency>-->
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.bstats</groupId>
|
<groupId>org.bstats</groupId>
|
||||||
<artifactId>bstats-bukkit</artifactId>
|
<artifactId>bstats-bukkit</artifactId>
|
||||||
@ -105,6 +105,11 @@
|
|||||||
<scope>system</scope>
|
<scope>system</scope>
|
||||||
<systemPath>${project.basedir}/lib/CrackShot.jar</systemPath>
|
<systemPath>${project.basedir}/lib/CrackShot.jar</systemPath>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>at.pcgamingfreaks</groupId>
|
||||||
|
<artifactId>Minepacks-API</artifactId>
|
||||||
|
<version>2.2</version><!-- Check api-version shield for newest version -->
|
||||||
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
<description>Automatically sorts your chests!</description>
|
<description>Automatically sorts your chests!</description>
|
||||||
|
@ -1,58 +0,0 @@
|
|||||||
package de.jeffclan.JeffChestSort;
|
|
||||||
|
|
||||||
import org.bukkit.block.Block;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.event.EventHandler;
|
|
||||||
import org.bukkit.event.Listener;
|
|
||||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
|
||||||
import org.bukkit.event.inventory.InventoryType;
|
|
||||||
|
|
||||||
public class JeffChestSortAdditionalHotkeyListener implements Listener {
|
|
||||||
|
|
||||||
JeffChestSortPlugin plugin;
|
|
||||||
|
|
||||||
public JeffChestSortAdditionalHotkeyListener(JeffChestSortPlugin jeffChestSortPlugin) {
|
|
||||||
this.plugin = jeffChestSortPlugin;
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
public void onInventoryClickEvent(InventoryClickEvent e) {
|
|
||||||
if(!plugin.getConfig().getBoolean("allow-hotkeys")) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if(!(e.getWhoClicked() instanceof Player)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Player p = (Player) e.getWhoClicked();
|
|
||||||
// Only continue if clicked outside of the chest
|
|
||||||
if(e.getClickedInventory()!=null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// Possible fix for #57
|
|
||||||
if(e.getInventory().getHolder()==null) return;
|
|
||||||
if(e.getInventory().getHolder() == p && e.getInventory() != p.getInventory()) return;
|
|
||||||
// End Possible fix for #57
|
|
||||||
if(e.getInventory().getType() != InventoryType.CHEST
|
|
||||||
&& e.getInventory().getType() != InventoryType.DISPENSER
|
|
||||||
&& e.getInventory().getType() != InventoryType.DROPPER
|
|
||||||
&& e.getInventory().getType() != InventoryType.ENDER_CHEST
|
|
||||||
&& !e.getInventory().getType().name().equalsIgnoreCase("SHULKER_BOX")
|
|
||||||
&& (e.getInventory().getHolder() == null || !e.getInventory().getHolder().getClass().toString().endsWith(".CraftBarrel"))) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!p.hasPermission("chestsort.use")) return;
|
|
||||||
|
|
||||||
plugin.registerPlayerIfNeeded(p);
|
|
||||||
JeffChestSortPlayerSetting setting = plugin.perPlayerSettings.get(p.getUniqueId().toString());
|
|
||||||
|
|
||||||
if(e.isLeftClick() && setting.leftClick) {
|
|
||||||
plugin.organizer.stuffPlayerInventoryIntoAnother(p.getInventory(), e.getInventory());
|
|
||||||
plugin.sortInventory(e.getInventory());
|
|
||||||
plugin.organizer.updateInventoryView(e.getInventory());
|
|
||||||
} else if(e.isRightClick() && setting.rightClick) {
|
|
||||||
plugin.organizer.stuffInventoryIntoAnother(e.getInventory(), p.getInventory(),e.getInventory());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -5,9 +5,6 @@ import org.bukkit.command.CommandExecutor;
|
|||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import de.jeffclan.JeffChestSort.JeffChestSortPlayerSetting;
|
|
||||||
import de.jeffclan.JeffChestSort.JeffChestSortPlugin;
|
|
||||||
|
|
||||||
public class JeffChestSortChestSortCommand implements CommandExecutor {
|
public class JeffChestSortChestSortCommand implements CommandExecutor {
|
||||||
|
|
||||||
JeffChestSortPlugin plugin;
|
JeffChestSortPlugin plugin;
|
||||||
|
@ -4,15 +4,12 @@ import org.bukkit.GameMode;
|
|||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.block.Chest;
|
import org.bukkit.block.Chest;
|
||||||
import org.bukkit.block.DoubleChest;
|
import org.bukkit.block.DoubleChest;
|
||||||
import org.bukkit.entity.HumanEntity;
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.EventPriority;
|
import org.bukkit.event.EventPriority;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.event.inventory.ClickType;
|
|
||||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||||
import org.bukkit.event.inventory.InventoryCloseEvent;
|
import org.bukkit.event.inventory.InventoryCloseEvent;
|
||||||
import org.bukkit.event.inventory.InventoryEvent;
|
|
||||||
import org.bukkit.event.inventory.InventoryOpenEvent;
|
import org.bukkit.event.inventory.InventoryOpenEvent;
|
||||||
import org.bukkit.event.inventory.InventoryType.SlotType;
|
import org.bukkit.event.inventory.InventoryType.SlotType;
|
||||||
import org.bukkit.event.inventory.InventoryType;
|
import org.bukkit.event.inventory.InventoryType;
|
||||||
@ -21,12 +18,16 @@ import org.bukkit.event.player.PlayerQuitEvent;
|
|||||||
import org.bukkit.inventory.Inventory;
|
import org.bukkit.inventory.Inventory;
|
||||||
import org.bukkit.inventory.InventoryHolder;
|
import org.bukkit.inventory.InventoryHolder;
|
||||||
|
|
||||||
|
import de.jeffclan.hooks.MinepacksHook;
|
||||||
|
|
||||||
public class JeffChestSortListener implements Listener {
|
public class JeffChestSortListener implements Listener {
|
||||||
|
|
||||||
JeffChestSortPlugin plugin;
|
JeffChestSortPlugin plugin;
|
||||||
|
MinepacksHook minepacksHook;
|
||||||
|
|
||||||
JeffChestSortListener(JeffChestSortPlugin plugin) {
|
JeffChestSortListener(JeffChestSortPlugin plugin) {
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
|
this.minepacksHook = new MinepacksHook(plugin);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
@ -51,6 +52,29 @@ public class JeffChestSortListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onBackPackClose(InventoryCloseEvent event) {
|
||||||
|
if(plugin.getConfig().getString("sort-time").equalsIgnoreCase("close")
|
||||||
|
|| plugin.getConfig().getString("sort-time").equalsIgnoreCase("both"))
|
||||||
|
onBackPackUse(event.getInventory(),(Player)event.getPlayer());
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onBackPackOpen(InventoryOpenEvent event) {
|
||||||
|
if(plugin.getConfig().getString("sort-time").equalsIgnoreCase("open")
|
||||||
|
|| plugin.getConfig().getString("sort-time").equalsIgnoreCase("both"))
|
||||||
|
onBackPackUse(event.getInventory(),(Player)event.getPlayer());
|
||||||
|
}
|
||||||
|
|
||||||
|
void onBackPackUse(Inventory inv, Player p) {
|
||||||
|
if(!minepacksHook.isMinepacksBackpack(inv)) return;
|
||||||
|
if(!p.hasPermission("chestsort.use")) return;
|
||||||
|
plugin.registerPlayerIfNeeded(p);
|
||||||
|
JeffChestSortPlayerSetting setting = plugin.perPlayerSettings.get(p.getUniqueId().toString());
|
||||||
|
if(!setting.sortingEnabled) return;
|
||||||
|
plugin.organizer.sortInventory(inv);
|
||||||
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPlayerInventoryClose(InventoryCloseEvent event) {
|
public void onPlayerInventoryClose(InventoryCloseEvent event) {
|
||||||
if(event.getInventory()==null) return;
|
if(event.getInventory()==null) return;
|
||||||
@ -58,6 +82,7 @@ public class JeffChestSortListener implements Listener {
|
|||||||
if(event.getInventory().getType() == null) return;
|
if(event.getInventory().getType() == null) return;
|
||||||
if(event.getInventory().getType() != InventoryType.CRAFTING) return; // Weird! Returns CRAFTING instead of PLAYER
|
if(event.getInventory().getType() != InventoryType.CRAFTING) return; // Weird! Returns CRAFTING instead of PLAYER
|
||||||
if(!(event.getInventory().getHolder() instanceof Player)) return;
|
if(!(event.getInventory().getHolder() instanceof Player)) return;
|
||||||
|
|
||||||
Player p = (Player) event.getInventory().getHolder();
|
Player p = (Player) event.getInventory().getHolder();
|
||||||
|
|
||||||
if(!p.hasPermission("chestsort.use.inventory")) return;
|
if(!p.hasPermission("chestsort.use.inventory")) return;
|
||||||
@ -294,13 +319,11 @@ public class JeffChestSortListener implements Listener {
|
|||||||
if(event.getClickedInventory() == setting.guiInventory) {
|
if(event.getClickedInventory() == setting.guiInventory) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Prevent player from putting items into GUI inventory
|
// Prevent player from putting items into GUI inventory
|
||||||
if(event.getInventory() == setting.guiInventory) {
|
if(event.getInventory() == setting.guiInventory) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch(event.getClick()) {
|
switch(event.getClick()) {
|
||||||
case MIDDLE:
|
case MIDDLE:
|
||||||
//if(plugin.getConfig().getBoolean("hotkeys.middle-click")) {
|
//if(plugin.getConfig().getBoolean("hotkeys.middle-click")) {
|
||||||
@ -340,18 +363,17 @@ public class JeffChestSortListener implements Listener {
|
|||||||
if(!sort) {
|
if(!sort) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if(belongsToChestLikeBlock(event.getClickedInventory()) || minepacksHook.isMinepacksBackpack(event.getClickedInventory())) {
|
||||||
if(belongsToChestLikeBlock(event.getClickedInventory())) {
|
|
||||||
|
|
||||||
if(!p.hasPermission("chestsort.use")) {
|
if(!p.hasPermission("chestsort.use")) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
plugin.organizer.sortInventory(event.getClickedInventory());
|
plugin.organizer.sortInventory(event.getClickedInventory());
|
||||||
plugin.organizer.updateInventoryView(event);
|
plugin.organizer.updateInventoryView(event);
|
||||||
return;
|
return;
|
||||||
} else if(holder instanceof Player) {
|
} else if(holder instanceof Player) {
|
||||||
|
|
||||||
if(!p.hasPermission("chestsort.use.inventory")) {
|
if(!p.hasPermission("chestsort.use.inventory")) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -370,6 +392,49 @@ public class JeffChestSortListener implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onAdditionalHotkeys(InventoryClickEvent e) {
|
||||||
|
// Backpacks must not go into backpacks, however I am unsure on how to
|
||||||
|
// check if something is a backpack, so will just disable the fill-chest hotkey
|
||||||
|
if(minepacksHook.isMinepacksBackpack(e.getInventory())) return;
|
||||||
|
if(!plugin.getConfig().getBoolean("allow-hotkeys")) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if(!(e.getWhoClicked() instanceof Player)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Player p = (Player) e.getWhoClicked();
|
||||||
|
// Only continue if clicked outside of the chest
|
||||||
|
if(e.getClickedInventory()!=null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// Possible fix for #57
|
||||||
|
if(e.getInventory().getHolder()==null) return;
|
||||||
|
if(e.getInventory().getHolder() == p && e.getInventory() != p.getInventory()) return;
|
||||||
|
// End Possible fix for #57
|
||||||
|
if(e.getInventory().getType() != InventoryType.CHEST
|
||||||
|
&& e.getInventory().getType() != InventoryType.DISPENSER
|
||||||
|
&& e.getInventory().getType() != InventoryType.DROPPER
|
||||||
|
&& e.getInventory().getType() != InventoryType.ENDER_CHEST
|
||||||
|
&& !e.getInventory().getType().name().equalsIgnoreCase("SHULKER_BOX")
|
||||||
|
&& (e.getInventory().getHolder() == null || !e.getInventory().getHolder().getClass().toString().endsWith(".CraftBarrel"))) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!p.hasPermission("chestsort.use")) return;
|
||||||
|
|
||||||
|
plugin.registerPlayerIfNeeded(p);
|
||||||
|
JeffChestSortPlayerSetting setting = plugin.perPlayerSettings.get(p.getUniqueId().toString());
|
||||||
|
|
||||||
|
if(e.isLeftClick() && setting.leftClick) {
|
||||||
|
plugin.organizer.stuffPlayerInventoryIntoAnother(p.getInventory(), e.getInventory());
|
||||||
|
plugin.sortInventory(e.getInventory());
|
||||||
|
plugin.organizer.updateInventoryView(e.getInventory());
|
||||||
|
} else if(e.isRightClick() && setting.rightClick) {
|
||||||
|
plugin.organizer.stuffInventoryIntoAnother(e.getInventory(), p.getInventory(),e.getInventory());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -50,6 +50,7 @@ import org.bukkit.inventory.Inventory;
|
|||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
|
import at.pcgamingfreaks.Minepacks.Bukkit.API.MinepacksPlugin;
|
||||||
import de.jeffclan.utils.Utils;
|
import de.jeffclan.utils.Utils;
|
||||||
|
|
||||||
public class JeffChestSortPlugin extends JavaPlugin {
|
public class JeffChestSortPlugin extends JavaPlugin {
|
||||||
@ -59,11 +60,10 @@ public class JeffChestSortPlugin extends JavaPlugin {
|
|||||||
JeffChestSortOrganizer organizer;
|
JeffChestSortOrganizer organizer;
|
||||||
JeffChestSortUpdateChecker updateChecker;
|
JeffChestSortUpdateChecker updateChecker;
|
||||||
JeffChestSortListener listener;
|
JeffChestSortListener listener;
|
||||||
JeffChestSortAdditionalHotkeyListener additionalHotkeys;
|
|
||||||
JeffChestSortSettingsGUI settingsGUI;
|
JeffChestSortSettingsGUI settingsGUI;
|
||||||
String sortingMethod;
|
String sortingMethod;
|
||||||
ArrayList<String> disabledWorlds;
|
ArrayList<String> disabledWorlds;
|
||||||
int currentConfigVersion = 27;
|
int currentConfigVersion = 28;
|
||||||
boolean usingMatchingConfig = true;
|
boolean usingMatchingConfig = true;
|
||||||
protected boolean debug = false;
|
protected boolean debug = false;
|
||||||
boolean verbose = true;
|
boolean verbose = true;
|
||||||
@ -71,6 +71,7 @@ public class JeffChestSortPlugin extends JavaPlugin {
|
|||||||
|
|
||||||
public boolean hookCrackShot = false;
|
public boolean hookCrackShot = false;
|
||||||
public boolean hookInventoryPages = false;
|
public boolean hookInventoryPages = false;
|
||||||
|
public boolean hookMinepacks = false;
|
||||||
|
|
||||||
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
|
||||||
|
|
||||||
@ -169,6 +170,7 @@ public class JeffChestSortPlugin extends JavaPlugin {
|
|||||||
getConfig().addDefault("hook-crackshot", true);
|
getConfig().addDefault("hook-crackshot", true);
|
||||||
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("verbose", true); // Prints some information in onEnable()
|
getConfig().addDefault("verbose", true); // Prints some information in onEnable()
|
||||||
}
|
}
|
||||||
@ -227,6 +229,11 @@ public class JeffChestSortPlugin extends JavaPlugin {
|
|||||||
hookInventoryPages=true;
|
hookInventoryPages=true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if(getConfig().getBoolean("hook-minepacks")) {
|
||||||
|
if(Bukkit.getPluginManager().getPlugin("Minepacks") instanceof MinepacksPlugin) {
|
||||||
|
hookMinepacks=true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
debug = getConfig().getBoolean("debug");
|
debug = getConfig().getBoolean("debug");
|
||||||
|
|
||||||
@ -254,14 +261,12 @@ public class JeffChestSortPlugin extends JavaPlugin {
|
|||||||
// the Organizer to sort inventories when a player closes a chest, shulkerbox or
|
// the Organizer to sort inventories when a player closes a chest, shulkerbox or
|
||||||
// barrel inventory
|
// barrel inventory
|
||||||
listener = new JeffChestSortListener(this);
|
listener = new JeffChestSortListener(this);
|
||||||
additionalHotkeys = new JeffChestSortAdditionalHotkeyListener(this);
|
|
||||||
|
|
||||||
// The sorting method will determine how stuff is sorted
|
// The sorting method will determine how stuff is sorted
|
||||||
sortingMethod = getConfig().getString("sorting-method");
|
sortingMethod = getConfig().getString("sorting-method");
|
||||||
|
|
||||||
// Register the events for our Listener
|
// Register the events for our Listener
|
||||||
getServer().getPluginManager().registerEvents(listener, this);
|
getServer().getPluginManager().registerEvents(listener, this);
|
||||||
getServer().getPluginManager().registerEvents(additionalHotkeys, this);
|
|
||||||
|
|
||||||
// Register events for the GUI interaction
|
// Register events for the GUI interaction
|
||||||
getServer().getPluginManager().registerEvents(settingsGUI, this);
|
getServer().getPluginManager().registerEvents(settingsGUI, this);
|
||||||
|
47
src/main/java/de/jeffclan/hooks/MinepacksHook.java
Normal file
47
src/main/java/de/jeffclan/hooks/MinepacksHook.java
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
package de.jeffclan.hooks;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.inventory.Inventory;
|
||||||
|
import org.bukkit.plugin.Plugin;
|
||||||
|
|
||||||
|
import at.pcgamingfreaks.Minepacks.Bukkit.API.MinepacksPlugin;
|
||||||
|
import de.jeffclan.JeffChestSort.JeffChestSortPlugin;
|
||||||
|
|
||||||
|
public class MinepacksHook {
|
||||||
|
|
||||||
|
JeffChestSortPlugin plugin;
|
||||||
|
MinepacksPlugin minepacks = null;
|
||||||
|
|
||||||
|
public MinepacksHook(JeffChestSortPlugin plugin) {
|
||||||
|
this.plugin = plugin;
|
||||||
|
Plugin bukkitPlugin = Bukkit.getPluginManager().getPlugin("Minepacks");
|
||||||
|
if(plugin.hookMinepacks && bukkitPlugin instanceof MinepacksPlugin) {
|
||||||
|
// Do something if Minepacks is not available
|
||||||
|
minepacks = (MinepacksPlugin) bukkitPlugin;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isMinepacksBackpack(Inventory inv) {
|
||||||
|
|
||||||
|
if(minepacks == null) return false;
|
||||||
|
|
||||||
|
if( inv.getHolder() == null) return false;
|
||||||
|
|
||||||
|
if( inv.getHolder().getClass().getName().equalsIgnoreCase("at.pcgamingfreaks.MinepacksStandalone.Bukkit.Backpack")) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
|
||||||
|
//System.out.println(inv.getHolder().getClass().getName());
|
||||||
|
|
||||||
|
/*if(inv.getHolder() instanceof Backpack) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(minepacks.getBackpackCachedOnly(p).getInventory() == inv) {
|
||||||
|
return true;
|
||||||
|
}*/
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -144,22 +144,43 @@ disabled-worlds:
|
|||||||
# installed. ChestSort will automatically check if the plugins
|
# installed. ChestSort will automatically check if the plugins
|
||||||
# are installed.
|
# are installed.
|
||||||
|
|
||||||
##### CrackShot #####
|
##### CrackShot ##### -> https://www.spigotmc.org/resources/crackshot-guns.48301/
|
||||||
# When CrackShot is installed, all CrackShot weapons will be
|
# When CrackShot is installed, all CrackShot weapons will be
|
||||||
# grouped together and sorted by their name
|
# grouped together and sorted by their name
|
||||||
hook-crackshot: true
|
hook-crackshot: true
|
||||||
|
|
||||||
# You can define a custom name that will be used as prefix
|
# You can define a custom name that will be used as prefix
|
||||||
# for all CrackShot weapon names.
|
# for all CrackShot weapon names.
|
||||||
# E.g. when you set this to "crackshot_weapon", an AK-47
|
# E.g. when you set this to "crackshot_weapon", an AK-47
|
||||||
# will be called "crackshot_weapon_AK-47"
|
# will be called "crackshot_weapon_AK-47"
|
||||||
hook-crackshot-prefix: "crackshot_weapon"
|
hook-crackshot-prefix: "crackshot_weapon"
|
||||||
|
|
||||||
##### InventoryPages #####
|
##### InventoryPages ##### -> https://www.spigotmc.org/resources/inventorypages.32432/
|
||||||
# When InventoryPages is installed, ChestSort will not sort
|
# When InventoryPages is installed, ChestSort will not sort
|
||||||
# the "Next Page" and "Prev Page" buttons. You should not
|
# the "Next Page" and "Prev Page" buttons. You should not
|
||||||
# disable this behaviour unless you know what you are doing!
|
# disable this behaviour unless you know what you are doing!
|
||||||
hook-inventorypages: true
|
hook-inventorypages: true
|
||||||
|
|
||||||
|
##### Minepacks ##### -> https://www.spigotmc.org/resources/minepacks-backpack-plugin-mc-1-7-1-15.19286/
|
||||||
|
# When Minepacks is installed, ChestSort can detect your
|
||||||
|
# backpacks and sort them like a regular chest. Please note
|
||||||
|
# that the left-click and right-click hotkey will not work
|
||||||
|
# with a Minepack backpack to avoid the possibility of
|
||||||
|
# putting a backpack inside of itself.
|
||||||
|
hook-minepacks: true
|
||||||
|
|
||||||
|
##### Other backpack plugins #####
|
||||||
|
# ChestSort is able to detect backpacks from most backpack
|
||||||
|
# plugins like ShulkerPacks or Better Shulker Boxes.
|
||||||
|
# This detection is always enabled, you cannot turn it off.
|
||||||
|
|
||||||
|
##### Other GUI plugins #####
|
||||||
|
# ChestSort tries to detect if an inventory belongs to a
|
||||||
|
# 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
|
||||||
|
|
||||||
##########################
|
##########################
|
||||||
##### Sorting Method #####
|
##### Sorting Method #####
|
||||||
##########################
|
##########################
|
||||||
@ -526,4 +547,4 @@ debug: 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: 27
|
config-version: 28
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
main: de.jeffclan.JeffChestSort.JeffChestSortPlugin
|
main: de.jeffclan.JeffChestSort.JeffChestSortPlugin
|
||||||
name: ChestSort
|
name: ChestSort
|
||||||
version: 8.5
|
version: 8.6
|
||||||
api-version: 1.13
|
api-version: 1.13
|
||||||
description: Allows automatic chest sorting
|
description: Allows automatic chest sorting
|
||||||
author: mfnalex
|
author: mfnalex
|
||||||
@ -8,7 +8,7 @@ website: https://www.chestsort.de
|
|||||||
prefix: ChestSort
|
prefix: ChestSort
|
||||||
database: false
|
database: false
|
||||||
loadbefore: [InvUnload]
|
loadbefore: [InvUnload]
|
||||||
softdepend: [CrackShot, InventoryPages]
|
softdepend: [CrackShot, InventoryPages,Minepacks]
|
||||||
commands:
|
commands:
|
||||||
chestsort:
|
chestsort:
|
||||||
description: Toggle automatic chest sorting.
|
description: Toggle automatic chest sorting.
|
||||||
|
Loading…
Reference in New Issue
Block a user