mirror of
https://github.com/songoda/UltimateModeration.git
synced 2024-11-22 18:26:10 +01:00
Added the ability to be notified when rare ores are mined.
This commit is contained in:
parent
40825c613e
commit
19f4270658
@ -119,6 +119,7 @@ public class UltimateModeration extends SongodaPlugin {
|
||||
Bukkit.getPluginManager().registerEvents(new ChatListener(this), this);
|
||||
Bukkit.getPluginManager().registerEvents(new LoginListener(this), this);
|
||||
Bukkit.getPluginManager().registerEvents(new MobTargetLister(), this);
|
||||
Bukkit.getPluginManager().registerEvents(new BlockListener(this), this);
|
||||
|
||||
if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_13))
|
||||
Bukkit.getPluginManager().registerEvents(new SpyingDismountListener(), this);
|
||||
|
@ -137,7 +137,7 @@ public class GUITicket extends AbstractGUI {
|
||||
registerClickable(5, ((player1, inventory1, cursor, slot, type) -> {
|
||||
ticket.setStatus(ticket.getStatus() == TicketStatus.OPEN ? TicketStatus.CLOSED : TicketStatus.OPEN);
|
||||
// Notify staff of ticket status
|
||||
chatManager.getChat("ticket").messageAll("&7[UM] &a[Ticket #" + ticket.getTicketId() + " - " + ticket.getType() + " - " + Bukkit.getPlayer(ticket.getVictim()).getDisplayName() + "&a] New Status: &6" + ticket.getStatus());
|
||||
chatManager.getChat("ticket").messageAll(UltimateModeration.getInstance().getLocale().getMessage("notify.ticket.status").getMessage().replace("%tid%", ""+ticket.getTicketId()).replace("%type%", ticket.getType()).replace("%player%", Bukkit.getPlayer(ticket.getVictim()).getDisplayName()).replace("%status%", ticket.getStatus().toString()));
|
||||
constructGUI();
|
||||
}));
|
||||
}
|
||||
@ -148,7 +148,7 @@ public class GUITicket extends AbstractGUI {
|
||||
AbstractChatConfirm abstractChatConfirm = new AbstractChatConfirm(player, event2 -> {
|
||||
ticket.addResponse(new TicketResponse(player, event2.getMessage(), System.currentTimeMillis()));
|
||||
// Notify staff of ticket response.
|
||||
chatManager.getChat("ticket").messageAll("&7[UM] &a[Ticket #" + ticket.getTicketId() + " - " + ticket.getType() + " - " + Bukkit.getPlayer(ticket.getVictim()).getDisplayName() + "&a] Has a new response!");
|
||||
chatManager.getChat("ticket").messageAll(UltimateModeration.getInstance().getLocale().getMessage("notify.ticket.response").getMessage().replace("%tid%", ""+ticket.getTicketId()).replace("%type%", ticket.getType()).replace("%player%", Bukkit.getPlayer(ticket.getVictim()).getDisplayName()));
|
||||
constructGUI();
|
||||
});
|
||||
|
||||
|
@ -48,7 +48,7 @@ public class GUITicketType extends AbstractGUI {
|
||||
AbstractChatConfirm abstractChatConfirm = new AbstractChatConfirm(player, event2 -> {
|
||||
plugin.getTicketManager().addTicket(ticket);
|
||||
// Notify staff
|
||||
chatManager.getChat("ticket").messageAll("&7[UM] &a[Ticket #" + ticket.getTicketId() + " - " + ticket.getType() + " - " + Bukkit.getPlayer(ticket.getVictim()).getDisplayName() + "&a] Has been created!");
|
||||
chatManager.getChat("ticket").messageAll(UltimateModeration.getInstance().getLocale().getMessage("notify.ticket.created").getMessage().replace("%tid%", ""+ticket.getTicketId()).replace("%type%", ticket.getType()).replace("%player%", Bukkit.getPlayer(ticket.getVictim()).getDisplayName()));
|
||||
if (player == toModerate)
|
||||
ticket.setLocation(player.getLocation());
|
||||
ticket.addResponse(new TicketResponse(player, event2.getMessage(), System.currentTimeMillis()));
|
||||
|
@ -0,0 +1,42 @@
|
||||
package com.songoda.ultimatemoderation.listeners;
|
||||
|
||||
import com.songoda.ultimatemoderation.UltimateModeration;
|
||||
import com.songoda.ultimatemoderation.staffchat.StaffChatManager;
|
||||
import java.util.List;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.block.BlockBreakEvent;
|
||||
|
||||
public class BlockListener implements Listener {
|
||||
|
||||
private UltimateModeration instance;
|
||||
private StaffChatManager chat = UltimateModeration.getInstance().getStaffChatManager();
|
||||
|
||||
public BlockListener(UltimateModeration ultimateModeration) {
|
||||
this.instance = ultimateModeration;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onBlockBreak(BlockBreakEvent event) {
|
||||
|
||||
Player player = event.getPlayer();
|
||||
Block block = event.getBlock();
|
||||
Material material = block.getType();
|
||||
|
||||
List<String> blocks = instance.getConfig().getStringList("Main.Notify Blocks List");
|
||||
|
||||
for(String broken : blocks) {
|
||||
if(broken.equalsIgnoreCase(material.name())) {
|
||||
if(player.hasPermission("um.staffchat.join") && instance.getConfig().getBoolean("Main.Notify Blocks")) {
|
||||
chat.getChat("notify").messageAll("&7[UM] &a" + Bukkit.getPlayer(player.getUniqueId()).getDisplayName()
|
||||
+ UltimateModeration.getInstance().getLocale().getMessage("notify.block.main").getMessage().replace("%material%", material.name()) + "(" + block.getX() + ", " + block.getY() + ", " + block.getZ() + ")&a!");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -53,6 +53,11 @@ public class Settings {
|
||||
public static final ConfigSetting LANGUGE_MODE = new ConfigSetting(config, "System.Language Mode", "en_US",
|
||||
"The enabled language file.",
|
||||
"More language files (if available) can be found in the plugins data folder.");
|
||||
|
||||
public static final ConfigSetting NOTIFY_BLOCK = new ConfigSetting(config, "Main.Notify Blocks", true, "Notify Staff on Block Break");
|
||||
|
||||
public static final ConfigSetting NOTIFY_BLOCK_LIST = new ConfigSetting(config, "Main.Notify Blocks List", Arrays.asList("DIAMOND_ORE", "EMERALD_ORE"),
|
||||
"Blocks that will give a notification when mined.");
|
||||
|
||||
public static void setupConfig() {
|
||||
config.load();
|
||||
|
@ -174,4 +174,9 @@ gui.ticket.createdon = "&7Created on &6%sent%&7."
|
||||
gui.ticket.respond = "&6Respond"
|
||||
gui.ticket.status = "&7Status &6%status%&7."
|
||||
gui.ticket.postedby = "&7Posted by &6%player%&7."
|
||||
gui.ticket.what = "&6What would you like to say?"
|
||||
gui.ticket.what = "&6What would you like to say?"
|
||||
|
||||
notify.block.main = "&a Has mined [&6%material%&a] at &6"
|
||||
notify.ticket.created = "&7[UM] &a[Ticket #%tid% - %type% - %player%&a] Has been created!"
|
||||
notify.ticket.status = "&7[UM] &a[Ticket #%tid% - %type% - %player%&a] New Status: &6%status%"
|
||||
notify.ticket.response = "&7[UM] &a[Ticket #%tid% - %type% - %player%&a] Has a new response!"
|
Loading…
Reference in New Issue
Block a user