mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2025-06-28 11:44:42 +02:00
@ -1835,8 +1835,6 @@ public class PS {
|
||||
options.put("cache.permissions", Settings.PERMISSION_CACHING);
|
||||
options.put("cache.ratings", Settings.CACHE_RATINGS);
|
||||
|
||||
options.put("cache.ratings", Settings.CACHE_RATINGS);
|
||||
|
||||
// Titles
|
||||
options.put("titles", Settings.TITLES);
|
||||
|
||||
|
@ -52,7 +52,7 @@ public class CreateRoadSchematic extends SubCommand {
|
||||
return sendMessage(player, C.NOT_IN_PLOT_WORLD);
|
||||
}
|
||||
HybridUtils.manager.setupRoadSchematic(plot);
|
||||
MainUtil.sendMessage(player, "&6Saved new road schematic (see console for more information)");
|
||||
MainUtil.sendMessage(player, "&6Saved new road schematic. To test the road, fly to a few other plots and use /plot debugroadregen");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -69,6 +69,7 @@ public class DebugRoadRegen extends SubCommand {
|
||||
}
|
||||
boolean result = HybridUtils.manager.regenerateRoad(world, chunk, extend);
|
||||
MainUtil.sendMessage(player, "&6Regenerating chunk: " + chunk.x + "," + chunk.z + "\n&6 - Result: " + (result == true ? "&aSuccess" : "&cFailed"));
|
||||
MainUtil.sendMessage(player, "&cTo regenerate all roads: /plot regenallroads");
|
||||
}
|
||||
else {
|
||||
HybridPlotManager manager = (HybridPlotManager) PS.get().getPlotManager(world);
|
||||
@ -76,6 +77,7 @@ public class DebugRoadRegen extends SubCommand {
|
||||
manager.createRoadSouth(plotworld, plot);
|
||||
manager.createRoadSouthEast(plotworld, plot);
|
||||
MainUtil.sendMessage(player, "&6Regenerating plot south/east roads: " + plot.id + "\n&6 - Result: &aSuccess");
|
||||
MainUtil.sendMessage(player, "&cTo regenerate all roads: /plot regenallroads");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -125,8 +125,8 @@ public class FlagCmd extends SubCommand {
|
||||
return false;
|
||||
}
|
||||
final String value = StringMan.join(Arrays.copyOfRange(args, 2, args.length), " ");
|
||||
if (!Permissions.hasPermission(player, "plots.set.flag." + args[1].toLowerCase()) && !Permissions.hasPermission(player, "plots.set.flag." + args[1].toLowerCase() + "." + value.toLowerCase())) {
|
||||
MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.set.flag." + args[1].toLowerCase());
|
||||
if (!Permissions.hasPermission(player, "plots.set.flag." + args[1].toLowerCase() + "." + value.toLowerCase())) {
|
||||
MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.set.flag." + args[1].toLowerCase() + "." + value.toLowerCase());
|
||||
return false;
|
||||
}
|
||||
final Object parsed = af.parseValueRaw(value);
|
||||
@ -161,7 +161,7 @@ public class FlagCmd extends SubCommand {
|
||||
if (!Permissions.hasPermission(player, "plots.set.flag." + args[1].toLowerCase())) {
|
||||
for (String entry : args[2].split(",")) {
|
||||
if (!Permissions.hasPermission(player, "plots.set.flag." + args[1].toLowerCase() + "." + entry)) {
|
||||
MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.set.flag." + args[1].toLowerCase());
|
||||
MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.set.flag." + args[1].toLowerCase() + "." + entry);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -201,7 +201,7 @@ public class FlagCmd extends SubCommand {
|
||||
if (!Permissions.hasPermission(player, "plots.set.flag." + args[1].toLowerCase())) {
|
||||
for (String entry : args[2].split(",")) {
|
||||
if (!Permissions.hasPermission(player, "plots.set.flag." + args[1].toLowerCase() + "." + entry)) {
|
||||
MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.set.flag." + args[1].toLowerCase());
|
||||
MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.set.flag." + args[1].toLowerCase() + "." + entry);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -542,6 +542,31 @@ public class Plot {
|
||||
PlotAnalysis.analyzePlot(this, whenDone);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a flag for this plot
|
||||
* @param flag
|
||||
* @param value
|
||||
*/
|
||||
public void setFlag(String flag, Object value) {
|
||||
FlagManager.addPlotFlag(this, new Flag(FlagManager.getFlag(flag), value));
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove a flag from this plot
|
||||
* @param flag
|
||||
*/
|
||||
public void removeFlag(String flag) {
|
||||
FlagManager.removePlotFlag(this, flag);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the flag for a given key
|
||||
* @param flag
|
||||
*/
|
||||
public Flag getFlag(String key) {
|
||||
return FlagManager.getPlotFlag(this, key);
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a plot
|
||||
* @see PS#removePlot(String, PlotId, boolean)
|
||||
|
@ -18,7 +18,15 @@ public class Rating {
|
||||
private int initial;
|
||||
|
||||
public Rating(int value) {
|
||||
this.initial = value;
|
||||
ratingMap = new HashMap<>();
|
||||
if (value < 10) {
|
||||
for (int i = 0 ; i < Settings.RATING_CATEGORIES.size(); i++) {
|
||||
ratingMap.put(Settings.RATING_CATEGORIES.get(i), value);
|
||||
}
|
||||
changed = true;
|
||||
return;
|
||||
}
|
||||
if (Settings.RATING_CATEGORIES != null && Settings.RATING_CATEGORIES.size() > 1) {
|
||||
for (int i = 0 ; i < Settings.RATING_CATEGORIES.size(); i++) {
|
||||
ratingMap.put(Settings.RATING_CATEGORIES.get(i), (value % 10) - 1);
|
||||
@ -28,7 +36,6 @@ public class Rating {
|
||||
else {
|
||||
ratingMap.put(null, value);
|
||||
}
|
||||
this.initial = value;
|
||||
}
|
||||
|
||||
public List<String> getCategories() {
|
||||
|
@ -122,7 +122,7 @@ public class ExpireManager {
|
||||
public void run() {
|
||||
PlotAnalysis changed = this.value;
|
||||
if (Settings.CLEAR_THRESHOLD != -1 && plotworld.TYPE == 0 && changed != null) {
|
||||
if (changed.getComplexity() > Settings.CLEAR_THRESHOLD) {
|
||||
if (changed.changes != 0 && changed.getComplexity() > Settings.CLEAR_THRESHOLD) {
|
||||
PS.debug("$2[&5Expire&dManager$2] &bIgnoring modified plot: " + plot + " : " + changed.getComplexity() + " - " + changed.changes);
|
||||
expiredPlots.get(world).remove(plot);
|
||||
FlagManager.addPlotFlag(plot, new Flag(FlagManager.getFlag("analysis"), changed.asList()));
|
||||
|
@ -1261,7 +1261,7 @@ public class MainUtil {
|
||||
Location loc = new Location(bot.getWorld(), bot.getX() + home.x, bot.getY() + home.y, bot.getZ() + home.z);
|
||||
if (BlockManager.manager.getBlock(loc).id != 0) {
|
||||
// sendConsoleMessage("ID was " + BukkitUtil.getBlock(loc).id);
|
||||
loc.setY(Math.max(getHeighestBlock(w, bot.getX(), bot.getZ()), bot.getY()));
|
||||
loc.setY(Math.max(getHeighestBlock(w, loc.getX(), loc.getZ()), bot.getY()));
|
||||
}
|
||||
return loc;
|
||||
}
|
||||
|
@ -1,5 +1,7 @@
|
||||
package com.intellectualcrafters.plot.util;
|
||||
|
||||
import org.bukkit.permissions.Permission;
|
||||
|
||||
import com.intellectualcrafters.plot.config.C;
|
||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||
import com.plotsquared.general.commands.CommandCaller;
|
||||
@ -13,13 +15,24 @@ public class Permissions {
|
||||
return hasPermission((CommandCaller) player, perm);
|
||||
}
|
||||
|
||||
public static boolean hasPermission(final CommandCaller player, final String perm) {
|
||||
public static boolean hasPermission(final CommandCaller player, String perm) {
|
||||
if ((player == null) || player.hasPermission(C.PERMISSION_ADMIN.s()) || player.hasPermission(C.PERMISSION_STAR.s())) {
|
||||
return true;
|
||||
}
|
||||
if (player.hasPermission(perm)) {
|
||||
return true;
|
||||
}
|
||||
perm = perm.toLowerCase().replaceAll("^[^a-z|0-9|\\.|_|-]", "");
|
||||
String[] nodes = perm.split("\\.");
|
||||
final StringBuilder n = new StringBuilder();
|
||||
for (int i = 0; i < (nodes.length - 1); i++) {
|
||||
n.append(nodes[i] + ("."));
|
||||
if (!perm.equals(n + C.PERMISSION_STAR.s())) {
|
||||
if (player.hasPermission(n + C.PERMISSION_STAR.s())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -40,6 +53,7 @@ public class Permissions {
|
||||
if (player.hasPermission(stub + ".*")) {
|
||||
return Integer.MAX_VALUE;
|
||||
}
|
||||
System.out.print(range);
|
||||
for (int i = range; i > 0; i--) {
|
||||
if (player.hasPermission(stub + "." + i)) {
|
||||
return i;
|
||||
|
Reference in New Issue
Block a user