mirror of
https://github.com/kaboomserver/extras.git
synced 2024-11-23 16:08:18 -05:00
Add config options, fix skin issue
This commit is contained in:
parent
3a3b450921
commit
0410492f76
4 changed files with 31 additions and 23 deletions
2
build.sh
2
build.sh
|
@ -1,2 +1,2 @@
|
|||
#!/bin/bash
|
||||
#!/bin/sh
|
||||
mvn package
|
|
@ -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]"
|
||||
);
|
||||
|
||||
event.setFormat(prefix + ChatColor.GRAY + " " + player.getDisplayName().toString() + ChatColor.RESET + ": " + ChatColor.RESET + "%2$s");
|
||||
prefix = JavaPlugin.getPlugin(Main.class).getConfig().getString("deOpTag");
|
||||
}
|
||||
|
||||
event.setMessage(ChatColor.translateAlternateColorCodes('&', event.getMessage()));
|
||||
event.setFormat(prefix + name + ChatColor.RESET + ": " + ChatColor.RESET + "%2$s");
|
||||
event.setMessage(
|
||||
ChatColor.translateAlternateColorCodes('&', event.getMessage())
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -103,7 +103,9 @@ class PlayerConnection implements Listener {
|
|||
|
||||
@EventHandler
|
||||
void onPlayerKick(PlayerKickEvent event) {
|
||||
event.setCancelled(true);
|
||||
if (!JavaPlugin.getPlugin(Main.class).getConfig().getBoolean("enableKick")) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
|
@ -116,8 +118,13 @@ class PlayerConnection implements Listener {
|
|||
|
||||
final Player player = event.getPlayer();
|
||||
|
||||
event.allow();
|
||||
player.setOp(true);
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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"
|
Loading…
Reference in a new issue