[MISC] Advert 0.5 - Advertise easily [1000]

Discussion in 'Inactive/Unsupported Plugins' started by Shendow, Jul 18, 2011.

  1. Offline

    Shendow

    [​IMG]
    [​IMG]

    [​IMG]

    [​IMG]

    [​IMG]

    Version: 0.5

    Plugin allowing you to advertise against money (5$ by default). Now uses Register.

    Features:
    • Advertising. (useful for RPs, etc.)
    • Generated config.yml where you can change the price and the delay between 2 adverts.
    • Anti-spam delay.
    • Permissions!
    • And pretty colors.
    Command:
    • /advert <message> - Advertise.
    • /advert - Various infos about the plugin.
    Download:
    v0.5

    Permission node(s):
    Installation:
    Drop the downloaded file into the "plugins" folder of your server.

    Changelog:
    Version 0.5
    • Added 2 Permissions nodes, "advert.free" and "advert.nodelay", see above for more informations.
    Version 0.4
    • Added Permissions compatibility. See above for the node.
    Version 0.3
    • Added an anti-spam delay. (special thanks to Raeon!)
    • Now made /advert an "about" command. It shows the version, the price of 1 advert and the anti-spam delay.
    Version 0.2
    • Switched to Register, this plugin now supports most Economy Plugins. Yet I've only tested on iConomy 5.
    Version 0.1
    • Release of the plugin.
     
  2. Offline

    ChrizC

    How does it advertise? Over chat?
    Also, look into using the Register API by Nijikokun, to allow usages of the three major economy plugins (iCo, BOSE and Essentials)
     
  3. Offline

    Shendow

    I don't really understand the point of Register, as I'm French and don't fully understand English. So I've downloaded the iConomy plugin and added it as External .JAR in my project. It works too.
     
  4. Offline

    ChrizC

    It allows your users to use any of the major economy plugins, not just iConomy. This opens up your plugin to a larger audience.
     
  5. Offline

    Mike A

    This is a good idea, but will most likely be abused on almost every server that has it...
     
  6. Offline

    Shendow

    Will do in the next version.

    An idea would be to add a "cooldown" before the next advert. Only, I don't know how to make "timers" or something similar. If somebody can teach me how to make those, I would greatly appreicate!

    Now uploaded v0.2. I've switched to Register but I am unsure the plugin will work. Please tell me if the plugin is not working properly. I will try to fix it.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 17, 2016
    Mike A likes this.
  7. Offline

    redred

    I
    You can set the current time on variable and check the difference when someone use the command
     
  8. Offline

    Shendow

    What is the ideal function to get the "current time"? I've tried Player.getPlayerTime() but it acts strangely.
     
  9. Offline

    redred

    http://joysofprogramming.com/current-time-in-seconds-in-java/
    This will give you the system current time, when someone do command you can check again and see how many seconds passed
     
  10. Offline

    Shendow

    I'm having trouble doing this way with arrays. I've coded way too much Lua and used to make string indexes. Oh well. If you know any other way to store stuff, I would like you to share it with me.
     
  11. Offline

    asterious

    thx, i`ll try it on my server.
     
  12. Offline

    Raeon

    Code:
        // Declarations
        public static HashMap<Player, Integer> lastUsed = new Map<Player, Integer>();
    
        // Functions
        public int getLastUsed(Player player){
            if(lastUsed.get(player) != null){
                return lastUsed.get(player);
            }else{
                return null;
            }
        }
    
        public void setLastUsed(Player player, int time){
            lastUsed.put(player, time);
        }
    Using HashMaps is a good way to easily assign a Object to another Object. With the code above you can easily store the last time a player advertised in a HashMap. Just copy - paste and give it a try.
    Though, be aware of the fact that I've put in Integer as the value- not a Date or whatever type of other object you use to specify the 'last time used' variable.

    Succes!
    ~ Raeon
     
  13. Offline

    Shendow

    Thanks! I am having a lot of trouble with HashMaps until I read this, you now enlightened me! Anyways, I have uploaded the 0.3 version.
     
  14. Offline

    asterious

    What about Permissons plugin?
     
  15. Offline

    Shendow

    I'm going to implement it if I get it to work.
     
  16. Offline

    asterious

    Glad to hear it. Just I`m wanna use that plugin on my server, but can`t turn off Permission plugin ^^ Waiting for fix.
     
  17. Offline

    Shendow

    Oh, do you mean that you are asking for Permissions nodes in the plugin?
     
  18. Offline

    asterious

    yep. what did u think?)
     
  19. Offline

    Shendow

    Added Permissions support. I'm not sure how this works, but it works. (for me, atleast.)

    Added 2 more nodes, "advert.free" and "advert.nodelay".

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

    asterious

    Thanks u!

    Hm... It does not working, when i use permissions like that:

    Admins:
    default: false
    info:
    prefix: '&C[Admin]'
    suffix: ''
    build: true
    rank: 10
    inheritance:
    permissions:
    - '*'

    all plugins working with that config, except ur plugin. Can u fix it?

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

    Samzapp

    It says that an internal error occurred when I attempt to advertise. Any ideas?
     
  22. Offline

    Shendow

    Permissions work for me. Try putting - 'advert.*'

    It works perfectly for me, make sure you have an economy system AND Permissions.
     
  23. Offline

    Samzapp

    I use EssentialsEco and PermissionsBukkit.
     
  24. Offline

    Shendow

    I'm not sure Register supports EssentialsEco, try using another economy plugin instead.
     
  25. Offline

    Samzapp

  26. Offline

    asterious

    It still does not working... I put 'advert.*' and nothing...

    btw:

    09:52:47 [SEVERE] null
    org.bukkit.command.CommandException: Unhandled exception executing command 'adve
    rt' in plugin Advert v0.5
    at org.bukkit.command.PluginCommand.execute(PluginCommand.java:37)
    at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:12
    9)
    at org.bukkit.craftbukkit.CraftServer.dispatchCommand(CraftServer.java:3
    20)
    at net.minecraft.server.NetServerHandler.handleCommand(NetServerHandler.
    java:713)
    at net.minecraft.server.NetServerHandler.chat(NetServerHandler.java:677)

    at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:670)
    at net.minecraft.server.Packet3Chat.a(Packet3Chat.java:33)
    at net.minecraft.server.NetworkManager.b(NetworkManager.java:226)
    at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:85)
    at net.minecraft.server.NetworkListenThread.a(SourceFile:105)
    at net.minecraft.server.MinecraftServer.h(MinecraftServer.java:451)
    at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:361)
    at net.minecraft.server.ThreadServerApplication.run(SourceFile:422)
    Caused by: java.lang.NullPointerException
    at shen.annonces.Annonces.onCommand(Annonces.java:109)
    at org.bukkit.command.PluginCommand.execute(PluginCommand.java:35)
    ... 12 more

    its not normally...
     
  27. Offline

    Samzapp

    Is it possible to get it working with EssentialsEco?
     
  28. Offline

    Shendow

    What economy plugin and Permissions are you using?

    Not really.
     
  29. Offline

    asterious

    Real Economy that built in Real Shop plugin. Its bad, yes?
     
  30. Offline

    Shendow

    Yes it is, please use iConomy or any other major economy system.
     

Share This Page