This commit is contained in:
mfnalex 2021-05-24 22:41:53 +02:00
parent 4b2a3c9fcc
commit 84d144e229
8 changed files with 10 additions and 103 deletions

View File

@ -1,5 +1,8 @@
# Changelog
## 10.0.2
- Fixed legacy API still being shaded into the .jar file.
## 10.0.1
- API update - some weird Spigot update broke casting the Plugin instance to its interface.
- Plugins depending on ChestSort or using its API must be updated too.

View File

@ -9,7 +9,7 @@
<name>ChestSort</name>
<url>https://www.chestsort.de</url>
<description>Automatically sorts your chests!</description>
<version>10.0.1</version>
<version>10.0.2</version>
<packaging>jar</packaging>
<properties>
@ -149,7 +149,7 @@
<dependency>
<groupId>de.jeff_media</groupId>
<artifactId>ChestSortAPI</artifactId>
<version>3.0.0</version>
<version>4.0.0</version>
<scope>compile</scope>
</dependency>
<dependency>

View File

@ -1,47 +0,0 @@
package de.jeff_media.chestsort;
import de.jeff_media.ChestSortAPI.ChestSortAPI;
import org.bukkit.entity.Player;
import org.bukkit.inventory.Inventory;
/**
* This isn't used anymore
*/
public class ChestSortAPIHandler implements ChestSortAPI {
final ChestSortPlugin plugin;
ChestSortAPIHandler(ChestSortPlugin plugin) {
this.plugin = plugin;
}
// Public API method to sort any given inventory
@Override
public void sortInventory(Inventory inv) {
plugin.organizer.sortInventory(inv);
}
// Public API method to sort any given inventory inbetween startSlot and endSlot
@Override
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
@Override
public boolean sortingEnabled(Player p) {
return plugin.isSortingEnabled(p);
}
@Override
public String getChestSortVersion() {
return plugin.getDescription().getVersion();
}
@Override
public String getChestSortAPIVersion() {
return "1.2.0";
}
}

View File

@ -2,8 +2,6 @@ package de.jeff_media.chestsort;
import de.jeff_media.chestsort.hooks.*;
import de.jeff_media.chestsort.utils.LlamaUtils;
import de.jeff_media.ChestSortAPI.ChestSortEvent;
import de.jeff_media.ChestSortAPI.ISortable;
import net.md_5.bungee.api.ChatMessageType;
import net.md_5.bungee.api.chat.TextComponent;
import org.bukkit.Bukkit;
@ -61,7 +59,7 @@ public class ChestSortListener implements Listener {
if(!playerSetting.leftClickOutside) return;
Container containerState = (Container) clickedBlock.getState();
Inventory inventory = containerState.getInventory();
plugin.getAPI().sortInventory(inventory);
plugin.organizer.sortInventory(inventory);
event.getPlayer().spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText(plugin.messages.MSG_CONTAINER_SORTED));
}

View File

@ -6,7 +6,7 @@ import de.jeff_media.chestsort.hooks.SlimeFunHook;
import de.jeff_media.chestsort.utils.CategoryLinePair;
import de.jeff_media.chestsort.utils.TypeMatchPositionPair;
import de.jeff_media.chestsort.utils.Utils;
import de.jeff_media.ChestSortAPI.ChestSortEvent;
import de.jeff_media.chestsort.ChestSortEvent;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.enchantments.Enchantment;
@ -462,7 +462,7 @@ public class ChestSortOrganizer {
if(inv==null) return;
plugin.debug("Attempting to sort an Inventory and calling ChestSortEvent.");
Class<? extends Inventory> invClass = inv.getClass();
de.jeff_media.ChestSortAPI.ChestSortEvent chestSortEvent = new de.jeff_media.ChestSortAPI.ChestSortEvent(inv);
ChestSortEvent chestSortEvent = new ChestSortEvent(inv);
try {
if (invClass.getMethod("getLocation", null) != null) {

View File

@ -52,7 +52,7 @@ import org.bukkit.plugin.java.JavaPlugin;
import java.io.*;
import java.util.*;
public class ChestSortPlugin extends JavaPlugin implements de.jeff_media.ChestSortAPI.ChestSort {
public class ChestSortPlugin extends JavaPlugin {
private static double updateCheckInterval = 4 * 60 * 60; // in seconds. We check on startup and every 4 hours
final int currentConfigVersion = 50;
@ -64,7 +64,6 @@ public class ChestSortPlugin extends JavaPlugin implements de.jeff_media.ChestSo
public boolean hookMinepacks = false;
public PlayerVaultsHook playerVaultsHook;
protected boolean debug = false;
ChestSortAPIHandler api;
ArrayList<String> disabledWorlds;
HashMap<UUID, Long> hotkeyCooldown;
ChestSortLogger lgr;
@ -177,11 +176,6 @@ public class ChestSortPlugin extends JavaPlugin implements de.jeff_media.ChestSo
}
@Override
public ChestSortAPIHandler getAPI() {
return this.api;
}
private String getCategoryList() {
StringBuilder list = new StringBuilder();
ChestSortCategory[] categories = organizer.categories.toArray(new ChestSortCategory[0]);
@ -274,7 +268,6 @@ public class ChestSortPlugin extends JavaPlugin implements de.jeff_media.ChestSo
PaperLib.suggestPaper(this);
}
listener = new ChestSortListener(this);
api = new ChestSortAPIHandler(this);
hotkeyCooldown = new HashMap<>();
permissionsHandler = new ChestSortPermissionsHandler(this);
updateCheckInterval = getConfig().getDouble("check-interval");
@ -640,33 +633,6 @@ public class ChestSortPlugin extends JavaPlugin implements de.jeff_media.ChestSo
getLogger().warning("==============================================");
}
// Public API method to sort any given inventory
@Deprecated
@Override
public void sortInventory(Inventory inv) {
StackTraceElement[] stackTraceElements = Thread.currentThread().getStackTrace();
getLogger().warning(String.format("%s has performed a call to a deprecated ChestSort API method. This is NOT a ChestSort error.", stackTraceElements[2]));
api.sortInventory(inv);
}
// Public API method to sort any given inventory inbetween startSlot and endSlot
@Deprecated
@Override
public void sortInventory(Inventory inv, int startSlot, int endSlot) {
StackTraceElement[] stackTraceElements = Thread.currentThread().getStackTrace();
getLogger().warning(String.format("%s has performed a call to a deprecated ChestSort API method. This is NOT a ChestSort error.", stackTraceElements[2]));
api.sortInventory(inv, startSlot, endSlot);
}
// Public API method to check if player has automatic chest sorting enabled
@Deprecated
@Override
public boolean sortingEnabled(Player p) {
StackTraceElement[] stackTraceElements = Thread.currentThread().getStackTrace();
getLogger().warning(String.format("%s has performed a call to a deprecated ChestSort API method. This is NOT a ChestSort error.", stackTraceElements[2]));
return isSortingEnabled(p);
}
void unregisterAllPlayers() {
if (perPlayerSettings != null && perPlayerSettings.size() > 0) {
Iterator<String> it = perPlayerSettings.keySet().iterator();

View File

@ -1,13 +0,0 @@
package de.jeff_media.chestsort.test;
import de.jeff_media.chestsort.ChestSortPlugin;
import org.bukkit.entity.Player;
public class APIDeprecation {
public static void sortInventoryDeprecated(Player p, ChestSortPlugin plugin) {
plugin.sortInventory(p.getInventory());
}
}

View File

@ -1,6 +1,6 @@
main: de.jeff_media.chestsort.ChestSortPlugin
name: ChestSort
version: 10.0.1
version: 10.0.2
api-version: "1.13"
description: Allows automatic chest sorting
author: mfnalex