Small tweak.
parent
7e1fe5a602
commit
5d1bdf5e9e
|
@ -50,13 +50,6 @@ public class TextileBackup implements ModInitializer {
|
||||||
config = ConfigManager.loadConfig(ConfigHandler.class);
|
config = ConfigManager.loadConfig(ConfigHandler.class);
|
||||||
|
|
||||||
registerCommands();
|
registerCommands();
|
||||||
|
|
||||||
ServerStartCallback.EVENT.register(server -> {
|
|
||||||
LevelStorage.Session session = ((MinecraftServerSessionAccessor)server).getSession();
|
|
||||||
|
|
||||||
System.out.println(session.getDirectory(class_5218.field_24188).toAbsolutePath());
|
|
||||||
System.out.println(session.method_27424(DimensionType.OVERWORLD).toPath().toAbsolutePath());
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void registerCommands(){
|
private void registerCommands(){
|
||||||
|
|
|
@ -8,6 +8,7 @@ import net.minecraft.command.arguments.EntityArgumentType;
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.server.command.CommandManager;
|
import net.minecraft.server.command.CommandManager;
|
||||||
import net.minecraft.server.command.ServerCommandSource;
|
import net.minecraft.server.command.ServerCommandSource;
|
||||||
|
import net.minecraft.server.network.ServerPlayerEntity;
|
||||||
import net.minecraft.text.LiteralText;
|
import net.minecraft.text.LiteralText;
|
||||||
import net.minecraft.text.TranslatableText;
|
import net.minecraft.text.TranslatableText;
|
||||||
import net.szum123321.textile_backup.TextileBackup;
|
import net.szum123321.textile_backup.TextileBackup;
|
||||||
|
@ -51,7 +52,7 @@ public class BlacklistCommand {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int executeAdd(CommandContext<ServerCommandSource> ctx) throws CommandSyntaxException {
|
private static int executeAdd(CommandContext<ServerCommandSource> ctx) throws CommandSyntaxException {
|
||||||
PlayerEntity player = EntityArgumentType.getPlayer(ctx, "player");
|
ServerPlayerEntity player = EntityArgumentType.getPlayer(ctx, "player");
|
||||||
|
|
||||||
if(TextileBackup.config.playerBlacklist.contains(player.getEntityName())) {
|
if(TextileBackup.config.playerBlacklist.contains(player.getEntityName())) {
|
||||||
ctx.getSource().sendFeedback(new TranslatableText("Player: %s is already blacklisted.", player.getEntityName()), false);
|
ctx.getSource().sendFeedback(new TranslatableText("Player: %s is already blacklisted.", player.getEntityName()), false);
|
||||||
|
@ -72,6 +73,8 @@ public class BlacklistCommand {
|
||||||
|
|
||||||
builder.append(" successfully.");
|
builder.append(" successfully.");
|
||||||
|
|
||||||
|
ctx.getSource().getMinecraftServer().getCommandManager().sendCommandTree(player);
|
||||||
|
|
||||||
Utilities.log(builder.toString(), ctx.getSource());
|
Utilities.log(builder.toString(), ctx.getSource());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -79,7 +82,7 @@ public class BlacklistCommand {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int executeRemove(CommandContext<ServerCommandSource> ctx) throws CommandSyntaxException {
|
private static int executeRemove(CommandContext<ServerCommandSource> ctx) throws CommandSyntaxException {
|
||||||
PlayerEntity player = EntityArgumentType.getPlayer(ctx, "player");
|
ServerPlayerEntity player = EntityArgumentType.getPlayer(ctx, "player");
|
||||||
|
|
||||||
if(!TextileBackup.config.playerBlacklist.contains(player.getEntityName())) {
|
if(!TextileBackup.config.playerBlacklist.contains(player.getEntityName())) {
|
||||||
ctx.getSource().sendFeedback(new TranslatableText("Player: %s newer was blacklisted.", player.getEntityName()), false);
|
ctx.getSource().sendFeedback(new TranslatableText("Player: %s newer was blacklisted.", player.getEntityName()), false);
|
||||||
|
@ -93,6 +96,8 @@ public class BlacklistCommand {
|
||||||
builder.append(player.getEntityName());
|
builder.append(player.getEntityName());
|
||||||
builder.append(" removed from the blacklist successfully.");
|
builder.append(" removed from the blacklist successfully.");
|
||||||
|
|
||||||
|
ctx.getSource().getMinecraftServer().getCommandManager().sendCommandTree(player);
|
||||||
|
|
||||||
Utilities.log(builder.toString(), ctx.getSource());
|
Utilities.log(builder.toString(), ctx.getSource());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,7 @@ import net.minecraft.command.arguments.EntityArgumentType;
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.server.command.CommandManager;
|
import net.minecraft.server.command.CommandManager;
|
||||||
import net.minecraft.server.command.ServerCommandSource;
|
import net.minecraft.server.command.ServerCommandSource;
|
||||||
|
import net.minecraft.server.network.ServerPlayerEntity;
|
||||||
import net.minecraft.text.LiteralText;
|
import net.minecraft.text.LiteralText;
|
||||||
import net.minecraft.text.TranslatableText;
|
import net.minecraft.text.TranslatableText;
|
||||||
import net.szum123321.textile_backup.TextileBackup;
|
import net.szum123321.textile_backup.TextileBackup;
|
||||||
|
@ -51,7 +52,7 @@ public class WhitelistCommand {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int executeAdd(CommandContext<ServerCommandSource> ctx) throws CommandSyntaxException {
|
private static int executeAdd(CommandContext<ServerCommandSource> ctx) throws CommandSyntaxException {
|
||||||
PlayerEntity player = EntityArgumentType.getPlayer(ctx, "player");
|
ServerPlayerEntity player = EntityArgumentType.getPlayer(ctx, "player");
|
||||||
|
|
||||||
if(TextileBackup.config.playerWhitelist.contains(player.getEntityName())) {
|
if(TextileBackup.config.playerWhitelist.contains(player.getEntityName())) {
|
||||||
ctx.getSource().sendFeedback(new TranslatableText("Player: %s is already whitelisted.", player.getEntityName()), false);
|
ctx.getSource().sendFeedback(new TranslatableText("Player: %s is already whitelisted.", player.getEntityName()), false);
|
||||||
|
@ -72,6 +73,8 @@ public class WhitelistCommand {
|
||||||
|
|
||||||
builder.append(" successfully.");
|
builder.append(" successfully.");
|
||||||
|
|
||||||
|
ctx.getSource().getMinecraftServer().getCommandManager().sendCommandTree(player);
|
||||||
|
|
||||||
Utilities.log(builder.toString(), ctx.getSource());
|
Utilities.log(builder.toString(), ctx.getSource());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -79,7 +82,7 @@ public class WhitelistCommand {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int executeRemove(CommandContext<ServerCommandSource> ctx) throws CommandSyntaxException {
|
private static int executeRemove(CommandContext<ServerCommandSource> ctx) throws CommandSyntaxException {
|
||||||
PlayerEntity player = EntityArgumentType.getPlayer(ctx, "player");
|
ServerPlayerEntity player = EntityArgumentType.getPlayer(ctx, "player");
|
||||||
|
|
||||||
if(!TextileBackup.config.playerWhitelist.contains(player.getEntityName())) {
|
if(!TextileBackup.config.playerWhitelist.contains(player.getEntityName())) {
|
||||||
ctx.getSource().sendFeedback(new TranslatableText("Player: %s newer was on the whitelist.", player.getEntityName()), false);
|
ctx.getSource().sendFeedback(new TranslatableText("Player: %s newer was on the whitelist.", player.getEntityName()), false);
|
||||||
|
@ -92,6 +95,8 @@ public class WhitelistCommand {
|
||||||
builder.append(player.getEntityName());
|
builder.append(player.getEntityName());
|
||||||
builder.append(" removed from the whitelist successfully.");
|
builder.append(" removed from the whitelist successfully.");
|
||||||
|
|
||||||
|
ctx.getSource().getMinecraftServer().getCommandManager().sendCommandTree(player);
|
||||||
|
|
||||||
Utilities.log(builder.toString(), ctx.getSource());
|
Utilities.log(builder.toString(), ctx.getSource());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -29,6 +29,6 @@
|
||||||
"depends": {
|
"depends": {
|
||||||
"fabricloader": ">=0.7.2",
|
"fabricloader": ">=0.7.2",
|
||||||
"fabric": "*",
|
"fabric": "*",
|
||||||
"minecraft": "1.16.*"
|
"minecraft": ">=1.16-alpha.20.19.a"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue