mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-11-26 17:05:01 +00:00
Add mean averaging to FUtil
This commit is contained in:
parent
1726050d65
commit
72bab1e2ed
@ -5,12 +5,7 @@ import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.commons.lang.WordUtils;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Color;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.*;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -19,10 +14,8 @@ import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
import org.bukkit.scheduler.BukkitTask;
|
||||
import org.json.simple.JSONArray;
|
||||
|
||||
import java.io.*;
|
||||
import java.lang.reflect.Field;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
import java.text.ParseException;
|
||||
@ -800,6 +793,42 @@ public class FUtil
|
||||
return getServer().getOnlinePlayers().size() - i;
|
||||
}
|
||||
|
||||
public static double getMeanAverageDouble(double[] doubles)
|
||||
{
|
||||
double total = 0;
|
||||
|
||||
for (double aDouble : doubles)
|
||||
{
|
||||
total += aDouble;
|
||||
}
|
||||
|
||||
return total / doubles.length;
|
||||
}
|
||||
|
||||
public static int getMeanAverageInt(int[] ints)
|
||||
{
|
||||
int total = 0;
|
||||
|
||||
for (int anInt : ints)
|
||||
{
|
||||
total += anInt;
|
||||
}
|
||||
|
||||
return total / ints.length;
|
||||
}
|
||||
|
||||
public static long getMeanAverageLong(long[] longs)
|
||||
{
|
||||
long total = 0;
|
||||
|
||||
for (long aLong : longs)
|
||||
{
|
||||
total += aLong;
|
||||
}
|
||||
|
||||
return total / longs.length;
|
||||
}
|
||||
|
||||
public static class PaginationList<T> extends ArrayList<T>
|
||||
{
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user