Developing rules for my GPL licensed plugins.

Discussion in 'Plugin Development' started by V10lator, Jul 14, 2011.

Thread Status:
Not open for further replies.
  1. Hi guys.
    As I tend to releasy my plugins under the terms of the GPL(v3) I think I need a few rules for other developers that want to help developing. :)

    1. Whenever you can send in a patch: Do it!
    2. When you send in a patch use the command: "diff -Nru folder.old folder.new > output.patch" or something which creates a similar file (it must be patchable with the default unix/linux patch -p1 command). Example:
      Code:
      [v10lator@example eclipse/workspace]$ diff -Nru SignClock-0.4 SignClock-0.5 > example.patch
      And the resulting patch (still an example):
      Code:
      cat example.patch                (07-14 13:55)
        Binärdateien SignClock-0.4/bin/com/V10lator/SignClock/SignClock.class and SignClock-0.5/bin/com/V10lator/SignClock/SignClock.class sind verschieden.
        Binärdateien SignClock-0.4/bin/com/V10lator/SignClock/SignClockBlockListener.class and SignClock-0.5/bin/com/V10lator/SignClock/SignClockBlockListener.class sind verschieden.
        Binärdateien SignClock-0.4/bin/com/V10lator/SignClock/SignClockPlayerListener.class and SignClock-0.5/bin/com/V10lator/SignClock/SignClockPlayerListener.class sind verschieden.
        diff -Nru SignClock-0.4/bin/plugin.yml SignClock-0.5/bin/plugin.yml
        --- SignClock-0.4/bin/plugin.yml 2011-07-07 17:09:11.000000000 +0200
        +++ SignClock-0.5/bin/plugin.yml 2011-07-07 20:10:46.000000000 +0200
        @@ -1,3 +1,3 @@
          name: SignClock
          main: com.V10lator.SignClock.SignClock
        -version: 0.4
        +version: 0.5
        diff -Nru SignClock-0.4/src/com/V10lator/SignClock/SignClock.java SignClock-0.5/src/com/V10lator/SignClock/SignClock.java
        --- SignClock-0.4/src/com/V10lator/SignClock/SignClock.java 2011-07-07 18:24:01.000000000 +0200
        +++ SignClock-0.5/src/com/V10lator/SignClock/SignClock.java 2011-07-07 19:18:14.000000000 +0200
        @@ -23,6 +23,7 @@
            private String name;
            private File saveFile;
            private final SignClockBlockListener blockListener = new SignClockBlockListener(this);
        +  private final SignClockPlayerListener playerListener = new SignClockPlayerListener(this);
            private final HashMap<Block, SClock> signs = new HashMap<Block, SClock>();
            public void onEnable()
        @@ -32,6 +33,7 @@
              pm.registerEvent(Event.Type.SIGN_CHANGE, blockListener, Event.Priority.Normal, this);
              pm.registerEvent(Event.Type.REDSTONE_CHANGE, blockListener, Event.Priority.Normal, this);
              pm.registerEvent(Event.Type.BLOCK_BREAK, blockListener, Event.Priority.Normal, this);
        +    pm.registerEvent(Event.Type.PLAYER_INTERACT, playerListener, Event.Priority.Normal, this);
              PluginDescriptionFile pdfFile = this.getDescription();
              this.name = pdfFile.getName();
        diff -Nru SignClock-0.4/src/com/V10lator/SignClock/SignClockBlockListener.java SignClock-0.5/src/com/V10lator/SignClock/SignClockBlockListener.java
        --- SignClock-0.4/src/com/V10lator/SignClock/SignClockBlockListener.java 2011-07-07 18:52:33.000000000 +0200
        +++ SignClock-0.5/src/com/V10lator/SignClock/SignClockBlockListener.java 2011-07-07 19:14:57.000000000 +0200
        @@ -10,7 +10,6 @@
          import org.bukkit.event.block.SignChangeEvent;
          import org.bukkit.event.block.BlockRedstoneEvent;
          import org.bukkit.ChatColor;
        -//import org.bukkit.World;
          public class SignClockBlockListener extends BlockListener
          {
        diff -Nru SignClock-0.4/src/com/V10lator/SignClock/SignClockPlayerListener.java SignClock-0.5/src/com/V10lator/SignClock/SignClockPlayerListener.java
        --- SignClock-0.4/src/com/V10lator/SignClock/SignClockPlayerListener.java 1970-01-01 01:00:00.000000000 +0100
        +++ SignClock-0.5/src/com/V10lator/SignClock/SignClockPlayerListener.java 2011-07-07 20:18:10.000000000 +0200
        @@ -0,0 +1,42 @@
        +package com.V10lator.SignClock;
        +
        +import org.bukkit.block.Block;
        +import org.bukkit.block.BlockFace;
        +import org.bukkit.block.Sign;
        +import org.bukkit.Material;
        +import org.bukkit.entity.Player;
        +import org.bukkit.event.block.Action;
        +import org.bukkit.event.player.PlayerListener;
        +import org.bukkit.event.block.SignChangeEvent;
        +import org.bukkit.event.block.BlockRedstoneEvent;
        +import org.bukkit.event.player.PlayerInteractEvent;
        +import org.bukkit.ChatColor;
        +import org.bukkit.event.player.PlayerChatEvent;
        +
        +public class SignClockPlayerListener extends PlayerListener
        +{
        +  private final SignClock plugin;
        +  private Player player;
        +
        +  public SignClockPlayerListener(final SignClock plugin)
        +  {
        +    this.plugin = plugin;
        +  }
        +
        +  public void onPlayerInteract(PlayerInteractEvent event)
        +  {
        + if(event.getAction() == Action.RIGHT_CLICK_BLOCK)
        + {
        +   this.player = event.getPlayer();
        +   Block block = event.getClickedBlock();
        +      SClock SClock = plugin.getSignClock(block);
        +   if(SClock == null)
        + return;
        +   int tmp = SClock.getStyle() + 1;
        +   if(tmp >= 4)
        + tmp = 0;
        +   SClock.setStyle(tmp);
        +   this.player.sendMessage(ChatColor.YELLOW + "SignClock " + ChatColor.BLUE + "has style " + tmp); 
        + }
        +  }
        +}
        diff -Nru SignClock-0.4/src/plugin.yml SignClock-0.5/src/plugin.yml
        --- SignClock-0.4/src/plugin.yml 2011-07-07 17:09:11.000000000 +0200
        +++ SignClock-0.5/src/plugin.yml 2011-07-07 20:10:46.000000000 +0200
        @@ -1,3 +1,3 @@
          name: SignClock
          main: com.V10lator.SignClock.SignClock
        -version: 0.4
        +version: 0.5
        
    3. Set the versions number +1 after the last point in src/plugin.yml. For example:
      Before:
      Code:
      name: SignClock
        main: com.V10lator.SignClock.SignClock
        version: 0.2.2
      After:
      Code:
      name: SignClock
        main: com.V10lator.SignClock.SignClock
        version: 0.2.3
    4. If you make changes which are so big (much new commands, for example) that you think I could set the versions number higher because of that (for example from 0.2.2 to 0.3) set the versions number to 9999 after the last point. For example from 0.2.2 to 0.2.9999
    5. follow the versions sheming of the plugin! For example if you see old versions 0.1.1, 0.1.2, 0.1.3, 0.2, 0.3, 0.3.1, 0.3.2 and current version 0.4 don't set the versions number to 0.5 or 0.9999, set it to 0.4.1 or 0.4.9999!
    6. Read Changelog for changes in Versions sheming and keep them in mind. An example Changelog:
      • 1.0 Public release.
      • 1.1 Fixed a bug.
      • 1.2 Fixed a bug.
      • 1.3 Fixed a bug.
      • 1.3.1 Fixed a bug and changed versions sheming cause of many little bugfix releases.
      • 1.3.2 Fixed a bug.
      • 1.3.3 Fixed a bug.
      • 1.3.3.1 Fixed a bug and changed versions sheming cause we still have much litte bugfix releases.
      • 1.3.3.2 Fixed 2 bugs.
      • 1.3.3.3 Fixed 5 bugs.
      • 1.3.3.4 Fixed 4 bugs.
      • 1.3.4 Added new functions and fixed 2 bugs.
      • 1.3.4.1 Fixed 6 bugs.
      • 2.0 Fixed a couple of bugs and changed version sheming again cause we're getting into a stabler state (not as much bugfixes as before).
      In this example the next versions number should be 2.1! If the last version wasn't 2.0 but 2.0.0 the next version would be 2.0.1! If it were 1.4 the next were 1.5 and so on. I hope this isn't to confusing. :)
    7. If there are versions numbers in any other files, don't set them +1, too, fix them! Use plugin.getDescription().getVersion() from org.bukkit.plugin.PluginDescriptionFile. Example:
      Code:
      diff -Nru SignClock-0.2.2/src/com/V10lator/SignClock/SignClock.java SignClock-0.2.3/src/com/V10lator/SignClock/SignClock.java
        --- SignClock-0.2.2/src/com/V10lator/SignClock/SignClock.java 2011-07-14 14:07:03.224634019 +0200
        +++ SignClock-0.2.3/src/com/V10lator/SignClock/SignClock.java 2011-07-07 14:19:57.000000000 +0200
        @@ -12,6 +12,7 @@
          import org.bukkit.Material;
          import org.bukkit.block.Block;
          import org.bukkit.event.Event;
        +import org.bukkit.plugin.PluginDescriptionFile;
          import org.bukkit.plugin.PluginManager;
          import org.bukkit.plugin.java.JavaPlugin;
          import org.bukkit.Server;
        @@ -35,7 +36,8 @@
              pm.registerEvent(Event.Type.REDSTONE_CHANGE, blockListener, Event.Priority.Normal, this);
              pm.registerEvent(Event.Type.BLOCK_BREAK, blockListener, Event.Priority.Normal, this);
        -    this.name = "SignClock";
        +    PluginDescriptionFile pdfFile = this.getDescription();
        +    this.name = pdfFile.getName();
              saveFile = new File("plugins/"+this.name+"/data.sav");
              if(!checkFiles())
        @@ -44,7 +46,7 @@
                return;
              }
        -    this.info2log("v0.2.2 enabled");
        +    this.info2log("v" + pdfFile.getVersion() + " enabled");
              this.loadSigns();
            }
        @@ -52,12 +54,13 @@
            {
          if(signs.size() != 0)
            this.saveSigns();
        +    PluginDescriptionFile pdfFile = this.getDescription();
              this.info2log("disabled");
            }
            public void info2log(String text)
            {
        -    log.info("[SignClock] " + text + ".");
        +    log.info("[" + this.name + "] " + text + ".");
            }
            public void addSign(Block block, SClock sign)
        @@ -202,4 +205,4 @@
          this.info2log(count + " Clocks resetted");
          return count;
            }
        -}
        +}
        \ Kein Zeilenumbruch am Dateiende.
        diff -Nru SignClock-0.2.2/src/plugin.yml SignClock-0.2.3/src/plugin.yml
        --- SignClock-0.2.2/src/plugin.yml 2011-07-14 14:05:32.267005896 +0200
        +++ SignClock-0.2.3/src/plugin.yml 2011-07-14 14:04:46.453704188 +0200
        @@ -1,3 +1,3 @@
          name: SignClock
          main: com.V10lator.SignClock.SignClock
        -version: 0.2.2
        +version: 0.2.3
    8. Upload your patch (as txt file) in a response to the plugins thread.
    9. Feel free to upload a precompiled jar with your patch applied, too.
    10. If you choose option 9. include the patched sources (the src folder) in the jar. This is important as you violate the GLP if you don't!
    If you find any language/grammatic mistakes in this thread please report them to me because english is not my native language

    Thanks for reading and happy developing,
    Thomas.
     
    hawkfalcon and garrett2smart87 like this.
  2. Offline

    ImARedSoxFan

    Like you asked developping has 1 p - "developing"
     
    V10lator likes this.
  3. and that's the reason why you bump a nearly one year old thread? -.-'
     
    garrett2smart87 likes this.
  4. Offline

    C0nsole

    I agree but, he probably found it in the guys signature :p
     
    WarmakerT, ferrybig and V10lator like this.
Thread Status:
Not open for further replies.

Share This Page