-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
release of version 1.0.0
- Loading branch information
Showing
7 changed files
with
795 additions
and
5 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
 | ||
|
||
## 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 | ||
 | ||
|
||
### Show nicknames on right click | ||
 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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!"); | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
src/main/java/me/irinque/CampfireHiddenNames/handlers/PlayerClick.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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())); | ||
} | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
src/main/java/me/irinque/CampfireHiddenNames/handlers/PlayerJoin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
src/main/java/me/irinque/CampfireHiddenNames/loaders/PluginTeam.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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();} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
Manifest-Version: 1.0 | ||
Main-Class: Main | ||
|