mirror of
https://github.com/sekwah41/Advanced-Portals.git
synced 2024-11-30 22:43:29 +01:00
Upgraded gradle file and fixed a nullpointer
This commit is contained in:
parent
c8efcbb801
commit
f5deb96d2e
@ -16,7 +16,7 @@ tasks.withType(JavaCompile) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
String getPluginData(String tag) {
|
String getPluginData(String tag) {
|
||||||
File file = new File("src/main/resources/plugin.yml")
|
File file = file("src/main/resources/plugin.yml")
|
||||||
String version = "notfound"
|
String version = "notfound"
|
||||||
file.readLines("UTF-8").each {String line ->
|
file.readLines("UTF-8").each {String line ->
|
||||||
line = line.trim()
|
line = line.trim()
|
||||||
|
@ -74,11 +74,13 @@ public class Portal {
|
|||||||
|
|
||||||
ConfigurationSection portalConfigSection = portalData.getConfig().getConfigurationSection(portal.toString());
|
ConfigurationSection portalConfigSection = portalData.getConfig().getConfigurationSection(portal.toString());
|
||||||
|
|
||||||
String[] blockTypesString = portalConfigSection.getString("triggerblock").split(",");
|
String blockTypesRaw = portalConfigSection.getString("triggerblock");
|
||||||
|
|
||||||
|
String[] blockTypesString = blockTypesRaw != null ? blockTypesRaw.split(",") : null;
|
||||||
|
|
||||||
HashSet<Material> blockTypes = getMaterialSet(blockTypesString);
|
HashSet<Material> blockTypes = getMaterialSet(blockTypesString);
|
||||||
|
|
||||||
if(blockTypes.size() == 0) {
|
if(blockTypes.isEmpty()) {
|
||||||
blockTypes.add(Material.NETHER_PORTAL);
|
blockTypes.add(Material.NETHER_PORTAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -132,12 +134,15 @@ public class Portal {
|
|||||||
public static HashSet<Material> getMaterialSet(String[] blockTypesString) {
|
public static HashSet<Material> getMaterialSet(String[] blockTypesString) {
|
||||||
HashSet<Material> blockTypes = new HashSet<>();
|
HashSet<Material> blockTypes = new HashSet<>();
|
||||||
|
|
||||||
for(String blockType : blockTypesString) {
|
if (blockTypesString != null) {
|
||||||
Material material = Material.getMaterial(blockType);
|
for(String blockType : blockTypesString) {
|
||||||
if(material != null) {
|
Material material = Material.getMaterial(blockType);
|
||||||
blockTypes.add(material);
|
if(material != null) {
|
||||||
|
blockTypes.add(material);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return blockTypes;
|
return blockTypes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
main: com.sekwah.advancedportals.AdvancedPortalsPlugin
|
main: com.sekwah.advancedportals.AdvancedPortalsPlugin
|
||||||
name: AdvancedPortals
|
name: AdvancedPortals
|
||||||
version: 0.2.0
|
version: 0.2.1
|
||||||
author: sekwah41
|
author: sekwah41
|
||||||
description: An advanced portals plugin for bukkit.
|
description: An advanced portals plugin for bukkit.
|
||||||
api-version: 1.13
|
api-version: 1.13
|
||||||
|
Loading…
Reference in New Issue
Block a user