Skip to content

Commit d240819

Browse files
committed
[Bug Fix] Another Possible Vault fix.
1 parent c31e701 commit d240819

1 file changed

Lines changed: 58 additions & 1 deletion

File tree

src/main/java/ca/q0r/mchat/api/Reader.java

Lines changed: 58 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public static Object getRawInfo(String name, InfoType type, String world, String
6363
} else if (API.isPluginEnabled(PluginType.BPERMISSIONS)) {
6464
return getbPermInfo(name, type, world, info);
6565
} else if (API.isPluginEnabled(PluginType.VAULT_CHAT)) {
66-
return getBukkitInfo(name, world, info);
66+
return getVaultInfo(name, type, world, info);
6767
}
6868

6969
return getMChatInfo(name, type, world, info);
@@ -487,6 +487,63 @@ private static Object getbPermGroup(String name, String world, String info) {
487487
return group;
488488
}
489489

490+
private static Object getVaultInfo(String name, InfoType type, String world, String info) {
491+
Object infoString = "";
492+
boolean UserInfoLookupFailed = false;
493+
494+
if (type == InfoType.USER) {
495+
infoString = getVaultUserInfo(name, world, info);
496+
UserInfoLookupFailed = infoString.equals("");
497+
}
498+
499+
if (UserInfoLookupFailed) {
500+
if (!API.vChat.getName().equals("MChat")) {
501+
name = API.vChat.getPrimaryGroup(world, name);
502+
}
503+
}
504+
505+
if (type == InfoType.GROUP || UserInfoLookupFailed) {
506+
getVaultGroupInfo(name, world, info);
507+
}
508+
509+
return infoString;
510+
}
511+
512+
private static Object getVaultUserInfo(String name, String world, String info) {
513+
Object infoString = "";
514+
515+
if (!API.vChat.getName().equals("MChat")) {
516+
if (info.equals("group")) {
517+
infoString = API.vChat.getPrimaryGroup(world, name);
518+
} else if (info.equals("groups")) {
519+
infoString = API.vChat.getPlayerGroups(world, name);
520+
} else if (info.equals("prefix")) {
521+
infoString = API.vChat.getPlayerPrefix(world, name);
522+
} else if (info.equals("suffix")) {
523+
infoString = API.vChat.getPlayerSuffix(world, name);
524+
} else {
525+
infoString = API.vChat.getPlayerInfoString(world, name, info, "");
526+
}
527+
}
528+
529+
return infoString;
530+
}
531+
532+
private static Object getVaultGroupInfo(String name, String world, String info) {
533+
Object infoString = "";
534+
if (!API.vChat.getName().equals("MChat")) {
535+
if (info.equals("prefix")) {
536+
infoString = API.vChat.getGroupPrefix(world, name);
537+
} else if (info.equals("suffix")) {
538+
infoString = API.vChat.getGroupSuffix(world, name);
539+
} else {
540+
infoString = API.vChat.getGroupInfoString(world, name, info, "");
541+
}
542+
}
543+
544+
return infoString;
545+
}
546+
490547
/**
491548
* Group Name Resolver
492549
*

0 commit comments

Comments
 (0)