use of com.massivecraft.massivecore.collections.MassiveMap in project MassiveCore by MassiveCraft.
the class EngineMassiveCoreGank method getPlayerQuotients.
public Map<Player, Double> getPlayerQuotients(Entity entity) {
// Get PlayerDamages
Map<Player, Double> playerDamages = getPlayerDamages(entity);
// Calculate Total
double total = 0;
for (Double damage : playerDamages.values()) {
total += damage;
}
// Create Ret
Map<Player, Double> ret = new MassiveMap<>(playerDamages.size());
// Fill Ret
for (Entry<Player, Double> playerDamage : playerDamages.entrySet()) {
Player player = playerDamage.getKey();
Double damage = playerDamage.getValue();
ret.put(player, damage / total);
}
// Return Ret
return ret;
}
use of com.massivecraft.massivecore.collections.MassiveMap in project MassiveCore by MassiveCraft.
the class Accessor method getFieldMap.
public static Map<String, Field> getFieldMap(Class<?> clazz) {
Map<String, Field> ret = new MassiveMap<>();
for (Field field : getFieldList(clazz)) {
if (Modifier.isTransient(field.getModifiers()))
continue;
if (Modifier.isFinal(field.getModifiers()))
continue;
String fieldName = field.getName();
if (ret.containsKey(fieldName))
continue;
ret.put(fieldName, field);
}
return ret;
}
use of com.massivecraft.massivecore.collections.MassiveMap in project MassiveCore by MassiveCraft.
the class BoardUtil method updatePlayers.
public static void updatePlayers() {
// Create
Map<String, Player> players = new MassiveMap<>();
// Fill
for (Player player : MUtil.getOnlinePlayers()) {
players.put(player.getName(), player);
}
players = Collections.unmodifiableMap(players);
// Set
BoardUtil.players = players;
}
use of com.massivecraft.massivecore.collections.MassiveMap in project MassiveCore by MassiveCraft.
the class BoardUtil method getTeamOptions.
// -------------------------------------------- //
// TEAM > OPTIONS
// -------------------------------------------- //
public static Map<TeamOptionKey, TeamOptionValue> getTeamOptions(Team team) {
// Create
Map<TeamOptionKey, TeamOptionValue> ret = new MassiveMap<>();
// Fill
for (TeamOptionKey key : TeamOptionKey.values()) {
TeamOptionValue value = getTeamOption(team, key);
if (value == null)
continue;
ret.put(key, value);
}
// Return
return ret;
}
use of com.massivecraft.massivecore.collections.MassiveMap in project MassiveCore by MassiveCraft.
the class DataItemStack method fromBukkitContents.
public static Map<Integer, DataItemStack> fromBukkitContents(ItemStack[] contents) {
// Catch NullEmpty
if (contents == null || contents.length == 0)
return null;
// Create
Map<Integer, DataItemStack> ret = new MassiveMap<>();
// Fill
for (int i = 0; i < contents.length; i++) {
ItemStack itemStack = contents[i];
if (InventoryUtil.isNothing(itemStack))
continue;
ret.put(i, DataItemStack.fromBukkit(itemStack));
}
// Return
return ret;
}
Aggregations