Merge branch 'development'

This commit is contained in:
Brianna 2020-07-03 11:39:56 -05:00
commit 1285fac84f
3 changed files with 52 additions and 5 deletions

View File

@ -4,7 +4,7 @@ stages:
variables:
name: "SongodaCore"
path: "/builds/$CI_PROJECT_PATH"
version: "2.3.40"
version: "2.3.41"
build:
stage: build

View File

@ -53,13 +53,13 @@ public abstract class SongodaPlugin extends JavaPlugin {
}
@Override
public void reloadConfig() {
public void reloadConfig() {
config.load();
onConfigReload();
}
@Override
public void saveConfig() {
public void saveConfig() {
config.save();
}

View File

@ -1353,12 +1353,59 @@ public enum CompatibleMaterial {
* @return LegacyMaterial or null if none found
*/
public static CompatibleMaterial getMaterial(Block block) {
if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_13)) { // Flattening
return CompatibleMaterial.getMaterialFromNewBlock(block);
} else { // Pre-Flattening
if(block != null){
if (block.getData() != 0) {
for (CompatibleMaterial cm : CompatibleMaterial.values()) {
if (cm.getMaterial().equals(block.getType())) {
if (cm.getData() == block.getData()) {
return cm;
}
}
}
}
return CompatibleMaterial.getMaterialFromNewBlock(block);
}
}
return null;
}
/**
* Lookup a Material by Material and data, corrected for legacy
*
* @param mat material to check
* @param data data of the block
* @return LegacyMaterial or null if none found
*/
public static CompatibleMaterial getMaterial(Material mat, byte data) {
if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_13)) { // Flattening
return CompatibleMaterial.getMaterial(mat);
} else { // Pre-Flattening
if(mat != null){
if (data != 0) {
for (CompatibleMaterial cm : CompatibleMaterial.values()) {
if (cm.getMaterial() != null
&& cm.getMaterial().equals(mat)) {
if (cm.getData() == data) {
return cm;
}
}
}
}
return CompatibleMaterial.getMaterial(mat);
}
}
return null;
}
private static CompatibleMaterial getMaterialFromNewBlock(Block block) {
if (block == null) {
return null;
}
Material mat = block.getType();
if (mat == null) return null;
else if (useLegacy) {
if (useLegacy) {
LegacyMaterialBlockType legacyBlock = LegacyMaterialBlockType.getFromLegacy(mat.name());
if (legacyBlock != null) {
return lookupMap.get(legacyBlock.name());