Skip to content

Commit

Permalink
Update to Sponge API 7
Browse files Browse the repository at this point in the history
  • Loading branch information
games647 committed Apr 5, 2018
1 parent d4a9442 commit 0afd3c0
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 41 deletions.
50 changes: 26 additions & 24 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,37 +1,22 @@
# Eclipse stuff
/.classpath
/.project
/.settings
# Eclipse
.classpath
.project
.settings/

# NetBeans
*/nbproject
nbproject/
nb-configuration.xml

# maven
*/target

# vim
.*.sw[a-p]

# virtual machine crash logs, see https://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*

# various other potential build files
*/build/
/bin
/dist
/manifest.mf
*.log

# Mac filesystem dust
.DS_Store

# IntelliJ
*.iml
*.ipr
*.iws
.idea/

# Maven
target/
pom.xml.versionsBackup

# Gradle
.gradle

Expand All @@ -40,3 +25,20 @@ gradle-app.setting

# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)
!gradle-wrapper.jar

# various other potential build files
build/
bin/
dist/
manifest.mf
*.log

# Vim
.*.sw[a-p]

# virtual machine crash logs, see https://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*

# Mac filesystem dust
.DS_Store

2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2015
Copyright (c) 2015-2018

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

### Description

A Sponge minecraft server plugin for displaying the health above an entity.
A Sponge Minecraft server plugin for displaying the health above an entity.
This plugins makes it possible to display player or mob health above their character.

### Features
Expand Down
5 changes: 2 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<packaging>jar</packaging>

<name>HealthName</name>
<version>0.3</version>
<version>0.4</version>
<description>Sponge plugin that displays the health of a mob or player above their head</description>
<url>https://github.com/games647/HealthName</url>

Expand Down Expand Up @@ -53,8 +53,7 @@
<dependency>
<groupId>org.spongepowered</groupId>
<artifactId>spongeapi</artifactId>
<version>6.0.0</version>
<type>jar</type>
<version>7.0.0</version>
<scope>provided</scope>
</dependency>
</dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,10 @@
import com.github.games647.healthname.config.Settings;
import com.google.inject.Inject;

import java.util.Optional;

import org.spongepowered.api.Sponge;
import org.spongepowered.api.entity.living.player.Player;
import org.spongepowered.api.event.Listener;
import org.spongepowered.api.event.network.ClientConnectionEvent;
import org.spongepowered.api.scoreboard.Scoreboard;
import org.spongepowered.api.scoreboard.Team;
import org.spongepowered.api.text.Text;

Expand All @@ -36,11 +33,9 @@ public void onJoin(ClientConnectionEvent.Join joinEvent) {
public void onQuit(ClientConnectionEvent.Disconnect disconnectEvent) {
String playerName = disconnectEvent.getTargetEntity().getName();
//Clean up scoreboard in order to prevent to big ones
Optional<Scoreboard> serverScoreboard = Sponge.getServer().getServerScoreboard();
if (serverScoreboard.isPresent()) {
Scoreboard globalScoreboard = serverScoreboard.get();
globalScoreboard.removeScores(Text.of(playerName));
globalScoreboard.getTeam(playerName).ifPresent(Team::unregister);
}
Sponge.getServer().getServerScoreboard().ifPresent(scoreboard -> {
scoreboard.removeScores(Text.of(playerName));
scoreboard.getTeam(playerName).ifPresent(Team::unregister);
});
}
}
4 changes: 2 additions & 2 deletions src/main/java/com/github/games647/healthname/HealthName.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
import org.spongepowered.api.text.Text;
import org.spongepowered.api.text.format.TextColors;

@Plugin(id = PomData.ARTIFACT_ID, name = PomData.NAME, version = PomData.VERSION
, url = PomData.URL, description = PomData.DESCRIPTION)
@Plugin(id = PomData.ARTIFACT_ID, name = PomData.NAME, version = PomData.VERSION,
url = PomData.URL, description = PomData.DESCRIPTION)
public class HealthName {

private final Logger logger;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public class Config {
private boolean enabledMob = true;

@Setting(comment = "Show the health of a player besides his nametag")
private boolean nametagHealth = false;
private boolean nametagHealth;

@Setting(comment = "Show the health of a player under his nametag (only the health number)")
private boolean belowNameHealth = true;
Expand Down

0 comments on commit 0afd3c0

Please sign in to comment.