Skip to content
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

[DONE] Small but helpful additions & fixes #916

Open
wants to merge 8 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ public class BedWars extends JavaPlugin {

private static ServerType serverType = ServerType.MULTIARENA;
public static boolean debug = true, autoscale = false;
public static String mainCmd = "bw", link = "https://www.spigotmc.org/resources/50942/";
public static String mainCmd = "bw", link = "https://www.spigotmc.org/resources/97320/";
public static ConfigManager signs, generators;
public static MainConfig config;
public static ShopManager shop;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -861,9 +861,12 @@ public void removePlayer(@NotNull Player p, boolean disconnect) {
Language lang = Language.getPlayerLanguage(inGame);
inGame.sendMessage(event.getMessage().apply(inGame)
.replace("{PlayerTeamName}", team.getDisplayName(lang))
.replace("{PlayerColor}", team.getColor().chat().toString()).replace("{PlayerName}", p.getDisplayName())
.replace("{PlayerColor}", team.getColor().chat().toString())
.replace("{PlayerName}", p.getDisplayName())
.replace("{PlayerNameUnformatted}", p.getName())
.replace("{KillerColor}", killerTeam.getColor().chat().toString())
.replace("{KillerName}", lastDamager.getDisplayName())
.replace("{KillerNameUnformatted}", lastDamager.getName())
.replace("{KillerTeamName}", killerTeam.getDisplayName(lang)));
}
}
Expand All @@ -873,9 +876,12 @@ public void removePlayer(@NotNull Player p, boolean disconnect) {
Language lang = Language.getPlayerLanguage(inGame);
inGame.sendMessage(event.getMessage().apply(inGame)
.replace("{PlayerTeamName}", team.getDisplayName(lang))
.replace("{PlayerColor}", team.getColor().chat().toString()).replace("{PlayerName}", p.getDisplayName())
.replace("{PlayerColor}", team.getColor().chat().toString())
.replace("{PlayerName}", p.getDisplayName())
.replace("{PlayerNameUnformatted}", p.getName())
.replace("{KillerColor}", killerTeam.getColor().chat().toString())
.replace("{KillerName}", lastDamager.getDisplayName())
.replace("{KillerNameUnformatted}", lastDamager.getName())
.replace("{KillerTeamName}", killerTeam.getDisplayName(lang)));
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
package com.andrei1058.bedwars.commands.party;

import com.andrei1058.bedwars.api.language.Messages;
import com.andrei1058.bedwars.support.papi.SupportPAPI;
import net.md_5.bungee.api.chat.ClickEvent;
import net.md_5.bungee.api.chat.TextComponent;
import org.bukkit.Bukkit;
Expand All @@ -43,7 +44,7 @@ public PartyCommand(String name) {
}

//owner, target
private static HashMap<UUID, UUID> partySessionRequest = new HashMap<>();
private static final HashMap<UUID, UUID> partySessionRequest = new HashMap<>();

@Override
public boolean execute(CommandSender s, String c, String[] args) {
Expand All @@ -63,19 +64,20 @@ public boolean execute(CommandSender s, String c, String[] args) {
p.sendMessage(getMsg(p, Messages.COMMAND_PARTY_INSUFFICIENT_PERMISSIONS));
return true;
}
if (Bukkit.getPlayer(args[1]) != null && Bukkit.getPlayer(args[1]).isOnline()) {
if (p == Bukkit.getPlayer(args[1])) {
Player invited = Bukkit.getPlayer(args[1]);
if (invited != null && invited.isOnline()) {
if (p == invited) {
p.sendMessage(getMsg(p, Messages.COMMAND_PARTY_INVITE_DENIED_CANNOT_INVITE_YOURSELF));
return true;
}
p.sendMessage(getMsg(p, Messages.COMMAND_PARTY_INVITE_SENT).replace("{playername}", p.getName()).replace("{player}", args[1]));
p.sendMessage(SupportPAPI.getSupportPAPI().replace(p, getMsg(p, Messages.COMMAND_PARTY_INVITE_SENT).replace("{playername}", p.getName()).replace("{player}", invited.getName())));
TextComponent tc = new TextComponent(getMsg(p, Messages.COMMAND_PARTY_INVITE_SENT_TARGET_RECEIVE_MSG).replace("{player}", p.getName()));
tc.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/party accept " + p.getName()));
Bukkit.getPlayer(args[1]).spigot().sendMessage(tc);
invited.spigot().sendMessage(tc);
if (partySessionRequest.containsKey(p.getUniqueId())) {
partySessionRequest.replace(p.getUniqueId(), Bukkit.getPlayer(args[1]).getUniqueId());
partySessionRequest.replace(p.getUniqueId(), invited.getUniqueId());
} else {
partySessionRequest.put(p.getUniqueId(), Bukkit.getPlayer(args[1]).getUniqueId());
partySessionRequest.put(p.getUniqueId(), invited.getUniqueId());
}
} else {
p.sendMessage(getMsg(p, Messages.COMMAND_PARTY_INVITE_DENIED_PLAYER_OFFLINE).replace("{player}", args[1]));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,14 @@ public String onPlaceholderRequest(Player player, @NotNull String s) {
response = String.valueOf(a.getPlayers().size());
}
break;
case "player_team_letter":
if (a != null && a.isPlayer(player) && a.getStatus() == GameState.playing) {
ITeam team = a.getTeam(player);
if (team != null) {
response = String.valueOf(team.getName().charAt(0));
iiAhmedYT marked this conversation as resolved.
Show resolved Hide resolved
}
}
break;
case "player_team_color":
if (a != null && a.isPlayer(player) && a.getStatus() == GameState.playing) {
ITeam team = a.getTeam(player);
Expand Down
Loading