-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
193 additions
and
180 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 19 additions & 1 deletion
20
src/main/java/dev/anvilcraft/rg/RollingGateServerRules.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,26 @@ | ||
package dev.anvilcraft.rg; | ||
|
||
import dev.anvilcraft.rg.api.RGValidator; | ||
import dev.anvilcraft.rg.api.Rule; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
import java.util.Map; | ||
|
||
public class RollingGateServerRules { | ||
@Rule(allowed = {"zh_cn", "en_us"}, categories = {RollingGateCategories.BASE}) | ||
@Rule(allowed = {"zh_cn", "en_us"}, categories = RollingGateCategories.BASE) | ||
public static String language = "zh_cn"; | ||
|
||
public static class ViewDistanceValidator extends RGValidator.IntegerValidator { | ||
@Override | ||
public @NotNull Map.Entry<Integer, Integer> getRange() { | ||
return Map.entry(0, 32); | ||
} | ||
} | ||
|
||
@Rule( | ||
allowed = {"0", "12", "16", "32"}, | ||
categories = RollingGateCategories.CREATIVE, | ||
validator = ViewDistanceValidator.class | ||
) | ||
public static int viewDistance = 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
src/main/java/dev/anvilcraft/rg/api/event/RGRuleChangeEvent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
package dev.anvilcraft.rg.api.event; | ||
|
||
import dev.anvilcraft.rg.api.RGRule; | ||
import net.minecraft.server.MinecraftServer; | ||
import net.neoforged.bus.api.Event; | ||
import net.neoforged.bus.api.ICancellableEvent; | ||
|
||
public class RGRuleChangeEvent<T> extends Event implements ICancellableEvent { | ||
private final RGRule<T> rule; | ||
private final T oldValue; | ||
private T newValue; | ||
|
||
public RGRuleChangeEvent(RGRule<T> rule, T oldValue, T newValue) { | ||
this.rule = rule; | ||
this.oldValue = oldValue; | ||
this.newValue = newValue; | ||
} | ||
|
||
public RGRule<T> getRule() { | ||
return rule; | ||
} | ||
|
||
public T getNewValue() { | ||
return newValue; | ||
} | ||
|
||
public T getOldValue() { | ||
return oldValue; | ||
} | ||
|
||
public void setNewValue(T newValue) { | ||
this.newValue = newValue; | ||
} | ||
|
||
public static class Server<T> extends RGRuleChangeEvent<T> { | ||
private final MinecraftServer server; | ||
|
||
public Server(RGRule<T> rule, T oldValue, T newValue, MinecraftServer server) { | ||
super(rule, oldValue, newValue); | ||
this.server = server; | ||
} | ||
|
||
public MinecraftServer getServer() { | ||
return server; | ||
} | ||
} | ||
|
||
public static class Client<T> extends RGRuleChangeEvent<T> { | ||
public Client(RGRule<T> rule, T oldValue, T newValue) { | ||
super(rule, oldValue, newValue); | ||
} | ||
} | ||
} |
Oops, something went wrong.