mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2025-07-20 06:14:44 +02:00
Compare commits
2 Commits
feature/mi
...
fix/admin-
Author | SHA1 | Date | |
---|---|---|---|
ad24287619 | |||
b64db18f7d |
@ -41,7 +41,6 @@ dependencies {
|
|||||||
compileOnly(libs.luckperms)
|
compileOnly(libs.luckperms)
|
||||||
compileOnly(libs.essentialsx)
|
compileOnly(libs.essentialsx)
|
||||||
compileOnly(libs.mvdwapi) { isTransitive = false }
|
compileOnly(libs.mvdwapi) { isTransitive = false }
|
||||||
compileOnly(libs.miniplaceholders) { isTransitive = false }
|
|
||||||
|
|
||||||
// Other libraries
|
// Other libraries
|
||||||
implementation(libs.squirrelid) { isTransitive = false }
|
implementation(libs.squirrelid) { isTransitive = false }
|
||||||
|
@ -252,7 +252,8 @@ public class PlayerEventListener implements Listener {
|
|||||||
}
|
}
|
||||||
Plot plot = location.getOwnedPlot();
|
Plot plot = location.getOwnedPlot();
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
if (PlotFlagUtil.isAreaRoadFlagsAndFlagEquals(area, EditSignFlag.class, false)) {
|
if (PlotFlagUtil.isAreaRoadFlagsAndFlagEquals(area, EditSignFlag.class, false)
|
||||||
|
&& !event.getPlayer().hasPermission(Permission.PERMISSION_ADMIN_INTERACT_ROAD.toString())) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
@ -260,7 +261,8 @@ public class PlayerEventListener implements Listener {
|
|||||||
if (plot.isAdded(event.getPlayer().getUniqueId())) {
|
if (plot.isAdded(event.getPlayer().getUniqueId())) {
|
||||||
return; // allow for added players
|
return; // allow for added players
|
||||||
}
|
}
|
||||||
if (!plot.getFlag(EditSignFlag.class)) {
|
if (!plot.getFlag(EditSignFlag.class)
|
||||||
|
&& !event.getPlayer().hasPermission(Permission.PERMISSION_ADMIN_INTERACT_OTHER.toString())) {
|
||||||
plot.debug(event.getPlayer().getName() + " could not color the sign because of edit-sign = false");
|
plot.debug(event.getPlayer().getName() + " could not color the sign because of edit-sign = false");
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
|
@ -20,6 +20,7 @@ package com.plotsquared.bukkit.listener;
|
|||||||
|
|
||||||
import com.plotsquared.bukkit.util.BukkitUtil;
|
import com.plotsquared.bukkit.util.BukkitUtil;
|
||||||
import com.plotsquared.core.location.Location;
|
import com.plotsquared.core.location.Location;
|
||||||
|
import com.plotsquared.core.permissions.Permission;
|
||||||
import com.plotsquared.core.plot.Plot;
|
import com.plotsquared.core.plot.Plot;
|
||||||
import com.plotsquared.core.plot.PlotArea;
|
import com.plotsquared.core.plot.PlotArea;
|
||||||
import com.plotsquared.core.plot.flag.implementations.EditSignFlag;
|
import com.plotsquared.core.plot.flag.implementations.EditSignFlag;
|
||||||
@ -46,7 +47,8 @@ public class PlayerEventListener1201 implements Listener {
|
|||||||
}
|
}
|
||||||
Plot plot = location.getOwnedPlot();
|
Plot plot = location.getOwnedPlot();
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
if (PlotFlagUtil.isAreaRoadFlagsAndFlagEquals(area, EditSignFlag.class, false)) {
|
if (PlotFlagUtil.isAreaRoadFlagsAndFlagEquals(area, EditSignFlag.class, false)
|
||||||
|
&& !event.getPlayer().hasPermission(Permission.PERMISSION_ADMIN_INTERACT_ROAD.toString())) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
@ -54,7 +56,8 @@ public class PlayerEventListener1201 implements Listener {
|
|||||||
if (plot.isAdded(event.getPlayer().getUniqueId())) {
|
if (plot.isAdded(event.getPlayer().getUniqueId())) {
|
||||||
return; // allow for added players
|
return; // allow for added players
|
||||||
}
|
}
|
||||||
if (!plot.getFlag(EditSignFlag.class)) {
|
if (!plot.getFlag(EditSignFlag.class)
|
||||||
|
&& !event.getPlayer().hasPermission(Permission.PERMISSION_ADMIN_INTERACT_OTHER.toString())) {
|
||||||
plot.debug(event.getPlayer().getName() + " could not edit the sign because of edit-sign = false");
|
plot.debug(event.getPlayer().getName() + " could not edit the sign because of edit-sign = false");
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,6 @@ package com.plotsquared.bukkit.listener;
|
|||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
import com.plotsquared.bukkit.BukkitPlatform;
|
import com.plotsquared.bukkit.BukkitPlatform;
|
||||||
import com.plotsquared.bukkit.placeholder.MVdWPlaceholders;
|
import com.plotsquared.bukkit.placeholder.MVdWPlaceholders;
|
||||||
import com.plotsquared.bukkit.placeholder.MiniPlaceholders;
|
|
||||||
import com.plotsquared.bukkit.util.BukkitEconHandler;
|
import com.plotsquared.bukkit.util.BukkitEconHandler;
|
||||||
import com.plotsquared.core.PlotSquared;
|
import com.plotsquared.core.PlotSquared;
|
||||||
import com.plotsquared.core.configuration.Settings;
|
import com.plotsquared.core.configuration.Settings;
|
||||||
@ -53,11 +52,6 @@ public class ServerListener implements Listener {
|
|||||||
new MVdWPlaceholders(this.plugin, this.plugin.placeholderRegistry());
|
new MVdWPlaceholders(this.plugin, this.plugin.placeholderRegistry());
|
||||||
ConsolePlayer.getConsole().sendMessage(TranslatableCaption.of("placeholder.hooked"));
|
ConsolePlayer.getConsole().sendMessage(TranslatableCaption.of("placeholder.hooked"));
|
||||||
}
|
}
|
||||||
if (Bukkit.getPluginManager().getPlugin("MiniPlaceholders") != null
|
|
||||||
&& Settings.Enabled_Components.USE_MINIPLACEHOLDERS) {
|
|
||||||
new MiniPlaceholders(this.plugin.placeholderRegistry());
|
|
||||||
ConsolePlayer.getConsole().sendMessage(TranslatableCaption.of("placeholder.miniplaceholders.hooked"));
|
|
||||||
}
|
|
||||||
if (Settings.Enabled_Components.ECONOMY && Bukkit.getPluginManager().isPluginEnabled("Vault")) {
|
if (Settings.Enabled_Components.ECONOMY && Bukkit.getPluginManager().isPluginEnabled("Vault")) {
|
||||||
EconHandler econHandler = new BukkitEconHandler();
|
EconHandler econHandler = new BukkitEconHandler();
|
||||||
try {
|
try {
|
||||||
|
@ -1,69 +0,0 @@
|
|||||||
/*
|
|
||||||
* PlotSquared, a land and world management plugin for Minecraft.
|
|
||||||
* Copyright (C) IntellectualSites <https://intellectualsites.com>
|
|
||||||
* Copyright (C) IntellectualSites team and contributors
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
package com.plotsquared.bukkit.placeholder;
|
|
||||||
|
|
||||||
import com.google.common.eventbus.Subscribe;
|
|
||||||
import com.plotsquared.bukkit.util.BukkitUtil;
|
|
||||||
import com.plotsquared.core.PlotSquared;
|
|
||||||
import com.plotsquared.core.player.ConsolePlayer;
|
|
||||||
import com.plotsquared.core.player.PlotPlayer;
|
|
||||||
import com.plotsquared.core.util.placeholders.Placeholder;
|
|
||||||
import com.plotsquared.core.util.placeholders.PlaceholderRegistry;
|
|
||||||
import io.github.miniplaceholders.api.Expansion;
|
|
||||||
import io.github.miniplaceholders.api.utils.TagsUtils;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
|
||||||
|
|
||||||
public final class MiniPlaceholders {
|
|
||||||
|
|
||||||
private Expansion expansion = null;
|
|
||||||
private final PlaceholderRegistry registry;
|
|
||||||
|
|
||||||
public MiniPlaceholders(final @NonNull PlaceholderRegistry registry) {
|
|
||||||
this.registry = registry;
|
|
||||||
this.createExpansion();
|
|
||||||
PlotSquared.get().getEventDispatcher().registerListener(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Subscribe
|
|
||||||
public void onNewPlaceholder(final PlaceholderRegistry.@NonNull PlaceholderAddedEvent event) {
|
|
||||||
// We cannot register placeholders on the fly, so we have to replace the expansion.
|
|
||||||
this.createExpansion();
|
|
||||||
}
|
|
||||||
|
|
||||||
private synchronized void createExpansion() {
|
|
||||||
if (this.expansion != null && this.expansion.registered()) {
|
|
||||||
this.expansion.unregister();
|
|
||||||
}
|
|
||||||
final Expansion.Builder builder = Expansion.builder("plotsquared");
|
|
||||||
for (final Placeholder placeholder : this.registry.getPlaceholders()) {
|
|
||||||
builder.audiencePlaceholder(placeholder.getKey(), (audience, argumentQueue, context) -> {
|
|
||||||
final PlotPlayer<?> plotPlayer;
|
|
||||||
if (audience instanceof Player player) {
|
|
||||||
plotPlayer = BukkitUtil.adapt(player);
|
|
||||||
} else {
|
|
||||||
plotPlayer = ConsolePlayer.getConsole();
|
|
||||||
}
|
|
||||||
return TagsUtils.staticTag(placeholder.getValue(plotPlayer));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
this.expansion = builder.build();
|
|
||||||
this.expansion.register();
|
|
||||||
}
|
|
||||||
}
|
|
@ -810,10 +810,6 @@ public class Settings extends Config {
|
|||||||
);
|
);
|
||||||
@Comment("Whether PlotSquared should hook into MvDWPlaceholderAPI or not")
|
@Comment("Whether PlotSquared should hook into MvDWPlaceholderAPI or not")
|
||||||
public static boolean USE_MVDWAPI = true;
|
public static boolean USE_MVDWAPI = true;
|
||||||
|
|
||||||
@Comment("Whether PlotSquared should hook into MiniPlaceholders")
|
|
||||||
public static boolean USE_MINIPLACEHOLDERS = true;
|
|
||||||
|
|
||||||
@Comment("Prevent cross plot beacon effects")
|
@Comment("Prevent cross plot beacon effects")
|
||||||
public static boolean DISABLE_BEACON_EFFECT_OVERFLOW = true;
|
public static boolean DISABLE_BEACON_EFFECT_OVERFLOW = true;
|
||||||
|
|
||||||
|
@ -190,7 +190,6 @@
|
|||||||
"core.prefix": "<dark_gray>[</dark_gray><gold>P2</gold><dark_gray>] </dark_gray>",
|
"core.prefix": "<dark_gray>[</dark_gray><gold>P2</gold><dark_gray>] </dark_gray>",
|
||||||
"core.enabled": "<prefix><gold><value> is now enabled.</gold>",
|
"core.enabled": "<prefix><gold><value> is now enabled.</gold>",
|
||||||
"placeholder.hooked": "<prefix><gold>PlotSquared hooked into MVdWPlaceholderAPI</gold>",
|
"placeholder.hooked": "<prefix><gold>PlotSquared hooked into MVdWPlaceholderAPI</gold>",
|
||||||
"placeholder.miniplaceholders.hooked": "<prefix><gold>PlotSquared hooked into MiniPlaceholders</gold>",
|
|
||||||
"placeholder.nan": "Not a number",
|
"placeholder.nan": "Not a number",
|
||||||
"reload.reloaded_configs": "<prefix><gold>Translations and world settings have been reloaded successfully.</gold>",
|
"reload.reloaded_configs": "<prefix><gold>Translations and world settings have been reloaded successfully.</gold>",
|
||||||
"reload.reload_failed": "<prefix><red>Failed to reload file configurations.</red>",
|
"reload.reload_failed": "<prefix><red>Failed to reload file configurations.</red>",
|
||||||
|
@ -18,7 +18,6 @@ placeholderapi = "2.11.5"
|
|||||||
luckperms = "5.4"
|
luckperms = "5.4"
|
||||||
essentialsx = "2.20.1"
|
essentialsx = "2.20.1"
|
||||||
mvdwapi = "3.1.1"
|
mvdwapi = "3.1.1"
|
||||||
miniplaceholders = "2.2.3"
|
|
||||||
|
|
||||||
# Third party
|
# Third party
|
||||||
prtree = "2.0.1"
|
prtree = "2.0.1"
|
||||||
@ -69,7 +68,6 @@ prtree = { group = "com.intellectualsites.prtree", name = "PRTree", version.ref
|
|||||||
aopalliance = { group = "aopalliance", name = "aopalliance", version.ref = "aopalliance" }
|
aopalliance = { group = "aopalliance", name = "aopalliance", version.ref = "aopalliance" }
|
||||||
cloudServices = { group = "cloud.commandframework", name = "cloud-services", version.ref = "cloud-services" }
|
cloudServices = { group = "cloud.commandframework", name = "cloud-services", version.ref = "cloud-services" }
|
||||||
mvdwapi = { group = "com.intellectualsites.mvdwplaceholderapi", name = "MVdWPlaceholderAPI", version.ref = "mvdwapi" }
|
mvdwapi = { group = "com.intellectualsites.mvdwplaceholderapi", name = "MVdWPlaceholderAPI", version.ref = "mvdwapi" }
|
||||||
miniplaceholders = { group = "io.github.miniplaceholders", name = "miniplaceholders-api", version.ref = "miniplaceholders" }
|
|
||||||
squirrelid = { group = "org.enginehub", name = "squirrelid", version.ref = "squirrelid" }
|
squirrelid = { group = "org.enginehub", name = "squirrelid", version.ref = "squirrelid" }
|
||||||
arkitektonika = { group = "com.intellectualsites.arkitektonika", name = "Arkitektonika-Client", version.ref = "arkitektonika" }
|
arkitektonika = { group = "com.intellectualsites.arkitektonika", name = "Arkitektonika-Client", version.ref = "arkitektonika" }
|
||||||
paster = { group = "com.intellectualsites.paster", name = "Paster", version.ref = "paster" }
|
paster = { group = "com.intellectualsites.paster", name = "Paster", version.ref = "paster" }
|
||||||
|
Reference in New Issue
Block a user