mirror of
https://github.com/Aust1n46/VentureChat.git
synced 2025-05-23 10:39:05 +00:00
Added 'support' for Bukkit /reload.
This commit is contained in:
parent
8010d60880
commit
6d431cebc5
@ -211,6 +211,13 @@ public class MineverseChat extends JavaPlugin implements PluginMessageListener {
|
||||
// Get config and handle
|
||||
// Configuration
|
||||
//Localization.initialize();
|
||||
|
||||
Bukkit.getConsoleSender().sendMessage(Format.FormatStringAll("&8[&eVentureChat&8]&e - Registering Listeners"));
|
||||
// Channel information reference
|
||||
aaInfo = new AliasInfo(this);
|
||||
jfInfo = new JsonFormatInfo(this);
|
||||
gsInfo = new GuiSlotInfo();
|
||||
|
||||
PlayerData.initialize();
|
||||
if(this.firstRun) {
|
||||
for(String uuidString : PlayerData.getPlayerData().getConfigurationSection("players").getKeys(false)) {
|
||||
@ -258,7 +265,7 @@ public class MineverseChat extends JavaPlugin implements PluginMessageListener {
|
||||
boolean filter = PlayerData.getPlayerData().getConfigurationSection("players." + uuidString).getBoolean("filter");
|
||||
boolean notifications = PlayerData.getPlayerData().getConfigurationSection("players." + uuidString).getBoolean("notifications");
|
||||
String nickname = PlayerData.getPlayerData().getConfigurationSection("players." + uuidString).getString("nickname");
|
||||
String jsonFormat = PlayerData.getPlayerData().getConfigurationSection("players." + uuidString).getString("jsonformat");
|
||||
String jsonFormat = "Default";
|
||||
boolean spy = PlayerData.getPlayerData().getConfigurationSection("players." + uuidString).getBoolean("spy", false);
|
||||
boolean commandSpy = PlayerData.getPlayerData().getConfigurationSection("players." + uuidString).getBoolean("commandspy", false);
|
||||
boolean rangedSpy = PlayerData.getPlayerData().getConfigurationSection("players." + uuidString).getBoolean("rangedspy", false);
|
||||
@ -271,15 +278,11 @@ public class MineverseChat extends JavaPlugin implements PluginMessageListener {
|
||||
MineverseChatPlayer mcp = MineverseChatAPI.getMineverseChatPlayer(p);
|
||||
mcp.setName(p.getName());
|
||||
mcp.setOnline(true);
|
||||
mcp.setHasPlayed(false);
|
||||
mcp.setJsonFormat();
|
||||
onlinePlayers.add(mcp);
|
||||
}
|
||||
|
||||
Bukkit.getConsoleSender().sendMessage(Format.FormatStringAll("&8[&eVentureChat&8]&e - Registering Listeners"));
|
||||
// Channel information reference
|
||||
aaInfo = new AliasInfo(this);
|
||||
jfInfo = new JsonFormatInfo(this);
|
||||
gsInfo = new GuiSlotInfo();
|
||||
|
||||
if(ccInfo == null) {
|
||||
Bukkit.getConsoleSender().sendMessage(Format.FormatStringAll("&8[&eVentureChat&8]&e - &cConfiguration is BAD!"));
|
||||
}
|
||||
|
@ -7,7 +7,9 @@ import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
import mineverse.Aust1n46.chat.ChatMessage;
|
||||
import mineverse.Aust1n46.chat.MineverseChat;
|
||||
import mineverse.Aust1n46.chat.channel.ChatChannel;
|
||||
import mineverse.Aust1n46.chat.json.JsonFormat;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
@ -516,7 +518,13 @@ public class MineverseChatPlayer {
|
||||
return this.jsonFormat;
|
||||
}
|
||||
|
||||
public void setJsonFormat(String jsonFormat) {
|
||||
this.jsonFormat = jsonFormat;
|
||||
public void setJsonFormat() {
|
||||
for(JsonFormat j : MineverseChat.jfInfo.getJsonFormats()) {
|
||||
if(this.getPlayer().hasPermission("venturechat.json." + j.getName())) {
|
||||
if(MineverseChat.jfInfo.getJsonFormat(this.getJsonFormat()).getPriority() > j.getPriority()) {
|
||||
this.jsonFormat = j.getName();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -15,7 +15,6 @@ import mineverse.Aust1n46.chat.api.MineverseChatPlayer;
|
||||
import mineverse.Aust1n46.chat.channel.ChatChannel;
|
||||
import mineverse.Aust1n46.chat.channel.ChatChannelInfo;
|
||||
import mineverse.Aust1n46.chat.database.PlayerData;
|
||||
import mineverse.Aust1n46.chat.json.JsonFormat;
|
||||
import mineverse.Aust1n46.chat.utilities.Format;
|
||||
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
@ -86,23 +85,16 @@ public class LoginListener implements Listener {
|
||||
mcp.setOnline(true);
|
||||
mcp.setHasPlayed(false);
|
||||
MineverseChat.onlinePlayers.add(mcp);
|
||||
mcp.setJsonFormat("Default");
|
||||
for(JsonFormat j : MineverseChat.jfInfo.getJsonFormats()) {
|
||||
if(mcp.getPlayer().hasPermission("venturechat.json." + j.getName())) {
|
||||
if(MineverseChat.jfInfo.getJsonFormat(mcp.getJsonFormat()).getPriority() > j.getPriority()) {
|
||||
mcp.setJsonFormat(j.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
mcp.setJsonFormat();
|
||||
if(mcp.getNickname().equals(mcp.getName())) {
|
||||
mcp.setNickname(event.getPlayer().getName());
|
||||
}
|
||||
mcp.getPlayer().setDisplayName(Format.FormatStringAll(mcp.getNickname()));
|
||||
if(plugin.getConfig().getBoolean("nickname-in-tablist", false)) {
|
||||
String nick = mcp.getNickname();
|
||||
if(nick.length() >= 16) {
|
||||
nick = nick.substring(0, 16);
|
||||
}
|
||||
if(plugin.getConfig().getBoolean("nickname-in-tablist", false)) {
|
||||
mcp.getPlayer().setPlayerListName(Format.FormatStringAll(nick));
|
||||
}
|
||||
for(ChatChannel ch : MineverseChat.ccInfo.getAutojoinList()) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user