Implemented config-option id

master
Ruakij 4 years ago
parent 982190b730
commit 7e6601d56d

@ -11,6 +11,8 @@ import java.util.List;
* Describes a placed-beacon-teleporter in the world * Describes a placed-beacon-teleporter in the world
*/ */
public abstract class LinkedBeaconTeleporter { public abstract class LinkedBeaconTeleporter {
static String id_alphabet = "abcdefghijklmnopqrstuvwxyz0123456789";
static int id_length = 10;
// Persistent id for linked-beacons // Persistent id for linked-beacons
public String teleporterId; public String teleporterId;
@ -19,7 +21,7 @@ public abstract class LinkedBeaconTeleporter {
protected List<LinkedBeaconTeleporter> linkedBeaconTeleporters = new ArrayList<>(); protected List<LinkedBeaconTeleporter> linkedBeaconTeleporters = new ArrayList<>();
LinkedBeaconTeleporter(){ LinkedBeaconTeleporter(){
this.teleporterId = Function.randomString("abcdefghijklmnopqrstuvwxyz0123456789", 10); this.teleporterId = Function.randomString(id_alphabet, id_length);
linkedBeaconTeleporters = new ArrayList<>(); linkedBeaconTeleporters = new ArrayList<>();
} }

@ -34,6 +34,10 @@ public class LinkedBeaconTeleporterManager {
Main.config.getStringList("item.lore") Main.config.getStringList("item.lore")
); );
// Load settings
LinkedBeaconTeleporter.id_alphabet = Main.config.getString("id.alphabet");
LinkedBeaconTeleporter.id_length = Main.config.getInt("id.length");
// Construct & add crafting-receipes // Construct & add crafting-receipes
constructAndAddRecipes(); constructAndAddRecipes();

@ -7,7 +7,7 @@ item:
- '§8§o%id%' - '§8§o%id%'
id: # TODO id:
# Alphabet to use for random-generation # Alphabet to use for random-generation
alphabet: 'abcdefghijklmnopqrstuvwxyz0123456789' alphabet: 'abcdefghijklmnopqrstuvwxyz0123456789'
# Length of id # Length of id

Loading…
Cancel
Save