mirror of
				https://github.com/Aust1n46/VentureChat.git
				synced 2025-10-30 21:52:23 +00:00 
			
		
		
		
	Resolve more merge conflicts due to file system layout change.
This commit is contained in:
		
							parent
							
								
									81ffcda38b
								
							
						
					
					
						commit
						d20e2c0535
					
				| @ -105,34 +105,15 @@ public class MineverseChat extends JavaPlugin implements PluginMessageListener { | |||||||
| 		Bukkit.getConsoleSender().sendMessage(Format.FormatStringAll("&8[&eVentureChat&8]&e - Checking for Vault...")); | 		Bukkit.getConsoleSender().sendMessage(Format.FormatStringAll("&8[&eVentureChat&8]&e - Checking for Vault...")); | ||||||
| 		 | 		 | ||||||
| 		if(!setupPermissions() || !setupChat()) { | 		if(!setupPermissions() || !setupChat()) { | ||||||
| 			Bukkit.getConsoleSender().sendMessage(Format.FormatStringAll("&8[&eVentureChat&8]&e - &cCould not find Vault dependency, disabling.")); | 			Bukkit.getConsoleSender().sendMessage(Format.FormatStringAll("&8[&eVentureChat&8]&e - &cCould not find Vault and/or a Vault compatible permissions plugin!")); | ||||||
| 			Bukkit.getPluginManager().disablePlugin(this); | 			Bukkit.getPluginManager().disablePlugin(this); | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
| 		Localization.initialize(); | 		initializeConfigReaders(); | ||||||
| 		Alias.initialize(); |  | ||||||
| 		JsonFormat.initialize(); |  | ||||||
| 		GuiSlot.initialize(); |  | ||||||
| 		ChatChannel.initialize(false); |  | ||||||
| 		 | 		 | ||||||
| 		Bukkit.getConsoleSender().sendMessage(Format.FormatStringAll("&8[&eVentureChat&8]&e - Loading player data")); | 		Bukkit.getConsoleSender().sendMessage(Format.FormatStringAll("&8[&eVentureChat&8]&e - Loading player data")); | ||||||
| 		PlayerData.loadLegacyPlayerData(); | 		PlayerData.loadLegacyPlayerData(); | ||||||
| 		PlayerData.loadPlayerData(); | 		PlayerData.loadPlayerData(); | ||||||
| 		for(Player p : getServer().getOnlinePlayers()) { |  | ||||||
| 			MineverseChatPlayer mcp = MineverseChatAPI.getMineverseChatPlayer(p); |  | ||||||
| 			if(mcp == null) { |  | ||||||
| 				Bukkit.getConsoleSender().sendMessage(Format.FormatStringAll("&8[&eVentureChat&8]&c - Could not find player data post reload for currently online player: " + p.getName())); |  | ||||||
| 				Bukkit.getConsoleSender().sendMessage(Format.FormatStringAll("&8[&eVentureChat&8]&c - There could be an issue with your player data saving.")); |  | ||||||
| 				String name = p.getName(); |  | ||||||
| 				UUID uuid = p.getUniqueId(); |  | ||||||
| 				mcp = new MineverseChatPlayer(uuid, name); |  | ||||||
| 			} |  | ||||||
| 			mcp.setOnline(true); |  | ||||||
| 			mcp.setHasPlayed(false); |  | ||||||
| 			mcp.setJsonFormat(); |  | ||||||
| 			MineverseChatAPI.addMineverseChatOnlinePlayerToMap(mcp); |  | ||||||
| 			MineverseChatAPI.addNameToMap(mcp); |  | ||||||
| 		} |  | ||||||
| 		 | 		 | ||||||
| 		Bukkit.getScheduler().runTaskAsynchronously(this, () -> { | 		Bukkit.getScheduler().runTaskAsynchronously(this, () -> { | ||||||
| 			Database.initializeMySQL(); | 			Database.initializeMySQL(); | ||||||
| @ -259,6 +240,14 @@ public class MineverseChat extends JavaPlugin implements PluginMessageListener { | |||||||
| 		return getPlugin(MineverseChat.class);	 | 		return getPlugin(MineverseChat.class);	 | ||||||
| 	} | 	} | ||||||
| 	 | 	 | ||||||
|  | 	public static void initializeConfigReaders() { | ||||||
|  | 		Localization.initialize(); | ||||||
|  | 		Alias.initialize(); | ||||||
|  | 		JsonFormat.initialize(); | ||||||
|  | 		GuiSlot.initialize(); | ||||||
|  | 		ChatChannel.initialize(false); | ||||||
|  | 	} | ||||||
|  | 	 | ||||||
| 	public static Chat getVaultChat() { | 	public static Chat getVaultChat() { | ||||||
| 		return chat; | 		return chat; | ||||||
| 	} | 	} | ||||||
|  | |||||||
| @ -22,16 +22,16 @@ public class ChatChannel { | |||||||
| 	private static final String PERMISSION_PREFIX = "venturechat."; | 	private static final String PERMISSION_PREFIX = "venturechat."; | ||||||
| 	private static final String NO_PERMISSIONS = "venturechat.none"; | 	private static final String NO_PERMISSIONS = "venturechat.none"; | ||||||
| 	 | 	 | ||||||
|  | 	private static boolean aliasesRegisteredAsCommands; | ||||||
|  | 
 | ||||||
| 	private static MineverseChat plugin = MineverseChat.getInstance(); | 	private static MineverseChat plugin = MineverseChat.getInstance(); | ||||||
| 	private static ChatChannel defaultChatChannel; | 	private static ChatChannel defaultChatChannel; | ||||||
|     private static boolean aliasesRegisteredAsCommands; | 	private static String defaultColor; | ||||||
|  | 	private static HashMap<String, ChatChannel> chatChannels; | ||||||
| 	 | 	 | ||||||
| 	@Deprecated | 	@Deprecated | ||||||
| 	private static ChatChannel[] channels; | 	private static ChatChannel[] channels; | ||||||
| 
 | 
 | ||||||
|     private static String defaultColor; |  | ||||||
|     private static HashMap<String, ChatChannel> chatChannels; |  | ||||||
| 
 |  | ||||||
| 	private String name; | 	private String name; | ||||||
| 	private String permission; | 	private String permission; | ||||||
| 	private String speakPermission; | 	private String speakPermission; | ||||||
| @ -110,7 +110,8 @@ public class ChatChannel { | |||||||
| 	/** | 	/** | ||||||
| 	 * Get a chat channel by name. | 	 * Get a chat channel by name. | ||||||
| 	 *  | 	 *  | ||||||
|      * @param channelName name of channel to get. | 	 * @param channelName | ||||||
|  | 	 *            name of channel to get. | ||||||
| 	 * @return {@link ChatChannel} | 	 * @return {@link ChatChannel} | ||||||
| 	 */ | 	 */ | ||||||
| 	public static ChatChannel getChannel(String channelName) { | 	public static ChatChannel getChannel(String channelName) { | ||||||
| @ -120,7 +121,8 @@ public class ChatChannel { | |||||||
| 	/** | 	/** | ||||||
| 	 * Checks if the chat channel exists. | 	 * Checks if the chat channel exists. | ||||||
| 	 *  | 	 *  | ||||||
|      * @param channelName name of channel to check. | 	 * @param channelName | ||||||
|  | 	 *            name of channel to check. | ||||||
| 	 * @return true if channel exists, false otherwise. | 	 * @return true if channel exists, false otherwise. | ||||||
| 	 */ | 	 */ | ||||||
| 	public static boolean isChannel(String channelName) { | 	public static boolean isChannel(String channelName) { | ||||||
| @ -444,7 +446,8 @@ public class ChatChannel { | |||||||
| 	/** | 	/** | ||||||
| 	 * Compares the chat channel by name to determine equality. | 	 * Compares the chat channel by name to determine equality. | ||||||
| 	 *  | 	 *  | ||||||
|      * @param channel Object to compare for equality. | 	 * @param channel | ||||||
|  | 	 *            Object to compare for equality. | ||||||
| 	 * @return true if the objects are equal, false otherwise. | 	 * @return true if the objects are equal, false otherwise. | ||||||
| 	 */ | 	 */ | ||||||
| 	@Override | 	@Override | ||||||
|  | |||||||
| @ -5,6 +5,7 @@ import java.util.List; | |||||||
| import java.util.Map; | import java.util.Map; | ||||||
| 
 | 
 | ||||||
| import org.bukkit.command.Command; | import org.bukkit.command.Command; | ||||||
|  | import org.bukkit.command.CommandExecutor; | ||||||
| import org.bukkit.command.CommandSender; | import org.bukkit.command.CommandSender; | ||||||
| import org.bukkit.command.TabExecutor; | import org.bukkit.command.TabExecutor; | ||||||
| 
 | 
 | ||||||
| @ -103,32 +104,39 @@ public class VentureCommandExecutor implements TabExecutor { | |||||||
| 		commands.put("venturechatgui", new VentureChatGui()); | 		commands.put("venturechatgui", new VentureChatGui()); | ||||||
| 		commands.put("messagetoggle", new MessageToggle()); | 		commands.put("messagetoggle", new MessageToggle()); | ||||||
| 		commands.put("bungeetoggle", new BungeeToggle()); | 		commands.put("bungeetoggle", new BungeeToggle()); | ||||||
|         for (String command : commands.keySet()) { | 		for(String command : commands.keySet()) { | ||||||
|             plugin.getCommand(command).setExecutor(commandExecutor); | 			registerCommand(command, commandExecutor); | ||||||
| 		} | 		} | ||||||
| 		 | 		 | ||||||
| 		plugin.getServer().getScheduler().runTaskLater(plugin, () -> { | 		plugin.getServer().getScheduler().runTaskLater(plugin, () -> { | ||||||
| 			VentureCommand reply = new Reply(); | 			VentureCommand reply = new Reply(); | ||||||
| 			commands.put("reply", reply); | 			commands.put("reply", reply); | ||||||
| 			commands.put("r", reply); | 			commands.put("r", reply); | ||||||
|             plugin.getCommand("reply").setExecutor(commandExecutor); | 			registerCommand("reply", commandExecutor); | ||||||
|             plugin.getCommand("r").setExecutor(commandExecutor); | 			registerCommand("r", commandExecutor); | ||||||
| 			 | 			 | ||||||
| 			commands.put("mute", new Mute()); | 			commands.put("mute", new Mute()); | ||||||
| 			commands.put("muteall", new Muteall()); | 			commands.put("muteall", new Muteall()); | ||||||
| 			commands.put("unmute", new Unmute()); | 			commands.put("unmute", new Unmute()); | ||||||
| 			commands.put("unmuteall", new Unmuteall()); | 			commands.put("unmuteall", new Unmuteall()); | ||||||
|             plugin.getCommand("mute").setExecutor(commandExecutor); | 			registerCommand("mute", commandExecutor); | ||||||
|             plugin.getCommand("muteall").setExecutor(commandExecutor); | 			registerCommand("muteall", commandExecutor); | ||||||
|             plugin.getCommand("unmute").setExecutor(commandExecutor); | 			registerCommand("unmute", commandExecutor); | ||||||
|             plugin.getCommand("unmuteall").setExecutor(commandExecutor); | 			registerCommand("unmuteall", commandExecutor); | ||||||
| 			 | 			 | ||||||
| 			MessageCommandExecutor messageCommandExecutor = new MessageCommandExecutor(); | 			MessageCommandExecutor messageCommandExecutor = new MessageCommandExecutor(); | ||||||
|             plugin.getCommand("message").setExecutor(messageCommandExecutor); | 			registerCommand("message", messageCommandExecutor); | ||||||
|             plugin.getCommand("msg").setExecutor(messageCommandExecutor); | 			registerCommand("msg", messageCommandExecutor); | ||||||
|             plugin.getCommand("tell").setExecutor(messageCommandExecutor); | 			registerCommand("tell", messageCommandExecutor); | ||||||
|             plugin.getCommand("whisper").setExecutor(messageCommandExecutor); | 			registerCommand("whisper", messageCommandExecutor); | ||||||
|             plugin.getCommand("ignore").setExecutor(new IgnoreCommandExecutor()); | 			 | ||||||
|  | 			registerCommand("ignore", new IgnoreCommandExecutor()); | ||||||
| 		}, 0); | 		}, 0); | ||||||
| 	} | 	} | ||||||
|  | 	 | ||||||
|  | 	private static void registerCommand(String command, CommandExecutor commandExecutor) { | ||||||
|  | 		if(plugin.getCommand(command) != null) { | ||||||
|  | 			plugin.getCommand(command).setExecutor(commandExecutor); | ||||||
|  | 		} | ||||||
|  | 	} | ||||||
| } | } | ||||||
|  | |||||||
| @ -1,26 +1,54 @@ | |||||||
| package mineverse.Aust1n46.chat.command.chat; | package mineverse.Aust1n46.chat.command.chat; | ||||||
| 
 | 
 | ||||||
|  | import java.util.UUID; | ||||||
|  | 
 | ||||||
| import org.bukkit.Bukkit; | import org.bukkit.Bukkit; | ||||||
| import org.bukkit.command.CommandSender; | import org.bukkit.command.CommandSender; | ||||||
|  | import org.bukkit.entity.Player; | ||||||
| 
 | 
 | ||||||
| import mineverse.Aust1n46.chat.MineverseChat; | import mineverse.Aust1n46.chat.MineverseChat; | ||||||
| import mineverse.Aust1n46.chat.api.MineverseChatAPI; | import mineverse.Aust1n46.chat.api.MineverseChatAPI; | ||||||
| import mineverse.Aust1n46.chat.api.MineverseChatPlayer; | import mineverse.Aust1n46.chat.api.MineverseChatPlayer; | ||||||
| import mineverse.Aust1n46.chat.command.VentureCommand; | import mineverse.Aust1n46.chat.command.VentureCommand; | ||||||
|  | import mineverse.Aust1n46.chat.database.PlayerData; | ||||||
| import mineverse.Aust1n46.chat.localization.LocalizedMessage; | import mineverse.Aust1n46.chat.localization.LocalizedMessage; | ||||||
|  | import mineverse.Aust1n46.chat.utilities.Format; | ||||||
| 
 | 
 | ||||||
| public class Chatreload implements VentureCommand { | public class Chatreload implements VentureCommand { | ||||||
| 	private MineverseChat plugin = MineverseChat.getInstance(); | 	private MineverseChat plugin = MineverseChat.getInstance(); | ||||||
| 
 | 
 | ||||||
| 	@Override | 	@Override | ||||||
| 	public void execute(CommandSender sender, String command, String[] args) { | 	public void execute(CommandSender sender, String command, String[] args) { | ||||||
|         if (sender.hasPermission("venturechat.reload")) { | 		if(sender.hasPermission("venturechat.reload")) { | ||||||
|  | 			PlayerData.savePlayerData(); | ||||||
|  | 			MineverseChatAPI.clearMineverseChatPlayerMap(); | ||||||
|  | 			MineverseChatAPI.clearNameMap(); | ||||||
|  | 			MineverseChatAPI.clearOnlineMineverseChatPlayerMap(); | ||||||
|  | 			 | ||||||
| 			plugin.reloadConfig(); | 			plugin.reloadConfig(); | ||||||
|             Bukkit.getPluginManager().disablePlugin(plugin); | 			MineverseChat.initializeConfigReaders(); | ||||||
|             Bukkit.getPluginManager().enablePlugin(plugin); | 			 | ||||||
|             plugin.getServer().getLogger().info("[VentureChat] Config reloaded"); | 			PlayerData.loadLegacyPlayerData(); | ||||||
|             for (MineverseChatPlayer player : MineverseChatAPI.getOnlineMineverseChatPlayers()) { | 			PlayerData.loadPlayerData(); | ||||||
|                 if (player.getPlayer().hasPermission("venturechat.reload")) { | 			for(Player p : plugin.getServer().getOnlinePlayers()) { | ||||||
|  | 				MineverseChatPlayer mcp = MineverseChatAPI.getMineverseChatPlayer(p); | ||||||
|  | 				if(mcp == null) { | ||||||
|  | 					Bukkit.getConsoleSender().sendMessage(Format.FormatStringAll("&8[&eVentureChat&8]&c - Could not find player data post reload for currently online player: " + p.getName())); | ||||||
|  | 					Bukkit.getConsoleSender().sendMessage(Format.FormatStringAll("&8[&eVentureChat&8]&c - There could be an issue with your player data saving.")); | ||||||
|  | 					String name = p.getName(); | ||||||
|  | 					UUID uuid = p.getUniqueId(); | ||||||
|  | 					mcp = new MineverseChatPlayer(uuid, name); | ||||||
|  | 				} | ||||||
|  | 				mcp.setOnline(true); | ||||||
|  | 				mcp.setHasPlayed(false); | ||||||
|  | 				mcp.setJsonFormat(); | ||||||
|  | 				MineverseChatAPI.addMineverseChatOnlinePlayerToMap(mcp); | ||||||
|  | 				MineverseChatAPI.addNameToMap(mcp); | ||||||
|  | 			} | ||||||
|  | 			 | ||||||
|  | 			Bukkit.getConsoleSender().sendMessage(Format.FormatStringAll("&8[&eVentureChat&8]&e - Config reloaded"));	 | ||||||
|  | 			for(MineverseChatPlayer player : MineverseChatAPI.getOnlineMineverseChatPlayers()) { | ||||||
|  | 				if(player.getPlayer().hasPermission("venturechat.reload")) { | ||||||
| 					player.getPlayer().sendMessage(LocalizedMessage.CONFIG_RELOADED.toString()); | 					player.getPlayer().sendMessage(LocalizedMessage.CONFIG_RELOADED.toString()); | ||||||
| 				} | 				} | ||||||
| 			} | 			} | ||||||
|  | |||||||
| @ -343,7 +343,7 @@ public class ChatListener implements Listener { | |||||||
| 			chDistance = eventChannel.getDistance(); | 			chDistance = eventChannel.getDistance(); | ||||||
| 		} | 		} | ||||||
| 		 | 		 | ||||||
| 		format = Format.FormatStringAll(PlaceholderAPI.setBracketPlaceholders(mcp.getPlayer(), Format.FormatStringAll(plugin.getConfig().getConfigurationSection("channels." + eventChannel.getName()).getString("format")))); | 		format = Format.FormatStringAll(PlaceholderAPI.setBracketPlaceholders(mcp.getPlayer(), Format.FormatStringAll(eventChannel.getFormat()))); | ||||||
| 		if(plugin.getConfig().getBoolean("formatcleaner", false)) { | 		if(plugin.getConfig().getBoolean("formatcleaner", false)) { | ||||||
| 			format = format.replace("[]", " "); | 			format = format.replace("[]", " "); | ||||||
| 			format = format.replace("    ", " ").replace("   ", " ").replace("  ", " "); | 			format = format.replace("    ", " ").replace("   ", " ").replace("  ", " "); | ||||||
|  | |||||||
| @ -892,9 +892,12 @@ public class Format { | |||||||
| 	 | 	 | ||||||
| 	public static void playMessageSound(MineverseChatPlayer mcp) { | 	public static void playMessageSound(MineverseChatPlayer mcp) { | ||||||
| 		Player player = mcp.getPlayer(); | 		Player player = mcp.getPlayer(); | ||||||
| 		Sound messageSound = getSound(getInstance().getConfig().getString("message_sound", DEFAULT_MESSAGE_SOUND)); | 		String soundName = getInstance().getConfig().getString("message_sound", DEFAULT_MESSAGE_SOUND); | ||||||
|  | 		if(!soundName.equalsIgnoreCase("None")) { | ||||||
|  | 			Sound messageSound = getSound(soundName); | ||||||
| 			player.playSound(player.getLocation(), messageSound, 1, 0); | 			player.playSound(player.getLocation(), messageSound, 1, 0); | ||||||
| 		} | 		} | ||||||
|  | 	} | ||||||
| 	 | 	 | ||||||
| 	private static Sound getSound(String soundName) { | 	private static Sound getSound(String soundName) { | ||||||
| 		if(Arrays.asList(Sound.values()).stream().map(Sound::toString).collect(Collectors.toList()).contains(soundName)) { | 		if(Arrays.asList(Sound.values()).stream().map(Sound::toString).collect(Collectors.toList()).contains(soundName)) { | ||||||
|  | |||||||
| @ -100,6 +100,7 @@ unmuteinterval: 60 | |||||||
| bungeecordmessaging: false | bungeecordmessaging: false | ||||||
| 
 | 
 | ||||||
| # Sound for message notification | # Sound for message notification | ||||||
|  | # Enter 'None' to disable the sound | ||||||
| message_sound: ENTITY_PLAYER_LEVELUP | message_sound: ENTITY_PLAYER_LEVELUP | ||||||
| 
 | 
 | ||||||
| # This will allow vanished players to be exempt from being sent private messages, and will act as if they aren't online | # This will allow vanished players to be exempt from being sent private messages, and will act as if they aren't online | ||||||
|  | |||||||
| @ -100,6 +100,7 @@ unmuteinterval: 60 | |||||||
| bungeecordmessaging: false | bungeecordmessaging: false | ||||||
| 
 | 
 | ||||||
| # Sound for message notification | # Sound for message notification | ||||||
|  | # Enter 'None' to disable the sound | ||||||
| message_sound: ENTITY_PLAYER_LEVELUP | message_sound: ENTITY_PLAYER_LEVELUP | ||||||
| 
 | 
 | ||||||
| # This will allow vanished players to be exempt from being sent private messages, and will act as if they aren't online | # This will allow vanished players to be exempt from being sent private messages, and will act as if they aren't online | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Aust1n46
						Aust1n46