本文整理汇总了Java中org.spongepowered.api.service.permission.Subject.getIdentifier方法的典型用法代码示例。如果您正苦于以下问题:Java Subject.getIdentifier方法的具体用法?Java Subject.getIdentifier怎么用?Java Subject.getIdentifier使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.spongepowered.api.service.permission.Subject
的用法示例。
在下文中一共展示了Subject.getIdentifier方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getHighestGroup
import org.spongepowered.api.service.permission.Subject; //导入方法依赖的package包/类
public Subject getHighestGroup(User player){
HashMap<Integer, Subject> subs = new HashMap<Integer, Subject>();
for (Subject sub:player.getParents()){
if (sub.getContainingCollection().equals(getGroups()) && (sub.getIdentifier() != null)){
subs.put(sub.getParents().size(), sub);
}
}
if (!subs.isEmpty()){
return subs.get(Collections.max(subs.keySet()));
}
return null;
}
示例2: getGroupAndTag
import org.spongepowered.api.service.permission.Subject; //导入方法依赖的package包/类
public Subject getGroupAndTag(User player) {
HashMap<Integer, Subject> subs = new HashMap<>();
for (Subject sub:player.getParents()){
if (sub.getContainingCollection().equals(getGroups()) && (sub.getIdentifier() != null)){
subs.put(sub.getParents().size(), sub);
}
}
return subs.isEmpty() ? null : subs.get(Collections.max(subs.keySet()));
}
示例3: getGroup
import org.spongepowered.api.service.permission.Subject; //导入方法依赖的package包/类
public String getGroup(User player){
for (Subject sub:player.getParents()){
if (sub.getContainingCollection().equals(getGroups()) && (sub.getIdentifier() != null)){
return sub.getIdentifier();
}
}
return null;
}
示例4: getGroups
import org.spongepowered.api.service.permission.Subject; //导入方法依赖的package包/类
public Subject getGroups(User player){
for (Subject sub:player.getParents()){
if (sub.getContainingCollection().equals(getGroups()) && (sub.getIdentifier() != null)){
return sub;
}
}
return null;
}
示例5: checkRankup
import org.spongepowered.api.service.permission.Subject; //导入方法依赖的package包/类
boolean checkRankup(User p){
Subject subG = plugin.perms.getHighestGroup(p);
if(subG == null){
return false;
}
String pgroup = subG.getIdentifier();
RULogger.debug("Highest Group is: "+pgroup);
String ngroup = config.getNode("ranked-groups",pgroup,"next-group").getString();
if (ngroup == null || ngroup.isEmpty() || !plugin.perms.getAllGroups().contains(ngroup)){
return false;
}
int minutesNeeded = config.getNode("ranked-groups",pgroup,"minutes-needed").getInt();
int moneyNeeded = config.getNode("ranked-groups",pgroup,"money-needed").getInt();
int levelNeeded = config.getNode("ranked-groups",pgroup,"levels-needed").getInt();
if (minutesNeeded != 0){
if (getPlayerTime(getPlayerKey(p)) < minutesNeeded){
return false;
}
}
if (moneyNeeded != 0){
UniqueAccount acc = plugin.econ.getOrCreateAccount(p.getUniqueId()).get();
if (acc.getBalance(plugin.econ.getDefaultCurrency()).intValue() < moneyNeeded){
return false;
}
}
if (levelNeeded != 0){
if (p.get(Keys.EXPERIENCE_LEVEL).isPresent() && p.get(Keys.EXPERIENCE_LEVEL).get() < levelNeeded){
return false;
}
}
for (String cmd:getStringList("ranked-groups",pgroup,"execute-commands")){
plugin.game.getCommandManager().process(Sponge.getServer().getConsole(), cmd.replace("{player}", p.getName()).replace("{oldgroup}", pgroup).replace("{newgroup}", ngroup));
}
String message = config.getNode("ranked-groups",pgroup,"message-broadcast").getString();
if (message != null && !message.equals("")){
Sponge.getServer().getBroadcastChannel().send(RUUtil.toText(message.replace("{player}", p.getName()).replace("{time}", RUUtil.timeDescript(minutesNeeded)).replace("{newgroup}", ngroup)));
}
return true;
}
示例6: SendCheckMessage
import org.spongepowered.api.service.permission.Subject; //导入方法依赖的package包/类
private static void SendCheckMessage(CommandSource sender, User playerToCheck) {
int time = plugin.cfgs.getPlayerTime(plugin.cfgs.getPlayerKey(playerToCheck));
Subject subG = plugin.perms.getHighestGroup(playerToCheck);
String pgroup = "";
String dispName = "";
if (subG != null){
pgroup = subG.getIdentifier();
if (subG.getOption("display_name").isPresent()){
dispName = subG.getOption("display_name").get();
} else {
dispName = pgroup;
}
}
RULogger.debug("Player Groups: "+pgroup);
if(pgroup.isEmpty()) {
RULang.sendMessage(sender, RULang.get("commands.check.youplayed").replace("{time}", RUUtil.timeDescript(time)).replace("{group}", "none"));
} else {
RULang.sendMessage(sender, RULang.get("commands.check.youplayed").replace("{time}", RUUtil.timeDescript(time)).replace("{group}", dispName));
}
String ngroup = plugin.cfgs.getString("ranked-groups",pgroup,"next-group");
if (ngroup == null || ngroup.isEmpty() || !plugin.perms.getAllGroups().contains(ngroup)){
return;
}
sender.sendMessage(RUUtil.toText(RULang.get("commands.nextgroup").replace("{group}", ngroup)));
int minutesNeeded = plugin.cfgs.getInt("ranked-groups",pgroup,"minutes-needed");
int moneyNeeded = plugin.cfgs.getInt("ranked-groups",pgroup,"money-needed");
int levelNeeded = plugin.cfgs.getInt("ranked-groups",pgroup,"levels-needed");
if (minutesNeeded != 0){
if (plugin.cfgs.getPlayerTime(plugin.cfgs.getPlayerKey(playerToCheck)) >= minutesNeeded){
sender.sendMessage(RUUtil.toText(RULang.get("config.time") + ": &a" + RUUtil.timeDescript(minutesNeeded) + " - " + RULang.get("config.ok")));
} else {
sender.sendMessage(RUUtil.toText(RULang.get("config.time") + ": &c" + RUUtil.timeDescript(minutesNeeded)));
}
}
if (moneyNeeded != 0){
UniqueAccount acc = plugin.econ.getOrCreateAccount(playerToCheck.getUniqueId()).get();
int usermoney = acc.getBalance(plugin.econ.getDefaultCurrency()).intValue();
if (usermoney >= moneyNeeded){
sender.sendMessage(RUUtil.toText(RULang.get("config.money") + ": &a" + RULang.get("config.cifra")+" "+ usermoney+"/"+moneyNeeded + " - " + RULang.get("config.ok")));
} else {
sender.sendMessage(RUUtil.toText(RULang.get("config.money") + ": &c" + RULang.get("config.cifra")+" "+ usermoney+"/"+moneyNeeded));
}
}
if (levelNeeded != 0){
if (!playerToCheck.get(Keys.EXPERIENCE_LEVEL).isPresent()){
sender.sendMessage(RUUtil.toText(RULang.get("config.levels") + ": &c0/"+levelNeeded + " Lvs."));
return;
}
int lvls = playerToCheck.get(Keys.EXPERIENCE_LEVEL).get();
if (lvls >= levelNeeded){
sender.sendMessage(RUUtil.toText(RULang.get("config.levels") + ": &a" + lvls+"/"+levelNeeded + " Lvs. - " + RULang.get("config.ok")));
} else {
sender.sendMessage(RUUtil.toText(RULang.get("config.levels") + ": &c" + lvls+"/"+levelNeeded + " Lvs."));
}
}
}
示例7: SendCheckMessage
import org.spongepowered.api.service.permission.Subject; //导入方法依赖的package包/类
private static void SendCheckMessage(CommandSource sender, User playerToCheck) {
int time = plugin.cfgs.getPlayerTime(plugin.cfgs.getPlayerKey(playerToCheck));
Subject subG = plugin.perms.getHighestGroup(playerToCheck);
String pgroup = "";
String dispName = "";
if (subG != null){
pgroup = subG.getIdentifier();
if (subG.getOption("display_name").isPresent()){
dispName = subG.getOption("display_name").get();
} else {
dispName = pgroup;
}
}
RULogger.debug("Player Groups: "+pgroup);
if(pgroup.isEmpty()) {
RULang.sendMessage(sender, RULang.get("commands.check.youplayed").replace("{time}", RUUtil.timeDescript(time)).replace("{group}", "none"));
} else {
RULang.sendMessage(sender, RULang.get("commands.check.youplayed").replace("{time}", RUUtil.timeDescript(time)).replace("{group}", dispName));
}
String ngroup = plugin.cfgs.getString("ranked-groups",pgroup,"next-group");
if (ngroup == null || ngroup.isEmpty() || !plugin.perms.getAllGroups().contains(ngroup)){
return;
}
sender.sendMessage(RUUtil.toText(RULang.get("commands.nextgroup").replace("{group}", ngroup)));
int minutesNeeded = plugin.cfgs.getInt("ranked-groups",pgroup,"minutes-needed");
int moneyNeeded = plugin.cfgs.getInt("ranked-groups",pgroup,"money-needed");
int levelNeeded = plugin.cfgs.getInt("ranked-groups",pgroup,"levels-needed");
if (minutesNeeded != 0){
if (plugin.cfgs.getPlayerTime(plugin.cfgs.getPlayerKey(playerToCheck)) >= minutesNeeded){
sender.sendMessage(RUUtil.toText(RULang.get("config.time") + ": &a" + RUUtil.timeDescript(minutesNeeded) + " - " + RULang.get("config.ok")));
} else {
sender.sendMessage(RUUtil.toText(RULang.get("config.time") + ": &c" + RUUtil.timeDescript(minutesNeeded)));
}
}
if (moneyNeeded != 0){
UniqueAccount acc = plugin.econ.getOrCreateAccount(playerToCheck.getUniqueId()).get();
int usermoney = acc.getBalance(plugin.econ.getDefaultCurrency()).intValue();
if (usermoney >= moneyNeeded){
sender.sendMessage(RUUtil.toText(RULang.get("config.money") + ": &a" + RULang.get("config.cifra")+" "+ usermoney+"/"+moneyNeeded + " - " + RULang.get("config.ok")));
} else {
sender.sendMessage(RUUtil.toText(RULang.get("config.money") + ": &c" + RULang.get("config.cifra")+" "+ usermoney+"/"+moneyNeeded));
}
}
if (levelNeeded != 0){
if (!playerToCheck.get(Keys.EXPERIENCE_LEVEL).isPresent()){
sender.sendMessage(RUUtil.toText(RULang.get("config.levels") + ": &c0/"+levelNeeded + " Lvs."));
return;
}
int lvls = playerToCheck.get(Keys.EXPERIENCE_LEVEL).get();
if (lvls >= levelNeeded){
sender.sendMessage(RUUtil.toText(RULang.get("config.levels") + ": &a" + lvls+"/"+levelNeeded + " Lvs. - " + RULang.get("config.ok")));
} else {
sender.sendMessage(RUUtil.toText(RULang.get("config.levels") + ": &c" + lvls+"/"+levelNeeded + " Lvs."));
}
}
}