mirror of
https://github.com/songoda/FabledSkyBlock.git
synced 2024-11-27 12:45:25 +01:00
Per-World Generators
This commit is contained in:
parent
93ee9d5092
commit
2892bd7192
@ -1,19 +1,22 @@
|
||||
package com.songoda.skyblock.generator;
|
||||
|
||||
import com.songoda.core.compatibility.CompatibleMaterial;
|
||||
|
||||
import com.songoda.skyblock.island.IslandWorld;
|
||||
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class Generator {
|
||||
|
||||
private String name;
|
||||
private IslandWorld isWorld;
|
||||
private CompatibleMaterial materials;
|
||||
private List<GeneratorMaterial> generatorMaterials;
|
||||
private boolean permission;
|
||||
|
||||
public Generator(String name, CompatibleMaterial materials, List<GeneratorMaterial> generatorMaterials, boolean permission) {
|
||||
public Generator(String name, IslandWorld isWorld, CompatibleMaterial materials, List<GeneratorMaterial> generatorMaterials, boolean permission) {
|
||||
this.name = name;
|
||||
this.isWorld = isWorld;
|
||||
this.materials = materials;
|
||||
this.generatorMaterials = generatorMaterials;
|
||||
this.permission = permission;
|
||||
@ -23,6 +26,10 @@ public class Generator {
|
||||
return name;
|
||||
}
|
||||
|
||||
public IslandWorld getIsWorld() {
|
||||
return isWorld;
|
||||
}
|
||||
|
||||
public CompatibleMaterial getMaterials() {
|
||||
return materials;
|
||||
}
|
||||
|
@ -4,7 +4,8 @@ import com.songoda.core.compatibility.CompatibleMaterial;
|
||||
import com.songoda.core.compatibility.CompatibleSound;
|
||||
import com.songoda.skyblock.SkyBlock;
|
||||
import com.songoda.skyblock.config.FileManager.Config;
|
||||
|
||||
|
||||
import com.songoda.skyblock.island.IslandWorld;
|
||||
import com.songoda.skyblock.utils.version.NMSUtil;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
@ -56,6 +57,7 @@ public class GeneratorManager {
|
||||
}
|
||||
|
||||
generatorStorage.add(new Generator(configLoad.getString("Generators." + generatorList + ".Name"),
|
||||
IslandWorld.valueOf(configLoad.getString("Generators." + generatorList + ".World", "Normal")),
|
||||
oreMaterials[rnd.nextInt(oreMaterials.length)], generatorMaterials,
|
||||
configLoad.getBoolean("Generators." + generatorList + ".Permission")));
|
||||
}
|
||||
@ -150,10 +152,10 @@ public class GeneratorManager {
|
||||
return CompatibleMaterial.COBBLESTONE;
|
||||
}
|
||||
|
||||
public void addGenerator(String name, List<GeneratorMaterial> generatorMaterials, boolean permission) {
|
||||
public void addGenerator(String name, IslandWorld isWorld, List<GeneratorMaterial> generatorMaterials, boolean permission) {
|
||||
CompatibleMaterial[] oreMaterials = new CompatibleMaterial[]{CompatibleMaterial.COAL, CompatibleMaterial.CHARCOAL, CompatibleMaterial.DIAMOND,
|
||||
CompatibleMaterial.IRON_INGOT, CompatibleMaterial.GOLD_INGOT, CompatibleMaterial.EMERALD};
|
||||
generatorStorage.add(new Generator(name, oreMaterials[new Random().nextInt(oreMaterials.length)],
|
||||
generatorStorage.add(new Generator(name, isWorld, oreMaterials[new Random().nextInt(oreMaterials.length)],
|
||||
generatorMaterials, permission));
|
||||
}
|
||||
|
||||
|
@ -7,6 +7,7 @@ import com.songoda.skyblock.config.FileManager;
|
||||
import com.songoda.skyblock.config.FileManager.Config;
|
||||
import com.songoda.skyblock.generator.GeneratorManager;
|
||||
import com.songoda.skyblock.generator.GeneratorMaterial;
|
||||
import com.songoda.skyblock.island.IslandWorld;
|
||||
import com.songoda.skyblock.message.MessageManager;
|
||||
import com.songoda.skyblock.placeholder.Placeholder;
|
||||
import com.songoda.skyblock.playerdata.PlayerData;
|
||||
@ -277,7 +278,7 @@ public class Generator implements Listener {
|
||||
configLoad.getString("Island.Admin.Generator.Characters.Message"));
|
||||
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
|
||||
} else {
|
||||
generatorManager.addGenerator(event1.getName(), new ArrayList<>(), false);
|
||||
generatorManager.addGenerator(event1.getName(), IslandWorld.Normal, new ArrayList<>(), false);
|
||||
|
||||
messageManager.sendMessage(player,
|
||||
configLoad.getString("Island.Admin.Generator.Created.Message")
|
||||
|
@ -1,6 +1,7 @@
|
||||
Generators:
|
||||
Default:
|
||||
Name: Default
|
||||
Normal:
|
||||
Name: Normal
|
||||
World: Normal
|
||||
Permission: false
|
||||
Materials:
|
||||
COBBLESTONE:
|
||||
@ -14,4 +15,22 @@ Generators:
|
||||
EMERALD_ORE:
|
||||
Chance: 5.5
|
||||
DIAMOND_ORE:
|
||||
Chance: 2.5
|
||||
Chance: 2.5
|
||||
Nether:
|
||||
Name: Nether
|
||||
World: Nether
|
||||
Permission: false
|
||||
Materials:
|
||||
NETHERRACK:
|
||||
Chance: 80
|
||||
GLOWSTONE:
|
||||
Chance: 10.0
|
||||
QUARTZ_ORE:
|
||||
Chance: 10.0
|
||||
End:
|
||||
Name: End
|
||||
World: End
|
||||
Permission: false
|
||||
Materials:
|
||||
END_STONE:
|
||||
Chance: 100.0
|
Loading…
Reference in New Issue
Block a user