mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2025-01-19 16:59:36 +01:00
Schematic export + Administrator plot merging
This commit is contained in:
parent
7a558b34da
commit
a6d6c34902
@ -6,7 +6,7 @@
|
|||||||
<groupId>com.intellectualcrafters</groupId>
|
<groupId>com.intellectualcrafters</groupId>
|
||||||
|
|
||||||
<artifactId>PlotSquared</artifactId>
|
<artifactId>PlotSquared</artifactId>
|
||||||
<version>2.5.1</version>
|
<version>2.5.3</version>
|
||||||
<name>PlotSquared</name>
|
<name>PlotSquared</name>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
<build>
|
<build>
|
||||||
|
@ -1533,7 +1533,7 @@ import java.util.concurrent.TimeUnit;
|
|||||||
UUIDHandler.uuidWrapper = new OfflineUUIDWrapper();
|
UUIDHandler.uuidWrapper = new OfflineUUIDWrapper();
|
||||||
Settings.OFFLINE_MODE = true;
|
Settings.OFFLINE_MODE = true;
|
||||||
}
|
}
|
||||||
else if (checkVersion && Bukkit.getOnlineMode()) {
|
else if (checkVersion) {
|
||||||
UUIDHandler.uuidWrapper = new DefaultUUIDWrapper();
|
UUIDHandler.uuidWrapper = new DefaultUUIDWrapper();
|
||||||
Settings.OFFLINE_MODE = false;
|
Settings.OFFLINE_MODE = false;
|
||||||
}
|
}
|
||||||
|
@ -83,10 +83,11 @@ public class Merge extends SubCommand {
|
|||||||
}
|
}
|
||||||
final Plot plot = PlayerFunctions.getCurrentPlot(plr);
|
final Plot plot = PlayerFunctions.getCurrentPlot(plr);
|
||||||
if ((plot == null) || !plot.hasOwner()) {
|
if ((plot == null) || !plot.hasOwner()) {
|
||||||
PlayerFunctions.sendMessage(plr, C.NO_PLOT_PERMS);
|
PlayerFunctions.sendMessage(plr, C.PLOT_UNOWNED);
|
||||||
return false;
|
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);
|
PlayerFunctions.sendMessage(plr, C.NO_PLOT_PERMS);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -129,7 +130,7 @@ public class Merge extends SubCommand {
|
|||||||
}
|
}
|
||||||
for (final PlotId myid : plots) {
|
for (final PlotId myid : plots) {
|
||||||
final Plot myplot = PlotMain.getPlots(world).get(myid);
|
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()));
|
PlayerFunctions.sendMessage(plr, C.NO_PERM_MERGE.s().replaceAll("%plot%", myid.toString()));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -161,7 +162,7 @@ public class Merge extends SubCommand {
|
|||||||
PlayerFunctions.sendMessage(plr, "&cPlots have been merged");
|
PlayerFunctions.sendMessage(plr, "&cPlots have been merged");
|
||||||
PlotHelper.mergePlots(world, plots);
|
PlotHelper.mergePlots(world, plots);
|
||||||
|
|
||||||
PlotHelper.setSign(world, plr.getName(), plot);
|
PlotHelper.setSign(world, UUIDHandler.getName(plot.owner), plot);
|
||||||
|
|
||||||
if (PlotHelper.canSetFast) {
|
if (PlotHelper.canSetFast) {
|
||||||
SetBlockFast.update(plr);
|
SetBlockFast.update(plr);
|
||||||
|
@ -244,7 +244,7 @@ public enum C {
|
|||||||
/*
|
/*
|
||||||
* Info
|
* 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("" +
|
* PLOT_INFO("" +
|
||||||
* "&6ID&7: &a%id%&7\n" +
|
* "&6ID&7: &a%id%&7\n" +
|
||||||
|
@ -21,6 +21,8 @@
|
|||||||
|
|
||||||
package com.intellectualcrafters.plot.config;
|
package com.intellectualcrafters.plot.config;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Updater and DB settings
|
* Updater and DB settings
|
||||||
*
|
*
|
||||||
|
@ -100,14 +100,16 @@ public class UUIDHandler {
|
|||||||
return s.endsWith(".dat");
|
return s.endsWith(".dat");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
for (String current : dat) {
|
if (dat != null) {
|
||||||
String s = current.replaceAll(".dat$", "");
|
for (String current : dat) {
|
||||||
try {
|
String s = current.replaceAll(".dat$", "");
|
||||||
UUID uuid = UUID.fromString(s);
|
try {
|
||||||
uuids.add(uuid);
|
UUID uuid = UUID.fromString(s);
|
||||||
}
|
uuids.add(uuid);
|
||||||
catch (Exception e) {
|
}
|
||||||
PlotMain.sendConsoleSenderMessage(C.PREFIX.s() + "Invalid playerdata: "+current);
|
catch (Exception e) {
|
||||||
|
PlotMain.sendConsoleSenderMessage(C.PREFIX.s() + "Invalid playerdata: "+current);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -118,13 +120,15 @@ public class UUIDHandler {
|
|||||||
return s.endsWith(".dat");
|
return s.endsWith(".dat");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
for (String current : dat) {
|
if (dat != null) {
|
||||||
names.add(current.replaceAll(".dat$", ""));
|
for (String current : dat) {
|
||||||
|
names.add(current.replaceAll(".dat$", ""));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
UUIDWrapper wrapper = null;
|
UUIDWrapper wrapper = new DefaultUUIDWrapper();
|
||||||
for (UUID uuid : uuids) {
|
for (UUID uuid : uuids) {
|
||||||
try {
|
try {
|
||||||
OfflinePlayer player = wrapper.getOfflinePlayer(uuid);
|
OfflinePlayer player = wrapper.getOfflinePlayer(uuid);
|
||||||
@ -155,6 +159,10 @@ public class UUIDHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static String getName(UUID uuid) {
|
public static String getName(UUID uuid) {
|
||||||
|
if (uuid == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
// check online
|
// check online
|
||||||
for (Player player : Bukkit.getOnlinePlayers()) {
|
for (Player player : Bukkit.getOnlinePlayers()) {
|
||||||
UUID u2 = UUIDHandler.uuidWrapper.getUUID(player);
|
UUID u2 = UUIDHandler.uuidWrapper.getUUID(player);
|
||||||
@ -182,6 +190,10 @@ public class UUIDHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static UUID getUUID(final String name) {
|
public static UUID getUUID(final String name) {
|
||||||
|
if (name == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
// check online
|
// check online
|
||||||
Player player = Bukkit.getPlayer(name);
|
Player player = Bukkit.getPlayer(name);
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user