From 9e193ef75fe80fc5d99607e1dcaa83baace62d7a Mon Sep 17 00:00:00 2001 From: Olof Larsson Date: Thu, 2 Jun 2016 11:30:23 +0200 Subject: [PATCH] TypeWeatherType - Aliases and Colorization --- .../type/enumeration/TypeWeatherType.java | 36 +++++++++++++++++-- 1 file changed, 33 insertions(+), 3 deletions(-) diff --git a/src/com/massivecraft/massivecore/command/type/enumeration/TypeWeatherType.java b/src/com/massivecraft/massivecore/command/type/enumeration/TypeWeatherType.java index 348e3e52..a6f20e5a 100644 --- a/src/com/massivecraft/massivecore/command/type/enumeration/TypeWeatherType.java +++ b/src/com/massivecraft/massivecore/command/type/enumeration/TypeWeatherType.java @@ -2,7 +2,9 @@ package com.massivecraft.massivecore.command.type.enumeration; import java.util.Set; +import org.bukkit.ChatColor; import org.bukkit.WeatherType; +import org.bukkit.command.CommandSender; import com.massivecraft.massivecore.collections.MassiveSet; @@ -23,16 +25,44 @@ public class TypeWeatherType extends TypeEnum // OVERRIDE // -------------------------------------------- // + @Override + public ChatColor getVisualColor(WeatherType value, CommandSender sender) + { + if (value == null) return ChatColor.GRAY; + if (value == WeatherType.CLEAR) return ChatColor.GREEN; + return ChatColor.RED; + } + + @Override + public String getNameInner(WeatherType value) + { + switch (value) + { + case DOWNFALL: return "Rain"; + case CLEAR: return "Sun"; + } + throw new RuntimeException(); + } + @Override public Set getNamesInner(WeatherType value) { - Set ret = new MassiveSet(super.getNamesInner(value)); + Set ret = new MassiveSet(); - if (value == WeatherType.DOWNFALL) + switch (value) { - ret.add("Rain"); + case DOWNFALL: + ret.add("Rain"); + ret.add("Storm"); + break; + case CLEAR: + ret.add("Sun"); + ret.add("Sky"); + break; } + ret.addAll(super.getNamesInner(value)); + return ret; }