Command on server start

Discussion in 'Plugin Help/Development/Requests' started by NSPredator, Nov 3, 2014.

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

    NSPredator

    Title says it all really.
    What I want is a very simple plugin that issues a command when the server starts.
    Many thanks!
     
  2. Offline

    EgyptianKing

    NSPredator
    I'll make you this, give me some time for me to come back from the movie theater.
     
  3. Offline

    NSPredator

    Okay thank you very much.
     
  4. Offline

    TheOatBaron

  5. Offline

    NSPredator

    Thank you very much! I will give it ago. I might have some ideas for this plugin in the future if your interested just say.

    The .jar that you provided me doesn't work. It doesn't create a folder nor can I see it in my logs.

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

    TheOatBaron

    NSPredator
    Ah, figures. I wasn't able to test it because I was in school. I'll fix it at about 8 pm est when I get off of work.
     
  7. Offline

    timtower Moderator Moderator

    TheOatBaron
    Code:
    if (!getDataFolder().exists()) {
          getDataFolder().mkdir();
        }
        File file = new File(getDataFolder(), "config.yml");
        if (!file.exists()) {
          saveDefaultConfig();
        }
    Can be replaced with just saveDefaultConfig, bukkit is doing the check stuff etc.
    getConfig().getStringList(<path>)
     
  8. Offline

    EgyptianKing

    NSPredator
    https://www.dropbox.com/s/d7ii95xkz6mcvu1/StartupCommands.jar?dl=0

    Here you go.

    A note for any programmer attempting to do this and failing. The commands need to be dispatched AFTER the server loads. You do this by dispatching all commands in a delayed task that has a delay of 0. Delayed tasks get run after the server loads, which makes dispatching the commands right after the server loads.
     
  9. Offline

    NSPredator

    EgyptianKing
    Many thanks that works! Awesome work!


    Would it be possible to add a delay feature. Something like this
    commands:
    - $wait Xs$ <commandhere>

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

    EgyptianKing

    NSPredator
    Here you go: https://www.dropbox.com/s/d7ii95xkz6mcvu1/StartupCommands.jar?dl=0
    To make it simple for myself, this is how you are supposed to put the command and the time in the config:
    Code:
    'Command:Time(seconds)'
    Example: time day:5

    *PLEASE DO NOT ADD SPACES BETWEEN THE COLON AND TIME. DO IT EXACTLY LIKE I DID.*

    This would execute the command "time day" 5 seconds after you see the "Done (#.###s) ! For help, type "help" or "?"." message.
    Need anything else? Tahg me.
     
  11. Offline

    NSPredator

    Thanks! The delay works perfectly but I have encounter a problem when trying to run a command after "Done (#.###s) ! For help, type "help" or "?".". I am using MyCommand to run a custom command on startup (using your plugin to execute the command upon start up) but it keeps displaying the Unknown command message. I have tried putting a 30 second delay to try and resolve this (I did this to ensure that the plugin has time to fully load) but it doesn't resolve the issue. I have checked to make sure that this isn't a problem with MyCommand and I have found no problem with it. Is there any solution to this?
    Many thanks!
     
  12. Offline

    EgyptianKing

    NSPredator
    What command did you try to execute? Also the timers start when the done message appears, so no worries about making it higher to ensure it to fully load.
     
  13. Offline

    NSPredator

    This is my MyCommand command:
    Code:
    'startup':
      command: serverstart
      type: RUN_CONSOLE
      runcmd:
      - /broadcast hello
     
  14. Offline

    timtower Moderator Moderator

  15. Offline

    NSPredator

    That doesn't seem to work either.
     
  16. Offline

    EgyptianKing

    NSPredator
    What are you trying to do with MyCommand? I don't really understand.
     
  17. Offline

    NSPredator

    I am trying to use it to run commands such as: /npc select 1 then /npc remove. All the commands that I want to be ran can be ran through the console so I don't understand why my server displays them as unknown commands when using your plugin to execute a command with MyCommand. The command that I am using works fine when you manually execute it in the console.
     
  18. Offline

    EgyptianKing

    NSPredator
    To be honest I don't really know. Sorry
     
  19. Offline

    timtower Moderator Moderator

  20. Offline

    NSPredator


    Code:
    [22:38:58] [Server thread/INFO]: Starting minecraft server version 1.7.10
    [22:38:58] [Server thread/INFO]: Loading properties
    [22:38:58] [Server thread/INFO]: Default game type: SURVIVAL
    [22:38:58] [Server thread/INFO]: This server is running CraftBukkit version git-Spigot-1604 (MC: 1.7.10) (Implementing API version 1.7.10-R0.1-SNAPSHOT)
    [22:38:58] [Server thread/INFO]: Server Ping Player Sample Count: 12
    [22:38:58] [Server thread/INFO]: Using 4 threads for Netty based IO
    [22:38:58] [Server thread/INFO]: Generating keypair
    [22:38:58] [Server thread/INFO]: Starting Minecraft server on *:25565
    [22:38:58] [Server thread/INFO]: Set PluginClassLoader as parallel capable
    [22:38:58] [Server thread/INFO]: [MyCommand] Loading MyCommand v5.1.3
    [22:38:58] [Server thread/INFO]: [StartupCommands] Loading StartupCommands v1.0
    [22:38:58] [Server thread/WARN]: **** SERVER IS RUNNING IN OFFLINE/INSECURE MODE!
    [22:38:58] [Server thread/WARN]: The server will make no attempt to authenticate usernames. Beware.
    [22:38:58] [Server thread/WARN]: While this makes the game possible to play without internet access, it also opens up the ability for hackers to connect with any username they choose.
    [22:38:58] [Server thread/WARN]: To change this, set "online-mode" to "true" in the server.properties file.
    [22:38:58] [Server thread/INFO]: **** Beginning UUID conversion, this may take A LONG time ****
    [22:38:58] [Server thread/INFO]: Preparing level "world"
    [22:38:58] [Server thread/INFO]: -------- World Settings For [world] --------
    [22:38:58] [Server thread/INFO]: View Distance: 10
    [22:38:58] [Server thread/INFO]: Chunks to Grow per Tick: 650
    [22:38:58] [Server thread/INFO]: Clear tick list: false
    [22:38:58] [Server thread/INFO]: Experience Merge Radius: 3.0
    [22:38:58] [Server thread/INFO]: Item Despawn Rate: 6000
    [22:38:58] [Server thread/INFO]: Item Merge Radius: 2.5
    [22:38:58] [Server thread/INFO]: Allow Zombie Pigmen to spawn from portal blocks: true
    [22:38:58] [Server thread/INFO]: Arrow Despawn Rate: 1200
    [22:38:58] [Server thread/INFO]: Nerfing mobs spawned from spawners: false
    [22:38:58] [Server thread/INFO]: Cactus Growth Modifier: 100%
    [22:38:58] [Server thread/INFO]: Cane Growth Modifier: 100%
    [22:38:58] [Server thread/INFO]: Melon Growth Modifier: 100%
    [22:38:58] [Server thread/INFO]: Mushroom Growth Modifier: 100%
    [22:38:58] [Server thread/INFO]: Pumpkin Growth Modifier: 100%
    [22:38:58] [Server thread/INFO]: Sapling Growth Modifier: 100%
    [22:38:58] [Server thread/INFO]: Wheat Growth Modifier: 100%
    [22:38:58] [Server thread/INFO]: Entity Activation Range: An 32 / Mo 32 / Mi 16
    [22:38:58] [Server thread/INFO]: Sending up to 5 chunks per packet
    [22:38:58] [Server thread/INFO]: Max Entity Collisions: 8
    [22:38:58] [Server thread/INFO]: Custom Map Seeds:  Village: 10387312 Feature: 14357617
    [22:38:58] [Server thread/INFO]: Anti X-Ray: true
    [22:38:58] [Server thread/INFO]:    Engine Mode: 1
    [22:38:58] [Server thread/INFO]:    Hidden Blocks: [14, 15, 16, 21, 48, 49, 54, 56, 73, 74, 82, 129, 130]
    [22:38:58] [Server thread/INFO]:    Replace Blocks: [1, 5]
    [22:38:58] [Server thread/INFO]: Entity Tracking Range: Pl 48 / An 48 / Mo 48 / Mi 32 / Other 64
    [22:38:58] [Server thread/INFO]: Mob Spawn Range: 4
    [22:38:58] [Server thread/INFO]: Alternative Hopper Ticking: false
    [22:38:58] [Server thread/INFO]: Hopper Transfer: 8 Hopper Check: 8 Hopper Amount: 1
    [22:38:58] [Server thread/INFO]: Random Lighting Updates: false
    [22:38:58] [Server thread/INFO]: Structure Info Saving: true
    [22:38:58] [Server thread/INFO]: Zombie Aggressive Towards Villager: true
    [22:38:59] [Server thread/INFO]: -------- World Settings For [world_nether] --------
    [22:38:59] [Server thread/INFO]: View Distance: 10
    [22:38:59] [Server thread/INFO]: Chunks to Grow per Tick: 650
    [22:38:59] [Server thread/INFO]: Clear tick list: false
    [22:38:59] [Server thread/INFO]: Experience Merge Radius: 3.0
    [22:38:59] [Server thread/INFO]: Item Despawn Rate: 6000
    [22:38:59] [Server thread/INFO]: Item Merge Radius: 2.5
    [22:38:59] [Server thread/INFO]: Allow Zombie Pigmen to spawn from portal blocks: true
    [22:38:59] [Server thread/INFO]: Arrow Despawn Rate: 1200
    [22:38:59] [Server thread/INFO]: Nerfing mobs spawned from spawners: false
    [22:38:59] [Server thread/INFO]: Cactus Growth Modifier: 100%
    [22:38:59] [Server thread/INFO]: Cane Growth Modifier: 100%
    [22:38:59] [Server thread/INFO]: Melon Growth Modifier: 100%
    [22:38:59] [Server thread/INFO]: Mushroom Growth Modifier: 100%
    [22:38:59] [Server thread/INFO]: Pumpkin Growth Modifier: 100%
    [22:38:59] [Server thread/INFO]: Sapling Growth Modifier: 100%
    [22:38:59] [Server thread/INFO]: Wheat Growth Modifier: 100%
    [22:38:59] [Server thread/INFO]: Entity Activation Range: An 32 / Mo 32 / Mi 16
    [22:38:59] [Server thread/INFO]: Sending up to 5 chunks per packet
    [22:38:59] [Server thread/INFO]: Max Entity Collisions: 8
    [22:38:59] [Server thread/INFO]: Custom Map Seeds:  Village: 10387312 Feature: 14357617
    [22:38:59] [Server thread/INFO]: Anti X-Ray: true
    [22:38:59] [Server thread/INFO]:    Engine Mode: 1
    [22:38:59] [Server thread/INFO]:    Hidden Blocks: [14, 15, 16, 21, 48, 49, 54, 56, 73, 74, 82, 129, 130]
    [22:38:59] [Server thread/INFO]:    Replace Blocks: [1, 5]
    [22:38:59] [Server thread/INFO]: Entity Tracking Range: Pl 48 / An 48 / Mo 48 / Mi 32 / Other 64
    [22:38:59] [Server thread/INFO]: Mob Spawn Range: 4
    [22:38:59] [Server thread/INFO]: Alternative Hopper Ticking: false
    [22:38:59] [Server thread/INFO]: Hopper Transfer: 8 Hopper Check: 8 Hopper Amount: 1
    [22:38:59] [Server thread/INFO]: Random Lighting Updates: false
    [22:38:59] [Server thread/INFO]: Structure Info Saving: true
    [22:38:59] [Server thread/INFO]: Zombie Aggressive Towards Villager: true
    [22:38:59] [Server thread/INFO]: -------- World Settings For [world_the_end] --------
    [22:38:59] [Server thread/INFO]: View Distance: 10
    [22:38:59] [Server thread/INFO]: Chunks to Grow per Tick: 650
    [22:38:59] [Server thread/INFO]: Clear tick list: false
    [22:38:59] [Server thread/INFO]: Experience Merge Radius: 3.0
    [22:38:59] [Server thread/INFO]: Item Despawn Rate: 6000
    [22:38:59] [Server thread/INFO]: Item Merge Radius: 2.5
    [22:38:59] [Server thread/INFO]: Allow Zombie Pigmen to spawn from portal blocks: true
    [22:38:59] [Server thread/INFO]: Arrow Despawn Rate: 1200
    [22:38:59] [Server thread/INFO]: Nerfing mobs spawned from spawners: false
    [22:38:59] [Server thread/INFO]: Cactus Growth Modifier: 100%
    [22:38:59] [Server thread/INFO]: Cane Growth Modifier: 100%
    [22:38:59] [Server thread/INFO]: Melon Growth Modifier: 100%
    [22:38:59] [Server thread/INFO]: Mushroom Growth Modifier: 100%
    [22:38:59] [Server thread/INFO]: Pumpkin Growth Modifier: 100%
    [22:38:59] [Server thread/INFO]: Sapling Growth Modifier: 100%
    [22:38:59] [Server thread/INFO]: Wheat Growth Modifier: 100%
    [22:38:59] [Server thread/INFO]: Entity Activation Range: An 32 / Mo 32 / Mi 16
    [22:38:59] [Server thread/INFO]: Sending up to 5 chunks per packet
    [22:38:59] [Server thread/INFO]: Max Entity Collisions: 8
    [22:38:59] [Server thread/INFO]: Custom Map Seeds:  Village: 10387312 Feature: 14357617
    [22:38:59] [Server thread/INFO]: Anti X-Ray: true
    [22:38:59] [Server thread/INFO]:    Engine Mode: 1
    [22:38:59] [Server thread/INFO]:    Hidden Blocks: [14, 15, 16, 21, 48, 49, 54, 56, 73, 74, 82, 129, 130]
    [22:38:59] [Server thread/INFO]:    Replace Blocks: [1, 5]
    [22:38:59] [Server thread/INFO]: Entity Tracking Range: Pl 48 / An 48 / Mo 48 / Mi 32 / Other 64
    [22:38:59] [Server thread/INFO]: Mob Spawn Range: 4
    [22:38:59] [Server thread/INFO]: Alternative Hopper Ticking: false
    [22:38:59] [Server thread/INFO]: Hopper Transfer: 8 Hopper Check: 8 Hopper Amount: 1
    [22:38:59] [Server thread/INFO]: Random Lighting Updates: false
    [22:38:59] [Server thread/INFO]: Structure Info Saving: true
    [22:38:59] [Server thread/INFO]: Zombie Aggressive Towards Villager: true
    [22:38:59] [Server thread/INFO]: Preparing start region for level 0 (Seed: -179289506726423608)
    [22:38:59] [Server thread/INFO]: Preparing start region for level 1 (Seed: 4252523444037993625)
    [22:39:00] [Server thread/INFO]: Preparing start region for level 2 (Seed: 4252523444037993625)
    [22:39:00] [Server thread/INFO]: [MyCommand] Enabling MyCommand v5.1.3
    [22:39:00] [Server thread/INFO]: =-=-=-=-=-=-=-=-=-=-=-MyCommand-=-=-=-=-=-=-=-=-=-=-=-=
    [22:39:00] [Server thread/INFO]: = Vault  : Not found! Using BukkitPermissions
    [22:39:00] [Server thread/INFO]: = Vault  : Disabling Economy Support
    [22:39:00] [Server thread/INFO]: = Spout  : Not detectedBarAPI : Not detected
    [22:39:00] [Server thread/INFO]: = Config : Ok
    [22:39:00] [Server thread/INFO]: = Custom commands loaded : 1
    [22:39:00] [Server thread/INFO]: = Version: 5.1.3
    [22:39:00] [Server thread/INFO]: = Author : MRI a.k.a Ivanpro
    [22:39:00] [Server thread/INFO]: = Status : Active
    [22:39:00] [Server thread/INFO]: =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
    [22:39:00] [Server thread/INFO]: [StartupCommands] Enabling StartupCommands v1.0
    [22:39:00] [Server thread/INFO]: Server permissions file permissions.yml is empty, ignoring it
    [22:39:00] [Server thread/INFO]: Done (1.850s)! For help, type "help" or "?"
    [22:39:20] [Server thread/INFO]: Unknown command. Type "/help" for help.
    [22:39:42] [Server thread/INFO]: CONSOLE: Stopping the server..
    [22:39:42] [Server thread/INFO]: Stopping server
    [22:39:42] [Server thread/INFO]: [StartupCommands] Disabling StartupCommands v1.0
    [22:39:42] [Server thread/INFO]: [MyCommand] Disabling MyCommand v5.1.3
    [22:39:42] [Server thread/INFO]: =-=-=-=-=-=-=-=-=-=-=-MyCommand-=-=-=-=-=-=-=-=-=-=-=-=
    [22:39:42] [Server thread/INFO]: = Version : 5.1.3
    [22:39:42] [Server thread/INFO]: = Author  : MRI a.k.a Ivanpro
    [22:39:42] [Server thread/INFO]: = Status  : Deactivated
    [22:39:42] [Server thread/INFO]: =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
    [22:39:42] [Server thread/INFO]: Saving players
    [22:39:42] [Server thread/INFO]: Saving worlds
    [22:39:42] [Server thread/INFO]: Saving chunks for level 'world'/Overworld
    [22:39:42] [Server thread/INFO]: Saving chunks for level 'world_nether'/Nether
    [22:39:42] [Server thread/INFO]: Saving chunks for level 'world_the_end'/The End
    [22:39:42] [Thread-4/INFO]: Stopping server
    [22:39:42] [Thread-4/INFO]: Saving players
    [22:39:42] [Thread-4/INFO]: Saving worlds
    [22:39:42] [Thread-4/INFO]: Saving chunks for level 'world'/Overworld
    
     
Thread Status:
Not open for further replies.

Share This Page