TrMenu compatibility (Thanks to @Dreeam)
This commit is contained in:
parent
657e51f2cc
commit
b9ecb58760
@ -1,17 +1,7 @@
|
||||
package fr.xephi.authme.listener;
|
||||
|
||||
import fr.xephi.authme.data.QuickCommandsProtectionManager;
|
||||
import fr.xephi.authme.datasource.DataSource;
|
||||
import fr.xephi.authme.message.Messages;
|
||||
import fr.xephi.authme.permission.PermissionsManager;
|
||||
import fr.xephi.authme.process.Management;
|
||||
import fr.xephi.authme.service.AntiBotService;
|
||||
import fr.xephi.authme.service.BukkitService;
|
||||
import fr.xephi.authme.service.JoinMessageService;
|
||||
import fr.xephi.authme.service.TeleportationService;
|
||||
import fr.xephi.authme.service.ValidationService;
|
||||
import fr.xephi.authme.settings.Settings;
|
||||
import fr.xephi.authme.settings.SpawnLoader;
|
||||
import fr.xephi.authme.settings.properties.PluginSettings;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
@ -26,18 +16,26 @@ public class PlayerListenerHigherThan18 implements Listener {
|
||||
@Inject
|
||||
private ListenerService listenerService;
|
||||
|
||||
@Inject
|
||||
private Settings settings;
|
||||
|
||||
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST)
|
||||
public void onPlayerPickupItem(EntityPickupItemEvent event) {
|
||||
if (listenerService.shouldCancelEvent(event)) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
public void onSwitchHand(PlayerSwapHandItemsEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
if (!player.isSneaking() || !player.hasPermission("keybindings.use"))
|
||||
if ((!player.isSneaking() || !player.hasPermission("keybindings.use")) &&
|
||||
settings.getProperty(PluginSettings.MENU_UNREGISTER_COMPATIBILITY)) {
|
||||
return;
|
||||
}
|
||||
event.setCancelled(true);
|
||||
Bukkit.dispatchCommand(event.getPlayer(), "help");
|
||||
if (settings.getProperty(PluginSettings.MENU_UNREGISTER_COMPATIBILITY)) {
|
||||
Bukkit.dispatchCommand(event.getPlayer(), "help");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -8,6 +8,13 @@ import fr.xephi.authme.output.LogLevel;
|
||||
import static ch.jalu.configme.properties.PropertyInitializer.newProperty;
|
||||
|
||||
public final class PluginSettings implements SettingsHolder {
|
||||
@Comment({
|
||||
"Should we execute /help command when unregistered players press Shift+F?",
|
||||
"This keeps compatibility with some menu plugins",
|
||||
"If you are using TrMenu, don't enable this because TrMenu already implemented this."
|
||||
})
|
||||
public static final Property<Boolean> MENU_UNREGISTER_COMPATIBILITY =
|
||||
newProperty("3rdPartyFeatures.compatibility.menu_plugins", true);
|
||||
|
||||
@Comment({
|
||||
"Do you want to enable the session feature?",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user