AY 4 年之前
父节点
当前提交
f9bee7de22
共有 4 个文件被更改,包括 26 次插入20 次删除
  1. 18 12
      main.go
  2. 2 2
      mod/config/ops.go
  3. 4 4
      mod/config/properties.go
  4. 2 2
      mod/config/whitelist.go

+ 18 - 12
main.go

@@ -14,20 +14,26 @@ import (
 
 func main() {
 	mcs := config.NewHandler("./server/")
+
+	p := mcs.ReadAllProperties()
+	fmt.Println(p)
+
+	mcs.ChangeProperties("max-players", "99")
+	p = mcs.ReadAllProperties()
+	fmt.Println(p)
+
 	/*
-	   p := mcs.ReadProperties()
-	   fmt.Println(p)
-	   q := mcs.ReadBannedIP()
-	   fmt.Println(q)
-	   r := mcs.ReadBannedPlayer()
-	   fmt.Println(r)
-	   s := mcs.ReadOps()
-	   fmt.Println(s)
-	   t := mcs.ReadWhitelist()
-	   fmt.Println(t)
+		q := mcs.ReadAllBannedIPs()
+		fmt.Println(q)
+		r := mcs.ReadAllBannedPlayers()
+		fmt.Println(r)
+		s := mcs.ReadAllOps()
+		fmt.Println(s)
+		t := mcs.ReadAllWhitelists()
+		fmt.Println(t)
+		u := mcs.ReadEULA()
+		fmt.Println(u)
 	*/
-	u := mcs.ReadEULA()
-	fmt.Println(u)
 	/*
 		cmdName := "java -Xmx1024M -Xms1024M -jar server.jar nogui"
 		cmdArgs := strings.Fields(cmdName)

+ 2 - 2
mod/config/ops.go

@@ -21,8 +21,8 @@ func initOps(serverFolder string) Op {
 	return dataArray
 }
 
-//ReallAllOps is exported function
-func (mch *Handler) ReallAllOps() Op {
+//ReadAllOps is exported function
+func (mch *Handler) ReadAllOps() Op {
 	return mch.ops
 }
 

+ 4 - 4
mod/config/properties.go

@@ -32,13 +32,13 @@ func initProperties(serverFolder string) []ServerConfig {
 	return properties
 }
 
-//ReallAllProperties is exported function
-func (mch *Handler) ReallAllProperties() []ServerConfig {
+//ReadAllProperties is exported function
+func (mch *Handler) ReadAllProperties() []ServerConfig {
 	return mch.properties
 }
 
-//ChangetProperties is exported function
-func (mch *Handler) ChangetProperties(inputValue string, inputKey string) bool {
+//ChangeProperties is exported function
+func (mch *Handler) ChangeProperties(inputKey string, inputValue string) bool {
 	for _, item := range mch.properties {
 		if strings.ToLower(inputKey) == strings.ToLower(item.key) {
 			item.value = inputValue

+ 2 - 2
mod/config/whitelist.go

@@ -20,8 +20,8 @@ func initWhitelist(serverFolder string) Whitelist {
 	return dataArray
 }
 
-//ReallAllWhitelists is exported function
-func (mch *Handler) ReallAllWhitelists() Whitelist {
+//ReadAllWhitelists is exported function
+func (mch *Handler) ReadAllWhitelists() Whitelist {
 	return mch.whitelists
 }