Migrate more messages
This commit is contained in:
parent
6eaab7c7ee
commit
ae60e6e642
11 changed files with 52 additions and 29 deletions
|
@ -4,7 +4,7 @@ org.gradle.jvmargs=-Xmx3G
|
|||
org.gradle.daemon=false
|
||||
|
||||
|
||||
my_version=1.0.0.0228230928
|
||||
my_version=1.0.0.0302231751
|
||||
my_modgroup=dev.zontreck.essentials
|
||||
my_modid=ariasessentials
|
||||
|
||||
|
@ -12,4 +12,4 @@ my_modid=ariasessentials
|
|||
mc_version=1.18.2
|
||||
forge_version=40.2.1
|
||||
parchment_version=2022.11.06
|
||||
libz_version=1.0.5.0228230925
|
||||
libz_version=1.0.5.0302231758
|
||||
|
|
|
@ -27,6 +27,13 @@ public class Messages {
|
|||
public static final String WARP_CREATED;
|
||||
public static final String WARP_CREATE_ERROR;
|
||||
public static final String WARP_RTP_CREATED;
|
||||
public static final String WARP_RTP_FOUND;
|
||||
public static final String WARP_DELETE_SUCCESS;
|
||||
public static final String WARP_DELETE_FAIL;
|
||||
|
||||
public static final String TELEPORT_REQUEST_NOT_FOUND;
|
||||
public static final String TELEPORT_REQUEST_DENIED;
|
||||
public static final String TELEPORT_REQUEST_CANCELLED;
|
||||
|
||||
static{
|
||||
ESSENTIALS_PREFIX = "!Gray![!Dark_Green!AE!Gray!] ";
|
||||
|
@ -34,7 +41,7 @@ public class Messages {
|
|||
WARP_ATTEMPTING = ESSENTIALS_PREFIX + "!Dark_Green!Attempting to find a safe landing location. This may take a minute";
|
||||
WARPING = ESSENTIALS_PREFIX+"!Dark_green!Warping";
|
||||
|
||||
|
||||
WARP_RTP_FOUND = ESSENTIALS_PREFIX + "!Dark_Green!A suitable location has been found";
|
||||
RTP_SEARCHING = ESSENTIALS_PREFIX + "!Dark_Purple!Searching... Attempt !Gold![0]!White!/!Dark_Red![1]";
|
||||
RTP_CANCELLED = ESSENTIALS_PREFIX + "!Dark_Red!Last position was good, but another mod asked us not to send you there. This could happen with a claims mod.";
|
||||
RTP_ABORTED = ESSENTIALS_PREFIX + "!Dark_Red!Could not find a suitable location in [0] attempts. Giving up. [1]";
|
||||
|
@ -58,5 +65,14 @@ public class Messages {
|
|||
WARP_CREATE_ERROR = ESSENTIALS_PREFIX + "!Dark_Red!Warp could not be created due to [0]";
|
||||
|
||||
WARP_RTP_CREATED = WARP_CREATED+" with RTP properties";
|
||||
|
||||
|
||||
WARP_DELETE_SUCCESS = ESSENTIALS_PREFIX + "!Dark_Green!Warp successfully deleted";
|
||||
WARP_DELETE_FAIL = ESSENTIALS_PREFIX + "!Dark_Red!Warp could not be deleted";
|
||||
|
||||
|
||||
TELEPORT_REQUEST_NOT_FOUND = ESSENTIALS_PREFIX + "!Dark_Red!The teleport request could not be found. Perhaps it already expired or was cancelled/denied already.";
|
||||
TELEPORT_REQUEST_DENIED = ESSENTIALS_PREFIX + "!Dark_Red!Teleport request was denied";
|
||||
TELEPORT_REQUEST_CANCELLED = ESSENTIALS_PREFIX + "!Dark_Red!Teleport request was cancelled";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package dev.zontreck.essentials.commands.teleport;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.UUID;
|
||||
|
||||
import com.mojang.brigadier.CommandDispatcher;
|
||||
|
@ -32,20 +33,23 @@ public class TPCancelCommand {
|
|||
UUID teleporter = UUID.fromString(TPID);
|
||||
ServerPlayer play = (ServerPlayer)source.getEntity();
|
||||
|
||||
for(TeleportContainer cont : TeleportRegistry.get()){
|
||||
Iterator<TeleportContainer> it = TeleportRegistry.get().iterator();
|
||||
while(it.hasNext())
|
||||
{
|
||||
TeleportContainer cont = it.next();
|
||||
if(cont.TeleportID.equals(teleporter)){
|
||||
// Canceling!
|
||||
Component comp = new TextComponent(Messages.ESSENTIALS_PREFIX + ChatColor.DARK_PURPLE+"Teleport request was cancelled");
|
||||
Component comp = ChatHelpers.macro(Messages.TELEPORT_REQUEST_CANCELLED);
|
||||
|
||||
ChatHelpers.broadcastTo(cont.FromPlayer, comp, source.getServer());
|
||||
ChatHelpers.broadcastTo(cont.ToPlayer, comp, source.getServer());
|
||||
|
||||
TeleportRegistry.get().remove(cont);
|
||||
it.remove();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
Component comp = new TextComponent(ChatColor.DARK_RED+"The teleport was not found, perhaps the request expired or was already cancelled");
|
||||
Component comp = ChatHelpers.macro(Messages.TELEPORT_REQUEST_NOT_FOUND);
|
||||
|
||||
ChatHelpers.broadcastTo(play.getUUID(), comp, source.getServer());
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package dev.zontreck.essentials.commands.teleport;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.UUID;
|
||||
|
||||
import com.mojang.brigadier.CommandDispatcher;
|
||||
|
@ -31,21 +32,23 @@ public class TPDenyCommand {
|
|||
private static int doCancel(CommandSourceStack source, String TPID) {
|
||||
UUID teleporter = UUID.fromString(TPID);
|
||||
ServerPlayer play = (ServerPlayer)source.getEntity();
|
||||
|
||||
for(TeleportContainer cont : TeleportRegistry.get()){
|
||||
Iterator<TeleportContainer> it = TeleportRegistry.get().iterator();
|
||||
while(it.hasNext())
|
||||
{
|
||||
TeleportContainer cont = it.next();
|
||||
if(cont.TeleportID.equals(teleporter)){
|
||||
// Canceling!
|
||||
Component comp = new TextComponent(Messages.ESSENTIALS_PREFIX + ChatColor.DARK_PURPLE+"Teleport request was denied");
|
||||
Component comp = ChatHelpers.macro(Messages.TELEPORT_REQUEST_DENIED);
|
||||
|
||||
ChatHelpers.broadcastTo(cont.FromPlayer, comp, source.getServer());
|
||||
ChatHelpers.broadcastTo(cont.ToPlayer, comp, source.getServer());
|
||||
|
||||
TeleportRegistry.get().remove(cont);
|
||||
it.remove();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
Component comp = new TextComponent(ChatColor.DARK_RED+"The teleport was not found, perhaps the request expired or was already cancelled/denied");
|
||||
Component comp = ChatHelpers.macro(Messages.TELEPORT_REQUEST_NOT_FOUND);
|
||||
|
||||
ChatHelpers.broadcastTo(play.getUUID(), comp, source.getServer());
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ public class DelWarpCommand {
|
|||
try {
|
||||
warp = WarpsProvider.WARPS_INSTANCE.getNamedWarp(string);
|
||||
} catch (NoSuchWarpException e) {
|
||||
ChatHelpers.broadcastTo(p.getUUID(), new TextComponent(Messages.ESSENTIALS_PREFIX+ChatColor.doColors(" !Dark_Red!That warp does not exist")), p.server);
|
||||
ChatHelpers.broadcastTo(p.getUUID(), ChatHelpers.macro(Messages.WARP_NOT_EXIST), p.server);
|
||||
return 0;
|
||||
}
|
||||
if(p.getUUID().equals(warp.owner) || p.hasPermissions(5))
|
||||
|
@ -42,15 +42,15 @@ public class DelWarpCommand {
|
|||
try {
|
||||
WarpsProvider.WARPS_INSTANCE.delete(WarpsProvider.WARPS_INSTANCE.getNamedWarp(string));
|
||||
} catch (NoSuchWarpException e) {
|
||||
ChatHelpers.broadcastTo(p.getUUID(), new TextComponent(Messages.ESSENTIALS_PREFIX+ChatColor.doColors(" !Dark_Red!That warp does not exist")), p.server);
|
||||
ChatHelpers.broadcastTo(p.getUUID(), ChatHelpers.macro(Messages.WARP_NOT_EXIST), p.server);
|
||||
return 0;
|
||||
}
|
||||
|
||||
ChatHelpers.broadcastTo(p.getUUID(), new TextComponent(Messages.ESSENTIALS_PREFIX+ChatColor.doColors(" !Dark_Green!Warp deleted successfully")), p.server);
|
||||
ChatHelpers.broadcastTo(p.getUUID(), ChatHelpers.macro(Messages.WARP_DELETE_SUCCESS), p.server);
|
||||
|
||||
}else {
|
||||
|
||||
ChatHelpers.broadcastTo(p.getUUID(), new TextComponent(Messages.ESSENTIALS_PREFIX+ChatColor.doColors(" !Dark_Red!Warp could not be deleted, because you do not own the warp.")), p.server);
|
||||
ChatHelpers.broadcastTo(p.getUUID(), ChatHelpers.macro(Messages.WARP_DELETE_FAIL), p.server);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -50,13 +50,13 @@ public class RTPWarpCommand {
|
|||
WarpCreatedEvent event = new WarpCreatedEvent(warp);
|
||||
if(MinecraftForge.EVENT_BUS.post(event))
|
||||
{
|
||||
ChatHelpers.broadcastTo(p.getUUID(), new TextComponent(ChatHelpers.macroize(Messages.WARP_CREATE_ERROR)), p.server);
|
||||
ChatHelpers.broadcastTo(p.getUUID(), ChatHelpers.macro(Messages.WARP_CREATE_ERROR), p.server);
|
||||
return 0;
|
||||
}
|
||||
WarpsProvider.WARPS_INSTANCE.add(warp);
|
||||
|
||||
|
||||
ChatHelpers.broadcastTo(p.getUUID(), new TextComponent(ChatHelpers.macroize(Messages.WARP_RTP_CREATED)), p.server);
|
||||
ChatHelpers.broadcastTo(p.getUUID(), ChatHelpers.macro(Messages.WARP_RTP_CREATED), p.server);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -50,12 +50,12 @@ public class SetWarpCommand {
|
|||
Warp w = new Warp(p.getUUID(), string, false, true, dest);
|
||||
WarpCreatedEvent event = new WarpCreatedEvent(w);
|
||||
if(MinecraftForge.EVENT_BUS.post(event)){
|
||||
ChatHelpers.broadcastTo(p.getUUID(), new TextComponent(ChatHelpers.macroize(Messages.WARP_CREATE_ERROR, event.denyReason)), p.server);
|
||||
ChatHelpers.broadcastTo(p.getUUID(), ChatHelpers.macro(Messages.WARP_CREATE_ERROR, event.denyReason), p.server);
|
||||
return 0;
|
||||
}
|
||||
WarpsProvider.WARPS_INSTANCE.add(w);
|
||||
|
||||
ChatHelpers.broadcastTo(p.getUUID(), new TextComponent(ChatHelpers.macroize(Messages.WARP_CREATED)), p.server);
|
||||
ChatHelpers.broadcastTo(p.getUUID(), ChatHelpers.macro(Messages.WARP_CREATED), p.server);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -64,10 +64,10 @@ public class WarpCommand {
|
|||
|
||||
if(type == 1)
|
||||
{
|
||||
ChatHelpers.broadcastTo(p.getUUID(), new TextComponent(ChatHelpers.macroize(Messages.WARP_ATTEMPTING)), p.server);
|
||||
ChatHelpers.broadcastTo(p.getUUID(), ChatHelpers.macro(Messages.WARP_ATTEMPTING), p.server);
|
||||
}else{
|
||||
|
||||
ChatHelpers.broadcastTo(p.getUUID(), new TextComponent(ChatHelpers.macroize(Messages.WARPING)), p.server);
|
||||
ChatHelpers.broadcastTo(p.getUUID(), ChatHelpers.macro(Messages.WARPING), p.server);
|
||||
}
|
||||
|
||||
Thread tx = new Thread(new Runnable(){
|
||||
|
@ -92,7 +92,7 @@ public class WarpCommand {
|
|||
tx.start();
|
||||
}catch(NoSuchWarpException e)
|
||||
{
|
||||
ChatHelpers.broadcastTo(source.getEntity().getUUID(), new TextComponent(ChatHelpers.macroize(Messages.WARP_NOT_EXIST)), source.getServer());
|
||||
ChatHelpers.broadcastTo(source.getEntity().getUUID(), ChatHelpers.macro(Messages.WARP_NOT_EXIST), source.getServer());
|
||||
} catch (CommandSyntaxException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
@ -101,7 +101,7 @@ public class WarpCommand {
|
|||
|
||||
private static int nowarp(CommandSourceStack source) {
|
||||
ServerPlayer p = (ServerPlayer)source.getEntity();
|
||||
ChatHelpers.broadcastTo(p.getUUID(), new TextComponent(ChatHelpers.macroize(Messages.WARP_NAME_REQUIRED)).withStyle(Style.EMPTY.withFont(Style.DEFAULT_FONT).withClickEvent(Clickable.command("/warps"))), source.getServer());
|
||||
ChatHelpers.broadcastTo(p.getUUID(), ChatHelpers.macro(Messages.WARP_NAME_REQUIRED).withStyle(Style.EMPTY.withFont(Style.DEFAULT_FONT).withClickEvent(Clickable.command("/warps"))), source.getServer());
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@ public class WarpsCommand {
|
|||
|
||||
Map<String, Warp> warps = WarpsProvider.WARPS_INSTANCE.get();
|
||||
|
||||
ChatHelpers.broadcastTo(p.getUUID(), new TextComponent(ChatHelpers.macroize(Messages.COUNT, String.valueOf(warps.size()), "warp")), source.getServer());
|
||||
ChatHelpers.broadcastTo(p.getUUID(), ChatHelpers.macro(Messages.COUNT, String.valueOf(warps.size()), "warp"), source.getServer());
|
||||
|
||||
Iterator<Entry<String, Warp>> it = warps.entrySet().iterator();
|
||||
while(it.hasNext())
|
||||
|
|
|
@ -50,7 +50,7 @@ public class ForgeEventsHandler {
|
|||
{
|
||||
final TeleportContainer contain = ev.container.container;
|
||||
|
||||
ChatHelpers.broadcastTo(contain.PlayerInst.getUUID(), new TextComponent(Messages.ESSENTIALS_PREFIX + ChatColor.DARK_PURPLE+" A suitable location has been found. Wormhole opening now!"), contain.PlayerInst.server);
|
||||
ChatHelpers.broadcastTo(contain.PlayerInst.getUUID(), ChatHelpers.macro(Messages.WARP_RTP_FOUND), contain.PlayerInst.server);
|
||||
TeleportActioner.ApplyTeleportEffect(contain.PlayerInst);
|
||||
TeleportActioner.PerformTeleport(contain);
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ public class RandomPositionLocator implements Runnable
|
|||
public void run() {
|
||||
if(!AriasEssentials.ALIVE)return;
|
||||
|
||||
ChatHelpers.broadcastTo(contain.container.PlayerInst.getUUID(), new TextComponent(ChatHelpers.macroize(Messages.RTP_SEARCHING, String.valueOf(contain.tries), "30")), contain.container.PlayerInst.server);
|
||||
ChatHelpers.broadcastTo(contain.container.PlayerInst.getUUID(), ChatHelpers.macro(Messages.RTP_SEARCHING, String.valueOf(contain.tries), "30"), contain.container.PlayerInst.server);
|
||||
|
||||
ServerLevel levl = contain.container.Dimension;
|
||||
ChunkAccess chunk = levl.getChunk(contain.container.world_pos.Position.asBlockPos());
|
||||
|
@ -57,7 +57,7 @@ public class RandomPositionLocator implements Runnable
|
|||
{
|
||||
contain.complete=false;
|
||||
contain.container.Position = contain.container.world_pos.Position.asMinecraftVector();
|
||||
ChatHelpers.broadcastTo(contain.container.PlayerInst.getUUID(), new TextComponent(ChatHelpers.macroize(Messages.RTP_CANCELLED)), contain.container.PlayerInst.server);
|
||||
ChatHelpers.broadcastTo(contain.container.PlayerInst.getUUID(), ChatHelpers.macro(Messages.RTP_CANCELLED), contain.container.PlayerInst.server);
|
||||
|
||||
break;
|
||||
}else {
|
||||
|
@ -79,7 +79,7 @@ public class RandomPositionLocator implements Runnable
|
|||
if(contain.tries > 30)
|
||||
{
|
||||
// Abort
|
||||
ChatHelpers.broadcastTo(contain.container.PlayerInst.getUUID(), new TextComponent(ChatHelpers.macroize(Messages.RTP_ABORTED,"30")), contain.container.PlayerInst.server);
|
||||
ChatHelpers.broadcastTo(contain.container.PlayerInst.getUUID(), ChatHelpers.macro(Messages.RTP_ABORTED,"30"), contain.container.PlayerInst.server);
|
||||
contain.aborted=true;
|
||||
return;
|
||||
}else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue