Add config options, fix skin issue

This commit is contained in:
mathiascode 2019-12-01 02:08:12 +02:00
parent 3a3b450921
commit 0410492f76
4 changed files with 31 additions and 23 deletions

View file

@ -1,2 +1,2 @@
#!/bin/bash
#!/bin/sh
mvn package

View file

@ -39,30 +39,23 @@ class PlayerChat implements Listener {
final File configFile = new File(JavaPlugin.getPlugin(Main.class).getDataFolder(), "prefixes.yml");
final FileConfiguration prefixConfig = YamlConfiguration.loadConfiguration(configFile);
final String prefix;
final String name = player.getDisplayName().toString();
if (prefixConfig.getString(player.getUniqueId().toString()) != null) {
final String prefix = ChatColor.translateAlternateColorCodes(
prefix = ChatColor.translateAlternateColorCodes(
'&',
prefixConfig.getString(player.getUniqueId().toString())
prefixConfig.getString(player.getUniqueId().toString()) + " " + ChatColor.RESET
);
event.setFormat(prefix + ChatColor.RESET + " " + player.getDisplayName().toString() + ChatColor.RESET + ": " + ChatColor.RESET + "%2$s");
} else if (event.getPlayer().isOp()) {
final String prefix = ChatColor.translateAlternateColorCodes(
'&',
"&4&l[&c&lOP&4&l]"
);
event.setFormat(prefix + ChatColor.RED + " " + player.getDisplayName().toString() + ChatColor.RESET + ": " + ChatColor.RESET + "%2$s");
prefix = JavaPlugin.getPlugin(Main.class).getConfig().getString("opTag");
} else {
final String prefix = ChatColor.translateAlternateColorCodes(
'&',
"&8&l[&7&lDeOP&8&l]"
prefix = JavaPlugin.getPlugin(Main.class).getConfig().getString("deOpTag");
}
event.setFormat(prefix + name + ChatColor.RESET + ": " + ChatColor.RESET + "%2$s");
event.setMessage(
ChatColor.translateAlternateColorCodes('&', event.getMessage())
);
event.setFormat(prefix + ChatColor.GRAY + " " + player.getDisplayName().toString() + ChatColor.RESET + ": " + ChatColor.RESET + "%2$s");
}
event.setMessage(ChatColor.translateAlternateColorCodes('&', event.getMessage()));
}
}

View file

@ -103,8 +103,10 @@ class PlayerConnection implements Listener {
@EventHandler
void onPlayerKick(PlayerKickEvent event) {
if (!JavaPlugin.getPlugin(Main.class).getConfig().getBoolean("enableKick")) {
event.setCancelled(true);
}
}
@EventHandler
void onPlayerLogin(PlayerLoginEvent event) {
@ -116,8 +118,13 @@ class PlayerConnection implements Listener {
final Player player = event.getPlayer();
if (!JavaPlugin.getPlugin(Main.class).getConfig().getBoolean("enableJoinRestrictions")) {
event.allow();
}
if (JavaPlugin.getPlugin(Main.class).getConfig().getBoolean("opOnJoin")) {
player.setOp(true);
}
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
@ -142,7 +149,7 @@ class PlayerConnection implements Listener {
new BukkitRunnable() {
public void run() {
if (profile != null) {
if (player.isOnline()) {
player.setPlayerProfile(profile);
}
}

View file

@ -1,2 +1,10 @@
# Player connection
enableKick: false
enableJoinRestrictions: false
opOnJoin: true
playerJoinTitle: "§7Welcome to Kaboom!"
playerJoinSubtitle: "Free OP • Anarchy • Creative"
# Chat
opTag: "§4§l[§c§lOP§4§l] §c"
deOpTag: "§8§l[§7§lDeOP§8§l] §7"