okeee
This commit is contained in:
		@ -1,8 +1,6 @@
 | 
			
		||||
package rip.tilly.bedwars.listeners.game;
 | 
			
		||||
 | 
			
		||||
import org.bukkit.GameMode;
 | 
			
		||||
import org.bukkit.Material;
 | 
			
		||||
import org.bukkit.Sound;
 | 
			
		||||
import org.bukkit.*;
 | 
			
		||||
import org.bukkit.block.Block;
 | 
			
		||||
import org.bukkit.entity.Player;
 | 
			
		||||
import org.bukkit.event.EventHandler;
 | 
			
		||||
@ -72,6 +70,18 @@ public class WorldListener implements Listener {
 | 
			
		||||
            opposingTeam.destroyBed();
 | 
			
		||||
            game.broadcastWithSound(playerTeam.getPlayerTeam().getChatColor() + player.getName() + " &ehas destroyed " + opposingTeam.getPlayerTeam().getChatColor() + opposingTeam.getPlayerTeam().getName() + "'s &ebed!", Sound.ENDERDRAGON_GROWL);
 | 
			
		||||
            game.broadcastSound(Sound.ENDERDRAGON_GROWL);
 | 
			
		||||
 | 
			
		||||
            block.getDrops().clear();
 | 
			
		||||
            Location location = block.getLocation();
 | 
			
		||||
            World world = location.getWorld();
 | 
			
		||||
            world.playEffect(location, Effect.CRIT, 1, 400);
 | 
			
		||||
            world.playEffect(location, Effect.FLAME, 1, 400);
 | 
			
		||||
            world.playEffect(location, Effect.MOBSPAWNER_FLAMES, 1, 400);
 | 
			
		||||
            world.playEffect(location, Effect.PARTICLE_SMOKE, 1, 400);
 | 
			
		||||
            world.playEffect(location, Effect.VILLAGER_THUNDERCLOUD, 1, 400);
 | 
			
		||||
            world.playEffect(location, Effect.LARGE_SMOKE, 1, 400);
 | 
			
		||||
            world.playEffect(location, Effect.SMOKE, 1, 400);
 | 
			
		||||
            world.playEffect(location, Effect.PARTICLE_SMOKE, 1, 400);
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -46,6 +46,7 @@ public class PlayerDataManager {
 | 
			
		||||
			playerData.setWins(document.getInteger("wins"));
 | 
			
		||||
			playerData.setLosses(document.getInteger("losses"));
 | 
			
		||||
			playerData.setGamesPlayed(document.getInteger("gamesPlayed"));
 | 
			
		||||
			playerData.setBedsDestroyed(document.getInteger("bedsDestroyed"));
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		playerData.setLoaded(true);
 | 
			
		||||
@ -63,6 +64,7 @@ public class PlayerDataManager {
 | 
			
		||||
		document.put("wins", playerData.getWins());
 | 
			
		||||
		document.put("losses", playerData.getLosses());
 | 
			
		||||
		document.put("gamesPlayed", playerData.getGamesPlayed());
 | 
			
		||||
		document.put("bedsDestroyed", playerData.getBedsDestroyed());
 | 
			
		||||
 | 
			
		||||
		this.plugin.getMongoManager().getPlayers().replaceOne(Filters.eq("uniqueId", playerData.getUniqueId().toString()), document, new UpdateOptions().upsert(true));
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
@ -34,9 +34,11 @@ public class PlayerData {
 | 
			
		||||
    private int wins;
 | 
			
		||||
    private int losses;
 | 
			
		||||
    private int gamesPlayed;
 | 
			
		||||
    private int bedsDestroyed;
 | 
			
		||||
 | 
			
		||||
    private Player lastDamager;
 | 
			
		||||
    private int gameKills;
 | 
			
		||||
    private int gameBedsDestroyed;
 | 
			
		||||
 | 
			
		||||
    public PlayerData(UUID uniqueId) {
 | 
			
		||||
        this.uniqueId = uniqueId;
 | 
			
		||||
 | 
			
		||||
@ -9,31 +9,33 @@ import java.util.Arrays;
 | 
			
		||||
@Getter
 | 
			
		||||
public enum PlayerTeam {
 | 
			
		||||
 | 
			
		||||
    WHITE("White", Color.WHITE, ChatColor.WHITE, (byte) 0),
 | 
			
		||||
    SILVER("Silver", Color.SILVER, ChatColor.GRAY, (byte) 8),
 | 
			
		||||
    GRAY("Gray", Color.GRAY, ChatColor.DARK_GRAY, (byte) 7),
 | 
			
		||||
    BLACK("Black", Color.BLACK, ChatColor.BLACK, (byte) 15),
 | 
			
		||||
    BLUE("Blue", Color.BLUE, ChatColor.BLUE, (byte) 11),
 | 
			
		||||
    CYAN("Cyan", Color.TEAL, ChatColor.DARK_AQUA, (byte) 9),
 | 
			
		||||
    AQUA("Aqua", Color.AQUA, ChatColor.AQUA, (byte) 3),
 | 
			
		||||
    LIME("Lime", Color.LIME, ChatColor.GREEN, (byte) 5),
 | 
			
		||||
    GREEN("Green", Color.GREEN, ChatColor.DARK_GREEN, (byte) 13),
 | 
			
		||||
    YELLOW("Yellow", Color.YELLOW, ChatColor.YELLOW, (byte) 4),
 | 
			
		||||
    ORANGE("Orange", Color.ORANGE, ChatColor.GOLD, (byte) 1),
 | 
			
		||||
    RED("Red", Color.RED, ChatColor.RED, (byte) 14),
 | 
			
		||||
    PURPLE("Purple", Color.PURPLE, ChatColor.DARK_PURPLE, (byte) 10),
 | 
			
		||||
    PINK("Pink", Color.FUCHSIA, ChatColor.LIGHT_PURPLE, (byte) 6);
 | 
			
		||||
    WHITE("White", Color.WHITE, ChatColor.WHITE, 0, "W"),
 | 
			
		||||
    SILVER("Silver", Color.SILVER, ChatColor.GRAY, 8, "S"),
 | 
			
		||||
    GRAY("Gray", Color.GRAY, ChatColor.DARK_GRAY, 7, "G"),
 | 
			
		||||
    BLACK("Black", Color.BLACK, ChatColor.BLACK, 15, "B"),
 | 
			
		||||
    BLUE("Blue", Color.BLUE, ChatColor.BLUE, 11, "B"),
 | 
			
		||||
    CYAN("Cyan", Color.TEAL, ChatColor.DARK_AQUA, 9, "C"),
 | 
			
		||||
    AQUA("Aqua", Color.AQUA, ChatColor.AQUA, 3, "A"),
 | 
			
		||||
    LIME("Lime", Color.LIME, ChatColor.GREEN, 5, "L"),
 | 
			
		||||
    GREEN("Green", Color.GREEN, ChatColor.DARK_GREEN, 13, "G"),
 | 
			
		||||
    YELLOW("Yellow", Color.YELLOW, ChatColor.YELLOW, 4, "Y"),
 | 
			
		||||
    ORANGE("Orange", Color.ORANGE, ChatColor.GOLD, 1, "O"),
 | 
			
		||||
    RED("Red", Color.RED, ChatColor.RED, 14, "R"),
 | 
			
		||||
    PURPLE("Purple", Color.PURPLE, ChatColor.DARK_PURPLE, 10, "P"),
 | 
			
		||||
    PINK("Pink", Color.FUCHSIA, ChatColor.LIGHT_PURPLE, 6, "P");
 | 
			
		||||
 | 
			
		||||
    private final String name;
 | 
			
		||||
    private final Color color;
 | 
			
		||||
    private final ChatColor chatColor;
 | 
			
		||||
    private final byte colorData;
 | 
			
		||||
    private final int colorData;
 | 
			
		||||
    private final String smallName;
 | 
			
		||||
 | 
			
		||||
    PlayerTeam(String name, Color color, ChatColor chatColor, byte colorData) {
 | 
			
		||||
    PlayerTeam(String name, Color color, ChatColor chatColor, int colorData, String smallName) {
 | 
			
		||||
        this.name = name;
 | 
			
		||||
        this.color = color;
 | 
			
		||||
        this.chatColor = chatColor;
 | 
			
		||||
        this.colorData = colorData;
 | 
			
		||||
        this.smallName = smallName;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public static PlayerTeam getFromName(String name) {
 | 
			
		||||
 | 
			
		||||
@ -1,6 +1,8 @@
 | 
			
		||||
package rip.tilly.bedwars.providers.scoreboard;
 | 
			
		||||
 | 
			
		||||
import org.bukkit.Bukkit;
 | 
			
		||||
import rip.tilly.bedwars.game.Game;
 | 
			
		||||
import rip.tilly.bedwars.game.GameTeam;
 | 
			
		||||
import rip.tilly.bedwars.managers.party.Party;
 | 
			
		||||
import rip.tilly.bedwars.managers.queue.QueueEntry;
 | 
			
		||||
import rip.tilly.bedwars.playerdata.PlayerState;
 | 
			
		||||
@ -35,8 +37,9 @@ public class ScoreboardProvider implements AssembleAdapter {
 | 
			
		||||
            case SPAWN:
 | 
			
		||||
            case QUEUE:
 | 
			
		||||
                return this.spawnScoreboard(playerData);
 | 
			
		||||
            case RESPAWNING:
 | 
			
		||||
            case PLAYING:
 | 
			
		||||
                return null;
 | 
			
		||||
                return this.playingScoreboard(playerData);
 | 
			
		||||
            case SPECTATING:
 | 
			
		||||
                return null;
 | 
			
		||||
        }
 | 
			
		||||
@ -103,8 +106,32 @@ public class ScoreboardProvider implements AssembleAdapter {
 | 
			
		||||
 | 
			
		||||
    private List<String> playingScoreboard(PlayerData playerData) {
 | 
			
		||||
        List<String> lines = new ArrayList<String>();
 | 
			
		||||
        Game game = this.main.getGameManager().getGame(playerData);
 | 
			
		||||
        GameTeam yourTeam = game.getTeamByName(playerData.getPlayerTeam().getName());
 | 
			
		||||
        GameTeam opposingTeam = game.getTeams().get(playerData.getTeamId() == 1 ? 0 : 1);
 | 
			
		||||
 | 
			
		||||
        lines.add(CC.scoreboardBar);
 | 
			
		||||
        lines.add("&fDuration: &d" + game.getDuration());
 | 
			
		||||
        lines.add(" ");
 | 
			
		||||
        if (yourTeam.isHasBed()) {
 | 
			
		||||
            lines.add("&f[" + yourTeam.getPlayerTeam().getChatColor() + yourTeam.getPlayerTeam().getSmallName() + "&f] &a&l✓ &7(YOU)");
 | 
			
		||||
        } else if (yourTeam.getPlayingPlayers().size() > 0) {
 | 
			
		||||
            lines.add("&f[" + yourTeam.getPlayerTeam().getChatColor() + yourTeam.getPlayerTeam().getSmallName() + "&f] &7" + yourTeam.getPlayingPlayers().size() + " &7(YOU)");
 | 
			
		||||
        } else {
 | 
			
		||||
            lines.add("&f[" + yourTeam.getPlayerTeam().getChatColor() + yourTeam.getPlayerTeam().getSmallName() + "&f] &c&l✗ &7(YOU)");
 | 
			
		||||
        }
 | 
			
		||||
        if (opposingTeam.isHasBed()) {
 | 
			
		||||
            lines.add("&f[" + opposingTeam.getPlayerTeam().getChatColor() + opposingTeam.getPlayerTeam().getSmallName() + "&f] &a&l✓");
 | 
			
		||||
        } else if (opposingTeam.getPlayingPlayers().size() > 0) {
 | 
			
		||||
            lines.add("&f[" + opposingTeam.getPlayerTeam().getChatColor() + opposingTeam.getPlayerTeam().getSmallName() + "&f] &7" + yourTeam.getPlayingPlayers().size());
 | 
			
		||||
        } else {
 | 
			
		||||
            lines.add("&f[" + opposingTeam.getPlayerTeam().getChatColor() + opposingTeam.getPlayerTeam().getSmallName() + "&f] &c&l✗");
 | 
			
		||||
        }
 | 
			
		||||
        lines.add(" ");
 | 
			
		||||
        lines.add("&fKills: &d" + playerData.getGameKills());
 | 
			
		||||
        lines.add("&fBeds Destroyed: &d");
 | 
			
		||||
        lines.add(" ");
 | 
			
		||||
        lines.add("&dtilly.rip");
 | 
			
		||||
        lines.add(CC.scoreboardBar);
 | 
			
		||||
 | 
			
		||||
        return CC.translate(lines);
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user