This commit is contained in:
MattBDev
2016-04-04 12:49:11 -04:00
16 changed files with 717 additions and 652 deletions

View File

@ -53,7 +53,6 @@ import com.intellectualcrafters.plot.util.WorldUtil;
import com.intellectualcrafters.plot.util.area.QuadMap;
import com.plotsquared.listener.WESubscriber;
import com.sk89q.worldedit.WorldEdit;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
@ -2030,6 +2029,7 @@ public class PS {
// Teleportation
options.put("teleport.on_login", Settings.TELEPORT_ON_LOGIN);
options.put("teleport.on_death", Settings.TELEPORT_ON_DEATH);
options.put("teleport.delay", Settings.TELEPORT_DELAY);
// WorldEdit
@ -2140,6 +2140,7 @@ public class PS {
// Teleportation
Settings.TELEPORT_DELAY = this.config.getInt("teleport.delay");
Settings.TELEPORT_ON_LOGIN = this.config.getBoolean("teleport.on_login");
Settings.TELEPORT_ON_DEATH = this.config.getBoolean("teleport.on_death");
// WorldEdit
Settings.QUEUE_COMMANDS = this.config.getBoolean("worldedit.queue-commands");

View File

@ -5,7 +5,6 @@ import com.intellectualcrafters.configuration.file.YamlConfiguration;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.util.StringMan;
import com.plotsquared.general.commands.CommandCaller;
import java.io.File;
import java.util.EnumSet;
import java.util.HashMap;
@ -58,6 +57,7 @@ public enum C {
PERMISSION_COMMANDS_CHAT("plots.admin.command.chat", "static.permissions"),
PERMISSION_MERGE_OTHER("plots.merge.other", "static.permissions"),
PERMISSION_ADMIN_DESTROY_UNOWNED("plots.admin.destroy.unowned", "static.permissions"),
PERMISSION_ADMIN_DESTROY_GROUNDLEVEL("plots.admin.destroy.groundlevel", "static.permissions"),
PERMISSION_ADMIN_DESTROY_OTHER("plots.admin.destroy.other", "static.permissions"),
PERMISSION_ADMIN_DESTROY_ROAD("plots.admin.destroy.road", "static.permissions"),
PERMISSION_ADMIN_BUILD_ROAD("plots.admin.build.road", "static.permissions"),

View File

@ -11,10 +11,10 @@ import java.util.List;
*/
public class Settings {
public static boolean USE_SQLUUIDHANDLER = false;
public static boolean AUTO_PURGE = false;
/**
*
*
*/
public static boolean UPDATE_NOTIFICATIONS = true;
@ -26,7 +26,7 @@ public class Settings {
public static boolean PERMISSION_CACHING = true;
public static boolean CACHE_RATINGS = true;
public static boolean UUID_FROM_DISK = false;
/**
* Web
*/
@ -82,6 +82,10 @@ public class Settings {
* Teleport to path on login
*/
public static boolean TELEPORT_ON_LOGIN = false;
/**
* Teleport to path on death
*/
public static boolean TELEPORT_ON_DEATH = false;
/**
* Display titles
*/
@ -156,7 +160,7 @@ public class Settings {
* Use global plot limit?
*/
public static boolean GLOBAL_LIMIT = false;
/**
* Database settings
*

View File

@ -4,6 +4,7 @@ import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.object.ChunkLoc;
import com.intellectualcrafters.plot.object.Location;
import com.intellectualcrafters.plot.object.Plot;
import com.intellectualcrafters.plot.object.PlotPlayer;
import com.intellectualcrafters.plot.object.RegionWrapper;
import com.intellectualcrafters.plot.object.RunnableVal;
import com.intellectualcrafters.plot.util.SetQueue.ChunkWrapper;
@ -11,7 +12,9 @@ import com.intellectualcrafters.plot.util.SetQueue.ChunkWrapper;
import java.io.File;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
public abstract class ChunkManager {
@ -226,7 +229,19 @@ public abstract class ChunkManager {
return chunks;
}
public abstract void regenerateChunk(String world, ChunkLoc loc);
public void regenerateChunk(String world, ChunkLoc loc) {
SetQueue.IMP.regenerateChunk(world, loc);
SetQueue.IMP.queue.sendChunk(world, Collections.singletonList(loc));
for (Map.Entry<String, PlotPlayer> entry : UUIDHandler.getPlayers().entrySet()) {
PlotPlayer pp = entry.getValue();
Location pLoc = pp.getLocation();
if (!StringMan.isEqual(world, pLoc.getWorld()) || !pLoc.getChunkLoc().equals(loc)) {
continue;
}
pLoc.setY(WorldUtil.IMP.getHighestBlock(world, pLoc.getX(), pLoc.getZ()));
pp.teleport(pLoc);
}
}
public void deleteRegionFiles(String world, Collection<ChunkLoc> chunks) {
deleteRegionFiles(world, chunks, null);

View File

@ -15,7 +15,6 @@ import com.intellectualcrafters.plot.object.PlotId;
import com.intellectualcrafters.plot.object.PlotPlayer;
import com.intellectualcrafters.plot.object.Rating;
import com.plotsquared.listener.PlayerBlockEventType;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.UUID;
@ -78,6 +77,19 @@ public abstract class EventUtil {
}
}
public void doDeathTask(final PlotPlayer pp) {
final Plot plot = pp.getCurrentPlot();
if (Settings.TELEPORT_ON_DEATH && plot != null) {
TaskManager.runTask(new Runnable() {
@Override
public void run() {
plot.teleportPlayer(pp);
}
});
MainUtil.sendMessage(pp, C.TELEPORTED_TO_ROAD);
}
}
public boolean checkPlayerBlockEvent(PlotPlayer pp, PlayerBlockEventType type, Location loc, LazyBlock block, boolean notifyPerms) {
PlotArea area = PS.get().getPlotAreaAbs(loc);
Plot plot;

View File

@ -26,5 +26,7 @@ public interface PlotQueue<T> {
PlotChunk<T> next(ChunkWrapper wrap, boolean fixLighting);
void clear();
void regenerateChunk(String world, ChunkLoc loc);
}

View File

@ -1,7 +1,7 @@
package com.intellectualcrafters.plot.util;
import com.intellectualcrafters.plot.object.ChunkLoc;
import com.intellectualcrafters.plot.object.PlotBlock;
import java.util.ArrayDeque;
import java.util.concurrent.atomic.AtomicInteger;
@ -149,6 +149,10 @@ public class SetQueue {
return this.queue.setBlock(world, x, y, z, (short) id, (byte) 0);
}
public void regenerateChunk(String world, ChunkLoc loc) {
queue.regenerateChunk(world, loc);
}
public class ChunkWrapper {
public final int x;