mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-24 06:06:45 +01:00
Fix compile
Recover on unknown command error Fixes #1224 Close #1213 (fixed elsewhere) Fixes #1212
This commit is contained in:
parent
f8e97f14d6
commit
06682b18a5
@ -1,6 +1,6 @@
|
|||||||
dependencies {
|
dependencies {
|
||||||
compile project(':Core')
|
compile project(':Core')
|
||||||
compile 'org.spigotmc:spigot-api:1.10.2-R0.1-SNAPSHOT'
|
compile 'org.bukkit:Spigot:1.10'
|
||||||
compile 'org.mcstats.bukkit:metrics:R7'
|
compile 'org.mcstats.bukkit:metrics:R7'
|
||||||
compile 'net.milkbowl.vault:VaultAPI:1.6'
|
compile 'net.milkbowl.vault:VaultAPI:1.6'
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
package com.plotsquared.bukkit.listeners;
|
package com.plotsquared.bukkit.listeners;
|
||||||
|
|
||||||
import static com.intellectualcrafters.plot.util.ReflectionUtils.getRefClass;
|
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.PS;
|
import com.intellectualcrafters.plot.PS;
|
||||||
import com.intellectualcrafters.plot.config.Settings;
|
import com.intellectualcrafters.plot.config.Settings;
|
||||||
import com.intellectualcrafters.plot.object.Location;
|
import com.intellectualcrafters.plot.object.Location;
|
||||||
@ -10,6 +8,8 @@ import com.intellectualcrafters.plot.util.ReflectionUtils.RefClass;
|
|||||||
import com.intellectualcrafters.plot.util.ReflectionUtils.RefField;
|
import com.intellectualcrafters.plot.util.ReflectionUtils.RefField;
|
||||||
import com.intellectualcrafters.plot.util.ReflectionUtils.RefMethod;
|
import com.intellectualcrafters.plot.util.ReflectionUtils.RefMethod;
|
||||||
import com.intellectualcrafters.plot.util.TaskManager;
|
import com.intellectualcrafters.plot.util.TaskManager;
|
||||||
|
import java.lang.reflect.Method;
|
||||||
|
import java.util.HashSet;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Chunk;
|
import org.bukkit.Chunk;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
@ -28,8 +28,8 @@ import org.bukkit.event.entity.ItemSpawnEvent;
|
|||||||
import org.bukkit.event.world.ChunkLoadEvent;
|
import org.bukkit.event.world.ChunkLoadEvent;
|
||||||
import org.bukkit.event.world.ChunkUnloadEvent;
|
import org.bukkit.event.world.ChunkUnloadEvent;
|
||||||
|
|
||||||
import java.lang.reflect.Method;
|
|
||||||
import java.util.HashSet;
|
import static com.intellectualcrafters.plot.util.ReflectionUtils.getRefClass;
|
||||||
|
|
||||||
public class ChunkListener implements Listener {
|
public class ChunkListener implements Listener {
|
||||||
|
|
||||||
@ -100,14 +100,21 @@ public class ChunkListener implements Listener {
|
|||||||
}, 1);
|
}, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean ignoreUnload = false;
|
||||||
|
|
||||||
public boolean unloadChunk(String world, Chunk chunk, boolean safe) {
|
public boolean unloadChunk(String world, Chunk chunk, boolean safe) {
|
||||||
if (safe && shouldSave(world, chunk.getX(), chunk.getZ())) {
|
if (safe && shouldSave(world, chunk.getX(), chunk.getZ())) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
Object c = this.methodGetHandleChunk.of(chunk).call();
|
Object c = this.methodGetHandleChunk.of(chunk).call();
|
||||||
this.mustSave.of(c).set(false);
|
RefField.RefExecutor field = this.mustSave.of(c);
|
||||||
if (chunk.isLoaded()) {
|
if (field.get() == true) {
|
||||||
chunk.unload(false, false);
|
field.set(false);
|
||||||
|
if (chunk.isLoaded()) {
|
||||||
|
ignoreUnload = true;
|
||||||
|
chunk.unload(false, false);
|
||||||
|
ignoreUnload = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -139,6 +146,9 @@ public class ChunkListener implements Listener {
|
|||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onChunkUnload(ChunkUnloadEvent event) {
|
public void onChunkUnload(ChunkUnloadEvent event) {
|
||||||
|
if (ignoreUnload) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (Settings.Chunk_Processor.AUTO_TRIM) {
|
if (Settings.Chunk_Processor.AUTO_TRIM) {
|
||||||
Chunk chunk = event.getChunk();
|
Chunk chunk = event.getChunk();
|
||||||
String world = chunk.getWorld().getName();
|
String world = chunk.getWorld().getName();
|
||||||
|
@ -1374,7 +1374,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
|||||||
this.lastRadius = event.getRadius() + 1;
|
this.lastRadius = event.getRadius() + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean checkEntity(Plot plot, IntegerFlag... flags) {
|
public static boolean checkEntity(Plot plot, IntegerFlag... flags) {
|
||||||
int[] mobs = null;
|
int[] mobs = null;
|
||||||
for (IntegerFlag flag : flags) {
|
for (IntegerFlag flag : flags) {
|
||||||
int i;
|
int i;
|
||||||
|
@ -223,7 +223,12 @@ public class MainCommand extends Command {
|
|||||||
args = Arrays.copyOfRange(args, 1, args.length);
|
args = Arrays.copyOfRange(args, 1, args.length);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
super.execute(player, args, confirm, whenDone);
|
try {
|
||||||
|
super.execute(player, args, confirm, whenDone);
|
||||||
|
} catch (Throwable e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
C.ERROR.send(player, e.getLocalizedMessage());
|
||||||
|
}
|
||||||
// Reset command scope //
|
// Reset command scope //
|
||||||
if (tp && !(player instanceof ConsolePlayer)) {
|
if (tp && !(player instanceof ConsolePlayer)) {
|
||||||
if (loc == null) {
|
if (loc == null) {
|
||||||
|
@ -4,10 +4,13 @@ import com.intellectualcrafters.plot.PS;
|
|||||||
import com.intellectualcrafters.plot.config.C;
|
import com.intellectualcrafters.plot.config.C;
|
||||||
import com.intellectualcrafters.plot.object.Plot;
|
import com.intellectualcrafters.plot.object.Plot;
|
||||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
|
import com.intellectualcrafters.plot.object.RunnableVal2;
|
||||||
|
import com.intellectualcrafters.plot.object.RunnableVal3;
|
||||||
import com.intellectualcrafters.plot.util.MainUtil;
|
import com.intellectualcrafters.plot.util.MainUtil;
|
||||||
import com.intellectualcrafters.plot.util.MathMan;
|
import com.intellectualcrafters.plot.util.MathMan;
|
||||||
import com.intellectualcrafters.plot.util.Permissions;
|
import com.intellectualcrafters.plot.util.Permissions;
|
||||||
import com.intellectualcrafters.plot.util.UUIDHandler;
|
import com.intellectualcrafters.plot.util.UUIDHandler;
|
||||||
|
import com.plotsquared.general.commands.Command;
|
||||||
import com.plotsquared.general.commands.CommandDeclaration;
|
import com.plotsquared.general.commands.CommandDeclaration;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
@ -20,14 +23,23 @@ import java.util.UUID;
|
|||||||
command = "visit",
|
command = "visit",
|
||||||
permission = "plots.visit",
|
permission = "plots.visit",
|
||||||
description = "Visit someones plot",
|
description = "Visit someones plot",
|
||||||
usage = "/plot visit [player|alias|world|id] [#]",
|
usage = "/plot visit [<player>|<alias>|<world>|<id>] [#]",
|
||||||
aliases = {"v", "tp", "teleport", "goto", "home", "h"},
|
aliases = {"v", "tp", "teleport", "goto", "home", "h"},
|
||||||
requiredType = RequiredType.NONE,
|
requiredType = RequiredType.NONE,
|
||||||
category = CommandCategory.TELEPORT)
|
category = CommandCategory.TELEPORT)
|
||||||
public class Visit extends SubCommand {
|
public class Visit extends Command {
|
||||||
|
|
||||||
|
public Visit() {
|
||||||
|
super(MainCommand.getInstance(), true);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(PlotPlayer player, String[] args) {
|
public Collection<Command> tab(PlotPlayer player, String[] args, boolean space) {
|
||||||
|
return tabOf(player, args, space, getUsage());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void execute(final PlotPlayer player, String[] args, RunnableVal3<Command, Runnable, Runnable> confirm, final RunnableVal2<Command, CommandResult> whenDone) throws CommandException {
|
||||||
if (args.length == 1 && args[0].contains(":")) {
|
if (args.length == 1 && args[0].contains(":")) {
|
||||||
args = args[0].split(":");
|
args = args[0].split(":");
|
||||||
}
|
}
|
||||||
@ -36,9 +48,9 @@ public class Visit extends SubCommand {
|
|||||||
switch (args.length) {
|
switch (args.length) {
|
||||||
case 2:
|
case 2:
|
||||||
if (!MathMan.isInteger(args[1])) {
|
if (!MathMan.isInteger(args[1])) {
|
||||||
sendMessage(player, C.NOT_VALID_NUMBER, "(1, ∞)");
|
C.NOT_VALID_NUMBER.send(player, "(1, ∞)");
|
||||||
sendMessage(player, C.COMMAND_SYNTAX, "/plot visit " + args[0] + " [#]");
|
C.COMMAND_SYNTAX.send(player, getUsage());;
|
||||||
return false;
|
return;
|
||||||
}
|
}
|
||||||
page = Integer.parseInt(args[1]);
|
page = Integer.parseInt(args[1]);
|
||||||
case 1:
|
case 1:
|
||||||
@ -68,8 +80,8 @@ public class Visit extends SubCommand {
|
|||||||
page = 1;
|
page = 1;
|
||||||
}
|
}
|
||||||
if (unsorted == null || unsorted.isEmpty()) {
|
if (unsorted == null || unsorted.isEmpty()) {
|
||||||
sendMessage(player, C.FOUND_NO_PLOTS);
|
C.FOUND_NO_PLOTS.send(player);
|
||||||
return false;
|
return;
|
||||||
}
|
}
|
||||||
Iterator<Plot> iterator = unsorted.iterator();
|
Iterator<Plot> iterator = unsorted.iterator();
|
||||||
while (iterator.hasNext()) {
|
while (iterator.hasNext()) {
|
||||||
@ -78,34 +90,47 @@ public class Visit extends SubCommand {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (page < 1 || page > unsorted.size()) {
|
if (page < 1 || page > unsorted.size()) {
|
||||||
sendMessage(player, C.NOT_VALID_NUMBER, "(1, " + unsorted.size() + ')');
|
C.NOT_VALID_NUMBER.send(player, "(1, " + unsorted.size() + ")");
|
||||||
return false;
|
return;
|
||||||
}
|
}
|
||||||
List<Plot> plots = PS.get().sortPlotsByTemp(unsorted);
|
List<Plot> plots = PS.get().sortPlotsByTemp(unsorted);
|
||||||
Plot plot = plots.get(page - 1);
|
final Plot plot = plots.get(page - 1);
|
||||||
if (!plot.hasOwner()) {
|
if (!plot.hasOwner()) {
|
||||||
if (!Permissions.hasPermission(player, "plots.visit.unowned")) {
|
if (!Permissions.hasPermission(player, "plots.visit.unowned")) {
|
||||||
sendMessage(player, C.NO_PERMISSION, "plots.visit.unowned");
|
C.NO_PERMISSION.send(player, "plots.visit.unowned");
|
||||||
return false;
|
return;
|
||||||
}
|
}
|
||||||
} else if (plot.isOwner(player.getUUID())) {
|
} else if (plot.isOwner(player.getUUID())) {
|
||||||
if (!Permissions.hasPermission(player, "plots.visit.owned") && !Permissions.hasPermission(player, "plots.home")) {
|
if (!Permissions.hasPermission(player, "plots.visit.owned") && !Permissions.hasPermission(player, "plots.home")) {
|
||||||
sendMessage(player, C.NO_PERMISSION, "plots.visit.owned, plots.home");
|
C.NO_PERMISSION.send(player, "plots.visit.owned, plots.home");
|
||||||
return false;
|
return;
|
||||||
}
|
}
|
||||||
} else if (plot.isAdded(player.getUUID())) {
|
} else if (plot.isAdded(player.getUUID())) {
|
||||||
if (!Permissions.hasPermission(player, "plots.visit.shared")) {
|
if (!Permissions.hasPermission(player, "plots.visit.shared")) {
|
||||||
sendMessage(player, C.NO_PERMISSION, "plots.visit.shared");
|
C.NO_PERMISSION.send(player, "plots.visit.shared");
|
||||||
return false;
|
return;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (!Permissions.hasPermission(player, "plots.visit.other")) {
|
if (!Permissions.hasPermission(player, "plots.visit.other")) {
|
||||||
sendMessage(player, C.NO_PERMISSION, "plots.visit.other");
|
C.NO_PERMISSION.send(player, "plots.visit.other");
|
||||||
return false;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
plot.teleportPlayer(player);
|
confirm.run(this, new Runnable() {
|
||||||
return true;
|
@Override
|
||||||
|
public void run() {
|
||||||
|
if (plot.teleportPlayer(player)) {
|
||||||
|
whenDone.run(Visit.this, CommandResult.SUCCESS);
|
||||||
|
} else {
|
||||||
|
whenDone.run(Visit.this, CommandResult.SUCCESS);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
whenDone.run(Visit.this, CommandResult.FAILURE);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -365,6 +365,10 @@ public enum C {
|
|||||||
INVALID_PLAYER_WAIT("$2Player not found: $1%s$2, fetching it. Try again soon.", "Errors"),
|
INVALID_PLAYER_WAIT("$2Player not found: $1%s$2, fetching it. Try again soon.", "Errors"),
|
||||||
INVALID_PLAYER("$2Player not found: $1%s$2.", "Errors"),
|
INVALID_PLAYER("$2Player not found: $1%s$2.", "Errors"),
|
||||||
INVALID_PLAYER_OFFLINE("$2The player must be online: $1%s.", "Errors"),
|
INVALID_PLAYER_OFFLINE("$2The player must be online: $1%s.", "Errors"),
|
||||||
|
/*
|
||||||
|
* Unknown Error
|
||||||
|
*/
|
||||||
|
ERROR("$2An error occured: %s", "Errors"),
|
||||||
// SETTINGS_PASTE_UPLOADED("$2settings.yml was uploaded to: $1%url%", "Paste"),
|
// SETTINGS_PASTE_UPLOADED("$2settings.yml was uploaded to: $1%url%", "Paste"),
|
||||||
// LATEST_LOG_UPLOADED("$2latest.log was uploaded to: $1%url%", "Paste"),
|
// LATEST_LOG_UPLOADED("$2latest.log was uploaded to: $1%url%", "Paste"),
|
||||||
DEBUG_REPORT_CREATED("$1Uploaded a full debug to: $1%url%", "Paste"),
|
DEBUG_REPORT_CREATED("$1Uploaded a full debug to: $1%url%", "Paste"),
|
||||||
|
@ -484,6 +484,23 @@ public abstract class Command {
|
|||||||
return getCommandString() + " " + args + "]";
|
return getCommandString() + " " + args + "]";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Collection<Command> tabOf(PlotPlayer player, String[] input, boolean space, String... args) {
|
||||||
|
/*
|
||||||
|
<player>
|
||||||
|
<alias>
|
||||||
|
<world>
|
||||||
|
<id>
|
||||||
|
<#>
|
||||||
|
*/
|
||||||
|
// int index = input.length - (space ? 0 : 1);
|
||||||
|
// List<Command> result = new ArrayList<>();
|
||||||
|
// for (String arg : args) {
|
||||||
|
// String[] split = arg.split(" ");
|
||||||
|
// }
|
||||||
|
// TODO
|
||||||
|
return new ArrayList<>();
|
||||||
|
}
|
||||||
|
|
||||||
public Collection<Command> tab(PlotPlayer player, String[] args, boolean space) {
|
public Collection<Command> tab(PlotPlayer player, String[] args, boolean space) {
|
||||||
switch (args.length) {
|
switch (args.length) {
|
||||||
case 0:
|
case 0:
|
||||||
|
@ -75,11 +75,11 @@ public class PlotListener {
|
|||||||
Optional<Boolean> flyFlag = plot.getFlag(Flags.FLY);
|
Optional<Boolean> flyFlag = plot.getFlag(Flags.FLY);
|
||||||
if (flyFlag.isPresent()) {
|
if (flyFlag.isPresent()) {
|
||||||
boolean flight = player.getFlight();
|
boolean flight = player.getFlight();
|
||||||
|
PlotGameMode gamemode = player.getGameMode();
|
||||||
|
if (flight != (gamemode == PlotGameMode.CREATIVE || gamemode == PlotGameMode.SPECTATOR)) {
|
||||||
|
player.setPersistentMeta("flight", ByteArrayUtilities.booleanToBytes(player.getFlight()));
|
||||||
|
}
|
||||||
if (flyFlag.get() != player.getFlight()) {
|
if (flyFlag.get() != player.getFlight()) {
|
||||||
PlotGameMode gamemode = player.getGameMode();
|
|
||||||
if (flight != (gamemode == PlotGameMode.CREATIVE || gamemode == PlotGameMode.SPECTATOR)) {
|
|
||||||
player.setPersistentMeta("flight", ByteArrayUtilities.booleanToBytes(player.getFlight()));
|
|
||||||
}
|
|
||||||
player.setFlight(flyFlag.get());
|
player.setFlight(flyFlag.get());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -209,6 +209,8 @@ public class PlotListener {
|
|||||||
PlotGameMode gameMode = player.getGameMode();
|
PlotGameMode gameMode = player.getGameMode();
|
||||||
if (gameMode == PlotGameMode.SURVIVAL || gameMode == PlotGameMode.ADVENTURE) {
|
if (gameMode == PlotGameMode.SURVIVAL || gameMode == PlotGameMode.ADVENTURE) {
|
||||||
player.setFlight(false);
|
player.setFlight(false);
|
||||||
|
} else if (player.getFlight() != true) {
|
||||||
|
player.setFlight(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
4
gradle/wrapper/gradle-wrapper.properties
vendored
4
gradle/wrapper/gradle-wrapper.properties
vendored
@ -1,6 +1,6 @@
|
|||||||
#Wed Jun 22 12:28:48 EDT 2016
|
#Tue Jun 28 19:14:40 AEST 2016
|
||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14-all.zip
|
||||||
|
8
pom.xml
8
pom.xml
@ -73,12 +73,16 @@
|
|||||||
<id>vault-repo</id>
|
<id>vault-repo</id>
|
||||||
<url>http://nexus.theyeticave.net/content/repositories/pub_releases</url>
|
<url>http://nexus.theyeticave.net/content/repositories/pub_releases</url>
|
||||||
</repository>
|
</repository>
|
||||||
|
<repository>
|
||||||
|
<id>empcraft-repo</id>
|
||||||
|
<url>http://empcraft.com/maven2</url>
|
||||||
|
</repository>
|
||||||
</repositories>
|
</repositories>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.bukkit</groupId>
|
<groupId>org.bukkit</groupId>
|
||||||
<artifactId>bukkit</artifactId>
|
<artifactId>Spigot</artifactId>
|
||||||
<version>1.10-R0.1-SNAPSHOT</version>
|
<version>1.10</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.sk89q</groupId>
|
<groupId>com.sk89q</groupId>
|
||||||
|
Loading…
Reference in New Issue
Block a user