Added ban/unban aliases. Made "plot.settings.getBiome()" return the actual biome. Fixed a colour error 💥

This commit is contained in:
Sauilitired 2014-11-09 17:22:53 +01:00
parent 1b9a42d3c9
commit 790bb4e948
6 changed files with 140 additions and 79 deletions

View File

@ -55,6 +55,7 @@ public class PlotSettings {
private PlotHomePosition position;
private Plot plot;
/**
* Constructor
*
@ -62,6 +63,7 @@ public class PlotSettings {
*/
public PlotSettings(final Plot plot) {
this.alias = "";
this.plot = plot;
}
/**
@ -97,6 +99,14 @@ public class PlotSettings {
this.merged[direction] = merged;
}
/**
* @return
* @deprecated
*/
public Biome getBiome() {
return PlotHelper.getPlotBottomLoc(plot.getWorld(), plot.getId()).add(1, 0, 1).getBlock().getBiome();
}
/**
* @param b
*/
@ -104,22 +114,6 @@ public class PlotSettings {
this.biome = b;
}
/**
* @return
* @deprecated
*/
@Deprecated
public Biome getBiome() {
return this.biome;
}
/**
* @param alias
*/
public void setAlias(final String alias) {
this.alias = alias;
}
/**
* @param flag
*/
@ -131,13 +125,6 @@ public class PlotSettings {
this.flags.add(flag);
}
/**
* @param flags
*/
public void setFlags(final Flag[] flags) {
this.flags = new HashSet<Flag>(Arrays.asList(flags));
}
/**
* @return
*/
@ -145,6 +132,13 @@ public class PlotSettings {
return this.flags;
}
/**
* @param flags
*/
public void setFlags(final Flag[] flags) {
this.flags = new HashSet<Flag>(Arrays.asList(flags));
}
/**
* @param flag
* @return
@ -170,6 +164,13 @@ public class PlotSettings {
return this.alias;
}
/**
* @param alias
*/
public void setAlias(final String alias) {
this.alias = alias;
}
public String getJoinMessage() {
return "";
}

View File

@ -0,0 +1,33 @@
package com.intellectualcrafters.plot.commands;
import com.intellectualcrafters.plot.C;
import com.intellectualcrafters.plot.PlayerFunctions;
import com.intellectualcrafters.plot.Plot;
import org.bukkit.entity.Player;
/**
* Created 2014-11-09 for PlotSquared
*
* @author Citymonstret
*/
public class Ban extends SubCommand {
public Ban() {
super(Command.BAN, "Alis for /plot denied add", "/plot ban [player]", CommandCategory.ACTIONS, true);
}
@Override
public boolean execute(Player plr, String... args) {
if (args.length < 1) {
return PlayerFunctions.sendMessage(plr, "&cUsage: &c" + usage);
}
if (!PlayerFunctions.isInPlot(plr)) {
return sendMessage(plr, C.NOT_IN_PLOT);
}
Plot plot = PlayerFunctions.getCurrentPlot(plr);
if (!plot.hasRights(plr)) {
return sendMessage(plr, C.NO_PLOT_PERMS);
}
return plr.performCommand("plot denied add " + args[0]);
}
}

View File

@ -127,6 +127,8 @@ public enum Command {
/**
*
*/
BAN("ban", "block"),
UNBAN("unban", "unblock"),
TP("tp", "tp");
/**
*

View File

@ -46,7 +46,7 @@ public class MainCommand implements CommandExecutor, TabCompleter {
public static final String
MAIN_PERMISSION = "plots.use";
private static SubCommand[] _subCommands = new SubCommand[]{new Claim(), new Paste(), new Copy(), new Clipboard(), new Auto(), new Home(), new Visit(), new TP(), new Set(), new Clear(), new Delete(), new SetOwner(), new Denied(), new Helpers(), new Trusted(), new Info(), new list(), new Help(), new Debug(), new Schematic(), new plugin(), new Inventory(), new Purge(), new Reload(), new Merge(), new Unlink(), new Kick(), new Setup(), new DebugClaimTest(), new Inbox(), new Comment(), new Swap(), new MusicSubcommand()};
private static SubCommand[] _subCommands = new SubCommand[]{new Ban(), new Unban(), new Claim(), new Paste(), new Copy(), new Clipboard(), new Auto(), new Home(), new Visit(), new TP(), new Set(), new Clear(), new Delete(), new SetOwner(), new Denied(), new Helpers(), new Trusted(), new Info(), new list(), new Help(), new Debug(), new Schematic(), new plugin(), new Inventory(), new Purge(), new Reload(), new Merge(), new Unlink(), new Kick(), new Setup(), new DebugClaimTest(), new Inbox(), new Comment(), new Swap(), new MusicSubcommand()};
public static ArrayList<SubCommand> subCommands = new ArrayList<SubCommand>() {
{

View File

@ -0,0 +1,33 @@
package com.intellectualcrafters.plot.commands;
import com.intellectualcrafters.plot.C;
import com.intellectualcrafters.plot.PlayerFunctions;
import com.intellectualcrafters.plot.Plot;
import org.bukkit.entity.Player;
/**
* Created 2014-11-09 for PlotSquared
*
* @author Citymonstret
*/
public class Unban extends SubCommand {
public Unban() {
super(Command.UNBAN, "Alis for /plot denied remove", "/plot unban [player]", CommandCategory.ACTIONS, true);
}
@Override
public boolean execute(Player plr, String... args) {
if (args.length < 1) {
return PlayerFunctions.sendMessage(plr, "&cUsage: &c" + usage);
}
if (!PlayerFunctions.isInPlot(plr)) {
return sendMessage(plr, C.NOT_IN_PLOT);
}
Plot plot = PlayerFunctions.getCurrentPlot(plr);
if (!plot.hasRights(plr)) {
return sendMessage(plr, C.NO_PLOT_PERMS);
}
return plr.performCommand("plot denied remove " + args[0]);
}
}

View File

@ -33,109 +33,101 @@ public class DefaultPlotWorld extends PlotWorld {
* the functions/algorithms
*/
/**
* Road Height
*/
public int ROAD_HEIGHT;
/**
* Default Road Height: 64
*/
public static int ROAD_HEIGHT_DEFAULT = 64;
/**
* plot height
*/
public int PLOT_HEIGHT;
/**
* Default plot height: 64
*/
public static int PLOT_HEIGHT_DEFAULT = 64;
/**
* Wall height
*/
public int WALL_HEIGHT;
/**
* Default Wall Height: 64
*/
public static int WALL_HEIGHT_DEFAULT = 64;
/**
* plot width
*/
public int PLOT_WIDTH;
/**
* Default plot width: 32
*/
public static int PLOT_WIDTH_DEFAULT = 32;
/**
* Road width
*/
public int ROAD_WIDTH;
/**
* Default road width: 7
*/
public static int ROAD_WIDTH_DEFAULT = 7;
/**
* Plot main block
*/
public PlotBlock[] MAIN_BLOCK;
/**
* Default main block: 1
*/
public static PlotBlock[] MAIN_BLOCK_DEFAULT = new PlotBlock[]{new PlotBlock((short) 1, (byte) 0)};
/**
* Top blocks
*/
public PlotBlock[] TOP_BLOCK;
/**
* Default top blocks: {"2"}
*/
public static PlotBlock[] TOP_BLOCK_DEFAULT = new PlotBlock[]{new PlotBlock((short) 2, (byte) 0)};
/**
* Wall block
*/
public PlotBlock WALL_BLOCK;
/**
* Default wall block: 44
*/
public static PlotBlock WALL_BLOCK_DEFAULT = new PlotBlock((short) 44, (byte) 0);
public PlotBlock CLAIMED_WALL_BLOCK;
public static PlotBlock CLAIMED_WALL_BLOCK_DEFAULT = new PlotBlock((short) 44, (byte) 1);
/**
* Default wall filling: 1
*/
public static PlotBlock WALL_FILLING_DEFAULT = new PlotBlock((short) 1, (byte) 0);
/**
* Default road stripes: 35
*/
public static PlotBlock ROAD_STRIPES_DEFAULT = new PlotBlock((short) 98, (byte) 0);
public static boolean ROAD_STRIPES_ENABLED_DEFAULT = false;
/**
* Default road block: 155
*/
public static PlotBlock ROAD_BLOCK_DEFAULT = new PlotBlock((short) 155, (byte) 0);
/**
* Road Height
*/
public int ROAD_HEIGHT;
/**
* plot height
*/
public int PLOT_HEIGHT;
/**
* Wall height
*/
public int WALL_HEIGHT;
/**
* plot width
*/
public int PLOT_WIDTH;
/**
* Road width
*/
public int ROAD_WIDTH;
/**
* Plot main block
*/
public PlotBlock[] MAIN_BLOCK;
/**
* Top blocks
*/
public PlotBlock[] TOP_BLOCK;
/**
* Wall block
*/
public PlotBlock WALL_BLOCK;
public PlotBlock CLAIMED_WALL_BLOCK;
/**
* Wall filling
*/
public PlotBlock WALL_FILLING;
/**
* Default wall filling: 1
*/
public static PlotBlock WALL_FILLING_DEFAULT = new PlotBlock((short) 1, (byte) 0);
/**
* Road stripes
*/
public PlotBlock ROAD_STRIPES;
/**
* Default road stripes: 35
*/
public static PlotBlock ROAD_STRIPES_DEFAULT = new PlotBlock((short) 98, (byte) 0);
/**
* enable road stripes
*/
public boolean ROAD_STRIPES_ENABLED;
public static boolean ROAD_STRIPES_ENABLED_DEFAULT = false;
/**
* Road block
*/
public PlotBlock ROAD_BLOCK;
/**
* Default road block: 155
*/
public static PlotBlock ROAD_BLOCK_DEFAULT = new PlotBlock((short) 155, (byte) 0);
/*
* Here we are just calling the super method, nothing special
@ -170,7 +162,7 @@ public class DefaultPlotWorld extends PlotWorld {
this.PLOT_HEIGHT = config.getInt("plot.height");
if (!config.contains("plot.height")) {
PlotMain.sendConsoleSenderMessage(" - &Configuration is null? (" + config.getCurrentPath() + ")");
PlotMain.sendConsoleSenderMessage(" - &cConfiguration is null? (" + config.getCurrentPath() + ")");
}
this.PLOT_WIDTH = config.getInt("plot.size");