below name scoreboard with sidebar fix as it wont show rank for new players lol
This commit is contained in:
parent
1638c84b88
commit
5de189003f
5 changed files with 41 additions and 23 deletions
|
@ -1,10 +1,7 @@
|
||||||
package com.night.nullvalkyrie;
|
package com.night.nullvalkyrie;
|
||||||
|
|
||||||
import com.night.nullvalkyrie.Chests.MenuListener;
|
import com.night.nullvalkyrie.Chests.MenuListener;
|
||||||
import com.night.nullvalkyrie.RankSys.NameTagManager;
|
import com.night.nullvalkyrie.RankSys.*;
|
||||||
import com.night.nullvalkyrie.RankSys.ScoreboardListener;
|
|
||||||
import com.night.nullvalkyrie.RankSys.RankManager;
|
|
||||||
import com.night.nullvalkyrie.RankSys.SideBarManager;
|
|
||||||
import com.night.nullvalkyrie.commands.*;
|
import com.night.nullvalkyrie.commands.*;
|
||||||
import net.md_5.bungee.api.ChatMessageType;
|
import net.md_5.bungee.api.ChatMessageType;
|
||||||
import net.md_5.bungee.api.chat.TextComponent;
|
import net.md_5.bungee.api.chat.TextComponent;
|
||||||
|
@ -44,12 +41,14 @@ public final class Main extends JavaPlugin implements Listener {
|
||||||
private RankManager rankManager;
|
private RankManager rankManager;
|
||||||
private NameTagManager nameTagManager;
|
private NameTagManager nameTagManager;
|
||||||
private SideBarManager sideBarManager;
|
private SideBarManager sideBarManager;
|
||||||
|
private BelowNameManager belowNameManager;
|
||||||
|
|
||||||
public RankManager getRankManager() {
|
public RankManager getRankManager() {
|
||||||
return rankManager;
|
return rankManager;
|
||||||
}
|
}
|
||||||
public NameTagManager getNameTagManager() { return nameTagManager; }
|
public NameTagManager getNameTagManager() { return nameTagManager; }
|
||||||
public SideBarManager getSideBarManager() { return sideBarManager; }
|
public SideBarManager getSideBarManager() { return sideBarManager; }
|
||||||
|
public BelowNameManager getBelowNameManager() { return belowNameManager; }
|
||||||
@Override
|
@Override
|
||||||
public void onEnable() {
|
public void onEnable() {
|
||||||
new VanishCommand();new TestCommand();new WeaponCommand();new AnvilCommand();new ArmorCommand();new MenuCommand();new RankCommand(this);
|
new VanishCommand();new TestCommand();new WeaponCommand();new AnvilCommand();new ArmorCommand();new MenuCommand();new RankCommand(this);
|
||||||
|
@ -65,7 +64,7 @@ public final class Main extends JavaPlugin implements Listener {
|
||||||
nameTagManager = new NameTagManager(this);
|
nameTagManager = new NameTagManager(this);
|
||||||
rankManager = new RankManager(this);
|
rankManager = new RankManager(this);
|
||||||
sideBarManager = new SideBarManager(this);
|
sideBarManager = new SideBarManager(this);
|
||||||
|
belowNameManager = new BelowNameManager();
|
||||||
ItemStack widow_sword = new ItemStack(Material.STICK);
|
ItemStack widow_sword = new ItemStack(Material.STICK);
|
||||||
widow_sword.addUnsafeEnchantment(Enchantment.DAMAGE_ALL, 20);
|
widow_sword.addUnsafeEnchantment(Enchantment.DAMAGE_ALL, 20);
|
||||||
widow_sword.addUnsafeEnchantment(Enchantment.LOOT_BONUS_MOBS, 10);
|
widow_sword.addUnsafeEnchantment(Enchantment.LOOT_BONUS_MOBS, 10);
|
||||||
|
@ -83,17 +82,16 @@ public final class Main extends JavaPlugin implements Listener {
|
||||||
}
|
}
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void Projectile(ProjectileLaunchEvent e) {
|
public void Projectile(ProjectileLaunchEvent e) {
|
||||||
Player player = (Player) e.getEntity().getShooter();
|
if(e.getEntity().getShooter() instanceof Player) {
|
||||||
if(player.getInventory().getItemInMainHand().getItemMeta() != null) {
|
Player player = (Player) e.getEntity().getShooter();
|
||||||
String name = player.getInventory().getItemInMainHand().getItemMeta().getDisplayName();
|
if(player.getInventory().getItemInMainHand().getItemMeta() != null) {
|
||||||
if (name.equalsIgnoreCase(net.md_5.bungee.api.ChatColor.of("#ff23ff") + "Frag Grenade")) {
|
String name = player.getInventory().getItemInMainHand().getItemMeta().getDisplayName();
|
||||||
Egg s = (Egg) e.getEntity();
|
if (name.equalsIgnoreCase(net.md_5.bungee.api.ChatColor.of("#ff23ff") + "Frag Grenade")) {
|
||||||
s.setVelocity(player.getLocation().getDirection().multiply(10));
|
Egg s = (Egg) e.getEntity();
|
||||||
|
s.setVelocity(player.getLocation().getDirection().multiply(10));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPlayerInteract(PlayerInteractEvent e) {
|
public void onPlayerInteract(PlayerInteractEvent e) {
|
||||||
|
@ -111,7 +109,7 @@ public final class Main extends JavaPlugin implements Listener {
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onJoin(PlayerJoinEvent e) {
|
public void onJoin(PlayerJoinEvent e) {
|
||||||
e.setJoinMessage(rankManager.getRank(e.getPlayer().getUniqueId()).getDisplay() + " " + e.getPlayer().getName() + ChatColor.WHITE + " joined the server!");
|
|
||||||
|
|
||||||
e.getPlayer().sendTitle(ChatColor.RED +"Welcome to Apache!", ChatColor.GREEN + "LOL", 20, 100, 20);
|
e.getPlayer().sendTitle(ChatColor.RED +"Welcome to Apache!", ChatColor.GREEN + "LOL", 20, 100, 20);
|
||||||
e.getPlayer().spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText("§1NOT ENOUGH MANNER"));
|
e.getPlayer().spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText("§1NOT ENOUGH MANNER"));
|
||||||
|
|
|
@ -0,0 +1,20 @@
|
||||||
|
package com.night.nullvalkyrie.RankSys;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.scoreboard.DisplaySlot;
|
||||||
|
import org.bukkit.scoreboard.Objective;
|
||||||
|
import org.bukkit.scoreboard.Score;
|
||||||
|
import org.bukkit.scoreboard.Scoreboard;
|
||||||
|
|
||||||
|
public class BelowNameManager {
|
||||||
|
public void setBelowName(Player player) {
|
||||||
|
Scoreboard board = player.getScoreboard();
|
||||||
|
Objective obj = board.registerNewObjective("HealthBar", "health");
|
||||||
|
obj.setDisplaySlot(DisplaySlot.BELOW_NAME);
|
||||||
|
obj.setDisplayName("/ 20");
|
||||||
|
player.setScoreboard(board);
|
||||||
|
player.setHealth(player.getHealth());
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -30,6 +30,8 @@ public class ScoreboardListener implements Listener {
|
||||||
main.getNameTagManager().setNametags(player);
|
main.getNameTagManager().setNametags(player);
|
||||||
main.getNameTagManager().newTag(player);
|
main.getNameTagManager().newTag(player);
|
||||||
main.getSideBarManager().setSideBar(player);
|
main.getSideBarManager().setSideBar(player);
|
||||||
|
main.getBelowNameManager().setBelowName(player);
|
||||||
|
e.setJoinMessage(main.getRankManager().getRank(e.getPlayer().getUniqueId()).getDisplay() + " " + e.getPlayer().getName() + ChatColor.WHITE + " joined the server!");
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
|
|
|
@ -22,9 +22,6 @@ public class SideBarManager {
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
public void setSideBar(Player player) {
|
public void setSideBar(Player player) {
|
||||||
Scoreboard board = player.getScoreboard();
|
Scoreboard board = player.getScoreboard();
|
||||||
if(board.getObjective("Pluto") != null) {
|
|
||||||
|
|
||||||
}
|
|
||||||
Objective obj = board.registerNewObjective("Pluto", "dummy");
|
Objective obj = board.registerNewObjective("Pluto", "dummy");
|
||||||
obj.setDisplaySlot(DisplaySlot.SIDEBAR);
|
obj.setDisplaySlot(DisplaySlot.SIDEBAR);
|
||||||
obj.setDisplayName(ChatColor.AQUA.toString() + ChatColor.BOLD + "Pluto");
|
obj.setDisplayName(ChatColor.AQUA.toString() + ChatColor.BOLD + "Pluto");
|
||||||
|
|
|
@ -2,10 +2,7 @@ package com.night.nullvalkyrie.commands;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.*;
|
||||||
import org.bukkit.entity.EntityType;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.entity.Zombie;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -22,9 +19,13 @@ public class SpawnCommand extends Command {
|
||||||
@Override
|
@Override
|
||||||
public void onCommand(CommandSender sender, String[] args) {
|
public void onCommand(CommandSender sender, String[] args) {
|
||||||
Player player = (Player) sender;
|
Player player = (Player) sender;
|
||||||
Entity ent = (Entity) Bukkit.getWorld("world").spawnEntity((player.getLocation().add(0, 2, 0)), EntityType.ZOMBIE);
|
Entity ent = player.getWorld().spawnEntity((player.getLocation().add(0, 2, 0)), EntityType.ZOMBIE);
|
||||||
ent.setCustomName("Gay");
|
ent.setCustomName("Gay");
|
||||||
ent.setCustomNameVisible(true);
|
ent.setCustomNameVisible(true);
|
||||||
|
double ourHealth = 20 * 5;
|
||||||
|
Damageable ente = (Damageable) ent;
|
||||||
|
ente.setMaxHealth(ourHealth);
|
||||||
|
ente.setHealth(ourHealth);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue