No Weather plugin

Discussion in 'Archived: Plugin Requests' started by EmoHobo, Jan 29, 2014.

  1. Offline

    EmoHobo

    Plugin category: AdminTools

    Suggested name: WeatherOff *Just a suggestion, im terrible at names.*

    What I want: Well, i know there used to be some of these, but i haven't found a single updated one in a while. I've seen servers that do it but they never tell me exactly how its done. So i'm requesting a plugin to make it short sweet and to the point. Basically, i would like a plugin that just disables weather. No snow, no rain, no lightning. Just a normal day and normal night. No weather effects whats-so-ever.


    Ideas for commands: /permtoggle weather or just no commands and it auto does it in the config.

    Ideas for permissions: Make it so if there is a command, only OP can use it. And no one can see that OP is using it, they just notice hey no rain sweet :D

    When I'd like it by: Any time, but hopefully as soon as possible. Don't wanna open the server until we can get it situated :)

    Thank you for taking the time to read this and if you create it thank you very much :)

    Anyone looking into this? :eek:
     
  2. Offline

    Codisimus

    Any chance you want to learn to create plugins yourself? This is a really simple plugin and a good one for beginners. Otherwise, I can send you a link to something I threw together called "NoRain" It disables weather but the "/toggledownfall" command still works for admins.
     
  3. Offline

    EmoHobo

    I've always wanted to learn how to do it, i just never really dove into it. Is there tutorials on Bukkit? :eek:
     
  4. Offline

    Codisimus

    Do you have any programming experience? or would you be starting from scratch?
     
  5. Offline

    EmoHobo

    The only program experience i've ever had was making a JavaScript website become red. I went into it for about a good 20 minutes, copied the code from the video, did it, then i just never really continued. So basically starting from scratch lol
     
  6. Offline

    timtower Administrator Administrator Moderator

    In that case you are better of using NoRain like Codisimus suggested.
     
  7. Offline

    Codisimus

    Download link for NoRain: https://dl.dropboxusercontent.com/u/23866327/Plugins/Dev Builds/NoRain.jar

    Full plugin Source:
    Code:java
    1. package com.codisimus.norain;
    2.  
    3. import org.bukkit.event.EventHandler;
    4. import org.bukkit.event.EventPriority;
    5. import org.bukkit.event.Listener;
    6. import org.bukkit.event.player.PlayerCommandPreprocessEvent;
    7. import org.bukkit.event.weather.WeatherChangeEvent;
    8. import org.bukkit.plugin.java.JavaPlugin;
    9.  
    10. public class NoRain extends JavaPlugin implements Listener {
    11. //This is a variable that our two methods will use to "communicate" with each other
    12. private boolean denyRain = true;
    13.  
    14. @Override
    15. public void onEnable() {
    16. //Register all of the EventHandlers within this class
    17. getServer().getPluginManager().registerEvents(this, this);
    18. }
    19.  
    20. @EventHandler (ignoreCancelled = true, priority = EventPriority.LOW)
    21. public void onWeatherChange(WeatherChangeEvent event) {
    22. if (event.toWeatherState()) { //Rain is trying to turn on
    23. //Cancel the event if denyRain is set to true
    24. event.setCancelled(denyRain);
    25. }
    26. //Reset the denyRain value until next time a Player issues the /toggledownfall command
    27. denyRain = true;
    28. }
    29.  
    30. @EventHandler (ignoreCancelled = true, priority = EventPriority.MONITOR)
    31. public void onPlayerCommand(PlayerCommandPreprocessEvent event) {
    32. //Check if the Player is attempting to change the weather
    33. if (event.getMessage().startsWith("/toggledownfall")) {
    34. //Verify that the Player has permission to change the weather
    35. if (event.getPlayer().hasPermission("bukkit.command.toggledownfall")) {
    36. //Allow the Rain to start for this occasion
    37. denyRain = false;
    38. }
    39. }
    40. }
    41. }


    Simple version of the plugin:
    Code:java
    1. package com.codisimus.norain;
    2.  
    3. import org.bukkit.event.EventHandler;
    4. import org.bukkit.event.Listener;
    5. import org.bukkit.event.weather.WeatherChangeEvent;
    6. import org.bukkit.plugin.java.JavaPlugin;
    7.  
    8. public class NoRain extends JavaPlugin implements Listener {
    9. @Override
    10. public void onEnable() {
    11. getServer().getPluginManager().registerEvents(this, this);
    12. }
    13.  
    14. @EventHandler
    15. public void onWeatherChange(WeatherChangeEvent event) {
    16. event.setCancelled(true);
    17. }
    18. }


    Sorry for the double post but editing the previous one messes up how the code is formatted. I just wanted to point out that this plugin is taken directly from <Removed shortened link - Shorted links are not allowed here - Necrodoom> . This is one of the first plugins that it walks you through creating.

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

    EmoHobo

  9. Offline

    nightcrawler601

    Just let me say so, there's a feature in Essentials config.yml that lets you disable the weather.
     
  10. Offline

    15987632

    never knew that thanks will defiantly be using that :p
     

Share This Page