Update to 1.19.3, update libzontreck, and start adding cost configs
This commit is contained in:
parent
e146f66e84
commit
d709426061
26 changed files with 161 additions and 79 deletions
|
@ -31,6 +31,7 @@ minecraft {
|
|||
// Use non-default mappings at your own risk. They may not always work.
|
||||
// Simply re-run your setup task after changing the mappings to update your workspace.
|
||||
mappings channel: 'parchment', version: "${parchment_version}-${mc_version}"
|
||||
// mappings channel: 'official', version: "${mc_version}"
|
||||
|
||||
// accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg') // Currently, this location cannot be changed from the default.
|
||||
|
||||
|
|
|
@ -4,12 +4,12 @@ org.gradle.jvmargs=-Xmx3G
|
|||
org.gradle.daemon=false
|
||||
|
||||
|
||||
my_version=1.0.0.0306230211
|
||||
my_version=1.0.0.0516230728
|
||||
my_modgroup=dev.zontreck.essentials
|
||||
my_modid=ariasessentials
|
||||
|
||||
|
||||
mc_version=1.18.2
|
||||
forge_version=40.2.1
|
||||
parchment_version=2022.11.06
|
||||
libz_version=1.0.5.0306230154
|
||||
mc_version=1.19.3
|
||||
forge_version=44.1.0
|
||||
parchment_version=2023.03.12
|
||||
libz_version=1.0.7.0515232132
|
||||
|
|
|
@ -7,6 +7,9 @@ import java.util.HashMap;
|
|||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
import dev.zontreck.ariaslib.util.DelayedExecutorService;
|
||||
import dev.zontreck.essentials.configs.AEServerConfig;
|
||||
import net.minecraftforge.fml.config.ModConfig;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
import com.mojang.logging.LogUtils;
|
||||
|
@ -24,6 +27,7 @@ import net.minecraftforge.event.server.ServerStartedEvent;
|
|||
import net.minecraftforge.event.server.ServerStoppingEvent;
|
||||
import net.minecraftforge.eventbus.api.IEventBus;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.ModLoadingContext;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
|
||||
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
|
||||
|
@ -39,6 +43,11 @@ public class AriasEssentials {
|
|||
{
|
||||
IEventBus bus = FMLJavaModLoadingContext.get().getModEventBus();
|
||||
bus.addListener(this::setup);
|
||||
DelayedExecutorService.setup();
|
||||
|
||||
|
||||
ModLoadingContext.get().registerConfig(ModConfig.Type.SERVER, AEServerConfig.SPEC, "arias-essentials-server.toml");
|
||||
|
||||
|
||||
EssentialsDatastore.initialize();
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
|
|
|
@ -59,6 +59,13 @@ public class Messages {
|
|||
public static final String HOME_DELETE_SUCCESS;
|
||||
public static final String HOME_DELETE_FAIL;
|
||||
|
||||
public static final String HOME_CREATE_SUCCESS;
|
||||
public static final String HOME_CREATE_FAIL;
|
||||
|
||||
public static final String PAYMENT_ATTEMPTING;
|
||||
public static final String PAYMENT_FAILED;
|
||||
public static final String PAYMENT_SUCCESS;
|
||||
|
||||
static{
|
||||
ESSENTIALS_PREFIX = "!Gray![!Dark_Green!AE!Gray!] ";
|
||||
|
||||
|
@ -121,5 +128,12 @@ public class Messages {
|
|||
|
||||
HOME_DELETE_FAIL = ESSENTIALS_PREFIX + "!Dark_Red!Home could not be deleted due to an unknown error";
|
||||
HOME_DELETE_SUCCESS = ESSENTIALS_PREFIX + "!Dark_Green!Home was successfully deleted";
|
||||
|
||||
HOME_CREATE_SUCCESS = ESSENTIALS_PREFIX + "!Dark_Green!Home was created or updated successfully";
|
||||
HOME_CREATE_FAIL = ESSENTIALS_PREFIX + "!Dark_Red!Home could not be created or updated";
|
||||
|
||||
PAYMENT_ATTEMPTING = ESSENTIALS_PREFIX + "!Dark_Green!Please wait... Attempting to pay [0] to [1]";
|
||||
PAYMENT_FAILED = ESSENTIALS_PREFIX + "!Dark_Red!Payment failed";
|
||||
PAYMENT_SUCCESS = ESSENTIALS_PREFIX + "!Dark_Green!Payment successful";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,13 +9,19 @@ import dev.zontreck.essentials.Messages;
|
|||
import dev.zontreck.essentials.commands.teleport.TeleportActioner;
|
||||
import dev.zontreck.essentials.commands.teleport.TeleportContainer;
|
||||
import dev.zontreck.essentials.commands.teleport.TeleportDestination;
|
||||
import dev.zontreck.essentials.configs.AEServerConfig;
|
||||
import dev.zontreck.essentials.homes.Home;
|
||||
import dev.zontreck.essentials.homes.NoSuchHomeException;
|
||||
import dev.zontreck.libzontreck.currency.Bank;
|
||||
import dev.zontreck.libzontreck.currency.Transaction;
|
||||
import dev.zontreck.libzontreck.exceptions.InvalidSideException;
|
||||
import dev.zontreck.libzontreck.util.ChatHelpers;
|
||||
import net.minecraft.commands.CommandSourceStack;
|
||||
import net.minecraft.commands.Commands;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
|
||||
import java.time.Instant;
|
||||
|
||||
public class HomeCommand {
|
||||
public static void register(CommandDispatcher<CommandSourceStack> dispatcher)
|
||||
{
|
||||
|
@ -38,6 +44,18 @@ public class HomeCommand {
|
|||
ServerPlayer p = ctx.getPlayerOrException();
|
||||
Home home = AriasEssentials.player_homes.get(p.getUUID()).get(homeName);
|
||||
|
||||
//Transaction tx = new Transaction(Bank.getAccount(p.getUUID()), Bank.SYSTEM, AEServerConfig.COST_TO_TP_HOME.get(), Instant.now().getEpochSecond());
|
||||
|
||||
//ChatHelpers.broadcastTo(p.getUUID(), ChatHelpers.macro(Messages.PAYMENT_ATTEMPTING,
|
||||
// "$" + String.valueOf(AEServerConfig.COST_TO_TP_HOME.get()), "SYSTEM"), p.server);
|
||||
/*if(true)
|
||||
{
|
||||
ChatHelpers.broadcastTo(p.getUUID(), ChatHelpers.macro(Messages.PAYMENT_SUCCESS), p.server);
|
||||
}else {
|
||||
ChatHelpers.broadcastTo(p.getUUID(), ChatHelpers.macro(Messages.PAYMENT_FAILED), p.server);
|
||||
return 0;
|
||||
}*/
|
||||
|
||||
TeleportDestination dest = home.destination;
|
||||
TeleportActioner.ApplyTeleportEffect(p);
|
||||
TeleportContainer cont = new TeleportContainer(p, dest.Position.asMinecraftVector(), dest.Rotation.asMinecraftVector(), dest.getActualDimension());
|
||||
|
|
|
@ -22,7 +22,6 @@ import net.minecraft.server.level.ServerPlayer;
|
|||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.phys.Vec2;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
import net.minecraft.network.chat.TextComponent;
|
||||
|
||||
public class SetHomeCommand {
|
||||
public static void register(CommandDispatcher<CommandSourceStack> dispatcher)
|
||||
|
@ -55,10 +54,10 @@ public class SetHomeCommand {
|
|||
AriasEssentials.player_homes.get(p.getUUID()).add(newhome);
|
||||
|
||||
|
||||
ChatHelpers.broadcastTo(p.getUUID(), new TextComponent(Messages.ESSENTIALS_PREFIX + ChatColor.doColors(" !dark_green!Home was created or updated successfully!")), ctx.getServer());
|
||||
ChatHelpers.broadcastTo(p.getUUID(), ChatHelpers.macro(Messages.HOME_CREATE_SUCCESS), ctx.getServer());
|
||||
} catch (CommandSyntaxException e) {
|
||||
|
||||
ChatHelpers.broadcastTo(ctx.getEntity().getUUID(), new TextComponent(Messages.ESSENTIALS_PREFIX + ChatColor.doColors(" !dark_red!Home could not be created or updated!")), ctx.getServer());
|
||||
ChatHelpers.broadcastTo(ctx.getEntity().getUUID(), ChatHelpers.macro(Messages.HOME_CREATE_FAIL), ctx.getServer());
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
|
|
|
@ -2,6 +2,8 @@ package dev.zontreck.essentials.commands.teleport;
|
|||
|
||||
import com.mojang.brigadier.CommandDispatcher;
|
||||
|
||||
import dev.zontreck.ariaslib.terminal.Task;
|
||||
import dev.zontreck.ariaslib.util.DelayedExecutorService;
|
||||
import dev.zontreck.essentials.Messages;
|
||||
import dev.zontreck.libzontreck.chat.ChatColor;
|
||||
import dev.zontreck.libzontreck.chat.Clickable;
|
||||
|
@ -9,7 +11,6 @@ import dev.zontreck.libzontreck.chat.HoverTip;
|
|||
import dev.zontreck.libzontreck.profiles.Profile;
|
||||
import dev.zontreck.libzontreck.profiles.UserProfileNotYetExistsException;
|
||||
import dev.zontreck.libzontreck.util.ChatHelpers;
|
||||
import dev.zontreck.libzontreck.util.DelayedExecutorService;
|
||||
import net.minecraft.commands.CommandSourceStack;
|
||||
import net.minecraft.commands.Commands;
|
||||
import net.minecraft.commands.arguments.EntityArgument;
|
||||
|
@ -17,7 +18,6 @@ import net.minecraft.network.chat.ClickEvent;
|
|||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.network.chat.HoverEvent;
|
||||
import net.minecraft.network.chat.Style;
|
||||
import net.minecraft.network.chat.TextComponent;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraftforge.network.NetworkHooks;
|
||||
|
||||
|
@ -69,7 +69,7 @@ public class TPACommand {
|
|||
Style s = Style.EMPTY.withFont(Style.DEFAULT_FONT).withHoverEvent(he).withClickEvent(ce);
|
||||
|
||||
// Send the alerts
|
||||
ChatHelpers.broadcastTo(cont.FromPlayer, new TextComponent(ChatColor.BOLD + ChatColor.DARK_GREEN +"TPA Request Sent! ").append(new TextComponent(ChatColor.BOLD+ChatColor.DARK_GRAY+"["+ChatColor.DARK_RED+"X"+ChatColor.DARK_GRAY+"]").setStyle(s)), serverPlayer.server);
|
||||
ChatHelpers.broadcastTo(cont.FromPlayer, ChatHelpers.macro(ChatColor.BOLD + ChatColor.DARK_GREEN +"TPA Request Sent! ").append(ChatHelpers.macro(ChatColor.BOLD+ChatColor.DARK_GRAY+"["+ChatColor.DARK_RED+"X"+ChatColor.DARK_GRAY+"]").setStyle(s)), serverPlayer.server);
|
||||
|
||||
|
||||
ce = Clickable.command("/tpaccept "+cont.TeleportID.toString());
|
||||
|
@ -94,7 +94,7 @@ public class TPACommand {
|
|||
append(ChatHelpers.macro(Messages.TELEPORT_DENY).setStyle(s2)), serverPlayer.server);
|
||||
|
||||
TeleportRegistry.get().add(cont);
|
||||
DelayedExecutorService.getInstance().schedule(new Runnable(){
|
||||
DelayedExecutorService.getInstance().schedule(new Task("tpa_expire",true){
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
|
@ -109,7 +109,7 @@ public class TPACommand {
|
|||
}
|
||||
|
||||
private static int usage(CommandSourceStack source) {
|
||||
source.sendSuccess(new TextComponent("/tpa USAGE\n\n "+ChatColor.BOLD + ChatColor.DARK_GRAY+"/tpa "+ChatColor.DARK_RED+"target_player\n"), false);
|
||||
source.sendSuccess(ChatHelpers.macro("/tpa USAGE\n\n "+ChatColor.BOLD + ChatColor.DARK_GRAY+"/tpa "+ChatColor.DARK_RED+"target_player\n"), false);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,6 +2,8 @@ package dev.zontreck.essentials.commands.teleport;
|
|||
|
||||
import com.mojang.brigadier.CommandDispatcher;
|
||||
|
||||
import dev.zontreck.ariaslib.terminal.Task;
|
||||
import dev.zontreck.ariaslib.util.DelayedExecutorService;
|
||||
import dev.zontreck.essentials.Messages;
|
||||
import dev.zontreck.libzontreck.chat.ChatColor;
|
||||
import dev.zontreck.libzontreck.chat.Clickable;
|
||||
|
@ -9,15 +11,10 @@ import dev.zontreck.libzontreck.chat.HoverTip;
|
|||
import dev.zontreck.libzontreck.profiles.Profile;
|
||||
import dev.zontreck.libzontreck.profiles.UserProfileNotYetExistsException;
|
||||
import dev.zontreck.libzontreck.util.ChatHelpers;
|
||||
import dev.zontreck.libzontreck.util.DelayedExecutorService;
|
||||
import net.minecraft.commands.CommandSourceStack;
|
||||
import net.minecraft.commands.Commands;
|
||||
import net.minecraft.commands.arguments.EntityArgument;
|
||||
import net.minecraft.network.chat.ClickEvent;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.network.chat.HoverEvent;
|
||||
import net.minecraft.network.chat.Style;
|
||||
import net.minecraft.network.chat.TextComponent;
|
||||
import net.minecraft.network.chat.*;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
|
||||
public class TPAHereCommand {
|
||||
|
@ -63,11 +60,15 @@ public class TPAHereCommand {
|
|||
ClickEvent ce = Clickable.command("/tpcancel "+cont.TeleportID.toString());
|
||||
HoverEvent he = HoverTip.get(ChatColor.DARK_GREEN+"Cancel this teleport request");
|
||||
|
||||
Style s = Style.EMPTY.withFont(Style.DEFAULT_FONT).withHoverEvent(he).withClickEvent(ce);
|
||||
|
||||
// Send the alerts
|
||||
ChatHelpers.broadcastTo(cont.ToPlayer, new TextComponent(ChatColor.BOLD + ChatColor.DARK_GREEN +"TPA Request Sent! ").append(new TextComponent(ChatColor.BOLD+ChatColor.DARK_GRAY+"["+ChatColor.DARK_RED+"X"+ChatColor.DARK_GRAY+"]").setStyle(s)), serverPlayer.server);
|
||||
MutableComponent component = ChatHelpers.macro("!Bold!!Dark_Green!TPA Request Sent! ");
|
||||
MutableComponent cancelation = ChatHelpers.macro("!Bold!!Dark_Gray![!Dark_Red!X!Dark_Gray!]");
|
||||
cancelation.setStyle(cancelation.getStyle().withClickEvent(ce).withHoverEvent(he));
|
||||
|
||||
component.append(cancelation);
|
||||
ChatHelpers.broadcastTo(cont.ToPlayer, component, serverPlayer.server);
|
||||
|
||||
Style s;
|
||||
|
||||
ce = Clickable.command("/tpaccept "+cont.TeleportID.toString());
|
||||
he = HoverTip.get(ChatColor.DARK_GREEN + "Accept tp request");
|
||||
|
@ -90,7 +91,7 @@ public class TPAHereCommand {
|
|||
|
||||
TeleportRegistry.get().add(cont);
|
||||
|
||||
DelayedExecutorService.getInstance().schedule(new Runnable(){
|
||||
DelayedExecutorService.getInstance().schedule(new Task("tpahere_expire",true){
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
|
@ -105,7 +106,7 @@ public class TPAHereCommand {
|
|||
}
|
||||
|
||||
private static int usage(CommandSourceStack source) {
|
||||
source.sendSuccess(new TextComponent("/tpahere USAGE\n\n "+ChatColor.BOLD + ChatColor.DARK_GRAY+"/tpahere "+ChatColor.DARK_RED+"target_player\n"), false);
|
||||
source.sendSuccess(ChatHelpers.macro("/tpahere USAGE\n\n !Bold!!Dark_Gray!/tpahere !Dark_Red!target_player\n"), false);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,7 +12,6 @@ import dev.zontreck.libzontreck.util.ChatHelpers;
|
|||
import net.minecraft.commands.CommandSourceStack;
|
||||
import net.minecraft.commands.Commands;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.network.chat.TextComponent;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
|
||||
public class TPAcceptCommand {
|
||||
|
|
|
@ -12,7 +12,6 @@ import dev.zontreck.libzontreck.util.ChatHelpers;
|
|||
import net.minecraft.commands.CommandSourceStack;
|
||||
import net.minecraft.commands.Commands;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.network.chat.TextComponent;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
|
||||
public class TPCancelCommand {
|
||||
|
|
|
@ -12,7 +12,6 @@ import dev.zontreck.libzontreck.util.ChatHelpers;
|
|||
import net.minecraft.commands.CommandSourceStack;
|
||||
import net.minecraft.commands.Commands;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.network.chat.TextComponent;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
|
||||
public class TPDenyCommand {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package dev.zontreck.essentials.commands.teleport;
|
||||
|
||||
import dev.zontreck.libzontreck.util.DelayedExecutorService;
|
||||
import dev.zontreck.ariaslib.util.DelayedExecutorService;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.world.effect.MobEffectInstance;
|
||||
import net.minecraft.world.effect.MobEffects;
|
||||
|
@ -19,18 +19,22 @@ public class TeleportActioner
|
|||
player.server.execute(new Runnable(){
|
||||
public void run(){
|
||||
|
||||
MobEffectInstance inst = new MobEffectInstance(MobEffects.BLINDNESS, 250, 1, true, true);
|
||||
MobEffectInstance inst = new MobEffectInstance(MobEffects.DARKNESS, 250, 1, true, true);
|
||||
// 02/26/2023 - Adjusted to 400 due to 1.18.2, the teleport is slightly more delayed, and thus a regen is needed incase levitation runs out too soon
|
||||
MobEffectInstance regen = new MobEffectInstance(MobEffects.REGENERATION, 400, 2, true, true);
|
||||
// 05/15/2023 - Removed regen effect and replaced with feather fall.
|
||||
//MobEffectInstance regen = new MobEffectInstance(MobEffects.REGENERATION, 400, 2, true, true);
|
||||
|
||||
// 10-05-2022 - Adjusted to 100 on duration due to a small issue where it would sometimes stop levitation prior to the teleport taking effect.
|
||||
// 02/26/2023 - Adjusted to 200 on duration due to 1.18.2 causing levitation to run out too quickly before teleport
|
||||
// Small tradeoff is the player now levitates slightly longer at the destination. This is acceptable. Compensated by increasing regen strength by 1
|
||||
MobEffectInstance levitate = new MobEffectInstance(MobEffects.LEVITATION, 200, 1, true, true);
|
||||
|
||||
// 05/15/2023 - Add feather falling as a effect that lasts longer than levitate to avoid damaging the player.
|
||||
MobEffectInstance feathers = new MobEffectInstance(MobEffects.SLOW_FALLING, 400, 2, true, true);
|
||||
|
||||
|
||||
player.addEffect(inst);
|
||||
player.addEffect(regen);
|
||||
player.addEffect(feathers);
|
||||
player.addEffect(levitate); // ensure the player can't fall into lava in the short time we are not in control (if the player was silly enough to make a home above lava!!!)
|
||||
|
||||
}
|
||||
|
|
|
@ -1,12 +1,15 @@
|
|||
package dev.zontreck.essentials.commands.teleport;
|
||||
|
||||
import dev.zontreck.libzontreck.util.DelayedExecutorService;
|
||||
|
||||
public class TeleportRunnable implements Runnable
|
||||
import dev.zontreck.ariaslib.terminal.Task;
|
||||
import dev.zontreck.ariaslib.util.DelayedExecutorService;
|
||||
|
||||
public class TeleportRunnable extends Task
|
||||
{
|
||||
|
||||
public final TeleportContainer Action;
|
||||
public TeleportRunnable(TeleportContainer cont){
|
||||
super("TP",true);
|
||||
Action = cont;
|
||||
}
|
||||
|
||||
|
@ -14,7 +17,7 @@ public class TeleportRunnable implements Runnable
|
|||
public void run() {
|
||||
Action.PlayerInst.teleportTo(Action.Dimension, Action.Position.x, Action.Position.y, Action.Position.z, Action.Rotation.y, Action.Rotation.x);
|
||||
|
||||
DelayedExecutorService.getInstance().schedule(new Runnable(){
|
||||
DelayedExecutorService.getInstance().schedule(new Task("tp_action",true){
|
||||
public TeleportContainer container=Action;
|
||||
@Override
|
||||
public void run()
|
||||
|
|
|
@ -11,7 +11,6 @@ import dev.zontreck.libzontreck.chat.ChatColor;
|
|||
import dev.zontreck.libzontreck.util.ChatHelpers;
|
||||
import net.minecraft.commands.CommandSourceStack;
|
||||
import net.minecraft.commands.Commands;
|
||||
import net.minecraft.network.chat.TextComponent;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
|
||||
public class DelWarpCommand {
|
||||
|
@ -37,7 +36,7 @@ public class DelWarpCommand {
|
|||
ChatHelpers.broadcastTo(p.getUUID(), ChatHelpers.macro(Messages.WARP_NOT_EXIST), p.server);
|
||||
return 0;
|
||||
}
|
||||
if(p.getUUID().equals(warp.owner) || p.hasPermissions(5))
|
||||
if(p.getUUID().equals(warp.owner) || p.hasPermissions(4))
|
||||
{
|
||||
try {
|
||||
WarpsProvider.WARPS_INSTANCE.delete(WarpsProvider.WARPS_INSTANCE.getNamedWarp(string));
|
||||
|
|
|
@ -19,8 +19,6 @@ import dev.zontreck.libzontreck.vectors.Vector3;
|
|||
import net.minecraft.commands.CommandSourceStack;
|
||||
import net.minecraft.commands.Commands;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.network.chat.TextComponent;
|
||||
import net.minecraft.network.chat.TranslatableComponent;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.world.phys.Vec2;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
|
|
|
@ -19,8 +19,6 @@ import dev.zontreck.libzontreck.vectors.Vector3;
|
|||
import net.minecraft.commands.CommandSourceStack;
|
||||
import net.minecraft.commands.Commands;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.network.chat.TextComponent;
|
||||
import net.minecraft.network.chat.TranslatableComponent;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.world.phys.Vec2;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
|
|
|
@ -28,8 +28,10 @@ import dev.zontreck.libzontreck.vectors.Vector3;
|
|||
import net.minecraft.commands.CommandSourceStack;
|
||||
import net.minecraft.commands.Commands;
|
||||
import net.minecraft.nbt.NbtUtils;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.network.chat.ComponentUtils;
|
||||
import net.minecraft.network.chat.MutableComponent;
|
||||
import net.minecraft.network.chat.Style;
|
||||
import net.minecraft.network.chat.TextComponent;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.world.phys.Vec2;
|
||||
|
@ -101,7 +103,9 @@ public class WarpCommand {
|
|||
|
||||
private static int nowarp(CommandSourceStack source) {
|
||||
ServerPlayer p = (ServerPlayer)source.getEntity();
|
||||
ChatHelpers.broadcastTo(p.getUUID(), ChatHelpers.macro(Messages.WARP_NAME_REQUIRED).withStyle(Style.EMPTY.withFont(Style.DEFAULT_FONT).withClickEvent(Clickable.command("/warps"))), source.getServer());
|
||||
|
||||
ChatHelpers.broadcastTo(p.getUUID(), ChatHelpers.applyClickEvent(ChatHelpers.macro(Messages.WARP_NAME_REQUIRED), Clickable.command("/warps")), p.server);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -21,12 +21,9 @@ import dev.zontreck.libzontreck.profiles.UserProfileNotYetExistsException;
|
|||
import dev.zontreck.libzontreck.util.ChatHelpers;
|
||||
import net.minecraft.commands.CommandSourceStack;
|
||||
import net.minecraft.commands.Commands;
|
||||
import net.minecraft.network.chat.ClickEvent;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.network.chat.HoverEvent;
|
||||
import net.minecraft.network.chat.Style;
|
||||
import net.minecraft.network.chat.TextComponent;
|
||||
import net.minecraft.network.chat.*;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import org.spongepowered.asm.mixin.Mutable;
|
||||
|
||||
public class WarpsCommand {
|
||||
|
||||
|
@ -69,11 +66,12 @@ public class WarpsCommand {
|
|||
String appendType = (warpType == 0) ? Messages.WARP_STANDARD : Messages.WARP_RTP;
|
||||
|
||||
|
||||
HoverEvent hover = HoverTip.get(ChatHelpers.macroize(appendType));
|
||||
HoverEvent hover = HoverTip.get(ChatHelpers.macroize(appendType, warp.destination.Dimension));
|
||||
ClickEvent click = Clickable.command("/warp "+warpName);
|
||||
Style S = Style.EMPTY.withFont(Style.DEFAULT_FONT).withHoverEvent(hover).withClickEvent(click);
|
||||
|
||||
Component warpMsg = new TextComponent(ChatColor.GREEN + warpName + ChatColor.resetChat()).withStyle(S);
|
||||
MutableComponent warpMsg = ChatHelpers.macro(ChatColor.GREEN + warpName + ChatColor.resetChat());
|
||||
|
||||
warpMsg = ChatHelpers.applyHoverEvent(warpMsg, hover);
|
||||
|
||||
// Now, display the warp name, along with the warp's owner information
|
||||
HoverEvent h2 = HoverTip.get(
|
||||
|
@ -85,11 +83,13 @@ public class WarpsCommand {
|
|||
)
|
||||
|
||||
);
|
||||
S = Style.EMPTY.withFont(Style.DEFAULT_FONT).withHoverEvent(h2);
|
||||
Component ownerInfo = new TextComponent(ChatHelpers.macroize(Messages.HOVER_WARP_INFO)).withStyle(S);
|
||||
|
||||
Component ownerInfo = ChatHelpers.applyHoverEvent(ChatHelpers.macro(Messages.HOVER_WARP_INFO), h2);
|
||||
|
||||
|
||||
// Combine the two
|
||||
warpMsg = new TextComponent("").append(warpMsg).append(ownerInfo);
|
||||
warpMsg = warpMsg.copy().append(ownerInfo);
|
||||
warpMsg = ChatHelpers.applyClickEvent(warpMsg, click);
|
||||
ChatHelpers.broadcastTo(p.getUUID(), warpMsg, source.getServer());
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,46 @@
|
|||
package dev.zontreck.essentials.configs;
|
||||
|
||||
import net.minecraftforge.common.ForgeConfigSpec;
|
||||
|
||||
public class AEServerConfig {
|
||||
// TODO:
|
||||
/*
|
||||
* 1. Waystone support, Issue #1
|
||||
* 2. Economy support for server owners to charge a fee to use warps and / or homes
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
public static final ForgeConfigSpec.Builder BUILDER= new ForgeConfigSpec.Builder();
|
||||
public static final ForgeConfigSpec SPEC;
|
||||
|
||||
public static final ForgeConfigSpec.ConfigValue<Integer> COST_TO_TP_HOME;
|
||||
public static final ForgeConfigSpec.ConfigValue<Integer> COST_TO_WARP;
|
||||
public static final ForgeConfigSpec.ConfigValue<Integer> COST_TO_MAKE_HOME;
|
||||
public static final ForgeConfigSpec.ConfigValue<Integer> COST_TO_MAKE_WARP;
|
||||
|
||||
public static final ForgeConfigSpec.ConfigValue<Integer> MAX_HOMES;
|
||||
|
||||
|
||||
|
||||
static{
|
||||
|
||||
BUILDER.push("prices").comment("Costs are calculated as follows: A copper coin is 1, while a iron coin is 100. Thus a gold coin is 10000");
|
||||
COST_TO_TP_HOME = BUILDER.comment("The cost to teleport home.").define("home_tp_cost", 100);
|
||||
COST_TO_WARP = BUILDER.comment("The cost to warp.").define("warp_tp_cost", 1000);
|
||||
COST_TO_MAKE_HOME = BUILDER.comment("The cost to set a new home").define("make_home_cost", 1);
|
||||
COST_TO_MAKE_WARP = BUILDER.comment("The cost to make a new warp. (This applies to all non-creative players) (Default: 1 Emerald Coin)").define("make_warp_cost", 1000000);
|
||||
BUILDER.pop();
|
||||
BUILDER.push("permissions").comment("This section defines permissions, such as total number of homes, and who can make warps");
|
||||
|
||||
MAX_HOMES = BUILDER.comment("Maximum number of homes that are allowed per player (-1 disables the limit entirely)").define("max_homes", -1);
|
||||
|
||||
|
||||
|
||||
|
||||
BUILDER.pop();
|
||||
SPEC=BUILDER.build();
|
||||
}
|
||||
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
package dev.zontreck.essentials.configs;
|
||||
|
||||
public class EssentialsConfig {
|
||||
// TODO:
|
||||
/*
|
||||
* 1. Waystone support, Issue #1
|
||||
* 2. Economy support for server owners to charge a fee to use warps and / or homes
|
||||
*
|
||||
*
|
||||
*/
|
||||
}
|
|
@ -18,7 +18,6 @@ import dev.zontreck.libzontreck.events.ProfileLoadedEvent;
|
|||
import dev.zontreck.libzontreck.events.ProfileUnloadedEvent;
|
||||
import dev.zontreck.libzontreck.util.ChatHelpers;
|
||||
import dev.zontreck.libzontreck.vectors.WorldPosition;
|
||||
import net.minecraft.network.chat.TextComponent;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
|
||||
|
|
|
@ -15,6 +15,7 @@ import dev.zontreck.libzontreck.vectors.Vector3;
|
|||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.core.BlockPos.MutableBlockPos;
|
||||
import net.minecraft.core.Vec3i;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.world.level.BlockGetter;
|
||||
|
@ -114,7 +115,8 @@ public class RTPContainer {
|
|||
|
||||
private void spiralPositions(Vector3 position)
|
||||
{
|
||||
for(BlockPos pos : BlockPos.spiralAround(new BlockPos(position.x, container.Dimension.getSeaLevel(), position.z), 16, Direction.WEST, Direction.NORTH)){
|
||||
Vec3i posi = position.asMinecraftVec3i();
|
||||
for(BlockPos pos : BlockPos.spiralAround(new BlockPos(posi.getX(), container.Dimension.getSeaLevel(), posi.getZ()), 16, Direction.WEST, Direction.NORTH)){
|
||||
if(isSafe(pos)){
|
||||
// Set the new position
|
||||
container.world_pos.Position = new Vector3(pos);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package dev.zontreck.essentials.util;
|
||||
|
||||
import dev.zontreck.libzontreck.util.DelayedExecutorService;
|
||||
import dev.zontreck.ariaslib.util.DelayedExecutorService;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.world.phys.Vec2;
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
package dev.zontreck.essentials.util;
|
||||
|
||||
import dev.zontreck.ariaslib.terminal.Task;
|
||||
import dev.zontreck.ariaslib.util.DelayedExecutorService;
|
||||
import dev.zontreck.essentials.AriasEssentials;
|
||||
import dev.zontreck.essentials.Messages;
|
||||
import dev.zontreck.essentials.events.RTPEvent;
|
||||
import dev.zontreck.essentials.events.RTPNotCancelledEvent;
|
||||
import dev.zontreck.libzontreck.chat.ChatColor;
|
||||
import dev.zontreck.libzontreck.util.ChatHelpers;
|
||||
import dev.zontreck.libzontreck.util.DelayedExecutorService;
|
||||
import net.minecraft.network.chat.TextComponent;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.world.level.ChunkPos;
|
||||
import net.minecraft.world.level.chunk.ChunkAccess;
|
||||
|
@ -19,12 +19,13 @@ import net.minecraftforge.common.MinecraftForge;
|
|||
*
|
||||
* To utilize, initialize a RTPContainer from the RandomPositionFactory and execute from there.
|
||||
*/
|
||||
public class RandomPositionLocator implements Runnable
|
||||
public class RandomPositionLocator extends Task
|
||||
{
|
||||
private final RTPContainer contain;
|
||||
|
||||
public RandomPositionLocator(RTPContainer rtp)
|
||||
{
|
||||
super("RPL",true);
|
||||
contain=rtp;
|
||||
}
|
||||
|
||||
|
|
|
@ -89,7 +89,7 @@ public class Warp {
|
|||
*/
|
||||
protected void giveAccess(ServerPlayer player)
|
||||
{
|
||||
giveAccess(player.getName().getContents(), player.getUUID());
|
||||
giveAccess(player.getName().getString(), player.getUUID());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
# The name of the mod loader type to load - for regular FML @Mod mods it should be javafml
|
||||
modLoader="javafml" #mandatory
|
||||
# A version range to match for said mod loader - for regular FML @Mod it will be the forge version
|
||||
loaderVersion="[40,)" #mandatory This is typically bumped every Minecraft version by Forge. See our download page for lists of versions.
|
||||
loaderVersion="[44,)" #mandatory This is typically bumped every Minecraft version by Forge. See our download page for lists of versions.
|
||||
# The license for you mod. This is mandatory metadata and allows for easier comprehension of your redistributive properties.
|
||||
# Review your options at https://choosealicense.com/. All rights reserved is the default copyright stance, and is thus the default here.
|
||||
license="GPLv3"
|
||||
|
@ -43,7 +43,7 @@ This mod provides homes, warps, and teleporting of all kinds
|
|||
# Does this dependency have to exist - if not, ordering below must be specified
|
||||
mandatory=true #mandatory
|
||||
# The version range of the dependency
|
||||
versionRange="[40,)" #mandatory
|
||||
versionRange="[44,)" #mandatory
|
||||
# An ordering relationship for the dependency - BEFORE or AFTER required if the relationship is not mandatory
|
||||
ordering="NONE"
|
||||
# Side this dependency is applied on - BOTH, CLIENT or SERVER
|
||||
|
@ -53,12 +53,12 @@ This mod provides homes, warps, and teleporting of all kinds
|
|||
modId="minecraft"
|
||||
mandatory=true
|
||||
# This version range declares a minimum of the current minecraft version up to but not including the next major version
|
||||
versionRange="[1.18.2,1.19)"
|
||||
versionRange="[1.19.3,1.20)"
|
||||
ordering="NONE"
|
||||
side="BOTH"
|
||||
[[dependencies.ariasessentials]]
|
||||
modId="libzontreck"
|
||||
mandatory=true
|
||||
versionRange="[1.0.5,1.0.6)"
|
||||
versionRange="[1.0.7,1.0.8)"
|
||||
ordering="NONE"
|
||||
side="BOTH"
|
Loading…
Reference in a new issue