Merge remote-tracking branch 'remotes/origin/develop' into virizion_speed_builder
This commit is contained in:
commit
845014b677
@ -56,7 +56,7 @@ public class MotdManager implements Listener, Runnable
|
||||
//String motdLine = "§f§l◄ §c§lMaintenance§f§l ►";
|
||||
//String motdLine = "§f§l◄ §a§lCarl the Creeper§f§l ►";
|
||||
// String motdLine = " §2§l§n M O N S T E R M A Z E B E T A §f";
|
||||
String motdLine = " §f❄ §2§lNew Game §f❄ §2§lType Wars §f❄";
|
||||
String motdLine = " §f❄ §2§lMerry Christmas §f❄ §2§lElf Presents §f❄";
|
||||
//String motdLine = " §d§lRank Sale §a§l40% Off");
|
||||
//String motdLine = " §f§l◄§c§lMAINTENANCE§f§l►");
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
package mineplex.game.clans.items.generation;
|
||||
package mineplex.core.common.weight;
|
||||
|
||||
public class Weight<T>
|
||||
{
|
@ -1,4 +1,4 @@
|
||||
package mineplex.game.clans.items.generation;
|
||||
package mineplex.core.common.weight;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
@ -6,7 +6,7 @@ import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import mineplex.game.clans.economy.GoldManager;
|
||||
import mineplex.game.clans.items.GearManager;
|
||||
import mineplex.game.clans.items.generation.WeightSet;
|
||||
import mineplex.core.common.weight.WeightSet;
|
||||
|
||||
public class LootManager
|
||||
{
|
||||
|
@ -60,8 +60,8 @@ import mineplex.core.recharge.Recharge;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.game.clans.clans.ClansManager;
|
||||
import mineplex.game.clans.items.generation.Weight;
|
||||
import mineplex.game.clans.items.generation.WeightSet;
|
||||
import mineplex.core.common.weight.Weight;
|
||||
import mineplex.core.common.weight.WeightSet;
|
||||
import mineplex.minecraft.game.classcombat.Class.ClientClass;
|
||||
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
|
||||
import mineplex.minecraft.game.classcombat.Skill.event.BlockTossEvent;
|
||||
|
@ -53,8 +53,8 @@ import mineplex.game.clans.items.attributes.weapon.JaggedAttribute;
|
||||
import mineplex.game.clans.items.attributes.weapon.SharpAttribute;
|
||||
import mineplex.game.clans.items.commands.GearCommand;
|
||||
import mineplex.game.clans.items.economy.GoldToken;
|
||||
import mineplex.game.clans.items.generation.Weight;
|
||||
import mineplex.game.clans.items.generation.WeightSet;
|
||||
import mineplex.core.common.weight.Weight;
|
||||
import mineplex.core.common.weight.WeightSet;
|
||||
import mineplex.game.clans.items.legendaries.AlligatorsTooth;
|
||||
import mineplex.game.clans.items.legendaries.GiantsBroadsword;
|
||||
import mineplex.game.clans.items.legendaries.HyperAxe;
|
||||
@ -67,7 +67,6 @@ import mineplex.serverdata.serialization.RuntimeTypeAdapterFactory;
|
||||
|
||||
import net.minecraft.server.v1_8_R3.NBTTagCompound;
|
||||
import net.minecraft.server.v1_8_R3.Packet;
|
||||
import net.minecraft.server.v1_8_R3.PacketPlayOutChat;
|
||||
import net.minecraft.server.v1_8_R3.PacketPlayOutSetSlot;
|
||||
import net.minecraft.server.v1_8_R3.PacketPlayOutWindowItems;
|
||||
|
||||
|
@ -1,11 +1,5 @@
|
||||
package mineplex.game.clans.items;
|
||||
|
||||
import com.google.common.collect.Sets;
|
||||
|
||||
import mineplex.game.clans.items.generation.WeightSet;
|
||||
import mineplex.game.clans.items.legendaries.AlligatorsTooth;
|
||||
import mineplex.game.clans.items.legendaries.WindBlade;
|
||||
|
||||
public enum ItemType
|
||||
{
|
||||
LEGENDARY,
|
||||
|
@ -16,7 +16,6 @@ import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Monster;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.block.BlockBreakEvent;
|
||||
import org.bukkit.event.block.BlockBurnEvent;
|
||||
import org.bukkit.event.block.BlockFromToEvent;
|
||||
@ -33,7 +32,6 @@ import org.bukkit.event.player.PlayerVelocityEvent;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import mineplex.core.MiniPlugin;
|
||||
import mineplex.core.common.Rank;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilParticle;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
@ -44,7 +42,7 @@ import mineplex.core.common.util.UtilTime.TimeUnit;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.game.clans.clans.ClansManager;
|
||||
import mineplex.game.clans.items.generation.WeightSet;
|
||||
import mineplex.core.common.weight.WeightSet;
|
||||
import mineplex.minecraft.game.classcombat.Skill.event.SkillTriggerEvent;
|
||||
import mineplex.minecraft.game.classcombat.item.event.WebTossEvent;
|
||||
import mineplex.minecraft.game.core.condition.Condition.ConditionType;
|
||||
|
@ -74,6 +74,7 @@ import mineplex.hub.commands.GadgetToggle;
|
||||
import mineplex.hub.commands.GameModeCommand;
|
||||
import mineplex.hub.commands.NewsCommand;
|
||||
import mineplex.hub.modules.ForcefieldManager;
|
||||
import mineplex.hub.modules.HolidayGiftManager;
|
||||
import mineplex.hub.modules.HubVisibilityManager;
|
||||
import mineplex.hub.modules.JumpManager;
|
||||
import mineplex.hub.modules.KothManager;
|
||||
@ -247,6 +248,8 @@ public class HubManager extends MiniClientPlugin<HubClient>
|
||||
|
||||
// _halloweenManager = new HalloweenSpookinessManager(this);
|
||||
|
||||
new HolidayGiftManager(plugin, clientManager, donationManager, inventoryManager, taskManager);
|
||||
|
||||
// NotificationManager notificationManager = new NotificationManager(plugin, clientManager, donationManager);
|
||||
// new MailManager(_plugin, notificationManager);
|
||||
|
||||
|
@ -0,0 +1,118 @@
|
||||
package mineplex.hub.modules;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Villager;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.player.PlayerInteractEntityEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import mineplex.core.MiniPlugin;
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.weight.WeightSet;
|
||||
import mineplex.core.donation.DonationManager;
|
||||
import mineplex.core.inventory.InventoryManager;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
import mineplex.core.reward.Reward;
|
||||
import mineplex.core.reward.RewardRarity;
|
||||
import mineplex.core.reward.RewardType;
|
||||
import mineplex.core.reward.rewards.GemReward;
|
||||
import mineplex.core.reward.rewards.InventoryReward;
|
||||
import mineplex.core.task.TaskManager;
|
||||
import mineplex.core.treasure.TreasureType;
|
||||
|
||||
public class HolidayGiftManager extends MiniPlugin
|
||||
{
|
||||
private final String IDENTIFIER = "the elf";
|
||||
|
||||
private boolean _enabled = true;
|
||||
private WeightSet<Reward> _rewards;
|
||||
private TaskManager _taskManager;
|
||||
|
||||
public HolidayGiftManager(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager, InventoryManager inventoryManager, TaskManager taskManager)
|
||||
{
|
||||
super("Holiday Gift", plugin);
|
||||
|
||||
_taskManager = taskManager;
|
||||
|
||||
_rewards = new WeightSet<>();
|
||||
_rewards.add(100, new GemReward(donationManager, 50, 300, 1, 1, RewardRarity.UNCOMMON));
|
||||
_rewards.add(100, new InventoryReward(inventoryManager, "Coal", "Coal", 10, 50, new ItemStack(Material.COAL), RewardRarity.UNCOMMON, 10, 0));
|
||||
_rewards.add(50, new InventoryReward(inventoryManager, "Old Chest", TreasureType.OLD.getItemName(), 1, 1, new ItemStack(Material.CHEST), RewardRarity.RARE, 1, 1));
|
||||
_rewards.add(50, new InventoryReward(inventoryManager, "Ancient Chest", TreasureType.ANCIENT.getItemName(), 1, 1, new ItemStack(Material.CHEST), RewardRarity.RARE, 1, 1));
|
||||
_rewards.add(20, new InventoryReward(inventoryManager, "Winter Holiday Chest", TreasureType.CHRISTMAS.getItemName(), 1, 1, new ItemStack(Material.CHEST), RewardRarity.RARE, 1, 1));
|
||||
_rewards.add(20, new InventoryReward(inventoryManager, "Mythical Chest", TreasureType.MYTHICAL.getItemName(), 1, 1, new ItemStack(Material.CHEST), RewardRarity.RARE, 1, 1));
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onInteract(PlayerInteractEntityEvent event)
|
||||
{
|
||||
if (!_enabled)
|
||||
return;
|
||||
|
||||
if (!(event.getRightClicked() instanceof Villager))
|
||||
return;
|
||||
|
||||
Villager villager = ((Villager) event.getRightClicked());
|
||||
String colorLess = ChatColor.stripColor(villager.getCustomName());
|
||||
String parsedName = colorLess.toLowerCase();
|
||||
String elfName = parsedName.split(" ")[0];
|
||||
|
||||
if (!parsedName.endsWith(IDENTIFIER))
|
||||
return;
|
||||
|
||||
if (!Recharge.Instance.use(event.getPlayer(), parsedName, 2000, false, false))
|
||||
return;
|
||||
|
||||
String taskName = getTaskName(elfName);
|
||||
|
||||
if (taskName == null)
|
||||
return;
|
||||
|
||||
if (!_taskManager.hasCompletedTask(event.getPlayer(), taskName))
|
||||
{
|
||||
_taskManager.completedTask(completed -> {
|
||||
if (completed)
|
||||
{
|
||||
Reward reward = _rewards.generateRandom();
|
||||
|
||||
reward.giveReward(RewardType.GameLoot, event.getPlayer(), rewardData -> {
|
||||
UtilPlayer.message(event.getPlayer(), F.main("Gift", F.elem(colorLess) + " searches for your gift..."));
|
||||
UtilPlayer.message(event.getPlayer(), F.main("Gift", "You received " + rewardData.getFriendlyName() + C.mBody + "!"));
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
UtilPlayer.message(event.getPlayer(), F.main("Gift", F.elem(colorLess) + " had trouble finding a gift for you"));
|
||||
UtilPlayer.message(event.getPlayer(), F.main("Gift", "Please try again later!"));
|
||||
}
|
||||
}, event.getPlayer(), taskName);
|
||||
}
|
||||
else
|
||||
{
|
||||
UtilPlayer.message(event.getPlayer(), F.main("Gift", F.elem(colorLess) + " has no more gifts for you!"));
|
||||
}
|
||||
}
|
||||
|
||||
private String getTaskName(String elfName)
|
||||
{
|
||||
if (elfName == null || elfName.length() == 0)
|
||||
return null;
|
||||
|
||||
return "ChristmasGift.2015." + elfName;
|
||||
}
|
||||
|
||||
public boolean isEnabled()
|
||||
{
|
||||
return _enabled;
|
||||
}
|
||||
|
||||
public void setEnabled(boolean enabled)
|
||||
{
|
||||
_enabled = enabled;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user