Add command to get versions, spawn wither skeletons with /mob
This commit is contained in:
parent
035c5e9011
commit
5cac083941
@ -250,6 +250,19 @@ public class MobCommand extends MultiCommandBase<Creature>
|
|||||||
}
|
}
|
||||||
argHandle.add(arg);
|
argHandle.add(arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
else if (arg.equalsIgnoreCase("wither"))
|
||||||
|
{
|
||||||
|
for (Entity ent : entSet)
|
||||||
|
{
|
||||||
|
if (ent instanceof Skeleton)
|
||||||
|
{
|
||||||
|
((Skeleton) ent).setSkeletonType(SkeletonType.WITHER);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
argHandle.add(arg);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
for (String arg : argHandle)
|
for (String arg : argHandle)
|
||||||
argSet.remove(arg);
|
argSet.remove(arg);
|
||||||
|
@ -42,6 +42,12 @@ public class LagMeter extends MiniPlugin
|
|||||||
_start = System.currentTimeMillis();
|
_start = System.currentTimeMillis();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addCommands()
|
||||||
|
{
|
||||||
|
addCommand(new VersionsCommand(this));
|
||||||
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPlayerCommandPreProcess(PlayerCommandPreprocessEvent event)
|
public void onPlayerCommandPreProcess(PlayerCommandPreprocessEvent event)
|
||||||
{
|
{
|
||||||
|
@ -0,0 +1,74 @@
|
|||||||
|
package mineplex.core.monitor;
|
||||||
|
|
||||||
|
import java.util.Comparator;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import javax.print.attribute.IntegerSyntax;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import mineplex.core.command.CommandBase;
|
||||||
|
import mineplex.core.common.Rank;
|
||||||
|
import mineplex.core.common.util.C;
|
||||||
|
import mineplex.core.common.util.F;
|
||||||
|
import mineplex.core.common.util.UtilPlayer;
|
||||||
|
import mineplex.core.common.util.UtilServer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Statistics on versions
|
||||||
|
* @author Dan
|
||||||
|
*/
|
||||||
|
public class VersionsCommand extends CommandBase<LagMeter>
|
||||||
|
{
|
||||||
|
public VersionsCommand(LagMeter plugin)
|
||||||
|
{
|
||||||
|
super(plugin, Rank.DEVELOPER, "versions", "getver");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void Execute(Player caller, String[] args)
|
||||||
|
{
|
||||||
|
if (args.length == 0)
|
||||||
|
{
|
||||||
|
Map<Integer, Integer> versions = new HashMap<>();
|
||||||
|
for (Player player : Bukkit.getOnlinePlayers())
|
||||||
|
{
|
||||||
|
int version = ((CraftPlayer) player).getHandle().getProtocol();
|
||||||
|
int players = versions.getOrDefault(version, 0);
|
||||||
|
versions.put(version, players + 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
UtilPlayer.message(caller, F.main("Version", "Distribution on " + C.cGold
|
||||||
|
+ UtilServer.getServerName()));
|
||||||
|
|
||||||
|
List<Map.Entry<Integer, Integer>> sorted = versions
|
||||||
|
.entrySet().stream()
|
||||||
|
.sorted(Comparator.comparing(Map.Entry::getValue, (i1, i2) -> -i1.compareTo(i2)))
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
for (Map.Entry<Integer, Integer> entry : sorted)
|
||||||
|
{
|
||||||
|
UtilPlayer.message(caller,
|
||||||
|
F.main("Version", C.cYellow + entry.getKey() + C.cGray + ": " + C.cGreen
|
||||||
|
+ entry.getValue() + C.cGray + " players"));
|
||||||
|
}
|
||||||
|
} else if (args.length == 1)
|
||||||
|
{
|
||||||
|
List<Player> players = UtilPlayer.matchOnline(caller, args[0], true);
|
||||||
|
if (!players.isEmpty())
|
||||||
|
{
|
||||||
|
Player player = players.get(0);
|
||||||
|
UtilPlayer.message(caller,
|
||||||
|
F.main("Version", C.cYellow + player.getName() + C.cGray + " is on protocol "
|
||||||
|
+ C.cGreen + ((CraftPlayer) player).getHandle().getProtocol()));
|
||||||
|
}
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
UtilPlayer.message(caller, F.main("Version", "Invalid argument list."));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user