Stop with these playerData null checks

This commit is contained in:
Indyuce 2022-02-25 22:44:07 +01:00
parent 07f6247235
commit cd75819c39
2 changed files with 2 additions and 16 deletions

View File

@ -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");
}
/**

View File

@ -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);