mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-07-04 03:56:41 +00:00
More deprecation removal
This commit is contained in:
@ -109,16 +109,6 @@ public abstract class AbstractWorld implements World {
|
||||
new BaseBlock(BlockTypes.FLOWING_WATER));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBlockType(Vector pt) {
|
||||
return getLazyBlock(pt).getType().getLegacyId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBlockData(Vector pt) {
|
||||
return getLazyBlock(pt).getData();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dropItem(Vector pt, BaseItemStack item, int times) {
|
||||
for (int i = 0; i < times; ++i) {
|
||||
@ -189,19 +179,15 @@ public abstract class AbstractWorld implements World {
|
||||
return false;
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
public boolean queueBlockBreakEffect(Platform server, Vector position, int blockId, double priority) {
|
||||
if (taskId == -1) {
|
||||
taskId = server.schedule(0, 1, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
int max = Math.max(1, Math.min(30, effectQueue.size() / 3));
|
||||
for (int i = 0; i < max; ++i) {
|
||||
if (effectQueue.isEmpty()) return;
|
||||
taskId = server.schedule(0, 1, () -> {
|
||||
int max = Math.max(1, Math.min(30, effectQueue.size() / 3));
|
||||
for (int i = 0; i < max; ++i) {
|
||||
if (effectQueue.isEmpty()) return;
|
||||
|
||||
effectQueue.poll().play();
|
||||
}
|
||||
effectQueue.poll().play();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -27,7 +27,6 @@ import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||
import com.sk89q.worldedit.blocks.BaseItem;
|
||||
import com.sk89q.worldedit.blocks.BaseItemStack;
|
||||
import com.sk89q.worldedit.blocks.type.BlockType;
|
||||
import com.sk89q.worldedit.extension.platform.Platform;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.function.mask.Mask;
|
||||
@ -92,18 +91,6 @@ public interface World extends Extent {
|
||||
*/
|
||||
boolean useItem(Vector position, BaseItem item, Direction face);
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #getLazyBlock(Vector)}
|
||||
*/
|
||||
@Deprecated
|
||||
int getBlockType(Vector pt);
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #getLazyBlock(Vector)}
|
||||
*/
|
||||
@Deprecated
|
||||
int getBlockData(Vector pt);
|
||||
|
||||
/**
|
||||
* Similar to {@link Extent#setBlock(Vector, BaseBlock)} but a
|
||||
* {@code notifyAndLight} parameter indicates whether adjacent blocks
|
||||
|
@ -19,18 +19,19 @@
|
||||
|
||||
package com.sk89q.worldedit.world.biome;
|
||||
|
||||
import com.google.common.base.Function;
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import com.google.common.base.Functions;
|
||||
import com.google.common.base.Optional;
|
||||
import com.sk89q.worldedit.util.WeightedChoice;
|
||||
import com.sk89q.worldedit.util.WeightedChoice.Choice;
|
||||
import com.sk89q.worldedit.util.function.LevenshteinDistance;
|
||||
import com.sk89q.worldedit.world.registry.BiomeRegistry;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Collection;
|
||||
import java.util.Optional;
|
||||
import java.util.function.Function;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
/**
|
||||
* Utility methods related to biomes.
|
||||
@ -55,7 +56,7 @@ public final class Biomes {
|
||||
checkNotNull(registry);
|
||||
|
||||
Function<String, ? extends Number> compare = new LevenshteinDistance(name, false, LevenshteinDistance.STANDARD_CHARS);
|
||||
WeightedChoice<BaseBiome> chooser = new WeightedChoice<BaseBiome>(Functions.compose(compare, new BiomeName(registry)), 0);
|
||||
WeightedChoice<BaseBiome> chooser = new WeightedChoice<>(Functions.compose(compare::apply, new BiomeName(registry)), 0);
|
||||
for (BaseBiome biome : biomes) {
|
||||
chooser.consider(biome);
|
||||
}
|
||||
|
@ -196,7 +196,7 @@ public class AnvilChunk implements Chunk {
|
||||
List<Tag> tags = NBTUtils.getChildTag(rootTag.getValue(),
|
||||
"TileEntities", ListTag.class).getValue();
|
||||
|
||||
tileEntities = new HashMap<BlockVector, Map<String, Tag>>();
|
||||
tileEntities = new HashMap<>();
|
||||
|
||||
for (Tag tag : tags) {
|
||||
if (!(tag instanceof CompoundTag)) {
|
||||
@ -210,21 +210,25 @@ public class AnvilChunk implements Chunk {
|
||||
int y = 0;
|
||||
int z = 0;
|
||||
|
||||
Map<String, Tag> values = new HashMap<String, Tag>();
|
||||
Map<String, Tag> values = new HashMap<>();
|
||||
|
||||
for (Map.Entry<String, Tag> entry : t.getValue().entrySet()) {
|
||||
if (entry.getKey().equals("x")) {
|
||||
if (entry.getValue() instanceof IntTag) {
|
||||
x = ((IntTag) entry.getValue()).getValue();
|
||||
}
|
||||
} else if (entry.getKey().equals("y")) {
|
||||
if (entry.getValue() instanceof IntTag) {
|
||||
y = ((IntTag) entry.getValue()).getValue();
|
||||
}
|
||||
} else if (entry.getKey().equals("z")) {
|
||||
if (entry.getValue() instanceof IntTag) {
|
||||
z = ((IntTag) entry.getValue()).getValue();
|
||||
}
|
||||
switch (entry.getKey()) {
|
||||
case "x":
|
||||
if (entry.getValue() instanceof IntTag) {
|
||||
x = ((IntTag) entry.getValue()).getValue();
|
||||
}
|
||||
break;
|
||||
case "y":
|
||||
if (entry.getValue() instanceof IntTag) {
|
||||
y = ((IntTag) entry.getValue()).getValue();
|
||||
}
|
||||
break;
|
||||
case "z":
|
||||
if (entry.getValue() instanceof IntTag) {
|
||||
z = ((IntTag) entry.getValue()).getValue();
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
values.put(entry.getKey(), entry.getValue());
|
||||
|
@ -123,7 +123,7 @@ public class OldChunk implements Chunk {
|
||||
rootTag.getValue(), "TileEntities", ListTag.class)
|
||||
.getValue();
|
||||
|
||||
tileEntities = new HashMap<BlockVector, Map<String, Tag>>();
|
||||
tileEntities = new HashMap<>();
|
||||
|
||||
for (Tag tag : tags) {
|
||||
if (!(tag instanceof CompoundTag)) {
|
||||
@ -136,21 +136,25 @@ public class OldChunk implements Chunk {
|
||||
int y = 0;
|
||||
int z = 0;
|
||||
|
||||
Map<String, Tag> values = new HashMap<String, Tag>();
|
||||
Map<String, Tag> values = new HashMap<>();
|
||||
|
||||
for (Map.Entry<String, Tag> entry : t.getValue().entrySet()) {
|
||||
if (entry.getKey().equals("x")) {
|
||||
if (entry.getValue() instanceof IntTag) {
|
||||
x = ((IntTag) entry.getValue()).getValue();
|
||||
}
|
||||
} else if (entry.getKey().equals("y")) {
|
||||
if (entry.getValue() instanceof IntTag) {
|
||||
y = ((IntTag) entry.getValue()).getValue();
|
||||
}
|
||||
} else if (entry.getKey().equals("z")) {
|
||||
if (entry.getValue() instanceof IntTag) {
|
||||
z = ((IntTag) entry.getValue()).getValue();
|
||||
}
|
||||
switch (entry.getKey()) {
|
||||
case "x":
|
||||
if (entry.getValue() instanceof IntTag) {
|
||||
x = ((IntTag) entry.getValue()).getValue();
|
||||
}
|
||||
break;
|
||||
case "y":
|
||||
if (entry.getValue() instanceof IntTag) {
|
||||
y = ((IntTag) entry.getValue()).getValue();
|
||||
}
|
||||
break;
|
||||
case "z":
|
||||
if (entry.getValue() instanceof IntTag) {
|
||||
z = ((IntTag) entry.getValue()).getValue();
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
values.put(entry.getKey(), entry.getValue());
|
||||
|
@ -37,7 +37,7 @@ import java.util.List;
|
||||
public class SnapshotRepository {
|
||||
|
||||
protected File dir;
|
||||
protected List<SnapshotDateParser> dateParsers = new ArrayList<SnapshotDateParser>();
|
||||
protected List<SnapshotDateParser> dateParsers = new ArrayList<>();
|
||||
|
||||
/**
|
||||
* Create a new instance of a repository.
|
||||
@ -71,19 +71,16 @@ public class SnapshotRepository {
|
||||
* @return a list of snapshots
|
||||
*/
|
||||
public List<Snapshot> getSnapshots(boolean newestFirst, String worldName) throws MissingWorldException {
|
||||
FilenameFilter filter = new FilenameFilter() {
|
||||
@Override
|
||||
public boolean accept(File dir, String name) {
|
||||
File f = new File(dir, name);
|
||||
return isValidSnapshot(f);
|
||||
}
|
||||
FilenameFilter filter = (dir, name) -> {
|
||||
File f = new File(dir, name);
|
||||
return isValidSnapshot(f);
|
||||
};
|
||||
|
||||
File[] snapshotFiles = dir.listFiles();
|
||||
if (snapshotFiles == null) {
|
||||
throw new MissingWorldException(worldName);
|
||||
}
|
||||
List<Snapshot> list = new ArrayList<Snapshot>(snapshotFiles.length);
|
||||
List<Snapshot> list = new ArrayList<>(snapshotFiles.length);
|
||||
|
||||
for (File file : snapshotFiles) {
|
||||
if (isValidSnapshot(file)) {
|
||||
@ -102,7 +99,7 @@ public class SnapshotRepository {
|
||||
}
|
||||
|
||||
if (newestFirst) {
|
||||
Collections.sort(list, Collections.reverseOrder());
|
||||
list.sort(Collections.reverseOrder());
|
||||
} else {
|
||||
Collections.sort(list);
|
||||
}
|
||||
|
@ -44,7 +44,7 @@ import java.util.Map;
|
||||
*/
|
||||
public class SnapshotRestore {
|
||||
|
||||
private final Map<BlockVector2D, ArrayList<Vector>> neededChunks = new LinkedHashMap<BlockVector2D, ArrayList<Vector>>();
|
||||
private final Map<BlockVector2D, ArrayList<Vector>> neededChunks = new LinkedHashMap<>();
|
||||
private final ChunkStore chunkStore;
|
||||
private final EditSession editSession;
|
||||
private ArrayList<Vector2D> missingChunks;
|
||||
@ -111,7 +111,7 @@ public class SnapshotRestore {
|
||||
|
||||
// Unidentified chunk
|
||||
if (!neededChunks.containsKey(chunkPos)) {
|
||||
neededChunks.put(chunkPos, new ArrayList<Vector>());
|
||||
neededChunks.put(chunkPos, new ArrayList<>());
|
||||
}
|
||||
|
||||
neededChunks.get(chunkPos).add(pos);
|
||||
@ -133,8 +133,8 @@ public class SnapshotRestore {
|
||||
*/
|
||||
public void restore() throws MaxChangedBlocksException {
|
||||
|
||||
missingChunks = new ArrayList<Vector2D>();
|
||||
errorChunks = new ArrayList<Vector2D>();
|
||||
missingChunks = new ArrayList<>();
|
||||
errorChunks = new ArrayList<>();
|
||||
|
||||
// Now let's start restoring!
|
||||
for (Map.Entry<BlockVector2D, ArrayList<Vector>> entry : neededChunks.entrySet()) {
|
||||
@ -156,15 +156,9 @@ public class SnapshotRestore {
|
||||
}
|
||||
} catch (MissingChunkException me) {
|
||||
missingChunks.add(chunkPos);
|
||||
} catch (MissingWorldException me) {
|
||||
} catch (IOException | DataException me) {
|
||||
errorChunks.add(chunkPos);
|
||||
lastErrorMessage = me.getMessage();
|
||||
} catch (DataException de) {
|
||||
errorChunks.add(chunkPos);
|
||||
lastErrorMessage = de.getMessage();
|
||||
} catch (IOException ioe) {
|
||||
errorChunks.add(chunkPos);
|
||||
lastErrorMessage = ioe.getMessage();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user