Suggestions for a better Config structure

Discussion in 'Plugin Development' started by Eistee², Dec 24, 2013.

Thread Status:
Not open for further replies.
  1. Offline

    Eistee²

    Hello,
    I currently rewrite my plugin MineBuilder again and I had many crapy code to read the Settings etc. my old config looks like this:


    ExpConfig:
    Code:
    Config Version:1.3
    # When you use levels it will change the percentage so when you are lvl 10 yo will get 10% percent more exp each block
    # ItemID;1:5:10 here you will get 5$ after breaking/placeing 10 blocks of Stone (ID 1)
    # You can Write the name of the block under or over it but NEVER write it all upercase may its written like in Minecraft and then it throws errors
    # you can use randoms like this ItemID:01:lowexp:10 it will give you a amount of between 5-10 you can add randoms the name does not matter
    # You can add every block! you need to make it like this :
    #
    #ItemID;BlockID:EXP:How many blocks to break/place
     
    --------------------- /*
    Levels:                      * get Ignored
    ---------------------  */
    Use Level:true
    MAXlvl:200
    lvl1:0
    lvl10:10
    lvl20:20
    lvl30:30
     
    ---------------------
    Randoms:
    ---------------------
    lowexp;5:10
    highexp;10:15
    random;1:100
     
    ---------------------
    Break Block:
    ---------------------
    Stone // Gets ignored just for Users so he doesn't need to search what kind of block the ID is
    ItemID;1:10:5
     
    Grass
    ItemID;2:5:5
     
    Dirt
    ItemID;3:5:5
     
    Cobble Stone
    ItemID;4:10:5
     
    Sand
    ItemID;12:5:5
     
    Gravel
    ItemID;13:5:5
     
    Gold Ore
    ItemID;14:15:5
     
    Iron Ore
    ItemID;15:12:5
     
    Coal Ore
    ItemID;16:5:5
     
    Log
    ItemID;17:5:5
     
    Lapis Ore
    ItemID;15:10:5
     
    Sand Stone
    ItemID;24:5:5
     
    Moss Stone
    ItemID;48:5:5
     
    Obsidian
    ItemID;49:5:1
     
    Diamond Ore
    ItemID;56:6:1
     
    Redstone Ore
    ItemID;73:2:1
     
    Redstone Ore (Glowing)
    ItemID;74:2:1
     
    Clay
    ItemID;82:1:1
     
    Netherrack
    ItemID;87:5:5
     
    Soulsand
    ItemID;88:5:5
     
    Glowstone
    ItemID;89:5:5
     
    Silverfish Stone
    ItemID;97:2:1
     
    Myzelium
    ItemID;110:1:1
     
    Nether Brick
    ItemID;112:5:5
     
    End Stone
    ItemID;121:5:5
     
    Emerald
    ItemID;129:7:1
     
    ---------------------
    Place Block:
    ---------------------
    Dirt
    ItemID;3:1:5
     
    Wood
    ItemID;17:1:5
     
    Wooden Planks
    ItemID;5:1:5
     
    Wool
    ItemID;35:1:5
     
    Stone
    ItemID;1:1:5
     
    Cobblestone
    ItemID;4:1:5
     
    Glass
    ItemID;20:1:5
     
    Glass Pane
    ItemID;102:1:5
     
    Netherrack
    ItemID;87:1:5
     
    Glowstone
    ItemID;89:1:5
     
    Soul Sand
    ItemID;88:1:5
     
    Stone bricks
    ItemID;98:1:5
     
    Fence
    ItemID;85:1:5
     
    Fence Gate
    ItemID;107:1:5
     
    Nether Brick Fence
    ItemID;113:1:5
     
    Nether Brick
    ItemID;112:1:5
     
    Nether Brick Stairs
    ItemID;114:1:5
     
    Wood Stairs
    ItemID;53:1:5
     
    Cobblestone Stairs
    ItemID;67:1:5
     
    Brick Stairs
    ItemID;108:1:5
     
    Stone Brick Stairs
    ItemID;109:1:5
     
    Obsidian
    ItemID;49:1:5
     
    Cobblestone Wall
    ItemID;139:1:2
     
    Flower pot
    ItemID;140:1:4
     
    ---------------------
    Slain Mobs:
    ---------------------
     
    # Friendly
    ItemID;SnowMan:0:1
    ItemID;Wolf:0:1
    ItemID;Ozelot:0:1
     
    # Passive
    ItemID;Pig:1:1
    ItemID;Sheep:1:1
    ItemID;Cow:1:1
    ItemID;Chicken:1:1
    ItemID;Squid:1:1
    ItemID;MooshroomCow:1:1
    ItemID;Villager:1:1
     
    # Neutral
    ItemID;IronGolem:10:1
    ItemID;Enderman:7:1
     
    # Agressive
    ItemID;Zombie:5:1
    ItemID;Skeleton:5:1
    ItemID;Spider:5:1
    ItemID;Creeper:5:1
    ItemID;Slime:3:1
    ItemID;CaveSpider:5:1
    ItemID;Silverfish:5:1
    ItemID;Witch:5:1
     
    # Nether
    ItemID;Ghast:10:1
    ItemID;LavaSlime:7:1
    ItemID;Blaze:7:1
    ItemID;PigZombie:5:1
    ItemID;WitherSkeleton:5:1
     
    # Boss
    ItemID;Giant:50:1
    ItemID;EnderDragon:500:1
    ItemID;Wither:50:1
     
    ---------------------
    Fishing:
    ---------------------
     
    ItemID;Fish:1:1
     
    --------------------
    Smelting:         
    --------------------
     
    Iron Ingot
    ItemID;265:5:8
     
    Gold Ingot
    ItemID;266:4:5
     
    Cooked Porkchop
    ItemID;320:1:5
     
    Cooked Fish
    ItemID;350:1:5
     
    Glass
    ItemID;20:1:3
     
    Charcoal
    ItemID;263:1:8
     
    Cactus green
    ItemID;351:1:5
     
    Brick
    ItemID;336:1:1
     
    Stone
    ItemID;1:1:10
    Settings:
    Code:
    Setting Version:1.4.1
    ---------------------
    MAXplayer:200
    MAXblocksaved:1000
    Save Blocks to file on server reload/stop:false
    Block save intervall in minutes:5
    Use Permissions:false
    Vip percentage:0
    ---------------------
    Give Exp:true
    (general option)
    Use MinerExp:true
    Use BuilderExp:true
    Use FishingExp:true
    Use MobExp:true
    Use SmeltingExp:true
     
    Spawn ExpOrbs for break Blocks:true
    Spawn ExpOrbs for place Blocks:false
    ---------------------
    Give Money:false
    (general option)
    Use MinerMoney:true
    Use BuilderMoney:true
    Use FishingMoney:true
    Use MobMoney:true
    Use SmeltingMoney:true
    My Question:
    How can i make the ExpConfig and Settings easier to read and easier to find the right segements in the plugin Code?
    (I'm fairly new to Programming, I taught it all by myself and so i'm not really good in optimating something like this)

    Like
    1. s.o. has break a block
    2. look up in ExpConfig if this block is in it,get amount, reward (tons of loops because of spliting always again (i've loaded the config into an ArrayList))
    3. give the player the reward (or not)

    in the Old version I had tons of loops and many,I probably think, are unnecessary when I've got a better structure.


    Thanks for everyone who have a suggestions (may a little exampel just to get me thinking about it which would really help me a lot!)

    Sincerely Eistee²

    Sorry for my englisch, I know it isn't the best but I try to get better :D
     
  2. Offline

    Necrodoom

    Moved to correct section.
     
    Eistee² likes this.
Thread Status:
Not open for further replies.

Share This Page