Skip to content

Commit

Permalink
Fixed the 3rd party scoreboard issue
Browse files Browse the repository at this point in the history
[ERROR]: PlayerData is empty no longer happens on player join event
  • Loading branch information
VetheonGames committed Sep 21, 2021
1 parent fa7c108 commit e08a9a7
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 4 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>veth.vetheon</groupId>
<artifactId>SurvivalPlus</artifactId>
<version>4.0.2-RELEASE</version>
<version>4.0.4-RELEASE</version>

<properties>
<maven.compiler.source>1.8</maven.compiler.source>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@ public String getVersion() {
@Override
public String onPlaceholderRequest(Player p, String identifier) {
PlayerData playerData = playerManager.getPlayerData(p);

if (playerData == null )
{
return null;
}

// Shows player's health, kinda useless but here it is
if (identifier.equalsIgnoreCase("player_health")) {
Expand Down
16 changes: 16 additions & 0 deletions src/main/java/veth/vetheon/survival/managers/PlayerManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,10 @@ public Location lookAt(Location loc, Location lookat) {
}

public List<String> ShowThirst(Player player) {
if (player == null)
{
return null;
}
StringBuilder thirstBar = new StringBuilder();
PlayerData data = getPlayerData(player);
int thirst = data.getThirst();
Expand All @@ -233,6 +237,10 @@ else if (thirst <= 6)
}

public List<String> ShowHunger(Player player) {
if (player == null)
{
return null;
}
int hunger = player.getFoodLevel();
int saturation = Math.round(player.getSaturation());
StringBuilder hungerBar = new StringBuilder();
Expand All @@ -258,6 +266,10 @@ else if (hunger <= 6)
}

public List<String> ShowNutrients(Player player) {
if (player == null)
{
return null;
}
List<String> nutrients = new ArrayList<>();
PlayerData data = getPlayerData(player);

Expand Down Expand Up @@ -290,6 +302,10 @@ public List<String> ShowNutrients(Player player) {
}

public List<String> showEnergy(Player player) {
if (player == null)
{
return null;
}
PlayerData playerData = getPlayerData(player);
double energy = Math.floor(playerData.getEnergy());
StringBuilder energyBar = new StringBuilder();
Expand Down
Binary file not shown.
2 changes: 1 addition & 1 deletion target/classes/plugin.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: SurvivalPlus
main: veth.vetheon.survival.Survival
authors: [FattyMieo, ShaneBee, VetheonGames]
version: '4.0.2-RELEASE'
version: '4.0.4-RELEASE'
api-version: '1.17'
softdepend:
- PlaceholderAPI
Expand Down
Binary file modified target/classes/veth/vetheon/survival/managers/Placeholders.class
Binary file not shown.
Binary file modified target/classes/veth/vetheon/survival/managers/PlayerManager.class
Binary file not shown.
4 changes: 2 additions & 2 deletions target/maven-archiver/pom.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#Generated by Maven
#Mon Sep 20 22:32:20 MDT 2021
#Tue Sep 21 14:39:49 MDT 2021
groupId=veth.vetheon
artifactId=SurvivalPlus
version=4.0.2-RELEASE
version=4.0.4-RELEASE

0 comments on commit e08a9a7

Please sign in to comment.