mirror of
https://github.com/songoda/UltimateModeration.git
synced 2025-02-12 09:31:24 +01:00
Update to core version 3.3.0-SNAPSHOT
This commit is contained in:
parent
dd69623031
commit
600d4299b6
2
pom.xml
2
pom.xml
@ -128,7 +128,7 @@
|
||||
<dependency>
|
||||
<groupId>com.craftaro</groupId>
|
||||
<artifactId>CraftaroCore</artifactId>
|
||||
<version>3.1.0-SNAPSHOT</version>
|
||||
<version>3.3.0-SNAPSHOT</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
|
@ -38,7 +38,7 @@ public class CommandUnMute extends AbstractCommand {
|
||||
playerPunishData.expirePunishments(PunishmentType.MUTE);
|
||||
|
||||
this.plugin.getLocale().newMessage(this.plugin.getLocale().getMessage("event.unmute.success")
|
||||
.processPlaceholder("player", player.getName()).getMessage()).sendPrefixedMessage(sender);
|
||||
.processPlaceholder("player", player.getName()).toText()).sendPrefixedMessage(sender);
|
||||
return ReturnType.SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.craftaro.ultimatemoderation.database;
|
||||
|
||||
import com.craftaro.core.chat.AdventureUtils;
|
||||
import com.craftaro.core.database.DataManager;
|
||||
import com.craftaro.core.database.DatabaseConnector;
|
||||
import com.craftaro.core.utils.TextUtils;
|
||||
@ -111,14 +112,14 @@ public class DataHelper {
|
||||
Bukkit.getScheduler().runTask(plugin, () -> offlinePlayer.getPlayer().kickPlayer(plugin.getLocale()
|
||||
.getMessage("event.ban.message")
|
||||
.processPlaceholder("reason", reason == null ? "" : reason)
|
||||
.processPlaceholder("duration", TimeUtils.makeReadable(duration)).getMessage()));
|
||||
.processPlaceholder("duration", TimeUtils.makeReadable(duration)).toText()));
|
||||
}
|
||||
break;
|
||||
case KICK:
|
||||
if (offlinePlayer.isOnline()) {
|
||||
Bukkit.getScheduler().runTask(plugin, () -> offlinePlayer.getPlayer().kickPlayer(plugin.getLocale()
|
||||
.getMessage("event.kick.message")
|
||||
.processPlaceholder("reason", reason == null ? "" : reason).getMessage()));
|
||||
.processPlaceholder("reason", reason == null ? "" : reason).toText()));
|
||||
}
|
||||
break;
|
||||
case MUTE:
|
||||
@ -217,8 +218,8 @@ public class DataHelper {
|
||||
Player victim = offlineVictim.getPlayer();
|
||||
UltimateModeration plugin = UltimateModeration.getInstance();
|
||||
|
||||
String punishSuccess = plugin.getLocale()
|
||||
.getMessage("event." + punishment.getPunishmentType().name().toLowerCase() + ".message").getPrefixedMessage();
|
||||
String punishSuccess = AdventureUtils.toLegacy(plugin.getLocale()
|
||||
.getMessage("event." + punishment.getPunishmentType().name().toLowerCase() + ".message").getPrefixedMessage());
|
||||
|
||||
if (punishment.getReason() != null) {
|
||||
punishSuccess += plugin.getLocale().getMessage("event.punish.reason")
|
||||
|
@ -99,7 +99,7 @@ public class MainGui extends Gui {
|
||||
|
||||
ItemStack item = new ItemStack(Material.PAPER);
|
||||
ItemMeta meta = item.getItemMeta();
|
||||
meta.setDisplayName(this.plugin.getLocale().getMessage("gui.players.name").getMessage());
|
||||
meta.setDisplayName(this.plugin.getLocale().getMessage("gui.players.name").toText());
|
||||
item.setItemMeta(meta);
|
||||
|
||||
gui.setInput(item);
|
||||
@ -149,33 +149,33 @@ public class MainGui extends Gui {
|
||||
PlayerPunishData playerPunishData = this.plugin.getPunishmentManager().getPlayer(pl);
|
||||
|
||||
ArrayList<String> lore = new ArrayList<>();
|
||||
lore.add(this.plugin.getLocale().getMessage("gui.players.click").getMessage());
|
||||
lore.add(this.plugin.getLocale().getMessage("gui.players.click").toText());
|
||||
lore.add("");
|
||||
|
||||
int ticketAmt = (int) this.plugin.getTicketManager().getTicketsAbout(pl).stream()
|
||||
.filter(t -> t.getStatus() == TicketStatus.OPEN).count();
|
||||
|
||||
if (ticketAmt == 0) {
|
||||
lore.add(this.plugin.getLocale().getMessage("gui.players.notickets").getMessage());
|
||||
lore.add(this.plugin.getLocale().getMessage("gui.players.notickets").toText());
|
||||
} else {
|
||||
if (ticketAmt == 1) {
|
||||
lore.add(this.plugin.getLocale().getMessage("gui.players.ticketsone").getMessage());
|
||||
lore.add(this.plugin.getLocale().getMessage("gui.players.ticketsone").toText());
|
||||
} else {
|
||||
lore.add(this.plugin.getLocale().getMessage("gui.players.tickets")
|
||||
.processPlaceholder("amount", ticketAmt).getMessage());
|
||||
.processPlaceholder("amount", ticketAmt).toText());
|
||||
}
|
||||
}
|
||||
|
||||
int warningAmt = playerPunishData.getActivePunishments(PunishmentType.WARNING).size();
|
||||
|
||||
if (warningAmt == 0) {
|
||||
lore.add(this.plugin.getLocale().getMessage("gui.players.nowarnings").getMessage());
|
||||
lore.add(this.plugin.getLocale().getMessage("gui.players.nowarnings").toText());
|
||||
} else {
|
||||
if (warningAmt == 1) {
|
||||
lore.add(this.plugin.getLocale().getMessage("gui.players.warningsone").getMessage());
|
||||
lore.add(this.plugin.getLocale().getMessage("gui.players.warningsone").toText());
|
||||
} else {
|
||||
lore.add(this.plugin.getLocale().getMessage("gui.players.warnings")
|
||||
.processPlaceholder("amount", warningAmt).getMessage());
|
||||
.processPlaceholder("amount", warningAmt).toText());
|
||||
}
|
||||
}
|
||||
|
||||
@ -203,7 +203,7 @@ public class MainGui extends Gui {
|
||||
return UltimateModeration.getPlugin(UltimateModeration.class)
|
||||
.getLocale()
|
||||
.getMessage("gui.players.online." + this.name().toLowerCase())
|
||||
.getMessage();
|
||||
.toText();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -79,7 +79,7 @@ public class NotesManagerGui extends Gui {
|
||||
this.plugin.getLocale().getMessage("gui.notes.create").getMessage()),
|
||||
(event) -> {
|
||||
ChatPrompt.showPrompt(this.plugin, event.player,
|
||||
this.plugin.getLocale().getMessage("gui.notes.type").getMessage(),
|
||||
this.plugin.getLocale().getMessage("gui.notes.type").toText(),
|
||||
(response) -> {
|
||||
PunishmentNote note = new PunishmentNote(response.getMessage(),
|
||||
event.player.getUniqueId(), this.toModerate.getUniqueId(),
|
||||
@ -125,12 +125,12 @@ public class NotesManagerGui extends Gui {
|
||||
|
||||
lore.add(this.plugin.getLocale().getMessage("gui.notes.createdby")
|
||||
.processPlaceholder("player", Bukkit.getOfflinePlayer(note.getAuthor()).getName())
|
||||
.getMessage());
|
||||
.toText());
|
||||
lore.add(this.plugin.getLocale().getMessage("gui.notes.createdon")
|
||||
.processPlaceholder("sent", format.format(new Date(note.getCreationDate())))
|
||||
.getMessage());
|
||||
.toText());
|
||||
if (this.delete) {
|
||||
lore.add(this.plugin.getLocale().getMessage("gui.notes.remove").getMessage());
|
||||
lore.add(this.plugin.getLocale().getMessage("gui.notes.remove").toText());
|
||||
}
|
||||
|
||||
setButton(num, GuiUtils.createButtonItem(XMaterial.MAP, TextUtils.formatText(name), TextUtils.formatText(lore)),
|
||||
|
@ -138,10 +138,10 @@ public class PunishGui extends Gui {
|
||||
});
|
||||
|
||||
setButton(28, GuiUtils.createButtonItem(XMaterial.ANVIL,
|
||||
this.plugin.getLocale().getMessage("gui.punish.type.punishment").getMessage(),
|
||||
this.plugin.getLocale().getMessage("gui.punish.type.punishment").toText(),
|
||||
TextUtils.formatText("&7" + this.type.getTranslation()),
|
||||
"",
|
||||
this.plugin.getLocale().getMessage("gui.punish.type.punishment.click").getMessage()),
|
||||
this.plugin.getLocale().getMessage("gui.punish.type.punishment.click").toText()),
|
||||
(event) -> {
|
||||
this.type = this.type.next();
|
||||
this.justSaved = false;
|
||||
@ -149,25 +149,25 @@ public class PunishGui extends Gui {
|
||||
});
|
||||
|
||||
ItemStack templateItem = this.toModerate != null ? GuiUtils.createButtonItem(XMaterial.MAP,
|
||||
this.plugin.getLocale().getMessage("gui.punish.type.template").getMessage(),
|
||||
this.plugin.getLocale().getMessage("gui.punish.type.template").toText(),
|
||||
this.plugin.getLocale().getMessage("gui.punish.type.template.current")
|
||||
.processPlaceholder("template",
|
||||
this.template == null
|
||||
? this.plugin.getLocale().getMessage("gui.general.none").getMessage()
|
||||
: this.template.getName()).getMessage(),
|
||||
? this.plugin.getLocale().getMessage("gui.general.none").toText()
|
||||
: this.template.getName()).toText(),
|
||||
"",
|
||||
this.plugin.getLocale().getMessage(this.plugin.getTemplateManager().getTemplates().size() == 0
|
||||
? "gui.punish.type.template.none"
|
||||
: "gui.punish.type.template.click").getMessage())
|
||||
: "gui.punish.type.template.click").toText())
|
||||
: GuiUtils.createButtonItem(XMaterial.MAP,
|
||||
this.plugin.getLocale().getMessage("gui.punish.type.name").getMessage(),
|
||||
this.plugin.getLocale().getMessage("gui.punish.type.name").toText(),
|
||||
this.plugin.getLocale().getMessage("gui.punish.type.name.current")
|
||||
.processPlaceholder("name",
|
||||
this.templateName == null
|
||||
? this.plugin.getLocale().getMessage("gui.punish.type.name.current").getMessage()
|
||||
: this.templateName).getMessage(),
|
||||
? this.plugin.getLocale().getMessage("gui.punish.type.name.current").toText()
|
||||
: this.templateName).toText(),
|
||||
"",
|
||||
this.plugin.getLocale().getMessage("gui.punish.type.name.current.click").getMessage());
|
||||
this.plugin.getLocale().getMessage("gui.punish.type.name.current.click").toText());
|
||||
|
||||
setButton(30, templateItem, (event) -> {
|
||||
if (this.toModerate == null) {
|
||||
@ -185,12 +185,12 @@ public class PunishGui extends Gui {
|
||||
|
||||
if (this.type != PunishmentType.KICK) {
|
||||
setButton(32, GuiUtils.createButtonItem(XMaterial.CLOCK,
|
||||
this.plugin.getLocale().getMessage("gui.punish.type.duration").getMessage(),
|
||||
this.plugin.getLocale().getMessage("gui.punish.type.duration.leftclick").getMessage(),
|
||||
this.plugin.getLocale().getMessage("gui.punish.type.duration.rightclick").getMessage(),
|
||||
this.plugin.getLocale().getMessage("gui.punish.type.duration").toText(),
|
||||
this.plugin.getLocale().getMessage("gui.punish.type.duration.leftclick").toText(),
|
||||
this.plugin.getLocale().getMessage("gui.punish.type.duration.rightclick").toText(),
|
||||
"",
|
||||
this.plugin.getLocale().getMessage("gui.punish.type.duration.current").getMessage(),
|
||||
TextUtils.formatText("&6" + (this.duration == -1 ? this.plugin.getLocale().getMessage("gui.general.permanent").getMessage()
|
||||
this.plugin.getLocale().getMessage("gui.punish.type.duration.current").toText(),
|
||||
TextUtils.formatText("&6" + (this.duration == -1 ? this.plugin.getLocale().getMessage("gui.general.permanent").toText()
|
||||
: TimeUtils.makeReadable(this.duration)))),
|
||||
(event) -> {
|
||||
if (this.type == PunishmentType.KICK) {
|
||||
@ -221,10 +221,10 @@ public class PunishGui extends Gui {
|
||||
}
|
||||
|
||||
setButton(34, GuiUtils.createButtonItem(XMaterial.PAPER,
|
||||
this.plugin.getLocale().getMessage("gui.punish.type.reason").getMessage(),
|
||||
this.plugin.getLocale().getMessage("gui.punish.type.reason.click").getMessage(),
|
||||
this.plugin.getLocale().getMessage("gui.punish.type.reason").toText(),
|
||||
this.plugin.getLocale().getMessage("gui.punish.type.reason.click").toText(),
|
||||
"",
|
||||
this.plugin.getLocale().getMessage("gui.punish.type.reason.current").getMessage(),
|
||||
this.plugin.getLocale().getMessage("gui.punish.type.reason.current").toText(),
|
||||
TextUtils.formatText("&6" + this.reason)), (event) -> {
|
||||
|
||||
AnvilGui gui = new AnvilGui(this.player, this);
|
||||
@ -236,7 +236,7 @@ public class PunishGui extends Gui {
|
||||
});
|
||||
|
||||
ItemStack item = GuiUtils.createButtonItem(XMaterial.PAPER,
|
||||
this.reason == null ? this.plugin.getLocale().getMessage("gui.general.reason").getMessage() : this.reason);
|
||||
this.reason == null ? this.plugin.getLocale().getMessage("gui.general.reason").toText() : this.reason);
|
||||
|
||||
gui.setInput(item);
|
||||
this.guiManager.showGUI(this.player, gui);
|
||||
@ -250,17 +250,17 @@ public class PunishGui extends Gui {
|
||||
}
|
||||
|
||||
XMaterial material = XMaterial.WHITE_WOOL;
|
||||
String name = this.plugin.getLocale().getMessage("gui.punish.template.create").getMessage();
|
||||
String name = this.plugin.getLocale().getMessage("gui.punish.template.create").toText();
|
||||
ArrayList<String> lore = new ArrayList<>();
|
||||
lore.add(this.plugin.getLocale().getMessage("gui.punish.template.create2").getMessage());
|
||||
lore.add(this.plugin.getLocale().getMessage("gui.punish.template.create2").toText());
|
||||
|
||||
if (!this.justSaved && this.template != null) {
|
||||
name = this.plugin.getLocale().getMessage("gui.punish.template.leftclick").getMessage();
|
||||
name = this.plugin.getLocale().getMessage("gui.punish.template.leftclick").toText();
|
||||
lore.clear();
|
||||
lore.add(this.plugin.getLocale().getMessage("gui.punish.template.leftclick2")
|
||||
.processPlaceholder("template", this.template.getName()).getMessage());
|
||||
.processPlaceholder("template", this.template.getName()).toText());
|
||||
lore.add("");
|
||||
lore.add(this.plugin.getLocale().getMessage("gui.punish.template.rightclick").getMessage());
|
||||
lore.add(this.plugin.getLocale().getMessage("gui.punish.template.rightclick").toText());
|
||||
}
|
||||
|
||||
if (getItem(4) != null && XMaterial.WHITE_WOOL.isSimilar(getItem(4))) {
|
||||
@ -304,7 +304,7 @@ public class PunishGui extends Gui {
|
||||
});
|
||||
|
||||
ItemStack item = GuiUtils.createButtonItem(XMaterial.PAPER,
|
||||
this.template == null ? this.plugin.getLocale().getMessage("gui.general.templatename").getMessage() : this.template.getName());
|
||||
this.template == null ? this.plugin.getLocale().getMessage("gui.general.templatename").toText() : this.template.getName());
|
||||
|
||||
gui.setInput(item);
|
||||
this.guiManager.showGUI(this.player, gui);
|
||||
|
@ -121,25 +121,25 @@ public class PunishmentsGui extends Gui {
|
||||
|
||||
ArrayList<String> lore = new ArrayList<>();
|
||||
lore.add("");
|
||||
lore.add(this.plugin.getLocale().getMessage("gui.punishments.reason").getMessage());
|
||||
lore.add(this.plugin.getLocale().getMessage("gui.punishments.reason").toText());
|
||||
lore.add("&7" + appliedPunishment.getReason());
|
||||
if (appliedPunishment.getPunishmentType() != PunishmentType.KICK) {
|
||||
lore.add("");
|
||||
lore.add(this.plugin.getLocale().getMessage("gui.punishments.duration").getMessage());
|
||||
lore.add(this.plugin.getLocale().getMessage("gui.punishments.duration").toText());
|
||||
lore.add("&7" + (appliedPunishment.getDuration() != -1
|
||||
? TimeUtils.makeReadable(appliedPunishment.getDuration())
|
||||
: this.plugin.getLocale().getMessage("gui.general.permanent").getMessage()));
|
||||
: this.plugin.getLocale().getMessage("gui.general.permanent").toText()));
|
||||
lore.add("");
|
||||
lore.add(this.plugin.getLocale().getMessage("gui.punishments.punisher").getMessage());
|
||||
lore.add(this.plugin.getLocale().getMessage("gui.punishments.punisher").toText());
|
||||
lore.add("&7" + (appliedPunishment.getPunisher() == null ? "Console" : Bukkit.getOfflinePlayer(appliedPunishment.getPunisher()).getName()));
|
||||
if (activity == Activity.ACTIVE) {
|
||||
lore.add("");
|
||||
if (appliedPunishment.getDuration() != -1) {
|
||||
lore.add(this.plugin.getLocale().getMessage("gui.punishments.remaining").getMessage());
|
||||
lore.add(this.plugin.getLocale().getMessage("gui.punishments.remaining").toText());
|
||||
lore.add("&7" + TimeUtils.makeReadable(appliedPunishment.getTimeRemaining()));
|
||||
lore.add("");
|
||||
}
|
||||
lore.add(this.plugin.getLocale().getMessage("gui.punishments.click").getMessage());
|
||||
lore.add(this.plugin.getLocale().getMessage("gui.punishments.click").toText());
|
||||
}
|
||||
}
|
||||
lore.add("");
|
||||
@ -188,7 +188,7 @@ public class PunishmentsGui extends Gui {
|
||||
return UltimateModeration.getPlugin(UltimateModeration.class)
|
||||
.getLocale()
|
||||
.getMessage("gui.punishments.activity." + this.name().toLowerCase())
|
||||
.getMessage();
|
||||
.toText();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -98,8 +98,8 @@ public class TemplateManagerGui extends Gui {
|
||||
}
|
||||
|
||||
setButton(num, GuiUtils.createButtonItem(XMaterial.MAP, TextUtils.formatText("&6&l" + template.getName()),
|
||||
this.plugin.getLocale().getMessage("gui.templatemanager.leftclick").getMessage(),
|
||||
this.plugin.getLocale().getMessage("gui.templatemanager.rightclick").getMessage()),
|
||||
this.plugin.getLocale().getMessage("gui.templatemanager.leftclick").toText(),
|
||||
this.plugin.getLocale().getMessage("gui.templatemanager.rightclick").toText()),
|
||||
(event) -> {
|
||||
if (event.clickType == ClickType.LEFT) {
|
||||
if (this.player.hasPermission("um.templates.edit"))
|
||||
|
@ -36,7 +36,7 @@ public class TemplateSelectorGui extends Gui {
|
||||
for (int i = 0; i < templates.size(); i++) {
|
||||
Template template = templates.get(i);
|
||||
setButton(18 + i, GuiUtils.createButtonItem(XMaterial.MAP, TextUtils.formatText("&6&l" + template.getName()),
|
||||
this.plugin.getLocale().getMessage("gui.templateselector.click").getMessage()),
|
||||
this.plugin.getLocale().getMessage("gui.templateselector.click").toText()),
|
||||
(event) -> {
|
||||
this.punish.setType(template.getPunishmentType());
|
||||
this.punish.setDuration(template.getDuration());
|
||||
|
@ -84,7 +84,7 @@ public class TicketGui extends Gui {
|
||||
this.ticket.setStatus(this.ticket.getStatus() == TicketStatus.OPEN ? TicketStatus.CLOSED : TicketStatus.OPEN);
|
||||
this.plugin.getDataHelper().updateTicket(this.ticket);
|
||||
// Notify staff of ticket status
|
||||
this.chatManager.getChat("ticket").messageAll(this.plugin.getLocale().getMessage("notify.ticket.status").getMessage().replace("%tid%", String.valueOf(this.ticket.getId())).replace("%type%", this.ticket.getType()).replace("%player%", Bukkit.getPlayer(this.ticket.getVictim()).getDisplayName()).replace("%status%", this.ticket.getStatus().toString()));
|
||||
this.chatManager.getChat("ticket").messageAll(this.plugin.getLocale().getMessage("notify.ticket.status").toText().replace("%tid%", String.valueOf(this.ticket.getId())).replace("%type%", this.ticket.getType()).replace("%player%", Bukkit.getPlayer(this.ticket.getVictim()).getDisplayName()).replace("%status%", this.ticket.getStatus().toString()));
|
||||
showPage();
|
||||
});
|
||||
}
|
||||
@ -104,11 +104,11 @@ public class TicketGui extends Gui {
|
||||
if (this.player.hasPermission("um.tickets.respond")) {
|
||||
setButton(5, 4, GuiUtils.createButtonItem(XMaterial.WRITABLE_BOOK, this.plugin.getLocale().getMessage("gui.ticket.respond").getMessage()),
|
||||
(event) -> {
|
||||
ChatPrompt.showPrompt(this.plugin, this.player, this.plugin.getLocale().getMessage("gui.ticket.what").getMessage(), (evnt) -> {
|
||||
ChatPrompt.showPrompt(this.plugin, this.player, this.plugin.getLocale().getMessage("gui.ticket.what").toText(), (evnt) -> {
|
||||
TicketResponse response = this.ticket.addResponse(new TicketResponse(this.player, evnt.getMessage(), System.currentTimeMillis()));
|
||||
this.plugin.getDataHelper().createTicketResponse(response);
|
||||
// Notify staff of ticket response.
|
||||
this.chatManager.getChat("ticket").messageAll(this.plugin.getLocale().getMessage("notify.ticket.response").getMessage().replace("%tid%", "" + this.ticket.getId()).replace("%type%", this.ticket.getType()).replace("%player%", Bukkit.getPlayer(this.ticket.getVictim()).getDisplayName()));
|
||||
this.chatManager.getChat("ticket").messageAll(this.plugin.getLocale().getMessage("notify.ticket.response").toText().replace("%tid%", "" + this.ticket.getId()).replace("%type%", this.ticket.getType()).replace("%player%", Bukkit.getPlayer(this.ticket.getVictim()).getDisplayName()));
|
||||
showPage();
|
||||
}).setOnClose(() -> this.guiManager.showGUI(event.player, this));
|
||||
});
|
||||
@ -148,9 +148,9 @@ public class TicketGui extends Gui {
|
||||
SimpleDateFormat format = new SimpleDateFormat("MM-dd-yyyy");
|
||||
|
||||
lore.add(this.plugin.getLocale().getMessage("gui.ticket.postedby")
|
||||
.processPlaceholder("player", Bukkit.getOfflinePlayer(ticketResponse.getAuthor()).getName()).getMessage());
|
||||
.processPlaceholder("player", Bukkit.getOfflinePlayer(ticketResponse.getAuthor()).getName()).toText());
|
||||
lore.add(this.plugin.getLocale().getMessage("gui.ticket.createdon")
|
||||
.processPlaceholder("sent", format.format(new Date(ticketResponse.getPostedDate()))).getMessage());
|
||||
.processPlaceholder("sent", format.format(new Date(ticketResponse.getPostedDate()))).toText());
|
||||
|
||||
setItem(num, GuiUtils.createButtonItem(XMaterial.MAP, TextUtils.formatText(name), lore));
|
||||
num++;
|
||||
|
@ -133,17 +133,17 @@ public class TicketManagerGui extends Gui {
|
||||
SimpleDateFormat format = new SimpleDateFormat("MM-dd-yyyy");
|
||||
|
||||
lore.add(this.plugin.getLocale().getMessage("gui.ticket.status")
|
||||
.processPlaceholder("status", ticket.getStatus().getStatus()).getMessage());
|
||||
.processPlaceholder("status", ticket.getStatus().getStatus()).toText());
|
||||
|
||||
if (this.toModerate != null) {
|
||||
lore.add(this.plugin.getLocale().getMessage("gui.tickets.player")
|
||||
.processPlaceholder("player", Bukkit.getOfflinePlayer(ticket.getVictim()).getName()).getMessage());
|
||||
.processPlaceholder("player", Bukkit.getOfflinePlayer(ticket.getVictim()).getName()).toText());
|
||||
}
|
||||
lore.add(this.plugin.getLocale().getMessage("gui.ticket.type")
|
||||
.processPlaceholder("type", ticket.getType()).getMessage());
|
||||
.processPlaceholder("type", ticket.getType()).toText());
|
||||
lore.add(this.plugin.getLocale().getMessage("gui.ticket.createdon")
|
||||
.processPlaceholder("sent", format.format(new Date(ticket.getCreationDate()))).getMessage());
|
||||
lore.add(this.plugin.getLocale().getMessage("gui.tickets.click").getMessage());
|
||||
.processPlaceholder("sent", format.format(new Date(ticket.getCreationDate()))).toText());
|
||||
lore.add(this.plugin.getLocale().getMessage("gui.tickets.click").toText());
|
||||
|
||||
setButton(num, GuiUtils.createButtonItem(XMaterial.MAP,
|
||||
TextUtils.formatText(name), TextUtils.formatText(lore)),
|
||||
|
@ -33,12 +33,12 @@ public class TicketTypeGui extends Gui {
|
||||
(event) -> {
|
||||
Ticket ticket = new Ticket(toModerate, subject, types.get(fi));
|
||||
ChatPrompt.showPrompt(plugin,
|
||||
player, plugin.getLocale().getMessage("gui.tickets.what").getMessage(),
|
||||
player, plugin.getLocale().getMessage("gui.tickets.what").toText(),
|
||||
event2 -> {
|
||||
plugin.getTicketManager().addTicket(ticket);
|
||||
|
||||
// Notify staff
|
||||
this.chatManager.getChat("ticket").messageAll(plugin.getLocale().getMessage("notify.ticket.created").getMessage().replace("%tid%", String.valueOf(ticket.getId())).replace("%type%", ticket.getType()).replace("%player%", Bukkit.getPlayer(ticket.getVictim()).getDisplayName()));
|
||||
this.chatManager.getChat("ticket").messageAll(plugin.getLocale().getMessage("notify.ticket.created").toText().replace("%tid%", String.valueOf(ticket.getId())).replace("%type%", ticket.getType()).replace("%player%", Bukkit.getPlayer(ticket.getVictim()).getDisplayName()));
|
||||
if (player == toModerate) {
|
||||
ticket.setLocation(player.getLocation());
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ public class BlockListener implements Listener {
|
||||
+ this.instance
|
||||
.getLocale()
|
||||
.getMessage("notify.block.main")
|
||||
.getMessage()
|
||||
.toText()
|
||||
.replace("%material%", material.name())
|
||||
+ "(" + block.getX() + ", " + block.getY() + ", " + block.getZ() + ")&a!");
|
||||
}
|
||||
|
@ -35,7 +35,7 @@ public class LoginListener implements Listener {
|
||||
|
||||
event.setKickMessage(this.instance.getLocale().getMessage("event.ban.message")
|
||||
.processPlaceholder("reason", appliedPunishment.getReason() == null ? "" : appliedPunishment.getReason())
|
||||
.processPlaceholder("duration", TimeUtils.makeReadable(appliedPunishment.getTimeRemaining())).getMessage());
|
||||
.processPlaceholder("duration", TimeUtils.makeReadable(appliedPunishment.getTimeRemaining())).toText());
|
||||
|
||||
event.setLoginResult(AsyncPlayerPreLoginEvent.Result.KICK_BANNED);
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.craftaro.ultimatemoderation.punish;
|
||||
|
||||
import com.craftaro.core.chat.AdventureUtils;
|
||||
import com.craftaro.core.utils.TextUtils;
|
||||
import com.craftaro.core.utils.TimeUtils;
|
||||
import com.craftaro.ultimatemoderation.UltimateModeration;
|
||||
@ -60,7 +61,7 @@ public class Punishment {
|
||||
Bukkit.getScheduler().runTask(plugin, () -> victim.getPlayer().kickPlayer(plugin.getLocale()
|
||||
.getMessage("event.ban.message")
|
||||
.processPlaceholder("reason", this.reason == null ? "" : this.reason)
|
||||
.processPlaceholder("duration", TimeUtils.makeReadable(this.duration)).getMessage()));
|
||||
.processPlaceholder("duration", TimeUtils.makeReadable(this.duration)).toText()));
|
||||
}
|
||||
break;
|
||||
case MUTE:
|
||||
@ -74,7 +75,7 @@ public class Punishment {
|
||||
if (victim.isOnline()) {
|
||||
Bukkit.getScheduler().runTask(plugin, () -> victim.getPlayer().kickPlayer(plugin.getLocale()
|
||||
.getMessage("event.kick.message")
|
||||
.processPlaceholder("reason", this.reason == null ? "" : this.reason).getMessage()));
|
||||
.processPlaceholder("reason", this.reason == null ? "" : this.reason).toText()));
|
||||
}
|
||||
break;
|
||||
case WARNING:
|
||||
@ -82,10 +83,10 @@ public class Punishment {
|
||||
break;
|
||||
}
|
||||
|
||||
String punishSuccess = plugin.getLocale()
|
||||
String punishSuccess = AdventureUtils.toLegacy(plugin.getLocale()
|
||||
.getMessage("event." + this.punishmentType.name().toLowerCase() + ".success")
|
||||
.processPlaceholder("player", victim.getName())
|
||||
.getPrefixedMessage();
|
||||
.getPrefixedMessage());
|
||||
|
||||
if (this.reason != null) {
|
||||
punishSuccess += plugin.getLocale().getMessage("event.punish.reason")
|
||||
@ -116,8 +117,8 @@ public class Punishment {
|
||||
Player victim = offlineVictim.getPlayer();
|
||||
UltimateModeration plugin = UltimateModeration.getInstance();
|
||||
|
||||
String punishSuccess = plugin.getLocale()
|
||||
.getMessage("event." + this.punishmentType.name().toLowerCase() + ".message").getPrefixedMessage();
|
||||
String punishSuccess = AdventureUtils.toLegacy(plugin.getLocale()
|
||||
.getMessage("event." + this.punishmentType.name().toLowerCase() + ".message").getPrefixedMessage());
|
||||
|
||||
if (this.reason != null) {
|
||||
punishSuccess += plugin.getLocale().getMessage("event.punish.reason")
|
||||
|
@ -23,6 +23,6 @@ public enum PunishmentType {
|
||||
return UltimateModeration.getPlugin(UltimateModeration.class)
|
||||
.getLocale()
|
||||
.getMessage("gui.punishmenttypes." + this.name().toLowerCase())
|
||||
.getMessage();
|
||||
.toText();
|
||||
}
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ public class StaffChannel {
|
||||
}
|
||||
messageAll(UltimateModeration.getInstance().getLocale()
|
||||
.getMessage("event.staffchat.alljoin")
|
||||
.processPlaceholder("player", player.getName()).getMessage(), player);
|
||||
.processPlaceholder("player", player.getName()).toText(), player);
|
||||
|
||||
UltimateModeration.getInstance()
|
||||
.getStaffChatManager()
|
||||
@ -52,7 +52,7 @@ public class StaffChannel {
|
||||
this.members.remove(player.getUniqueId());
|
||||
messageAll(UltimateModeration.getInstance().getLocale()
|
||||
.getMessage("event.staffchat.allleave")
|
||||
.processPlaceholder("player", player.getName()).getMessage(), player);
|
||||
.processPlaceholder("player", player.getName()).toText(), player);
|
||||
}
|
||||
|
||||
public void processMessage(String message, Player player) {
|
||||
@ -61,7 +61,7 @@ public class StaffChannel {
|
||||
.processPlaceholder("color", this.chatChar)
|
||||
.processPlaceholder("channel", this.channelName)
|
||||
.processPlaceholder("player", player.getDisplayName())
|
||||
.processPlaceholder("message", message).getMessage());
|
||||
.processPlaceholder("message", message).toText());
|
||||
}
|
||||
|
||||
public void messageAll(String message) {
|
||||
|
@ -56,8 +56,8 @@ public class SlowModeTask extends BukkitRunnable {
|
||||
int remaining = (int) ((slowmode / 1000) - (System.currentTimeMillis() - last.getSent()) / 1000);
|
||||
if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_9)) {
|
||||
player.spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText(remaining == 0
|
||||
? plugin.getLocale().getMessage("event.slowmode.done").getMessage()
|
||||
: plugin.getLocale().getMessage("event.slowmode.wait").processPlaceholder("delay", remaining).getMessage()));
|
||||
? plugin.getLocale().getMessage("event.slowmode.done").toText()
|
||||
: plugin.getLocale().getMessage("event.slowmode.wait").processPlaceholder("delay", remaining).toText()));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user