Allergy reaction kicked in. This commit removes the Spout features. I have nothing against spout but if we are going to have them we should do them properly. They should be coded in such a way that they could be in an external plugin alltogether. Also removed netbeans stuff from IDE that should not be in the github repo.

This commit is contained in:
Olof Larsson
2013-04-22 21:00:00 +02:00
parent bc194efc9b
commit 90d819ab18
34 changed files with 103 additions and 1129 deletions

View File

@ -1,70 +0,0 @@
package com.massivecraft.factions.util;
import java.util.Map.Entry;
import com.massivecraft.factions.ConfServer;
import com.massivecraft.mcore.util.Txt;
public class HealthBarUtil
{
public static String getHealthbar(double healthQuota, int barLength)
{
// Ensure between 0 and 1;
healthQuota = fixQuota(healthQuota);
// What color is the health bar?
String color = getColorFromHealthQuota(healthQuota);
// how much solid should there be?
int solidCount = (int) Math.ceil(barLength * healthQuota);
// The rest is empty
int emptyCount = (int) ((barLength - solidCount) / ConfServer.spoutHealthBarSolidsPerEmpty);
// Create the non-parsed bar
String ret = ConfServer.spoutHealthBarLeft + Txt.repeat(ConfServer.spoutHealthBarSolid, solidCount) + ConfServer.spoutHealthBarBetween + Txt.repeat(ConfServer.spoutHealthBarEmpty, emptyCount) + ConfServer.spoutHealthBarRight;
// Replace color tag
ret = ret.replace("{c}", color);
// Parse amp color codes
ret = Txt.parse(ret);
return ret;
}
public static String getHealthbar(double healthQuota)
{
return getHealthbar(healthQuota, ConfServer.spoutHealthBarWidth);
}
public static double fixQuota(double healthQuota)
{
if (healthQuota > 1)
{
return 1d;
}
else if (healthQuota < 0)
{
return 0d;
}
return healthQuota;
}
public static String getColorFromHealthQuota(double healthQuota)
{
Double currentRoof = null;
String ret = null;
for (Entry<Double, String> entry : ConfServer.spoutHealthBarColorUnderQuota.entrySet())
{
double roof = entry.getKey();
String color = entry.getValue();
if (healthQuota <= roof && (currentRoof == null || roof <= currentRoof))
{
currentRoof = roof;
ret = color;
}
}
return ret;
}
}