Mirror von
https://github.com/IntellectualSites/FastAsyncWorldEdit.git
synchronisiert 2024-12-25 18:40:05 +01:00
Update for Spout changes
Dieser Commit ist enthalten in:
Ursprung
afd8ebe66f
Commit
672e6fc584
@ -36,8 +36,8 @@ import org.spout.api.geo.discrete.Point;
|
||||
import org.spout.api.inventory.Inventory;
|
||||
import org.spout.api.inventory.ItemStack;
|
||||
import org.spout.api.entity.Player;
|
||||
import org.spout.vanilla.component.inventory.window.Window;
|
||||
import org.spout.vanilla.component.living.Human;
|
||||
import org.spout.vanilla.component.inventory.PlayerInventory;
|
||||
import org.spout.vanilla.component.living.neutral.Human;
|
||||
import org.spout.vanilla.material.VanillaMaterial;
|
||||
import org.spout.vanilla.material.VanillaMaterials;
|
||||
|
||||
@ -55,7 +55,7 @@ public class SpoutPlayer extends LocalPlayer {
|
||||
@Override
|
||||
public int getItemInHand() {
|
||||
if (player.has(Human.class)) {
|
||||
return ((VanillaMaterial) player.get(Human.class).getInventory().getQuickbar()
|
||||
return ((VanillaMaterial) player.get(PlayerInventory.class).getQuickbar()
|
||||
.getCurrentItem().getMaterial()).getMinecraftId();
|
||||
} else {
|
||||
return 0;
|
||||
@ -87,7 +87,7 @@ public class SpoutPlayer extends LocalPlayer {
|
||||
@Override
|
||||
public void giveItem(int type, int amt) {
|
||||
if (player.has(Human.class)) {
|
||||
player.get(Human.class).getInventory().add(new ItemStack(VanillaMaterials.getMaterial((short) type), amt));
|
||||
player.get(PlayerInventory.class).add(new ItemStack(VanillaMaterials.getMaterial((short) type), amt));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -34,9 +34,8 @@ import org.spout.api.inventory.ItemStack;
|
||||
import org.spout.api.material.Material;
|
||||
import org.spout.api.entity.Player;
|
||||
import org.spout.vanilla.component.inventory.PlayerInventory;
|
||||
import org.spout.vanilla.component.living.Human;
|
||||
import org.spout.vanilla.component.living.neutral.Human;
|
||||
import org.spout.vanilla.material.VanillaMaterials;
|
||||
import org.spout.vanilla.util.VanillaPlayerUtil;
|
||||
|
||||
public class SpoutPlayerBlockBag extends BlockBag {
|
||||
/**
|
||||
@ -80,7 +79,7 @@ public class SpoutPlayerBlockBag extends BlockBag {
|
||||
boolean includesFullInventory = true;
|
||||
ItemStack[] items;
|
||||
Human human = player.get(Human.class);
|
||||
PlayerInventory inv = human.getInventory();
|
||||
PlayerInventory inv = player.get(PlayerInventory.class);
|
||||
if (human.isCreative()) {
|
||||
includesFullInventory = false;
|
||||
items = new ItemStack[inv.getQuickbar().size()];
|
||||
@ -237,7 +236,7 @@ public class SpoutPlayerBlockBag extends BlockBag {
|
||||
@Override
|
||||
public void flushChanges() {
|
||||
if (items != null) {
|
||||
PlayerInventory inv = player.get(Human.class).getInventory();
|
||||
PlayerInventory inv = player.get(PlayerInventory.class);
|
||||
for (int i = 0; i < inv.getQuickbar().size(); i++) {
|
||||
inv.getQuickbar().set(i, items.inventory[i]);
|
||||
}
|
||||
|
@ -102,7 +102,7 @@ public class SpoutUtil {
|
||||
}
|
||||
|
||||
public static Block toBlock(BlockWorldVector pt) {
|
||||
return toWorld(pt).getBlock(pt.getBlockX(), pt.getBlockY(), pt.getBlockZ(), WorldEditPlugin.getInstance());
|
||||
return toWorld(pt).getBlock(pt.getBlockX(), pt.getBlockY(), pt.getBlockZ());
|
||||
}
|
||||
|
||||
public static World toWorld(WorldVector pt) {
|
||||
|
@ -41,6 +41,7 @@ import com.sk89q.worldedit.regions.Region;
|
||||
import com.sk89q.worldedit.util.TreeGenerator;
|
||||
import org.spout.api.component.Component;
|
||||
import org.spout.api.entity.Entity;
|
||||
import org.spout.api.event.cause.PluginCause;
|
||||
import org.spout.api.generator.biome.BiomeGenerator;
|
||||
import org.spout.api.geo.LoadOption;
|
||||
import org.spout.api.geo.World;
|
||||
@ -110,7 +111,7 @@ public class SpoutWorld extends LocalWorld {
|
||||
final int x = pt.getBlockX();
|
||||
final int y = pt.getBlockY();
|
||||
final int z = pt.getBlockZ();
|
||||
return world.getChunkFromBlock(x, y, z, LoadOption.LOAD_GEN).setBlockMaterial(x, y, z, (BlockMaterial) mat, (short) 0, WorldEditPlugin.getInstance());
|
||||
return world.getChunkFromBlock(x, y, z, LoadOption.LOAD_GEN).setBlockMaterial(x, y, z, (BlockMaterial) mat, (short) 0, WorldEditPlugin.asCause());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@ -141,7 +142,7 @@ public class SpoutWorld extends LocalWorld {
|
||||
final int x = pt.getBlockX();
|
||||
final int y = pt.getBlockY();
|
||||
final int z = pt.getBlockZ();
|
||||
return world.getChunkFromBlock(x, y, z, LoadOption.LOAD_GEN).setBlockMaterial(x, y, z, (BlockMaterial) mat, (short) data, WorldEditPlugin.getInstance());
|
||||
return world.getChunkFromBlock(x, y, z, LoadOption.LOAD_GEN).setBlockMaterial(x, y, z, (BlockMaterial) mat, (short) data, WorldEditPlugin.asCause());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@ -185,7 +186,7 @@ public class SpoutWorld extends LocalWorld {
|
||||
final int x = pt.getBlockX();
|
||||
final int y = pt.getBlockY();
|
||||
final int z = pt.getBlockZ();
|
||||
world.getChunkFromBlock(x, y, z, LoadOption.LOAD_GEN).setBlockData(x, y, z, (short) data, WorldEditPlugin.getInstance());
|
||||
world.getChunkFromBlock(x, y, z, LoadOption.LOAD_GEN).setBlockData(x, y, z, (short) data, WorldEditPlugin.asCause());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -50,4 +50,9 @@ public class WorldEditCUIMessage implements Message {
|
||||
.append("message", message)
|
||||
.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getChannelId() {
|
||||
return DEFAULT_CHANNEL;
|
||||
}
|
||||
}
|
||||
|
@ -34,9 +34,12 @@ import com.sk89q.worldedit.spout.selections.Selection;
|
||||
import com.sk89q.worldedit.util.YAMLConfiguration;
|
||||
import org.spout.api.Server;
|
||||
import org.spout.api.command.CommandSource;
|
||||
import org.spout.api.event.Cause;
|
||||
import org.spout.api.event.cause.PluginCause;
|
||||
import org.spout.api.geo.World;
|
||||
import org.spout.api.entity.Player;
|
||||
import org.spout.api.plugin.CommonPlugin;
|
||||
import org.spout.api.plugin.Plugin;
|
||||
import org.spout.api.protocol.Protocol;
|
||||
import org.spout.api.scheduler.TaskPriority;
|
||||
|
||||
@ -65,8 +68,10 @@ public class WorldEditPlugin extends CommonPlugin {
|
||||
private YAMLConfiguration config;
|
||||
|
||||
private static WorldEditPlugin instance;
|
||||
private static PluginCause instanceCause;
|
||||
{
|
||||
instance = this;
|
||||
instanceCause = new PluginCause(this);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -105,7 +110,7 @@ public class WorldEditPlugin extends CommonPlugin {
|
||||
proto.registerPacket(WorldEditCUICodec.class, new WorldEditCUIMessageHandler(this));
|
||||
}
|
||||
|
||||
getEngine().getScheduler().scheduleAsyncRepeatingTask(this,
|
||||
getEngine().getScheduler().scheduleSyncRepeatingTask(this,
|
||||
new SessionTimer(controller, getServer()), 6 * 1000, 6 * 1000, TaskPriority.LOWEST);
|
||||
}
|
||||
|
||||
@ -356,4 +361,8 @@ public class WorldEditPlugin extends CommonPlugin {
|
||||
static WorldEditPlugin getInstance() {
|
||||
return instance;
|
||||
}
|
||||
|
||||
static Cause<Plugin> asCause() {
|
||||
return instanceCause;
|
||||
}
|
||||
}
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren