TypeWeatherType - Aliases and Colorization

This commit is contained in:
Olof Larsson 2016-06-02 11:30:23 +02:00
parent 4200155719
commit 9e193ef75f
No known key found for this signature in database
GPG Key ID: BBEF14F97DA52474

View File

@ -2,7 +2,9 @@ package com.massivecraft.massivecore.command.type.enumeration;
import java.util.Set; import java.util.Set;
import org.bukkit.ChatColor;
import org.bukkit.WeatherType; import org.bukkit.WeatherType;
import org.bukkit.command.CommandSender;
import com.massivecraft.massivecore.collections.MassiveSet; import com.massivecraft.massivecore.collections.MassiveSet;
@ -23,16 +25,44 @@ public class TypeWeatherType extends TypeEnum<WeatherType>
// OVERRIDE // 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 @Override
public Set<String> getNamesInner(WeatherType value) public Set<String> getNamesInner(WeatherType value)
{ {
Set<String> ret = new MassiveSet<String>(super.getNamesInner(value)); Set<String> ret = new MassiveSet<String>();
if (value == WeatherType.DOWNFALL) switch (value)
{ {
case DOWNFALL:
ret.add("Rain"); ret.add("Rain");
ret.add("Storm");
break;
case CLEAR:
ret.add("Sun");
ret.add("Sky");
break;
} }
ret.addAll(super.getNamesInner(value));
return ret; return ret;
} }