mirror of
https://github.com/LuckPerms/LuckPerms.git
synced 2024-11-28 13:45:20 +01:00
Closes #58 - Disable OP commands on Sponge
This commit is contained in:
parent
251f51b01c
commit
4ecb2c7c27
@ -41,6 +41,7 @@ public enum Message {
|
|||||||
PLAYER_OFFLINE("&cOffline", false),
|
PLAYER_OFFLINE("&cOffline", false),
|
||||||
LOADING_ERROR("Permissions data could not be loaded. Please contact an administrator.", true),
|
LOADING_ERROR("Permissions data could not be loaded. Please contact an administrator.", true),
|
||||||
OP_DISABLED("&bThe vanilla OP system is disabled on this server.", false),
|
OP_DISABLED("&bThe vanilla OP system is disabled on this server.", false),
|
||||||
|
OP_DISABLED_SPONGE("&2Server Operator status has no effect when a permission plugin is installed. Please edit user data directly.", true),
|
||||||
LOG("&3LOG &3&l> {0}", true),
|
LOG("&3LOG &3&l> {0}", true),
|
||||||
|
|
||||||
COMMAND_NOT_RECOGNISED("Command not recognised.", true),
|
COMMAND_NOT_RECOGNISED("Command not recognised.", true),
|
||||||
|
@ -8,6 +8,7 @@ player-online: "&aOnline"
|
|||||||
player-offline: "&cOffline"
|
player-offline: "&cOffline"
|
||||||
loading-error: "Permissions data could not be loaded. Please contact an administrator."
|
loading-error: "Permissions data could not be loaded. Please contact an administrator."
|
||||||
op-disabled: "&bThe vanilla OP system is disabled on this server."
|
op-disabled: "&bThe vanilla OP system is disabled on this server."
|
||||||
|
op-disabled-sponge: "&2Server Operator status has no effect when a permission plugin is installed. Please edit user data directly."
|
||||||
log: "&3LOG &3&l> {0}"
|
log: "&3LOG &3&l> {0}"
|
||||||
|
|
||||||
command-not-recognised: "Command not recognised."
|
command-not-recognised: "Command not recognised."
|
||||||
|
@ -29,9 +29,11 @@ import me.lucko.luckperms.common.core.model.User;
|
|||||||
import me.lucko.luckperms.common.utils.AbstractListener;
|
import me.lucko.luckperms.common.utils.AbstractListener;
|
||||||
import me.lucko.luckperms.sponge.timings.LPTiming;
|
import me.lucko.luckperms.sponge.timings.LPTiming;
|
||||||
|
|
||||||
|
import org.spongepowered.api.command.CommandSource;
|
||||||
import org.spongepowered.api.entity.living.player.Player;
|
import org.spongepowered.api.entity.living.player.Player;
|
||||||
import org.spongepowered.api.event.Listener;
|
import org.spongepowered.api.event.Listener;
|
||||||
import org.spongepowered.api.event.Order;
|
import org.spongepowered.api.event.Order;
|
||||||
|
import org.spongepowered.api.event.command.SendCommandEvent;
|
||||||
import org.spongepowered.api.event.network.ClientConnectionEvent;
|
import org.spongepowered.api.event.network.ClientConnectionEvent;
|
||||||
import org.spongepowered.api.profile.GameProfile;
|
import org.spongepowered.api.profile.GameProfile;
|
||||||
import org.spongepowered.api.text.serializer.TextSerializers;
|
import org.spongepowered.api.text.serializer.TextSerializers;
|
||||||
@ -114,4 +116,15 @@ public class SpongeListener extends AbstractListener {
|
|||||||
onLeave(e.getTargetEntity().getUniqueId());
|
onLeave(e.getTargetEntity().getUniqueId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Listener
|
||||||
|
public void onSendCommand(SendCommandEvent e) {
|
||||||
|
CommandSource source = e.getCause().first(CommandSource.class).orElse(null);
|
||||||
|
if (source == null) return;
|
||||||
|
|
||||||
|
final String name = e.getCommand().toLowerCase();
|
||||||
|
if (name.equals("op") || name.equals("deop")) {
|
||||||
|
Message.OP_DISABLED_SPONGE.send(plugin.getSenderFactory().wrap(source));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user