From 29b26ed32790448b5a22292d5f5c463bd23d788d Mon Sep 17 00:00:00 2001 From: TheBusyBiscuit Date: Mon, 20 Jul 2020 16:30:20 +0200 Subject: [PATCH] Made requested changes --- .../api/gps/TeleportationManager.java | 22 +++++++++++++++---- .../commands/subcommands/VersionsCommand.java | 2 +- .../items/gps/ElevatorPlate.java | 2 +- 3 files changed, 20 insertions(+), 6 deletions(-) diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/api/gps/TeleportationManager.java b/src/main/java/io/github/thebusybiscuit/slimefun4/api/gps/TeleportationManager.java index 6de370063..7b4d0f1bd 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/api/gps/TeleportationManager.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/api/gps/TeleportationManager.java @@ -1,6 +1,8 @@ package io.github.thebusybiscuit.slimefun4.api.gps; +import java.util.ArrayList; import java.util.HashSet; +import java.util.List; import java.util.Set; import java.util.UUID; @@ -59,10 +61,21 @@ public final class TeleportationManager { } int slot = teleporterInventory[index]; - Location l = waypoint.getLocation(); - menu.addItem(slot, new CustomItem(waypoint.getIcon(), waypoint.getName().replace("player:death ", ""), "", "&8\u21E8 &7" + SlimefunPlugin.getLocalization().getResourceString(p, "tooltips.world") + ": &f" + l.getWorld().getName(), "&8\u21E8 &7X: &f" + l.getX(), "&8\u21E8 &7Y: &f" + l.getY(), "&8\u21E8 &7Z: &f" + l.getZ(), "&8\u21E8 &7" + SlimefunPlugin.getLocalization().getMessage(p, "machines.TELEPORTER.gui.time") + ": &f" + DoubleHandler.fixDouble(0.5 * getTeleportationTime(complexity, source, l)) + "s", "", "&8\u21E8 &c" - + SlimefunPlugin.getLocalization().getMessage(p, "machines.TELEPORTER.gui.tooltip"))); + double time = DoubleHandler.fixDouble(0.5 * getTeleportationTime(complexity, source, l)); + + List nameAndLore = new ArrayList<>(); + nameAndLore.add(waypoint.getName().replace("player:death ", "")); + nameAndLore.add(""); + nameAndLore.add("&8\u21E8 &7" + SlimefunPlugin.getLocalization().getResourceString(p, "tooltips.world") + ": &f" + l.getWorld().getName()); + nameAndLore.add("&8\u21E8 &7X: &f" + l.getX()); + nameAndLore.add("&8\u21E8 &7Y: &f" + l.getY()); + nameAndLore.add("&8\u21E8 &7Z: &f" + l.getZ()); + nameAndLore.add("&8\u21E8 &7" + SlimefunPlugin.getLocalization().getMessage(p, "machines.TELEPORTER.gui.time") + ": &f" + time + "s"); + nameAndLore.add(""); + nameAndLore.add("&8\u21E8 &c" + SlimefunPlugin.getLocalization().getMessage(p, "machines.TELEPORTER.gui.tooltip")); + + menu.addItem(slot, new CustomItem(waypoint.getIcon(), nameAndLore)); menu.addMenuClickHandler(slot, (pl, s, item, action) -> { pl.closeInventory(); teleport(pl.getUniqueId(), complexity, source, l, false); @@ -129,7 +142,8 @@ public final class TeleportationManager { SlimefunPlugin.getLocalization().sendMessage(p, "machines.TELEPORTER.invulnerability"); } - destination.getWorld().spawnParticle(Particle.PORTAL, new Location(destination.getWorld(), destination.getX(), destination.getY() + 1, destination.getZ()), progress * 2, 0.2F, 0.8F, 0.2F); + Location loc = new Location(destination.getWorld(), destination.getX(), destination.getY() + 1, destination.getZ()); + destination.getWorld().spawnParticle(Particle.PORTAL, loc, progress * 2, 0.2F, 0.8F, 0.2F); destination.getWorld().playSound(destination, Sound.BLOCK_BEACON_ACTIVATE, 1F, 1F); teleporterUsers.remove(uuid); }); diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/subcommands/VersionsCommand.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/subcommands/VersionsCommand.java index 375573291..c63601815 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/subcommands/VersionsCommand.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/subcommands/VersionsCommand.java @@ -35,7 +35,7 @@ class VersionsCommand extends SubCommand { public void onExecute(CommandSender sender, String[] args) { if (sender.hasPermission("slimefun.command.versions") || sender instanceof ConsoleCommandSender) { // After all these years... Spigot still displays as "CraftBukkit" - // so we will just this issue for them :) + // so we will just fix this inconsistency for them :) String serverSoftware = PaperLib.isSpigot() && !PaperLib.isPaper() ? "Spigot" : Bukkit.getName(); sender.sendMessage(ChatColors.color("&a" + serverSoftware + " &2" + ReflectionUtils.getVersion())); sender.sendMessage(""); diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/gps/ElevatorPlate.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/gps/ElevatorPlate.java index 16fa5f69f..2f4a60dda 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/gps/ElevatorPlate.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/gps/ElevatorPlate.java @@ -138,7 +138,7 @@ public class ElevatorPlate extends SimpleSlimefunItem { Location destination = new Location(player.getWorld(), block.getX() + 0.5, block.getY() + 0.4, block.getZ() + 0.5, yaw, player.getEyeLocation().getPitch()); PaperLib.teleportAsync(player, destination).thenAccept(teleported -> { if (teleported.booleanValue()) { - Slimefun.runSync(() -> player.sendTitle(ChatColor.WHITE + ChatColors.color(floor), " ", 20, 60, 20)); + Slimefun.runSync(() -> player.sendTitle(ChatColor.WHITE + ChatColors.color(floor), null, 20, 60, 20)); } }); })));