Skip to content

Commit d3e4608

Browse files
Merge pull request #11 from v0ee/tpc-and-entities2
Tpc and teleporting with entities being ridden
2 parents 227e801 + 30fff8f commit d3e4608

8 files changed

Lines changed: 371 additions & 101 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
/build/
33
/run/
44
/.idea/
5+
/bin/

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,9 @@ Minecraft self-service teleport requests
1717
| `/tpa <NAME>` | `tpask` | Send request | `tpa.tpa` |
1818
| `/tpy <NAME>` | `tpaccept`, `tpyes` | Accept request | `tpa.tpy` |
1919
| `/tpn <NAME>` | `tpdeny`, `tpno` | Deny request | `tpa.tpn` |
20-
| `/tpi [<NAME>]` | `tpignore` | Ignore requests per player | `tpa.tpi` |
20+
| `/tpi <NAME>` | `tpignore` | Ignore requests per player | `tpa.tpi` |
2121
| `/tpt` | `tptoggle` | Ignore requests globally | `tpa.tpt` |
22+
| `/tpc <NAME>` | `tpcancel` | Cancel outgoing requests | `tpa.tpc` |
2223

2324
## Statistics
2425

src/main/java/lol/hub/hubtp/Config.java

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,13 @@ public final class Config {
1717
private static boolean movementCheck;
1818
private static boolean includeLeashed;
1919
private static boolean includeLeashedInterdimensional;
20+
private static boolean teleportMountedEntities;
2021
private static Path ignoresPath;
2122
private static boolean debug;
2223

2324
private static synchronized void assertInitialized() {
24-
if (!initialized) throw new IllegalStateException("Config access prior to initialization!");
25+
if (!initialized)
26+
throw new IllegalStateException("Config access prior to initialization!");
2527
}
2628

2729
public static synchronized void load(Plugin plugin) {
@@ -37,13 +39,13 @@ public static synchronized void load(Plugin plugin) {
3739
config.addDefault("movement-check", false);
3840
config.addDefault("include-leashed", true);
3941
config.addDefault("include-leashed-interdimensional", false);
42+
config.addDefault("teleport-mounted-entities", true);
4043
config.addDefault("ignores-path", Ignores.defaultPath.apply(plugin));
4144
config.addDefault("debug", false);
4245
config.addDefault("bStats", true);
4346
config.options().copyDefaults(true);
4447
plugin.saveConfig();
4548

46-
4749
allowMultiTargetRequest = config.getBoolean("allow-multi-target-request");
4850

4951
if (config.getInt("request-timeout-seconds") < 10) {
@@ -80,7 +82,9 @@ public static synchronized void load(Plugin plugin) {
8082

8183
includeLeashedInterdimensional = config.getBoolean("include-leashed-interdimensional");
8284

83-
//noinspection DataFlowIssue
85+
teleportMountedEntities = config.getBoolean("teleport-mounted-entities");
86+
87+
// noinspection DataFlowIssue
8488
if (config.getString("ignores-path") == null || config.getString("ignores-path").isBlank()) {
8589
config.set("ignores-path", Ignores.defaultPath.apply(plugin));
8690
plugin.saveConfig();
@@ -90,7 +94,7 @@ public static synchronized void load(Plugin plugin) {
9094
config.set("ignores-path", Ignores.defaultPath.apply(plugin));
9195
plugin.saveConfig();
9296
}
93-
//noinspection DataFlowIssue
97+
// noinspection DataFlowIssue
9498
ignoresPath = Path.of(config.getString("ignores-path"));
9599

96100
debug = config.getBoolean("debug");
@@ -148,6 +152,11 @@ public static boolean includeLeashedInterdimensional() {
148152
return includeLeashedInterdimensional;
149153
}
150154

155+
public static boolean teleportMountedEntities() {
156+
assertInitialized();
157+
return teleportMountedEntities;
158+
}
159+
151160
public static Path ignoresPath() {
152161
assertInitialized();
153162
return ignoresPath;

0 commit comments

Comments
 (0)