Default, default flags

This commit is contained in:
Jesse Boyd 2015-11-15 19:56:32 +11:00
parent 9218147aa0
commit 27d1ba810b
5 changed files with 55 additions and 67 deletions

View File

@ -8,7 +8,7 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties> </properties>
<artifactId>PlotSquared</artifactId> <artifactId>PlotSquared</artifactId>
<version>3.2.17</version> <version>3.2.18</version>
<name>PlotSquared</name> <name>PlotSquared</name>
<packaging>jar</packaging> <packaging>jar</packaging>
<build> <build>

View File

@ -275,6 +275,9 @@ public abstract class PlotWorld {
config.set(option, options.get(option)); config.set(option, options.get(option));
} }
} }
if (!config.contains("flags")) {
config.set("flags.use", "63,64,68,69,71,77,96,143,167,193,194,195,196,197,77,143,69,70,72,147,148,107,183,184,185,186,187,132");
}
} }
/** /**

View File

@ -128,7 +128,7 @@ import com.plotsquared.bukkit.util.BukkitUtil;
* Player Events involving plots * Player Events involving plots
* *
*/ */
@SuppressWarnings({ "unused", "deprecation", "unchecked" }) @SuppressWarnings({ "deprecation", "unchecked" })
public class PlayerEvents extends com.plotsquared.listener.PlotListener implements Listener { public class PlayerEvents extends com.plotsquared.listener.PlotListener implements Listener {
private boolean pistonBlocks = true; private boolean pistonBlocks = true;
@ -315,11 +315,11 @@ public class PlayerEvents extends com.plotsquared.listener.PlotListener implemen
@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST) @EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST)
public void PlayerCommand(final PlayerCommandPreprocessEvent event) { public void PlayerCommand(final PlayerCommandPreprocessEvent event) {
final String message = event.getMessage().toLowerCase().replaceAll("/", "").trim(); String msg = event.getMessage().toLowerCase().replaceAll("/", "").trim();
if (message.length() == 0) { if (msg.length() == 0) {
return; return;
} }
final String[] split = message.split(" "); final String[] split = msg.split(" ");
final PluginCommand cmd = Bukkit.getServer().getPluginCommand(split[0]); final PluginCommand cmd = Bukkit.getServer().getPluginCommand(split[0]);
if (cmd == null) { if (cmd == null) {
if (split[0].equals("plotme") || split[0].equals("ap")) { if (split[0].equals("plotme") || split[0].equals("ap")) {
@ -330,38 +330,28 @@ public class PlayerEvents extends com.plotsquared.listener.PlotListener implemen
MainUtil.sendMessage(BukkitUtil.getPlayer(player), C.NOT_USING_PLOTME); MainUtil.sendMessage(BukkitUtil.getPlayer(player), C.NOT_USING_PLOTME);
} }
event.setCancelled(true); event.setCancelled(true);
}
}
final Player player = event.getPlayer();
final PlotPlayer pp = BukkitUtil.getPlayer(player);
pp.getLocation();
if (!PS.get().isPlotWorld(BukkitUtil.getWorld(player))) {
return; return;
} }
}
final Plot plot = MainUtil.getPlot(BukkitUtil.getLocation(player)); final Player player = event.getPlayer();
final PlotPlayer pp = BukkitUtil.getPlayer(player);
Plot plot = pp.getCurrentPlot();
if (plot == null) { if (plot == null) {
return; return;
} }
Flag flag = FlagManager.getPlotFlagRaw(plot, "blocked-cmds");
Flag flag; if (flag == null || Permissions.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_BLOCKED_CMDS)) {
if (((flag = FlagManager.getPlotFlagRaw(plot, "blocked-cmds")) != null) && !Permissions.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_BLOCKED_CMDS)) { return;
}
final List<String> v = (List<String>) flag.getValue(); final List<String> v = (List<String>) flag.getValue();
String msg = event.getMessage().toLowerCase().replaceFirst("/", "");
final String[] parts = msg.split(" "); final String[] parts = msg.split(" ");
String c = parts[0]; String c = parts[0];
if (parts[0].contains(":")) { if (parts[0].contains(":")) {
c = parts[0].split(":")[1]; c = parts[0].split(":")[1];
msg = msg.replace(parts[0].split(":")[0] + ":", ""); msg = msg.replace(parts[0].split(":")[0] + ":", "");
} }
final String l = c; final String l = c;
final List<String> aliases = new ArrayList<>(); final List<String> aliases = new ArrayList<>();
for (final HelpTopic cmdLabel : Bukkit.getServer().getHelpMap().getHelpTopics()) { for (final HelpTopic cmdLabel : Bukkit.getServer().getHelpMap().getHelpTopics()) {
if (c.equals(cmdLabel.getName())) { if (c.equals(cmdLabel.getName())) {
break; break;
@ -385,11 +375,9 @@ public class PlayerEvents extends com.plotsquared.listener.PlotListener implemen
} }
} }
} }
if (!l.equals(c)) { if (!l.equals(c)) {
msg = msg.replace(l, c); msg = msg.replace(l, c);
} }
for (final String s : v) { for (final String s : v) {
Pattern pattern; Pattern pattern;
if (!RegExUtil.compiledPatterns.containsKey(s)) { if (!RegExUtil.compiledPatterns.containsKey(s)) {
@ -404,7 +392,6 @@ public class PlayerEvents extends com.plotsquared.listener.PlotListener implemen
} }
} }
} }
}
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onChunkLoad(final ChunkLoadEvent event) { public void onChunkLoad(final ChunkLoadEvent event) {

View File

@ -227,9 +227,7 @@ public class PlotListener {
pp.setFlight(false); pp.setFlight(false);
} }
} }
System.out.print("CHECKING TIME");
if (FlagManager.getPlotFlagRaw(plot, "time") != null) { if (FlagManager.getPlotFlagRaw(plot, "time") != null) {
System.out.print("RESETTING TIEM");
pp.setTime(Long.MAX_VALUE); pp.setTime(Long.MAX_VALUE);
} }
if (FlagManager.getPlotFlagRaw(plot, "weather") != null) { if (FlagManager.getPlotFlagRaw(plot, "weather") != null) {

Binary file not shown.