Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void runDebugPanel() {
- new BukkitRunnable() {
- Player player = getPlayer();
- WrapperPlayServerScoreboardObjective objective = new WrapperPlayServerScoreboardObjective();
- WrapperPlayServerScoreboardDisplayObjective disp = new WrapperPlayServerScoreboardDisplayObjective();
- @Override
- public void run() {
- if (!playersMap.containsKey(playerName)) {
- cancel();
- return;
- }
- if (CustomWorld.getCustomWorld().getWorld() != player.getWorld()) {
- removeBoard(player);
- return;
- }
- List<WrapperPlayServerScoreboardScore> scores = Lists.newArrayList();
- Cupboard cupboard = Cupboard.fromLocation(player.getLocation().getBlock().getLocation());
- Radtown radtown = Radtown.fromLocation(player.getLocation().getBlock().getLocation());
- boolean isBuilding;
- int slot = 14;
- isBuilding = cupboard == null ? radtown == null : cupboard.getOwnersList().contains(player.getUniqueId());
- for (String s : new String[]{
- (cupboard != null || radtown != null ? "&6» &7Строительство: " + (isBuilding ? "&aразрешено" : "&cзапрещено") : null),
- cupboard != null || radtown != null ? " " : null,
- "&6» " + "&a&l&nЗдоровье&a&l: " + (healthRegen == 0 ? "" : "&7(" + (healthRegen > 0 ? "&a+" + healthRegen : "&c" + healthRegen) + "&7)"),
- "&6» &7(&a" + (int) player.getHealth() + "&7) " + (Utils.generateLine(15, (int) player.getHealth(), 100, "&a&l", "&2&l")),
- "&6» " + "&b&l&nВода&b&l:",
- "&6» &7(&a" + water + "&7) " + (Utils.generateLine(15, water, 250, "&b&l", "&3&l")),
- "&6» " + "&e&l&nГолод&e&l:",
- "&6» &7(&a" + food + "&7) " + (Utils.generateLine(15, food, 500, "&e&l", "&6&l")),
- (radiation != 0 || bloodingCount != 0 || temperature <= 0 || temperature >= 30 ? " " : null),
- radiation != 0 ? "&6» &c&lРадиация &7[&c&l" + radiation + "&7]" : null,
- bloodingCount != 0 ? "&6» &c&lТечет кровь! - &7[&c&l" + bloodingCount + "&7]" : null,
- temperature <= 0 ? "&6» &e&lМне холодно! - &7[&b&l" + temperature + "℃&7]" : temperature >= 30 ? "&6» &e&lМне жарко! - &7[&6&l+" + temperature + "℃&7]" : null,
- " ",
- "&6» &7Координаты » &a" + player.getLocation().getBlockX() + " " + player.getLocation().getBlockY() + " " + player.getLocation().getBlockZ(),
- }) {
- if (s == null) continue;
- WrapperPlayServerScoreboardScore score = new WrapperPlayServerScoreboardScore();
- score.setObjectiveName("mr" + player.getName());
- score.setScoreboardAction(EnumWrappers.ScoreboardAction.CHANGE);
- score.setScoreName(Utils.stripColor(s));
- score.setValue(slot);
- scores.add(score);
- --slot;
- }
- removeBoard(player);
- objective.setName("mr" + player.getName());
- objective.setDisplayName(Utils.stripColor("&f&lMC&c&lRust &7- &a" + Main.plugin.getDescription().getVersion()));
- objective.setMode(0);
- disp.setPosition(1);
- disp.setScoreName("mr" + player.getName());
- objective.sendPacket(player);
- disp.sendPacket(player);
- for (WrapperPlayServerScoreboardScore score : scores) score.sendPacket(player);
- }
- }.runTaskTimer(Main.plugin, 1, 10);
- }
- private boolean isValid(Player player) {
- if (Respawn.fromPlayerName(player.getName()) != null) return false;
- if (player.isDead()) return false;
- return player.getGameMode() == GameMode.SURVIVAL || player.getGameMode() == GameMode.ADVENTURE;
- }
- private void removeBoard(Player player) {
- WrapperPlayServerScoreboardObjective remove = new WrapperPlayServerScoreboardObjective();
- remove.setName("mr" + player.getName());
- remove.setDisplayName(Utils.stripColor(player.getName()));
- remove.setMode(1);
- remove.sendPacket(player);
- }
Advertisement
Add Comment
Please, Sign In to add comment