SteamWar/BauSystem2.0
Archiviert
12
0

Update TraceCommand
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Signed-off-by: yoyosource <yoyosource@nidido.de>
Dieser Commit ist enthalten in:
yoyosource 2021-12-08 17:36:46 +01:00
Ursprung cd360c1911
Commit d385fb6d25

Datei anzeigen

@ -114,8 +114,8 @@ public class TraceCommand extends SWCommand {
listCommand(p, 0); listCommand(p, 0);
} }
@Register({"record", "list"}) @Register(value = {"record", "list"}, noTabComplete = true)
@Register({"list"}) @Register(value = {"list"}, noTabComplete = true)
public void listCommand(Player player, int page) { public void listCommand(Player player, int page) {
if (!permissionCheck(player)) return; if (!permissionCheck(player)) return;
ListChatView.chatView(player, StoredRecords.getRecords(), page, record -> { ListChatView.chatView(player, StoredRecords.getRecords(), page, record -> {
@ -139,19 +139,19 @@ public class TraceCommand extends SWCommand {
}); });
} }
@Register({"record", "delete"}) @Register(value = {"record", "delete"}, noTabComplete = true)
public void recordDelete(Player p, int id) { public void recordDelete(Player p, int id) {
if (!permissionCheck(p)) return; if (!permissionCheck(p)) return;
StoredRecords.remove(id); StoredRecords.remove(id);
BauSystem.MESSAGE.send("TRACE_RECORD_DELETE", p); BauSystem.MESSAGE.send("TRACE_RECORD_DELETE", p);
} }
@Register("record") @Register(value = "record", noTabComplete = true)
public void recordList(Player p, int record) { public void recordList(Player p, int record) {
recordList(p, record, 0); recordList(p, record, 0);
} }
@Register("record") @Register(value = "record", noTabComplete = true)
public void recordList(Player player, int recordID, int page) { public void recordList(Player player, int recordID, int page) {
if (!permissionCheck(player)) return; if (!permissionCheck(player)) return;
Record traceRecord = StoredRecords.get(recordID); Record traceRecord = StoredRecords.get(recordID);
@ -180,7 +180,7 @@ public class TraceCommand extends SWCommand {
}); });
} }
@Register({"record", "tnt", "delete"}) @Register(value = {"record", "tnt", "delete"}, noTabComplete = true)
public void deleteRecordTNT(Player player, int recordID, int tntID) { public void deleteRecordTNT(Player player, int recordID, int tntID) {
if (!permissionCheck(player)) return; if (!permissionCheck(player)) return;
Record record = StoredRecords.get(recordID); Record record = StoredRecords.get(recordID);
@ -192,13 +192,13 @@ public class TraceCommand extends SWCommand {
BauSystem.MESSAGE.send("TRACE_TNT_DELETE", player); BauSystem.MESSAGE.send("TRACE_TNT_DELETE", player);
} }
@Register("record") @Register(value = "record", noTabComplete = true)
public void recordTNTPositions(Player player, int recordID, @Mapper("tnt") String tnt, int tntID) { public void recordTNTPositions(Player player, int recordID, @StaticValue("tnt") String tnt, int tntID) {
recordTNTPositions(player, recordID, tnt, tntID, 0); recordTNTPositions(player, recordID, tnt, tntID, 0);
} }
@Register("record") @Register(value = "record", noTabComplete = true)
public void recordTNTPositions(Player player, int recordID, @Mapper("tnt") String tnt, int tntID, int page) { public void recordTNTPositions(Player player, int recordID, @StaticValue("tnt") String tnt, int tntID, int page) {
if (!permissionCheck(player)) return; if (!permissionCheck(player)) return;
Record record = StoredRecords.get(recordID); Record record = StoredRecords.get(recordID);
if (record == null) { if (record == null) {
@ -225,8 +225,8 @@ public class TraceCommand extends SWCommand {
}); });
} }
@Register("record") @Register(value = "record", noTabComplete = true)
public void recordTNTPositions(Player player, int recordID, @Mapper("tnt") String tnt, int tntID, @Mapper("fuse") String fuse, int fuseTicks) { public void recordTNTPositions(Player player, int recordID, @StaticValue("tnt") String tnt, int tntID, @StaticValue("fuse") String fuse, int fuseTicks) {
if (!permissionCheck(player)) return; if (!permissionCheck(player)) return;
Record record = StoredRecords.get(recordID); Record record = StoredRecords.get(recordID);
if (record == null) { if (record == null) {
@ -361,40 +361,4 @@ public class TraceCommand extends SWCommand {
} }
return true; return true;
} }
@Mapper(value = "tnt", local = true)
public TypeMapper<String> tntTypeMapper() {
return new TypeMapper<String>() {
@Override
public String map(CommandSender commandSender, String[] previousArguments, String s) {
if (s.equals("tnt")) {
return "tnt";
}
return null;
}
@Override
public List<String> tabCompletes(CommandSender commandSender, String[] strings, String s) {
return Collections.singletonList("tnt");
}
};
}
@Mapper(value = "fuse", local = true)
public TypeMapper<String> fuseTypeMapper() {
return new TypeMapper<String>() {
@Override
public String map(CommandSender commandSender, String[] previousArguments, String s) {
if (s.equals("fuse")) {
return "fuse";
}
return null;
}
@Override
public List<String> tabCompletes(CommandSender commandSender, String[] strings, String s) {
return Collections.singletonList("fuse");
}
};
}
} }