Smart™ Tab Completion©®
This commit is contained in:
parent
e5ece844cb
commit
6692432c42
@ -4,13 +4,16 @@ import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.MiniPlugin;
|
||||
import mineplex.core.PlayerSelector;
|
||||
import mineplex.core.common.Rank;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.common.util.UtilLambda;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
|
||||
public abstract class CommandBase<PluginType extends MiniPlugin> implements ICommand
|
||||
@ -109,22 +112,12 @@ public abstract class CommandBase<PluginType extends MiniPlugin> implements ICom
|
||||
return matches;
|
||||
}
|
||||
|
||||
protected List<String> getPlayerMatches(Player sender, String start)
|
||||
protected List<String> tabCompletePlayerNames(CommandSender sender, String commandLabel, String[] args, boolean endsWithSpace)
|
||||
{
|
||||
List<String> matches = new ArrayList<>();
|
||||
|
||||
for (Player player : UtilServer.getPlayersCollection())
|
||||
{
|
||||
if (sender.canSee(player) && player.getName().toLowerCase().startsWith(start.toLowerCase()))
|
||||
{
|
||||
matches.add(player.getName());
|
||||
}
|
||||
}
|
||||
|
||||
return matches;
|
||||
return tabCompletePlayerNames(sender, commandLabel, args, endsWithSpace, t -> true);
|
||||
}
|
||||
|
||||
protected List<String> tabCompletePlayerNames(CommandSender sender, String commandLabel, String[] args, boolean endsWithSpace)
|
||||
protected List<String> tabCompletePlayerNames(CommandSender sender, String commandLabel, String[] args, boolean endsWithSpace, Predicate<Player> filter)
|
||||
{
|
||||
if (sender instanceof Player)
|
||||
{
|
||||
@ -132,12 +125,23 @@ public abstract class CommandBase<PluginType extends MiniPlugin> implements ICom
|
||||
{
|
||||
if (!endsWithSpace)
|
||||
{
|
||||
return getPlayerMatches((Player) sender, args[0]);
|
||||
return PlayerSelector.selectPlayers(
|
||||
UtilLambda.and(
|
||||
((Player) sender)::canSee,
|
||||
player -> player.getName().toLowerCase().startsWith(args[0]),
|
||||
filter
|
||||
)
|
||||
).stream().map(Player::getName).collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
else if (args.length == 0)
|
||||
{
|
||||
return getPlayerMatches((Player) sender, "");
|
||||
return PlayerSelector.selectPlayers(
|
||||
UtilLambda.and(
|
||||
((Player) sender)::canSee,
|
||||
filter
|
||||
)
|
||||
).stream().map(Player::getName).collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
return null;
|
||||
|
@ -12,8 +12,6 @@ import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
import org.bukkit.scheduler.BukkitTask;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
|
||||
import mineplex.core.MiniPlugin;
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.common.jsonchat.ChildJsonMessage;
|
||||
@ -468,6 +466,12 @@ public class PartyManager extends MiniPlugin
|
||||
return;
|
||||
}
|
||||
|
||||
if (playerTarget == caller)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Party", "You can't kick yourself!"));
|
||||
return;
|
||||
}
|
||||
|
||||
removeFromParty(playerTarget, PartyRemoveReason.KICKED);
|
||||
}
|
||||
|
||||
@ -492,8 +496,8 @@ public class PartyManager extends MiniPlugin
|
||||
return;
|
||||
}
|
||||
|
||||
removeFromParty(caller, PartyRemoveReason.LEFT);
|
||||
Lang.LEFT.send(caller);
|
||||
removeFromParty(caller, PartyRemoveReason.LEFT);
|
||||
}
|
||||
|
||||
public void removeFromParty(Player player, PartyRemoveReason reason)
|
||||
@ -514,6 +518,8 @@ public class PartyManager extends MiniPlugin
|
||||
}
|
||||
}
|
||||
|
||||
party.removeMember(player);
|
||||
|
||||
switch (reason)
|
||||
{
|
||||
case KICKED:
|
||||
@ -530,8 +536,6 @@ public class PartyManager extends MiniPlugin
|
||||
break;
|
||||
}
|
||||
|
||||
party.removeMember(player);
|
||||
|
||||
if (party.getMembers().size() == 0)
|
||||
{
|
||||
removeParty(party);
|
||||
@ -560,7 +564,13 @@ public class PartyManager extends MiniPlugin
|
||||
}
|
||||
|
||||
caller.sendMessage(F.main("Party", "You have disbanded your party."));
|
||||
Lang.DISBANDED_BY_OWNER.send(party);
|
||||
for (Player player : party.getMembers())
|
||||
{
|
||||
if (player != caller)
|
||||
{
|
||||
UtilPlayer.message(player, F.main("Party", "Your party has been disbanded!"));
|
||||
}
|
||||
}
|
||||
removeParty(party);
|
||||
}
|
||||
|
||||
|
@ -1,11 +1,18 @@
|
||||
package mineplex.core.party.command.cli;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.PlayerSelector;
|
||||
import mineplex.core.command.CommandBase;
|
||||
import mineplex.core.common.Rank;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilLambda;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.party.InviteData;
|
||||
import mineplex.core.party.Party;
|
||||
import mineplex.core.party.PartyManager;
|
||||
|
||||
@ -27,4 +34,27 @@ public class PartyAcceptCommand extends CommandBase<PartyManager>
|
||||
|
||||
Plugin.acceptInviteBySender(caller, args[0]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> onTabComplete(CommandSender sender, String commandLabel, String[] args, boolean endsWithSpace)
|
||||
{
|
||||
if (sender instanceof Player)
|
||||
{
|
||||
Player player = (Player) sender;
|
||||
|
||||
if (args.length == 1)
|
||||
{
|
||||
if (!endsWithSpace)
|
||||
{
|
||||
return getMatches(args[0], Plugin.getInviteManager().getAllInvites(player).stream().map(InviteData::getInviterName).collect(Collectors.toList()));
|
||||
}
|
||||
}
|
||||
else if (args.length == 0)
|
||||
{
|
||||
return Plugin.getInviteManager().getAllInvites(player).stream().map(InviteData::getInviterName).collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -1,11 +1,16 @@
|
||||
package mineplex.core.party.command.cli;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.command.CommandBase;
|
||||
import mineplex.core.common.Rank;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.party.InviteData;
|
||||
import mineplex.core.party.PartyManager;
|
||||
|
||||
public class PartyDenyCommand extends CommandBase<PartyManager>
|
||||
@ -25,4 +30,27 @@ public class PartyDenyCommand extends CommandBase<PartyManager>
|
||||
}
|
||||
Plugin.denyInviteBySender(caller, args[0]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> onTabComplete(CommandSender sender, String commandLabel, String[] args, boolean endsWithSpace)
|
||||
{
|
||||
if (sender instanceof Player)
|
||||
{
|
||||
Player player = (Player) sender;
|
||||
|
||||
if (args.length == 1)
|
||||
{
|
||||
if (!endsWithSpace)
|
||||
{
|
||||
return getMatches(args[0], Plugin.getInviteManager().getAllInvites(player).stream().map(InviteData::getInviterName).collect(Collectors.toList()));
|
||||
}
|
||||
}
|
||||
else if (args.length == 0)
|
||||
{
|
||||
return Plugin.getInviteManager().getAllInvites(player).stream().map(InviteData::getInviterName).collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -10,6 +10,7 @@ import mineplex.core.command.CommandBase;
|
||||
import mineplex.core.common.Rank;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.party.Party;
|
||||
import mineplex.core.party.PartyManager;
|
||||
|
||||
public class PartyInviteCommand extends CommandBase<PartyManager>
|
||||
@ -33,6 +34,14 @@ public class PartyInviteCommand extends CommandBase<PartyManager>
|
||||
@Override
|
||||
public List<String> onTabComplete(CommandSender sender, String commandLabel, String[] args, boolean endsWithSpace)
|
||||
{
|
||||
return tabCompletePlayerNames(sender, commandLabel, args, endsWithSpace);
|
||||
if (sender instanceof Player)
|
||||
{
|
||||
Player player = (Player) sender;
|
||||
Party party = Plugin.getPartyByPlayer(player);
|
||||
|
||||
return tabCompletePlayerNames(sender, commandLabel, args, endsWithSpace, other -> party == null || !party.isMember(other));
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -1,9 +1,14 @@
|
||||
package mineplex.core.party.command.cli;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.command.CommandBase;
|
||||
import mineplex.core.common.Rank;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.party.Party;
|
||||
import mineplex.core.party.PartyManager;
|
||||
|
||||
@ -18,12 +23,37 @@ public class PartyKickCommand extends CommandBase<PartyManager>
|
||||
public void Execute(Player caller, String[] args)
|
||||
{
|
||||
Party party = Plugin.getPartyByPlayer(caller);
|
||||
if (party != null)
|
||||
if (party == null)
|
||||
{
|
||||
if (party.getOwnerName().equals(caller.getName()))
|
||||
{
|
||||
Plugin.kickPlayer(caller, args[0]);
|
||||
}
|
||||
UtilPlayer.message(caller, F.main("Party", "You are not in a party!"));
|
||||
return;
|
||||
}
|
||||
if (args.length == 0)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Party", "I didn't quite catch that. Who are you kicking?"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (party.getOwnerName().equals(caller.getName()))
|
||||
{
|
||||
Plugin.kickPlayer(caller, args[0]);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> onTabComplete(CommandSender sender, String commandLabel, String[] args, boolean endsWithSpace)
|
||||
{
|
||||
if (sender instanceof Player)
|
||||
{
|
||||
Player player = (Player) sender;
|
||||
Party party = Plugin.getPartyByPlayer(player);
|
||||
|
||||
if (party != null && party.isOwner(player))
|
||||
{
|
||||
return tabCompletePlayerNames(sender, commandLabel, args, endsWithSpace, other -> other != player && party.isMember(other));
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,9 @@
|
||||
package mineplex.core.party.command.cli;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.command.CommandBase;
|
||||
@ -54,7 +57,30 @@ public class PartyTransferOwnerCommand extends CommandBase<PartyManager>
|
||||
return;
|
||||
}
|
||||
|
||||
if (player == caller)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Party", "You can't promote yourself!"));
|
||||
return;
|
||||
}
|
||||
|
||||
playerParty.setOwner(player);
|
||||
Lang.TRANSFER_OWNER.send(playerParty, caller.getName(), player.getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> onTabComplete(CommandSender sender, String commandLabel, String[] args, boolean endsWithSpace)
|
||||
{
|
||||
if (sender instanceof Player)
|
||||
{
|
||||
Player player = (Player) sender;
|
||||
Party party = Plugin.getPartyByPlayer(player);
|
||||
|
||||
if (party != null && party.isOwner(player))
|
||||
{
|
||||
return tabCompletePlayerNames(sender, commandLabel, args, endsWithSpace, other -> other != player && party.isMember(other));
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -41,6 +41,11 @@ public class PartyTransferOwnerMenu extends PlayerNameMenu
|
||||
Lang.NOT_MEMBER.send(_player, name);
|
||||
return;
|
||||
}
|
||||
if (player == _player)
|
||||
{
|
||||
UtilPlayer.message(_player, F.main("Party", "You can't promote yourself!"));
|
||||
return;
|
||||
}
|
||||
|
||||
_party.setOwner(player);
|
||||
Lang.TRANSFER_OWNER.send(_party, _player.getName(), name);
|
||||
|
@ -629,12 +629,20 @@ public class HubManager extends MiniClientPlugin<HubClient> implements IChatMess
|
||||
Party party = _partyManager.getPartyByPlayer(player);
|
||||
if (party != null)
|
||||
{
|
||||
event.getRecipients().clear();
|
||||
if (event.getMessage().length() > 1)
|
||||
{
|
||||
event.getRecipients().clear();
|
||||
|
||||
event.setMessage(event.getMessage().substring(1, event.getMessage().length()));
|
||||
event.setFormat(levelStr + C.cDPurple + C.Bold + "Party " + C.cWhite + C.Bold + playerName + " " + C.cPurple + "%2$s");
|
||||
event.setMessage(event.getMessage().substring(1, event.getMessage().length()).trim());
|
||||
event.setFormat(levelStr + C.cDPurple + C.Bold + "Party " + C.cWhite + C.Bold + playerName + " " + C.cPurple + "%2$s");
|
||||
|
||||
event.getRecipients().removeIf(other -> !party.getMembers().contains(other));
|
||||
event.getRecipients().removeIf(other -> !party.getMembers().contains(other));
|
||||
}
|
||||
else
|
||||
{
|
||||
UtilPlayer.message(player, F.main("Party", "Where's the message?"));
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -62,9 +62,9 @@ public class GameChatManager implements Listener
|
||||
{
|
||||
if (event.isCancelled() || event.getMessage().isEmpty())
|
||||
return;
|
||||
if(event.getMessage() == null)
|
||||
if (event.getMessage() == null)
|
||||
return;
|
||||
if(event.getMessage().trim().length() == 0)
|
||||
if (event.getMessage().trim().length() == 0)
|
||||
return;
|
||||
|
||||
Player sender = event.getPlayer();
|
||||
@ -107,11 +107,11 @@ public class GameChatManager implements Listener
|
||||
else if (_manager.GetGameHostManager().isCommunityServer())
|
||||
rankStr = C.cDGreen + C.Bold + "MCS Co-Host " + C.Reset;
|
||||
else
|
||||
rankStr = C.cDGreen + C.Bold + "MPS Co-Host " + C.Reset;
|
||||
rankStr = C.cDGreen + C.Bold + "MPS Co-Host " + C.Reset;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (rank != Rank.ALL)
|
||||
if (rank != Rank.ALL)
|
||||
rankStr = rank.getTag(true, true) + " " + C.Reset;
|
||||
}
|
||||
|
||||
@ -121,10 +121,20 @@ public class GameChatManager implements Listener
|
||||
Party party = _manager.getPartyManager().getPartyByPlayer(sender);
|
||||
if (party != null)
|
||||
{
|
||||
event.setMessage(event.getMessage().substring(1, event.getMessage().length()));
|
||||
event.setFormat(levelStr + C.cDPurple + C.Bold + "Party " + C.cWhite + C.Bold + event.getPlayer().getName() + " " + C.cPurple + "%2$s");
|
||||
if (event.getMessage().length() > 1)
|
||||
{
|
||||
event.getRecipients().clear();
|
||||
|
||||
event.getRecipients().removeIf(other -> !party.getMembers().contains(other));
|
||||
event.setMessage(event.getMessage().substring(1, event.getMessage().length()));
|
||||
event.setFormat(levelStr + C.cDPurple + C.Bold + "Party " + C.cWhite + C.Bold + event.getPlayer().getName() + " " + C.cPurple + "%2$s");
|
||||
|
||||
event.getRecipients().removeIf(other -> !party.getMembers().contains(other));
|
||||
}
|
||||
else
|
||||
{
|
||||
UtilPlayer.message(event.getPlayer(), F.main("Party", "Where's the message?"));
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -137,7 +147,7 @@ public class GameChatManager implements Listener
|
||||
|
||||
event.setFormat(levelStr + rankStr + senderName + " " + C.cWhite + "%2$s");
|
||||
|
||||
if(rankStr.equals(""))
|
||||
if (rankStr.equals(""))
|
||||
format = levelStr;
|
||||
else
|
||||
format = event.getFormat().split(rankStr)[0];
|
||||
@ -152,7 +162,7 @@ public class GameChatManager implements Listener
|
||||
{
|
||||
event.setFormat(levelStr + rankStr + senderName + " " + C.cWhite + "%2$s");
|
||||
|
||||
if(safeSend(sender, format, rankStr, rank, name, message, event.getRecipients()))
|
||||
if (safeSend(sender, format, rankStr, rank, name, message, event.getRecipients()))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
}
|
||||
@ -175,14 +185,14 @@ public class GameChatManager implements Listener
|
||||
{
|
||||
boolean isPriv = event.getMessage().charAt(0) == '#';
|
||||
|
||||
if(isPriv)
|
||||
if (isPriv)
|
||||
event.setMessage(event.getMessage().substring(1, event.getMessage().length()));
|
||||
else
|
||||
globalMessage = true;
|
||||
|
||||
event.setFormat(isPriv ? C.cWhiteB + "Team " + dead + levelStr + rankStr + senderName + " " + C.cWhite + "%2$s" : dead + levelStr + rankStr + team.GetColor() + senderName + " " + C.cWhite + "%2$s");
|
||||
|
||||
if(rankStr.equals(""))
|
||||
if (rankStr.equals(""))
|
||||
format = isPriv ? C.cWhiteB + "Team " + dead + levelStr : dead + levelStr;
|
||||
else
|
||||
format = event.getFormat().split(rankStr)[0];
|
||||
@ -194,7 +204,7 @@ public class GameChatManager implements Listener
|
||||
globalMessage = true;
|
||||
event.setFormat(dead + levelStr + rankStr + senderName + " " + C.cWhite + "%2$s");
|
||||
|
||||
if(rankStr.equals(""))
|
||||
if (rankStr.equals(""))
|
||||
format = dead + levelStr;
|
||||
else
|
||||
format = event.getFormat().split(rankStr)[0];
|
||||
@ -227,7 +237,7 @@ public class GameChatManager implements Listener
|
||||
}
|
||||
}
|
||||
|
||||
if(safeSend(sender, format, rankStr, rank, name, message, event.getRecipients()))
|
||||
if (safeSend(sender, format, rankStr, rank, name, message, event.getRecipients()))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
}
|
||||
@ -259,7 +269,7 @@ public class GameChatManager implements Listener
|
||||
recipientIterator.remove();
|
||||
}
|
||||
|
||||
if(safeSend(sender, format, rankStr, rank, name, message, event.getRecipients()))
|
||||
if (safeSend(sender, format, rankStr, rank, name, message, event.getRecipients()))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
}
|
||||
@ -285,7 +295,7 @@ public class GameChatManager implements Listener
|
||||
public void setGameChatStats(ChatStatData... stats)
|
||||
{
|
||||
_chatStats = new LinkedList<ChatStatData>();
|
||||
for(ChatStatData chatStat : stats)
|
||||
for (ChatStatData chatStat : stats)
|
||||
{
|
||||
_chatStats.add(chatStat);
|
||||
}
|
||||
@ -293,9 +303,9 @@ public class GameChatManager implements Listener
|
||||
|
||||
private JsonMessage buildJSON(Player player, String prefix, String rankStr, Rank rank, String name, LinkedList<ChatStatData> hoverText, String message)
|
||||
{
|
||||
if(_manager.GetGame() == null || (_manager.GetGame().GetState() != GameState.Prepare && _manager.GetGame().GetState() != GameState.Live && _manager.GetGame().GetState() != GameState.End))
|
||||
if (_manager.GetGame() == null || (_manager.GetGame().GetState() != GameState.Prepare && _manager.GetGame().GetState() != GameState.Live && _manager.GetGame().GetState() != GameState.End))
|
||||
{
|
||||
if(rank == Rank.ALL)
|
||||
if (rank == Rank.ALL)
|
||||
{
|
||||
return new JsonMessage("").extra(JSONObject.escape(prefix))
|
||||
.add(JSONObject.escape(rankStr)).add(JSONObject.escape(name)).add(JSONObject.escape(message));
|
||||
@ -326,7 +336,7 @@ public class GameChatManager implements Listener
|
||||
ChatStatData chatStatData = hoverText.get(i);
|
||||
String display = (chatStatData.getDisplay() == null ? chatStatData.getStat() : chatStatData.getDisplay());
|
||||
|
||||
if(!chatStatData.isValue())
|
||||
if (!chatStatData.isValue())
|
||||
{
|
||||
temp.add(new AbstractMap.SimpleEntry<String, String>(chatStatData.getDisplay(), ""));
|
||||
continue;
|
||||
@ -370,10 +380,10 @@ public class GameChatManager implements Listener
|
||||
String stats = "";
|
||||
for (int i = 0; i < temp.size(); i++)
|
||||
{
|
||||
stats += C.cWhite + JSONObject.escape(temp.get(i).getKey()) + C.cGray + JSONObject.escape(temp.get(i).getValue()) + (i >= temp.size()-1 ? "" : "\\n");
|
||||
stats += C.cWhite + JSONObject.escape(temp.get(i).getKey()) + C.cGray + JSONObject.escape(temp.get(i).getValue()) + (i >= temp.size() - 1 ? "" : "\\n");
|
||||
}
|
||||
|
||||
if(rank == Rank.ALL)
|
||||
if (rank == Rank.ALL)
|
||||
{
|
||||
return new JsonMessage("").extra(JSONObject.escape(prefix))
|
||||
.add(JSONObject.escape(rankStr)).add(JSONObject.escape(name)).hover("show_text", stats).add(JSONObject.escape(message));
|
||||
@ -388,10 +398,10 @@ public class GameChatManager implements Listener
|
||||
{
|
||||
double ratio = 0.0;
|
||||
|
||||
if(var1 <= 0) ratio = 0d;
|
||||
else if(var2 <= 1) ratio = (double) var1;
|
||||
else if(var1 <= 0 && var2 <= 0) ratio = 0d;
|
||||
else ratio = ((double) var1 / var2);
|
||||
if (var1 <= 0) ratio = 0d;
|
||||
else if (var2 <= 1) ratio = (double) var1;
|
||||
else if (var1 <= 0 && var2 <= 0) ratio = 0d;
|
||||
else ratio = ((double) var1 / var2);
|
||||
|
||||
return Double.parseDouble(new DecimalFormat(format).format(ratio));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user