Finish adding dimension exclusions
This commit is contained in:
parent
10bd89450c
commit
f3bce6751b
19 changed files with 124 additions and 28 deletions
|
@ -125,7 +125,7 @@ dependencies {
|
|||
compileOnly fg.deobf("dev.zontreck:libzontreck:${libz_version}:dev")
|
||||
runtimeOnly fg.deobf("dev.zontreck:libzontreck:${libz_version}")
|
||||
|
||||
compileOnly "net.luckperms:api:${luckperms_version}"
|
||||
//compileOnly "net.luckperms:api:${luckperms_version}"
|
||||
// compile against the JEI API but do not include it at runtime
|
||||
//compileOnly fg.deobf("mezz.jei:jei-${mc_version}-forge-api:${jei_version}")
|
||||
// at runtime, use the full JEI jar
|
||||
|
|
|
@ -3,9 +3,9 @@
|
|||
org.gradle.jvmargs=-Xmx8G
|
||||
org.gradle.daemon=false
|
||||
|
||||
my_version=1.3.5.5
|
||||
my_version=1.3.5.6
|
||||
|
||||
mc_version=1.19.2
|
||||
forge_version=43.2.3
|
||||
libz_version=1.0.2.4
|
||||
luckperms_version=5.4
|
||||
# luckperms_version=5.4
|
|
@ -9,6 +9,7 @@ import java.util.UUID;
|
|||
import dev.zontreck.libzontreck.chat.ChatColor;
|
||||
import dev.zontreck.libzontreck.chat.HoverTip;
|
||||
import dev.zontreck.otemod.OTEMod;
|
||||
import dev.zontreck.otemod.configs.OTEServerConfig;
|
||||
import dev.zontreck.otemod.configs.PlayerFlyCache;
|
||||
import dev.zontreck.otemod.configs.Profile;
|
||||
import net.minecraft.network.chat.Component;
|
||||
|
@ -68,6 +69,8 @@ public class ChatServerOverride {
|
|||
OTEMod.LOGGER.error("FATAL: Profile was null for "+ev.getEntity().getName().getString());
|
||||
return;
|
||||
}
|
||||
|
||||
if(!OTEServerConfig.USE_CUSTOM_JOINLEAVE.get()) return;
|
||||
|
||||
ChatServerOverride.broadcast(Component.literal(ChatColor.DARK_GRAY + "[" + ChatColor.DARK_GREEN + "+" + ChatColor.DARK_GRAY + "] "+ ChatColor.BOLD + ChatColor.DARK_AQUA + prof.nickname), ev.getEntity().getServer());
|
||||
}
|
||||
|
@ -81,6 +84,8 @@ public class ChatServerOverride {
|
|||
|
||||
if(px==null)return;
|
||||
|
||||
if(!OTEServerConfig.USE_CUSTOM_JOINLEAVE.get()) return;
|
||||
|
||||
// Send the alert
|
||||
ChatServerOverride.broadcast(Component.literal(ChatColor.DARK_GRAY + "[" + ChatColor.DARK_RED + "-" + ChatColor.DARK_GRAY + "] "+ChatColor.BOLD + ChatColor.DARK_AQUA + px.nickname), ev.getEntity().getServer());
|
||||
|
||||
|
@ -104,6 +109,9 @@ public class ChatServerOverride {
|
|||
@SubscribeEvent
|
||||
public void onChat(final ServerChatEvent ev){
|
||||
// Player has chatted, apply override
|
||||
if(!OTEServerConfig.USE_CUSTOM_CHATREPLACER.get()) return;
|
||||
|
||||
|
||||
ServerPlayer sp = ev.getPlayer();
|
||||
// Get profile
|
||||
Profile XD = Profile.get_profile_of(sp.getStringUUID());
|
||||
|
|
|
@ -110,6 +110,7 @@ public class CommandRegistry {
|
|||
PrefixColorCommand.register(ev.getDispatcher());
|
||||
PrefixCommand.register(ev.getDispatcher());
|
||||
NickCommand.register(ev.getDispatcher());
|
||||
|
||||
|
||||
TPACommand.register(ev.getDispatcher());
|
||||
TPCancelCommand.register(ev.getDispatcher());
|
||||
|
|
|
@ -49,8 +49,6 @@ public class HomeCommand {
|
|||
|
||||
if(! ctx.isPlayer())
|
||||
{
|
||||
|
||||
ChatServerOverride.broadcastTo(ctx.getPlayer().getUUID(), Component.literal(ChatColor.DARK_RED).append(Component.translatable("dev.zontreck.otemod.msgs.only_player")), ctx.getServer());
|
||||
return 1;
|
||||
}
|
||||
ServerPlayer p = ctx.getPlayer();
|
||||
|
@ -109,7 +107,7 @@ public class HomeCommand {
|
|||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
if(!e.getMessage().equals("%%"))
|
||||
ctx.sendFailure(Component.translatable("dev.zontreck.otemod.msgs.homes.goto.fail"));
|
||||
ChatServerOverride.broadcastTo(ctx.getPlayer().getUUID(), Component.literal(OTEMod.OTEPrefix + ChatColor.doColors("!Dark_Red! Could not go to the home")), ctx.getServer());
|
||||
else
|
||||
ctx.sendFailure(Component.literal("FAILED SQL: "+ ChatColor.GOLD+ SQL));
|
||||
} catch (InvalidDeserialization e) {
|
||||
|
|
|
@ -17,10 +17,8 @@ import dev.zontreck.otemod.OTEMod;
|
|||
import dev.zontreck.otemod.chat.ChatServerOverride;
|
||||
import net.minecraft.commands.CommandSourceStack;
|
||||
import net.minecraft.commands.Commands;
|
||||
import net.minecraft.network.chat.contents.TranslatableContents;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.network.chat.MutableComponent;
|
||||
import net.minecraft.network.chat.Style;
|
||||
|
||||
public class HomesCommand {
|
||||
|
@ -48,7 +46,7 @@ public class HomesCommand {
|
|||
homes.add(rs.getString("home_name"));
|
||||
}
|
||||
|
||||
ctx.getSource().sendSuccess(MutableComponent.create(new TranslatableContents("dev.zontreck.otemod.msgs.homes.total")).append(""+String.valueOf(homes.size())), true);
|
||||
ChatServerOverride.broadcastTo(p.getUUID(), Component.literal(OTEMod.OTEPrefix + ChatColor.doColors(" !Dark_Purple!There are !gold!"+String.valueOf(homes.size())+" !dark_purple!total homes.")), p.server);
|
||||
con.endRequest();
|
||||
|
||||
for (String string : homes) {
|
||||
|
|
|
@ -15,6 +15,8 @@ import dev.zontreck.libzontreck.vectors.Vector3;
|
|||
import dev.zontreck.libzontreck.vectors.WorldPosition;
|
||||
import dev.zontreck.otemod.OTEMod;
|
||||
import dev.zontreck.otemod.chat.ChatServerOverride;
|
||||
import dev.zontreck.otemod.integrations.LuckPermsHelper;
|
||||
import dev.zontreck.otemod.permissions.Permissions;
|
||||
import dev.zontreck.otemod.zschem.MemoryHolder;
|
||||
import dev.zontreck.otemod.zschem.MemoryHolder.Container;
|
||||
import dev.zontreck.otemod.zschem.StoredBlock;
|
||||
|
@ -48,6 +50,12 @@ public class LoadSchem {
|
|||
|
||||
ServerPlayer play = source.getPlayer();
|
||||
if(play==null)return 1;
|
||||
|
||||
if(!LuckPermsHelper.hasGroupOrPerm(play, Permissions.zschem, Permissions.zschem_load)){
|
||||
LuckPermsHelper.sendNoPermissionsMessage(play, Permissions.zschem_load, Permissions.zschem);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if(MemoryHolder.hasPlayerCached(play))
|
||||
{
|
||||
Container cont = MemoryHolder.getContainer(play);
|
||||
|
|
|
@ -5,9 +5,10 @@ import java.util.List;
|
|||
import com.mojang.brigadier.CommandDispatcher;
|
||||
|
||||
import dev.zontreck.libzontreck.chat.ChatColor;
|
||||
import dev.zontreck.libzontreck.vectors.Vector3;
|
||||
import dev.zontreck.otemod.OTEMod;
|
||||
import dev.zontreck.otemod.chat.ChatServerOverride;
|
||||
import dev.zontreck.otemod.integrations.LuckPermsHelper;
|
||||
import dev.zontreck.otemod.permissions.Permissions;
|
||||
import dev.zontreck.otemod.zschem.MemoryHolder;
|
||||
import dev.zontreck.otemod.zschem.StoredBlock;
|
||||
import dev.zontreck.otemod.zschem.WorldProp;
|
||||
|
@ -35,6 +36,11 @@ public class Place {
|
|||
ServerPlayer play = source.getPlayer();
|
||||
if(play==null)return 1;
|
||||
|
||||
if(!LuckPermsHelper.hasGroupOrPerm(play, Permissions.zschem, Permissions.zschem_place)){
|
||||
LuckPermsHelper.sendNoPermissionsMessage(play, Permissions.zschem_place, Permissions.zschem);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if(!MemoryHolder.hasPlayerCached(play)){
|
||||
|
||||
ChatServerOverride.broadcastTo(play.getUUID(), Component.literal(OTEMod.OTEPrefix+ChatColor.doColors(" !Dark_Red!You must first load the zschem!")), OTEMod.THE_SERVER);
|
||||
|
|
|
@ -9,6 +9,8 @@ import dev.zontreck.libzontreck.chat.ChatColor;
|
|||
import dev.zontreck.libzontreck.vectors.Vector3;
|
||||
import dev.zontreck.otemod.OTEMod;
|
||||
import dev.zontreck.otemod.chat.ChatServerOverride;
|
||||
import dev.zontreck.otemod.integrations.LuckPermsHelper;
|
||||
import dev.zontreck.otemod.permissions.Permissions;
|
||||
import dev.zontreck.otemod.zschem.MemoryHolder;
|
||||
import dev.zontreck.otemod.zschem.StoredBlock;
|
||||
import dev.zontreck.otemod.zschem.WorldProp;
|
||||
|
@ -37,6 +39,11 @@ public class PlaceAsAir {
|
|||
ServerPlayer play = source.getPlayer();
|
||||
if(play==null)return 1;
|
||||
|
||||
if(!LuckPermsHelper.hasGroupOrPerm(play, Permissions.zschem, Permissions.zschem_air)){
|
||||
LuckPermsHelper.sendNoPermissionsMessage(play, Permissions.zschem_air, Permissions.zschem);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if(!MemoryHolder.hasPlayerCached(play)){
|
||||
|
||||
ChatServerOverride.broadcastTo(play.getUUID(), Component.literal(OTEMod.OTEPrefix+ChatColor.doColors(" !Dark_Red!You must first set the positions!")), OTEMod.THE_SERVER);
|
||||
|
|
|
@ -13,6 +13,8 @@ import dev.zontreck.libzontreck.chat.ChatColor;
|
|||
import dev.zontreck.libzontreck.vectors.Vector3;
|
||||
import dev.zontreck.otemod.OTEMod;
|
||||
import dev.zontreck.otemod.chat.ChatServerOverride;
|
||||
import dev.zontreck.otemod.integrations.LuckPermsHelper;
|
||||
import dev.zontreck.otemod.permissions.Permissions;
|
||||
import dev.zontreck.otemod.zschem.MemoryHolder;
|
||||
import dev.zontreck.otemod.zschem.MemoryHolder.Container;
|
||||
import dev.zontreck.otemod.zschem.StoredBlock;
|
||||
|
@ -45,6 +47,12 @@ public class SaveSchem {
|
|||
|
||||
ServerPlayer play = source.getPlayer();
|
||||
if(play==null)return 1;
|
||||
|
||||
if(!LuckPermsHelper.hasGroupOrPerm(play, Permissions.zschem, Permissions.zschem_save)){
|
||||
LuckPermsHelper.sendNoPermissionsMessage(play, Permissions.zschem_save, Permissions.zschem);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if(MemoryHolder.hasPlayerCached(play))
|
||||
{
|
||||
Container cont = MemoryHolder.getContainer(play);
|
||||
|
|
|
@ -6,6 +6,8 @@ import dev.zontreck.libzontreck.chat.ChatColor;
|
|||
import dev.zontreck.libzontreck.vectors.Vector3;
|
||||
import dev.zontreck.otemod.OTEMod;
|
||||
import dev.zontreck.otemod.chat.ChatServerOverride;
|
||||
import dev.zontreck.otemod.integrations.LuckPermsHelper;
|
||||
import dev.zontreck.otemod.permissions.Permissions;
|
||||
import dev.zontreck.otemod.zschem.MemoryHolder;
|
||||
import net.minecraft.commands.CommandSourceStack;
|
||||
import net.minecraft.commands.Commands;
|
||||
|
@ -29,6 +31,10 @@ public class SetPos1 {
|
|||
ServerPlayer play = source.getPlayer();
|
||||
if(play==null)return 1;
|
||||
|
||||
if(!LuckPermsHelper.hasGroupOrPerm(play, Permissions.zschem, Permissions.zschem_pos1)){
|
||||
LuckPermsHelper.sendNoPermissionsMessage(play, Permissions.zschem_pos1, Permissions.zschem);
|
||||
return 1;
|
||||
}
|
||||
MemoryHolder.setPos1(play, new Vector3(source.getPosition()));
|
||||
MemoryHolder.setLevel(play, source.getLevel());
|
||||
|
||||
|
|
|
@ -6,6 +6,8 @@ import dev.zontreck.libzontreck.chat.ChatColor;
|
|||
import dev.zontreck.libzontreck.vectors.Vector3;
|
||||
import dev.zontreck.otemod.OTEMod;
|
||||
import dev.zontreck.otemod.chat.ChatServerOverride;
|
||||
import dev.zontreck.otemod.integrations.LuckPermsHelper;
|
||||
import dev.zontreck.otemod.permissions.Permissions;
|
||||
import dev.zontreck.otemod.zschem.MemoryHolder;
|
||||
import net.minecraft.commands.CommandSourceStack;
|
||||
import net.minecraft.commands.Commands;
|
||||
|
@ -28,6 +30,11 @@ public class SetPos2 {
|
|||
ServerPlayer play = source.getPlayer();
|
||||
if(play==null)return 1;
|
||||
|
||||
if(!LuckPermsHelper.hasGroupOrPerm(play, Permissions.zschem, Permissions.zschem_pos2)){
|
||||
LuckPermsHelper.sendNoPermissionsMessage(play, Permissions.zschem_pos2, Permissions.zschem);
|
||||
return 1;
|
||||
}
|
||||
|
||||
MemoryHolder.setPos2(play, new Vector3(source.getPosition()));
|
||||
MemoryHolder.setLevel(play, source.getLevel());
|
||||
|
||||
|
|
|
@ -21,7 +21,11 @@ public class OTEServerConfig {
|
|||
public static final ForgeConfigSpec.ConfigValue<String> PASSWORD;
|
||||
public static final ForgeConfigSpec.ConfigValue<String> DATABASE;
|
||||
public static final ForgeConfigSpec.ConfigValue<Integer> ITEM_DESPAWN_TIMER;
|
||||
|
||||
|
||||
public static final ForgeConfigSpec.ConfigValue<Integer> RTP_COOLDOWN;
|
||||
|
||||
|
||||
public static final ForgeConfigSpec.ConfigValue<Integer> HEALER_TIMER;
|
||||
public static final ForgeConfigSpec.BooleanValue DEBUG_HEALER;
|
||||
public static final ForgeConfigSpec.ConfigValue<Integer> TIME_BETWEEN_BLOCKS;
|
||||
|
@ -29,6 +33,10 @@ public class OTEServerConfig {
|
|||
public static final ForgeConfigSpec.ConfigValue<List<String>> EXCLUDE_DIMS;
|
||||
|
||||
|
||||
public static final ForgeConfigSpec.BooleanValue USE_CUSTOM_JOINLEAVE;
|
||||
public static final ForgeConfigSpec.BooleanValue USE_CUSTOM_CHATREPLACER;
|
||||
|
||||
|
||||
static {
|
||||
List<ItemStack> defaults = new ArrayList<ItemStack>();
|
||||
List<String> defaultExcludeDimensions = new ArrayList<String>();
|
||||
|
@ -62,6 +70,12 @@ public class OTEServerConfig {
|
|||
defDims.add("otemod:resource");
|
||||
EXCLUDE_DIMS = BUILDER.comment("Dimension names (ex. minecraft:overworld) to exclude from the explosion healing events").define("exclude_dimensions", defDims);
|
||||
|
||||
BUILDER.pop();
|
||||
|
||||
BUILDER.push("CHATSERVER");
|
||||
USE_CUSTOM_JOINLEAVE = BUILDER.comment("Whether to use the custom join and leave messages").define("join_leave_messages", true);
|
||||
USE_CUSTOM_CHATREPLACER = BUILDER.comment("Whether to use the custom chat replacer (If disabled the relevant commands will be removed)").define("chatprettifier", true);
|
||||
|
||||
BUILDER.pop();
|
||||
SPEC=BUILDER.build();
|
||||
}
|
||||
|
|
|
@ -1,12 +0,0 @@
|
|||
package dev.zontreck.otemod.integrations;
|
||||
|
||||
//@JeiPlugin
|
||||
public class JEI
|
||||
{
|
||||
|
||||
//@Override
|
||||
/*public ResourceLocation getPluginUid() {
|
||||
return new ResourceLocation(OTEMod.MOD_ID, "jei_plugin");
|
||||
}*/
|
||||
|
||||
}
|
|
@ -0,0 +1,39 @@
|
|||
package dev.zontreck.otemod.integrations;
|
||||
|
||||
import dev.zontreck.libzontreck.chat.ChatColor;
|
||||
import dev.zontreck.otemod.OTEMod;
|
||||
import dev.zontreck.otemod.chat.ChatServerOverride;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
|
||||
public class LuckPermsHelper {
|
||||
/*public static LuckPerms getLuckPerms()
|
||||
{
|
||||
return LuckPermsProvider.get();
|
||||
}
|
||||
|
||||
private static User getUserOf(Player p){
|
||||
return getLuckPerms().getPlayerAdapter(Player.class).getUser(p);
|
||||
}
|
||||
|
||||
private static boolean hasPermission(User u, String perm)
|
||||
{
|
||||
return u.getCachedData().getPermissionData().checkPermission(perm).asBoolean();
|
||||
}*/
|
||||
|
||||
public static boolean hasPermission(Player p, String perm)
|
||||
{
|
||||
//User u = getUserOf(p);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public static boolean hasGroupOrPerm(Player p, String group, String perm){
|
||||
return hasPermission(p, group) || hasPermission(p, perm);
|
||||
}
|
||||
|
||||
public static void sendNoPermissionsMessage(ServerPlayer play, String perm, String group) {
|
||||
ChatServerOverride.broadcastTo(play.getUUID(), Component.literal(OTEMod.OTEPrefix + ChatColor.doColors(" !Dark_Red!You do not have permission to use that command. You need permission !Gold!"+perm+" !White! or !Gold!"+group)), play.server);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
package dev.zontreck.otemod.permissions;
|
||||
|
||||
public class Permissions {
|
||||
public static String zschem = "group.otemod.zschem";
|
||||
public static String zschem_load = "otemod.commands.zschem.loadzschem";
|
||||
public static String zschem_save = "otemod.commands.zschem.savezschem";
|
||||
public static String zschem_place = "otemod.commands.zschem.placezschem";
|
||||
public static String zschem_pos1 = "otemod.commands.zschem.pos1";
|
||||
public static String zschem_pos2 = "otemod.commands.zschem.pos2";
|
||||
public static String zschem_air = "otemod.commands.zschem.setair";
|
||||
|
||||
|
||||
}
|
|
@ -4,7 +4,6 @@ import java.util.ArrayList;
|
|||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.ListIterator;
|
||||
import java.util.Random;
|
||||
import java.util.concurrent.locks.Lock;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
|
||||
|
@ -13,8 +12,6 @@ import dev.zontreck.otemod.configs.OTEServerConfig;
|
|||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.nbt.ListTag;
|
||||
import net.minecraft.nbt.Tag;
|
||||
import net.minecraft.sounds.SoundEvents;
|
||||
import net.minecraft.sounds.SoundSource;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
|
||||
public class BlockContainerList {
|
||||
|
|
|
@ -19,7 +19,7 @@ modId="otemod" #mandatory
|
|||
# The version number of the mod - there's a few well known ${} variables useable here or just hardcode it
|
||||
# ${file.jarVersion} will substitute the value of the Implementation-Version as read from the mod's JAR file metadata
|
||||
# see the associated build.gradle script for how to populate this completely automatically during a build
|
||||
version="1.3.5.5" #mandatory
|
||||
version="1.3.5.6" #mandatory
|
||||
# A display name for the mod
|
||||
displayName="OTEMod Resources" #mandatory
|
||||
# A URL to query for updates for this mod. See the JSON update specification https://mcforge.readthedocs.io/en/latest/gettingstarted/autoupdate/
|
||||
|
|
|
@ -21,8 +21,6 @@
|
|||
|
||||
"dev.zontreck.otemod.msgs.only_player": "§cOnly players are allowed to execute this command",
|
||||
|
||||
"dev.zontreck.otemod.msgs.homes.total": "§3Total number of homes: §6",
|
||||
|
||||
"dev.zontreck.otemod.msgs.command_cooling_down": "This command is currently on cooldown. You must wait for ",
|
||||
"dev.zontreck.otemod.msgs.command_cooling_down_seconds": "seconds.",
|
||||
|
||||
|
|
Reference in a new issue