mirror of
https://github.com/kaboomserver/extras.git
synced 2025-08-06 20:43:01 +00: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
|
mvn package
|
|
@ -39,30 +39,23 @@ class PlayerChat implements Listener {
|
||||||
|
|
||||||
final File configFile = new File(JavaPlugin.getPlugin(Main.class).getDataFolder(), "prefixes.yml");
|
final File configFile = new File(JavaPlugin.getPlugin(Main.class).getDataFolder(), "prefixes.yml");
|
||||||
final FileConfiguration prefixConfig = YamlConfiguration.loadConfiguration(configFile);
|
final FileConfiguration prefixConfig = YamlConfiguration.loadConfiguration(configFile);
|
||||||
|
final String prefix;
|
||||||
|
final String name = player.getDisplayName().toString();
|
||||||
|
|
||||||
if (prefixConfig.getString(player.getUniqueId().toString()) != null) {
|
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()) {
|
} else if (event.getPlayer().isOp()) {
|
||||||
final String prefix = ChatColor.translateAlternateColorCodes(
|
prefix = JavaPlugin.getPlugin(Main.class).getConfig().getString("opTag");
|
||||||
'&',
|
|
||||||
"&4&l[&c&lOP&4&l]"
|
|
||||||
);
|
|
||||||
|
|
||||||
event.setFormat(prefix + ChatColor.RED + " " + player.getDisplayName().toString() + ChatColor.RESET + ": " + ChatColor.RESET + "%2$s");
|
|
||||||
} else {
|
} else {
|
||||||
final String prefix = ChatColor.translateAlternateColorCodes(
|
prefix = JavaPlugin.getPlugin(Main.class).getConfig().getString("deOpTag");
|
||||||
'&',
|
|
||||||
"&8&l[&7&lDeOP&8&l]"
|
|
||||||
);
|
|
||||||
|
|
||||||
event.setFormat(prefix + ChatColor.GRAY + " " + player.getDisplayName().toString() + ChatColor.RESET + ": " + ChatColor.RESET + "%2$s");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
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
|
@EventHandler
|
||||||
void onPlayerKick(PlayerKickEvent event) {
|
void onPlayerKick(PlayerKickEvent event) {
|
||||||
event.setCancelled(true);
|
if (!JavaPlugin.getPlugin(Main.class).getConfig().getBoolean("enableKick")) {
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
|
@ -116,8 +118,13 @@ class PlayerConnection implements Listener {
|
||||||
|
|
||||||
final Player player = event.getPlayer();
|
final Player player = event.getPlayer();
|
||||||
|
|
||||||
event.allow();
|
if (!JavaPlugin.getPlugin(Main.class).getConfig().getBoolean("enableJoinRestrictions")) {
|
||||||
player.setOp(true);
|
event.allow();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (JavaPlugin.getPlugin(Main.class).getConfig().getBoolean("opOnJoin")) {
|
||||||
|
player.setOp(true);
|
||||||
|
}
|
||||||
|
|
||||||
HttpClient client = HttpClient.newHttpClient();
|
HttpClient client = HttpClient.newHttpClient();
|
||||||
HttpRequest request = HttpRequest.newBuilder()
|
HttpRequest request = HttpRequest.newBuilder()
|
||||||
|
@ -142,7 +149,7 @@ class PlayerConnection implements Listener {
|
||||||
|
|
||||||
new BukkitRunnable() {
|
new BukkitRunnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
if (profile != null) {
|
if (player.isOnline()) {
|
||||||
player.setPlayerProfile(profile);
|
player.setPlayerProfile(profile);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,2 +1,10 @@
|
||||||
|
# Player connection
|
||||||
|
enableKick: false
|
||||||
|
enableJoinRestrictions: false
|
||||||
|
opOnJoin: true
|
||||||
playerJoinTitle: "§7Welcome to Kaboom!"
|
playerJoinTitle: "§7Welcome to Kaboom!"
|
||||||
playerJoinSubtitle: "Free OP • Anarchy • Creative"
|
playerJoinSubtitle: "Free OP • Anarchy • Creative"
|
||||||
|
|
||||||
|
# Chat
|
||||||
|
opTag: "§4§l[§c§lOP§4§l] §c"
|
||||||
|
deOpTag: "§8§l[§7§lDeOP§8§l] §7"
|
Loading…
Add table
Add a link
Reference in a new issue