MCPcopy Create free account
hub / github.com/MCSLTeam/MCSL2 / checkMemSet

Method checkMemSet

MCSL2Lib/ProgramControllers/serverValidator.py:49–79  ·  view source on GitHub ↗

检查内存设置

(self, minMem, maxMem, v: BaseServerVariables)

Source from the content-addressed store, hash-verified

47 return self.tr("Java 检查: 出错,缺失"), 1
48
49 def checkMemSet(self, minMem, maxMem, v: BaseServerVariables):
50 """检查内存设置"""
51 # 基岩版服务器不需要内存设置(不使用JVM)
52 if hasattr(v, 'serverType') and v.serverType == "bedrock":
53 v.minMem = 0
54 v.maxMem = 0
55 return self.tr("内存检查: 跳过(基岩版服务器)"), 0
56
57 # 是否为空
58 if minMem != "" and maxMem != "":
59 # 是否是数字
60 if minMem.isdigit() and maxMem.isdigit():
61 # 是否为整数
62 if not int(minMem) % 1 and not int(maxMem) % 1:
63 # 是否为整数
64 if int(minMem) <= int(minMem):
65 v.minMem = int(minMem)
66 v.maxMem = int(maxMem)
67 return self.tr("内存检查: 正常"), 0
68
69 else:
70 return (
71 self.tr("内存检查: 出错, 最小内存必须小于等于最大内存"),
72 1,
73 )
74 else:
75 return self.tr("内存检查: 出错, 不为整数"), 1
76 else:
77 return self.tr("内存检查: 出错, 不为数字"), 1
78 else:
79 return self.tr("内存检查: 出错, 内容为空"), 1
80
81 def checkCoreSet(self, v: BaseServerVariables):
82 """检查核心设置"""

Callers 1

checkMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected