Fix improper caching causing duplications, closes #10

* Implemented a universal cache for loaded players
* Reworked a significant amount of my API additions
* Simplified join/quit handling
* Cleaned up ISpecialEnderChest/ISpecialPlayerInventory implementations
* Fixed OpenInv.* permission not granting access to commands
This commit is contained in:
Jikoo
2016-07-09 10:40:51 -04:00
parent 1bbdde683c
commit 23bda96f38
66 changed files with 1087 additions and 1803 deletions

View File

@@ -18,6 +18,10 @@ package com.lishid.openinv.commands;
import java.util.HashMap;
import com.lishid.openinv.OpenInv;
import com.lishid.openinv.Permissions;
import com.lishid.openinv.internal.ISpecialPlayerInventory;
import org.bukkit.ChatColor;
import org.bukkit.OfflinePlayer;
import org.bukkit.command.Command;
@@ -26,10 +30,6 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.scheduler.BukkitRunnable;
import com.lishid.openinv.OpenInv;
import com.lishid.openinv.Permissions;
import com.lishid.openinv.internal.ISpecialPlayerInventory;
public class OpenInvPluginCommand implements CommandExecutor {
private final OpenInv plugin;
public static HashMap<Player, String> openInvHistory = new HashMap<Player, String>();
@@ -104,7 +104,7 @@ public class OpenInvPluginCommand implements CommandExecutor {
if (!online) {
// Try loading the player's data
onlineTarget = plugin.getPlayerLoader().loadPlayer(plugin, target);
onlineTarget = plugin.loadPlayer(target);
if (onlineTarget == null) {
player.sendMessage(ChatColor.RED + "Player not found!");
@@ -136,7 +136,7 @@ public class OpenInvPluginCommand implements CommandExecutor {
openInvHistory.put(player, onlineTarget.getName());
// Create the inventory
ISpecialPlayerInventory inv = plugin.getOrCreateInventoryFor(onlineTarget, online);
ISpecialPlayerInventory inv = plugin.getInventoryFor(onlineTarget, online);
// Open the inventory
player.openInventory(inv.getBukkitInventory());