Prepare for 1.14
To continue providing renamed ender chests/player inventories we can no longer just provide an Inventory, a full InventoryView is required. To avoid confusion the old method has been removed entirely, leading to a major API revision bump.
This commit is contained in:
		@@ -17,9 +17,10 @@
 | 
			
		||||
package com.lishid.openinv.internal;
 | 
			
		||||
 | 
			
		||||
import java.util.Collection;
 | 
			
		||||
 | 
			
		||||
import org.bukkit.OfflinePlayer;
 | 
			
		||||
import org.bukkit.entity.Player;
 | 
			
		||||
import org.jetbrains.annotations.NotNull;
 | 
			
		||||
import org.jetbrains.annotations.Nullable;
 | 
			
		||||
 | 
			
		||||
public interface IPlayerDataManager {
 | 
			
		||||
 | 
			
		||||
@@ -31,7 +32,8 @@ public interface IPlayerDataManager {
 | 
			
		||||
     * @param offline the OfflinePlayer
 | 
			
		||||
     * @return the Player loaded
 | 
			
		||||
     */
 | 
			
		||||
	Player loadPlayer(OfflinePlayer offline);
 | 
			
		||||
    @Nullable
 | 
			
		||||
    Player loadPlayer(@NotNull OfflinePlayer offline);
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Gets a unique identifying string for an OfflinePlayer.
 | 
			
		||||
@@ -39,7 +41,8 @@ public interface IPlayerDataManager {
 | 
			
		||||
     * @param offline the OfflinePlayer
 | 
			
		||||
     * @return the unique identifier
 | 
			
		||||
     */
 | 
			
		||||
	String getPlayerDataID(OfflinePlayer offline);
 | 
			
		||||
    @NotNull
 | 
			
		||||
    String getPlayerDataID(@NotNull OfflinePlayer offline);
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Gets an OfflinePlayer by the given unique identifier.
 | 
			
		||||
@@ -47,13 +50,15 @@ public interface IPlayerDataManager {
 | 
			
		||||
     * @param identifier the unique identifier
 | 
			
		||||
     * @return the OfflinePlayer, or null if no exact match was found
 | 
			
		||||
     */
 | 
			
		||||
	OfflinePlayer getPlayerByID(String identifier);
 | 
			
		||||
    @Nullable
 | 
			
		||||
    OfflinePlayer getPlayerByID(@NotNull String identifier);
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Gets a Collection of all Players currently online.
 | 
			
		||||
     *
 | 
			
		||||
     * @return the Collection of Players
 | 
			
		||||
     */
 | 
			
		||||
	Collection<? extends Player> getOnlinePlayers();
 | 
			
		||||
    @NotNull
 | 
			
		||||
    Collection<? extends Player> getOnlinePlayers();
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -16,6 +16,8 @@
 | 
			
		||||
 | 
			
		||||
package com.lishid.openinv.util;
 | 
			
		||||
 | 
			
		||||
import com.google.common.collect.Multimap;
 | 
			
		||||
import com.google.common.collect.TreeMultimap;
 | 
			
		||||
import java.util.ArrayList;
 | 
			
		||||
import java.util.Comparator;
 | 
			
		||||
import java.util.HashMap;
 | 
			
		||||
@@ -23,9 +25,6 @@ import java.util.Iterator;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
import java.util.Map;
 | 
			
		||||
 | 
			
		||||
import com.google.common.collect.Multimap;
 | 
			
		||||
import com.google.common.collect.TreeMultimap;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * A minimal thread-safe time-based cache implementation backed by a HashMap and TreeMultimap.
 | 
			
		||||
 *
 | 
			
		||||
 
 | 
			
		||||
@@ -16,16 +16,14 @@
 | 
			
		||||
 | 
			
		||||
package com.lishid.openinv.util;
 | 
			
		||||
 | 
			
		||||
import java.lang.reflect.Constructor;
 | 
			
		||||
import java.lang.reflect.Field;
 | 
			
		||||
import java.lang.reflect.InvocationTargetException;
 | 
			
		||||
 | 
			
		||||
import com.lishid.openinv.internal.IAnySilentContainer;
 | 
			
		||||
import com.lishid.openinv.internal.IInventoryAccess;
 | 
			
		||||
import com.lishid.openinv.internal.IPlayerDataManager;
 | 
			
		||||
import com.lishid.openinv.internal.ISpecialEnderChest;
 | 
			
		||||
import com.lishid.openinv.internal.ISpecialPlayerInventory;
 | 
			
		||||
 | 
			
		||||
import java.lang.reflect.Constructor;
 | 
			
		||||
import java.lang.reflect.Field;
 | 
			
		||||
import java.lang.reflect.InvocationTargetException;
 | 
			
		||||
import org.bukkit.entity.Player;
 | 
			
		||||
import org.bukkit.plugin.Plugin;
 | 
			
		||||
 | 
			
		||||
@@ -63,13 +61,14 @@ public class InternalAccessor {
 | 
			
		||||
        this.version = packageName.substring(packageName.lastIndexOf('.') + 1);
 | 
			
		||||
 | 
			
		||||
        try {
 | 
			
		||||
            // TODO: implement support for CraftMagicNumbers#getMappingsVersion
 | 
			
		||||
            Class.forName("com.lishid.openinv.internal." + this.version + ".SpecialPlayerInventory");
 | 
			
		||||
            Class.forName("com.lishid.openinv.internal." + this.version + ".SpecialEnderChest");
 | 
			
		||||
            this.playerDataManager = this.createObject(IPlayerDataManager.class, "PlayerDataManager");
 | 
			
		||||
            this.inventoryAccess = this.createObject(IInventoryAccess.class, "InventoryAccess");
 | 
			
		||||
            this.anySilentContainer = this.createObject(IAnySilentContainer.class, "AnySilentContainer");
 | 
			
		||||
            this.supported = true;
 | 
			
		||||
        } catch (Exception e) {}
 | 
			
		||||
        } catch (Exception ignored) {}
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private <T> T createObject(final Class<? extends T> assignableClass, final String className,
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user