Mirror von
https://github.com/IntellectualSites/FastAsyncWorldEdit.git
synchronisiert 2024-11-02 17:40:09 +01:00
When custom files are found, use the base files for default values.
Dieser Commit ist enthalten in:
Ursprung
87fb9f6d0e
Commit
9a01bf9ab2
@ -106,7 +106,7 @@ public class BiomeCommands {
|
|||||||
})
|
})
|
||||||
.collect(Collectors.toList()));
|
.collect(Collectors.toList()));
|
||||||
return paginationBox.create(page);
|
return paginationBox.create(page);
|
||||||
}, null);
|
}, (Component) null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Command(
|
@Command(
|
||||||
|
@ -51,6 +51,7 @@ import com.sk89q.worldedit.regions.CuboidRegion;
|
|||||||
import com.sk89q.worldedit.regions.CylinderRegion;
|
import com.sk89q.worldedit.regions.CylinderRegion;
|
||||||
import com.sk89q.worldedit.regions.Region;
|
import com.sk89q.worldedit.regions.Region;
|
||||||
import com.sk89q.worldedit.util.formatting.component.SubtleFormat;
|
import com.sk89q.worldedit.util.formatting.component.SubtleFormat;
|
||||||
|
import com.sk89q.worldedit.util.formatting.text.Component;
|
||||||
import com.sk89q.worldedit.util.formatting.text.TextComponent;
|
import com.sk89q.worldedit.util.formatting.text.TextComponent;
|
||||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||||
import com.sk89q.worldedit.util.formatting.text.format.TextColor;
|
import com.sk89q.worldedit.util.formatting.text.format.TextColor;
|
||||||
@ -491,7 +492,7 @@ public class UtilityCommands {
|
|||||||
new double[]{}, WorldEdit.getInstance().getSessionManager().get(actor).getTimeout());
|
new double[]{}, WorldEdit.getInstance().getSessionManager().get(actor).getTimeout());
|
||||||
String formatted = Double.isNaN(result) ? "NaN" : formatForLocale(actor.getLocale()).format(result);
|
String formatted = Double.isNaN(result) ? "NaN" : formatForLocale(actor.getLocale()).format(result);
|
||||||
return SubtleFormat.wrap(input + " = ").append(TextComponent.of(formatted, TextColor.LIGHT_PURPLE));
|
return SubtleFormat.wrap(input + " = ").append(TextComponent.of(formatted, TextColor.LIGHT_PURPLE));
|
||||||
}, null);
|
}, (Component) null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Command(
|
@Command(
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
|
|
||||||
package com.sk89q.worldedit.regions;
|
package com.sk89q.worldedit.regions;
|
||||||
|
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
import com.sk89q.worldedit.IncompleteRegionException;
|
import com.sk89q.worldedit.IncompleteRegionException;
|
||||||
import com.sk89q.worldedit.LocalSession;
|
import com.sk89q.worldedit.LocalSession;
|
||||||
import com.sk89q.worldedit.extension.platform.Actor;
|
import com.sk89q.worldedit.extension.platform.Actor;
|
||||||
@ -158,7 +159,9 @@ public interface RegionSelector {
|
|||||||
* @return a list of lines describing the region
|
* @return a list of lines describing the region
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
List<String> getInformationLines();
|
default List<String> getInformationLines() {
|
||||||
|
return Lists.newArrayList();
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get lines of information about the selection.
|
* Get lines of information about the selection.
|
||||||
|
@ -85,20 +85,26 @@ public class TranslationManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private Optional<Map<String, String>> loadTranslationFile(String filename) {
|
private Optional<Map<String, String>> loadTranslationFile(String filename) {
|
||||||
|
Map<String, String> baseTranslations;
|
||||||
|
|
||||||
|
try {
|
||||||
|
baseTranslations = parseTranslationFile(ResourceLoader.getResourceRoot("lang/" + filename));
|
||||||
|
} catch (IOException e) {
|
||||||
|
// Seem to be missing base. If the user has provided a file use that.
|
||||||
|
baseTranslations = new HashMap<>();
|
||||||
|
}
|
||||||
|
|
||||||
File localFile = worldEdit.getWorkingDirectoryFile("lang/" + filename);
|
File localFile = worldEdit.getWorkingDirectoryFile("lang/" + filename);
|
||||||
if (localFile.exists()) {
|
if (localFile.exists()) {
|
||||||
try {
|
try {
|
||||||
return Optional.of(parseTranslationFile(localFile));
|
baseTranslations.putAll(parseTranslationFile(localFile));
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
return Optional.empty();
|
// Failed to parse custom language file. Worth printing.
|
||||||
}
|
e.printStackTrace();
|
||||||
} else {
|
|
||||||
try {
|
|
||||||
return Optional.of(parseTranslationFile(ResourceLoader.getResourceRoot("lang/" + filename)));
|
|
||||||
} catch (IOException e) {
|
|
||||||
return Optional.empty();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return baseTranslations.size() == 0 ? Optional.empty() : Optional.of(baseTranslations);
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean tryLoadTranslations(Locale locale) {
|
private boolean tryLoadTranslations(Locale locale) {
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren