forked from Cyberbit-7/teamcmd
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add set home and home command + sonarqube action
- Loading branch information
Showing
13 changed files
with
219 additions
and
16 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
name: Build | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
types: [opened, synchronize, reopened] | ||
|
||
jobs: | ||
build: | ||
name: Build and analyze | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis | ||
- name: Set up JDK 17 | ||
uses: actions/setup-java@v1 | ||
with: | ||
java-version: 17 | ||
- name: Cache SonarQube packages | ||
uses: actions/cache@v1 | ||
with: | ||
path: ~/.sonar/cache | ||
key: ${{ runner.os }}-sonar | ||
restore-keys: ${{ runner.os }}-sonar | ||
- name: Cache Gradle packages | ||
uses: actions/cache@v1 | ||
with: | ||
path: ~/.gradle/caches | ||
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }} | ||
restore-keys: ${{ runner.os }}-gradle | ||
- name: Build and analyze | ||
env: | ||
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | ||
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }} | ||
run: ./gradlew build sonar --info |
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 |
---|---|---|
|
@@ -34,4 +34,3 @@ run/ | |
img/ | ||
|
||
# ignore github workflow for now, might use later | ||
.github/ |
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 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
2 changes: 1 addition & 1 deletion
2
...java/io/github/beabfc/teamcmd/Config.java → ...va/io/github/PasVegan/teamcmd/Config.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
3 changes: 2 additions & 1 deletion
3
...io/github/beabfc/teamcmd/TeamCommand.java → .../github/PasVegan/teamcmd/TeamCommand.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
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,71 @@ | ||
package io.github.PasVegan.teamcmd; | ||
|
||
import net.fabricmc.loader.api.FabricLoader; | ||
import net.minecraft.util.math.Vec2f; | ||
import net.minecraft.util.math.Vec3d; | ||
|
||
import java.io.*; | ||
import java.util.HashMap; | ||
|
||
public class TeamHomes implements Serializable { | ||
private final HashMap<String, TeamHome> homes = new HashMap<>(); | ||
|
||
public static TeamHomes load(String fileName) { | ||
try { | ||
File dataFile = FabricLoader.getInstance().getConfigDir().resolve(fileName).toFile(); | ||
if (dataFile.exists()) { | ||
FileInputStream fileIn = new FileInputStream(dataFile); | ||
ObjectInputStream objectIn = new ObjectInputStream(fileIn); | ||
TeamHomes teamHomes = (TeamHomes) objectIn.readObject(); | ||
objectIn.close(); | ||
fileIn.close(); | ||
return teamHomes; | ||
} else { | ||
return new TeamHomes(); | ||
} | ||
} catch (Exception ex) { | ||
throw new RuntimeException(ex); | ||
} | ||
} | ||
|
||
public void save(String fileName) { | ||
try { | ||
File dataFile = FabricLoader.getInstance().getConfigDir().resolve(fileName).toFile(); | ||
FileOutputStream fileOut = new FileOutputStream(dataFile); | ||
ObjectOutputStream objectOut = new ObjectOutputStream(fileOut); | ||
objectOut.writeObject(this); | ||
objectOut.close(); | ||
fileOut.close(); | ||
} catch (IOException ex) { | ||
throw new RuntimeException(ex); | ||
} | ||
} | ||
|
||
public TeamHome getHome(String teamName) { | ||
return homes.get(teamName); | ||
} | ||
|
||
public void setHome(String teamName, Vec3d position, Vec2f rotation, int dimension) { | ||
TeamHome home = new TeamHome(); | ||
home.posX = position.x; | ||
home.posY = position.y; | ||
home.posZ = position.z; | ||
home.pitch = rotation.x; | ||
home.yaw = rotation.y; | ||
home.dimension = dimension; | ||
homes.put(teamName, home); | ||
} | ||
|
||
public void deleteTeamHome(String teamName) { | ||
homes.remove(teamName); | ||
} | ||
|
||
public static class TeamHome implements Serializable { | ||
public double posX; | ||
public double posY; | ||
public double posZ; | ||
public float yaw; | ||
public float pitch; | ||
public int dimension; | ||
} | ||
} |
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 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,19 @@ | ||
{ | ||
"commands.teamcmd.fail.in_team": "Vous êtes déjà dans une équipe", | ||
"commands.teamcmd.fail.no_team": "Vous n'êtes dans aucune équipe", | ||
"commands.teamcmd.fail.already_teammate": "Ce joueur est déjà dans votre équipe", | ||
"commands.teamcmd.fail.not_invited": "Vous n'êtes invité dans aucune équipe", | ||
"commands.teamcmd.invite.success": "%s à été invité a rejoindre votre équipe", | ||
"commands.teamcmd.invite": "%s vous à invité a rejoindre l'équipe %s", | ||
"commands.teamcmd.teammates.invite": "%s à invité %s dans votre équipe", | ||
"commands.teamcmd.joined": "Vous avez rejoint l'équipe %s", | ||
"commands.teamcmd.teammates.joined": "%s à rejoint votre équipe", | ||
"commands.teamcmd.left": "Vous avez quitté l'équipe %s", | ||
"commands.teamcmd.teammates.left": "%s à quitté votre équipe", | ||
"commands.teamcmd.invite_expired": "Votre invitation pour rejoindre l'équipe %s à expiré", | ||
"commands.teamcmd.fail.duplicate_color": "Une équipe avec cette couleur existe déjà", | ||
"commands.teamcmd.teamates.created_home": "%s à défini une nouvelle demeure pour votre équipe", | ||
"commands.teamcmd.created_home": "Vous avez défini une nouvelle demeure pour votre équipe", | ||
"commands.teamcmd.tp_to_home": "Téléportation à la demeure de votre équipe", | ||
"commands.teamcmd.fail.tp_to_home": "Votre équipe n'a pas de demeure" | ||
} |
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