We need to catch some rares exceptions !
This commit is contained in:
parent
ea85ec25b9
commit
a5e6a8fa12
@ -38,6 +38,8 @@ public class FileCache {
|
|||||||
public void createCache(Player player, DataFileCache playerData,
|
public void createCache(Player player, DataFileCache playerData,
|
||||||
String group, boolean operator, boolean flying) {
|
String group, boolean operator, boolean flying) {
|
||||||
String path = "";
|
String path = "";
|
||||||
|
if (player == null)
|
||||||
|
return;
|
||||||
try {
|
try {
|
||||||
path = player.getUniqueId().toString();
|
path = player.getUniqueId().toString();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|||||||
@ -48,9 +48,14 @@ public class LimboCache {
|
|||||||
inv = null;
|
inv = null;
|
||||||
arm = null;
|
arm = null;
|
||||||
}
|
}
|
||||||
playerGroup = playerData.readCache(player).getGroup();
|
try {
|
||||||
operator = playerData.readCache(player).getOperator();
|
playerGroup = playerData.readCache(player).getGroup();
|
||||||
flying = playerData.readCache(player).isFlying();
|
operator = playerData.readCache(player).getOperator();
|
||||||
|
flying = playerData.readCache(player).isFlying();
|
||||||
|
} catch (Exception e)
|
||||||
|
{
|
||||||
|
ConsoleLogger.showError("Some error on reading cache of " + name);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
StoreInventoryEvent event = new StoreInventoryEvent(player);
|
StoreInventoryEvent event = new StoreInventoryEvent(player);
|
||||||
Bukkit.getServer().getPluginManager().callEvent(event);
|
Bukkit.getServer().getPluginManager().callEvent(event);
|
||||||
|
|||||||
@ -25,8 +25,14 @@ public class StoreInventoryEvent extends CustomEvent {
|
|||||||
|
|
||||||
public StoreInventoryEvent(Player player, FileCache fileCache) {
|
public StoreInventoryEvent(Player player, FileCache fileCache) {
|
||||||
this.player = player;
|
this.player = player;
|
||||||
this.inventory = fileCache.readCache(player).getInventory();
|
try {
|
||||||
this.armor = fileCache.readCache(player).getArmour();
|
this.inventory = fileCache.readCache(player).getInventory();
|
||||||
|
this.armor = fileCache.readCache(player).getArmour();
|
||||||
|
} catch (Exception e)
|
||||||
|
{
|
||||||
|
this.inventory = player.getInventory().getContents();
|
||||||
|
this.armor = player.getInventory().getArmorContents();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemStack[] getInventory() {
|
public ItemStack[] getInventory() {
|
||||||
|
|||||||
@ -11,7 +11,6 @@ import org.bukkit.Bukkit;
|
|||||||
import org.bukkit.GameMode;
|
import org.bukkit.GameMode;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.OfflinePlayer;
|
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user