spenk

NoWeatherHook

Feb 15th, 2012
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.82 KB | None | 0 0
  1. public class NoWeatherHook implements PluginInterface{
  2.         NoWeatherListener nwl;
  3.  
  4.         public NoWeatherHook(NoWeatherListener nw){ nwl = nw; }
  5.  
  6.         public String getName(){
  7.               return "NoWeather";
  8.         }
  9.         public int getNumParameters() {
  10.               return 2;
  11.         }
  12.         public String checkParameters(Object[] os) {
  13.             if ((os.length < 1) || (os.length > getNumParameters())) {
  14.                 return "Invalid amount of parameters.";
  15.             }
  16.             return null;
  17.         }
  18.         public Object run(Object[] os) {
  19.             String type = (String)os[0];
  20.             if(type.equalsIgnoreCase("CHECK")){
  21.                 if (nwl.prevrain){
  22.                     return true;
  23.                 }else{
  24.                     return false;
  25.                 }
  26.             }else if (type.equalsIgnoreCase("SET")){
  27.                 Boolean b   = (Boolean)os[1];
  28.                 if (b){
  29.                     nwl.prevrain = true;
  30.                 }else{
  31.                     nwl.prevrain = false;
  32.                 }
  33.             }
  34.             return null;
  35.         }
  36.     }
Advertisement
Add Comment
Please, Sign In to add comment