Clans Alpha 0.18b fixes
This commit is contained in:
parent
15d2118bc1
commit
025615d080
@ -142,6 +142,11 @@ public class CoreClientManager extends MiniPlugin
|
||||
}
|
||||
}
|
||||
|
||||
public boolean Contains(String name)
|
||||
{
|
||||
return _clientList.containsKey(name);
|
||||
}
|
||||
|
||||
public CoreClient Get(Player player)
|
||||
{
|
||||
return Get(player.getName());
|
||||
|
@ -73,11 +73,6 @@ public class Task
|
||||
_cancel.run(_client);
|
||||
}
|
||||
|
||||
if (_end != null)
|
||||
{
|
||||
_end.run(_client);
|
||||
}
|
||||
|
||||
_client.cleanup(_name);
|
||||
return;
|
||||
}
|
||||
|
@ -53,7 +53,7 @@ import net.minecraft.server.v1_8_R3.MinecraftServer;
|
||||
|
||||
public class Clans extends JavaPlugin
|
||||
{
|
||||
public static final String VERSION = "0.18";
|
||||
public static final String VERSION = "0.18b";
|
||||
private String WEB_CONFIG = "webServer";
|
||||
|
||||
// Modules
|
||||
|
@ -649,17 +649,17 @@ public class ClansManager extends MiniClientPlugin<ClientClan>implements IRelati
|
||||
}
|
||||
}
|
||||
|
||||
private void handleClanChat(AsyncPlayerChatEvent event, ClanInfo clan, String rank)
|
||||
private void handleClanChat(Player player, String message, ClanInfo clan, String rank)
|
||||
{
|
||||
for (Player cur : clan.getOnlinePlayers())
|
||||
{
|
||||
String message = _chat.getFilteredMessage(event.getPlayer(), event.getMessage());
|
||||
message = _chat.getFilteredMessage(player, message);
|
||||
|
||||
UtilPlayer.message(cur, String.format(rank + C.cAqua + "%s " + C.cDAqua + "%s", event.getPlayer().getName(), message));
|
||||
UtilPlayer.message(cur, String.format(rank + C.cAqua + "%s " + C.cDAqua + "%s", player.getName(), message));
|
||||
}
|
||||
}
|
||||
|
||||
private void handleAllyChat(AsyncPlayerChatEvent event, ClanInfo clan, String rank)
|
||||
private void handleAllyChat(Player player, String message, ClanInfo clan, String rank)
|
||||
{
|
||||
List<Player> recipients = new ArrayList<>();
|
||||
|
||||
@ -673,9 +673,9 @@ public class ClansManager extends MiniClientPlugin<ClientClan>implements IRelati
|
||||
ally.getOnlinePlayers().forEach(recipients::add);
|
||||
}
|
||||
|
||||
String message = _chat.getFilteredMessage(event.getPlayer(), event.getMessage());
|
||||
final String filtered = _chat.getFilteredMessage(player, message);
|
||||
|
||||
recipients.forEach(p -> UtilPlayer.message(p, String.format(rank + C.cDGreen + clan.getName() + " " + C.cDGreen + "%s " + C.cGreen + "%s", event.getPlayer().getName(), message)));
|
||||
recipients.forEach(p -> UtilPlayer.message(p, String.format(rank + C.cDGreen + clan.getName() + " " + C.cDGreen + "%s " + C.cGreen + "%s", player.getName(), filtered)));
|
||||
|
||||
recipients.clear();
|
||||
}
|
||||
@ -733,11 +733,11 @@ public class ClansManager extends MiniClientPlugin<ClientClan>implements IRelati
|
||||
|
||||
if (client.isClanChat() && clan != null)
|
||||
{
|
||||
handleClanChat(event, clan, rank);
|
||||
handleClanChat(event.getPlayer(), event.getMessage(), clan, rank);
|
||||
}
|
||||
else if (client.isAllyChat() && clan != null)
|
||||
{
|
||||
handleAllyChat(event, clan, rank);
|
||||
handleAllyChat(event.getPlayer(), event.getMessage(), clan, rank);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -776,22 +776,22 @@ public class ClansManager extends MiniClientPlugin<ClientClan>implements IRelati
|
||||
|
||||
public void chatClan(ClanInfo clan, Player caller, String message)
|
||||
{
|
||||
messageClan(clan, C.cAqua + caller.getName() + " " + C.cDAqua + message);
|
||||
String rank = _clientManager.Get(caller).GetRank().getTag(true, true) + " ";
|
||||
|
||||
if (!_clientManager.Get(caller).GetRank().has(Rank.TWITCH))
|
||||
rank = "";
|
||||
|
||||
handleClanChat(caller, message, clan, rank);
|
||||
}
|
||||
|
||||
public void chatAlly(ClanInfo clan, Player caller, String message)
|
||||
{
|
||||
String sendMessage = C.cDGreen + clan.getName() + " " + C.cDGreen + caller.getName() + " " + C.cGreen + message;
|
||||
String rank = _clientManager.Get(caller).GetRank().getTag(true, true) + " ";
|
||||
|
||||
messageClan(clan, sendMessage);
|
||||
if (!_clientManager.Get(caller).GetRank().has(Rank.TWITCH))
|
||||
rank = "";
|
||||
|
||||
for (String allyName : clan.getAllyMap().keySet())
|
||||
{
|
||||
ClanInfo ally = _clanUtility.getClanByClanName(allyName);
|
||||
if (ally == null) continue;
|
||||
|
||||
messageClan(ally, sendMessage);
|
||||
}
|
||||
handleAllyChat(caller, message, clan, rank);
|
||||
}
|
||||
|
||||
public int getNameMin()
|
||||
|
@ -8,6 +8,7 @@ import java.util.List;
|
||||
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import mineplex.core.account.CoreClient;
|
||||
import mineplex.core.common.util.Callback;
|
||||
import mineplex.core.common.util.NonFinalInteger;
|
||||
import mineplex.core.database.DBPool;
|
||||
@ -50,16 +51,10 @@ public class ClansBanRepository extends RepositoryBase
|
||||
public void loadBans(final String name, final Callback<ClansBanClient> callback)
|
||||
{
|
||||
System.out.println(">> Attempting to load Clans Bans for \"" + name + "\"");
|
||||
_manager.getClientManager().loadClientByName(name, new Runnable() {
|
||||
public void run()
|
||||
{
|
||||
loadClientByName(name, client -> {
|
||||
System.out.println("> Successfully loaded CoreClient");
|
||||
|
||||
executeQuery(GET_ALL_BANS, new ResultSetCallable()
|
||||
{
|
||||
@Override
|
||||
public void processResultSet(ResultSet resultSet) throws SQLException
|
||||
{
|
||||
executeQuery(GET_ALL_BANS, resultSet -> {
|
||||
System.out.println("> Successfully executed query, result set object: " + resultSet);
|
||||
|
||||
final List<ClansBan> list = new ArrayList<ClansBan>();
|
||||
@ -77,53 +72,11 @@ public class ClansBanRepository extends RepositoryBase
|
||||
list.add(new ClansBan(id, accountId, reason, banTime, unbanTime, permanent, removed));
|
||||
}
|
||||
|
||||
callback.run(new ClansBanClient(_manager.getClientManager().Get(name).getAccountId(), list));
|
||||
callback.run(new ClansBanClient(client.getAccountId(), list));
|
||||
|
||||
System.out.println("> Successfully handled result");
|
||||
System.out.println(">> FINISH");
|
||||
}
|
||||
}, new ColumnInt("accountId", _manager.getClientManager().Get(name).getAccountId()));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void loadBansSync(final String name, final Callback<ClansBanClient> callback)
|
||||
{
|
||||
System.out.println(">> Attempting to load Clans Bans for \"" + name + "\"");
|
||||
_manager.getClientManager().loadClientByNameSync(name, new Runnable() {
|
||||
public void run()
|
||||
{
|
||||
System.out.println("> Successfully loaded CoreClient");
|
||||
|
||||
executeQuery(GET_ALL_BANS, new ResultSetCallable()
|
||||
{
|
||||
@Override
|
||||
public void processResultSet(ResultSet resultSet) throws SQLException
|
||||
{
|
||||
System.out.println("> Successfully executed query, result set object: " + resultSet);
|
||||
|
||||
final List<ClansBan> list = new ArrayList<ClansBan>();
|
||||
|
||||
while (resultSet.next())
|
||||
{
|
||||
int id = resultSet.getInt(1);
|
||||
int accountId = resultSet.getInt(2);
|
||||
String reason = resultSet.getString(3);
|
||||
Timestamp banTime = resultSet.getTimestamp(4);
|
||||
Timestamp unbanTime = resultSet.getTimestamp(5);
|
||||
boolean permanent = resultSet.getBoolean(6);
|
||||
boolean removed = resultSet.getBoolean(7);
|
||||
|
||||
list.add(new ClansBan(id, accountId, reason, banTime, unbanTime, permanent, removed));
|
||||
}
|
||||
|
||||
callback.run(new ClansBanClient(_manager.getClientManager().Get(name).getAccountId(), list));
|
||||
|
||||
System.out.println("> Successfully handled result");
|
||||
System.out.println(">> FINISH");
|
||||
}
|
||||
}, new ColumnInt("accountId", _manager.getClientManager().Get(name).getAccountId()));
|
||||
}
|
||||
}, new ColumnInt("accountId", client.getAccountId()));
|
||||
});
|
||||
}
|
||||
|
||||
@ -134,14 +87,8 @@ public class ClansBanRepository extends RepositoryBase
|
||||
return;
|
||||
}
|
||||
|
||||
_manager.getClientManager().loadClientByName(name, new Runnable(){
|
||||
public void run()
|
||||
{
|
||||
executeQuery(GET_LONGEST_BAN, new ResultSetCallable()
|
||||
{
|
||||
@Override
|
||||
public void processResultSet(ResultSet resultSet) throws SQLException
|
||||
{
|
||||
loadClientByName(name, client -> {
|
||||
executeQuery(GET_LONGEST_BAN, resultSet -> {
|
||||
while (resultSet.next())
|
||||
{
|
||||
int id = resultSet.getInt(1);
|
||||
@ -154,12 +101,22 @@ public class ClansBanRepository extends RepositoryBase
|
||||
|
||||
callback.run(new ClansBan(id, accountId, reason, banTime, unbanTime, permanent, removed));
|
||||
}
|
||||
}
|
||||
}, new ColumnInt("accountId", _manager.getClientManager().Get(name).getAccountId()));
|
||||
}
|
||||
}, new ColumnInt("accountId", client.getAccountId()));
|
||||
});
|
||||
}
|
||||
|
||||
public void loadClientByName(String name, Callback<CoreClient> client)
|
||||
{
|
||||
if (_manager.getClientManager().Contains(name))
|
||||
{
|
||||
client.run(_manager.getClientManager().Get(name));
|
||||
}
|
||||
else
|
||||
{
|
||||
_manager.getClientManager().loadClientByName(name, () -> client.run(_manager.getClientManager().Get(name)));
|
||||
}
|
||||
}
|
||||
|
||||
public void loadAll(Callback<List<ClansBanClient>> callback)
|
||||
{
|
||||
_manager.runAsync(() -> {
|
||||
|
@ -807,7 +807,7 @@ public class ClansCommand extends CommandBase<ClansManager>
|
||||
}, new Callback<DelayedTaskClient>() {
|
||||
public void run(DelayedTaskClient client)
|
||||
{
|
||||
UtilTextMiddle.display("", "Teleporting to Clan Home in " + F.elem(UtilTime.MakeStr(Math.max(0, client.getTimeLeft("Home Teleport")))), 0, 5, 0);
|
||||
UtilTextMiddle.display("", "Teleporting to Clan Home in " + F.elem(UtilTime.MakeStr(Math.max(0, client.getTimeLeft("Home Teleport")))), 0, 5, 0, client.getPlayer());
|
||||
}
|
||||
}, new Callback<DelayedTaskClient>() {
|
||||
public void run(DelayedTaskClient client)
|
||||
|
@ -65,7 +65,7 @@ public class PlayerGear
|
||||
{
|
||||
legendary.OriginalOwner = getPlayer().getUniqueId().toString();
|
||||
UtilServer.broadcast(F.main("Clans", F.elem(getPlayer().getName()) + " has picked up " + F.vowelAN(legendary.getDisplayName()) + " " + legendary.getDisplayName() + C.mBody + "."));
|
||||
UtilTextMiddle.display(C.cDPurple + "Legendary", F.elem(getPlayer().getName()) + C.cWhite + " picked up " + F.vowelAN(legendary.getDisplayName()) + " " + legendary.getDisplayName() + C.cWhite + ".");
|
||||
UtilTextMiddle.display(C.cDPurple + "Legendary", F.elem(getPlayer().getName()) + C.cWhite + " picked up " + F.vowelAN(legendary.getDisplayName()) + " " + legendary.getDisplayName() + C.cWhite + ".", 20, 60, 20);
|
||||
|
||||
getPlayer().setItemInHand(legendary.toItemStack());
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user