MCPcopy Create free account
hub / github.com/e2wugui/zeze / setSeed

Method setSeed

ZezeJava/ZezeJava/src/main/java/Zeze/Component/AutoKey.java:152–166  ·  view source on GitHub ↗

设置当前serverId的种子,新种子必须比当前值大。 @param seed new seed. @return true if success.

(long seed)

Source from the content-addressed store, hash-verified

150 * @return true if success.
151 */
152 public boolean setSeed(long seed) {
153 try {
154 return Procedure.Success == Task.runUnsafe(module.zeze.newProcedure(() -> {
155 var seedKey = new BSeedKey(module.zeze.getConfig().getServerId(), name);
156 var bAutoKey = module._tAutoKeys.getOrAdd(seedKey);
157 if (seed > bAutoKey.getNextId()) {
158 bAutoKey.setNextId(seed);
159 return 0;
160 }
161 return Procedure.LogicError;
162 }, "AutoKey.setSeed"), DispatchMode.Critical).get();
163 } catch (InterruptedException | ExecutionException e) {
164 throw Task.forceThrow(e);
165 }
166 }
167
168 /**
169 * 设置当前serverId的种子,新种子必须比当前值大。

Callers 4

setMinIdMethod · 0.95
testEncryptDecrypt2Method · 0.45
mainMethod · 0.45
runJobsMethod · 0.45

Calls 9

runUnsafeMethod · 0.95
forceThrowMethod · 0.95
setNextIdMethod · 0.80
getMethod · 0.65
getServerIdMethod · 0.65
getNextIdMethod · 0.65
newProcedureMethod · 0.45
getConfigMethod · 0.45
getOrAddMethod · 0.45

Tested by 3

testEncryptDecrypt2Method · 0.36
mainMethod · 0.36
runJobsMethod · 0.36