Skip to content

Commit

Permalink
v1.0.0
Browse files Browse the repository at this point in the history
release of version 1.0.0
  • Loading branch information
irinque authored Feb 22, 2025
2 parents 3c2a068 + 5aaa910 commit bce3cba
Show file tree
Hide file tree
Showing 7 changed files with 795 additions and 5 deletions.
674 changes: 674 additions & 0 deletions LICENSE.md

Large diffs are not rendered by default.

13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
![CAMPFIREHIDDENNAMES](https://i.postimg.cc/GpvrgSWg/text.png)

## CampfireHiddenNames - Get the names above your head out of the way in a couple clicks

**CampfireHiddenNames** - New plugin that allows you to remove player names above the head and show on right click

## Features

### Overhead nicknames removed
![EXAMPLE](https://i.postimg.cc/FRqvn5PS/preview-names.png)

### Show nicknames on right click
![EXAMPLE](https://i.postimg.cc/jdGVfY2w/preview-clicked.png)
33 changes: 28 additions & 5 deletions src/main/java/me/irinque/CampfireHiddenNames/Main.java
Original file line number Diff line number Diff line change
@@ -1,17 +1,40 @@
package me.irinque.CampfireHiddenNames;

import me.irinque.CampfireHiddenNames.handlers.PlayerClick;
import me.irinque.CampfireHiddenNames.handlers.PlayerJoin;
import me.irinque.CampfireHiddenNames.loaders.PluginTeam;
import org.bukkit.plugin.java.JavaPlugin;

public final class Main extends JavaPlugin {
public final class Main extends JavaPlugin
{
public static Main instance;
public static Main getInstance() {return instance;}

private PluginTeam team_plugin;

public PluginTeam GetTeam() {
return team_plugin;
}

@Override
public void onEnable() {
// Plugin startup logic
public void onEnable()
{
if (instance == null) {instance = this;}

team_plugin = new PluginTeam();

getServer().getPluginManager().registerEvents(new PlayerJoin(), this);
getServer().getPluginManager().registerEvents(new PlayerClick(), this);

getServer().getLogger().info("[CHN] Plugin is ready");

}

@Override
public void onDisable() {
// Plugin shutdown logic
public void onDisable()
{
if (instance != null) {instance = null;}
team_plugin.UnRegisterTeam();
getServer().getLogger().info("[CHN] Plugin was shutdown!");
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package me.irinque.CampfireHiddenNames.handlers;

import net.md_5.bungee.api.ChatMessageType;
import net.md_5.bungee.api.chat.TextComponent;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerInteractAtEntityEvent;

public class PlayerClick implements Listener
{
@EventHandler
public void onPlayerClick (PlayerInteractAtEntityEvent event)
{
Entity entity_clicked = event.getRightClicked();
Player player = event.getPlayer();

if (entity_clicked instanceof Player && !player.isSneaking())
{
player.spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacy(entity_clicked.getName()));
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package me.irinque.CampfireHiddenNames.handlers;

import me.irinque.CampfireHiddenNames.Main;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.entity.Player;

public class PlayerJoin implements Listener
{
static Main plugin = Main.getInstance();

@EventHandler
public void onPlayerJoin(PlayerJoinEvent event)
{
Player player = event.getPlayer();
plugin.GetTeam().AddPlayer(player);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package me.irinque.CampfireHiddenNames.loaders;

import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.scoreboard.*;
import org.bukkit.scoreboard.Team.Option;
import org.bukkit.scoreboard.Team.OptionStatus;

public class PluginTeam
{
private Team team_plugin;
private Scoreboard scoreboard;

public PluginTeam ()
{
ScoreboardManager scoreboardmanager = Bukkit.getScoreboardManager();
scoreboard = scoreboardmanager.getNewScoreboard();
team_plugin = scoreboard.registerNewTeam("CHN");
team_plugin.setCanSeeFriendlyInvisibles(false);
team_plugin.setOption(Option.NAME_TAG_VISIBILITY, OptionStatus.NEVER);
}

public void AddPlayer (Player player_joined)
{
player_joined.setScoreboard(scoreboard);
team_plugin.addPlayer(player_joined);
}

public void UnRegisterTeam ()
{
if (team_plugin != null){team_plugin.unregister();}
}

}
3 changes: 3 additions & 0 deletions src/main/resources/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Manifest-Version: 1.0
Main-Class: Main

0 comments on commit bce3cba

Please sign in to comment.