本文整理了Java中com.gmail.filoghost.holographicdisplays.util.Utils
类的一些代码示例,展示了Utils
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Utils
类的具体详情如下:
包路径:com.gmail.filoghost.holographicdisplays.util.Utils
类名称:Utils
暂无
代码示例来源:origin: filoghost/HolographicDisplays
@Override
public void setLocationNMS(double x, double y, double z) {
super.setPosition(x, y, z);
if (Configuration.preciseHologramMovement) {
// Send a packet near to update the position.
PacketPlayOutEntityTeleport teleportPacket = new PacketPlayOutEntityTeleport(this);
for (Object obj : super.world.players) {
if (obj instanceof EntityPlayer) {
EntityPlayer nmsPlayer = (EntityPlayer) obj;
double distanceSquared = Utils.square(nmsPlayer.locX - super.locX) + Utils.square(nmsPlayer.locZ - super.locZ);
if (distanceSquared < 8192 && nmsPlayer.playerConnection != null) {
nmsPlayer.playerConnection.sendPacket(teleportPacket);
}
}
}
}
}
代码示例来源:origin: filoghost/HolographicDisplays
public static String join(String[] elements, String separator) {
return join(elements, separator, 0, elements.length);
}
代码示例来源:origin: filoghost/HolographicDisplays
public DynamicLineData(NMSNameable entity, String originalName) {
Validator.notNull(entity, "entity");
this.entity = entity;
this.originalName = originalName;
placeholders = Utils.newSet();
animations = Utils.newMap();
replacers = Utils.newMap();
}
代码示例来源:origin: filoghost/HolographicDisplays
List<String> help = Utils.newList();
help.add(Colors.PRIMARY + usage);
for (String tutLine : subCommand.getTutorial()) {
.color(ChatColor.AQUA)
.event(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, usage))
.event(new HoverEvent(HoverEvent.Action.SHOW_TEXT, TextComponent.fromLegacyText(Utils.join(help, "\n"))))
.create());
代码示例来源:origin: filoghost/HolographicDisplays
config.options().header(Utils.join(new String[] {
".",
". Read the tutorial at: http://dev.bukkit.org/bukkit-plugins/holographic-displays/",
pingerServers = Utils.newMap();
代码示例来源:origin: filoghost/HolographicDisplays
normalPlaceholders = Utils.newSet();
worldsOnlinePlayersReplacers = Utils.newMap();
bungeeReplacers = Utils.newMap();
bungeeReplacers = Utils.newMap();
bungeeReplacers = Utils.newMap();
bungeeReplacers = Utils.newMap();
bungeeReplacers = Utils.newMap();
animationsPlaceholders = Utils.newMap();
if (Utils.isThereNonNull(normalPlaceholders, bungeeReplacers, worldsOnlinePlayersReplacers, animationsPlaceholders)) {
代码示例来源:origin: filoghost/HolographicDisplays
private void updateLocation(World world, double x, double y, double z) {
Validator.notNull(world, "world");
this.world = world;
this.x = x;
this.y = y;
this.z = z;
chunkX = Utils.floor(x) >> 4;
chunkZ = Utils.floor(z) >> 4;
}
代码示例来源:origin: filoghost/HolographicDisplays
List<String> help = Utils.newList();
help.add(Colors.PRIMARY + usage);
for (String tutLine : subCommand.getTutorial()) {
.color(ChatColor.AQUA)
.event(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, usage))
.event(new HoverEvent(HoverEvent.Action.SHOW_TEXT, TextComponent.fromLegacyText(Utils.join(help, "\n"))))
.create());
代码示例来源:origin: filoghost/HolographicDisplays
@Override
public void setLocationNMS(double x, double y, double z) {
super.setPosition(x, y, z);
if (Configuration.preciseHologramMovement) {
// Send a packet near to update the position.
PacketPlayOutEntityTeleport teleportPacket = new PacketPlayOutEntityTeleport(this);
for (Object obj : super.world.players) {
if (obj instanceof EntityPlayer) {
EntityPlayer nmsPlayer = (EntityPlayer) obj;
double distanceSquared = Utils.square(nmsPlayer.locX - super.locX) + Utils.square(nmsPlayer.locZ - super.locZ);
if (distanceSquared < 8192 && nmsPlayer.playerConnection != null) {
nmsPlayer.playerConnection.sendPacket(teleportPacket);
}
}
}
}
}
代码示例来源:origin: filoghost/HolographicDisplays
public static String join(List<String> elements, String separator) {
return join(elements, separator, 0, elements.size());
}
代码示例来源:origin: filoghost/HolographicDisplays
@Override
public void setLocationNMS(double x, double y, double z) {
super.setPosition(x, y, z);
if (Configuration.preciseHologramMovement) {
// Send a packet near to update the position.
PacketPlayOutEntityTeleport teleportPacket = new PacketPlayOutEntityTeleport(this);
for (Object obj : super.world.players) {
if (obj instanceof EntityPlayer) {
EntityPlayer nmsPlayer = (EntityPlayer) obj;
double distanceSquared = Utils.square(nmsPlayer.locX - super.locX) + Utils.square(nmsPlayer.locZ - super.locZ);
if (distanceSquared < 8192 && nmsPlayer.playerConnection != null) {
nmsPlayer.playerConnection.sendPacket(teleportPacket);
}
}
}
}
}
代码示例来源:origin: filoghost/HolographicDisplays
public static String join(List<String> elements, String separator, int startIndex, int size) {
return join(elements.toArray(new String[elements.size()]), separator, startIndex, size);
}
代码示例来源:origin: filoghost/HolographicDisplays
@Override
public void setLocationNMS(double x, double y, double z) {
super.setPosition(x, y, z);
if (Configuration.preciseHologramMovement) {
// Send a packet near to update the position.
PacketPlayOutEntityTeleport teleportPacket = new PacketPlayOutEntityTeleport(this);
for (Object obj : super.world.players) {
if (obj instanceof EntityPlayer) {
EntityPlayer nmsPlayer = (EntityPlayer) obj;
double distanceSquared = Utils.square(nmsPlayer.locX - super.locX) + Utils.square(nmsPlayer.locZ - super.locZ);
if (distanceSquared < 8192 && nmsPlayer.playerConnection != null) {
nmsPlayer.playerConnection.sendPacket(teleportPacket);
}
}
}
}
}
代码示例来源:origin: filoghost/HolographicDisplays
@Override
public void execute(CommandSender sender, String label, String[] args) throws CommandException {
NamedHologram hologram = NamedHologramManager.getHologram(args[0].toLowerCase());
CommandValidator.notNull(hologram, Strings.noSuchHologram(args[0].toLowerCase()));
String line = Utils.join(args, " ", 1, args.length);
// Check material validity
if (line.toLowerCase().startsWith("icon:")) {
String iconMaterial = ItemUtils.stripSpacingChars(line.substring("icon:".length(), line.length()));
if (iconMaterial.contains(":")) {
iconMaterial = iconMaterial.split(":")[0];
}
Material mat = ItemUtils.matchMaterial(iconMaterial);
CommandValidator.notNull(mat, "Invalid icon material.");
}
hologram.getLinesUnsafe().add(HologramDatabase.readLineFromString(line, hologram));
hologram.refreshAll();
HologramDatabase.saveHologram(hologram);
HologramDatabase.trySaveToDisk();
sender.sendMessage(Colors.PRIMARY + "Line added!");
Bukkit.getPluginManager().callEvent(new NamedHologramEditedEvent(hologram));
}
代码示例来源:origin: filoghost/HolographicDisplays
@Override
public void setLocationNMS(double x, double y, double z) {
super.setPosition(x, y, z);
if (Configuration.preciseHologramMovement) {
// Send a packet near to update the position.
PacketPlayOutEntityTeleport teleportPacket = new PacketPlayOutEntityTeleport(this);
for (Object obj : super.world.players) {
if (obj instanceof EntityPlayer) {
EntityPlayer nmsPlayer = (EntityPlayer) obj;
double distanceSquared = Utils.square(nmsPlayer.locX - super.locX) + Utils.square(nmsPlayer.locZ - super.locZ);
if (distanceSquared < 8192 && nmsPlayer.playerConnection != null) {
nmsPlayer.playerConnection.sendPacket(teleportPacket);
}
}
}
}
}
代码示例来源:origin: filoghost/HolographicDisplays
NamedHologram hologram = NamedHologramManager.getHologram(args[0].toLowerCase());
CommandValidator.notNull(hologram, Strings.noSuchHologram(args[0].toLowerCase()));
String line = Utils.join(args, " ", 2, args.length);
代码示例来源:origin: filoghost/HolographicDisplays
@Override
public void setLocationNMS(double x, double y, double z) {
super.setPosition(x, y, z);
if (Configuration.preciseHologramMovement) {
// Send a packet near to update the position.
PacketPlayOutEntityTeleport teleportPacket = new PacketPlayOutEntityTeleport(this);
for (Object obj : super.world.players) {
if (obj instanceof EntityPlayer) {
EntityPlayer nmsPlayer = (EntityPlayer) obj;
double distanceSquared = Utils.square(nmsPlayer.locX - super.locX) + Utils.square(nmsPlayer.locZ - super.locZ);
if (distanceSquared < 8192 && nmsPlayer.playerConnection != null) {
nmsPlayer.playerConnection.sendPacket(teleportPacket);
}
}
}
}
}
代码示例来源:origin: filoghost/HolographicDisplays
@Override
public void execute(CommandSender sender, String label, String[] args) throws CommandException {
NamedHologram hologram = NamedHologramManager.getHologram(args[0].toLowerCase());
CommandValidator.notNull(hologram, Strings.noSuchHologram(args[0].toLowerCase()));
int insertAfter = CommandValidator.getInteger(args[1]);
int oldLinesAmount = hologram.size();
CommandValidator.isTrue(insertAfter >= 0 && insertAfter <= oldLinesAmount, "The number must be between 0 and " + hologram.size() + "(amount of lines of the hologram).");
hologram.getLinesUnsafe().add(insertAfter, HologramDatabase.readLineFromString(Utils.join(args, " ", 2, args.length), hologram));
hologram.refreshAll();
HologramDatabase.saveHologram(hologram);
HologramDatabase.trySaveToDisk();
if (insertAfter == 0) {
sender.sendMessage(Colors.PRIMARY + "Line inserted before line n.1!");
} else if (insertAfter == oldLinesAmount) {
sender.sendMessage(Colors.PRIMARY + "Line appended at the end!");
sender.sendMessage(Strings.TIP_PREFIX + "Next time use /" + label + " addline to add a line at the end.");
} else {
sender.sendMessage(Colors.PRIMARY + "Line inserted between lines " + insertAfter + " and " + (insertAfter + 1) + "!");
}
Bukkit.getPluginManager().callEvent(new NamedHologramEditedEvent(hologram));
}
代码示例来源:origin: filoghost/HolographicDisplays
@Override
public void setLocationNMS(double x, double y, double z) {
super.setPosition(x, y, z);
if (Configuration.preciseHologramMovement) {
// Send a packet near to update the position.
PacketPlayOutEntityTeleport teleportPacket = new PacketPlayOutEntityTeleport(this);
for (Object obj : super.world.players) {
if (obj instanceof EntityPlayer) {
EntityPlayer nmsPlayer = (EntityPlayer) obj;
double distanceSquared = Utils.square(nmsPlayer.locX - super.locX) + Utils.square(nmsPlayer.locZ - super.locZ);
if (distanceSquared < 8192 && nmsPlayer.playerConnection != null) {
nmsPlayer.playerConnection.sendPacket(teleportPacket);
}
}
}
}
}
代码示例来源:origin: filoghost/HolographicDisplays
String text = Utils.join(args, " ", 1, args.length);
CommandValidator.isTrue(!text.equalsIgnoreCase("{empty}"), "The first line should not be empty.");
内容来源于网络,如有侵权,请联系作者删除!