3
0
Mirror von https://github.com/IntellectualSites/FastAsyncWorldEdit.git synchronisiert 2024-12-25 10:30:04 +01:00

Removed a stupid worldname method.

Dieser Commit ist enthalten in:
MattBDev 2019-06-18 23:43:06 -04:00
Ursprung 2f9ece3268
Commit 9d1117303c
14 geänderte Dateien mit 45 neuen und 91 gelöschten Zeilen

Datei anzeigen

@ -38,6 +38,8 @@ import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.regions.Region; import com.sk89q.worldedit.regions.Region;
import com.sk89q.worldedit.world.AbstractWorld; import com.sk89q.worldedit.world.AbstractWorld;
import com.sk89q.worldedit.world.World; import com.sk89q.worldedit.world.World;
import org.jetbrains.annotations.NotNull;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.lang.reflect.Field; import java.lang.reflect.Field;
@ -66,7 +68,7 @@ public class FaweAPI {
* *
* @param world * @param world
* @return A new EditSessionBuilder * @return A new EditSessionBuilder
* @see com.boydti.fawe.util.EditSessionBuilder * @see EditSessionBuilder
*/ */
public static EditSessionBuilder getEditSessionBuilder(World world) { public static EditSessionBuilder getEditSessionBuilder(World world) {
return new EditSessionBuilder(world); return new EditSessionBuilder(world);
@ -181,7 +183,7 @@ public class FaweAPI {
* @param world The name of the world * @param world The name of the world
* @param autoqueue If it should start dispatching before you enqueue it. * @param autoqueue If it should start dispatching before you enqueue it.
* @return * @return
* @see com.boydti.fawe.object.FaweQueue#enqueue() * @see FaweQueue#enqueue()
*/ */
public static FaweQueue createQueue(World world, boolean autoqueue) { public static FaweQueue createQueue(World world, boolean autoqueue) {
return SetQueue.IMP.getNewQueue(world, true, autoqueue); return SetQueue.IMP.getNewQueue(world, true, autoqueue);
@ -190,11 +192,6 @@ public class FaweAPI {
public static World getWorld(String worldName) { public static World getWorld(String worldName) {
Platform platform = WorldEdit.getInstance().getPlatformManager().queryCapability(Capability.WORLD_EDITING); Platform platform = WorldEdit.getInstance().getPlatformManager().queryCapability(Capability.WORLD_EDITING);
List<? extends World> worlds = platform.getWorlds(); List<? extends World> worlds = platform.getWorlds();
for (World current : worlds) {
if (Fawe.imp().getWorldName(current).equals(worldName)) {
return WorldWrapper.wrap(current);
}
}
for (World current : worlds) { for (World current : worlds) {
if (current.getName().equals(worldName)) { if (current.getName().equals(worldName)) {
return WorldWrapper.wrap(current); return WorldWrapper.wrap(current);
@ -219,8 +216,8 @@ public class FaweAPI {
* *
* @param file * @param file
* @return * @return
* @see com.sk89q.worldedit.extent.clipboard.io.ClipboardFormat * @see ClipboardFormat
* @see com.boydti.fawe.object.schematic.Schematic * @see Schematic
*/ */
public static Schematic load(File file) throws IOException { public static Schematic load(File file) throws IOException {
return ClipboardFormats.findByFile(file).load(file); return ClipboardFormats.findByFile(file).load(file);
@ -261,7 +258,7 @@ public class FaweAPI {
* *
* @param extent * @param extent
* @param reason * @param reason
* @see com.sk89q.worldedit.EditSession#getRegionExtent() To get the FaweExtent for an EditSession * @see EditSession#getRegionExtent() To get the FaweExtent for an EditSession
*/ */
public static void cancelEdit(Extent extent, BBC reason) { public static void cancelEdit(Extent extent, BBC reason) {
try { try {
@ -400,7 +397,7 @@ public class FaweAPI {
* @param uuid * @param uuid
* @param index * @param index
* @return * @return
* @see com.boydti.fawe.object.changeset.DiskStorageHistory#toEditSession(com.boydti.fawe.object.FawePlayer) * @see DiskStorageHistory#toEditSession(FawePlayer)
*/ */
public static DiskStorageHistory getChangeSetFromDisk(World world, UUID uuid, int index) { public static DiskStorageHistory getChangeSetFromDisk(World world, UUID uuid, int index) {
return new DiskStorageHistory(world, uuid, index); return new DiskStorageHistory(world, uuid, index);
@ -517,25 +514,4 @@ public class FaweAPI {
return BBC.values(); return BBC.values();
} }
/**
* @see #getEditSessionBuilder(com.sk89q.worldedit.world.World)
* @deprecated
*/
@Deprecated
public static EditSession getNewEditSession(@Nonnull FawePlayer player) {
if (player == null) {
throw new IllegalArgumentException("Player may not be null");
}
return player.getNewEditSession();
}
/**
* @see #getEditSessionBuilder(com.sk89q.worldedit.world.World)
* @deprecated
*/
@Deprecated
public static EditSession getNewEditSession(World world) {
return WorldEdit.getInstance().getEditSessionFactory().getEditSession(world, -1);
}
} }

Datei anzeigen

@ -111,7 +111,7 @@ public class AnvilCommands {
} }
CuboidRegion cuboid = (CuboidRegion) selection; CuboidRegion cuboid = (CuboidRegion) selection;
RegionWrapper wrappedRegion = new RegionWrapper(cuboid.getMinimumPoint(), cuboid.getMaximumPoint()); RegionWrapper wrappedRegion = new RegionWrapper(cuboid.getMinimumPoint(), cuboid.getMaximumPoint());
String worldName = Fawe.imp().getWorldName(editSession.getWorld()); String worldName = editSession.getWorld().getName();
FaweQueue tmp = SetQueue.IMP.getNewQueue(worldName, true, false); FaweQueue tmp = SetQueue.IMP.getNewQueue(worldName, true, false);
MCAQueue queue = new MCAQueue(tmp); MCAQueue queue = new MCAQueue(tmp);
FawePlayer<Object> fp = FawePlayer.wrap(player); FawePlayer<Object> fp = FawePlayer.wrap(player);
@ -127,7 +127,7 @@ public class AnvilCommands {
if (session == null || session.hasFastMode()) { if (session == null || session.hasFastMode()) {
run.accept(new NullAnvilHistory()); run.accept(new NullAnvilHistory());
} else { } else {
AnvilHistory history = new AnvilHistory(Fawe.imp().getWorldName(world), fp.getUUID()); AnvilHistory history = new AnvilHistory(world.getName(), fp.getUUID());
run.accept(history); run.accept(history);
session.remember(fp.getPlayer(), world, history, fp.getLimit()); session.remember(fp.getPlayer(), world, history, fp.getLimit());
} }
@ -173,13 +173,8 @@ public class AnvilCommands {
ClipboardRemapper mapper; ClipboardRemapper mapper;
ClipboardRemapper.RemapPlatform from; ClipboardRemapper.RemapPlatform from;
ClipboardRemapper.RemapPlatform to; ClipboardRemapper.RemapPlatform to;
if (Fawe.imp().getPlatform().equalsIgnoreCase("nukkit")) { from = ClipboardRemapper.RemapPlatform.PE;
from = ClipboardRemapper.RemapPlatform.PC; to = ClipboardRemapper.RemapPlatform.PC;
to = ClipboardRemapper.RemapPlatform.PE;
} else {
from = ClipboardRemapper.RemapPlatform.PE;
to = ClipboardRemapper.RemapPlatform.PC;
}
RemapFilter filter = new RemapFilter(from, to); RemapFilter filter = new RemapFilter(from, to);
RemapFilter result = runWithWorld(player, folder, filter, true); RemapFilter result = runWithWorld(player, folder, filter, true);
if (result != null) player.print(BBC.VISITOR_BLOCK.format(result.getTotal())); if (result != null) player.print(BBC.VISITOR_BLOCK.format(result.getTotal()));
@ -199,8 +194,7 @@ public class AnvilCommands {
) )
@CommandPermissions("worldedit.anvil.deleteallunvisited") @CommandPermissions("worldedit.anvil.deleteallunvisited")
public void deleteAllUnvisited(Player player, String folder, int inhabitedTicks, @Optional("60000") int fileDurationMillis) throws WorldEditException { public void deleteAllUnvisited(Player player, String folder, int inhabitedTicks, @Optional("60000") int fileDurationMillis) throws WorldEditException {
long chunkInactivityMillis = fileDurationMillis; // Use same value for now DeleteUninhabitedFilter filter = new DeleteUninhabitedFilter(fileDurationMillis, inhabitedTicks, fileDurationMillis);
DeleteUninhabitedFilter filter = new DeleteUninhabitedFilter(fileDurationMillis, inhabitedTicks, chunkInactivityMillis);
DeleteUninhabitedFilter result = runWithWorld(player, folder, filter, true); DeleteUninhabitedFilter result = runWithWorld(player, folder, filter, true);
if (result != null) player.print(BBC.VISITOR_BLOCK.format(result.getTotal())); if (result != null) player.print(BBC.VISITOR_BLOCK.format(result.getTotal()));
} }
@ -218,9 +212,8 @@ public class AnvilCommands {
) )
@CommandPermissions("worldedit.anvil.deleteallunclaimed") @CommandPermissions("worldedit.anvil.deleteallunclaimed")
public void deleteAllUnclaimed(Player player, int inhabitedTicks, @Optional("60000") int fileDurationMillis, @Switch('d') boolean debug) throws WorldEditException { public void deleteAllUnclaimed(Player player, int inhabitedTicks, @Optional("60000") int fileDurationMillis, @Switch('d') boolean debug) throws WorldEditException {
String folder = Fawe.imp().getWorldName(player.getWorld()); String folder = player.getWorld().getName();
long chunkInactivityMillis = fileDurationMillis; // Use same value for now DeleteUnclaimedFilter filter = new DeleteUnclaimedFilter(player.getWorld(), fileDurationMillis, inhabitedTicks, fileDurationMillis);
DeleteUnclaimedFilter filter = new DeleteUnclaimedFilter(player.getWorld(), fileDurationMillis, inhabitedTicks, chunkInactivityMillis);
if (debug) filter.enableDebug(); if (debug) filter.enableDebug();
DeleteUnclaimedFilter result = runWithWorld(player, folder, filter, true); DeleteUnclaimedFilter result = runWithWorld(player, folder, filter, true);
if (result != null) player.print(BBC.VISITOR_BLOCK.format(result.getTotal())); if (result != null) player.print(BBC.VISITOR_BLOCK.format(result.getTotal()));
@ -239,9 +232,7 @@ public class AnvilCommands {
) )
@CommandPermissions("worldedit.anvil.deleteunclaimed") @CommandPermissions("worldedit.anvil.deleteunclaimed")
public void deleteUnclaimed(Player player, EditSession editSession, @Selection Region selection, int inhabitedTicks, @Optional("60000") int fileDurationMillis, @Switch('d') boolean debug) throws WorldEditException { public void deleteUnclaimed(Player player, EditSession editSession, @Selection Region selection, int inhabitedTicks, @Optional("60000") int fileDurationMillis, @Switch('d') boolean debug) throws WorldEditException {
String folder = Fawe.imp().getWorldName(player.getWorld()); DeleteUnclaimedFilter filter = new DeleteUnclaimedFilter(player.getWorld(), fileDurationMillis, inhabitedTicks, fileDurationMillis);
long chunkInactivityMillis = fileDurationMillis; // Use same value for now
DeleteUnclaimedFilter filter = new DeleteUnclaimedFilter(player.getWorld(), fileDurationMillis, inhabitedTicks, chunkInactivityMillis);
if (debug) filter.enableDebug(); if (debug) filter.enableDebug();
DeleteUnclaimedFilter result = runWithSelection(player, editSession, selection, filter); DeleteUnclaimedFilter result = runWithSelection(player, editSession, selection, filter);
if (result != null) player.print(BBC.VISITOR_BLOCK.format(result.getTotal())); if (result != null) player.print(BBC.VISITOR_BLOCK.format(result.getTotal()));
@ -260,7 +251,7 @@ public class AnvilCommands {
) )
@CommandPermissions("worldedit.anvil.deletealloldregions") @CommandPermissions("worldedit.anvil.deletealloldregions")
public void deleteAllOldRegions(Player player, String folder, String time) throws WorldEditException { public void deleteAllOldRegions(Player player, String folder, String time) throws WorldEditException {
long duration = MainUtil.timeToSec(time) * 1000l; long duration = MainUtil.timeToSec(time) * 1000L;
DeleteOldFilter filter = new DeleteOldFilter(duration); DeleteOldFilter filter = new DeleteOldFilter(duration);
DeleteOldFilter result = runWithWorld(player, folder, filter, true); DeleteOldFilter result = runWithWorld(player, folder, filter, true);
if (result != null) player.print(BBC.VISITOR_BLOCK.format(result.getTotal())); if (result != null) player.print(BBC.VISITOR_BLOCK.format(result.getTotal()));
@ -276,7 +267,7 @@ public class AnvilCommands {
) )
@CommandPermissions("worldedit.anvil.trimallplots") @CommandPermissions("worldedit.anvil.trimallplots")
public void trimAllPlots(Player player, @Switch('v') boolean deleteUnvisited) throws WorldEditException { public void trimAllPlots(Player player, @Switch('v') boolean deleteUnvisited) throws WorldEditException {
String folder = Fawe.imp().getWorldName(player.getWorld()); String folder = player.getWorld().getName();
int visitTime = deleteUnvisited ? 1 : -1; int visitTime = deleteUnvisited ? 1 : -1;
PlotTrimFilter filter = new PlotTrimFilter(player.getWorld(), 0, visitTime, 600000); PlotTrimFilter filter = new PlotTrimFilter(player.getWorld(), 0, visitTime, 600000);
// PlotTrimFilter result = runWithWorld(player, folder, filter, true); // PlotTrimFilter result = runWithWorld(player, folder, filter, true);
@ -627,7 +618,7 @@ public class AnvilCommands {
return; return;
} }
CuboidRegion cuboid = (CuboidRegion) selection; CuboidRegion cuboid = (CuboidRegion) selection;
String worldName = Fawe.imp().getWorldName(editSession.getWorld()); String worldName = editSession.getWorld().getName();
FaweQueue tmp = SetQueue.IMP.getNewQueue(worldName, true, false); FaweQueue tmp = SetQueue.IMP.getNewQueue(worldName, true, false);
MCAQueue queue = new MCAQueue(tmp); MCAQueue queue = new MCAQueue(tmp);
BlockVector3 origin = session.getPlacementPosition(player); BlockVector3 origin = session.getPlacementPosition(player);

Datei anzeigen

@ -11,7 +11,7 @@ public class DBHandler {
private Map<String, RollbackDatabase> databases = new ConcurrentHashMap<>(8, 0.9f, 1); private Map<String, RollbackDatabase> databases = new ConcurrentHashMap<>(8, 0.9f, 1);
public RollbackDatabase getDatabase(World world) { public RollbackDatabase getDatabase(World world) {
String worldName = Fawe.imp().getWorldName(world); String worldName = world.getName();
RollbackDatabase database = databases.get(worldName); RollbackDatabase database = databases.get(worldName);
if (database != null) { if (database != null) {
return database; return database;

Datei anzeigen

@ -52,9 +52,9 @@ public class RollbackDatabase extends AsyncNotifyQueue {
public RollbackDatabase(final World world) throws SQLException, ClassNotFoundException { public RollbackDatabase(final World world) throws SQLException, ClassNotFoundException {
this.prefix = ""; this.prefix = "";
this.worldName = Fawe.imp().getWorldName(world); this.worldName = world.getName();
this.world = world; this.world = world;
this.dbLocation = MainUtil.getFile(Fawe.imp().getDirectory(), Settings.IMP.PATHS.HISTORY + File.separator + Fawe.imp().getWorldName(world) + File.separator + "summary.db"); this.dbLocation = MainUtil.getFile(Fawe.imp().getDirectory(), Settings.IMP.PATHS.HISTORY + File.separator + world.getName() + File.separator + "summary.db");
connection = openConnection(); connection = openConnection();
CREATE_TABLE = "CREATE TABLE IF NOT EXISTS `" + prefix + "edits` (`player` BLOB(16) NOT NULL,`id` INT NOT NULL,`x1` INT NOT NULL,`y1` INT NOT NULL,`z1` INT NOT NULL,`x2` INT NOT NULL,`y2` INT NOT NULL,`z2` INT NOT NULL,`time` INT NOT NULL, PRIMARY KEY (player, id))"; CREATE_TABLE = "CREATE TABLE IF NOT EXISTS `" + prefix + "edits` (`player` BLOB(16) NOT NULL,`id` INT NOT NULL,`x1` INT NOT NULL,`y1` INT NOT NULL,`z1` INT NOT NULL,`x2` INT NOT NULL,`y2` INT NOT NULL,`z2` INT NOT NULL,`time` INT NOT NULL, PRIMARY KEY (player, id))";
INSERT_EDIT = "INSERT OR REPLACE INTO `" + prefix + "edits` (`player`,`id`,`x1`,`y1`,`z1`,`x2`,`y2`,`z2`,`time`) VALUES(?,?,?,?,?,?,?,?,?)"; INSERT_EDIT = "INSERT OR REPLACE INTO `" + prefix + "edits` (`player`,`id`,`x1`,`y1`,`z1`,`x2`,`y2`,`z2`,`time`) VALUES(?,?,?,?,?,?,?,?,?)";

Datei anzeigen

@ -84,7 +84,7 @@ public abstract class MappedFaweQueue<WORLD, CHUNK, CHUNKSECTIONS, SECTION> impl
public MappedFaweQueue(final World world, IFaweQueueMap map) { public MappedFaweQueue(final World world, IFaweQueueMap map) {
this.weWorld = world; this.weWorld = world;
if (world != null) this.world = Fawe.imp().getWorldName(world); if (world != null) this.world = world.getName();
if (map == null) { if (map == null) {
map = getSettings().PREVENT_CRASHES ? new WeakFaweQueueMap(this) : new DefaultFaweQueueMap(this); map = getSettings().PREVENT_CRASHES ? new WeakFaweQueueMap(this) : new DefaultFaweQueueMap(this);
} }

Datei anzeigen

@ -16,7 +16,7 @@ public class DeleteUnclaimedFilter extends DeleteUninhabitedFilter {
public DeleteUnclaimedFilter(World world, long fileDuration, long inhabitedTicks, long chunkInactivity) { public DeleteUnclaimedFilter(World world, long fileDuration, long inhabitedTicks, long chunkInactivity) {
super(fileDuration, inhabitedTicks, chunkInactivity); super(fileDuration, inhabitedTicks, chunkInactivity);
for (FaweMaskManager m : FaweAPI.getMaskManagers()) { for (FaweMaskManager m : FaweAPI.getMaskManagers()) {
RegionFilter filter = m.getFilter(Fawe.imp().getWorldName(world)); RegionFilter filter = m.getFilter(world.getName());
if (filter != null) { if (filter != null) {
filters.add(filter); filters.add(filter);
} }

Datei anzeigen

@ -46,7 +46,7 @@ public class PlotTrimFilter extends DeleteUninhabitedFilter {
super(fileDuration, inhabitedTicks, chunkInactivity); super(fileDuration, inhabitedTicks, chunkInactivity);
Fawe.debug("Initializing Plot trim..."); Fawe.debug("Initializing Plot trim...");
String worldName = Fawe.imp().getWorldName(world); String worldName = world.getName();
PlotArea area = PlotSquared.get().getPlotAreaByString(worldName); PlotArea area = PlotSquared.get().getPlotAreaByString(worldName);
IndependentPlotGenerator gen = area.getGenerator(); IndependentPlotGenerator gen = area.getGenerator();
if (!(area instanceof HybridPlotWorld) || !(gen instanceof HybridGen)) { if (!(area instanceof HybridPlotWorld) || !(gen instanceof HybridGen)) {

Datei anzeigen

@ -88,15 +88,7 @@ public abstract class FawePlayer<T> extends Metadatable {
return existing; return existing;
} }
} }
if (obj.getClass().getName().contains("CraftPlayer") && !Fawe.imp().getPlatform().equals("bukkit")) { obj.getClass().getName();
try {
Method methodGetHandle = obj.getClass().getDeclaredMethod("getHandle");
obj = methodGetHandle.invoke(obj);
} catch (Throwable e) {
e.printStackTrace();
return null;
}
}
return Fawe.imp().wrap(obj); return Fawe.imp().wrap(obj);
} }

Datei anzeigen

@ -66,7 +66,7 @@ public class DiskStorageHistory extends FaweStreamChangeSet {
public DiskStorageHistory(World world, UUID uuid) { public DiskStorageHistory(World world, UUID uuid) {
super(world); super(world);
init(uuid, Fawe.imp().getWorldName(world)); init(uuid, world.getName());
} }
public DiskStorageHistory(String world, UUID uuid) { public DiskStorageHistory(String world, UUID uuid) {
@ -116,12 +116,12 @@ public class DiskStorageHistory extends FaweStreamChangeSet {
private void init(UUID uuid, int i) { private void init(UUID uuid, int i) {
this.uuid = uuid; this.uuid = uuid;
this.index = i; this.index = i;
File folder = MainUtil.getFile(Fawe.imp().getDirectory(), Settings.IMP.PATHS.HISTORY + File.separator + Fawe.imp().getWorldName(getWorld()) + File.separator + uuid); File folder = MainUtil.getFile(Fawe.imp().getDirectory(), Settings.IMP.PATHS.HISTORY + File.separator + getWorld().getName() + File.separator + uuid);
initFiles(folder); initFiles(folder);
} }
public void delete() { public void delete() {
Fawe.debug("Deleting history: " + Fawe.imp().getWorldName(getWorld()) + "/" + uuid + "/" + index); Fawe.debug("Deleting history: " + getWorld().getName() + "/" + uuid + "/" + index);
deleteFiles(); deleteFiles();
if (Settings.IMP.HISTORY.USE_DATABASE) { if (Settings.IMP.HISTORY.USE_DATABASE) {
RollbackDatabase db = DBHandler.IMP.getDatabase(getWorld()); RollbackDatabase db = DBHandler.IMP.getDatabase(getWorld());

Datei anzeigen

@ -61,7 +61,7 @@ public abstract class FaweChangeSet implements ChangeSet {
public FaweChangeSet(World world) { public FaweChangeSet(World world) {
this.world = world; this.world = world;
this.worldName = Fawe.imp().getWorldName(world); this.worldName = world.getName();
this.mainThread = Fawe.isMainThread(); this.mainThread = Fawe.isMainThread();
this.layers = (this.world.getMaxY() + 1) >> 4; this.layers = (this.world.getMaxY() + 1) >> 4;
} }

Datei anzeigen

@ -97,7 +97,7 @@ public class EditSessionBuilder {
public EditSessionBuilder world(@Nonnull World world) { public EditSessionBuilder world(@Nonnull World world) {
checkNotNull(world); checkNotNull(world);
this.world = world; this.world = world;
this.worldName = Fawe.imp().getWorldName(world); this.worldName = world.getName();
return this; return this;
} }

Datei anzeigen

@ -244,7 +244,7 @@ public class EditSession extends AbstractDelegateExtent implements HasFaweQueue,
public EditSession(@Nullable String worldName, @Nullable World world, @Nullable FaweQueue queue, @Nullable FawePlayer player, @Nullable FaweLimit limit, @Nullable FaweChangeSet changeSet, @Nullable Region[] allowedRegions, @Nullable Boolean autoQueue, @Nullable Boolean fastmode, @Nullable Boolean checkMemory, @Nullable Boolean combineStages, @Nullable BlockBag blockBag, @Nullable EventBus bus, @Nullable EditSessionEvent event) { public EditSession(@Nullable String worldName, @Nullable World world, @Nullable FaweQueue queue, @Nullable FawePlayer player, @Nullable FaweLimit limit, @Nullable FaweChangeSet changeSet, @Nullable Region[] allowedRegions, @Nullable Boolean autoQueue, @Nullable Boolean fastmode, @Nullable Boolean checkMemory, @Nullable Boolean combineStages, @Nullable BlockBag blockBag, @Nullable EventBus bus, @Nullable EditSessionEvent event) {
super(world); super(world);
this.worldName = worldName == null ? world == null ? queue == null ? "" : queue.getWorldName() : Fawe.imp().getWorldName(world) : worldName; this.worldName = worldName == null ? world == null ? queue == null ? "" : queue.getWorldName() : world.getName() : worldName;
if (world == null && this.worldName != null) world = FaweAPI.getWorld(this.worldName); if (world == null && this.worldName != null) world = FaweAPI.getWorld(this.worldName);
this.world = world; this.world = world;
if (bus == null) { if (bus == null) {

Datei anzeigen

@ -221,7 +221,7 @@ public class LocalSession implements TextureHolder {
private boolean loadHistoryChangeSets(UUID uuid, World world) { private boolean loadHistoryChangeSets(UUID uuid, World world) {
SparseBitSet set = new SparseBitSet(); SparseBitSet set = new SparseBitSet();
final File folder = MainUtil.getFile(Fawe.imp().getDirectory(), Settings.IMP.PATHS.HISTORY + File.separator + Fawe.imp().getWorldName(world) + File.separator + uuid); final File folder = MainUtil.getFile(Fawe.imp().getDirectory(), Settings.IMP.PATHS.HISTORY + File.separator + world.getName() + File.separator + uuid);
if (folder.isDirectory()) { if (folder.isDirectory()) {
folder.listFiles(pathname -> { folder.listFiles(pathname -> {
String name = pathname.getName(); String name = pathname.getName();
@ -252,7 +252,7 @@ public class LocalSession implements TextureHolder {
if (!Settings.IMP.HISTORY.USE_DISK) { if (!Settings.IMP.HISTORY.USE_DISK) {
return; return;
} }
File file = MainUtil.getFile(Fawe.imp().getDirectory(), Settings.IMP.PATHS.HISTORY + File.separator + Fawe.imp().getWorldName(world) + File.separator + uuid + File.separator + "index"); File file = MainUtil.getFile(Fawe.imp().getDirectory(), Settings.IMP.PATHS.HISTORY + File.separator + world.getName() + File.separator + uuid + File.separator + "index");
if (file.exists()) { if (file.exists()) {
try (FaweInputStream is = new FaweInputStream(new FileInputStream(file))) { try (FaweInputStream is = new FaweInputStream(new FileInputStream(file))) {
historyNegativeIndex = Math.min(Math.max(0, is.readInt()), history.size()); historyNegativeIndex = Math.min(Math.max(0, is.readInt()), history.size());
@ -268,7 +268,7 @@ public class LocalSession implements TextureHolder {
if (world == null || !Settings.IMP.HISTORY.USE_DISK) { if (world == null || !Settings.IMP.HISTORY.USE_DISK) {
return; return;
} }
File file = MainUtil.getFile(Fawe.imp().getDirectory(), Settings.IMP.PATHS.HISTORY + File.separator + Fawe.imp().getWorldName(world) + File.separator + uuid + File.separator + "index"); File file = MainUtil.getFile(Fawe.imp().getDirectory(), Settings.IMP.PATHS.HISTORY + File.separator + world.getName() + File.separator + uuid + File.separator + "index");
if (getHistoryNegativeIndex() != 0) { if (getHistoryNegativeIndex() != 0) {
try { try {
if (!file.exists()) { if (!file.exists()) {
@ -389,10 +389,10 @@ public class LocalSession implements TextureHolder {
return cs; return cs;
} }
if (o instanceof Integer) { if (o instanceof Integer) {
File folder = MainUtil.getFile(Fawe.imp().getDirectory(), Settings.IMP.PATHS.HISTORY + File.separator + Fawe.imp().getWorldName(currentWorld) + File.separator + uuid); File folder = MainUtil.getFile(Fawe.imp().getDirectory(), Settings.IMP.PATHS.HISTORY + File.separator + currentWorld.getName() + File.separator + uuid);
File specific = new File(folder, o.toString()); File specific = new File(folder, o.toString());
if (specific.isDirectory()) { if (specific.isDirectory()) {
return new AnvilHistory(Fawe.imp().getWorldName(currentWorld), specific); return new AnvilHistory(currentWorld.getName(), specific);
} else { } else {
return new DiskStorageHistory(currentWorld, this.uuid, (Integer) o); return new DiskStorageHistory(currentWorld, this.uuid, (Integer) o);
} }

Datei anzeigen

@ -142,7 +142,7 @@ public class HistoryCommands extends MethodCommands {
if (file.getBDFile().exists()) { if (file.getBDFile().exists()) {
if (restore) file.redo(FawePlayer.wrap(player)); if (restore) file.redo(FawePlayer.wrap(player));
else file.undo(FawePlayer.wrap(player)); else file.undo(FawePlayer.wrap(player));
BBC.ROLLBACK_ELEMENT.send(player, Fawe.imp().getWorldName(world) + "/" + user + "-" + index); BBC.ROLLBACK_ELEMENT.send(player, world.getName() + "/" + user + "-" + index);
} else { } else {
BBC.TOOL_INSPECT_INFO_FOOTER.send(player, 0); BBC.TOOL_INSPECT_INFO_FOOTER.send(player, 0);
} }
@ -193,15 +193,10 @@ public class HistoryCommands extends MethodCommands {
@Override @Override
public void run(DiskStorageHistory edit) { public void run(DiskStorageHistory edit) {
edit.undo(fp, allowedRegions); edit.undo(fp, allowedRegions);
BBC.ROLLBACK_ELEMENT.send(player, Fawe.imp().getWorldName(edit.getWorld()) + "/" + user + "-" + edit.getIndex()); BBC.ROLLBACK_ELEMENT.send(player, edit.getWorld().getName() + "/" + user + "-" + edit.getIndex());
count.incrementAndGet(); count.incrementAndGet();
} }
}, new Runnable() { }, () -> BBC.TOOL_INSPECT_INFO_FOOTER.send(player, count), true, restore);
@Override
public void run() {
BBC.TOOL_INSPECT_INFO_FOOTER.send(player, count);
}
}, true, restore);
} }
@Command( @Command(