Merge branch 'master' of ssh://184.154.0.242:7999/min/Mineplex

This commit is contained in:
Jonathan Williams 2014-12-24 02:49:37 -05:00
commit 6e93d85da8
4 changed files with 32 additions and 3 deletions

View File

@ -4,6 +4,8 @@ import java.util.ArrayList;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.entity.Creature;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
@ -185,7 +187,9 @@ public class Menu extends ShopPageBase<CosmeticManager, CosmeticShop>
if (Plugin.getPetManager().hasActivePet(Player.getName()))
{
AddButton(26 + 9, new ShopItem(Material.MONSTER_EGG, (byte)Plugin.getPetManager().getActivePet(Player.getName()).getType().getTypeId(), ChatColor.RESET + C.mItem + Plugin.getPetManager().getActivePet(Player.getName()).getCustomName(), new String[] {}, 1, false, false),
Creature activePet = Plugin.getPetManager().getActivePet(Player.getName());
String petName = activePet.getType() == EntityType.WITHER ? "Widder" : activePet.getCustomName();
AddButton(26 + 9, new ShopItem(Material.MONSTER_EGG, (byte)Plugin.getPetManager().getActivePet(Player.getName()).getType().getTypeId(), ChatColor.RESET + C.mItem + petName, new String[] {}, 1, false, false),
new IButton()
{
public void onClick(Player player, ClickType clickType)

View File

@ -79,10 +79,16 @@ public class PetPage extends ShopPageBase<CosmeticManager, CosmeticShop>
//Owned
if (DonationManager.Get(Player.getName()).OwnsUnknownPackage(pet.GetPetName()))
{
String petName = Plugin.getPetManager().Get(Player).GetPets().get(pet.GetPetType());
if (petName == null)
{
petName = pet.GetName();
}
if (Plugin.getPetManager().hasActivePet(Player.getName()) && Plugin.getPetManager().getActivePet(Player.getName()).getType() == pet.GetPetType())
{
AddButton(slot, new ShopItem(Material.MONSTER_EGG, (byte)pet.GetPetType().getTypeId(),
"Deactivate " + pet.GetPetName() + " (" + C.cWhite + Plugin.getPetManager().Get(Player).GetPets().get(pet.GetPetType()) + C.cGreen + ")",
"Deactivate " + pet.GetPetName() + " (" + C.cWhite + petName + C.cGreen + ")",
itemLore.toArray(new String[itemLore.size()]), 1, false, false), new DeactivatePetButton(this, Plugin.getPetManager()));
addGlow(slot);
@ -90,7 +96,7 @@ public class PetPage extends ShopPageBase<CosmeticManager, CosmeticShop>
else
{
AddButton(slot, new ShopItem(Material.MONSTER_EGG, (byte)pet.GetPetType().getTypeId(),
"Activate " + pet.GetPetName() + " (" + C.cWhite + Plugin.getPetManager().Get(Player).GetPets().get(pet.GetPetType()) + C.cGreen + ")",
"Activate " + pet.GetPetName() + " (" + C.cWhite + petName + C.cGreen + ")",
itemLore.toArray(new String[itemLore.size()]), 1, false, false), new ActivatePetButton(pet, this));
}
}

View File

@ -13,6 +13,7 @@ import mineplex.core.updater.UpdateType;
import mineplex.core.account.CoreClientManager;
import mineplex.core.account.event.ClientWebResponseEvent;
import mineplex.core.blockrestore.BlockRestore;
import mineplex.core.common.Rank;
import mineplex.core.common.util.NautHashMap;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilServer;
@ -44,6 +45,7 @@ import org.bukkit.event.entity.EntityTargetEvent;
import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.player.PlayerInteractEntityEvent;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.java.JavaPlugin;
@ -66,6 +68,8 @@ public class PetManager extends MiniClientPlugin<PetClient>
private NautHashMap<String, EntityType> _petOwnerQueue = new NautHashMap<String, EntityType>();
private NautHashMap<String, String> _petRenameQueue = new NautHashMap<String, String>();
private DonationManager _donationManager;
private CoreClientManager _clientManager;
public PetManager(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager, DisguiseManager disguiseManager, mineplex.core.creature.Creature creatureModule, BlockRestore restore, String webAddress)
{
@ -76,6 +80,8 @@ public class PetManager extends MiniClientPlugin<PetClient>
_repository = new PetRepository(webAddress);
_petFactory = new PetFactory(_repository);
_blockRestore = restore;
_donationManager = donationManager;
_clientManager = clientManager;
_activePetOwners = new NautHashMap<String, Creature>();
_failedAttempts = new NautHashMap<String, Integer>();
@ -135,6 +141,17 @@ public class PetManager extends MiniClientPlugin<PetClient>
}
}
@EventHandler
public void onJoin(PlayerJoinEvent event)
{
Player p = event.getPlayer();
Rank rank = _clientManager.Get(p).GetRank();
if (rank == Rank.LEGEND || rank == Rank.ADMIN || rank == Rank.DEVELOPER || rank == Rank.OWNER)
{
_donationManager.Get(p.getName()).AddUnknownSalesPackagesOwned("Widder");
}
}
public void AddPetOwner(Player player, EntityType entityType, Location location)
{
if (_activePetOwners.containsKey(player.getName()))

View File

@ -532,6 +532,8 @@ public class ArcadeManager extends MiniPlugin implements IRelation
@EventHandler
public void MessageMOTD(ServerListPingEvent event)
{
event.setMaxPlayers(_serverConfig.MaxPlayers);
//MPS
if (_gameHostManager != null && _gameHostManager.isPrivateServer())
{