本文整理汇总了Java中com.earth2me.essentials.User.isAuthorized方法的典型用法代码示例。如果您正苦于以下问题:Java User.isAuthorized方法的具体用法?Java User.isAuthorized怎么用?Java User.isAuthorized使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.earth2me.essentials.User
的用法示例。
在下文中一共展示了User.isAuthorized方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: broadcastMessage
import com.earth2me.essentials.User; //导入方法依赖的package包/类
private void broadcastMessage(IUser sender, final String permission, final String message) {
if(essentialsHook != null) {
IText broadcast = new SimpleTextInput(message);
final Collection<Player> players = (Collection<Player>) Bukkit.getOnlinePlayers();
for (Player player : players) {
final User user = essentialsHook.getUser(player);
if ((permission == null && (sender == null || !user.isIgnoredPlayer(sender))) || (permission != null && user.isAuthorized(permission))) {
for (String messageText : broadcast.getLines()) {
UnifiedUser unifiedUser = new UnifiedUser(player);
if (unifiedUser.isSynced())
messenger.sendMessageToDM(unifiedUser.getMcbUser().getUser(), messageText);
}
}
}
}
}
示例2: doBack
import com.earth2me.essentials.User; //导入方法依赖的package包/类
private void doBack(Player p, User iu, Location curLoc, Location lastLoc) {
if (iu.getWorld() != lastLoc.getWorld() && ess.getSettings().isWorldTeleportPermissions() && !iu.isAuthorized("essentials.worlds." + lastLoc.getWorld().getName())) {
msg(p, "internal.error.no_required_permission", "essentials.worlds." + lastLoc.getWorld().getName());
return;
}
double fee = plugin.cfg.backBase;
if (curLoc.getWorld() != lastLoc.getWorld()) {
fee += plugin.cfg.backWorld;
fee += lastLoc.distance(PlayerSpawn(p, lastLoc.getWorld())) * (double) plugin.cfg.backIncrement / plugin.cfg.backDistance;
} else {
fee += lastLoc.distance(curLoc) * (double) plugin.cfg.backIncrement / plugin.cfg.backDistance;
}
if (fee > plugin.cfg.backMax) fee = plugin.cfg.backMax;
fee = Double.parseDouble(new DecimalFormat("#.00").format(fee));
if (!VaultUtils.withdraw(p, fee)) {
msg(p, "user.teleport.money_insufficient", fee);
return;
}
try {
iu.getTeleport().back(new Trade(0, ess));
msg(p, "user.teleport.ok", fee, I18n.format("user.teleport.back"));
if (plugin.systemBalance != null) {
plugin.systemBalance.deposit(fee, plugin);
}
} catch (Exception e) {
VaultUtils.deposit(p, fee);
p.sendMessage(e.getMessage());
}
}
示例3: doHome
import com.earth2me.essentials.User; //导入方法依赖的package包/类
private void doHome(Player p, User iu, Location homeLoc, Location curLoc) {
if (iu.getWorld() != homeLoc.getWorld() && ess.getSettings().isWorldHomePermissions() && !iu.isAuthorized("essentials.worlds." + homeLoc.getWorld().getName())) {
msg(p, "internal.error.no_required_permission", "essentials.worlds." + homeLoc.getWorld().getName());
return;
}
double fee = plugin.cfg.homeBase;
if (homeLoc.getWorld() != curLoc.getWorld()) {
fee += plugin.cfg.homeWorld;
fee += homeLoc.distance(PlayerSpawn(p, homeLoc.getWorld())) * (double) plugin.cfg.homeIncrement / plugin.cfg.homeDistance;
} else {
fee += homeLoc.distance(curLoc) * (double) plugin.cfg.homeIncrement / plugin.cfg.homeDistance;
}
if (fee > plugin.cfg.homeMax) fee = plugin.cfg.homeMax;
fee = Double.parseDouble(new DecimalFormat("#.00").format(fee));
if (!VaultUtils.withdraw(p, fee)) {
msg(p, "user.teleport.money_insufficient", fee);
return;
}
try {
iu.getTeleport().teleport(homeLoc, new Trade(0, ess), PlayerTeleportEvent.TeleportCause.PLUGIN);
msg(p, "user.teleport.ok", fee, I18n.format("user.teleport.home"));
if (plugin.systemBalance != null) {
plugin.systemBalance.deposit(fee, plugin);
}
} catch (Exception e) {
VaultUtils.deposit(p, fee);
p.sendMessage(e.getMessage());
}
}
示例4: checkHomeLimit
import com.earth2me.essentials.User; //导入方法依赖的package包/类
private int checkHomeLimit(final User user, String name) {
if (!user.isAuthorized("essentials.sethome.multiple.unlimited")) {
int limit = ess.getSettings().getHomeLimit(user);
if (user.getHomes().size() == limit && user.getHomes().contains(name)) {
return 0;
}
if (user.getHomes().size() >= limit) {
return limit;
}
if (limit == 1) {
return 1;
}
}
return 0;
}