-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
127 additions
and
17 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
48 changes: 48 additions & 0 deletions
48
src/main/java/me/lrxh/practice/commands/admin/general/FollowCommand.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,48 @@ | ||
package me.lrxh.practice.commands.admin.general; | ||
|
||
import co.aikar.commands.BaseCommand; | ||
import co.aikar.commands.annotation.*; | ||
import me.lrxh.practice.Locale; | ||
import me.lrxh.practice.profile.Profile; | ||
import me.lrxh.practice.util.CC; | ||
import org.bukkit.Bukkit; | ||
import org.bukkit.entity.Player; | ||
|
||
@CommandAlias("follow") | ||
@Description("Follow a player.") | ||
@CommandPermission("practice.admin.follow") | ||
public class FollowCommand extends BaseCommand { | ||
|
||
|
||
@Default | ||
@Syntax("<name>") | ||
@CommandCompletion("@names") | ||
public void pingOthers(Player player, String otherPlayer) { | ||
if (Bukkit.getPlayer(otherPlayer) == null) { | ||
player.sendMessage(CC.translate("&4ERROR - &cPlayer isn't online!")); | ||
return; | ||
} | ||
if (Bukkit.getPlayer(otherPlayer).equals(player)) { | ||
player.sendMessage(CC.translate("&4ERROR - &cYou can't follow yourself!")); | ||
return; | ||
} | ||
Profile playerProfile = Profile.getProfiles().get(player.getUniqueId()); | ||
if (!playerProfile.getFollowing().isEmpty() && !playerProfile.getFollowing().contains(player.getUniqueId())) { | ||
player.sendMessage(CC.translate("&4ERROR - &cYou can't follow multiple players!")); | ||
return; | ||
} | ||
|
||
Player otherP = Bukkit.getPlayer(otherPlayer); | ||
Profile profile = Profile.getProfiles().get(otherP.getUniqueId()); | ||
|
||
if (profile.getFollowers().contains(player.getUniqueId())) { | ||
profile.getFollowers().remove(player.getUniqueId()); | ||
playerProfile.getFollowing().remove(otherP.getUniqueId()); | ||
player.sendMessage(Locale.FOLLOW_END.format(player, otherP.getName())); | ||
} else { | ||
profile.getFollowers().add(player.getUniqueId()); | ||
playerProfile.getFollowing().add(otherP.getUniqueId()); | ||
player.sendMessage(Locale.FOLLOW_START.format(player, otherP.getName())); | ||
} | ||
} | ||
} |
11 changes: 4 additions & 7 deletions
11
src/main/java/me/lrxh/practice/commands/admin/general/SilentCommand.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
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 |
---|---|---|
|
@@ -27,6 +27,7 @@ public MatchLogicTask(Match match) { | |
} | ||
} | ||
|
||
|
||
@Override | ||
public void run() { | ||
nextAction--; | ||
|
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