mirror of
https://github.com/JEFF-Media-GbR/ChestSort.git
synced 2025-02-18 13:21:29 +01:00
changed class and package names
This commit is contained in:
parent
d105854dd0
commit
192cadbfb0
@ -1,4 +1,6 @@
|
||||
# Changelog
|
||||
## 8.8-pre1
|
||||
- Changed class names and moved API to its own class - can be accessed via ChestSortPlugin#getAPI()
|
||||
## 8.7
|
||||
- When using Minepacks, the backpack item in the inventory will not be moved
|
||||
- Added use-permissions option. If you do not use a permissions plugin, you can set this to false to allow every player to use ChestSort
|
||||
|
29
src/main/java/de/jeff_media/ChestSort/ChestSortAPI.java
Normal file
29
src/main/java/de/jeff_media/ChestSort/ChestSortAPI.java
Normal file
@ -0,0 +1,29 @@
|
||||
package de.jeff_media.ChestSort;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
|
||||
public class ChestSortAPI {
|
||||
|
||||
ChestSortPlugin plugin;
|
||||
|
||||
ChestSortAPI(ChestSortPlugin plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
// Public API method to sort any given inventory
|
||||
public void sortInventory(Inventory inv) {
|
||||
plugin.organizer.sortInventory(inv);
|
||||
}
|
||||
|
||||
// Public API method to sort any given inventory inbetween startSlot and endSlot
|
||||
public void sortInventory(Inventory inv, int startSlot, int endSlot) {
|
||||
plugin.organizer.sortInventory(inv, startSlot, endSlot);
|
||||
}
|
||||
|
||||
// Public API method to check if player has automatic chest sorting enabled
|
||||
public boolean sortingEnabled(Player p) {
|
||||
return plugin.isSortingEnabled(p);
|
||||
}
|
||||
|
||||
}
|
@ -1,8 +1,8 @@
|
||||
package de.jeffclan.JeffChestSort;
|
||||
package de.jeff_media.ChestSort;
|
||||
|
||||
import de.jeffclan.utils.TypeMatchPositionPair;
|
||||
import de.jeff_media.ChestSort.utils.TypeMatchPositionPair;
|
||||
|
||||
public class JeffChestSortCategory implements Comparable<JeffChestSortCategory>{
|
||||
public class ChestSortCategory implements Comparable<ChestSortCategory>{
|
||||
|
||||
// Represents a sorting category
|
||||
// Includes an array of strings called typeMatches
|
||||
@ -16,7 +16,7 @@ public class JeffChestSortCategory implements Comparable<JeffChestSortCategory>{
|
||||
boolean sticky = false;
|
||||
TypeMatchPositionPair[] typeMatches;
|
||||
|
||||
JeffChestSortCategory(String name, TypeMatchPositionPair[] typeMatchPositionPairs) {
|
||||
ChestSortCategory(String name, TypeMatchPositionPair[] typeMatchPositionPairs) {
|
||||
this.name = name;
|
||||
this.typeMatches = typeMatchPositionPairs;
|
||||
}
|
||||
@ -70,7 +70,7 @@ public class JeffChestSortCategory implements Comparable<JeffChestSortCategory>{
|
||||
return 0;
|
||||
}
|
||||
|
||||
public int compareTo(JeffChestSortCategory compareCategory) {
|
||||
public int compareTo(ChestSortCategory compareCategory) {
|
||||
return this.name.compareTo(compareCategory.name);
|
||||
}
|
||||
|
@ -1,15 +1,15 @@
|
||||
package de.jeffclan.JeffChestSort;
|
||||
package de.jeff_media.ChestSort;
|
||||
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class JeffChestSortChestSortCommand implements CommandExecutor {
|
||||
public class ChestSortChestSortCommand implements CommandExecutor {
|
||||
|
||||
JeffChestSortPlugin plugin;
|
||||
ChestSortPlugin plugin;
|
||||
|
||||
JeffChestSortChestSortCommand(JeffChestSortPlugin plugin) {
|
||||
ChestSortChestSortCommand(ChestSortPlugin plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@ -57,7 +57,7 @@ public class JeffChestSortChestSortCommand implements CommandExecutor {
|
||||
}
|
||||
// Settings GUI End
|
||||
|
||||
JeffChestSortPlayerSetting setting = plugin.perPlayerSettings.get(p.getUniqueId().toString());
|
||||
ChestSortPlayerSetting setting = plugin.perPlayerSettings.get(p.getUniqueId().toString());
|
||||
|
||||
if(args.length>0
|
||||
&& !args[0].equalsIgnoreCase("toggle")
|
@ -1,4 +1,4 @@
|
||||
package de.jeffclan.JeffChestSort;
|
||||
package de.jeff_media.ChestSort;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
@ -12,13 +12,13 @@ import org.bukkit.configuration.InvalidConfigurationException;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
|
||||
import de.jeffclan.utils.Utils;
|
||||
import de.jeff_media.ChestSort.utils.Utils;
|
||||
|
||||
public class JeffChestSortConfigUpdater {
|
||||
public class ChestSortConfigUpdater {
|
||||
|
||||
JeffChestSortPlugin plugin;
|
||||
ChestSortPlugin plugin;
|
||||
|
||||
public JeffChestSortConfigUpdater(JeffChestSortPlugin jeffChestSortPlugin) {
|
||||
public ChestSortConfigUpdater(ChestSortPlugin jeffChestSortPlugin) {
|
||||
this.plugin = jeffChestSortPlugin;
|
||||
}
|
||||
|
@ -1,15 +1,15 @@
|
||||
package de.jeffclan.JeffChestSort;
|
||||
package de.jeff_media.ChestSort;
|
||||
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class JeffChestSortInvSortCommand implements CommandExecutor {
|
||||
public class ChestSortInvSortCommand implements CommandExecutor {
|
||||
|
||||
JeffChestSortPlugin plugin;
|
||||
ChestSortPlugin plugin;
|
||||
|
||||
JeffChestSortInvSortCommand(JeffChestSortPlugin plugin) {
|
||||
ChestSortInvSortCommand(ChestSortPlugin plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@ -31,7 +31,7 @@ public class JeffChestSortInvSortCommand implements CommandExecutor {
|
||||
int start = 9;
|
||||
int end = 35;
|
||||
|
||||
JeffChestSortPlayerSetting setting = plugin.perPlayerSettings.get(p.getUniqueId().toString());
|
||||
ChestSortPlayerSetting setting = plugin.perPlayerSettings.get(p.getUniqueId().toString());
|
||||
|
||||
if(args.length>0) {
|
||||
if(args[0].equalsIgnoreCase("all")) {
|
||||
@ -66,7 +66,7 @@ public class JeffChestSortInvSortCommand implements CommandExecutor {
|
||||
}
|
||||
}
|
||||
|
||||
plugin.sortInventory(p.getInventory(), start, end);
|
||||
plugin.organizer.sortInventory(p.getInventory(), start, end);
|
||||
p.sendMessage(plugin.messages.MSG_PLAYERINVSORTED);
|
||||
|
||||
return true;
|
@ -1,4 +1,4 @@
|
||||
package de.jeffclan.JeffChestSort;
|
||||
package de.jeff_media.ChestSort;
|
||||
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Material;
|
||||
@ -18,14 +18,14 @@ import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.InventoryHolder;
|
||||
|
||||
import de.jeffclan.hooks.MinepacksHook;
|
||||
import de.jeff_media.ChestSort.hooks.MinepacksHook;
|
||||
|
||||
public class JeffChestSortListener implements Listener {
|
||||
public class ChestSortListener implements Listener {
|
||||
|
||||
JeffChestSortPlugin plugin;
|
||||
ChestSortPlugin plugin;
|
||||
MinepacksHook minepacksHook;
|
||||
|
||||
JeffChestSortListener(JeffChestSortPlugin plugin) {
|
||||
ChestSortListener(ChestSortPlugin plugin) {
|
||||
this.plugin = plugin;
|
||||
this.minepacksHook = new MinepacksHook(plugin);
|
||||
}
|
||||
@ -73,7 +73,7 @@ public class JeffChestSortListener implements Listener {
|
||||
if(!minepacksHook.isMinepacksBackpack(inv)) return;
|
||||
if( !p.hasPermission("chestsort.use")) return;
|
||||
plugin.registerPlayerIfNeeded(p);
|
||||
JeffChestSortPlayerSetting setting = plugin.perPlayerSettings.get(p.getUniqueId().toString());
|
||||
ChestSortPlayerSetting setting = plugin.perPlayerSettings.get(p.getUniqueId().toString());
|
||||
if(!setting.sortingEnabled) return;
|
||||
plugin.organizer.sortInventory(inv);
|
||||
}
|
||||
@ -91,7 +91,7 @@ public class JeffChestSortListener implements Listener {
|
||||
if( !p.hasPermission("chestsort.use.inventory")) return;
|
||||
plugin.registerPlayerIfNeeded(p);
|
||||
|
||||
JeffChestSortPlayerSetting setting = plugin.perPlayerSettings.get(p.getUniqueId().toString());
|
||||
ChestSortPlayerSetting setting = plugin.perPlayerSettings.get(p.getUniqueId().toString());
|
||||
if(!setting.invSortingEnabled) return;
|
||||
|
||||
plugin.organizer.sortInventory(p.getInventory(),9,35);
|
||||
@ -218,7 +218,7 @@ public class JeffChestSortListener implements Listener {
|
||||
// Get the current player's settings
|
||||
// We do not immediately cancel when sorting is disabled because we might want
|
||||
// to show the hint message
|
||||
JeffChestSortPlayerSetting setting = plugin.perPlayerSettings.get(p.getUniqueId().toString());
|
||||
ChestSortPlayerSetting setting = plugin.perPlayerSettings.get(p.getUniqueId().toString());
|
||||
|
||||
// Show "how to enable ChestSort" message when ALL of the following criteria are
|
||||
// met:
|
||||
@ -227,7 +227,7 @@ public class JeffChestSortListener implements Listener {
|
||||
// logout
|
||||
// is defined by the config setting "show-message-again-after-logout")
|
||||
// - "show-message-when-using-chest" is set to true in the config.yml
|
||||
if (!plugin.sortingEnabled(p)) {
|
||||
if (!plugin.isSortingEnabled(p)) {
|
||||
if (!setting.hasSeenMessage) {
|
||||
setting.hasSeenMessage = true;
|
||||
if (plugin.getConfig().getBoolean("show-message-when-using-chest")) {
|
||||
@ -316,7 +316,7 @@ public class JeffChestSortListener implements Listener {
|
||||
|
||||
boolean sort = false;
|
||||
|
||||
JeffChestSortPlayerSetting setting = plugin.perPlayerSettings.get(p.getUniqueId().toString());
|
||||
ChestSortPlayerSetting setting = plugin.perPlayerSettings.get(p.getUniqueId().toString());
|
||||
|
||||
// Do not sort the GUI inventory
|
||||
if(event.getClickedInventory() == setting.guiInventory) {
|
||||
@ -424,11 +424,11 @@ public class JeffChestSortListener implements Listener {
|
||||
if( !p.hasPermission("chestsort.use")) return;
|
||||
|
||||
plugin.registerPlayerIfNeeded(p);
|
||||
JeffChestSortPlayerSetting setting = plugin.perPlayerSettings.get(p.getUniqueId().toString());
|
||||
ChestSortPlayerSetting 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.sortInventory(e.getInventory());
|
||||
plugin.organizer.updateInventoryView(e.getInventory());
|
||||
} else if(e.isRightClick() && setting.rightClick) {
|
||||
plugin.organizer.stuffInventoryIntoAnother(e.getInventory(), p.getInventory(),e.getInventory());
|
@ -1,8 +1,8 @@
|
||||
package de.jeffclan.JeffChestSort;
|
||||
package de.jeff_media.ChestSort;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
|
||||
public class JeffChestSortMessages {
|
||||
public class ChestSortMessages {
|
||||
|
||||
// Messages can be customized in the config.yml
|
||||
// To avoid problems with missing messages in the config, the default messages
|
||||
@ -11,7 +11,7 @@ public class JeffChestSortMessages {
|
||||
// When creating pull requests that feature a message to the player, please
|
||||
// stick to this scheme
|
||||
|
||||
JeffChestSortPlugin plugin;
|
||||
ChestSortPlugin plugin;
|
||||
|
||||
final String MSG_ACTIVATED, MSG_DEACTIVATED, MSG_INVACTIVATED, MSG_INVDEACTIVATED, MSG_COMMANDMESSAGE, MSG_COMMANDMESSAGE2, MSG_PLAYERSONLY,
|
||||
MSG_PLAYERINVSORTED, MSG_INVALIDOPTIONS;
|
||||
@ -20,7 +20,7 @@ public class JeffChestSortMessages {
|
||||
|
||||
final String MSG_GUI_MIDDLECLICK, MSG_GUI_SHIFTCLICK, MSG_GUI_DOUBLECLICK, MSG_GUI_SHIFTRIGHTCLICK, MSG_GUI_LEFTCLICK, MSG_GUI_RIGHTCLICK;
|
||||
|
||||
JeffChestSortMessages(JeffChestSortPlugin plugin) {
|
||||
ChestSortMessages(ChestSortPlugin plugin) {
|
||||
this.plugin = plugin;
|
||||
|
||||
MSG_ACTIVATED = ChatColor.translateAlternateColorCodes('&', plugin.getConfig()
|
@ -1,4 +1,4 @@
|
||||
package de.jeffclan.JeffChestSort;
|
||||
package de.jeff_media.ChestSort;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
@ -26,12 +26,12 @@ import org.bukkit.inventory.meta.ItemMeta;
|
||||
import org.bukkit.inventory.meta.PotionMeta;
|
||||
import org.bukkit.potion.PotionData;
|
||||
|
||||
import de.jeffclan.hooks.CrackShotHook;
|
||||
import de.jeffclan.hooks.InventoryPagesHook;
|
||||
import de.jeffclan.utils.CategoryLinePair;
|
||||
import de.jeffclan.utils.TypeMatchPositionPair;
|
||||
import de.jeff_media.ChestSort.hooks.CrackShotHook;
|
||||
import de.jeff_media.ChestSort.hooks.InventoryPagesHook;
|
||||
import de.jeff_media.ChestSort.utils.CategoryLinePair;
|
||||
import de.jeff_media.ChestSort.utils.TypeMatchPositionPair;
|
||||
|
||||
public class JeffChestSortOrganizer {
|
||||
public class ChestSortOrganizer {
|
||||
|
||||
// This is the heart of ChestSort!
|
||||
// All of the sorting stuff happens here.
|
||||
@ -44,7 +44,7 @@ public class JeffChestSortOrganizer {
|
||||
* they are already alphabetically in the right order
|
||||
*/
|
||||
|
||||
JeffChestSortPlugin plugin;
|
||||
ChestSortPlugin plugin;
|
||||
CrackShotHook crackShotHook;
|
||||
InventoryPagesHook inventoryPagesHook;
|
||||
|
||||
@ -64,10 +64,10 @@ public class JeffChestSortOrganizer {
|
||||
private static final String emptyPlaceholderString = "~";
|
||||
|
||||
// We store a list of all Category objects
|
||||
ArrayList<JeffChestSortCategory> categories = new ArrayList<JeffChestSortCategory>();
|
||||
ArrayList<ChestSortCategory> categories = new ArrayList<ChestSortCategory>();
|
||||
ArrayList<String> stickyCategoryNames = new ArrayList<String>();
|
||||
|
||||
JeffChestSortOrganizer(JeffChestSortPlugin plugin) {
|
||||
ChestSortOrganizer(ChestSortPlugin plugin) {
|
||||
this.plugin = plugin;
|
||||
|
||||
// Load Categories
|
||||
@ -95,7 +95,7 @@ public class JeffChestSortOrganizer {
|
||||
plugin.getLogger().info("Loading category file " + file.getName());
|
||||
}
|
||||
try {
|
||||
JeffChestSortCategory category = new JeffChestSortCategory(categoryName, loadCategoryFile(file));
|
||||
ChestSortCategory category = new ChestSortCategory(categoryName, loadCategoryFile(file));
|
||||
categories.add(category);
|
||||
if (plugin.debug) {
|
||||
plugin.getLogger().info("Loaded category file " + file.getName() + " ("
|
||||
@ -110,7 +110,7 @@ public class JeffChestSortOrganizer {
|
||||
|
||||
// Make categories sticky
|
||||
for(String catName : stickyCategoryNames) {
|
||||
for(JeffChestSortCategory cat : categories) {
|
||||
for(ChestSortCategory cat : categories) {
|
||||
if(catName.equalsIgnoreCase(cat.name)) {
|
||||
cat.setSticky();
|
||||
}
|
||||
@ -280,7 +280,7 @@ public class JeffChestSortOrganizer {
|
||||
// items when sorting by category)
|
||||
CategoryLinePair getCategoryLinePair(String typeName) {
|
||||
typeName = typeName.toLowerCase();
|
||||
for (JeffChestSortCategory cat : categories) {
|
||||
for (ChestSortCategory cat : categories) {
|
||||
short matchingLineNumber = cat.matches(typeName);
|
||||
if (matchingLineNumber != 0) {
|
||||
return new CategoryLinePair(cat.name, matchingLineNumber);
|
@ -1,4 +1,4 @@
|
||||
package de.jeffclan.JeffChestSort;
|
||||
package de.jeff_media.ChestSort;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.UUID;
|
||||
@ -6,12 +6,12 @@ import java.util.UUID;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.permissions.PermissionAttachment;
|
||||
|
||||
public class JeffChestSortPermissionsHandler {
|
||||
public class ChestSortPermissionsHandler {
|
||||
|
||||
HashMap<UUID,PermissionAttachment> permissions;
|
||||
JeffChestSortPlugin plugin;
|
||||
ChestSortPlugin plugin;
|
||||
|
||||
JeffChestSortPermissionsHandler(JeffChestSortPlugin plugin) {
|
||||
ChestSortPermissionsHandler(ChestSortPlugin plugin) {
|
||||
this.plugin = plugin;
|
||||
this.permissions = new HashMap<UUID,PermissionAttachment>();
|
||||
}
|
@ -1,8 +1,8 @@
|
||||
package de.jeffclan.JeffChestSort;
|
||||
package de.jeff_media.ChestSort;
|
||||
|
||||
import org.bukkit.inventory.Inventory;
|
||||
|
||||
public class JeffChestSortPlayerSetting {
|
||||
public class ChestSortPlayerSetting {
|
||||
|
||||
// Represents the information regarding a player
|
||||
// That includes:
|
||||
@ -26,7 +26,7 @@ public class JeffChestSortPlayerSetting {
|
||||
// Do we have to save these settings?
|
||||
boolean changed = false;
|
||||
|
||||
JeffChestSortPlayerSetting(boolean sortingEnabled, boolean invSortingEnabled, boolean middleClick, boolean shiftClick, boolean doubleClick, boolean shiftRightClick, boolean leftClick, boolean rightClick, boolean changed) {
|
||||
ChestSortPlayerSetting(boolean sortingEnabled, boolean invSortingEnabled, boolean middleClick, boolean shiftClick, boolean doubleClick, boolean shiftRightClick, boolean leftClick, boolean rightClick, boolean changed) {
|
||||
this.sortingEnabled = sortingEnabled;
|
||||
this.middleClick = middleClick;
|
||||
this.shiftClick = shiftClick;
|
@ -26,7 +26,7 @@
|
||||
|
||||
*/
|
||||
|
||||
package de.jeffclan.JeffChestSort;
|
||||
package de.jeff_media.ChestSort;
|
||||
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.File;
|
||||
@ -47,24 +47,24 @@ import org.bukkit.Material;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.permissions.PermissionAttachment;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import at.pcgamingfreaks.Minepacks.Bukkit.API.MinepacksPlugin;
|
||||
import de.jeffclan.utils.Utils;
|
||||
import de.jeff_media.ChestSort.utils.Utils;
|
||||
|
||||
public class JeffChestSortPlugin extends JavaPlugin {
|
||||
public class ChestSortPlugin extends JavaPlugin {
|
||||
|
||||
Map<String, JeffChestSortPlayerSetting> perPlayerSettings = new HashMap<String, JeffChestSortPlayerSetting>();
|
||||
JeffChestSortMessages messages;
|
||||
JeffChestSortOrganizer organizer;
|
||||
JeffChestSortUpdateChecker updateChecker;
|
||||
JeffChestSortListener listener;
|
||||
JeffChestSortSettingsGUI settingsGUI;
|
||||
JeffChestSortPermissionsHandler permissionsHandler;
|
||||
Map<String, ChestSortPlayerSetting> perPlayerSettings = new HashMap<String, ChestSortPlayerSetting>();
|
||||
ChestSortMessages messages;
|
||||
ChestSortOrganizer organizer;
|
||||
ChestSortUpdateChecker updateChecker;
|
||||
ChestSortListener listener;
|
||||
ChestSortSettingsGUI settingsGUI;
|
||||
ChestSortPermissionsHandler permissionsHandler;
|
||||
String sortingMethod;
|
||||
ArrayList<String> disabledWorlds;
|
||||
ChestSortAPI api;
|
||||
int currentConfigVersion = 30;
|
||||
boolean usingMatchingConfig = true;
|
||||
protected boolean debug = false;
|
||||
@ -82,22 +82,32 @@ public class JeffChestSortPlugin extends JavaPlugin {
|
||||
// 1.14.4 = 1_14_R1
|
||||
// 1.8.0 = 1_8_R1
|
||||
int mcMinorVersion; // 14 for 1.14, 13 for 1.13, ...
|
||||
|
||||
public ChestSortAPI getAPI() {
|
||||
return this.api;
|
||||
}
|
||||
|
||||
// Public API method to sort any given inventory
|
||||
@Deprecated
|
||||
public void sortInventory(Inventory inv) {
|
||||
this.organizer.sortInventory(inv);
|
||||
api.sortInventory(inv);
|
||||
}
|
||||
|
||||
// Public API method to sort any given inventory inbetween startSlot and endSlot
|
||||
@Deprecated
|
||||
public void sortInventory(Inventory inv, int startSlot, int endSlot) {
|
||||
this.organizer.sortInventory(inv, startSlot, endSlot);
|
||||
api.sortInventory(inv, startSlot, endSlot);
|
||||
}
|
||||
|
||||
// Check whether sorting is enabled for a player. Public because it can be
|
||||
// accessed as part of the API
|
||||
// Public API method to check if player has automatic chest sorting enabled
|
||||
@Deprecated
|
||||
public boolean sortingEnabled(Player p) {
|
||||
return isSortingEnabled(p);
|
||||
}
|
||||
|
||||
boolean isSortingEnabled(Player p) {
|
||||
if (perPlayerSettings == null) {
|
||||
perPlayerSettings = new HashMap<String, JeffChestSortPlayerSetting>();
|
||||
perPlayerSettings = new HashMap<String, ChestSortPlayerSetting>();
|
||||
}
|
||||
listener.plugin.registerPlayerIfNeeded(p);
|
||||
return perPlayerSettings.get(p.getUniqueId().toString()).sortingEnabled;
|
||||
@ -133,7 +143,7 @@ public class JeffChestSortPlugin extends JavaPlugin {
|
||||
// use the default values later on
|
||||
} else*/ if (getConfig().getInt("config-version", 0) != currentConfigVersion) {
|
||||
showOldConfigWarning();
|
||||
JeffChestSortConfigUpdater configUpdater = new JeffChestSortConfigUpdater(this);
|
||||
ChestSortConfigUpdater configUpdater = new ChestSortConfigUpdater(this);
|
||||
configUpdater.updateConfig();
|
||||
configUpdater = null;
|
||||
usingMatchingConfig = true;
|
||||
@ -251,23 +261,25 @@ public class JeffChestSortPlugin extends JavaPlugin {
|
||||
|
||||
// Messages class will load messages from config, fallback to hardcoded default
|
||||
// messages
|
||||
messages = new JeffChestSortMessages(this);
|
||||
messages = new ChestSortMessages(this);
|
||||
|
||||
// Organizer will load all category files and will be ready to sort stuff
|
||||
organizer = new JeffChestSortOrganizer(this);
|
||||
organizer = new ChestSortOrganizer(this);
|
||||
|
||||
settingsGUI = new JeffChestSortSettingsGUI(this);
|
||||
settingsGUI = new ChestSortSettingsGUI(this);
|
||||
|
||||
// UpdateChecker will check on startup and every 24 hours for new updates (when
|
||||
// enabled)
|
||||
updateChecker = new JeffChestSortUpdateChecker(this);
|
||||
updateChecker = new ChestSortUpdateChecker(this);
|
||||
|
||||
// The listener will register joining (and unregister leaving) players, and call
|
||||
// the Organizer to sort inventories when a player closes a chest, shulkerbox or
|
||||
// barrel inventory
|
||||
listener = new JeffChestSortListener(this);
|
||||
listener = new ChestSortListener(this);
|
||||
|
||||
permissionsHandler = new JeffChestSortPermissionsHandler(this);
|
||||
api = new ChestSortAPI(this);
|
||||
|
||||
permissionsHandler = new ChestSortPermissionsHandler(this);
|
||||
|
||||
usePermissions = getConfig().getBoolean("use-permissions");
|
||||
|
||||
@ -281,11 +293,11 @@ public class JeffChestSortPlugin extends JavaPlugin {
|
||||
getServer().getPluginManager().registerEvents(settingsGUI, this);
|
||||
|
||||
// Create the CommandExecutor, register commands and set their TabCompleter
|
||||
JeffChestSortChestSortCommand chestsortCommandExecutor = new JeffChestSortChestSortCommand(this);
|
||||
JeffChestSortTabCompleter tabCompleter = new JeffChestSortTabCompleter();
|
||||
ChestSortChestSortCommand chestsortCommandExecutor = new ChestSortChestSortCommand(this);
|
||||
ChestSortTabCompleter tabCompleter = new ChestSortTabCompleter();
|
||||
this.getCommand("chestsort").setExecutor(chestsortCommandExecutor);
|
||||
this.getCommand("chestsort").setTabCompleter(tabCompleter);
|
||||
JeffChestSortInvSortCommand invsortCommandExecutor = new JeffChestSortInvSortCommand(this);
|
||||
ChestSortInvSortCommand invsortCommandExecutor = new ChestSortInvSortCommand(this);
|
||||
this.getCommand("invsort").setExecutor(invsortCommandExecutor);
|
||||
this.getCommand("invsort").setTabCompleter(tabCompleter);
|
||||
|
||||
@ -349,9 +361,9 @@ public class JeffChestSortPlugin extends JavaPlugin {
|
||||
|
||||
private String getCategoryList() {
|
||||
String list = "";
|
||||
JeffChestSortCategory[] categories = organizer.categories.toArray(new JeffChestSortCategory[organizer.categories.size()]);
|
||||
ChestSortCategory[] categories = organizer.categories.toArray(new ChestSortCategory[organizer.categories.size()]);
|
||||
Arrays.sort(categories);
|
||||
for(JeffChestSortCategory category : categories) {
|
||||
for(ChestSortCategory category : categories) {
|
||||
list = list + category.name + " (";
|
||||
list = list + category.typeMatches.length + "), ";
|
||||
}
|
||||
@ -491,7 +503,7 @@ public class JeffChestSortPlugin extends JavaPlugin {
|
||||
// are online
|
||||
// but not registered. So, we only continue when the player has been registered
|
||||
if (perPlayerSettings.containsKey(uniqueId.toString())) {
|
||||
JeffChestSortPlayerSetting setting = perPlayerSettings.get(p.getUniqueId().toString());
|
||||
ChestSortPlayerSetting setting = perPlayerSettings.get(p.getUniqueId().toString());
|
||||
|
||||
File playerFile = new File(getDataFolder() + File.separator + "playerdata",
|
||||
p.getUniqueId().toString() + ".yml");
|
||||
@ -589,7 +601,7 @@ public class JeffChestSortPlugin extends JavaPlugin {
|
||||
rightClick = playerConfig.getBoolean("rightClick",getConfig().getBoolean("additional-hotkeys.right-click"));
|
||||
}
|
||||
|
||||
JeffChestSortPlayerSetting newSettings = new JeffChestSortPlayerSetting(activeForThisPlayer,invActiveForThisPlayer,middleClick,shiftClick,doubleClick,shiftRightClick,leftClick,rightClick,changed);
|
||||
ChestSortPlayerSetting newSettings = new ChestSortPlayerSetting(activeForThisPlayer,invActiveForThisPlayer,middleClick,shiftClick,doubleClick,shiftRightClick,leftClick,rightClick,changed);
|
||||
|
||||
// when "show-message-again-after-logout" is enabled, we don't care if the
|
||||
// player already saw the message
|
@ -1,4 +1,4 @@
|
||||
package de.jeffclan.JeffChestSort;
|
||||
package de.jeff_media.ChestSort;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
@ -13,9 +13,9 @@ import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
|
||||
public class JeffChestSortSettingsGUI implements Listener {
|
||||
public class ChestSortSettingsGUI implements Listener {
|
||||
|
||||
JeffChestSortPlugin plugin;
|
||||
ChestSortPlugin plugin;
|
||||
|
||||
public static int slotMiddleClick = 1;
|
||||
public static int slotShiftClick = 3 ;
|
||||
@ -31,7 +31,7 @@ public class JeffChestSortSettingsGUI implements Listener {
|
||||
MiddleClick, ShiftClick, DoubleClick, ShiftRightClick, LeftClick, RightClick;
|
||||
}
|
||||
|
||||
JeffChestSortSettingsGUI(JeffChestSortPlugin plugin) {
|
||||
ChestSortSettingsGUI(ChestSortPlugin plugin) {
|
||||
this.plugin=plugin;
|
||||
}
|
||||
|
||||
@ -81,7 +81,7 @@ public class JeffChestSortSettingsGUI implements Listener {
|
||||
void openGUI(Player player) {
|
||||
Inventory inventory = createGUI("ChestSort", player);
|
||||
|
||||
JeffChestSortPlayerSetting setting = plugin.perPlayerSettings.get(player.getUniqueId().toString());
|
||||
ChestSortPlayerSetting setting = plugin.perPlayerSettings.get(player.getUniqueId().toString());
|
||||
|
||||
inventory.setItem(slotMiddleClick, getItem(setting.middleClick,Hotkey.MiddleClick));
|
||||
inventory.setItem(slotShiftClick, getItem(setting.shiftClick,Hotkey.ShiftClick));
|
||||
@ -109,7 +109,7 @@ public class JeffChestSortSettingsGUI implements Listener {
|
||||
}
|
||||
Player p = (Player) event.getWhoClicked();
|
||||
plugin.listener.plugin.registerPlayerIfNeeded(p);
|
||||
JeffChestSortPlayerSetting setting = plugin.perPlayerSettings.get(p.getUniqueId().toString());
|
||||
ChestSortPlayerSetting setting = plugin.perPlayerSettings.get(p.getUniqueId().toString());
|
||||
|
||||
if(setting.guiInventory==null) {
|
||||
return;
|
||||
@ -128,28 +128,28 @@ public class JeffChestSortSettingsGUI implements Listener {
|
||||
return;
|
||||
}
|
||||
|
||||
if(event.getSlot() == JeffChestSortSettingsGUI.slotMiddleClick) {
|
||||
if(event.getSlot() == ChestSortSettingsGUI.slotMiddleClick) {
|
||||
setting.toggleMiddleClick();
|
||||
plugin.settingsGUI.openGUI(p);
|
||||
return;
|
||||
}
|
||||
else if(event.getSlot() == JeffChestSortSettingsGUI.slotShiftClick) {
|
||||
else if(event.getSlot() == ChestSortSettingsGUI.slotShiftClick) {
|
||||
setting.toggleShiftClick();
|
||||
plugin.settingsGUI.openGUI(p);
|
||||
return;
|
||||
} else if(event.getSlot() == JeffChestSortSettingsGUI.slotDoubleClick) {
|
||||
} else if(event.getSlot() == ChestSortSettingsGUI.slotDoubleClick) {
|
||||
setting.toggleDoubleClick();
|
||||
plugin.settingsGUI.openGUI(p);
|
||||
return;
|
||||
} else if(event.getSlot() == JeffChestSortSettingsGUI.slotShiftRightClick) {
|
||||
} else if(event.getSlot() == ChestSortSettingsGUI.slotShiftRightClick) {
|
||||
setting.toggleShiftRightClick();
|
||||
plugin.settingsGUI.openGUI(p);
|
||||
return;
|
||||
} else if(event.getSlot() == JeffChestSortSettingsGUI.slotLeftClick) {
|
||||
} else if(event.getSlot() == ChestSortSettingsGUI.slotLeftClick) {
|
||||
setting.toggleLeftClick();
|
||||
plugin.settingsGUI.openGUI(p);
|
||||
return;
|
||||
} else if(event.getSlot() == JeffChestSortSettingsGUI.slotRightClick) {
|
||||
} else if(event.getSlot() == ChestSortSettingsGUI.slotRightClick) {
|
||||
setting.toggleRightClick();
|
||||
plugin.settingsGUI.openGUI(p);
|
||||
return;
|
@ -1,4 +1,4 @@
|
||||
package de.jeffclan.JeffChestSort;
|
||||
package de.jeff_media.ChestSort;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@ -7,7 +7,7 @@ import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.command.TabCompleter;
|
||||
|
||||
public class JeffChestSortTabCompleter implements TabCompleter {
|
||||
public class ChestSortTabCompleter implements TabCompleter {
|
||||
|
||||
static final String[] chestsortOptions = { "toggle","on","off","hotkeys" };
|
||||
static final String[] invsortOptions = { "toggle","on","off","all", "hotbar", "inv" };
|
@ -1,4 +1,4 @@
|
||||
package de.jeffclan.JeffChestSort;
|
||||
package de.jeff_media.ChestSort;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.InputStreamReader;
|
||||
@ -14,7 +14,7 @@ import net.md_5.bungee.api.chat.ComponentBuilder;
|
||||
import net.md_5.bungee.api.chat.HoverEvent;
|
||||
import net.md_5.bungee.api.chat.TextComponent;
|
||||
|
||||
public class JeffChestSortUpdateChecker {
|
||||
public class ChestSortUpdateChecker {
|
||||
|
||||
// This checks for updates. A txt file is downloaded. If the txt file contains a
|
||||
// string that is unequal to the currently used plugin's version, a message is
|
||||
@ -24,9 +24,9 @@ public class JeffChestSortUpdateChecker {
|
||||
// Media GbR API server is offline, or if you have no internet connection, a
|
||||
// warning will be printed in the console.
|
||||
|
||||
private JeffChestSortPlugin plugin;
|
||||
private ChestSortPlugin plugin;
|
||||
|
||||
JeffChestSortUpdateChecker(JeffChestSortPlugin plugin) {
|
||||
ChestSortUpdateChecker(ChestSortPlugin plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
@ -1,17 +1,17 @@
|
||||
package de.jeffclan.hooks;
|
||||
package de.jeff_media.ChestSort.hooks;
|
||||
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import com.shampaggon.crackshot.CSUtility;
|
||||
|
||||
import de.jeffclan.JeffChestSort.JeffChestSortPlugin;
|
||||
import de.jeff_media.ChestSort.ChestSortPlugin;
|
||||
|
||||
public class CrackShotHook {
|
||||
|
||||
JeffChestSortPlugin plugin;
|
||||
ChestSortPlugin plugin;
|
||||
CSUtility crackShotUtility = null;
|
||||
|
||||
public CrackShotHook(JeffChestSortPlugin plugin) {
|
||||
public CrackShotHook(ChestSortPlugin plugin) {
|
||||
this.plugin=plugin;
|
||||
|
||||
if(plugin.hookCrackShot) {
|
@ -1,4 +1,4 @@
|
||||
package de.jeffclan.hooks;
|
||||
package de.jeff_media.ChestSort.hooks;
|
||||
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
@ -1,4 +1,4 @@
|
||||
package de.jeffclan.hooks;
|
||||
package de.jeff_media.ChestSort.hooks;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
@ -8,19 +8,19 @@ import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.PlayerInventory;
|
||||
|
||||
import de.jeffclan.JeffChestSort.JeffChestSortPlugin;
|
||||
import de.jeff_media.ChestSort.ChestSortPlugin;
|
||||
import net.md_5.bungee.api.ChatColor;
|
||||
|
||||
public class InventoryPagesHook {
|
||||
|
||||
JeffChestSortPlugin plugin;
|
||||
ChestSortPlugin plugin;
|
||||
YamlConfiguration inventoryPagesConfig;
|
||||
|
||||
int prevSlot, nextSlot;
|
||||
Material prevMat, nextMat, noPageMat;
|
||||
String prevName, nextName, noPageName;
|
||||
|
||||
public InventoryPagesHook(JeffChestSortPlugin plugin) {
|
||||
public InventoryPagesHook(ChestSortPlugin plugin) {
|
||||
this.plugin = plugin;
|
||||
|
||||
if(!plugin.hookInventoryPages) {
|
@ -1,4 +1,4 @@
|
||||
package de.jeffclan.hooks;
|
||||
package de.jeff_media.ChestSort.hooks;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
@ -7,14 +7,14 @@ import org.bukkit.plugin.Plugin;
|
||||
|
||||
import at.pcgamingfreaks.Minepacks.Bukkit.API.Backpack;
|
||||
import at.pcgamingfreaks.Minepacks.Bukkit.API.MinepacksPlugin;
|
||||
import de.jeffclan.JeffChestSort.JeffChestSortPlugin;
|
||||
import de.jeff_media.ChestSort.ChestSortPlugin;
|
||||
|
||||
public class MinepacksHook {
|
||||
|
||||
JeffChestSortPlugin plugin;
|
||||
ChestSortPlugin plugin;
|
||||
MinepacksPlugin minepacks = null;
|
||||
|
||||
public MinepacksHook(JeffChestSortPlugin plugin) {
|
||||
public MinepacksHook(ChestSortPlugin plugin) {
|
||||
this.plugin = plugin;
|
||||
Plugin bukkitPlugin = Bukkit.getPluginManager().getPlugin("Minepacks");
|
||||
if(plugin.hookMinepacks && bukkitPlugin instanceof MinepacksPlugin) {
|
@ -1,4 +1,4 @@
|
||||
package de.jeffclan.utils;
|
||||
package de.jeff_media.ChestSort.utils;
|
||||
|
||||
|
||||
public class CategoryLinePair {
|
@ -1,4 +1,4 @@
|
||||
package de.jeffclan.utils;
|
||||
package de.jeff_media.ChestSort.utils;
|
||||
|
||||
public class TypeMatchPositionPair {
|
||||
|
@ -1,4 +1,4 @@
|
||||
package de.jeffclan.utils;
|
||||
package de.jeff_media.ChestSort.utils;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
@ -6,7 +6,7 @@ import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
||||
import de.jeffclan.JeffChestSort.JeffChestSortPlugin;
|
||||
import de.jeff_media.ChestSort.ChestSortPlugin;
|
||||
|
||||
public class Utils {
|
||||
|
||||
@ -36,7 +36,7 @@ public class Utils {
|
||||
return String.format("%05d", number);
|
||||
}
|
||||
|
||||
public static void renameFileInPluginDir(JeffChestSortPlugin plugin,String oldName, String newName) {
|
||||
public static void renameFileInPluginDir(ChestSortPlugin plugin,String oldName, String newName) {
|
||||
File oldFile = new File(plugin.getDataFolder().getAbsolutePath() + File.separator + oldName);
|
||||
File newFile = new File(plugin.getDataFolder().getAbsolutePath() + File.separator + newName);
|
||||
oldFile.getAbsoluteFile().renameTo(newFile.getAbsoluteFile());
|
@ -1,4 +1,4 @@
|
||||
main: de.jeffclan.JeffChestSort.JeffChestSortPlugin
|
||||
main: de.jeff_media.ChestSort.ChestSortPlugin
|
||||
name: ChestSort
|
||||
version: 8.7
|
||||
api-version: 1.13
|
||||
|
Loading…
Reference in New Issue
Block a user