Hey I got my plugin but I can't get it to work :/

Discussion in 'Spigot Plugin Development' started by juthekiller, Apr 30, 2015.

  1. Hey! I'm working on a godmode Hypixel style plugin...

    I was wondering... I got my code here...

    Code (Text):
    package me.xXRedstoneTekXx.Godmode;

    import org.bukkit.command.Command;
    import org.bukkit.command.CommandSender;
    import org.bukkit.plugin.java.JavaPlugin;

    public class Main extends JavaPlugin {
        @Override
        public void onEnable() {
            getLogger().info("Godmode has been enabled!");
           
        }
       
        @Override
        public void onDisable() {
            getLogger().info("Godmode has been disabled!");
           
        }
       
        public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) {
            if (commandLabel.equalsIgnoreCase("GodQuakeEnable")) {
                sender.sendMessage("Quake GodMode has been enabled!");
            } else if (commandLabel.equalsIgnoreCase("GodQuakeDisable")) {
                sender.sendMessage("Quake GodMode has been disabled!");
               
            }
            return false;
        }
    }
       
    so yeah this is my main plugin class... I would like to the plugin edit another plugin's config...

    how can i make that ? Like onCommand (/GodQuakeEnable), it edits the Quake plugin config file...

    plz help me :)
     
  2. Does that plugin have an API you can hook into to do such thing? If it's a custom plugin then make a API to do that.
     
  3. I think without an API it is possible but very hard to code
     
  4. Not really. You just have to read the file line by line and do a little String parsing; however, it is pointless to reinvent the wheel unless the current wheel is malformed.
     
    • Agree Agree x 1
  5. My idea was, to "clone" the Config or to create it new everytime
     
  6. Why don't you just code the god mode yourself?

    Just add the player to an array list when its enabled and on the entity damage event check whether the player is in the array list and if they are, cancel the event.
     
  7. ... kden sorry but doesnt helps xD Look... I just want something simple ok ?
    I'm gonna link the plugins folder down here so you can see what I mean...

    http://i.imgur.com/xeSMhxb.png

    there is the godmode plugin there... if i make /godquakeenable it would edit something in my quake config called items.yml

    it would change this:

    Code (Text):
    4:
        type: trigger
        cost: 0
        name: Normal Trigger
        lore:
            - 1.5s reloading speed.
        material: 77
        trigger_amount: 15
        trigger_speed: 30
    17:
        type: trigger
        cost: 750
        name: Better trigger.
        lore:
            - 1.3s reloading speed.
        material: 77
        trigger_amount: 13
        trigger_speed: 26
    18:
        type: trigger
        cost: 10000000
        name: HACKER'S TRIGGER
        lore:
            - 0.1s reloading speed.
        material: 77
        trigger_amount: 1
        trigger_speed: 1
    to this

    Code (Text):
    4:
        type: trigger
        cost: 0
        name: Normal Trigger
        lore:
            - 1.5s reloading speed.
        material: 77
        trigger_amount: 15
        trigger_speed: 11
    17:
        type: trigger
        cost: 750
        name: Better trigger.
        lore:
            - 1.3s reloading speed.
        material: 77
        trigger_amount: 13
        trigger_speed: 1
    18:
        type: trigger
        cost: 10000000
        name: HACKER'S TRIGGER
        lore:
            - 0.1s reloading speed.
        material: 77
        trigger_amount: 1
        trigger_speed: 1
    and if i would make /godquakedisable it would put it back to normal
     
  8. Use Bukkit's YamlConfiguration API.
    I am going to take a wild guess and say that the next question is going to be somewhat like "How do I use it? pls help me." To save time, my answer to that is do a little bit of research and read the Javadocs. Your next question will probably be "Link?" My answer to that is find it yourself, ever heard of google?