Updates and Added Bypass Mode Feature In The Staff Management System
This commit is contained in:
parent
918ee11ee5
commit
d49e4bd87d
@ -0,0 +1,34 @@
|
||||
package com.loganmagnan.eventcore.commands;
|
||||
|
||||
import com.loganmagnan.eventcore.EventCore;
|
||||
import com.loganmagnan.eventcore.utils.ColorUtils;
|
||||
import com.loganmagnan.eventcore.utils.Constants;
|
||||
import com.loganmagnan.eventcore.utils.command.BaseCommand;
|
||||
import com.loganmagnan.eventcore.utils.command.Command;
|
||||
import com.loganmagnan.eventcore.utils.command.CommandArguments;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class BypassModeCommand extends BaseCommand {
|
||||
|
||||
private EventCore main = EventCore.getInstance();
|
||||
|
||||
@Command(name = "bypassmode", permission = "eventcore.command.bypassmode", aliases = {"bypass", "build", "buildmode"})
|
||||
@Override
|
||||
public void executeAs(CommandArguments command) {
|
||||
Player player = command.getPlayer();
|
||||
|
||||
String[] args = command.getArgs();
|
||||
|
||||
if (args.length == 0) {
|
||||
if (this.main.getStaffManager().getPlayersBypassed().contains(player.getUniqueId())) {
|
||||
this.main.getStaffManager().getPlayersBypassed().remove(player.getUniqueId());
|
||||
|
||||
player.sendMessage(ColorUtils.getMessageType(Constants.COMMAND_MESSAGES.get("bypass-mode.disabled").get(0)));
|
||||
} else {
|
||||
this.main.getStaffManager().getPlayersBypassed().add(player.getUniqueId());
|
||||
|
||||
player.sendMessage(ColorUtils.getMessageType(Constants.COMMAND_MESSAGES.get("bypass-mode.enabled").get(0)));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -27,7 +27,7 @@ public class AsyncPlayerChatListener implements Listener {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!player.hasPermission(Constants.PERMISSION_NODES.get("chat-bypass"))) {
|
||||
if (!player.hasPermission(Constants.PERMISSION_NODES.get("chat.bypass"))) {
|
||||
if (this.main.getCooldownManager().isOnChatCooldown(player.getUniqueId())) {
|
||||
int minutes = this.main.getCooldownManager().getChatCooldownTime(player.getUniqueId()) / 60;
|
||||
int seconds = this.main.getCooldownManager().getChatCooldownTime(player.getUniqueId()) % 60;
|
||||
|
@ -60,6 +60,10 @@ public class StaffModeListener implements Listener {
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.main.getStaffManager().getPlayersBypassed().contains(player.getUniqueId())) {
|
||||
return;
|
||||
}
|
||||
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
@ -71,6 +75,10 @@ public class StaffModeListener implements Listener {
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.main.getStaffManager().getPlayersBypassed().contains(player.getUniqueId())) {
|
||||
return;
|
||||
}
|
||||
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
@ -110,6 +118,10 @@ public class StaffModeListener implements Listener {
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.main.getStaffManager().getPlayersBypassed().contains(player.getUniqueId())) {
|
||||
return;
|
||||
}
|
||||
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
@ -127,6 +139,10 @@ public class StaffModeListener implements Listener {
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.main.getStaffManager().getPlayersBypassed().contains(player.getUniqueId())) {
|
||||
return;
|
||||
}
|
||||
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
@ -138,6 +154,10 @@ public class StaffModeListener implements Listener {
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.main.getStaffManager().getPlayersBypassed().contains(player.getUniqueId())) {
|
||||
return;
|
||||
}
|
||||
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
|
@ -20,6 +20,7 @@ public class StaffManager {
|
||||
private List<UUID> playersInStaffMode = new ArrayList<UUID>();
|
||||
private List<UUID> playersVanished = new ArrayList<UUID>();
|
||||
private List<UUID> playersHidingStaff = new ArrayList<UUID>();
|
||||
private List<UUID> playersBypassed = new ArrayList<UUID>();
|
||||
|
||||
private Map<UUID, CachedInventory> cachedInventories = new HashMap<UUID, CachedInventory>();
|
||||
|
||||
|
@ -74,7 +74,7 @@ public class ChatManagementMenu extends Menu {
|
||||
ColorUtils.getMessageType("&bToggle Chat"),
|
||||
ColorUtils.getMessageType(
|
||||
Arrays.asList(
|
||||
"&fMuted: " + (this.main.getChatManager().isMuted() ? "&aYes" : "&4No"),
|
||||
"&fMuted: " + (this.main.getChatManager().isMuted() ? "&aYes" : "&cNo"),
|
||||
"&fToggled By: &b" + (this.main.getChatManager().getToggledBy() == null ? "None" : this.main.getServer().getOfflinePlayer(this.main.getChatManager().getToggledBy()).getName()),
|
||||
"&fLast Toggled: &b" + (this.main.getChatManager().getLastToggledTime() == 0 ? "Never" : Utils.getTimeAsAString(this.main.getChatManager().getLastToggledTime())),
|
||||
"",
|
||||
|
@ -112,8 +112,8 @@ public class StaffOnlineMenu extends PaginatedMenu {
|
||||
}
|
||||
|
||||
List<String> lore = new ArrayList<String>();
|
||||
lore.add(ColorUtils.getMessageType("&fStaff Mode: " + (this.main.getStaffManager().isPlayerInStaffMode(playerOnline) ? "&aEnabled" : "&4Disabled")));
|
||||
lore.add(ColorUtils.getMessageType("&fVanish: " + (this.main.getStaffManager().isPlayerVanished(playerOnline) ? "&aEnabled" : "&4Disabled")));
|
||||
lore.add(ColorUtils.getMessageType("&fStaff Mode: " + (this.main.getStaffManager().isPlayerInStaffMode(playerOnline) ? "&aEnabled" : "&cDisabled")));
|
||||
lore.add(ColorUtils.getMessageType("&fVanish: " + (this.main.getStaffManager().isPlayerVanished(playerOnline) ? "&aEnabled" : "&cDisabled")));
|
||||
lore.add(ColorUtils.getMessageType(""));
|
||||
lore.add(ColorUtils.getMessageType("&bClick to teleport"));
|
||||
|
||||
|
@ -28,6 +28,10 @@ public class Constants {
|
||||
COMMAND_MESSAGES.put("staff-mode.enabled", Collections.singletonList(this.main.getMessagesConfig().getConfig().getString("MESSAGES.COMMANDS.STAFF-MODE.ENABLED")));
|
||||
COMMAND_MESSAGES.put("staff-mode.disabled", Collections.singletonList(this.main.getMessagesConfig().getConfig().getString("MESSAGES.COMMANDS.STAFF-MODE.DISABLED")));
|
||||
|
||||
// /bypassmode
|
||||
COMMAND_MESSAGES.put("bypass-mode.enabled", Collections.singletonList(this.main.getMessagesConfig().getConfig().getString("MESSAGES.COMMANDS.BYPASS-MODE.ENABLED")));
|
||||
COMMAND_MESSAGES.put("bypass-mode.disabled", Collections.singletonList(this.main.getMessagesConfig().getConfig().getString("MESSAGES.COMMANDS.BYPASS-MODE.DISABLED")));
|
||||
|
||||
// AsyncPlayerChatEvent
|
||||
LISTENER_MESSAGES.put("chat-muted", Collections.singletonList(this.main.getMessagesConfig().getConfig().getString("MESSAGES.LISTENERS.CHAT-MUTED")));
|
||||
LISTENER_MESSAGES.put("chat-cooldown", this.main.getMessagesConfig().getConfig().getStringList("MESSAGES.LISTENERS.CHAT-COOLDOWN"));
|
||||
@ -43,6 +47,7 @@ public class Constants {
|
||||
STAFF_MANAGEMENT_MESSAGES.put("vanish.disabled", Collections.singletonList(this.main.getMessagesConfig().getConfig().getString("MESSAGES.STAFF-MANAGEMENT.VANISH.DISABLED")));
|
||||
|
||||
// Permission Nodes
|
||||
PERMISSION_NODES.put("chat-bypass", this.main.getMainConfig().getConfig().getString("PERMISSION-NODES.CHAT-BYPASS"));
|
||||
PERMISSION_NODES.put("chat.bypass", this.main.getMainConfig().getConfig().getString("PERMISSION-NODES.CHAT-BYPASS"));
|
||||
PERMISSION_NODES.put("staff-mode.bypass", this.main.getMainConfig().getConfig().getString("PERMISSION-NODES.STAFF-MODE-BYPASS"));
|
||||
}
|
||||
}
|
||||
|
@ -19,6 +19,9 @@ MESSAGES:
|
||||
STAFF-MODE: # Permission Node - eventcore.command.staffmode
|
||||
ENABLED: "&bYou've &aenabled &bstaff mode"
|
||||
DISABLED: "&bYou've &cdisabled &bstaff mode"
|
||||
BYPASS-MODE: # Permission Node - eventcore.command.bypassmode
|
||||
ENABLED: "&bYou've &aenabled &bbypass mode"
|
||||
DISABLED: "&bYou've &cdisabled &bbypass mode"
|
||||
LISTENERS:
|
||||
CHAT-MUTED: "&cChat is muted"
|
||||
CHAT-COOLDOWN:
|
||||
|
Loading…
Reference in New Issue
Block a user