mirror of
https://gitlab.com/phoenix-dvpmt/mmoitems.git
synced 2025-02-01 11:11:21 +01:00
Stop with these playerData null checks
This commit is contained in:
parent
07f6247235
commit
cd75819c39
@ -414,19 +414,8 @@ public class PlayerData {
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static PlayerData get(@NotNull UUID uuid) {
|
||||
|
||||
// Might not be null, after all
|
||||
PlayerData observedData = data.get(uuid);
|
||||
if (observedData != null) {
|
||||
return observedData;
|
||||
}
|
||||
|
||||
// Attempt to load
|
||||
load(uuid);
|
||||
|
||||
// Yes
|
||||
return Objects.requireNonNull(data.get(uuid), "Could not obtain PlayerData. Please make sure the plugin initialized correctly.");
|
||||
public static PlayerData get(UUID uuid) {
|
||||
return Objects.requireNonNull(data.get(uuid), "Player data not loaded");
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -249,9 +249,6 @@ public class PlayerListener implements Listener {
|
||||
@EventHandler
|
||||
public void onArmorEquip(ArmorEquipEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
if (!PlayerData.has(player))
|
||||
return;
|
||||
|
||||
NBTItem item = NBTItem.get(event.getNewArmorPiece());
|
||||
if (!PlayerData.get(player).getRPG().canUse(item, true))
|
||||
event.setCancelled(true);
|
||||
|
Loading…
Reference in New Issue
Block a user