Skip to content

PermissionsEx Chat Handling #521

@Paralaxus

Description

@Paralaxus

Hi again,

I created a class called ChatHandler which overrides the ChatManager class.

It basically does this:
[CitizenRank][EmpireName] Username: message
example: [L][Rome] Player123: Hello World

I want it to do this:
[PexPrefix][CitizenRank][EmpireName][PexSuffix] Username: message
example: [Admin][L][Rome] Username: message
**No suffix in this example ^

Was wondering if you could help me set this up, because i get this error:

Caused by: java.lang.ClassNotFoundException: ru.tehkode.permissions.bukkit.PermissionsEx
    at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:101) ~[launchwrapper-1.12.jar:?]
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424) ~[?:1.8.0_73]
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[?:1.8.0_73]

So i modified the class to include:

	empire = CommandsEMP.getEmpireFromCitizen(res);
					rank = CommandsEMP.getRankFromCitizen(res);
					// TODO: Add herochat support?

					String rankChat = "[" + rank.getChatName() + "]";
					String empireChat = "[" + empire + "]";
					if (ClassUtils.isBukkitLoaded() == true) {

					if (Bukkit.getPluginManager().getPlugin("PermissionsEx").isEnabled() == true) {	
						Empires.instance.LOG.warn("[Empires Mod] PermissiosnEX detected.. Applying hooks");
						//get pex prefix below					
					Player bukkitplayer = Bukkit.getPlayer(target.getUniqueID());
					String pexPrefix = ChatComponentPEX.getPrefix(bukkitplayer);
					String pexSuffix = ChatComponentPEX.getSuffix(bukkitplayer);

					
					
					
					
					Method method = ChatComponentPEX.class.getDeclaredMethod("getPrefix", Player.class);
					String chat = pexPrefix + EnumChatFormatting.RED + rankChat + EnumChatFormatting.GOLD + empireChat + " "
								+ EnumChatFormatting.WHITE + player.getDisplayName() + pexSuffix + ": " + event.message;
						//add pex prefix here ^

						target.addChatMessage(new ChatComponentTranslation(chat));
					}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions