Page 1 of 1

[Asked][1.10.63a] Plugin crash (center .json:426)

Posted: 26 Jul 2022, 18:05
by Papijoldan
Hi, I got the following error with a plugin (center .json:426):

Code: Select all

In plugins/sample/center .json:

java.lang.IllegalStateException: When loading "$invstcentr0": Value [{"id":"$center.upgrade2","title":"Office upgrade","text":"Improve trades and unlock gun industry ","frames":[{"bmp":"fhotel.png"}],"price":250000,"monthly price":100,"power":-20,"water":-10,"build time":300,"influence management":10}] at 1 of type io.blueflower.stapel2d.util.json.JSONArray cannot be converted to JSONObject
Thank you in advance.

Entire code:
[
{
"id":"$invstcentr0",
"type":"public",
"author":"papiJoldan",
"width":2,
"height":2,
"frames":[
{
"bmp":"fhotel.png"
}
],
"price":1000000,
"workers":20,
"influence noise":10,
"build time":600,
"requirement":{
"requirements":[
{
"type":"RANK",
"data":{
"lvl":30
}
}
]
},
"upgrades":[
{
"id":"$center.upgrade",
"title":"Radio Upgrade",
"text":"Help organization with buildings",
"frames":[
{
"bmp":"fhotel.png"
}
],
"price":500000,
"monthly price":200,
"power":-50,
"water":-50,
"build time":200,
"influence management":20
},
[
{
"id":"$center.upgrade2",
"title":"Office upgrade",
"text":"Improve trades and unlock gun industry ",
"frames":[
{
"bmp":"fhotel.png"
}
],
"price":250000,
"monthly price":100,
"power":-20,
"water":-10,
"build time":300,
"influence management":10
}
]
],
"title":"Investigation Centre",
"text":"Investigation of buildings"
}
]

Re: [Asked][1.10.63a] Plugin crash (center .json:426)

Posted: 26 Jul 2022, 19:45
by CommanderABab

Code: Select all

[{
	"id": "$invstcentr0",
	"type": "public",
	"author": "papiJoldan",
	"width": 2,
	"height": 2,
	"frames": [{
		"bmp": "fhotel.png"
	}],
	"price": 1000000,
	"workers": 20,
	"influence noise": 10,
	"build time": 600,
	"requirement": {
		"requirements": [{
			"type": "RANK",
			"data": {
				"lvl": 30
			}
		}]
	},
	"upgrades": [{
			"id": "$center.upgrade",
			"title": "Radio Upgrade",
			"text": "Help organization with buildings",
			"frames": [{
				"bmp": "fhotel.png"
			}],
			"price": 500000,
			"monthly price": 200,
			"power": -50,
			"water": -50,
			"build time": 200,
			"influence management": 20
		},
		[{
			"id": "$center.upgrade2",
			"title": "Office upgrade",
			"text": "Improve trades and unlock gun industry ",
			"frames": [{
				"bmp": "fhotel.png"
			}],
			"price": 250000,
			"monthly price": 100,
			"power": -20,
			"water": -10,
			"build time": 300,
			"influence management": 10
		}]
	],
	"title": "Investigation Centre",
	"text": "Investigation of buildings"
}]

Code: Select all    Reset

[{ "id": "$invstcentr0", "type": "public", "author": "papiJoldan", "width": 2, "height": 2, "frames": [{ "bmp": "fhotel.png" }], "price": 1000000, "workers": 20, "influence noise": 10, "build time": 600, "requirement": { "requirements": [{ "type": "RANK", "data": { "lvl": 30 } }] }, "upgrades": [{ "id": "$center.upgrade", "title": "Radio Upgrade", "text": "Help organization with buildings", "frames": [{ "bmp": "fhotel.png" }], "price": 500000, "monthly price": 200, "power": -50, "water": -50, "build time": 200, "influence management": 20 }, [{ "id": "$center.upgrade2", "title": "Office upgrade", "text": "Improve trades and unlock gun industry ", "frames": [{ "bmp": "fhotel.png" }], "price": 250000, "monthly price": 100, "power": -20, "water": -10, "build time": 300, "influence management": 10 }] ], "title": "Investigation Centre", "text": "Investigation of buildings" }]
JSON checker
Check
Is also valid.

Re: [Asked][1.10.63a] Plugin crash (center .json:426)

Posted: 26 Jul 2022, 19:51
by CommanderABab
Maybe you should include carriage returns and not have the entire code on one line. You might be exceeding the number of characters the parser uses for storage.

Re: [Asked][1.10.63a] Plugin crash (center .json:426)

Posted: 26 Jul 2022, 23:37
by Papijoldan
Thank you, but how can I apply the carriage returns on my code ?

Re: [Asked][1.10.63a] Plugin crash (center .json:426)

Posted: 27 Jul 2022, 04:44
by CommanderABab
Press the return key after each line. :)

Re: [Asked][1.10.63a] Plugin crash (center .json:426)

Posted: 27 Jul 2022, 09:33
by Papijoldan
I tried but still saying me error 🥲