Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
org.gradle.jvmargs=-Xmx2G

# BTA
bta_version=7.3
bta_version=7.3_01
bta_channel=release

# Loader & Mod Menu
loader_version=0.15.6-bta.7

# ServerLibe
serverlibe_version=beta.2.7-7.3
serverlibe_version=beta.2.7-7.3_01

# Mod
mod_version=1.0.0-7.3
mod_version=1.0.1-7.3_01
mod_group=MelonModding
mod_name=MelonUtilities
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import java.io.IOException;
import java.nio.file.Files;
import java.text.SimpleDateFormat;
import java.time.ZoneId;
import java.util.HashMap;
import java.util.Map;

Expand Down Expand Up @@ -56,7 +57,7 @@ public static int rollback(PlayerServer sender) {
{
ItemStack snapshotIcon = Items.PAPER.getDefaultStack();
SimpleDateFormat sdf = new SimpleDateFormat("MMM/dd/yyyy HH:mm:ss");
snapshotIcon.setCustomName("Snapshot: [" + sdf.format(capture.getKey()) + "]");
snapshotIcon.setCustomName("Snapshot: [" + sdf.format(capture.getKey()) + "]" + " (" + ZoneId.systemDefault() + ")");
snapshotIcon.setCustomColor((byte) TextFormatting.LIGHT_BLUE.id);
return new ServerSlotButton(snapshotIcon, inventory, finalI, () -> {
for(Entity entity : sender.world.loadedEntityList){
Expand All @@ -82,7 +83,7 @@ public static int rollback(PlayerServer sender) {
{
ItemStack backupIcon = Items.BOOK.getDefaultStack();
SimpleDateFormat sdf = new SimpleDateFormat("MMM/dd/yyyy HH:mm:ss");
backupIcon.setCustomName("Backup: [" + sdf.format(capture.getKey()) + "]");
backupIcon.setCustomName("Backup: [" + sdf.format(capture.getKey()) + "]" + " (" + ZoneId.systemDefault() + ")");
backupIcon.setCustomColor((byte) TextFormatting.CYAN.id);
return new ServerSlotButton(backupIcon, inventory, finalI, () -> {
for(Entity entity : sender.world.loadedEntityList){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,19 @@
import MelonUtilities.utility.feedback.FeedbackType;
import MelonUtilities.utility.managers.TpaManager;
import com.mojang.brigadier.Command;
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.entity.player.PlayerServer;
import net.minecraft.server.world.WorldServer;

public class CommandLogicTPA {
public static int tpa(PlayerServer sender, String targetUsername) {

assert sender.world != null;
PlayerServer target = (PlayerServer) sender.world.getPlayerEntityByName(targetUsername);
PlayerServer target = null;
for(WorldServer dimension : MinecraftServer.getInstance().dimensionWorlds.values()){
if(dimension.getPlayerEntityByName(targetUsername) != null){
target = (PlayerServer) dimension.getPlayerEntityByName(targetUsername);
}
}

if (target != null) {
TpaManager.addRequest(sender, target, false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,19 @@
import MelonUtilities.utility.feedback.FeedbackType;
import MelonUtilities.utility.managers.TpaManager;
import com.mojang.brigadier.Command;
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.entity.player.PlayerServer;
import net.minecraft.server.world.WorldServer;

public class CommandLogicTPAHere {
public static int tpaHere(PlayerServer sender, String targetUsername){

assert sender.world != null;
PlayerServer target = (PlayerServer) sender.world.getPlayerEntityByName(targetUsername);
PlayerServer target = null;
for(WorldServer dimension : MinecraftServer.getInstance().dimensionWorlds.values()){
if(dimension.getPlayerEntityByName(targetUsername) != null){
target = (PlayerServer) dimension.getPlayerEntityByName(targetUsername);
}
}

if(target != null){
TpaManager.addRequest(sender, target, true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@

import MelonUtilities.command.commandlogic.CommandLogicElevator;
import com.mojang.brigadier.CommandDispatcher;
import com.mojang.brigadier.arguments.IntegerArgumentType;
import com.mojang.brigadier.arguments.ArgumentTypeInteger;
import com.mojang.brigadier.builder.ArgumentBuilder;
import com.mojang.brigadier.builder.LiteralArgumentBuilder;
import com.mojang.brigadier.builder.RequiredArgumentBuilder;
import com.mojang.brigadier.builder.ArgumentBuilderLiteral;
import com.mojang.brigadier.builder.ArgumentBuilderRequired;
import net.minecraft.core.net.command.CommandManager;
import net.minecraft.core.net.command.CommandSource;
import net.minecraft.server.entity.player.PlayerServer;

public class CommandElevator implements CommandManager.CommandRegistry{

public static ArgumentBuilder<CommandSource, LiteralArgumentBuilder<CommandSource>> elevatorAllowObstructions(ArgumentBuilder<CommandSource, LiteralArgumentBuilder<CommandSource>> builder) {
builder.then(LiteralArgumentBuilder.<CommandSource>literal("allowobstructions")
public static ArgumentBuilder<CommandSource, ArgumentBuilderLiteral<CommandSource>> elevatorAllowObstructions(ArgumentBuilder<CommandSource, ArgumentBuilderLiteral<CommandSource>> builder) {
builder.then(ArgumentBuilderLiteral.<CommandSource>literal("allowobstructions")
.executes(context ->
{
PlayerServer sender = (PlayerServer) context.getSource().getSender(); if(sender == null){return 0;}
Expand All @@ -24,9 +24,9 @@ public static ArgumentBuilder<CommandSource, LiteralArgumentBuilder<CommandSourc
return builder;
}

public static ArgumentBuilder<CommandSource, LiteralArgumentBuilder<CommandSource>> elevatorCooldown(ArgumentBuilder<CommandSource, LiteralArgumentBuilder<CommandSource>> builder) {
builder.then(LiteralArgumentBuilder.<CommandSource>literal("cooldown")
.then(RequiredArgumentBuilder.<CommandSource, Integer>argument("cooldownvalue", IntegerArgumentType.integer(0, 256))
public static ArgumentBuilder<CommandSource, ArgumentBuilderLiteral<CommandSource>> elevatorCooldown(ArgumentBuilder<CommandSource, ArgumentBuilderLiteral<CommandSource>> builder) {
builder.then(ArgumentBuilderLiteral.<CommandSource>literal("cooldown")
.then(ArgumentBuilderRequired.<CommandSource, Integer>argument("cooldownvalue", ArgumentTypeInteger.integer(0, 256))
.executes(context ->
{
PlayerServer sender = (PlayerServer) context.getSource().getSender(); if(sender == null){return 0;}
Expand All @@ -41,7 +41,7 @@ public static ArgumentBuilder<CommandSource, LiteralArgumentBuilder<CommandSourc

@Override
public void register(CommandDispatcher<CommandSource> dispatcher) {
LiteralArgumentBuilder<CommandSource> builder = LiteralArgumentBuilder.<CommandSource>literal("elevator").requires(CommandSource::hasAdmin);
ArgumentBuilderLiteral<CommandSource> builder = ArgumentBuilderLiteral.<CommandSource>literal("elevator").requires(CommandSource::hasAdmin);

elevatorAllowObstructions(builder);
elevatorCooldown(builder);
Expand Down
38 changes: 19 additions & 19 deletions src/main/java/MelonUtilities/command/commands/CommandHome.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@
import MelonUtilities.config.Data;
import MelonUtilities.config.datatypes.data.Home;
import com.mojang.brigadier.CommandDispatcher;
import com.mojang.brigadier.arguments.StringArgumentType;
import com.mojang.brigadier.arguments.ArgumentTypeString;
import com.mojang.brigadier.builder.ArgumentBuilder;
import com.mojang.brigadier.builder.LiteralArgumentBuilder;
import com.mojang.brigadier.builder.RequiredArgumentBuilder;
import com.mojang.brigadier.builder.ArgumentBuilderLiteral;
import com.mojang.brigadier.builder.ArgumentBuilderRequired;
import net.minecraft.core.net.command.CommandManager;
import net.minecraft.core.net.command.CommandSource;
import net.minecraft.server.entity.player.PlayerServer;

public class CommandHome implements CommandManager.CommandRegistry {
public static ArgumentBuilder<CommandSource, LiteralArgumentBuilder<CommandSource>> homeTP(ArgumentBuilder<CommandSource, LiteralArgumentBuilder<CommandSource>> builder) {
builder.then(LiteralArgumentBuilder.<CommandSource>literal("tp")
.then(RequiredArgumentBuilder.<CommandSource, String>argument("home", ArgumentTypeHome.home())
public static ArgumentBuilder<CommandSource, ArgumentBuilderLiteral<CommandSource>> homeTP(ArgumentBuilder<CommandSource, ArgumentBuilderLiteral<CommandSource>> builder) {
builder.then(ArgumentBuilderLiteral.<CommandSource>literal("tp")
.then(ArgumentBuilderRequired.<CommandSource, String>argument("home", ArgumentTypeHome.home())
.executes(context ->
{
PlayerServer sender = (PlayerServer) context.getSource().getSender(); if(sender == null){return 0;}
Expand All @@ -34,9 +34,9 @@ public static ArgumentBuilder<CommandSource, LiteralArgumentBuilder<CommandSourc
return builder;
}

public static ArgumentBuilder<CommandSource, LiteralArgumentBuilder<CommandSource>> homeDelete(ArgumentBuilder<CommandSource, LiteralArgumentBuilder<CommandSource>> builder) {
builder.then(LiteralArgumentBuilder.<CommandSource>literal("delete")
.then(RequiredArgumentBuilder.<CommandSource, String>argument("home", ArgumentTypeHome.home())
public static ArgumentBuilder<CommandSource, ArgumentBuilderLiteral<CommandSource>> homeDelete(ArgumentBuilder<CommandSource, ArgumentBuilderLiteral<CommandSource>> builder) {
builder.then(ArgumentBuilderLiteral.<CommandSource>literal("delete")
.then(ArgumentBuilderRequired.<CommandSource, String>argument("home", ArgumentTypeHome.home())
.executes(context ->
{
PlayerServer sender = (PlayerServer) context.getSource().getSender(); if(sender == null){return 0;}
Expand All @@ -54,9 +54,9 @@ public static ArgumentBuilder<CommandSource, LiteralArgumentBuilder<CommandSourc
return builder;
}

public static ArgumentBuilder<CommandSource, LiteralArgumentBuilder<CommandSource>> homeCreate(ArgumentBuilder<CommandSource, LiteralArgumentBuilder<CommandSource>> builder) {
builder.then(LiteralArgumentBuilder.<CommandSource>literal("create")
.then(RequiredArgumentBuilder.<CommandSource, String>argument("name", StringArgumentType.string())
public static ArgumentBuilder<CommandSource, ArgumentBuilderLiteral<CommandSource>> homeCreate(ArgumentBuilder<CommandSource, ArgumentBuilderLiteral<CommandSource>> builder) {
builder.then(ArgumentBuilderLiteral.<CommandSource>literal("create")
.then(ArgumentBuilderRequired.<CommandSource, String>argument("name", ArgumentTypeString.string())
.executes(context ->
{
PlayerServer sender = (PlayerServer) context.getSource().getSender(); if(sender == null){return 0;}
Expand All @@ -69,10 +69,10 @@ public static ArgumentBuilder<CommandSource, LiteralArgumentBuilder<CommandSourc
return builder;
}

public static ArgumentBuilder<CommandSource, LiteralArgumentBuilder<CommandSource>> homeRename(ArgumentBuilder<CommandSource, LiteralArgumentBuilder<CommandSource>> builder) {
builder.then(LiteralArgumentBuilder.<CommandSource>literal("rename")
.then(RequiredArgumentBuilder.<CommandSource, String>argument("home", ArgumentTypeHome.home())
.then(RequiredArgumentBuilder.<CommandSource, String>argument("name", StringArgumentType.string())
public static ArgumentBuilder<CommandSource, ArgumentBuilderLiteral<CommandSource>> homeRename(ArgumentBuilder<CommandSource, ArgumentBuilderLiteral<CommandSource>> builder) {
builder.then(ArgumentBuilderLiteral.<CommandSource>literal("rename")
.then(ArgumentBuilderRequired.<CommandSource, String>argument("home", ArgumentTypeHome.home())
.then(ArgumentBuilderRequired.<CommandSource, String>argument("name", ArgumentTypeString.string())
.executes(context ->
{
PlayerServer sender = (PlayerServer) context.getSource().getSender(); if(sender == null){return 0;}
Expand All @@ -92,8 +92,8 @@ public static ArgumentBuilder<CommandSource, LiteralArgumentBuilder<CommandSourc
return builder;
}

public static ArgumentBuilder<CommandSource, LiteralArgumentBuilder<CommandSource>> homeList(ArgumentBuilder<CommandSource, LiteralArgumentBuilder<CommandSource>> builder) {
builder.then(LiteralArgumentBuilder.<CommandSource>literal("list")
public static ArgumentBuilder<CommandSource, ArgumentBuilderLiteral<CommandSource>> homeList(ArgumentBuilder<CommandSource, ArgumentBuilderLiteral<CommandSource>> builder) {
builder.then(ArgumentBuilderLiteral.<CommandSource>literal("list")
.executes(context ->
{
PlayerServer sender = (PlayerServer) context.getSource().getSender(); if(sender == null){return 0;}
Expand All @@ -106,7 +106,7 @@ public static ArgumentBuilder<CommandSource, LiteralArgumentBuilder<CommandSourc

@Override
public void register(CommandDispatcher<CommandSource> dispatcher) {
LiteralArgumentBuilder<CommandSource> builder = LiteralArgumentBuilder.<CommandSource>literal("home");
ArgumentBuilderLiteral<CommandSource> builder = ArgumentBuilderLiteral.<CommandSource>literal("home");

homeTP(builder);
homeDelete(builder);
Expand Down
Loading
Loading