Schematic export + Administrator plot merging

This commit is contained in:
boy0001 2015-01-02 00:22:59 +11:00
parent 7a558b34da
commit a6d6c34902
6 changed files with 33 additions and 18 deletions

View File

@ -6,7 +6,7 @@
<groupId>com.intellectualcrafters</groupId>
<artifactId>PlotSquared</artifactId>
<version>2.5.1</version>
<version>2.5.3</version>
<name>PlotSquared</name>
<packaging>jar</packaging>
<build>

View File

@ -1533,7 +1533,7 @@ import java.util.concurrent.TimeUnit;
UUIDHandler.uuidWrapper = new OfflineUUIDWrapper();
Settings.OFFLINE_MODE = true;
}
else if (checkVersion && Bukkit.getOnlineMode()) {
else if (checkVersion) {
UUIDHandler.uuidWrapper = new DefaultUUIDWrapper();
Settings.OFFLINE_MODE = false;
}

View File

@ -83,10 +83,11 @@ public class Merge extends SubCommand {
}
final Plot plot = PlayerFunctions.getCurrentPlot(plr);
if ((plot == null) || !plot.hasOwner()) {
PlayerFunctions.sendMessage(plr, C.NO_PLOT_PERMS);
PlayerFunctions.sendMessage(plr, C.PLOT_UNOWNED);
return false;
}
if (!plot.getOwner().equals(UUIDHandler.getUUID(plr))) {
boolean admin = PlotMain.hasPermission(plr, "plots.admin");
if (!plot.getOwner().equals(UUIDHandler.getUUID( plr)) && !admin) {
PlayerFunctions.sendMessage(plr, C.NO_PLOT_PERMS);
return false;
}
@ -129,7 +130,7 @@ public class Merge extends SubCommand {
}
for (final PlotId myid : plots) {
final Plot myplot = PlotMain.getPlots(world).get(myid);
if ((myplot == null) || !myplot.hasOwner() || !(myplot.getOwner().equals(UUIDHandler.getUUID(plr)))) {
if ((myplot == null) || !myplot.hasOwner() || !(myplot.getOwner().equals(UUIDHandler.getUUID(plr)) || admin)) {
PlayerFunctions.sendMessage(plr, C.NO_PERM_MERGE.s().replaceAll("%plot%", myid.toString()));
return false;
}
@ -161,7 +162,7 @@ public class Merge extends SubCommand {
PlayerFunctions.sendMessage(plr, "&cPlots have been merged");
PlotHelper.mergePlots(world, plots);
PlotHelper.setSign(world, plr.getName(), plot);
PlotHelper.setSign(world, UUIDHandler.getName(plot.owner), plot);
if (PlotHelper.canSetFast) {
SetBlockFast.update(plr);

View File

@ -244,7 +244,7 @@ public enum C {
/*
* Info
*/
PLOT_INFO_UNCLAIMED("&cPlot &6%s&c is not yet claimed"),
PLOT_UNOWNED("&cThe current plot must have an owner to perform this action"),
/*
* PLOT_INFO("" +
* "&6ID&7: &a%id%&7\n" +

View File

@ -21,6 +21,8 @@
package com.intellectualcrafters.plot.config;
import org.bukkit.Bukkit;
/**
* Updater and DB settings
*

View File

@ -100,14 +100,16 @@ public class UUIDHandler {
return s.endsWith(".dat");
}
});
for (String current : dat) {
String s = current.replaceAll(".dat$", "");
try {
UUID uuid = UUID.fromString(s);
uuids.add(uuid);
}
catch (Exception e) {
PlotMain.sendConsoleSenderMessage(C.PREFIX.s() + "Invalid playerdata: "+current);
if (dat != null) {
for (String current : dat) {
String s = current.replaceAll(".dat$", "");
try {
UUID uuid = UUID.fromString(s);
uuids.add(uuid);
}
catch (Exception e) {
PlotMain.sendConsoleSenderMessage(C.PREFIX.s() + "Invalid playerdata: "+current);
}
}
}
@ -118,13 +120,15 @@ public class UUIDHandler {
return s.endsWith(".dat");
}
});
for (String current : dat) {
names.add(current.replaceAll(".dat$", ""));
if (dat != null) {
for (String current : dat) {
names.add(current.replaceAll(".dat$", ""));
}
}
}
UUIDWrapper wrapper = null;
UUIDWrapper wrapper = new DefaultUUIDWrapper();
for (UUID uuid : uuids) {
try {
OfflinePlayer player = wrapper.getOfflinePlayer(uuid);
@ -155,6 +159,10 @@ public class UUIDHandler {
}
public static String getName(UUID uuid) {
if (uuid == null) {
return null;
}
// check online
for (Player player : Bukkit.getOnlinePlayers()) {
UUID u2 = UUIDHandler.uuidWrapper.getUUID(player);
@ -182,6 +190,10 @@ public class UUIDHandler {
}
public static UUID getUUID(final String name) {
if (name == null) {
return null;
}
// check online
Player player = Bukkit.getPlayer(name);
if (player != null) {