@ -19,7 +19,7 @@ import java.util.regex.Pattern;
public class LinkedBeaconTeleporterManager {
// Stores all placed Beacon-Teleporters for fast access
// TODO: Evaluate necessity of 2 HashMaps with main reason of performance
HashMap < String , List < LinkedBeaconTeleporter Block > > linkedBeaconTeleporterById = new HashMap ( ) ;
HashMap < String , List < LinkedBeaconTeleporter > > linkedBeaconTeleporterById = new HashMap ( ) ;
HashMap < String , LinkedBeaconTeleporterBlock > linkedBeaconTeleporterByLoc = new HashMap ( ) ;
// Regex to match item-name&lore and extract id (group 1)
@ -42,7 +42,7 @@ public class LinkedBeaconTeleporterManager {
ConfigurationSection teleportersData = Main . data . getConfigurationSection ( teleporterId ) ;
// New list for this id
ArrayList< LinkedBeaconTeleporterBlock > lbtBlock s = new ArrayList ( ) ;
List< LinkedBeaconTeleporter > linkedBeaconTeleporter s = new ArrayList ( ) ;
for ( String blockId : teleportersData . getKeys ( false ) ) {
ConfigurationSection teleporterData = teleportersData . getConfigurationSection ( blockId ) ;
@ -67,16 +67,15 @@ public class LinkedBeaconTeleporterManager {
// Construct block
LinkedBeaconTeleporterBlock lbtBlock = new LinkedBeaconTeleporterBlock ( teleporterId , block ) ;
// Add block to id-list
lbtBlocks . add ( lbtBlock ) ;
// Write reference of list
lbtBlock . linkedBeaconTeleporters = linkedBeaconTeleporters ;
// Save to loc-list
linkedBeaconTeleporterByLoc . put ( serializedLoc , lbtBlock ) ;
}
// Save list to id-list
linkedBeaconTeleporterById . put ( teleporterId , l btBlock s) ;
linkedBeaconTeleporterById . put ( teleporterId , l inkedBeaconTeleporter s) ;
}
Main . log . info ( "All done!" ) ;
@ -84,7 +83,7 @@ public class LinkedBeaconTeleporterManager {
public LinkedBeaconTeleporterBlock placeLbtItem ( LinkedBeaconTeleporterItem lbtItem , Block block ) {
// Check if id already exists
List < LinkedBeaconTeleporter Block > lbtBlocks = linkedBeaconTeleporterById . get ( lbtItem . teleporterId ( ) ) ;
List < LinkedBeaconTeleporter > lbtBlocks = linkedBeaconTeleporterById . get ( lbtItem . teleporterId ( ) ) ;
if ( lbtBlocks = = null ) {
// Create empty if not found
lbtBlocks = new ArrayList < > ( ) ;
@ -107,7 +106,7 @@ public class LinkedBeaconTeleporterManager {
public LinkedBeaconTeleporterItem breakLbtBlock ( LinkedBeaconTeleporterBlock lbtBlock ) {
// Get list by id
List < LinkedBeaconTeleporter Block > lbtBlocks = linkedBeaconTeleporterById . get ( lbtBlock . teleporterId ( ) ) ;
List < LinkedBeaconTeleporter > lbtBlocks = linkedBeaconTeleporterById . get ( lbtBlock . teleporterId ( ) ) ;
// Remove from list
lbtBlocks . remove ( lbtBlock ) ;
@ -198,7 +197,7 @@ public class LinkedBeaconTeleporterManager {
return linkedBeaconTeleporterByLoc . get ( serializedLoc ) ;
}
public List < LinkedBeaconTeleporter Block > getLbtBlocksFromTeleportId ( String teleportId ) {
public List < LinkedBeaconTeleporter > getLbtBlocksFromTeleportId ( String teleportId ) {
return linkedBeaconTeleporterById . get ( teleportId ) ;
}