• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java SkillType类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.gmail.nossr50.datatypes.skills.SkillType的典型用法代码示例。如果您正苦于以下问题:Java SkillType类的具体用法?Java SkillType怎么用?Java SkillType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



SkillType类属于com.gmail.nossr50.datatypes.skills包,在下文中一共展示了SkillType类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: load

import com.gmail.nossr50.datatypes.skills.SkillType; //导入依赖的package包/类
public void load() {
    FileConfiguration config = plugin.getConfig();

    loadMessages(config);
    loadNotificationSound(config.getConfigurationSection("notification-sound"));

    progressEnabled = config.getBoolean("progress");

    for (String disableSkill : config.getStringList("progress-disabled")) {
        Optional<SkillType> skillType = Enums.getIfPresent(SkillType.class, disableSkill.toUpperCase());
        if (skillType.isPresent()) {
            disabledSkillProgress.add(skillType.get());
        } else {
            plugin.getLogger()
                    .log(Level.WARNING, "The skill type {0} for disabled progress is unknown", disableSkill);
        }
    }
}
 
开发者ID:games647,项目名称:mcMMOAction,代码行数:19,代码来源:Configuration.java


示例2: onPlayerActivateSecAbillity

import com.gmail.nossr50.datatypes.skills.SkillType; //导入依赖的package包/类
@EventHandler
public void onPlayerActivateSecAbillity(SecondaryAbilityWeightedActivationCheckEvent e){
	RedProtect.get().logger.debug("Mcmmo SecondaryAbilityWeightedActivationCheckEvent event.");
	
	Player p = e.getPlayer();
	Region r = RedProtect.get().rm.getTopRegion(p.getLocation());
	if (r == null){
		return;
	}
	
	if (!r.canSkill(p)){
		e.setCancelled(true);
	}
	if (!r.canPVP(p, null) && (e.getSkill().equals(SkillType.SWORDS) || e.getSkill().equals(SkillType.UNARMED) || e.getSkill().equals(SkillType.AXES))){
		e.setCancelled(true);
	}
}
 
开发者ID:FabioZumbi12,项目名称:RedProtect,代码行数:18,代码来源:McMMoListener.java


示例3: onPlayerUnarmed

import com.gmail.nossr50.datatypes.skills.SkillType; //导入依赖的package包/类
@EventHandler
public void onPlayerUnarmed(McMMOPlayerDisarmEvent e){
	RedProtect.get().logger.debug("Mcmmo McMMOPlayerDisarmEvent event.");
	
	Player p = e.getPlayer();
	Region r = RedProtect.get().rm.getTopRegion(e.getDefender().getLocation());
	if (r == null){
		return;
	}
	
	if (!r.canSkill(p)){
		e.setCancelled(true);
	}
	if (!r.canPVP(p, e.getDefender()) && (e.getSkill().equals(SkillType.SWORDS) || e.getSkill().equals(SkillType.UNARMED) || e.getSkill().equals(SkillType.AXES))){
		e.setCancelled(true);
	}
}
 
开发者ID:FabioZumbi12,项目名称:RedProtect,代码行数:18,代码来源:McMMoListener.java


示例4: onSecondaryAbilityEvent

import com.gmail.nossr50.datatypes.skills.SkillType; //导入依赖的package包/类
@EventHandler
public void onSecondaryAbilityEvent(SecondaryAbilityEvent e){
	RedProtect.get().logger.debug("Mcmmo SecondaryAbilityEvent event.");
	
	Player p = e.getPlayer();
	Region r = RedProtect.get().rm.getTopRegion(e.getPlayer().getLocation());
	if (r == null){
		return;
	}
	if (!r.canSkill(p)){
		e.setCancelled(true);
	}
	if (!r.canPVP(p, null) && (e.getSkill().equals(SkillType.SWORDS) || e.getSkill().equals(SkillType.UNARMED) || e.getSkill().equals(SkillType.AXES))){
		e.setCancelled(true);
	}
}
 
开发者ID:FabioZumbi12,项目名称:RedProtect,代码行数:17,代码来源:McMMoListener.java


示例5: isForbiddenSkillInRegion

import com.gmail.nossr50.datatypes.skills.SkillType; //导入依赖的package包/类
public boolean isForbiddenSkillInRegion(Player player, SkillType skill) {
    if (worldGuard != null) {
        Location location = player.getLocation();
        RegionManager regionManager = worldGuard.getRegionContainer().get(player.getWorld());
        if (regionManager == null) {
            return false;
        }

        ApplicableRegionSet regions = regionManager.getApplicableRegions(location);

        LocalPlayer localPlayer = worldGuard.wrapPlayer(player);
        return regions.queryAllValues(localPlayer, skillListFlag).contains(skill);
    }

    return false;
}
 
开发者ID:games647,项目名称:mcMMOExtras,代码行数:17,代码来源:WorldGuardFlagSupport.java


示例6: updateExpBar

import com.gmail.nossr50.datatypes.skills.SkillType; //导入依赖的package包/类
public void updateExpBar(SkillType usedSkill, float gainedExp) {
    if (!enabled) {
        return;
    }

    Player player = Bukkit.getPlayer(playerUUID);
    String skillName = usedSkill.getName();
    int level = ExperienceAPI.getLevel(player, skillName);

    int exp = ExperienceAPI.getXP(player, skillName);
    int requiredExp = ExperienceAPI.getXPToNextLevel(player, skillName);
    int percent = calculatePercent(exp, requiredExp);

    String newMessage = formatMessage(skillName, level, exp, requiredExp, gainedExp, percent);
    updateBar(player, usedSkill, newMessage, percent);
}
 
开发者ID:games647,项目名称:mcMMOExtras,代码行数:17,代码来源:PlayerData.java


示例7: updateBar

import com.gmail.nossr50.datatypes.skills.SkillType; //导入依赖的package包/类
private void updateBar(Player player, final SkillType skill, String message, float percent) {
    plugin.getBossAPI().setMessage(player, skill, message, percent);

    Bukkit.getScheduler().cancelTask(disappearTimers.getOrDefault(skill, -1));

    //disappear timer
    if (!plugin.getConfig().getBoolean("alwaysShow")) {
        int taskId = Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, () -> {
            Player onlinePlayer = Bukkit.getPlayer(playerUUID);
            if (onlinePlayer != null) {
                plugin.getBossAPI().removeBar(onlinePlayer, skill);
            }
        }, plugin.getConfig().getInt("bar.disappear") * 20);

        disappearTimers.put(skill, taskId);
    }
}
 
开发者ID:games647,项目名称:mcMMOExtras,代码行数:18,代码来源:PlayerData.java


示例8: onNewExp

import com.gmail.nossr50.datatypes.skills.SkillType; //导入依赖的package包/类
private void onNewExp(UUID playerUUID, SkillType skillType, float xpGain) {
    Player player = Bukkit.getPlayer(playerUUID);
    if (player == null) {
        //player went offline in that one tick
        return;
    }

    String skillName = skillType.getName();
    int level = ExperienceAPI.getLevel(player, skillName);

    //permission based max levels
    if (level <= plugin.getMaxLevel(player, skillType) && !plugin.isForbiddenRegion(player, skillType)) {
        PlayerData playerData = plugin.getData(player);
        playerData.updateExpBar(skillType, xpGain);
    }
}
 
开发者ID:games647,项目名称:mcMMOExtras,代码行数:17,代码来源:ExpBarEvents.java


示例9: addXp

import com.gmail.nossr50.datatypes.skills.SkillType; //导入依赖的package包/类
/**
 * Add Experience to a skill.
 *
 * @param skill Type of skill to add experience to
 * @param xp Number of experience to add
 */
public void addXp(SkillType skill, float xp) {
    changed = true;

    if (skill.isChildSkill()) {
        Set<SkillType> parentSkills = FamilyTree.getParents(skill);
        float dividedXP = (xp / parentSkills.size());

        for (SkillType parentSkill : parentSkills) {
            skillsXp.put(parentSkill, skillsXp.get(parentSkill) + dividedXP);
        }
    }
    else {
        skillsXp.put(skill, skillsXp.get(skill) + xp);
    }
}
 
开发者ID:Pershonkey,项目名称:McMMOPlus,代码行数:22,代码来源:PlayerProfile.java


示例10: applyXpGain

import com.gmail.nossr50.datatypes.skills.SkillType; //导入依赖的package包/类
/**
 * Applies an experience gain
 *
 * @param skillType Skill being used
 * @param xp Experience amount to add
 */
public void applyXpGain(SkillType skillType, float xp, XPGainReason xpGainReason) {
    if (!skillType.getPermissions(player)) {
        return;
    }

    if (skillType.isChildSkill()) {
        Set<SkillType> parentSkills = FamilyTree.getParents(skillType);

        for (SkillType parentSkill : parentSkills) {
            applyXpGain(parentSkill, xp / parentSkills.size(), xpGainReason);
        }

        return;
    }

    if (!EventUtils.handleXpGainEvent(player, skillType, xp, xpGainReason)) {
        return;
    }

    isUsingUnarmed = (skillType == SkillType.UNARMED);
    checkXp(skillType, xpGainReason);
}
 
开发者ID:Pershonkey,项目名称:McMMOPlus,代码行数:29,代码来源:McMMOPlayer.java


示例11: editValues

import com.gmail.nossr50.datatypes.skills.SkillType; //导入依赖的package包/类
protected void editValues(Player player, PlayerProfile profile, SkillType skill) {
    if (skill == null) {
        for (SkillType skillType : SkillType.NON_CHILD_SKILLS) {
            handleCommand(player, profile, skillType);
        }

        if (player != null) {
            handlePlayerMessageAll(player);
        }
    }
    else {
        handleCommand(player, profile, skill);

        if (player != null) {
            handlePlayerMessageSkill(player, skill);
        }
    }
}
 
开发者ID:Pershonkey,项目名称:McMMOPlus,代码行数:19,代码来源:SkillresetCommand.java


示例12: handleXpPerks

import com.gmail.nossr50.datatypes.skills.SkillType; //导入依赖的package包/类
public static float handleXpPerks(Player player, float xp, SkillType skill) {
    if (Permissions.quadrupleXp(player, skill)) {
        xp *= 4;
    }
    else if (Permissions.tripleXp(player, skill)) {
        xp *= 3;
    }
    else if (Permissions.doubleAndOneHalfXp(player, skill)) {
        xp *= 2.5;
    }
    else if (Permissions.doubleXp(player, skill)) {
        xp *= 2;
    }
    else if (Permissions.oneAndOneHalfXp(player, skill)) {
        xp *= 1.5;
    }
    else if (Permissions.oneAndOneTenthXp(player, skill)) {
        xp *= 1.1;
    }
    else if (Permissions.customXpBoost(player, skill)) {
        xp *= ExperienceConfig.getInstance().getCustomXpPerkBoost();
    }

    return xp;
}
 
开发者ID:Pershonkey,项目名称:McMMOPlus,代码行数:26,代码来源:PerksUtils.java


示例13: acceptRankData

import com.gmail.nossr50.datatypes.skills.SkillType; //导入依赖的package包/类
public void acceptRankData(Map<SkillType, Integer> rankData) {
    Integer rank;
    Player player = mcMMO.p.getServer().getPlayerExact(playerName);

    for (SkillType skill : SkillType.NON_CHILD_SKILLS) {
        if (!skill.getPermissions(player)) {
            continue;
        }

        rank = rankData.get(skill);

        if (rank != null) {
            sidebarObjective.getScore(ScoreboardManager.skillLabels.get(skill)).setScore(rank);
        }
    }

    rank = rankData.get(null);

    if (rank != null) {
        sidebarObjective.getScore(ScoreboardManager.LABEL_POWER_LEVEL).setScore(rank);
    }
}
 
开发者ID:Pershonkey,项目名称:McMMOPlus,代码行数:23,代码来源:ScoreboardWrapper.java


示例14: editValues

import com.gmail.nossr50.datatypes.skills.SkillType; //导入依赖的package包/类
protected void editValues(Player player, PlayerProfile profile, SkillType skill, int value) {
    if (skill == null) {
        for (SkillType skillType : SkillType.NON_CHILD_SKILLS) {
            handleCommand(player, profile, skillType, value);
        }

        if (player != null) {
            handlePlayerMessageAll(player, value);
        }
    }
    else {
        handleCommand(player, profile, skill, value);

        if (player != null) {
            handlePlayerMessageSkill(player, value, skill);
        }
    }
}
 
开发者ID:Pershonkey,项目名称:McMMOPlus,代码行数:19,代码来源:ExperienceCommand.java


示例15: addLevelOffline

import com.gmail.nossr50.datatypes.skills.SkillType; //导入依赖的package包/类
/**
 * Add levels to a skill for an offline player.
 * </br>
 * This function is designed for API usage.
 *
 * @param playerName The player to add levels to
 * @param skillType Type of skill to add levels to
 * @param levels Number of levels to add
 *
 * @throws InvalidSkillException if the given skill is not valid
 * @throws InvalidPlayerException if the given player does not exist in the database
 */
@Deprecated
public static void addLevelOffline(String playerName, String skillType, int levels) {
    PlayerProfile profile = getOfflineProfile(playerName);
    SkillType skill = getSkillType(skillType);

    if (skill.isChildSkill()) {
        Set<SkillType> parentSkills = FamilyTree.getParents(skill);

        for (SkillType parentSkill : parentSkills) {
            profile.addLevels(parentSkill, (levels / parentSkills.size()));
        }

        profile.scheduleAsyncSave();
        return;
    }

    profile.addLevels(skill, levels);
    profile.scheduleAsyncSave();
}
 
开发者ID:Pershonkey,项目名称:McMMOPlus,代码行数:32,代码来源:ExperienceAPI.java


示例16: onBlockPlace

import com.gmail.nossr50.datatypes.skills.SkillType; //导入依赖的package包/类
/**
 * Monitor BlockPlace events.
 *
 * @param event The event to watch
 */
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onBlockPlace(BlockPlaceEvent event) {
    Player player = event.getPlayer();

    if (!UserManager.hasPlayerDataKey(player)) {
        return;
    }

    BlockState blockState = event.getBlock().getState();

    /* Check if the blocks placed should be monitored so they do not give out XP in the future */
    if (BlockUtils.shouldBeWatched(blockState)) {
        mcMMO.getPlaceStore().setTrue(blockState);
    }

    McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);

    if (blockState.getType() == Repair.anvilMaterial && SkillType.REPAIR.getPermissions(player)) {
        mcMMOPlayer.getRepairManager().placedAnvilCheck();
    }
    else if (blockState.getType() == Salvage.anvilMaterial && SkillType.SALVAGE.getPermissions(player)) {
        mcMMOPlayer.getSalvageManager().placedAnvilCheck();
    }
}
 
开发者ID:Pershonkey,项目名称:McMMOPlus,代码行数:30,代码来源:BlockListener.java


示例17: onPlayerCommandPreprocess

import com.gmail.nossr50.datatypes.skills.SkillType; //导入依赖的package包/类
/**
 * Handle "ugly" aliasing /skillname commands, since setAliases doesn't work.
 *
 * @param event The event to watch
 */
@EventHandler(priority = EventPriority.LOWEST)
public void onPlayerCommandPreprocess(PlayerCommandPreprocessEvent event) {
    if (!Config.getInstance().getLocale().equalsIgnoreCase("en_US")) {
        String message = event.getMessage();
        String command = message.substring(1).split(" ")[0];
        String lowerCaseCommand = command.toLowerCase();

        // Do these ACTUALLY have to be lower case to work properly?
        for (SkillType skill : SkillType.values()) {
            String skillName = skill.toString().toLowerCase();
            String localizedName = skill.getName().toLowerCase();

            if (lowerCaseCommand.equals(localizedName)) {
                event.setMessage(message.replace(command, skillName));
                break;
            }

            if (lowerCaseCommand.equals(skillName)) {
                break;
            }
        }
    }
}
 
开发者ID:Pershonkey,项目名称:McMMOPlus,代码行数:29,代码来源:PlayerListener.java


示例18: get

import com.gmail.nossr50.datatypes.skills.SkillType; //导入依赖的package包/类
@Override
@Nullable
protected SkillType[] get(Event e) {
	if (e.getEventName().equals("McMMOPlayerLevelUpEvent")) {
		return new SkillType[] { ((McMMOPlayerLevelUpEvent) e).getSkill() };
	} else if (e.getEventName().equals("McMMOPlayerXpGainEvent")) {
		return new SkillType[] { ((McMMOPlayerXpGainEvent) e).getSkill() };
	}
	return null;
}
 
开发者ID:Sharpjaws,项目名称:SharpSK,代码行数:11,代码来源:ExprEvtSkillType.java


示例19: init

import com.gmail.nossr50.datatypes.skills.SkillType; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public boolean init(Expression<?>[] expr, int arg1, Kleenean arg2, ParseResult arg3) {
	s = (Expression<SkillType>) expr[0];
	p = (Expression<OfflinePlayer>) expr[1];
	return true;
}
 
开发者ID:Sharpjaws,项目名称:SharpSK,代码行数:8,代码来源:ExprmcMMOSkillLevelReXP.java


示例20: init

import com.gmail.nossr50.datatypes.skills.SkillType; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public boolean init(Expression<?>[] expr, int matchedPattern, Kleenean paramKleenean,
		SkriptParser.ParseResult paramParseResult) {
	s = (Expression<SkillType>) expr[0];
	p = (Expression<OfflinePlayer>) expr[1];
	return true;
}
 
开发者ID:Sharpjaws,项目名称:SharpSK,代码行数:9,代码来源:ExprmcMMOSkillLevel.java



注:本文中的com.gmail.nossr50.datatypes.skills.SkillType类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java DestroyElementCommand类代码示例发布时间:2022-05-23
下一篇:
Java ExpressionParser类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap