Merge branch 'v6' into feature/v6/generify-perms

This commit is contained in:
N0tMyFaultOG 2020-11-16 10:25:48 +01:00
commit ce7ceccc1c
11 changed files with 30 additions and 11 deletions

View File

@ -13,6 +13,9 @@ on:
jobs:
test:
runs-on: ubuntu-18.04
strategy:
matrix:
java: [1.8, 1.11]
steps:
- name: Checkout

View File

@ -43,11 +43,11 @@ dependencies {
implementation("org.bstats:bstats-bukkit:1.7")
// Minecraft
compileOnlyApi("com.destroystokyo.paper:paper-api:1.16.3-R0.1-SNAPSHOT")
compileOnlyApi("com.destroystokyo.paper:paper-api:1.16.4-R0.1-SNAPSHOT")
implementation("io.papermc:paperlib:1.0.5")
// Plugins
compileOnly("com.sk89q.worldedit:worldedit-bukkit:7.2.0-SNAPSHOT") {
compileOnly("com.sk89q.worldedit:worldedit-bukkit:7.2.0") {
exclude(group = "org.bukkit")
exclude(group = "org.spigotmc")
}

View File

@ -141,6 +141,8 @@ permissions:
default: false
plots.visit.other:
default: false
plots.visit.denied:
default: false
plots.home:
default: false
plots.alias.remove:

View File

@ -26,12 +26,12 @@ dependencies {
compileOnlyApi("javax.inject:javax.inject:1")
// Plugins
compileOnlyApi("com.sk89q.worldedit:worldedit-core:7.2.0-SNAPSHOT") {
compileOnlyApi("com.sk89q.worldedit:worldedit-core:7.2.0") {
exclude(group = "bukkit-classloader-check")
exclude(group = "mockito-core")
exclude(group = "dummypermscompat")
}
testImplementation("com.sk89q.worldedit:worldedit-core:7.2.0-SNAPSHOT")
testImplementation("com.sk89q.worldedit:worldedit-core:7.2.0")
// Logging
api("org.slf4j:slf4j-api:1.7.25")

View File

@ -108,10 +108,12 @@ public class Auto extends SubCommand {
if (metaDataAccess.isPresent()) {
int grantedPlots = metaDataAccess.get().orElse(0);
if (diff < 0 && grantedPlots < sizeX * sizeZ) {
player.sendMessage(TranslatableCaption.of("permission.cant_claim_more_plots"));
player.sendMessage(TranslatableCaption.of("permission.cant_claim_more_plots"),
Template.of("amount", String.valueOf(diff + grantedPlots)));
return false;
} else if (diff >= 0 && grantedPlots + diff < sizeX * sizeZ) {
player.sendMessage(TranslatableCaption.of("permission.cant_claim_more_plots"));
player.sendMessage(TranslatableCaption.of("permission.cant_claim_more_plots"),
Template.of("amount", String.valueOf(diff + grantedPlots)));
return false;
} else {
int left = grantedPlots + diff < 0 ? 0 : diff - sizeX * sizeZ;
@ -125,7 +127,8 @@ public class Auto extends SubCommand {
Template.of("remainingGrants", String.valueOf(left)));
}
} else {
player.sendMessage(TranslatableCaption.of("permission.cant_claim_more_plots"));
player.sendMessage(TranslatableCaption.of("permission.cant_claim_more_plots"),
Template.of("amount", "0"));
return false;
}
}

View File

@ -87,7 +87,8 @@ public class Buy extends Command {
checkTrue(!plot.isOwner(player.getUUID()), TranslatableCaption.of("economy.cannot_buy_own"));
Set<Plot> plots = plot.getConnectedPlots();
checkTrue(player.getPlotCount() + plots.size() <= player.getAllowedPlots(),
TranslatableCaption.of("permission.cant_claim_more_plots"));
TranslatableCaption.of("permission.cant_claim_more_plots"),
Template.of("amount", String.valueOf(player.getAllowedPlots())));
double price = plot.getFlag(PriceFlag.class);
if (price <= 0) {
throw new CommandException(TranslatableCaption.of("economy.not_for_sale"));

View File

@ -104,10 +104,12 @@ public class Claim extends SubCommand {
grants = metaDataAccess.get().orElse(0);
if (grants <= 0) {
metaDataAccess.remove();
player.sendMessage(TranslatableCaption.of("permission.cant_claim_more_plots"));
player.sendMessage(TranslatableCaption.of("permission.cant_claim_more_plots"),
Template.of("amount", String.valueOf(grants)));
}
} else {
player.sendMessage(TranslatableCaption.of("permission.cant_claim_more_plots"));
player.sendMessage(TranslatableCaption.of("permission.cant_claim_more_plots"),
Template.of("amount", String.valueOf(grants)));
}
}

View File

@ -135,6 +135,13 @@ public class Visit extends Command {
Templates.of("node", "plots.admin.visit.untrusted"));
return;
}
if (plot.isDenied(player.getUUID())) {
if (!Permissions.hasPermission(player, Permission.PERMISSION_VISIT_DENIED)) {
player.sendMessage(TranslatableCaption.of("permission.no_permission"),
Template.of("node", String.valueOf(Permission.PERMISSION_VISIT_DENIED)));
return;
}
}
}
confirm.run(this, () -> plot.teleportPlayer(player, TeleportCause.COMMAND, result -> {

View File

@ -157,6 +157,7 @@ public enum Permission {
PERMISSION_VISIT_UNOWNED("plots.visit.unowned"),
PERMISSION_VISIT_OWNED("plots.visit.owned"),
PERMISSION_SHARED("plots.visit.shared"),
PERMISSION_VISIT_DENIED("plots.visit.denied"),
PERMISSION_VISIT_OTHER("plots.visit.other"),
PERMISSION_HOME("plots.home"),
PERMISSION_ALIAS_SET("plots.alias.set"),

View File

@ -208,7 +208,7 @@
"permission.no_permission": "<prefix><red>You are lacking the permission node: <gold><node></gold>.</red>",
"permission.no_permission_event": "<prefix><red>You are lacking the permission node: <gold><node></gold>.</red>",
"permission.no_plot_perms": "<prefix><red>You must be the plot owner to perform this action.</red>",
"permission.cant_claim_more_plots": "<prefix><red>You can't claim more plots.</red>",
"permission.cant_claim_more_plots": "<prefix><red>You can't claim more than <gold><amount> </gold>plots.</red>",
"permission.cant_claim_more_clusters": "<prefix><red>You can't claim more clusters.</red>",
"permission.cant_transfer_more_plots": "<prefix><red>You can't send more plots to that user.</red>",
"permission.cant_claim_more_plots_num": "<prefix><red>You can't claim more than <gold><amount> </gold>plots at once.</red>",