-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #54 from PhantazmNetwork/dev
Dev --> Main
- Loading branch information
Showing
429 changed files
with
10,983 additions
and
3,198 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,24 @@ | ||
name: Test PhantazmServer | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
pull_request: | ||
branches: [ main ] | ||
push: | ||
branches: [ main ] | ||
pull_request: | ||
branches: [ main ] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up JDK 17 | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: 17 | ||
cache: 'gradle' | ||
distribution: 'adopt' | ||
- name: Run tests | ||
run: ./gradlew test | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
submodules: 'recursive' | ||
- name: Set up JDK 17 | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: 17 | ||
cache: 'gradle' | ||
distribution: 'adopt' | ||
- name: Run tests | ||
run: ./gradlew test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,12 @@ | ||
<component name="ProjectRunConfigurationManager"> | ||
<configuration default="false" name="Run Velocity" type="JarApplication"> | ||
<option name="JAR_PATH" value="$PROJECT_DIR$/run/velocity/velocity.jar"/> | ||
<option name="VM_PARAMETERS" | ||
value="-Xms512M -Xmx512M -XX:+UseG1GC -XX:G1HeapRegionSize=4M -XX:+UnlockExperimentalVMOptions -XX:+ParallelRefProcEnabled -XX:+AlwaysPreTouch -Dfile.encoding=UTF-8"/> | ||
<option name="WORKING_DIRECTORY" value="$ProjectFileDir$\run\velocity"/> | ||
<option name="ALTERNATIVE_JRE_PATH"/> | ||
<method v="2"> | ||
<option name="Gradle.BeforeRunTask" enabled="false" tasks="setupServer" | ||
externalProjectPath="$PROJECT_DIR$/server" vmOptions="" scriptParameters=""/> | ||
<option name="Gradle.BeforeRunTask" enabled="true" tasks="copyJar" | ||
externalProjectPath="$PROJECT_DIR$/velocity" vmOptions="" scriptParameters=""/> | ||
</method> | ||
</configuration> | ||
</component> | ||
<configuration default="false" name="Run Velocity" type="JarApplication"> | ||
<option name="JAR_PATH" value="$PROJECT_DIR$/run/velocity/velocity.jar" /> | ||
<option name="VM_PARAMETERS" value="-Xms512M -Xmx512M -XX:+UseG1GC -XX:G1HeapRegionSize=4M -XX:+UnlockExperimentalVMOptions -XX:+ParallelRefProcEnabled -XX:+AlwaysPreTouch -Dfile.encoding=UTF-8" /> | ||
<option name="WORKING_DIRECTORY" value="$ProjectFileDir$/run/velocity" /> | ||
<option name="ALTERNATIVE_JRE_PATH" /> | ||
<method v="2"> | ||
<option name="Gradle.BeforeRunTask" enabled="false" tasks="setupServer" externalProjectPath="$PROJECT_DIR$/server" vmOptions="" scriptParameters="" /> | ||
<option name="Gradle.BeforeRunTask" enabled="true" tasks="copyJar" externalProjectPath="$PROJECT_DIR$/velocity" vmOptions="" scriptParameters="" /> | ||
</method> | ||
</configuration> | ||
</component> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
<component name="ProjectRunConfigurationManager"> | ||
<configuration default="false" name="Run server" type="JarApplication"> | ||
<option name="JAR_PATH" value="$PROJECT_DIR$/run/server-1/server.jar" /> | ||
<option name="VM_PARAMETERS" value="-Dfile.encoding=UTF-8 -Dminestom.packet-queue-size=-1" /> | ||
<option name="VM_PARAMETERS" value="-Dfile.encoding=UTF-8 -Dminestom.packet-queue-size=-1 -Dminestom.keep-alive-kick=-1" /> | ||
<option name="PROGRAM_PARAMETERS" value="unsafe" /> | ||
<option name="WORKING_DIRECTORY" value="$ProjectFileDir$/run/server-1" /> | ||
<option name="ALTERNATIVE_JRE_PATH" /> | ||
<method v="2"> | ||
<option name="Gradle.BeforeRunTask" enabled="false" tasks="setupServer copyJar" externalProjectPath="$PROJECT_DIR$/server" vmOptions="" scriptParameters="-PskipBuild=zombies-mapeditor" /> | ||
<option name="Gradle.BeforeRunTask" enabled="false" tasks="setupServer copyJar" externalProjectPath="$PROJECT_DIR$/server" vmOptions="" scriptParameters="-PskipBuild=zombies-mapeditor,zombies-timer" /> | ||
</method> | ||
</configuration> | ||
</component> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
commons/src/main/java/org/phantazm/commons/TickableTask.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,38 @@ | ||
package org.phantazm.commons; | ||
|
||
import org.jetbrains.annotations.NotNull; | ||
|
||
public interface TickableTask extends Tickable { | ||
boolean isFinished(); | ||
|
||
default void end() { | ||
|
||
} | ||
|
||
static @NotNull TickableTask afterTicks(long ticks, @NotNull Runnable action, @NotNull Runnable endAction) { | ||
long start = System.currentTimeMillis(); | ||
return new TickableTask() { | ||
private boolean finished; | ||
|
||
@Override | ||
public boolean isFinished() { | ||
return finished; | ||
} | ||
|
||
@Override | ||
public void tick(long time) { | ||
if ((time - start) / 50 >= ticks) { | ||
finished = true; | ||
action.run(); | ||
} | ||
} | ||
|
||
@Override | ||
public void end() { | ||
if (!finished) { | ||
endAction.run(); | ||
} | ||
} | ||
}; | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
commons/src/main/java/org/phantazm/commons/chat/ChatDestination.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package org.phantazm.commons.chat; | ||
|
||
public enum ChatDestination { | ||
TITLE, | ||
SUBTITLE, | ||
CHAT, | ||
ACTION_BAR | ||
} |
8 changes: 8 additions & 0 deletions
8
commons/src/main/java/org/phantazm/commons/chat/MessageWithDestination.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package org.phantazm.commons.chat; | ||
|
||
import net.kyori.adventure.text.Component; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
public record MessageWithDestination(@NotNull Component component, @NotNull ChatDestination destination) { | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package org.phantazm.core; | ||
|
||
import net.kyori.adventure.text.Component; | ||
import net.kyori.adventure.text.minimessage.MiniMessage; | ||
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver; | ||
import net.minestom.server.item.ItemStack; | ||
import net.minestom.server.item.Material; | ||
import org.jetbrains.annotations.NotNull; | ||
import org.jetbrains.annotations.Nullable; | ||
import org.jglrxavpok.hephaistos.nbt.NBTCompound; | ||
import org.jglrxavpok.hephaistos.nbt.NBTException; | ||
import org.jglrxavpok.hephaistos.parser.SNBTParser; | ||
|
||
import java.io.StringReader; | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
public final class ItemStackUtils { | ||
public static @NotNull ItemStack buildItem(@NotNull Material material, @Nullable String tag, | ||
@Nullable String displayName, @Nullable List<String> lore, @NotNull TagResolver @NotNull ... tags) { | ||
ItemStack.Builder builder = ItemStack.builder(material); | ||
if (tag != null) { | ||
try { | ||
builder.meta((NBTCompound)new SNBTParser(new StringReader(tag)).parse()); | ||
} | ||
catch (NBTException ignored) { | ||
} | ||
} | ||
|
||
if (displayName != null) { | ||
builder.displayName(MiniMessage.miniMessage().deserialize(displayName, tags)); | ||
} | ||
|
||
if (lore != null) { | ||
List<Component> components = new ArrayList<>(lore.size()); | ||
for (String format : lore) { | ||
components.add(MiniMessage.miniMessage().deserialize(format, tags)); | ||
} | ||
builder.lore(components); | ||
} | ||
|
||
return builder.build(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package org.phantazm.core; | ||
|
||
import net.minestom.server.tag.Tag; | ||
|
||
import java.util.UUID; | ||
|
||
public final class Tags { | ||
public static final Tag<UUID> LAST_MELEE_HIT_TAG = Tag.UUID("last_melee_hit"); | ||
} |
Oops, something went wrong.