mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-26 12:35:15 +01:00
merge direction
This commit is contained in:
parent
f472c6a2f5
commit
4d4cec4cb1
@ -72,7 +72,7 @@ public class Merge extends SubCommand {
|
||||
|
||||
@Override
|
||||
public boolean execute(final PlotPlayer plr, final String... args) {
|
||||
final Location loc = plr.getLocation();
|
||||
final Location loc = plr.getLocationFull();
|
||||
final Plot plot = MainUtil.getPlot(loc);
|
||||
if (plot == null) {
|
||||
return !sendMessage(plr, C.NOT_IN_PLOT);
|
||||
|
@ -20,7 +20,10 @@
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
package com.intellectualcrafters.plot.commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
|
||||
@ -49,7 +52,7 @@ import com.intellectualcrafters.plot.util.bukkit.UUIDHandler;
|
||||
* @author Citymonstret
|
||||
*/
|
||||
public class Set extends SubCommand {
|
||||
public final static String[] values = new String[] { "biome", "wall", "wall_filling", "floor", "alias", "home", "flag" };
|
||||
public final static String[] values = new String[] { "biome", "alias", "home", "flag" };
|
||||
public final static String[] aliases = new String[] { "b", "w", "wf", "f", "a", "h", "fl" };
|
||||
|
||||
public Set() {
|
||||
@ -73,7 +76,10 @@ public class Set extends SubCommand {
|
||||
return false;
|
||||
}
|
||||
if (args.length < 1) {
|
||||
MainUtil.sendMessage(plr, C.SUBCOMMAND_SET_OPTIONS_HEADER.s() + getArgumentList(values));
|
||||
PlotManager manager = PlotSquared.getPlotManager(loc.getWorld());
|
||||
List<String> newValues = Arrays.asList(values);;
|
||||
newValues.addAll(Arrays.asList(manager.getPlotComponents(PlotSquared.getPlotWorld(loc.getWorld()), plot.id)));
|
||||
MainUtil.sendMessage(plr, C.SUBCOMMAND_SET_OPTIONS_HEADER.s() + getArgumentList(newValues));
|
||||
return false;
|
||||
}
|
||||
for (int i = 0; i < aliases.length; i++) {
|
||||
@ -258,7 +264,9 @@ public class Set extends SubCommand {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
MainUtil.sendMessage(plr, C.SUBCOMMAND_SET_OPTIONS_HEADER.s() + getArgumentList(values));
|
||||
List<String> newValues = Arrays.asList(values);;
|
||||
newValues.addAll(Arrays.asList(manager.getPlotComponents(plotworld, plot.id)));
|
||||
MainUtil.sendMessage(plr, C.SUBCOMMAND_SET_OPTIONS_HEADER.s() + getArgumentList(newValues));
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -266,9 +274,9 @@ public class Set extends SubCommand {
|
||||
return MainUtil.colorise('&', C.BLOCK_LIST_ITEM.s().replaceAll("%mat%", s));
|
||||
}
|
||||
|
||||
private String getArgumentList(final String[] strings) {
|
||||
private String getArgumentList(final List<String> newValues) {
|
||||
final StringBuilder builder = new StringBuilder();
|
||||
for (final String s : strings) {
|
||||
for (final String s : newValues) {
|
||||
builder.append(getString(s));
|
||||
}
|
||||
return builder.toString().substring(1, builder.toString().length() - 1);
|
||||
|
@ -102,4 +102,9 @@ public class BukkitPlayer implements PlotPlayer {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Location getLocationFull() {
|
||||
return BukkitUtil.getLocationFull(this.player);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -10,6 +10,8 @@ import java.util.UUID;
|
||||
public interface PlotPlayer {
|
||||
public Location getLocation();
|
||||
|
||||
public Location getLocationFull();
|
||||
|
||||
public UUID getUUID();
|
||||
|
||||
public boolean hasPermission(final String perm);
|
||||
|
@ -159,6 +159,12 @@ public class BukkitUtil extends BlockManager {
|
||||
final String world = loc.getWorld().getName();
|
||||
return new Location(world, loc.getBlockX(), loc.getBlockY(), loc.getBlockZ());
|
||||
}
|
||||
|
||||
public static Location getLocationFull(final Entity entity) {
|
||||
final org.bukkit.Location loc = entity.getLocation();
|
||||
final String world = loc.getWorld().getName();
|
||||
return new Location(world, loc.getBlockX(), loc.getBlockY(), loc.getBlockZ(), loc.getYaw(), loc.getPitch());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void functionSetBlocks(final String worldname, final int[] x, final int[] y, final int[] z, final int[] id, final byte[] data) {
|
||||
|
Loading…
Reference in New Issue
Block a user