package com.atoukprod.spigot.lessrain;

import org.bukkit.Bukkit;
import org.bukkit.World;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.weather.WeatherChangeEvent;
import org.bukkit.plugin.java.JavaPlugin;

import java.util.Random;

/**
 * Created by Romain on 28/12/2016.
 */
public class LessRain extends JavaPlugin implements Listener{
    @Override
    public void onDisable() {
        super.onDisable();
    }

    @Override
    public void onEnable() {
        super.onEnable();

        getServer().getPluginManager().registerEvents(this, this);

    }

    @EventHandler
    public void onRain(WeatherChangeEvent event)
    {
        Bukkit.broadcastMessage("Oh, it's raining today !");
        int r = (new Random()).nextInt(2);
        if(r==0)
        {
            Bukkit.broadcastMessage("Chance, this time the rain is gone !");
            event.setCancelled(true);
        }
        else
        {
            Bukkit.broadcastMessage("Oh shit, luck isn't with me this time");
        }

    }


}

@@ -249,16 +249,133 @@
 aPlugin;
+%0Aimport org.bukkit.scoreboard.Objective;%0Aimport org.bukkit.scoreboard.Score;%0Aimport org.bukkit.scoreboard.Scoreboard;
 %0A%0Aimport
@@ -500,16 +500,80 @@
 stener%7B%0A
+%0A    private Scoreboard board;%0A    private Objective settings;%0A%0A
     @Ove
@@ -776,24 +776,443 @@
 is, this);%0A%0A
+        board = Bukkit.getScoreboardManager().getMainScoreboard();%0A%0A        settings = board.getObjective(%22pluginlessrain%22);%0A%0A        if(settings==null)%0A        %7B%0A            settings = board.registerNewObjective(%22pluginlessrain%22,%22dummy%22);%0A            settings.getScore(%22verbose%22).setScore(0);%0A            settings.getScore(%22numerator%22).setScore(0);%0A            settings.getScore(%22denominator%22).setScore(1);%0A        %7D%0A%0A
     %7D%0A%0A    @
@@ -1279,24 +1279,25 @@
 )%0A    %7B%0A
+%0A
         
 Bukkit.b
@@ -1280,32 +1280,250 @@
 %0A    %7B%0A%0A        
+int verbose = settings.getScore(%22verbose%22).getScore();%0A        int numerator = settings.getScore(%22numerator%22).getScore();%0A        int denominator = settings.getScore(%22denominator%22).getScore();%0A%0A%0A%0A        if(verbose==1)
 Bukkit.broadcast
@@ -1567,18 +1567,29 @@
         
-in
+%0A        floa
 t r = (n
@@ -1609,13 +1609,14 @@
 next
-In
+Floa
 t(
-2
 );%0A 
@@ -1630,11 +1630,30 @@
 if(r
-==0
+%3Cnumerator/denominator
 )%0A  
@@ -1664,32 +1664,46 @@
   %7B%0A            
+if(verbose==1)
 Bukkit.broadcast
@@ -1834,16 +1834,30 @@
         
+if(verbose==1)
 Bukkit.b

Add scoreboard settings