mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2024-11-23 19:25:12 +01:00
Throw an error if player is null
This commit is contained in:
parent
765f774652
commit
8852b9d660
@ -33,6 +33,7 @@ import world.bentobox.bentobox.api.addons.Addon;
|
|||||||
import world.bentobox.bentobox.api.events.OfflineMessageEvent;
|
import world.bentobox.bentobox.api.events.OfflineMessageEvent;
|
||||||
import world.bentobox.bentobox.api.metadata.MetaDataAble;
|
import world.bentobox.bentobox.api.metadata.MetaDataAble;
|
||||||
import world.bentobox.bentobox.api.metadata.MetaDataValue;
|
import world.bentobox.bentobox.api.metadata.MetaDataValue;
|
||||||
|
import world.bentobox.bentobox.database.objects.Players;
|
||||||
import world.bentobox.bentobox.util.Util;
|
import world.bentobox.bentobox.util.Util;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -671,10 +672,10 @@ public class User implements MetaDataAble {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Optional<Map<String, MetaDataValue>> getMetaData() {
|
public Optional<Map<String, MetaDataValue>> getMetaData() {
|
||||||
return plugin
|
Players p = plugin
|
||||||
.getPlayers()
|
.getPlayers()
|
||||||
.getPlayer(playerUUID)
|
.getPlayer(playerUUID);
|
||||||
.getMetaData();
|
return Objects.requireNonNull(p, "Unknown player for " + playerUUID).getMetaData();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -683,7 +684,11 @@ public class User implements MetaDataAble {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void setMetaData(Map<String, MetaDataValue> metaData) {
|
public void setMetaData(Map<String, MetaDataValue> metaData) {
|
||||||
plugin.getPlayers().getPlayer(playerUUID).setMetaData(metaData);
|
Players p = plugin
|
||||||
|
.getPlayers()
|
||||||
|
.getPlayer(playerUUID);
|
||||||
|
|
||||||
|
Objects.requireNonNull(p, "Unknown player for " + playerUUID).setMetaData(metaData);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user