mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2025-02-11 20:00:46 +00:00
Allow admins to force enable /recipe if they want
Add `force-enable-recipe`, which allows server admins to manually enable `/recipe` despite potential duplication exploits. Use this at your own risk! Related: #1397
This commit is contained in:
parent
44301fae4f
commit
6a6383462d
4 changed files with 20 additions and 3 deletions
|
@ -316,4 +316,6 @@ public interface ISettings extends IConf {
|
||||||
boolean isAllowWorldInBroadcastworld();
|
boolean isAllowWorldInBroadcastworld();
|
||||||
|
|
||||||
String getItemDbType();
|
String getItemDbType();
|
||||||
|
|
||||||
|
boolean isForceEnableRecipe();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1463,7 +1463,7 @@ public class Settings implements net.ess3.api.ISettings {
|
||||||
return isAllowWorldInBroadcastworld;
|
return isAllowWorldInBroadcastworld;
|
||||||
}
|
}
|
||||||
|
|
||||||
private String itemDbType;
|
private String itemDbType; // #EasterEgg - admins can manually switch items provider if they want
|
||||||
|
|
||||||
private String _getItemDbType() {
|
private String _getItemDbType() {
|
||||||
return config.getString("item-db-type", "auto");
|
return config.getString("item-db-type", "auto");
|
||||||
|
@ -1473,4 +1473,15 @@ public class Settings implements net.ess3.api.ISettings {
|
||||||
public String getItemDbType() {
|
public String getItemDbType() {
|
||||||
return itemDbType;
|
return itemDbType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean forceEnableRecipe; // https://github.com/EssentialsX/Essentials/issues/1397
|
||||||
|
|
||||||
|
private boolean _isForceEnableRecipe() {
|
||||||
|
return config.getBoolean("force-enable-recipe", false);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isForceEnableRecipe() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@ package com.earth2me.essentials.commands;
|
||||||
import com.earth2me.essentials.CommandSource;
|
import com.earth2me.essentials.CommandSource;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.User;
|
||||||
import com.earth2me.essentials.utils.NumberUtil;
|
import com.earth2me.essentials.utils.NumberUtil;
|
||||||
|
import com.earth2me.essentials.utils.VersionUtil;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
import org.bukkit.inventory.*;
|
import org.bukkit.inventory.*;
|
||||||
|
@ -24,8 +25,10 @@ public class Commandrecipe extends EssentialsCommand {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void disableCommandForVersion1_12() throws Exception {
|
private void disableCommandForVersion1_12() throws Exception {
|
||||||
if (ReflUtil.getNmsVersionObject().equals(ReflUtil.V1_12_R1)) {
|
VersionUtil.BukkitVersion version = VersionUtil.getServerBukkitVersion();
|
||||||
throw new Exception("/recipe is temporarily disabled. Please use the recipe book in your inventory.");
|
if (version.isHigherThanOrEqualTo(VersionUtil.v1_12_0_R01)
|
||||||
|
&& !ess.getSettings().isForceEnableRecipe()) {
|
||||||
|
throw new Exception("Please use the recipe book in your inventory.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,6 +15,7 @@ public class VersionUtil {
|
||||||
public static final BukkitVersion v1_9_4_R01 = BukkitVersion.fromString("1.9.4-R0.1-SNAPSHOT");
|
public static final BukkitVersion v1_9_4_R01 = BukkitVersion.fromString("1.9.4-R0.1-SNAPSHOT");
|
||||||
public static final BukkitVersion v1_10_2_R01 = BukkitVersion.fromString("1.10.2-R0.1-SNAPSHOT");
|
public static final BukkitVersion v1_10_2_R01 = BukkitVersion.fromString("1.10.2-R0.1-SNAPSHOT");
|
||||||
public static final BukkitVersion v1_11_2_R01 = BukkitVersion.fromString("1.11.2-R0.1-SNAPSHOT");
|
public static final BukkitVersion v1_11_2_R01 = BukkitVersion.fromString("1.11.2-R0.1-SNAPSHOT");
|
||||||
|
public static final BukkitVersion v1_12_0_R01 = BukkitVersion.fromString("1.12.0-R0.1-SNAPSHOT");
|
||||||
public static final BukkitVersion v1_12_2_R01 = BukkitVersion.fromString("1.12.2-R0.1-SNAPSHOT");
|
public static final BukkitVersion v1_12_2_R01 = BukkitVersion.fromString("1.12.2-R0.1-SNAPSHOT");
|
||||||
public static final BukkitVersion v1_13_0_R01 = BukkitVersion.fromString("1.13.0-R0.1-SNAPSHOT");
|
public static final BukkitVersion v1_13_0_R01 = BukkitVersion.fromString("1.13.0-R0.1-SNAPSHOT");
|
||||||
public static final BukkitVersion v1_13_2_R01 = BukkitVersion.fromString("1.13.2-R0.1-SNAPSHOT");
|
public static final BukkitVersion v1_13_2_R01 = BukkitVersion.fromString("1.13.2-R0.1-SNAPSHOT");
|
||||||
|
|
Loading…
Reference in a new issue