-
-
Notifications
You must be signed in to change notification settings - Fork 0
Create team system #214
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
PrinzPizza42
wants to merge
43
commits into
master
Choose a base branch
from
Create-team-system
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Create team system #214
Changes from 41 commits
Commits
Show all changes
43 commits
Select commit
Hold shift + click to select a range
472e534
created custom team class;
PrinzPizza42 d69287b
fixed and finished TeamsMainMenuGUI
PrinzPizza42 863c42e
fix MainMenuGUI name not showing actual page
PrinzPizza42 d09995f
implement TeamSettingsGUI
PrinzPizza42 e921fe2
finished color changer implementation
PrinzPizza42 328cebb
implement locking team settings
PrinzPizza42 51d86c5
finish TeamsMainMenuGUI teams implementation
PrinzPizza42 37c928c
team chest implementation;
PrinzPizza42 ce16f52
implement TeamPlayerSettingsGUI
PrinzPizza42 4c35fc6
implemented reloading mechanic for team menus to reload to everyone a…
PrinzPizza42 2476e18
safe teams in database;
PrinzPizza42 436deab
change locked state of team to unlocked when no operator is present a…
PrinzPizza42 a3c7127
save and read team enderchest content from and to DB
PrinzPizza42 45c6b9e
add fast access to team enderchest via command
PrinzPizza42 bffbba4
add claiming chunks for the team via TeamSettings
PrinzPizza42 20a8c02
cancel event of putting in items with enchants and send the player a …
PrinzPizza42 7583757
cancel event of putting in items with enchants and send the player a …
PrinzPizza42 079c5f5
Merge remote-tracking branch 'origin/Create-team-system' into Create-…
PrinzPizza42 283ad37
get and safe coordinates of protected team base
PrinzPizza42 8527255
create break and use block listener and cancel in protected areas fro…
PrinzPizza42 e2c1fa0
fix bug causing removal of members from team on plugin shutdown;
PrinzPizza42 8edf4cb
replace debug messages of team system with messages meant for the player
PrinzPizza42 25ba14b
bugfixes;
PrinzPizza42 8ba69ae
show the protected location in teamsmainmenu gui;
PrinzPizza42 2bde5dc
add option in config to change how big the claiming radius is
PrinzPizza42 fae4541
display the team name before the player name in the tab menu
PrinzPizza42 fcbe099
fix protected Location radius not getting saved anywhere
PrinzPizza42 47dce7b
fix protected Location radius not getting saved anywhere
PrinzPizza42 52f62f1
add shortcut for getting to your own team's settings
PrinzPizza42 67c003a
show the player the whole protected location via particles;
PrinzPizza42 2c65984
change detection of protected location when trying to claim one
PrinzPizza42 0a13177
fix bug
PrinzPizza42 70e55d9
Add sound effects for the menu interactions;
PrinzPizza42 09d7308
edit ReadMe
PrinzPizza42 d87afe9
fix
PrinzPizza42 97aebe5
Merge branch 'master' into Create-team-system
PrinzPizza42 794087f
Remove publish to repo
JonasFranke 6db3cc7
Update src/main/java/de/j/deathMinigames/main/HandlePlayers.java
PrinzPizza42 39d56e4
Update src/main/java/de/j/stationofdoom/teams/TeamCMD.java
PrinzPizza42 5143a93
fix
PrinzPizza42 3fde6ae
fix
PrinzPizza42 31210b9
fix
PrinzPizza42 dc56c73
resolved conflicts
PrinzPizza42 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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
15 changes: 15 additions & 0 deletions
15
src/main/java/de/j/deathMinigames/database/DBTeamMember.java
This file contains hidden or 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,15 @@ | ||
| package de.j.deathMinigames.database; | ||
|
|
||
| import java.util.UUID; | ||
|
|
||
| public class DBTeamMember { | ||
| public boolean isInTeam; | ||
| public UUID uuid; | ||
| public boolean isTeamOperator; | ||
|
|
||
| public DBTeamMember(boolean isInTeam, String uuid, boolean isTeamOperator) { | ||
| this.isInTeam = isInTeam; | ||
| this.uuid = UUID.fromString(uuid); | ||
| this.isTeamOperator = isTeamOperator; | ||
| } | ||
| } |
This file contains hidden or 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 hidden or 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
88 changes: 88 additions & 0 deletions
88
src/main/java/de/j/deathMinigames/database/TeamEnderchestsDatabase.java
This file contains hidden or 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,88 @@ | ||
| package de.j.deathMinigames.database; | ||
|
|
||
| import de.chojo.sadu.queries.api.call.Call; | ||
| import de.chojo.sadu.queries.api.query.Query; | ||
| import de.chojo.sadu.queries.call.adapter.UUIDAdapter; | ||
| import de.j.stationofdoom.main.Main; | ||
| import de.j.stationofdoom.teams.Team; | ||
| import de.j.stationofdoom.teams.TeamsMainMenuGUI; | ||
| import net.kyori.adventure.text.Component; | ||
| import org.bukkit.Bukkit; | ||
| import org.bukkit.Material; | ||
| import org.bukkit.inventory.Inventory; | ||
| import org.bukkit.inventory.ItemStack; | ||
| import org.bukkit.inventory.meta.ItemMeta; | ||
|
|
||
| import java.util.UUID; | ||
|
|
||
| public class TeamEnderchestsDatabase { | ||
| private static volatile TeamEnderchestsDatabase instance; | ||
|
|
||
| public TeamEnderchestsDatabase() {} | ||
|
|
||
| public static TeamEnderchestsDatabase getInstance() { | ||
| if (instance == null) { | ||
| synchronized (TeamEnderchestsDatabase.class) { | ||
| if (instance == null) { | ||
| instance = new TeamEnderchestsDatabase(); | ||
| } | ||
| } | ||
| } | ||
| return instance; | ||
| } | ||
|
|
||
| public void createTable() { | ||
| if(!Database.getInstance().isConnected) return; | ||
| Query.query("CREATE TABLE IF NOT EXISTS teamEnderchests (uuidOfTeam VARCHAR(255), name VARCHAR(255), amount INTEGER, material VARCHAR(255));") | ||
| .single() | ||
| .insert(); | ||
| } | ||
|
|
||
| public Inventory getTeamEnderchest(UUID uuidOfTeam) { | ||
| Inventory inv = Bukkit.createInventory(null, 27, "Team Enderchest"); | ||
| if(!Database.getInstance().isConnected) return inv; | ||
| Query.query("SELECT * FROM teamEnderchests WHERE uuidOfTeam = ?;") | ||
| .single(Call.of() | ||
| .bind(uuidOfTeam, UUIDAdapter.AS_STRING)) | ||
| .map(row -> { | ||
| ItemStack itemStack; | ||
| try { | ||
| itemStack = new ItemStack(Material.valueOf(row.getString("material")), row.getInt("amount")); | ||
| ItemMeta itemMeta = itemStack.getItemMeta(); | ||
| if(row.getString("name") != null && !row.getString("name").isEmpty()) itemMeta.displayName(Component.text(row.getString("name"))); | ||
| itemStack.setItemMeta(itemMeta); | ||
| } | ||
| catch (NullPointerException e) { | ||
| Main.getMainLogger().warning("Could not find material of " + row.getString("material") + " in team enderchests of team " + uuidOfTeam); | ||
| itemStack = new ItemStack(Material.STONE, 1); | ||
| itemStack.getItemMeta().displayName(Component.text("Could not find material of " + row.getString("material"))); | ||
| } | ||
| inv.addItem(itemStack); | ||
| return itemStack; | ||
| }) | ||
| .all(); | ||
| return inv; | ||
PrinzPizza42 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| } | ||
|
|
||
| public void updateTeamEnderchestsOfAllTeams() { | ||
| if(!Database.getInstance().isConnected) return; | ||
| for (Team team : TeamsMainMenuGUI.teams) { | ||
| UUID uuidOfTeam = team.getUuid(); | ||
| Query.query("DELETE FROM teamEnderchests WHERE uuidOfTeam = ?;") | ||
| .single(Call.of() | ||
| .bind(uuidOfTeam, UUIDAdapter.AS_STRING)) | ||
| .delete(); | ||
| if(team.inventory == null) continue; | ||
| for (ItemStack itemStack : team.inventory.getContents()) { | ||
| if(itemStack == null) continue; | ||
| Query.query("INSERT INTO teamEnderchests (uuidOfTeam, name, amount, material) VALUES (?, ?, ?, ?);") | ||
| .single(Call.of() | ||
| .bind(uuidOfTeam, UUIDAdapter.AS_STRING) | ||
| .bind(itemStack.getItemMeta().displayName() != null ? itemStack.getItemMeta().getDisplayName() : null) | ||
| .bind(itemStack.getAmount()) | ||
| .bind(itemStack.getType().toString())) | ||
| .insert(); | ||
| } | ||
| } | ||
| } | ||
PrinzPizza42 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.