fixed deathmessage location and expanded pin command
This commit is contained in:
@@ -5,6 +5,8 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.attribute.Attribute;
|
||||
import org.bukkit.attribute.AttributeModifier;
|
||||
@@ -29,12 +31,13 @@ public class ArmoredElytra implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void tes(PlayerDeathEvent e) {
|
||||
Location deathLoc = e.getPlayer().getLocation();
|
||||
|
||||
new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
e.getPlayer().spigot().respawn();
|
||||
e.getPlayer().sendMessage("Todes koordinaten: " + e.getPlayer().getLocation().getX() + " "
|
||||
+ e.getPlayer().getLocation().getY() + " " + e.getPlayer().getLocation().getZ());
|
||||
e.getPlayer().sendMessage("Todes koordinaten: " + deathLoc.getBlockX() + " " + deathLoc.getBlockY() + " " + deathLoc.getBlockZ());
|
||||
}
|
||||
}.runTaskLater(App.main, 1L); // Run next tick to prevent death screen
|
||||
}
|
||||
|
||||
@@ -8,6 +8,9 @@ import java.util.UUID;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.boss.BarColor;
|
||||
import org.bukkit.boss.BarStyle;
|
||||
import org.bukkit.boss.BossBar;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
@@ -22,6 +25,7 @@ import net.md_5.bungee.api.ChatColor;
|
||||
public class EnvironmentExCommands implements CommandExecutor, Listener {
|
||||
public de.hessj.helper.Helper helper = new de.hessj.helper.Helper();
|
||||
private final Map<UUID, Map<String, Location>> playerPins = new HashMap<>();
|
||||
private HashMap<UUID, BossBar> bossBars = new HashMap<>();
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
@@ -46,13 +50,12 @@ public class EnvironmentExCommands implements CommandExecutor, Listener {
|
||||
Player p = (Player) sender;
|
||||
p.playerListName(App.main.helper.R3SMessage(Type.ERROR, "[AFK] " + p.getName()));
|
||||
}
|
||||
|
||||
if (label.equalsIgnoreCase("pin")) {
|
||||
Player p = (Player) sender;
|
||||
UUID playerId = p.getUniqueId();
|
||||
playerPins.putIfAbsent(playerId, new HashMap<>());
|
||||
if (args.length < 1) {
|
||||
p.sendMessage(ChatColor.RED + "Benutzung: /pin <set|show|list|remove> [name]");
|
||||
p.sendMessage(ChatColor.RED + "Benutzung: /pin <set | list | remove | follow | unfollow> [name]");
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -88,17 +91,16 @@ public class EnvironmentExCommands implements CommandExecutor, Listener {
|
||||
for (String name : pins.keySet()) {
|
||||
Location location = pins.get(name);
|
||||
String w = "Overworld: ";
|
||||
|
||||
|
||||
if(location.getWorld().getName().endsWith("_nether")){
|
||||
if (location.getWorld().getName().endsWith("_nether")) {
|
||||
w = "Nether: ";
|
||||
}
|
||||
else if(location.getWorld().getName().endsWith("_end")){
|
||||
w = "End: ";
|
||||
} else if (location.getWorld().getName().endsWith("_end")) {
|
||||
w = "End: ";
|
||||
}
|
||||
|
||||
p.sendMessage("- " + w + name + " (" + location.getBlockX() + ", " + location.getBlockY() + ", "
|
||||
+ location.getBlockZ() + ")");
|
||||
p.sendMessage(
|
||||
"- " + w + name + " (" + location.getBlockX() + ", " + location.getBlockY() + ", "
|
||||
+ location.getBlockZ() + ")");
|
||||
}
|
||||
break;
|
||||
case "remove":
|
||||
@@ -116,8 +118,72 @@ w = "End: ";
|
||||
}
|
||||
break;
|
||||
|
||||
case "follow":
|
||||
|
||||
if (args.length < 2) {
|
||||
p.sendMessage(ChatColor.RED + "Benutzung: /pin follow <name>");
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
pinName = args[1];
|
||||
if (PinFeature.pinConfig.contains(playerId + "." + pinName)) {
|
||||
|
||||
String locationString = PinFeature.pinConfig.getString(playerId + "." + pinName + ".loc");
|
||||
|
||||
if (locationString != null) {
|
||||
|
||||
String[] locParts = locationString.split(", ");
|
||||
String worldName = locParts[0];
|
||||
int x = Integer.parseInt(locParts[1]);
|
||||
int y = Integer.parseInt(locParts[2]);
|
||||
int z = Integer.parseInt(locParts[3]);
|
||||
Location pinLocation = new Location(Bukkit.getWorld(worldName), x, y, z);
|
||||
String w = "Overworld: ";
|
||||
if (pinLocation.getWorld().getName().endsWith("_nether")) {
|
||||
w = "Nether: ";
|
||||
} else if (pinLocation.getWorld().getName().endsWith("_end")) {
|
||||
w = "End: ";
|
||||
}
|
||||
|
||||
BossBar bossBar = Bukkit.createBossBar(w + x + " " + y + " " + z, BarColor.WHITE, BarStyle.SOLID);
|
||||
bossBar.setProgress(0.0);
|
||||
if (!bossBars.containsKey(p.getUniqueId())) {
|
||||
|
||||
bossBar.addPlayer(p);
|
||||
bossBars.put(p.getUniqueId(), bossBar);
|
||||
} else {
|
||||
bossBars.get(p.getUniqueId()).removeAll();
|
||||
bossBars.remove(p.getUniqueId());
|
||||
bossBar.addPlayer(p);
|
||||
bossBars.put(p.getUniqueId(), bossBar);
|
||||
}
|
||||
p.sendMessage(ChatColor.GREEN + "Du folgst nun dem Pin '" + pinName + "'.");
|
||||
}
|
||||
}
|
||||
else {
|
||||
p.sendMessage(ChatColor.RED + "Kein Pin mit diesem Namen gefunden.");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
break;
|
||||
|
||||
case "unfollow":
|
||||
if (bossBars.containsKey(p.getUniqueId())) {
|
||||
bossBars.get(p.getUniqueId()).removeAll();
|
||||
bossBars.remove(p.getUniqueId());
|
||||
p.sendMessage(ChatColor.RED + "Du folgst nun keinem Pin mehr.");
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
p.sendMessage(ChatColor.RED + "Benutzung: /pin <set|show|list|remove> [name]");
|
||||
p.sendMessage(ChatColor.RED + "Benutzung: /pin <set | list | remove | follow | unfollow> [name]");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user