Minecraft

Copy and paste optimization and GUI help

Submitted by SkyCrafting_, , Thread ID: 159719

Thread Closed
23-02-2020, 05:31 PM
#1
Hello. I have ran into a problem with my code. I have A TON of copy and paste and its related to GUI creation. I want to know how I can optimize this so I dont have 200 lines of copy and paste. My goal is to create a GUI that is customizable through a config. I had no issues in the past, but I got help from someone and they changed my config to:
shop:
items:
MATERIAL
command: <command>
price: <price>
Which has me confused because before I had my config:
shop:
to:
item:
itemZero: MATERIAL
itemZeroPrice: <price>
commands:
to:
command:
commandZero: <command>
Which made it easier but was a lot harder to read and a bunch of copy and paste. So, I want to know how I can optimize my code since before it was a bunch of copy and paste (which is related to my config issue). I have attached the two files, Core, which has the code that I got help with. I want it to be similar to that. And Commands, which I need help with. In short, I need help with changing my code so that it works with the new config and also how to optimize it so that it isnt a bunch of copy and paste. Thanks! Sorry if this was confusing

EDIT: cant post my code will do that in reply.

Users browsing this thread: 2 Guest(s)