Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
MythicMobs MythicMobs
  • Project overview
    • Project overview
    • Details
    • Activity
  • Issues 132
    • Issues 132
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
  • Operations
    • Operations
    • Incidents
  • Analytics
    • Analytics
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Members
    • Members
  • Activity
  • Create a new issue
  • Issue Boards
Collapse sidebar
  • MythicCraft
  • MythicMobsMythicMobs
  • Issues
  • #114

Closed
Open
Created Sep 30, 2020 by EternalHittMan@EternalHittMan

MythicMobs Api Mobspawn api null error

I am coding a simple huntnight plugin. I am using MythicMobs mob spawn api. When i use version 4.10.1, console spamming "Unable to create attribute: null" error. But older versions -like 4.9.0- there is no problem.

My Code

`

                            double randDouble = Math.random();
                            double chance = plugin.getConfig().getDouble("spawn-chance");

                                if (randDouble <= chance) {

                                    List<String> mobs = (List<String>) plugin.getConfig().getList("mobs");
                                    Random rand = new Random();
                                    String rmobs = mobs.get(rand.nextInt(mobs.size()));


                                    if (!rmobs.isEmpty() && rmobs.length() > 0 && rmobs != null && rmobs != "" && rmobs != "null") { // Null check, but it does not have any effect.
                                        try {
                                            try {
                                                MythicMobs.inst().getAPIHelper().spawnMythicMob(rmobs, e.getLocation());
                                            } catch (NullPointerException ex) {
                                                return;
                                            }
                                        } catch (InvalidMobTypeException e1) {
                                            return;
                                        }
                                    }

                        }`
Edited Sep 30, 2020 by EternalHittMan
Assignee
Assign to
None
Milestone
None
Assign milestone
Time tracking