Solved Unobtainable enchants?

Discussion in 'Plugin Development' started by BMX_ATVMAN14, Nov 30, 2012.

Thread Status:
Not open for further replies.
  1. Offline

    BMX_ATVMAN14

    Hello! I have my races plugin, and I made a admin race and put knockback and fire on a bone, is there any way I can add like the level 127 (Or the highest enchant) to them?

    Thanks!

    This is what I did

    Code:
    public static void procTic() {
    for (Player p : Bukkit.getOnlinePlayers()) {
    String race = MetroRaces.getStatic().getUserDatabase().getUserRace(p.getName());
    if (!race.equals("boss")) {
    continue;
    }
    if (p.getFoodLevel() < 20) {
    p.setFoodLevel(20);
    }
    if (!Permissions.hasSkillPermission((Player) p, race)) {
    continue;
    }
    if (p.getItemInHand() == null) {
    return;
    }
    if (p.getItemInHand().getTypeId() != 352) {
    return;
    }
    if (!p.getItemInHand().containsEnchantment(Enchantment.KNOCKBACK)) {
    p.getItemInHand().addUnsafeEnchantment(Enchantment.KNOCKBACK, 2);
    }
    if (!p.getItemInHand().containsEnchantment(Enchantment.FIRE_ASPECT)) {
    p.getItemInHand().addUnsafeEnchantment(Enchantment.FIRE_ASPECT, 2);
    Or view here
     
  2. Offline

    Cammy_the_block

    use "addUnsafeEnchantment(Enchantment ench, int level)". Java Doc page http://jd.bukkit.org/apidocs/org/bukkit/inventory/ItemStack.html#addUnsafeEnchantment%28org.bukkit.enchantments.Enchantment,%20int%29
     
  3. Offline

    BMX_ATVMAN14

  4. Offline

    Cammy_the_block

    No clue! Anyways I'm brain dead.
     
  5. Offline

    BMX_ATVMAN14

    I'd get that fixed :p
     
  6. Offline

    CeramicTitan

    The max level is 127.
     
    BMX_ATVMAN14 likes this.
  7. Offline

    Cammy_the_block

    I'ma better now.
     
    BMX_ATVMAN14 likes this.
  8. Offline

    BMX_ATVMAN14

    Thank you!
     
  9. Offline

    CeramicTitan

    hahah No problem as long as I could help.
     
  10. Offline

    Jogy34

    The max level is much higher than 127. I've tested it with my enchanter plugin and the highest it would let me go is 10000
     
  11. Offline

    CeramicTitan

    It has no notable effect though?
     
  12. Offline

    Jogy34

    It has a fairly notable effect. I tested it with the knockback enchantment on a diamond sword. With a level 127 you can see the mob that you hit fly through the air in front of you. With level 10000 the mob virtually just disappears when you hit it and presumably flys much much farther.
     
Thread Status:
Not open for further replies.

Share This Page