forked from SteamWar/SteamWar
Compare commits
227
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b2b803aca6 | ||
|
|
701964c2f2 | ||
|
|
6cbfc94e6d | ||
|
|
c0ff123279 | ||
|
|
5511a1f08e | ||
|
|
8c8da355bb | ||
|
|
7326ed4aa0 | ||
|
|
2d59eb81c7 | ||
|
|
711920464a | ||
|
|
117dbd08ae | ||
|
|
b36464e69e | ||
|
|
f5ac006c0c | ||
|
|
414bfbfe3c | ||
|
|
c362a3e1f0 | ||
|
|
2b43af8851 | ||
|
|
1590f8f0ee | ||
|
|
932732737d | ||
|
|
2bc164c1b0 | ||
|
|
aa66b3dc83 | ||
|
|
f5d9c6e175 | ||
|
|
36b31fac77 | ||
|
|
641cefad01 | ||
|
|
eb866125ea | ||
|
|
961331f029 | ||
|
|
786257ad0e | ||
|
|
e176b3bca8 | ||
|
|
f81f05c3d0 | ||
|
|
0afb6ce06a | ||
|
|
a938abde3f | ||
|
|
ec9b0387c5 | ||
|
|
03c3d49659 | ||
|
|
8d9a77ab67 | ||
|
|
fc2997e011 | ||
|
|
8eb5f5ddf2 | ||
|
|
aa807060f4 | ||
|
|
9bbbab9d4b | ||
|
|
7cca4ada10 | ||
|
|
725e6df047 | ||
|
|
f3ce124a23 | ||
|
|
e83f72a53e | ||
|
|
def0c19e43 | ||
|
|
3810ccd63d | ||
|
|
a018af1c8a | ||
|
|
fd8f942014 | ||
|
|
eab8826583 | ||
|
|
bc0177df43 | ||
|
|
1dc78b8eb8 | ||
|
|
a9fb982143 | ||
|
|
5b8d881e01 | ||
|
|
eb55f4b395 | ||
|
|
273db91d06 | ||
|
|
983ad544c1 | ||
|
|
a6a34b2221 | ||
|
|
6c6bd19038 | ||
|
|
89e05cd109 | ||
|
|
ea9d7ac584 | ||
|
|
17e1cf53b0 | ||
|
|
f64f337f17 | ||
|
|
c5f5be7d58 | ||
|
|
9f18644763 | ||
|
|
1de17d27f4 | ||
|
|
3cd0db9bdf | ||
|
|
9711b48f2f | ||
|
|
9934b8bbb2
|
||
|
|
6447265b90 | ||
|
|
71258318db | ||
|
|
52e95e2649 | ||
|
|
de6ac2cf20 | ||
|
|
628001e693 | ||
|
|
47c148d64a | ||
|
|
78617d5a98 | ||
|
|
69b924ded6 | ||
|
|
002f7e5542 | ||
|
|
5d70f75ac9 | ||
|
|
7f21a31ec9 | ||
|
|
23b5ab3e82 | ||
|
|
4f9fe07951 | ||
|
|
3bcff4c5ce | ||
|
|
1810cb7546 | ||
|
|
e55ca911c4 | ||
|
|
793f2de6c3 | ||
|
|
54fa47bd99 | ||
|
|
14a770b207 | ||
|
|
7b3a04f4eb | ||
|
|
f2a06057a8 | ||
|
|
e11f3f7cbc | ||
|
|
ebc10c1ce4 | ||
|
|
d682e35159 | ||
|
|
7d74eb0c09 | ||
|
|
7e18207b87 | ||
|
|
72b23ad116 | ||
|
|
c508627d92 | ||
|
|
93ff982649 | ||
|
|
21f6394359 | ||
|
|
29d0c8978c | ||
|
|
7366f83b15 | ||
|
|
9240bcfd5f | ||
|
|
bede8caa82 | ||
|
|
108aa2af9a | ||
|
|
d07a86c13f | ||
|
|
29106d5bb5 | ||
|
|
32fd4b4630 | ||
|
|
c241aef932 | ||
|
|
2db24ef2eb | ||
|
|
a2caa79f99 | ||
|
|
e49cfa9495 | ||
|
|
1f44b3169e | ||
|
|
49fafa5955 | ||
|
|
c81e6b15e5 | ||
|
|
dc0365834a | ||
|
|
13334e03a4 | ||
|
|
b35b2c0138 | ||
|
|
6ef311ce68 | ||
|
|
68d9c55525 | ||
|
|
dcd70c5ced | ||
|
|
a1d22b7d77 | ||
|
|
3b6fdbeec3 | ||
|
|
714f86a55b | ||
|
|
a177cc4faf | ||
|
|
09aa2ee22c | ||
|
|
b8499a7a8a | ||
|
|
e50bff3d38 | ||
|
|
8424f842c3 | ||
|
|
8f23f57415 | ||
|
|
3b65b93e73 | ||
|
|
4a458f0e92 | ||
|
|
5f5a98bcd6 | ||
|
|
72df919312 | ||
|
|
7ed36fe56e | ||
|
|
a7a8c4d051 | ||
|
|
5da3767378 | ||
|
|
53f98d4cd7 | ||
|
|
48fb6b5ed7 | ||
|
|
24d8ec7301 | ||
|
|
ba29e5cf23 | ||
|
|
a5992a9e4e | ||
|
|
e94eac9b9d
|
||
|
|
a000beee20 | ||
|
|
2fd6c40b15 | ||
|
|
32a2cbb4dd | ||
|
|
cf7a1ee086 | ||
|
|
8da7956523 | ||
|
|
9b821ff08f | ||
|
|
ae6f279dcf | ||
|
|
deb56c0c02 | ||
|
|
aead25650e | ||
|
|
53ada2de83 | ||
|
|
496cc3121c | ||
|
|
e9c766dbbb | ||
|
|
706f6ed743 | ||
|
|
270d82eb71 | ||
|
|
6da180136e | ||
|
|
463d8336a7 | ||
|
|
c241b9c264 | ||
|
|
b98273a7b2
|
||
|
|
bd28b133a2
|
||
|
|
5c618d03e8 | ||
|
|
89b8a3ea42 | ||
|
|
4198a08cda | ||
|
|
9f319128cc | ||
|
|
088d548d61 | ||
|
|
e435154c12 | ||
|
|
eceb58b28c | ||
|
|
5125453406 | ||
|
|
d110df924e | ||
|
|
81dd8045f2 | ||
|
|
245072f02c | ||
|
|
00147f2a74 | ||
|
|
fcc370c353 | ||
|
|
3bd1cf7167 | ||
|
|
cfa650bcf4 | ||
|
|
ba4ee08489 | ||
|
|
723a7dc0ca | ||
|
|
88de28ed68 | ||
|
|
6f1a3fe70c | ||
|
|
4a43e09a8b | ||
|
|
6fb018b86b | ||
|
|
ec310dfee9 | ||
|
|
9de5a93997 | ||
|
|
ce88e88859 | ||
|
|
5589c6cd20
|
||
|
|
35dead9c74 | ||
|
|
f1fbe14e60 | ||
|
|
b146c9928f | ||
|
|
136b0f5b97
|
||
|
|
2d679028c0
|
||
|
|
ce1f947f4b | ||
|
|
5fb51b63c3
|
||
|
|
c04dc8fd86
|
||
|
|
ab3970981d | ||
|
|
9e4c9ce04a | ||
|
|
44e37467d6
|
||
|
|
7c74ca014d
|
||
|
|
e7454f6ce8 | ||
|
|
a100d2d798 | ||
|
|
3c48e7c02d | ||
|
|
2b3c79fcab | ||
|
|
7ff778b60a | ||
|
|
b83476b451 | ||
|
|
58652cac5c | ||
|
|
b216438a47 | ||
|
|
604657a084 | ||
|
|
5a57b5f799 | ||
|
|
be233c65fe | ||
|
|
9f201f8191 | ||
|
|
55c1962294
|
||
|
|
441932b30a
|
||
|
|
bdecec304a | ||
|
|
75e3e77478 | ||
|
|
5c93ca6143
|
||
|
|
0452a9faa5 | ||
|
|
9a75f38226 | ||
|
|
6d24aa160f
|
||
|
|
105630bbd8
|
||
|
|
228ab5b2f2 | ||
|
|
42808f40c0 | ||
|
|
57c21122e6 | ||
|
|
42faba70d9 | ||
|
|
99e1f01869 | ||
|
|
13bddbe359 | ||
|
|
51ff0e1a9f | ||
|
|
6766862a00 | ||
|
|
c30aad179b | ||
|
|
d3aad6a198 | ||
|
|
744dc67ca9 | ||
|
|
164a7f5826 | ||
|
|
210cfcf3a6 |
@@ -41,7 +41,7 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
echo "$SW_MAVEN_CREDENTIALS" > steamwar.properties
|
echo "$SW_MAVEN_CREDENTIALS" > steamwar.properties
|
||||||
- name: Build with Gradle
|
- name: Build with Gradle
|
||||||
run: ./gradlew build --no-daemon
|
run: ./gradlew clean build --no-daemon --no-build-cache --refresh-dependencies
|
||||||
|
|
||||||
- name: Stage deploy artifacts
|
- name: Stage deploy artifacts
|
||||||
shell: bash
|
shell: bash
|
||||||
@@ -51,8 +51,8 @@ jobs:
|
|||||||
rm -rf deploy
|
rm -rf deploy
|
||||||
mkdir -p deploy
|
mkdir -p deploy
|
||||||
|
|
||||||
|
cp "AccessWidener/build/libs/AccessWidener-all.jar" "deploy/AccessWidener.jar"
|
||||||
cp "BauSystem/build/libs/BauSystem-all.jar" "deploy/BauSystem.jar"
|
cp "BauSystem/build/libs/BauSystem-all.jar" "deploy/BauSystem.jar"
|
||||||
cp "LegacyBauSystem/build/libs/LegacyBauSystem.jar" "deploy/BauSystem-1.12.jar"
|
|
||||||
cp "FightSystem/build/libs/FightSystem-all.jar" "deploy/FightSystem.jar"
|
cp "FightSystem/build/libs/FightSystem-all.jar" "deploy/FightSystem.jar"
|
||||||
cp "KotlinCore/build/libs/KotlinCore-all.jar" "deploy/KotlinCore.jar"
|
cp "KotlinCore/build/libs/KotlinCore-all.jar" "deploy/KotlinCore.jar"
|
||||||
cp "TNTLeague/build/libs/TNTLeague.jar" "deploy/TNTLeague.jar"
|
cp "TNTLeague/build/libs/TNTLeague.jar" "deploy/TNTLeague.jar"
|
||||||
@@ -130,7 +130,12 @@ jobs:
|
|||||||
ssh-keyscan -p "$port" "$DEPLOY_HOST" >> ~/.ssh/known_hosts
|
ssh-keyscan -p "$port" "$DEPLOY_HOST" >> ~/.ssh/known_hosts
|
||||||
|
|
||||||
ssh -i ~/.ssh/deploy_key -p "$port" "${DEPLOY_USER}@${DEPLOY_HOST}" "mkdir -p '$DEPLOY_PATH'"
|
ssh -i ~/.ssh/deploy_key -p "$port" "${DEPLOY_USER}@${DEPLOY_HOST}" "mkdir -p '$DEPLOY_PATH'"
|
||||||
scp -i ~/.ssh/deploy_key -P "$port" deploy/* "${DEPLOY_USER}@${DEPLOY_HOST}:$DEPLOY_PATH/"
|
ssh -i ~/.ssh/deploy_key -p "$port" "${DEPLOY_USER}@${DEPLOY_HOST}" "mkdir -p '$DEPLOY_PATH/upload'"
|
||||||
|
scp -i ~/.ssh/deploy_key -P "$port" deploy/* "${DEPLOY_USER}@${DEPLOY_HOST}:$DEPLOY_PATH/upload"
|
||||||
|
ssh -i ~/.ssh/deploy_key -p "$port" "${DEPLOY_USER}@${DEPLOY_HOST}" "rm -f '$DEPLOY_PATH'/*.jar '$DEPLOY_PATH'/*.zip"
|
||||||
|
ssh -i ~/.ssh/deploy_key -p "$port" "${DEPLOY_USER}@${DEPLOY_HOST}" "mv '$DEPLOY_PATH'/upload/* '$DEPLOY_PATH'"
|
||||||
|
ssh -i ~/.ssh/deploy_key -p "$port" "${DEPLOY_USER}@${DEPLOY_HOST}" "rm -r '$DEPLOY_PATH/upload'"
|
||||||
|
ssh -i ~/.ssh/deploy_key -p "$port" "${DEPLOY_USER}@${DEPLOY_HOST}" "chmod o-w '$DEPLOY_PATH'/*"
|
||||||
- name: Restart Services
|
- name: Restart Services
|
||||||
shell: bash
|
shell: bash
|
||||||
env:
|
env:
|
||||||
|
|||||||
+15
@@ -0,0 +1,15 @@
|
|||||||
|
<component name="ProjectRunConfigurationManager">
|
||||||
|
<configuration default="false" name="Remote JVM Debugger" type="Remote">
|
||||||
|
<option name="USE_SOCKET_TRANSPORT" value="true" />
|
||||||
|
<option name="SERVER_MODE" value="false" />
|
||||||
|
<option name="SHMEM_ADDRESS" />
|
||||||
|
<option name="HOST" value="localhost" />
|
||||||
|
<option name="PORT" value="5005" />
|
||||||
|
<option name="AUTO_RESTART" value="false" />
|
||||||
|
<RunnerSettings RunnerId="Debug">
|
||||||
|
<option name="DEBUG_PORT" value="5005" />
|
||||||
|
<option name="LOCAL" value="false" />
|
||||||
|
</RunnerSettings>
|
||||||
|
<method v="2" />
|
||||||
|
</configuration>
|
||||||
|
</component>
|
||||||
+22
-13
@@ -17,20 +17,29 @@
|
|||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package de.steamwar.bausystem.utils;
|
plugins {
|
||||||
|
`java-library`
|
||||||
import org.bukkit.event.Event;
|
alias(libs.plugins.shadow)
|
||||||
import org.bukkit.event.HandlerList;
|
|
||||||
|
|
||||||
public class TickStartEvent extends Event {
|
|
||||||
|
|
||||||
private static final HandlerList handlers = new HandlerList();
|
|
||||||
|
|
||||||
public HandlerList getHandlers() {
|
|
||||||
return handlers;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static HandlerList getHandlerList() {
|
dependencies {
|
||||||
return handlers;
|
implementation("org.ow2.asm:asm:9.7")
|
||||||
|
implementation("org.ow2.asm:asm-commons:9.7")
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.shadowJar {
|
||||||
|
manifest {
|
||||||
|
attributes(
|
||||||
|
"Manifest-Version" to "1.0",
|
||||||
|
"Build-Jdk-Spec" to "21",
|
||||||
|
"Main-Class" to "de.steamwar.Main",
|
||||||
|
"Premain-Class" to "de.steamwar.Agent",
|
||||||
|
"Can-Retransform-Classes" to "true",
|
||||||
|
"Can-Redefine-Classes" to "true",
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tasks.build {
|
||||||
|
dependsOn(tasks.shadowJar)
|
||||||
|
}
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
/*
|
||||||
|
* This file is a part of the SteamWar software.
|
||||||
|
*
|
||||||
|
* Copyright (C) 2026 SteamWar.de-Serverteam
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Affero General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package de.steamwar;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A single parsed line from a .accesswidener file.
|
||||||
|
* <p>
|
||||||
|
* Examples:
|
||||||
|
* accessible class net/minecraft/server/level/ServerPlayer
|
||||||
|
* accessible method net/minecraft/server/level/ServerPlayer getStats ()V
|
||||||
|
* mutable field net/minecraft/world/entity/Entity id I
|
||||||
|
* extendable class net/minecraft/world/level/chunk/LevelChunk
|
||||||
|
*/
|
||||||
|
public record AccessWidenerEntry(
|
||||||
|
/** accessible | mutable | extendable (may have "transitive-" prefix) */
|
||||||
|
String directive,
|
||||||
|
/** class | method | field */
|
||||||
|
String memberType,
|
||||||
|
/** Internal class name, e.g. net/minecraft/server/level/ServerPlayer */
|
||||||
|
String target,
|
||||||
|
/** Method/field name, null for class entries */
|
||||||
|
String name,
|
||||||
|
/** Descriptor, null for class entries */
|
||||||
|
String descriptor) {
|
||||||
|
/**
|
||||||
|
* Returns true if this entry targets the class with the given internal name.
|
||||||
|
*/
|
||||||
|
public boolean targets(String internalName) {
|
||||||
|
return target.equals(internalName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,104 @@
|
|||||||
|
/*
|
||||||
|
* This file is a part of the SteamWar software.
|
||||||
|
*
|
||||||
|
* Copyright (C) 2026 SteamWar.de-Serverteam
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Affero General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package de.steamwar;
|
||||||
|
|
||||||
|
import java.io.BufferedReader;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.io.InputStreamReader;
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parses Fabric-compatible .accesswidener files.
|
||||||
|
* <p>
|
||||||
|
* Supported format:
|
||||||
|
* <pre>
|
||||||
|
* accessWidener v2 named
|
||||||
|
*
|
||||||
|
* # comments are supported
|
||||||
|
* accessible class net/minecraft/Foo
|
||||||
|
* accessible method net/minecraft/Foo someMethod ()V
|
||||||
|
* accessible field net/minecraft/Foo someField I
|
||||||
|
* mutable field net/minecraft/Foo someField I
|
||||||
|
* extendable class net/minecraft/Foo
|
||||||
|
* extendable method net/minecraft/Foo someMethod ()V
|
||||||
|
*
|
||||||
|
* # transitive variants (expose widening to dependents)
|
||||||
|
* transitive-accessible class net/minecraft/Foo
|
||||||
|
* </pre>
|
||||||
|
*/
|
||||||
|
public final class AccessWidenerParser {
|
||||||
|
|
||||||
|
private AccessWidenerParser() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public static List<AccessWidenerEntry> parse(InputStream in) throws IOException {
|
||||||
|
List<AccessWidenerEntry> entries = new ArrayList<>();
|
||||||
|
|
||||||
|
try (BufferedReader reader = new BufferedReader(new InputStreamReader(in, StandardCharsets.UTF_8))) {
|
||||||
|
|
||||||
|
String line;
|
||||||
|
boolean headerSeen = false;
|
||||||
|
|
||||||
|
while ((line = reader.readLine()) != null) {
|
||||||
|
// Strip inline comments
|
||||||
|
int commentIdx = line.indexOf('#');
|
||||||
|
if (commentIdx >= 0) line = line.substring(0, commentIdx);
|
||||||
|
line = line.strip();
|
||||||
|
|
||||||
|
if (line.isEmpty()) continue;
|
||||||
|
|
||||||
|
if (!headerSeen) {
|
||||||
|
// First non-blank, non-comment line must be the header
|
||||||
|
if (!line.startsWith("accessWidener")) {
|
||||||
|
throw new IOException("Missing accessWidener header, got: " + line);
|
||||||
|
}
|
||||||
|
headerSeen = true;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
AccessWidenerEntry entry = parseLine(line);
|
||||||
|
if (entry != null) entries.add(entry);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return entries;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static AccessWidenerEntry parseLine(String line) {
|
||||||
|
String[] parts = line.split("\\s+");
|
||||||
|
if (parts.length < 3) return null;
|
||||||
|
|
||||||
|
String directive = parts[0]; // accessible / mutable / extendable / transitive-*
|
||||||
|
String memberType = parts[1]; // class / method / field
|
||||||
|
String target = parts[2]; // internal class name
|
||||||
|
|
||||||
|
return switch (memberType) {
|
||||||
|
case "class" -> new AccessWidenerEntry(directive, "class", target, null, null);
|
||||||
|
case "method", "field" -> {
|
||||||
|
if (parts.length < 5) yield null;
|
||||||
|
yield new AccessWidenerEntry(directive, memberType, target, parts[3], parts[4]);
|
||||||
|
}
|
||||||
|
default -> null;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,75 @@
|
|||||||
|
/*
|
||||||
|
* This file is a part of the SteamWar software.
|
||||||
|
*
|
||||||
|
* Copyright (C) 2026 SteamWar.de-Serverteam
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Affero General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package de.steamwar;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.lang.instrument.Instrumentation;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Java agent entry point.
|
||||||
|
* <p>
|
||||||
|
* At JVM startup: java -javaagent:paper-access-widener-agent.jar -jar server.jar
|
||||||
|
* <p>
|
||||||
|
* On attach the agent:
|
||||||
|
* <ol>
|
||||||
|
* <li>Find all .jar files inside the plugins folder</li>
|
||||||
|
* <li>Scan all found jars for *.accesswidener resources</li>
|
||||||
|
* <li>Transform any class during loading</li>
|
||||||
|
* </ol>
|
||||||
|
*/
|
||||||
|
public class Agent {
|
||||||
|
private Agent() {
|
||||||
|
throw new IllegalStateException("Utility class");
|
||||||
|
}
|
||||||
|
|
||||||
|
private static final Logger LOG = Logger.getLogger("AccessWidenerAgent");
|
||||||
|
|
||||||
|
// -javaagent: startup
|
||||||
|
public static void premain(String args, Instrumentation inst) {
|
||||||
|
init(inst);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void init(Instrumentation inst) {
|
||||||
|
LOG.info("[AccessWidener] Agent initialising.");
|
||||||
|
|
||||||
|
List<AccessWidenerEntry> entries = new ArrayList<>();
|
||||||
|
File file = new File(new File(".").getAbsoluteFile(), "plugins/");
|
||||||
|
File[] files = file.listFiles();
|
||||||
|
if (files == null) files = new File[0];
|
||||||
|
for (File jarFile : files) {
|
||||||
|
if (!jarFile.isFile()) continue;
|
||||||
|
if (!jarFile.getName().endsWith(".jar")) continue;
|
||||||
|
try {
|
||||||
|
entries.addAll(Utils.findAndParseAccessWideners(jarFile.toPath()));
|
||||||
|
} catch (IOException e) {
|
||||||
|
LOG.warning("Failed to parse access wideners from " + jarFile.getAbsolutePath());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
LOG.info("[AccessWidener] Loaded " + entries.size() + " access wideners.");
|
||||||
|
|
||||||
|
inst.addTransformer(new WideningTransformer(entries), false);
|
||||||
|
LOG.info("[AccessWidener] Agent ready.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,83 @@
|
|||||||
|
/*
|
||||||
|
* This file is a part of the SteamWar software.
|
||||||
|
*
|
||||||
|
* Copyright (C) 2026 SteamWar.de-Serverteam
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Affero General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package de.steamwar;
|
||||||
|
|
||||||
|
import org.objectweb.asm.ClassReader;
|
||||||
|
import org.objectweb.asm.ClassWriter;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Uses ASM to patch class bytecode according to a list of access widener entries.
|
||||||
|
*
|
||||||
|
* Returns {@code null} if the class is not targeted by any entry (no-op signal
|
||||||
|
* to the caller so it can skip the write).
|
||||||
|
*/
|
||||||
|
public class ClassPatcher {
|
||||||
|
|
||||||
|
private static final Logger LOG = Logger.getLogger("ClassPatcher");
|
||||||
|
|
||||||
|
private final List<AccessWidenerEntry> entries;
|
||||||
|
|
||||||
|
/** Pre-computed set of targeted internal names for fast filtering. */
|
||||||
|
private final Set<String> targets;
|
||||||
|
|
||||||
|
private final Set<String> targetsPublicConstructor;
|
||||||
|
|
||||||
|
public ClassPatcher(List<AccessWidenerEntry> entries) {
|
||||||
|
this.entries = entries;
|
||||||
|
this.targets = entries.stream()
|
||||||
|
.map(AccessWidenerEntry::target)
|
||||||
|
.flatMap(s -> {
|
||||||
|
if (!s.contains("$")) return Stream.of(s);
|
||||||
|
int index = s.lastIndexOf('$');
|
||||||
|
return Stream.of(s, s.substring(0, index));
|
||||||
|
})
|
||||||
|
.collect(Collectors.toSet());
|
||||||
|
this.targetsPublicConstructor = entries.stream()
|
||||||
|
.filter(entry -> entry.directive().equals("transitive-extendable"))
|
||||||
|
.map(AccessWidenerEntry::target)
|
||||||
|
.collect(Collectors.toSet());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Patches {@code classBytes} if {@code className} is targeted.
|
||||||
|
*
|
||||||
|
* @return patched bytes, or {@code null} if no changes were needed
|
||||||
|
*/
|
||||||
|
public byte[] patch(String className, byte[] classBytes) {
|
||||||
|
if (!targets.contains(className)) return null;
|
||||||
|
|
||||||
|
try {
|
||||||
|
ClassReader cr = new ClassReader(classBytes);
|
||||||
|
ClassWriter cw = new ClassWriter(cr, 0);
|
||||||
|
cr.accept(new ClassTransformer(cw, className, entries, targetsPublicConstructor.contains(className)), ClassReader.SKIP_CODE | ClassReader.SKIP_DEBUG | ClassReader.SKIP_FRAMES);
|
||||||
|
return cw.toByteArray();
|
||||||
|
} catch (Exception e) {
|
||||||
|
LOG.warning("[AccessWidener] Failed to transform " + className + ": " + e.getMessage());
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,125 @@
|
|||||||
|
/*
|
||||||
|
* This file is a part of the SteamWar software.
|
||||||
|
*
|
||||||
|
* Copyright (C) 2026 SteamWar.de-Serverteam
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Affero General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package de.steamwar;
|
||||||
|
|
||||||
|
import org.objectweb.asm.ClassVisitor;
|
||||||
|
import org.objectweb.asm.FieldVisitor;
|
||||||
|
import org.objectweb.asm.MethodVisitor;
|
||||||
|
import org.objectweb.asm.Opcodes;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class ClassTransformer extends ClassVisitor {
|
||||||
|
|
||||||
|
private final String internalName;
|
||||||
|
private final List<AccessWidenerEntry> entries;
|
||||||
|
private final boolean appendPublicConstructor;
|
||||||
|
|
||||||
|
public ClassTransformer(ClassVisitor cv, String internalName, List<AccessWidenerEntry> entries, boolean appendPublicConstructor) {
|
||||||
|
super(Opcodes.ASM9, cv);
|
||||||
|
this.internalName = internalName;
|
||||||
|
this.entries = entries;
|
||||||
|
this.appendPublicConstructor = appendPublicConstructor;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void visit(int version, int access, String name, String signature, String superName, String[] interfaces) {
|
||||||
|
int newAccess = access;
|
||||||
|
for (AccessWidenerEntry e : entries) {
|
||||||
|
if (!e.targets(internalName) || !"class".equals(e.memberType())) continue;
|
||||||
|
newAccess = applyDirective(e.directive(), newAccess, false);
|
||||||
|
}
|
||||||
|
if (appendPublicConstructor) {
|
||||||
|
MethodVisitor methodVisitor = visitMethod(Opcodes.ACC_PUBLIC, "<init>", "()V", null, null);
|
||||||
|
methodVisitor.visitCode();
|
||||||
|
methodVisitor.visitVarInsn(Opcodes.ALOAD, 0);
|
||||||
|
methodVisitor.visitMethodInsn(
|
||||||
|
Opcodes.INVOKESPECIAL,
|
||||||
|
"java/lang/Object",
|
||||||
|
"<init>",
|
||||||
|
"()V",
|
||||||
|
false
|
||||||
|
);
|
||||||
|
methodVisitor.visitInsn(Opcodes.RETURN);
|
||||||
|
methodVisitor.visitMaxs(1, 1);
|
||||||
|
methodVisitor.visitEnd();
|
||||||
|
}
|
||||||
|
super.visit(version, newAccess, name, signature, superName, interfaces);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void visitInnerClass(String name, String outerName, String innerName, int access) {
|
||||||
|
int newAccess = access;
|
||||||
|
for (AccessWidenerEntry e : entries) {
|
||||||
|
if (!e.target().equals(name) || !"class".equals(e.memberType())) continue;
|
||||||
|
newAccess = applyDirective(e.directive(), newAccess, false);
|
||||||
|
}
|
||||||
|
super.visitInnerClass(name, outerName, innerName, newAccess);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public MethodVisitor visitMethod(int access, String name, String descriptor, String signature, String[] exceptions) {
|
||||||
|
int newAccess = access;
|
||||||
|
for (AccessWidenerEntry e : entries) {
|
||||||
|
if (!e.targets(internalName) || !"method".equals(e.memberType())) continue;
|
||||||
|
if (!name.equals(e.name()) || !descriptor.equals(e.descriptor())) continue;
|
||||||
|
newAccess = applyDirective(e.directive(), newAccess, false);
|
||||||
|
}
|
||||||
|
return super.visitMethod(newAccess, name, descriptor, signature, exceptions);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public FieldVisitor visitField(int access, String name, String descriptor, String signature, Object value) {
|
||||||
|
int newAccess = access;
|
||||||
|
for (AccessWidenerEntry e : entries) {
|
||||||
|
if (!e.targets(internalName) || !"field".equals(e.memberType())) continue;
|
||||||
|
if (!name.equals(e.name())) continue;
|
||||||
|
newAccess = applyDirective(e.directive(), newAccess, true);
|
||||||
|
}
|
||||||
|
return super.visitField(newAccess, name, descriptor, signature, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Apply a directive to an access bitmask.
|
||||||
|
*
|
||||||
|
* @param directive accessible / mutable / extendable (with optional "transitive-" prefix)
|
||||||
|
* @param access current access flags
|
||||||
|
* @param isField true when processing a field (mutable removes final)
|
||||||
|
*/
|
||||||
|
private static int applyDirective(String directive, int access, boolean isField) {
|
||||||
|
// Strip transitive- prefix — the widening itself is the same
|
||||||
|
String effective = directive.startsWith("transitive-") ? directive.substring("transitive-".length()) : directive;
|
||||||
|
|
||||||
|
return switch (effective) {
|
||||||
|
case "accessible" -> makePublic(access);
|
||||||
|
case "extendable" -> makePublic(removeFinal(access));
|
||||||
|
case "mutable" -> isField ? removeFinal(access) : access;
|
||||||
|
default -> access;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
private static int makePublic(int access) {
|
||||||
|
return (access & ~(Opcodes.ACC_PRIVATE | Opcodes.ACC_PROTECTED)) | Opcodes.ACC_PUBLIC;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static int removeFinal(int access) {
|
||||||
|
return access & ~Opcodes.ACC_FINAL;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,125 @@
|
|||||||
|
/*
|
||||||
|
* This file is a part of the SteamWar software.
|
||||||
|
*
|
||||||
|
* Copyright (C) 2026 SteamWar.de-Serverteam
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Affero General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package de.steamwar;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.nio.file.*;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Command-line tool that produces a widened copy of a JAR for use as a
|
||||||
|
* compile-time stub in IntelliJ / Gradle.
|
||||||
|
*
|
||||||
|
* Usage:
|
||||||
|
* java -jar jar-widener.jar <input.jar> <output.jar> [file.accesswidener ...]
|
||||||
|
*
|
||||||
|
* The output JAR is identical to the input JAR except that every class
|
||||||
|
* targeted by the access widener entries has its access flags patched:
|
||||||
|
* accessible → public
|
||||||
|
* extendable → public + non-final
|
||||||
|
* mutable → non-final field
|
||||||
|
*
|
||||||
|
* Intended for use as a Gradle task so IntelliJ sees the already-widened
|
||||||
|
* class when you Ctrl+click NMS code, and javac compiles without complaints.
|
||||||
|
*/
|
||||||
|
public class Main {
|
||||||
|
|
||||||
|
public static void main(String[] args) throws Exception {
|
||||||
|
if (args.length < 2) {
|
||||||
|
System.err.println("Usage: jar-widener <input.jar> <output.jar> [*.accesswidener ...]");
|
||||||
|
System.exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
Path inputJar = Path.of(args[0]);
|
||||||
|
Path outputJar = Path.of(args[1]);
|
||||||
|
|
||||||
|
if (!Files.exists(inputJar)) {
|
||||||
|
System.err.println("Input JAR not found: " + inputJar);
|
||||||
|
System.exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
// --- Collect all access widener entries ---
|
||||||
|
List<AccessWidenerEntry> entries = new ArrayList<>();
|
||||||
|
|
||||||
|
if (args.length > 2) {
|
||||||
|
for (int i = 2; i < args.length; i++) {
|
||||||
|
Path awFile = Path.of(args[i]);
|
||||||
|
if (!Files.exists(awFile)) {
|
||||||
|
System.err.println("Warning: access widener file not found, skipping: " + awFile);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
try (InputStream in = Files.newInputStream(awFile)) {
|
||||||
|
List<AccessWidenerEntry> parsed = AccessWidenerParser.parse(in);
|
||||||
|
System.out.println("Loaded " + parsed.size() + " entries from " + awFile.getFileName());
|
||||||
|
entries.addAll(parsed);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (entries.isEmpty()) {
|
||||||
|
System.out.println("No access widener entries found — copying JAR unchanged.");
|
||||||
|
Files.createDirectories(outputJar.getParent());
|
||||||
|
Files.copy(inputJar, outputJar, StandardCopyOption.REPLACE_EXISTING);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
System.out.println("Widening " + inputJar.getFileName()
|
||||||
|
+ " with " + entries.size() + " total entr"
|
||||||
|
+ (entries.size() == 1 ? "y" : "ies") + "...");
|
||||||
|
|
||||||
|
// --- Copy input → output, transforming .class files in place ---
|
||||||
|
Files.createDirectories(outputJar.getParent());
|
||||||
|
Files.copy(inputJar, outputJar, StandardCopyOption.REPLACE_EXISTING);
|
||||||
|
|
||||||
|
ClassPatcher patcher = new ClassPatcher(entries);
|
||||||
|
|
||||||
|
try (FileSystem fs = FileSystems.newFileSystem(outputJar)) {
|
||||||
|
// Walk every .class entry in the JAR
|
||||||
|
try (var stream = Files.walk(fs.getPath("/"))) {
|
||||||
|
stream.filter(p -> p.toString().endsWith(".class"))
|
||||||
|
.forEach(classPath -> patchClass(fs, classPath, patcher));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
System.out.println("Done. Widened JAR written to " + outputJar);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void patchClass(FileSystem fs, Path classPath, ClassPatcher patcher) {
|
||||||
|
// Derive internal class name from path e.g. /net/minecraft/Foo.class → net/minecraft/Foo
|
||||||
|
String internalName = classPath.toString()
|
||||||
|
.replaceFirst("^/", "")
|
||||||
|
.replace(".class", "");
|
||||||
|
|
||||||
|
try {
|
||||||
|
byte[] original = Files.readAllBytes(classPath);
|
||||||
|
byte[] patched = patcher.patch(internalName, original);
|
||||||
|
|
||||||
|
if (patched != null) {
|
||||||
|
Files.write(classPath, patched);
|
||||||
|
System.out.println(" Widened: " + internalName);
|
||||||
|
}
|
||||||
|
} catch (IOException e) {
|
||||||
|
System.err.println(" Warning: failed to patch " + internalName + ": " + e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,60 @@
|
|||||||
|
/*
|
||||||
|
* This file is a part of the SteamWar software.
|
||||||
|
*
|
||||||
|
* Copyright (C) 2026 SteamWar.de-Serverteam
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Affero General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package de.steamwar;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.nio.file.Path;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Enumeration;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
import java.util.zip.ZipEntry;
|
||||||
|
import java.util.zip.ZipFile;
|
||||||
|
|
||||||
|
public class Utils {
|
||||||
|
|
||||||
|
private static final Logger LOG = Logger.getLogger("AccessWidenerAgent");
|
||||||
|
|
||||||
|
private Utils() {
|
||||||
|
throw new IllegalStateException("Utility class");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static List<AccessWidenerEntry> findAndParseAccessWideners(Path jarPath) throws IOException {
|
||||||
|
List<AccessWidenerEntry> results = new ArrayList<>();
|
||||||
|
|
||||||
|
try (ZipFile zip = new ZipFile(jarPath.toFile())) {
|
||||||
|
Enumeration<? extends ZipEntry> entries = zip.entries();
|
||||||
|
while (entries.hasMoreElements()) {
|
||||||
|
ZipEntry entry = entries.nextElement();
|
||||||
|
if (entry.isDirectory() || !entry.getName().endsWith(".accesswidener")) continue;
|
||||||
|
|
||||||
|
try (InputStream in = zip.getInputStream(entry)) {
|
||||||
|
results.addAll(AccessWidenerParser.parse(in));
|
||||||
|
} catch (IOException e) {
|
||||||
|
LOG.warning("[AccessWidener] Failed to parse " + entry.getName()
|
||||||
|
+ " in " + jarPath.getFileName() + ": " + e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
/*
|
||||||
|
* This file is a part of the SteamWar software.
|
||||||
|
*
|
||||||
|
* Copyright (C) 2026 SteamWar.de-Serverteam
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Affero General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package de.steamwar;
|
||||||
|
|
||||||
|
import java.lang.instrument.ClassFileTransformer;
|
||||||
|
import java.security.ProtectionDomain;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Transforms class bytecode to apply access widening rules.
|
||||||
|
* <p>
|
||||||
|
* Also monitors for new plugin ClassLoaders appearing (when plugins load after
|
||||||
|
* the agent attaches) and automatically picks up their .accesswidener files.
|
||||||
|
*/
|
||||||
|
public class WideningTransformer implements ClassFileTransformer {
|
||||||
|
|
||||||
|
private final ClassPatcher patcher;
|
||||||
|
|
||||||
|
public WideningTransformer(List<AccessWidenerEntry> entries) {
|
||||||
|
patcher = new ClassPatcher(entries);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public byte[] transform(ClassLoader loader, String className, Class<?> classBeingRedefined, ProtectionDomain protectionDomain, byte[] classfileBuffer) {
|
||||||
|
return patcher.patch(className, classfileBuffer);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -19,6 +19,7 @@
|
|||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
steamwar.java
|
steamwar.java
|
||||||
|
widener
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.compileJava {
|
tasks.compileJava {
|
||||||
@@ -38,11 +39,16 @@ dependencies {
|
|||||||
compileOnly(libs.axiom)
|
compileOnly(libs.axiom)
|
||||||
compileOnly(libs.authlib)
|
compileOnly(libs.authlib)
|
||||||
|
|
||||||
compileOnly(libs.paperapi21)
|
compileOnly(libs.paperapi)
|
||||||
compileOnly(libs.nms21)
|
compileOnly(libs.nms)
|
||||||
|
|
||||||
compileOnly(libs.fawe18)
|
compileOnly(libs.fawe)
|
||||||
|
compileOnly(libs.netty)
|
||||||
|
|
||||||
implementation(libs.luaj)
|
implementation(libs.luaj)
|
||||||
implementation(files("$projectDir/../libs/YAPION-SNAPSHOT.jar"))
|
implementation(files("$projectDir/../libs/YAPION-SNAPSHOT.jar"))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
widener {
|
||||||
|
fromCatalog(libs.nms)
|
||||||
|
}
|
||||||
|
|||||||
@@ -834,6 +834,10 @@ SKIN_NO_REGION=§7You are not in a region with a changealbe skin
|
|||||||
SKIN_ALREADY_EXISTS = §cThis skin already exists like this
|
SKIN_ALREADY_EXISTS = §cThis skin already exists like this
|
||||||
SKIN_MESSAGE = §7Skin created
|
SKIN_MESSAGE = §7Skin created
|
||||||
SKIN_MESSAGE_HOVER = §eClick to copy for YoyoNow and send
|
SKIN_MESSAGE_HOVER = §eClick to copy for YoyoNow and send
|
||||||
|
# Blast Resistance
|
||||||
|
BLASTRESISTANCE_HELP = §8/§eblastresistance §8-§7 Calculate min/max and average blast resistance of current clipboard
|
||||||
|
BLASTRESISTANCE_NO_CLIPBOARD = §cYou currently do not have a clipboard to be used.
|
||||||
|
BLASTRESISTANCE_RESULT = §7BlastResistance §8>>§7 Min§8: §e{0}§7 Max§8: §e{1}§7 Avg§8: §e{2}
|
||||||
# Panzern
|
# Panzern
|
||||||
PANZERN_HELP = §8/§epanzern §8[§7Block§8] §8[§7Slab§8] §8- §7Armor your WorldEdit selection
|
PANZERN_HELP = §8/§epanzern §8[§7Block§8] §8[§7Slab§8] §8- §7Armor your WorldEdit selection
|
||||||
PANZERN_PREPARE1 = §71. Check, if barrels reach until border of armor.
|
PANZERN_PREPARE1 = §71. Check, if barrels reach until border of armor.
|
||||||
|
|||||||
@@ -772,6 +772,10 @@ SKIN_NO_REGION=§7Du steht in keiner Region, welche mit einem Skin versehen werd
|
|||||||
SKIN_ALREADY_EXISTS = §cDieser Skin existiert in der Form bereits
|
SKIN_ALREADY_EXISTS = §cDieser Skin existiert in der Form bereits
|
||||||
SKIN_MESSAGE = §7Skin erstellt
|
SKIN_MESSAGE = §7Skin erstellt
|
||||||
SKIN_MESSAGE_HOVER = §eKlicken zum kopieren für YoyoNow und an diesen senden
|
SKIN_MESSAGE_HOVER = §eKlicken zum kopieren für YoyoNow und an diesen senden
|
||||||
|
# Blast Resistance
|
||||||
|
BLASTRESISTANCE_HELP = §8/§eblastresistance §8-§7 Minimal-, Maximal- und durchschnittliche Sprengfestigkeit des aktuellen Inhalts der Zwischenablage berechnen
|
||||||
|
BLASTRESISTANCE_NO_CLIPBOARD = §cDerzeit steht Ihnen keine Zwischenablage zur Verfügung.
|
||||||
|
BLASTRESISTANCE_RESULT = §7BlastResistance §8>>§7 Min§8: §e{0}§7 Max§8: §e{1}§7 Avg§8: §e{2}
|
||||||
# Panzern
|
# Panzern
|
||||||
PANZERN_HELP = §8/§epanzern §8[§7Block§8] §8[§7Slab§8] §8- §7Panzer deine WorldEdit Auswahl
|
PANZERN_HELP = §8/§epanzern §8[§7Block§8] §8[§7Slab§8] §8- §7Panzer deine WorldEdit Auswahl
|
||||||
PANZERN_PREPARE1 = §71. Gucke nochmal nach, ob Läufe auch bis zur Panzergrenze führen.
|
PANZERN_PREPARE1 = §71. Gucke nochmal nach, ob Läufe auch bis zur Panzergrenze führen.
|
||||||
|
|||||||
@@ -0,0 +1,13 @@
|
|||||||
|
accessWidener v2 named
|
||||||
|
|
||||||
|
# For NoClipCommand
|
||||||
|
accessible field net/minecraft/server/level/ServerPlayerGameMode gameModeForPlayer Lnet/minecraft/world/level/GameType;
|
||||||
|
|
||||||
|
# For PlaceItemUtils
|
||||||
|
accessible field org/bukkit/craftbukkit/block/CraftBlockState position Lnet/minecraft/core/BlockPos;
|
||||||
|
mutable field org/bukkit/craftbukkit/block/CraftBlockState position Lnet/minecraft/core/BlockPos;
|
||||||
|
accessible field org/bukkit/craftbukkit/block/CraftBlockState world Lorg/bukkit/craftbukkit/CraftWorld;
|
||||||
|
mutable field org/bukkit/craftbukkit/block/CraftBlockState world Lorg/bukkit/craftbukkit/CraftWorld;
|
||||||
|
|
||||||
|
# For TickManager
|
||||||
|
accessible field net/minecraft/server/ServerTickRateManager remainingSprintTicks J
|
||||||
@@ -25,7 +25,6 @@ import de.steamwar.bausystem.configplayer.ConfigConverter;
|
|||||||
import de.steamwar.bausystem.features.gui.BauGUI;
|
import de.steamwar.bausystem.features.gui.BauGUI;
|
||||||
import de.steamwar.bausystem.features.script.lua.SteamWarLuaPlugin;
|
import de.steamwar.bausystem.features.script.lua.SteamWarLuaPlugin;
|
||||||
import de.steamwar.bausystem.features.script.lua.libs.LuaLib;
|
import de.steamwar.bausystem.features.script.lua.libs.LuaLib;
|
||||||
import de.steamwar.bausystem.features.slaves.laufbau.BoundingBoxLoader;
|
|
||||||
import de.steamwar.bausystem.features.slaves.panzern.Panzern;
|
import de.steamwar.bausystem.features.slaves.panzern.Panzern;
|
||||||
import de.steamwar.bausystem.features.slaves.panzern.PanzernAlgorithm;
|
import de.steamwar.bausystem.features.slaves.panzern.PanzernAlgorithm;
|
||||||
import de.steamwar.bausystem.features.tracer.TraceManager;
|
import de.steamwar.bausystem.features.tracer.TraceManager;
|
||||||
@@ -112,9 +111,6 @@ public class BauSystem extends JavaPlugin implements Listener {
|
|||||||
if (any instanceof ConfigConverter) {
|
if (any instanceof ConfigConverter) {
|
||||||
Config.addConfigConverter((ConfigConverter) any);
|
Config.addConfigConverter((ConfigConverter) any);
|
||||||
}
|
}
|
||||||
if (any instanceof BoundingBoxLoader) {
|
|
||||||
((BoundingBoxLoader) any).load();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
try {
|
try {
|
||||||
|
|||||||
+12
-4
@@ -76,13 +76,21 @@ public class AttributesCopyCommand extends SWCommand {
|
|||||||
if (itemStack.getType() == Material.ZOMBIE_HEAD && block.getType() == Material.ZOMBIE_WALL_HEAD) return true;
|
if (itemStack.getType() == Material.ZOMBIE_HEAD && block.getType() == Material.ZOMBIE_WALL_HEAD) return true;
|
||||||
if (itemStack.getType() == Material.CREEPER_HEAD && block.getType() == Material.CREEPER_WALL_HEAD) return true;
|
if (itemStack.getType() == Material.CREEPER_HEAD && block.getType() == Material.CREEPER_WALL_HEAD) return true;
|
||||||
if (itemStack.getType() == Material.DRAGON_HEAD && block.getType() == Material.DRAGON_WALL_HEAD) return true;
|
if (itemStack.getType() == Material.DRAGON_HEAD && block.getType() == Material.DRAGON_WALL_HEAD) return true;
|
||||||
if (itemStack.getType() == Material.SKELETON_SKULL && block.getType() == Material.SKELETON_WALL_SKULL) return true;
|
if (itemStack.getType() == Material.SKELETON_SKULL && block.getType() == Material.SKELETON_WALL_SKULL) {
|
||||||
if (itemStack.getType() == Material.WITHER_SKELETON_SKULL && block.getType() == Material.WITHER_SKELETON_WALL_SKULL) return true;
|
return true;
|
||||||
|
}
|
||||||
|
if (itemStack.getType() == Material.WITHER_SKELETON_SKULL && block.getType() == Material.WITHER_SKELETON_WALL_SKULL) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
if (itemStack.getType() == Material.TORCH && block.getType() == Material.WALL_TORCH) return true;
|
if (itemStack.getType() == Material.TORCH && block.getType() == Material.WALL_TORCH) return true;
|
||||||
if (itemStack.getType() == Material.SOUL_TORCH && block.getType() == Material.SOUL_WALL_TORCH) return true;
|
if (itemStack.getType() == Material.SOUL_TORCH && block.getType() == Material.SOUL_WALL_TORCH) return true;
|
||||||
if (itemStack.getType() == Material.REDSTONE_TORCH && block.getType() == Material.REDSTONE_WALL_TORCH) return true;
|
if (itemStack.getType() == Material.REDSTONE_TORCH && block.getType() == Material.REDSTONE_WALL_TORCH) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
if (itemStack.getType() == Material.WHEAT_SEEDS && block.getType() == Material.WHEAT) return true;
|
if (itemStack.getType() == Material.WHEAT_SEEDS && block.getType() == Material.WHEAT) return true;
|
||||||
if (itemStack.getType().name().contains("_BANNER") && block.getType().name().contains("_WALL_BANNER")) return true;
|
if (itemStack.getType().name().contains("_BANNER") && block.getType().name().contains("_WALL_BANNER")) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-1
@@ -104,7 +104,8 @@ public class BackupCommand extends SWCommand {
|
|||||||
List<String> lore = Arrays.asList(BauSystem.MESSAGE.parse("BACKUP_LORE", p));
|
List<String> lore = Arrays.asList(BauSystem.MESSAGE.parse("BACKUP_LORE", p));
|
||||||
for (int i = 0; i < backups.size(); i++) {
|
for (int i = 0; i < backups.size(); i++) {
|
||||||
RegionBackups.Backup backup = backups.get(i);
|
RegionBackups.Backup backup = backups.get(i);
|
||||||
SWItem swItem = new SWItem(Material.BRICK, BauSystem.MESSAGE.parse("BACKUP_ITEM_NAME", p, backup.getName()), lore, false, clickType -> {});
|
SWItem swItem = new SWItem(Material.BRICK, BauSystem.MESSAGE.parse("BACKUP_ITEM_NAME", p, backup.getName()), lore, false, clickType -> {
|
||||||
|
});
|
||||||
swItem.getItemStack().setAmount(i + 1);
|
swItem.getItemStack().setAmount(i + 1);
|
||||||
swListEntries.add(new SWListInv.SWListEntry<>(swItem, backup));
|
swListEntries.add(new SWListInv.SWListEntry<>(swItem, backup));
|
||||||
}
|
}
|
||||||
|
|||||||
+11
-10
@@ -21,9 +21,7 @@ package de.steamwar.bausystem.features.design.endstone;
|
|||||||
|
|
||||||
import de.steamwar.bausystem.BauSystem;
|
import de.steamwar.bausystem.BauSystem;
|
||||||
import de.steamwar.bausystem.region.Region;
|
import de.steamwar.bausystem.region.Region;
|
||||||
import de.steamwar.entity.REntity;
|
import de.steamwar.entity.*;
|
||||||
import de.steamwar.entity.REntityServer;
|
|
||||||
import de.steamwar.entity.RFallingBlockEntity;
|
|
||||||
import net.md_5.bungee.api.ChatMessageType;
|
import net.md_5.bungee.api.ChatMessageType;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
@@ -59,15 +57,15 @@ public class DesignEndStone {
|
|||||||
.filter(material -> material.getBlastResistance() > region.getGameModeConfig().Schematic.MaxDesignBlastResistance)
|
.filter(material -> material.getBlastResistance() > region.getGameModeConfig().Schematic.MaxDesignBlastResistance)
|
||||||
.collect(Collectors.toSet());
|
.collect(Collectors.toSet());
|
||||||
calculateFromBottom = region.getGameModeConfig().Arena.NoFloor;
|
calculateFromBottom = region.getGameModeConfig().Arena.NoFloor;
|
||||||
|
}
|
||||||
|
|
||||||
entityServer.setCallback((player, rEntity, entityAction) -> {
|
private void interact(Player player, RInteraction entity, REntityAction action) {
|
||||||
if (entityAction != REntityServer.EntityAction.ATTACK) return;
|
if (action != REntityAction.ATTACK) return;
|
||||||
Location location = new Location(WORLD, rEntity.getX(), rEntity.getY(), rEntity.getZ());
|
Location location = new Location(WORLD, entity.getX(), entity.getY(), entity.getZ());
|
||||||
Bukkit.getScheduler().runTaskLater(BauSystem.getInstance(), () -> {
|
Bukkit.getScheduler().runTaskLater(BauSystem.getInstance(), () -> {
|
||||||
location.getBlock().breakNaturally();
|
location.getBlock().breakNaturally();
|
||||||
calc();
|
calc();
|
||||||
}, 1);
|
}, 1);
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void calc() {
|
public void calc() {
|
||||||
@@ -110,12 +108,15 @@ public class DesignEndStone {
|
|||||||
Material material = WORLD.getBlockAt(cx, cy, cz).getType();
|
Material material = WORLD.getBlockAt(cx, cy, cz).getType();
|
||||||
|
|
||||||
if (material != Material.WATER && material != Material.LAVA && limited.contains(material)) {
|
if (material != Material.WATER && material != Material.LAVA && limited.contains(material)) {
|
||||||
Location location = new Location(WORLD, cx + 0.5, cy, cz + 0.5);
|
Location location = new Location(WORLD, cx, cy, cz);
|
||||||
if (!locations.add(location)) break;
|
if (!locations.add(location)) break;
|
||||||
RFallingBlockEntity entity = new RFallingBlockEntity(entityServer, location, Material.RED_STAINED_GLASS);
|
RBlockDisplay entity = new RBlockDisplay(entityServer, location);
|
||||||
entity.setNoGravity(true);
|
entity.setBlock(Material.RED_STAINED_GLASS.createBlockData());
|
||||||
entity.setGlowing(true);
|
entity.setGlowing(true);
|
||||||
entities.add(entity);
|
entities.add(entity);
|
||||||
|
RInteraction interaction = new RInteraction(entityServer, location);
|
||||||
|
interaction.setCallback(this::interact);
|
||||||
|
entities.add(interaction);
|
||||||
break;
|
break;
|
||||||
} else if (!material.isAir() && material != Material.WATER && material != Material.LAVA) {
|
} else if (!material.isAir() && material != Material.WATER && material != Material.LAVA) {
|
||||||
break;
|
break;
|
||||||
|
|||||||
+10
-9
@@ -26,8 +26,9 @@ import de.steamwar.bausystem.features.autostart.AutostartListener;
|
|||||||
import de.steamwar.bausystem.features.detonator.storage.DetonatorStorage;
|
import de.steamwar.bausystem.features.detonator.storage.DetonatorStorage;
|
||||||
import de.steamwar.bausystem.features.detonator.storage.ItemStorage;
|
import de.steamwar.bausystem.features.detonator.storage.ItemStorage;
|
||||||
import de.steamwar.core.SWPlayer;
|
import de.steamwar.core.SWPlayer;
|
||||||
|
import de.steamwar.entity.RBlockDisplay;
|
||||||
import de.steamwar.entity.REntityServer;
|
import de.steamwar.entity.REntityServer;
|
||||||
import de.steamwar.entity.RFallingBlockEntity;
|
import de.steamwar.entity.RInteraction;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
import lombok.experimental.UtilityClass;
|
import lombok.experimental.UtilityClass;
|
||||||
@@ -58,10 +59,6 @@ public class Detonator {
|
|||||||
@Override
|
@Override
|
||||||
public void onMount(SWPlayer player) {
|
public void onMount(SWPlayer player) {
|
||||||
entities.addPlayer(player.getPlayer());
|
entities.addPlayer(player.getPlayer());
|
||||||
entities.setCallback((player1, entity, action) -> {
|
|
||||||
Vector vector = new Vector(entity.getX(), entity.getY(), entity.getZ());
|
|
||||||
DetonatorListener.addLocationToDetonator(vector.toLocation(player.getWorld()).getBlock().getLocation(), player1);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -70,8 +67,6 @@ public class Detonator {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final Vector HALF = new Vector(0.5, 0, 0.5);
|
|
||||||
|
|
||||||
public static boolean isDetonator(ItemStack itemStack) {
|
public static boolean isDetonator(ItemStack itemStack) {
|
||||||
return ItemStorage.isDetonator(itemStack);
|
return ItemStorage.isDetonator(itemStack);
|
||||||
}
|
}
|
||||||
@@ -79,8 +74,14 @@ public class Detonator {
|
|||||||
public static void showDetonator(Player p, List<Location> locs) {
|
public static void showDetonator(Player p, List<Location> locs) {
|
||||||
DetonatorComponent detonatorComponent = SWPlayer.of(p).getComponentOrDefault(DetonatorComponent.class, DetonatorComponent::new);
|
DetonatorComponent detonatorComponent = SWPlayer.of(p).getComponentOrDefault(DetonatorComponent.class, DetonatorComponent::new);
|
||||||
locs.forEach(location -> {
|
locs.forEach(location -> {
|
||||||
RFallingBlockEntity entity = new RFallingBlockEntity(detonatorComponent.entities, location.clone().add(HALF), Material.RED_STAINED_GLASS);
|
RBlockDisplay blockDisplay = new RBlockDisplay(detonatorComponent.entities, location);
|
||||||
entity.setNoGravity(true);
|
blockDisplay.setBlock(Material.RED_STAINED_GLASS.createBlockData());
|
||||||
|
|
||||||
|
RInteraction interaction = new RInteraction(detonatorComponent.entities, location);
|
||||||
|
interaction.setCallback((player, entity, action) -> {
|
||||||
|
Vector vector = new Vector(entity.getX(), entity.getY(), entity.getZ());
|
||||||
|
DetonatorListener.addLocationToDetonator(vector.toLocation(player.getWorld()).getBlock().getLocation(), player);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+10
-10
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* This file is a part of the SteamWar software.
|
* This file is a part of the SteamWar software.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2025 SteamWar.de-Serverteam
|
* Copyright (C) 2026 SteamWar.de-Serverteam
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU Affero General Public License as published by
|
* it under the terms of the GNU Affero General Public License as published by
|
||||||
@@ -17,15 +17,15 @@
|
|||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package de.steamwar.linkage;
|
package de.steamwar.bausystem.features.experimental;
|
||||||
|
|
||||||
import java.lang.annotation.ElementType;
|
import de.steamwar.command.SWCommand;
|
||||||
import java.lang.annotation.Retention;
|
import de.steamwar.linkage.Linked;
|
||||||
import java.lang.annotation.RetentionPolicy;
|
|
||||||
import java.lang.annotation.Target;
|
|
||||||
|
|
||||||
@Retention(RetentionPolicy.RUNTIME)
|
@Linked
|
||||||
@Target({ElementType.TYPE})
|
public class ExperimentalCommand extends SWCommand {
|
||||||
public @interface MinVersion {
|
|
||||||
int value();
|
public ExperimentalCommand() {
|
||||||
|
super("experimental", "experiment");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
+135
@@ -0,0 +1,135 @@
|
|||||||
|
/*
|
||||||
|
* This file is a part of the SteamWar software.
|
||||||
|
*
|
||||||
|
* Copyright (C) 2026 SteamWar.de-Serverteam
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Affero General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package de.steamwar.bausystem.features.experimental.redstone_engine;
|
||||||
|
|
||||||
|
import de.steamwar.bausystem.features.experimental.ExperimentalCommand;
|
||||||
|
import de.steamwar.bausystem.region.Region;
|
||||||
|
import de.steamwar.bausystem.utils.ScoreboardElement;
|
||||||
|
import de.steamwar.command.AbstractSWCommand;
|
||||||
|
import de.steamwar.command.SWCommand;
|
||||||
|
import de.steamwar.linkage.Linked;
|
||||||
|
import io.papermc.paper.configuration.WorldConfiguration;
|
||||||
|
import net.kyori.adventure.text.Component;
|
||||||
|
import net.kyori.adventure.text.format.NamedTextColor;
|
||||||
|
import net.kyori.adventure.title.TitlePart;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.craftbukkit.CraftWorld;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.Listener;
|
||||||
|
import org.bukkit.event.player.PlayerJoinEvent;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@AbstractSWCommand.PartOf(ExperimentalCommand.class)
|
||||||
|
@Linked
|
||||||
|
public class RedstoneEngine extends SWCommand implements Listener, ScoreboardElement {
|
||||||
|
|
||||||
|
public RedstoneEngine() {
|
||||||
|
super("");
|
||||||
|
}
|
||||||
|
|
||||||
|
private WorldConfiguration.Misc getConfig() {
|
||||||
|
return ((CraftWorld) Bukkit.getWorlds().get(0)).getHandle().paperConfig().misc;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Register("redstone")
|
||||||
|
@Register("redstoneengine")
|
||||||
|
public void setRedstoneEngine(Player player, @StaticValue("alternate_current") String __, WorldConfiguration.Misc.AlternateCurrentUpdateOrder updateOrder) {
|
||||||
|
WorldConfiguration.Misc misc = getConfig();
|
||||||
|
misc.redstoneImplementation = WorldConfiguration.Misc.RedstoneImplementation.ALTERNATE_CURRENT;
|
||||||
|
misc.alternateCurrentUpdateOrder = updateOrder;
|
||||||
|
broadcastTitle(Bukkit.getOnlinePlayers());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Register("redstone")
|
||||||
|
@Register("redstoneengine")
|
||||||
|
public void setRedstoneEngine(Player player, WorldConfiguration.Misc.RedstoneImplementation implementation) {
|
||||||
|
getConfig().redstoneImplementation = implementation;
|
||||||
|
broadcastTitle(Bukkit.getOnlinePlayers());
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onPlayerJoin(PlayerJoinEvent event) {
|
||||||
|
WorldConfiguration.Misc misc = getConfig();
|
||||||
|
if (misc.redstoneImplementation != WorldConfiguration.Misc.RedstoneImplementation.EIGENCRAFT) {
|
||||||
|
broadcastTitle(List.of(event.getPlayer()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void broadcastTitle(Collection<? extends Player> players) {
|
||||||
|
WorldConfiguration.Misc misc = getConfig();
|
||||||
|
Component title = switch (misc.redstoneImplementation) {
|
||||||
|
case VANILLA -> Component.text("⚠").color(NamedTextColor.RED).append(Component.text(" Redstone: Vanilla ").color(NamedTextColor.WHITE)).append(Component.text("⚠").color(NamedTextColor.RED));
|
||||||
|
case EIGENCRAFT -> Component.text("Redstone: Eigencraft");
|
||||||
|
case ALTERNATE_CURRENT -> Component.text("⚠").color(NamedTextColor.RED).append(Component.text(" Redstone: AC ").color(NamedTextColor.WHITE)).append(Component.text("⚠").color(NamedTextColor.RED));
|
||||||
|
};
|
||||||
|
Component subtitle;
|
||||||
|
if (misc.redstoneImplementation != WorldConfiguration.Misc.RedstoneImplementation.ALTERNATE_CURRENT) {
|
||||||
|
subtitle = Component.text().build();
|
||||||
|
} else {
|
||||||
|
subtitle = switch (misc.alternateCurrentUpdateOrder) {
|
||||||
|
case VERTICAL_FIRST_INWARD -> Component.text("Y first inwards"); // Y before XZ
|
||||||
|
case VERTICAL_FIRST_OUTWARD -> Component.text("Y first outwards"); // XZ before Y
|
||||||
|
case HORIZONTAL_FIRST_INWARD -> Component.text("XZ first inwards"); // Y before XZ
|
||||||
|
case HORIZONTAL_FIRST_OUTWARD -> Component.text("XZ first outwards"); // XZ before Y
|
||||||
|
};
|
||||||
|
}
|
||||||
|
players.forEach(player -> {
|
||||||
|
player.sendTitlePart(TitlePart.TITLE, title);
|
||||||
|
player.sendTitlePart(TitlePart.SUBTITLE, subtitle);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ScoreboardGroup getGroup() {
|
||||||
|
return ScoreboardGroup.FOOTER;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int order() {
|
||||||
|
return Integer.MAX_VALUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String get(Region region, Player p) {
|
||||||
|
WorldConfiguration.Misc misc = getConfig();
|
||||||
|
switch (misc.redstoneImplementation) {
|
||||||
|
case ALTERNATE_CURRENT:
|
||||||
|
switch (misc.alternateCurrentUpdateOrder) {
|
||||||
|
case VERTICAL_FIRST_INWARD:
|
||||||
|
return "§eRedstone§8: §cAC §8(§7Y in§8)";
|
||||||
|
case VERTICAL_FIRST_OUTWARD:
|
||||||
|
return "§eRedstone§8: §cAC §8(§7Y out§8)";
|
||||||
|
case HORIZONTAL_FIRST_INWARD:
|
||||||
|
return "§eRedstone§8: §cAC §8(§7XZ in§8)";
|
||||||
|
case HORIZONTAL_FIRST_OUTWARD:
|
||||||
|
return "§eRedstone§8: §cAC §8(§7XZ out§8)";
|
||||||
|
}
|
||||||
|
return "§eRedstone§8: §cAC";
|
||||||
|
case EIGENCRAFT:
|
||||||
|
return null;
|
||||||
|
case VANILLA:
|
||||||
|
default:
|
||||||
|
return "§eRedstone§8: §cVanilla";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+1
-2
@@ -22,7 +22,6 @@ package de.steamwar.bausystem.features.gui.editor;
|
|||||||
import de.steamwar.bausystem.BauSystem;
|
import de.steamwar.bausystem.BauSystem;
|
||||||
import de.steamwar.bausystem.features.gui.BauGUI;
|
import de.steamwar.bausystem.features.gui.BauGUI;
|
||||||
import de.steamwar.bausystem.linkage.BauGuiItem;
|
import de.steamwar.bausystem.linkage.BauGuiItem;
|
||||||
import de.steamwar.core.TrickyTrialsWrapper;
|
|
||||||
import de.steamwar.data.CMDs;
|
import de.steamwar.data.CMDs;
|
||||||
import de.steamwar.inventory.SWItem;
|
import de.steamwar.inventory.SWItem;
|
||||||
import de.steamwar.inventory.SWListInv;
|
import de.steamwar.inventory.SWListInv;
|
||||||
@@ -74,7 +73,7 @@ public class BauGuiEditor implements Listener {
|
|||||||
|
|
||||||
inv.setItem(mapping.getSize() + 5, new SWItem(Material.BARRIER, BauSystem.MESSAGE.parse("GUI_EDITOR_ITEM_TRASH", p), Arrays.asList(BauSystem.MESSAGE.parse("GUI_EDITOR_ITEM_TRASH_LORE", p)), false, clickType -> {
|
inv.setItem(mapping.getSize() + 5, new SWItem(Material.BARRIER, BauSystem.MESSAGE.parse("GUI_EDITOR_ITEM_TRASH", p), Arrays.asList(BauSystem.MESSAGE.parse("GUI_EDITOR_ITEM_TRASH_LORE", p)), false, clickType -> {
|
||||||
}).getItemStack());
|
}).getItemStack());
|
||||||
inv.setItem(mapping.getSize() + 6, new SWItem(TrickyTrialsWrapper.impl.getTurtleScute(), BauSystem.MESSAGE.parse("GUI_EDITOR_ITEM_MORE", p)).getItemStack());
|
inv.setItem(mapping.getSize() + 6, new SWItem(Material.TURTLE_SCUTE, BauSystem.MESSAGE.parse("GUI_EDITOR_ITEM_MORE", p)).getItemStack());
|
||||||
inv.setItem(mapping.getSize() + 8, new SWItem(Material.ARROW, BauSystem.MESSAGE.parse("GUI_EDITOR_ITEM_CLOSE", p)).setCustomModelData(CMDs.BACK).getItemStack());
|
inv.setItem(mapping.getSize() + 8, new SWItem(Material.ARROW, BauSystem.MESSAGE.parse("GUI_EDITOR_ITEM_CLOSE", p)).setCustomModelData(CMDs.BACK).getItemStack());
|
||||||
|
|
||||||
p.openInventory(inv);
|
p.openInventory(inv);
|
||||||
|
|||||||
+2
-1
@@ -50,7 +50,8 @@ public class InventoryFillBauGuiItem extends BauGuiItem {
|
|||||||
@Override
|
@Override
|
||||||
public ItemStack getItem(Player player) {
|
public ItemStack getItem(Player player) {
|
||||||
String loreKey = Config.getInstance().get(player).getPlainValueOrDefault("inventoryfill", false) ? "OTHER_ITEMS_INVENTORY_FILL_LORE_ACTIVE" : "OTHER_ITEMS_INVENTORY_FILL_LORE_INACTIVE";
|
String loreKey = Config.getInstance().get(player).getPlainValueOrDefault("inventoryfill", false) ? "OTHER_ITEMS_INVENTORY_FILL_LORE_ACTIVE" : "OTHER_ITEMS_INVENTORY_FILL_LORE_INACTIVE";
|
||||||
return new SWItem(Material.HOPPER, BauSystem.MESSAGE.parse("OTHER_ITEMS_INVENTORY_FILL_NAME", player), Collections.singletonList(BauSystem.MESSAGE.parse(loreKey, player)), false, clickType -> {}).getItemStack();
|
return new SWItem(Material.HOPPER, BauSystem.MESSAGE.parse("OTHER_ITEMS_INVENTORY_FILL_NAME", player), Collections.singletonList(BauSystem.MESSAGE.parse(loreKey, player)), false, clickType -> {
|
||||||
|
}).getItemStack();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
+9
-5
@@ -24,9 +24,9 @@ import de.steamwar.bausystem.region.Point;
|
|||||||
import de.steamwar.bausystem.region.Region;
|
import de.steamwar.bausystem.region.Region;
|
||||||
import de.steamwar.bausystem.utils.bossbar.BauSystemBossbar;
|
import de.steamwar.bausystem.utils.bossbar.BauSystemBossbar;
|
||||||
import de.steamwar.bausystem.utils.bossbar.BossBarService;
|
import de.steamwar.bausystem.utils.bossbar.BossBarService;
|
||||||
|
import de.steamwar.entity.RBlockDisplay;
|
||||||
import de.steamwar.entity.REntity;
|
import de.steamwar.entity.REntity;
|
||||||
import de.steamwar.entity.REntityServer;
|
import de.steamwar.entity.REntityServer;
|
||||||
import de.steamwar.entity.RFallingBlockEntity;
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
@@ -104,7 +104,9 @@ public class KillcheckerVisualizer {
|
|||||||
Block block = WORLD.getBlockAt(x, y, z);
|
Block block = WORLD.getBlockAt(x, y, z);
|
||||||
if (block.getType().isAir()) continue;
|
if (block.getType().isAir()) continue;
|
||||||
String name = block.getType().name();
|
String name = block.getType().name();
|
||||||
if (!name.endsWith("_WOOL") && !name.endsWith("_STAINED_GLASS") && !name.endsWith("_CONCRETE") && !name.endsWith("_TERRACOTTA")) continue;
|
if (!name.endsWith("_WOOL") && !name.endsWith("_STAINED_GLASS") && !name.endsWith("_CONCRETE") && !name.endsWith("_TERRACOTTA")) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if (name.equals("_GLAZED_TERRACOTTA")) continue;
|
if (name.equals("_GLAZED_TERRACOTTA")) continue;
|
||||||
Cuboid cuboid = create(block.getType(), x, y, z);
|
Cuboid cuboid = create(block.getType(), x, y, z);
|
||||||
cuboids.add(cuboid);
|
cuboids.add(cuboid);
|
||||||
@@ -283,11 +285,13 @@ public class KillcheckerVisualizer {
|
|||||||
}
|
}
|
||||||
kill.forEach((point, count) -> {
|
kill.forEach((point, count) -> {
|
||||||
if (rEntities.containsKey(point)) {
|
if (rEntities.containsKey(point)) {
|
||||||
if (killCount.get(point) == count && outlinePoints.contains(point) == outlinePointsCacheLast.contains(point)) return;
|
if (killCount.get(point) == count && outlinePoints.contains(point) == outlinePointsCacheLast.contains(point)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
rEntities.get(point).die();
|
rEntities.get(point).die();
|
||||||
}
|
}
|
||||||
RFallingBlockEntity entity = new RFallingBlockEntity(outlinePoints.contains(point) ? outline : inner, point.toLocation(WORLD, 0.5, 0, 0.5), MATERIALS[Math.min(count - 1, MATERIALS.length) - 1]);
|
RBlockDisplay entity = new RBlockDisplay(outlinePoints.contains(point) ? outline : inner, point.toLocation(WORLD, 0.5, 0, 0.5));
|
||||||
entity.setNoGravity(true);
|
entity.setBlock(MATERIALS[Math.min(count - 1, MATERIALS.length) - 1].createBlockData());
|
||||||
rEntities.put(point, entity);
|
rEntities.put(point, entity);
|
||||||
if (outlinePoints.contains(point)) outlinePointsCache.add(point);
|
if (outlinePoints.contains(point)) outlinePointsCache.add(point);
|
||||||
killCount.put(point, count);
|
killCount.put(point, count);
|
||||||
|
|||||||
@@ -213,7 +213,8 @@ public class Loader implements Listener, SWPlayer.Component {
|
|||||||
};
|
};
|
||||||
updateRunnable.run();
|
updateRunnable.run();
|
||||||
|
|
||||||
SWListInv<LoaderElement> swListInv = new SWListInv<>(p, BauSystem.MESSAGE.parse("LOADER_GUI_TITLE", p), false, list, (clickType, loaderElement) -> {});
|
SWListInv<LoaderElement> swListInv = new SWListInv<>(p, BauSystem.MESSAGE.parse("LOADER_GUI_TITLE", p), false, list, (clickType, loaderElement) -> {
|
||||||
|
});
|
||||||
swListInv.setCallback((clickType, entry) -> entry.click(p, () -> {
|
swListInv.setCallback((clickType, entry) -> entry.click(p, () -> {
|
||||||
updateRunnable.run();
|
updateRunnable.run();
|
||||||
swListInv.open();
|
swListInv.open();
|
||||||
@@ -363,7 +364,9 @@ public class Loader implements Listener, SWPlayer.Component {
|
|||||||
public static int LENGTH = SettingsSorting.values().length;
|
public static int LENGTH = SettingsSorting.values().length;
|
||||||
|
|
||||||
public abstract Material getMaterial();
|
public abstract Material getMaterial();
|
||||||
|
|
||||||
public abstract String getName();
|
public abstract String getName();
|
||||||
|
|
||||||
public abstract boolean shouldShow(LoaderElement previous, LoaderElement current, LoaderElement next);
|
public abstract boolean shouldShow(LoaderElement previous, LoaderElement current, LoaderElement next);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
@@ -26,6 +26,8 @@ import java.util.function.Consumer;
|
|||||||
|
|
||||||
public interface LoaderElement {
|
public interface LoaderElement {
|
||||||
SWItem menu(Player player);
|
SWItem menu(Player player);
|
||||||
|
|
||||||
void execute(Consumer<Long> delay);
|
void execute(Consumer<Long> delay);
|
||||||
|
|
||||||
void click(Player player, Runnable backAction);
|
void click(Player player, Runnable backAction);
|
||||||
}
|
}
|
||||||
|
|||||||
+14
-6
@@ -95,7 +95,8 @@ public abstract class LoaderInteractionElement<T extends Enum<T> & LoaderSetting
|
|||||||
};
|
};
|
||||||
updateRunnable.run();
|
updateRunnable.run();
|
||||||
|
|
||||||
SWListInv<Integer> listInv = new SWListInv<>(player, "Interaction Settings", false, entries, (clickType, entry) -> {});
|
SWListInv<Integer> listInv = new SWListInv<>(player, "Interaction Settings", false, entries, (clickType, entry) -> {
|
||||||
|
});
|
||||||
listInv.setCallback((clickType, entry) -> {
|
listInv.setCallback((clickType, entry) -> {
|
||||||
openIndividualSettingsMenu(player, entry, () -> {
|
openIndividualSettingsMenu(player, entry, () -> {
|
||||||
updateRunnable.run();
|
updateRunnable.run();
|
||||||
@@ -150,7 +151,10 @@ public abstract class LoaderInteractionElement<T extends Enum<T> & LoaderSetting
|
|||||||
}
|
}
|
||||||
|
|
||||||
SWInventory swInventory = new SWInventory(player, guiSize, BauSystem.MESSAGE.parse("LOADER_GUI_SETTINGS_TITLE", player));
|
SWInventory swInventory = new SWInventory(player, guiSize, BauSystem.MESSAGE.parse("LOADER_GUI_SETTINGS_TITLE", player));
|
||||||
for (int i = guiSize - 9; i < guiSize; i++) swInventory.setItem(i, new SWItem(Material.GRAY_STAINED_GLASS_PANE, "§7", clickType -> {}));
|
for (int i = guiSize - 9; i < guiSize; i++) {
|
||||||
|
swInventory.setItem(i, new SWItem(Material.GRAY_STAINED_GLASS_PANE, "§7", clickType -> {
|
||||||
|
}));
|
||||||
|
}
|
||||||
swInventory.setItem(guiSize - 9, new SWItem(Material.ARROW, BauSystem.MESSAGE.parse("LOADER_GUI_SETTINGS_BACK", player)).setCustomModelData(CMDs.BACK).getItemStack(), clickType -> back.run());
|
swInventory.setItem(guiSize - 9, new SWItem(Material.ARROW, BauSystem.MESSAGE.parse("LOADER_GUI_SETTINGS_BACK", player)).setCustomModelData(CMDs.BACK).getItemStack(), clickType -> back.run());
|
||||||
swInventory.setItem(guiSize - 5, new SWItem(Material.WOODEN_AXE, BauSystem.MESSAGE.parse("LOADER_GUI_SETTINGS_COPY", player)).getItemStack(), clickType -> {
|
swInventory.setItem(guiSize - 5, new SWItem(Material.WOODEN_AXE, BauSystem.MESSAGE.parse("LOADER_GUI_SETTINGS_COPY", player)).getItemStack(), clickType -> {
|
||||||
SWAnvilInv swAnvilInv = new SWAnvilInv(player, BauSystem.MESSAGE.parse("LOADER_GUI_COPY_TITLE", player), "1");
|
SWAnvilInv swAnvilInv = new SWAnvilInv(player, BauSystem.MESSAGE.parse("LOADER_GUI_COPY_TITLE", player), "1");
|
||||||
@@ -197,7 +201,8 @@ public abstract class LoaderInteractionElement<T extends Enum<T> & LoaderSetting
|
|||||||
for (int power = 0; power < 16; power++) {
|
for (int power = 0; power < 16; power++) {
|
||||||
int finalPowerPosition = power;
|
int finalPowerPosition = power;
|
||||||
if (power >= 9) finalPowerPosition++;
|
if (power >= 9) finalPowerPosition++;
|
||||||
SWItem powerItem = new SWItem(Material.REDSTONE, BauSystem.MESSAGE.parse("LOADER_SETTING_POWER", player, power), Arrays.asList(), false, clickType -> {});
|
SWItem powerItem = new SWItem(Material.REDSTONE, BauSystem.MESSAGE.parse("LOADER_SETTING_POWER", player, power), Arrays.asList(), false, clickType -> {
|
||||||
|
});
|
||||||
powerItem.getItemStack().setAmount(Math.max(power, 1));
|
powerItem.getItemStack().setAmount(Math.max(power, 1));
|
||||||
if (extraPower.get(index) == power) powerItem.setEnchanted(true);
|
if (extraPower.get(index) == power) powerItem.setEnchanted(true);
|
||||||
|
|
||||||
@@ -210,7 +215,8 @@ public abstract class LoaderInteractionElement<T extends Enum<T> & LoaderSetting
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (currentElement.hasTicks(this)) {
|
if (currentElement.hasTicks(this)) {
|
||||||
swInventory.setItem(ticksStart + 3, new SWItem(SWItem.getDye(1), BauSystem.MESSAGE.parse("LOADER_SETTING_TICKS_REMOVE_ONE", player), Arrays.asList(BauSystem.MESSAGE.parse("LOADER_SETTING_TICKS_REMOVE_ONE_SHIFT", player)), false, clickType -> {}).getItemStack(), clickType -> {
|
swInventory.setItem(ticksStart + 3, new SWItem(Material.RED_DYE, BauSystem.MESSAGE.parse("LOADER_SETTING_TICKS_REMOVE_ONE", player), Arrays.asList(BauSystem.MESSAGE.parse("LOADER_SETTING_TICKS_REMOVE_ONE_SHIFT", player)), false, clickType -> {
|
||||||
|
}).getItemStack(), clickType -> {
|
||||||
long ticks = extraTicks.get(index);
|
long ticks = extraTicks.get(index);
|
||||||
ticks -= clickType.isShiftClick() ? 5 : 1;
|
ticks -= clickType.isShiftClick() ? 5 : 1;
|
||||||
if (ticks < 1) ticks = 1;
|
if (ticks < 1) ticks = 1;
|
||||||
@@ -218,7 +224,8 @@ public abstract class LoaderInteractionElement<T extends Enum<T> & LoaderSetting
|
|||||||
openIndividualSettingsMenu(player, index, back, delete);
|
openIndividualSettingsMenu(player, index, back, delete);
|
||||||
});
|
});
|
||||||
|
|
||||||
SWItem ticksItem = new SWItem(Material.CLOCK, BauSystem.MESSAGE.parse("LOADER_SETTING_TICKS", player, extraTicks.get(index)), Arrays.asList(BauSystem.MESSAGE.parse("LOADER_GUI_CLICK_TO_EDIT", player)), false, clickType -> {});
|
SWItem ticksItem = new SWItem(Material.CLOCK, BauSystem.MESSAGE.parse("LOADER_SETTING_TICKS", player, extraTicks.get(index)), Arrays.asList(BauSystem.MESSAGE.parse("LOADER_GUI_CLICK_TO_EDIT", player)), false, clickType -> {
|
||||||
|
});
|
||||||
ticksItem.getItemStack().setAmount((int) Math.min(extraTicks.get(index), 64));
|
ticksItem.getItemStack().setAmount((int) Math.min(extraTicks.get(index), 64));
|
||||||
swInventory.setItem(ticksStart + 4, ticksItem.getItemStack(), clickType -> {
|
swInventory.setItem(ticksStart + 4, ticksItem.getItemStack(), clickType -> {
|
||||||
SWAnvilInv swAnvilInv = new SWAnvilInv(player, BauSystem.MESSAGE.parse("LOADER_SETTING_TICKS_NAME", player), extraTicks.get(index) + "");
|
SWAnvilInv swAnvilInv = new SWAnvilInv(player, BauSystem.MESSAGE.parse("LOADER_SETTING_TICKS_NAME", player), extraTicks.get(index) + "");
|
||||||
@@ -234,7 +241,8 @@ public abstract class LoaderInteractionElement<T extends Enum<T> & LoaderSetting
|
|||||||
swAnvilInv.open();
|
swAnvilInv.open();
|
||||||
});
|
});
|
||||||
|
|
||||||
swInventory.setItem(ticksStart + 5, new SWItem(SWItem.getDye(10), BauSystem.MESSAGE.parse("LOADER_SETTING_TICKS_ADD_ONE", player), Arrays.asList(BauSystem.MESSAGE.parse("LOADER_SETTING_TICKS_ADD_ONE_SHIFT", player)), false, clickType -> {}).getItemStack(), clickType -> {
|
swInventory.setItem(ticksStart + 5, new SWItem(Material.LIME_DYE, BauSystem.MESSAGE.parse("LOADER_SETTING_TICKS_ADD_ONE", player), Arrays.asList(BauSystem.MESSAGE.parse("LOADER_SETTING_TICKS_ADD_ONE_SHIFT", player)), false, clickType -> {
|
||||||
|
}).getItemStack(), clickType -> {
|
||||||
long ticks = extraTicks.get(index);
|
long ticks = extraTicks.get(index);
|
||||||
ticks += clickType.isShiftClick() ? 5 : 1;
|
ticks += clickType.isShiftClick() ? 5 : 1;
|
||||||
extraTicks.set(index, ticks);
|
extraTicks.set(index, ticks);
|
||||||
|
|||||||
+3
@@ -28,10 +28,13 @@ import java.util.function.Consumer;
|
|||||||
|
|
||||||
public interface LoaderSettingsEnum<T, P extends LoaderInteractionElement<E>, E extends Enum<E> & LoaderSettingsEnum<T, P, E>> {
|
public interface LoaderSettingsEnum<T, P extends LoaderInteractionElement<E>, E extends Enum<E> & LoaderSettingsEnum<T, P, E>> {
|
||||||
int getPos();
|
int getPos();
|
||||||
|
|
||||||
SWItem menu(Player player, P parent, int power, long ticks);
|
SWItem menu(Player player, P parent, int power, long ticks);
|
||||||
|
|
||||||
default boolean hasPower(P parent) {
|
default boolean hasPower(P parent) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
default boolean hasTicks(P parent) {
|
default boolean hasTicks(P parent) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-2
@@ -63,7 +63,8 @@ public class LoaderWait implements LoaderElement {
|
|||||||
for (int i = 9; i < 18; i++) swInventory.setItem(i, new SWItem(Material.GRAY_STAINED_GLASS_PANE, "§7"));
|
for (int i = 9; i < 18; i++) swInventory.setItem(i, new SWItem(Material.GRAY_STAINED_GLASS_PANE, "§7"));
|
||||||
swInventory.setItem(9, new SWItem(Material.ARROW, BauSystem.MESSAGE.parse("LOADER_GUI_WAIT_BACK", player)).setCustomModelData(CMDs.BACK).getItemStack(), clickType -> backAction.run());
|
swInventory.setItem(9, new SWItem(Material.ARROW, BauSystem.MESSAGE.parse("LOADER_GUI_WAIT_BACK", player)).setCustomModelData(CMDs.BACK).getItemStack(), clickType -> backAction.run());
|
||||||
|
|
||||||
swInventory.setItem(3, new SWItem(SWItem.getDye(1), BauSystem.MESSAGE.parse("LOADER_SETTING_TICKS_REMOVE_ONE", player), Arrays.asList(BauSystem.MESSAGE.parse("LOADER_SETTING_TICKS_REMOVE_ONE_SHIFT", player)), false, clickType -> {}).getItemStack(), clickType -> {
|
swInventory.setItem(3, new SWItem(Material.RED_DYE, BauSystem.MESSAGE.parse("LOADER_SETTING_TICKS_REMOVE_ONE", player), Arrays.asList(BauSystem.MESSAGE.parse("LOADER_SETTING_TICKS_REMOVE_ONE_SHIFT", player)), false, clickType -> {
|
||||||
|
}).getItemStack(), clickType -> {
|
||||||
delay -= clickType.isShiftClick() ? 5 : 1;
|
delay -= clickType.isShiftClick() ? 5 : 1;
|
||||||
if (delay < 0) delay = 0;
|
if (delay < 0) delay = 0;
|
||||||
swInventory.setItem(4, menu(player));
|
swInventory.setItem(4, menu(player));
|
||||||
@@ -80,7 +81,8 @@ public class LoaderWait implements LoaderElement {
|
|||||||
});
|
});
|
||||||
swAnvilInv.open();
|
swAnvilInv.open();
|
||||||
});
|
});
|
||||||
swInventory.setItem(5, new SWItem(SWItem.getDye(10), BauSystem.MESSAGE.parse("LOADER_SETTING_TICKS_ADD_ONE", player), Arrays.asList(BauSystem.MESSAGE.parse("LOADER_SETTING_TICKS_ADD_ONE_SHIFT", player)), false, clickType -> {}).getItemStack(), clickType -> {
|
swInventory.setItem(5, new SWItem(Material.LIME_DYE, BauSystem.MESSAGE.parse("LOADER_SETTING_TICKS_ADD_ONE", player), Arrays.asList(BauSystem.MESSAGE.parse("LOADER_SETTING_TICKS_ADD_ONE_SHIFT", player)), false, clickType -> {
|
||||||
|
}).getItemStack(), clickType -> {
|
||||||
delay += clickType.isShiftClick() ? 5 : 1;
|
delay += clickType.isShiftClick() ? 5 : 1;
|
||||||
swInventory.setItem(4, menu(player));
|
swInventory.setItem(4, menu(player));
|
||||||
});
|
});
|
||||||
|
|||||||
+2
-4
@@ -146,8 +146,7 @@ public class Loadtimer implements Listener {
|
|||||||
if ((stage == Stage.COUNTING || stage == Stage.ACTIVATED)) {
|
if ((stage == Stage.COUNTING || stage == Stage.ACTIVATED)) {
|
||||||
stage = Stage.IGNITION;
|
stage = Stage.IGNITION;
|
||||||
ignite = TPSUtils.currentRealTick.get();
|
ignite = TPSUtils.currentRealTick.get();
|
||||||
if (activate == -1)
|
if (activate == -1) activate = TPSUtils.currentRealTick.get();
|
||||||
activate = TPSUtils.currentRealTick.get();
|
|
||||||
if (finishOnActive) {
|
if (finishOnActive) {
|
||||||
stage = Stage.END;
|
stage = Stage.END;
|
||||||
print();
|
print();
|
||||||
@@ -184,8 +183,7 @@ public class Loadtimer implements Listener {
|
|||||||
|
|
||||||
long ignTime = ignite - activate;
|
long ignTime = ignite - activate;
|
||||||
long explTime = explode - ignTime - activate;
|
long explTime = explode - ignTime - activate;
|
||||||
if (explTime < 0)
|
if (explTime < 0) explTime = loadTime;
|
||||||
explTime = loadTime;
|
|
||||||
|
|
||||||
int finalAllTnt = allTnt;
|
int finalAllTnt = allTnt;
|
||||||
long finalExplTime = explTime;
|
long finalExplTime = explTime;
|
||||||
|
|||||||
+4
-2
@@ -40,17 +40,19 @@ public class LoadtimerCommand extends SWCommand {
|
|||||||
public void start(@Validator Player p, TimerMode mode) {
|
public void start(@Validator Player p, TimerMode mode) {
|
||||||
Region r = Region.getRegion(p.getLocation());
|
Region r = Region.getRegion(p.getLocation());
|
||||||
if (r.getType().isGlobal()) return;
|
if (r.getType().isGlobal()) return;
|
||||||
if (!Loadtimer.hasTimer(r))
|
if (!Loadtimer.hasTimer(r)) {
|
||||||
Loadtimer.createLoadtimer(r, mode == TimerMode.HALF);
|
Loadtimer.createLoadtimer(r, mode == TimerMode.HALF);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Register(value = "stop", description = "LOADTIMER_HELP_STOP")
|
@Register(value = "stop", description = "LOADTIMER_HELP_STOP")
|
||||||
public void stop(@Validator Player p) {
|
public void stop(@Validator Player p) {
|
||||||
Region r = Region.getRegion(p.getLocation());
|
Region r = Region.getRegion(p.getLocation());
|
||||||
if (r.getType().isGlobal()) return;
|
if (r.getType().isGlobal()) return;
|
||||||
if (Loadtimer.hasTimer(r))
|
if (Loadtimer.hasTimer(r)) {
|
||||||
Loadtimer.getTimer(r).delete();
|
Loadtimer.getTimer(r).delete();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public enum TimerMode {
|
public enum TimerMode {
|
||||||
FULL,
|
FULL,
|
||||||
|
|||||||
+2
-1
@@ -46,8 +46,9 @@ public class LoadtimerGuiItem extends BauGuiItem {
|
|||||||
@Override
|
@Override
|
||||||
public ItemStack getItem(Player player) {
|
public ItemStack getItem(Player player) {
|
||||||
Region r = Region.getRegion(player.getLocation());
|
Region r = Region.getRegion(player.getLocation());
|
||||||
if (r.getType().isGlobal())
|
if (r.getType().isGlobal()) {
|
||||||
return new SWItem(Material.BOWL, BauSystem.MESSAGE.parse("LOADTIMER_GUI_GLOBAL", player)).getItemStack();
|
return new SWItem(Material.BOWL, BauSystem.MESSAGE.parse("LOADTIMER_GUI_GLOBAL", player)).getItemStack();
|
||||||
|
}
|
||||||
if (Loadtimer.hasTimer(r)) {
|
if (Loadtimer.hasTimer(r)) {
|
||||||
return new SWItem(Material.BOW, BauSystem.MESSAGE.parse("LOADTIMER_GUI_STOP", player)).getItemStack();
|
return new SWItem(Material.BOW, BauSystem.MESSAGE.parse("LOADTIMER_GUI_STOP", player)).getItemStack();
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
+3
-3
@@ -20,9 +20,9 @@
|
|||||||
package de.steamwar.bausystem.features.loadtimer;
|
package de.steamwar.bausystem.features.loadtimer;
|
||||||
|
|
||||||
import de.steamwar.bausystem.region.Region;
|
import de.steamwar.bausystem.region.Region;
|
||||||
import de.steamwar.core.TrickyTrialsWrapper;
|
|
||||||
import de.steamwar.linkage.Linked;
|
import de.steamwar.linkage.Linked;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.entity.EntityType;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.event.block.BlockPlaceEvent;
|
import org.bukkit.event.block.BlockPlaceEvent;
|
||||||
@@ -57,7 +57,7 @@ public class LoadtimerListener implements Listener {
|
|||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onEntitySpawn(EntitySpawnEvent event) {
|
public void onEntitySpawn(EntitySpawnEvent event) {
|
||||||
if (!getTimers().isEmpty() && event.getEntityType() == TrickyTrialsWrapper.impl.getTntEntityType()) {
|
if (!getTimers().isEmpty() && event.getEntityType() == EntityType.TNT) {
|
||||||
Region r = Region.getRegion(event.getLocation());
|
Region r = Region.getRegion(event.getLocation());
|
||||||
if (hasTimer(r)) {
|
if (hasTimer(r)) {
|
||||||
getTimer(r).onTntSpawn();
|
getTimer(r).onTntSpawn();
|
||||||
@@ -67,7 +67,7 @@ public class LoadtimerListener implements Listener {
|
|||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onEntityExplode(EntityExplodeEvent event) {
|
public void onEntityExplode(EntityExplodeEvent event) {
|
||||||
if (!getTimers().isEmpty() && event.getEntityType() == TrickyTrialsWrapper.impl.getTntEntityType()) {
|
if (!getTimers().isEmpty() && event.getEntityType() == EntityType.TNT) {
|
||||||
Region r = Region.getRegion(event.getLocation());
|
Region r = Region.getRegion(event.getLocation());
|
||||||
if (hasTimer(r)) {
|
if (hasTimer(r)) {
|
||||||
getTimer(r).onTntExplode(event);
|
getTimer(r).onTntExplode(event);
|
||||||
|
|||||||
-2
@@ -28,7 +28,6 @@ import de.steamwar.command.SWCommand;
|
|||||||
import de.steamwar.entity.CRay;
|
import de.steamwar.entity.CRay;
|
||||||
import de.steamwar.entity.REntityServer;
|
import de.steamwar.entity.REntityServer;
|
||||||
import de.steamwar.linkage.Linked;
|
import de.steamwar.linkage.Linked;
|
||||||
import de.steamwar.linkage.MinVersion;
|
|
||||||
import org.bukkit.*;
|
import org.bukkit.*;
|
||||||
import org.bukkit.block.data.BlockData;
|
import org.bukkit.block.data.BlockData;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@@ -42,7 +41,6 @@ import org.bukkit.util.RayTraceResult;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@Linked
|
@Linked
|
||||||
@MinVersion(20)
|
|
||||||
public class RayVisualizerCommand extends SWCommand implements Listener {
|
public class RayVisualizerCommand extends SWCommand implements Listener {
|
||||||
|
|
||||||
private BlockData VISIBLE = Material.LIME_CONCRETE.createBlockData();
|
private BlockData VISIBLE = Material.LIME_CONCRETE.createBlockData();
|
||||||
|
|||||||
+6
-2
@@ -36,12 +36,16 @@ public class FireListener implements Listener, ScoreboardElement {
|
|||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onFireDamage(BlockBurnEvent e) {
|
public void onFireDamage(BlockBurnEvent e) {
|
||||||
if (Region.getRegion(e.getBlock().getLocation()).getRegionData().get(Flag.FIRE).isWithDefault(FireMode.DENY)) e.setCancelled(true);
|
if (Region.getRegion(e.getBlock().getLocation()).getRegionData().get(Flag.FIRE).isWithDefault(FireMode.DENY)) {
|
||||||
|
e.setCancelled(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onFireSpread(BlockSpreadEvent e) {
|
public void onFireSpread(BlockSpreadEvent e) {
|
||||||
if (Region.getRegion(e.getBlock().getLocation()).getRegionData().get(Flag.FIRE).isWithDefault(FireMode.DENY)) e.setCancelled(true);
|
if (Region.getRegion(e.getBlock().getLocation()).getRegionData().get(Flag.FIRE).isWithDefault(FireMode.DENY)) {
|
||||||
|
e.setCancelled(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
+11
-7
@@ -24,8 +24,6 @@ import de.steamwar.bausystem.region.Region;
|
|||||||
import de.steamwar.bausystem.region.flags.Flag;
|
import de.steamwar.bausystem.region.flags.Flag;
|
||||||
import de.steamwar.bausystem.region.flags.FreezeMode;
|
import de.steamwar.bausystem.region.flags.FreezeMode;
|
||||||
import de.steamwar.bausystem.utils.ScoreboardElement;
|
import de.steamwar.bausystem.utils.ScoreboardElement;
|
||||||
import de.steamwar.core.Core;
|
|
||||||
import de.steamwar.core.TrickyTrialsWrapper;
|
|
||||||
import de.steamwar.linkage.Linked;
|
import de.steamwar.linkage.Linked;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
@@ -33,6 +31,7 @@ import org.bukkit.block.Block;
|
|||||||
import org.bukkit.block.BlockState;
|
import org.bukkit.block.BlockState;
|
||||||
import org.bukkit.block.data.type.NoteBlock;
|
import org.bukkit.block.data.type.NoteBlock;
|
||||||
import org.bukkit.block.data.type.Switch;
|
import org.bukkit.block.data.type.Switch;
|
||||||
|
import org.bukkit.entity.EntityType;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.EventPriority;
|
import org.bukkit.event.EventPriority;
|
||||||
@@ -48,7 +47,9 @@ public class FreezeListener implements Listener, ScoreboardElement {
|
|||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onBlockExplode(BlockExplodeEvent e) {
|
public void onBlockExplode(BlockExplodeEvent e) {
|
||||||
if (Region.getRegion(e.getBlock().getLocation()).getRegionData().get(Flag.FREEZE).isWithDefault(FreezeMode.INACTIVE)) return;
|
if (Region.getRegion(e.getBlock().getLocation()).getRegionData().get(Flag.FREEZE).isWithDefault(FreezeMode.INACTIVE)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
BlockState state = e.getBlock().getState();
|
BlockState state = e.getBlock().getState();
|
||||||
Bukkit.getScheduler().runTaskLater(BauSystem.getInstance(), () -> {
|
Bukkit.getScheduler().runTaskLater(BauSystem.getInstance(), () -> {
|
||||||
@@ -58,9 +59,11 @@ public class FreezeListener implements Listener, ScoreboardElement {
|
|||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onEntitySpawn(EntitySpawnEvent e) {
|
public void onEntitySpawn(EntitySpawnEvent e) {
|
||||||
if (Region.getRegion(e.getLocation()).getRegionData().get(Flag.FREEZE).isWithDefault(FreezeMode.INACTIVE)) return;
|
if (Region.getRegion(e.getLocation()).getRegionData().get(Flag.FREEZE).isWithDefault(FreezeMode.INACTIVE)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
if (e.getEntityType() == TrickyTrialsWrapper.impl.getTntEntityType()) {
|
if (e.getEntityType() == EntityType.TNT) {
|
||||||
Bukkit.getScheduler().runTaskLater(BauSystem.getInstance(), () -> {
|
Bukkit.getScheduler().runTaskLater(BauSystem.getInstance(), () -> {
|
||||||
e.getLocation().getBlock().setType(Material.TNT, false);
|
e.getLocation().getBlock().setType(Material.TNT, false);
|
||||||
}, 1L);
|
}, 1L);
|
||||||
@@ -70,7 +73,9 @@ public class FreezeListener implements Listener, ScoreboardElement {
|
|||||||
@EventHandler
|
@EventHandler
|
||||||
public void onBlockCanBuild(BlockCanBuildEvent e) {
|
public void onBlockCanBuild(BlockCanBuildEvent e) {
|
||||||
if (!e.isBuildable()) return;
|
if (!e.isBuildable()) return;
|
||||||
if (Region.getRegion(e.getBlock().getLocation()).getRegionData().get(Flag.FREEZE).isWithDefault(FreezeMode.INACTIVE)) return;
|
if (Region.getRegion(e.getBlock().getLocation()).getRegionData().get(Flag.FREEZE).isWithDefault(FreezeMode.INACTIVE)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (e.getMaterial() == Material.TNT) {
|
if (e.getMaterial() == Material.TNT) {
|
||||||
e.setBuildable(false);
|
e.setBuildable(false);
|
||||||
e.getBlock().setType(Material.TNT, false);
|
e.getBlock().setType(Material.TNT, false);
|
||||||
@@ -155,7 +160,6 @@ public class FreezeListener implements Listener, ScoreboardElement {
|
|||||||
|
|
||||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||||
public void onBlockBreak(BlockBreakEvent e) {
|
public void onBlockBreak(BlockBreakEvent e) {
|
||||||
if (Core.getVersion() < 19) return;
|
|
||||||
if (e.getPlayer().getInventory().getItemInMainHand().getType() == Material.DEBUG_STICK) return;
|
if (e.getPlayer().getInventory().getItemInMainHand().getType() == Material.DEBUG_STICK) return;
|
||||||
if (Region.getRegion(e.getBlock().getLocation()).getRegionData().get(Flag.FREEZE).isWithDefault(FreezeMode.ACTIVE)) {
|
if (Region.getRegion(e.getBlock().getLocation()).getRegionData().get(Flag.FREEZE).isWithDefault(FreezeMode.ACTIVE)) {
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
|
|||||||
@@ -25,11 +25,9 @@ import de.steamwar.bausystem.region.flags.Flag;
|
|||||||
import de.steamwar.bausystem.region.flags.ItemMode;
|
import de.steamwar.bausystem.region.flags.ItemMode;
|
||||||
import de.steamwar.command.SWCommand;
|
import de.steamwar.command.SWCommand;
|
||||||
import de.steamwar.linkage.Linked;
|
import de.steamwar.linkage.Linked;
|
||||||
import de.steamwar.linkage.MinVersion;
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
@Linked
|
@Linked
|
||||||
@MinVersion(19)
|
|
||||||
public class ItemsCommand extends SWCommand {
|
public class ItemsCommand extends SWCommand {
|
||||||
|
|
||||||
public ItemsCommand() {
|
public ItemsCommand() {
|
||||||
|
|||||||
@@ -25,14 +25,12 @@ import de.steamwar.bausystem.region.flags.Flag;
|
|||||||
import de.steamwar.bausystem.region.flags.ItemMode;
|
import de.steamwar.bausystem.region.flags.ItemMode;
|
||||||
import de.steamwar.bausystem.utils.ScoreboardElement;
|
import de.steamwar.bausystem.utils.ScoreboardElement;
|
||||||
import de.steamwar.linkage.Linked;
|
import de.steamwar.linkage.Linked;
|
||||||
import de.steamwar.linkage.MinVersion;
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.event.entity.ItemSpawnEvent;
|
import org.bukkit.event.entity.ItemSpawnEvent;
|
||||||
|
|
||||||
@Linked
|
@Linked
|
||||||
@MinVersion(19)
|
|
||||||
public class ItemsListener implements Listener, ScoreboardElement {
|
public class ItemsListener implements Listener, ScoreboardElement {
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
|
|||||||
+3
-1
@@ -59,7 +59,9 @@ public class RegionListener implements Listener {
|
|||||||
|
|
||||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||||
public void onBlockPhysics(final BlockPhysicsEvent event) {
|
public void onBlockPhysics(final BlockPhysicsEvent event) {
|
||||||
if (event.getBlock().getType() != event.getChangedType()) RegionListener.tagChangedRegion(event.getBlock().getLocation());
|
if (event.getBlock().getType() != event.getChangedType()) {
|
||||||
|
RegionListener.tagChangedRegion(event.getBlock().getLocation());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||||
|
|||||||
+3
-1
@@ -36,7 +36,9 @@ public class WaterDestroyListener implements Listener, ScoreboardElement {
|
|||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onBlockFromTo(BlockFromToEvent event) {
|
public void onBlockFromTo(BlockFromToEvent event) {
|
||||||
if (event.getBlock().getType() == Material.WATER && event.getToBlock().getType() != Material.AIR && Region.getRegion(event.getBlock().getLocation()).getRegionData().get(Flag.WATER_DESTROY).isWithDefault(WaterDestroyMode.DENY)) event.setCancelled(true);
|
if (event.getBlock().getType() == Material.WATER && event.getToBlock().getType() != Material.AIR && Region.getRegion(event.getBlock().getLocation()).getRegionData().get(Flag.WATER_DESTROY).isWithDefault(WaterDestroyMode.DENY)) {
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -75,7 +75,8 @@ public class ScriptGUI implements Listener {
|
|||||||
lore.add(BauSystem.MESSAGE.parse("SCRIPT_MENU_GUI_ITEM_LORE_3", player));
|
lore.add(BauSystem.MESSAGE.parse("SCRIPT_MENU_GUI_ITEM_LORE_3", player));
|
||||||
lore.add(BauSystem.MESSAGE.parse("SCRIPT_MENU_GUI_ITEM_LORE_4", player));
|
lore.add(BauSystem.MESSAGE.parse("SCRIPT_MENU_GUI_ITEM_LORE_4", player));
|
||||||
|
|
||||||
entries.add(new SWListInv.SWListEntry<>(new SWItem(Material.ENCHANTED_BOOK, script.getName(), new ArrayList<>(lore), false, clickType -> {}), script));
|
entries.add(new SWListInv.SWListEntry<>(new SWItem(Material.ENCHANTED_BOOK, script.getName(), new ArrayList<>(lore), false, clickType -> {
|
||||||
|
}), script));
|
||||||
lore.clear();
|
lore.clear();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
+3
-3
@@ -26,10 +26,10 @@ import de.steamwar.bausystem.features.script.lua.SteamWarGlobalLuaPlugin;
|
|||||||
import de.steamwar.bausystem.features.script.lua.libs.StorageLib;
|
import de.steamwar.bausystem.features.script.lua.libs.StorageLib;
|
||||||
import de.steamwar.bausystem.region.Region;
|
import de.steamwar.bausystem.region.Region;
|
||||||
import de.steamwar.core.SWPlayer;
|
import de.steamwar.core.SWPlayer;
|
||||||
import de.steamwar.core.TrickyTrialsWrapper;
|
|
||||||
import de.steamwar.linkage.Linked;
|
import de.steamwar.linkage.Linked;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.entity.EntityType;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.EventPriority;
|
import org.bukkit.event.EventPriority;
|
||||||
@@ -141,7 +141,7 @@ public class EventListener implements Listener {
|
|||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGH)
|
@EventHandler(priority = EventPriority.HIGH)
|
||||||
public void onEntitySpawn(EntitySpawnEvent event) {
|
public void onEntitySpawn(EntitySpawnEvent event) {
|
||||||
if (event.getEntityType() != TrickyTrialsWrapper.impl.getTntEntityType()) {
|
if (event.getEntityType() != EntityType.TNT) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Region tntRegion = Region.getRegion(event.getLocation());
|
Region tntRegion = Region.getRegion(event.getLocation());
|
||||||
@@ -156,7 +156,7 @@ public class EventListener implements Listener {
|
|||||||
|
|
||||||
@EventHandler(priority = EventPriority.LOWEST)
|
@EventHandler(priority = EventPriority.LOWEST)
|
||||||
public void onEntityExplode(EntityExplodeEvent event) {
|
public void onEntityExplode(EntityExplodeEvent event) {
|
||||||
if (event.getEntityType() != TrickyTrialsWrapper.impl.getTntEntityType()) {
|
if (event.getEntityType() != EntityType.TNT) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Region tntRegion = Region.getRegion(event.getLocation());
|
Region tntRegion = Region.getRegion(event.getLocation());
|
||||||
|
|||||||
+14
-6
@@ -82,7 +82,9 @@ public interface LuaLib {
|
|||||||
default Class<? extends LuaLib> parent() {
|
default Class<? extends LuaLib> parent() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
String name();
|
String name();
|
||||||
|
|
||||||
LuaTable get(Player player);
|
LuaTable get(Player player);
|
||||||
|
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@@ -103,27 +105,33 @@ public interface LuaLib {
|
|||||||
try {
|
try {
|
||||||
consumer.accept(luaValue.toboolean());
|
consumer.accept(luaValue.toboolean());
|
||||||
return NIL;
|
return NIL;
|
||||||
} catch (Exception ingored) {}
|
} catch (Exception ingored) {
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
consumer.accept((long) luaValue.toint());
|
consumer.accept((long) luaValue.toint());
|
||||||
return NIL;
|
return NIL;
|
||||||
} catch (Exception ignored) {}
|
} catch (Exception ignored) {
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
consumer.accept(luaValue.toint());
|
consumer.accept(luaValue.toint());
|
||||||
return NIL;
|
return NIL;
|
||||||
} catch (Exception ignored) {}
|
} catch (Exception ignored) {
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
consumer.accept(luaValue.todouble());
|
consumer.accept(luaValue.todouble());
|
||||||
return NIL;
|
return NIL;
|
||||||
} catch (Exception ignored) {}
|
} catch (Exception ignored) {
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
consumer.accept((float) luaValue.todouble());
|
consumer.accept((float) luaValue.todouble());
|
||||||
return NIL;
|
return NIL;
|
||||||
} catch (Exception ignored) {}
|
} catch (Exception ignored) {
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
consumer.accept(luaValue.toString());
|
consumer.accept(luaValue.toString());
|
||||||
return NIL;
|
return NIL;
|
||||||
} catch (Exception ignored) {}
|
} catch (Exception ignored) {
|
||||||
|
}
|
||||||
throw new LuaError("Invalid lua type: " + luaValue.typename());
|
throw new LuaError("Invalid lua type: " + luaValue.typename());
|
||||||
} catch (Throwable throwable) {
|
} catch (Throwable throwable) {
|
||||||
throw new LuaError("Error in '" + name + "' " + throwable.getMessage());
|
throw new LuaError("Error in '" + name + "' " + throwable.getMessage());
|
||||||
|
|||||||
+33
-18
@@ -22,7 +22,6 @@ package de.steamwar.bausystem.features.script.lua.libs;
|
|||||||
import com.google.gson.*;
|
import com.google.gson.*;
|
||||||
import de.steamwar.bausystem.region.Region;
|
import de.steamwar.bausystem.region.Region;
|
||||||
import de.steamwar.bausystem.region.RegionSystem;
|
import de.steamwar.bausystem.region.RegionSystem;
|
||||||
import de.steamwar.core.Core;
|
|
||||||
import de.steamwar.linkage.Linked;
|
import de.steamwar.linkage.Linked;
|
||||||
import de.steamwar.linkage.api.Disable;
|
import de.steamwar.linkage.api.Disable;
|
||||||
import de.steamwar.linkage.api.Enable;
|
import de.steamwar.linkage.api.Enable;
|
||||||
@@ -56,7 +55,6 @@ public class StorageLib implements LuaLib, Enable, Disable {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void enable() {
|
public void enable() {
|
||||||
if (Core.getVersion() <= 15) return;
|
|
||||||
if (!storageDirectory.exists()) storageDirectory.mkdirs();
|
if (!storageDirectory.exists()) storageDirectory.mkdirs();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -64,7 +62,8 @@ public class StorageLib implements LuaLib, Enable, Disable {
|
|||||||
jsonObject.keySet().forEach(key -> {
|
jsonObject.keySet().forEach(key -> {
|
||||||
GLOBAL_STORAGE.put(key, fromJson(jsonObject.get(key)));
|
GLOBAL_STORAGE.put(key, fromJson(jsonObject.get(key)));
|
||||||
});
|
});
|
||||||
} catch (Exception e) {}
|
} catch (Exception e) {
|
||||||
|
}
|
||||||
|
|
||||||
File regionStorageDirectory = new File(storageDirectory, "region");
|
File regionStorageDirectory = new File(storageDirectory, "region");
|
||||||
regionStorageDirectory.mkdirs();
|
regionStorageDirectory.mkdirs();
|
||||||
@@ -77,7 +76,8 @@ public class StorageLib implements LuaLib, Enable, Disable {
|
|||||||
});
|
});
|
||||||
Region region = RegionSystem.INSTANCE.getRegion(UUID.fromString(regionStorage.getName().substring(0, regionStorage.getName().length() - ".json".length()))).orElse(null);
|
Region region = RegionSystem.INSTANCE.getRegion(UUID.fromString(regionStorage.getName().substring(0, regionStorage.getName().length() - ".json".length()))).orElse(null);
|
||||||
REGION_STORAGE.put(region, map);
|
REGION_STORAGE.put(region, map);
|
||||||
} catch (Exception e) {}
|
} catch (Exception e) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
File playerStorageDirectory = new File(storageDirectory, "player");
|
File playerStorageDirectory = new File(storageDirectory, "player");
|
||||||
@@ -91,7 +91,8 @@ public class StorageLib implements LuaLib, Enable, Disable {
|
|||||||
});
|
});
|
||||||
SteamwarUser steamwarUser = SteamwarUser.byId(Integer.parseInt(playerStorage.getName().substring(0, playerStorage.getName().length() - ".json".length())));
|
SteamwarUser steamwarUser = SteamwarUser.byId(Integer.parseInt(playerStorage.getName().substring(0, playerStorage.getName().length() - ".json".length())));
|
||||||
PLAYER_STORAGE.put(steamwarUser.getUUID(), map);
|
PLAYER_STORAGE.put(steamwarUser.getUUID(), map);
|
||||||
} catch (Exception e) {}
|
} catch (Exception e) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -107,10 +108,12 @@ public class StorageLib implements LuaLib, Enable, Disable {
|
|||||||
if (jsonPrimitive.isNumber()) {
|
if (jsonPrimitive.isNumber()) {
|
||||||
try {
|
try {
|
||||||
return LuaValue.valueOf(jsonPrimitive.getAsInt());
|
return LuaValue.valueOf(jsonPrimitive.getAsInt());
|
||||||
} catch (NumberFormatException e) {}
|
} catch (NumberFormatException e) {
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
return LuaValue.valueOf(jsonPrimitive.getAsDouble());
|
return LuaValue.valueOf(jsonPrimitive.getAsDouble());
|
||||||
} catch (NumberFormatException e) {}
|
} catch (NumberFormatException e) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (jsonPrimitive.isString()) {
|
if (jsonPrimitive.isString()) {
|
||||||
return LuaValue.valueOf(jsonPrimitive.getAsString());
|
return LuaValue.valueOf(jsonPrimitive.getAsString());
|
||||||
@@ -132,13 +135,13 @@ public class StorageLib implements LuaLib, Enable, Disable {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void disable() {
|
public void disable() {
|
||||||
if (Core.getVersion() <= 15) return;
|
|
||||||
if (!storageDirectory.exists()) storageDirectory.mkdirs();
|
if (!storageDirectory.exists()) storageDirectory.mkdirs();
|
||||||
try {
|
try {
|
||||||
FileWriter fileWriter = new FileWriter(new File(storageDirectory, "global.json"));
|
FileWriter fileWriter = new FileWriter(new File(storageDirectory, "global.json"));
|
||||||
gson.toJson(toJson(GLOBAL_STORAGE), fileWriter);
|
gson.toJson(toJson(GLOBAL_STORAGE), fileWriter);
|
||||||
fileWriter.close();
|
fileWriter.close();
|
||||||
} catch (IOException e) {}
|
} catch (IOException e) {
|
||||||
|
}
|
||||||
|
|
||||||
File regionStorageDirectory = new File(storageDirectory, "region");
|
File regionStorageDirectory = new File(storageDirectory, "region");
|
||||||
regionStorageDirectory.mkdirs();
|
regionStorageDirectory.mkdirs();
|
||||||
@@ -147,7 +150,8 @@ public class StorageLib implements LuaLib, Enable, Disable {
|
|||||||
FileWriter fileWriter = new FileWriter(new File(regionStorageDirectory, entry.getKey().getID().toString() + ".json"));
|
FileWriter fileWriter = new FileWriter(new File(regionStorageDirectory, entry.getKey().getID().toString() + ".json"));
|
||||||
gson.toJson(toJson(entry.getValue()), fileWriter);
|
gson.toJson(toJson(entry.getValue()), fileWriter);
|
||||||
fileWriter.close();
|
fileWriter.close();
|
||||||
} catch (IOException e) {}
|
} catch (IOException e) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
File playerStorageDirectory = new File(storageDirectory, "player");
|
File playerStorageDirectory = new File(storageDirectory, "player");
|
||||||
@@ -157,7 +161,8 @@ public class StorageLib implements LuaLib, Enable, Disable {
|
|||||||
FileWriter fileWriter = new FileWriter(new File(playerStorageDirectory, SteamwarUser.get(entry.getKey()).getId() + ".json"));
|
FileWriter fileWriter = new FileWriter(new File(playerStorageDirectory, SteamwarUser.get(entry.getKey()).getId() + ".json"));
|
||||||
gson.toJson(toJson(entry.getValue()), fileWriter);
|
gson.toJson(toJson(entry.getValue()), fileWriter);
|
||||||
fileWriter.close();
|
fileWriter.close();
|
||||||
} catch (IOException e) {}
|
} catch (IOException e) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -177,13 +182,16 @@ public class StorageLib implements LuaLib, Enable, Disable {
|
|||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
return new JsonPrimitive(luaValue.checkboolean());
|
return new JsonPrimitive(luaValue.checkboolean());
|
||||||
} catch (Exception e) {}
|
} catch (Exception e) {
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
return new JsonPrimitive(luaValue.checkint());
|
return new JsonPrimitive(luaValue.checkint());
|
||||||
} catch (Exception e) {}
|
} catch (Exception e) {
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
return new JsonPrimitive(luaValue.checkdouble());
|
return new JsonPrimitive(luaValue.checkdouble());
|
||||||
} catch (Exception e) {}
|
} catch (Exception e) {
|
||||||
|
}
|
||||||
|
|
||||||
if (luaValue.isstring()) {
|
if (luaValue.isstring()) {
|
||||||
return new JsonPrimitive(luaValue.tojstring());
|
return new JsonPrimitive(luaValue.tojstring());
|
||||||
@@ -196,7 +204,8 @@ public class StorageLib implements LuaLib, Enable, Disable {
|
|||||||
if (value == null) continue;
|
if (value == null) continue;
|
||||||
try {
|
try {
|
||||||
jsonObject.add(key.checkjstring(), value);
|
jsonObject.add(key.checkjstring(), value);
|
||||||
} catch (Exception e) {}
|
} catch (Exception e) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return jsonObject;
|
return jsonObject;
|
||||||
}
|
}
|
||||||
@@ -252,7 +261,9 @@ public class StorageLib implements LuaLib, Enable, Disable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
};
|
}
|
||||||
|
|
||||||
|
;
|
||||||
});
|
});
|
||||||
storageLib.set("global", global);
|
storageLib.set("global", global);
|
||||||
|
|
||||||
@@ -297,7 +308,9 @@ public class StorageLib implements LuaLib, Enable, Disable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
};
|
}
|
||||||
|
|
||||||
|
;
|
||||||
});
|
});
|
||||||
storageLib.set("player", playerStorage);
|
storageLib.set("player", playerStorage);
|
||||||
|
|
||||||
@@ -346,7 +359,9 @@ public class StorageLib implements LuaLib, Enable, Disable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
};
|
}
|
||||||
|
|
||||||
|
;
|
||||||
});
|
});
|
||||||
storageLib.set("region", regionStorage);
|
storageLib.set("region", regionStorage);
|
||||||
|
|
||||||
|
|||||||
+2
@@ -26,7 +26,9 @@ import org.bukkit.entity.Player;
|
|||||||
public interface BlockDataConfiguration<T extends BlockData> {
|
public interface BlockDataConfiguration<T extends BlockData> {
|
||||||
|
|
||||||
void previous();
|
void previous();
|
||||||
|
|
||||||
void next();
|
void next();
|
||||||
|
|
||||||
SWItem get(Player player);
|
SWItem get(Player player);
|
||||||
|
|
||||||
void apply(T copied, T worldOriginal);
|
void apply(T copied, T worldOriginal);
|
||||||
|
|||||||
-2
@@ -29,14 +29,12 @@ import de.steamwar.command.TypeMapper;
|
|||||||
import de.steamwar.command.TypeValidator;
|
import de.steamwar.command.TypeValidator;
|
||||||
import de.steamwar.linkage.Linked;
|
import de.steamwar.linkage.Linked;
|
||||||
import de.steamwar.linkage.LinkedInstance;
|
import de.steamwar.linkage.LinkedInstance;
|
||||||
import de.steamwar.linkage.MinVersion;
|
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
|
||||||
@Linked
|
@Linked
|
||||||
@MinVersion(19)
|
|
||||||
public class SimulatorCommand extends SWCommand {
|
public class SimulatorCommand extends SWCommand {
|
||||||
|
|
||||||
@LinkedInstance
|
@LinkedInstance
|
||||||
|
|||||||
+94
-209
@@ -19,7 +19,6 @@
|
|||||||
|
|
||||||
package de.steamwar.bausystem.features.simulator;
|
package de.steamwar.bausystem.features.simulator;
|
||||||
|
|
||||||
import com.comphenix.tinyprotocol.TinyProtocol;
|
|
||||||
import de.steamwar.bausystem.BauSystem;
|
import de.steamwar.bausystem.BauSystem;
|
||||||
import de.steamwar.bausystem.Permission;
|
import de.steamwar.bausystem.Permission;
|
||||||
import de.steamwar.bausystem.SWUtils;
|
import de.steamwar.bausystem.SWUtils;
|
||||||
@@ -38,79 +37,80 @@ import de.steamwar.bausystem.features.simulator.gui.SimulatorGui;
|
|||||||
import de.steamwar.bausystem.features.simulator.gui.base.SimulatorBaseGui;
|
import de.steamwar.bausystem.features.simulator.gui.base.SimulatorBaseGui;
|
||||||
import de.steamwar.bausystem.utils.BauMemberUpdateEvent;
|
import de.steamwar.bausystem.utils.BauMemberUpdateEvent;
|
||||||
import de.steamwar.bausystem.utils.ItemUtils;
|
import de.steamwar.bausystem.utils.ItemUtils;
|
||||||
import de.steamwar.bausystem.utils.RayTraceUtils;
|
import de.steamwar.core.SWPlayer;
|
||||||
|
import de.steamwar.cursor.Cursor;
|
||||||
import de.steamwar.entity.REntity;
|
import de.steamwar.entity.REntity;
|
||||||
import de.steamwar.entity.REntityServer;
|
import de.steamwar.entity.REntityServer;
|
||||||
import de.steamwar.entity.RFallingBlockEntity;
|
|
||||||
import de.steamwar.inventory.SWAnvilInv;
|
import de.steamwar.inventory.SWAnvilInv;
|
||||||
import de.steamwar.linkage.Linked;
|
import de.steamwar.linkage.Linked;
|
||||||
import de.steamwar.linkage.MinVersion;
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import net.minecraft.network.protocol.game.ServerboundMovePlayerPacket;
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.World;
|
|
||||||
import org.bukkit.block.BlockFace;
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.EventPriority;
|
import org.bukkit.event.EventPriority;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.event.block.Action;
|
import org.bukkit.event.block.Action;
|
||||||
|
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||||
|
import org.bukkit.event.inventory.InventoryDragEvent;
|
||||||
import org.bukkit.event.player.*;
|
import org.bukkit.event.player.*;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.function.BiFunction;
|
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@Linked
|
@Linked
|
||||||
@MinVersion(19)
|
|
||||||
public class SimulatorCursor implements Listener {
|
public class SimulatorCursor implements Listener {
|
||||||
|
|
||||||
private static final World WORLD = Bukkit.getWorlds().get(0);
|
private static final Map<Player, CursorType> cursorType = Collections.synchronizedMap(new HashMap<>());
|
||||||
|
private static final Map<Player, REntityServer> emptyTargetServers = Collections.synchronizedMap(new HashMap<>());
|
||||||
private static Map<Player, CursorType> cursorType = Collections.synchronizedMap(new HashMap<>());
|
|
||||||
private static Map<Player, REntityServer> cursors = Collections.synchronizedMap(new HashMap<>());
|
|
||||||
private static final Set<Player> calculating = new HashSet<>();
|
|
||||||
|
|
||||||
public static boolean isSimulatorItem(ItemStack itemStack) {
|
public static boolean isSimulatorItem(ItemStack itemStack) {
|
||||||
return ItemUtils.isItem(itemStack, "simulator");
|
return ItemUtils.isItem(itemStack, "simulator");
|
||||||
}
|
}
|
||||||
|
|
||||||
public SimulatorCursor() {
|
private static boolean hasSimulatorItem(Player player) {
|
||||||
BiFunction<Player, Object, Object> function = (player, object) -> {
|
return isSimulatorItem(player.getInventory().getItemInMainHand()) || isSimulatorItem(player.getInventory().getItemInOffHand());
|
||||||
calcCursor(player);
|
}
|
||||||
return object;
|
|
||||||
};
|
private static void scheduleCursorUpdate(Player player) {
|
||||||
TinyProtocol.instance.addFilter(ServerboundMovePlayerPacket.Pos.class, function);
|
BauSystem.runTaskLater(BauSystem.getInstance(), () -> calcCursor(player), 1);
|
||||||
TinyProtocol.instance.addFilter(ServerboundMovePlayerPacket.Rot.class, function);
|
|
||||||
TinyProtocol.instance.addFilter(ServerboundMovePlayerPacket.PosRot.class, function);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPlayerJoin(PlayerJoinEvent event) {
|
public void onPlayerJoin(PlayerJoinEvent event) {
|
||||||
if (!Permission.BUILD.hasPermission(event.getPlayer())) return;
|
if (!Permission.BUILD.hasPermission(event.getPlayer())) return;
|
||||||
Bukkit.getScheduler().runTaskLater(BauSystem.getInstance(), () -> {
|
scheduleCursorUpdate(event.getPlayer());
|
||||||
calcCursor(event.getPlayer());
|
|
||||||
}, 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPlayerDropItem(PlayerDropItemEvent event) {
|
public void onPlayerDropItem(PlayerDropItemEvent event) {
|
||||||
if (!Permission.BUILD.hasPermission(event.getPlayer())) return;
|
if (!Permission.BUILD.hasPermission(event.getPlayer())) return;
|
||||||
calcCursor(event.getPlayer());
|
scheduleCursorUpdate(event.getPlayer());
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPlayerItemHeld(PlayerItemHeldEvent event) {
|
public void onPlayerItemHeld(PlayerItemHeldEvent event) {
|
||||||
if (!Permission.BUILD.hasPermission(event.getPlayer())) return;
|
if (!Permission.BUILD.hasPermission(event.getPlayer())) return;
|
||||||
Bukkit.getScheduler().runTaskLater(BauSystem.getInstance(), () -> {
|
scheduleCursorUpdate(event.getPlayer());
|
||||||
calcCursor(event.getPlayer());
|
}
|
||||||
}, 1);
|
|
||||||
|
@EventHandler
|
||||||
|
public void onInventoryClick(InventoryClickEvent event) {
|
||||||
|
if (!(event.getWhoClicked() instanceof Player player)) return;
|
||||||
|
if (!Permission.BUILD.hasPermission(player)) return;
|
||||||
|
scheduleCursorUpdate(player);
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onInventoryDrag(InventoryDragEvent event) {
|
||||||
|
if (!(event.getWhoClicked() instanceof Player player)) return;
|
||||||
|
if (!Permission.BUILD.hasPermission(player)) return;
|
||||||
|
scheduleCursorUpdate(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
@@ -121,10 +121,7 @@ public class SimulatorCursor implements Listener {
|
|||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPlayerQuit(PlayerQuitEvent event) {
|
public void onPlayerQuit(PlayerQuitEvent event) {
|
||||||
cursorType.remove(event.getPlayer());
|
cursorType.remove(event.getPlayer());
|
||||||
cursors.remove(event.getPlayer());
|
removeCursor(event.getPlayer());
|
||||||
synchronized (calculating) {
|
|
||||||
calculating.remove(event.getPlayer());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final Map<Player, Long> LAST_SNEAKS = new HashMap<>();
|
private static final Map<Player, Long> LAST_SNEAKS = new HashMap<>();
|
||||||
@@ -140,7 +137,7 @@ public class SimulatorCursor implements Listener {
|
|||||||
public void onPlayerToggleSneak(PlayerToggleSneakEvent event) {
|
public void onPlayerToggleSneak(PlayerToggleSneakEvent event) {
|
||||||
if (!event.isSneaking()) return;
|
if (!event.isSneaking()) return;
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
if (!isSimulatorItem(player.getInventory().getItemInMainHand()) && !isSimulatorItem(player.getInventory().getItemInOffHand())) {
|
if (!hasSimulatorItem(player)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (LAST_SNEAKS.containsKey(player)) {
|
if (LAST_SNEAKS.containsKey(player)) {
|
||||||
@@ -166,17 +163,10 @@ public class SimulatorCursor implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void calcCursor(Player player) {
|
public static void calcCursor(Player player) {
|
||||||
synchronized (calculating) {
|
if (!Permission.BUILD.hasPermission(player) || !hasSimulatorItem(player)) {
|
||||||
if (calculating.contains(player)) return;
|
if (removeCursor(player) | SimulatorWatcher.show(null, player)) {
|
||||||
calculating.add(player);
|
|
||||||
}
|
|
||||||
if (!Permission.BUILD.hasPermission(player) || (!isSimulatorItem(player.getInventory().getItemInMainHand()) && !isSimulatorItem(player.getInventory().getItemInOffHand()))) {
|
|
||||||
if (removeCursor(player) || SimulatorWatcher.show(null, player)) {
|
|
||||||
SWUtils.sendToActionbar(player, "");
|
SWUtils.sendToActionbar(player, "");
|
||||||
}
|
}
|
||||||
synchronized (calculating) {
|
|
||||||
calculating.remove(player);
|
|
||||||
}
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -185,202 +175,98 @@ public class SimulatorCursor implements Listener {
|
|||||||
removeCursor(player);
|
removeCursor(player);
|
||||||
SimulatorWatcher.show(null, player);
|
SimulatorWatcher.show(null, player);
|
||||||
SWUtils.sendToActionbar(player, "§cGenerating Stab");
|
SWUtils.sendToActionbar(player, "§cGenerating Stab");
|
||||||
synchronized (calculating) {
|
|
||||||
calculating.remove(player);
|
|
||||||
}
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
SimulatorWatcher.show(simulator, player);
|
SimulatorWatcher.show(simulator, player);
|
||||||
List<REntity> entities = SimulatorWatcher.getEntitiesOfSimulator(simulator);
|
Cursor cursor = getOrCreateCursor(player, simulator, cursorType.getOrDefault(player, CursorType.TNT));
|
||||||
RayTraceUtils.RRayTraceResult rayTraceResult = RayTraceUtils.traceREntity(player, player.getLocation(), entities);
|
cursor.renderDeduplicated();
|
||||||
if (rayTraceResult == null) {
|
|
||||||
removeCursor(player);
|
|
||||||
if (simulator == null) {
|
|
||||||
SWUtils.sendToActionbar(player, "§eSelect Simulator");
|
|
||||||
} else {
|
|
||||||
SWUtils.sendToActionbar(player, "§eOpen Simulator");
|
|
||||||
}
|
|
||||||
synchronized (calculating) {
|
|
||||||
calculating.remove(player);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
showCursor(player, rayTraceResult, simulator != null);
|
private static Cursor getOrCreateCursor(Player player, Simulator simulator, CursorType type) {
|
||||||
synchronized (calculating) {
|
REntityServer targetServer = simulator == null ? emptyTargetServers.computeIfAbsent(player, __ -> new REntityServer()) : SimulatorWatcher.getEntityServerOfSimulator(simulator);
|
||||||
calculating.remove(player);
|
SWPlayer swPlayer = SWPlayer.of(player);
|
||||||
|
Optional<Cursor> activeCursor = swPlayer.getComponent(Cursor.class);
|
||||||
|
|
||||||
|
Cursor cursor = activeCursor.orElse(null);
|
||||||
|
if (cursor == null || cursor.getTargetServer() != targetServer) {
|
||||||
|
swPlayer.removeComponent(Cursor.class);
|
||||||
|
cursor = new Cursor(
|
||||||
|
targetServer,
|
||||||
|
player,
|
||||||
|
Material.GLASS,
|
||||||
|
type.material,
|
||||||
|
type.cursorModes,
|
||||||
|
(location, hitEntity, action) -> handlePlayerClick(player, location, hitEntity, action),
|
||||||
|
(location, hitEntity) -> sendCursorActionbar(player, SimulatorStorage.getSimulator(player), location != null, hitEntity.isPresent())
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
cursor.setCursorMaterial(type.material);
|
||||||
|
cursor.setAllowedCursorModes(type.cursorModes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return cursor;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static synchronized boolean removeCursor(Player player) {
|
private static synchronized boolean removeCursor(Player player) {
|
||||||
REntityServer entityServer = cursors.get(player);
|
Optional<Cursor> cursor = SWPlayer.of(player).getComponent(Cursor.class);
|
||||||
boolean hadCursor = entityServer != null && !entityServer.getEntities().isEmpty();
|
cursor.ifPresent(__ -> SWPlayer.of(player).removeComponent(Cursor.class));
|
||||||
if (entityServer != null) {
|
REntityServer emptyTargetServer = emptyTargetServers.remove(player);
|
||||||
entityServer.getEntities().forEach(REntity::die);
|
if (emptyTargetServer != null) {
|
||||||
|
emptyTargetServer.close();
|
||||||
}
|
}
|
||||||
return hadCursor;
|
return cursor.isPresent();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static synchronized void showCursor(Player player, RayTraceUtils.RRayTraceResult rayTraceResult, boolean hasSimulatorSelected) {
|
private static void sendCursorActionbar(Player player, Simulator simulator, boolean hasCursorLocation, boolean hasHitEntity) {
|
||||||
REntityServer entityServer = cursors.computeIfAbsent(player, __ -> {
|
if (!hasCursorLocation) {
|
||||||
REntityServer rEntityServer = new REntityServer();
|
SWUtils.sendToActionbar(player, simulator == null ? "§eSelect Simulator" : "§eOpen Simulator");
|
||||||
rEntityServer.addPlayer(player);
|
} else if (simulator == null) {
|
||||||
return rEntityServer;
|
SWUtils.sendToActionbar(player, "§eCreate new Simulator");
|
||||||
});
|
} else if (hasHitEntity) {
|
||||||
|
|
||||||
CursorType type = cursorType.getOrDefault(player, CursorType.TNT);
|
|
||||||
REntity hitEntity = rayTraceResult.getHitEntity();
|
|
||||||
Location location = hitEntity != null ? new Vector(hitEntity.getX(), hitEntity.getY(), hitEntity.getZ()).toLocation(WORLD) :
|
|
||||||
type.position.apply(player, rayTraceResult).toLocation(WORLD);
|
|
||||||
|
|
||||||
Material material = hitEntity != null ? Material.GLASS : type.getMaterial();
|
|
||||||
List<RFallingBlockEntity> entities = entityServer.getEntitiesByType(RFallingBlockEntity.class);
|
|
||||||
entities.removeIf(rFallingBlockEntity -> {
|
|
||||||
if (rFallingBlockEntity.getMaterial() != material) {
|
|
||||||
rFallingBlockEntity.die();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
rFallingBlockEntity.move(location);
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
if (entities.isEmpty()) {
|
|
||||||
RFallingBlockEntity rFallingBlockEntity = new RFallingBlockEntity(entityServer, location, material);
|
|
||||||
rFallingBlockEntity.setNoGravity(true);
|
|
||||||
if (material == Material.GLASS) {
|
|
||||||
rFallingBlockEntity.setGlowing(true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (hasSimulatorSelected) {
|
|
||||||
if (hitEntity != null) {
|
|
||||||
SWUtils.sendToActionbar(player, "§eEdit Position");
|
SWUtils.sendToActionbar(player, "§eEdit Position");
|
||||||
} else {
|
} else {
|
||||||
SWUtils.sendToActionbar(player, "§eAdd new " + type.name);
|
SWUtils.sendToActionbar(player, "§eAdd new " + cursorType.getOrDefault(player, CursorType.TNT).name);
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
SWUtils.sendToActionbar(player, "§eCreate new Simulator");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Vector getPosFree(Player player, RayTraceUtils.RRayTraceResult result) {
|
|
||||||
Vector pos = result.getHitPosition();
|
|
||||||
|
|
||||||
BlockFace face = result.getHitBlockFace();
|
|
||||||
if (face != null) {
|
|
||||||
switch (face) {
|
|
||||||
case DOWN:
|
|
||||||
pos.setY(pos.getY() - 0.98);
|
|
||||||
break;
|
|
||||||
case EAST:
|
|
||||||
pos.setX(pos.getX() + 0.49);
|
|
||||||
break;
|
|
||||||
case WEST:
|
|
||||||
pos.setX(pos.getX() - 0.49);
|
|
||||||
break;
|
|
||||||
case NORTH:
|
|
||||||
pos.setZ(pos.getZ() - 0.49);
|
|
||||||
break;
|
|
||||||
case SOUTH:
|
|
||||||
pos.setZ(pos.getZ() + 0.49);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (face.getModY() == 0 && player.isSneaking()) {
|
|
||||||
pos.setY(pos.getY() - 0.49);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!player.isSneaking()) {
|
|
||||||
pos.setX(pos.getBlockX() + 0.5);
|
|
||||||
if (face == null || face.getModY() == 0)
|
|
||||||
pos.setY(pos.getBlockY() + 0.0);
|
|
||||||
pos.setZ(pos.getBlockZ() + 0.5);
|
|
||||||
}
|
|
||||||
|
|
||||||
return pos;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static Vector getPosBlockAligned(Player player, RayTraceUtils.RRayTraceResult result) {
|
|
||||||
Vector pos = result.getHitPosition();
|
|
||||||
|
|
||||||
BlockFace face = result.getHitBlockFace();
|
|
||||||
if (face != null) {
|
|
||||||
switch (face) {
|
|
||||||
case DOWN:
|
|
||||||
pos.setY(pos.getY() - 0.98);
|
|
||||||
break;
|
|
||||||
case EAST:
|
|
||||||
pos.setX(pos.getX() + 0.49);
|
|
||||||
break;
|
|
||||||
case WEST:
|
|
||||||
pos.setX(pos.getX() - 0.49);
|
|
||||||
break;
|
|
||||||
case NORTH:
|
|
||||||
pos.setZ(pos.getZ() - 0.49);
|
|
||||||
break;
|
|
||||||
case SOUTH:
|
|
||||||
pos.setZ(pos.getZ() + 0.49);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pos.setX(pos.getBlockX() + 0.5);
|
|
||||||
if (pos.getY() - pos.getBlockY() != 0 && face == BlockFace.UP) {
|
|
||||||
pos.setY(pos.getBlockY() + 1.0);
|
|
||||||
} else {
|
|
||||||
pos.setY(pos.getBlockY());
|
|
||||||
}
|
|
||||||
pos.setZ(pos.getBlockZ() + 0.5);
|
|
||||||
return pos;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public enum CursorType {
|
public enum CursorType {
|
||||||
TNT(Material.TNT, Material.GUNPOWDER, SimulatorCursor::getPosFree, "TNT", vector -> new TNTElement(vector).add(new TNTPhase())),
|
TNT(Material.TNT, Material.GUNPOWDER, List.of(Cursor.CursorMode.FREE, Cursor.CursorMode.SURFACE_ALIGNED), "TNT", vector -> new TNTElement(vector).add(new TNTPhase())),
|
||||||
REDSTONE_BLOCK(Material.REDSTONE_BLOCK, Material.REDSTONE, SimulatorCursor::getPosBlockAligned, "Redstone Block", vector -> new RedstoneElement(vector).add(new RedstonePhase())),
|
REDSTONE_BLOCK(Material.REDSTONE_BLOCK, Material.REDSTONE, List.of(Cursor.CursorMode.BLOCK_ALIGNED), "Redstone Block", vector -> new RedstoneElement(vector).add(new RedstonePhase())),
|
||||||
OBSERVER(Material.OBSERVER, Material.QUARTZ, SimulatorCursor::getPosBlockAligned, "Observer", vector -> new ObserverElement(vector).add(new ObserverPhase())),
|
OBSERVER(Material.OBSERVER, Material.QUARTZ, List.of(Cursor.CursorMode.BLOCK_ALIGNED), "Observer", vector -> new ObserverElement(vector).add(new ObserverPhase())),
|
||||||
;
|
;
|
||||||
|
|
||||||
public final Material material;
|
public final Material material;
|
||||||
public final Material nonSelectedMaterial;
|
public final Material nonSelectedMaterial;
|
||||||
public final BiFunction<Player, RayTraceUtils.RRayTraceResult, Vector> position;
|
public final List<Cursor.CursorMode> cursorModes;
|
||||||
public final String name;
|
public final String name;
|
||||||
public final Function<Vector, SimulatorElement<?>> elementFunction;
|
public final Function<Vector, SimulatorElement<?>> elementFunction;
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
private static void handlePlayerClick(Player player, Location cursorLocation, Optional<REntity> hitEntity, Action action) {
|
||||||
public void onPlayerInteract(PlayerInteractEvent event) {
|
if (!Permission.BUILD.hasPermission(player)) return;
|
||||||
if (!Permission.BUILD.hasPermission(event.getPlayer())) return;
|
if (!hasSimulatorItem(player)) {
|
||||||
if (!ItemUtils.isItem(event.getItem(), "simulator")) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
event.setCancelled(true);
|
|
||||||
Player player = event.getPlayer();
|
|
||||||
Simulator simulator = SimulatorStorage.getSimulator(player);
|
Simulator simulator = SimulatorStorage.getSimulator(player);
|
||||||
|
|
||||||
if (event.getAction() == Action.LEFT_CLICK_BLOCK || event.getAction() == Action.LEFT_CLICK_AIR) {
|
if (action == Action.LEFT_CLICK_BLOCK || action == Action.LEFT_CLICK_AIR) {
|
||||||
if (simulator == null) {
|
if (simulator == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
SimulatorExecutor.run(event.getPlayer(), simulator, null);
|
SimulatorExecutor.run(player, simulator, null);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (event.getAction() != Action.RIGHT_CLICK_BLOCK && event.getAction() != Action.RIGHT_CLICK_AIR) {
|
if (action != Action.RIGHT_CLICK_BLOCK && action != Action.RIGHT_CLICK_AIR) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
RayTraceUtils.RRayTraceResult rayTraceResult = RayTraceUtils.traceREntity(player, player.getLocation(), SimulatorWatcher.getEntitiesOfSimulator(simulator));
|
|
||||||
if (simulator == null) {
|
if (simulator == null) {
|
||||||
if (rayTraceResult == null) {
|
if (cursorLocation == null) {
|
||||||
SimulatorStorage.openSimulatorSelector(player);
|
SimulatorStorage.openSimulatorSelector(player);
|
||||||
} else {
|
} else {
|
||||||
SWAnvilInv anvilInv = new SWAnvilInv(player, "Name");
|
SWAnvilInv anvilInv = new SWAnvilInv(player, "Name");
|
||||||
@@ -396,7 +282,7 @@ public class SimulatorCursor implements Listener {
|
|||||||
}
|
}
|
||||||
sim = new Simulator(s);
|
sim = new Simulator(s);
|
||||||
SimulatorStorage.addSimulator(s, sim);
|
SimulatorStorage.addSimulator(s, sim);
|
||||||
createElement(player, rayTraceResult, sim);
|
createElement(player, cursorLocation, sim);
|
||||||
SimulatorStorage.setSimulator(player, sim);
|
SimulatorStorage.setSimulator(player, sim);
|
||||||
});
|
});
|
||||||
anvilInv.open();
|
anvilInv.open();
|
||||||
@@ -404,13 +290,20 @@ public class SimulatorCursor implements Listener {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rayTraceResult == null) {
|
if (cursorLocation == null) {
|
||||||
new SimulatorGui(player, simulator).open();
|
new SimulatorGui(player, simulator).open();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rayTraceResult.getHitEntity() != null) {
|
if (hitEntity.isPresent()) {
|
||||||
REntity hitEntity = rayTraceResult.getHitEntity();
|
openElement(player, simulator, hitEntity.get());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
createElement(player, cursorLocation, simulator);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void openElement(Player player, Simulator simulator, REntity hitEntity) {
|
||||||
Vector vector = new Vector(hitEntity.getX(), hitEntity.getY(), hitEntity.getZ());
|
Vector vector = new Vector(hitEntity.getX(), hitEntity.getY(), hitEntity.getZ());
|
||||||
List<SimulatorElement<?>> elements = simulator.getGroups().stream().map(SimulatorGroup::getElements).flatMap(List::stream).filter(element -> {
|
List<SimulatorElement<?>> elements = simulator.getGroups().stream().map(SimulatorGroup::getElements).flatMap(List::stream).filter(element -> {
|
||||||
return element.getWorldPos().distanceSquared(vector) < (1 / 16.0) * (1 / 16.0);
|
return element.getWorldPos().distanceSquared(vector) < (1 / 16.0) * (1 / 16.0);
|
||||||
@@ -420,7 +313,6 @@ public class SimulatorCursor implements Listener {
|
|||||||
case 0:
|
case 0:
|
||||||
return;
|
return;
|
||||||
case 1:
|
case 1:
|
||||||
// Open single element present in Simulator
|
|
||||||
SimulatorElement<?> element = elements.get(0);
|
SimulatorElement<?> element = elements.get(0);
|
||||||
SimulatorGroup group1 = element.getGroup(simulator);
|
SimulatorGroup group1 = element.getGroup(simulator);
|
||||||
SimulatorBaseGui back = new SimulatorGui(player, simulator);
|
SimulatorBaseGui back = new SimulatorGui(player, simulator);
|
||||||
@@ -432,11 +324,9 @@ public class SimulatorCursor implements Listener {
|
|||||||
default:
|
default:
|
||||||
List<SimulatorGroup> parents = elements.stream().map(e -> e.getGroup(simulator)).distinct().collect(Collectors.toList());
|
List<SimulatorGroup> parents = elements.stream().map(e -> e.getGroup(simulator)).distinct().collect(Collectors.toList());
|
||||||
if (parents.size() == 1) {
|
if (parents.size() == 1) {
|
||||||
// Open multi element present in Simulator in existing group
|
|
||||||
SimulatorGui simulatorGui = new SimulatorGui(player, simulator);
|
SimulatorGui simulatorGui = new SimulatorGui(player, simulator);
|
||||||
new SimulatorGroupGui(player, simulator, parents.get(0), simulatorGui).open();
|
new SimulatorGroupGui(player, simulator, parents.get(0), simulatorGui).open();
|
||||||
} else {
|
} else {
|
||||||
// Open multi element present in Simulator in implicit group
|
|
||||||
SimulatorGroup group2 = new SimulatorGroup();
|
SimulatorGroup group2 = new SimulatorGroup();
|
||||||
group2.setMaterial(null);
|
group2.setMaterial(null);
|
||||||
group2.getElements().addAll(elements);
|
group2.getElements().addAll(elements);
|
||||||
@@ -445,16 +335,11 @@ public class SimulatorCursor implements Listener {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add new Element to current simulator
|
private static void createElement(Player player, Location cursorLocation, Simulator simulator) {
|
||||||
createElement(player, rayTraceResult, simulator);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void createElement(Player player, RayTraceUtils.RRayTraceResult rayTraceResult, Simulator simulator) {
|
|
||||||
CursorType type = cursorType.getOrDefault(player, CursorType.TNT);
|
CursorType type = cursorType.getOrDefault(player, CursorType.TNT);
|
||||||
Vector vector = type.position.apply(player, rayTraceResult);
|
Vector vector = cursorLocation.toVector();
|
||||||
if (type == CursorType.REDSTONE_BLOCK) {
|
if (type == CursorType.REDSTONE_BLOCK) {
|
||||||
vector.subtract(new Vector(0.5, 0, 0.5));
|
vector.subtract(new Vector(0.5, 0, 0.5));
|
||||||
}
|
}
|
||||||
|
|||||||
-2
@@ -32,7 +32,6 @@ import de.steamwar.bausystem.utils.ItemUtils;
|
|||||||
import de.steamwar.inventory.SWAnvilInv;
|
import de.steamwar.inventory.SWAnvilInv;
|
||||||
import de.steamwar.inventory.SWItem;
|
import de.steamwar.inventory.SWItem;
|
||||||
import de.steamwar.linkage.Linked;
|
import de.steamwar.linkage.Linked;
|
||||||
import de.steamwar.linkage.MinVersion;
|
|
||||||
import de.steamwar.linkage.api.Enable;
|
import de.steamwar.linkage.api.Enable;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
@@ -47,7 +46,6 @@ import java.util.*;
|
|||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@Linked
|
@Linked
|
||||||
@MinVersion(19)
|
|
||||||
public class SimulatorStorage implements Enable {
|
public class SimulatorStorage implements Enable {
|
||||||
|
|
||||||
public static final File simulatorsDir = new File(Bukkit.getWorlds().get(0).getWorldFolder(), "simulators");
|
public static final File simulatorsDir = new File(Bukkit.getWorlds().get(0).getWorldFolder(), "simulators");
|
||||||
|
|||||||
+7
-2
@@ -28,7 +28,6 @@ import de.steamwar.entity.REntity;
|
|||||||
import de.steamwar.entity.REntityServer;
|
import de.steamwar.entity.REntityServer;
|
||||||
import de.steamwar.entity.RFallingBlockEntity;
|
import de.steamwar.entity.RFallingBlockEntity;
|
||||||
import de.steamwar.linkage.Linked;
|
import de.steamwar.linkage.Linked;
|
||||||
import de.steamwar.linkage.MinVersion;
|
|
||||||
import lombok.experimental.UtilityClass;
|
import lombok.experimental.UtilityClass;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
@@ -75,7 +74,6 @@ public class SimulatorWatcher {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Linked
|
@Linked
|
||||||
@MinVersion(19)
|
|
||||||
public static class QuitListener implements Listener {
|
public static class QuitListener implements Listener {
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
@@ -126,4 +124,11 @@ public class SimulatorWatcher {
|
|||||||
}
|
}
|
||||||
return entityServer.getEntities();
|
return entityServer.getEntities();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
synchronized REntityServer getEntityServerOfSimulator(Simulator simulator) {
|
||||||
|
if (simulator == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return entityServers.computeIfAbsent(simulator, __ -> createSim(new REntityServer(), simulator));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+6
-2
@@ -120,6 +120,10 @@ public abstract class SimulatorElement<T extends SimulatorPhase> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public abstract String getType();
|
public abstract String getType();
|
||||||
public void saveExtra(YAPIONObject elementObject) {}
|
|
||||||
public void loadExtra(YAPIONObject elementObject) {}
|
public void saveExtra(YAPIONObject elementObject) {
|
||||||
|
}
|
||||||
|
|
||||||
|
public void loadExtra(YAPIONObject elementObject) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+6
-2
@@ -37,6 +37,10 @@ public abstract class SimulatorPhase {
|
|||||||
protected int order = 0;
|
protected int order = 0;
|
||||||
|
|
||||||
public abstract void toSimulatorActions(Vector position, BiConsumer<Integer, SimulatorAction> tickStart, BiConsumer<Integer, SimulatorAction> tickEnd);
|
public abstract void toSimulatorActions(Vector position, BiConsumer<Integer, SimulatorAction> tickStart, BiConsumer<Integer, SimulatorAction> tickEnd);
|
||||||
public void saveExtra(YAPIONObject phaseObject) {}
|
|
||||||
public void loadExtra(YAPIONObject phaseObject) {}
|
public void saveExtra(YAPIONObject phaseObject) {
|
||||||
|
}
|
||||||
|
|
||||||
|
public void loadExtra(YAPIONObject phaseObject) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-1
@@ -65,7 +65,9 @@ public final class TNTPhase extends SimulatorPhase {
|
|||||||
@Override
|
@Override
|
||||||
public void accept(World world) {
|
public void accept(World world) {
|
||||||
Location location = position.toLocation(world);
|
Location location = position.toLocation(world);
|
||||||
if (Region.getRegion(location).getRegionData().get(Flag.FREEZE).isWithDefault(FreezeMode.ACTIVE)) return;
|
if (Region.getRegion(location).getRegionData().get(Flag.FREEZE).isWithDefault(FreezeMode.ACTIVE)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
TNTPrimed tnt = world.spawn(location, TNTPrimed.class);
|
TNTPrimed tnt = world.spawn(location, TNTPrimed.class);
|
||||||
if (!xJump) tnt.setVelocity(tnt.getVelocity().setX(0));
|
if (!xJump) tnt.setVelocity(tnt.getVelocity().setX(0));
|
||||||
if (!yJump) tnt.setVelocity(tnt.getVelocity().setY(0));
|
if (!yJump) tnt.setVelocity(tnt.getVelocity().setY(0));
|
||||||
|
|||||||
-2
@@ -29,7 +29,6 @@ import de.steamwar.bausystem.features.tracer.TraceRecorder;
|
|||||||
import de.steamwar.bausystem.region.Region;
|
import de.steamwar.bausystem.region.Region;
|
||||||
import de.steamwar.bausystem.utils.TickManager;
|
import de.steamwar.bausystem.utils.TickManager;
|
||||||
import de.steamwar.linkage.Linked;
|
import de.steamwar.linkage.Linked;
|
||||||
import de.steamwar.linkage.MinVersion;
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@@ -40,7 +39,6 @@ import java.util.*;
|
|||||||
import java.util.concurrent.atomic.AtomicLong;
|
import java.util.concurrent.atomic.AtomicLong;
|
||||||
|
|
||||||
@Linked
|
@Linked
|
||||||
@MinVersion(19)
|
|
||||||
public class SimulatorExecutor implements Listener {
|
public class SimulatorExecutor implements Listener {
|
||||||
|
|
||||||
private static final World WORLD = Bukkit.getWorlds().get(0);
|
private static final World WORLD = Bukkit.getWorlds().get(0);
|
||||||
|
|||||||
+2
-1
@@ -55,8 +55,9 @@ public class StabGenerator extends StabStep implements Listener {
|
|||||||
if (!(event.getEntity() instanceof TNTPrimed)) return;
|
if (!(event.getEntity() instanceof TNTPrimed)) return;
|
||||||
if (Region.getRegion(event.getEntity().getLocation()) == data.region) {
|
if (Region.getRegion(event.getEntity().getLocation()) == data.region) {
|
||||||
event.blockList().forEach(block -> {
|
event.blockList().forEach(block -> {
|
||||||
if (!data.region.getTestblockArea().inRegion(block.getLocation(), true))
|
if (!data.region.getTestblockArea().inRegion(block.getLocation(), true)) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
int component = data.direction.component.apply(block.getLocation().toVector());
|
int component = data.direction.component.apply(block.getLocation().toVector());
|
||||||
destroyedBlocksPerSlice.computeIfAbsent(component, __ -> new HashSet<>())
|
destroyedBlocksPerSlice.computeIfAbsent(component, __ -> new HashSet<>())
|
||||||
.add(block.getLocation());
|
.add(block.getLocation());
|
||||||
|
|||||||
+8
-8
@@ -69,7 +69,7 @@ public class SimulatorGroupSettingsGui extends SimulatorBaseGui {
|
|||||||
|
|
||||||
// Base Tick
|
// Base Tick
|
||||||
int baseTicks = simulatorGroup.getBaseTick();
|
int baseTicks = simulatorGroup.getBaseTick();
|
||||||
inventory.setItem(9, new SWItem(SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
|
inventory.setItem(9, new SWItem(Material.LIME_DYE, "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
|
||||||
simulatorGroup.changeBaseTicks(clickType.isShiftClick() ? 5 : 1);
|
simulatorGroup.changeBaseTicks(clickType.isShiftClick() ? 5 : 1);
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
}).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED));
|
}).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED));
|
||||||
@@ -83,7 +83,7 @@ public class SimulatorGroupSettingsGui extends SimulatorBaseGui {
|
|||||||
});
|
});
|
||||||
baseTick.getItemStack().setAmount(Math.max(1, Math.min(baseTicks, 64)));
|
baseTick.getItemStack().setAmount(Math.max(1, Math.min(baseTicks, 64)));
|
||||||
inventory.setItem(18, baseTick);
|
inventory.setItem(18, baseTick);
|
||||||
inventory.setItem(27, new SWItem(SWItem.getDye(baseTicks > 0 ? 1 : 8), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
|
inventory.setItem(27, new SWItem(baseTicks > 0 ? Material.RED_DYE : Material.GRAY_DYE, "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
|
||||||
if (baseTicks - (clickType.isShiftClick() ? 5 : 1) < 0) {
|
if (baseTicks - (clickType.isShiftClick() ? 5 : 1) < 0) {
|
||||||
simulatorGroup.changeBaseTicks(-baseTicks);
|
simulatorGroup.changeBaseTicks(-baseTicks);
|
||||||
} else {
|
} else {
|
||||||
@@ -163,7 +163,7 @@ public class SimulatorGroupSettingsGui extends SimulatorBaseGui {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Pos X
|
//Pos X
|
||||||
inventory.setItem(15, new SWItem(SWItem.getDye(10), "§e+1", Arrays.asList(allTNT ? "§7Shift§8: §e+0.0625" : "§7Shift§8: §e+5"), false, clickType -> {
|
inventory.setItem(15, new SWItem(Material.LIME_DYE, "§e+1", Arrays.asList(allTNT ? "§7Shift§8: §e+0.0625" : "§7Shift§8: §e+5"), false, clickType -> {
|
||||||
simulatorGroup.move(clickType.isShiftClick() ? (allTNT ? 0.0625 : 5) : 1, 0, 0);
|
simulatorGroup.move(clickType.isShiftClick() ? (allTNT ? 0.0625 : 5) : 1, 0, 0);
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
}).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED));
|
}).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED));
|
||||||
@@ -177,13 +177,13 @@ public class SimulatorGroupSettingsGui extends SimulatorBaseGui {
|
|||||||
return true;
|
return true;
|
||||||
}, this).setItem(Material.PAPER).open();
|
}, this).setItem(Material.PAPER).open();
|
||||||
}));
|
}));
|
||||||
inventory.setItem(33, new SWItem(SWItem.getDye(1), "§e-1", Arrays.asList(allTNT ? "§7Shift§8: §e-0.0625" : "§7Shift§8: §e-5"), false, clickType -> {
|
inventory.setItem(33, new SWItem(Material.RED_DYE, "§e-1", Arrays.asList(allTNT ? "§7Shift§8: §e-0.0625" : "§7Shift§8: §e-5"), false, clickType -> {
|
||||||
simulatorGroup.move(clickType.isShiftClick() ? (allTNT ? -0.0625 : -5) : -1, 0, 0);
|
simulatorGroup.move(clickType.isShiftClick() ? (allTNT ? -0.0625 : -5) : -1, 0, 0);
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
}).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED));
|
}).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED));
|
||||||
|
|
||||||
//Pos Y
|
//Pos Y
|
||||||
inventory.setItem(16, new SWItem(SWItem.getDye(10), "§e+1", Arrays.asList(allTNT ? "§7Shift§8: §e+0.0625" : "§7Shift§8: §e+5"), false, clickType -> {
|
inventory.setItem(16, new SWItem(Material.LIME_DYE, "§e+1", Arrays.asList(allTNT ? "§7Shift§8: §e+0.0625" : "§7Shift§8: §e+5"), false, clickType -> {
|
||||||
simulatorGroup.move(0, clickType.isShiftClick() ? (allTNT ? 0.0625 : 5) : 1, 0);
|
simulatorGroup.move(0, clickType.isShiftClick() ? (allTNT ? 0.0625 : 5) : 1, 0);
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
}).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED));
|
}).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED));
|
||||||
@@ -197,13 +197,13 @@ public class SimulatorGroupSettingsGui extends SimulatorBaseGui {
|
|||||||
return true;
|
return true;
|
||||||
}, this).setItem(Material.PAPER).open();
|
}, this).setItem(Material.PAPER).open();
|
||||||
}));
|
}));
|
||||||
inventory.setItem(34, new SWItem(SWItem.getDye(1), "§e-1", Arrays.asList(allTNT ? "§7Shift§8: §e-0.0625" : "§7Shift§8: §e-5"), false, clickType -> {
|
inventory.setItem(34, new SWItem(Material.RED_DYE, "§e-1", Arrays.asList(allTNT ? "§7Shift§8: §e-0.0625" : "§7Shift§8: §e-5"), false, clickType -> {
|
||||||
simulatorGroup.move(0, clickType.isShiftClick() ? (allTNT ? -0.0625 : -5) : -1, 0);
|
simulatorGroup.move(0, clickType.isShiftClick() ? (allTNT ? -0.0625 : -5) : -1, 0);
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
}).setCustomModelData(CMDs.Simulator.ENABLED_OR_DISABLED));
|
}).setCustomModelData(CMDs.Simulator.ENABLED_OR_DISABLED));
|
||||||
|
|
||||||
//Pos Z
|
//Pos Z
|
||||||
inventory.setItem(17, new SWItem(SWItem.getDye(10), "§e+1", Arrays.asList(allTNT ? "§7Shift§8: §e+0.0625" : "§7Shift§8: §e+5"), false, clickType -> {
|
inventory.setItem(17, new SWItem(Material.LIME_DYE, "§e+1", Arrays.asList(allTNT ? "§7Shift§8: §e+0.0625" : "§7Shift§8: §e+5"), false, clickType -> {
|
||||||
simulatorGroup.move(0, 0, clickType.isShiftClick() ? (allTNT ? 0.0625 : 5) : 1);
|
simulatorGroup.move(0, 0, clickType.isShiftClick() ? (allTNT ? 0.0625 : 5) : 1);
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
}).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED));
|
}).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED));
|
||||||
@@ -217,7 +217,7 @@ public class SimulatorGroupSettingsGui extends SimulatorBaseGui {
|
|||||||
return true;
|
return true;
|
||||||
}, this).setItem(Material.PAPER).open();
|
}, this).setItem(Material.PAPER).open();
|
||||||
}));
|
}));
|
||||||
inventory.setItem(35, new SWItem(SWItem.getDye(1), "§e-1", Arrays.asList(allTNT ? "§7Shift§8: §e-0.0625" : "§7Shift§8: §e-5"), false, clickType -> {
|
inventory.setItem(35, new SWItem(Material.RED_DYE, "§e-1", Arrays.asList(allTNT ? "§7Shift§8: §e-0.0625" : "§7Shift§8: §e-5"), false, clickType -> {
|
||||||
simulatorGroup.move(0, 0, clickType.isShiftClick() ? (allTNT ? -0.0625 : -5) : -1);
|
simulatorGroup.move(0, 0, clickType.isShiftClick() ? (allTNT ? -0.0625 : -5) : -1);
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
}).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED));
|
}).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED));
|
||||||
|
|||||||
+4
-4
@@ -149,13 +149,13 @@ public class SimulatorObserverGui extends SimulatorScrollGui<ObserverPhase> {
|
|||||||
Supplier<Integer> getter = observerPhase::getTickOffset;
|
Supplier<Integer> getter = observerPhase::getTickOffset;
|
||||||
Consumer<Integer> setter = observerPhase::setTickOffset;
|
Consumer<Integer> setter = observerPhase::setTickOffset;
|
||||||
return new SWItem[]{
|
return new SWItem[]{
|
||||||
new SWItem(SWItem.getDye(getter.get() < max ? 10 : 8), "§e+1", Arrays.asList("§7Shift§8:§e +5"), false, clickType -> {
|
new SWItem(getter.get() < max ? Material.LIME_DYE : Material.GRAY_DYE, "§e+1", Arrays.asList("§7Shift§8:§e +5"), false, clickType -> {
|
||||||
if (clickType == ClickType.DOUBLE_CLICK) return;
|
if (clickType == ClickType.DOUBLE_CLICK) return;
|
||||||
setter.accept(Math.min(max, getter.get() + (clickType.isShiftClick() ? 5 : 1)));
|
setter.accept(Math.min(max, getter.get() + (clickType.isShiftClick() ? 5 : 1)));
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
}).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED),
|
}).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED),
|
||||||
observer,
|
observer,
|
||||||
new SWItem(SWItem.getDye(getter.get() > min ? 1 : 8), "§e-1", Arrays.asList("§7Shift§8:§e -5"), false, clickType -> {
|
new SWItem(getter.get() > min ? Material.RED_DYE : Material.GRAY_DYE, "§e-1", Arrays.asList("§7Shift§8:§e -5"), false, clickType -> {
|
||||||
if (clickType == ClickType.DOUBLE_CLICK) return;
|
if (clickType == ClickType.DOUBLE_CLICK) return;
|
||||||
setter.accept(Math.max(min, getter.get() - (clickType.isShiftClick() ? 5 : 1)));
|
setter.accept(Math.max(min, getter.get() - (clickType.isShiftClick() ? 5 : 1)));
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
@@ -169,13 +169,13 @@ public class SimulatorObserverGui extends SimulatorScrollGui<ObserverPhase> {
|
|||||||
@Override
|
@Override
|
||||||
public SWItem[] lastColumn() {
|
public SWItem[] lastColumn() {
|
||||||
return new SWItem[]{
|
return new SWItem[]{
|
||||||
new SWItem(SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8:§e +5"), false, clickType -> {
|
new SWItem(Material.LIME_DYE, "§e+1", Arrays.asList("§7Shift§8:§e +5"), false, clickType -> {
|
||||||
addNewPhase(clickType.isShiftClick());
|
addNewPhase(clickType.isShiftClick());
|
||||||
}).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED),
|
}).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED),
|
||||||
new SWItem(Material.QUARTZ, "§eObserver§8:§a New Phase", clickType -> {
|
new SWItem(Material.QUARTZ, "§eObserver§8:§a New Phase", clickType -> {
|
||||||
addNewPhase(false);
|
addNewPhase(false);
|
||||||
}).setCustomModelData(CMDs.Simulator.NEW_PHASE),
|
}).setCustomModelData(CMDs.Simulator.NEW_PHASE),
|
||||||
new SWItem(SWItem.getDye(8), "§7", clickType -> {
|
new SWItem(Material.GRAY_DYE, "§7", clickType -> {
|
||||||
}).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED),
|
}).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
+6
-8
@@ -26,7 +26,6 @@ import de.steamwar.bausystem.features.simulator.data.observer.ObserverElement;
|
|||||||
import de.steamwar.bausystem.features.simulator.data.observer.ObserverPhase;
|
import de.steamwar.bausystem.features.simulator.data.observer.ObserverPhase;
|
||||||
import de.steamwar.bausystem.features.simulator.gui.base.SimulatorAnvilGui;
|
import de.steamwar.bausystem.features.simulator.gui.base.SimulatorAnvilGui;
|
||||||
import de.steamwar.bausystem.features.simulator.gui.base.SimulatorBaseGui;
|
import de.steamwar.bausystem.features.simulator.gui.base.SimulatorBaseGui;
|
||||||
import de.steamwar.core.Core;
|
|
||||||
import de.steamwar.data.CMDs;
|
import de.steamwar.data.CMDs;
|
||||||
import de.steamwar.inventory.SWItem;
|
import de.steamwar.inventory.SWItem;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
@@ -97,7 +96,7 @@ public class SimulatorObserverPhaseSettingsGui extends SimulatorBaseGui {
|
|||||||
|
|
||||||
//Tick Offset
|
//Tick Offset
|
||||||
int offset = observer.getTickOffset();
|
int offset = observer.getTickOffset();
|
||||||
inventory.setItem(10, new SWItem(SWItem.getDye(offset < max ? 10 : 8), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
|
inventory.setItem(10, new SWItem(offset < max ? Material.LIME_DYE : Material.GRAY_DYE, "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
|
||||||
if (clickType == ClickType.DOUBLE_CLICK) return;
|
if (clickType == ClickType.DOUBLE_CLICK) return;
|
||||||
observer.setTickOffset(Math.min(max, offset + (clickType.isShiftClick() ? 5 : 1)));
|
observer.setTickOffset(Math.min(max, offset + (clickType.isShiftClick() ? 5 : 1)));
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
@@ -114,7 +113,7 @@ public class SimulatorObserverPhaseSettingsGui extends SimulatorBaseGui {
|
|||||||
offsetItem.getItemStack().setAmount(Math.max(1, Math.min(offset, 64)));
|
offsetItem.getItemStack().setAmount(Math.max(1, Math.min(offset, 64)));
|
||||||
inventory.setItem(19, offsetItem);
|
inventory.setItem(19, offsetItem);
|
||||||
|
|
||||||
inventory.setItem(28, new SWItem(SWItem.getDye(offset > min ? 1 : 8), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
|
inventory.setItem(28, new SWItem(offset > min ? Material.RED_DYE : Material.GRAY_DYE, "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
|
||||||
if (clickType == ClickType.DOUBLE_CLICK) return;
|
if (clickType == ClickType.DOUBLE_CLICK) return;
|
||||||
observer.setTickOffset(Math.max(min, offset - (clickType.isShiftClick() ? 5 : 1)));
|
observer.setTickOffset(Math.max(min, offset - (clickType.isShiftClick() ? 5 : 1)));
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
@@ -122,26 +121,25 @@ public class SimulatorObserverPhaseSettingsGui extends SimulatorBaseGui {
|
|||||||
|
|
||||||
//Order
|
//Order
|
||||||
int order = observer.getOrder();
|
int order = observer.getOrder();
|
||||||
inventory.setItem(13, new SWItem(SWItem.getDye(order < SimulatorPhase.ORDER_LIMIT ? 10 : 8), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
|
inventory.setItem(13, new SWItem(order < SimulatorPhase.ORDER_LIMIT ? Material.LIME_DYE : Material.GRAY_DYE, "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
|
||||||
if (clickType == ClickType.DOUBLE_CLICK) return;
|
if (clickType == ClickType.DOUBLE_CLICK) return;
|
||||||
observer.setOrder(Math.min(SimulatorPhase.ORDER_LIMIT, order + (clickType.isShiftClick() ? 5 : 1)));
|
observer.setOrder(Math.min(SimulatorPhase.ORDER_LIMIT, order + (clickType.isShiftClick() ? 5 : 1)));
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
}).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED));
|
}).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED));
|
||||||
|
|
||||||
Material negativeNumbers = Material.getMaterial(Core.getVersion() >= 19 ? "RECOVERY_COMPASS" : "FIREWORK_STAR");
|
SWItem orderItem = new SWItem(order >= 0 ? Material.COMPASS : Material.RECOVERY_COMPASS, "§eActivation Order§8:§7 " + order, clickType -> {
|
||||||
SWItem orderItem = new SWItem(order >= 0 ? Material.COMPASS : negativeNumbers, "§eActivation Order§8:§7 " + order, clickType -> {
|
|
||||||
new SimulatorAnvilGui<>(player, "Activation Order", order + "", Integer::parseInt, integer -> {
|
new SimulatorAnvilGui<>(player, "Activation Order", order + "", Integer::parseInt, integer -> {
|
||||||
if (integer < -SimulatorPhase.ORDER_LIMIT) return false;
|
if (integer < -SimulatorPhase.ORDER_LIMIT) return false;
|
||||||
if (integer > SimulatorPhase.ORDER_LIMIT) return false;
|
if (integer > SimulatorPhase.ORDER_LIMIT) return false;
|
||||||
observer.setOrder(integer);
|
observer.setOrder(integer);
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
return true;
|
return true;
|
||||||
}, this).setItem(order >= 0 ? Material.COMPASS : negativeNumbers).open();
|
}, this).setItem(order >= 0 ? Material.COMPASS : Material.RECOVERY_COMPASS).open();
|
||||||
});
|
});
|
||||||
orderItem.getItemStack().setAmount(Math.max(1, Math.min(Math.abs(order), 30)));
|
orderItem.getItemStack().setAmount(Math.max(1, Math.min(Math.abs(order), 30)));
|
||||||
inventory.setItem(22, orderItem);
|
inventory.setItem(22, orderItem);
|
||||||
|
|
||||||
inventory.setItem(31, new SWItem(SWItem.getDye(order > -SimulatorPhase.ORDER_LIMIT ? 1 : 8), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
|
inventory.setItem(31, new SWItem(order > -SimulatorPhase.ORDER_LIMIT ? Material.RED_DYE : Material.GRAY_DYE, "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
|
||||||
if (clickType == ClickType.DOUBLE_CLICK) return;
|
if (clickType == ClickType.DOUBLE_CLICK) return;
|
||||||
observer.setOrder(Math.max(-SimulatorPhase.ORDER_LIMIT, order - (clickType.isShiftClick() ? 5 : 1)));
|
observer.setOrder(Math.max(-SimulatorPhase.ORDER_LIMIT, order - (clickType.isShiftClick() ? 5 : 1)));
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
|
|||||||
+8
-8
@@ -67,7 +67,7 @@ public class SimulatorObserverSettingsGui extends SimulatorBaseGui {
|
|||||||
|
|
||||||
// Base Tick
|
// Base Tick
|
||||||
int baseTicks = observer.getBaseTick();
|
int baseTicks = observer.getBaseTick();
|
||||||
inventory.setItem(9, new SWItem(SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
|
inventory.setItem(9, new SWItem(Material.LIME_DYE, "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
|
||||||
if (clickType == ClickType.DOUBLE_CLICK) return;
|
if (clickType == ClickType.DOUBLE_CLICK) return;
|
||||||
observer.changeBaseTicks(clickType.isShiftClick() ? 5 : 1);
|
observer.changeBaseTicks(clickType.isShiftClick() ? 5 : 1);
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
@@ -82,7 +82,7 @@ public class SimulatorObserverSettingsGui extends SimulatorBaseGui {
|
|||||||
});
|
});
|
||||||
baseTick.getItemStack().setAmount(Math.max(1, Math.min(baseTicks, 64)));
|
baseTick.getItemStack().setAmount(Math.max(1, Math.min(baseTicks, 64)));
|
||||||
inventory.setItem(18, baseTick);
|
inventory.setItem(18, baseTick);
|
||||||
inventory.setItem(27, new SWItem(SWItem.getDye(baseTicks > 0 ? 1 : 8), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
|
inventory.setItem(27, new SWItem(baseTicks > 0 ? Material.RED_DYE : Material.GRAY_DYE, "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
|
||||||
if (clickType == ClickType.DOUBLE_CLICK) return;
|
if (clickType == ClickType.DOUBLE_CLICK) return;
|
||||||
if (baseTicks - (clickType.isShiftClick() ? 5 : 1) < 0) {
|
if (baseTicks - (clickType.isShiftClick() ? 5 : 1) < 0) {
|
||||||
observer.changeBaseTicks(-baseTicks);
|
observer.changeBaseTicks(-baseTicks);
|
||||||
@@ -93,7 +93,7 @@ public class SimulatorObserverSettingsGui extends SimulatorBaseGui {
|
|||||||
}).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED));
|
}).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED));
|
||||||
|
|
||||||
//Pos X
|
//Pos X
|
||||||
inventory.setItem(15, new SWItem(SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
|
inventory.setItem(15, new SWItem(Material.LIME_DYE, "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
|
||||||
if (clickType == ClickType.DOUBLE_CLICK) return;
|
if (clickType == ClickType.DOUBLE_CLICK) return;
|
||||||
observer.move(clickType.isShiftClick() ? 5 : 1, 0, 0);
|
observer.move(clickType.isShiftClick() ? 5 : 1, 0, 0);
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
@@ -105,14 +105,14 @@ public class SimulatorObserverSettingsGui extends SimulatorBaseGui {
|
|||||||
return true;
|
return true;
|
||||||
}, this).open();
|
}, this).open();
|
||||||
}));
|
}));
|
||||||
inventory.setItem(33, new SWItem(SWItem.getDye(1), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
|
inventory.setItem(33, new SWItem(Material.RED_DYE, "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
|
||||||
if (clickType == ClickType.DOUBLE_CLICK) return;
|
if (clickType == ClickType.DOUBLE_CLICK) return;
|
||||||
observer.move(clickType.isShiftClick() ? -5 : -1, 0, 0);
|
observer.move(clickType.isShiftClick() ? -5 : -1, 0, 0);
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
}).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED));
|
}).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED));
|
||||||
|
|
||||||
//Pos Y
|
//Pos Y
|
||||||
inventory.setItem(16, new SWItem(SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
|
inventory.setItem(16, new SWItem(Material.LIME_DYE, "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
|
||||||
if (clickType == ClickType.DOUBLE_CLICK) return;
|
if (clickType == ClickType.DOUBLE_CLICK) return;
|
||||||
observer.move(0, clickType.isShiftClick() ? 5 : 1, 0);
|
observer.move(0, clickType.isShiftClick() ? 5 : 1, 0);
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
@@ -124,14 +124,14 @@ public class SimulatorObserverSettingsGui extends SimulatorBaseGui {
|
|||||||
return true;
|
return true;
|
||||||
}, this).open();
|
}, this).open();
|
||||||
}));
|
}));
|
||||||
inventory.setItem(34, new SWItem(SWItem.getDye(1), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
|
inventory.setItem(34, new SWItem(Material.RED_DYE, "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
|
||||||
if (clickType == ClickType.DOUBLE_CLICK) return;
|
if (clickType == ClickType.DOUBLE_CLICK) return;
|
||||||
observer.move(0, clickType.isShiftClick() ? -5 : -1, 0);
|
observer.move(0, clickType.isShiftClick() ? -5 : -1, 0);
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
}).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED));
|
}).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED));
|
||||||
|
|
||||||
//Pos Z
|
//Pos Z
|
||||||
inventory.setItem(17, new SWItem(SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
|
inventory.setItem(17, new SWItem(Material.LIME_DYE, "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
|
||||||
if (clickType == ClickType.DOUBLE_CLICK) return;
|
if (clickType == ClickType.DOUBLE_CLICK) return;
|
||||||
observer.move(0, 0, clickType.isShiftClick() ? 5 : 1);
|
observer.move(0, 0, clickType.isShiftClick() ? 5 : 1);
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
@@ -143,7 +143,7 @@ public class SimulatorObserverSettingsGui extends SimulatorBaseGui {
|
|||||||
return true;
|
return true;
|
||||||
}, this).open();
|
}, this).open();
|
||||||
}));
|
}));
|
||||||
inventory.setItem(35, new SWItem(SWItem.getDye(1), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
|
inventory.setItem(35, new SWItem(Material.RED_DYE, "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
|
||||||
if (clickType == ClickType.DOUBLE_CLICK) return;
|
if (clickType == ClickType.DOUBLE_CLICK) return;
|
||||||
observer.move(0, 0, clickType.isShiftClick() ? -5 : -1);
|
observer.move(0, 0, clickType.isShiftClick() ? -5 : -1);
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
|
|||||||
+4
-4
@@ -164,13 +164,13 @@ public class SimulatorRedstoneGui extends SimulatorScrollGui<SimulatorRedstoneGu
|
|||||||
Supplier<Integer> getter = redstoneSubPhase.place ? redstoneSubPhase.phase::getTickOffset : redstoneSubPhase.phase::getLifetime;
|
Supplier<Integer> getter = redstoneSubPhase.place ? redstoneSubPhase.phase::getTickOffset : redstoneSubPhase.phase::getLifetime;
|
||||||
Consumer<Integer> setter = redstoneSubPhase.place ? redstoneSubPhase.phase::setTickOffset : redstoneSubPhase.phase::setLifetime;
|
Consumer<Integer> setter = redstoneSubPhase.place ? redstoneSubPhase.phase::setTickOffset : redstoneSubPhase.phase::setLifetime;
|
||||||
return new SWItem[]{
|
return new SWItem[]{
|
||||||
new SWItem(SWItem.getDye(getter.get() < max ? 10 : 8), "§e+1", Arrays.asList("§7Shift§8:§e +5"), false, clickType -> {
|
new SWItem(getter.get() < max ? Material.LIME_DYE : Material.GRAY_DYE, "§e+1", Arrays.asList("§7Shift§8:§e +5"), false, clickType -> {
|
||||||
if (clickType == ClickType.DOUBLE_CLICK) return;
|
if (clickType == ClickType.DOUBLE_CLICK) return;
|
||||||
setter.accept(Math.min(max, getter.get() + (clickType.isShiftClick() ? 5 : 1)));
|
setter.accept(Math.min(max, getter.get() + (clickType.isShiftClick() ? 5 : 1)));
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
}).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED),
|
}).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED),
|
||||||
redstone,
|
redstone,
|
||||||
new SWItem(SWItem.getDye(getter.get() > min ? 1 : 8), "§e-1", Arrays.asList("§7Shift§8:§e -5"), false, clickType -> {
|
new SWItem(getter.get() > min ? Material.RED_DYE : Material.GRAY_DYE, "§e-1", Arrays.asList("§7Shift§8:§e -5"), false, clickType -> {
|
||||||
if (clickType == ClickType.DOUBLE_CLICK) return;
|
if (clickType == ClickType.DOUBLE_CLICK) return;
|
||||||
setter.accept(Math.max(min, getter.get() - (clickType.isShiftClick() ? 5 : 1)));
|
setter.accept(Math.max(min, getter.get() - (clickType.isShiftClick() ? 5 : 1)));
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
@@ -184,13 +184,13 @@ public class SimulatorRedstoneGui extends SimulatorScrollGui<SimulatorRedstoneGu
|
|||||||
@Override
|
@Override
|
||||||
public SWItem[] lastColumn() {
|
public SWItem[] lastColumn() {
|
||||||
return new SWItem[]{
|
return new SWItem[]{
|
||||||
new SWItem(SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8:§e +5"), false, clickType -> {
|
new SWItem(Material.LIME_DYE, "§e+1", Arrays.asList("§7Shift§8:§e +5"), false, clickType -> {
|
||||||
addNewPhase(clickType.isShiftClick());
|
addNewPhase(clickType.isShiftClick());
|
||||||
}).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED),
|
}).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED),
|
||||||
new SWItem(Material.REDSTONE, "§eRedstone§8:§a New Phase", clickType -> {
|
new SWItem(Material.REDSTONE, "§eRedstone§8:§a New Phase", clickType -> {
|
||||||
addNewPhase(false);
|
addNewPhase(false);
|
||||||
}).setCustomModelData(CMDs.Simulator.NEW_PHASE),
|
}).setCustomModelData(CMDs.Simulator.NEW_PHASE),
|
||||||
new SWItem(SWItem.getDye(8), "§7", clickType -> {
|
new SWItem(Material.GRAY_DYE, "§7", clickType -> {
|
||||||
}).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED),
|
}).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
+8
-10
@@ -26,7 +26,6 @@ import de.steamwar.bausystem.features.simulator.data.redstone.RedstoneElement;
|
|||||||
import de.steamwar.bausystem.features.simulator.data.redstone.RedstonePhase;
|
import de.steamwar.bausystem.features.simulator.data.redstone.RedstonePhase;
|
||||||
import de.steamwar.bausystem.features.simulator.gui.base.SimulatorAnvilGui;
|
import de.steamwar.bausystem.features.simulator.gui.base.SimulatorAnvilGui;
|
||||||
import de.steamwar.bausystem.features.simulator.gui.base.SimulatorBaseGui;
|
import de.steamwar.bausystem.features.simulator.gui.base.SimulatorBaseGui;
|
||||||
import de.steamwar.core.Core;
|
|
||||||
import de.steamwar.data.CMDs;
|
import de.steamwar.data.CMDs;
|
||||||
import de.steamwar.inventory.SWItem;
|
import de.steamwar.inventory.SWItem;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
@@ -98,7 +97,7 @@ public class SimulatorRedstonePhaseSettingsGui extends SimulatorBaseGui {
|
|||||||
|
|
||||||
//Tick Offset
|
//Tick Offset
|
||||||
int offset = redstone.getTickOffset();
|
int offset = redstone.getTickOffset();
|
||||||
inventory.setItem(10, new SWItem(SWItem.getDye(offset < maxOffset ? 10 : 8), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
|
inventory.setItem(10, new SWItem(offset < maxOffset ? Material.LIME_DYE : Material.GRAY_DYE, "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
|
||||||
if (clickType == ClickType.DOUBLE_CLICK) return;
|
if (clickType == ClickType.DOUBLE_CLICK) return;
|
||||||
redstone.setTickOffset(Math.min(maxOffset, offset + (clickType.isShiftClick() ? 5 : 1)));
|
redstone.setTickOffset(Math.min(maxOffset, offset + (clickType.isShiftClick() ? 5 : 1)));
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
@@ -115,7 +114,7 @@ public class SimulatorRedstonePhaseSettingsGui extends SimulatorBaseGui {
|
|||||||
offsetItem.getItemStack().setAmount(Math.max(1, Math.min(offset, 64)));
|
offsetItem.getItemStack().setAmount(Math.max(1, Math.min(offset, 64)));
|
||||||
inventory.setItem(19, offsetItem);
|
inventory.setItem(19, offsetItem);
|
||||||
|
|
||||||
inventory.setItem(28, new SWItem(SWItem.getDye(offset > min ? 1 : 8), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
|
inventory.setItem(28, new SWItem(offset > min ? Material.RED_DYE : Material.GRAY_DYE, "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
|
||||||
if (clickType == ClickType.DOUBLE_CLICK) return;
|
if (clickType == ClickType.DOUBLE_CLICK) return;
|
||||||
redstone.setTickOffset(Math.max(min, offset - (clickType.isShiftClick() ? 5 : 1)));
|
redstone.setTickOffset(Math.max(min, offset - (clickType.isShiftClick() ? 5 : 1)));
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
@@ -123,7 +122,7 @@ public class SimulatorRedstonePhaseSettingsGui extends SimulatorBaseGui {
|
|||||||
|
|
||||||
//Lifetime
|
//Lifetime
|
||||||
int lifetime = redstone.getLifetime();
|
int lifetime = redstone.getLifetime();
|
||||||
inventory.setItem(11, new SWItem(SWItem.getDye(lifetime < maxLifetime ? 10 : 8), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
|
inventory.setItem(11, new SWItem(lifetime < maxLifetime ? Material.LIME_DYE : Material.GRAY_DYE, "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
|
||||||
if (clickType == ClickType.DOUBLE_CLICK) return;
|
if (clickType == ClickType.DOUBLE_CLICK) return;
|
||||||
redstone.setLifetime(Math.min(maxLifetime, lifetime + (clickType.isShiftClick() ? 5 : 1)));
|
redstone.setLifetime(Math.min(maxLifetime, lifetime + (clickType.isShiftClick() ? 5 : 1)));
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
@@ -140,7 +139,7 @@ public class SimulatorRedstonePhaseSettingsGui extends SimulatorBaseGui {
|
|||||||
lifetimeItem.getItemStack().setAmount(Math.max(1, Math.min(lifetime, 64)));
|
lifetimeItem.getItemStack().setAmount(Math.max(1, Math.min(lifetime, 64)));
|
||||||
inventory.setItem(20, lifetimeItem);
|
inventory.setItem(20, lifetimeItem);
|
||||||
|
|
||||||
inventory.setItem(29, new SWItem(SWItem.getDye(lifetime > 0 ? 1 : 8), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
|
inventory.setItem(29, new SWItem(lifetime > 0 ? Material.RED_DYE : Material.GRAY_DYE, "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
|
||||||
if (clickType == ClickType.DOUBLE_CLICK) return;
|
if (clickType == ClickType.DOUBLE_CLICK) return;
|
||||||
redstone.setLifetime(Math.max(0, lifetime - (clickType.isShiftClick() ? 5 : 1)));
|
redstone.setLifetime(Math.max(0, lifetime - (clickType.isShiftClick() ? 5 : 1)));
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
@@ -148,26 +147,25 @@ public class SimulatorRedstonePhaseSettingsGui extends SimulatorBaseGui {
|
|||||||
|
|
||||||
//Order
|
//Order
|
||||||
int order = redstone.getOrder();
|
int order = redstone.getOrder();
|
||||||
inventory.setItem(13, new SWItem(SWItem.getDye(order < SimulatorPhase.ORDER_LIMIT ? 10 : 8), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
|
inventory.setItem(13, new SWItem(order < SimulatorPhase.ORDER_LIMIT ? Material.LIME_DYE : Material.GRAY_DYE, "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
|
||||||
if (clickType == ClickType.DOUBLE_CLICK) return;
|
if (clickType == ClickType.DOUBLE_CLICK) return;
|
||||||
redstone.setOrder(Math.min(SimulatorPhase.ORDER_LIMIT, order + (clickType.isShiftClick() ? 5 : 1)));
|
redstone.setOrder(Math.min(SimulatorPhase.ORDER_LIMIT, order + (clickType.isShiftClick() ? 5 : 1)));
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
}).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED));
|
}).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED));
|
||||||
|
|
||||||
Material negativeNumbers = Material.getMaterial(Core.getVersion() >= 19 ? "RECOVERY_COMPASS" : "FIREWORK_STAR");
|
SWItem orderItem = new SWItem(order >= 0 ? Material.COMPASS : Material.RECOVERY_COMPASS, "§eActivation Order§8:§7 " + order, clickType -> {
|
||||||
SWItem orderItem = new SWItem(order >= 0 ? Material.COMPASS : negativeNumbers, "§eActivation Order§8:§7 " + order, clickType -> {
|
|
||||||
new SimulatorAnvilGui<>(player, "Activation Order", order + "", Integer::parseInt, integer -> {
|
new SimulatorAnvilGui<>(player, "Activation Order", order + "", Integer::parseInt, integer -> {
|
||||||
if (integer < -SimulatorPhase.ORDER_LIMIT) return false;
|
if (integer < -SimulatorPhase.ORDER_LIMIT) return false;
|
||||||
if (integer > SimulatorPhase.ORDER_LIMIT) return false;
|
if (integer > SimulatorPhase.ORDER_LIMIT) return false;
|
||||||
redstone.setOrder(integer);
|
redstone.setOrder(integer);
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
return true;
|
return true;
|
||||||
}, this).setItem(order >= 0 ? Material.COMPASS : negativeNumbers).open();
|
}, this).setItem(order >= 0 ? Material.COMPASS : Material.RECOVERY_COMPASS).open();
|
||||||
});
|
});
|
||||||
orderItem.getItemStack().setAmount(Math.max(1, Math.min(Math.abs(order), 30)));
|
orderItem.getItemStack().setAmount(Math.max(1, Math.min(Math.abs(order), 30)));
|
||||||
inventory.setItem(22, orderItem);
|
inventory.setItem(22, orderItem);
|
||||||
|
|
||||||
inventory.setItem(31, new SWItem(SWItem.getDye(order > -SimulatorPhase.ORDER_LIMIT ? 1 : 8), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
|
inventory.setItem(31, new SWItem(order > -SimulatorPhase.ORDER_LIMIT ? Material.RED_DYE : Material.GRAY_DYE, "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
|
||||||
if (clickType == ClickType.DOUBLE_CLICK) return;
|
if (clickType == ClickType.DOUBLE_CLICK) return;
|
||||||
redstone.setOrder(Math.max(-SimulatorPhase.ORDER_LIMIT, order - (clickType.isShiftClick() ? 5 : 1)));
|
redstone.setOrder(Math.max(-SimulatorPhase.ORDER_LIMIT, order - (clickType.isShiftClick() ? 5 : 1)));
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
|
|||||||
+8
-8
@@ -66,7 +66,7 @@ public class SimulatorRedstoneSettingsGui extends SimulatorBaseGui {
|
|||||||
|
|
||||||
// Base Tick
|
// Base Tick
|
||||||
int baseTicks = redstone.getBaseTick();
|
int baseTicks = redstone.getBaseTick();
|
||||||
inventory.setItem(9, new SWItem(SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
|
inventory.setItem(9, new SWItem(Material.LIME_DYE, "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
|
||||||
if (clickType == ClickType.DOUBLE_CLICK) return;
|
if (clickType == ClickType.DOUBLE_CLICK) return;
|
||||||
redstone.changeBaseTicks(clickType.isShiftClick() ? 5 : 1);
|
redstone.changeBaseTicks(clickType.isShiftClick() ? 5 : 1);
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
@@ -81,7 +81,7 @@ public class SimulatorRedstoneSettingsGui extends SimulatorBaseGui {
|
|||||||
});
|
});
|
||||||
baseTick.getItemStack().setAmount(Math.max(1, Math.min(baseTicks, 64)));
|
baseTick.getItemStack().setAmount(Math.max(1, Math.min(baseTicks, 64)));
|
||||||
inventory.setItem(18, baseTick);
|
inventory.setItem(18, baseTick);
|
||||||
inventory.setItem(27, new SWItem(SWItem.getDye(baseTicks > 0 ? 1 : 8), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
|
inventory.setItem(27, new SWItem(baseTicks > 0 ? Material.RED_DYE : Material.GRAY_DYE, "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
|
||||||
if (clickType == ClickType.DOUBLE_CLICK) return;
|
if (clickType == ClickType.DOUBLE_CLICK) return;
|
||||||
if (baseTicks - (clickType.isShiftClick() ? 5 : 1) < 0) {
|
if (baseTicks - (clickType.isShiftClick() ? 5 : 1) < 0) {
|
||||||
redstone.changeBaseTicks(-baseTicks);
|
redstone.changeBaseTicks(-baseTicks);
|
||||||
@@ -92,7 +92,7 @@ public class SimulatorRedstoneSettingsGui extends SimulatorBaseGui {
|
|||||||
}).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED));
|
}).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED));
|
||||||
|
|
||||||
//Pos X
|
//Pos X
|
||||||
inventory.setItem(15, new SWItem(SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
|
inventory.setItem(15, new SWItem(Material.LIME_DYE, "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
|
||||||
if (clickType == ClickType.DOUBLE_CLICK) return;
|
if (clickType == ClickType.DOUBLE_CLICK) return;
|
||||||
redstone.move(clickType.isShiftClick() ? 5 : 1, 0, 0);
|
redstone.move(clickType.isShiftClick() ? 5 : 1, 0, 0);
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
@@ -104,14 +104,14 @@ public class SimulatorRedstoneSettingsGui extends SimulatorBaseGui {
|
|||||||
return true;
|
return true;
|
||||||
}, this).open();
|
}, this).open();
|
||||||
}));
|
}));
|
||||||
inventory.setItem(33, new SWItem(SWItem.getDye(1), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
|
inventory.setItem(33, new SWItem(Material.RED_DYE, "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
|
||||||
if (clickType == ClickType.DOUBLE_CLICK) return;
|
if (clickType == ClickType.DOUBLE_CLICK) return;
|
||||||
redstone.move(clickType.isShiftClick() ? -5 : -1, 0, 0);
|
redstone.move(clickType.isShiftClick() ? -5 : -1, 0, 0);
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
}).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED));
|
}).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED));
|
||||||
|
|
||||||
//Pos Y
|
//Pos Y
|
||||||
inventory.setItem(16, new SWItem(SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
|
inventory.setItem(16, new SWItem(Material.LIME_DYE, "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
|
||||||
if (clickType == ClickType.DOUBLE_CLICK) return;
|
if (clickType == ClickType.DOUBLE_CLICK) return;
|
||||||
redstone.move(0, clickType.isShiftClick() ? 5 : 1, 0);
|
redstone.move(0, clickType.isShiftClick() ? 5 : 1, 0);
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
@@ -123,14 +123,14 @@ public class SimulatorRedstoneSettingsGui extends SimulatorBaseGui {
|
|||||||
return true;
|
return true;
|
||||||
}, this).open();
|
}, this).open();
|
||||||
}));
|
}));
|
||||||
inventory.setItem(34, new SWItem(SWItem.getDye(1), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
|
inventory.setItem(34, new SWItem(Material.RED_DYE, "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
|
||||||
if (clickType == ClickType.DOUBLE_CLICK) return;
|
if (clickType == ClickType.DOUBLE_CLICK) return;
|
||||||
redstone.move(0, clickType.isShiftClick() ? -5 : -1, 0);
|
redstone.move(0, clickType.isShiftClick() ? -5 : -1, 0);
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
}).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED));
|
}).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED));
|
||||||
|
|
||||||
//Pos Z
|
//Pos Z
|
||||||
inventory.setItem(17, new SWItem(SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
|
inventory.setItem(17, new SWItem(Material.LIME_DYE, "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
|
||||||
if (clickType == ClickType.DOUBLE_CLICK) return;
|
if (clickType == ClickType.DOUBLE_CLICK) return;
|
||||||
redstone.move(0, 0, clickType.isShiftClick() ? 5 : 1);
|
redstone.move(0, 0, clickType.isShiftClick() ? 5 : 1);
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
@@ -142,7 +142,7 @@ public class SimulatorRedstoneSettingsGui extends SimulatorBaseGui {
|
|||||||
return true;
|
return true;
|
||||||
}, this).open();
|
}, this).open();
|
||||||
}));
|
}));
|
||||||
inventory.setItem(35, new SWItem(SWItem.getDye(1), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
|
inventory.setItem(35, new SWItem(Material.RED_DYE, "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
|
||||||
if (clickType == ClickType.DOUBLE_CLICK) return;
|
if (clickType == ClickType.DOUBLE_CLICK) return;
|
||||||
redstone.move(0, 0, clickType.isShiftClick() ? -5 : -1);
|
redstone.move(0, 0, clickType.isShiftClick() ? -5 : -1);
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
|
|||||||
+6
-6
@@ -66,37 +66,37 @@ public class SimulatorSettingsGui extends SimulatorBaseGui {
|
|||||||
}));
|
}));
|
||||||
|
|
||||||
//Pos X
|
//Pos X
|
||||||
inventory.setItem(15, new SWItem(SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
|
inventory.setItem(15, new SWItem(Material.LIME_DYE, "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
|
||||||
simulator.move(clickType.isShiftClick() ? 5 : 1, 0, 0);
|
simulator.move(clickType.isShiftClick() ? 5 : 1, 0, 0);
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
}).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED));
|
}).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED));
|
||||||
inventory.setItem(24, new SWItem(Material.PAPER, "§eX", clickType -> {
|
inventory.setItem(24, new SWItem(Material.PAPER, "§eX", clickType -> {
|
||||||
}));
|
}));
|
||||||
inventory.setItem(33, new SWItem(SWItem.getDye(1), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
|
inventory.setItem(33, new SWItem(Material.RED_DYE, "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
|
||||||
simulator.move(clickType.isShiftClick() ? -5 : -1, 0, 0);
|
simulator.move(clickType.isShiftClick() ? -5 : -1, 0, 0);
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
}).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED));
|
}).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED));
|
||||||
|
|
||||||
//Pos Y
|
//Pos Y
|
||||||
inventory.setItem(16, new SWItem(SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
|
inventory.setItem(16, new SWItem(Material.LIME_DYE, "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
|
||||||
simulator.move(0, clickType.isShiftClick() ? 5 : 1, 0);
|
simulator.move(0, clickType.isShiftClick() ? 5 : 1, 0);
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
}).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED));
|
}).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED));
|
||||||
inventory.setItem(25, new SWItem(Material.PAPER, "§eY", clickType -> {
|
inventory.setItem(25, new SWItem(Material.PAPER, "§eY", clickType -> {
|
||||||
}));
|
}));
|
||||||
inventory.setItem(34, new SWItem(SWItem.getDye(1), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
|
inventory.setItem(34, new SWItem(Material.RED_DYE, "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
|
||||||
simulator.move(0, clickType.isShiftClick() ? -5 : -1, 0);
|
simulator.move(0, clickType.isShiftClick() ? -5 : -1, 0);
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
}).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED));
|
}).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED));
|
||||||
|
|
||||||
//Pos Z
|
//Pos Z
|
||||||
inventory.setItem(17, new SWItem(SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
|
inventory.setItem(17, new SWItem(Material.LIME_DYE, "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
|
||||||
simulator.move(0, 0, clickType.isShiftClick() ? 5 : 1);
|
simulator.move(0, 0, clickType.isShiftClick() ? 5 : 1);
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
}).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED));
|
}).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED));
|
||||||
inventory.setItem(26, new SWItem(Material.PAPER, "§eZ", clickType -> {
|
inventory.setItem(26, new SWItem(Material.PAPER, "§eZ", clickType -> {
|
||||||
}));
|
}));
|
||||||
inventory.setItem(35, new SWItem(SWItem.getDye(1), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
|
inventory.setItem(35, new SWItem(Material.RED_DYE, "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
|
||||||
simulator.move(0, 0, clickType.isShiftClick() ? -5 : -1);
|
simulator.move(0, 0, clickType.isShiftClick() ? -5 : -1);
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
}).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED));
|
}).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED));
|
||||||
|
|||||||
+4
-7
@@ -29,7 +29,6 @@ import de.steamwar.bausystem.features.simulator.gui.base.SimulatorAnvilGui;
|
|||||||
import de.steamwar.bausystem.features.simulator.gui.base.SimulatorBaseGui;
|
import de.steamwar.bausystem.features.simulator.gui.base.SimulatorBaseGui;
|
||||||
import de.steamwar.bausystem.features.simulator.gui.base.SimulatorScrollGui;
|
import de.steamwar.bausystem.features.simulator.gui.base.SimulatorScrollGui;
|
||||||
import de.steamwar.bausystem.region.Region;
|
import de.steamwar.bausystem.region.Region;
|
||||||
import de.steamwar.core.Core;
|
|
||||||
import de.steamwar.data.CMDs;
|
import de.steamwar.data.CMDs;
|
||||||
import de.steamwar.inventory.SWItem;
|
import de.steamwar.inventory.SWItem;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
@@ -102,7 +101,6 @@ public class SimulatorTNTGui extends SimulatorScrollGui<TNTPhase> {
|
|||||||
tnt.setDisabled(!tnt.isDisabled());
|
tnt.setDisabled(!tnt.isDisabled());
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
}).setCustomModelData(CMDs.Simulator.ENABLED_OR_DISABLED));
|
}).setCustomModelData(CMDs.Simulator.ENABLED_OR_DISABLED));
|
||||||
if (Core.getVersion() > 19) {
|
|
||||||
inventory.setItem(49, new SWItem(Material.CALIBRATED_SCULK_SENSOR, "§eCreate Stab", click -> {
|
inventory.setItem(49, new SWItem(Material.CALIBRATED_SCULK_SENSOR, "§eCreate Stab", click -> {
|
||||||
new SimulatorAnvilGui<>(player, "Depth Limit", "", Integer::parseInt, depthLimit -> {
|
new SimulatorAnvilGui<>(player, "Depth Limit", "", Integer::parseInt, depthLimit -> {
|
||||||
if (depthLimit <= 0) return false;
|
if (depthLimit <= 0) return false;
|
||||||
@@ -111,7 +109,6 @@ public class SimulatorTNTGui extends SimulatorScrollGui<TNTPhase> {
|
|||||||
return true;
|
return true;
|
||||||
}, null).open();
|
}, null).open();
|
||||||
}).setCustomModelData(CMDs.Simulator.CREATE_STAB));
|
}).setCustomModelData(CMDs.Simulator.CREATE_STAB));
|
||||||
}
|
|
||||||
inventory.setItem(50, new SWItem(Material.CHEST, parent.getElements().size() == 1 ? "§eMake Group" : "§eAdd another TNT to Group", clickType -> {
|
inventory.setItem(50, new SWItem(Material.CHEST, parent.getElements().size() == 1 ? "§eMake Group" : "§eAdd another TNT to Group", clickType -> {
|
||||||
TNTElement tntElement = new TNTElement(tnt.getPosition().clone());
|
TNTElement tntElement = new TNTElement(tnt.getPosition().clone());
|
||||||
tntElement.add(new TNTPhase());
|
tntElement.add(new TNTPhase());
|
||||||
@@ -137,13 +134,13 @@ public class SimulatorTNTGui extends SimulatorScrollGui<TNTPhase> {
|
|||||||
tnt.getItemStack().setAmount(Math.min(tntSetting.getCount(), 64));
|
tnt.getItemStack().setAmount(Math.min(tntSetting.getCount(), 64));
|
||||||
|
|
||||||
return new SWItem[]{
|
return new SWItem[]{
|
||||||
new SWItem(SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8:§e +5"), false, clickType -> {
|
new SWItem(Material.LIME_DYE, "§e+1", Arrays.asList("§7Shift§8:§e +5"), false, clickType -> {
|
||||||
if (clickType == ClickType.DOUBLE_CLICK) return;
|
if (clickType == ClickType.DOUBLE_CLICK) return;
|
||||||
tntSetting.setCount(tntSetting.getCount() + (clickType.isShiftClick() ? 5 : 1));
|
tntSetting.setCount(tntSetting.getCount() + (clickType.isShiftClick() ? 5 : 1));
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
}).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED),
|
}).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED),
|
||||||
tnt,
|
tnt,
|
||||||
new SWItem(SWItem.getDye(tntSetting.getCount() > 1 ? 1 : 8), "§e-1", Arrays.asList("§7Shift§8:§e -5"), false, clickType -> {
|
new SWItem(tntSetting.getCount() > 1 ? Material.RED_DYE : Material.GRAY_DYE, "§e-1", Arrays.asList("§7Shift§8:§e -5"), false, clickType -> {
|
||||||
if (clickType == ClickType.DOUBLE_CLICK) return;
|
if (clickType == ClickType.DOUBLE_CLICK) return;
|
||||||
tntSetting.setCount(Math.max(1, tntSetting.getCount() - (clickType.isShiftClick() ? 5 : 1)));
|
tntSetting.setCount(Math.max(1, tntSetting.getCount() - (clickType.isShiftClick() ? 5 : 1)));
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
@@ -157,13 +154,13 @@ public class SimulatorTNTGui extends SimulatorScrollGui<TNTPhase> {
|
|||||||
@Override
|
@Override
|
||||||
public SWItem[] lastColumn() {
|
public SWItem[] lastColumn() {
|
||||||
return new SWItem[]{
|
return new SWItem[]{
|
||||||
new SWItem(SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8:§e +5"), false, clickType -> {
|
new SWItem(Material.LIME_DYE, "§e+1", Arrays.asList("§7Shift§8:§e +5"), false, clickType -> {
|
||||||
addNewPhase(clickType.isShiftClick());
|
addNewPhase(clickType.isShiftClick());
|
||||||
}).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED),
|
}).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED),
|
||||||
new SWItem(Material.GUNPOWDER, "§eTNT§8:§a New Phase", clickType -> {
|
new SWItem(Material.GUNPOWDER, "§eTNT§8:§a New Phase", clickType -> {
|
||||||
addNewPhase(false);
|
addNewPhase(false);
|
||||||
}).setCustomModelData(CMDs.Simulator.NEW_PHASE),
|
}).setCustomModelData(CMDs.Simulator.NEW_PHASE),
|
||||||
new SWItem(SWItem.getDye(8), "§7", clickType -> {
|
new SWItem(Material.GRAY_DYE, "§7", clickType -> {
|
||||||
}).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED),
|
}).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
+10
-12
@@ -26,7 +26,6 @@ import de.steamwar.bausystem.features.simulator.data.tnt.TNTElement;
|
|||||||
import de.steamwar.bausystem.features.simulator.data.tnt.TNTPhase;
|
import de.steamwar.bausystem.features.simulator.data.tnt.TNTPhase;
|
||||||
import de.steamwar.bausystem.features.simulator.gui.base.SimulatorAnvilGui;
|
import de.steamwar.bausystem.features.simulator.gui.base.SimulatorAnvilGui;
|
||||||
import de.steamwar.bausystem.features.simulator.gui.base.SimulatorBaseGui;
|
import de.steamwar.bausystem.features.simulator.gui.base.SimulatorBaseGui;
|
||||||
import de.steamwar.core.Core;
|
|
||||||
import de.steamwar.data.CMDs;
|
import de.steamwar.data.CMDs;
|
||||||
import de.steamwar.inventory.SWItem;
|
import de.steamwar.inventory.SWItem;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
@@ -78,7 +77,7 @@ public class SimulatorTNTPhaseSettingsGui extends SimulatorBaseGui {
|
|||||||
|
|
||||||
//Count
|
//Count
|
||||||
int count = tnt.getCount();
|
int count = tnt.getCount();
|
||||||
inventory.setItem(9, new SWItem(SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
|
inventory.setItem(9, new SWItem(Material.LIME_DYE, "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
|
||||||
if (clickType == ClickType.DOUBLE_CLICK) return;
|
if (clickType == ClickType.DOUBLE_CLICK) return;
|
||||||
tnt.setCount(count + (clickType.isShiftClick() ? 5 : 1));
|
tnt.setCount(count + (clickType.isShiftClick() ? 5 : 1));
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
@@ -95,7 +94,7 @@ public class SimulatorTNTPhaseSettingsGui extends SimulatorBaseGui {
|
|||||||
countItem.getItemStack().setAmount(Math.max(1, Math.min(count, 64)));
|
countItem.getItemStack().setAmount(Math.max(1, Math.min(count, 64)));
|
||||||
inventory.setItem(18, countItem);
|
inventory.setItem(18, countItem);
|
||||||
|
|
||||||
inventory.setItem(27, new SWItem(SWItem.getDye(count > 1 ? 1 : 8), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
|
inventory.setItem(27, new SWItem(count > 1 ? Material.RED_DYE : Material.GRAY_DYE, "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
|
||||||
if (clickType == ClickType.DOUBLE_CLICK) return;
|
if (clickType == ClickType.DOUBLE_CLICK) return;
|
||||||
tnt.setCount(Math.max(1, count - (clickType.isShiftClick() ? 5 : 1)));
|
tnt.setCount(Math.max(1, count - (clickType.isShiftClick() ? 5 : 1)));
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
@@ -103,7 +102,7 @@ public class SimulatorTNTPhaseSettingsGui extends SimulatorBaseGui {
|
|||||||
|
|
||||||
//Tick Offset
|
//Tick Offset
|
||||||
int offset = tnt.getTickOffset();
|
int offset = tnt.getTickOffset();
|
||||||
inventory.setItem(10, new SWItem(SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
|
inventory.setItem(10, new SWItem(Material.LIME_DYE, "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
|
||||||
if (clickType == ClickType.DOUBLE_CLICK) return;
|
if (clickType == ClickType.DOUBLE_CLICK) return;
|
||||||
tnt.setTickOffset(offset + (clickType.isShiftClick() ? 5 : 1));
|
tnt.setTickOffset(offset + (clickType.isShiftClick() ? 5 : 1));
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
@@ -120,7 +119,7 @@ public class SimulatorTNTPhaseSettingsGui extends SimulatorBaseGui {
|
|||||||
offsetItem.getItemStack().setAmount(Math.max(1, Math.min(offset, 64)));
|
offsetItem.getItemStack().setAmount(Math.max(1, Math.min(offset, 64)));
|
||||||
inventory.setItem(19, offsetItem);
|
inventory.setItem(19, offsetItem);
|
||||||
|
|
||||||
inventory.setItem(28, new SWItem(SWItem.getDye(offset > 0 ? 1 : 8), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
|
inventory.setItem(28, new SWItem(offset > 0 ? Material.RED_DYE : Material.GRAY_DYE, "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
|
||||||
if (clickType == ClickType.DOUBLE_CLICK) return;
|
if (clickType == ClickType.DOUBLE_CLICK) return;
|
||||||
tnt.setTickOffset(Math.max(0, offset - (clickType.isShiftClick() ? 5 : 1)));
|
tnt.setTickOffset(Math.max(0, offset - (clickType.isShiftClick() ? 5 : 1)));
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
@@ -128,7 +127,7 @@ public class SimulatorTNTPhaseSettingsGui extends SimulatorBaseGui {
|
|||||||
|
|
||||||
//Lifetime
|
//Lifetime
|
||||||
int lifetime = tnt.getLifetime();
|
int lifetime = tnt.getLifetime();
|
||||||
inventory.setItem(11, new SWItem(SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
|
inventory.setItem(11, new SWItem(Material.LIME_DYE, "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
|
||||||
if (clickType == ClickType.DOUBLE_CLICK) return;
|
if (clickType == ClickType.DOUBLE_CLICK) return;
|
||||||
tnt.setLifetime(lifetime + (clickType.isShiftClick() ? 5 : 1));
|
tnt.setLifetime(lifetime + (clickType.isShiftClick() ? 5 : 1));
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
@@ -145,7 +144,7 @@ public class SimulatorTNTPhaseSettingsGui extends SimulatorBaseGui {
|
|||||||
lifetimeItem.getItemStack().setAmount(Math.max(1, Math.min(lifetime, 64)));
|
lifetimeItem.getItemStack().setAmount(Math.max(1, Math.min(lifetime, 64)));
|
||||||
inventory.setItem(20, lifetimeItem);
|
inventory.setItem(20, lifetimeItem);
|
||||||
|
|
||||||
inventory.setItem(29, new SWItem(SWItem.getDye(lifetime > 0 ? 1 : 8), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
|
inventory.setItem(29, new SWItem(lifetime > 0 ? Material.GRAY_DYE : Material.GRAY_DYE, "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
|
||||||
if (clickType == ClickType.DOUBLE_CLICK) return;
|
if (clickType == ClickType.DOUBLE_CLICK) return;
|
||||||
tnt.setLifetime(Math.max(1, lifetime - (clickType.isShiftClick() ? 5 : 1)));
|
tnt.setLifetime(Math.max(1, lifetime - (clickType.isShiftClick() ? 5 : 1)));
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
@@ -153,26 +152,25 @@ public class SimulatorTNTPhaseSettingsGui extends SimulatorBaseGui {
|
|||||||
|
|
||||||
//Order
|
//Order
|
||||||
int order = tnt.getOrder();
|
int order = tnt.getOrder();
|
||||||
inventory.setItem(13, new SWItem(SWItem.getDye(order < SimulatorPhase.ORDER_LIMIT ? 10 : 8), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
|
inventory.setItem(13, new SWItem(order < SimulatorPhase.ORDER_LIMIT ? Material.LIME_DYE : Material.GRAY_DYE, "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
|
||||||
if (clickType == ClickType.DOUBLE_CLICK) return;
|
if (clickType == ClickType.DOUBLE_CLICK) return;
|
||||||
tnt.setOrder(Math.min(SimulatorPhase.ORDER_LIMIT, order + (clickType.isShiftClick() ? 5 : 1)));
|
tnt.setOrder(Math.min(SimulatorPhase.ORDER_LIMIT, order + (clickType.isShiftClick() ? 5 : 1)));
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
}).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED));
|
}).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED));
|
||||||
|
|
||||||
Material negativeNumbers = Material.getMaterial(Core.getVersion() >= 19 ? "RECOVERY_COMPASS" : "FIREWORK_STAR");
|
SWItem orderItem = new SWItem(order >= 0 ? Material.COMPASS : Material.RECOVERY_COMPASS, "§eCalculation Order§8:§7 " + order, clickType -> {
|
||||||
SWItem orderItem = new SWItem(order >= 0 ? Material.COMPASS : negativeNumbers, "§eCalculation Order§8:§7 " + order, clickType -> {
|
|
||||||
new SimulatorAnvilGui<>(player, "Calculation Order", order + "", Integer::parseInt, integer -> {
|
new SimulatorAnvilGui<>(player, "Calculation Order", order + "", Integer::parseInt, integer -> {
|
||||||
if (integer < -SimulatorPhase.ORDER_LIMIT) return false;
|
if (integer < -SimulatorPhase.ORDER_LIMIT) return false;
|
||||||
if (integer > SimulatorPhase.ORDER_LIMIT) return false;
|
if (integer > SimulatorPhase.ORDER_LIMIT) return false;
|
||||||
tnt.setOrder(integer);
|
tnt.setOrder(integer);
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
return true;
|
return true;
|
||||||
}, this).setItem(order >= 0 ? Material.COMPASS : negativeNumbers).open();
|
}, this).setItem(order >= 0 ? Material.COMPASS : Material.RECOVERY_COMPASS).open();
|
||||||
});
|
});
|
||||||
orderItem.getItemStack().setAmount(Math.max(1, Math.min(Math.abs(order), 30)));
|
orderItem.getItemStack().setAmount(Math.max(1, Math.min(Math.abs(order), 30)));
|
||||||
inventory.setItem(22, orderItem);
|
inventory.setItem(22, orderItem);
|
||||||
|
|
||||||
inventory.setItem(31, new SWItem(SWItem.getDye(order > -SimulatorPhase.ORDER_LIMIT ? 1 : 8), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
|
inventory.setItem(31, new SWItem(order > -SimulatorPhase.ORDER_LIMIT ? Material.RED_DYE : Material.GRAY_DYE, "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
|
||||||
if (clickType == ClickType.DOUBLE_CLICK) return;
|
if (clickType == ClickType.DOUBLE_CLICK) return;
|
||||||
tnt.setOrder(Math.max(-SimulatorPhase.ORDER_LIMIT, order - (clickType.isShiftClick() ? 5 : 1)));
|
tnt.setOrder(Math.max(-SimulatorPhase.ORDER_LIMIT, order - (clickType.isShiftClick() ? 5 : 1)));
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
|
|||||||
+8
-8
@@ -75,7 +75,7 @@ public class SimulatorTNTSettingsGui extends SimulatorBaseGui {
|
|||||||
|
|
||||||
// Base Tick
|
// Base Tick
|
||||||
int baseTicks = tnt.getBaseTick();
|
int baseTicks = tnt.getBaseTick();
|
||||||
inventory.setItem(9, new SWItem(SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
|
inventory.setItem(9, new SWItem(Material.LIME_DYE, "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
|
||||||
if (clickType == ClickType.DOUBLE_CLICK) return;
|
if (clickType == ClickType.DOUBLE_CLICK) return;
|
||||||
tnt.changeBaseTicks(clickType.isShiftClick() ? 5 : 1);
|
tnt.changeBaseTicks(clickType.isShiftClick() ? 5 : 1);
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
@@ -90,7 +90,7 @@ public class SimulatorTNTSettingsGui extends SimulatorBaseGui {
|
|||||||
});
|
});
|
||||||
baseTick.getItemStack().setAmount(Math.max(1, Math.min(baseTicks, 64)));
|
baseTick.getItemStack().setAmount(Math.max(1, Math.min(baseTicks, 64)));
|
||||||
inventory.setItem(18, baseTick);
|
inventory.setItem(18, baseTick);
|
||||||
inventory.setItem(27, new SWItem(SWItem.getDye(baseTicks > 0 ? 1 : 8), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
|
inventory.setItem(27, new SWItem(baseTicks > 0 ? Material.RED_DYE : Material.GRAY_DYE, "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
|
||||||
if (clickType == ClickType.DOUBLE_CLICK) return;
|
if (clickType == ClickType.DOUBLE_CLICK) return;
|
||||||
if (baseTicks - (clickType.isShiftClick() ? 5 : 1) < 0) {
|
if (baseTicks - (clickType.isShiftClick() ? 5 : 1) < 0) {
|
||||||
tnt.changeBaseTicks(-baseTicks);
|
tnt.changeBaseTicks(-baseTicks);
|
||||||
@@ -138,7 +138,7 @@ public class SimulatorTNTSettingsGui extends SimulatorBaseGui {
|
|||||||
inventory.setItem(30, positivXItem);
|
inventory.setItem(30, positivXItem);
|
||||||
|
|
||||||
// Pos X
|
// Pos X
|
||||||
inventory.setItem(15, new SWItem(SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+0.0625"), false, clickType -> {
|
inventory.setItem(15, new SWItem(Material.LIME_DYE, "§e+1", Arrays.asList("§7Shift§8: §e+0.0625"), false, clickType -> {
|
||||||
if (clickType == ClickType.DOUBLE_CLICK) return;
|
if (clickType == ClickType.DOUBLE_CLICK) return;
|
||||||
tnt.move(clickType.isShiftClick() ? 0.0625 : 1, 0, 0);
|
tnt.move(clickType.isShiftClick() ? 0.0625 : 1, 0, 0);
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
@@ -150,14 +150,14 @@ public class SimulatorTNTSettingsGui extends SimulatorBaseGui {
|
|||||||
return true;
|
return true;
|
||||||
}, this).open();
|
}, this).open();
|
||||||
}));
|
}));
|
||||||
inventory.setItem(33, new SWItem(SWItem.getDye(1), "§e-1", Arrays.asList("§7Shift§8: §e-0.0625"), false, clickType -> {
|
inventory.setItem(33, new SWItem(Material.RED_DYE, "§e-1", Arrays.asList("§7Shift§8: §e-0.0625"), false, clickType -> {
|
||||||
if (clickType == ClickType.DOUBLE_CLICK) return;
|
if (clickType == ClickType.DOUBLE_CLICK) return;
|
||||||
tnt.move(clickType.isShiftClick() ? -0.0625 : -1, 0, 0);
|
tnt.move(clickType.isShiftClick() ? -0.0625 : -1, 0, 0);
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
}).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED));
|
}).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED));
|
||||||
|
|
||||||
// Pos Y
|
// Pos Y
|
||||||
inventory.setItem(16, new SWItem(SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+0.0625"), false, clickType -> {
|
inventory.setItem(16, new SWItem(Material.LIME_DYE, "§e+1", Arrays.asList("§7Shift§8: §e+0.0625"), false, clickType -> {
|
||||||
if (clickType == ClickType.DOUBLE_CLICK) return;
|
if (clickType == ClickType.DOUBLE_CLICK) return;
|
||||||
tnt.move(0, clickType.isShiftClick() ? 0.0625 : 1, 0);
|
tnt.move(0, clickType.isShiftClick() ? 0.0625 : 1, 0);
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
@@ -169,14 +169,14 @@ public class SimulatorTNTSettingsGui extends SimulatorBaseGui {
|
|||||||
return true;
|
return true;
|
||||||
}, this).open();
|
}, this).open();
|
||||||
}));
|
}));
|
||||||
inventory.setItem(34, new SWItem(SWItem.getDye(1), "§e-1", Arrays.asList("§7Shift§8: §e-0.0625"), false, clickType -> {
|
inventory.setItem(34, new SWItem(Material.RED_DYE, "§e-1", Arrays.asList("§7Shift§8: §e-0.0625"), false, clickType -> {
|
||||||
if (clickType == ClickType.DOUBLE_CLICK) return;
|
if (clickType == ClickType.DOUBLE_CLICK) return;
|
||||||
tnt.move(0, clickType.isShiftClick() ? -0.0625 : -1, 0);
|
tnt.move(0, clickType.isShiftClick() ? -0.0625 : -1, 0);
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
}).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED));
|
}).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED));
|
||||||
|
|
||||||
// Pos Z
|
// Pos Z
|
||||||
inventory.setItem(17, new SWItem(SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+0.0625"), false, clickType -> {
|
inventory.setItem(17, new SWItem(Material.LIME_DYE, "§e+1", Arrays.asList("§7Shift§8: §e+0.0625"), false, clickType -> {
|
||||||
if (clickType == ClickType.DOUBLE_CLICK) return;
|
if (clickType == ClickType.DOUBLE_CLICK) return;
|
||||||
tnt.move(0, 0, clickType.isShiftClick() ? 0.0625 : 1);
|
tnt.move(0, 0, clickType.isShiftClick() ? 0.0625 : 1);
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
@@ -188,7 +188,7 @@ public class SimulatorTNTSettingsGui extends SimulatorBaseGui {
|
|||||||
return true;
|
return true;
|
||||||
}, this).open();
|
}, this).open();
|
||||||
}));
|
}));
|
||||||
inventory.setItem(35, new SWItem(SWItem.getDye(1), "§e-1", Arrays.asList("§7Shift§8: §e-0.0625"), false, clickType -> {
|
inventory.setItem(35, new SWItem(Material.RED_DYE, "§e-1", Arrays.asList("§7Shift§8: §e-0.0625"), false, clickType -> {
|
||||||
if (clickType == ClickType.DOUBLE_CLICK) return;
|
if (clickType == ClickType.DOUBLE_CLICK) return;
|
||||||
tnt.move(0, 0, clickType.isShiftClick() ? -0.0625 : -1);
|
tnt.move(0, 0, clickType.isShiftClick() ? -0.0625 : -1);
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
|
|||||||
+1
-7
@@ -21,7 +21,6 @@ package de.steamwar.bausystem.features.simulator.gui.base;
|
|||||||
|
|
||||||
import de.steamwar.bausystem.features.simulator.SimulatorWatcher;
|
import de.steamwar.bausystem.features.simulator.SimulatorWatcher;
|
||||||
import de.steamwar.bausystem.features.simulator.data.Simulator;
|
import de.steamwar.bausystem.features.simulator.data.Simulator;
|
||||||
import de.steamwar.core.Core;
|
|
||||||
import de.steamwar.inventory.SWInventory;
|
import de.steamwar.inventory.SWInventory;
|
||||||
import de.steamwar.inventory.SWItem;
|
import de.steamwar.inventory.SWItem;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
@@ -47,10 +46,7 @@ public abstract class SimulatorBaseGui {
|
|||||||
public final void open() {
|
public final void open() {
|
||||||
if (!shouldOpen()) return;
|
if (!shouldOpen()) return;
|
||||||
|
|
||||||
String newTitle = title();
|
if (inv != null) {
|
||||||
String originalTitle = player.getOpenInventory().getTitle();
|
|
||||||
|
|
||||||
if (inv != null && (Core.getVersion() > 19 || newTitle.equals(originalTitle))) {
|
|
||||||
// TODO: Flickering is better but not gone!
|
// TODO: Flickering is better but not gone!
|
||||||
for (int i = 9; i < size - 9; i++) {
|
for (int i = 9; i < size - 9; i++) {
|
||||||
inv.setItem(i, null);
|
inv.setItem(i, null);
|
||||||
@@ -60,9 +56,7 @@ public abstract class SimulatorBaseGui {
|
|||||||
inventory.open();
|
inventory.open();
|
||||||
SimulatorWatcher.watch(player, simulator, this::open);
|
SimulatorWatcher.watch(player, simulator, this::open);
|
||||||
}
|
}
|
||||||
if (Core.getVersion() > 19) {
|
|
||||||
player.getOpenInventory().setTitle(title());
|
player.getOpenInventory().setTitle(title());
|
||||||
}
|
|
||||||
if (simulator != null && simulator.getStabGenerator() != null) {
|
if (simulator != null && simulator.getStabGenerator() != null) {
|
||||||
populateStabGenerator();
|
populateStabGenerator();
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
+3
-2
@@ -23,6 +23,7 @@ import de.steamwar.bausystem.features.simulator.data.Simulator;
|
|||||||
import de.steamwar.core.Core;
|
import de.steamwar.core.Core;
|
||||||
import de.steamwar.data.CMDs;
|
import de.steamwar.data.CMDs;
|
||||||
import de.steamwar.inventory.SWItem;
|
import de.steamwar.inventory.SWItem;
|
||||||
|
import org.bukkit.Material;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -51,14 +52,14 @@ public abstract class SimulatorPageGui<T> extends SimulatorBaseGui {
|
|||||||
headerAndFooter();
|
headerAndFooter();
|
||||||
page = Math.min(page, maxPage());
|
page = Math.min(page, maxPage());
|
||||||
|
|
||||||
inventory.setItem(size - 9, new SWItem(SWItem.getDye(page > 0 ? 10 : 8), page > 0 ? (byte) 10 : (byte) 8, Core.MESSAGE.parse(page > 0 ? "SWLISINV_PREVIOUS_PAGE_ACTIVE" : "SWLISINV_PREVIOUS_PAGE_INACTIVE", player), clickType -> {
|
inventory.setItem(size - 9, new SWItem(page > 0 ? Material.LIME_DYE : Material.GRAY_DYE, page > 0 ? (byte) 10 : (byte) 8, Core.MESSAGE.parse(page > 0 ? "SWLISINV_PREVIOUS_PAGE_ACTIVE" : "SWLISINV_PREVIOUS_PAGE_INACTIVE", player), clickType -> {
|
||||||
if (page > 0) {
|
if (page > 0) {
|
||||||
page--;
|
page--;
|
||||||
open();
|
open();
|
||||||
}
|
}
|
||||||
}).setCustomModelData(CMDs.PREVIOUS_PAGE));
|
}).setCustomModelData(CMDs.PREVIOUS_PAGE));
|
||||||
boolean hasNext = page < maxPage() - (data.size() % (size - 18) == 0 ? 1 : 0);
|
boolean hasNext = page < maxPage() - (data.size() % (size - 18) == 0 ? 1 : 0);
|
||||||
inventory.setItem(size - 1, new SWItem(SWItem.getDye(hasNext ? 10 : 8), hasNext ? (byte) 10 : (byte) 8, Core.MESSAGE.parse(hasNext ? "SWLISINV_NEXT_PAGE_ACTIVE" : "SWLISINV_NEXT_PAGE_INACTIVE", player), clickType -> {
|
inventory.setItem(size - 1, new SWItem(hasNext ? Material.LIME_DYE : Material.GRAY_DYE, hasNext ? (byte) 10 : (byte) 8, Core.MESSAGE.parse(hasNext ? "SWLISINV_NEXT_PAGE_ACTIVE" : "SWLISINV_NEXT_PAGE_INACTIVE", player), clickType -> {
|
||||||
if (hasNext) {
|
if (hasNext) {
|
||||||
page++;
|
page++;
|
||||||
open();
|
open();
|
||||||
|
|||||||
+3
-2
@@ -24,6 +24,7 @@ import de.steamwar.bausystem.features.simulator.data.Simulator;
|
|||||||
import de.steamwar.core.Core;
|
import de.steamwar.core.Core;
|
||||||
import de.steamwar.data.CMDs;
|
import de.steamwar.data.CMDs;
|
||||||
import de.steamwar.inventory.SWItem;
|
import de.steamwar.inventory.SWItem;
|
||||||
|
import org.bukkit.Material;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -51,14 +52,14 @@ public abstract class SimulatorScrollGui<T> extends SimulatorBaseGui {
|
|||||||
headerAndFooter();
|
headerAndFooter();
|
||||||
scroll = maxScroll();
|
scroll = maxScroll();
|
||||||
|
|
||||||
inventory.setItem(size - 9, new SWItem(SWItem.getDye(scroll > 0 ? 10 : 8), scroll > 0 ? (byte) 10 : (byte) 8, Core.MESSAGE.parse(scroll > 0 ? "SWLISINV_PREVIOUS_PAGE_ACTIVE" : "SWLISINV_PREVIOUS_PAGE_INACTIVE", player), clickType -> {
|
inventory.setItem(size - 9, new SWItem(scroll > 0 ? Material.LIME_DYE : Material.GRAY_DYE, scroll > 0 ? (byte) 10 : (byte) 8, Core.MESSAGE.parse(scroll > 0 ? "SWLISINV_PREVIOUS_PAGE_ACTIVE" : "SWLISINV_PREVIOUS_PAGE_INACTIVE", player), clickType -> {
|
||||||
if (scroll > 0) {
|
if (scroll > 0) {
|
||||||
scroll = Math.max(0, scroll - 9);
|
scroll = Math.max(0, scroll - 9);
|
||||||
open();
|
open();
|
||||||
}
|
}
|
||||||
}).setCustomModelData(CMDs.PREVIOUS_PAGE));
|
}).setCustomModelData(CMDs.PREVIOUS_PAGE));
|
||||||
boolean hasNext = (data.size() + 1) - scroll > 9;
|
boolean hasNext = (data.size() + 1) - scroll > 9;
|
||||||
inventory.setItem(size - 1, new SWItem(SWItem.getDye(hasNext ? 10 : 8), hasNext ? (byte) 10 : (byte) 8, Core.MESSAGE.parse(hasNext ? "SWLISINV_NEXT_PAGE_ACTIVE" : "SWLISINV_NEXT_PAGE_INACTIVE", player), clickType -> {
|
inventory.setItem(size - 1, new SWItem(hasNext ? Material.LIME_DYE : Material.GRAY_DYE, hasNext ? (byte) 10 : (byte) 8, Core.MESSAGE.parse(hasNext ? "SWLISINV_NEXT_PAGE_ACTIVE" : "SWLISINV_NEXT_PAGE_INACTIVE", player), clickType -> {
|
||||||
if (hasNext) {
|
if (hasNext) {
|
||||||
scroll = Math.min(scroll + 9, data.size() + 1 - 9);
|
scroll = Math.min(scroll + 9, data.size() + 1 - 9);
|
||||||
open();
|
open();
|
||||||
|
|||||||
+72
@@ -0,0 +1,72 @@
|
|||||||
|
/*
|
||||||
|
* This file is a part of the SteamWar software.
|
||||||
|
*
|
||||||
|
* Copyright (C) 2026 SteamWar.de-Serverteam
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Affero General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package de.steamwar.bausystem.features.slaves.blastresistance;
|
||||||
|
|
||||||
|
import com.google.common.util.concurrent.AtomicDouble;
|
||||||
|
import com.sk89q.worldedit.LocalSession;
|
||||||
|
import com.sk89q.worldedit.WorldEdit;
|
||||||
|
import com.sk89q.worldedit.WorldEditException;
|
||||||
|
import com.sk89q.worldedit.bukkit.BukkitAdapter;
|
||||||
|
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
||||||
|
import com.sk89q.worldedit.world.block.BlockState;
|
||||||
|
import de.steamwar.bausystem.BauSystem;
|
||||||
|
import de.steamwar.command.SWCommand;
|
||||||
|
import de.steamwar.linkage.Linked;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
|
|
||||||
|
@Linked
|
||||||
|
public class BlastResistanceCommand extends SWCommand {
|
||||||
|
|
||||||
|
public BlastResistanceCommand() {
|
||||||
|
super("blastresistance");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Register(description = "BLASTRESISTANCE_HELP")
|
||||||
|
public void command(@Validator Player player) {
|
||||||
|
LocalSession localSession = WorldEdit.getInstance().getSessionManager().get(BukkitAdapter.adapt(player));
|
||||||
|
Clipboard clipboard;
|
||||||
|
try {
|
||||||
|
clipboard = localSession.getClipboard().getClipboards().getFirst();
|
||||||
|
} catch (WorldEditException e) {
|
||||||
|
BauSystem.MESSAGE.send("BLASTRESISTANCE_NO_CLIPBOARD", player);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
AtomicDouble min = new AtomicDouble(0);
|
||||||
|
AtomicDouble max = new AtomicDouble(0);
|
||||||
|
AtomicDouble sum = new AtomicDouble(0);
|
||||||
|
AtomicInteger count = new AtomicInteger(0);
|
||||||
|
clipboard.forEach(blockVector3 -> {
|
||||||
|
BlockState blockState = clipboard.getBlock(blockVector3);
|
||||||
|
Material material = BukkitAdapter.adapt(blockState).getMaterial();
|
||||||
|
if (material == Material.WATER || material == Material.LAVA) return;
|
||||||
|
double blastResistance = BukkitAdapter.adapt(blockState).getMaterial().getBlastResistance();
|
||||||
|
min.set(Math.min(min.get(), blastResistance));
|
||||||
|
max.set(Math.max(max.get(), blastResistance));
|
||||||
|
sum.addAndGet(blastResistance);
|
||||||
|
count.getAndIncrement();
|
||||||
|
});
|
||||||
|
|
||||||
|
BauSystem.MESSAGE.send("BLASTRESISTANCE_RESULT", player, min.get(), max.get(), sum.get() / count.get());
|
||||||
|
}
|
||||||
|
}
|
||||||
-208
@@ -19,30 +19,17 @@
|
|||||||
|
|
||||||
package de.steamwar.bausystem.features.slaves.laufbau;
|
package de.steamwar.bausystem.features.slaves.laufbau;
|
||||||
|
|
||||||
import com.sk89q.worldedit.blocks.SkullBlock;
|
|
||||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||||
import de.steamwar.bausystem.utils.NMSWrapper;
|
|
||||||
import de.steamwar.core.Core;
|
|
||||||
import de.steamwar.inventory.SWItem;
|
import de.steamwar.inventory.SWItem;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.ToString;
|
import lombok.ToString;
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.block.BlockFace;
|
|
||||||
import org.bukkit.block.data.Bisected;
|
|
||||||
import org.bukkit.block.data.BlockData;
|
import org.bukkit.block.data.BlockData;
|
||||||
import org.bukkit.block.data.Directional;
|
|
||||||
import org.bukkit.block.data.Waterlogged;
|
|
||||||
import org.bukkit.block.data.type.*;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
import static de.steamwar.bausystem.features.slaves.laufbau.LaufbauUtils.createItem;
|
|
||||||
import static de.steamwar.bausystem.features.slaves.laufbau.LaufbauUtils.pixelCuboid;
|
|
||||||
|
|
||||||
@ToString
|
@ToString
|
||||||
@Getter
|
@Getter
|
||||||
public class BlockBoundingBox {
|
public class BlockBoundingBox {
|
||||||
@@ -94,199 +81,4 @@ public class BlockBoundingBox {
|
|||||||
public double volume() {
|
public double volume() {
|
||||||
return volume;
|
return volume;
|
||||||
}
|
}
|
||||||
|
|
||||||
static {
|
|
||||||
addPixel(Material.AIR.createBlockData(), 0, 0, 0, 0, 0, 0, null);
|
|
||||||
// addPixel(Material.COBWEB.createBlockData(), 0, 0, 0, 0, 0, 0, createItem("LAUFBAU_BLOCK_COBWEB", Material.COBWEB));
|
|
||||||
addPixel(Material.END_STONE.createBlockData(), 0, 0, 0, 16, 16, 16, null);
|
|
||||||
|
|
||||||
addPixel(NMSWrapper.impl.pathMaterial().createBlockData(), 0, 0, 0, 16, 15, 16, createItem("LAUFBAU_BLOCK_GRASS_PATH", NMSWrapper.impl.pathMaterial()));
|
|
||||||
addPixel(Material.MUD.createBlockData(), 0, 0, 0, 16, 14, 16, createItem("LAUFBAU_BLOCK_SOUL_SAND", Material.SOUL_SAND));
|
|
||||||
|
|
||||||
Cocoa cocoaNorth = (Cocoa) Material.COCOA.createBlockData();
|
|
||||||
cocoaNorth.setAge(2);
|
|
||||||
cocoaNorth.setFacing(BlockFace.NORTH);
|
|
||||||
addPixel(cocoaNorth, 4, 3, 1, 8, 9, 8, createItem("LAUFBAU_BLOCK_COCOA", Material.COCOA_BEANS, "LAUFBAU_FACING_NORTH"));
|
|
||||||
|
|
||||||
Cocoa cocoaSouth = (Cocoa) Material.COCOA.createBlockData();
|
|
||||||
cocoaSouth.setAge(2);
|
|
||||||
cocoaSouth.setFacing(BlockFace.SOUTH);
|
|
||||||
addPixel(cocoaSouth, 4, 3, 7, 8, 9, 8, createItem("LAUFBAU_BLOCK_COCOA", Material.COCOA_BEANS, "LAUFBAU_FACING_SOUTH"));
|
|
||||||
|
|
||||||
Cocoa cocoaWest = (Cocoa) Material.COCOA.createBlockData();
|
|
||||||
cocoaWest.setAge(2);
|
|
||||||
cocoaWest.setFacing(BlockFace.WEST);
|
|
||||||
addPixel(cocoaWest, 1, 3, 4, 8, 9, 8, createItem("LAUFBAU_BLOCK_COCOA", Material.COCOA_BEANS, "LAUFBAU_FACING_WEST"));
|
|
||||||
|
|
||||||
Cocoa cocoaEast = (Cocoa) Material.COCOA.createBlockData();
|
|
||||||
cocoaEast.setAge(2);
|
|
||||||
cocoaEast.setFacing(BlockFace.EAST);
|
|
||||||
addPixel(cocoaEast, 7, 3, 4, 8, 9, 8, createItem("LAUFBAU_BLOCK_COCOA", Material.COCOA_BEANS, "LAUFBAU_FACING_EAST"));
|
|
||||||
|
|
||||||
TurtleEgg singleTurtleEgg = (TurtleEgg) Material.TURTLE_EGG.createBlockData();
|
|
||||||
singleTurtleEgg.setEggs(1);
|
|
||||||
singleTurtleEgg.setHatch(0);
|
|
||||||
addPixel(singleTurtleEgg, 4, 0, 3, 9, 7, 9, createItem("LAUFBAU_BLOCK_TURTLE_EGG", Material.TURTLE_EGG, "LAUFBAU_COUNT_1"));
|
|
||||||
|
|
||||||
TurtleEgg doubleTurtleEgg = (TurtleEgg) Material.TURTLE_EGG.createBlockData();
|
|
||||||
doubleTurtleEgg.setEggs(2);
|
|
||||||
doubleTurtleEgg.setHatch(0);
|
|
||||||
addPixel(doubleTurtleEgg, 1, 0, 1, 14, 7, 14, createItem("LAUFBAU_BLOCK_TURTLE_EGG", Material.TURTLE_EGG, "LAUFBAU_COUNT_2"));
|
|
||||||
|
|
||||||
addPixel(Material.CHEST.createBlockData(), 1, 0, 1, 14, 14, 14, createItem("LAUFBAU_BLOCK_CHEST", Material.CHEST));
|
|
||||||
|
|
||||||
Snow snowLayers8 = (Snow) Material.SNOW.createBlockData();
|
|
||||||
snowLayers8.setLayers(8);
|
|
||||||
addPixel(snowLayers8, 0, 0, 0, 16, 14, 16, createItem("LAUFBAU_BLOCK_SNOW", Material.SNOW, "LAUFBAU_LAYERS_8"));
|
|
||||||
|
|
||||||
Directional headNorth = (Directional) Material.PLAYER_WALL_HEAD.createBlockData();
|
|
||||||
headNorth.setFacing(BlockFace.NORTH);
|
|
||||||
addPixel(headNorth, 4, 4, 8, 8, 8, 8, createItem("LAUFBAU_BLOCK_PLAYER_WALL_HEAD", Material.PLAYER_HEAD, "LAUFBAU_FACING_NORTH"), BlockBoundingBox::randomPlayerHead);
|
|
||||||
|
|
||||||
Directional headSouth = (Directional) Material.PLAYER_WALL_HEAD.createBlockData();
|
|
||||||
headSouth.setFacing(BlockFace.SOUTH);
|
|
||||||
addPixel(headSouth, 4, 4, 0, 8, 8, 8, createItem("LAUFBAU_BLOCK_PLAYER_WALL_HEAD", Material.PLAYER_HEAD, "LAUFBAU_FACING_SOUTH"), BlockBoundingBox::randomPlayerHead);
|
|
||||||
|
|
||||||
Directional headWest = (Directional) Material.PLAYER_WALL_HEAD.createBlockData();
|
|
||||||
headWest.setFacing(BlockFace.WEST);
|
|
||||||
addPixel(headWest, 8, 4, 4, 8, 8, 8, createItem("LAUFBAU_BLOCK_PLAYER_WALL_HEAD", Material.PLAYER_HEAD, "LAUFBAU_FACING_WEST"), BlockBoundingBox::randomPlayerHead);
|
|
||||||
|
|
||||||
Directional headEast = (Directional) Material.PLAYER_WALL_HEAD.createBlockData();
|
|
||||||
headEast.setFacing(BlockFace.EAST);
|
|
||||||
addPixel(headEast, 0, 4, 4, 8, 8, 8, createItem("LAUFBAU_BLOCK_PLAYER_WALL_HEAD", Material.PLAYER_HEAD, "LAUFBAU_FACING_EAST"), BlockBoundingBox::randomPlayerHead);
|
|
||||||
|
|
||||||
Snow snowLayers7 = (Snow) Material.SNOW.createBlockData();
|
|
||||||
snowLayers7.setLayers(7);
|
|
||||||
addPixel(snowLayers7, 0, 0, 0, 16, 12, 16, createItem("LAUFBAU_BLOCK_SNOW", Material.SNOW, "LAUFBAU_LAYERS_7"));
|
|
||||||
|
|
||||||
Snow snowLayers6 = (Snow) Material.SNOW.createBlockData();
|
|
||||||
snowLayers6.setLayers(6);
|
|
||||||
addPixel(snowLayers6, 0, 0, 0, 16, 10, 16, createItem("LAUFBAU_BLOCK_SNOW", Material.SNOW, "LAUFBAU_LAYERS_6"));
|
|
||||||
|
|
||||||
addPixel(Material.STONECUTTER.createBlockData(), 0, 0, 0, 16, 9, 16, createItem("LAUFBAU_BLOCK_STONECUTTER", Material.STONECUTTER));
|
|
||||||
|
|
||||||
addPixel(Material.PLAYER_HEAD.createBlockData(), 4, 0, 4, 8, 8, 8, createItem("LAUFBAU_BLOCK_PLAYER_HEAD", Material.PLAYER_HEAD), BlockBoundingBox::randomPlayerHead);
|
|
||||||
|
|
||||||
addPixel(Material.CAKE.createBlockData(), 1, 0, 1, 14, 8, 14, createItem("LAUFBAU_BLOCK_CAKE", Material.CAKE));
|
|
||||||
|
|
||||||
Slab bottomSlab = (Slab) Material.END_STONE_BRICK_SLAB.createBlockData();
|
|
||||||
bottomSlab.setType(Slab.Type.BOTTOM);
|
|
||||||
addPixel(bottomSlab, 0, 0, 0, 16, 8, 16, createItem("LAUFBAU_BLOCK_END_STONE_BRICK_SLAB", Material.END_STONE_BRICK_SLAB, "LAUFBAU_TYPE_BOTTOM"));
|
|
||||||
|
|
||||||
Slab topSlab = (Slab) Material.END_STONE_BRICK_SLAB.createBlockData();
|
|
||||||
topSlab.setType(Slab.Type.TOP);
|
|
||||||
addPixel(topSlab, 0, 8, 0, 16, 8, 16, createItem("LAUFBAU_BLOCK_END_STONE_BRICK_SLAB", Material.END_STONE_BRICK_SLAB, "LAUFBAU_TYPE_TOP"));
|
|
||||||
|
|
||||||
SeaPickle quadSeaPickle = (SeaPickle) Material.SEA_PICKLE.createBlockData();
|
|
||||||
quadSeaPickle.setWaterlogged(false);
|
|
||||||
quadSeaPickle.setPickles(4);
|
|
||||||
addPixel(quadSeaPickle, 2, 0, 2, 12, 7, 12, createItem("LAUFBAU_BLOCK_SEA_PICKLE", Material.SEA_PICKLE, "LAUFBAU_COUNT_4"));
|
|
||||||
|
|
||||||
Campfire campfire = (Campfire) Material.CAMPFIRE.createBlockData();
|
|
||||||
campfire.setSignalFire(false);
|
|
||||||
campfire.setLit(false);
|
|
||||||
addPixel(campfire, 0, 0, 0, 16, 7, 16, createItem("LAUFBAU_BLOCK_CAMPFIRE", Material.CAMPFIRE));
|
|
||||||
|
|
||||||
SeaPickle trippleSeaPickle = (SeaPickle) Material.SEA_PICKLE.createBlockData();
|
|
||||||
trippleSeaPickle.setWaterlogged(false);
|
|
||||||
trippleSeaPickle.setPickles(3);
|
|
||||||
addPixel(trippleSeaPickle, 2, 0, 2, 12, 6, 12, createItem("LAUFBAU_BLOCK_SEA_PICKLE", Material.SEA_PICKLE, "LAUFBAU_COUNT_3"));
|
|
||||||
|
|
||||||
SeaPickle doubleSeaPickle = (SeaPickle) Material.SEA_PICKLE.createBlockData();
|
|
||||||
doubleSeaPickle.setWaterlogged(false);
|
|
||||||
doubleSeaPickle.setPickles(2);
|
|
||||||
addPixel(doubleSeaPickle, 3, 0, 3, 10, 6, 10, createItem("LAUFBAU_BLOCK_SEA_PICKLE", Material.SEA_PICKLE, "LAUFBAU_COUNT_2"));
|
|
||||||
|
|
||||||
SeaPickle singleSeaPickle = (SeaPickle) Material.SEA_PICKLE.createBlockData();
|
|
||||||
singleSeaPickle.setWaterlogged(false);
|
|
||||||
singleSeaPickle.setPickles(1);
|
|
||||||
addPixel(singleSeaPickle, 6, 0, 6, 4, 6, 4, createItem("LAUFBAU_BLOCK_SEA_PICKLE", Material.SEA_PICKLE, "LAUFBAU_COUNT_1"));
|
|
||||||
|
|
||||||
addPixel(Material.FLOWER_POT.createBlockData(), 5, 0, 5, 6, 6, 6, createItem("LAUFBAU_BLOCK_FLOWER_POT", Material.FLOWER_POT));
|
|
||||||
|
|
||||||
Snow snowLayers3 = (Snow) Material.SNOW.createBlockData();
|
|
||||||
snowLayers3.setLayers(3);
|
|
||||||
addPixel(snowLayers3, 0, 0, 0, 16, 4, 16, createItem("LAUFBAU_BLOCK_SNOW", Material.SNOW, "LAUFBAU_LAYERS_3"));
|
|
||||||
|
|
||||||
TrapDoor bottomTrapDoor = (TrapDoor) Material.IRON_TRAPDOOR.createBlockData();
|
|
||||||
bottomTrapDoor.setHalf(Bisected.Half.BOTTOM);
|
|
||||||
addPixel(bottomTrapDoor, 0, 0, 0, 16, 3, 16, createItem("LAUFBAU_BLOCK_IRON_TRAPDOOR", Material.IRON_TRAPDOOR, "LAUFBAU_HALF_BOTTOM"));
|
|
||||||
|
|
||||||
TrapDoor topTrapDoor = (TrapDoor) Material.IRON_TRAPDOOR.createBlockData();
|
|
||||||
topTrapDoor.setHalf(Bisected.Half.TOP);
|
|
||||||
addPixel(topTrapDoor, 0, 13, 0, 16, 3, 16, createItem("LAUFBAU_BLOCK_IRON_TRAPDOOR", Material.IRON_TRAPDOOR, "LAUFBAU_HALF_TOP"));
|
|
||||||
|
|
||||||
Snow snowLayers2 = (Snow) Material.SNOW.createBlockData();
|
|
||||||
snowLayers2.setLayers(2);
|
|
||||||
addPixel(snowLayers2, 0, 0, 0, 16, 2, 16, createItem("LAUFBAU_BLOCK_SNOW", Material.SNOW, "LAUFBAU_LAYERS_2"));
|
|
||||||
|
|
||||||
addPixel(Material.LILY_PAD.createBlockData(), 1, 0, 1, 14, 1.5, 14, createItem("LAUFBAU_BLOCK_LILY_PAD", Material.LILY_PAD));
|
|
||||||
addPixel(Material.WHITE_CARPET.createBlockData(), 0, 0, 0, 16, 1, 16, createItem("LAUFBAU_BLOCK_WHITE_CARPET", Material.WHITE_CARPET));
|
|
||||||
|
|
||||||
Directional endRodBottomTop = (Directional) Material.END_ROD.createBlockData();
|
|
||||||
endRodBottomTop.setFacing(BlockFace.UP);
|
|
||||||
addPixel(endRodBottomTop, 6, 0, 6, 4, 16, 4, createItem("LAUFBAU_BLOCK_END_ROD", Material.END_ROD, "LAUFBAU_FACING_UP", "LAUFBAU_FACING_DOWN"));
|
|
||||||
|
|
||||||
Directional endRodNorthSouth = (Directional) Material.END_ROD.createBlockData();
|
|
||||||
endRodNorthSouth.setFacing(BlockFace.NORTH);
|
|
||||||
addPixel(endRodNorthSouth, 6, 6, 0, 4, 4, 16, createItem("LAUFBAU_BLOCK_END_ROD", Material.END_ROD, "LAUFBAU_FACING_NORTH", "LAUFBAU_FACING_SOUTH"));
|
|
||||||
|
|
||||||
Directional endRodEastWest = (Directional) Material.END_ROD.createBlockData();
|
|
||||||
endRodEastWest.setFacing(BlockFace.EAST);
|
|
||||||
addPixel(endRodEastWest, 0, 6, 6, 16, 4, 4, createItem("LAUFBAU_BLOCK_END_ROD", Material.END_ROD, "LAUFBAU_FACING_EAST", "LAUFBAU_FACING_WEST"));
|
|
||||||
|
|
||||||
if (Core.getVersion() >= 19) {
|
|
||||||
Directional lightningRodBottomTop = (Directional) Material.LIGHTNING_ROD.createBlockData();
|
|
||||||
lightningRodBottomTop.setFacing(BlockFace.UP);
|
|
||||||
addPixel(lightningRodBottomTop, 6, 0, 6, 4, 16, 4, createItem("LAUFBAU_BLOCK_LIGHTNING_ROD", Material.LIGHTNING_ROD, "LAUFBAU_FACING_UP", "LAUFBAU_FACING_DOWN"));
|
|
||||||
|
|
||||||
Directional lightningRodNorthSouth = (Directional) Material.LIGHTNING_ROD.createBlockData();
|
|
||||||
lightningRodNorthSouth.setFacing(BlockFace.NORTH);
|
|
||||||
addPixel(lightningRodNorthSouth, 6, 6, 0, 4, 4, 16, createItem("LAUFBAU_BLOCK_LIGHTNING_ROD", Material.LIGHTNING_ROD, "LAUFBAU_FACING_NORTH", "LAUFBAU_FACING_SOUTH"));
|
|
||||||
|
|
||||||
Directional lightningRodEastWest = (Directional) Material.LIGHTNING_ROD.createBlockData();
|
|
||||||
lightningRodEastWest.setFacing(BlockFace.EAST);
|
|
||||||
addPixel(lightningRodEastWest, 0, 6, 6, 16, 4, 4, createItem("LAUFBAU_BLOCK_LIGHTNING_ROD", Material.LIGHTNING_ROD, "LAUFBAU_FACING_EAST", "LAUFBAU_FACING_WEST"));
|
|
||||||
}
|
|
||||||
|
|
||||||
Waterlogged conduit = (Waterlogged) Material.CONDUIT.createBlockData();
|
|
||||||
conduit.setWaterlogged(false);
|
|
||||||
addPixel(conduit, 5, 5, 5, 6, 6, 6, createItem("LAUFBAU_BLOCK_CONDUIT", Material.CONDUIT));
|
|
||||||
|
|
||||||
TrapDoor northTrapDoor = (TrapDoor) Material.IRON_TRAPDOOR.createBlockData();
|
|
||||||
northTrapDoor.setFacing(BlockFace.NORTH);
|
|
||||||
northTrapDoor.setOpen(true);
|
|
||||||
addPixel(northTrapDoor, 0, 0, 13, 16, 16, 3, createItem("LAUFBAU_BLOCK_IRON_TRAPDOOR", Material.IRON_TRAPDOOR, "LAUFBAU_FACING_NORTH", "LAUFBAU_OPEN"));
|
|
||||||
|
|
||||||
TrapDoor southTrapDoor = (TrapDoor) Material.IRON_TRAPDOOR.createBlockData();
|
|
||||||
southTrapDoor.setFacing(BlockFace.SOUTH);
|
|
||||||
southTrapDoor.setOpen(true);
|
|
||||||
addPixel(southTrapDoor, 0, 0, 0, 16, 16, 3, createItem("LAUFBAU_BLOCK_IRON_TRAPDOOR", Material.IRON_TRAPDOOR, "LAUFBAU_FACING_SOUTH", "LAUFBAU_OPEN"));
|
|
||||||
|
|
||||||
TrapDoor westTrapDoor = (TrapDoor) Material.IRON_TRAPDOOR.createBlockData();
|
|
||||||
westTrapDoor.setFacing(BlockFace.WEST);
|
|
||||||
westTrapDoor.setOpen(true);
|
|
||||||
addPixel(westTrapDoor, 13, 0, 0, 3, 16, 16, createItem("LAUFBAU_BLOCK_IRON_TRAPDOOR", Material.IRON_TRAPDOOR, "LAUFBAU_FACING_WEST", "LAUFBAU_OPEN"));
|
|
||||||
|
|
||||||
TrapDoor eastTrapDoor = (TrapDoor) Material.IRON_TRAPDOOR.createBlockData();
|
|
||||||
eastTrapDoor.setFacing(BlockFace.EAST);
|
|
||||||
eastTrapDoor.setOpen(true);
|
|
||||||
addPixel(eastTrapDoor, 0, 0, 0, 3, 16, 16, createItem("LAUFBAU_BLOCK_IRON_TRAPDOOR", Material.IRON_TRAPDOOR, "LAUFBAU_FACING_EAST", "LAUFBAU_OPEN"));
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void addPixel(BlockData blockData, double xPixel, double yPixel, double zPixel, double dxPixel, double dyPixel, double dzPixel, SWItem swItem) {
|
|
||||||
new BlockBoundingBox(blockData, Arrays.asList(pixelCuboid(xPixel, yPixel, zPixel, dxPixel, dyPixel, dzPixel)), swItem);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void addPixel(BlockData blockData, double xPixel, double yPixel, double zPixel, double dxPixel, double dyPixel, double dzPixel, SWItem swItem, Consumer<BaseBlock> blockConsumer) {
|
|
||||||
new BlockBoundingBox(blockData, Arrays.asList(pixelCuboid(xPixel, yPixel, zPixel, dxPixel, dyPixel, dzPixel)), swItem, blockConsumer);
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
|
||||||
private static void randomPlayerHead(BaseBlock block) {
|
|
||||||
if (block instanceof SkullBlock) {
|
|
||||||
SkullBlock skullBlock = (SkullBlock) block;
|
|
||||||
skullBlock.setOwner(randomPlayerHead.get(random.nextInt(randomPlayerHead.size())).toString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
+10
@@ -22,6 +22,7 @@ package de.steamwar.bausystem.features.slaves.laufbau;
|
|||||||
import de.steamwar.bausystem.region.Point;
|
import de.steamwar.bausystem.region.Point;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import org.bukkit.util.BoundingBox;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@@ -33,6 +34,15 @@ public class Cuboid {
|
|||||||
private double dy;
|
private double dy;
|
||||||
private double dz;
|
private double dz;
|
||||||
|
|
||||||
|
public Cuboid(BoundingBox boundingBox) {
|
||||||
|
this.x = boundingBox.getMinX();
|
||||||
|
this.y = boundingBox.getMinY();
|
||||||
|
this.z = boundingBox.getMinZ();
|
||||||
|
this.dx = boundingBox.getWidthX();
|
||||||
|
this.dy = boundingBox.getHeight();
|
||||||
|
this.dz = boundingBox.getWidthZ();
|
||||||
|
}
|
||||||
|
|
||||||
public boolean intersects(Cuboid cuboid) {
|
public boolean intersects(Cuboid cuboid) {
|
||||||
double minx = x - cuboid.dx;
|
double minx = x - cuboid.dx;
|
||||||
double miny = y - cuboid.dy;
|
double miny = y - cuboid.dy;
|
||||||
|
|||||||
+37
-2
@@ -24,17 +24,52 @@ import de.steamwar.bausystem.SWUtils;
|
|||||||
import de.steamwar.bausystem.shared.Pair;
|
import de.steamwar.bausystem.shared.Pair;
|
||||||
import de.steamwar.bausystem.utils.WorldEditUtils;
|
import de.steamwar.bausystem.utils.WorldEditUtils;
|
||||||
import de.steamwar.command.SWCommand;
|
import de.steamwar.command.SWCommand;
|
||||||
|
import de.steamwar.inventory.SWItem;
|
||||||
import de.steamwar.linkage.Linked;
|
import de.steamwar.linkage.Linked;
|
||||||
import de.steamwar.linkage.MinVersion;
|
import net.minecraft.core.BlockPos;
|
||||||
|
import net.minecraft.world.level.EmptyBlockGetter;
|
||||||
|
import net.minecraft.world.level.block.Block;
|
||||||
|
import net.minecraft.world.phys.shapes.CollisionContext;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.Registry;
|
||||||
|
import org.bukkit.craftbukkit.block.CraftBlockType;
|
||||||
|
import org.bukkit.craftbukkit.block.data.CraftBlockData;
|
||||||
|
import org.bukkit.craftbukkit.util.CraftVoxelShape;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.scheduler.BukkitRunnable;
|
import org.bukkit.scheduler.BukkitRunnable;
|
||||||
|
import org.bukkit.util.VoxelShape;
|
||||||
|
|
||||||
|
import java.util.concurrent.atomic.AtomicLong;
|
||||||
|
import java.util.concurrent.atomic.AtomicReference;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@Linked
|
@Linked
|
||||||
@MinVersion(19)
|
|
||||||
public class LaufbauCommand extends SWCommand {
|
public class LaufbauCommand extends SWCommand {
|
||||||
|
|
||||||
|
static {
|
||||||
|
AtomicLong counter = new AtomicLong();
|
||||||
|
AtomicReference<VoxelShape> shape = new AtomicReference<>();
|
||||||
|
long time = System.currentTimeMillis();
|
||||||
|
Registry.BLOCK.forEach(blockType -> {
|
||||||
|
Block block = CraftBlockType.bukkitToMinecraftNew(blockType);
|
||||||
|
block.getStateDefinition().getPossibleStates().forEach(blockState -> {
|
||||||
|
VoxelShape voxelShape = new CraftVoxelShape(blockState.getCollisionShape(EmptyBlockGetter.INSTANCE, BlockPos.ZERO, CollisionContext.empty()));
|
||||||
|
shape.set(voxelShape);
|
||||||
|
Material material = blockType.asMaterial();
|
||||||
|
if (!material.isItem()) return;
|
||||||
|
new BlockBoundingBox(
|
||||||
|
CraftBlockData.createData(blockState),
|
||||||
|
voxelShape.getBoundingBoxes().stream().map(Cuboid::new).collect(Collectors.toList()),
|
||||||
|
new SWItem(material, "Item")
|
||||||
|
);
|
||||||
|
counter.incrementAndGet();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
System.out.println(System.currentTimeMillis() - time + "ms " + shape.get() + " " + counter.get());
|
||||||
|
}
|
||||||
|
|
||||||
public LaufbauCommand() {
|
public LaufbauCommand() {
|
||||||
super("laufbau", "laufsklave");
|
super("laufbau", "laufsklave");
|
||||||
}
|
}
|
||||||
|
|||||||
+7
-3
@@ -33,6 +33,7 @@ import java.util.*;
|
|||||||
public class LaufbauSettings {
|
public class LaufbauSettings {
|
||||||
|
|
||||||
private static Map<Pair<Material, String>, List<BlockBoundingBox>> groupMap = new LinkedHashMap<>();
|
private static Map<Pair<Material, String>, List<BlockBoundingBox>> groupMap = new LinkedHashMap<>();
|
||||||
|
|
||||||
static {
|
static {
|
||||||
BlockBoundingBox.elements.forEach(blockBoundingBox -> {
|
BlockBoundingBox.elements.forEach(blockBoundingBox -> {
|
||||||
if (blockBoundingBox.getSwItem() == null) return;
|
if (blockBoundingBox.getSwItem() == null) return;
|
||||||
@@ -115,12 +116,15 @@ public class LaufbauSettings {
|
|||||||
} else {
|
} else {
|
||||||
long count = blockBoundingBoxes.stream().filter(bb -> LaufbauUtils.isDeactivated(p, bb)).count();
|
long count = blockBoundingBoxes.stream().filter(bb -> LaufbauUtils.isDeactivated(p, bb)).count();
|
||||||
if (count == 0) {
|
if (count == 0) {
|
||||||
return new SWItem(material, BauSystem.MESSAGE.parse(group, p), Arrays.asList("", BauSystem.MESSAGE.parse("LAUFBAU_SETTINGS_ACTIVE", p), "", BauSystem.MESSAGE.parse("LAUFBAU_SETTINGS_ADVANCED", p), BauSystem.MESSAGE.parse("LAUFBAU_SETTINGS_TOGGLE", p)), false, clickType -> {});
|
return new SWItem(material, BauSystem.MESSAGE.parse(group, p), Arrays.asList("", BauSystem.MESSAGE.parse("LAUFBAU_SETTINGS_ACTIVE", p), "", BauSystem.MESSAGE.parse("LAUFBAU_SETTINGS_ADVANCED", p), BauSystem.MESSAGE.parse("LAUFBAU_SETTINGS_TOGGLE", p)), false, clickType -> {
|
||||||
|
});
|
||||||
}
|
}
|
||||||
if (count == blockBoundingBoxes.size()) {
|
if (count == blockBoundingBoxes.size()) {
|
||||||
return new SWItem(material, BauSystem.MESSAGE.parse(group, p), Arrays.asList("", BauSystem.MESSAGE.parse("LAUFBAU_SETTINGS_INACTIVE", p), "", BauSystem.MESSAGE.parse("LAUFBAU_SETTINGS_ADVANCED", p), BauSystem.MESSAGE.parse("LAUFBAU_SETTINGS_TOGGLE", p)), false, clickType -> {});
|
return new SWItem(material, BauSystem.MESSAGE.parse(group, p), Arrays.asList("", BauSystem.MESSAGE.parse("LAUFBAU_SETTINGS_INACTIVE", p), "", BauSystem.MESSAGE.parse("LAUFBAU_SETTINGS_ADVANCED", p), BauSystem.MESSAGE.parse("LAUFBAU_SETTINGS_TOGGLE", p)), false, clickType -> {
|
||||||
|
});
|
||||||
}
|
}
|
||||||
return new SWItem(material, BauSystem.MESSAGE.parse(group, p), Arrays.asList("", BauSystem.MESSAGE.parse("LAUFBAU_SETTINGS_MIXED", p, blockBoundingBoxes.size() - count, blockBoundingBoxes.size()), "", BauSystem.MESSAGE.parse("LAUFBAU_SETTINGS_ADVANCED", p), BauSystem.MESSAGE.parse("LAUFBAU_SETTINGS_TOGGLE", p)), false, clickType -> {});
|
return new SWItem(material, BauSystem.MESSAGE.parse(group, p), Arrays.asList("", BauSystem.MESSAGE.parse("LAUFBAU_SETTINGS_MIXED", p, blockBoundingBoxes.size() - count, blockBoundingBoxes.size()), "", BauSystem.MESSAGE.parse("LAUFBAU_SETTINGS_ADVANCED", p), BauSystem.MESSAGE.parse("LAUFBAU_SETTINGS_TOGGLE", p)), false, clickType -> {
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
-263
@@ -1,263 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is a part of the SteamWar software.
|
|
||||||
*
|
|
||||||
* Copyright (C) 2025 SteamWar.de-Serverteam
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU Affero General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU Affero General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.steamwar.bausystem.features.slaves.laufbau.boundingboxes;
|
|
||||||
|
|
||||||
import de.steamwar.bausystem.features.slaves.laufbau.BlockBoundingBox;
|
|
||||||
import de.steamwar.bausystem.features.slaves.laufbau.BoundingBoxLoader;
|
|
||||||
import de.steamwar.bausystem.features.slaves.laufbau.Cuboid;
|
|
||||||
import de.steamwar.linkage.Linked;
|
|
||||||
import de.steamwar.linkage.MinVersion;
|
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.block.BlockFace;
|
|
||||||
import org.bukkit.block.data.type.AmethystCluster;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import static de.steamwar.bausystem.features.slaves.laufbau.LaufbauUtils.createItem;
|
|
||||||
import static de.steamwar.bausystem.features.slaves.laufbau.LaufbauUtils.pixelCuboid;
|
|
||||||
|
|
||||||
@Linked
|
|
||||||
@MinVersion(19)
|
|
||||||
public class AmethystBoundingBox implements BoundingBoxLoader {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void load() {
|
|
||||||
floorSmallAmethystBud();
|
|
||||||
ceilingSmallAmethystBud();
|
|
||||||
northSmallAmethystBud();
|
|
||||||
southSmallAmethystBud();
|
|
||||||
eastSmallAmethystBud();
|
|
||||||
westSmallAmethystBud();
|
|
||||||
|
|
||||||
floorMediumAmethystBud();
|
|
||||||
ceilingMediumAmethystBud();
|
|
||||||
northMediumAmethystBud();
|
|
||||||
southMediumAmethystBud();
|
|
||||||
eastMediumAmethystBud();
|
|
||||||
westMediumAmethystBud();
|
|
||||||
|
|
||||||
floorLargeAmethystBud();
|
|
||||||
ceilingLargeAmethystBud();
|
|
||||||
northLargeAmethystBud();
|
|
||||||
southLargeAmethystBud();
|
|
||||||
eastLargeAmethystBud();
|
|
||||||
westLargeAmethystBud();
|
|
||||||
|
|
||||||
floorAmethystCluster();
|
|
||||||
ceilingAmethystCluster();
|
|
||||||
northAmethystCluster();
|
|
||||||
southAmethystCluster();
|
|
||||||
eastAmethystCluster();
|
|
||||||
westAmethystCluster();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void floorSmallAmethystBud() {
|
|
||||||
AmethystCluster cluster = (AmethystCluster) Material.SMALL_AMETHYST_BUD.createBlockData();
|
|
||||||
cluster.setFacing(BlockFace.UP);
|
|
||||||
List<Cuboid> cuboidList = new ArrayList<>();
|
|
||||||
cuboidList.add(pixelCuboid(4, 0, 4, 8, 3, 8));
|
|
||||||
new BlockBoundingBox(cluster, cuboidList, createItem("LAUFBAU_BLOCK_SMALL_AMETHYST_BUD", Material.SMALL_AMETHYST_BUD, "LAUFBAU_FACING_UP"));
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ceilingSmallAmethystBud() {
|
|
||||||
AmethystCluster cluster = (AmethystCluster) Material.SMALL_AMETHYST_BUD.createBlockData();
|
|
||||||
cluster.setFacing(BlockFace.DOWN);
|
|
||||||
List<Cuboid> cuboidList = new ArrayList<>();
|
|
||||||
cuboidList.add(pixelCuboid(4, 13, 4, 8, 3, 8));
|
|
||||||
new BlockBoundingBox(cluster, cuboidList, createItem("LAUFBAU_BLOCK_SMALL_AMETHYST_BUD", Material.SMALL_AMETHYST_BUD, "LAUFBAU_FACING_DOWN"));
|
|
||||||
}
|
|
||||||
|
|
||||||
private void northSmallAmethystBud() {
|
|
||||||
AmethystCluster cluster = (AmethystCluster) Material.SMALL_AMETHYST_BUD.createBlockData();
|
|
||||||
cluster.setFacing(BlockFace.NORTH);
|
|
||||||
List<Cuboid> cuboidList = new ArrayList<>();
|
|
||||||
cuboidList.add(pixelCuboid(4, 4, 13, 8, 8, 3));
|
|
||||||
new BlockBoundingBox(cluster, cuboidList, createItem("LAUFBAU_BLOCK_SMALL_AMETHYST_BUD", Material.SMALL_AMETHYST_BUD, "LAUFBAU_FACING_NORTH"));
|
|
||||||
}
|
|
||||||
|
|
||||||
private void southSmallAmethystBud() {
|
|
||||||
AmethystCluster cluster = (AmethystCluster) Material.SMALL_AMETHYST_BUD.createBlockData();
|
|
||||||
cluster.setFacing(BlockFace.SOUTH);
|
|
||||||
List<Cuboid> cuboidList = new ArrayList<>();
|
|
||||||
cuboidList.add(pixelCuboid(4, 4, 0, 8, 8, 3));
|
|
||||||
new BlockBoundingBox(cluster, cuboidList, createItem("LAUFBAU_BLOCK_SMALL_AMETHYST_BUD", Material.SMALL_AMETHYST_BUD, "LAUFBAU_FACING_SOUTH"));
|
|
||||||
}
|
|
||||||
|
|
||||||
private void eastSmallAmethystBud() {
|
|
||||||
AmethystCluster cluster = (AmethystCluster) Material.SMALL_AMETHYST_BUD.createBlockData();
|
|
||||||
cluster.setFacing(BlockFace.EAST);
|
|
||||||
List<Cuboid> cuboidList = new ArrayList<>();
|
|
||||||
cuboidList.add(pixelCuboid(0, 4, 4, 3, 8, 8));
|
|
||||||
new BlockBoundingBox(cluster, cuboidList, createItem("LAUFBAU_BLOCK_SMALL_AMETHYST_BUD", Material.SMALL_AMETHYST_BUD, "LAUFBAU_FACING_EAST"));
|
|
||||||
}
|
|
||||||
|
|
||||||
private void westSmallAmethystBud() {
|
|
||||||
AmethystCluster cluster = (AmethystCluster) Material.SMALL_AMETHYST_BUD.createBlockData();
|
|
||||||
cluster.setFacing(BlockFace.WEST);
|
|
||||||
List<Cuboid> cuboidList = new ArrayList<>();
|
|
||||||
cuboidList.add(pixelCuboid(13, 4, 4, 3, 8, 8));
|
|
||||||
new BlockBoundingBox(cluster, cuboidList, createItem("LAUFBAU_BLOCK_SMALL_AMETHYST_BUD", Material.SMALL_AMETHYST_BUD, "LAUFBAU_FACING_WEST"));
|
|
||||||
}
|
|
||||||
|
|
||||||
private void floorMediumAmethystBud() {
|
|
||||||
AmethystCluster cluster = (AmethystCluster) Material.MEDIUM_AMETHYST_BUD.createBlockData();
|
|
||||||
cluster.setFacing(BlockFace.UP);
|
|
||||||
List<Cuboid> cuboidList = new ArrayList<>();
|
|
||||||
cuboidList.add(pixelCuboid(3, 0, 3, 10, 4, 10));
|
|
||||||
new BlockBoundingBox(cluster, cuboidList, createItem("LAUFBAU_BLOCK_MEDIUM_AMETHYST_BUD", Material.MEDIUM_AMETHYST_BUD, "LAUFBAU_FACING_UP"));
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ceilingMediumAmethystBud() {
|
|
||||||
AmethystCluster cluster = (AmethystCluster) Material.MEDIUM_AMETHYST_BUD.createBlockData();
|
|
||||||
cluster.setFacing(BlockFace.DOWN);
|
|
||||||
List<Cuboid> cuboidList = new ArrayList<>();
|
|
||||||
cuboidList.add(pixelCuboid(3, 12, 3, 10, 4, 10));
|
|
||||||
new BlockBoundingBox(cluster, cuboidList, createItem("LAUFBAU_BLOCK_MEDIUM_AMETHYST_BUD", Material.MEDIUM_AMETHYST_BUD, "LAUFBAU_FACING_DOWN"));
|
|
||||||
}
|
|
||||||
|
|
||||||
private void northMediumAmethystBud() {
|
|
||||||
AmethystCluster cluster = (AmethystCluster) Material.MEDIUM_AMETHYST_BUD.createBlockData();
|
|
||||||
cluster.setFacing(BlockFace.NORTH);
|
|
||||||
List<Cuboid> cuboidList = new ArrayList<>();
|
|
||||||
cuboidList.add(pixelCuboid(3, 3, 12, 10, 10, 4));
|
|
||||||
new BlockBoundingBox(cluster, cuboidList, createItem("LAUFBAU_BLOCK_MEDIUM_AMETHYST_BUD", Material.MEDIUM_AMETHYST_BUD, "LAUFBAU_FACING_NORTH"));
|
|
||||||
}
|
|
||||||
|
|
||||||
private void southMediumAmethystBud() {
|
|
||||||
AmethystCluster cluster = (AmethystCluster) Material.MEDIUM_AMETHYST_BUD.createBlockData();
|
|
||||||
cluster.setFacing(BlockFace.SOUTH);
|
|
||||||
List<Cuboid> cuboidList = new ArrayList<>();
|
|
||||||
cuboidList.add(pixelCuboid(3, 3, 0, 10, 10, 4));
|
|
||||||
new BlockBoundingBox(cluster, cuboidList, createItem("LAUFBAU_BLOCK_MEDIUM_AMETHYST_BUD", Material.MEDIUM_AMETHYST_BUD, "LAUFBAU_FACING_SOUTH"));
|
|
||||||
}
|
|
||||||
|
|
||||||
private void eastMediumAmethystBud() {
|
|
||||||
AmethystCluster cluster = (AmethystCluster) Material.MEDIUM_AMETHYST_BUD.createBlockData();
|
|
||||||
cluster.setFacing(BlockFace.EAST);
|
|
||||||
List<Cuboid> cuboidList = new ArrayList<>();
|
|
||||||
cuboidList.add(pixelCuboid(0, 3, 3, 4, 10, 10));
|
|
||||||
new BlockBoundingBox(cluster, cuboidList, createItem("LAUFBAU_BLOCK_MEDIUM_AMETHYST_BUD", Material.MEDIUM_AMETHYST_BUD, "LAUFBAU_FACING_EAST"));
|
|
||||||
}
|
|
||||||
|
|
||||||
private void westMediumAmethystBud() {
|
|
||||||
AmethystCluster cluster = (AmethystCluster) Material.MEDIUM_AMETHYST_BUD.createBlockData();
|
|
||||||
cluster.setFacing(BlockFace.WEST);
|
|
||||||
List<Cuboid> cuboidList = new ArrayList<>();
|
|
||||||
cuboidList.add(pixelCuboid(12, 3, 3, 4, 10, 10));
|
|
||||||
new BlockBoundingBox(cluster, cuboidList, createItem("LAUFBAU_BLOCK_MEDIUM_AMETHYST_BUD", Material.MEDIUM_AMETHYST_BUD, "LAUFBAU_FACING_WEST"));
|
|
||||||
}
|
|
||||||
|
|
||||||
private void floorLargeAmethystBud() {
|
|
||||||
AmethystCluster cluster = (AmethystCluster) Material.LARGE_AMETHYST_BUD.createBlockData();
|
|
||||||
cluster.setFacing(BlockFace.UP);
|
|
||||||
List<Cuboid> cuboidList = new ArrayList<>();
|
|
||||||
cuboidList.add(pixelCuboid(3, 0, 3, 10, 5, 10));
|
|
||||||
new BlockBoundingBox(cluster, cuboidList, createItem("LAUFBAU_BLOCK_LARGE_AMETHYST_BUD", Material.LARGE_AMETHYST_BUD, "LAUFBAU_FACING_UP"));
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ceilingLargeAmethystBud() {
|
|
||||||
AmethystCluster cluster = (AmethystCluster) Material.LARGE_AMETHYST_BUD.createBlockData();
|
|
||||||
cluster.setFacing(BlockFace.DOWN);
|
|
||||||
List<Cuboid> cuboidList = new ArrayList<>();
|
|
||||||
cuboidList.add(pixelCuboid(3, 11, 3, 10, 5, 10));
|
|
||||||
new BlockBoundingBox(cluster, cuboidList, createItem("LAUFBAU_BLOCK_LARGE_AMETHYST_BUD", Material.LARGE_AMETHYST_BUD, "LAUFBAU_FACING_DOWN"));
|
|
||||||
}
|
|
||||||
|
|
||||||
private void northLargeAmethystBud() {
|
|
||||||
AmethystCluster cluster = (AmethystCluster) Material.LARGE_AMETHYST_BUD.createBlockData();
|
|
||||||
cluster.setFacing(BlockFace.NORTH);
|
|
||||||
List<Cuboid> cuboidList = new ArrayList<>();
|
|
||||||
cuboidList.add(pixelCuboid(3, 3, 11, 10, 10, 5));
|
|
||||||
new BlockBoundingBox(cluster, cuboidList, createItem("LAUFBAU_BLOCK_LARGE_AMETHYST_BUD", Material.LARGE_AMETHYST_BUD, "LAUFBAU_FACING_NORTH"));
|
|
||||||
}
|
|
||||||
|
|
||||||
private void southLargeAmethystBud() {
|
|
||||||
AmethystCluster cluster = (AmethystCluster) Material.LARGE_AMETHYST_BUD.createBlockData();
|
|
||||||
cluster.setFacing(BlockFace.SOUTH);
|
|
||||||
List<Cuboid> cuboidList = new ArrayList<>();
|
|
||||||
cuboidList.add(pixelCuboid(3, 3, 0, 10, 10, 5));
|
|
||||||
new BlockBoundingBox(cluster, cuboidList, createItem("LAUFBAU_BLOCK_LARGE_AMETHYST_BUD", Material.LARGE_AMETHYST_BUD, "LAUFBAU_FACING_SOUTH"));
|
|
||||||
}
|
|
||||||
|
|
||||||
private void eastLargeAmethystBud() {
|
|
||||||
AmethystCluster cluster = (AmethystCluster) Material.LARGE_AMETHYST_BUD.createBlockData();
|
|
||||||
cluster.setFacing(BlockFace.EAST);
|
|
||||||
List<Cuboid> cuboidList = new ArrayList<>();
|
|
||||||
cuboidList.add(pixelCuboid(0, 3, 3, 5, 10, 10));
|
|
||||||
new BlockBoundingBox(cluster, cuboidList, createItem("LAUFBAU_BLOCK_LARGE_AMETHYST_BUD", Material.LARGE_AMETHYST_BUD, "LAUFBAU_FACING_EAST"));
|
|
||||||
}
|
|
||||||
|
|
||||||
private void westLargeAmethystBud() {
|
|
||||||
AmethystCluster cluster = (AmethystCluster) Material.LARGE_AMETHYST_BUD.createBlockData();
|
|
||||||
cluster.setFacing(BlockFace.WEST);
|
|
||||||
List<Cuboid> cuboidList = new ArrayList<>();
|
|
||||||
cuboidList.add(pixelCuboid(11, 3, 3, 5, 10, 10));
|
|
||||||
new BlockBoundingBox(cluster, cuboidList, createItem("LAUFBAU_BLOCK_LARGE_AMETHYST_BUD", Material.LARGE_AMETHYST_BUD, "LAUFBAU_FACING_WEST"));
|
|
||||||
}
|
|
||||||
|
|
||||||
private void floorAmethystCluster() {
|
|
||||||
AmethystCluster cluster = (AmethystCluster) Material.AMETHYST_CLUSTER.createBlockData();
|
|
||||||
cluster.setFacing(BlockFace.UP);
|
|
||||||
List<Cuboid> cuboidList = new ArrayList<>();
|
|
||||||
cuboidList.add(pixelCuboid(3, 0, 3, 10, 7, 10));
|
|
||||||
new BlockBoundingBox(cluster, cuboidList, createItem("LAUFBAU_BLOCK_AMETHYST_CLUSTER", Material.AMETHYST_CLUSTER, "LAUFBAU_FACING_UP"));
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ceilingAmethystCluster() {
|
|
||||||
AmethystCluster cluster = (AmethystCluster) Material.AMETHYST_CLUSTER.createBlockData();
|
|
||||||
cluster.setFacing(BlockFace.DOWN);
|
|
||||||
List<Cuboid> cuboidList = new ArrayList<>();
|
|
||||||
cuboidList.add(pixelCuboid(3, 9, 3, 10, 7, 10));
|
|
||||||
new BlockBoundingBox(cluster, cuboidList, createItem("LAUFBAU_BLOCK_AMETHYST_CLUSTER", Material.AMETHYST_CLUSTER, "LAUFBAU_FACING_DOWN"));
|
|
||||||
}
|
|
||||||
|
|
||||||
private void northAmethystCluster() {
|
|
||||||
AmethystCluster cluster = (AmethystCluster) Material.AMETHYST_CLUSTER.createBlockData();
|
|
||||||
cluster.setFacing(BlockFace.NORTH);
|
|
||||||
List<Cuboid> cuboidList = new ArrayList<>();
|
|
||||||
cuboidList.add(pixelCuboid(3, 3, 9, 10, 10, 7));
|
|
||||||
new BlockBoundingBox(cluster, cuboidList, createItem("LAUFBAU_BLOCK_AMETHYST_CLUSTER", Material.AMETHYST_CLUSTER, "LAUFBAU_FACING_NORTH"));
|
|
||||||
}
|
|
||||||
|
|
||||||
private void southAmethystCluster() {
|
|
||||||
AmethystCluster cluster = (AmethystCluster) Material.AMETHYST_CLUSTER.createBlockData();
|
|
||||||
cluster.setFacing(BlockFace.SOUTH);
|
|
||||||
List<Cuboid> cuboidList = new ArrayList<>();
|
|
||||||
cuboidList.add(pixelCuboid(3, 3, 0, 10, 10, 7));
|
|
||||||
new BlockBoundingBox(cluster, cuboidList, createItem("LAUFBAU_BLOCK_AMETHYST_CLUSTER", Material.AMETHYST_CLUSTER, "LAUFBAU_FACING_SOUTH"));
|
|
||||||
}
|
|
||||||
|
|
||||||
private void eastAmethystCluster() {
|
|
||||||
AmethystCluster cluster = (AmethystCluster) Material.AMETHYST_CLUSTER.createBlockData();
|
|
||||||
cluster.setFacing(BlockFace.EAST);
|
|
||||||
List<Cuboid> cuboidList = new ArrayList<>();
|
|
||||||
cuboidList.add(pixelCuboid(0, 3, 3, 7, 10, 10));
|
|
||||||
new BlockBoundingBox(cluster, cuboidList, createItem("LAUFBAU_BLOCK_AMETHYST_CLUSTER", Material.AMETHYST_CLUSTER, "LAUFBAU_FACING_EAST"));
|
|
||||||
}
|
|
||||||
|
|
||||||
private void westAmethystCluster() {
|
|
||||||
AmethystCluster cluster = (AmethystCluster) Material.AMETHYST_CLUSTER.createBlockData();
|
|
||||||
cluster.setFacing(BlockFace.WEST);
|
|
||||||
List<Cuboid> cuboidList = new ArrayList<>();
|
|
||||||
cuboidList.add(pixelCuboid(9, 3, 3, 7, 10, 10));
|
|
||||||
new BlockBoundingBox(cluster, cuboidList, createItem("LAUFBAU_BLOCK_AMETHYST_CLUSTER", Material.AMETHYST_CLUSTER, "LAUFBAU_FACING_WEST"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-48
@@ -1,48 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is a part of the SteamWar software.
|
|
||||||
*
|
|
||||||
* Copyright (C) 2025 SteamWar.de-Serverteam
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU Affero General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU Affero General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.steamwar.bausystem.features.slaves.laufbau.boundingboxes;
|
|
||||||
|
|
||||||
import de.steamwar.bausystem.features.slaves.laufbau.BlockBoundingBox;
|
|
||||||
import de.steamwar.bausystem.features.slaves.laufbau.BoundingBoxLoader;
|
|
||||||
import de.steamwar.bausystem.features.slaves.laufbau.Cuboid;
|
|
||||||
import de.steamwar.linkage.Linked;
|
|
||||||
import de.steamwar.linkage.MinVersion;
|
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.block.data.BlockData;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import static de.steamwar.bausystem.features.slaves.laufbau.LaufbauUtils.createItem;
|
|
||||||
import static de.steamwar.bausystem.features.slaves.laufbau.LaufbauUtils.pixelCuboid;
|
|
||||||
|
|
||||||
@Linked
|
|
||||||
@MinVersion(19)
|
|
||||||
public class AzaleaBoundingBox implements BoundingBoxLoader {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void load() {
|
|
||||||
BlockData blockData = Material.FLOWERING_AZALEA.createBlockData();
|
|
||||||
List<Cuboid> cuboidList = new ArrayList<>();
|
|
||||||
cuboidList.add(pixelCuboid(0, 8, 0, 16, 8, 16));
|
|
||||||
cuboidList.add(pixelCuboid(6, 0, 6, 4, 8, 4));
|
|
||||||
new BlockBoundingBox(blockData, cuboidList, createItem("LAUFBAU_BLOCK_AZALEA", Material.FLOWERING_AZALEA));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-149
@@ -1,149 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is a part of the SteamWar software.
|
|
||||||
*
|
|
||||||
* Copyright (C) 2025 SteamWar.de-Serverteam
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU Affero General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU Affero General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.steamwar.bausystem.features.slaves.laufbau.boundingboxes;
|
|
||||||
|
|
||||||
import de.steamwar.bausystem.features.slaves.laufbau.BlockBoundingBox;
|
|
||||||
import de.steamwar.bausystem.features.slaves.laufbau.BoundingBoxLoader;
|
|
||||||
import de.steamwar.bausystem.features.slaves.laufbau.Cuboid;
|
|
||||||
import de.steamwar.linkage.Linked;
|
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.block.BlockFace;
|
|
||||||
import org.bukkit.block.data.type.Bell;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import static de.steamwar.bausystem.features.slaves.laufbau.LaufbauUtils.createItem;
|
|
||||||
import static de.steamwar.bausystem.features.slaves.laufbau.LaufbauUtils.pixelCuboid;
|
|
||||||
|
|
||||||
@Linked
|
|
||||||
public class BellBoundingBox implements BoundingBoxLoader {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void load() {
|
|
||||||
ceilingBell();
|
|
||||||
|
|
||||||
floorNorthBell();
|
|
||||||
floorEastBell();
|
|
||||||
|
|
||||||
doubleWallNorthBell();
|
|
||||||
doubleWallEastBell();
|
|
||||||
|
|
||||||
singleWallNorthBell();
|
|
||||||
singleWallSouthBell();
|
|
||||||
singleWallEastBell();
|
|
||||||
singleWallWestBell();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void ceilingBell() {
|
|
||||||
Bell bell = (Bell) Material.BELL.createBlockData();
|
|
||||||
bell.setAttachment(Bell.Attachment.CEILING);
|
|
||||||
bell.setFacing(BlockFace.NORTH);
|
|
||||||
List<Cuboid> cuboidList = new ArrayList<>();
|
|
||||||
cuboidList.add(pixelCuboid(4, 4, 4, 8, 2, 8));
|
|
||||||
cuboidList.add(pixelCuboid(5, 6, 5, 6, 8, 6));
|
|
||||||
cuboidList.add(pixelCuboid(7, 13, 7, 2, 3, 2));
|
|
||||||
new BlockBoundingBox(bell, cuboidList, createItem("LAUFBAU_BLOCK_BELL", Material.BELL, "LAUFBAU_ATTACHMENT_CEILING"));
|
|
||||||
}
|
|
||||||
|
|
||||||
public void floorNorthBell() {
|
|
||||||
Bell bell = (Bell) Material.BELL.createBlockData();
|
|
||||||
bell.setAttachment(Bell.Attachment.FLOOR);
|
|
||||||
bell.setFacing(BlockFace.NORTH);
|
|
||||||
List<Cuboid> cuboidList = new ArrayList<>();
|
|
||||||
cuboidList.add(pixelCuboid(0, 0, 4, 16, 16, 8));
|
|
||||||
new BlockBoundingBox(bell, cuboidList, createItem("LAUFBAU_BLOCK_BELL", Material.BELL, "LAUFBAU_ATTACHMENT_FLOOR", "LAUFBAU_FACING_NORTH", "LAUFBAU_FACING_SOUTH"));
|
|
||||||
}
|
|
||||||
|
|
||||||
public void floorEastBell() {
|
|
||||||
Bell bell = (Bell) Material.BELL.createBlockData();
|
|
||||||
bell.setAttachment(Bell.Attachment.FLOOR);
|
|
||||||
bell.setFacing(BlockFace.EAST);
|
|
||||||
List<Cuboid> cuboidList = new ArrayList<>();
|
|
||||||
cuboidList.add(pixelCuboid(4, 0, 0, 8, 16, 16));
|
|
||||||
new BlockBoundingBox(bell, cuboidList, createItem("LAUFBAU_BLOCK_BELL", Material.BELL, "LAUFBAU_ATTACHMENT_FLOOR", "LAUFBAU_FACING_EAST", "LAUFBAU_FACING_WEST"));
|
|
||||||
}
|
|
||||||
|
|
||||||
public void doubleWallNorthBell() {
|
|
||||||
Bell bell = (Bell) Material.BELL.createBlockData();
|
|
||||||
bell.setAttachment(Bell.Attachment.DOUBLE_WALL);
|
|
||||||
bell.setFacing(BlockFace.NORTH);
|
|
||||||
List<Cuboid> cuboidList = new ArrayList<>();
|
|
||||||
cuboidList.add(pixelCuboid(4, 4, 4, 8, 2, 8));
|
|
||||||
cuboidList.add(pixelCuboid(5, 6, 5, 6, 8, 6));
|
|
||||||
cuboidList.add(pixelCuboid(7, 13, 0, 2, 2, 16));
|
|
||||||
new BlockBoundingBox(bell, cuboidList, createItem("LAUFBAU_BLOCK_BELL", Material.BELL, "LAUFBAU_ATTACHMENT_DOUBLE_WALL", "LAUFBAU_FACING_NORTH"));
|
|
||||||
}
|
|
||||||
|
|
||||||
public void doubleWallEastBell() {
|
|
||||||
Bell bell = (Bell) Material.BELL.createBlockData();
|
|
||||||
bell.setAttachment(Bell.Attachment.DOUBLE_WALL);
|
|
||||||
bell.setFacing(BlockFace.EAST);
|
|
||||||
List<Cuboid> cuboidList = new ArrayList<>();
|
|
||||||
cuboidList.add(pixelCuboid(4, 4, 4, 8, 2, 8));
|
|
||||||
cuboidList.add(pixelCuboid(5, 6, 5, 6, 8, 6));
|
|
||||||
cuboidList.add(pixelCuboid(0, 13, 7, 16, 2, 2));
|
|
||||||
new BlockBoundingBox(bell, cuboidList, createItem("LAUFBAU_BLOCK_BELL", Material.BELL, "LAUFBAU_ATTACHMENT_DOUBLE_WALL", "LAUFBAU_FACING_EAST"));
|
|
||||||
}
|
|
||||||
|
|
||||||
public void singleWallNorthBell() {
|
|
||||||
Bell bell = (Bell) Material.BELL.createBlockData();
|
|
||||||
bell.setAttachment(Bell.Attachment.SINGLE_WALL);
|
|
||||||
bell.setFacing(BlockFace.NORTH);
|
|
||||||
List<Cuboid> cuboidList = new ArrayList<>();
|
|
||||||
cuboidList.add(pixelCuboid(4, 4, 4, 8, 2, 8));
|
|
||||||
cuboidList.add(pixelCuboid(5, 6, 5, 6, 8, 6));
|
|
||||||
cuboidList.add(pixelCuboid(7, 13, 0, 2, 2, 13));
|
|
||||||
new BlockBoundingBox(bell, cuboidList, createItem("LAUFBAU_BLOCK_BELL", Material.BELL, "LAUFBAU_ATTACHMENT_SINGLE_WALL", "LAUFBAU_FACING_NORTH"));
|
|
||||||
}
|
|
||||||
|
|
||||||
public void singleWallSouthBell() {
|
|
||||||
Bell bell = (Bell) Material.BELL.createBlockData();
|
|
||||||
bell.setAttachment(Bell.Attachment.SINGLE_WALL);
|
|
||||||
bell.setFacing(BlockFace.SOUTH);
|
|
||||||
List<Cuboid> cuboidList = new ArrayList<>();
|
|
||||||
cuboidList.add(pixelCuboid(4, 4, 4, 8, 2, 8));
|
|
||||||
cuboidList.add(pixelCuboid(5, 6, 5, 6, 8, 6));
|
|
||||||
cuboidList.add(pixelCuboid(7, 13, 3, 2, 2, 13));
|
|
||||||
new BlockBoundingBox(bell, cuboidList, createItem("LAUFBAU_BLOCK_BELL", Material.BELL, "LAUFBAU_ATTACHMENT_SINGLE_WALL", "LAUFBAU_FACING_SOUTH"));
|
|
||||||
}
|
|
||||||
|
|
||||||
public void singleWallEastBell() {
|
|
||||||
Bell bell = (Bell) Material.BELL.createBlockData();
|
|
||||||
bell.setAttachment(Bell.Attachment.SINGLE_WALL);
|
|
||||||
bell.setFacing(BlockFace.EAST);
|
|
||||||
List<Cuboid> cuboidList = new ArrayList<>();
|
|
||||||
cuboidList.add(pixelCuboid(4, 4, 4, 8, 2, 8));
|
|
||||||
cuboidList.add(pixelCuboid(5, 6, 5, 6, 8, 6));
|
|
||||||
cuboidList.add(pixelCuboid(3, 13, 7, 13, 2, 2));
|
|
||||||
new BlockBoundingBox(bell, cuboidList, createItem("LAUFBAU_BLOCK_BELL", Material.BELL, "LAUFBAU_ATTACHMENT_SINGLE_WALL", "LAUFBAU_FACING_EAST"));
|
|
||||||
}
|
|
||||||
|
|
||||||
public void singleWallWestBell() {
|
|
||||||
Bell bell = (Bell) Material.BELL.createBlockData();
|
|
||||||
bell.setAttachment(Bell.Attachment.SINGLE_WALL);
|
|
||||||
bell.setFacing(BlockFace.WEST);
|
|
||||||
List<Cuboid> cuboidList = new ArrayList<>();
|
|
||||||
cuboidList.add(pixelCuboid(4, 4, 4, 8, 2, 8));
|
|
||||||
cuboidList.add(pixelCuboid(5, 6, 5, 6, 8, 6));
|
|
||||||
cuboidList.add(pixelCuboid(0, 13, 7, 13, 2, 2));
|
|
||||||
new BlockBoundingBox(bell, cuboidList, createItem("LAUFBAU_BLOCK_BELL", Material.BELL, "LAUFBAU_ATTACHMENT_SINGLE_WALL", "LAUFBAU_FACING_WEST"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-46
@@ -1,46 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is a part of the SteamWar software.
|
|
||||||
*
|
|
||||||
* Copyright (C) 2025 SteamWar.de-Serverteam
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU Affero General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU Affero General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.steamwar.bausystem.features.slaves.laufbau.boundingboxes;
|
|
||||||
|
|
||||||
import de.steamwar.bausystem.features.slaves.laufbau.BlockBoundingBox;
|
|
||||||
import de.steamwar.bausystem.features.slaves.laufbau.BoundingBoxLoader;
|
|
||||||
import de.steamwar.bausystem.features.slaves.laufbau.Cuboid;
|
|
||||||
import de.steamwar.linkage.Linked;
|
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.block.data.type.BrewingStand;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import static de.steamwar.bausystem.features.slaves.laufbau.LaufbauUtils.createItem;
|
|
||||||
import static de.steamwar.bausystem.features.slaves.laufbau.LaufbauUtils.pixelCuboid;
|
|
||||||
|
|
||||||
@Linked
|
|
||||||
public class BrewingStandBoundingBox implements BoundingBoxLoader {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void load() {
|
|
||||||
BrewingStand brewingStand = (BrewingStand) Material.BREWING_STAND.createBlockData();
|
|
||||||
List<Cuboid> cuboids = new ArrayList<>();
|
|
||||||
cuboids.add(pixelCuboid(1, 0, 1, 14, 2, 14));
|
|
||||||
cuboids.add(pixelCuboid(7, 2, 7, 2, 12, 2));
|
|
||||||
new BlockBoundingBox(brewingStand, cuboids, createItem("LAUFBAU_BLOCK_BREWING_STAND", Material.BREWING_STAND));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-64
@@ -1,64 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is a part of the SteamWar software.
|
|
||||||
*
|
|
||||||
* Copyright (C) 2025 SteamWar.de-Serverteam
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU Affero General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU Affero General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.steamwar.bausystem.features.slaves.laufbau.boundingboxes;
|
|
||||||
|
|
||||||
import de.steamwar.bausystem.features.slaves.laufbau.BlockBoundingBox;
|
|
||||||
import de.steamwar.bausystem.features.slaves.laufbau.BoundingBoxLoader;
|
|
||||||
import de.steamwar.bausystem.features.slaves.laufbau.Cuboid;
|
|
||||||
import de.steamwar.linkage.Linked;
|
|
||||||
import de.steamwar.linkage.MinVersion;
|
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.block.data.Lightable;
|
|
||||||
import org.bukkit.block.data.type.Candle;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import static de.steamwar.bausystem.features.slaves.laufbau.LaufbauUtils.createItem;
|
|
||||||
import static de.steamwar.bausystem.features.slaves.laufbau.LaufbauUtils.pixelCuboid;
|
|
||||||
|
|
||||||
@Linked
|
|
||||||
@MinVersion(19)
|
|
||||||
public class CandleBoundingBox implements BoundingBoxLoader {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void load() {
|
|
||||||
caked();
|
|
||||||
|
|
||||||
single();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void caked() {
|
|
||||||
Lightable candleCake = (Lightable) Material.CYAN_CANDLE_CAKE.createBlockData();
|
|
||||||
candleCake.setLit(true);
|
|
||||||
List<Cuboid> cuboidList = new ArrayList<>();
|
|
||||||
cuboidList.add(pixelCuboid(0, 0, 0, 16, 8, 16));
|
|
||||||
cuboidList.add(pixelCuboid(7, 8, 7, 2, 6, 2));
|
|
||||||
new BlockBoundingBox(candleCake, cuboidList, createItem("LAUFBAU_BLOCK_CANDLE_CAKE", Material.CAKE));
|
|
||||||
}
|
|
||||||
|
|
||||||
private void single() {
|
|
||||||
Candle candle = (Candle) Material.CYAN_CANDLE.createBlockData();
|
|
||||||
candle.setCandles(1);
|
|
||||||
List<Cuboid> cuboidList = new ArrayList<>();
|
|
||||||
cuboidList.add(pixelCuboid(7, 0,7, 2, 6, 2));
|
|
||||||
new BlockBoundingBox(candle, cuboidList, createItem("LAUFBAU_BLOCK_CANDLE", Material.CYAN_CANDLE, "LAUFBAU_COUNT_1"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-71
@@ -1,71 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is a part of the SteamWar software.
|
|
||||||
*
|
|
||||||
* Copyright (C) 2025 SteamWar.de-Serverteam
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU Affero General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU Affero General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.steamwar.bausystem.features.slaves.laufbau.boundingboxes;
|
|
||||||
|
|
||||||
import de.steamwar.bausystem.features.slaves.laufbau.BlockBoundingBox;
|
|
||||||
import de.steamwar.bausystem.features.slaves.laufbau.BoundingBoxLoader;
|
|
||||||
import de.steamwar.bausystem.features.slaves.laufbau.Cuboid;
|
|
||||||
import de.steamwar.linkage.Linked;
|
|
||||||
import de.steamwar.linkage.MinVersion;
|
|
||||||
import org.bukkit.Axis;
|
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.block.data.Orientable;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import static de.steamwar.bausystem.features.slaves.laufbau.LaufbauUtils.createItem;
|
|
||||||
import static de.steamwar.bausystem.features.slaves.laufbau.LaufbauUtils.pixelCuboid;
|
|
||||||
|
|
||||||
@Linked
|
|
||||||
@MinVersion(19)
|
|
||||||
public class ChainBoundingBox implements BoundingBoxLoader {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void load() {
|
|
||||||
bottomTopChain();
|
|
||||||
northSouthChain();
|
|
||||||
eastWestChain();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void bottomTopChain() {
|
|
||||||
Orientable chainBottomTop = (Orientable) Material.CHAIN.createBlockData();
|
|
||||||
chainBottomTop.setAxis(Axis.Y);
|
|
||||||
List<Cuboid> cuboidList = new ArrayList<>();
|
|
||||||
cuboidList.add(pixelCuboid(6.5, 0, 6.5, 3, 16, 3));
|
|
||||||
new BlockBoundingBox(chainBottomTop, cuboidList, createItem("LAUFBAU_BLOCK_CHAIN", Material.CHAIN, "LAUFBAU_FACING_UP", "LAUFBAU_FACING_DOWN"));
|
|
||||||
}
|
|
||||||
|
|
||||||
private void northSouthChain() {
|
|
||||||
Orientable chainBottomTop = (Orientable) Material.CHAIN.createBlockData();
|
|
||||||
chainBottomTop.setAxis(Axis.Z);
|
|
||||||
List<Cuboid> cuboidList = new ArrayList<>();
|
|
||||||
cuboidList.add(pixelCuboid(6.5, 6.5, 0, 3, 3, 16));
|
|
||||||
new BlockBoundingBox(chainBottomTop, cuboidList, createItem("LAUFBAU_BLOCK_CHAIN", Material.CHAIN, "LAUFBAU_FACING_NORTH", "LAUFBAU_FACING_SOUTH"));
|
|
||||||
}
|
|
||||||
|
|
||||||
private void eastWestChain() {
|
|
||||||
Orientable chainBottomTop = (Orientable) Material.CHAIN.createBlockData();
|
|
||||||
chainBottomTop.setAxis(Axis.X);
|
|
||||||
List<Cuboid> cuboidList = new ArrayList<>();
|
|
||||||
cuboidList.add(pixelCuboid(0, 6.5, 6.5, 16, 3, 3));
|
|
||||||
new BlockBoundingBox(chainBottomTop, cuboidList, createItem("LAUFBAU_BLOCK_CHAIN", Material.CHAIN, "LAUFBAU_FACING_EAST", "LAUFBAU_FACING_WEST"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-89
@@ -1,89 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is a part of the SteamWar software.
|
|
||||||
*
|
|
||||||
* Copyright (C) 2025 SteamWar.de-Serverteam
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU Affero General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU Affero General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.steamwar.bausystem.features.slaves.laufbau.boundingboxes;
|
|
||||||
|
|
||||||
import de.steamwar.bausystem.features.slaves.laufbau.BlockBoundingBox;
|
|
||||||
import de.steamwar.bausystem.features.slaves.laufbau.BoundingBoxLoader;
|
|
||||||
import de.steamwar.bausystem.features.slaves.laufbau.Cuboid;
|
|
||||||
import de.steamwar.linkage.Linked;
|
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.block.BlockFace;
|
|
||||||
import org.bukkit.block.data.MultipleFacing;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import static de.steamwar.bausystem.features.slaves.laufbau.LaufbauUtils.createItem;
|
|
||||||
import static de.steamwar.bausystem.features.slaves.laufbau.LaufbauUtils.pixelCuboid;
|
|
||||||
|
|
||||||
@Linked
|
|
||||||
public class ChorusPlantBoundingBox implements BoundingBoxLoader {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void load() {
|
|
||||||
for (int nx = 0; nx < 2; nx++) {
|
|
||||||
for (int ny = 0; ny < 2; ny++) {
|
|
||||||
for (int nz = 0; nz < 2; nz++) {
|
|
||||||
for (int px = 0; px < 2; px++) {
|
|
||||||
for (int py = 0; py < 2; py++) {
|
|
||||||
for (int pz = 0; pz < 2; pz++) {
|
|
||||||
MultipleFacing chorusPlant = (MultipleFacing) Material.CHORUS_PLANT.createBlockData();
|
|
||||||
List<String> lore = new ArrayList<>();
|
|
||||||
List<Cuboid> cuboidList = new ArrayList<>();
|
|
||||||
cuboidList.add(pixelCuboid(3, 3, 3, 10, 10, 10));
|
|
||||||
if (nx == 1) {
|
|
||||||
lore.add("LAUFBAU_CONNECTION_WEST");
|
|
||||||
chorusPlant.setFace(BlockFace.WEST, true);
|
|
||||||
cuboidList.add(pixelCuboid(0, 3, 3, 3, 10, 10));
|
|
||||||
}
|
|
||||||
if (ny == 1) {
|
|
||||||
lore.add("LAUFBAU_CONNECTION_DOWN");
|
|
||||||
chorusPlant.setFace(BlockFace.DOWN, true);
|
|
||||||
cuboidList.add(pixelCuboid(3, 0, 3, 10, 3, 10));
|
|
||||||
}
|
|
||||||
if (nz == 1) {
|
|
||||||
lore.add("LAUFBAU_CONNECTION_NORTH");
|
|
||||||
chorusPlant.setFace(BlockFace.NORTH, true);
|
|
||||||
cuboidList.add(pixelCuboid(3, 3, 0, 10, 10, 3));
|
|
||||||
}
|
|
||||||
if (px == 1) {
|
|
||||||
lore.add("LAUFBAU_CONNECTION_EAST");
|
|
||||||
chorusPlant.setFace(BlockFace.EAST, true);
|
|
||||||
cuboidList.add(pixelCuboid(13, 3, 3, 3, 10, 10));
|
|
||||||
}
|
|
||||||
if (py == 1) {
|
|
||||||
lore.add("LAUFBAU_CONNECTION_UP");
|
|
||||||
chorusPlant.setFace(BlockFace.UP, true);
|
|
||||||
cuboidList.add(pixelCuboid(3, 13, 3, 10, 3, 10));
|
|
||||||
}
|
|
||||||
if (pz == 1) {
|
|
||||||
lore.add("LAUFBAU_CONNECTION_SOUTH");
|
|
||||||
chorusPlant.setFace(BlockFace.SOUTH, true);
|
|
||||||
cuboidList.add(pixelCuboid(3, 3, 13, 10, 10, 3));
|
|
||||||
}
|
|
||||||
new BlockBoundingBox(chorusPlant, cuboidList, createItem("LAUFBAU_BLOCK_CHORUS_PLANT", Material.CHORUS_PLANT, lore.toArray(new String[0])));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-47
@@ -1,47 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is a part of the SteamWar software.
|
|
||||||
*
|
|
||||||
* Copyright (C) 2025 SteamWar.de-Serverteam
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU Affero General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU Affero General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.steamwar.bausystem.features.slaves.laufbau.boundingboxes;
|
|
||||||
|
|
||||||
import de.steamwar.bausystem.features.slaves.laufbau.BlockBoundingBox;
|
|
||||||
import de.steamwar.bausystem.features.slaves.laufbau.BoundingBoxLoader;
|
|
||||||
import de.steamwar.bausystem.features.slaves.laufbau.Cuboid;
|
|
||||||
import de.steamwar.linkage.Linked;
|
|
||||||
import de.steamwar.linkage.MinVersion;
|
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.block.data.BlockData;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import static de.steamwar.bausystem.features.slaves.laufbau.LaufbauUtils.createItem;
|
|
||||||
import static de.steamwar.bausystem.features.slaves.laufbau.LaufbauUtils.pixelCuboid;
|
|
||||||
|
|
||||||
@Linked
|
|
||||||
@MinVersion(19)
|
|
||||||
public class DragonEggBoundingBox implements BoundingBoxLoader {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void load() {
|
|
||||||
BlockData blockData = Material.DRAGON_EGG.createBlockData();
|
|
||||||
List<Cuboid> cuboidList = new ArrayList<>();
|
|
||||||
cuboidList.add(pixelCuboid(1, 0, 1, 14, 16, 14));
|
|
||||||
new BlockBoundingBox(blockData, cuboidList, createItem("LAUFBAU_BLOCK_DRAGON_EGG", Material.DRAGON_EGG));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-61
@@ -1,61 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is a part of the SteamWar software.
|
|
||||||
*
|
|
||||||
* Copyright (C) 2025 SteamWar.de-Serverteam
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU Affero General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU Affero General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.steamwar.bausystem.features.slaves.laufbau.boundingboxes;
|
|
||||||
|
|
||||||
import de.steamwar.bausystem.features.slaves.laufbau.BlockBoundingBox;
|
|
||||||
import de.steamwar.bausystem.features.slaves.laufbau.BoundingBoxLoader;
|
|
||||||
import de.steamwar.bausystem.features.slaves.laufbau.Cuboid;
|
|
||||||
import de.steamwar.linkage.Linked;
|
|
||||||
import de.steamwar.linkage.MinVersion;
|
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.block.data.type.BigDripleaf;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import static de.steamwar.bausystem.features.slaves.laufbau.LaufbauUtils.createItem;
|
|
||||||
import static de.steamwar.bausystem.features.slaves.laufbau.LaufbauUtils.pixelCuboid;
|
|
||||||
|
|
||||||
@Linked
|
|
||||||
@MinVersion(19)
|
|
||||||
public class DripLeafBoundingBox implements BoundingBoxLoader {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void load() {
|
|
||||||
tiltNone();
|
|
||||||
tiltPartial();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void tiltNone() {
|
|
||||||
BigDripleaf bigDripleaf = (BigDripleaf) Material.BIG_DRIPLEAF.createBlockData();
|
|
||||||
bigDripleaf.setTilt(BigDripleaf.Tilt.NONE);
|
|
||||||
List<Cuboid> cuboidList = new ArrayList<>();
|
|
||||||
cuboidList.add(pixelCuboid(0, 11, 0, 16, 4, 16));
|
|
||||||
new BlockBoundingBox(bigDripleaf, cuboidList, createItem("LAUFBAU_BLOCK_BIG_DRIP_LEAF", Material.BIG_DRIPLEAF, "LAUFBAU_TILT_NONE"));
|
|
||||||
}
|
|
||||||
|
|
||||||
private void tiltPartial() {
|
|
||||||
BigDripleaf bigDripleaf = (BigDripleaf) Material.BIG_DRIPLEAF.createBlockData();
|
|
||||||
bigDripleaf.setTilt(BigDripleaf.Tilt.PARTIAL);
|
|
||||||
List<Cuboid> cuboidList = new ArrayList<>();
|
|
||||||
cuboidList.add(pixelCuboid(0, 11, 0, 16, 2, 16));
|
|
||||||
new BlockBoundingBox(bigDripleaf, cuboidList, createItem("LAUFBAU_BLOCK_BIG_DRIP_LEAF", Material.BIG_DRIPLEAF, "LAUFBAU_TILT_PARTIAL"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-75
@@ -1,75 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is a part of the SteamWar software.
|
|
||||||
*
|
|
||||||
* Copyright (C) 2025 SteamWar.de-Serverteam
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU Affero General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU Affero General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.steamwar.bausystem.features.slaves.laufbau.boundingboxes;
|
|
||||||
|
|
||||||
import de.steamwar.bausystem.features.slaves.laufbau.BlockBoundingBox;
|
|
||||||
import de.steamwar.bausystem.features.slaves.laufbau.BoundingBoxLoader;
|
|
||||||
import de.steamwar.bausystem.features.slaves.laufbau.Cuboid;
|
|
||||||
import de.steamwar.linkage.Linked;
|
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.block.BlockFace;
|
|
||||||
import org.bukkit.block.data.type.Fence;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import static de.steamwar.bausystem.features.slaves.laufbau.LaufbauUtils.createItem;
|
|
||||||
import static de.steamwar.bausystem.features.slaves.laufbau.LaufbauUtils.pixelCuboid;
|
|
||||||
|
|
||||||
@Linked
|
|
||||||
public class FencesBoundingBox implements BoundingBoxLoader {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void load() {
|
|
||||||
for (int nx = 0; nx < 2; nx++) {
|
|
||||||
for (int nz = 0; nz < 2; nz++) {
|
|
||||||
for (int px = 0; px < 2; px++) {
|
|
||||||
for (int pz = 0; pz < 2; pz++) {
|
|
||||||
Fence fence = (Fence) Material.NETHER_BRICK_FENCE.createBlockData();
|
|
||||||
List<String> lore = new ArrayList<>();
|
|
||||||
List<Cuboid> cuboidList = new ArrayList<>();
|
|
||||||
cuboidList.add(pixelCuboid(6, 0, 6, 4, 24, 4));
|
|
||||||
if (nz == 1) {
|
|
||||||
lore.add("LAUFBAU_CONNECTION_NORTH");
|
|
||||||
fence.setFace(BlockFace.NORTH, true);
|
|
||||||
cuboidList.add(pixelCuboid(6, 0, 0, 4, 24, 6));
|
|
||||||
}
|
|
||||||
if (pz == 1) {
|
|
||||||
lore.add("LAUFBAU_CONNECTION_SOUTH");
|
|
||||||
fence.setFace(BlockFace.SOUTH, true);
|
|
||||||
cuboidList.add(pixelCuboid(6, 0, 10, 4, 24, 6));
|
|
||||||
}
|
|
||||||
if (nx == 1) {
|
|
||||||
lore.add("LAUFBAU_CONNECTION_WEST");
|
|
||||||
fence.setFace(BlockFace.WEST, true);
|
|
||||||
cuboidList.add(pixelCuboid(0, 0, 6, 6, 24, 4));
|
|
||||||
}
|
|
||||||
if (px == 1) {
|
|
||||||
lore.add("LAUFBAU_CONNECTION_EAST");
|
|
||||||
fence.setFace(BlockFace.EAST, true);
|
|
||||||
cuboidList.add(pixelCuboid(10, 0, 6, 6, 24, 4));
|
|
||||||
}
|
|
||||||
new BlockBoundingBox(fence, cuboidList, createItem("LAUFBAU_BLOCK_NETHER_BRICK_FENCE", Material.NETHER_BRICK_FENCE, lore.toArray(new String[0])));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-157
@@ -1,157 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is a part of the SteamWar software.
|
|
||||||
*
|
|
||||||
* Copyright (C) 2025 SteamWar.de-Serverteam
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU Affero General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU Affero General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.steamwar.bausystem.features.slaves.laufbau.boundingboxes;
|
|
||||||
|
|
||||||
import de.steamwar.bausystem.features.slaves.laufbau.BlockBoundingBox;
|
|
||||||
import de.steamwar.bausystem.features.slaves.laufbau.BoundingBoxLoader;
|
|
||||||
import de.steamwar.bausystem.features.slaves.laufbau.Cuboid;
|
|
||||||
import de.steamwar.linkage.Linked;
|
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.block.BlockFace;
|
|
||||||
import org.bukkit.block.data.FaceAttachable;
|
|
||||||
import org.bukkit.block.data.type.Grindstone;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import static de.steamwar.bausystem.features.slaves.laufbau.LaufbauUtils.createItem;
|
|
||||||
import static de.steamwar.bausystem.features.slaves.laufbau.LaufbauUtils.pixelCuboid;
|
|
||||||
|
|
||||||
@Linked
|
|
||||||
public class GrindstoneBoundingBox implements BoundingBoxLoader {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void load() {
|
|
||||||
floorNorthGrindstone();
|
|
||||||
floorEastGrindstone();
|
|
||||||
|
|
||||||
ceilingNorthGrindstone();
|
|
||||||
ceilingEastGrindstone();
|
|
||||||
|
|
||||||
wallNorthGrindstone();
|
|
||||||
wallSouthGrindstone();
|
|
||||||
wallEastGrindstone();
|
|
||||||
wallWestGrindstone();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void floorNorthGrindstone() {
|
|
||||||
Grindstone grindstone = (Grindstone) Material.GRINDSTONE.createBlockData();
|
|
||||||
grindstone.setAttachedFace(FaceAttachable.AttachedFace.FLOOR);
|
|
||||||
grindstone.setFacing(BlockFace.NORTH);
|
|
||||||
List<Cuboid> cuboidList = new ArrayList<>();
|
|
||||||
cuboidList.add(pixelCuboid(4, 4, 2, 8, 12, 12));
|
|
||||||
cuboidList.add(pixelCuboid(2, 0, 6, 2, 7, 4));
|
|
||||||
cuboidList.add(pixelCuboid(12, 0, 6, 2, 7, 4));
|
|
||||||
cuboidList.add(pixelCuboid(2, 7, 5, 2, 6, 6));
|
|
||||||
cuboidList.add(pixelCuboid(12, 7, 5, 2, 6, 6));
|
|
||||||
new BlockBoundingBox(grindstone, cuboidList, createItem("LAUFBAU_BLOCK_GRINDSTONE", Material.GRINDSTONE, "LAUFBAU_ATTACHMENT_FLOOR", "LAUFBAU_FACING_NORTH", "LAUFBAU_FACING_SOUTH"));
|
|
||||||
}
|
|
||||||
|
|
||||||
public void floorEastGrindstone() {
|
|
||||||
Grindstone grindstone = (Grindstone) Material.GRINDSTONE.createBlockData();
|
|
||||||
grindstone.setAttachedFace(FaceAttachable.AttachedFace.FLOOR);
|
|
||||||
grindstone.setFacing(BlockFace.EAST);
|
|
||||||
List<Cuboid> cuboidList = new ArrayList<>();
|
|
||||||
cuboidList.add(pixelCuboid(2, 4, 4, 12, 12, 8));
|
|
||||||
cuboidList.add(pixelCuboid(6, 0, 2, 4, 7, 2));
|
|
||||||
cuboidList.add(pixelCuboid(6, 0, 12, 4, 7, 2));
|
|
||||||
cuboidList.add(pixelCuboid(5, 7, 2, 6, 6, 2));
|
|
||||||
cuboidList.add(pixelCuboid(5, 7, 12, 6, 6, 2));
|
|
||||||
new BlockBoundingBox(grindstone, cuboidList, createItem("LAUFBAU_BLOCK_GRINDSTONE", Material.GRINDSTONE, "LAUFBAU_ATTACHMENT_FLOOR", "LAUFBAU_FACING_EAST", "LAUFBAU_FACING_WEST"));
|
|
||||||
}
|
|
||||||
|
|
||||||
public void ceilingNorthGrindstone() {
|
|
||||||
Grindstone grindstone = (Grindstone) Material.GRINDSTONE.createBlockData();
|
|
||||||
grindstone.setAttachedFace(FaceAttachable.AttachedFace.CEILING);
|
|
||||||
grindstone.setFacing(BlockFace.NORTH);
|
|
||||||
List<Cuboid> cuboidList = new ArrayList<>();
|
|
||||||
cuboidList.add(pixelCuboid(4, 0, 2, 8, 12, 12));
|
|
||||||
cuboidList.add(pixelCuboid(2, 9, 6, 2, 7, 4));
|
|
||||||
cuboidList.add(pixelCuboid(12, 9, 6, 2, 7, 4));
|
|
||||||
cuboidList.add(pixelCuboid(2, 3, 5, 2, 6, 6));
|
|
||||||
cuboidList.add(pixelCuboid(12, 3, 5, 2, 6, 6));
|
|
||||||
new BlockBoundingBox(grindstone, cuboidList, createItem("LAUFBAU_BLOCK_GRINDSTONE", Material.GRINDSTONE, "LAUFBAU_ATTACHMENT_CEILING", "LAUFBAU_FACING_NORTH", "LAUFBAU_FACING_SOUTH"));
|
|
||||||
}
|
|
||||||
|
|
||||||
public void ceilingEastGrindstone() {
|
|
||||||
Grindstone grindstone = (Grindstone) Material.GRINDSTONE.createBlockData();
|
|
||||||
grindstone.setAttachedFace(FaceAttachable.AttachedFace.CEILING);
|
|
||||||
grindstone.setFacing(BlockFace.EAST);
|
|
||||||
List<Cuboid> cuboidList = new ArrayList<>();
|
|
||||||
cuboidList.add(pixelCuboid(2, 0, 4, 12, 12, 8));
|
|
||||||
cuboidList.add(pixelCuboid(6, 9, 2, 4, 7, 2));
|
|
||||||
cuboidList.add(pixelCuboid(6, 9, 12, 4, 7, 2));
|
|
||||||
cuboidList.add(pixelCuboid(5, 3, 2, 6, 6, 2));
|
|
||||||
cuboidList.add(pixelCuboid(5, 3, 12, 6, 6, 2));
|
|
||||||
new BlockBoundingBox(grindstone, cuboidList, createItem("LAUFBAU_BLOCK_GRINDSTONE", Material.GRINDSTONE, "LAUFBAU_ATTACHMENT_CEILING", "LAUFBAU_FACING_EAST", "LAUFBAU_FACING_WEST"));
|
|
||||||
}
|
|
||||||
|
|
||||||
public void wallNorthGrindstone() {
|
|
||||||
Grindstone grindstone = (Grindstone) Material.GRINDSTONE.createBlockData();
|
|
||||||
grindstone.setAttachedFace(FaceAttachable.AttachedFace.WALL);
|
|
||||||
grindstone.setFacing(BlockFace.NORTH);
|
|
||||||
List<Cuboid> cuboidList = new ArrayList<>();
|
|
||||||
cuboidList.add(pixelCuboid(4, 2, 0, 8, 12, 12));
|
|
||||||
cuboidList.add(pixelCuboid(2, 6, 9, 2, 4, 7));
|
|
||||||
cuboidList.add(pixelCuboid(12, 6, 9, 2, 4, 7));
|
|
||||||
cuboidList.add(pixelCuboid(2, 5, 3, 2, 6, 6));
|
|
||||||
cuboidList.add(pixelCuboid(12, 5, 3, 2, 6, 6));
|
|
||||||
new BlockBoundingBox(grindstone, cuboidList, createItem("LAUFBAU_BLOCK_GRINDSTONE", Material.GRINDSTONE, "LAUFBAU_ATTACHMENT_WALL", "LAUFBAU_FACING_NORTH"));
|
|
||||||
}
|
|
||||||
|
|
||||||
public void wallSouthGrindstone() {
|
|
||||||
Grindstone grindstone = (Grindstone) Material.GRINDSTONE.createBlockData();
|
|
||||||
grindstone.setAttachedFace(FaceAttachable.AttachedFace.WALL);
|
|
||||||
grindstone.setFacing(BlockFace.SOUTH);
|
|
||||||
List<Cuboid> cuboidList = new ArrayList<>();
|
|
||||||
cuboidList.add(pixelCuboid(4, 2, 4, 8, 12, 12));
|
|
||||||
cuboidList.add(pixelCuboid(2, 6, 0, 2, 4, 7));
|
|
||||||
cuboidList.add(pixelCuboid(12, 6, 0, 2, 4, 7));
|
|
||||||
cuboidList.add(pixelCuboid(2, 5, 7, 2, 6, 6));
|
|
||||||
cuboidList.add(pixelCuboid(12, 5, 7, 2, 6, 6));
|
|
||||||
new BlockBoundingBox(grindstone, cuboidList, createItem("LAUFBAU_BLOCK_GRINDSTONE", Material.GRINDSTONE, "LAUFBAU_ATTACHMENT_WALL", "LAUFBAU_FACING_SOUTH"));
|
|
||||||
}
|
|
||||||
|
|
||||||
public void wallEastGrindstone() {
|
|
||||||
Grindstone grindstone = (Grindstone) Material.GRINDSTONE.createBlockData();
|
|
||||||
grindstone.setAttachedFace(FaceAttachable.AttachedFace.WALL);
|
|
||||||
grindstone.setFacing(BlockFace.EAST);
|
|
||||||
List<Cuboid> cuboidList = new ArrayList<>();
|
|
||||||
cuboidList.add(pixelCuboid(4, 2, 4, 12, 12, 8));
|
|
||||||
cuboidList.add(pixelCuboid(0, 6, 2, 7, 4, 2));
|
|
||||||
cuboidList.add(pixelCuboid(0, 6, 12, 7, 4, 2));
|
|
||||||
cuboidList.add(pixelCuboid(7, 5, 2, 6, 6, 2));
|
|
||||||
cuboidList.add(pixelCuboid(7, 5, 12, 6, 6, 2));
|
|
||||||
new BlockBoundingBox(grindstone, cuboidList, createItem("LAUFBAU_BLOCK_GRINDSTONE", Material.GRINDSTONE, "LAUFBAU_ATTACHMENT_WALL", "LAUFBAU_FACING_EAST"));
|
|
||||||
}
|
|
||||||
|
|
||||||
public void wallWestGrindstone() {
|
|
||||||
Grindstone grindstone = (Grindstone) Material.GRINDSTONE.createBlockData();
|
|
||||||
grindstone.setAttachedFace(FaceAttachable.AttachedFace.WALL);
|
|
||||||
grindstone.setFacing(BlockFace.WEST);
|
|
||||||
List<Cuboid> cuboidList = new ArrayList<>();
|
|
||||||
cuboidList.add(pixelCuboid(0, 2, 4, 12, 12, 8));
|
|
||||||
cuboidList.add(pixelCuboid(9, 6, 2, 7, 4, 2));
|
|
||||||
cuboidList.add(pixelCuboid(9, 6, 12, 7, 4, 2));
|
|
||||||
cuboidList.add(pixelCuboid(3, 5, 2, 6, 6, 2));
|
|
||||||
cuboidList.add(pixelCuboid(3, 5, 12, 6, 6, 2));
|
|
||||||
new BlockBoundingBox(grindstone, cuboidList, createItem("LAUFBAU_BLOCK_GRINDSTONE", Material.GRINDSTONE, "LAUFBAU_ATTACHMENT_WALL", "LAUFBAU_FACING_WEST"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-97
@@ -1,97 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is a part of the SteamWar software.
|
|
||||||
*
|
|
||||||
* Copyright (C) 2025 SteamWar.de-Serverteam
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU Affero General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU Affero General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.steamwar.bausystem.features.slaves.laufbau.boundingboxes;
|
|
||||||
|
|
||||||
import de.steamwar.bausystem.features.slaves.laufbau.BlockBoundingBox;
|
|
||||||
import de.steamwar.bausystem.features.slaves.laufbau.BoundingBoxLoader;
|
|
||||||
import de.steamwar.bausystem.features.slaves.laufbau.Cuboid;
|
|
||||||
import de.steamwar.linkage.Linked;
|
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.block.BlockFace;
|
|
||||||
import org.bukkit.block.data.type.Hopper;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import static de.steamwar.bausystem.features.slaves.laufbau.LaufbauUtils.createItem;
|
|
||||||
import static de.steamwar.bausystem.features.slaves.laufbau.LaufbauUtils.pixelCuboid;
|
|
||||||
|
|
||||||
@Linked
|
|
||||||
public class HopperBoundingBox implements BoundingBoxLoader {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void load() {
|
|
||||||
downHopper();
|
|
||||||
northHopper();
|
|
||||||
southHopper();
|
|
||||||
eastHopper();
|
|
||||||
westHopper();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void downHopper() {
|
|
||||||
Hopper hopper = (Hopper) Material.HOPPER.createBlockData();
|
|
||||||
hopper.setFacing(BlockFace.DOWN);
|
|
||||||
List<Cuboid> cuboidList = new ArrayList<>();
|
|
||||||
cuboidList.add(pixelCuboid(0, 10, 0, 16, 6, 16));
|
|
||||||
cuboidList.add(pixelCuboid(4, 4, 4, 8, 6, 8));
|
|
||||||
cuboidList.add(pixelCuboid(6, 0, 6, 4, 4, 4));
|
|
||||||
new BlockBoundingBox(hopper, cuboidList, createItem("LAUFBAU_BLOCK_HOPPER", Material.HOPPER, "LAUFBAU_CONNECTION_FLOOR"));
|
|
||||||
}
|
|
||||||
|
|
||||||
public void northHopper() {
|
|
||||||
Hopper hopper = (Hopper) Material.HOPPER.createBlockData();
|
|
||||||
hopper.setFacing(BlockFace.NORTH);
|
|
||||||
List<Cuboid> cuboidList = new ArrayList<>();
|
|
||||||
cuboidList.add(pixelCuboid(0, 10, 0, 16, 6, 16));
|
|
||||||
cuboidList.add(pixelCuboid(4, 4, 4, 8, 6, 8));
|
|
||||||
cuboidList.add(pixelCuboid(6, 4, 0, 4, 4, 4));
|
|
||||||
new BlockBoundingBox(hopper, cuboidList, createItem("LAUFBAU_BLOCK_HOPPER", Material.HOPPER, "LAUFBAU_CONNECTION_NORTH"));
|
|
||||||
}
|
|
||||||
|
|
||||||
public void southHopper() {
|
|
||||||
Hopper hopper = (Hopper) Material.HOPPER.createBlockData();
|
|
||||||
hopper.setFacing(BlockFace.SOUTH);
|
|
||||||
List<Cuboid> cuboidList = new ArrayList<>();
|
|
||||||
cuboidList.add(pixelCuboid(0, 10, 0, 16, 6, 16));
|
|
||||||
cuboidList.add(pixelCuboid(4, 4, 4, 8, 6, 8));
|
|
||||||
cuboidList.add(pixelCuboid(6, 4, 12, 4, 4, 4));
|
|
||||||
new BlockBoundingBox(hopper, cuboidList, createItem("LAUFBAU_BLOCK_HOPPER", Material.HOPPER, "LAUFBAU_CONNECTION_SOUTH"));
|
|
||||||
}
|
|
||||||
|
|
||||||
public void eastHopper() {
|
|
||||||
Hopper hopper = (Hopper) Material.HOPPER.createBlockData();
|
|
||||||
hopper.setFacing(BlockFace.EAST);
|
|
||||||
List<Cuboid> cuboidList = new ArrayList<>();
|
|
||||||
cuboidList.add(pixelCuboid(0, 10, 0, 16, 6, 16));
|
|
||||||
cuboidList.add(pixelCuboid(4, 4, 4, 8, 6, 8));
|
|
||||||
cuboidList.add(pixelCuboid(12, 4, 6, 4, 4, 4));
|
|
||||||
new BlockBoundingBox(hopper, cuboidList, createItem("LAUFBAU_BLOCK_HOPPER", Material.HOPPER, "LAUFBAU_CONNECTION_EAST"));
|
|
||||||
}
|
|
||||||
|
|
||||||
public void westHopper() {
|
|
||||||
Hopper hopper = (Hopper) Material.HOPPER.createBlockData();
|
|
||||||
hopper.setFacing(BlockFace.WEST);
|
|
||||||
List<Cuboid> cuboidList = new ArrayList<>();
|
|
||||||
cuboidList.add(pixelCuboid(0, 10, 0, 16, 6, 16));
|
|
||||||
cuboidList.add(pixelCuboid(4, 4, 4, 8, 6, 8));
|
|
||||||
cuboidList.add(pixelCuboid(0, 4, 6, 4, 4, 4));
|
|
||||||
new BlockBoundingBox(hopper, cuboidList, createItem("LAUFBAU_BLOCK_HOPPER", Material.HOPPER, "LAUFBAU_CONNECTION_WEST"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-75
@@ -1,75 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is a part of the SteamWar software.
|
|
||||||
*
|
|
||||||
* Copyright (C) 2025 SteamWar.de-Serverteam
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU Affero General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU Affero General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.steamwar.bausystem.features.slaves.laufbau.boundingboxes;
|
|
||||||
|
|
||||||
import de.steamwar.bausystem.features.slaves.laufbau.BlockBoundingBox;
|
|
||||||
import de.steamwar.bausystem.features.slaves.laufbau.BoundingBoxLoader;
|
|
||||||
import de.steamwar.bausystem.features.slaves.laufbau.Cuboid;
|
|
||||||
import de.steamwar.linkage.Linked;
|
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.block.BlockFace;
|
|
||||||
import org.bukkit.block.data.type.Fence;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import static de.steamwar.bausystem.features.slaves.laufbau.LaufbauUtils.createItem;
|
|
||||||
import static de.steamwar.bausystem.features.slaves.laufbau.LaufbauUtils.pixelCuboid;
|
|
||||||
|
|
||||||
@Linked
|
|
||||||
public class IronBarBoundingBox implements BoundingBoxLoader {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void load() {
|
|
||||||
for (int nx = 0; nx < 2; nx++) {
|
|
||||||
for (int nz = 0; nz < 2; nz++) {
|
|
||||||
for (int px = 0; px < 2; px++) {
|
|
||||||
for (int pz = 0; pz < 2; pz++) {
|
|
||||||
Fence fence = (Fence) Material.IRON_BARS.createBlockData();
|
|
||||||
List<String> lore = new ArrayList<>();
|
|
||||||
List<Cuboid> cuboidList = new ArrayList<>();
|
|
||||||
cuboidList.add(pixelCuboid(7, 0, 7, 2, 16, 2));
|
|
||||||
if (nz == 1) {
|
|
||||||
lore.add("LAUFBAU_CONNECTION_NORTH");
|
|
||||||
fence.setFace(BlockFace.NORTH, true);
|
|
||||||
cuboidList.add(pixelCuboid(7, 0, 0, 2, 16, 7));
|
|
||||||
}
|
|
||||||
if (pz == 1) {
|
|
||||||
lore.add("LAUFBAU_CONNECTION_SOUTH");
|
|
||||||
fence.setFace(BlockFace.SOUTH, true);
|
|
||||||
cuboidList.add(pixelCuboid(7, 0, 9, 2, 16, 7));
|
|
||||||
}
|
|
||||||
if (nx == 1) {
|
|
||||||
lore.add("LAUFBAU_CONNECTION_WEST");
|
|
||||||
fence.setFace(BlockFace.WEST, true);
|
|
||||||
cuboidList.add(pixelCuboid(0, 0, 7, 7, 16, 2));
|
|
||||||
}
|
|
||||||
if (px == 1) {
|
|
||||||
lore.add("LAUFBAU_CONNECTION_EAST");
|
|
||||||
fence.setFace(BlockFace.EAST, true);
|
|
||||||
cuboidList.add(pixelCuboid(9, 0, 7, 7, 16, 2));
|
|
||||||
}
|
|
||||||
new BlockBoundingBox(fence, cuboidList, createItem("LAUFBAU_BLOCK_IRON_BARS", Material.IRON_BARS, lore.toArray(new String[0])));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-61
@@ -1,61 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is a part of the SteamWar software.
|
|
||||||
*
|
|
||||||
* Copyright (C) 2025 SteamWar.de-Serverteam
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU Affero General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU Affero General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.steamwar.bausystem.features.slaves.laufbau.boundingboxes;
|
|
||||||
|
|
||||||
import de.steamwar.bausystem.features.slaves.laufbau.BlockBoundingBox;
|
|
||||||
import de.steamwar.bausystem.features.slaves.laufbau.BoundingBoxLoader;
|
|
||||||
import de.steamwar.bausystem.features.slaves.laufbau.Cuboid;
|
|
||||||
import de.steamwar.linkage.Linked;
|
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.block.data.type.Lantern;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import static de.steamwar.bausystem.features.slaves.laufbau.LaufbauUtils.createItem;
|
|
||||||
import static de.steamwar.bausystem.features.slaves.laufbau.LaufbauUtils.pixelCuboid;
|
|
||||||
|
|
||||||
@Linked
|
|
||||||
public class LanternBoundingBox implements BoundingBoxLoader {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void load() {
|
|
||||||
lantern();
|
|
||||||
hangingLantern();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void lantern() {
|
|
||||||
Lantern lantern = (Lantern) Material.LANTERN.createBlockData();
|
|
||||||
lantern.setHanging(false);
|
|
||||||
List<Cuboid> cuboidList = new ArrayList<>();
|
|
||||||
cuboidList.add(pixelCuboid(5, 0, 5, 6, 7, 6));
|
|
||||||
cuboidList.add(pixelCuboid(6, 7, 6, 4, 2, 4));
|
|
||||||
new BlockBoundingBox(lantern, cuboidList, createItem("LAUFBAU_BLOCK_LANTERN", Material.LANTERN));
|
|
||||||
}
|
|
||||||
|
|
||||||
public void hangingLantern() {
|
|
||||||
Lantern lantern = (Lantern) Material.LANTERN.createBlockData();
|
|
||||||
lantern.setHanging(true);
|
|
||||||
List<Cuboid> cuboidList = new ArrayList<>();
|
|
||||||
cuboidList.add(pixelCuboid(5, 1, 5, 6, 7, 6));
|
|
||||||
cuboidList.add(pixelCuboid(6, 8, 6, 4, 2, 4));
|
|
||||||
new BlockBoundingBox(lantern, cuboidList, createItem("LAUFBAU_BLOCK_LANTERN", Material.LANTERN, "LAUFBAU_HANGING"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-46
@@ -1,46 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is a part of the SteamWar software.
|
|
||||||
*
|
|
||||||
* Copyright (C) 2025 SteamWar.de-Serverteam
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU Affero General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU Affero General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.steamwar.bausystem.features.slaves.laufbau.boundingboxes;
|
|
||||||
|
|
||||||
import de.steamwar.bausystem.features.slaves.laufbau.BlockBoundingBox;
|
|
||||||
import de.steamwar.bausystem.features.slaves.laufbau.BoundingBoxLoader;
|
|
||||||
import de.steamwar.bausystem.features.slaves.laufbau.Cuboid;
|
|
||||||
import de.steamwar.linkage.Linked;
|
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.block.data.BlockData;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import static de.steamwar.bausystem.features.slaves.laufbau.LaufbauUtils.createItem;
|
|
||||||
import static de.steamwar.bausystem.features.slaves.laufbau.LaufbauUtils.pixelCuboid;
|
|
||||||
|
|
||||||
@Linked
|
|
||||||
public class LecternBoundingBox implements BoundingBoxLoader {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void load() {
|
|
||||||
BlockData blockData = Material.LECTERN.createBlockData();
|
|
||||||
List<Cuboid> cuboidList = new ArrayList<>();
|
|
||||||
cuboidList.add(pixelCuboid(0, 0, 0, 16, 2, 16));
|
|
||||||
cuboidList.add(pixelCuboid(4, 2, 4, 8, 12, 8));
|
|
||||||
new BlockBoundingBox(blockData, cuboidList, createItem("LAUFBAU_BLOCK_LECTERN", Material.LECTERN));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-343
@@ -1,343 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is a part of the SteamWar software.
|
|
||||||
*
|
|
||||||
* Copyright (C) 2025 SteamWar.de-Serverteam
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU Affero General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU Affero General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.steamwar.bausystem.features.slaves.laufbau.boundingboxes;
|
|
||||||
|
|
||||||
import de.steamwar.bausystem.features.slaves.laufbau.BlockBoundingBox;
|
|
||||||
import de.steamwar.bausystem.features.slaves.laufbau.BoundingBoxLoader;
|
|
||||||
import de.steamwar.bausystem.features.slaves.laufbau.Cuboid;
|
|
||||||
import de.steamwar.linkage.Linked;
|
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.block.BlockFace;
|
|
||||||
import org.bukkit.block.data.type.Stairs;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import static de.steamwar.bausystem.features.slaves.laufbau.LaufbauUtils.createItem;
|
|
||||||
import static de.steamwar.bausystem.features.slaves.laufbau.LaufbauUtils.pixelCuboid;
|
|
||||||
|
|
||||||
@Linked
|
|
||||||
public class StairBoundingBox implements BoundingBoxLoader {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void load() {
|
|
||||||
straightBottomNorthStair();
|
|
||||||
straightBottomSouthStair();
|
|
||||||
straightBottomEastStair();
|
|
||||||
straightBottomWestStair();
|
|
||||||
|
|
||||||
straightTopNorthStair();
|
|
||||||
straightTopSouthStair();
|
|
||||||
straightTopEastStair();
|
|
||||||
straightTopWestStair();
|
|
||||||
|
|
||||||
outerLeftBottomNorthStair();
|
|
||||||
outerLeftBottomSouthStair();
|
|
||||||
outerLeftBottomEastStair();
|
|
||||||
outerLeftBottomWestStair();
|
|
||||||
|
|
||||||
outerLeftTopNorthStair();
|
|
||||||
outerLeftTopSouthStair();
|
|
||||||
outerLeftTopEastStair();
|
|
||||||
outerLeftTopWestStair();
|
|
||||||
|
|
||||||
innerLeftBottomNorthStair();
|
|
||||||
innerLeftBottomSouthStair();
|
|
||||||
innerLeftBottomEastStair();
|
|
||||||
innerLeftBottomWestStair();
|
|
||||||
|
|
||||||
innerLeftTopNorthStair();
|
|
||||||
innerLeftTopSouthStair();
|
|
||||||
innerLeftTopEastStair();
|
|
||||||
innerLeftTopWestStair();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void straightBottomNorthStair() {
|
|
||||||
Stairs stairs = (Stairs) Material.END_STONE_BRICK_STAIRS.createBlockData();
|
|
||||||
stairs.setShape(Stairs.Shape.STRAIGHT);
|
|
||||||
stairs.setHalf(Stairs.Half.BOTTOM);
|
|
||||||
stairs.setFacing(BlockFace.NORTH);
|
|
||||||
List<Cuboid> cuboidList = new ArrayList<>();
|
|
||||||
cuboidList.add(pixelCuboid(0, 0, 0, 16, 8, 16));
|
|
||||||
cuboidList.add(pixelCuboid(0, 8, 0, 16, 8, 8));
|
|
||||||
new BlockBoundingBox(stairs, cuboidList, createItem("LAUFBAU_BLOCK_END_STONE_BRICK_STAIRS", Material.END_STONE_BRICK_STAIRS, "LAUFBAU_SHAPE_STRAIGHT", "LAUFBAU_HALF_BOTTOM", "LAUFBAU_FACING_NORTH"));
|
|
||||||
}
|
|
||||||
|
|
||||||
public void straightBottomSouthStair() {
|
|
||||||
Stairs stairs = (Stairs) Material.END_STONE_BRICK_STAIRS.createBlockData();
|
|
||||||
stairs.setShape(Stairs.Shape.STRAIGHT);
|
|
||||||
stairs.setHalf(Stairs.Half.BOTTOM);
|
|
||||||
stairs.setFacing(BlockFace.SOUTH);
|
|
||||||
List<Cuboid> cuboidList = new ArrayList<>();
|
|
||||||
cuboidList.add(pixelCuboid(0, 0, 0, 16, 8, 16));
|
|
||||||
cuboidList.add(pixelCuboid(0, 8, 8, 16, 8, 8));
|
|
||||||
new BlockBoundingBox(stairs, cuboidList, createItem("LAUFBAU_BLOCK_END_STONE_BRICK_STAIRS", Material.END_STONE_BRICK_STAIRS, "LAUFBAU_SHAPE_STRAIGHT", "LAUFBAU_HALF_BOTTOM", "LAUFBAU_FACING_SOUTH"));
|
|
||||||
}
|
|
||||||
|
|
||||||
public void straightBottomEastStair() {
|
|
||||||
Stairs stairs = (Stairs) Material.END_STONE_BRICK_STAIRS.createBlockData();
|
|
||||||
stairs.setShape(Stairs.Shape.STRAIGHT);
|
|
||||||
stairs.setHalf(Stairs.Half.BOTTOM);
|
|
||||||
stairs.setFacing(BlockFace.EAST);
|
|
||||||
List<Cuboid> cuboidList = new ArrayList<>();
|
|
||||||
cuboidList.add(pixelCuboid(0, 0, 0, 16, 8, 16));
|
|
||||||
cuboidList.add(pixelCuboid(8, 8, 0, 8, 8, 16));
|
|
||||||
new BlockBoundingBox(stairs, cuboidList, createItem("LAUFBAU_BLOCK_END_STONE_BRICK_STAIRS", Material.END_STONE_BRICK_STAIRS, "LAUFBAU_SHAPE_STRAIGHT", "LAUFBAU_HALF_BOTTOM", "LAUFBAU_FACING_EAST"));
|
|
||||||
}
|
|
||||||
|
|
||||||
public void straightBottomWestStair() {
|
|
||||||
Stairs stairs = (Stairs) Material.END_STONE_BRICK_STAIRS.createBlockData();
|
|
||||||
stairs.setShape(Stairs.Shape.STRAIGHT);
|
|
||||||
stairs.setHalf(Stairs.Half.BOTTOM);
|
|
||||||
stairs.setFacing(BlockFace.WEST);
|
|
||||||
List<Cuboid> cuboidList = new ArrayList<>();
|
|
||||||
cuboidList.add(pixelCuboid(0, 0, 0, 16, 8, 16));
|
|
||||||
cuboidList.add(pixelCuboid(0, 8, 0, 8, 8, 16));
|
|
||||||
new BlockBoundingBox(stairs, cuboidList, createItem("LAUFBAU_BLOCK_END_STONE_BRICK_STAIRS", Material.END_STONE_BRICK_STAIRS, "LAUFBAU_SHAPE_STRAIGHT", "LAUFBAU_HALF_BOTTOM", "LAUFBAU_FACING_WEST"));
|
|
||||||
}
|
|
||||||
|
|
||||||
public void straightTopNorthStair() {
|
|
||||||
Stairs stairs = (Stairs) Material.END_STONE_BRICK_STAIRS.createBlockData();
|
|
||||||
stairs.setShape(Stairs.Shape.STRAIGHT);
|
|
||||||
stairs.setHalf(Stairs.Half.TOP);
|
|
||||||
stairs.setFacing(BlockFace.NORTH);
|
|
||||||
List<Cuboid> cuboidList = new ArrayList<>();
|
|
||||||
cuboidList.add(pixelCuboid(0, 8, 0, 16, 8, 16));
|
|
||||||
cuboidList.add(pixelCuboid(0, 0, 0, 16, 8, 8));
|
|
||||||
new BlockBoundingBox(stairs, cuboidList, createItem("LAUFBAU_BLOCK_END_STONE_BRICK_STAIRS", Material.END_STONE_BRICK_STAIRS, "LAUFBAU_SHAPE_STRAIGHT", "LAUFBAU_HALF_TOP", "LAUFBAU_FACING_NORTH"));
|
|
||||||
}
|
|
||||||
|
|
||||||
public void straightTopSouthStair() {
|
|
||||||
Stairs stairs = (Stairs) Material.END_STONE_BRICK_STAIRS.createBlockData();
|
|
||||||
stairs.setShape(Stairs.Shape.STRAIGHT);
|
|
||||||
stairs.setHalf(Stairs.Half.TOP);
|
|
||||||
stairs.setFacing(BlockFace.SOUTH);
|
|
||||||
List<Cuboid> cuboidList = new ArrayList<>();
|
|
||||||
cuboidList.add(pixelCuboid(0, 8, 0, 16, 8, 16));
|
|
||||||
cuboidList.add(pixelCuboid(0, 0, 8, 16, 8, 8));
|
|
||||||
new BlockBoundingBox(stairs, cuboidList, createItem("LAUFBAU_BLOCK_END_STONE_BRICK_STAIRS", Material.END_STONE_BRICK_STAIRS, "LAUFBAU_SHAPE_STRAIGHT", "LAUFBAU_HALF_TOP", "LAUFBAU_FACING_SOUTH"));
|
|
||||||
}
|
|
||||||
|
|
||||||
public void straightTopEastStair() {
|
|
||||||
Stairs stairs = (Stairs) Material.END_STONE_BRICK_STAIRS.createBlockData();
|
|
||||||
stairs.setShape(Stairs.Shape.STRAIGHT);
|
|
||||||
stairs.setHalf(Stairs.Half.TOP);
|
|
||||||
stairs.setFacing(BlockFace.EAST);
|
|
||||||
List<Cuboid> cuboidList = new ArrayList<>();
|
|
||||||
cuboidList.add(pixelCuboid(0, 8, 0, 16, 8, 16));
|
|
||||||
cuboidList.add(pixelCuboid(8, 0, 0, 8, 8, 16));
|
|
||||||
new BlockBoundingBox(stairs, cuboidList, createItem("LAUFBAU_BLOCK_END_STONE_BRICK_STAIRS", Material.END_STONE_BRICK_STAIRS, "LAUFBAU_SHAPE_STRAIGHT", "LAUFBAU_HALF_TOP", "LAUFBAU_FACING_EAST"));
|
|
||||||
}
|
|
||||||
|
|
||||||
public void straightTopWestStair() {
|
|
||||||
Stairs stairs = (Stairs) Material.END_STONE_BRICK_STAIRS.createBlockData();
|
|
||||||
stairs.setShape(Stairs.Shape.STRAIGHT);
|
|
||||||
stairs.setHalf(Stairs.Half.TOP);
|
|
||||||
stairs.setFacing(BlockFace.WEST);
|
|
||||||
List<Cuboid> cuboidList = new ArrayList<>();
|
|
||||||
cuboidList.add(pixelCuboid(0, 8, 0, 16, 8, 16));
|
|
||||||
cuboidList.add(pixelCuboid(0, 0, 0, 8, 8, 16));
|
|
||||||
new BlockBoundingBox(stairs, cuboidList, createItem("LAUFBAU_BLOCK_END_STONE_BRICK_STAIRS", Material.END_STONE_BRICK_STAIRS, "LAUFBAU_SHAPE_STRAIGHT", "LAUFBAU_HALF_TOP", "LAUFBAU_FACING_WEST"));
|
|
||||||
}
|
|
||||||
|
|
||||||
public void outerLeftBottomNorthStair() {
|
|
||||||
Stairs stairs = (Stairs) Material.END_STONE_BRICK_STAIRS.createBlockData();
|
|
||||||
stairs.setShape(Stairs.Shape.OUTER_LEFT);
|
|
||||||
stairs.setHalf(Stairs.Half.BOTTOM);
|
|
||||||
stairs.setFacing(BlockFace.NORTH);
|
|
||||||
List<Cuboid> cuboidList = new ArrayList<>();
|
|
||||||
cuboidList.add(pixelCuboid(0, 0, 0, 16, 8, 16));
|
|
||||||
cuboidList.add(pixelCuboid(0, 8, 0, 8, 8, 8));
|
|
||||||
new BlockBoundingBox(stairs, cuboidList, createItem("LAUFBAU_BLOCK_END_STONE_BRICK_STAIRS", Material.END_STONE_BRICK_STAIRS, "LAUFBAU_SHAPE_OUTER_LEFT", "LAUFBAU_HALF_BOTTOM", "LAUFBAU_FACING_NORTH"));
|
|
||||||
}
|
|
||||||
|
|
||||||
public void outerLeftBottomSouthStair() {
|
|
||||||
Stairs stairs = (Stairs) Material.END_STONE_BRICK_STAIRS.createBlockData();
|
|
||||||
stairs.setShape(Stairs.Shape.OUTER_LEFT);
|
|
||||||
stairs.setHalf(Stairs.Half.BOTTOM);
|
|
||||||
stairs.setFacing(BlockFace.SOUTH);
|
|
||||||
List<Cuboid> cuboidList = new ArrayList<>();
|
|
||||||
cuboidList.add(pixelCuboid(0, 0, 0, 16, 8, 16));
|
|
||||||
cuboidList.add(pixelCuboid(8, 8, 8, 8, 8, 8));
|
|
||||||
new BlockBoundingBox(stairs, cuboidList, createItem("LAUFBAU_BLOCK_END_STONE_BRICK_STAIRS", Material.END_STONE_BRICK_STAIRS, "LAUFBAU_SHAPE_OUTER_LEFT", "LAUFBAU_HALF_BOTTOM", "LAUFBAU_FACING_SOUTH"));
|
|
||||||
}
|
|
||||||
|
|
||||||
public void outerLeftBottomEastStair() {
|
|
||||||
Stairs stairs = (Stairs) Material.END_STONE_BRICK_STAIRS.createBlockData();
|
|
||||||
stairs.setShape(Stairs.Shape.OUTER_LEFT);
|
|
||||||
stairs.setHalf(Stairs.Half.BOTTOM);
|
|
||||||
stairs.setFacing(BlockFace.EAST);
|
|
||||||
List<Cuboid> cuboidList = new ArrayList<>();
|
|
||||||
cuboidList.add(pixelCuboid(0, 0, 0, 16, 8, 16));
|
|
||||||
cuboidList.add(pixelCuboid(8, 8, 0, 8, 8, 8));
|
|
||||||
new BlockBoundingBox(stairs, cuboidList, createItem("LAUFBAU_BLOCK_END_STONE_BRICK_STAIRS", Material.END_STONE_BRICK_STAIRS, "LAUFBAU_SHAPE_OUTER_LEFT", "LAUFBAU_HALF_BOTTOM", "LAUFBAU_FACING_EAST"));
|
|
||||||
}
|
|
||||||
|
|
||||||
public void outerLeftBottomWestStair() {
|
|
||||||
Stairs stairs = (Stairs) Material.END_STONE_BRICK_STAIRS.createBlockData();
|
|
||||||
stairs.setShape(Stairs.Shape.OUTER_LEFT);
|
|
||||||
stairs.setHalf(Stairs.Half.BOTTOM);
|
|
||||||
stairs.setFacing(BlockFace.WEST);
|
|
||||||
List<Cuboid> cuboidList = new ArrayList<>();
|
|
||||||
cuboidList.add(pixelCuboid(0, 0, 0, 16, 8, 16));
|
|
||||||
cuboidList.add(pixelCuboid(0, 8, 8, 8, 8, 8));
|
|
||||||
new BlockBoundingBox(stairs, cuboidList, createItem("LAUFBAU_BLOCK_END_STONE_BRICK_STAIRS", Material.END_STONE_BRICK_STAIRS, "LAUFBAU_SHAPE_OUTER_LEFT", "LAUFBAU_HALF_BOTTOM", "LAUFBAU_FACING_WEST"));
|
|
||||||
}
|
|
||||||
|
|
||||||
public void outerLeftTopNorthStair() {
|
|
||||||
Stairs stairs = (Stairs) Material.END_STONE_BRICK_STAIRS.createBlockData();
|
|
||||||
stairs.setShape(Stairs.Shape.OUTER_LEFT);
|
|
||||||
stairs.setHalf(Stairs.Half.TOP);
|
|
||||||
stairs.setFacing(BlockFace.NORTH);
|
|
||||||
List<Cuboid> cuboidList = new ArrayList<>();
|
|
||||||
cuboidList.add(pixelCuboid(0, 8, 0, 16, 8, 16));
|
|
||||||
cuboidList.add(pixelCuboid(0, 0, 0, 8, 8, 8));
|
|
||||||
new BlockBoundingBox(stairs, cuboidList, createItem("LAUFBAU_BLOCK_END_STONE_BRICK_STAIRS", Material.END_STONE_BRICK_STAIRS, "LAUFBAU_SHAPE_OUTER_LEFT", "LAUFBAU_HALF_TOP", "LAUFBAU_FACING_NORTH"));
|
|
||||||
}
|
|
||||||
|
|
||||||
public void outerLeftTopSouthStair() {
|
|
||||||
Stairs stairs = (Stairs) Material.END_STONE_BRICK_STAIRS.createBlockData();
|
|
||||||
stairs.setShape(Stairs.Shape.OUTER_LEFT);
|
|
||||||
stairs.setHalf(Stairs.Half.TOP);
|
|
||||||
stairs.setFacing(BlockFace.SOUTH);
|
|
||||||
List<Cuboid> cuboidList = new ArrayList<>();
|
|
||||||
cuboidList.add(pixelCuboid(0, 8, 0, 16, 8, 16));
|
|
||||||
cuboidList.add(pixelCuboid(8, 0, 8, 8, 8, 8));
|
|
||||||
new BlockBoundingBox(stairs, cuboidList, createItem("LAUFBAU_BLOCK_END_STONE_BRICK_STAIRS", Material.END_STONE_BRICK_STAIRS, "LAUFBAU_SHAPE_OUTER_LEFT", "LAUFBAU_HALF_TOP", "LAUFBAU_FACING_SOUTH"));
|
|
||||||
}
|
|
||||||
|
|
||||||
public void outerLeftTopEastStair() {
|
|
||||||
Stairs stairs = (Stairs) Material.END_STONE_BRICK_STAIRS.createBlockData();
|
|
||||||
stairs.setShape(Stairs.Shape.OUTER_LEFT);
|
|
||||||
stairs.setHalf(Stairs.Half.TOP);
|
|
||||||
stairs.setFacing(BlockFace.EAST);
|
|
||||||
List<Cuboid> cuboidList = new ArrayList<>();
|
|
||||||
cuboidList.add(pixelCuboid(0, 8, 0, 16, 8, 16));
|
|
||||||
cuboidList.add(pixelCuboid(8, 0, 0, 8, 8, 8));
|
|
||||||
new BlockBoundingBox(stairs, cuboidList, createItem("LAUFBAU_BLOCK_END_STONE_BRICK_STAIRS", Material.END_STONE_BRICK_STAIRS, "LAUFBAU_SHAPE_OUTER_LEFT", "LAUFBAU_HALF_TOP", "LAUFBAU_FACING_EAST"));
|
|
||||||
}
|
|
||||||
|
|
||||||
public void outerLeftTopWestStair() {
|
|
||||||
Stairs stairs = (Stairs) Material.END_STONE_BRICK_STAIRS.createBlockData();
|
|
||||||
stairs.setShape(Stairs.Shape.OUTER_LEFT);
|
|
||||||
stairs.setHalf(Stairs.Half.TOP);
|
|
||||||
stairs.setFacing(BlockFace.WEST);
|
|
||||||
List<Cuboid> cuboidList = new ArrayList<>();
|
|
||||||
cuboidList.add(pixelCuboid(0, 8, 0, 16, 8, 16));
|
|
||||||
cuboidList.add(pixelCuboid(0, 0, 8, 8, 8, 8));
|
|
||||||
new BlockBoundingBox(stairs, cuboidList, createItem("LAUFBAU_BLOCK_END_STONE_BRICK_STAIRS", Material.END_STONE_BRICK_STAIRS, "LAUFBAU_SHAPE_OUTER_LEFT", "LAUFBAU_HALF_TOP", "LAUFBAU_FACING_WEST"));
|
|
||||||
}
|
|
||||||
|
|
||||||
public void innerLeftBottomNorthStair() {
|
|
||||||
Stairs stairs = (Stairs) Material.END_STONE_BRICK_STAIRS.createBlockData();
|
|
||||||
stairs.setShape(Stairs.Shape.INNER_LEFT);
|
|
||||||
stairs.setHalf(Stairs.Half.BOTTOM);
|
|
||||||
stairs.setFacing(BlockFace.NORTH);
|
|
||||||
List<Cuboid> cuboidList = new ArrayList<>();
|
|
||||||
cuboidList.add(pixelCuboid(0, 0, 0, 16, 8, 16));
|
|
||||||
cuboidList.add(pixelCuboid(0, 8, 0, 16, 8, 8));
|
|
||||||
cuboidList.add(pixelCuboid(0, 8, 8, 8, 8, 8));
|
|
||||||
new BlockBoundingBox(stairs, cuboidList, createItem("LAUFBAU_BLOCK_END_STONE_BRICK_STAIRS", Material.END_STONE_BRICK_STAIRS, "LAUFBAU_SHAPE_INNER_LEFT", "LAUFBAU_HALF_BOTTOM", "LAUFBAU_FACING_NORTH"));
|
|
||||||
}
|
|
||||||
|
|
||||||
public void innerLeftBottomSouthStair() {
|
|
||||||
Stairs stairs = (Stairs) Material.END_STONE_BRICK_STAIRS.createBlockData();
|
|
||||||
stairs.setShape(Stairs.Shape.INNER_LEFT);
|
|
||||||
stairs.setHalf(Stairs.Half.BOTTOM);
|
|
||||||
stairs.setFacing(BlockFace.SOUTH);
|
|
||||||
List<Cuboid> cuboidList = new ArrayList<>();
|
|
||||||
cuboidList.add(pixelCuboid(0, 0, 0, 16, 8, 16));
|
|
||||||
cuboidList.add(pixelCuboid(0, 8, 8, 16, 8, 8));
|
|
||||||
cuboidList.add(pixelCuboid(8, 8, 0, 8, 8, 8));
|
|
||||||
new BlockBoundingBox(stairs, cuboidList, createItem("LAUFBAU_BLOCK_END_STONE_BRICK_STAIRS", Material.END_STONE_BRICK_STAIRS, "LAUFBAU_SHAPE_INNER_LEFT", "LAUFBAU_HALF_BOTTOM", "LAUFBAU_FACING_SOUTH"));
|
|
||||||
}
|
|
||||||
|
|
||||||
public void innerLeftBottomEastStair() {
|
|
||||||
Stairs stairs = (Stairs) Material.END_STONE_BRICK_STAIRS.createBlockData();
|
|
||||||
stairs.setShape(Stairs.Shape.INNER_LEFT);
|
|
||||||
stairs.setHalf(Stairs.Half.BOTTOM);
|
|
||||||
stairs.setFacing(BlockFace.EAST);
|
|
||||||
List<Cuboid> cuboidList = new ArrayList<>();
|
|
||||||
cuboidList.add(pixelCuboid(0, 0, 0, 16, 8, 16));
|
|
||||||
cuboidList.add(pixelCuboid(0, 8, 0, 16, 8, 8));
|
|
||||||
cuboidList.add(pixelCuboid(8, 8, 8, 8, 8, 8));
|
|
||||||
new BlockBoundingBox(stairs, cuboidList, createItem("LAUFBAU_BLOCK_END_STONE_BRICK_STAIRS", Material.END_STONE_BRICK_STAIRS, "LAUFBAU_SHAPE_INNER_LEFT", "LAUFBAU_HALF_BOTTOM", "LAUFBAU_FACING_EAST"));
|
|
||||||
}
|
|
||||||
|
|
||||||
public void innerLeftBottomWestStair() {
|
|
||||||
Stairs stairs = (Stairs) Material.END_STONE_BRICK_STAIRS.createBlockData();
|
|
||||||
stairs.setShape(Stairs.Shape.INNER_LEFT);
|
|
||||||
stairs.setHalf(Stairs.Half.BOTTOM);
|
|
||||||
stairs.setFacing(BlockFace.WEST);
|
|
||||||
List<Cuboid> cuboidList = new ArrayList<>();
|
|
||||||
cuboidList.add(pixelCuboid(0, 0, 0, 16, 8, 16));
|
|
||||||
cuboidList.add(pixelCuboid(0, 8, 8, 16, 8, 8));
|
|
||||||
cuboidList.add(pixelCuboid(0, 8, 0, 8, 8, 8));
|
|
||||||
new BlockBoundingBox(stairs, cuboidList, createItem("LAUFBAU_BLOCK_END_STONE_BRICK_STAIRS", Material.END_STONE_BRICK_STAIRS, "LAUFBAU_SHAPE_INNER_LEFT", "LAUFBAU_HALF_BOTTOM", "LAUFBAU_FACING_WEST"));
|
|
||||||
}
|
|
||||||
|
|
||||||
public void innerLeftTopNorthStair() {
|
|
||||||
Stairs stairs = (Stairs) Material.END_STONE_BRICK_STAIRS.createBlockData();
|
|
||||||
stairs.setShape(Stairs.Shape.INNER_LEFT);
|
|
||||||
stairs.setHalf(Stairs.Half.TOP);
|
|
||||||
stairs.setFacing(BlockFace.NORTH);
|
|
||||||
List<Cuboid> cuboidList = new ArrayList<>();
|
|
||||||
cuboidList.add(pixelCuboid(0, 8, 0, 16, 8, 16));
|
|
||||||
cuboidList.add(pixelCuboid(0, 0, 0, 16, 8, 8));
|
|
||||||
cuboidList.add(pixelCuboid(0, 0, 8, 8, 8, 8));
|
|
||||||
new BlockBoundingBox(stairs, cuboidList, createItem("LAUFBAU_BLOCK_END_STONE_BRICK_STAIRS", Material.END_STONE_BRICK_STAIRS, "LAUFBAU_SHAPE_INNER_LEFT", "LAUFBAU_HALF_TOP", "LAUFBAU_FACING_NORTH"));
|
|
||||||
}
|
|
||||||
|
|
||||||
public void innerLeftTopSouthStair() {
|
|
||||||
Stairs stairs = (Stairs) Material.END_STONE_BRICK_STAIRS.createBlockData();
|
|
||||||
stairs.setShape(Stairs.Shape.INNER_LEFT);
|
|
||||||
stairs.setHalf(Stairs.Half.TOP);
|
|
||||||
stairs.setFacing(BlockFace.SOUTH);
|
|
||||||
List<Cuboid> cuboidList = new ArrayList<>();
|
|
||||||
cuboidList.add(pixelCuboid(0, 8, 0, 16, 8, 16));
|
|
||||||
cuboidList.add(pixelCuboid(0, 0, 8, 16, 8, 8));
|
|
||||||
cuboidList.add(pixelCuboid(8, 0, 0, 8, 8, 8));
|
|
||||||
new BlockBoundingBox(stairs, cuboidList, createItem("LAUFBAU_BLOCK_END_STONE_BRICK_STAIRS", Material.END_STONE_BRICK_STAIRS, "LAUFBAU_SHAPE_INNER_LEFT", "LAUFBAU_HALF_TOP", "LAUFBAU_FACING_SOUTH"));
|
|
||||||
}
|
|
||||||
|
|
||||||
public void innerLeftTopEastStair() {
|
|
||||||
Stairs stairs = (Stairs) Material.END_STONE_BRICK_STAIRS.createBlockData();
|
|
||||||
stairs.setShape(Stairs.Shape.INNER_LEFT);
|
|
||||||
stairs.setHalf(Stairs.Half.TOP);
|
|
||||||
stairs.setFacing(BlockFace.EAST);
|
|
||||||
List<Cuboid> cuboidList = new ArrayList<>();
|
|
||||||
cuboidList.add(pixelCuboid(0, 8, 0, 16, 8, 16));
|
|
||||||
cuboidList.add(pixelCuboid(0, 0, 0, 16, 8, 8));
|
|
||||||
cuboidList.add(pixelCuboid(8, 0, 8, 8, 8, 8));
|
|
||||||
new BlockBoundingBox(stairs, cuboidList, createItem("LAUFBAU_BLOCK_END_STONE_BRICK_STAIRS", Material.END_STONE_BRICK_STAIRS, "LAUFBAU_SHAPE_INNER_LEFT", "LAUFBAU_HALF_TOP", "LAUFBAU_FACING_EAST"));
|
|
||||||
}
|
|
||||||
|
|
||||||
public void innerLeftTopWestStair() {
|
|
||||||
Stairs stairs = (Stairs) Material.END_STONE_BRICK_STAIRS.createBlockData();
|
|
||||||
stairs.setShape(Stairs.Shape.INNER_LEFT);
|
|
||||||
stairs.setHalf(Stairs.Half.TOP);
|
|
||||||
stairs.setFacing(BlockFace.WEST);
|
|
||||||
List<Cuboid> cuboidList = new ArrayList<>();
|
|
||||||
cuboidList.add(pixelCuboid(0, 8, 0, 16, 8, 16));
|
|
||||||
cuboidList.add(pixelCuboid(0, 0, 8, 16, 8, 8));
|
|
||||||
cuboidList.add(pixelCuboid(0, 0, 0, 8, 8, 8));
|
|
||||||
new BlockBoundingBox(stairs, cuboidList, createItem("LAUFBAU_BLOCK_END_STONE_BRICK_STAIRS", Material.END_STONE_BRICK_STAIRS, "LAUFBAU_SHAPE_INNER_LEFT", "LAUFBAU_HALF_TOP", "LAUFBAU_FACING_WEST"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-121
@@ -1,121 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is a part of the SteamWar software.
|
|
||||||
*
|
|
||||||
* Copyright (C) 2025 SteamWar.de-Serverteam
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU Affero General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU Affero General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.steamwar.bausystem.features.slaves.laufbau.boundingboxes;
|
|
||||||
|
|
||||||
import de.steamwar.bausystem.features.slaves.laufbau.BlockBoundingBox;
|
|
||||||
import de.steamwar.bausystem.features.slaves.laufbau.BoundingBoxLoader;
|
|
||||||
import de.steamwar.bausystem.features.slaves.laufbau.Cuboid;
|
|
||||||
import de.steamwar.core.Core;
|
|
||||||
import de.steamwar.linkage.Linked;
|
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.block.BlockFace;
|
|
||||||
import org.bukkit.block.data.type.Fence;
|
|
||||||
import org.bukkit.block.data.type.Wall;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import static de.steamwar.bausystem.features.slaves.laufbau.LaufbauUtils.createItem;
|
|
||||||
import static de.steamwar.bausystem.features.slaves.laufbau.LaufbauUtils.pixelCuboid;
|
|
||||||
|
|
||||||
@Linked
|
|
||||||
public class WallBoundingBox implements BoundingBoxLoader {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void load() {
|
|
||||||
if (Core.getVersion() > 15) {
|
|
||||||
v18();
|
|
||||||
} else {
|
|
||||||
v15();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void v18() {
|
|
||||||
for (int nx = 0; nx < 2; nx++) {
|
|
||||||
for (int nz = 0; nz < 2; nz++) {
|
|
||||||
for (int px = 0; px < 2; px++) {
|
|
||||||
for (int pz = 0; pz < 2; pz++) {
|
|
||||||
Wall fence = (Wall) Material.END_STONE_BRICK_WALL.createBlockData();
|
|
||||||
List<String> lore = new ArrayList<>();
|
|
||||||
List<Cuboid> cuboidList = new ArrayList<>();
|
|
||||||
cuboidList.add(pixelCuboid(4, 0, 4, 8, 24, 8));
|
|
||||||
if (nz == 1) {
|
|
||||||
lore.add("LAUFBAU_CONNECTION_NORTH");
|
|
||||||
fence.setHeight(BlockFace.NORTH, Wall.Height.LOW);
|
|
||||||
cuboidList.add(pixelCuboid(5, 0, 0, 6, 24, 4));
|
|
||||||
}
|
|
||||||
if (pz == 1) {
|
|
||||||
lore.add("LAUFBAU_CONNECTION_SOUTH");
|
|
||||||
fence.setHeight(BlockFace.SOUTH, Wall.Height.LOW);
|
|
||||||
cuboidList.add(pixelCuboid(5, 0, 12, 6, 24, 4));
|
|
||||||
}
|
|
||||||
if (nx == 1) {
|
|
||||||
lore.add("LAUFBAU_CONNECTION_WEST");
|
|
||||||
fence.setHeight(BlockFace.WEST, Wall.Height.LOW);
|
|
||||||
cuboidList.add(pixelCuboid(0, 0, 5, 4, 24, 6));
|
|
||||||
}
|
|
||||||
if (px == 1) {
|
|
||||||
lore.add("LAUFBAU_CONNECTION_EAST");
|
|
||||||
fence.setHeight(BlockFace.EAST, Wall.Height.LOW);
|
|
||||||
cuboidList.add(pixelCuboid(12, 0, 5, 4, 24, 6));
|
|
||||||
}
|
|
||||||
new BlockBoundingBox(fence, cuboidList, createItem("LAUFBAU_BLOCK_END_STONE_BRICK_WALL", Material.END_STONE_BRICK_WALL, lore.toArray(new String[0])));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void v15() {
|
|
||||||
for (int nx = 0; nx < 2; nx++) {
|
|
||||||
for (int nz = 0; nz < 2; nz++) {
|
|
||||||
for (int px = 0; px < 2; px++) {
|
|
||||||
for (int pz = 0; pz < 2; pz++) {
|
|
||||||
Fence fence = (Fence) Material.END_STONE_BRICK_WALL.createBlockData();
|
|
||||||
List<String> lore = new ArrayList<>();
|
|
||||||
List<Cuboid> cuboidList = new ArrayList<>();
|
|
||||||
cuboidList.add(pixelCuboid(4, 0, 4, 8, 24, 8));
|
|
||||||
if (nz == 1) {
|
|
||||||
lore.add("LAUFBAU_CONNECTION_NORTH");
|
|
||||||
fence.setFace(BlockFace.NORTH, true);
|
|
||||||
cuboidList.add(pixelCuboid(5, 0, 0, 6, 24, 4));
|
|
||||||
}
|
|
||||||
if (pz == 1) {
|
|
||||||
lore.add("LAUFBAU_CONNECTION_SOUTH");
|
|
||||||
fence.setFace(BlockFace.SOUTH, true);
|
|
||||||
cuboidList.add(pixelCuboid(5, 0, 12, 6, 24, 4));
|
|
||||||
}
|
|
||||||
if (nx == 1) {
|
|
||||||
lore.add("LAUFBAU_CONNECTION_WEST");
|
|
||||||
fence.setFace(BlockFace.WEST, true);
|
|
||||||
cuboidList.add(pixelCuboid(0, 0, 5, 4, 24, 6));
|
|
||||||
}
|
|
||||||
if (px == 1) {
|
|
||||||
lore.add("LAUFBAU_CONNECTION_EAST");
|
|
||||||
fence.setFace(BlockFace.EAST, true);
|
|
||||||
cuboidList.add(pixelCuboid(12, 0, 5, 4, 24, 6));
|
|
||||||
}
|
|
||||||
new BlockBoundingBox(fence, cuboidList, createItem("LAUFBAU_BLOCK_END_STONE_BRICK_WALL", Material.END_STONE_BRICK_WALL, lore.toArray(new String[0])));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
+2
-1
@@ -87,8 +87,9 @@ public class ProcessingTracesState implements LaufbauState {
|
|||||||
|
|
||||||
TNTPoint current = TNTPoints.remove(0);
|
TNTPoint current = TNTPoints.remove(0);
|
||||||
if (FlatteningWrapper.impl.inWater(world, current.getLocation().toVector())) return;
|
if (FlatteningWrapper.impl.inWater(world, current.getLocation().toVector())) return;
|
||||||
if (!(inRegion(current.getLocation().toVector(), 1) || (current.getPrevious().isPresent() && inRegion(current.getPrevious().get().getLocation().toVector(), 1))))
|
if (!(inRegion(current.getLocation().toVector(), 1) || (current.getPrevious().isPresent() && inRegion(current.getPrevious().get().getLocation().toVector(), 1)))) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Location location = current.getLocation();
|
Location location = current.getLocation();
|
||||||
if (current.getPrevious().isPresent()) {
|
if (current.getPrevious().isPresent()) {
|
||||||
|
|||||||
+2
-3
@@ -25,7 +25,6 @@ import com.sk89q.worldedit.world.block.BaseBlock;
|
|||||||
import com.sk89q.worldedit.world.block.BlockState;
|
import com.sk89q.worldedit.world.block.BlockState;
|
||||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||||
import de.steamwar.bausystem.utils.WorldEditUtils;
|
import de.steamwar.bausystem.utils.WorldEditUtils;
|
||||||
import de.steamwar.core.Core;
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.SneakyThrows;
|
import lombok.SneakyThrows;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
@@ -41,6 +40,7 @@ import java.util.*;
|
|||||||
public class Panzern {
|
public class Panzern {
|
||||||
|
|
||||||
private static List<PanzernAlgorithm> panzernAlgorithmList = new ArrayList<>();
|
private static List<PanzernAlgorithm> panzernAlgorithmList = new ArrayList<>();
|
||||||
|
|
||||||
public static void add(PanzernAlgorithm panzernAlgorithm) {
|
public static void add(PanzernAlgorithm panzernAlgorithm) {
|
||||||
panzernAlgorithmList.add(panzernAlgorithm);
|
panzernAlgorithmList.add(panzernAlgorithm);
|
||||||
}
|
}
|
||||||
@@ -57,9 +57,8 @@ public class Panzern {
|
|||||||
|
|
||||||
private BaseBlock blockType;
|
private BaseBlock blockType;
|
||||||
private BaseBlock slabType;
|
private BaseBlock slabType;
|
||||||
private static final BaseBlock jukeboxType = (Core.getVersion() > 19 ? BlockTypes.get("lodestone"): BlockTypes.get("jukebox")).getDefaultState().toBaseBlock();
|
private static final BaseBlock jukeboxType = BlockTypes.get("lodestone").getDefaultState().toBaseBlock();
|
||||||
private static final BaseBlock cobwebType = BlockTypes.COBWEB.getDefaultState().toBaseBlock();
|
private static final BaseBlock cobwebType = BlockTypes.COBWEB.getDefaultState().toBaseBlock();
|
||||||
private static final BaseBlock airType = BlockTypes.AIR.getDefaultState().toBaseBlock();
|
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
private EditSession editSession;
|
private EditSession editSession;
|
||||||
|
|||||||
+3
-5
@@ -23,8 +23,6 @@ import com.comphenix.tinyprotocol.TinyProtocol;
|
|||||||
import de.steamwar.bausystem.BauSystem;
|
import de.steamwar.bausystem.BauSystem;
|
||||||
import de.steamwar.bausystem.Permission;
|
import de.steamwar.bausystem.Permission;
|
||||||
import de.steamwar.bausystem.configplayer.Config;
|
import de.steamwar.bausystem.configplayer.Config;
|
||||||
import de.steamwar.core.Core;
|
|
||||||
import de.steamwar.inventory.SWItem;
|
|
||||||
import de.steamwar.linkage.Linked;
|
import de.steamwar.linkage.Linked;
|
||||||
import net.minecraft.network.protocol.game.ServerboundUseItemOnPacket;
|
import net.minecraft.network.protocol.game.ServerboundUseItemOnPacket;
|
||||||
import org.bukkit.*;
|
import org.bukkit.*;
|
||||||
@@ -77,8 +75,8 @@ public class SmartPlaceListener implements Listener {
|
|||||||
|
|
||||||
IGNORED.add(Material.TNT);
|
IGNORED.add(Material.TNT);
|
||||||
IGNORED.add(Material.REDSTONE_ORE);
|
IGNORED.add(Material.REDSTONE_ORE);
|
||||||
IGNORED.add(SWItem.getMaterial("BEEHIVE"));
|
IGNORED.add(Material.BEEHIVE);
|
||||||
IGNORED.add(SWItem.getMaterial("SEA_PICKLE"));
|
IGNORED.add(Material.SEA_PICKLE);
|
||||||
IGNORED.remove(Material.STONE);
|
IGNORED.remove(Material.STONE);
|
||||||
IGNORED.remove(Material.BARRIER);
|
IGNORED.remove(Material.BARRIER);
|
||||||
}
|
}
|
||||||
@@ -150,7 +148,7 @@ public class SmartPlaceListener implements Listener {
|
|||||||
if (!Permission.BUILD.hasPermission(event.getPlayer())) return;
|
if (!Permission.BUILD.hasPermission(event.getPlayer())) return;
|
||||||
if (!Config.getInstance().get(event.getPlayer()).getPlainValueOrDefault("smartPlace", false)) return;
|
if (!Config.getInstance().get(event.getPlayer()).getPlainValueOrDefault("smartPlace", false)) return;
|
||||||
if (!SMART_PLACING.contains(event.getPlayer())) {
|
if (!SMART_PLACING.contains(event.getPlayer())) {
|
||||||
if (Core.getVersion() >= 20 && CONTAINERS.contains(event.getBlockAgainst().getType())) {
|
if (CONTAINERS.contains(event.getBlockAgainst().getType())) {
|
||||||
SoundGroup soundGroup = event.getBlockPlaced().getBlockData().getSoundGroup();
|
SoundGroup soundGroup = event.getBlockPlaced().getBlockData().getSoundGroup();
|
||||||
event.getPlayer().playSound(event.getBlockPlaced().getLocation(), soundGroup.getPlaceSound(), soundGroup.getVolume() * 0.8F, soundGroup.getPitch() * 0.8F);
|
event.getPlayer().playSound(event.getBlockPlaced().getLocation(), soundGroup.getPlaceSound(), soundGroup.getVolume() * 0.8F, soundGroup.getPitch() * 0.8F);
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-2
@@ -22,7 +22,6 @@ package de.steamwar.bausystem.features.team.boundary;
|
|||||||
import de.steamwar.bausystem.BauSystem;
|
import de.steamwar.bausystem.BauSystem;
|
||||||
import de.steamwar.bausystem.region.Point;
|
import de.steamwar.bausystem.region.Point;
|
||||||
import de.steamwar.bausystem.region.Region;
|
import de.steamwar.bausystem.region.Region;
|
||||||
import de.steamwar.core.TrickyParticleWrapper;
|
|
||||||
import de.steamwar.linkage.Linked;
|
import de.steamwar.linkage.Linked;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Particle;
|
import org.bukkit.Particle;
|
||||||
@@ -53,7 +52,7 @@ public class BoundaryViewer implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void showRegion(Region region, Player player) {
|
private void showRegion(Region region, Player player) {
|
||||||
drawCuboid(player, TrickyParticleWrapper.impl.getVillagerHappy(), region.getArea().getMinPoint(false), region.getArea().getMaxPoint(false));
|
drawCuboid(player, Particle.HAPPY_VILLAGER, region.getArea().getMinPoint(false), region.getArea().getMaxPoint(false));
|
||||||
if (!region.getTestblockArea().isEmpty()) {
|
if (!region.getTestblockArea().isEmpty()) {
|
||||||
drawCuboid(player, Particle.END_ROD, region.getTestblockArea().getMinPoint(true), region.getTestblockArea().getMaxPoint(true));
|
drawCuboid(player, Particle.END_ROD, region.getTestblockArea().getMinPoint(true), region.getTestblockArea().getMaxPoint(true));
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -31,7 +31,7 @@ import de.steamwar.command.TypeMapper;
|
|||||||
import de.steamwar.core.CraftbukkitWrapper;
|
import de.steamwar.core.CraftbukkitWrapper;
|
||||||
import de.steamwar.linkage.Linked;
|
import de.steamwar.linkage.Linked;
|
||||||
import de.steamwar.linkage.LinkedInstance;
|
import de.steamwar.linkage.LinkedInstance;
|
||||||
import de.steamwar.techhider.TechHider;
|
import de.steamwar.techhider.legacy.TechHider;
|
||||||
import net.md_5.bungee.api.ChatMessageType;
|
import net.md_5.bungee.api.ChatMessageType;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
@@ -92,7 +92,7 @@ public class TechHiderCommand extends SWCommand implements Listener, ScoreboardE
|
|||||||
BauSystem.MESSAGE.sendPrefixless("TECHHIDER_ON", player, ChatMessageType.ACTION_BAR);
|
BauSystem.MESSAGE.sendPrefixless("TECHHIDER_ON", player, ChatMessageType.ACTION_BAR);
|
||||||
}
|
}
|
||||||
region.getBuildArea().forEachChunk((x, z) -> {
|
region.getBuildArea().forEachChunk((x, z) -> {
|
||||||
CraftbukkitWrapper.impl.sendChunk(player, x, z);
|
CraftbukkitWrapper.sendChunk(player, x, z);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -19,19 +19,18 @@
|
|||||||
|
|
||||||
package de.steamwar.bausystem.features.tpslimit;
|
package de.steamwar.bausystem.features.tpslimit;
|
||||||
|
|
||||||
|
import com.destroystokyo.paper.event.server.ServerTickEndEvent;
|
||||||
import de.steamwar.bausystem.BauSystem;
|
import de.steamwar.bausystem.BauSystem;
|
||||||
import de.steamwar.bausystem.Permission;
|
import de.steamwar.bausystem.Permission;
|
||||||
import de.steamwar.bausystem.SWUtils;
|
import de.steamwar.bausystem.SWUtils;
|
||||||
import de.steamwar.bausystem.linkage.BauGuiItem;
|
import de.steamwar.bausystem.linkage.BauGuiItem;
|
||||||
import de.steamwar.bausystem.region.Region;
|
import de.steamwar.bausystem.region.Region;
|
||||||
import de.steamwar.bausystem.utils.ScoreboardElement;
|
import de.steamwar.bausystem.utils.ScoreboardElement;
|
||||||
import de.steamwar.bausystem.utils.TickEndEvent;
|
|
||||||
import de.steamwar.bausystem.utils.TickManager;
|
import de.steamwar.bausystem.utils.TickManager;
|
||||||
import de.steamwar.bausystem.utils.bossbar.BauSystemBossbar;
|
import de.steamwar.bausystem.utils.bossbar.BauSystemBossbar;
|
||||||
import de.steamwar.bausystem.utils.bossbar.BossBarService;
|
import de.steamwar.bausystem.utils.bossbar.BossBarService;
|
||||||
import de.steamwar.command.AbstractSWCommand;
|
import de.steamwar.command.AbstractSWCommand;
|
||||||
import de.steamwar.command.SWCommand;
|
import de.steamwar.command.SWCommand;
|
||||||
import de.steamwar.core.Core;
|
|
||||||
import de.steamwar.core.TPSWatcher;
|
import de.steamwar.core.TPSWatcher;
|
||||||
import de.steamwar.inventory.SWAnvilInv;
|
import de.steamwar.inventory.SWAnvilInv;
|
||||||
import de.steamwar.inventory.SWItem;
|
import de.steamwar.inventory.SWItem;
|
||||||
@@ -59,16 +58,12 @@ public class TPSSystem implements Listener {
|
|||||||
}
|
}
|
||||||
new TPSLimitCommand();
|
new TPSLimitCommand();
|
||||||
new TickLimitCommand();
|
new TickLimitCommand();
|
||||||
if (Core.getVersion() >= 15) {
|
|
||||||
new TPSWarpCommand();
|
new TPSWarpCommand();
|
||||||
new TickWarpCommand();
|
new TickWarpCommand();
|
||||||
if (TickManager.impl.canFreeze()) {
|
if (TickManager.impl.canFreeze()) {
|
||||||
new TickWarpingCommand();
|
new TickWarpingCommand();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (Core.getVersion() >= 21) {
|
|
||||||
new Tick21Command();
|
new Tick21Command();
|
||||||
}
|
|
||||||
new TPSDefaultCommand();
|
new TPSDefaultCommand();
|
||||||
new TickDefaultCommand();
|
new TickDefaultCommand();
|
||||||
new TPSBaseCommand();
|
new TPSBaseCommand();
|
||||||
@@ -77,7 +72,7 @@ public class TPSSystem implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onTickEnd(TickEndEvent event) {
|
public void onTickEnd(ServerTickEndEvent event) {
|
||||||
bossbar();
|
bossbar();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -20,7 +20,6 @@
|
|||||||
package de.steamwar.bausystem.features.tracer;
|
package de.steamwar.bausystem.features.tracer;
|
||||||
|
|
||||||
import de.steamwar.bausystem.region.Region;
|
import de.steamwar.bausystem.region.Region;
|
||||||
import de.steamwar.core.Core;
|
|
||||||
import lombok.AccessLevel;
|
import lombok.AccessLevel;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
@@ -100,11 +99,7 @@ public class TNTPoint {
|
|||||||
List<TNTPoint> history, List<Block> destroyedBlocks) {
|
List<TNTPoint> history, List<Block> destroyedBlocks) {
|
||||||
this.tntId = tntId;
|
this.tntId = tntId;
|
||||||
this.explosion = explosion;
|
this.explosion = explosion;
|
||||||
if (Core.getVersion() > 15) {
|
|
||||||
this.inWater = tnt.isInWater();
|
this.inWater = tnt.isInWater();
|
||||||
} else {
|
|
||||||
this.inWater = false;
|
|
||||||
}
|
|
||||||
this.afterFirstExplosion = afterFirstExplosion;
|
this.afterFirstExplosion = afterFirstExplosion;
|
||||||
this.ticksSinceStart = ticksSinceStart;
|
this.ticksSinceStart = ticksSinceStart;
|
||||||
fuse = tnt.getFuseTicks();
|
fuse = tnt.getFuseTicks();
|
||||||
|
|||||||
@@ -143,13 +143,6 @@ public class Trace {
|
|||||||
} else {
|
} else {
|
||||||
entityServer = new REntityServer();
|
entityServer = new REntityServer();
|
||||||
entityServer.addPlayer(player);
|
entityServer.addPlayer(player);
|
||||||
entityServer.setCallback((p, rEntity, entityAction) -> {
|
|
||||||
if (entityAction != REntityServer.EntityAction.INTERACT)
|
|
||||||
return;
|
|
||||||
if (rEntity instanceof TraceEntity) {
|
|
||||||
((TraceEntity) rEntity).printIntoChat(p);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
entityServerMap.put(player, entityServer);
|
entityServerMap.put(player, entityServer);
|
||||||
}
|
}
|
||||||
render(getRecords(), entityServer, playerTraceShowData);
|
render(getRecords(), entityServer, playerTraceShowData);
|
||||||
@@ -166,13 +159,6 @@ public class Trace {
|
|||||||
REntityServer entityServer = entityServerMap.computeIfAbsent(player, k -> {
|
REntityServer entityServer = entityServerMap.computeIfAbsent(player, k -> {
|
||||||
REntityServer newEntityServer = new REntityServer();
|
REntityServer newEntityServer = new REntityServer();
|
||||||
newEntityServer.addPlayer(k);
|
newEntityServer.addPlayer(k);
|
||||||
newEntityServer.setCallback((p, rEntity, entityAction) -> {
|
|
||||||
if (entityAction != REntityServer.EntityAction.INTERACT)
|
|
||||||
return;
|
|
||||||
if (rEntity instanceof TraceEntity) {
|
|
||||||
((TraceEntity) rEntity).printIntoChat(p);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return newEntityServer;
|
return newEntityServer;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
+5
-5
@@ -46,12 +46,10 @@ public class TraceManager implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void init() {
|
public void init() {
|
||||||
if (!tracesFolder.exists())
|
if (!tracesFolder.exists()) tracesFolder.mkdir();
|
||||||
tracesFolder.mkdir();
|
|
||||||
|
|
||||||
File[] traceFiles = tracesFolder.listFiles();
|
File[] traceFiles = tracesFolder.listFiles();
|
||||||
if (traceFiles == null)
|
if (traceFiles == null) return;
|
||||||
return;
|
|
||||||
|
|
||||||
boolean hasMetaFiles = false;
|
boolean hasMetaFiles = false;
|
||||||
for (File traceFile : traceFiles) {
|
for (File traceFile : traceFiles) {
|
||||||
@@ -152,7 +150,9 @@ public class TraceManager implements Listener {
|
|||||||
.map(Map.Entry::getKey)
|
.map(Map.Entry::getKey)
|
||||||
.findFirst()
|
.findFirst()
|
||||||
.orElse(null);
|
.orElse(null);
|
||||||
if (traceId == null) throw new RuntimeException("Trace not found while trying to remove see (c978eb98-b0b2-4009-91d8-acfa34e2831a)");
|
if (traceId == null) {
|
||||||
|
throw new RuntimeException("Trace not found while trying to remove see (c978eb98-b0b2-4009-91d8-acfa34e2831a)");
|
||||||
|
}
|
||||||
traces.remove(traceId);
|
traces.remove(traceId);
|
||||||
trace.hide();
|
trace.hide();
|
||||||
trace.getRecordsSaveFile().delete();
|
trace.getRecordsSaveFile().delete();
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user