本文整理汇总了Java中sx.blah.discord.handle.obj.IRole.getName方法的典型用法代码示例。如果您正苦于以下问题:Java IRole.getName方法的具体用法?Java IRole.getName怎么用?Java IRole.getName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sx.blah.discord.handle.obj.IRole
的用法示例。
在下文中一共展示了IRole.getName方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: fromRole
import sx.blah.discord.handle.obj.IRole; //导入方法依赖的package包/类
public WebRole fromRole(IRole r, GuildSettings settings) {
id = r.getLongID();
name = r.getName();
managed = r.isManaged();
if (r.isEveryoneRole() && settings.getControlRole().equalsIgnoreCase("everyone")) {
controlRole = true;
} else {
controlRole = settings.getControlRole().equalsIgnoreCase(String.valueOf(id));
}
return this;
}
示例2: getRoleNameFromID
import sx.blah.discord.handle.obj.IRole; //导入方法依赖的package包/类
public static String getRoleNameFromID(String id, MessageReceivedEvent event) {
IRole role = getRoleFromID(id, event);
if (role != null) {
return role.getName();
} else {
return "ERROR";
}
}
示例3: runCommand
import sx.blah.discord.handle.obj.IRole; //导入方法依赖的package包/类
public boolean runCommand(MessageReceivedEvent event, String[] args, String message) {
String s = "";
if(event.getGuild()!=null){
s+="\nR�les: {";
List<IRole> r = event.getAuthor().getRolesForGuild(event.getGuild());
for (int i = 0; i < r.size(); i++) {
if(i>0)s+=",";
IRole d = r.get(i);
s+="[id:"+d.getStringID()+", name:"+d.getName()+"]";
}
s+="}";
}
event.getChannel().sendMessage("Client Information: \nAuteur: "+event.getAuthor()+s+"\nId: "+event.getAuthor().getStringID());
return true;
}
示例4: toString
import sx.blah.discord.handle.obj.IRole; //导入方法依赖的package包/类
public static String toString (List<IRole> roles, String delimiter) {
if (roles.isEmpty() || roles.size() == 1 && roles.get(0).isEveryoneRole()) {
return "None";
}
String ret = "";
for (final IRole role : roles) {
if (!role.isEveryoneRole()) {
ret += role.getName() + delimiter;
}
}
return ret.substring(0, ret.length() - delimiter.length());
}
示例5: randomizer
import sx.blah.discord.handle.obj.IRole; //导入方法依赖的package包/类
private String randomizer(IUser user, MessageReceivedEvent event, Random rng){
List<IRole> rollRoles = event.getGuild().getRoles().stream().filter(x -> x.getName().contains("lotto-")).collect(Collectors.toList());
for (IRole role : user.getRolesForGuild(event.getGuild())) {
if (role.getName().contains("lotto-")) {
event.getAuthor().removeRole(role);
rollRoles.remove(role);
}
}
IRole rngRole = rollRoles.get(rng.nextInt(rollRoles.size()));
event.getAuthor().addRole(rngRole);
return rngRole.getName();
}
示例6: DiscordRole
import sx.blah.discord.handle.obj.IRole; //导入方法依赖的package包/类
public DiscordRole(IRole role) {
this.id = role.getID();
this.name = role.getName();
}
示例7: userChat
import sx.blah.discord.handle.obj.IRole; //导入方法依赖的package包/类
@EventSubscriber
public void userChat(MessageReceivedEvent event) {
if (commands && event.getMessage().getContent().startsWith(commandPrefix) && event.getMessage().getContent().length() > 1) {
// Commands enabled and it is a valid command
switch (event.getMessage().getContent().substring(1)) {
case "help":
MessageAPI.sendToDiscord("Available commands: list");
break;
case "list":
List<String> online = Bukkit.getOnlinePlayers().stream().map((Function<Player, String>) Player::getName).collect(Collectors.toList());
MessageAPI.sendToDiscord("There are " + online.size() + "/"
+ Bukkit.getMaxPlayers() + " players online:"
+ "\n" + StringUtils.join(online.toArray(), ", "));
break;
default:
break;
}
} else {
if (relayChat) {
if (!DiscordMC.getDiscordToMinecraft().contains(event.getMessage().getChannel())) {
return;
}
String content = event.getMessage().getContent();
List<IUser> mentions = event.getMessage().getMentions();
List<IRole> roleMentions = event.getMessage().getRoleMentions();
for (IUser u : mentions) {
String name = u.getNicknameForGuild(event.getMessage().getGuild());
String id = u.getStringID();
// User name
content = content.replaceAll("<@" + id + ">", "@" + name);
// Nick name
content = content.replaceAll("<@!" + id + ">", "@" + name);
}
for (IRole r : roleMentions) {
String roleName = r.getName();
String roleId = r.getStringID();
content = content.replaceAll("<@&" + roleId + ">", "@" + roleName);
}
final String finalContent = content;
final String nickname;
if (useNickname) {
nickname = event.getMessage().getAuthor().getNicknameForGuild(event.getMessage().getGuild());
} else {
nickname = event.getMessage().getAuthor().getName();
}
MessageAPI.sendToMinecraft(event.getMessage().getChannel(), nickname, finalContent);
if (sendToConsole) {
MessageAPI.sendToMinecraftConsole(event.getMessage().getChannel(), nickname, finalContent);
}
}
}
}