Setting Spawn!

Discussion in 'Plugin Development' started by BrayzPlayz, Jan 11, 2015.

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

    BrayzPlayz

    I am making my own Easy Essentials plugin but I can not figure out how to set spawn! I got /spawn to work but setting spawn is not working! Anyone see anything wrong?



    SpawnSetting Class:

    upload_2015-1-11_19-46-57.png


    Main Class:

    upload_2015-1-11_19-49-30.png


    SettingsManager (Part 1) Class:

    upload_2015-1-11_19-51-41.png

    SettingsManager (Part 2) Class:

    upload_2015-1-11_19-52-10.png




    For anyone that can help it will be greatly appreciated! :)

    @bwfcwalshy and @nverdier You guys have both helped me before so I will tag you and see if you can figure it out! Thanks :) Also in the console.. It says Error in the SpawnSetting Class for Line 17, and Line 25!

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 13, 2016
  2. Offline

    BaconStripzMan

    Can't see an error, could you post the error log?

    Is it sending you da spawn set message
     
    Last edited by a moderator: Jan 11, 2015
  3. Offline

    BrayzPlayz

    Yeah it sends me the SpawnSet Message @BaconStripzMan, here is the Error Code - it says something wrong with the settings manager too Line 21 and Line 30 in Main.... But line 30 is empty?

    upload_2015-1-11_20-46-19.png


    Line 21 in SettingsManager: public SettingsManager(String fileName) {
     
  4. Offline

    nverdier

    BaconStripzMan likes this.
  5. Offline

    BrayzPlayz

    @nverdier what do I use to post the whole log? To long

    12.01 03:51:58 [Server] INFO World saved.
    12.01 03:51:58 [Server] INFO CONSOLE: Forcing save..
    12.01 03:51:58 [Server] INFO CONSOLE: Enabled level saving..
    12.01 03:51:58 [Multicraft] Auto-saving world...
    12.01 03:42:03 [Server] Startup Done (3.560s)! For help, type "help" or "?"
    12.01 03:42:03 [Server] INFO Server permissions file permissions.yml is empty, ignoring it
    12.01 03:42:03 [Server] INFO Enabling Prison v1.0.0
    12.01 03:42:03 [Server] INFO Registered Sniper Listener.
    12.01 03:42:03 [Server] INFO Registered 75 Sniper Brushes with 149 handles.
    12.01 03:42:03 [Server] INFO Enabling VoxelSniper v5.170.0-SNAPSHOT-jnks317-gitfcb8fe1
    12.01 03:42:03 [Server] INFO Enabling MobPointCount v1.0.0
    12.01 03:42:03 [Server] INFO Enabling SReload v1.2
    12.01 03:42:03 [Server] INFO Version 2.5-b691 (API v18) Enabled - By Rigby, fernferret, lithium3141 and main--
    12.01 03:42:03 [Server] INFO 5 - World(s) loaded.
    12.01 03:42:02 [Server] INFO Preparing start region for level 4 (Seed: -6766243012827043287)
    12.01 03:42:02 [Server] INFO Could not set generator for world 'plotworld': Plugin 'PlotMe-DefaultGenerator' does not exist
    12.01 03:42:02 [Server] INFO Preparing start region for level 3 (Seed: -3085650785171608)
    12.01 03:42:02 [Server] ERROR Could not set generator for default world 'plotworld': Plugin 'PlotMe-DefaultGenerator' does not exist
    12.01 03:42:02 [Server] INFO Could not set generator for world 'plotworld': Plugin 'PlotMe-DefaultGenerator' does not exist
    12.01 03:42:02 [Server] INFO [AllPay] - Version 13.0 - using only an item based economy for Multiverse-Core v2.5-b691
    12.01 03:42:02 [Server] INFO Enabling Multiverse-Core v2.5-b691
    12.01 03:42:02 [Server] INFO Using com.sk89q.worldedit.bukkit.adapter.impl.CraftBukkit_v1_7_R3 as the Bukkit adapter
    12.01 03:42:02 [Server] INFO WEPIF: Using the Bukkit Permissions API.
    12.01 03:42:01 [Server] INFO Enabling WorldEdit v6.0;3342-78f975b9
    12.01 03:42:01 [Server] INFO Enabling KillMobs v1.0.0
    12.01 03:42:01 [Server] INFO at net.minecraft.server.v1_7_R3.ThreadServerApplication.run(SourceFile:628) [craftbukkit-beta.jar:git-Bukkit-1.7.9-R0.2-11-g3fd9db2-b3098jnks]
    12.01 03:42:01 [Server] INFO at net.minecraft.server.v1_7_R3.MinecraftServer.run(MinecraftServer.java:436) [craftbukkit-beta.jar:git-Bukkit-1.7.9-R0.2-11-g3fd9db2-b3098jnks]
    12.01 03:42:01 [Server] INFO at net.minecraft.server.v1_7_R3.DedicatedServer.init(DedicatedServer.java:182) [craftbukkit-beta.jar:git-Bukkit-1.7.9-R0.2-11-g3fd9db2-b3098jnks]
    12.01 03:42:01 [Server] INFO at net.minecraft.server.v1_7_R3.MinecraftServer.a(MinecraftServer.java:282) [craftbukkit-beta.jar:git-Bukkit-1.7.9-R0.2-11-g3fd9db2-b3098jnks]
    12.01 03:42:01 [Server] INFO at net.minecraft.server.v1_7_R3.MinecraftServer.g(MinecraftServer.java:326) [craftbukkit-beta.jar:git-Bukkit-1.7.9-R0.2-11-g3fd9db2-b3098jnks]
    12.01 03:42:01 [Server] INFO at net.minecraft.server.v1_7_R3.MinecraftServer.n(MinecraftServer.java:352) [craftbukkit-beta.jar:git-Bukkit-1.7.9-R0.2-11-g3fd9db2-b3098jnks]
    12.01 03:42:01 [Server] INFO at org.bukkit.craftbukkit.v1_7_R3.CraftServer.enablePlugins(CraftServer.java:389) [craftbukkit-beta.jar:git-Bukkit-1.7.9-R0.2-11-g3fd9db2-b3098jnks]
    12.01 03:42:01 [Server] INFO at org.bukkit.craftbukkit.v1_7_R3.CraftServer.loadPlugin(CraftServer.java:455) [craftbukkit-beta.jar:git-Bukkit-1.7.9-R0.2-11-g3fd9db2-b3098jnks]
    12.01 03:42:01 [Server] INFO at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:404) [craftbukkit-beta.jar:git-Bukkit-1.7.9-R0.2-11-g3fd9db2-b3098jnks]
    12.01 03:42:01 [Server] INFO at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:324) [craftbukkit-beta.jar:git-Bukkit-1.7.9-R0.2-11-g3fd9db2-b3098jnks]
    12.01 03:42:01 [Server] INFO at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:316) ~[craftbukkit-beta.jar:git-Bukkit-1.7.9-R0.2-11-g3fd9db2-b3098jnks]
    12.01 03:42:01 [Server] INFO at Commands.Main.onEnable(Main.java:30) ~[?:?]
    12.01 03:42:01 [Server] INFO at Commands.SettingsManager.<init>(SettingsManager.java:21) ~[?:?]
    12.01 03:42:01 [Server] INFO java.lang.NullPointerException
    12.01 03:42:01 [Server] ERROR Error occurred while enabling BasicCommands v1.0.0 (Is it up to date?)
    12.01 03:42:01 [Server] INFO Enabling BasicCommands v1.0.0
    12.01 03:42:01 [Server] INFO Unused enchantments: LURE(62) LUCK(61)
    12.01 03:42:01 [Server] INFO Enabling TimTheEnchanter v3.0
    12.01 03:42:01 [Server] INFO Preparing start region for level 2 (Seed: -5428393076992154619)
    12.01 03:42:01 [Server] INFO Preparing start region for level 1 (Seed: -5428393076992154619)
    12.01 03:42:01 [Server] INFO Preparing spawn area: 90%
    12.01 03:42:00 [Server] INFO Preparing start region for level 0 (Seed: -5428393076992154619)
    12.01 03:42:00 [Server] WARN Could not get latest artifact information: IOException
    12.01 03:42:00 [Server] INFO Preparing level "world"
    12.01 03:42:00 [Server] INFO Loading Prison v1.0.0
    12.01 03:42:00 [Server] INFO Loading VoxelSniper v5.170.0-SNAPSHOT-jnks317-gitfcb8fe1
    12.01 03:42:00 [Server] INFO Loading MobPointCount v1.0.0
    12.01 03:42:00 [Server] INFO Loading SReload v1.2
    12.01 03:41:59 [Server] INFO Loading Multiverse-Core v2.5-b691
    12.01 03:41:59 [Server] INFO Loading WorldEdit v6.0;3342-78f975b9
    12.01 03:41:59 [Server] INFO Loading KillMobs v1.0.0
    12.01 03:41:59 [Server] INFO Loading BasicCommands v1.0.0
    12.01 03:41:59 [Server] INFO Loading TimTheEnchanter v3.0
    12.01 03:41:59 [Server] WARN Could not get information about this CraftBukkit version; perhaps you are running a custom one?: IOException
    12.01 03:41:59 [Server] INFO This server is running CraftBukkit version git-Bukkit-1.7.9-R0.2-11-g3fd9db2-b3098jnks (MC: 1.7.9) (Implementing API version 1.7.9-R0.3-SNAPSHOT)
    12.01 03:41:59 [Server] INFO Starting Minecraft server on 162.248.247.114:41064
    12.01 03:41:59 [Server] INFO Generating keypair
    12.01 03:41:59 [Server] INFO Default game type: SURVIVAL
    12.01 03:41:59 [Server] INFO Loading properties
    12.01 03:41:59 [Server] INFO Starting minecraft server version 1.7.9
    12.01 03:41:52 [Server] INFO Loading libraries, please wait...
    12.01 03:41:52 [Multicraft] Loaded config for "Mod: Craftbukkit Beta"
    12.01 03:41:52 [Multicraft] Starting server!
    12.01 03:41:52 [Multicraft] Loading server properties
    12.01 03:41:51 [Multicraft] Server stopped
    12.01 03:41:51 [Multicraft] Server shut down
    12.01 03:41:51 [Server] INFO Saving worlds
    12.01 03:41:51 [Server] INFO Saving players
    12.01 03:41:51 [Server] INFO Stopping server
    12.01 03:41:51 [Server] INFO Saving chunks for level 'Prison'/Overworld
    12.01 03:41:51 [Server] INFO Saving chunks for level 'plotworld'/Overworld
    12.01 03:41:51 [Server] INFO Saving chunks for level 'world_the_end'/The End
    12.01 03:41:51 [Server] INFO Saving chunks for level 'world_nether'/Nether
    12.01 03:41:51 [Server] INFO Saving chunks for level 'world'/Overworld
    12.01 03:41:51 [Server] INFO Saving worlds
    12.01 03:41:51 [Server] INFO Saving players
    12.01 03:41:51 [Server] INFO I *warned* you, but did you listen to me? Oh, no, you *knew*, didn't you? Oh, it's just a harmless little *bunny*, isn't it?
    12.01 03:41:51 [Server] INFO Disabling TimTheEnchanter v3.0
    12.01 03:41:51 [Server] INFO Disabling BasicCommands v1.0.0
    12.01 03:41:51 [Server] INFO Disabling KillMobs v1.0.0
    12.01 03:41:51 [Server] INFO Disabling WorldEdit v6.0;3342-78f975b9
    12.01 03:41:51 [Server] INFO Disabling Multiverse-Core v2.5-b691
    12.01 03:41:51 [Server] INFO Disabling SReload v1.2
    12.01 03:41:51 [Server] INFO Disabling MobPointCount v1.0.0
    12.01 03:41:51 [Server] INFO Disabling VoxelSniper v5.170.0-SNAPSHOT-jnks317-gitfcb8fe1
    12.01 03:41:51 [Server] INFO Disabling Prison v1.0.0
    12.01 03:41:51 [Server] INFO Stopping server
    12.01 03:41:51 [Server] INFO CONSOLE: Stopping the server..
    12.01 03:41:51 [Server] INFO CONSOLE: Forcing save..
    12.01 03:41:51 [Multicraft] Stopping server!
    12.01 03:41:51 [Multicraft] Received restart command
     
  6. Offline

    nverdier

  7. Offline

    BrayzPlayz

  8. Offline

    Krizeh

    Just use Bukkit.getWorld("world").setSpawnLocation(0, 0, 0);
    ?
     
  9. Offline

    BrayzPlayz

    Ok what do I replace that with then @Krizeh ???
     
  10. Offline

    Skionz

    @BrayzPlayz Check the Javadocs for the parameters. We aren't going to tell you exactly what to write.
     
  11. Offline

    ComeAlive

    Pogostick29dev has a good tutorial on a plugin that sets the spawn - maybe you should watch that video.
     
  12. Offline

    _Cookie_

    When accessing the config in different classes, you want to have an instance in the class of your Main class.

    Code:
    private final Main plugin;
    
    public *ClassName*(Main plugin){
        this.plugin = plugin;
    }
    If you wanna check out some tutorials on saving locations into config, and methods, check out my youtube channel.
    www.youtube.com/helloitscookie
     
  13. Offline

    unrealdesign

    You're using a static reference of a class to get an instanced variable.
    1. (Best) Make the "SettingsManager" class only have on instance and make it static
    2. Create a single instance of "SettingsManager" in your main class and pass it as a variable to other methods and classes

    How to do 1.
    Code:
    //Make your class impossible to construct outside of using the single instance
    private SettingsManager() { }
    
    //Create a single static instance of your variable
    private static final SettingsManager instance = new SettingsManager();
    
    //Create a single method to get the only instance of the class
    public static SettingsManager getInstance() { return instance; }
    
    //Create a setup method that you call at onEnable() in your main class
    public void setup()
    {
        //Anything that needs to be initialized in your class or set up goes here
    }
    Then in your onEnable() class, you simply setup your single instance before anything else has time to use it.
    Code:
    @Override
    public void onEnable()
    {
        SettingsManager.getInstance().setup();
    }
     
  14. @unrealdesign There's no reason for an instance method for "setup". That's what constructors are for :)
     
    Konato_K likes this.
  15. Offline

    unrealdesign

    Not if you're creating a single instance.
     
  16. @unrealdesign But then you'd have to do new SettingsManager().setup()... it makes no sense... why not do whatever's done in setup in the constructor?
     
  17. Offline

    unrealdesign

    First off that wouldn't work because the constructor is private. Second off, you can't because a constructor constructs a new instance
     
  18. @unrealdesign Well, alright then. SettingsManager.getInstance().setup() equally makes no sense. Why not put the setup() method inside the private constructor?
     
  19. Offline

    unrealdesign

    If you thought about it, then you'd realize why. What if the setup requires the instance of your main class or any other variable? Think about that, then tell me if it's dumb ;)
     
  20. @unrealdesign If it requires that, then maybe the static design of it is off ;)
     
    Konato_K likes this.
  21. Offline

    unrealdesign

    Nope, it's perfect, because it allows a whole class to be "statically" referenced as long as it's initialized at start up.
     
  22. Offline

    ColonelHedgehog

    Define "good."
     
    nverdier likes this.
Thread Status:
Not open for further replies.

Share This Page