Merge branch 'development'
This commit is contained in:
commit
ade1ebdede
18
pom.xml
18
pom.xml
|
@ -2,7 +2,7 @@
|
|||
<groupId>com.songoda</groupId>
|
||||
<artifactId>UltimateModeration</artifactId>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<version>1.2.5</version>
|
||||
<version>1.2.6</version>
|
||||
<build>
|
||||
<defaultGoal>clean install</defaultGoal>
|
||||
<finalName>UltimateModeration-${project.version}</finalName>
|
||||
|
@ -84,6 +84,14 @@
|
|||
<id>private</id>
|
||||
<url>http://repo.songoda.com/artifactory/private/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>public</id>
|
||||
<url>https://repo.songoda.com/artifactory/public/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>jitpack.io</id>
|
||||
<url>https://jitpack.io</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
|
@ -91,6 +99,12 @@
|
|||
<artifactId>spigot</artifactId>
|
||||
<version>1.15</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.MilkBowl</groupId>
|
||||
<artifactId>VaultAPI</artifactId>
|
||||
<version>1.7</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.songoda</groupId>
|
||||
<artifactId>abledskyblock</artifactId>
|
||||
|
@ -100,7 +114,7 @@
|
|||
<dependency>
|
||||
<groupId>com.songoda</groupId>
|
||||
<artifactId>SongodaCore</artifactId>
|
||||
<version>maven-version-number</version>
|
||||
<version>LATEST</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
|
|
@ -1,10 +1,12 @@
|
|||
package com.songoda.ultimatemoderation.commands;
|
||||
|
||||
import com.songoda.core.commands.AbstractCommand;
|
||||
import com.songoda.core.utils.PlayerUtils;
|
||||
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;
|
||||
|
@ -48,12 +50,12 @@ public class CommandBan extends AbstractCommand {
|
|||
|
||||
OfflinePlayer player = Bukkit.getOfflinePlayer(args[0]);
|
||||
|
||||
if (player == null) {
|
||||
if (!player.hasPlayedBefore()) {
|
||||
instance.getLocale().newMessage("That player does not exist.").sendMessage(sender);
|
||||
return ReturnType.FAILURE;
|
||||
}
|
||||
|
||||
if (sender instanceof Player && player.getPlayer().hasPermission("um.ban.exempt")) {
|
||||
if (sender instanceof Player && VaultPermissions.hasPermission(Bukkit.getWorlds().get(0).getName(), player, "um.ban.exempt")) {
|
||||
instance.getLocale().newMessage("You cannot ban this player.").sendPrefixedMessage(sender);
|
||||
return ReturnType.FAILURE;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
@ -48,12 +49,12 @@ public class CommandMute extends AbstractCommand {
|
|||
|
||||
OfflinePlayer player = Bukkit.getOfflinePlayer(args[0]);
|
||||
|
||||
if (player == null) {
|
||||
if (!player.hasPlayedBefore()) {
|
||||
instance.getLocale().newMessage("That player does not exist.").sendPrefixedMessage(sender);
|
||||
return ReturnType.FAILURE;
|
||||
}
|
||||
|
||||
if (sender instanceof Player && player.getPlayer().hasPermission("um.mute.exempt")) {
|
||||
if (sender instanceof Player && VaultPermissions.hasPermission(Bukkit.getWorlds().get(0).getName(), player, "um.mute.exempt")) {
|
||||
instance.getLocale().newMessage("You cannot mute that player.").sendPrefixedMessage(sender);
|
||||
return ReturnType.FAILURE;
|
||||
}
|
||||
|
|
|
@ -3,7 +3,9 @@ package com.songoda.ultimatemoderation.commands;
|
|||
import com.songoda.core.commands.AbstractCommand;
|
||||
import com.songoda.core.compatibility.ServerVersion;
|
||||
import com.songoda.ultimatemoderation.UltimateModeration;
|
||||
import com.songoda.ultimatemoderation.listeners.SpyingDismountListener;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
@ -25,11 +27,22 @@ 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());
|
||||
senderP.teleport(spyingEntry.getLastLocation());
|
||||
if (spyingEntry.isVanishApplied() && CommandVanish.isVanished(senderP))
|
||||
CommandVanish.vanish(senderP);
|
||||
senderP.setGameMode(SpyingDismountListener.getGamemodes().get(senderP.getUniqueId()));
|
||||
|
||||
UltimateModeration.getInstance().getLocale().getMessage("command.spy.returned").sendPrefixedMessage(senderP);
|
||||
}
|
||||
|
||||
if (!ServerVersion.isServerVersionAtLeast(ServerVersion.V1_12)) {
|
||||
instance.getLocale().newMessage("This feature is not compatible with this version of spigot.").sendPrefixedMessage(senderP);
|
||||
return;
|
||||
}
|
||||
|
||||
if (oPlayer == null) return;
|
||||
Player player = oPlayer.getPlayer();
|
||||
|
||||
if (player == null) {
|
||||
|
|
|
@ -2,7 +2,6 @@ package com.songoda.ultimatemoderation.listeners;
|
|||
|
||||
import com.songoda.ultimatemoderation.UltimateModeration;
|
||||
import com.songoda.ultimatemoderation.commands.CommandSpy;
|
||||
import com.songoda.ultimatemoderation.commands.CommandVanish;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.entity.Player;
|
||||
|
@ -12,13 +11,14 @@ import org.bukkit.event.Listener;
|
|||
import org.bukkit.event.player.PlayerToggleSneakEvent;
|
||||
import org.spigotmc.event.entity.EntityDismountEvent;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
public class SpyingDismountListener implements Listener {
|
||||
|
||||
private Map<UUID, GameMode> gamemodes = new HashMap<>();
|
||||
private static Map<UUID, GameMode> gamemodes = new HashMap<>();
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void onEntityDismountEvent(EntityDismountEvent event) {
|
||||
|
@ -28,8 +28,11 @@ public class SpyingDismountListener implements Listener {
|
|||
Player player = (Player) event.getEntity();
|
||||
gamemodes.put(player.getUniqueId(), player.getGameMode());
|
||||
player.setGameMode(GameMode.SPECTATOR);
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(UltimateModeration.getInstance(), () ->
|
||||
player.setSpectatorTarget(event.getDismounted()), 5L);
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(UltimateModeration.getInstance(), () -> {
|
||||
|
||||
if (player.getGameMode() == GameMode.SPECTATOR)
|
||||
player.setSpectatorTarget(event.getDismounted());
|
||||
}, 5L);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -37,12 +40,10 @@ public class SpyingDismountListener implements Listener {
|
|||
public void onSneak(PlayerToggleSneakEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
if (player.isSneaking() || !CommandSpy.isSpying(player) || player.getGameMode() != GameMode.SPECTATOR) return;
|
||||
CommandSpy.Spy spyingEntry = CommandSpy.getSpying().remove(player.getUniqueId());
|
||||
player.teleport(spyingEntry.getLastLocation());
|
||||
if (spyingEntry.isVanishApplied() && CommandVanish.isVanished(player))
|
||||
CommandVanish.vanish(player);
|
||||
player.setGameMode(gamemodes.get(player.getUniqueId()));
|
||||
CommandSpy.spy(null, player);
|
||||
}
|
||||
|
||||
UltimateModeration.getInstance().getLocale().getMessage("command.spy.returned").sendPrefixedMessage(player);
|
||||
public static Map<UUID, GameMode> getGamemodes() {
|
||||
return Collections.unmodifiableMap(gamemodes);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,19 +38,15 @@ public class StaffChannel {
|
|||
chatLog.stream().skip(chatLog.size() - 3).forEach(message -> player.sendMessage(Methods.formatText(message)));
|
||||
}
|
||||
messageAll(UltimateModeration.getInstance().getLocale()
|
||||
.getMessage("event.staffchat.format.join")
|
||||
.processPlaceholder("color", chatChar)
|
||||
.processPlaceholder("channel", channelName)
|
||||
.processPlaceholder("player", player.getDisplayName()).getMessage());
|
||||
.getMessage("event.staffchat.join")
|
||||
.processPlaceholder("channel", channelName).getMessage());
|
||||
}
|
||||
|
||||
public void removeMember(Player player) {
|
||||
members.remove(player.getUniqueId());
|
||||
messageAll(UltimateModeration.getInstance().getLocale()
|
||||
.getMessage("event.staffchat.format.leave")
|
||||
.processPlaceholder("color", chatChar)
|
||||
.processPlaceholder("channel", channelName)
|
||||
.processPlaceholder("player", player.getDisplayName()).getMessage());
|
||||
.getMessage("event.staffchat.leave")
|
||||
.processPlaceholder("channel", channelName).getMessage());
|
||||
}
|
||||
|
||||
public void processMessage(String message, Player player) {
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
package com.songoda.ultimatemoderation.utils;
|
||||
|
||||
import net.milkbowl.vault.permission.Permission;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.plugin.RegisteredServiceProvider;
|
||||
|
||||
public class VaultPermissions {
|
||||
|
||||
// Vault
|
||||
private static Permission vaultPermission = null;
|
||||
|
||||
static {
|
||||
if (Bukkit.getServer().getPluginManager().getPlugin("Vault") != null) {
|
||||
RegisteredServiceProvider<Permission> permissionRsp = Bukkit.getServer().getServicesManager().getRegistration(Permission.class);
|
||||
if (permissionRsp != null) vaultPermission = permissionRsp.getProvider();
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean hasPermission(String world, OfflinePlayer offlinePlayer, String perm) {
|
||||
if (vaultPermission != null) return vaultPermission.playerHas(world, offlinePlayer, perm);
|
||||
return false;
|
||||
}
|
||||
}
|
|
@ -69,6 +69,7 @@ event:
|
|||
message: '&7You have been warned'
|
||||
staffchat:
|
||||
leave: '&7You left &6%channel% &7successfully.'
|
||||
leave: '&7You joined &6%channel% &7successfully.'
|
||||
nochannels: '&cYou are not in any channels.'
|
||||
format: '&%color%[%channel%] %player%&%color%: %message%'
|
||||
slowmode:
|
||||
|
|
Loading…
Reference in New Issue