Solved Commands not working after I restart server

Discussion in 'Spigot Plugin Development' started by TheDoominator, Jul 15, 2020.

  1. Hi, I have some commands and I restarted the server but they just come up with internal errors
    Code
    Code (Java):
    @Override
        public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
            Player player = (Player) sender;
            String uuid = player.getUniqueId().toString();
            if(command.getName().equals("visit")) {
                if (args.length == 0) {
                    player.sendMessage("Please enter a username");
                } else {
                    String visituuid = Bukkit.getOfflinePlayer(args[0]).getUniqueId().toString();
                    if (getConfig().getStringList("Players").contains(visituuid)) {
                        player.sendMessage("Teleporting you to " + args[0] + "'s cell!");
                        Location lock = new Location(Bukkit.getWorld(visituuid), 0.5, 95, 0.5);
                        player.teleport(lock);
                    } else {
                        player.sendMessage(args[0] + " does not have a cell");
                    }
                }
            } else {
                if (command.getName().equals("cell")) {
                    if (args.length == 0) {
                        if (getConfig().contains("Players." + uuid)) {
                            player.sendMessage("Teleporting you to your cell!");
                            Location lock = new Location(Bukkit.getWorld(uuid), 0.5, 95, 0.5);
                            player.teleport(lock);
                        }
                    } else if (args[0].equalsIgnoreCase("create") && !getConfig().contains("Players." + uuid)) {
                        player.sendMessage("Creating your cell now!");
                        cell = new WorldCreator(player.getUniqueId().toString() + "");
                        cell.generator(new ChunkGeneratorWorld());
                        cell.createWorld();
                        mv = (MultiverseCore) Bukkit.getPluginManager().getPlugin("MultiverseCore");
                        int x2 = 20;
                        int y2 = 101;
                        int z2 = -21;
                        Location loc2 = new Location(Bukkit.getWorld(player.getUniqueId().toString() + ""), 0, 95, 0);
                        try {
                            JavaPlugin.getPlugin(MultiverseCore.class).getMVWorldManager().getMVWorld(player.getUniqueId().toString() + "").setSpawnLocation(loc2);
                        } catch (Exception e) {
                            e.printStackTrace();
                        }
                        Location lock = new Location(null, 0.5, 95, 0.5);
                        lock.setWorld(Bukkit.getWorld(player.getUniqueId().toString() + ""));
                        BlockVector bvMin = BlockVector.toBlockPoint(200000, 255, 200000);
                        BlockVector bvMax = BlockVector.toBlockPoint(-200000, 0, -200000);

                        // define a region
                        ProtectedCuboidRegion reg = new ProtectedCuboidRegion("CELL" + player.getUniqueId(), bvMin, bvMax);
                        ProtectedCuboidRegion region = new ProtectedCuboidRegion("CELL" + player.getUniqueId(), bvMin, bvMax);
                        DefaultDomain owners = new DefaultDomain();
                        owners.addPlayer(getWorldGuard().wrapPlayer(player));
                        region.setOwners(owners);
                        region.setFlag(DefaultFlag.PVP, StateFlag.State.DENY);
                        getWorldGuard().getRegionManager(Bukkit.getWorld(player.getUniqueId().toString() + "")).addRegion(region);
                        player.teleport(lock);
                        int x = 0;
                        int y = 95;
                        int z = 0;
                        BlockVector asv = new BlockVector(x, y, z);
                        try {
                            loadArea(Bukkit.getWorld(player.getUniqueId().toString() + ""), "plugins/WorldEdit/schematics/prisoncell.schematic", asv);
                        } catch (DataException e) {
                            e.printStackTrace();
                        } catch (IOException e) {
                            e.printStackTrace();
                        } catch (MaxChangedBlocksException e) {
                            e.printStackTrace();
                        }
                        getConfig().createSection("Players." + uuid + ".size");
                        getConfig().createSection("Players." + uuid + ".perms");
                        getConfig().set("Players." + uuid + ".size", "1");
                        saveConfig();
                        return true;
                    } else if (args[0].equalsIgnoreCase("create") && getConfig().contains("Players." + uuid)) {
                        player.sendMessage("You already have a cell, sending you there now!");
                        Location lock = new Location(Bukkit.getWorld(uuid), 0.5, 95, 0.5);
                        player.teleport(lock);
                    } else if (args[0].equalsIgnoreCase("add")) {
                        Player target = Bukkit.getPlayer(args[1]);
                        if (target != null) {
                            String otheruuid = target.getUniqueId().toString();
                            List<String> permsList = getConfig().getStringList("Players." + uuid + ".perms");
                            ProtectedRegion region = getWorldGuard().getRegionManager(Bukkit.getWorld(player.getUniqueId().toString() + "")).getRegion("CELL" + player.getUniqueId());
                            DefaultDomain owners = new DefaultDomain();
                            if (!getConfig().getStringList("Players." + uuid + ".perms").contains(otheruuid)) {
                                owners.addPlayer(getWorldGuard().wrapPlayer(Bukkit.getPlayer(args[1])));
                                region.setOwners(owners);
                                permsList.add(otheruuid);
                                getConfig().set("Players." + uuid + ".perms", permsList);
                                saveConfig();
                                player.sendMessage("You have allowed " + args[1] + " to edit your cell!");
                            } else if (getConfig().getStringList("Players." + uuid + ".perms").contains(otheruuid)) {
                                player.sendMessage(args[1] + " already has permissions to edit your cell!");
                            }
                        } else {
                            player.sendMessage("Player " + args[1] + " is not online");
                        }
                    } else if (args[0].equalsIgnoreCase("remove")) {
                        Player target = Bukkit.getPlayer(args[1]);
                        if (target != null) {
                            String otheruuid = target.getUniqueId().toString();
                            List<String> permsList = getConfig().getStringList("Players." + uuid + ".perms");
                            ProtectedRegion region = getWorldGuard().getRegionManager(Bukkit.getWorld(player.getUniqueId().toString() + "")).getRegion("CELL" + player.getUniqueId());
                            DefaultDomain owners = new DefaultDomain();
                            if (getConfig().getStringList("Players." + uuid + ".perms").contains(otheruuid)) {
                                owners.removePlayer(getWorldGuard().wrapPlayer(Bukkit.getPlayer(args[1])));
                                region.setOwners(owners);
                                permsList.remove(otheruuid);
                                getConfig().set("Players." + uuid + ".perms", permsList);
                                saveConfig();
                                player.sendMessage("You have removed " + args[1] + "'s permissions to edit your cell!");
                            } else if (!getConfig().getStringList("Players." + uuid + ".perms").contains(otheruuid)) {
                                player.sendMessage(args[1] + " never had permissions to edit your cell!");
                            }
                        } else {
                            player.sendMessage("Player " + args[1] + " is not online");
                        }
                    } else {
                        player.sendMessage("Invalid command!");
                    }
                }
            }
            return false;
        }

        public static void loadArea(World world, String str, BlockVector origin) throws DataException, IOException, MaxChangedBlocksException {
            File file = new File(str);
            EditSession es = new EditSession(new BukkitWorld(world), 999999999);
            CuboidClipboard cc = CuboidClipboard.loadSchematic(file);
            cc.paste(es, origin, false);
        }
    it says i cant put more than 20000 characters in so ill do it in a reply
     
  2. In the console it says this when I run /cell, /cell create or any command that teleports you to a players world (It also teleports you to the default world if you are in a cell world)

    Code (Text):
    > [16:14:04 INFO]: EatedMySandwich issued server command: /cell
    > [16:14:04 ERROR]: Could not pass event PlayerTeleportEvent to WorldGuard v6.1
    org.bukkit.event.EventException
    at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:302) ~[server.jar:git-PaperSpigot-"4c7641d"]
    at co.aikar.timings.TimedEventExecutor.execute(TimedEventExecutor.java:78) ~[server.jar:git-PaperSpigot-"4c7641d"]
    at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:62) ~[server.jar:git-PaperSpigot-"4c7641d"]
    at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:517) [server.jar:git-PaperSpigot-"4c7641d"]
    at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:502) [server.jar:git-PaperSpigot-"4c7641d"]
    at org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer.teleport(CraftPlayer.java:541) [server.jar:git-PaperSpigot-"4c7641d"]
    at org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity.teleport(CraftEntity.java:236) [server.jar:git-PaperSpigot-"4c7641d"]
    at com.justdoom.prisonscell.Prisonscell.onCommand(Prisonscell.java:66) [PrisonsCell.jar:?]
    at org.bukkit.command.PluginCommand.execute(PluginCommand.java:45) [server.jar:git-PaperSpigot-"4c7641d"]
    at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:146) [server.jar:git-PaperSpigot-"4c7641d"]
    at org.bukkit.craftbukkit.v1_8_R3.CraftServer.dispatchCommand(CraftServer.java:666) [server.jar:git-PaperSpigot-"4c7641d"]
    at net.minecraft.server.v1_8_R3.PlayerConnection.handleCommand(PlayerConnection.java:1189) [server.jar:git-PaperSpigot-"4c7641d"]
    at net.minecraft.server.v1_8_R3.PlayerConnection.a(PlayerConnection.java:1001) [server.jar:git-PaperSpigot-"4c7641d"]
    at net.minecraft.server.v1_8_R3.PacketPlayInChat.a(PacketPlayInChat.java:45) [server.jar:git-PaperSpigot-"4c7641d"]
    at net.minecraft.server.v1_8_R3.PacketPlayInChat.a(PacketPlayInChat.java:1) [server.jar:git-PaperSpigot-"4c7641d"]
    at net.minecraft.server.v1_8_R3.PlayerConnectionUtils$1.run(SourceFile:13) [server.jar:git-PaperSpigot-"4c7641d"]
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:1.8.0_242]
    at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_242]
    at net.minecraft.server.v1_8_R3.SystemUtils.a(SourceFile:44) [server.jar:git-PaperSpigot-"4c7641d"]
    at net.minecraft.server.v1_8_R3.MinecraftServer.B(MinecraftServer.java:774) [server.jar:git-PaperSpigot-"4c7641d"]
    at net.minecraft.server.v1_8_R3.DedicatedServer.B(DedicatedServer.java:378) [server.jar:git-PaperSpigot-"4c7641d"]
    at net.minecraft.server.v1_8_R3.MinecraftServer.A(MinecraftServer.java:713) [server.jar:git-PaperSpigot-"4c7641d"]
    at net.minecraft.server.v1_8_R3.MinecraftServer.run(MinecraftServer.java:616) [server.jar:git-PaperSpigot-"4c7641d"]
    at java.lang.Thread.run(Thread.java:748) [?:1.8.0_242]
    Caused by: java.lang.NullPointerException
    > [16:14:04 ERROR]: Could not pass event PlayerTeleportEvent to QuickBoard v4.3.0
    org.bukkit.event.EventException
    at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:302) ~[server.jar:git-PaperSpigot-"4c7641d"]
    at co.aikar.timings.TimedEventExecutor.execute(TimedEventExecutor.java:78) ~[server.jar:git-PaperSpigot-"4c7641d"]
    at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:62) ~[server.jar:git-PaperSpigot-"4c7641d"]
    at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:517) [server.jar:git-PaperSpigot-"4c7641d"]
    at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:502) [server.jar:git-PaperSpigot-"4c7641d"]
    at org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer.teleport(CraftPlayer.java:541) [server.jar:git-PaperSpigot-"4c7641d"]
    at org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity.teleport(CraftEntity.java:236) [server.jar:git-PaperSpigot-"4c7641d"]
    at com.justdoom.prisonscell.Prisonscell.onCommand(Prisonscell.java:66) [PrisonsCell.jar:?]
    at org.bukkit.command.PluginCommand.execute(PluginCommand.java:45) [server.jar:git-PaperSpigot-"4c7641d"]
    at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:146) [server.jar:git-PaperSpigot-"4c7641d"]
    at org.bukkit.craftbukkit.v1_8_R3.CraftServer.dispatchCommand(CraftServer.java:666) [server.jar:git-PaperSpigot-"4c7641d"]
    at net.minecraft.server.v1_8_R3.PlayerConnection.handleCommand(PlayerConnection.java:1189) [server.jar:git-PaperSpigot-"4c7641d"]
    at net.minecraft.server.v1_8_R3.PlayerConnection.a(PlayerConnection.java:1001) [server.jar:git-PaperSpigot-"4c7641d"]
    at net.minecraft.server.v1_8_R3.PacketPlayInChat.a(PacketPlayInChat.java:45) [server.jar:git-PaperSpigot-"4c7641d"]
    at net.minecraft.server.v1_8_R3.PacketPlayInChat.a(PacketPlayInChat.java:1) [server.jar:git-PaperSpigot-"4c7641d"]
    at net.minecraft.server.v1_8_R3.PlayerConnectionUtils$1.run(SourceFile:13) [server.jar:git-PaperSpigot-"4c7641d"]
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:1.8.0_242]
    at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_242]
    at net.minecraft.server.v1_8_R3.SystemUtils.a(SourceFile:44) [server.jar:git-PaperSpigot-"4c7641d"]
    at net.minecraft.server.v1_8_R3.MinecraftServer.B(MinecraftServer.java:774) [server.jar:git-PaperSpigot-"4c7641d"]
    at net.minecraft.server.v1_8_R3.DedicatedServer.B(DedicatedServer.java:378) [server.jar:git-PaperSpigot-"4c7641d"]
    at net.minecraft.server.v1_8_R3.MinecraftServer.A(MinecraftServer.java:713) [server.jar:git-PaperSpigot-"4c7641d"]
    at net.minecraft.server.v1_8_R3.MinecraftServer.run(MinecraftServer.java:616) [server.jar:git-PaperSpigot-"4c7641d"]
    at java.lang.Thread.run(Thread.java:748) [?:1.8.0_242]
    Caused by: java.lang.NullPointerException
    at me.tade.quickboard.QuickBoard.onTeleport(QuickBoard.java:195) ~[?:?]
    at sun.reflect.GeneratedMethodAccessor27.invoke(Unknown Source) ~[?:?]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_242]
    at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_242]
    at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:300) ~[server.jar:git-PaperSpigot-"4c7641d"]
    ... 23 more
    > [16:14:04 ERROR]: Could not pass event PlayerTeleportEvent to Multiverse-Core v2.5-b699
    org.bukkit.event.EventException
    at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:302) ~[server.jar:git-PaperSpigot-"4c7641d"]
    at co.aikar.timings.TimedEventExecutor.execute(TimedEventExecutor.java:78) ~[server.jar:git-PaperSpigot-"4c7641d"]
    at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:62) ~[server.jar:git-PaperSpigot-"4c7641d"]
    at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:517) [server.jar:git-PaperSpigot-"4c7641d"]
    at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:502) [server.jar:git-PaperSpigot-"4c7641d"]
    at org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer.teleport(CraftPlayer.java:541) [server.jar:git-PaperSpigot-"4c7641d"]
    at org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity.teleport(CraftEntity.java:236) [server.jar:git-PaperSpigot-"4c7641d"]
    at com.justdoom.prisonscell.Prisonscell.onCommand(Prisonscell.java:66) [PrisonsCell.jar:?]
    at org.bukkit.command.PluginCommand.execute(PluginCommand.java:45) [server.jar:git-PaperSpigot-"4c7641d"]
    at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:146) [server.jar:git-PaperSpigot-"4c7641d"]
    at org.bukkit.craftbukkit.v1_8_R3.CraftServer.dispatchCommand(CraftServer.java:666) [server.jar:git-PaperSpigot-"4c7641d"]
    at net.minecraft.server.v1_8_R3.PlayerConnection.handleCommand(PlayerConnection.java:1189) [server.jar:git-PaperSpigot-"4c7641d"]
    at net.minecraft.server.v1_8_R3.PlayerConnection.a(PlayerConnection.java:1001) [server.jar:git-PaperSpigot-"4c7641d"]
    at net.minecraft.server.v1_8_R3.PacketPlayInChat.a(PacketPlayInChat.java:45) [server.jar:git-PaperSpigot-"4c7641d"]
    at net.minecraft.server.v1_8_R3.PacketPlayInChat.a(PacketPlayInChat.java:1) [server.jar:git-PaperSpigot-"4c7641d"]
    at net.minecraft.server.v1_8_R3.PlayerConnectionUtils$1.run(SourceFile:13) [server.jar:git-PaperSpigot-"4c7641d"]
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:1.8.0_242]
    at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_242]
    at net.minecraft.server.v1_8_R3.SystemUtils.a(SourceFile:44) [server.jar:git-PaperSpigot-"4c7641d"]
    at net.minecraft.server.v1_8_R3.MinecraftServer.B(MinecraftServer.java:774) [server.jar:git-PaperSpigot-"4c7641d"]
    at net.minecraft.server.v1_8_R3.DedicatedServer.B(DedicatedServer.java:378) [server.jar:git-PaperSpigot-"4c7641d"]
    at net.minecraft.server.v1_8_R3.MinecraftServer.A(MinecraftServer.java:713) [server.jar:git-PaperSpigot-"4c7641d"]
    at net.minecraft.server.v1_8_R3.MinecraftServer.run(MinecraftServer.java:616) [server.jar:git-PaperSpigot-"4c7641d"]
    at java.lang.Thread.run(Thread.java:748) [?:1.8.0_242]
    Caused by: java.lang.NullPointerException
    at com.onarandombox.MultiverseCore.listeners.MVPlayerListener.playerTeleport(MVPlayerListener.java:178) ~[?:?]
    at sun.reflect.GeneratedMethodAccessor29.invoke(Unknown Source) ~[?:?]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_242]
    at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_242]
    at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:300) ~[server.jar:git-PaperSpigot-"4c7641d"]
    ... 23 more
    > [16:14:04 ERROR]: null
    org.bukkit.command.CommandException: Unhandled exception executing command 'cell' in plugin PrisonsCell v1.0.0
    at org.bukkit.command.PluginCommand.execute(PluginCommand.java:47) ~[server.jar:git-PaperSpigot-"4c7641d"]
    at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:146) ~[server.jar:git-PaperSpigot-"4c7641d"]
    at org.bukkit.craftbukkit.v1_8_R3.CraftServer.dispatchCommand(CraftServer.java:666) ~[server.jar:git-PaperSpigot-"4c7641d"]
    at net.minecraft.server.v1_8_R3.PlayerConnection.handleCommand(PlayerConnection.java:1189) [server.jar:git-PaperSpigot-"4c7641d"]
    at net.minecraft.server.v1_8_R3.PlayerConnection.a(PlayerConnection.java:1001) [server.jar:git-PaperSpigot-"4c7641d"]
    at net.minecraft.server.v1_8_R3.PacketPlayInChat.a(PacketPlayInChat.java:45) [server.jar:git-PaperSpigot-"4c7641d"]
    at net.minecraft.server.v1_8_R3.PacketPlayInChat.a(PacketPlayInChat.java:1) [server.jar:git-PaperSpigot-"4c7641d"]
    at net.minecraft.server.v1_8_R3.PlayerConnectionUtils$1.run(SourceFile:13) [server.jar:git-PaperSpigot-"4c7641d"]
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:1.8.0_242]
    at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_242]
    at net.minecraft.server.v1_8_R3.SystemUtils.a(SourceFile:44) [server.jar:git-PaperSpigot-"4c7641d"]
    at net.minecraft.server.v1_8_R3.MinecraftServer.B(MinecraftServer.java:774) [server.jar:git-PaperSpigot-"4c7641d"]
    at net.minecraft.server.v1_8_R3.DedicatedServer.B(DedicatedServer.java:378) [server.jar:git-PaperSpigot-"4c7641d"]
    at net.minecraft.server.v1_8_R3.MinecraftServer.A(MinecraftServer.java:713) [server.jar:git-PaperSpigot-"4c7641d"]
    at net.minecraft.server.v1_8_R3.MinecraftServer.run(MinecraftServer.java:616) [server.jar:git-PaperSpigot-"4c7641d"]
    at java.lang.Thread.run(Thread.java:748) [?:1.8.0_242]
    Caused by: java.lang.NullPointerException
    at org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer.teleport(CraftPlayer.java:557) ~[server.jar:git-PaperSpigot-"4c7641d"]
    at org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity.teleport(CraftEntity.java:236) ~[server.jar:git-PaperSpigot-"4c7641d"]
    at com.justdoom.prisonscell.Prisonscell.onCommand(Prisonscell.java:66) ~[?:?]
    at org.bukkit.command.PluginCommand.execute(PluginCommand.java:45) ~[server.jar:git-PaperSpigot-"4c7641d"]
    ... 15 more
    and if i do /cell add or remove (player) it says
    Code (Text):
    > [16:15:23 INFO]: EatedMySandwich issued server command: /cell add EatedMySandwich
    > [16:15:23 ERROR]: null
    org.bukkit.command.CommandException: Unhandled exception executing command 'cell' in plugin PrisonsCell v1.0.0
    at org.bukkit.command.PluginCommand.execute(PluginCommand.java:47) ~[server.jar:git-PaperSpigot-"4c7641d"]
    at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:146) ~[server.jar:git-PaperSpigot-"4c7641d"]
    at org.bukkit.craftbukkit.v1_8_R3.CraftServer.dispatchCommand(CraftServer.java:666) ~[server.jar:git-PaperSpigot-"4c7641d"]
    at net.minecraft.server.v1_8_R3.PlayerConnection.handleCommand(PlayerConnection.java:1189) [server.jar:git-PaperSpigot-"4c7641d"]
    at net.minecraft.server.v1_8_R3.PlayerConnection.a(PlayerConnection.java:1001) [server.jar:git-PaperSpigot-"4c7641d"]
    at net.minecraft.server.v1_8_R3.PacketPlayInChat.a(PacketPlayInChat.java:45) [server.jar:git-PaperSpigot-"4c7641d"]
    at net.minecraft.server.v1_8_R3.PacketPlayInChat.a(PacketPlayInChat.java:1) [server.jar:git-PaperSpigot-"4c7641d"]
    at net.minecraft.server.v1_8_R3.PlayerConnectionUtils$1.run(SourceFile:13) [server.jar:git-PaperSpigot-"4c7641d"]
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:1.8.0_242]
    at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_242]
    at net.minecraft.server.v1_8_R3.SystemUtils.a(SourceFile:44) [server.jar:git-PaperSpigot-"4c7641d"]
    at net.minecraft.server.v1_8_R3.MinecraftServer.B(MinecraftServer.java:774) [server.jar:git-PaperSpigot-"4c7641d"]
    at net.minecraft.server.v1_8_R3.DedicatedServer.B(DedicatedServer.java:378) [server.jar:git-PaperSpigot-"4c7641d"]
    at net.minecraft.server.v1_8_R3.MinecraftServer.A(MinecraftServer.java:713) [server.jar:git-PaperSpigot-"4c7641d"]
    at net.minecraft.server.v1_8_R3.MinecraftServer.run(MinecraftServer.java:616) [server.jar:git-PaperSpigot-"4c7641d"]
    at java.lang.Thread.run(Thread.java:748) [?:1.8.0_242]
    Caused by: java.lang.NullPointerException
     
     
  3. at com.justdoom.prisonscell.Prisonscell.onCommand(Prisonscell.java:66) [PrisonsCell.jar:?]

    What's line 66 of Prisoncell?
     
  4. player.teleport(lock);
     
  5. Here is the full class

    Code (Text):
    package com.justdoom.prisonscell;

    import com.onarandombox.MultiverseCore.MultiverseCore;
    import com.sk89q.worldedit.*;
    import com.sk89q.worldedit.bukkit.BukkitWorld;
    import com.sk89q.worldedit.bukkit.WorldEditPlugin;
    import com.sk89q.worldedit.world.DataException;
    import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
    import com.sk89q.worldguard.domains.DefaultDomain;
    import com.sk89q.worldguard.protection.flags.DefaultFlag;
    import com.sk89q.worldguard.protection.flags.StateFlag;
    import com.sk89q.worldguard.protection.regions.ProtectedCuboidRegion;
    import com.sk89q.worldguard.protection.regions.ProtectedRegion;
    import org.bukkit.*;
    import org.bukkit.Location;
    import org.bukkit.attribute.Attribute;
    import org.bukkit.command.Command;
    import org.bukkit.command.CommandSender;
    import org.bukkit.command.TabCompleter;
    import org.bukkit.entity.EntityType;
    import org.bukkit.entity.Player;
    import org.bukkit.event.EventHandler;
    import org.bukkit.event.player.PlayerJoinEvent;
    import org.bukkit.plugin.Plugin;
    import org.bukkit.plugin.java.JavaPlugin;

    import java.io.File;
    import java.io.IOException;
    import java.util.List;
    import java.util.UUID;

    public final class Prisonscell extends JavaPlugin implements TabCompleter {
        public MultiverseCore mv;
        public WorldEdit we;
        private static WorldCreator cell;

        @Override
        public void onEnable() {
            // Plugin startup logic

        }

        @Override
        public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
            Player player = (Player) sender;
            String uuid = player.getUniqueId().toString();
            if(command.getName().equals("visit")) {
                if (args.length == 0) {
                    player.sendMessage("Please enter a username");
                } else {
                    String visituuid = Bukkit.getOfflinePlayer(args[0]).getUniqueId().toString();
                    if (getConfig().getStringList("Players").contains(visituuid)) {
                        player.sendMessage("Teleporting you to " + args[0] + "'s cell!");
                        Location lock = new Location(Bukkit.getWorld(visituuid), 0.5, 95, 0.5);
                        player.teleport(lock);
                    } else {
                        player.sendMessage(args[0] + " does not have a cell");
                    }
                }
            } else {
                if (command.getName().equals("cell")) {
                    if (args.length == 0) {
                        if (getConfig().contains("Players." + uuid)) {
                            player.sendMessage("Teleporting you to your cell!");
                            Location lock = new Location(Bukkit.getWorld(uuid), 0.5, 95, 0.5);
                            player.teleport(lock);
                        }
                    } else if (args[0].equalsIgnoreCase("create") && !getConfig().contains("Players." + uuid)) {
                        player.sendMessage("Creating your cell now!");
                        cell = new WorldCreator(player.getUniqueId().toString() + "");
                        cell.generator(new ChunkGeneratorWorld());
                        cell.createWorld();
                        mv = (MultiverseCore) Bukkit.getPluginManager().getPlugin("MultiverseCore");
                        int x2 = 20;
                        int y2 = 101;
                        int z2 = -21;
                        Location loc2 = new Location(Bukkit.getWorld(player.getUniqueId().toString() + ""), 0, 95, 0);
                        try {
                            JavaPlugin.getPlugin(MultiverseCore.class).getMVWorldManager().getMVWorld(player.getUniqueId().toString() + "").setSpawnLocation(loc2);
                        } catch (Exception e) {
                            e.printStackTrace();
                        }
                        Location lock = new Location(null, 0.5, 95, 0.5);
                        lock.setWorld(Bukkit.getWorld(player.getUniqueId().toString() + ""));
                        BlockVector bvMin = BlockVector.toBlockPoint(200000, 255, 200000);
                        BlockVector bvMax = BlockVector.toBlockPoint(-200000, 0, -200000);

                        // define a region
                        ProtectedCuboidRegion reg = new ProtectedCuboidRegion("CELL" + player.getUniqueId(), bvMin, bvMax);
                        ProtectedCuboidRegion region = new ProtectedCuboidRegion("CELL" + player.getUniqueId(), bvMin, bvMax);
                        DefaultDomain owners = new DefaultDomain();
                        owners.addPlayer(getWorldGuard().wrapPlayer(player));
                        region.setOwners(owners);
                        region.setFlag(DefaultFlag.PVP, StateFlag.State.DENY);
                        getWorldGuard().getRegionManager(Bukkit.getWorld(player.getUniqueId().toString() + "")).addRegion(region);
                        player.teleport(lock);
                        int x = 0;
                        int y = 95;
                        int z = 0;
                        BlockVector asv = new BlockVector(x, y, z);
                        try {
                            loadArea(Bukkit.getWorld(player.getUniqueId().toString() + ""), "plugins/WorldEdit/schematics/prisoncell.schematic", asv);
                        } catch (DataException e) {
                            e.printStackTrace();
                        } catch (IOException e) {
                            e.printStackTrace();
                        } catch (MaxChangedBlocksException e) {
                            e.printStackTrace();
                        }
                        getConfig().createSection("Players." + uuid + ".size");
                        getConfig().createSection("Players." + uuid + ".perms");
                        getConfig().set("Players." + uuid + ".size", "1");
                        saveConfig();
                        return true;
                    } else if (args[0].equalsIgnoreCase("create") && getConfig().contains("Players." + uuid)) {
                        player.sendMessage("You already have a cell, sending you there now!");
                        Location lock = new Location(Bukkit.getWorld(uuid), 0.5, 95, 0.5);
                        player.teleport(lock);
                    } else if (args[0].equalsIgnoreCase("add")) {
                        Player target = Bukkit.getPlayer(args[1]);
                        if (target != null) {
                            String otheruuid = target.getUniqueId().toString();
                            List<String> permsList = getConfig().getStringList("Players." + uuid + ".perms");
                            ProtectedRegion region = getWorldGuard().getRegionManager(Bukkit.getWorld(player.getUniqueId().toString() + "")).getRegion("CELL" + player.getUniqueId());
                            DefaultDomain owners = new DefaultDomain();
                            if (!getConfig().getStringList("Players." + uuid + ".perms").contains(otheruuid)) {
                                owners.addPlayer(getWorldGuard().wrapPlayer(Bukkit.getPlayer(args[1])));
                                region.setOwners(owners);
                                permsList.add(otheruuid);
                                getConfig().set("Players." + uuid + ".perms", permsList);
                                saveConfig();
                                player.sendMessage("You have allowed " + args[1] + " to edit your cell!");
                            } else if (getConfig().getStringList("Players." + uuid + ".perms").contains(otheruuid)) {
                                player.sendMessage(args[1] + " already has permissions to edit your cell!");
                            }
                        } else {
                            player.sendMessage("Player " + args[1] + " is not online");
                        }
                    } else if (args[0].equalsIgnoreCase("remove")) {
                        Player target = Bukkit.getPlayer(args[1]);
                        if (target != null) {
                            String otheruuid = target.getUniqueId().toString();
                            List<String> permsList = getConfig().getStringList("Players." + uuid + ".perms");
                            ProtectedRegion region = getWorldGuard().getRegionManager(Bukkit.getWorld(player.getUniqueId().toString() + "")).getRegion("CELL" + player.getUniqueId());
                            DefaultDomain owners = new DefaultDomain();
                            if (getConfig().getStringList("Players." + uuid + ".perms").contains(otheruuid)) {
                                owners.removePlayer(getWorldGuard().wrapPlayer(Bukkit.getPlayer(args[1])));
                                region.setOwners(owners);
                                permsList.remove(otheruuid);
                                getConfig().set("Players." + uuid + ".perms", permsList);
                                saveConfig();
                                player.sendMessage("You have removed " + args[1] + "'s permissions to edit your cell!");
                            } else if (!getConfig().getStringList("Players." + uuid + ".perms").contains(otheruuid)) {
                                player.sendMessage(args[1] + " never had permissions to edit your cell!");
                            }
                        } else {
                            player.sendMessage("Player " + args[1] + " is not online");
                        }
                    } else {
                        player.sendMessage("Invalid command!");
                    }
                }
            }
            return false;
        }

        public static void loadArea(World world, String str, BlockVector origin) throws DataException, IOException, MaxChangedBlocksException {
            File file = new File(str);
            EditSession es = new EditSession(new BukkitWorld(world), 999999999);
            CuboidClipboard cc = CuboidClipboard.loadSchematic(file);
            cc.paste(es, origin, false);
        }

        @Override
        public void onDisable() {
            // Plugin shutdown logic
        }

        public static BlockVector convertToSk89qBV(Location location)
        {
            return (new BlockVector(location.getX(), location.getY(), location.getZ()));
        }
        Plugin plugin = Bukkit.getServer().getPluginManager().getPlugin("WorldGuard");

        private WorldGuardPlugin getWorldGuard() {
            Plugin plugin = Bukkit.getServer().getPluginManager().getPlugin("WorldGuard");

            // WorldGuard may not be loaded
            return (WorldGuardPlugin) plugin;
        }

        private WorldEditPlugin getWorldEdit() {
            Plugin plugin = Bukkit.getServer().getPluginManager().getPlugin("WorldEdit");

            // WorldGuard may not be loaded
            return (WorldEditPlugin) plugin;
        }
     
     
  6. whenever its a teleport command it says the error is on a line with player.teleport(lock);
     
  7. Location 'lock' is null, which seems right because you're passing a players uuid into the method Bukkit#getWorld which expects either the worlds uuid or the name of the world
     
  8. the name of the world is the owners uuid
     
  9. Oh, well in that case the world doesn't exist or isn't loaded.
     
  10. before i restarted the server i was in the world and the world file is in my worlds folder and its registered in the config
    everything works before the restart
     
  11. drives_a_ford

    Moderator

    Your custom worlds do not get loaded magically. You'll need to do so yourself.

    Use Server#createWorld to load the world(s) when needed.
     
    • Informative Informative x 1
  12. got it, thanks