use of net.md_5.bungee.api.chat.TextComponent in project Arcade2 by ShootGame.
the class RestartCountdown method onTick.
@Override
public void onTick(long ticks) {
Game game = this.plugin.getGames().getCurrentGame();
if (game == null) {
return;
} else if (this.getProgress() > 1) {
return;
}
String message = this.getPrintMessage(this.getRestartMessage());
BossBar bossBar = this.getBossBar();
bossBar.setProgress(Percentage.finite(this.getProgress()));
bossBar.setText(new TextComponent(message));
for (ArcadePlayer online : this.plugin.getPlayers()) {
GamePlayer player = online.getGamePlayer();
if (player != null) {
bossBar.addPlayer(player, BAR_PRIORITY);
}
}
}
use of net.md_5.bungee.api.chat.TextComponent in project Arcade2 by ShootGame.
the class MatchStartCountdown method onTick.
@Override
public void onTick(long ticks) {
Game game = this.plugin.getGames().getCurrentGame();
if (game == null) {
return;
} else if (this.getProgress() > 1) {
return;
}
String message = this.getPrintMessage(this.getStartMessage());
BossBar bossBar = this.getBossBar();
bossBar.setProgress(Percentage.finite(this.getProgress()));
bossBar.setText(new TextComponent(message));
for (ArcadePlayer online : this.plugin.getPlayers()) {
GamePlayer player = online.getGamePlayer();
if (player != null) {
bossBar.addPlayer(player, BAR_PRIORITY);
}
}
}
use of net.md_5.bungee.api.chat.TextComponent in project SkinsRestorerX by DoNotSpamPls.
the class SkinsRestorer method checkVersion.
private String checkVersion(CommandSender console) {
try {
HttpsURLConnection con = (HttpsURLConnection) new URL("https://api.spigotmc.org/legacy/update.php?resource=2124").openConnection();
con.setDoOutput(true);
con.setRequestMethod("GET");
String version = new BufferedReader(new InputStreamReader(con.getInputStream())).readLine();
if (version.length() <= 13)
return version;
} catch (Exception ex) {
ex.printStackTrace();
console.sendMessage(new TextComponent("§e[§2SkinsRestorer§e] §cFailed to check for an update on Spigot."));
}
return getVersion();
}
use of net.md_5.bungee.api.chat.TextComponent in project SkinsRestorerX by DoNotSpamPls.
the class AdminCommands method execute.
@SuppressWarnings("deprecation")
public void execute(final CommandSender sender, final String[] args) {
if (sender.hasPermission("skinsrestorer.cmds")) {
if (args.length == 1 && args[0].equalsIgnoreCase("reload")) {
Locale.load();
Config.load(SkinsRestorer.getInstance().getResourceAsStream("config.yml"));
sender.sendMessage(new TextComponent(Locale.RELOAD));
} else if (args.length == 2 && args[0].equalsIgnoreCase("drop")) {
StringBuilder sb = new StringBuilder();
SkinStorage.removeSkinData(sb.toString());
sender.sendMessage(Locale.SKIN_DATA_DROPPED.replace("%player", sb.toString()));
} else if (args.length > 2 && args[0].equalsIgnoreCase("set")) {
final String skin = args[2];
ProxiedPlayer player = ProxyServer.getInstance().getPlayer(args[1]);
if (player == null)
for (ProxiedPlayer pl : ProxyServer.getInstance().getPlayers()) if (pl.getName().startsWith(args[1])) {
player = pl;
break;
}
if (player == null) {
sender.sendMessage(Locale.NOT_ONLINE);
return;
}
final ProxiedPlayer p = player;
ProxyServer.getInstance().getScheduler().runAsync(SkinsRestorer.getInstance(), () -> {
try {
MojangAPI.getUUID(skin);
SkinStorage.setPlayerSkin(p.getName(), skin);
SkinApplier.applySkin(p);
sender.sendMessage(Locale.SKIN_CHANGE_SUCCESS);
} catch (MojangAPI.SkinRequestException e) {
sender.sendMessage(e.getReason());
}
});
} else if (args.length == 1 && args[0].equalsIgnoreCase("config")) {
sender.sendMessage("§e[§2SkinsRestorer§e] §2/sr config has been removed from SkinsRestorer. Farewell!");
} else if (args.length > 0 && args[0].equalsIgnoreCase("props")) {
ProxiedPlayer p;
if (args.length == 1) {
if (!(sender instanceof ProxiedPlayer)) {
sender.sendMessage(Locale.NOT_PLAYER);
}
p = (ProxiedPlayer) sender;
} else {
StringBuilder name = new StringBuilder();
for (int i = 1; i < args.length; i++) if (args.length == 2)
name.append(args[i]);
else if (i + 1 == args.length)
name.append(args[i]);
else
name.append(args[i]).append(" ");
p = ProxyServer.getInstance().getPlayer(name.toString());
if (p == null) {
sender.sendMessage(Locale.NOT_ONLINE);
return;
}
}
InitialHandler h = (InitialHandler) p.getPendingConnection();
LoginResult.Property prop = h.getLoginProfile().getProperties()[0];
if (prop == null) {
sender.sendMessage(Locale.NO_SKIN_DATA);
return;
}
CommandSender cons = ProxyServer.getInstance().getConsole();
cons.sendMessage("\n§aName: §8" + prop.getName());
cons.sendMessage("\n§aValue : §8" + prop.getValue());
cons.sendMessage("\n§aSignature : §8" + prop.getSignature());
byte[] decoded = Base64.getDecoder().decode(prop.getValue());
cons.sendMessage("\n§aValue Decoded: §e" + Arrays.toString(decoded));
sender.sendMessage("\n§e" + Arrays.toString(decoded));
sender.sendMessage("§cMore info in console!");
} else {
if (!Locale.SR_LINE.isEmpty())
sender.sendMessage(Locale.SR_LINE);
sender.sendMessage(Locale.HELP_ADMIN.replace("%ver%", SkinsRestorer.getInstance().getVersion()));
if (!Locale.SR_LINE.isEmpty())
sender.sendMessage(Locale.SR_LINE);
}
} else {
sender.sendMessage(Locale.PLAYER_HAS_NO_PERMISSION);
}
}
use of net.md_5.bungee.api.chat.TextComponent in project FireAPI by FireBlade-Serv.
the class Events method onConnection.
@EventHandler
public void onConnection(PreLoginEvent e) {
String name = e.getConnection().getName();
String ip = e.getConnection().getAddress().getAddress().getHostAddress();
this.instance.getBungeePlugin().getLogger().info("Tentative de connection de " + name + " avec l'adresse IP : " + ip + ".");
try {
this.instance.getWhitelistSystem().setDefault(name, ip);
this.instance.getWhitelistSystem().loadConfiguration();
} catch (IOException e2) {
this.instance.getChatUtils().sendMessageToGroup(this.instance.getWhitelistSystem().getPrefix() + "§c Une erreur critique est survenue ! {name = " + name + ", " + e2.getMessage() + "}", VersionType.BUNGEECORD_VERSION, Rank.MODÉRATEUR);
e.setCancelReason(new TextComponent("§cUne erreur critique est survenue ! Veuillez contacter Glowstoner ! (SpamBot ?)"));
e.setCancelled(true);
return;
}
if (this.instance.getWhitelistSystem().isEnable() == false) {
return;
}
File file = new File(this.instance.getBungeePlugin().getDataFolder(), "whitelist.yml");
Configuration config;
try {
config = ConfigurationProvider.getProvider(YamlConfiguration.class).load(file);
boolean accepted = config.getBoolean("players." + name + ".accepted");
if (config.getString("players." + name + ".ip").equals(ip) && accepted == true) {
return;
}
e.setCancelReason(new TextComponent("§cLe serveur est en maintenance !\n§9Discord : https://discordapp.com/invite/H7acUcX"));
e.setCancelled(true);
} catch (IOException e1) {
this.instance.getChatUtils().sendMessageToGroup(this.instance.getWhitelistSystem().getPrefix() + "§c Une erreur critique est survenue ! {name = " + name + ", " + e1.getMessage() + "}", VersionType.BUNGEECORD_VERSION, Rank.MODÉRATEUR);
}
}
Aggregations