Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/v6' into v6
Browse files Browse the repository at this point in the history
  • Loading branch information
CaaMoe committed Jul 21, 2024
2 parents e154e28 + 1c27b6c commit 13e3964
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
* 二次确认快处工具
*/
public class SecondaryConfirmationHandler {
private static final long confirmValidTimeMillis = 1000 * 15;
private final Map<IPlayer, ConfirmEntry> concurrentHashMap = new ConcurrentHashMap<>();
private final AtomicReference<ConfirmEntry> consoleConfirm = new AtomicReference<>();

Expand Down Expand Up @@ -83,7 +82,7 @@ private ConfirmEntry(CallbackConfirmCommand callbackConfirmCommand) {
}

private boolean isInvalid() {
return subTime + confirmValidTimeMillis < System.currentTimeMillis();
return subTime + CommandHandler.getCore().getPluginConfig().getConfirmCommandValidTimeMills() < System.currentTimeMillis();
}

public void confirm() throws Exception {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ public class PluginConfig {
private boolean welcomeMsg;
@Getter
private Map<Integer, BaseServiceConfig> serviceIdMap = new HashMap<>();
@Getter
private long confirmCommandValidTimeMills;

public PluginConfig(File dataFolder, MultiCore core) {
this.dataFolder = dataFolder;
Expand Down Expand Up @@ -101,6 +103,7 @@ public void reload() throws IOException, URISyntaxException {
welcomeMsg = configConfigurationNode.node("welcomeMsg").getBoolean(true);
nameCorrect = configConfigurationNode.node("nameCorrect").getBoolean(true);
autoNameChange = configConfigurationNode.node("autoNameChange").getBoolean(true);
confirmCommandValidTimeMills = configConfigurationNode.node("confirmCommandValidTimeMills").getLong(15000);

Map<Integer, BaseServiceConfig> idMap = new HashMap<>();
try (Stream<Path> list = Files.list(servicesFolder.toPath())) {
Expand Down
5 changes: 5 additions & 0 deletions core/src/main/resources/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@ nameCorrect: true
# 默认值 true
autoNameChange: true

# 风险指令二次确认过期时间设置
#
# 默认值 15000
confirmCommandValidTimeMills: 15000

# 插件数据设置
sql:

Expand Down
15 changes: 15 additions & 0 deletions core/src/main/resources/examples/elyby.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Below, only the most basic configuration is provided.
# You can refer to the template file to complete all configurations.

# Please edit before use.
id: -1

name: 'ely.by'

# Don't change it unless you really want to.
serviceType: CUSTOM_YGGDRASIL
yggdrasilAuth:
custom:
method: 'GET'
url: 'https://authserver.ely.by/session/hasJoined?username={0}&serverId={1}{2}'
trackIpContent: '&ip={0}'
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
plugin_version=0.6.7
org.gradle.jvmargs=-Xmx1024m
plugin_version=0.6.10
org.gradle.jvmargs=-Xmx1024m
2 changes: 1 addition & 1 deletion latest
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.6.8
0.6.10

0 comments on commit 13e3964

Please sign in to comment.