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

Plugin specific problems will be solved here.

Moderator: Plugin Moderators

User avatar
Papijoldan
Settler
Reactions:
Posts: 4
Joined: 26 Jul 2022, 18:03

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

#1

Post 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"
}
]

User avatar
CommanderABab
AB
Reactions:
Posts: 11107
Joined: 07 Jun 2016, 21:12
Plugins: Showcase Store
Version: Beta

Plugin Creator

Platform

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

#2

Post 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.

User avatar
CommanderABab
AB
Reactions:
Posts: 11107
Joined: 07 Jun 2016, 21:12
Plugins: Showcase Store
Version: Beta

Plugin Creator

Platform

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

#3

Post 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.

User avatar
Papijoldan
Settler
Reactions:
Posts: 4
Joined: 26 Jul 2022, 18:03

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

#4

Post by Papijoldan »

Thank you, but how can I apply the carriage returns on my code ?

User avatar
CommanderABab
AB
Reactions:
Posts: 11107
Joined: 07 Jun 2016, 21:12
Plugins: Showcase Store
Version: Beta

Plugin Creator

Platform

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

#5

Post by CommanderABab »

Press the return key after each line. :)

User avatar
Papijoldan
Settler
Reactions:
Posts: 4
Joined: 26 Jul 2022, 18:03

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

#6

Post by Papijoldan »

I tried but still saying me error 🥲

Post Reply Previous topicNext topic

Return to “Problems”