3
0
Mirror von https://github.com/IntellectualSites/FastAsyncWorldEdit.git synchronisiert 2024-12-25 18:40:05 +01:00

Additional cleanup for the Sponge implementation

Dieser Commit ist enthalten in:
Wyatt Childers 2016-05-18 21:03:29 -04:00
Ursprung 7dc9a9aece
Commit bc29bff072
12 geänderte Dateien mit 25 neuen und 68 gelöschten Zeilen

Datei anzeigen

@ -57,6 +57,7 @@
<allow pkg="com.google.inject" /> <allow pkg="com.google.inject" />
<allow pkg="com.flowpowered.math" /> <allow pkg="com.flowpowered.math" />
<allow pkg="org.spongepowered.api" /> <allow pkg="org.spongepowered.api" />
<allow pkg="org.slf4j" />
<allow pkg="ninja.leaping.configurate" /> <allow pkg="ninja.leaping.configurate" />
</subpackage> </subpackage>
</subpackage> </subpackage>

Datei anzeigen

@ -31,7 +31,7 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
/** /**
* Provides access to biome data in Forge. * Provides access to biome data in Sponge.
*/ */
class SpongeBiomeRegistry implements BiomeRegistry { class SpongeBiomeRegistry implements BiomeRegistry {
@ -56,9 +56,6 @@ class SpongeBiomeRegistry implements BiomeRegistry {
return new SpongeBiomeData(IDHelper.resolveBiome(biome.getId())); return new SpongeBiomeData(IDHelper.resolveBiome(biome.getId()));
} }
/**
* Cached biome data information.
*/
private static class SpongeBiomeData implements BiomeData { private static class SpongeBiomeData implements BiomeData {
private final BiomeType biome; private final BiomeType biome;

Datei anzeigen

@ -170,7 +170,7 @@ class SpongePlatform extends AbstractPlatform implements MultiUserPlatform {
@Override @Override
public Map<Capability, Preference> getCapabilities() { public Map<Capability, Preference> getCapabilities() {
Map<Capability, Preference> capabilities = new EnumMap<>(Capability.class); Map<Capability, Preference> capabilities = new EnumMap<>(Capability.class);
capabilities.put(Capability.CONFIGURATION, Preference.PREFER_OTHERS); capabilities.put(Capability.CONFIGURATION, Preference.NORMAL);
capabilities.put(Capability.WORLDEDIT_CUI, Preference.NORMAL); capabilities.put(Capability.WORLDEDIT_CUI, Preference.NORMAL);
capabilities.put(Capability.GAME_HOOKS, Preference.NORMAL); capabilities.put(Capability.GAME_HOOKS, Preference.NORMAL);
capabilities.put(Capability.PERMISSIONS, Preference.NORMAL); capabilities.put(Capability.PERMISSIONS, Preference.NORMAL);

Datei anzeigen

@ -154,14 +154,7 @@ public class SpongePlayer extends AbstractPlayerActor {
this.player.getWorld(), pos.getX(), pos.getY(), pos.getZ() this.player.getWorld(), pos.getX(), pos.getY(), pos.getZ()
); );
this.player.setLocationAndRotation( this.player.setLocationAndRotation(loc, new Vector3d(pitch, yaw, 0));
loc,
new Vector3d(
pitch,
yaw,
0
)
);
} }
@Override @Override

Datei anzeigen

@ -45,6 +45,7 @@ import org.spongepowered.api.data.property.block.SkyLuminanceProperty;
import org.spongepowered.api.entity.EntityType; import org.spongepowered.api.entity.EntityType;
import org.spongepowered.api.entity.EntityTypes; import org.spongepowered.api.entity.EntityTypes;
import org.spongepowered.api.event.cause.Cause; import org.spongepowered.api.event.cause.Cause;
import org.spongepowered.api.event.cause.NamedCause;
import org.spongepowered.api.event.cause.entity.spawn.SpawnCause; import org.spongepowered.api.event.cause.entity.spawn.SpawnCause;
import org.spongepowered.api.event.cause.entity.spawn.SpawnTypes; import org.spongepowered.api.event.cause.entity.spawn.SpawnTypes;
import org.spongepowered.api.world.World; import org.spongepowered.api.world.World;
@ -262,7 +263,10 @@ public abstract class SpongeWorld extends AbstractWorld {
protected abstract void applyEntityData(org.spongepowered.api.entity.Entity entity, BaseEntity data); protected abstract void applyEntityData(org.spongepowered.api.entity.Entity entity, BaseEntity data);
private static final Cause ENTITY_SPAWN_CAUSE = Cause.source(SpawnCause.builder().type(SpawnTypes.PLUGIN).build()).build(); private static final Cause ENTITY_SPAWN_CAUSE = Cause
.source(SpawnCause.builder().type(SpawnTypes.PLUGIN).build())
.suggestNamed(NamedCause.SOURCE, SpongeWorldEdit.inst())
.build();
@Nullable @Nullable
@Override @Override

Datei anzeigen

@ -23,7 +23,7 @@ import com.sk89q.worldedit.world.registry.BiomeRegistry;
import com.sk89q.worldedit.world.registry.LegacyWorldData; import com.sk89q.worldedit.world.registry.LegacyWorldData;
/** /**
* World data for the Forge platform. * World data for the Sponge platform.
*/ */
class SpongeWorldData extends LegacyWorldData { class SpongeWorldData extends LegacyWorldData {

Datei anzeigen

@ -31,6 +31,7 @@ import com.sk89q.worldedit.internal.LocalWorldAdapter;
import com.sk89q.worldedit.sponge.config.SpongeConfiguration; import com.sk89q.worldedit.sponge.config.SpongeConfiguration;
import com.sk89q.worldedit.sponge.nms.NMSHelper; import com.sk89q.worldedit.sponge.nms.NMSHelper;
import com.sk89q.worldedit.sponge.nms.SpongeNMSWorld; import com.sk89q.worldedit.sponge.nms.SpongeNMSWorld;
import org.slf4j.Logger;
import org.spongepowered.api.Sponge; import org.spongepowered.api.Sponge;
import org.spongepowered.api.block.BlockSnapshot; import org.spongepowered.api.block.BlockSnapshot;
import org.spongepowered.api.block.BlockType; import org.spongepowered.api.block.BlockType;
@ -62,10 +63,9 @@ import static com.google.common.base.Preconditions.checkNotNull;
public class SpongeWorldEdit { public class SpongeWorldEdit {
@Inject @Inject
private java.util.logging.Logger logger; private Logger logger;
public static final String MOD_ID = "worldedit"; public static final String MOD_ID = "worldedit";
public static final String CUI_PLUGIN_CHANNEL = "WECUI";
private SpongePermissionsProvider provider; private SpongePermissionsProvider provider;
@ -118,7 +118,7 @@ public class SpongeWorldEdit {
@Listener @Listener
public void serverAboutToStart(GameAboutToStartServerEvent event) { public void serverAboutToStart(GameAboutToStartServerEvent event) {
if (this.platform != null) { if (this.platform != null) {
logger.warning("FMLServerStartingEvent occurred when FMLServerStoppingEvent hasn't"); logger.warn("GameAboutToStartServerEvent occurred when GameStoppingServerEvent hasn't");
WorldEdit.getInstance().getPlatformManager().unregister(platform); WorldEdit.getInstance().getPlatformManager().unregister(platform);
} }
@ -226,7 +226,7 @@ public class SpongeWorldEdit {
/** /**
* Get the configuration. * Get the configuration.
* *
* @return the Forge configuration * @return the Sponge configuration
*/ */
SpongeConfiguration getConfig() { SpongeConfiguration getConfig() {
return this.config; return this.config;
@ -292,7 +292,7 @@ public class SpongeWorldEdit {
} }
/** /**
* Get the version of the WorldEdit-for-Forge implementation. * Get the version of the WorldEdit Sponge implementation.
* *
* @return a version string * @return a version string
*/ */

Datei anzeigen

@ -22,8 +22,8 @@ package com.sk89q.worldedit.sponge;
import org.spongepowered.api.Sponge; import org.spongepowered.api.Sponge;
import org.spongepowered.api.entity.living.player.Player; import org.spongepowered.api.entity.living.player.Player;
import java.util.Collections; import java.util.ArrayList;
import java.util.HashSet; import java.util.List;
import java.util.Set; import java.util.Set;
import java.util.UUID; import java.util.UUID;
import java.util.concurrent.CopyOnWriteArraySet; import java.util.concurrent.CopyOnWriteArraySet;
@ -34,7 +34,7 @@ import java.util.concurrent.CopyOnWriteArraySet;
public class ThreadSafeCache implements Runnable { public class ThreadSafeCache implements Runnable {
private static final ThreadSafeCache INSTANCE = new ThreadSafeCache(); private static final ThreadSafeCache INSTANCE = new ThreadSafeCache();
private Set<UUID> onlineIds = Collections.emptySet(); private Set<UUID> onlineIds = new CopyOnWriteArraySet<>();
/** /**
* Get an concurrent-safe set of UUIDs of online players. * Get an concurrent-safe set of UUIDs of online players.
@ -47,7 +47,7 @@ public class ThreadSafeCache implements Runnable {
@Override @Override
public void run() { public void run() {
Set<UUID> onlineIds = new HashSet<>(); List<UUID> onlineIds = new ArrayList<>();
for (Player player : Sponge.getServer().getOnlinePlayers()) { for (Player player : Sponge.getServer().getOnlinePlayers()) {
onlineIds.add(player.getUniqueId()); onlineIds.add(player.getUniqueId());

Datei anzeigen

@ -28,11 +28,10 @@ import ninja.leaping.configurate.ConfigurationOptions;
import ninja.leaping.configurate.commented.CommentedConfigurationNode; import ninja.leaping.configurate.commented.CommentedConfigurationNode;
import ninja.leaping.configurate.loader.ConfigurationLoader; import ninja.leaping.configurate.loader.ConfigurationLoader;
import ninja.leaping.configurate.objectmapping.ObjectMappingException; import ninja.leaping.configurate.objectmapping.ObjectMappingException;
import org.slf4j.Logger;
import java.io.IOException; import java.io.IOException;
import java.util.HashSet; import java.util.HashSet;
import java.util.logging.Level;
import java.util.logging.Logger;
public class ConfigurateConfiguration extends LocalConfiguration { public class ConfigurateConfiguration extends LocalConfiguration {
@ -54,7 +53,7 @@ public class ConfigurateConfiguration extends LocalConfiguration {
node = config.load(options); node = config.load(options);
} catch (IOException e) { } catch (IOException e) {
logger.log(Level.WARNING, "Error loading WorldEdit configuration", e); logger.warn("Error loading WorldEdit configuration", e);
} }
profile = node.getNode("debug").getBoolean(profile); profile = node.getNode("debug").getBoolean(profile);
@ -76,12 +75,12 @@ public class ConfigurateConfiguration extends LocalConfiguration {
try { try {
disallowedBlocks = new HashSet<>(node.getNode("limits", "disallowed-blocks").getList(TypeToken.of(Integer.class))); disallowedBlocks = new HashSet<>(node.getNode("limits", "disallowed-blocks").getList(TypeToken.of(Integer.class)));
} catch (ObjectMappingException e) { } catch (ObjectMappingException e) {
logger.log(Level.WARNING, "Error loading WorldEdit configuration", e); logger.warn("Error loading WorldEdit configuration", e);
} }
try { try {
allowedDataCycleBlocks = new HashSet<>(node.getNode("limits", "allowed-data-cycle-blocks").getList(TypeToken.of(Integer.class))); allowedDataCycleBlocks = new HashSet<>(node.getNode("limits", "allowed-data-cycle-blocks").getList(TypeToken.of(Integer.class)));
} catch (ObjectMappingException e) { } catch (ObjectMappingException e) {
logger.log(Level.WARNING, "Error loading WorldEdit configuration", e); logger.warn("Error loading WorldEdit configuration", e);
} }
registerHelp = node.getNode("register-help").getBoolean(true); registerHelp = node.getNode("register-help").getBoolean(true);

Datei anzeigen

@ -22,11 +22,10 @@ package com.sk89q.worldedit.sponge.config;
import com.sk89q.worldedit.sponge.SpongeWorldEdit; import com.sk89q.worldedit.sponge.SpongeWorldEdit;
import ninja.leaping.configurate.commented.CommentedConfigurationNode; import ninja.leaping.configurate.commented.CommentedConfigurationNode;
import ninja.leaping.configurate.loader.ConfigurationLoader; import ninja.leaping.configurate.loader.ConfigurationLoader;
import org.slf4j.Logger;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
public class SpongeConfiguration extends ConfigurateConfiguration { public class SpongeConfiguration extends ConfigurateConfiguration {
@ -47,7 +46,7 @@ public class SpongeConfiguration extends ConfigurateConfiguration {
try { try {
config.save(node); config.save(node);
} catch (IOException e) { } catch (IOException e) {
logger.log(Level.WARNING, "Error loading WorldEdit configuration", e); logger.warn("Error loading WorldEdit configuration", e);
} }
} }

Datei anzeigen

@ -1,4 +0,0 @@
public net.minecraft.world.gen.ChunkProviderServer field_73248_b # droppedChunksSet
public net.minecraft.world.gen.ChunkProviderServer field_73244_f # id2ChunkMap
public net.minecraft.world.gen.ChunkProviderServer field_73245_g # loadedChunks
public net.minecraft.world.gen.ChunkProviderServer field_73246_d # serverChunkGenerator

Datei anzeigen

@ -1,32 +0,0 @@
#Don't put comments; they get removed
default-max-polygon-points=-1
schematic-save-dir=schematics
allow-extra-data-values=false
super-pickaxe-many-drop-items=true
register-help=true
nav-wand-item=345
profile=false
super-pickaxe-drop-items=true
disallowed-blocks=6,26,27,28,31,32,34,36,37,38,39,40,46,50,51,55,59,66,69,75,76,93,94,77,81,83,7,14,15,16,56
max-super-pickaxe-size=5
max-brush-radius=10
craftscript-dir=craftscripts
no-double-slash=false
wand-item=271
shell-save-type=
scripting-timeout=3000
snapshots-dir=
use-inventory-creative-override=false
log-file=worldedit.log
max-changed-blocks=-1
nav-wand-distance=50
butcher-default-radius=-1
default-max-changed-blocks=-1
history-size=15
use-inventory=false
allow-symbolic-links=false
use-inventory-override=false
log-commands=false
butcher-max-radius=-1
max-polygon-points=20
max-radius=-1