-
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.
Chat notifs on the actionbar, qol, bugs
- Loading branch information
Showing
6 changed files
with
64 additions
and
29 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
38 changes: 18 additions & 20 deletions
38
src/main/java/systems/joey/manhunt/commands/ManhuntCommand.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,41 +1,39 @@ | ||
package systems.joey.manhunt.commands; | ||
|
||
import org.bukkit.ChatColor; | ||
import org.bukkit.Material; | ||
import org.bukkit.command.Command; | ||
import org.bukkit.command.CommandExecutor; | ||
import org.bukkit.command.CommandSender; | ||
import org.bukkit.entity.Item; | ||
import org.bukkit.entity.Player; | ||
import org.bukkit.inventory.ItemStack; | ||
import systems.joey.manhunt.Manhunt; | ||
|
||
import systems.joey.manhunt.listeners.RespawnListeners; | ||
public class ManhuntCommand implements CommandExecutor { | ||
private final Manhunt plugin; | ||
|
||
public ManhuntCommand(Manhunt plugin) { | ||
this.plugin = plugin; | ||
} | ||
|
||
@Override | ||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { | ||
if (args.length == 0) { | ||
sender.sendMessage(ChatColor.RED + "Please specify a player to start the manhunt"); | ||
if (args.length <= 0) { | ||
sender.sendMessage(ChatColor.RED + "Please specify a player to target to be able to start the manhunt"); | ||
return true; | ||
} | ||
if (sender instanceof Player player) { | ||
if (args.length == 1) { | ||
Player target = plugin.getServer().getPlayer(args[0]); | ||
if (target == null) { | ||
sender.sendMessage(ChatColor.RED + "Player not found"); | ||
return true; | ||
} | ||
plugin.setRunner(args[0]); | ||
player.sendMessage(ChatColor.GREEN + "Manhunt Started with target " + args[0]); | ||
for (Player onlinePlayer : plugin.getServer().getOnlinePlayers()) { | ||
if (onlinePlayer != target) { | ||
onlinePlayer.getInventory().addItem(new ItemStack(Material.COMPASS)); | ||
} | ||
Player target = plugin.getServer().getPlayer(args[0]); | ||
if (target == null) { | ||
sender.sendMessage(ChatColor.RED + "Player not found"); | ||
return true; | ||
} | ||
plugin.setRunner(args[0]); | ||
player.sendMessage(ChatColor.GREEN + "Manhunt Started with target " + args[0]); | ||
for (Player onlinePlayer : plugin.getServer().getOnlinePlayers()) { | ||
if (onlinePlayer != target) { | ||
RespawnListeners.givePlayerCompass(onlinePlayer, target); | ||
} | ||
} else return false; | ||
} | ||
} | ||
return true; | ||
} | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
src/main/java/systems/joey/manhunt/commands/TestCommand.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,20 @@ | ||
package systems.joey.manhunt.commands; | ||
|
||
|
||
import net.md_5.bungee.api.chat.TextComponent; | ||
import org.bukkit.command.Command; | ||
import org.bukkit.command.CommandExecutor; | ||
import org.bukkit.command.CommandSender; | ||
import org.bukkit.entity.Player; | ||
import net.md_5.bungee.api.ChatMessageType; | ||
|
||
public class TestCommand implements CommandExecutor { | ||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { | ||
if (sender instanceof Player player) { | ||
player.setHealth(0); | ||
// player.sendTitle("Test", "Test", 10, 10, 10); | ||
// player.spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText("aaa")); | ||
} | ||
return true; | ||
} | ||
} |
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