auto commands plz help

Discussion in 'Plugin Development' started by Crowdy199(9), May 22, 2012.

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

    Crowdy199(9)

    guys i really don t get it i tryied everything i don t no what code to use to automaticly send commands to run.bat i was trying to do System.out.print("Save-all") and define the program as run.bat but somewone told me i was doing it wrong plz help me learn the code to autp sned commands to run.bat Thanks -Crowdy199(9)
     
  2. Offline

    WaffleOnABike

    I am so confused...
     
    ZachBora likes this.
  3. Offline

    Crowdy199(9)

    i want to no how to auto send commands to run.bat (launcher) every 4 mins what code do i use
     
  4. Offline

    tyzoid

    Are you writing a bukkit plugin?
     
  5. Offline

    Crowdy199(9)

    yes making a plugin

    yah i am making a plugin

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

    tyzoid

    Code:java
    1. getServer().dispatchCommand(getServer().getConsoleSender(), "save-all");
     
  7. Offline

    Crowdy199(9)

    what

    ok thanks alot man (oh and i ahve colors on my bukkit server)

    1 more question how do i make it save every 4 mins

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 25, 2016
  8. Offline

    tyzoid

    Code:java
    1. Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(plugin, new Runnable() {
    2. public void run() {
    3. Bukkit.getServer().dispatchCommand(getServer().getConsoleSender(), "save-all");
    4. }
    5. }, 4800L);


    Where plugin is your reference to your plugin's main class.
     
  9. Offline

    Crowdy199(9)

    ok

    so this is my plugin is this right ??

    package me.Crowdy199.AutoSave;

    import org.bukkit.Bukkit;
    import org.bukkit.plugin.java.JavaPlugin;

    public class AutoSave extends JavaPlugin {

    Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(plugin, new Runnable() {
    public void run() {
    Bukkit.getServer().dispatchCommand(getServer().getConsoleSender(), "Save-All");
    }
    }, 4800L);

    }

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

    tyzoid

    Code:java
    1. public class AutoSave extends JavaPlugin {
    2. public void onEnable(){
    3. Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(this, new Runnable() {
    4. public void run() {
    5. Bukkit.getServer().dispatchCommand(getServer().getConsoleSender(), "Save-All");
    6. }
    7. }, 4800L);
    8. }
    9. public void onDisable(){
    10. }
    11. }
     
  11. Offline

    Crowdy199(9)

    is this rite for plugin.yml



    name: AutoSave
    main: me.Crowdy199.AutoSave.AutoSave
    version: 1.0
    author: Crowdy199
    description: Provides automatic world saves at defined

    commands:
    autosave:
    description: Saves the world.
    aliases: save
     
Thread Status:
Not open for further replies.

Share This Page