1. Вы находитесь в сообществе Rubukkit. Мы - администраторы серверов Minecraft, разрабатываем собственные плагины и переводим на различные языки плагины наших коллег из других стран.
    Скрыть объявление
Скрыть объявление
В преддверии глобального обновления, мы проводим исследования, которые помогут нам сделать опыт пользования форумом ещё удобнее. Помогите нам, примите участие!

[SOLVED] Проблема с рецептами

Тема в разделе "Разработка плагинов для новичков", создана пользователем Zemf4you, 30 ноя 2017.

Статус темы:
Закрыта.
  1. Автор темы
    Zemf4you

    Zemf4you Активный участник Пользователь

    Баллы:
    76
    Имя в Minecraft:
    zemf4you
    Кастомные рецепты.
    Где может быть ошибка?
    Код:
    ShapedRecipe sh = new ShapedRecipe(chest);
          sh.shape(new String[]{"S0S", "SSS", "SSS"}).setIngredient('S', Material.DIRT);
          Bukkit.addRecipe(sh);
          ShapedRecipe sh2 = new ShapedRecipe(legg);
          sh2.shape(new String[]{"SSS", "S0S", "S0S"}).setIngredient('S', Material.DIRT);
          Bukkit.addRecipe(sh2);
          ShapedRecipe sh3 = new ShapedRecipe(hel);
          sh3.shape(new String[]{"SSS", "S0S", "000"}).setIngredient('S', Material.DIRT);
          Bukkit.addRecipe(sh3);
          ShapedRecipe sh4 = new ShapedRecipe(hel);
          sh4.shape(new String[]{"000", "SSS", "S0S"}).setIngredient('S', Material.DIRT);
          Bukkit.addRecipe(sh4);
          ShapedRecipe sh5 = new ShapedRecipe(boot);
          sh5.shape(new String[]{"S0S", "S0S", "000"}).setIngredient('S', Material.DIRT);
          Bukkit.addRecipe(sh5);
          ShapedRecipe sh6 = new ShapedRecipe(boot);
          sh6.shape(new String[]{"000", "S0S", "S0S"}).setIngredient('S', Material.DIRT);
          Bukkit.addRecipe(sh6);
          ShapedRecipe sh7 = new ShapedRecipe(axe);
          sh6.shape(new String[]{"0SS", "0BS", "0B0"}).setIngredient('S', Material.DIRT).setIngredient('B', Material.STICK);
          Bukkit.addRecipe(sh7);
          ShapedRecipe sh8 = new ShapedRecipe(axe);
          sh6.shape(new String[]{"SS0", "SB0", "0B0"}).setIngredient('S', Material.DIRT).setIngredient('B', Material.STICK);
          Bukkit.addRecipe(sh8);
          ShapedRecipe sh9 = new ShapedRecipe(sword);
          sh6.shape(new String[]{"0S0", "0S0", "0B0"}).setIngredient('S', Material.DIRT).setIngredient('B', Material.STICK);
          Bukkit.addRecipe(sh9);
          ShapedRecipe sh10 = new ShapedRecipe(sword);
          sh6.shape(new String[]{"S00", "S00", "B00"}).setIngredient('S', Material.DIRT).setIngredient('B', Material.STICK);
          Bukkit.addRecipe(sh10);
          ShapedRecipe sh11 = new ShapedRecipe(sword);
          sh6.shape(new String[]{"00S", "00S", "00B"}).setIngredient('S', Material.DIRT).setIngredient('B', Material.STICK);
          Bukkit.addRecipe(sh11);
          super.onEnable();
    
     
  2. Zнамя Юности

    Zнамя Юности Активный участник Пользователь

    Баллы:
    76
    вон там

    p.s. ты может больше подробностей напишешь или нах надо?
     
  3. Cool_boy

    Cool_boy Активный участник Пользователь

    Баллы:
    96
    Имя в Minecraft:
    prettydude
    Не нужно указать что 0 - это воздух?
     
  4. Автор темы
    Zemf4you

    Zemf4you Активный участник Пользователь

    Баллы:
    76
    Имя в Minecraft:
    zemf4you
    сейчас попробую
     
  5. Автор темы
    Zemf4you

    Zemf4you Активный участник Пользователь

    Баллы:
    76
    Имя в Minecraft:
    zemf4you
    прости, можешь сказать, какие нужны подробности?
    на всякий случай кину ошибку в логе:
    Код:
    [Server thread/ERROR]: Error occurred while enabling Armor4Gods v1.2 (Is it up to date?)
    java.lang.NullPointerException
        at org.*********ventory.ShapedRecipe.getShape(ShapedRecipe.java:137) ~[spigot-1.9.4-R0.1-SNAPSHOT-latest.jar:git-Spigot-4af49dc-c5e9a16]
        at org.bukkit.craftbukkit.v1_9_R2.inventory.CraftShapedRecipe.fromBukkitRecipe(CraftShapedRecipe.java:30) ~[spigot-1.9.4-R0.1-SNAPSHOT-latest.jar:git-Spigot-4af49dc-c5e9a16]
        at org.bukkit.craftbukkit.v1_9_R2.CraftServer.addRecipe(CraftServer.java:1098) ~[spigot-1.9.4-R0.1-SNAPSHOT-latest.jar:git-Spigot-4af49dc-c5e9a16]
        at org.bukkit.Bukkit.addRecipe(Bukkit.java:601) ~[spigot-1.9.4-R0.1-SNAPSHOT-latest.jar:git-Spigot-4af49dc-c5e9a16]
        at armor4gods.Main.onEnable(Main.java:94) ~[?:?]
        at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:292) ~[spigot-1.9.4-R0.1-SNAPSHOT-latest.jar:git-Spigot-4af49dc-c5e9a16]
        at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:340) [spigot-1.9.4-R0.1-SNAPSHOT-latest.jar:git-Spigot-4af49dc-c5e9a16]
        at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:405) [spigot-1.9.4-R0.1-SNAPSHOT-latest.jar:git-Spigot-4af49dc-c5e9a16]
        at org.bukkit.craftbukkit.v1_9_R2.CraftServer.loadPlugin(CraftServer.java:361) [spigot-1.9.4-R0.1-SNAPSHOT-latest.jar:git-Spigot-4af49dc-c5e9a16]
        at org.bukkit.craftbukkit.v1_9_R2.CraftServer.enablePlugins(CraftServer.java:321) [spigot-1.9.4-R0.1-SNAPSHOT-latest.jar:git-Spigot-4af49dc-c5e9a16]
        at net.minecraft.server.v1_9_R2.MinecraftServer.t(MinecraftServer.java:416) [spigot-1.9.4-R0.1-SNAPSHOT-latest.jar:git-Spigot-4af49dc-c5e9a16]
        at net.minecraft.server.v1_9_R2.MinecraftServer.l(MinecraftServer.java:381) [spigot-1.9.4-R0.1-SNAPSHOT-latest.jar:git-Spigot-4af49dc-c5e9a16]
        at net.minecraft.server.v1_9_R2.MinecraftServer.a(MinecraftServer.java:336) [spigot-1.9.4-R0.1-SNAPSHOT-latest.jar:git-Spigot-4af49dc-c5e9a16]
        at net.minecraft.server.v1_9_R2.DedicatedServer.init(DedicatedServer.java:268) [spigot-1.9.4-R0.1-SNAPSHOT-latest.jar:git-Spigot-4af49dc-c5e9a16]
        at net.minecraft.server.v1_9_R2.MinecraftServer.run(MinecraftServer.java:532) [spigot-1.9.4-R0.1-SNAPSHOT-latest.jar:git-Spigot-4af49dc-c5e9a16]
        at java.lang.Thread.run(Unknown Source) [?:1.8.0_152]
    
     
  6. Автор темы
    Zemf4you

    Zemf4you Активный участник Пользователь

    Баллы:
    76
    Имя в Minecraft:
    zemf4you
    не помогло
     
  7. Cool_boy

    Cool_boy Активный участник Пользователь

    Баллы:
    96
    Имя в Minecraft:
    prettydude
    Main.java:94, что там?
     
  8. Автор темы
    Zemf4you

    Zemf4you Активный участник Пользователь

    Баллы:
    76
    Имя в Minecraft:
    zemf4you
    Проблема решена. Т.к. лень было писать всё несколько раз, копировал и не заметил, что повторяюсь с sh6, а добавляю с 6 до 11.

    ShapedRecipe sh6 = new ShapedRecipe(boot);
    sh6.shape(new String[]{"000", "S0S", "S0S"}).setIngredient('S', Material.DIRT);
    Bukkit.addRecipe(sh6);
    ShapedRecipe sh7 = new ShapedRecipe(axe);
    sh6.shape(new String[]{"0SS", "0BS", "0B0"}).setIngredient('S', Material.DIRT).setIngredient('B', Material.STICK);
    Bukkit.addRecipe(sh7);
    ShapedRecipe sh8 = new ShapedRecipe(axe);
    sh6.shape(new String[]{"SS0", "SB0", "0B0"}).setIngredient('S', Material.DIRT).setIngredient('B', Material.STICK);
    Bukkit.addRecipe(sh8);
    ShapedRecipe sh9 = new ShapedRecipe(sword);
    sh6.shape(new String[]{"0S0", "0S0", "0B0"}).setIngredient('S', Material.DIRT).setIngredient('B', Material.STICK);
    Bukkit.addRecipe(sh9);
    ShapedRecipe sh10 = new ShapedRecipe(sword);
    sh6.shape(new String[]{"S00", "S00", "B00"}).setIngredient('S', Material.DIRT).setIngredient('B', Material.STICK);
    Bukkit.addRecipe(sh10);
    ShapedRecipe sh11 = new ShapedRecipe(sword);
    sh6.shape(new String[]{"00S", "00S", "00B"}).setIngredient('S', Material.DIRT).setIngredient('B', Material.STICK);
    Bukkit.addRecipe(sh11);

    P.S. - тот, кто будет глядеть - воздух я тоже указал. Делайте по аналогии
     
Статус темы:
Закрыта.

Поделиться этой страницей