This commit is contained in:
boy0001 2015-02-22 01:13:34 +11:00
parent 694dd0432e
commit d7d012a39d
5 changed files with 18 additions and 14 deletions

View File

@ -50,14 +50,18 @@ public class Claim extends SubCommand {
if (plot.hasOwner() || plot.settings.isMerged()) {
return false;
}
final PlayerClaimPlotEvent event = new PlayerClaimPlotEvent(player, plot, auto);
Bukkit.getPluginManager().callEvent(event);
if (!event.isCancelled()) {
MainUtil.createPlot(player, plot);
MainUtil.setSign(player, plot);
MainUtil.sendMessage(BukkitUtil.getPlayer(player), C.CLAIMED);
// FIXME claim plot event
// final PlayerClaimPlotEvent event = new PlayerClaimPlotEvent(player, plot, auto);
// Bukkit.getPluginManager().callEvent(event);
// boolean result = event.isCancelled();
boolean result = true;
if (!result) {
MainUtil.createPlot(player.getUUID(), plot);
MainUtil.setSign(player.getName(), plot);
MainUtil.sendMessage(player, C.CLAIMED);
if (teleport) {
PlotSquared.teleportPlayer(player, BukkitUtil.getLocation(entity), plot);
MainUtil.teleportPlayer(player, player.getLocation(), plot);
}
final World world = plot.world;
final PlotWorld plotworld = PlotSquared.getPlotWorld(world);

View File

@ -67,7 +67,7 @@ public class DebugClaimTest extends SubCommand {
MainUtil.setSign(player, plot);
MainUtil.sendMessage(BukkitUtil.getPlayer(player), C.CLAIMED);
if (teleport) {
PlotSquared.teleportPlayer(player, BukkitUtil.getLocation(entity), plot);
MainUtil.teleportPlayer(player, player.getLocation(), plot);
}
}
return event.isCancelled();

View File

@ -50,7 +50,7 @@ public class Home extends SubCommand {
public boolean execute(final PlotPlayer plr, String... args) {
final Plot[] plots = PlotSquared.getPlots(plr).toArray(new Plot[0]);
if (plots.length == 1) {
PlotSquared.teleportPlayer(plr, plr.getLocation(), plots[0]);
MainUtil.teleportPlayer(plr, plr.getLocation(), plots[0]);
return true;
} else if (plots.length > 1) {
if (args.length < 1) {
@ -87,6 +87,6 @@ public class Home extends SubCommand {
}
public void teleportPlayer(final Player player, final Plot plot) {
PlotSquared.teleportPlayer(player, BukkitUtil.getLocation(entity), plot);
MainUtil.teleportPlayer(player, player.getLocation(), plot);
}
}

View File

@ -60,12 +60,12 @@ public class TP extends SubCommand {
}
Plot temp;
if ((temp = isAlias(world, id)) != null) {
PlotSquared.teleportPlayer(plr, plr.getLocation(), temp);
MainUtil.teleportPlayer(plr, plr.getLocation(), temp);
return true;
}
try {
plotid = new PlotId(Integer.parseInt(id.split(";")[0]), Integer.parseInt(id.split(";")[1]));
PlotSquared.teleportPlayer(plr, plr.getLocation(), MainUtil.getPlot(world, plotid));
MainUtil.teleportPlayer(plr, plr.getLocation(), MainUtil.getPlot(world, plotid));
return true;
} catch (final Exception e) {
MainUtil.sendMessage(plr, C.NOT_VALID_PLOT_ID);

View File

@ -60,7 +60,7 @@ public class Visit extends SubCommand {
return sendMessage(plr, C.FOUND_NO_PLOTS);
}
if (args.length < 2) {
PlotSquared.teleportPlayer(plr, plr.getLocation(), plots.get(0));
MainUtil.teleportPlayer(plr, plr.getLocation(), plots.get(0));
return true;
}
int i;
@ -72,7 +72,7 @@ public class Visit extends SubCommand {
if ((i < 0) || (i >= plots.size())) {
return sendMessage(plr, C.NOT_VALID_NUMBER);
}
PlotSquared.teleportPlayer(plr, plr.getLocation(), plots.get(i));
MainUtil.teleportPlayer(plr, plr.getLocation(), plots.get(i));
return true;
}
}