Add latest revisions after getting it functional
This commit is contained in:
parent
9653e273e4
commit
ffcecb8e8e
1443 changed files with 258988 additions and 6046 deletions
31
src/main/java/com/zontreck/commands/CommandRegistry.java
Normal file
31
src/main/java/com/zontreck/commands/CommandRegistry.java
Normal file
|
@ -0,0 +1,31 @@
|
|||
package com.zontreck.commands;
|
||||
|
||||
import com.zontreck.commands.homes.DelHomeCommand;
|
||||
import com.zontreck.commands.homes.HomeCommand;
|
||||
import com.zontreck.commands.homes.HomesCommand;
|
||||
import com.zontreck.commands.homes.SetHomeCommand;
|
||||
import com.zontreck.commands.items.ShareItemInChatCommand;
|
||||
import com.zontreck.commands.items.TIABDebug;
|
||||
import com.zontreck.commands.teleport.*;
|
||||
import net.minecraftforge.event.RegisterCommandsEvent;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
|
||||
@Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.FORGE)
|
||||
public class CommandRegistry
|
||||
{
|
||||
@SubscribeEvent
|
||||
public static void onCommandRegister(RegisterCommandsEvent ev) {
|
||||
TPACommand.register(ev.getDispatcher());
|
||||
TPAcceptCommand.register(ev.getDispatcher());
|
||||
TPDenyCommand.register(ev.getDispatcher());
|
||||
TPCancelCommand.register(ev.getDispatcher());
|
||||
TPAHereCommand.register(ev.getDispatcher());
|
||||
HomesCommand.register(ev.getDispatcher());
|
||||
SetHomeCommand.register(ev.getDispatcher());
|
||||
DelHomeCommand.register(ev.getDispatcher());
|
||||
HomeCommand.register(ev.getDispatcher());
|
||||
ShareItemInChatCommand.register(ev.getDispatcher());
|
||||
//TIABDebug.register(ev.getDispatcher());
|
||||
}
|
||||
}
|
|
@ -0,0 +1,65 @@
|
|||
package com.zontreck.commands.homes;
|
||||
|
||||
|
||||
import com.mojang.brigadier.CommandDispatcher;
|
||||
import com.mojang.brigadier.arguments.StringArgumentType;
|
||||
import com.zontreck.Messages;
|
||||
import com.zontreck.events.CommandExecutionEvent;
|
||||
import com.zontreck.libzontreck.profiles.Profile;
|
||||
import com.zontreck.libzontreck.util.ChatHelpers;
|
||||
import net.minecraft.commands.CommandSourceStack;
|
||||
import net.minecraft.commands.Commands;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
|
||||
public class DelHomeCommand {
|
||||
public static void register(CommandDispatcher<CommandSourceStack> dispatcher)
|
||||
{
|
||||
dispatcher.register(
|
||||
Commands.literal("rmhome")
|
||||
.executes(c->rmHome(c.getSource(), "default"))
|
||||
.then(Commands.argument("nickname", StringArgumentType.string())
|
||||
.executes(c->rmHome(c.getSource(), StringArgumentType.getString(c, "nickname")))
|
||||
|
||||
)
|
||||
);
|
||||
|
||||
//dispatcher.register(Commands.literal("sethome").then(Commands.argument("nickname", StringArgumentType.string())).executes(command -> {
|
||||
//String arg = StringArgumentType.getString(command, "nickname");
|
||||
//return setHome(command.getSource(), arg);
|
||||
//}));
|
||||
}
|
||||
|
||||
private static int rmHome(CommandSourceStack ctx, String homeName)
|
||||
{
|
||||
|
||||
var exec = new CommandExecutionEvent(ctx.getPlayer(), "rmhome");
|
||||
if(MinecraftForge.EVENT_BUS.post(exec))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
// Request homes
|
||||
// String homeName = "";
|
||||
// CommandSourceStack ctx = ctx2.getSource();
|
||||
// homeName = StringArgumentType.getString(ctx2, "nickname");
|
||||
// if(homeName==null)return 0;
|
||||
try{
|
||||
ServerPlayer p = ctx.getPlayerOrException();
|
||||
|
||||
Profile prof = Profile.factory(p);
|
||||
prof.homes.delete(homeName);
|
||||
|
||||
prof.commit();
|
||||
|
||||
|
||||
ChatHelpers.broadcastTo(p, ChatHelpers.macro(Messages.HOME_DELETE_SUCCESS), ctx.getServer());
|
||||
}catch(Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
|
||||
ChatHelpers.broadcastTo(ctx.getEntity().getUUID(), ChatHelpers.macro(Messages.HOME_DELETE_FAIL), ctx.getServer());
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
81
src/main/java/com/zontreck/commands/homes/HomeCommand.java
Normal file
81
src/main/java/com/zontreck/commands/homes/HomeCommand.java
Normal file
|
@ -0,0 +1,81 @@
|
|||
package com.zontreck.commands.homes;
|
||||
|
||||
|
||||
import com.mojang.brigadier.CommandDispatcher;
|
||||
import com.mojang.brigadier.arguments.StringArgumentType;
|
||||
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||
import com.zontreck.Messages;
|
||||
import com.zontreck.events.CommandExecutionEvent;
|
||||
import com.zontreck.exceptions.NoSuchHomeException;
|
||||
import com.zontreck.homes.Home;
|
||||
import com.zontreck.libzontreck.profiles.Profile;
|
||||
import com.zontreck.libzontreck.util.ChatHelpers;
|
||||
import com.zontreck.util.TeleportActioner;
|
||||
import com.zontreck.util.TeleportContainer;
|
||||
import com.zontreck.util.TeleportDestination;
|
||||
import net.minecraft.commands.CommandSourceStack;
|
||||
import net.minecraft.commands.Commands;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
|
||||
public class HomeCommand {
|
||||
public static void register(CommandDispatcher<CommandSourceStack> dispatcher)
|
||||
{
|
||||
dispatcher.register(Commands.literal("home").executes(c-> home(c.getSource(), "default")).then(Commands.argument("name", StringArgumentType.string()).executes(c->home(c.getSource(), StringArgumentType.getString(c, "name")))));
|
||||
|
||||
//dispatcher.register(Commands.literal("sethome").then(Commands.argument("nickname", StringArgumentType.string())).executes(command -> {
|
||||
//String arg = StringArgumentType.getString(command, "nickname");
|
||||
//return setHome(command.getSource(), arg);
|
||||
//}));
|
||||
}
|
||||
|
||||
private static int home(CommandSourceStack ctx, String homeName)
|
||||
{
|
||||
var exec = new CommandExecutionEvent(ctx.getPlayer(), "home");
|
||||
if(MinecraftForge.EVENT_BUS.post(exec))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
// Request homes
|
||||
// String homeName = "";
|
||||
// CommandSourceStack ctx = ctx2.getSource();
|
||||
// homeName = StringArgumentType.getString(ctx2, "nickname");
|
||||
// if(homeName==null)return 0;
|
||||
try{
|
||||
ServerPlayer p = ctx.getPlayerOrException();
|
||||
Profile prof = Profile.factory(p);
|
||||
Home home = prof.homes.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());
|
||||
TeleportActioner.PerformTeleport(cont,false);
|
||||
|
||||
ChatHelpers.broadcastTo(p.getUUID(), ChatHelpers.macro(Messages.TELEPORTING_HOME), ctx.getServer());
|
||||
}catch(CommandSyntaxException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
return 1;
|
||||
}catch(NoSuchHomeException e)
|
||||
{
|
||||
|
||||
ChatHelpers.broadcastTo(ctx.getEntity().getUUID(), ChatHelpers.macro(Messages.TELEPORT_HOME_FAIL), ctx.getServer());
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
106
src/main/java/com/zontreck/commands/homes/HomesCommand.java
Normal file
106
src/main/java/com/zontreck/commands/homes/HomesCommand.java
Normal file
|
@ -0,0 +1,106 @@
|
|||
package com.zontreck.commands.homes;
|
||||
|
||||
|
||||
import com.mojang.brigadier.CommandDispatcher;
|
||||
import com.mojang.brigadier.arguments.StringArgumentType;
|
||||
import com.mojang.brigadier.context.CommandContext;
|
||||
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||
import com.zontreck.Messages;
|
||||
import com.zontreck.events.CommandExecutionEvent;
|
||||
import com.zontreck.exceptions.NoSuchHomeException;
|
||||
import com.zontreck.homes.Home;
|
||||
import com.zontreck.homes.Homes;
|
||||
import com.zontreck.libzontreck.chat.ChatColor;
|
||||
import com.zontreck.libzontreck.chat.Clickable;
|
||||
import com.zontreck.libzontreck.chat.HoverTip;
|
||||
import com.zontreck.libzontreck.chestgui.ChestGUI;
|
||||
import com.zontreck.libzontreck.chestgui.ChestGUIButton;
|
||||
import com.zontreck.libzontreck.chestgui.ChestGUIIdentifier;
|
||||
import com.zontreck.libzontreck.lore.LoreEntry;
|
||||
import com.zontreck.libzontreck.profiles.Profile;
|
||||
import com.zontreck.libzontreck.profiles.UserProfileNotYetExistsException;
|
||||
import com.zontreck.libzontreck.util.ChatHelpers;
|
||||
import com.zontreck.libzontreck.vectors.Vector2i;
|
||||
import com.zontreck.util.TeleportActioner;
|
||||
import com.zontreck.util.TeleportContainer;
|
||||
import com.zontreck.util.TeleportDestination;
|
||||
import net.minecraft.commands.CommandSourceStack;
|
||||
import net.minecraft.commands.Commands;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.network.chat.Style;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.Items;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
|
||||
public class HomesCommand {
|
||||
private static final ChestGUIIdentifier HOMES_GUI_ID = new ChestGUIIdentifier("homes-gui");
|
||||
|
||||
public static void register(CommandDispatcher<CommandSourceStack> dispatcher)
|
||||
{
|
||||
dispatcher.register(Commands.literal("homes").executes(HomesCommand::getHomes));
|
||||
}
|
||||
|
||||
private static int getHomes(CommandContext<CommandSourceStack> ctx)
|
||||
{
|
||||
// Request homes
|
||||
try{
|
||||
ServerPlayer player = ctx.getSource().getPlayerOrException();
|
||||
|
||||
Profile prof = Profile.factory(player);
|
||||
Homes homes = prof.homes;
|
||||
|
||||
ChatHelpers.broadcastTo(player.getUUID(), ChatHelpers.macro(Messages.HOME_COUNT, String.valueOf(homes.count())), player.server);
|
||||
|
||||
ChestGUI gui = ChestGUI.builder().withGUIId(HOMES_GUI_ID).withTitle("Homes").withPlayer(player.getUUID());
|
||||
|
||||
int iconX = 0;
|
||||
int iconY = 0;
|
||||
|
||||
for (Home string : homes.getList()) {
|
||||
Style st = Style.EMPTY.withFont(Style.DEFAULT_FONT).withHoverEvent(HoverTip.get(ChatHelpers.macroize(Messages.HOME_HOVER_TEXT))).withClickEvent(Clickable.command("/home "+string.homeName));
|
||||
|
||||
ItemStack stack = string.homeIcon.copy();
|
||||
if(stack.is(Items.AIR))
|
||||
{
|
||||
stack = new ItemStack(Items.GRASS_BLOCK, 1);
|
||||
}
|
||||
stack.setHoverName(Component.literal(string.homeName));
|
||||
|
||||
ChestGUIButton button = new ChestGUIButton(stack, (stackx, container, lore)-> {
|
||||
|
||||
TeleportDestination dest = string.destination;
|
||||
TeleportActioner.ApplyTeleportEffect(player);
|
||||
TeleportContainer cont = new TeleportContainer(player, dest.Position.asMinecraftVector(), dest.Rotation.asMinecraftVector(), dest.getActualDimension());
|
||||
TeleportActioner.PerformTeleport(cont, false);
|
||||
gui.close();
|
||||
}, new Vector2i(iconX, iconY))
|
||||
.withInfo(new LoreEntry.Builder().text(ChatColor.doColors("!Dark_Green!Click here to go to this home")).build())
|
||||
.withInfo(new LoreEntry.Builder().text(ChatHelpers.macro("!Dark_Purple!This home is in the dimension [0]", string.destination.Dimension).getString()).bold(true).build());
|
||||
|
||||
iconY++;
|
||||
if(iconY>=9)
|
||||
{
|
||||
iconY=0;
|
||||
iconX++;
|
||||
}
|
||||
if(homes.count() > (2*9))
|
||||
ChatHelpers.broadcastTo(player.getUUID(), ChatHelpers.macro(Messages.HOME_FORMAT, string.homeName).setStyle(st), ctx.getSource().getServer());
|
||||
else
|
||||
gui.withButton(button); // Put this in the else case, to prevent a error when exceeding inventory slots
|
||||
|
||||
}
|
||||
|
||||
if(homes.count()<=27)
|
||||
gui.open();
|
||||
}catch(CommandSyntaxException ex)
|
||||
{
|
||||
ex.printStackTrace();
|
||||
|
||||
}
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,95 @@
|
|||
package com.zontreck.commands.homes;
|
||||
|
||||
|
||||
import com.mojang.brigadier.CommandDispatcher;
|
||||
import com.mojang.brigadier.arguments.StringArgumentType;
|
||||
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||
import com.zontreck.Messages;
|
||||
import com.zontreck.configs.server.AEServerConfig;
|
||||
import com.zontreck.events.CommandExecutionEvent;
|
||||
import com.zontreck.homes.Home;
|
||||
import com.zontreck.libzontreck.profiles.Profile;
|
||||
import com.zontreck.libzontreck.profiles.UserProfileNotYetExistsException;
|
||||
import com.zontreck.libzontreck.util.ChatHelpers;
|
||||
import com.zontreck.libzontreck.vectors.Vector2f;
|
||||
import com.zontreck.libzontreck.vectors.Vector3d;
|
||||
import com.zontreck.util.TeleportActioner;
|
||||
import com.zontreck.util.TeleportDestination;
|
||||
import net.minecraft.commands.CommandSourceStack;
|
||||
import net.minecraft.commands.Commands;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.phys.Vec2;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
|
||||
public class SetHomeCommand {
|
||||
public static void register(CommandDispatcher<CommandSourceStack> dispatcher)
|
||||
{
|
||||
dispatcher.register(
|
||||
Commands.literal("sethome")
|
||||
.executes(c->setHome(c.getSource(), "default"))
|
||||
.then(Commands.argument("nickname", StringArgumentType.string())
|
||||
.executes(c -> setHome(c.getSource(), StringArgumentType.getString(c, "nickname")))
|
||||
)
|
||||
|
||||
);
|
||||
|
||||
//dispatcher.register(Commands.literal("sethome").then(Commands.argument("nickname", StringArgumentType.string())).executes(command -> {
|
||||
//String arg = StringArgumentType.getString(command, "nickname");
|
||||
//return setHome(command.getSource(), arg);
|
||||
//}));
|
||||
}
|
||||
|
||||
private static int setHome(CommandSourceStack ctx, String homeName)
|
||||
{
|
||||
|
||||
var exec = new CommandExecutionEvent(ctx.getPlayer(), "sethome");
|
||||
if(MinecraftForge.EVENT_BUS.post(exec))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
// Request homes
|
||||
// String homeName = "";
|
||||
// CommandSourceStack ctx = ctx2.getSource();
|
||||
// homeName = StringArgumentType.getString(ctx2, "nickname");
|
||||
// if(homeName==null)return 0;
|
||||
|
||||
ServerPlayer p;
|
||||
try {
|
||||
p = ctx.getPlayerOrException();
|
||||
|
||||
|
||||
if(TeleportActioner.isBlacklistedDimension(p.getLevel()))
|
||||
{
|
||||
ChatHelpers.broadcastTo(p, ChatHelpers.macro(Messages.ESSENTIALS_PREFIX + AEServerConfig.getInstance().messages.BlacklistedDimensionError), p.server);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Vec3 position = p.position();
|
||||
Vec2 rot = p.getRotationVector();
|
||||
|
||||
TeleportDestination dest = new TeleportDestination(new Vector3d(position), new Vector2f(rot), p.getLevel());
|
||||
BlockState bs = p.getLevel().getBlockState(dest.Position.moveDown().asBlockPos());
|
||||
|
||||
Home newhome = new Home(p, homeName, dest, new ItemStack(p.getBlockStateOn().getBlock().asItem()));
|
||||
|
||||
Profile prof = Profile.factory(p);
|
||||
prof.homes.add(newhome);
|
||||
prof.commit();
|
||||
|
||||
|
||||
ChatHelpers.broadcastTo(p.getUUID(), ChatHelpers.macro(Messages.HOME_CREATE_SUCCESS), ctx.getServer());
|
||||
} catch (CommandSyntaxException e) {
|
||||
|
||||
ChatHelpers.broadcastTo(ctx.getEntity().getUUID(), ChatHelpers.macro(Messages.HOME_CREATE_FAIL), ctx.getServer());
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,60 @@
|
|||
package com.zontreck.commands.items;
|
||||
|
||||
|
||||
import com.mojang.brigadier.CommandDispatcher;
|
||||
import com.zontreck.Messages;
|
||||
import com.zontreck.libzontreck.chat.HoverTip;
|
||||
import com.zontreck.libzontreck.profiles.Profile;
|
||||
import com.zontreck.libzontreck.profiles.UserProfileNotYetExistsException;
|
||||
import com.zontreck.libzontreck.util.ChatHelpers;
|
||||
import net.minecraft.commands.CommandSourceStack;
|
||||
import net.minecraft.commands.Commands;
|
||||
import net.minecraft.network.chat.MutableComponent;
|
||||
import net.minecraft.network.chat.Style;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.world.InteractionHand;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.item.AirItem;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraftforge.server.ServerLifecycleHooks;
|
||||
|
||||
public class ShareItemInChatCommand {
|
||||
|
||||
public static void register(CommandDispatcher<CommandSourceStack> dispatcher)
|
||||
{
|
||||
dispatcher.register(Commands.literal("shareitem").executes(c->share_item(c.getSource())));
|
||||
|
||||
//dispatcher.register(Commands.literal("sethome").then(Commands.argument("nickname", StringArgumentType.string())).executes(command -> {
|
||||
//String arg = StringArgumentType.getString(command, "nickname");
|
||||
//return setHome(command.getSource(), arg);
|
||||
//}));
|
||||
}
|
||||
|
||||
private static int share_item(CommandSourceStack source) {
|
||||
|
||||
if(source.getEntity() instanceof Player)
|
||||
{
|
||||
ServerPlayer play = (ServerPlayer)source.getEntity();
|
||||
ItemStack is = play.getItemInHand(InteractionHand.MAIN_HAND);
|
||||
if(is.getItem() instanceof AirItem)
|
||||
{
|
||||
play.displayClientMessage(ChatHelpers.macro(Messages.ESSENTIALS_PREFIX +" !Dark_Red!You cannot share air in the chat."), false);
|
||||
return 0;
|
||||
}
|
||||
|
||||
Profile prof = Profile.factory(play);
|
||||
|
||||
|
||||
MutableComponent component = ChatHelpers.macro(Messages.ESSENTIALS_PREFIX).append(is.getDisplayName()).append(ChatHelpers.macro(" !White!-!Dark_Purple! Hover here to see the item that "+prof.name_color+prof.nickname+"!Dark_Purple! shared"));
|
||||
Style style = Style.EMPTY.withFont(Style.DEFAULT_FONT);
|
||||
component = component.withStyle(style.withHoverEvent(HoverTip.getItem(is)));
|
||||
|
||||
ChatHelpers.broadcast(component, ServerLifecycleHooks.getCurrentServer());
|
||||
|
||||
}else {
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
54
src/main/java/com/zontreck/commands/items/TIABDebug.java
Normal file
54
src/main/java/com/zontreck/commands/items/TIABDebug.java
Normal file
|
@ -0,0 +1,54 @@
|
|||
package com.zontreck.commands.items;
|
||||
|
||||
import com.mojang.brigadier.CommandDispatcher;
|
||||
import com.zontreck.configs.server.AEServerConfig;
|
||||
import com.zontreck.items.abstracts.AbstractTIAB;
|
||||
import com.zontreck.items.impl.TimeBottle;
|
||||
import net.minecraft.commands.CommandSourceStack;
|
||||
import net.minecraft.commands.Commands;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
|
||||
public class TIABDebug {
|
||||
|
||||
public static void register(CommandDispatcher<CommandSourceStack> dispatcher)
|
||||
{
|
||||
dispatcher.register(Commands.literal("tiab_set_expire").executes(c->setBottleExpired(c.getSource())));
|
||||
|
||||
dispatcher.register(Commands.literal("tiab_shift_uses").executes(c->shiftBottleUses(c.getSource())));
|
||||
|
||||
dispatcher.register(Commands.literal("tiab_reset").executes(c->resetBottle(c.getSource())));
|
||||
|
||||
//dispatcher.register(Commands.literal("sethome").then(Commands.argument("nickname", StringArgumentType.string())).executes(command -> {
|
||||
//String arg = StringArgumentType.getString(command, "nickname");
|
||||
//return setHome(command.getSource(), arg);
|
||||
//}));
|
||||
}
|
||||
private static int setBottleExpired(CommandSourceStack stack) {
|
||||
ItemStack item = stack.getPlayer().getMainHandItem();
|
||||
TimeBottle TIAB = (TimeBottle) item.getItem();
|
||||
|
||||
TIAB.setTotalAccumulatedTime(item, Integer.MAX_VALUE);
|
||||
TIAB.setExpired(item);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
private static int shiftBottleUses(CommandSourceStack stack) {
|
||||
|
||||
ItemStack item = stack.getPlayer().getMainHandItem();
|
||||
TimeBottle TIAB = (TimeBottle) item.getItem();
|
||||
|
||||
TIAB.setStoredEnergy(item, 20 * AEServerConfig.getInstance().bottles.eachUseDuration * 20);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
private static int resetBottle(CommandSourceStack stack) {
|
||||
|
||||
ItemStack item = stack.getPlayer().getMainHandItem();
|
||||
item.setTag(new CompoundTag());
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
127
src/main/java/com/zontreck/commands/teleport/TPACommand.java
Normal file
127
src/main/java/com/zontreck/commands/teleport/TPACommand.java
Normal file
|
@ -0,0 +1,127 @@
|
|||
package com.zontreck.commands.teleport;
|
||||
|
||||
import com.mojang.brigadier.CommandDispatcher;
|
||||
import com.zontreck.Messages;
|
||||
import com.zontreck.events.CommandExecutionEvent;
|
||||
import com.zontreck.libzontreck.chat.ChatColor;
|
||||
import com.zontreck.libzontreck.chat.Clickable;
|
||||
import com.zontreck.libzontreck.chat.HoverTip;
|
||||
import com.zontreck.libzontreck.profiles.Profile;
|
||||
import com.zontreck.libzontreck.profiles.UserProfileNotYetExistsException;
|
||||
import com.zontreck.libzontreck.util.ChatHelpers;
|
||||
import com.zontreck.util.TeleportContainer;
|
||||
import com.zontreck.util.TeleportRegistry;
|
||||
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.HoverEvent;
|
||||
import net.minecraft.network.chat.Style;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
|
||||
public class TPACommand
|
||||
{
|
||||
public static void register(CommandDispatcher<CommandSourceStack> dispatcher)
|
||||
{
|
||||
dispatcher.register(Commands.literal("tpa").executes(c->usage(c.getSource())).then(Commands.argument("player", EntityArgument.player()).executes(c -> tpa(c.getSource(), EntityArgument.getPlayer(c, "player")))));
|
||||
|
||||
//dispatcher.register(Commands.literal("sethome").then(Commands.argument("nickname", StringArgumentType.string())).executes(command -> {
|
||||
//String arg = StringArgumentType.getString(command, "nickname");
|
||||
//return setHome(command.getSource(), arg);
|
||||
//}));
|
||||
}
|
||||
|
||||
private static int tpa(CommandSourceStack source, ServerPlayer serverPlayer) {
|
||||
|
||||
var exec = new CommandExecutionEvent(source.getPlayer(), "tpa");
|
||||
if(MinecraftForge.EVENT_BUS.post(exec))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
// Send the request to player
|
||||
if(serverPlayer == null){
|
||||
source.sendFailure(ChatHelpers.macro(Messages.PLAYER_NOT_FOUND));
|
||||
return 1;
|
||||
}
|
||||
|
||||
ServerPlayer play = (ServerPlayer)source.getEntity();
|
||||
|
||||
|
||||
if(play.getUUID() == serverPlayer.getUUID()){
|
||||
source.sendFailure(ChatHelpers.macro(Messages.NO_TP_TO_SELF));
|
||||
return 1;
|
||||
}
|
||||
|
||||
final TeleportContainer cont = new TeleportContainer(play.getUUID(), serverPlayer.getUUID());
|
||||
|
||||
for(TeleportContainer cont2 : TeleportRegistry.get()){
|
||||
if(cont2.compareTo(cont)==0){
|
||||
ChatHelpers.broadcastTo(cont.FromPlayer, ChatHelpers.macro(Messages.NO_MORE_THAN_ONE_TPA), source.getServer());
|
||||
return 0;
|
||||
}else {
|
||||
if(cont2.FromPlayer == cont.FromPlayer){
|
||||
ChatHelpers.broadcastTo(cont.FromPlayer, ChatHelpers.macro(Messages.NO_MORE_THAN_ONE_TPA), source.getServer());
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
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.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());
|
||||
he = HoverTip.get(ChatColor.DARK_GREEN + "Accept tp request");
|
||||
ClickEvent ce2 = Clickable.command("/tpdeny "+ cont.TeleportID);
|
||||
HoverEvent he2 = HoverTip.get(ChatColor.DARK_RED+"Deny this request");
|
||||
s = Style.EMPTY.withFont(Style.DEFAULT_FONT).withClickEvent(ce).withHoverEvent(he);
|
||||
|
||||
Style s2 = Style.EMPTY.withFont(Style.DEFAULT_FONT).withClickEvent(ce2).withHoverEvent(he2);
|
||||
|
||||
|
||||
|
||||
Profile p;
|
||||
try {
|
||||
p = Profile.get_profile_of(cont.FromPlayer.toString());
|
||||
} catch (UserProfileNotYetExistsException e) {
|
||||
return 1;
|
||||
}
|
||||
serverPlayer.playSound(Messages.TPA_SOUND, 1, serverPlayer.getRandom().nextFloat());
|
||||
ChatHelpers.broadcastTo(cont.ToPlayer, ChatHelpers.macro(Messages.TPA, p.name_color+p.nickname).
|
||||
append(ChatHelpers.macro(Messages.TELEPORT_ACCEPT+" ").setStyle(s)).
|
||||
append(ChatHelpers.macro(Messages.TELEPORT_DENY).setStyle(s2)), serverPlayer.server);
|
||||
|
||||
TeleportRegistry.get().add(cont);
|
||||
Thread tx = new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
try {
|
||||
Thread.sleep(30 * 1000);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if(!(TeleportRegistry.get().contains(cont)))return;
|
||||
TeleportRegistry.get().remove(cont);
|
||||
|
||||
ChatHelpers.broadcastTo(cont.ToPlayer, ChatHelpers.macro("!Dark_Red!Teleport request has expired"), cont.Dimension.getServer());
|
||||
ChatHelpers.broadcastTo(cont.FromPlayer, ChatHelpers.macro("!Dark_Red!Teleport request has expired"), cont.Dimension.getServer());
|
||||
}
|
||||
});
|
||||
tx.start();
|
||||
return 0;
|
||||
}
|
||||
|
||||
private static int usage(CommandSourceStack source) {
|
||||
|
||||
source.sendSystemMessage(ChatHelpers.macro("/tpa USAGE\n\n "+ ChatColor.BOLD + ChatColor.DARK_GRAY+"/tpa "+ChatColor.DARK_RED+"target_player\n"));
|
||||
return 0;
|
||||
}
|
||||
}
|
127
src/main/java/com/zontreck/commands/teleport/TPAHereCommand.java
Normal file
127
src/main/java/com/zontreck/commands/teleport/TPAHereCommand.java
Normal file
|
@ -0,0 +1,127 @@
|
|||
package com.zontreck.commands.teleport;
|
||||
|
||||
import com.mojang.brigadier.CommandDispatcher;
|
||||
import com.zontreck.Messages;
|
||||
import com.zontreck.events.CommandExecutionEvent;
|
||||
import com.zontreck.libzontreck.chat.ChatColor;
|
||||
import com.zontreck.libzontreck.chat.Clickable;
|
||||
import com.zontreck.libzontreck.chat.HoverTip;
|
||||
import com.zontreck.libzontreck.profiles.Profile;
|
||||
import com.zontreck.libzontreck.profiles.UserProfileNotYetExistsException;
|
||||
import com.zontreck.libzontreck.util.ChatHelpers;
|
||||
import com.zontreck.util.TeleportContainer;
|
||||
import com.zontreck.util.TeleportRegistry;
|
||||
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.HoverEvent;
|
||||
import net.minecraft.network.chat.MutableComponent;
|
||||
import net.minecraft.network.chat.Style;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
|
||||
public class TPAHereCommand
|
||||
{
|
||||
public static void register(CommandDispatcher<CommandSourceStack> dispatcher)
|
||||
{
|
||||
dispatcher.register(Commands.literal("tpahere").executes(c->usage(c.getSource())).then(Commands.argument("player", EntityArgument.player()).executes(c -> tpa(c.getSource(), EntityArgument.getPlayer(c, "player")))));
|
||||
|
||||
//dispatcher.register(Commands.literal("sethome").then(Commands.argument("nickname", StringArgumentType.string())).executes(command -> {
|
||||
//String arg = StringArgumentType.getString(command, "nickname");
|
||||
//return setHome(command.getSource(), arg);
|
||||
//}));
|
||||
}
|
||||
|
||||
private static int tpa(CommandSourceStack source, ServerPlayer serverPlayer) {
|
||||
|
||||
var exec = new CommandExecutionEvent(source.getPlayer(), "tpahere");
|
||||
if(MinecraftForge.EVENT_BUS.post(exec))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
// Send the request to player
|
||||
|
||||
ServerPlayer play = (ServerPlayer)source.getEntity();
|
||||
if(serverPlayer == null){
|
||||
source.sendFailure(ChatHelpers.macro(Messages.PLAYER_NOT_FOUND));
|
||||
return 1;
|
||||
}
|
||||
if(play.getUUID() == serverPlayer.getUUID()){
|
||||
source.sendFailure(ChatHelpers.macro(Messages.NO_TP_TO_SELF));
|
||||
return 1;
|
||||
}
|
||||
|
||||
final TeleportContainer cont = new TeleportContainer(serverPlayer.getUUID(), play.getUUID());
|
||||
|
||||
for(TeleportContainer cont2 : TeleportRegistry.get()){
|
||||
if(cont2.compareTo(cont)==0){
|
||||
ChatHelpers.broadcastTo(cont.ToPlayer, ChatHelpers.macro(Messages.NO_MORE_THAN_ONE_TPA), source.getServer());
|
||||
return 0;
|
||||
}else {
|
||||
if(cont2.ToPlayer.equals(cont.ToPlayer)){
|
||||
ChatHelpers.broadcastTo(cont.ToPlayer, ChatHelpers.macro(Messages.NO_MORE_THAN_ONE_TPA), source.getServer());
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ClickEvent ce = Clickable.command("/tpcancel "+cont.TeleportID.toString());
|
||||
HoverEvent he = HoverTip.get(ChatColor.DARK_GREEN+"Cancel this teleport request");
|
||||
|
||||
// Send the alerts
|
||||
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");
|
||||
ClickEvent ce2 = Clickable.command("/tpdeny "+ cont.TeleportID);
|
||||
HoverEvent he2 = HoverTip.get(ChatColor.DARK_RED+"Deny this request");
|
||||
s = Style.EMPTY.withFont(Style.DEFAULT_FONT).withClickEvent(ce).withHoverEvent(he);
|
||||
|
||||
Style s2 = Style.EMPTY.withFont(Style.DEFAULT_FONT).withClickEvent(ce2).withHoverEvent(he2);
|
||||
|
||||
Profile p;
|
||||
try {
|
||||
p = Profile.get_profile_of(cont.ToPlayer.toString());
|
||||
} catch (UserProfileNotYetExistsException e) {
|
||||
return 1;
|
||||
}
|
||||
serverPlayer.playSound(Messages.TPA_SOUND, 1, serverPlayer.getRandom().nextFloat());
|
||||
ChatHelpers.broadcastTo(cont.FromPlayer, ChatHelpers.macro(Messages.TPA_HERE, p.name_color+p.nickname).
|
||||
append(ChatHelpers.macro(Messages.TELEPORT_ACCEPT+" ").setStyle(s)).
|
||||
append(ChatHelpers.macro(Messages.TELEPORT_DENY).setStyle(s2)), serverPlayer.server);
|
||||
|
||||
TeleportRegistry.get().add(cont);
|
||||
|
||||
Thread tx = new Thread(new Runnable(){
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
try {
|
||||
Thread.sleep(30 * 1000);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if(!(TeleportRegistry.get().contains(cont)))return;
|
||||
TeleportRegistry.get().remove(cont);
|
||||
|
||||
ChatHelpers.broadcastTo(cont.ToPlayer, ChatHelpers.macro("!Dark_Red!Teleport request has expired"), cont.Dimension.getServer());
|
||||
ChatHelpers.broadcastTo(cont.FromPlayer, ChatHelpers.macro("!Dark_Red!Teleport request has expired"), cont.Dimension.getServer());
|
||||
}
|
||||
});
|
||||
return 0;
|
||||
}
|
||||
|
||||
private static int usage(CommandSourceStack source) {
|
||||
source.sendSystemMessage(ChatHelpers.macro("/tpahere USAGE\n\n !Bold!!Dark_Gray!/tpahere !Dark_Red!target_player\n"));
|
||||
return 0;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,71 @@
|
|||
package com.zontreck.commands.teleport;
|
||||
|
||||
import com.mojang.brigadier.CommandDispatcher;
|
||||
import com.mojang.brigadier.arguments.StringArgumentType;
|
||||
import com.zontreck.Messages;
|
||||
import com.zontreck.events.CommandExecutionEvent;
|
||||
import com.zontreck.libzontreck.util.ChatHelpers;
|
||||
import com.zontreck.util.TeleportActioner;
|
||||
import com.zontreck.util.TeleportContainer;
|
||||
import com.zontreck.util.TeleportRegistry;
|
||||
import net.minecraft.commands.CommandSourceStack;
|
||||
import net.minecraft.commands.Commands;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.UUID;
|
||||
|
||||
public class TPAcceptCommand {
|
||||
public static void register(CommandDispatcher<CommandSourceStack> dispatcher)
|
||||
{
|
||||
dispatcher.register(Commands.literal("tpaccept").then(Commands.argument("TeleportUUID", StringArgumentType.string()).executes(c->doAccept(c.getSource(), StringArgumentType.getString(c, "TeleportUUID")))));
|
||||
}
|
||||
|
||||
private static int doAccept(CommandSourceStack source, String TPID) {
|
||||
|
||||
var exec = new CommandExecutionEvent(source.getPlayer(), "tpaccept");
|
||||
if(MinecraftForge.EVENT_BUS.post(exec))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
UUID teleporter = UUID.fromString(TPID);
|
||||
|
||||
ServerPlayer play = (ServerPlayer)source.getEntity();
|
||||
Iterator<TeleportContainer> it = TeleportRegistry.get().iterator();
|
||||
while(it.hasNext())
|
||||
{
|
||||
TeleportContainer cont = it.next();
|
||||
if(cont.TeleportID.equals(teleporter)){
|
||||
// Accepting!
|
||||
|
||||
ServerPlayer from = source.getServer().getPlayerList().getPlayer(cont.FromPlayer);
|
||||
ServerPlayer to = source.getServer().getPlayerList().getPlayer(cont.ToPlayer);
|
||||
|
||||
Component comp = ChatHelpers.macro(Messages.TELEPORT_REQUEST_ACCEPTED);
|
||||
|
||||
ChatHelpers.broadcastTo(cont.FromPlayer, comp, source.getServer());
|
||||
ChatHelpers.broadcastTo(cont.ToPlayer, comp, source.getServer());
|
||||
|
||||
it.remove();
|
||||
|
||||
|
||||
cont.PlayerInst = from;
|
||||
cont.Position = to.position();
|
||||
cont.Rotation = to.getRotationVector();
|
||||
cont.Dimension = to.getLevel();
|
||||
|
||||
TeleportActioner.ApplyTeleportEffect(from);
|
||||
TeleportActioner.PerformTeleport(cont, false);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
Component comp = ChatHelpers.macro(Messages.TELEPORT_REQUEST_NOT_FOUND);
|
||||
|
||||
ChatHelpers.broadcastTo(play.getUUID(), comp, source.getServer());
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,57 @@
|
|||
package com.zontreck.commands.teleport;
|
||||
|
||||
import com.mojang.brigadier.CommandDispatcher;
|
||||
import com.mojang.brigadier.arguments.StringArgumentType;
|
||||
import com.zontreck.Messages;
|
||||
import com.zontreck.libzontreck.util.ChatHelpers;
|
||||
import com.zontreck.util.TeleportContainer;
|
||||
import com.zontreck.util.TeleportRegistry;
|
||||
import net.minecraft.commands.CommandSourceStack;
|
||||
import net.minecraft.commands.Commands;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.UUID;
|
||||
|
||||
public class TPCancelCommand
|
||||
{
|
||||
public static void register(CommandDispatcher<CommandSourceStack> dispatcher)
|
||||
{
|
||||
dispatcher.register(Commands.literal("tpcancel").then(Commands.argument("TeleportUUID", StringArgumentType.string()).executes(c->doCancel(c.getSource(), StringArgumentType.getString(c, "TeleportUUID")))));
|
||||
|
||||
//executes(c -> doCancel(c.getSource())));
|
||||
|
||||
//dispatcher.register(Commands.literal("sethome").then(Commands.argument("nickname", StringArgumentType.string())).executes(command -> {
|
||||
//String arg = StringArgumentType.getString(command, "nickname");
|
||||
//return setHome(command.getSource(), arg);
|
||||
//}));
|
||||
}
|
||||
|
||||
private static int doCancel(CommandSourceStack source, String TPID) {
|
||||
UUID teleporter = UUID.fromString(TPID);
|
||||
ServerPlayer play = (ServerPlayer)source.getEntity();
|
||||
|
||||
Iterator<TeleportContainer> it = TeleportRegistry.get().iterator();
|
||||
while(it.hasNext())
|
||||
{
|
||||
TeleportContainer cont = it.next();
|
||||
if(cont.TeleportID.equals(teleporter)){
|
||||
// Canceling!
|
||||
Component comp = ChatHelpers.macro(Messages.TELEPORT_REQUEST_CANCELLED);
|
||||
|
||||
ChatHelpers.broadcastTo(cont.FromPlayer, comp, source.getServer());
|
||||
ChatHelpers.broadcastTo(cont.ToPlayer, comp, source.getServer());
|
||||
|
||||
it.remove();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
Component comp = ChatHelpers.macro(Messages.TELEPORT_REQUEST_NOT_FOUND);
|
||||
|
||||
ChatHelpers.broadcastTo(play.getUUID(), comp, source.getServer());
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,56 @@
|
|||
package com.zontreck.commands.teleport;
|
||||
|
||||
import com.mojang.brigadier.CommandDispatcher;
|
||||
import com.mojang.brigadier.arguments.StringArgumentType;
|
||||
import com.zontreck.Messages;
|
||||
import com.zontreck.libzontreck.util.ChatHelpers;
|
||||
import com.zontreck.util.TeleportContainer;
|
||||
import com.zontreck.util.TeleportRegistry;
|
||||
import net.minecraft.commands.CommandSourceStack;
|
||||
import net.minecraft.commands.Commands;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.UUID;
|
||||
|
||||
public class TPDenyCommand
|
||||
{
|
||||
public static void register(CommandDispatcher<CommandSourceStack> dispatcher)
|
||||
{
|
||||
dispatcher.register(Commands.literal("tpdeny").then(Commands.argument("TeleportUUID", StringArgumentType.string()).executes(c->doCancel(c.getSource(), StringArgumentType.getString(c, "TeleportUUID")))));
|
||||
|
||||
//executes(c -> doCancel(c.getSource())));
|
||||
|
||||
//dispatcher.register(Commands.literal("sethome").then(Commands.argument("nickname", StringArgumentType.string())).executes(command -> {
|
||||
//String arg = StringArgumentType.getString(command, "nickname");
|
||||
//return setHome(command.getSource(), arg);
|
||||
//}));
|
||||
}
|
||||
|
||||
private static int doCancel(CommandSourceStack source, String TPID) {
|
||||
UUID teleporter = UUID.fromString(TPID);
|
||||
ServerPlayer play = (ServerPlayer)source.getEntity();
|
||||
Iterator<TeleportContainer> it = TeleportRegistry.get().iterator();
|
||||
while(it.hasNext())
|
||||
{
|
||||
TeleportContainer cont = it.next();
|
||||
if(cont.TeleportID.equals(teleporter)){
|
||||
// Canceling!
|
||||
Component comp = ChatHelpers.macro(Messages.TELEPORT_REQUEST_DENIED);
|
||||
|
||||
ChatHelpers.broadcastTo(cont.FromPlayer, comp, source.getServer());
|
||||
ChatHelpers.broadcastTo(cont.ToPlayer, comp, source.getServer());
|
||||
|
||||
it.remove();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
Component comp = ChatHelpers.macro(Messages.TELEPORT_REQUEST_NOT_FOUND);
|
||||
|
||||
ChatHelpers.broadcastTo(play.getUUID(), comp, source.getServer());
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue