diff --git a/src/main/java/com/lishid/openinv/internal/IPlayerDataManager.java b/src/main/java/com/lishid/openinv/internal/IPlayerDataManager.java index f0c34f3c..a8dd4e2f 100644 --- a/src/main/java/com/lishid/openinv/internal/IPlayerDataManager.java +++ b/src/main/java/com/lishid/openinv/internal/IPlayerDataManager.java @@ -19,8 +19,15 @@ import org.bukkit.OfflinePlayer; import org.bukkit.entity.Player; -public interface IPlayerDataManager { - public Player loadPlayer(OfflinePlayer offline); +public abstract class IPlayerDataManager { + public final Player loadPlayer(OfflinePlayer offline) { + if (offline.isOnline()) { + return offline.getPlayer(); + } + return this.loadOfflinePlayer(offline); + } - public String getPlayerDataID(OfflinePlayer player); + protected abstract Player loadOfflinePlayer(OfflinePlayer offline); + + public abstract String getPlayerDataID(OfflinePlayer player); } diff --git a/src/main/java/com/lishid/openinv/internal/v1_4_5/PlayerDataManager.java b/src/main/java/com/lishid/openinv/internal/v1_4_5/PlayerDataManager.java index d3c7ec85..d5c7061c 100644 --- a/src/main/java/com/lishid/openinv/internal/v1_4_5/PlayerDataManager.java +++ b/src/main/java/com/lishid/openinv/internal/v1_4_5/PlayerDataManager.java @@ -29,10 +29,10 @@ import org.bukkit.craftbukkit.v1_4_5.CraftServer; -public class PlayerDataManager implements IPlayerDataManager { +public class PlayerDataManager extends IPlayerDataManager { @Override - public Player loadPlayer(OfflinePlayer offline) { + public Player loadOfflinePlayer(OfflinePlayer offline) { MinecraftServer server = ((CraftServer) Bukkit.getServer()).getServer(); // Create an entity to load the player data diff --git a/src/main/java/com/lishid/openinv/internal/v1_4_6/PlayerDataManager.java b/src/main/java/com/lishid/openinv/internal/v1_4_6/PlayerDataManager.java index 6ae3b417..604e6d8a 100644 --- a/src/main/java/com/lishid/openinv/internal/v1_4_6/PlayerDataManager.java +++ b/src/main/java/com/lishid/openinv/internal/v1_4_6/PlayerDataManager.java @@ -29,10 +29,10 @@ import org.bukkit.craftbukkit.v1_4_6.CraftServer; -public class PlayerDataManager implements IPlayerDataManager { +public class PlayerDataManager extends IPlayerDataManager { @Override - public Player loadPlayer(OfflinePlayer offline) { + public Player loadOfflinePlayer(OfflinePlayer offline) { MinecraftServer server = ((CraftServer) Bukkit.getServer()).getServer(); // Create an entity to load the player data diff --git a/src/main/java/com/lishid/openinv/internal/v1_4_R1/PlayerDataManager.java b/src/main/java/com/lishid/openinv/internal/v1_4_R1/PlayerDataManager.java index 15f72724..21b2c5ad 100644 --- a/src/main/java/com/lishid/openinv/internal/v1_4_R1/PlayerDataManager.java +++ b/src/main/java/com/lishid/openinv/internal/v1_4_R1/PlayerDataManager.java @@ -30,10 +30,10 @@ import org.bukkit.craftbukkit.v1_4_R1.CraftServer; -public class PlayerDataManager implements IPlayerDataManager { +public class PlayerDataManager extends IPlayerDataManager { @Override - public Player loadPlayer(OfflinePlayer offline) { + public Player loadOfflinePlayer(OfflinePlayer offline) { MinecraftServer server = ((CraftServer) Bukkit.getServer()).getServer(); // Create an entity to load the player data diff --git a/src/main/java/com/lishid/openinv/internal/v1_5_R2/PlayerDataManager.java b/src/main/java/com/lishid/openinv/internal/v1_5_R2/PlayerDataManager.java index b6ea8a00..59d14d8f 100644 --- a/src/main/java/com/lishid/openinv/internal/v1_5_R2/PlayerDataManager.java +++ b/src/main/java/com/lishid/openinv/internal/v1_5_R2/PlayerDataManager.java @@ -29,10 +29,10 @@ import org.bukkit.craftbukkit.v1_5_R2.CraftServer; -public class PlayerDataManager implements IPlayerDataManager { +public class PlayerDataManager extends IPlayerDataManager { @Override - public Player loadPlayer(OfflinePlayer offline) { + public Player loadOfflinePlayer(OfflinePlayer offline) { MinecraftServer server = ((CraftServer) Bukkit.getServer()).getServer(); // Create an entity to load the player data diff --git a/src/main/java/com/lishid/openinv/internal/v1_5_R3/PlayerDataManager.java b/src/main/java/com/lishid/openinv/internal/v1_5_R3/PlayerDataManager.java index 679411fb..3f6589c3 100644 --- a/src/main/java/com/lishid/openinv/internal/v1_5_R3/PlayerDataManager.java +++ b/src/main/java/com/lishid/openinv/internal/v1_5_R3/PlayerDataManager.java @@ -29,10 +29,10 @@ import org.bukkit.craftbukkit.v1_5_R3.CraftServer; -public class PlayerDataManager implements IPlayerDataManager { +public class PlayerDataManager extends IPlayerDataManager { @Override - public Player loadPlayer(OfflinePlayer offline) { + public Player loadOfflinePlayer(OfflinePlayer offline) { MinecraftServer server = ((CraftServer) Bukkit.getServer()).getServer(); // Create an entity to load the player data diff --git a/src/main/java/com/lishid/openinv/internal/v1_6_R1/PlayerDataManager.java b/src/main/java/com/lishid/openinv/internal/v1_6_R1/PlayerDataManager.java index a73798ce..e0f2b73e 100644 --- a/src/main/java/com/lishid/openinv/internal/v1_6_R1/PlayerDataManager.java +++ b/src/main/java/com/lishid/openinv/internal/v1_6_R1/PlayerDataManager.java @@ -29,10 +29,10 @@ import org.bukkit.craftbukkit.v1_6_R1.CraftServer; -public class PlayerDataManager implements IPlayerDataManager { +public class PlayerDataManager extends IPlayerDataManager { @Override - public Player loadPlayer(OfflinePlayer offline) { + public Player loadOfflinePlayer(OfflinePlayer offline) { MinecraftServer server = ((CraftServer) Bukkit.getServer()).getServer(); // Create an entity to load the player data diff --git a/src/main/java/com/lishid/openinv/internal/v1_6_R2/PlayerDataManager.java b/src/main/java/com/lishid/openinv/internal/v1_6_R2/PlayerDataManager.java index 351aec59..5256ea62 100644 --- a/src/main/java/com/lishid/openinv/internal/v1_6_R2/PlayerDataManager.java +++ b/src/main/java/com/lishid/openinv/internal/v1_6_R2/PlayerDataManager.java @@ -29,10 +29,10 @@ import org.bukkit.craftbukkit.v1_6_R2.CraftServer; -public class PlayerDataManager implements IPlayerDataManager { +public class PlayerDataManager extends IPlayerDataManager { @Override - public Player loadPlayer(OfflinePlayer offline) { + public Player loadOfflinePlayer(OfflinePlayer offline) { MinecraftServer server = ((CraftServer) Bukkit.getServer()).getServer(); // Create an entity to load the player data diff --git a/src/main/java/com/lishid/openinv/internal/v1_6_R3/PlayerDataManager.java b/src/main/java/com/lishid/openinv/internal/v1_6_R3/PlayerDataManager.java index d340d47d..c96aea2f 100644 --- a/src/main/java/com/lishid/openinv/internal/v1_6_R3/PlayerDataManager.java +++ b/src/main/java/com/lishid/openinv/internal/v1_6_R3/PlayerDataManager.java @@ -29,10 +29,10 @@ import org.bukkit.craftbukkit.v1_6_R3.CraftServer; -public class PlayerDataManager implements IPlayerDataManager { +public class PlayerDataManager extends IPlayerDataManager { @Override - public Player loadPlayer(OfflinePlayer offline) { + public Player loadOfflinePlayer(OfflinePlayer offline) { MinecraftServer server = ((CraftServer) Bukkit.getServer()).getServer(); // Create an entity to load the player data diff --git a/src/main/java/com/lishid/openinv/internal/v1_7_R1/PlayerDataManager.java b/src/main/java/com/lishid/openinv/internal/v1_7_R1/PlayerDataManager.java index 7b67ac57..d9d173a9 100644 --- a/src/main/java/com/lishid/openinv/internal/v1_7_R1/PlayerDataManager.java +++ b/src/main/java/com/lishid/openinv/internal/v1_7_R1/PlayerDataManager.java @@ -30,10 +30,10 @@ import org.bukkit.craftbukkit.v1_7_R1.CraftServer; -public class PlayerDataManager implements IPlayerDataManager { +public class PlayerDataManager extends IPlayerDataManager { @Override - public Player loadPlayer(OfflinePlayer offline) { + public Player loadOfflinePlayer(OfflinePlayer offline) { MinecraftServer server = ((CraftServer) Bukkit.getServer()).getServer(); GameProfile profile = new GameProfile(null, offline.getName()); diff --git a/src/main/java/com/lishid/openinv/internal/v1_7_R2/PlayerDataManager.java b/src/main/java/com/lishid/openinv/internal/v1_7_R2/PlayerDataManager.java index b76a2571..c262a0ab 100644 --- a/src/main/java/com/lishid/openinv/internal/v1_7_R2/PlayerDataManager.java +++ b/src/main/java/com/lishid/openinv/internal/v1_7_R2/PlayerDataManager.java @@ -30,10 +30,10 @@ import org.bukkit.craftbukkit.v1_7_R2.CraftServer; -public class PlayerDataManager implements IPlayerDataManager { +public class PlayerDataManager extends IPlayerDataManager { @Override - public Player loadPlayer(OfflinePlayer offline) { + public Player loadOfflinePlayer(OfflinePlayer offline) { MinecraftServer server = ((CraftServer) Bukkit.getServer()).getServer(); GameProfile profile = new GameProfile(null, offline.getName()); diff --git a/src/main/java/com/lishid/openinv/internal/v1_7_R3/PlayerDataManager.java b/src/main/java/com/lishid/openinv/internal/v1_7_R3/PlayerDataManager.java index 66bc1ae1..7ccc30eb 100644 --- a/src/main/java/com/lishid/openinv/internal/v1_7_R3/PlayerDataManager.java +++ b/src/main/java/com/lishid/openinv/internal/v1_7_R3/PlayerDataManager.java @@ -30,10 +30,10 @@ import org.bukkit.craftbukkit.v1_7_R3.CraftServer; -public class PlayerDataManager implements IPlayerDataManager { +public class PlayerDataManager extends IPlayerDataManager { @Override - public Player loadPlayer(OfflinePlayer offline) { + public Player loadOfflinePlayer(OfflinePlayer offline) { MinecraftServer server = ((CraftServer) Bukkit.getServer()).getServer(); GameProfile profile = new GameProfile(offline.getUniqueId(), offline.getName()); diff --git a/src/main/java/com/lishid/openinv/internal/v1_7_R4/PlayerDataManager.java b/src/main/java/com/lishid/openinv/internal/v1_7_R4/PlayerDataManager.java index e2c84f4d..c9d7b438 100644 --- a/src/main/java/com/lishid/openinv/internal/v1_7_R4/PlayerDataManager.java +++ b/src/main/java/com/lishid/openinv/internal/v1_7_R4/PlayerDataManager.java @@ -30,10 +30,10 @@ import org.bukkit.craftbukkit.v1_7_R4.CraftServer; -public class PlayerDataManager implements IPlayerDataManager { +public class PlayerDataManager extends IPlayerDataManager { @Override - public Player loadPlayer(OfflinePlayer offline) { + public Player loadOfflinePlayer(OfflinePlayer offline) { MinecraftServer server = ((CraftServer) Bukkit.getServer()).getServer(); GameProfile profile = new GameProfile(offline.getUniqueId(), offline.getName()); diff --git a/src/main/java/com/lishid/openinv/internal/v1_8_R1/PlayerDataManager.java b/src/main/java/com/lishid/openinv/internal/v1_8_R1/PlayerDataManager.java index 81465a5b..4364ae46 100644 --- a/src/main/java/com/lishid/openinv/internal/v1_8_R1/PlayerDataManager.java +++ b/src/main/java/com/lishid/openinv/internal/v1_8_R1/PlayerDataManager.java @@ -30,10 +30,10 @@ //Volatile import org.bukkit.craftbukkit.v1_8_R1.CraftServer; -public class PlayerDataManager implements IPlayerDataManager { +public class PlayerDataManager extends IPlayerDataManager { @Override - public Player loadPlayer(OfflinePlayer offline) { + public Player loadOfflinePlayer(OfflinePlayer offline) { GameProfile profile = new GameProfile(offline.getUniqueId(), offline.getName()); MinecraftServer server = ((CraftServer) Bukkit.getServer()).getServer(); // Create an entity to load the player data diff --git a/src/main/java/com/lishid/openinv/internal/v1_8_R2/PlayerDataManager.java b/src/main/java/com/lishid/openinv/internal/v1_8_R2/PlayerDataManager.java index 8e1815e7..0b61df40 100644 --- a/src/main/java/com/lishid/openinv/internal/v1_8_R2/PlayerDataManager.java +++ b/src/main/java/com/lishid/openinv/internal/v1_8_R2/PlayerDataManager.java @@ -30,10 +30,10 @@ import org.bukkit.craftbukkit.v1_8_R2.CraftServer; -public class PlayerDataManager implements IPlayerDataManager { +public class PlayerDataManager extends IPlayerDataManager { @Override - public Player loadPlayer(OfflinePlayer offline) { + public Player loadOfflinePlayer(OfflinePlayer offline) { MinecraftServer server = ((CraftServer) Bukkit.getServer()).getServer(); GameProfile profile = new GameProfile(offline.getUniqueId(), offline.getName()); diff --git a/src/main/java/com/lishid/openinv/internal/v1_8_R3/PlayerDataManager.java b/src/main/java/com/lishid/openinv/internal/v1_8_R3/PlayerDataManager.java index 61b136bd..e3f2dd4f 100644 --- a/src/main/java/com/lishid/openinv/internal/v1_8_R3/PlayerDataManager.java +++ b/src/main/java/com/lishid/openinv/internal/v1_8_R3/PlayerDataManager.java @@ -30,10 +30,10 @@ //Volatile import org.bukkit.craftbukkit.v1_8_R3.CraftServer; -public class PlayerDataManager implements IPlayerDataManager { +public class PlayerDataManager extends IPlayerDataManager { @Override - public Player loadPlayer(OfflinePlayer offline) { + public Player loadOfflinePlayer(OfflinePlayer offline) { MinecraftServer server = ((CraftServer) Bukkit.getServer()).getServer(); GameProfile profile = new GameProfile(offline.getUniqueId(), offline.getName()); diff --git a/src/main/java/com/lishid/openinv/internal/v1_9_R1/PlayerDataManager.java b/src/main/java/com/lishid/openinv/internal/v1_9_R1/PlayerDataManager.java index f78104b6..b6aa87c9 100644 --- a/src/main/java/com/lishid/openinv/internal/v1_9_R1/PlayerDataManager.java +++ b/src/main/java/com/lishid/openinv/internal/v1_9_R1/PlayerDataManager.java @@ -30,10 +30,10 @@ import org.bukkit.craftbukkit.v1_9_R1.CraftServer; -public class PlayerDataManager implements IPlayerDataManager { +public class PlayerDataManager extends IPlayerDataManager { @Override - public Player loadPlayer(OfflinePlayer offline) { + public Player loadOfflinePlayer(OfflinePlayer offline) { if (offline == null || !offline.hasPlayedBefore()) { return null; } diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index 32f59f16..6f2a8fb3 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -1,6 +1,6 @@ name: OpenInv main: com.lishid.openinv.OpenInv -version: 2.3.0 +version: 2.4.1 author: lishid authors: [Jikoo] description: >