Compare commits
4 Commits
BauSystem/
...
schematic-
| Author | SHA1 | Date | |
|---|---|---|---|
| 6d801e473c | |||
| e17ba8bdcb | |||
| a21760003e | |||
| 9ba8a83a3b |
@@ -466,6 +466,16 @@ public class SchematicNode {
|
||||
setConfig(ConfigFlags.IS_PREPARED, prepared);
|
||||
}
|
||||
|
||||
public boolean isInvestigation() {
|
||||
return getConfig(ConfigFlags.INVESTIGATION);
|
||||
}
|
||||
|
||||
public void setInvestigation(boolean investigation) {
|
||||
if (isDir())
|
||||
throw new SecurityException("Is Directory");
|
||||
setConfig(ConfigFlags.INVESTIGATION, investigation);
|
||||
}
|
||||
|
||||
public boolean getConfig(ConfigFlags flag) {
|
||||
return (config & (1 << flag.ordinal())) != 0;
|
||||
}
|
||||
@@ -629,6 +639,7 @@ public class SchematicNode {
|
||||
public static enum ConfigFlags {
|
||||
REPLACE_COLOR,
|
||||
ALLOW_REPLAY,
|
||||
IS_PREPARED
|
||||
IS_PREPARED,
|
||||
INVESTIGATION,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -125,7 +125,7 @@ public class GUI {
|
||||
}).setCustomModelData(CMDs.Schematic.BACK));
|
||||
|
||||
if(node.getOwner() == user.getId()){
|
||||
if(!node.isDir() && node.getSchemtype().writeable()){
|
||||
if(!node.isDir() && node.getSchemtype().writeable() && !node.isInvestigation()){
|
||||
CheckedSchematic.getLastDeclinedOfNode(node.getId()).stream().findFirst().ifPresent(checkedSchematic ->
|
||||
inv.setItem(1, SWItem.getDye(10), (byte) 10, SchematicSystem.MESSAGE.parse("GUI_INFO_STATUS", player, node.getSchemtype().name()), Collections.singletonList(SchematicSystem.MESSAGE.parse("GUI_INFO_STATUS_LORE", player, checkedSchematic.getDeclineReason().replaceAll("&", "§"))), false, click -> {}));
|
||||
}
|
||||
|
||||
@@ -251,7 +251,9 @@ public class SchematicCommandUtils {
|
||||
}
|
||||
|
||||
SchematicSystem.MESSAGE.sendPrefixless("UTIL_INFO_FORMAT", player, node.getFileEnding());
|
||||
CheckedSchematic.getLastDeclinedOfNode(node.getId()).stream().findFirst().ifPresent(checkedSchematic -> SchematicSystem.MESSAGE.sendPrefixless("UTIL_INFO_STATUS", player, checkedSchematic.getEndTime(), checkedSchematic.getDeclineReason()));
|
||||
if (!node.isInvestigation()) {
|
||||
CheckedSchematic.getLastDeclinedOfNode(node.getId()).stream().findFirst().ifPresent(checkedSchematic -> SchematicSystem.MESSAGE.sendPrefixless("UTIL_INFO_STATUS", player, checkedSchematic.getEndTime(), checkedSchematic.getDeclineReason()));
|
||||
}
|
||||
} else {
|
||||
SchematicSystem.MESSAGE.sendPrefixless("UTIL_INFO_TYPE", player, SchematicSystem.MESSAGE.parse("UTIL_INFO_TYPE_DIR", player));
|
||||
}
|
||||
|
||||
@@ -319,6 +319,7 @@ CHECK_LIST_CHECKING_HOVER=§eTo the reviewer
|
||||
CHECK_SCHEMATIC_ALREADY_CHECKING=§cYou are already reviewing a schematic!
|
||||
CHECK_SCHEMATIC_OWN=§cYou cannot review your own schematics.
|
||||
CHECK_SCHEMATIC_OWN_TEAM=§cYou cannot review your team schematics.
|
||||
CHECK_SCHEMATIC_INVESTIGATION_PENDING=§cThis schematic is currently under investigation
|
||||
CHECK_SCHEMATIC_PREVIOUS=§7{0} from {1}§8: §e{2}
|
||||
CHECK_INVALID_RANK=§cUnknown schematic rank.
|
||||
CHECK_ABORT=§aThe test operation was canceled!
|
||||
|
||||
@@ -301,6 +301,7 @@ CHECK_LIST_CHECKING_HOVER=§eZum Prüfer
|
||||
CHECK_SCHEMATIC_ALREADY_CHECKING=§cDu prüfst schon eine Schematic!
|
||||
CHECK_SCHEMATIC_OWN=§cDu kannst nicht deine eigenen Schematics prüfen.
|
||||
CHECK_SCHEMATIC_OWN_TEAM=§cDu kannst nicht Schematics deines Teams prüfen.
|
||||
CHECK_SCHEMATIC_INVESTIGATION_PENDING=§cDiese Schematic wird grade untersucht!
|
||||
CHECK_SCHEMATIC_PREVIOUS=§7{0} von {1}§8: §e{2}
|
||||
CHECK_INVALID_RANK=§cUnbekannter Schematicrang.
|
||||
CHECK_ABORT=§aDer Prüfvorgang wurde abgebrochen!
|
||||
|
||||
@@ -99,11 +99,13 @@ public class CheckCommand extends SWCommand {
|
||||
for (SchematicNode schematic : schematicList) {
|
||||
CheckSession current = currentSchems.get(schematic.getId());
|
||||
if (current == null) {
|
||||
boolean isInvestigation = schematic.isInvestigation();
|
||||
|
||||
sender.prefixless("CHECK_LIST_TO_CHECK",
|
||||
new Message("CHECK_LIST_TO_CHECK_HOVER"),
|
||||
ClickEvent.runCommand("/check schematic " + schematic.getId()),
|
||||
isInvestigation ? new Message("PLAIN_STRING", CheckedSchematic.getLastDeclinedOfNode(schematic.getId()).stream().map(CheckedSchematic::getDeclineReason).findFirst().orElse("")) : new Message("CHECK_LIST_TO_CHECK_HOVER"),
|
||||
isInvestigation ? ClickEvent.suggestCommand("") : ClickEvent.runCommand("/check schematic " + schematic.getId()),
|
||||
getWaitTime(schematic),
|
||||
schematic.getSchemtype().getKuerzel(), SteamwarUser.get(schematic.getOwner()).getUserName(), schematic.getName());
|
||||
schematic.getSchemtype().getKuerzel(), SteamwarUser.get(schematic.getOwner()).getUserName(), (isInvestigation ? "§c" : "") + schematic.getName());
|
||||
} else {
|
||||
sender.prefixless("CHECK_LIST_CHECKING",
|
||||
new Message("CHECK_LIST_CHECKING_HOVER"),
|
||||
@@ -130,6 +132,10 @@ public class CheckCommand extends SWCommand {
|
||||
return;
|
||||
}
|
||||
|
||||
if(schem.isInvestigation() && !sender.user().hasPerm(UserPerm.MODERATION)) {
|
||||
sender.system("CHECK_SCHEMATIC_INVESTIGATION_PENDING");
|
||||
}
|
||||
|
||||
int playerTeam = sender.user().hasPerm(UserPerm.MODERATION) ? 0 : sender.user().getTeam();
|
||||
if (playerTeam != 0 && SteamwarUser.get(schem.getOwner()).getTeam() == playerTeam) {
|
||||
sender.system("CHECK_SCHEMATIC_OWN_TEAM");
|
||||
@@ -181,6 +187,22 @@ public class CheckCommand extends SWCommand {
|
||||
currentCheckers.get(sender.getPlayer().getUniqueId()).decline(String.join(" ", message));
|
||||
}
|
||||
|
||||
@Register(value = "block")
|
||||
public void investigate(PlayerChatter sender, String... message) {
|
||||
if(notChecking(sender.getPlayer()))
|
||||
return;
|
||||
|
||||
currentCheckers.get(sender.getPlayer().getUniqueId()).investigate(String.join(" ", message));
|
||||
}
|
||||
|
||||
@Register(value = "unblock")
|
||||
public void uninvestigate(PlayerChatter sender) {
|
||||
if(notChecking(sender.getPlayer()))
|
||||
return;
|
||||
|
||||
currentCheckers.get(sender.getPlayer().getUniqueId()).unblock();
|
||||
}
|
||||
|
||||
public static List<SchematicNode> getSchemsToCheck(){
|
||||
List<SchematicNode> schematicList = new ArrayList<>();
|
||||
|
||||
@@ -223,7 +245,7 @@ public class CheckCommand extends SWCommand {
|
||||
currentCheckers.put(checker.user().getUUID(), this);
|
||||
currentSchems.put(schematic.getId(), this);
|
||||
|
||||
for(CheckedSchematic previous : CheckedSchematic.previousChecks(schematic))
|
||||
for(CheckedSchematic previous : CheckedSchematic.getLastDeclinedOfNode(schematic.getId()))
|
||||
checker.prefixless("CHECK_SCHEMATIC_PREVIOUS", previous.getEndTime(), SteamwarUser.get(previous.getValidator()).getUserName(), previous.getDeclineReason());
|
||||
next();
|
||||
}).start();
|
||||
@@ -309,7 +331,9 @@ public class CheckCommand extends SWCommand {
|
||||
private void concludeCheckSession(String reason, SchematicType type, BooleanSupplier sendMessageIsOnline) {
|
||||
if(SchematicNode.getSchematicNode(schematic.getId()) != null) {
|
||||
CheckedSchematic.create(schematic, checker.user().getId(), startTime, Timestamp.from(Instant.now()), reason, sendMessageIsOnline.getAsBoolean());
|
||||
|
||||
if(type != null) {
|
||||
schematic.setInvestigation(false);
|
||||
schematic.setSchemtype(type);
|
||||
if (type == SchematicType.Normal) {
|
||||
schematic.setPrepared(false);
|
||||
@@ -329,5 +353,15 @@ public class CheckCommand extends SWCommand {
|
||||
currentCheckers.remove(checker.user().getUUID());
|
||||
currentSchems.remove(schematic.getId());
|
||||
}
|
||||
|
||||
public void investigate(String reason) {
|
||||
schematic.setInvestigation(true);
|
||||
concludeCheckSession(reason, null, () -> true);
|
||||
}
|
||||
|
||||
public void unblock() {
|
||||
schematic.setInvestigation(false);
|
||||
CheckedSchematic.create(schematic, checker.user().getId(), startTime, Timestamp.from(Instant.now()), "", true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user