Skip to content
This repository was archived by the owner on Oct 2, 2024. It is now read-only.

Commit 8d74ccb

Browse files
igoyekvLuckyyy
andauthored
GH-41 Some style fixes (#41)
* Some style fixes * Fix * Update gradle.yml --------- Co-authored-by: Martin Sulikowski <[email protected]>
1 parent 0dd9a09 commit 8d74ccb

File tree

9 files changed

+42
-42
lines changed

9 files changed

+42
-42
lines changed

.github/workflows/gradle.yml

Lines changed: 24 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,3 @@
1-
# This workflow uses actions that are not certified by GitHub.
2-
# They are provided by a third-party and are governed by
3-
# separate terms of service, privacy policy, and support
4-
# documentation.
5-
# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time
6-
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-gradle
7-
81
name: Java CI with Gradle
92

103
on:
@@ -13,22 +6,33 @@ on:
136
pull_request:
147
branches: [ "master" ]
158

16-
permissions:
17-
contents: read
18-
199
jobs:
2010
build:
2111

2212
runs-on: ubuntu-latest
2313

2414
steps:
25-
- uses: actions/checkout@v3
26-
- name: Set up JDK 11
27-
uses: actions/setup-java@v3
28-
with:
29-
java-version: '11'
30-
distribution: 'temurin'
31-
- name: Build with Gradle
32-
uses: gradle/gradle-build-action@1b2daf58338ede8c62b0fa54355d1f515f659ad8
33-
with:
34-
arguments: build
15+
- uses: actions/checkout@v3
16+
- name: Set up JDK 17
17+
uses: actions/setup-java@v3
18+
with:
19+
java-version: '17'
20+
distribution: 'temurin'
21+
cache: gradle
22+
- uses: actions/cache@v3
23+
with:
24+
path: |
25+
~/.gradle/caches
26+
~/.gradle/wrapper
27+
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
28+
restore-keys: |
29+
${{ runner.os }}-gradle-
30+
- name: Grant execute permission for gradlew
31+
run: chmod +x gradlew
32+
- name: Build with Gradle
33+
run: ./gradlew clean shadowJar
34+
- name: Upload a Build Artifact
35+
uses: actions/[email protected]
36+
with:
37+
name: 'EternalFriends.jar'
38+
path: build/libs/EternalFriends*

src/main/java/com/eternalcode/friends/command/handler/InvalidUsage.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public InvalidUsage(MessagesConfig messages, NotificationAnnouncer announcer) {
1919

2020
@Override
2121
public void handle(CommandSender sender, LiteInvocation invocation, Schematic schematic) {
22-
schematic.getSchematics().stream().forEach(str -> {
22+
schematic.getSchematics().forEach(str -> {
2323
this.announcer.announceMessage(sender, str);
2424
});
2525

src/main/java/com/eternalcode/friends/command/implementation/FriendIgnoreCommand.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public void ignore(Player sender, @Arg @Name("player") Player target) {
4343
if (this.friendManager.isIgnoredByPlayer(targetUuid, senderUuid)) {
4444
this.friendManager.removeIgnoredPlayer(senderUuid, targetUuid);
4545

46-
this.announcer.announceMessage(senderUuid, friendsConfig.youUnignoredPlayer.replace("{player}", target.getName()));
46+
this.announcer.announceMessage(senderUuid, friendsConfig.playerNoLongerIgnored.replace("{player}", target.getName()));
4747

4848
return;
4949
}

src/main/java/com/eternalcode/friends/command/implementation/FriendInviteCommand.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public void invite(Player sender, @Arg @Name("player") Player target) {
4343
}
4444

4545
if (this.friendManager.isIgnoredByPlayer(senderUuid, targetUuid)) {
46-
this.announcer.announceMessage(senderUuid, friendsConfig.youreIgnored);
46+
this.announcer.announceMessage(senderUuid, friendsConfig.cannotSendInvite);
4747

4848
return;
4949
}
@@ -54,12 +54,12 @@ public void invite(Player sender, @Arg @Name("player") Player target) {
5454
return;
5555
}
5656

57-
if (inviteManager.hasReceivedInvite(targetUuid, senderUuid) || this.inviteManager.hasSendedInvite(targetUuid, senderUuid)) {
57+
if (inviteManager.hasReceivedInvite(targetUuid, senderUuid) || this.inviteManager.hasSentInvite(targetUuid, senderUuid)) {
5858
this.announcer.announceMessage(senderUuid, friendsConfig.alreadyReceivedInvite);
5959

6060
return;
6161
}
62-
if (inviteManager.hasSendedInvite(senderUuid, targetUuid) || this.inviteManager.hasReceivedInvite(senderUuid, targetUuid)) {
62+
if (inviteManager.hasSentInvite(senderUuid, targetUuid) || this.inviteManager.hasReceivedInvite(senderUuid, targetUuid)) {
6363
this.announcer.announceMessage(senderUuid, friendsConfig.alreadySentInvite);
6464

6565
return;

src/main/java/com/eternalcode/friends/config/implementation/MessagesConfig.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public static class Friends {
3131
public String chatFormat = "&9[FRIENDS] &f{player} &8» &7{message}";
3232
public String inviteSent = "&aInvitation to friends sent to player &f{invited}";
3333
public String inviteReceived = "&aYou have received a friend request from player &f{player}&a. To accept it, use the command <hover:show_text:\"/friends accept {player}\"><click:suggest_command:/friends accept {player}>&7/friends accept {player} &8[click]</click></hover>, &cor to decline it, use the command <hover:show_text:\"/friends deny {player}\"><click:suggest_command:/friends deny {player}>&7/friends deny {player} &8[click]</click></hover>.";
34-
public String youreIgnored = "&cYou cannot send invitation to this player!";
34+
public String cannotSendInvite = "&cYou cannot send invitation to this player!";
3535
public String emptyFriendList = "&cYou have no friends :(";
3636
public String emptyFriendListAdmin = "&cThis player has no friends.";
3737
public String acceptedInvite = "&aYou accepted a friend request from player &f{player}";
@@ -50,9 +50,9 @@ public static class Friends {
5050
public String inviteInstruction = "&aTo send a friend request, use the command &7/friends invite {player_name}";
5151
public String configReloaded = "&aConfiguration successfully reloaded!";
5252
public String inviteDenied = "&cYou declined the friend request from player &7{player}";
53-
public String yourInvitationHasBeenDenied = "&cYour inivtation to &7{player} &chas been denied.";
53+
public String yourInvitationHasBeenDenied = "&cYour invitation to &7{player} &chas been denied.";
5454
public String youIgnoredPlayer = "&cYou will no longer receive friend requests from player &7{player}";
55-
public String youUnignoredPlayer = "&aYou can now receive friend requests from player &7{player} again.";
55+
public String playerNoLongerIgnored = "&aYou can now receive friend requests from player &7{player} again.";
5656
public String inviteExpired = "&cThe friend request from this player has expired!";
5757
public String friendJoined = "&9{friend} &ahas joined the server!";
5858
public List<String> helpCommand = List.of(

src/main/java/com/eternalcode/friends/config/implementation/PluginConfig.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ public Resource resource(File folder) {
2020
@Description("# Configuration of Database")
2121
public Database database = new Database();
2222

23-
@Description("# Color of player's nametag displayed to his friends")
23+
@Description("# Color of player's name tag displayed to his friends")
2424
public ChatColor friendColor = ChatColor.BLUE;
2525

2626
@Description("# Does server should message displayed to player when his friend joins the server?")
27-
public boolean anounceFriendJoin = true;
27+
public boolean announceFriendJoin = true;
2828

2929
@Description("# Configuration of command and subcommands names")
3030
public Command friendCommand = new Command();
@@ -47,7 +47,6 @@ public static class SubCommand {
4747
public String list = "list";
4848
public String help = "help";
4949
public String ignore = "ignore";
50-
public String reload = "reload";
5150
}
5251

5352
@Contextual

src/main/java/com/eternalcode/friends/invite/InviteManager.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,14 +72,14 @@ public void removeInvite(UUID from, UUID to) {
7272
if (hasReceivedInvite(from, to)) {
7373
this.receivedInvites.get(to).removeIf(invite -> invite.getFrom().equals(from));
7474
}
75-
if (hasSendedInvite(from, to)) {
75+
if (hasSentInvite(from, to)) {
7676
this.sentInvites.get(from).removeIf(invite -> invite.getTo().equals(to));
7777
}
7878

7979
this.inviteDatabaseService.removeInvite(from, to);
8080
}
8181

82-
public boolean hasSendedInvite(UUID from, UUID to) {
82+
public boolean hasSentInvite(UUID from, UUID to) {
8383
if (!this.sentInvites.containsKey(from)) {
8484
return false;
8585
}

src/main/java/com/eternalcode/friends/listener/AnnounceJoinListener.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,12 @@ public AnnounceJoinListener(PluginConfig pluginConfig, MessagesConfig messagesCo
2727

2828
@EventHandler
2929
public void onJoin(PlayerJoinEvent event) {
30-
if (this.pluginConfig.anounceFriendJoin) {
31-
this.anounceToFriends(event.getPlayer());
30+
if (this.pluginConfig.announceFriendJoin) {
31+
this.announceToFriends(event.getPlayer());
3232
}
3333
}
3434

35-
private void anounceToFriends(Player player) {
35+
private void announceToFriends(Player player) {
3636
UUID playerUUID = player.getUniqueId();
3737

3838
for (UUID friendUuid : this.friendManager.getFriends(playerUUID)) {

src/main/java/com/eternalcode/friends/listener/EntityDamageByEntityListener.java

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,14 @@ public EntityDamageByEntityListener(FriendManager friendManager) {
1616

1717
@EventHandler
1818
public void onDamage(EntityDamageByEntityEvent event) {
19-
if (!(event.getDamager() instanceof Player)) {
19+
if (!(event.getDamager() instanceof Player attacker)) {
2020
return;
2121
}
22-
if (!(event.getEntity() instanceof Player)) {
22+
if (!(event.getEntity() instanceof Player damaged)) {
2323
return;
2424
}
2525

26-
Player damager = (Player) event.getDamager();
27-
Player damaged = (Player) event.getEntity();
28-
29-
if (this.friendManager.areFriends(damager.getUniqueId(), damaged.getUniqueId())) {
26+
if (this.friendManager.areFriends(attacker.getUniqueId(), damaged.getUniqueId())) {
3027
event.setDamage(0D);
3128
}
3229
}

0 commit comments

Comments
 (0)