mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-26 15:16:45 +01:00
Update for SpongeAPI changes
This commit is contained in:
parent
7d494fef16
commit
e0e2756b95
@ -80,6 +80,7 @@ import com.plotsquared.sponge.util.SpongeUtil;
|
|||||||
import com.plotsquared.sponge.uuid.SpongeLowerOfflineUUIDWrapper;
|
import com.plotsquared.sponge.uuid.SpongeLowerOfflineUUIDWrapper;
|
||||||
import com.plotsquared.sponge.uuid.SpongeOnlineUUIDWrapper;
|
import com.plotsquared.sponge.uuid.SpongeOnlineUUIDWrapper;
|
||||||
import com.plotsquared.sponge.uuid.SpongeUUIDHandler;
|
import com.plotsquared.sponge.uuid.SpongeUUIDHandler;
|
||||||
|
import org.spongepowered.api.world.WorldBuilder;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by robin on 01/11/2014
|
* Created by robin on 01/11/2014
|
||||||
@ -263,7 +264,7 @@ public class SpongeMain implements IPlotMain, PluginContainer {
|
|||||||
case 0: {
|
case 0: {
|
||||||
modify = new WorldModify(generator, false);
|
modify = new WorldModify(generator, false);
|
||||||
game.getRegistry().registerWorldGeneratorModifier(modify);
|
game.getRegistry().registerWorldGeneratorModifier(modify);
|
||||||
final Optional<World> builder = game.getRegistry().createWorldBuilder().name(world).enabled(true).loadsOnStartup(true).keepsSpawnLoaded(true).dimensionType(DimensionTypes.OVERWORLD)
|
final Optional<World> builder = game.getRegistry().createBuilder(WorldBuilder.class).name(world).enabled(true).loadsOnStartup(true).keepsSpawnLoaded(true).dimensionType(DimensionTypes.OVERWORLD)
|
||||||
.generator(GeneratorTypes.FLAT).usesMapFeatures(false).generatorModifiers(modify).build();
|
.generator(GeneratorTypes.FLAT).usesMapFeatures(false).generatorModifiers(modify).build();
|
||||||
return builder.get();
|
return builder.get();
|
||||||
}
|
}
|
||||||
@ -271,7 +272,7 @@ public class SpongeMain implements IPlotMain, PluginContainer {
|
|||||||
default: {
|
default: {
|
||||||
modify = new WorldModify(generator, true);
|
modify = new WorldModify(generator, true);
|
||||||
game.getRegistry().registerWorldGeneratorModifier(modify);
|
game.getRegistry().registerWorldGeneratorModifier(modify);
|
||||||
final Optional<World> builder = game.getRegistry().createWorldBuilder().name(world).enabled(true).loadsOnStartup(true).keepsSpawnLoaded(true).dimensionType(DimensionTypes.OVERWORLD)
|
final Optional<World> builder = game.getRegistry().createBuilder(WorldBuilder.class).name(world).enabled(true).loadsOnStartup(true).keepsSpawnLoaded(true).dimensionType(DimensionTypes.OVERWORLD)
|
||||||
.generator(GeneratorTypes.OVERWORLD).usesMapFeatures(false).generatorModifiers(modify).build();
|
.generator(GeneratorTypes.OVERWORLD).usesMapFeatures(false).generatorModifiers(modify).build();
|
||||||
return builder.get();
|
return builder.get();
|
||||||
}
|
}
|
||||||
|
@ -6,9 +6,7 @@ import org.spongepowered.api.entity.living.player.Player;
|
|||||||
import org.spongepowered.api.item.ItemType;
|
import org.spongepowered.api.item.ItemType;
|
||||||
import org.spongepowered.api.item.ItemTypes;
|
import org.spongepowered.api.item.ItemTypes;
|
||||||
import org.spongepowered.api.item.inventory.Carrier;
|
import org.spongepowered.api.item.inventory.Carrier;
|
||||||
import org.spongepowered.api.item.inventory.Inventories;
|
|
||||||
import org.spongepowered.api.item.inventory.ItemStack;
|
import org.spongepowered.api.item.inventory.ItemStack;
|
||||||
import org.spongepowered.api.item.inventory.ItemStackBuilder;
|
|
||||||
import org.spongepowered.api.item.inventory.custom.CustomInventory;
|
import org.spongepowered.api.item.inventory.custom.CustomInventory;
|
||||||
import org.spongepowered.api.item.inventory.property.SlotIndex;
|
import org.spongepowered.api.item.inventory.property.SlotIndex;
|
||||||
import org.spongepowered.api.item.inventory.type.CarriedInventory;
|
import org.spongepowered.api.item.inventory.type.CarriedInventory;
|
||||||
@ -22,10 +20,10 @@ import com.plotsquared.sponge.object.SpongePlayer;
|
|||||||
|
|
||||||
public class SpongeInventoryUtil extends InventoryUtil {
|
public class SpongeInventoryUtil extends InventoryUtil {
|
||||||
|
|
||||||
public ItemStackBuilder builder;
|
public ItemStack.Builder builder;
|
||||||
|
|
||||||
public SpongeInventoryUtil() {
|
public SpongeInventoryUtil() {
|
||||||
builder = SpongeMain.THIS.getGame().getRegistry().createItemBuilder();
|
builder = SpongeMain.THIS.getGame().getRegistry().createBuilder(ItemStack.Builder.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -34,7 +32,7 @@ public class SpongeInventoryUtil extends InventoryUtil {
|
|||||||
final SpongePlayer sp = (SpongePlayer) inv.player;
|
final SpongePlayer sp = (SpongePlayer) inv.player;
|
||||||
final Player player = sp.player;
|
final Player player = sp.player;
|
||||||
|
|
||||||
final CustomInventory inventory = Inventories.customInventoryBuilder().name(SpongeMain.THIS.getTranslation(inv.getTitle())).size(inv.size).build();
|
final CustomInventory inventory = SpongeMain.THIS.getGame().getRegistry().createBuilder(CustomInventory.Builder.class).name(SpongeMain.THIS.getTranslation(inv.getTitle()).getTranslation()).size(inv.size).build();
|
||||||
final PlotItemStack[] items = inv.getItems();
|
final PlotItemStack[] items = inv.getItems();
|
||||||
for (int i = 0; i < (inv.size * 9); i++) {
|
for (int i = 0; i < (inv.size * 9); i++) {
|
||||||
final PlotItemStack item = items[i];
|
final PlotItemStack item = items[i];
|
||||||
|
@ -52,7 +52,6 @@ import ninja.leaping.configurate.loader.ConfigurationLoader;
|
|||||||
import org.spongepowered.api.Game;
|
import org.spongepowered.api.Game;
|
||||||
import org.spongepowered.api.plugin.PluginContainer;
|
import org.spongepowered.api.plugin.PluginContainer;
|
||||||
import org.spongepowered.api.service.scheduler.Task;
|
import org.spongepowered.api.service.scheduler.Task;
|
||||||
import org.spongepowered.api.service.scheduler.TaskBuilder;
|
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.PS;
|
import com.intellectualcrafters.plot.PS;
|
||||||
|
|
||||||
@ -184,7 +183,7 @@ public class SpongeMetrics {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Begin hitting the server with glorious data
|
// Begin hitting the server with glorious data
|
||||||
final TaskBuilder builder = game.getScheduler().createTaskBuilder();
|
final Task.Builder builder = game.getScheduler().createTaskBuilder();
|
||||||
builder.async().interval(PING_INTERVAL, TimeUnit.MINUTES).execute(new Runnable() {
|
builder.async().interval(PING_INTERVAL, TimeUnit.MINUTES).execute(new Runnable() {
|
||||||
|
|
||||||
private boolean firstPost = true;
|
private boolean firstPost = true;
|
||||||
|
@ -4,7 +4,6 @@ import java.util.HashMap;
|
|||||||
import java.util.concurrent.atomic.AtomicInteger;
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
|
|
||||||
import org.spongepowered.api.service.scheduler.Task;
|
import org.spongepowered.api.service.scheduler.Task;
|
||||||
import org.spongepowered.api.service.scheduler.TaskBuilder;
|
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.util.TaskManager;
|
import com.intellectualcrafters.plot.util.TaskManager;
|
||||||
import com.plotsquared.sponge.SpongeMain;
|
import com.plotsquared.sponge.SpongeMain;
|
||||||
@ -18,8 +17,8 @@ public class SpongeTaskManager extends TaskManager {
|
|||||||
@Override
|
@Override
|
||||||
public int taskRepeat(final Runnable r, final int interval) {
|
public int taskRepeat(final Runnable r, final int interval) {
|
||||||
final int val = i.incrementAndGet();
|
final int val = i.incrementAndGet();
|
||||||
final TaskBuilder builder = SpongeMain.THIS.getGame().getScheduler().createTaskBuilder();
|
final Task.Builder builder = SpongeMain.THIS.getGame().getScheduler().createTaskBuilder();
|
||||||
final TaskBuilder built = builder.delayTicks(interval).intervalTicks(interval).execute(r);
|
final Task.Builder built = builder.delayTicks(interval).intervalTicks(interval).execute(r);
|
||||||
final Task task = built.submit(SpongeMain.THIS.getPlugin());
|
final Task task = built.submit(SpongeMain.THIS.getPlugin());
|
||||||
tasks.put(val, task);
|
tasks.put(val, task);
|
||||||
return val;
|
return val;
|
||||||
@ -28,8 +27,8 @@ public class SpongeTaskManager extends TaskManager {
|
|||||||
@Override
|
@Override
|
||||||
public int taskRepeatAsync(final Runnable r, final int interval) {
|
public int taskRepeatAsync(final Runnable r, final int interval) {
|
||||||
final int val = i.incrementAndGet();
|
final int val = i.incrementAndGet();
|
||||||
final TaskBuilder builder = SpongeMain.THIS.getGame().getScheduler().createTaskBuilder();
|
final Task.Builder builder = SpongeMain.THIS.getGame().getScheduler().createTaskBuilder();
|
||||||
final TaskBuilder built = builder.delayTicks(interval).async().intervalTicks(interval).execute(r);
|
final Task.Builder built = builder.delayTicks(interval).async().intervalTicks(interval).execute(r);
|
||||||
final Task task = built.submit(SpongeMain.THIS.getPlugin());
|
final Task task = built.submit(SpongeMain.THIS.getPlugin());
|
||||||
tasks.put(val, task);
|
tasks.put(val, task);
|
||||||
return val;
|
return val;
|
||||||
@ -37,25 +36,25 @@ public class SpongeTaskManager extends TaskManager {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void taskAsync(final Runnable r) {
|
public void taskAsync(final Runnable r) {
|
||||||
final TaskBuilder builder = SpongeMain.THIS.getGame().getScheduler().createTaskBuilder();
|
final Task.Builder builder = SpongeMain.THIS.getGame().getScheduler().createTaskBuilder();
|
||||||
builder.async().execute(r).submit(SpongeMain.THIS.getPlugin());
|
builder.async().execute(r).submit(SpongeMain.THIS.getPlugin());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void task(final Runnable r) {
|
public void task(final Runnable r) {
|
||||||
final TaskBuilder builder = SpongeMain.THIS.getGame().getScheduler().createTaskBuilder();
|
final Task.Builder builder = SpongeMain.THIS.getGame().getScheduler().createTaskBuilder();
|
||||||
builder.execute(r).submit(SpongeMain.THIS.getPlugin());
|
builder.execute(r).submit(SpongeMain.THIS.getPlugin());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void taskLater(final Runnable r, final int delay) {
|
public void taskLater(final Runnable r, final int delay) {
|
||||||
final TaskBuilder builder = SpongeMain.THIS.getGame().getScheduler().createTaskBuilder();
|
final Task.Builder builder = SpongeMain.THIS.getGame().getScheduler().createTaskBuilder();
|
||||||
builder.delayTicks(delay).execute(r).submit(SpongeMain.THIS.getPlugin());
|
builder.delayTicks(delay).execute(r).submit(SpongeMain.THIS.getPlugin());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void taskLaterAsync(final Runnable r, final int delay) {
|
public void taskLaterAsync(final Runnable r, final int delay) {
|
||||||
final TaskBuilder builder = SpongeMain.THIS.getGame().getScheduler().createTaskBuilder();
|
final Task.Builder builder = SpongeMain.THIS.getGame().getScheduler().createTaskBuilder();
|
||||||
builder.async().delayTicks(delay).execute(r).submit(SpongeMain.THIS.getPlugin());
|
builder.async().delayTicks(delay).execute(r).submit(SpongeMain.THIS.getPlugin());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user