mirror of
https://github.com/songoda/UltimateModeration.git
synced 2025-02-16 19:41:19 +01:00
Merge branch 'development'
This commit is contained in:
commit
eff2de6360
2
pom.xml
2
pom.xml
@ -2,7 +2,7 @@
|
||||
<groupId>com.songoda</groupId>
|
||||
<artifactId>UltimateModeration</artifactId>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<version>1.2.8</version>
|
||||
<version>1.2.9</version>
|
||||
<build>
|
||||
<defaultGoal>clean install</defaultGoal>
|
||||
<finalName>UltimateModeration-${project.version}</finalName>
|
||||
|
@ -241,4 +241,8 @@ public class UltimateModeration extends SongodaPlugin {
|
||||
public StaffChatManager getStaffChatManager() {
|
||||
return staffChatManager;
|
||||
}
|
||||
|
||||
public GuiManager getGuiManager() {
|
||||
return guiManager;
|
||||
}
|
||||
}
|
||||
|
@ -10,7 +10,6 @@ import org.bukkit.Bukkit;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.omg.CORBA.TypeCodePackage.BadKind;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
|
@ -27,8 +27,8 @@ public class CommandSpy extends AbstractCommand {
|
||||
public static void spy(OfflinePlayer oPlayer, Player senderP) {
|
||||
UltimateModeration instance = UltimateModeration.getInstance();
|
||||
|
||||
if (isSpying(senderP) && oPlayer == null) {
|
||||
CommandSpy.Spy spyingEntry = CommandSpy.getSpying().remove(senderP.getUniqueId());
|
||||
if (spying.containsKey(senderP) && oPlayer == null) {
|
||||
Spy spyingEntry = spying.remove(senderP.getUniqueId());
|
||||
senderP.teleport(spyingEntry.getLastLocation());
|
||||
if (spyingEntry.isVanishApplied() && CommandVanish.isVanished(senderP))
|
||||
CommandVanish.vanish(senderP);
|
||||
@ -82,7 +82,7 @@ public class CommandSpy extends AbstractCommand {
|
||||
|
||||
Player senderP = ((Player) sender);
|
||||
|
||||
if (args.length == 0) {
|
||||
if (args.length == 0 || spying.containsKey(senderP.getUniqueId())) {
|
||||
if (!spying.containsKey(senderP.getUniqueId()))
|
||||
return ReturnType.SYNTAX_ERROR;
|
||||
Spy spyingEntry = spying.remove(senderP.getUniqueId());
|
||||
@ -138,10 +138,6 @@ public class CommandSpy extends AbstractCommand {
|
||||
return "Allows you to spy on a player.";
|
||||
}
|
||||
|
||||
public static Map<UUID, Spy> getSpying() {
|
||||
return spying;
|
||||
}
|
||||
|
||||
public static class Spy {
|
||||
private Location lastLocation;
|
||||
private boolean vanishApplied;
|
||||
|
@ -38,7 +38,7 @@ public class CommandStaffChat extends AbstractCommand {
|
||||
return ReturnType.FAILURE;
|
||||
}
|
||||
|
||||
instance.getLocale().getMessage("event.staffchat.leave")
|
||||
instance.getLocale().getMessage("event.staffchat.join")
|
||||
.processPlaceholder("channel", channelName).sendPrefixedMessage(player);
|
||||
instance.getStaffChatManager().getChat(channelName).addMember(player);
|
||||
return ReturnType.SUCCESS;
|
||||
|
@ -5,6 +5,7 @@ import com.songoda.ultimatemoderation.UltimateModeration;
|
||||
import com.songoda.ultimatemoderation.punish.Punishment;
|
||||
import com.songoda.ultimatemoderation.punish.PunishmentType;
|
||||
import com.songoda.ultimatemoderation.utils.Methods;
|
||||
import com.songoda.ultimatemoderation.utils.VaultPermissions;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.command.CommandSender;
|
||||
@ -53,7 +54,7 @@ public class CommandWarn extends AbstractCommand {
|
||||
return ReturnType.FAILURE;
|
||||
}
|
||||
|
||||
if (sender instanceof Player && player.getPlayer().hasPermission("um.warning.exempt")) {
|
||||
if (sender instanceof Player && VaultPermissions.hasPermission(Bukkit.getWorlds().get(0).getName(), player, "um.warning.exempt")) {
|
||||
instance.getLocale().newMessage("You cannot warn that player.").sendPrefixedMessage(sender);
|
||||
return ReturnType.FAILURE;
|
||||
}
|
||||
|
@ -1,11 +1,11 @@
|
||||
package com.songoda.ultimatemoderation.gui;
|
||||
|
||||
import com.songoda.core.compatibility.ServerVersion;
|
||||
import com.songoda.core.gui.AnvilGui;
|
||||
import com.songoda.ultimatemoderation.UltimateModeration;
|
||||
import com.songoda.ultimatemoderation.punish.PunishmentType;
|
||||
import com.songoda.ultimatemoderation.punish.player.PlayerPunishData;
|
||||
import com.songoda.ultimatemoderation.tickets.TicketStatus;
|
||||
import com.songoda.ultimatemoderation.utils.gui.AbstractAnvilGUI;
|
||||
import com.songoda.ultimatemoderation.utils.gui.AbstractGUI;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
@ -28,10 +28,19 @@ public class GUIPlayers extends AbstractGUI {
|
||||
private int page = 0;
|
||||
private Online currentOnline = Online.ONLINE;
|
||||
|
||||
private List<UUID> players = new ArrayList<>();
|
||||
|
||||
public GUIPlayers(UltimateModeration plugin, Player player) {
|
||||
super(player);
|
||||
this.plugin = plugin;
|
||||
|
||||
for (Player p : Bukkit.getOnlinePlayers())
|
||||
players.add(p.getUniqueId());
|
||||
for (UUID uuid : plugin.getPunishmentManager().getPunishments().keySet()) {
|
||||
if (Bukkit.getOfflinePlayer(uuid).isOnline()) continue;
|
||||
players.add(uuid);
|
||||
}
|
||||
|
||||
init(plugin.getLocale().getMessage("gui.players.title").getMessage(), 54);
|
||||
runTask();
|
||||
}
|
||||
@ -42,27 +51,16 @@ public class GUIPlayers extends AbstractGUI {
|
||||
resetClickables();
|
||||
registerClickables();
|
||||
|
||||
|
||||
int numNotes = Bukkit.getOnlinePlayers().size();
|
||||
int maxPage = (int) Math.floor(numNotes / 36.0);
|
||||
|
||||
List<UUID> players = new ArrayList<>();
|
||||
|
||||
if (currentOnline == Online.ONLINE || currentOnline == Online.BOTH) {
|
||||
for (Player player : Bukkit.getOnlinePlayers()) {
|
||||
players.add(player.getUniqueId());
|
||||
}
|
||||
}
|
||||
if (currentOnline == Online.OFFLINE || currentOnline == Online.BOTH) {
|
||||
for (UUID uuid : plugin.getPunishmentManager().getPunishments().keySet()) {
|
||||
if (Bukkit.getOfflinePlayer(uuid).isOnline()) continue;
|
||||
players.add(uuid);
|
||||
}
|
||||
}
|
||||
|
||||
players = players.stream()
|
||||
List<UUID> toUse = players.stream()
|
||||
.filter(u -> currentOnline == Online.BOTH
|
||||
|| currentOnline == Online.ONLINE && Bukkit.getOfflinePlayer(u).isOnline()
|
||||
|| currentOnline == Online.OFFLINE && !Bukkit.getOfflinePlayer(u).isOnline())
|
||||
.skip(page * 36).limit(36).collect(Collectors.toList());
|
||||
|
||||
|
||||
int numNotes = toUse.size();
|
||||
int maxPage = (int) Math.floor(numNotes / 36.0);
|
||||
|
||||
if (page != 0) {
|
||||
createButton(46, Material.ARROW, plugin.getLocale().getMessage("gui.general.previous").getMessage());
|
||||
registerClickable(46, ((player1, inventory1, cursor, slot, type) -> {
|
||||
@ -79,8 +77,8 @@ public class GUIPlayers extends AbstractGUI {
|
||||
}));
|
||||
}
|
||||
|
||||
for (int i = 0; i < players.size(); i++) {
|
||||
OfflinePlayer pl = Bukkit.getOfflinePlayer(players.get(i));
|
||||
for (int i = 0; i < toUse.size(); i++) {
|
||||
OfflinePlayer pl = Bukkit.getOfflinePlayer(toUse.get(i));
|
||||
|
||||
PlayerPunishData playerPunishData = plugin.getPunishmentManager().getPlayer(pl);
|
||||
|
||||
@ -164,7 +162,8 @@ public class GUIPlayers extends AbstractGUI {
|
||||
protected void registerClickables() {
|
||||
|
||||
registerClickable(46, ((player1, inventory1, cursor, slot, type) -> {
|
||||
AbstractAnvilGUI gui = new AbstractAnvilGUI(player, event -> {
|
||||
AnvilGui gui = new AnvilGui(player1);
|
||||
gui.setAction(event -> {
|
||||
List<UUID> players = new ArrayList<>(plugin.getPunishmentManager().getPunishments().keySet());
|
||||
|
||||
for (Player player : Bukkit.getOnlinePlayers()) {
|
||||
@ -172,10 +171,12 @@ public class GUIPlayers extends AbstractGUI {
|
||||
players.add(player.getUniqueId());
|
||||
}
|
||||
|
||||
List<UUID> found = players.stream().filter(uuid -> Bukkit.getOfflinePlayer(uuid).getName().equalsIgnoreCase(event.getName())).collect(Collectors.toList());
|
||||
List<UUID> found = players.stream().filter(uuid -> Bukkit.getOfflinePlayer(uuid).getName().toLowerCase().contains(gui.getInputText().toLowerCase())).collect(Collectors.toList());
|
||||
|
||||
if (found.size() == 1) {
|
||||
new GUIPlayer(plugin, Bukkit.getOfflinePlayer(found.get(0)), player);
|
||||
if (found.size() >= 1) {
|
||||
this.players = found;
|
||||
constructGUI();
|
||||
player.openInventory(this.inventory);
|
||||
} else {
|
||||
plugin.getLocale().getMessage("gui.players.nonefound").sendMessage(player);
|
||||
}
|
||||
@ -187,8 +188,8 @@ public class GUIPlayers extends AbstractGUI {
|
||||
meta.setDisplayName(plugin.getLocale().getMessage("gui.players.name").getMessage());
|
||||
item.setItemMeta(meta);
|
||||
|
||||
gui.setSlot(AbstractAnvilGUI.AnvilSlot.INPUT_LEFT, item);
|
||||
gui.open();
|
||||
gui.setInput(item);
|
||||
plugin.getGuiManager().showGUI(player, gui);
|
||||
}));
|
||||
|
||||
registerClickable(47, ((player1, inventory1, cursor, slot, type) -> {
|
||||
|
@ -30,7 +30,7 @@ public class StaffChannel {
|
||||
if (members.contains(player.getUniqueId())) return;
|
||||
messageAll(UltimateModeration.getInstance().getLocale()
|
||||
.getMessage("event.staffchat.alljoin")
|
||||
.processPlaceholder("player", player.getName()).getMessage());
|
||||
.processPlaceholder("player", player.getName()).getMessage(), player);
|
||||
|
||||
UltimateModeration.getInstance().getStaffChatManager().getChats().values().stream().forEach(members1 -> {
|
||||
if (members1.listMembers().contains(player.getUniqueId())) {
|
||||
@ -47,7 +47,7 @@ public class StaffChannel {
|
||||
members.remove(player.getUniqueId());
|
||||
messageAll(UltimateModeration.getInstance().getLocale()
|
||||
.getMessage("event.staffchat.allleave")
|
||||
.processPlaceholder("player", player.getName()).getMessage());
|
||||
.processPlaceholder("player", player.getName()).getMessage(), player);
|
||||
}
|
||||
|
||||
public void processMessage(String message, Player player) {
|
||||
@ -60,8 +60,13 @@ public class StaffChannel {
|
||||
}
|
||||
|
||||
public void messageAll(String message) {
|
||||
messageAll(message, null);
|
||||
}
|
||||
|
||||
public void messageAll(String message, Player exempt) {
|
||||
chatLog.add(message);
|
||||
for (Player player : Bukkit.getOnlinePlayers()) {
|
||||
if (exempt != null && player == exempt) continue;
|
||||
if (!members.contains(player.getUniqueId()) && !player.hasPermission("um.staffchat.spy")) continue;
|
||||
player.sendMessage(Methods.formatText(message));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user