Added many permissions

This commit is contained in:
Lilac 2019-08-24 15:36:04 +01:00
parent d7a4661b59
commit 60501c5c3f
21 changed files with 214 additions and 83 deletions

View File

@ -4,7 +4,7 @@ stages:
variables:
name: "UltimateModeration"
path: "/builds/$CI_PROJECT_PATH"
version: "1.1.11"
version: "1.1.12"
build:
stage: build

View File

@ -68,5 +68,10 @@
<artifactId>songodaupdater</artifactId>
<version>1</version>
</dependency>
<dependency>
<groupId>net.milkbowl</groupId>
<artifactId>vault</artifactId>
<version>1.7.1</version>
</dependency>
</dependencies>
</project>

View File

@ -29,9 +29,11 @@ import com.songoda.ultimatemoderation.utils.settings.SettingsManager;
import com.songoda.ultimatemoderation.utils.updateModules.LocaleModule;
import com.songoda.update.Plugin;
import com.songoda.update.SongodaUpdate;
import net.milkbowl.vault.permission.Permission;
import org.apache.commons.lang.ArrayUtils;
import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender;
import org.bukkit.plugin.RegisteredServiceProvider;
import org.bukkit.plugin.java.JavaPlugin;
import java.util.UUID;
@ -52,6 +54,8 @@ public class UltimateModeration extends JavaPlugin {
private Locale locale;
private Storage storage;
private Permission perms = null;
public static UltimateModeration getInstance() {
return INSTANCE;
}
@ -105,6 +109,11 @@ public class UltimateModeration extends JavaPlugin {
// Starting Metrics
new Metrics(this);
if (getServer().getPluginManager().getPlugin("Vault") != null) {
setupPermissions();
console.sendMessage("Hooked Vault.");
}
int timeout = Setting.AUTOSAVE.getInt() * 60 * 20;
Bukkit.getScheduler().runTaskTimerAsynchronously(this, () -> storage.doSave(), timeout, timeout);
console.sendMessage(Methods.formatText("&a============================="));
@ -200,6 +209,12 @@ public class UltimateModeration extends JavaPlugin {
storage.doSave();
}
private boolean setupPermissions() {
RegisteredServiceProvider<Permission> rsp = getServer().getServicesManager().getRegistration(Permission.class);
perms = rsp.getProvider();
return perms != null;
}
public ServerVersion getServerVersion() {
return serverVersion;
}
@ -248,4 +263,8 @@ public class UltimateModeration extends JavaPlugin {
public StaffChatManager getStaffChatManager() {
return staffChatManager;
}
public Permission getPerms() {
return perms;
}
}

View File

@ -50,12 +50,23 @@ public class CommandBan extends AbstractCommand {
return ReturnType.FAILURE;
}
if (instance.getPerms() != null && sender instanceof Player
&& instance.getPerms().playerHas(Bukkit.getWorlds().get(0).getName(), player, "um.ban.exempt")) {
instance.getLocale().newMessage("You cannot ban this player.").sendPrefixedMessage(sender);
return ReturnType.FAILURE;
}
if (instance.getPunishmentManager().getPlayer(player).getActivePunishments()
.stream().anyMatch(appliedPunishment -> appliedPunishment.getPunishmentType() == PunishmentType.BAN)) {
instance.getLocale().newMessage("That player is already banned.").sendPrefixedMessage(sender);
return ReturnType.FAILURE;
}
if (duration == 0 && !sender.hasPermission("um.ban.permanent")) {
instance.getLocale().getMessage("event.general.nopermission").sendPrefixedMessage(sender);
return ReturnType.FAILURE;
}
new Punishment(PunishmentType.BAN, duration == 0 ? -1 : duration, reason.equals("") ? null : reason)
.execute(sender, player);

View File

@ -48,6 +48,11 @@ public class CommandFreeze extends AbstractCommand {
return ReturnType.FAILURE;
}
if (sender instanceof Player && player.hasPermission("um.freeze.exempt")) {
instance.getLocale().newMessage("That player cannot be frozen.").sendPrefixedMessage(sender);
return ReturnType.FAILURE;
}
freeze(player, (Player) sender);
return ReturnType.SUCCESS;

View File

@ -29,6 +29,11 @@ public class CommandInvSee extends AbstractCommand {
return ReturnType.FAILURE;
}
if (player.hasPermission("um.invsee.exempt")) {
instance.getLocale().newMessage("You cannot invsee that player.").sendPrefixedMessage(sender);
return ReturnType.FAILURE;
}
((Player) sender).openInventory(player.getInventory());
return ReturnType.SUCCESS;
}

View File

@ -43,6 +43,11 @@ public class CommandKick extends AbstractCommand {
return ReturnType.FAILURE;
}
if (sender instanceof Player && player.getPlayer().hasPermission("um.kick.exempt")) {
instance.getLocale().newMessage("You cannot kick this player.").sendPrefixedMessage(sender);
return ReturnType.FAILURE;
}
new Punishment(PunishmentType.KICK, reason.equals("") ? null : reason)
.execute(sender, player);

View File

@ -50,6 +50,11 @@ public class CommandMute extends AbstractCommand {
return ReturnType.FAILURE;
}
if (sender instanceof Player && player.getPlayer().hasPermission("um.mute.exempt")) {
instance.getLocale().newMessage("You cannot mute that player.").sendPrefixedMessage(sender);
return ReturnType.FAILURE;
}
if (instance.getPunishmentManager().getPlayer(player).getActivePunishments()
.stream().anyMatch(appliedPunishment -> appliedPunishment.getPunishmentType() == PunishmentType.MUTE)) {
instance.getLocale().newMessage("That player is already muted.").sendPrefixedMessage(sender);

View File

@ -79,6 +79,11 @@ public class CommandSpy extends AbstractCommand {
return ReturnType.FAILURE;
}
if (player.hasPermission("um.spy.exempt")) {
instance.getLocale().newMessage("You cannot spy on that player.").sendPrefixedMessage(sender);
return ReturnType.FAILURE;
}
spy(player, senderP);
return ReturnType.SUCCESS;

View File

@ -7,8 +7,6 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
public class CommandViewEnderChest extends AbstractCommand {
@ -30,6 +28,11 @@ public class CommandViewEnderChest extends AbstractCommand {
return ReturnType.FAILURE;
}
if (player.hasPermission("um.viewenderchest.exempt")) {
instance.getLocale().newMessage("You cannot view the enderchest of that player.").sendPrefixedMessage(sender);
return ReturnType.FAILURE;
}
((Player) sender).openInventory(player.getEnderChest());
return ReturnType.SUCCESS;
}

View File

@ -50,6 +50,12 @@ public class CommandWarn extends AbstractCommand {
return ReturnType.FAILURE;
}
if (instance.getPerms() != null && sender instanceof Player
&& instance.getPerms().playerHas(Bukkit.getWorlds().get(0).getName(), player, "um.warning.exempt")) {
instance.getLocale().newMessage("You cannot warn that player.").sendPrefixedMessage(sender);
return ReturnType.FAILURE;
}
new Punishment(PunishmentType.WARNING, duration == 0 ? -1 : duration, reason.equals("") ? null : reason)
.execute(sender, player);

View File

@ -15,13 +15,18 @@ import org.bukkit.inventory.meta.SkullMeta;
public class GUIModerate extends AbstractGUI {
private final UltimateModeration plugin;
private final OfflinePlayer toModerate;
private boolean freeze, spy, invsee, enderview, revive;
public GUIModerate(UltimateModeration plugin, OfflinePlayer toModerate, Player player) {
super(player);
this.plugin = plugin;
this.toModerate = toModerate;
this.freeze = !toModerate.getPlayer().hasPermission("um.freeze.exempt") && player.hasPermission("um.freeze");
this.spy = !toModerate.getPlayer().hasPermission("um.spy.exempt") && player.hasPermission("um.spy");
this.invsee = !toModerate.getPlayer().hasPermission("um.invsee.exempt") && player.hasPermission("um.invsee");
this.enderview = !toModerate.getPlayer().hasPermission("um.viewenderchest.exempt") && player.hasPermission("um.viewenderchest");
this.revive = player.hasPermission("um.revive");
init(plugin.getLocale().getMessage("gui.moderate.title")
.processPlaceholder("toModerate", toModerate.getName()).getMessage(), 45);
@ -34,12 +39,11 @@ public class GUIModerate extends AbstractGUI {
? Material.OAK_DOOR
: Material.valueOf("WOOD_DOOR"), plugin.getLocale().getMessage("gui.general.back").getMessage());
createButton(10, plugin.isServerVersionAtLeast(ServerVersion.V1_13) ? Material.BLUE_ICE : Material.valueOf("PACKED_ICE"), "&6&lFreeze", "&7Stop this player from moving.", "", "&7Currently:&6 " + (CommandFreeze.isFrozen(toModerate) ? "Frozen" : "Unfrozen"));
createButton(12, Material.SADDLE, "&6&lSpy", "&7Spy on this player");
createButton(14, Material.CHEST, "&c&lInventory", "&7Access this players Inventory.");
createButton(16, Material.ENDER_CHEST, "&a&lEnderchest", "&7Access this players Enderchest");
createButton(28, plugin.isServerVersionAtLeast(ServerVersion.V1_13) ? Material.SPLASH_POTION : Material.valueOf("POTION"), "&c&lRevive", "&7Revive this player.");
if (freeze) createButton(10, plugin.isServerVersionAtLeast(ServerVersion.V1_13) ? Material.BLUE_ICE : Material.valueOf("PACKED_ICE"), "&6&lFreeze", "&7Stop this player from moving.", "", "&7Currently:&6 " + (CommandFreeze.isFrozen(toModerate) ? "Frozen" : "Unfrozen"));
if (spy) createButton(12, Material.SADDLE, "&6&lSpy", "&7Spy on this player");
if (invsee) createButton(14, Material.CHEST, "&c&lInventory", "&7Access this players Inventory.");
if (enderview) createButton(16, Material.ENDER_CHEST, "&a&lEnderchest", "&7Access this players Enderchest");
if (revive) createButton(28, plugin.isServerVersionAtLeast(ServerVersion.V1_13) ? Material.SPLASH_POTION : Material.valueOf("POTION"), "&c&lRevive", "&7Revive this player.");
}
@Override
@ -47,24 +51,34 @@ public class GUIModerate extends AbstractGUI {
registerClickable(8, ((player1, inventory1, cursor, slot, type) ->
new GUIPlayer(plugin, toModerate, player1)));
registerClickable(10, ((player1, inventory1, cursor, slot, type) -> {
CommandFreeze.freeze(toModerate, player);
constructGUI();
}));
if (freeze) {
registerClickable(10, ((player1, inventory1, cursor, slot, type) -> {
CommandFreeze.freeze(toModerate, player);
constructGUI();
}));
}
registerClickable(12, ((player1, inventory1, cursor, slot, type) -> {
CommandSpy.spy(toModerate, player);
player.closeInventory();
}));
if (spy) {
registerClickable(12, ((player1, inventory1, cursor, slot, type) -> {
CommandSpy.spy(toModerate, player);
player.closeInventory();
}));
}
registerClickable(14, ((player1, inventory1, cursor, slot, type) ->
player.openInventory(toModerate.getPlayer().getInventory())));
if (invsee) {
registerClickable(14, ((player1, inventory1, cursor, slot, type) ->
player.openInventory(toModerate.getPlayer().getInventory())));
}
registerClickable(16, ((player1, inventory1, cursor, slot, type) ->
player.openInventory(toModerate.getPlayer().getEnderChest())));
if (enderview) {
registerClickable(16, ((player1, inventory1, cursor, slot, type) ->
player.openInventory(toModerate.getPlayer().getEnderChest())));
}
registerClickable(28, ((player1, inventory1, cursor, slot, type) ->
CommandRevive.revive(toModerate.getPlayer(), player)));
if (revive) {
registerClickable(28, ((player1, inventory1, cursor, slot, type) ->
CommandRevive.revive(toModerate.getPlayer(), player)));
}
}
@Override

View File

@ -27,10 +27,14 @@ public class GUINotesManager extends AbstractGUI {
private int page = 0;
private boolean create, delete;
public GUINotesManager(UltimateModeration plugin, OfflinePlayer toModerate, Player player) {
super(player);
this.plugin = plugin;
this.toModerate = toModerate;
this.create = player.hasPermission("um.notes.create");
this.delete = player.hasPermission("um.notes.delete");
init(plugin.getLocale().getMessage("gui.notes.title")
.processPlaceholder("tonotes", player.getName()).getMessage(), 54);
@ -71,7 +75,7 @@ public class GUINotesManager extends AbstractGUI {
? Material.OAK_DOOR
: Material.valueOf("WOOD_DOOR"), plugin.getLocale().getMessage("gui.general.back").getMessage());
createButton(6, Material.REDSTONE, plugin.getLocale().getMessage("gui.notes.create").getMessage());
if (create) createButton(6, Material.REDSTONE, plugin.getLocale().getMessage("gui.notes.create").getMessage());
for (int i = 0; i < notes.size(); i++) {
PunishmentNote note = notes.get(i);
@ -106,14 +110,16 @@ public class GUINotesManager extends AbstractGUI {
lore.add(plugin.getLocale().getMessage("gui.notes.createdon")
.processPlaceholder("sent", format.format(new Date(note.getCreationDate())))
.getMessage());
lore.add(plugin.getLocale().getMessage("gui.notes.remove").getMessage());
if (delete) lore.add(plugin.getLocale().getMessage("gui.notes.remove").getMessage());
createButton(18 + i, Material.MAP, name, lore);
registerClickable(18 + i, ((player1, inventory1, cursor, slot, type) -> {
plugin.getPunishmentManager().getPlayer(toModerate).removeNote(note);
constructGUI();
}));
if (delete) {
registerClickable(18 + i, ((player1, inventory1, cursor, slot, type) -> {
plugin.getPunishmentManager().getPlayer(toModerate).removeNote(note);
constructGUI();
}));
}
}
}
@ -123,17 +129,19 @@ public class GUINotesManager extends AbstractGUI {
registerClickable(8, ((player1, inventory1, cursor, slot, type) ->
new GUIPlayer(plugin, toModerate, player1)));
registerClickable(6, ((player1, inventory1, cursor, slot, type) -> {
plugin.getLocale().getMessage("gui.notes.type").sendMessage(player);
AbstractChatConfirm abstractChatConfirm = new AbstractChatConfirm(player, event -> {
plugin.getPunishmentManager().getPlayer(toModerate).addNotes(new PunishmentNote(event.getMessage(),
player.getUniqueId(), toModerate.getUniqueId(), System.currentTimeMillis()));
constructGUI();
});
if (create) {
registerClickable(6, ((player1, inventory1, cursor, slot, type) -> {
plugin.getLocale().getMessage("gui.notes.type").sendMessage(player);
AbstractChatConfirm abstractChatConfirm = new AbstractChatConfirm(player, event -> {
plugin.getPunishmentManager().getPlayer(toModerate).addNotes(new PunishmentNote(event.getMessage(),
player.getUniqueId(), toModerate.getUniqueId(), System.currentTimeMillis()));
constructGUI();
});
abstractChatConfirm.setOnClose(() ->
init(setTitle, inventory.getSize()));
}));
abstractChatConfirm.setOnClose(() ->
init(setTitle, inventory.getSize()));
}));
}
}
@Override

View File

@ -15,10 +15,17 @@ public class GUIPlayer extends AbstractGUI {
private final OfflinePlayer toModerate;
private boolean punish, tickets, punishments, notes, moderate;
public GUIPlayer(UltimateModeration plugin, OfflinePlayer toModerate, Player player) {
super(player);
this.plugin = plugin;
this.toModerate = toModerate;
this.punish = player.hasPermission("um.punish");
this.tickets = player.hasPermission("um.tickets");
this.punishments = player.hasPermission("um.punishments");
this.notes = player.hasPermission("um.notes");
this.moderate = player.hasPermission("um.moderation");
init(plugin.getLocale().getMessage("gui.player.title")
.processPlaceholder("toModerate", toModerate.getName()).getMessage(), 54);
@ -41,12 +48,12 @@ public class GUIPlayer extends AbstractGUI {
? Material.OAK_DOOR
: Material.valueOf("WOOD_DOOR"), plugin.getLocale().getMessage("gui.general.back").getMessage());
createButton(38, Material.ANVIL, plugin.getLocale().getMessage("gui.player.punish").getMessage());
createButton(30, Material.CHEST, plugin.getLocale().getMessage("gui.player.tickets").getMessage());
if (player.isOnline())
if (punish) createButton(38, Material.ANVIL, plugin.getLocale().getMessage("gui.player.punish").getMessage());
if (tickets) createButton(30, Material.CHEST, plugin.getLocale().getMessage("gui.player.tickets").getMessage());
if (player.isOnline() && punishments)
createButton(32, Material.DIAMOND_SWORD, plugin.getLocale().getMessage("gui.player.punishments").getMessage());
createButton(42, Material.MAP, plugin.getLocale().getMessage("gui.player.notes").getMessage());
createButton(40, Material.DIAMOND_CHESTPLATE, plugin.getLocale().getMessage("gui.player.moderate").getMessage());
if (notes) createButton(42, Material.MAP, plugin.getLocale().getMessage("gui.player.notes").getMessage());
if (moderate) createButton(40, Material.DIAMOND_CHESTPLATE, plugin.getLocale().getMessage("gui.player.moderate").getMessage());
}
@Override
@ -54,20 +61,30 @@ public class GUIPlayer extends AbstractGUI {
registerClickable(8, ((player1, inventory1, cursor, slot, type) ->
new GUIPlayers(plugin, player1)));
registerClickable(38, ((player1, inventory1, cursor, slot, type) ->
new GUIPunish(plugin, toModerate, null, player1)));
if (punish) {
registerClickable(38, ((player1, inventory1, cursor, slot, type) ->
new GUIPunish(plugin, toModerate, null, player1)));
}
registerClickable(30, ((player1, inventory1, cursor, slot, type) ->
new GUITicketManager(plugin, toModerate, player1)));
if (tickets) {
registerClickable(30, ((player1, inventory1, cursor, slot, type) ->
new GUITicketManager(plugin, toModerate, player1)));
}
registerClickable(32, ((player1, inventory1, cursor, slot, type) ->
new GUIPunishments(plugin, toModerate, player1)));
if (punishments) {
registerClickable(32, ((player1, inventory1, cursor, slot, type) ->
new GUIPunishments(plugin, toModerate, player1)));
}
registerClickable(42, ((player1, inventory1, cursor, slot, type) ->
new GUINotesManager(plugin, toModerate, player1)));
if (notes) {
registerClickable(42, ((player1, inventory1, cursor, slot, type) ->
new GUINotesManager(plugin, toModerate, player1)));
}
registerClickable(40, ((player1, inventory1, cursor, slot, type) ->
new GUIModerate(plugin, toModerate, player1)));
if (moderate) {
registerClickable(40, ((player1, inventory1, cursor, slot, type) ->
new GUIModerate(plugin, toModerate, player1)));
}
}
@Override

View File

@ -132,8 +132,11 @@ public class GUIPlayers extends AbstractGUI {
createButton(46, Material.ENDER_PEARL, plugin.getLocale().getMessage("gui.players.search").getMessage());
createButton(47, Material.HOPPER, "&6" + currentOnline.getTranslation());
createButton(51, Material.CHEST, plugin.getLocale().getMessage("gui.players.button.tickets").getMessage());
createButton(52, Material.MAP, plugin.getLocale().getMessage("gui.players.button.templatemanager").getMessage());
if (player.hasPermission("um.tickets"))
createButton(51, Material.CHEST, plugin.getLocale().getMessage("gui.players.button.tickets").getMessage());
if (player.hasPermission("um.templates"))
createButton(52, Material.MAP, plugin.getLocale().getMessage("gui.players.button.templatemanager").getMessage());
}
@ -194,11 +197,17 @@ public class GUIPlayers extends AbstractGUI {
constructGUI();
}));
registerClickable(51, (player1, inventory1, cursor, slot, type) ->
new GUITicketManager(plugin, null, player));
if (player.hasPermission("um.tickets")) {
registerClickable(51, (player1, inventory1, cursor, slot, type) -> {
new GUITicketManager(plugin, null, player);
});
}
registerClickable(52, (player1, inventory1, cursor, slot, type) ->
new GUITemplateManager(plugin, player));
if (player.hasPermission("um.templates")) {
registerClickable(52, (player1, inventory1, cursor, slot, type) -> {
if (player.hasPermission("um.templates")) new GUITemplateManager(plugin, player);
});
}
}
@Override

View File

@ -69,7 +69,8 @@ public class GUIPunish extends AbstractGUI {
createButton(13, head, "&7&l" + toModerate.getName());
}
createButton(22, Material.EMERALD_BLOCK, plugin.getLocale().getMessage("gui.punish.submit").getMessage());
if (player.hasPermission("um." + type.toString().toLowerCase()))
createButton(22, Material.EMERALD_BLOCK, plugin.getLocale().getMessage("gui.punish.submit").getMessage());
createButton(8, plugin.isServerVersionAtLeast(ServerVersion.V1_13)
? Material.OAK_DOOR
@ -188,8 +189,9 @@ public class GUIPunish extends AbstractGUI {
}
if (plugin.getTemplateManager().getTemplates().size() == 0) return;
new GUITemplateSelector(plugin, this, player);
if (player.hasPermission("um.templates.use")) new GUITemplateSelector(plugin, this, player);
}));
registerClickable(32, ((player1, inventory1, cursor, slot, type) -> {
if (this.type == PunishmentType.KICK) return;
if (type == ClickType.LEFT) {
@ -233,6 +235,9 @@ public class GUIPunish extends AbstractGUI {
}));
registerClickable(22, ((player1, inventory1, cursor, slot, type1) -> {
if (!player.hasPermission("um." + type.toString().toLowerCase())) return;
if (duration == -1 && type == PunishmentType.BAN && !player.hasPermission("um.ban.permanent")) return;
if (toModerate == null) {
if (reason == null || duration == 0 || templateName == null) return;
@ -253,6 +258,7 @@ public class GUIPunish extends AbstractGUI {
new Punishment(type, reason).execute(player, toModerate);
break;
}
new GUIPlayer(plugin, toModerate, player);
}));
}

View File

@ -66,7 +66,8 @@ public class GUITemplateManager extends AbstractGUI {
: Material.valueOf("WOOD_DOOR"),
plugin.getLocale().getMessage("gui.general.back").getMessage());
createButton(7, Material.REDSTONE, plugin.getLocale().getMessage("gui.templatemanager.create").getMessage());
if (player.hasPermission("um.templates.create"))
createButton(7, Material.REDSTONE, plugin.getLocale().getMessage("gui.templatemanager.create").getMessage());
for (int i = 0; i < 9; i++)
createButton(9 + i, plugin.isServerVersionAtLeast(ServerVersion.V1_13) ? Material.GRAY_STAINED_GLASS_PANE : new ItemStack(Material.valueOf("STAINED_GLASS_PANE")), "&1");
@ -81,9 +82,9 @@ public class GUITemplateManager extends AbstractGUI {
registerClickable(18 + i, ((player1, inventory1, cursor, slot, type) -> {
if (type == ClickType.LEFT) {
new GUIPunish(plugin, null, template, player);
if (player.hasPermission("um.templates.edit")) new GUIPunish(plugin, null, template, player);
} else if (type == ClickType.RIGHT) {
plugin.getTemplateManager().removeTemplate(template.getUUID());
if (player.hasPermission("um.templates.destroy")) plugin.getTemplateManager().removeTemplate(template.getUUID());
constructGUI();
}
}));
@ -95,8 +96,11 @@ public class GUITemplateManager extends AbstractGUI {
registerClickable(8, ((player1, inventory1, cursor, slot, type) ->
new GUIPlayers(plugin, player)));
registerClickable(7, ((player1, inventory1, cursor, slot, type) ->
new GUIPunish(plugin, null, null, player)));
if (player.hasPermission("um.templates.create")) {
registerClickable(7, ((player1, inventory1, cursor, slot, type) -> {
new GUIPunish(plugin, null, null, player);
}));
}
registerClickable(3, ((player1, inventory1, cursor, slot, type) -> {
this.punishmentType = punishmentType.nextFilter();

View File

@ -80,7 +80,7 @@ public class GUITicket extends AbstractGUI {
createButton(7, Material.REDSTONE,
plugin.getLocale().getMessage("gui.ticket.clicktotele").getMessage());
createButton(6, Material.REDSTONE, plugin.getLocale().getMessage("gui.ticket.respond").getMessage());
if (player.hasPermission("um.tickets.respond")) createButton(6, Material.REDSTONE, plugin.getLocale().getMessage("gui.ticket.respond").getMessage());
for (int i = 0; i < 9; i++)
createButton(9 + i, plugin.isServerVersionAtLeast(ServerVersion.V1_13) ? Material.GRAY_STAINED_GLASS_PANE : new ItemStack(Material.valueOf("STAINED_GLASS_PANE")), "&1");
@ -139,16 +139,18 @@ public class GUITicket extends AbstractGUI {
}));
}
registerClickable(6, ((player1, inventory1, cursor, slot, type) -> {
player.sendMessage(plugin.getLocale().getMessage("gui.ticket.what").getMessage());
AbstractChatConfirm abstractChatConfirm = new AbstractChatConfirm(player, event2 -> {
ticket.addResponse(new TicketResponse(player, event2.getMessage(), System.currentTimeMillis()));
constructGUI();
});
if (player.hasPermission("um.ticket.respond")) {
registerClickable(6, ((player1, inventory1, cursor, slot, type) -> {
player.sendMessage(plugin.getLocale().getMessage("gui.ticket.what").getMessage());
AbstractChatConfirm abstractChatConfirm = new AbstractChatConfirm(player, event2 -> {
ticket.addResponse(new TicketResponse(player, event2.getMessage(), System.currentTimeMillis()));
constructGUI();
});
abstractChatConfirm.setOnClose(() ->
init(setTitle, inventory.getSize()));
}));
abstractChatConfirm.setOnClose(() ->
init(setTitle, inventory.getSize()));
}));
}
}
@Override

View File

@ -73,8 +73,8 @@ public class GUITicketManager extends AbstractGUI {
createButton(3 ,Material.DIAMOND_SWORD, Methods.formatText("&6" + status.getStatus()));
if (toModerate != null)
createButton(7, Material.REDSTONE, plugin.getLocale().getMessage("gui.tickets.create").getMessage());
if (toModerate != null && player.hasPermission("um.tickets.create"))
createButton(7, Material.REDSTONE, plugin.getLocale().getMessage("gui.tickets.create").getMessage());
if (player.hasPermission("um.ticket"))
createButton(8, plugin.isServerVersionAtLeast(ServerVersion.V1_13)
@ -149,9 +149,9 @@ public class GUITicketManager extends AbstractGUI {
constructGUI();
}));
if (toModerate != null) {
registerClickable(7, ((player1, inventory1, cursor, slot, type) ->
createNew(player, toModerate)));
if (toModerate != null && player.hasPermission("um.tickets.create")) {
registerClickable(7, ((player1, inventory1, cursor, slot, type) ->
createNew(player, toModerate)));
}
}

View File

@ -8,6 +8,7 @@ import com.songoda.ultimatemoderation.utils.Methods;
import com.songoda.ultimatemoderation.utils.settings.Setting;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.player.AsyncPlayerChatEvent;

View File

@ -4,6 +4,7 @@ main: com.songoda.ultimatemoderation.UltimateModeration
version: maven-version-number
author: Songoda
api-version: 1.13
softdepend: [Vault]
commands:
UltimateModeration:
description: View information on this plugin.