mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2025-01-19 16:59:36 +01:00
home
This commit is contained in:
parent
ef9e1dd1ac
commit
1f76b5c551
@ -46,6 +46,7 @@ import com.intellectualcrafters.plot.object.PlotCluster;
|
|||||||
import com.intellectualcrafters.plot.object.PlotGenerator;
|
import com.intellectualcrafters.plot.object.PlotGenerator;
|
||||||
import com.intellectualcrafters.plot.object.PlotId;
|
import com.intellectualcrafters.plot.object.PlotId;
|
||||||
import com.intellectualcrafters.plot.object.PlotManager;
|
import com.intellectualcrafters.plot.object.PlotManager;
|
||||||
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
import com.intellectualcrafters.plot.object.PlotWorld;
|
import com.intellectualcrafters.plot.object.PlotWorld;
|
||||||
import com.intellectualcrafters.plot.util.ClusterManager;
|
import com.intellectualcrafters.plot.util.ClusterManager;
|
||||||
import com.intellectualcrafters.plot.util.ExpireManager;
|
import com.intellectualcrafters.plot.util.ExpireManager;
|
||||||
@ -176,6 +177,23 @@ public class PlotSquared {
|
|||||||
return new HashMap<>();
|
return new HashMap<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Set<Plot> getPlots(final PlotPlayer player) {
|
||||||
|
final UUID uuid = player.getUUID();
|
||||||
|
final ArrayList<Plot> myplots = new ArrayList<>();
|
||||||
|
for (final String world : plots.keySet()) {
|
||||||
|
if (isPlotWorld(world)) {
|
||||||
|
for (final Plot plot : plots.get(world).values()) {
|
||||||
|
if (plot.hasOwner()) {
|
||||||
|
if (plot.getOwner().equals(uuid)) {
|
||||||
|
myplots.add(plot);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return new HashSet<>(myplots);
|
||||||
|
}
|
||||||
|
|
||||||
public static boolean removePlot(final String world, final PlotId id, final boolean callEvent) {
|
public static boolean removePlot(final String world, final PlotId id, final boolean callEvent) {
|
||||||
if (callEvent) {
|
if (callEvent) {
|
||||||
if (!IMP.callRemovePlot(world, id)) {
|
if (!IMP.callRemovePlot(world, id)) {
|
||||||
|
@ -31,6 +31,7 @@ import com.intellectualcrafters.plot.object.Location;
|
|||||||
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.util.MainUtil;
|
import com.intellectualcrafters.plot.util.MainUtil;
|
||||||
|
import com.intellectualcrafters.plot.util.Permissions;
|
||||||
import com.intellectualcrafters.plot.util.bukkit.BukkitPlayerFunctions;
|
import com.intellectualcrafters.plot.util.bukkit.BukkitPlayerFunctions;
|
||||||
import com.intellectualcrafters.plot.util.bukkit.UUIDHandler;
|
import com.intellectualcrafters.plot.util.bukkit.UUIDHandler;
|
||||||
|
|
||||||
@ -84,8 +85,7 @@ public class Helpers extends SubCommand {
|
|||||||
}
|
}
|
||||||
plot.addHelper(uuid);
|
plot.addHelper(uuid);
|
||||||
DBFunc.setHelper(loc.getWorld(), plot, uuid);
|
DBFunc.setHelper(loc.getWorld(), plot, uuid);
|
||||||
final PlayerPlotHelperEvent event = new PlayerPlotHelperEvent(plr, plot, uuid, true);
|
// FIXME PlayerPlotHelperEvent
|
||||||
Bukkit.getPluginManager().callEvent(event);
|
|
||||||
} else {
|
} else {
|
||||||
MainUtil.sendMessage(plr, C.ALREADY_ADDED);
|
MainUtil.sendMessage(plr, C.ALREADY_ADDED);
|
||||||
return false;
|
return false;
|
||||||
@ -107,8 +107,7 @@ public class Helpers extends SubCommand {
|
|||||||
final UUID uuid = UUIDHandler.getUUID(args[1]);
|
final UUID uuid = UUIDHandler.getUUID(args[1]);
|
||||||
plot.removeHelper(uuid);
|
plot.removeHelper(uuid);
|
||||||
DBFunc.removeHelper(loc.getWorld(), plot, uuid);
|
DBFunc.removeHelper(loc.getWorld(), plot, uuid);
|
||||||
final PlayerPlotHelperEvent event = new PlayerPlotHelperEvent(plr, plot, uuid, false);
|
// FIXME PlayerPlotHelperEvent
|
||||||
Bukkit.getPluginManager().callEvent(event);
|
|
||||||
MainUtil.sendMessage(plr, C.HELPER_REMOVED);
|
MainUtil.sendMessage(plr, C.HELPER_REMOVED);
|
||||||
} else {
|
} else {
|
||||||
MainUtil.sendMessage(plr, C.HELPER_NEED_ARGUMENT);
|
MainUtil.sendMessage(plr, C.HELPER_NEED_ARGUMENT);
|
||||||
|
@ -20,8 +20,6 @@
|
|||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
package com.intellectualcrafters.plot.commands;
|
package com.intellectualcrafters.plot.commands;
|
||||||
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.PlotSquared;
|
import com.intellectualcrafters.plot.PlotSquared;
|
||||||
import com.intellectualcrafters.plot.config.C;
|
import com.intellectualcrafters.plot.config.C;
|
||||||
import com.intellectualcrafters.plot.object.Plot;
|
import com.intellectualcrafters.plot.object.Plot;
|
||||||
@ -64,7 +62,7 @@ public class Home extends SubCommand {
|
|||||||
if ((temp = isAlias(args[0])) != null) {
|
if ((temp = isAlias(args[0])) != null) {
|
||||||
if (temp.hasOwner()) {
|
if (temp.hasOwner()) {
|
||||||
if (temp.getOwner().equals(UUIDHandler.getUUID(plr))) {
|
if (temp.getOwner().equals(UUIDHandler.getUUID(plr))) {
|
||||||
teleportPlayer(plr, temp);
|
MainUtil.teleportPlayer(plr, plr.getLocation(), temp);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -78,7 +76,7 @@ public class Home extends SubCommand {
|
|||||||
MainUtil.sendMessage(plr, C.NOT_VALID_NUMBER);
|
MainUtil.sendMessage(plr, C.NOT_VALID_NUMBER);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
teleportPlayer(plr, plots[id - 1]);
|
MainUtil.teleportPlayer(plr, plr.getLocation(), plots[id - 1]);
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
MainUtil.sendMessage(plr, C.NO_PLOTS);
|
MainUtil.sendMessage(plr, C.NO_PLOTS);
|
||||||
@ -86,7 +84,7 @@ public class Home extends SubCommand {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void teleportPlayer(final Player player, final Plot plot) {
|
public void teleportPlayer(final PlotPlayer player, final Plot plot) {
|
||||||
MainUtil.teleportPlayer(player, player.getLocation(), plot);
|
MainUtil.teleportPlayer(player, player.getLocation(), plot);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user