summaryrefslogtreecommitdiff
path: root/src/main/java/com/keuin/ohmyvanillamc/config
diff options
context:
space:
mode:
authorKeuin <[email protected]>2021-01-16 15:34:15 +0800
committerkeuin <[email protected]>2021-01-16 15:34:15 +0800
commitc96ce10cdcf75cf642101b00cc9572304d276851 (patch)
treedd1adaa56fe890e3e6f9b790ed654d2f33a1a0a2 /src/main/java/com/keuin/ohmyvanillamc/config
parent9aeb1b613329cc201766e5d97e5853c879a5d2fe (diff)
Add runtime configuration editing command `/omvm set <key> <value>`. The set is temporary and will not be modified in disk.
Diffstat (limited to 'src/main/java/com/keuin/ohmyvanillamc/config')
-rw-r--r--src/main/java/com/keuin/ohmyvanillamc/config/ImmutableOmvmConfiguration.java45
-rw-r--r--src/main/java/com/keuin/ohmyvanillamc/config/OmvmConfiguration.java113
2 files changed, 158 insertions, 0 deletions
diff --git a/src/main/java/com/keuin/ohmyvanillamc/config/ImmutableOmvmConfiguration.java b/src/main/java/com/keuin/ohmyvanillamc/config/ImmutableOmvmConfiguration.java
new file mode 100644
index 0000000..e5a34e1
--- /dev/null
+++ b/src/main/java/com/keuin/ohmyvanillamc/config/ImmutableOmvmConfiguration.java
@@ -0,0 +1,45 @@
+package com.keuin.ohmyvanillamc.config;
+
+public class ImmutableOmvmConfiguration extends OmvmConfiguration {
+
+ public ImmutableOmvmConfiguration() {
+ }
+
+ public ImmutableOmvmConfiguration(OmvmConfiguration omvmConfiguration) {
+ super(omvmConfiguration);
+ }
+
+ public ImmutableOmvmConfiguration(boolean fixEntityTrackerEntrySpamming, boolean disableFishSchooling, boolean disablePhantomSpawning, boolean disableWanderingTraderSpawning, boolean reintroduceLlamaItemDuplicating, boolean reintroduceZeroTickFarm) {
+ super(fixEntityTrackerEntrySpamming, disableFishSchooling, disablePhantomSpawning, disableWanderingTraderSpawning, reintroduceLlamaItemDuplicating, reintroduceZeroTickFarm);
+ }
+
+ @Override
+ public void setFixEntityTrackerEntrySpamming(boolean fixEntityTrackerEntrySpamming) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public void setDisableFishSchooling(boolean disableFishSchooling) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public void setDisablePhantomSpawning(boolean disablePhantomSpawning) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public void setDisableWanderingTraderSpawning(boolean disableWanderingTraderSpawning) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public void setReintroduceLlamaItemDuplicating(boolean reintroduceLlamaItemDuplicating) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public void setReintroduceZeroTickFarm(boolean reintroduceZeroTickFarm) {
+ throw new UnsupportedOperationException();
+ }
+}
diff --git a/src/main/java/com/keuin/ohmyvanillamc/config/OmvmConfiguration.java b/src/main/java/com/keuin/ohmyvanillamc/config/OmvmConfiguration.java
new file mode 100644
index 0000000..70ce1a7
--- /dev/null
+++ b/src/main/java/com/keuin/ohmyvanillamc/config/OmvmConfiguration.java
@@ -0,0 +1,113 @@
+package com.keuin.ohmyvanillamc.config;
+
+import java.util.Objects;
+
+public class OmvmConfiguration {
+
+ private boolean fixEntityTrackerEntrySpamming;
+ private boolean disableFishSchooling;
+ private boolean disablePhantomSpawning;
+ private boolean disableWanderingTraderSpawning;
+ private boolean reintroduceLlamaItemDuplicating;
+ private boolean reintroduceZeroTickFarm;
+
+ public OmvmConfiguration() {
+ this(true, false, false, false, false, false);
+ }
+
+ public OmvmConfiguration(OmvmConfiguration omvmConfiguration) {
+ this.fixEntityTrackerEntrySpamming = omvmConfiguration.fixEntityTrackerEntrySpamming;
+ this.disableFishSchooling = omvmConfiguration.disableFishSchooling;
+ this.disablePhantomSpawning = omvmConfiguration.disablePhantomSpawning;
+ this.disableWanderingTraderSpawning = omvmConfiguration.disableWanderingTraderSpawning;
+ this.reintroduceLlamaItemDuplicating = omvmConfiguration.reintroduceLlamaItemDuplicating;
+ this.reintroduceZeroTickFarm = omvmConfiguration.reintroduceZeroTickFarm;
+ }
+
+ public OmvmConfiguration(boolean fixEntityTrackerEntrySpamming, boolean disableFishSchooling, boolean disablePhantomSpawning, boolean disableWanderingTraderSpawning, boolean reintroduceLlamaItemDuplicating, boolean reintroduceZeroTickFarm) {
+ this.fixEntityTrackerEntrySpamming = fixEntityTrackerEntrySpamming;
+ this.disableFishSchooling = disableFishSchooling;
+ this.disablePhantomSpawning = disablePhantomSpawning;
+ this.disableWanderingTraderSpawning = disableWanderingTraderSpawning;
+ this.reintroduceLlamaItemDuplicating = reintroduceLlamaItemDuplicating;
+ this.reintroduceZeroTickFarm = reintroduceZeroTickFarm;
+ }
+
+ public boolean isFixEntityTrackerEntrySpamming() {
+ return fixEntityTrackerEntrySpamming;
+ }
+
+ public boolean isDisableFishSchooling() {
+ return disableFishSchooling;
+ }
+
+ public boolean isDisablePhantomSpawning() {
+ return disablePhantomSpawning;
+ }
+
+ public boolean isDisableWanderingTraderSpawning() {
+ return disableWanderingTraderSpawning;
+ }
+
+ public boolean isReintroduceLlamaItemDuplicating() {
+ return reintroduceLlamaItemDuplicating;
+ }
+
+ public boolean isReintroduceZeroTickFarm() {
+ return reintroduceZeroTickFarm;
+ }
+
+ public void setFixEntityTrackerEntrySpamming(boolean fixEntityTrackerEntrySpamming) {
+ this.fixEntityTrackerEntrySpamming = fixEntityTrackerEntrySpamming;
+ }
+
+ public void setDisableFishSchooling(boolean disableFishSchooling) {
+ this.disableFishSchooling = disableFishSchooling;
+ }
+
+ public void setDisablePhantomSpawning(boolean disablePhantomSpawning) {
+ this.disablePhantomSpawning = disablePhantomSpawning;
+ }
+
+ public void setDisableWanderingTraderSpawning(boolean disableWanderingTraderSpawning) {
+ this.disableWanderingTraderSpawning = disableWanderingTraderSpawning;
+ }
+
+ public void setReintroduceLlamaItemDuplicating(boolean reintroduceLlamaItemDuplicating) {
+ this.reintroduceLlamaItemDuplicating = reintroduceLlamaItemDuplicating;
+ }
+
+ public void setReintroduceZeroTickFarm(boolean reintroduceZeroTickFarm) {
+ this.reintroduceZeroTickFarm = reintroduceZeroTickFarm;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+ OmvmConfiguration that = (OmvmConfiguration) o;
+ return fixEntityTrackerEntrySpamming == that.fixEntityTrackerEntrySpamming &&
+ disableFishSchooling == that.disableFishSchooling &&
+ disablePhantomSpawning == that.disablePhantomSpawning &&
+ disableWanderingTraderSpawning == that.disableWanderingTraderSpawning &&
+ reintroduceLlamaItemDuplicating == that.reintroduceLlamaItemDuplicating &&
+ reintroduceZeroTickFarm == that.reintroduceZeroTickFarm;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(fixEntityTrackerEntrySpamming, disableFishSchooling, disablePhantomSpawning, disableWanderingTraderSpawning, reintroduceLlamaItemDuplicating, reintroduceZeroTickFarm);
+ }
+
+ @Override
+ public String toString() {
+ String s = "";
+ s += "(BugFix) Fix Entity Tracker Entry Spamming: " + fixEntityTrackerEntrySpamming + "\n";
+ s += "(Optimization) Disable Fish Schooling: " + disableFishSchooling + "\n";
+ s += "(Exotic Feature) Disable Phantom Spawning: " + disablePhantomSpawning + "\n";
+ s += "(Exotic Feature) Disable Wandering Trader Spawning: " + disableWanderingTraderSpawning + "\n";
+ s += "(Obsolete Vanilla Feature) Reintroduce Llama Item Duplicating: " + reintroduceLlamaItemDuplicating + "\n";
+ s += "(Obsolete Vanilla Feature) Reintroduce 0-tick Plants Farm: " + reintroduceZeroTickFarm;
+ return s;
+ }
+}