Add new datagenned resources
This commit is contained in:
parent
9e61a85498
commit
f63f250e3b
309 changed files with 16088 additions and 300 deletions
|
@ -21,7 +21,6 @@ import dev.zontreck.otemod.commands.zschem.PlaceAsAir;
|
|||
import dev.zontreck.otemod.commands.zschem.SaveSchem;
|
||||
import dev.zontreck.otemod.commands.zschem.SetPos1;
|
||||
import dev.zontreck.otemod.commands.zschem.SetPos2;
|
||||
import dev.zontreck.otemod.configs.OTEServerConfig;
|
||||
import net.minecraftforge.event.RegisterCommandsEvent;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
|
@ -36,52 +35,6 @@ public class CommandRegistry {
|
|||
// Command was used, mark the current time
|
||||
CommandCooldownRegistry.put(cmd, Instant.now().getEpochSecond());
|
||||
}
|
||||
|
||||
public static boolean canUse(String cmd)
|
||||
{
|
||||
if(!CommandCooldownRegistry.containsKey(cmd)) return true;
|
||||
long lastUse = CommandCooldownRegistry.get(cmd);
|
||||
switch(cmd)
|
||||
{
|
||||
case "rtp":
|
||||
{
|
||||
if(Instant.now().getEpochSecond() > lastUse+Long.parseLong(String.valueOf(OTEServerConfig.RTP_COOLDOWN))){
|
||||
CommandCooldownRegistry.remove(cmd);
|
||||
return true;
|
||||
}else return false;
|
||||
}
|
||||
default:
|
||||
{
|
||||
CommandCooldownRegistry.remove(cmd);
|
||||
return true; // cooldown not yet made
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
public static String getRemaining(String string) {
|
||||
long now = Instant.now().getEpochSecond();
|
||||
if(!CommandCooldownRegistry.containsKey(string))return "0";
|
||||
long used = CommandCooldownRegistry.get(string);
|
||||
long cmd_time = 0L;
|
||||
switch(string)
|
||||
{
|
||||
case "rtp":
|
||||
{
|
||||
cmd_time = Long.parseLong(String.valueOf(OTEServerConfig.RTP_COOLDOWN));
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
cmd_time = 0L;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
used+=cmd_time;
|
||||
long diff = used-now;
|
||||
if(diff<0)diff=0L;
|
||||
return String.valueOf(diff);
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onRegisterCommands(final RegisterCommandsEvent ev)
|
||||
|
|
|
@ -6,17 +6,15 @@ import dev.zontreck.libzontreck.exceptions.InvalidDeserialization;
|
|||
import dev.zontreck.libzontreck.util.ChatHelpers;
|
||||
import dev.zontreck.libzontreck.vectors.Vector3;
|
||||
import dev.zontreck.libzontreck.vectors.WorldPosition;
|
||||
import dev.zontreck.otemod.configs.OTEServerConfig;
|
||||
import dev.zontreck.otemod.configs.snbt.ServerConfig;
|
||||
import dev.zontreck.otemod.implementation.Messages;
|
||||
import dev.zontreck.otemod.registry.ModDimensions;
|
||||
import dev.zontreck.otemod.registry.PerPlayerDataRegistry;
|
||||
import net.minecraft.commands.CommandSourceStack;
|
||||
import net.minecraft.commands.Commands;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.server.commands.ExperienceCommand;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.server.command.EnumArgument;
|
||||
|
||||
public class BuildCommand
|
||||
{
|
||||
|
@ -39,7 +37,7 @@ public class BuildCommand
|
|||
ServerPlayer sp = stack.getPlayer();
|
||||
boolean playerIsOp = sp.hasPermissions(stack.getServer().getOperatorUserPermissionLevel());
|
||||
|
||||
if(playerIsOp || OTEServerConfig.ALLOW_BUILDER_DIM.get())
|
||||
if(playerIsOp || ServerConfig.general.allowBuilder)
|
||||
{
|
||||
|
||||
if(direction == Options.enter)
|
||||
|
|
Reference in a new issue