mirror of
https://github.com/StarWishsama/Slimefun4.git
synced 2024-09-19 19:25:48 +00:00
/sf teleporter will now open your own teleporter if no player was given
This commit is contained in:
parent
16e2376604
commit
61b4a1fe1a
@ -76,6 +76,7 @@
|
|||||||
* Changed Ignition Chamber Recipe
|
* Changed Ignition Chamber Recipe
|
||||||
* GEO Miner is now 2 seconds faster
|
* GEO Miner is now 2 seconds faster
|
||||||
* All Generators will now stop consuming fuel if no energy is needed
|
* All Generators will now stop consuming fuel if no energy is needed
|
||||||
|
* /sf teleporter will now open your own Teleporter Menu if you specify no Player
|
||||||
|
|
||||||
#### Fixes
|
#### Fixes
|
||||||
* Fixed error message when clicking empty slots in the Slimefun Guide
|
* Fixed error message when clicking empty slots in the Slimefun Guide
|
||||||
|
@ -28,20 +28,35 @@ class TeleporterCommand extends SubCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onExecute(CommandSender sender, String[] args) {
|
public void onExecute(CommandSender sender, String[] args) {
|
||||||
if (args.length == 2) {
|
if (sender instanceof Player) {
|
||||||
if (sender.hasPermission("slimefun.command.teleporter") && sender instanceof Player) {
|
if (sender.hasPermission("slimefun.command.teleporter")) {
|
||||||
|
if (args.length == 1) {
|
||||||
@SuppressWarnings("deprecation")
|
Player p = (Player) sender;
|
||||||
OfflinePlayer player = Bukkit.getOfflinePlayer(args[1]);
|
SlimefunPlugin.getGPSNetwork().getTeleportationManager().openTeleporterGUI(p, p.getUniqueId(), p.getLocation().getBlock().getRelative(BlockFace.DOWN), 999999999);
|
||||||
|
}
|
||||||
if (player.getName() != null) {
|
else if (args.length == 2) {
|
||||||
SlimefunPlugin.getGPSNetwork().getTeleportationManager().openTeleporterGUI((Player) sender, player.getUniqueId(), ((Player) sender).getLocation().getBlock().getRelative(BlockFace.DOWN), 999999999);
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
OfflinePlayer player = Bukkit.getOfflinePlayer(args[1]);
|
||||||
|
|
||||||
|
if (player.getName() != null) {
|
||||||
|
SlimefunPlugin.getGPSNetwork().getTeleportationManager().openTeleporterGUI((Player) sender, player.getUniqueId(), ((Player) sender).getLocation().getBlock().getRelative(BlockFace.DOWN), 999999999);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
SlimefunPlugin.getLocal().sendMessage(sender, "messages.unknown-player", msg -> msg.replace("%player%", args[1]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
SlimefunPlugin.getLocal().sendMessage(sender, "messages.usage", msg -> msg.replace("%usage%", "/sf teleporter [Player]"));
|
||||||
}
|
}
|
||||||
else SlimefunPlugin.getLocal().sendMessage(sender, "messages.unknown-player", msg -> msg.replace("%player%", args[1]));
|
|
||||||
}
|
}
|
||||||
else SlimefunPlugin.getLocal().sendMessage(sender, "messages.no-permission");
|
else {
|
||||||
|
SlimefunPlugin.getLocal().sendMessage(sender, "messages.no-permission");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
SlimefunPlugin.getLocal().sendMessage(sender, "messages.only-players");
|
||||||
}
|
}
|
||||||
else SlimefunPlugin.getLocal().sendMessage(sender, "messages.usage", msg -> msg.replace("%usage%", "/sf teleporter <Player>"));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user