Skills v2.0

A plugin that adds a skill and tier system

  1. ZinniZin
    Tested Minecraft Versions:
    • 1.10
    • 1.12
    Source Code:
    https://github.com/Zinni-zin/mc-skills-plugin
    A plugin that adds seven skills to Minecraft
    this plugin uses MagicSpells(Max Mana and Mana regen) and EssentialX(economy)

    The skills are
    Max Health
    Max Mana
    Mana Regen
    Damage
    Defense
    Dodge Chance
    Critical Hit Chance

    Skills Menu:
    [​IMG]

    Each Skill can be disabled via config

    The plugin adds up to ten tiers used via permissions, tiers can either increase via command or on level up, tiers can also be set in any permission plugin

    Each tier effects: Max Heath, Max Mana and Mana Regen
    if any of those skills are disabled the tier effect will also be disabled

    ---------Commands---------

    /skills
    Opens the menu

    /skills hp
    Displays current hp

    /skills dodge
    Displays dodge chance

    /skills crit
    Displays crit chance

    /skills point skill
    Displays the skill points

    /skills point hp
    Displays the hp points

    /skills point dodge
    Displays the dodge points

    /skills point crit
    Displays the crit points

    /skills reset
    Resets the player's skills(requires: skills.player.reset)

    /skills temp
    Gives the player temporary skills(requires: skills.player.temp)

    /skills load
    Loads the player's old skills(requires: skills.player.temp)
    ---------Admin---------

    /skills get [name] point skill
    Gets a skill point of a player

    /skills get [name] point hp
    gets health points of a player

    /skills get [name] point dodge
    gets dodge points of a player

    /skills get [name] point crit
    gets critpoints of a player

    /skills reset [player]
    resets a player's skill points and level

    /skills temp [player]
    Gives the player temporary skills

    /skills load [player]
    Loads the player's old skills



    /skills remove [player] [point type] [amount]
    Removes a point type of a player

    /skills give [player] [point type] [amount]
    Gives a player a point type

    /skills reload
    Reloads the config


    /skills increasetier [player]
    Increases a player’s tier(requires skills.leader perm node)


    /skills decreasetier [player]
    Decreases a player’s tier(requires skills.leader perm node)


    /skills settier [player] [tier num]
    Sets a player’s tier(requires skills.admin perm node)


    ---------Perm Nodes---------

    skills.leader

    skills.admin

    skills.player.reset

    skills.player.temp

    skills.tier.one

    skills.tier.two

    skills.tier.three

    skills.tier.four

    skills.tier.five

    skills.tier.six

    skills.tier.seven

    skills.tier.eight

    skills.tier.nine

    skills.tier.ten


    ---------Point Types---------

    Skill

    Hp

    Dmg

    Defense

    Dodge

    Crit

    Mana

    manaregen

    -----------------------------


    The plugin does have a config most of it explains it self but for reference
    "Save-Highest-Level" Keeps the player at their last highest level
    "Seconds-Each-Scoreboard-Packet-Is-Sent" Seconds the scoreboard is updated(if there's a scoreboard)
    "Scoreboard-Slot-[0-15]" enables that slot on the scoreboard(if there is a scoreboard)

    Do not set any of the max skill points to 0! the increase of skills is calculated by dividing the max skill point and of course you can't divide by 0!

    The scoreboard is customizable via other plugin if there isn't a plugin that calls the scoreboard send packet function then there won't be a scoreboard

    Example Code For Scoreboard:
    Code (Text):
    package zinnia.example.scoreboard;

    import org.bukkit.Bukkit;
    import org.bukkit.entity.Player;
    import org.bukkit.plugin.java.JavaPlugin;
    import org.bukkit.scheduler.BukkitRunnable;

    import com.earth2me.essentials.api.Economy;
    import com.nisovin.magicspells.MagicSpells;

    import zinnia.skills.main.Skills;
    import zinnia.skills.player.SkillsScoreboard;
    import zinnia.skills.utils.Colours;
    import zinnia.skills.utils.ScoreboardData;


    public class Data extends JavaPlugin {

        /*
         * !!! remember to add a plugin.yml !!!
        */
        @Override
        public void onEnable() {
            SkillsScoreboard scoreboard = new SkillsScoreboard();

            new BukkitRunnable() {
                @Override
                public void run() {
                    for(Player p : Bukkit.getOnlinePlayers())
                    {
                        ScoreboardData._Objective = "Stats";

                        ScoreboardData._DispalyName = Colours.GRAY + "----" + Colours.GOLD + "Title Text" + Colours.GRAY + "----";

                        ScoreboardData._Score5 = Colours.GREEN + "Hp: " + getHealth(p);
                        ScoreboardData._Score4 = Colours.DARK_AQUA + "Mana: " + getMana(p);
                        ScoreboardData._Score3 = Colours.DARK_PURPLE + "Tier: " + Colours.INDIGO + tierDisplay(p);
                        ScoreboardData._Score2 = "";
                        ScoreboardData._Score1 = Colours.GOLD + "Bal: " + Colours.YELLOW + Double.toString(getBal(p));
                        ScoreboardData._Score0 = Colours.DARK_GREEN + "Ping: " + Colours.GREEN + Integer.toString(getPing(p));
                        scoreboard.sendScoreboardPackets(p);
                    }
                }
            }.runTaskTimer(this, 0, Skills.scoreboardPacketSendPeriod * 20);
        }

        @SuppressWarnings("deprecation")
        private String getHealth(Player player) {
            if(player != null) {
                return Colours.RED + player.getHealth() + Colours.DARK_RED + "/" + Colours.RED + player.getMaxHealth();
            }
            return Colours.RED + "0" + Colours.DARK_RED + "/" + Colours.RED +  "0";
        }
     
        private String getMana(Player player) {
            if(player != null) {
                return Colours.AQUA + MagicSpells.getManaHandler().getMana(player) + Colours.DARK_BLUE + "/" +
                        Colours.AQUA + MagicSpells.getManaHandler().getMaxMana(player);
            }
            return Colours.AQUA + "0" + Colours.DARK_BLUE + "/" + Colours.AQUA + "0";
        }
     
        private String tierDisplay(Player player) {
            if(player.hasPermission("skills.tier.one"))     return "one";
            if(player.hasPermission("skills.tier.two"))     return "two";
            if(player.hasPermission("skills.tier.three"))   return "three";
            if(player.hasPermission("skills.tier.four"))    return "four";
            if(player.hasPermission("skills.tier.five"))    return "five";
            if(player.hasPermission("skills.tier.six"))     return "six";
            if(player.hasPermission("skills.tier.seven"))   return "seven";
            if(player.hasPermission("skills.tier.eight"))   return "eight";
            if(player.hasPermission("skills.tier.nine"))    return "Nine";
            if(player.hasPermission("skills.tier.ten"))     return "Ten";
            return                                                 "None";
        }
     
        @SuppressWarnings("deprecation")
        private double getBal(Player player) {
            try {
                if(Economy.getMoney(player.getName()) < 9999999) return Economy.getMoney(player.getName());
                else return 99999999;
            } catch(Exception e) {
                return 0;
            }
        }

        private int getPing(Player player) {
            try {
                // Like in the above method get the "getHandle" from craft player
                Object handler = player.getClass().getMethod("getHandle").invoke(player);

                // Get the ping from the handler field and convert it into an int
                Object ping = handler.getClass().getField("ping").getInt(handler);
                return (int)ping; // Return the ping converted into an int
            } catch(Exception e) { e.printStackTrace(); return 0; }
        }
    }

     
    Future Plans:
    Create particle effect on tier rank up(using Effectlib, willing to take effect suggestions, Note redstone dust particles can be coloured)

    Create grouping system, something like a guild and only the leader or co-leader can rank up the tiers of their members

    If there's any bugs please notify I do make mistakes and I can be really stupid

Recent Updates

  1. Changes!
  2. Skills v1.6
  3. Skills v1.2