Add clickable TNT list
Dieser Commit ist enthalten in:
Ursprung
fa6a5abf67
Commit
a4cc32d808
@ -28,6 +28,7 @@ public class CommandTrace implements CommandExecutor {
|
|||||||
player.sendMessage("§8/§etrace togglewater §8- §7Tracet auch TNT im Wasser");
|
player.sendMessage("§8/§etrace togglewater §8- §7Tracet auch TNT im Wasser");
|
||||||
player.sendMessage("§8/§etrace show §8<§eblock§8|§eparticle§8|§7TNT-ID§8> §8- §7Zeigt alle TNT-Positionen");
|
player.sendMessage("§8/§etrace show §8<§eblock§8|§eparticle§8|§7TNT-ID§8> §8- §7Zeigt alle TNT-Positionen");
|
||||||
player.sendMessage("§8/§etrace hide §8<§7TNT-ID§8> §8- §7Versteckt alle TNT-Positionen");
|
player.sendMessage("§8/§etrace hide §8<§7TNT-ID§8> §8- §7Versteckt alle TNT-Positionen");
|
||||||
|
player.sendMessage("§8/§etrace toggleshow §8<§7TNT-ID§8> §8- §7Zeigt/Versteckt ein TNT");
|
||||||
player.sendMessage("§8/§etrace delete §8<§7TNT-ID§8> §8- §7Löscht alle TNT-Positionen");
|
player.sendMessage("§8/§etrace delete §8<§7TNT-ID§8> §8- §7Löscht alle TNT-Positionen");
|
||||||
player.sendMessage("§8/§etrace interpolate §8[§eall§8|§eyaxis§8|§enone§8] §8- §7Interpolationsoptionen");
|
player.sendMessage("§8/§etrace interpolate §8[§eall§8|§eyaxis§8|§enone§8] §8- §7Interpolationsoptionen");
|
||||||
player.sendMessage("§8/§etrace list §8<§7FRAME-ID§8>§8- §7Listet alle TNT auf");
|
player.sendMessage("§8/§etrace list §8<§7FRAME-ID§8>§8- §7Listet alle TNT auf");
|
||||||
@ -138,7 +139,7 @@ public class CommandTrace implements CommandExecutor {
|
|||||||
try {
|
try {
|
||||||
int tntID = Integer.parseInt(args[1]);
|
int tntID = Integer.parseInt(args[1]);
|
||||||
ShowManager.get(player).addSelection(tntID);
|
ShowManager.get(player).addSelection(tntID);
|
||||||
player.sendMessage(BauSystem.PREFIX + "§aTNT-Positionen vom TNT mit ID " + tntID + " angezeigt");
|
player.sendMessage(BauSystem.PREFIX + "§aTNT-Positionen des TNT mit ID " + tntID + " angezeigt");
|
||||||
player.sendMessage(BauSystem.PREFIX + "§eBei zu vielen zu zeigenden Positionen wird der Block Tracer aktiviert");
|
player.sendMessage(BauSystem.PREFIX + "§eBei zu vielen zu zeigenden Positionen wird der Block Tracer aktiviert");
|
||||||
player.sendMessage(BauSystem.PREFIX + "§eBitte aktiviere animiertes Feuer in den Grafikeinstellungen");
|
player.sendMessage(BauSystem.PREFIX + "§eBitte aktiviere animiertes Feuer in den Grafikeinstellungen");
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
@ -157,7 +158,7 @@ public class CommandTrace implements CommandExecutor {
|
|||||||
try {
|
try {
|
||||||
int tntID = Integer.parseInt(args[1]);
|
int tntID = Integer.parseInt(args[1]);
|
||||||
ShowManager.get(player).removeSelection(tntID);
|
ShowManager.get(player).removeSelection(tntID);
|
||||||
player.sendMessage(BauSystem.PREFIX + "§aTNT-Positionen vom TNT mit ID " + tntID + " versteckt");
|
player.sendMessage(BauSystem.PREFIX + "§aTNT-Positionen des TNT mit ID " + tntID + " versteckt");
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
help15(player);
|
help15(player);
|
||||||
}
|
}
|
||||||
@ -166,6 +167,25 @@ public class CommandTrace implements CommandExecutor {
|
|||||||
ShowManager.get(player).hide();
|
ShowManager.get(player).hide();
|
||||||
player.sendMessage(BauSystem.PREFIX + "§aAlle TNT-Positionen versteckt");
|
player.sendMessage(BauSystem.PREFIX + "§aAlle TNT-Positionen versteckt");
|
||||||
break;
|
break;
|
||||||
|
case "toggleshow":
|
||||||
|
if (args.length == 2) {
|
||||||
|
try {
|
||||||
|
int tntID = Integer.parseInt(args[1]);
|
||||||
|
mode = ShowManager.get(player).toggleShow(tntID);
|
||||||
|
if (mode) {
|
||||||
|
player.sendMessage(BauSystem.PREFIX + "§aTNT-Positionen des TNT mit ID " + tntID + " angezeigt");
|
||||||
|
player.sendMessage(BauSystem.PREFIX + "§eBei zu vielen zu zeigenden Positionen wird der Block Tracer aktiviert");
|
||||||
|
player.sendMessage(BauSystem.PREFIX + "§eBitte aktiviere animiertes Feuer in den Grafikeinstellungen");
|
||||||
|
} else {
|
||||||
|
player.sendMessage(BauSystem.PREFIX + "§aTNT-Positionen des TNT mit ID " + tntID + " versteckt");
|
||||||
|
}
|
||||||
|
} catch (NumberFormatException e) {
|
||||||
|
help15(player);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
help15(player);
|
||||||
|
}
|
||||||
|
break;
|
||||||
case "delete":
|
case "delete":
|
||||||
if (args.length == 2) {
|
if (args.length == 2) {
|
||||||
try {
|
try {
|
||||||
@ -218,8 +238,7 @@ public class CommandTrace implements CommandExecutor {
|
|||||||
break;
|
break;
|
||||||
case "gui":
|
case "gui":
|
||||||
//player.sendMessage(BauSystem.PREFIX + "§cNoch in Bau");
|
//player.sendMessage(BauSystem.PREFIX + "§cNoch in Bau");
|
||||||
help15(player);
|
//break;
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
help15(player);
|
help15(player);
|
||||||
}
|
}
|
||||||
|
@ -44,6 +44,7 @@ public class CommandTraceTabCompleter implements TabCompleter {
|
|||||||
}
|
}
|
||||||
tabComplete.add("toggleauto");
|
tabComplete.add("toggleauto");
|
||||||
tabComplete.add("togglewater");
|
tabComplete.add("togglewater");
|
||||||
|
tabComplete.add("toggleshow");
|
||||||
tabComplete.add("show");
|
tabComplete.add("show");
|
||||||
if (args[0].equalsIgnoreCase("show") && args.length == 2) {
|
if (args[0].equalsIgnoreCase("show") && args.length == 2) {
|
||||||
return manageList(new ArrayList<>(Arrays.asList("block", "particle")), args, 1);
|
return manageList(new ArrayList<>(Arrays.asList("block", "particle")), args, 1);
|
||||||
|
@ -410,7 +410,12 @@ public class TNTTracer15 {
|
|||||||
if (integerList.contains(tntTrace.getUniqueID()) || ShowManager.get(player).getShow() == ShowStatus.Show.ALL) st.append("§a");
|
if (integerList.contains(tntTrace.getUniqueID()) || ShowManager.get(player).getShow() == ShowStatus.Show.ALL) st.append("§a");
|
||||||
else st.append("§c");
|
else st.append("§c");
|
||||||
st.append(format(length, tntTrace.getUniqueID())).append(" §eTick: ").append(format(tntFrame.getStartTime(), tntTrace.getStartTime(), tntTrace.length()));
|
st.append(format(length, tntTrace.getUniqueID())).append(" §eTick: ").append(format(tntFrame.getStartTime(), tntTrace.getStartTime(), tntTrace.length()));
|
||||||
player.sendMessage(st.toString());
|
|
||||||
|
TextComponent textComponent = new TextComponent();
|
||||||
|
textComponent.setText(st.toString());
|
||||||
|
textComponent.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, TextComponent.fromLegacyText("§7Zeigt die Positionen dieses TNT's an")));
|
||||||
|
textComponent.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/trace toggleshow " + tntTrace.getUniqueID()));
|
||||||
|
player.spigot().sendMessage(textComponent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,6 +3,7 @@ package de.steamwar.bausystem.tracer.trace;
|
|||||||
import de.steamwar.bausystem.tracer.TNTTracer15;
|
import de.steamwar.bausystem.tracer.TNTTracer15;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import java.util.Iterator;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
|
|
||||||
public class ShowStatus {
|
public class ShowStatus {
|
||||||
@ -50,6 +51,24 @@ public class ShowStatus {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean toggleShow(int tntID) {
|
||||||
|
dirty = true;
|
||||||
|
|
||||||
|
if (show == Show.ALL) {
|
||||||
|
removeSelection(tntID);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
Iterator<Integer> selection = selected.iterator();
|
||||||
|
while (selection.hasNext()) {
|
||||||
|
if (selection.next() == tntID) {
|
||||||
|
removeSelection(tntID);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
addSelection(tntID);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
public void show() {
|
public void show() {
|
||||||
dirty = true;
|
dirty = true;
|
||||||
show = Show.ALL;
|
show = Show.ALL;
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren