Clans Alpha 1.0 changes

This commit is contained in:
Shaun Bennett 2016-02-05 18:42:22 -05:00
parent 27e4ef784c
commit 4f5625d63e
6 changed files with 47 additions and 22 deletions

View File

@ -53,7 +53,7 @@ import net.minecraft.server.v1_8_R3.MinecraftServer;
public class Clans extends JavaPlugin
{
public static final String VERSION = "0.19";
public static final String VERSION = "1.0";
private String WEB_CONFIG = "webServer";
// Modules

View File

@ -85,6 +85,9 @@ public class ClansAdmin
else if (args[1].equalsIgnoreCase("wp"))
wp(caller, args);
else if (args[1].equalsIgnoreCase("timer"))
resetTime(caller, args);
else
help(caller);
}
@ -111,8 +114,26 @@ public class ClansAdmin
UtilPlayer.message(caller, F.help("/c x unclaim (all)", "Unclaim Territory for Mimic", Rank.CMOD));
UtilPlayer.message(caller, F.help("/c x delete", "Delete Mimic Clan", Rank.CMOD));
UtilPlayer.message(caller, F.help("/c x autoclaim", "AutoClaim for Mimic Clan", Rank.CMOD));
UtilPlayer.message(caller, F.help("/c x timer <player>", "Reset Clan Create Timer", Rank.CMOD));
UtilPlayer.message(caller, F.main("Mimic Clan", Clans.Get(caller).getMimic()));
}
private void resetTime(Player caller, String[] args)
{
if (args.length < 3)
{
UtilPlayer.message(caller, F.main("Clans Admin", "You did not enter a player name"));
return;
}
Player player = UtilPlayer.searchOnline(caller, args[2], true);
if (player != null)
{
Clans.resetLeftTimer(player.getUniqueId());
UtilPlayer.message(caller, F.main("Clans Admin", "Reset Clan create timer for " + F.name(player.getName())));
}
}
private void autoclaim(Player caller)
{

View File

@ -297,6 +297,8 @@ public class ClansDataAccessLayer
clan.getMembers().remove(clansPlayer.getUuid());
_manager.getClanMemberUuidMap().remove(clansPlayer.getUuid());
clan.playerOffline(clansPlayer.getPlayerName());
_manager.justLeft(clansPlayer.getUuid(), clan);
// Log
_manager.log("Removed [" + clansPlayer.getPlayerName() + "] from [" + clan.getName() + "].");
}

View File

@ -181,6 +181,7 @@ public class ClansManager extends MiniClientPlugin<ClientClan>implements IRelati
private NpcManager _npcManager;
private Explosion _explosion;
private GoldManager _goldManager;
private WarPointEvasion _warPointEvasion;
private Punish _punish;
@ -254,7 +255,7 @@ public class ClansManager extends MiniClientPlugin<ClientClan>implements IRelati
new TntGeneratorManager(plugin, this);
new SupplyDropManager(plugin, this);
_explosion = new Explosion(plugin, blockRestore);
new WarPointEvasion(plugin);
_warPointEvasion = new WarPointEvasion(plugin);
// new ClansLoginManager(getPlugin(), clientManager, _serverName);
@ -744,23 +745,9 @@ public class ClansManager extends MiniClientPlugin<ClientClan>implements IRelati
}
}
@EventHandler(priority = EventPriority.HIGHEST)
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void handlePlayerChat(AsyncPlayerChatEvent event)
{
event.setCancelled(false);
_chat.HandleChat(event);
if (event.isCancelled())
{
return;
}
else
{
event.setCancelled(true);
}
// PunishClient punishclient = _punish.GetClient(event.getPlayer().getName());
//
// if (punishclient != null && punishclient.IsMuted())
@ -809,7 +796,9 @@ public class ClansManager extends MiniClientPlugin<ClientClan>implements IRelati
{
handleRegularChat(event, clan, rank);
}
event.setCancelled(true);
System.out.println((clan == null ? "" : clan.getName()) + " " + _clientManager.Get(event.getPlayer()).GetRank().name() + " " + event.getPlayer().getName() + " " + event.getMessage());
}
@ -1166,6 +1155,13 @@ public class ClansManager extends MiniClientPlugin<ClientClan>implements IRelati
{
_clanMemberLeftMap.put(uniqueId, Pair.create(clan, System.currentTimeMillis()));
}
public void resetLeftTimer(UUID uuid)
{
_clanMemberLeftMap.remove(uuid);
_warPointEvasion.resetCooldown(uuid);
}
public Pair<ClanInfo, Long> leftRecently(UUID uniqueId, long time)
{

View File

@ -255,7 +255,7 @@ public class ClansCommand extends CommandBase<ClansManager>
return;
}
if (Plugin.leftRecently(caller.getUniqueId(), 20 * 60 * 1000) != null)
if (Plugin.leftRecently(caller.getUniqueId(), 5 * 60 * 1000) != null)
{
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You cannot create a Clan for " + C.mTime + UtilTime.MakeStr(Plugin.leftRecently(caller.getUniqueId(), 20 * 60 * 1000).getRight()) + C.mBody + "."));
return;
@ -540,8 +540,6 @@ public class ClansCommand extends CommandBase<ClansManager>
// Inform
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You left " + F.elem("Clan " + clan.getName()) + "."));
clan.inform(F.name(caller.getName()) + " has left your Clan.", null);
_manager.justLeft(caller.getUniqueId(), clan);
}
});
}

View File

@ -24,7 +24,7 @@ public class WarPointEvasion extends MiniPlugin{
private HashMap<Chunk, Long> _chunkCooldown;
private HashMap<UUID, Long> _playerCooldown;
private final long COOLDOWN_TIME = 1000 * 60 * 30;
private final long COOLDOWN_TIME = 1000 * 60 * 10;
public WarPointEvasion(JavaPlugin plugin) {
super("WP Evasion", plugin);
@ -77,9 +77,17 @@ public class WarPointEvasion extends MiniPlugin{
@EventHandler
public void onClanCreate(ClanCreatedEvent event) {
if (event.getFounder() == null)
return;
if (_playerCooldown.containsKey(event.getFounder().getUniqueId())) {
event.setCancelled(true);
event.getFounder().sendMessage(F.main("Clans", "You cannot create a clan for another " + UtilTime.convertString(COOLDOWN_TIME - (System.currentTimeMillis() - _playerCooldown.get(event.getFounder().getUniqueId())), 1, UtilTime.TimeUnit.MINUTES)));
}
}
public void resetCooldown(UUID uuid)
{
_playerCooldown.remove(uuid);
}
}