本文整理汇总了Java中net.dmulloy2.util.Util.getOnlinePlayers方法的典型用法代码示例。如果您正苦于以下问题:Java Util.getOnlinePlayers方法的具体用法?Java Util.getOnlinePlayers怎么用?Java Util.getOnlinePlayers使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.dmulloy2.util.Util
的用法示例。
在下文中一共展示了Util.getOnlinePlayers方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: cleanupData
import net.dmulloy2.util.Util; //导入方法依赖的package包/类
public final void cleanupData()
{
// Get all online players into an array list
List<String> online = new ArrayList<>();
for (Player player : Util.getOnlinePlayers())
online.add(player.getName());
// Actually cleanup the data
for (String key : getAllLoadedPlayerData().keySet())
if (! online.contains(key))
cache.remove(key);
// Clear references
online.clear();
online = null;
}
示例2: decidePlayer
import net.dmulloy2.util.Util; //导入方法依赖的package包/类
private final Player decidePlayer()
{
List<Player> validPlayers = new ArrayList<Player>();
for (Player pl : Util.getOnlinePlayers())
{
if (! plugin.doesFactionsApply(pl.getLocation()))
{
if (worlds.contains(pl.getWorld().getName()))
validPlayers.add(pl);
}
}
int rand = RANDOM.nextInt(validPlayers.size());
return validPlayers.get(rand);
}
示例3: run
import net.dmulloy2.util.Util; //导入方法依赖的package包/类
@Override
public void run()
{
if (! Config.hourlyRewardsEnabled)
{
getServer().getScheduler().cancelTask(rewardTask);
return;
}
String message = getMessage("hourly_reward");
String serverName = Config.serverName;
for (Player player : Util.getOnlinePlayers())
{
List<String> rewards = Config.hourlyRewards;
if (! rewards.isEmpty())
{
int rand = Util.random(rewards.size());
String entry = rewards.get(rand);
if (entry != null)
{
String[] split = entry.split(";");
String command = replacePlayerVars(split[0], player);
getServer().dispatchCommand(getServer().getConsoleSender(), command);
player.sendMessage(FormatUtil.format(message, serverName, split[1]));
}
}
}
}
示例4: run
import net.dmulloy2.util.Util; //导入方法依赖的package包/类
@Override
public void run()
{
for (Player player : Util.getOnlinePlayers())
{
plugin.getExperienceHandler().handleXpGain(player, xpGain, "");
}
}
示例5: refreshBoard
import net.dmulloy2.util.Util; //导入方法依赖的package包/类
public final void refreshBoard()
{
for (Player player : Util.getOnlinePlayers())
{
refreshBoard(player);
}
}
示例6: updatePlayerHealth
import net.dmulloy2.util.Util; //导入方法依赖的package包/类
public final void updatePlayerHealth()
{
for (Player player : Util.getOnlinePlayers())
{
updatePlayerHealth(player);
}
}
示例7: cleanupData
import net.dmulloy2.util.Util; //导入方法依赖的package包/类
public final void cleanupData()
{
// Get all online players into a list
List<String> online = new ArrayList<>();
for (Player player : Util.getOnlinePlayers())
online.add(getKey(player));
// Actually cleanup the data
for (String key : getAllLoadedPlayerData().keySet())
if (! online.contains(key))
cache.remove(key);
online.clear();
}
示例8: getOnlinePlayers
import net.dmulloy2.util.Util; //导入方法依赖的package包/类
private void getOnlinePlayers()
{
for (Player player : Util.getOnlinePlayers())
{
if (! players.containsKey(player.getName()))
players.put(player.getName(), new GunPlayer(this, player));
}
}
示例9: run
import net.dmulloy2.util.Util; //导入方法依赖的package包/类
@Override
public void run()
{
if (plugin.getLegendaryEntityId() == null && Util.getOnlinePlayers().size() > 0
&& System.currentTimeMillis() - plugin.getLastLegendaryDeathTime() > minutesBetweenLegendaries * 60 * 1000L)
{
List<Player> players = Util.getOnlinePlayers();
Player player = players.get(RANDOM.nextInt(players.size()));
if (! plugin.doesFactionsApply(player.getLocation()))
{
EntityType type = LegendaryMonsterType.getRandom();
LivingEntity legendary = null;
double dRand = RANDOM.nextDouble();
if ((type.equals(EntityType.GIANT)) && (1.0D / giantSpawnChance > dRand))
{
legendary = spawn(type, player.getLocation());
legendary.setMaxHealth(giantMaxHealth);
}
else if ((type.equals(EntityType.SLIME)) && (1.0D / slimeSpawnChance > dRand))
{
legendary = spawn(type, player.getLocation());
legendary.setMaxHealth(slimeMaxHealth);
((Slime) legendary).setSize(25);
}
else if ((type.equals(EntityType.WITHER)) && (1.0D / witherSpawnChance > dRand))
{
legendary = spawn(type, player.getLocation());
legendary.setMaxHealth(witherMaxHealth);
}
else
{
return;
}
legendary.setHealth(legendary.getMaxHealth());
plugin.setLegendary(legendary);
if (legendariesNotify)
{
plugin.getServer().broadcastMessage(FormatUtil.format("&a[SwornCritters] A legendary {0} has spawned",
FormatUtil.getFriendlyName(type)));
}
}
}
else
{
if (plugin.getLegendary() != null)
{
if (! plugin.getLegendary().isValid())
{
plugin.getLegendary().remove();
plugin.removeLegendary();
}
}
}
}
示例10: tick
import net.dmulloy2.util.Util; //导入方法依赖的package包/类
public void tick()
{
this.duration -= 1;
if (duration < 0)
{
plugin.removeEffect(this);
return;
}
double yRad = radius;
if (type.equals(Effect.MOBSPAWNER_FLAMES))
{
yRad = 0.75D;
for (Player player : Util.getOnlinePlayers())
{
if (player.getWorld().getUID() == location.getWorld().getUID())
{
if (location.distance(player.getLocation()) < radius)
{
player.setFireTicks(20);
}
}
}
}
for (double i = -radius; i <= radius; i += 1.0D)
{
for (double ii = -radius; ii <= radius; ii += 1.0D)
{
for (double iii = 0.0D; iii <= yRad * 2.0D; iii += 1.0D)
{
int rand = Util.random(8);
if (rand == 2)
{
Location newloc = location.clone().add(i, iii - 1.0D, ii);
Location testLoc = location.clone().add(0.0D, yRad - 1.0D, 0.0D);
if (newloc.distance(testLoc) <= radius)
{
byte dat = (byte) Util.random(8);
if (specialDat > -1)
dat = specialDat;
newloc.getWorld().playEffect(newloc, type, dat);
}
}
}
}
}
}