Skip to content

Commit

Permalink
No Name Tag plugin v1
Browse files Browse the repository at this point in the history
  • Loading branch information
BuildTools committed Aug 7, 2019
1 parent 4f29ac8 commit 395267e
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 0 deletions.
5 changes: 5 additions & 0 deletions NoNameTag/plugin.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
name: NoNameTag
main: ca.fastis.NoNameTag
version: 1.0
author: Auracle
api-version: 1.14
44 changes: 44 additions & 0 deletions NoNameTag/src/ca/fastis/NoNameTag.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
package ca.fastis;


import org.bukkit.ChatColor;
import org.bukkit.Server;
import org.bukkit.command.ConsoleCommandSender;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.scoreboard.NameTagVisibility;
import org.bukkit.scoreboard.ScoreboardManager;
import org.bukkit.scoreboard.Team;

@SuppressWarnings("deprecation")
public class NoNameTag extends JavaPlugin implements Listener {
static Server server;
static ConsoleCommandSender console;
static Plugin plugin;
Team NoNameTagTeam;

public void onEnable() {
plugin = this;
server = this.getServer();
console = server.getConsoleSender();
server.getPluginManager().registerEvents(this, this);
ScoreboardManager sbm = server.getScoreboardManager();
if (sbm.getMainScoreboard().getTeam("NoNameTagTeam") == null) sbm.getMainScoreboard().registerNewTeam("NoNameTagTeam");
NoNameTagTeam = sbm.getMainScoreboard().getTeam("NoNameTagTeam");
NoNameTagTeam.setNameTagVisibility(NameTagVisibility.NEVER);
console.sendMessage(ChatColor.GREEN + "" + ChatColor.ITALIC + "NoNameTag Loaded");
}

@EventHandler
public void onPlayerJoin(PlayerJoinEvent event) {
NoNameTagTeam.addPlayer(event.getPlayer());
}

@Override
public void onDisable() {
console.sendMessage(ChatColor.RED + "NoNameTag Disabled");
}
}

0 comments on commit 395267e

Please sign in to comment.