mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-22 21:26:45 +01:00
Potential fixes
Fixes #712 Fixes #711 Fixes #707 Fixes #705 Fixes #702 Fixes #698 Fixes #697 Fixes #694 Fixes #717
This commit is contained in:
parent
c32edfe0ee
commit
93a7b2cace
@ -90,7 +90,7 @@ import com.sk89q.worldedit.WorldEdit;
|
|||||||
public class PS {
|
public class PS {
|
||||||
|
|
||||||
// protected static:
|
// protected static:
|
||||||
public static PS instance;
|
private static PS instance;
|
||||||
|
|
||||||
// private final:
|
// private final:
|
||||||
private final HashMap<String, PlotWorld> plotworlds = new HashMap<>();
|
private final HashMap<String, PlotWorld> plotworlds = new HashMap<>();
|
||||||
|
@ -20,7 +20,6 @@
|
|||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
package com.intellectualcrafters.plot.commands;
|
package com.intellectualcrafters.plot.commands;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.PS;
|
import com.intellectualcrafters.plot.PS;
|
||||||
@ -32,23 +31,18 @@ import com.intellectualcrafters.plot.object.PlotManager;
|
|||||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
import com.intellectualcrafters.plot.util.ChunkManager;
|
import com.intellectualcrafters.plot.util.ChunkManager;
|
||||||
import com.intellectualcrafters.plot.util.MainUtil;
|
import com.intellectualcrafters.plot.util.MainUtil;
|
||||||
import com.plotsquared.general.commands.Argument;
|
|
||||||
import com.plotsquared.general.commands.CommandDeclaration;
|
import com.plotsquared.general.commands.CommandDeclaration;
|
||||||
|
|
||||||
@CommandDeclaration(
|
@CommandDeclaration(
|
||||||
command = "regenallroads",
|
command = "regenallroads",
|
||||||
description = "Regenerate all roads in the map using the set road schematic",
|
description = "Regenerate all roads in the map using the set road schematic",
|
||||||
aliases = { "rgar" },
|
aliases = { "rgar" },
|
||||||
usage = "/plot regenallroads <world>",
|
usage = "/plot regenallroads <world> [height]",
|
||||||
category = CommandCategory.DEBUG,
|
category = CommandCategory.DEBUG,
|
||||||
requiredType = RequiredType.CONSOLE,
|
requiredType = RequiredType.CONSOLE,
|
||||||
permission = "plots.regenallroads")
|
permission = "plots.regenallroads")
|
||||||
public class RegenAllRoads extends SubCommand {
|
public class RegenAllRoads extends SubCommand {
|
||||||
|
|
||||||
public RegenAllRoads() {
|
|
||||||
requiredArguments = new Argument[] { Argument.String };
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(final PlotPlayer plr, final String[] args) {
|
public boolean onCommand(final PlotPlayer plr, final String[] args) {
|
||||||
int height = 0;
|
int height = 0;
|
||||||
@ -60,6 +54,9 @@ public class RegenAllRoads extends SubCommand {
|
|||||||
MainUtil.sendMessage(plr, C.COMMAND_SYNTAX, "/plot regenallroads <world> [height]");
|
MainUtil.sendMessage(plr, C.COMMAND_SYNTAX, "/plot regenallroads <world> [height]");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
MainUtil.sendMessage(plr, C.COMMAND_SYNTAX, "/plot regenallroads <world> [height]");
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
final String name = args[0];
|
final String name = args[0];
|
||||||
final PlotManager manager = PS.get().getPlotManager(name);
|
final PlotManager manager = PS.get().getPlotManager(name);
|
||||||
|
@ -31,7 +31,7 @@ import com.plotsquared.general.commands.CommandDeclaration;
|
|||||||
|
|
||||||
@CommandDeclaration(
|
@CommandDeclaration(
|
||||||
command = "update",
|
command = "update",
|
||||||
permission = "plots.admin",
|
permission = "plots.admin.command.update",
|
||||||
description = "Update PlotSquared",
|
description = "Update PlotSquared",
|
||||||
usage = "/plot update",
|
usage = "/plot update",
|
||||||
requiredType = RequiredType.NONE,
|
requiredType = RequiredType.NONE,
|
||||||
|
@ -90,6 +90,7 @@ public enum C {
|
|||||||
PERMISSION_ADMIN_INTERACT_UNOWNED("plots.admin.interact.unowned", "static.permissions"),
|
PERMISSION_ADMIN_INTERACT_UNOWNED("plots.admin.interact.unowned", "static.permissions"),
|
||||||
PERMISSION_ADMIN_INTERACT_OTHER("plots.admin.interact.other", "static.permissions"),
|
PERMISSION_ADMIN_INTERACT_OTHER("plots.admin.interact.other", "static.permissions"),
|
||||||
PERMISSION_ADMIN_BUILD_HEIGHTLIMIT("plots.admin.build.heightlimit", "static.permissions"),
|
PERMISSION_ADMIN_BUILD_HEIGHTLIMIT("plots.admin.build.heightlimit", "static.permissions"),
|
||||||
|
PERMISSION_ADMIN_UPDATE("plots.admin.command.update", "static.permissions"),
|
||||||
/*
|
/*
|
||||||
* Static console
|
* Static console
|
||||||
*/
|
*/
|
||||||
|
@ -575,9 +575,9 @@ public class SQLManager implements AbstractDB {
|
|||||||
stmt.setInt((i * 5) + 1, plot.id.x);
|
stmt.setInt((i * 5) + 1, plot.id.x);
|
||||||
stmt.setInt((i * 5) + 2, plot.id.y);
|
stmt.setInt((i * 5) + 2, plot.id.y);
|
||||||
try {
|
try {
|
||||||
stmt.setString((i * 4) + 3, plot.owner.toString());
|
stmt.setString((i * 5) + 3, plot.owner.toString());
|
||||||
} catch (final Exception e) {
|
} catch (final Exception e) {
|
||||||
stmt.setString((i * 4) + 3, everyone.toString());
|
stmt.setString((i * 5) + 3, everyone.toString());
|
||||||
}
|
}
|
||||||
stmt.setString((i * 5) + 4, plot.world);
|
stmt.setString((i * 5) + 4, plot.world);
|
||||||
stmt.setTimestamp((i * 5) + 5, new Timestamp(plot.getTimestamp()));
|
stmt.setTimestamp((i * 5) + 5, new Timestamp(plot.getTimestamp()));
|
||||||
|
@ -11,7 +11,6 @@ import com.intellectualcrafters.plot.object.PlotWorld;
|
|||||||
import com.intellectualcrafters.plot.object.RegionWrapper;
|
import com.intellectualcrafters.plot.object.RegionWrapper;
|
||||||
import com.intellectualcrafters.plot.util.ChunkManager;
|
import com.intellectualcrafters.plot.util.ChunkManager;
|
||||||
import com.intellectualcrafters.plot.util.MainUtil;
|
import com.intellectualcrafters.plot.util.MainUtil;
|
||||||
import com.intellectualcrafters.plot.util.StringMan;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A plot manager with a square grid layout, with square shaped plots
|
* A plot manager with a square grid layout, with square shaped plots
|
||||||
@ -93,6 +92,7 @@ public abstract class SquarePlotManager extends GridPlotManager {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PlotId getPlotId(final PlotWorld plotworld, int x, final int y, int z) {
|
public PlotId getPlotId(final PlotWorld plotworld, int x, final int y, int z) {
|
||||||
|
try {
|
||||||
final SquarePlotWorld dpw = ((SquarePlotWorld) plotworld);
|
final SquarePlotWorld dpw = ((SquarePlotWorld) plotworld);
|
||||||
if (plotworld == null) {
|
if (plotworld == null) {
|
||||||
return null;
|
return null;
|
||||||
@ -170,6 +170,9 @@ public abstract class SquarePlotManager extends GridPlotManager {
|
|||||||
return plot.getMerged(7) ? id : null;
|
return plot.getMerged(7) ? id : null;
|
||||||
}
|
}
|
||||||
PS.debug("invalid location: " + merged);
|
PS.debug("invalid location: " + merged);
|
||||||
|
} catch (Exception e) {
|
||||||
|
PS.debug("Invalid plot / road width in settings.yml for world: " + plotworld.worldname);
|
||||||
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -129,8 +129,8 @@ public class ConsolePlayer extends PlotPlayer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void deleteMeta(final String key) {
|
public Object deleteMeta(final String key) {
|
||||||
meta.remove(key);
|
return meta.remove(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1013,7 +1013,7 @@ public class Plot {
|
|||||||
public boolean removeDenied(final UUID uuid) {
|
public boolean removeDenied(final UUID uuid) {
|
||||||
if (uuid == DBFunc.everyone) {
|
if (uuid == DBFunc.everyone) {
|
||||||
boolean result = false;
|
boolean result = false;
|
||||||
for (UUID other : getDenied()) {
|
for (UUID other : new HashSet<>(getDenied())) {
|
||||||
result = result || PlotHandler.removeDenied(this, other);
|
result = result || PlotHandler.removeDenied(this, other);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
@ -1029,7 +1029,7 @@ public class Plot {
|
|||||||
public boolean removeTrusted(final UUID uuid) {
|
public boolean removeTrusted(final UUID uuid) {
|
||||||
if (uuid == DBFunc.everyone) {
|
if (uuid == DBFunc.everyone) {
|
||||||
boolean result = false;
|
boolean result = false;
|
||||||
for (UUID other : getTrusted()) {
|
for (UUID other : new HashSet<>(getTrusted())) {
|
||||||
result = result || PlotHandler.removeTrusted(this, other);
|
result = result || PlotHandler.removeTrusted(this, other);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
@ -1045,7 +1045,7 @@ public class Plot {
|
|||||||
public boolean removeMember(final UUID uuid) {
|
public boolean removeMember(final UUID uuid) {
|
||||||
if (uuid == DBFunc.everyone) {
|
if (uuid == DBFunc.everyone) {
|
||||||
boolean result = false;
|
boolean result = false;
|
||||||
for (UUID other : getMembers()) {
|
for (UUID other : new HashSet<>(getMembers())) {
|
||||||
result = result || PlotHandler.removeMember(this, other);
|
result = result || PlotHandler.removeMember(this, other);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
|
@ -80,10 +80,8 @@ public abstract class PlotPlayer implements CommandCaller {
|
|||||||
* - deleting other plugin's metadata may cause issues
|
* - deleting other plugin's metadata may cause issues
|
||||||
* @param key
|
* @param key
|
||||||
*/
|
*/
|
||||||
public void deleteMeta(final String key) {
|
public Object deleteMeta(final String key) {
|
||||||
if (meta != null) {
|
return meta.remove(key);
|
||||||
meta.remove(key);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -107,12 +107,11 @@ public abstract class ChunkManager {
|
|||||||
public abstract void unloadChunk(final String world, final ChunkLoc loc, final boolean save, final boolean safe);
|
public abstract void unloadChunk(final String world, final ChunkLoc loc, final boolean save, final boolean safe);
|
||||||
|
|
||||||
public Set<ChunkLoc> getChunkChunks(final String world) {
|
public Set<ChunkLoc> getChunkChunks(final String world) {
|
||||||
final String directory = PS.get().IMP.getWorldContainer() + File.separator + world + File.separator + "region";
|
final File folder = new File(PS.get().IMP.getWorldContainer(), world + File.separator + "region");
|
||||||
final File folder = new File(directory);
|
|
||||||
final File[] regionFiles = folder.listFiles();
|
final File[] regionFiles = folder.listFiles();
|
||||||
final HashSet<ChunkLoc> chunks = new HashSet<>();
|
final HashSet<ChunkLoc> chunks = new HashSet<>();
|
||||||
if (regionFiles == null) {
|
if (regionFiles == null) {
|
||||||
throw new RuntimeException("Could not find worlds folder.");
|
throw new RuntimeException("Could not find worlds folder: " + folder + " ? (no read access?)");
|
||||||
}
|
}
|
||||||
for (final File file : regionFiles) {
|
for (final File file : regionFiles) {
|
||||||
final String name = file.getName();
|
final String name = file.getName();
|
||||||
|
@ -563,6 +563,9 @@ public class MainUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isPlotAreaAbs(final Location location) {
|
public static boolean isPlotAreaAbs(final Location location) {
|
||||||
|
if (!Settings.ENABLE_CLUSTERS) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
final PlotWorld plotworld = PS.get().getPlotWorld(location.getWorld());
|
final PlotWorld plotworld = PS.get().getPlotWorld(location.getWorld());
|
||||||
if (plotworld == null) {
|
if (plotworld == null) {
|
||||||
return false;
|
return false;
|
||||||
@ -586,6 +589,9 @@ public class MainUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isPlotArea(final Plot plot) {
|
public static boolean isPlotArea(final Plot plot) {
|
||||||
|
if (!Settings.ENABLE_CLUSTERS) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
final PlotWorld plotworld = PS.get().getPlotWorld(plot.world);
|
final PlotWorld plotworld = PS.get().getPlotWorld(plot.world);
|
||||||
if (plotworld.TYPE == 2) {
|
if (plotworld.TYPE == 2) {
|
||||||
return plot.getCluster() != null;
|
return plot.getCluster() != null;
|
||||||
|
@ -3,6 +3,7 @@ package com.plotsquared.bukkit;
|
|||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
@ -122,7 +123,7 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
|
|||||||
@Override
|
@Override
|
||||||
public void onEnable() {
|
public void onEnable() {
|
||||||
THIS = this;
|
THIS = this;
|
||||||
PS.instance = new PS(this, "Bukkit");
|
new PS(this, "Bukkit");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -191,23 +192,19 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
|
|||||||
public void runEntityTask() {
|
public void runEntityTask() {
|
||||||
log(C.PREFIX.s() + "KillAllEntities started.");
|
log(C.PREFIX.s() + "KillAllEntities started.");
|
||||||
TaskManager.runTaskRepeat(new Runnable() {
|
TaskManager.runTaskRepeat(new Runnable() {
|
||||||
long ticked = 0l;
|
|
||||||
long error = 0l;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
if (ticked > 36_000L) {
|
|
||||||
ticked = 0l;
|
|
||||||
if (error > 0) {
|
|
||||||
log(C.PREFIX.s() + "KillAllEntities has been running for 6 hours. Errors: " + error);
|
|
||||||
}
|
|
||||||
error = 0l;
|
|
||||||
}
|
|
||||||
World world;
|
World world;
|
||||||
for (final PlotWorld pw : PS.get().getPlotWorldObjects()) {
|
for (final PlotWorld pw : PS.get().getPlotWorldObjects()) {
|
||||||
world = Bukkit.getWorld(pw.worldname);
|
world = Bukkit.getWorld(pw.worldname);
|
||||||
try {
|
try {
|
||||||
for (final Entity entity : world.getEntities()) {
|
if (world == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
List<Entity> entities = world.getEntities();
|
||||||
|
Iterator<Entity> iter = entities.iterator();
|
||||||
|
while (iter.hasNext()) {
|
||||||
|
Entity entity = iter.next();
|
||||||
switch (entity.getType()) {
|
switch (entity.getType()) {
|
||||||
case EGG:
|
case EGG:
|
||||||
case ENDER_CRYSTAL:
|
case ENDER_CRYSTAL:
|
||||||
@ -251,19 +248,21 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
|
|||||||
Plot plot = loc.getPlot();
|
Plot plot = loc.getPlot();
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
if (MainUtil.isPlotAreaAbs(loc)) {
|
if (MainUtil.isPlotAreaAbs(loc)) {
|
||||||
|
iter.remove();
|
||||||
entity.remove();
|
entity.remove();
|
||||||
}
|
}
|
||||||
return;
|
continue;
|
||||||
}
|
}
|
||||||
List<MetadataValue> meta = entity.getMetadata("plot");
|
List<MetadataValue> meta = entity.getMetadata("plot");
|
||||||
if (meta.size() == 0) {
|
if (meta.size() == 0) {
|
||||||
return;
|
continue;
|
||||||
}
|
}
|
||||||
Plot origin = (Plot) meta.get(0).value();
|
Plot origin = (Plot) meta.get(0).value();
|
||||||
if (!plot.equals(origin.getBasePlot(false))) {
|
if (!plot.equals(origin.getBasePlot(false))) {
|
||||||
|
iter.remove();
|
||||||
entity.remove();
|
entity.remove();
|
||||||
}
|
}
|
||||||
break;
|
continue;
|
||||||
}
|
}
|
||||||
case SMALL_FIREBALL:
|
case SMALL_FIREBALL:
|
||||||
case FIREBALL:
|
case FIREBALL:
|
||||||
@ -317,18 +316,17 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
|
|||||||
final Entity passenger = entity.getPassenger();
|
final Entity passenger = entity.getPassenger();
|
||||||
if (!(passenger instanceof Player)) {
|
if (!(passenger instanceof Player)) {
|
||||||
if (entity.getMetadata("keep").size() == 0) {
|
if (entity.getMetadata("keep").size() == 0) {
|
||||||
|
iter.remove();
|
||||||
entity.remove();
|
entity.remove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (final Throwable e) {
|
} catch (final Throwable e) {
|
||||||
++error;
|
e.printStackTrace();
|
||||||
} finally {
|
|
||||||
++ticked;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -55,8 +55,17 @@ public class PlotMeConnector_017 extends APlotMeConnector {
|
|||||||
final HashMap<String, Integer> roadWidth = new HashMap<>();
|
final HashMap<String, Integer> roadWidth = new HashMap<>();
|
||||||
final HashMap<Integer, Plot> plots = new HashMap<>();
|
final HashMap<Integer, Plot> plots = new HashMap<>();
|
||||||
final HashMap<String, HashMap<PlotId, boolean[]>> merges = new HashMap<>();
|
final HashMap<String, HashMap<PlotId, boolean[]>> merges = new HashMap<>();
|
||||||
|
try {
|
||||||
stmt = connection.prepareStatement("SELECT * FROM `" + plugin + "core_plots`");
|
stmt = connection.prepareStatement("SELECT * FROM `" + plugin + "core_plots`");
|
||||||
r = stmt.executeQuery();
|
r = stmt.executeQuery();
|
||||||
|
} catch (Exception e) {
|
||||||
|
PS.debug("========= Table does not exist =========");
|
||||||
|
e.printStackTrace();
|
||||||
|
PS.debug("=======================================");
|
||||||
|
PS.debug("&8 - &7The database does not match the version specified in the PlotMe config");
|
||||||
|
PS.debug("&8 - &7Please correct this, or if you are unsure, the most common is 0.16.3");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
final boolean checkUUID = DBFunc.hasColumn(r, "ownerID");
|
final boolean checkUUID = DBFunc.hasColumn(r, "ownerID");
|
||||||
final boolean merge = !plugin.equals("plotme") && Settings.CONVERT_PLOTME;
|
final boolean merge = !plugin.equals("plotme") && Settings.CONVERT_PLOTME;
|
||||||
while (r.next()) {
|
while (r.next()) {
|
||||||
|
@ -92,7 +92,6 @@ import org.bukkit.plugin.Plugin;
|
|||||||
import org.bukkit.projectiles.BlockProjectileSource;
|
import org.bukkit.projectiles.BlockProjectileSource;
|
||||||
import org.bukkit.projectiles.ProjectileSource;
|
import org.bukkit.projectiles.ProjectileSource;
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
import org.spongepowered.api.entity.living.animal.Animal;
|
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.PS;
|
import com.intellectualcrafters.plot.PS;
|
||||||
import com.intellectualcrafters.plot.config.C;
|
import com.intellectualcrafters.plot.config.C;
|
||||||
@ -284,18 +283,9 @@ public class PlayerEvents extends com.plotsquared.listener.PlotListener implemen
|
|||||||
if (!MainUtil.isPlotArea(loc)) {
|
if (!MainUtil.isPlotArea(loc)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
//
|
||||||
final ProjectileSource shooter = entity.getShooter();
|
final ProjectileSource shooter = entity.getShooter();
|
||||||
if (shooter instanceof BlockProjectileSource) {
|
if ((shooter instanceof Player)) {
|
||||||
if (plot == null) {
|
|
||||||
entity.remove();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
final Location sLoc = BukkitUtil.getLocation(((BlockProjectileSource) shooter).getBlock().getLocation());
|
|
||||||
final Plot sPlot = MainUtil.getPlot(sLoc);
|
|
||||||
if ((sPlot == null) || !PlotHandler.sameOwners(plot, sPlot)) {
|
|
||||||
entity.remove();
|
|
||||||
}
|
|
||||||
} else if ((shooter instanceof Player)) {
|
|
||||||
final PlotPlayer pp = BukkitUtil.getPlayer((Player) shooter);
|
final PlotPlayer pp = BukkitUtil.getPlayer((Player) shooter);
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
if (!Permissions.hasPermission(pp, C.PERMISSION_PROJECTILE_UNOWNED)) {
|
if (!Permissions.hasPermission(pp, C.PERMISSION_PROJECTILE_UNOWNED)) {
|
||||||
@ -310,6 +300,16 @@ public class PlayerEvents extends com.plotsquared.listener.PlotListener implemen
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
entity.remove();
|
entity.remove();
|
||||||
|
} else if (!(shooter instanceof Entity) && shooter != null) {
|
||||||
|
if (plot == null) {
|
||||||
|
entity.remove();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
final Location sLoc = BukkitUtil.getLocation(((BlockProjectileSource) shooter).getBlock().getLocation());
|
||||||
|
final Plot sPlot = MainUtil.getPlot(sLoc);
|
||||||
|
if ((sPlot == null) || !PlotHandler.sameOwners(plot, sPlot)) {
|
||||||
|
entity.remove();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -453,7 +453,7 @@ public class PlayerEvents extends com.plotsquared.listener.PlotListener implemen
|
|||||||
MainUtil.sendMessage(pp, C.WORLDEDIT_BYPASSED);
|
MainUtil.sendMessage(pp, C.WORLDEDIT_BYPASSED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ((PS.get().update != null) && Permissions.hasPermission(pp, C.PERMISSION_ADMIN) && Settings.UPDATE_NOTIFICATIONS) {
|
if ((PS.get().update != null) && Permissions.hasPermission(pp, C.PERMISSION_ADMIN_UPDATE) && Settings.UPDATE_NOTIFICATIONS) {
|
||||||
TaskManager.runTaskLater(new Runnable() {
|
TaskManager.runTaskLater(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
@ -737,9 +737,13 @@ public class PlayerEvents extends com.plotsquared.listener.PlotListener implemen
|
|||||||
final Player player = event.getPlayer();
|
final Player player = event.getPlayer();
|
||||||
final PlotPlayer pp = BukkitUtil.getPlayer(player);
|
final PlotPlayer pp = BukkitUtil.getPlayer(player);
|
||||||
|
|
||||||
|
|
||||||
// Delete last location
|
// Delete last location
|
||||||
pp.deleteMeta("location");
|
pp.deleteMeta("location");
|
||||||
pp.deleteMeta("lastplot");
|
Plot plot = (Plot) pp.deleteMeta("lastplot");
|
||||||
|
if (plot != null) {
|
||||||
|
plotExit(pp, plot);
|
||||||
|
}
|
||||||
|
|
||||||
if (BukkitMain.worldEdit != null) {
|
if (BukkitMain.worldEdit != null) {
|
||||||
if (!Permissions.hasPermission(pp, C.PERMISSION_WORLDEDIT_BYPASS)) {
|
if (!Permissions.hasPermission(pp, C.PERMISSION_WORLDEDIT_BYPASS)) {
|
||||||
@ -1025,13 +1029,16 @@ public class PlayerEvents extends com.plotsquared.listener.PlotListener implemen
|
|||||||
if (blocks.size() == 0) {
|
if (blocks.size() == 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
final Plot origin = MainUtil.getPlot(BukkitUtil.getLocation(blocks.get(0).getLocation()));
|
Location loc = BukkitUtil.getLocation(blocks.get(0).getLocation());
|
||||||
|
final Plot origin = MainUtil.getPlot(loc);
|
||||||
if (origin == null) {
|
if (origin == null) {
|
||||||
|
if (MainUtil.isPlotAreaAbs(null)) {
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
for (int i = blocks.size() - 1; i >= 0; i--) {
|
for (int i = blocks.size() - 1; i >= 0; i--) {
|
||||||
final Location loc = BukkitUtil.getLocation(blocks.get(i).getLocation());
|
loc = BukkitUtil.getLocation(blocks.get(i).getLocation());
|
||||||
final Plot plot = MainUtil.getPlot(loc);
|
final Plot plot = MainUtil.getPlot(loc);
|
||||||
if (!Objects.equals(plot, origin)) {
|
if (!Objects.equals(plot, origin)) {
|
||||||
e.getBlocks().remove(i);
|
e.getBlocks().remove(i);
|
||||||
@ -1438,7 +1445,7 @@ public class PlayerEvents extends com.plotsquared.listener.PlotListener implemen
|
|||||||
default: {
|
default: {
|
||||||
String[] types;
|
String[] types;
|
||||||
if (entity instanceof LivingEntity) {
|
if (entity instanceof LivingEntity) {
|
||||||
if (entity instanceof Animal) {
|
if (entity instanceof Animals) {
|
||||||
types = new String[] { "entity-cap", "mob-cap", "animal-cap" };
|
types = new String[] { "entity-cap", "mob-cap", "animal-cap" };
|
||||||
} else if (entity instanceof Monster) {
|
} else if (entity instanceof Monster) {
|
||||||
types = new String[] { "entity-cap", "mob-cap", "hostile-cap" };
|
types = new String[] { "entity-cap", "mob-cap", "hostile-cap" };
|
||||||
|
@ -262,7 +262,11 @@ public class BukkitPlayer extends PlotPlayer {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setTime(final long time) {
|
public void setTime(final long time) {
|
||||||
|
if (time != Long.MAX_VALUE) {
|
||||||
player.setPlayerTime(time, false);
|
player.setPlayerTime(time, false);
|
||||||
|
} else {
|
||||||
|
player.resetPlayerTime();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -20,7 +20,6 @@
|
|||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
package com.plotsquared.listener;
|
package com.plotsquared.listener;
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
@ -228,7 +227,9 @@ public class PlotListener {
|
|||||||
pp.setFlight(false);
|
pp.setFlight(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
System.out.print("CHECKING TIME");
|
||||||
if (FlagManager.getPlotFlagRaw(plot, "time") != null) {
|
if (FlagManager.getPlotFlagRaw(plot, "time") != null) {
|
||||||
|
System.out.print("RESETTING TIEM");
|
||||||
pp.setTime(Long.MAX_VALUE);
|
pp.setTime(Long.MAX_VALUE);
|
||||||
}
|
}
|
||||||
if (FlagManager.getPlotFlagRaw(plot, "weather") != null) {
|
if (FlagManager.getPlotFlagRaw(plot, "weather") != null) {
|
||||||
@ -242,8 +243,4 @@ public class PlotListener {
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean getFlagValue(final String value) {
|
|
||||||
return Arrays.asList("true", "on", "enabled", "yes").contains(value.toLowerCase());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -236,7 +236,7 @@ public class SpongeMain implements IPlotMain, PluginContainer {
|
|||||||
server = game.getServer();
|
server = game.getServer();
|
||||||
//
|
//
|
||||||
|
|
||||||
PS.instance = new PS(this, "Sponge");
|
new PS(this, "Sponge");
|
||||||
|
|
||||||
registerBlocks();
|
registerBlocks();
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@ import java.util.function.Predicate;
|
|||||||
import org.spongepowered.api.GameProfile;
|
import org.spongepowered.api.GameProfile;
|
||||||
import org.spongepowered.api.block.BlockSnapshot;
|
import org.spongepowered.api.block.BlockSnapshot;
|
||||||
import org.spongepowered.api.block.BlockState;
|
import org.spongepowered.api.block.BlockState;
|
||||||
import org.spongepowered.api.block.BlockTransaction;
|
import org.spongepowered.api.data.Transaction;
|
||||||
import org.spongepowered.api.entity.Entity;
|
import org.spongepowered.api.entity.Entity;
|
||||||
import org.spongepowered.api.entity.EntityTypes;
|
import org.spongepowered.api.entity.EntityTypes;
|
||||||
import org.spongepowered.api.entity.Transform;
|
import org.spongepowered.api.entity.Transform;
|
||||||
@ -182,57 +182,57 @@ public class MainListener {
|
|||||||
|
|
||||||
@Listener
|
@Listener
|
||||||
public void onMobSpawn(final SpawnEntityEvent event) {
|
public void onMobSpawn(final SpawnEntityEvent event) {
|
||||||
final Entity entity = event.getTargetEntity();
|
World world = event.getTargetWorld();
|
||||||
if (entity instanceof Player) {
|
final PlotWorld plotworld = PS.get().getPlotWorld(world.getName());
|
||||||
return;
|
|
||||||
}
|
|
||||||
final Location loc = SpongeUtil.getLocation(entity);
|
|
||||||
final String world = loc.getWorld();
|
|
||||||
final PlotWorld plotworld = PS.get().getPlotWorld(world);
|
|
||||||
if (plotworld == null) {
|
if (plotworld == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
List<Entity> entities = event.getEntities();
|
||||||
|
event.filterEntities(new Predicate<Entity>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean test(Entity entity) {
|
||||||
|
if (entity instanceof Player) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
final Location loc = SpongeUtil.getLocation(entity);
|
||||||
final Plot plot = MainUtil.getPlot(loc);
|
final Plot plot = MainUtil.getPlot(loc);
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
if (MainUtil.isPlotRoad(loc)) {
|
if (MainUtil.isPlotRoad(loc)) {
|
||||||
event.setCancelled(true);
|
return false;
|
||||||
}
|
}
|
||||||
return;
|
return true;
|
||||||
}
|
}
|
||||||
PS.get().getPlotWorld(world);
|
|
||||||
// Player player = this.<Player> getCause(event.getCause());
|
// Player player = this.<Player> getCause(event.getCause());
|
||||||
// TODO selectively cancel depending on spawn reason
|
// TODO selectively cancel depending on spawn reason
|
||||||
// - Not sure if possible to get spawn reason (since there are no callbacks)
|
// - Not sure if possible to get spawn reason (since there are no callbacks)
|
||||||
// if (player != null && !plotworld.SPAWN_EGGS) {
|
// if (player != null && !plotworld.SPAWN_EGGS) {
|
||||||
// event.setCancelled(true);
|
// return false;
|
||||||
// return;
|
// return true;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
if (entity.getType() == EntityTypes.ITEM) {
|
if (entity.getType() == EntityTypes.ITEM) {
|
||||||
if (FlagManager.isPlotFlagFalse(plot, "item-drop")) {
|
if (FlagManager.isPlotFlagFalse(plot, "item-drop")) {
|
||||||
event.setCancelled(true);
|
return false;
|
||||||
}
|
}
|
||||||
return;
|
return true;
|
||||||
}
|
}
|
||||||
int[] mobs = null;
|
int[] mobs = null;
|
||||||
if (entity instanceof Living) {
|
if (entity instanceof Living) {
|
||||||
if (!plotworld.MOB_SPAWNING) {
|
if (!plotworld.MOB_SPAWNING) {
|
||||||
event.setCancelled(true);
|
return false;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
final Flag mobCap = FlagManager.getPlotFlagRaw(plot, "mob-cap");
|
final Flag mobCap = FlagManager.getPlotFlagRaw(plot, "mob-cap");
|
||||||
if (mobCap != null) {
|
if (mobCap != null) {
|
||||||
final Integer cap = (Integer) mobCap.getValue();
|
final Integer cap = (Integer) mobCap.getValue();
|
||||||
if (cap == 0) {
|
if (cap == 0) {
|
||||||
event.setCancelled(true);
|
return false;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
if (mobs == null) {
|
if (mobs == null) {
|
||||||
mobs = MainUtil.countEntities(plot);
|
mobs = MainUtil.countEntities(plot);
|
||||||
}
|
}
|
||||||
if (mobs[3] >= cap) {
|
if (mobs[3] >= cap) {
|
||||||
event.setCancelled(true);
|
return false;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ((entity instanceof Ambient) || (entity instanceof Animal)) {
|
if ((entity instanceof Ambient) || (entity instanceof Animal)) {
|
||||||
@ -240,15 +240,13 @@ public class MainListener {
|
|||||||
if (animalFlag != null) {
|
if (animalFlag != null) {
|
||||||
final int cap = ((Integer) animalFlag.getValue());
|
final int cap = ((Integer) animalFlag.getValue());
|
||||||
if (cap == 0) {
|
if (cap == 0) {
|
||||||
event.setCancelled(true);
|
return false;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
if (mobs == null) {
|
if (mobs == null) {
|
||||||
mobs = MainUtil.countEntities(plot);
|
mobs = MainUtil.countEntities(plot);
|
||||||
}
|
}
|
||||||
if (mobs[1] >= cap) {
|
if (mobs[1] >= cap) {
|
||||||
event.setCancelled(true);
|
return false;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -257,34 +255,30 @@ public class MainListener {
|
|||||||
if (monsterFlag != null) {
|
if (monsterFlag != null) {
|
||||||
final int cap = ((Integer) monsterFlag.getValue());
|
final int cap = ((Integer) monsterFlag.getValue());
|
||||||
if (cap == 0) {
|
if (cap == 0) {
|
||||||
event.setCancelled(true);
|
return false;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
if (mobs == null) {
|
if (mobs == null) {
|
||||||
mobs = MainUtil.countEntities(plot);
|
mobs = MainUtil.countEntities(plot);
|
||||||
}
|
}
|
||||||
if (mobs[2] >= cap) {
|
if (mobs[2] >= cap) {
|
||||||
event.setCancelled(true);
|
return false;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return;
|
return true;
|
||||||
}
|
}
|
||||||
if ((entity instanceof Minecart) || (entity instanceof Boat)) {
|
if ((entity instanceof Minecart) || (entity instanceof Boat)) {
|
||||||
final Flag vehicleFlag = FlagManager.getPlotFlagRaw(plot, "vehicle-cap");
|
final Flag vehicleFlag = FlagManager.getPlotFlagRaw(plot, "vehicle-cap");
|
||||||
if (vehicleFlag != null) {
|
if (vehicleFlag != null) {
|
||||||
final int cap = ((Integer) vehicleFlag.getValue());
|
final int cap = ((Integer) vehicleFlag.getValue());
|
||||||
if (cap == 0) {
|
if (cap == 0) {
|
||||||
event.setCancelled(true);
|
return false;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
if (mobs == null) {
|
if (mobs == null) {
|
||||||
mobs = MainUtil.countEntities(plot);
|
mobs = MainUtil.countEntities(plot);
|
||||||
}
|
}
|
||||||
if (mobs[4] >= cap) {
|
if (mobs[4] >= cap) {
|
||||||
event.setCancelled(true);
|
return false;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -292,21 +286,22 @@ public class MainListener {
|
|||||||
if (entityCap != null) {
|
if (entityCap != null) {
|
||||||
final Integer cap = (Integer) entityCap.getValue();
|
final Integer cap = (Integer) entityCap.getValue();
|
||||||
if (cap == 0) {
|
if (cap == 0) {
|
||||||
event.setCancelled(true);
|
return false;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
if (mobs == null) {
|
if (mobs == null) {
|
||||||
mobs = MainUtil.countEntities(plot);
|
mobs = MainUtil.countEntities(plot);
|
||||||
}
|
}
|
||||||
if (mobs[0] >= cap) {
|
if (mobs[0] >= cap) {
|
||||||
event.setCancelled(true);
|
return false;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (entity instanceof PrimedTNT) {
|
if (entity instanceof PrimedTNT) {
|
||||||
Vector3d pos = entity.getLocation().getPosition();
|
Vector3d pos = entity.getLocation().getPosition();
|
||||||
entity.setRotation(new Vector3d(MathMan.roundInt(pos.getX()), MathMan.roundInt(pos.getY()), MathMan.roundInt(pos.getZ())));
|
entity.setRotation(new Vector3d(MathMan.roundInt(pos.getX()), MathMan.roundInt(pos.getY()), MathMan.roundInt(pos.getZ())));
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Listener
|
@Listener
|
||||||
@ -333,8 +328,8 @@ public class MainListener {
|
|||||||
if (!PS.get().isPlotWorld(worldname)) {
|
if (!PS.get().isPlotWorld(worldname)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
List<BlockTransaction> transactions = event.getTransactions();
|
List<Transaction<BlockSnapshot>> transactions = event.getTransactions();
|
||||||
BlockTransaction first = transactions.get(0);
|
Transaction<BlockSnapshot> first = transactions.get(0);
|
||||||
Location loc = SpongeUtil.getLocation(worldname, first.getOriginal().getPosition());
|
Location loc = SpongeUtil.getLocation(worldname, first.getOriginal().getPosition());
|
||||||
Plot plot = MainUtil.getPlot(loc);
|
Plot plot = MainUtil.getPlot(loc);
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
@ -371,7 +366,6 @@ public class MainListener {
|
|||||||
onBlockChange(event);
|
onBlockChange(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void printCause(String method, Cause cause) {
|
public void printCause(String method, Cause cause) {
|
||||||
System.out.println(method + ": " + cause.toString());
|
System.out.println(method + ": " + cause.toString());
|
||||||
System.out.println(method + ": " + cause.getClass());
|
System.out.println(method + ": " + cause.getClass());
|
||||||
@ -433,8 +427,7 @@ public class MainListener {
|
|||||||
}
|
}
|
||||||
((SpongePlayer) user).player.sendMessage(Texts.join(components));
|
((SpongePlayer) user).player.sendMessage(Texts.join(components));
|
||||||
}
|
}
|
||||||
event.setMessage(Texts.of());
|
event.setMessage(null);
|
||||||
event.setCancelled(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Listener
|
@Listener
|
||||||
@ -529,8 +522,8 @@ public class MainListener {
|
|||||||
if (!PS.get().isPlotWorld(worldname)) {
|
if (!PS.get().isPlotWorld(worldname)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
List<BlockTransaction> transactions = event.getTransactions();
|
List<Transaction<BlockSnapshot>> transactions = event.getTransactions();
|
||||||
BlockTransaction first = transactions.get(0);
|
Transaction<BlockSnapshot> first = transactions.get(0);
|
||||||
BlockSnapshot pos = first.getOriginal();
|
BlockSnapshot pos = first.getOriginal();
|
||||||
Location loc = SpongeUtil.getLocation(worldname, pos.getPosition());
|
Location loc = SpongeUtil.getLocation(worldname, pos.getPosition());
|
||||||
Plot plot = MainUtil.getPlot(loc);
|
Plot plot = MainUtil.getPlot(loc);
|
||||||
@ -613,8 +606,8 @@ public class MainListener {
|
|||||||
if (!PS.get().isPlotWorld(worldname)) {
|
if (!PS.get().isPlotWorld(worldname)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
List<BlockTransaction> transactions = event.getTransactions();
|
List<Transaction<BlockSnapshot>> transactions = event.getTransactions();
|
||||||
BlockTransaction first = transactions.get(0);
|
Transaction<BlockSnapshot> first = transactions.get(0);
|
||||||
BlockSnapshot pos = first.getOriginal();
|
BlockSnapshot pos = first.getOriginal();
|
||||||
Location loc = SpongeUtil.getLocation(worldname, pos.getPosition());
|
Location loc = SpongeUtil.getLocation(worldname, pos.getPosition());
|
||||||
Plot plot = MainUtil.getPlot(loc);
|
Plot plot = MainUtil.getPlot(loc);
|
||||||
|
@ -225,6 +225,7 @@ public class SpongePlayer extends PlotPlayer {
|
|||||||
@Override
|
@Override
|
||||||
public void setTime(final long time) {
|
public void setTime(final long time) {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
|
if (time != Long.MAX_VALUE) {} else {}
|
||||||
throw new UnsupportedOperationException("NOT IMPLEMENTED YET");
|
throw new UnsupportedOperationException("NOT IMPLEMENTED YET");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package com.plotsquared.sponge.util;
|
package com.plotsquared.sponge.util;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Locale;
|
|
||||||
|
|
||||||
import org.spongepowered.api.entity.living.player.Player;
|
import org.spongepowered.api.entity.living.player.Player;
|
||||||
import org.spongepowered.api.item.ItemType;
|
import org.spongepowered.api.item.ItemType;
|
||||||
@ -105,7 +104,7 @@ public class SpongeInventoryUtil extends InventoryUtil {
|
|||||||
final Player player = sp.player;
|
final Player player = sp.player;
|
||||||
if (player.isViewingInventory()) {
|
if (player.isViewingInventory()) {
|
||||||
final CarriedInventory<? extends Carrier> inventory = player.getInventory();
|
final CarriedInventory<? extends Carrier> inventory = player.getInventory();
|
||||||
return inv.getTitle().equals(inventory.getName().getTranslation().get(Locale.ENGLISH));
|
return inv.getTitle().equals(inventory.getName().getId()); // TODO getId()
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -185,7 +185,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 TaskBuilder builder = game.getScheduler().createTaskBuilder();
|
||||||
builder.async().interval(TimeUnit.MINUTES.toMillis(PING_INTERVAL)).execute(new Runnable() {
|
builder.async().interval(PING_INTERVAL, TimeUnit.MINUTES).execute(new Runnable() {
|
||||||
|
|
||||||
private boolean firstPost = true;
|
private boolean firstPost = true;
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@ public class SpongeTaskManager extends TaskManager {
|
|||||||
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 TaskBuilder builder = SpongeMain.THIS.getGame().getScheduler().createTaskBuilder();
|
||||||
final TaskBuilder built = builder.delay(interval).interval(interval).execute(r);
|
final TaskBuilder 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;
|
||||||
@ -29,7 +29,7 @@ public class SpongeTaskManager extends TaskManager {
|
|||||||
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 TaskBuilder builder = SpongeMain.THIS.getGame().getScheduler().createTaskBuilder();
|
||||||
final TaskBuilder built = builder.delay(interval).async().interval(interval).execute(r);
|
final TaskBuilder 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;
|
||||||
@ -50,13 +50,13 @@ public class SpongeTaskManager extends TaskManager {
|
|||||||
@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 TaskBuilder builder = SpongeMain.THIS.getGame().getScheduler().createTaskBuilder();
|
||||||
builder.delay(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 TaskBuilder builder = SpongeMain.THIS.getGame().getScheduler().createTaskBuilder();
|
||||||
builder.async().delay(delay).execute(r).submit(SpongeMain.THIS.getPlugin());
|
builder.async().delayTicks(delay).execute(r).submit(SpongeMain.THIS.getPlugin());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Binary file not shown.
Loading…
Reference in New Issue
Block a user