mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-06-12 04:23:54 +00:00
Implement getNameUnsafe method to allow an unloaded world's name to be accessed (#1712)
* Implement getNameUnsafe method to allow an unloaded world's name to be accessed - Fixes #1671 and #504 * Add javadoc since tag Co-authored-by: Alexander Brandes <mc.cache@web.de> Co-authored-by: Alexander Brandes <mc.cache@web.de>
This commit is contained in:
@ -198,6 +198,13 @@ public class WorldWrapper extends AbstractWorld {
|
||||
return parent.getName();
|
||||
}
|
||||
|
||||
//FAWE start - allow history to read an unloaded world's name
|
||||
@Override
|
||||
public String getNameUnsafe() {
|
||||
return parent.getNameUnsafe();
|
||||
}
|
||||
//FAWE end
|
||||
|
||||
@Override
|
||||
public <B extends BlockStateHolder<B>> boolean setBlock(BlockVector3 position, B block, boolean notifyAndLight) throws
|
||||
WorldEditException {
|
||||
|
@ -306,7 +306,8 @@ public class LocalSession implements TextureHolder {
|
||||
}
|
||||
File file = MainUtil.getFile(
|
||||
Fawe.platform().getDirectory(),
|
||||
Settings.settings().PATHS.HISTORY + File.separator + world.getName() + File.separator + uuid + File.separator + "index"
|
||||
// Use "unsafe" method here as world does not need to be loaded to save this information.
|
||||
Settings.settings().PATHS.HISTORY + File.separator + world.getNameUnsafe() + File.separator + uuid + File.separator + "index"
|
||||
);
|
||||
if (getHistoryNegativeIndex() != 0) {
|
||||
try {
|
||||
|
@ -69,6 +69,13 @@ public class NullWorld extends AbstractWorld {
|
||||
return "null";
|
||||
}
|
||||
|
||||
//FAWE start - allow history to read an unloaded world's name
|
||||
@Override
|
||||
public String getNameUnsafe() {
|
||||
return "null";
|
||||
}
|
||||
//FAWE end
|
||||
|
||||
@Override
|
||||
public String getId() {
|
||||
return "null";
|
||||
|
@ -63,12 +63,23 @@ public interface World extends Extent, Keyed, IChunkCache<IChunkGet> {
|
||||
//FAWE end
|
||||
|
||||
/**
|
||||
* Get the name of the world.
|
||||
* Get the name of the world. This will error if world has been unloaded by the server.
|
||||
*
|
||||
* @return a name for the world
|
||||
*/
|
||||
String getName();
|
||||
|
||||
//FAWE start - allow history to read an unloaded world's name
|
||||
/**
|
||||
* Get the name of the world. If the world referenced has been unloaded, this will still return the name.
|
||||
*
|
||||
* @return a name for the world
|
||||
* @since TODO
|
||||
*/
|
||||
String getNameUnsafe();
|
||||
//FAWE end
|
||||
|
||||
|
||||
/**
|
||||
* Get the folder in which this world is stored. May return null if unknown
|
||||
* or if this world is not serialized to disk.
|
||||
|
Reference in New Issue
Block a user