Skip to content

Commit

Permalink
Attempt to reapply a nametag if an individual tag was cleared. Fixes #18
Browse files Browse the repository at this point in the history
  • Loading branch information
sgtcaze committed Mar 1, 2016
1 parent d42ff98 commit b82d76e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/main/java/com/nametagedit/plugin/NametagCommand.java
Expand Up @@ -7,6 +7,7 @@
import com.nametagedit.plugin.utils.Utils;
import lombok.AllArgsConstructor;
import mkremins.fanciful.FancyMessage;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
Expand Down Expand Up @@ -150,6 +151,7 @@ private void cmdClear(CommandSender sender, String[] args) {
}

handler.clear(sender, targetName);
handler.applyTagToPlayer(Bukkit.getPlayerExact(targetName));
}
}

Expand Down
4 changes: 3 additions & 1 deletion src/main/java/com/nametagedit/plugin/NametagHandler.java
Expand Up @@ -39,7 +39,8 @@ public NametagHandler(NametagEdit plugin) {
this.plugin = plugin;
Bukkit.getPluginManager().registerEvents(this, plugin);
this.tabListDisabled = plugin.getConfig().getBoolean("TabListDisabled");
this.fancyMessageCompatible = Bukkit.getServer().getClass().getPackage().getName().split("\\.")[3].startsWith("v1_8");
String version = Bukkit.getServer().getClass().getPackage().getName().split("\\.")[3];
this.fancyMessageCompatible = version.startsWith("v1_8");
if (plugin.getConfig().getBoolean("MySQL.Enabled")) {
abstractConfig = new DatabaseConfig(plugin, this);
} else {
Expand Down Expand Up @@ -174,6 +175,7 @@ public void applyTags() {
}

public void applyTagToPlayer(Player player) {
if (player == null) { return; }
UUID uuid = player.getUniqueId();
PlayerData data = playerData.get(uuid);
if (data != null) {
Expand Down

0 comments on commit b82d76e

Please sign in to comment.