Implemented getter for LinkedBeaconTeleporterBlock from Location and teleportId
This commit is contained in:
		
							parent
							
								
									59e8768ddb
								
							
						
					
					
						commit
						2f621d7a9b
					
				@ -1,9 +1,15 @@
 | 
			
		||||
package eu.ruekov.ruakij.LinkedBeaconTeleporters.linkedBeaconTeleporter;
 | 
			
		||||
 | 
			
		||||
import eu.ruekov.ruakij.LinkedBeaconTeleporters.Main;
 | 
			
		||||
import org.bukkit.Location;
 | 
			
		||||
import org.bukkit.block.Block;
 | 
			
		||||
import org.bukkit.block.BlockState;
 | 
			
		||||
import org.bukkit.inventory.ItemStack;
 | 
			
		||||
 | 
			
		||||
import java.util.List;
 | 
			
		||||
 | 
			
		||||
public class LinkedBeaconTeleporterBlock extends LinkedBeaconTeleporter {
 | 
			
		||||
    // FIXME: Storing the block like this will block the world from unloading and might be dangerous
 | 
			
		||||
    Block block;
 | 
			
		||||
 | 
			
		||||
    public LinkedBeaconTeleporterBlock(String teleporterId, Block block) {
 | 
			
		||||
@ -15,4 +21,13 @@ public class LinkedBeaconTeleporterBlock extends LinkedBeaconTeleporter {
 | 
			
		||||
    public Block block(){
 | 
			
		||||
        return block;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    // Conversion methods
 | 
			
		||||
    public static LinkedBeaconTeleporterBlock getFromLocation(Location loc){
 | 
			
		||||
        return Main.lbtManager.getLbtBlockFromLocation(loc);
 | 
			
		||||
    }
 | 
			
		||||
    public static List<LinkedBeaconTeleporterBlock> getListFromTeleportId(String teleportId){
 | 
			
		||||
        return Main.lbtManager.getLbtBlocksFromTeleportId(teleportId);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -121,6 +121,16 @@ public class LinkedBeaconTeleporterManager {
 | 
			
		||||
        return lbtItem;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public LinkedBeaconTeleporterBlock getLbtBlockFromLocation(Location loc){
 | 
			
		||||
        // Serialize
 | 
			
		||||
        String serializedLoc = Function.serialiseBlockLocation(loc);
 | 
			
		||||
 | 
			
		||||
        return linkedBeaconTeleporterByLoc.get(serializedLoc);
 | 
			
		||||
    }
 | 
			
		||||
    public List<LinkedBeaconTeleporterBlock> getLbtBlocksFromTeleportId(String teleportId){
 | 
			
		||||
        return linkedBeaconTeleporterById.get(teleportId);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    String constructRegex(String name, List<String> lore){
 | 
			
		||||
        // Serialize
 | 
			
		||||
        String regex = serialiseBeaconItem(name, lore);
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user