Fix sheep look bug, valentines gift effects, valentines achievements

This commit is contained in:
Shaun Bennett 2016-02-12 04:32:26 -06:00
parent dfd61833b7
commit 66aa89b5e0
4 changed files with 41 additions and 11 deletions

View File

@ -29,7 +29,21 @@ public enum Achievement
"during Christmas 2015!"},
new int[]{200},
AchievementCategory.HOLIDAY),
GLOBAL_GIFT_GIVER_2016("2016 Gift Giver", 2000,
new String[]{"Global.Valentines2016.GiftsGiven"},
new String[]{"Give 50 Valentines Gifts",
"during Valentines 2016!"},
new int[]{50},
AchievementCategory.HOLIDAY),
GLOBAL_GIFT_GETTER_2016("2016 People Love Me", 2000,
new String[]{"Global.Valentines2016.GiftsReceived"},
new String[]{"Receive 10 Gifts",
"during Valentines 2016!"},
new int[]{10},
AchievementCategory.HOLIDAY),
//Bridges
BRIDGES_WINS("Bridge Champion", 600,
new String[]{"The Bridges.Wins"},

View File

@ -35,25 +35,25 @@ public class GiftEffect
_finished = false;
_ticks = 0;
_to.setWalkSpeed(0.0F);
_from.setWalkSpeed(0.0F);
// _to.setWalkSpeed(0.0F);
// _from.setWalkSpeed(0.0F);
}
public void tick()
{
_ticks++;
if (_ticks == 20)
if (_ticks == 1)
{
if (_to.isOnline())
{
UtilTextMiddle.display("", C.cPurple + _from.getName() + " shared a Gift with you", _to);
_to.playSound(_to.getLocation(), Sound.NOTE_PLING, 1f, 1f);;
UtilTextMiddle.display("", C.cYellow + _from.getName() + C.cPurple + " is sharing a Gift with you", _to);
_to.playSound(_to.getLocation(), Sound.CAT_MEOW, 1f, 1f);;
}
if (_from.isOnline())
{
UtilTextMiddle.display("", C.cPurple + "You shared a Gift with " + _to.getName(), _from);
_from.playSound(_from.getLocation(), Sound.NOTE_PLING, 1f, 1f);
UtilTextMiddle.display("", C.cPurple + "You are sharing a Gift with " + C.cYellow + _to.getName(), _from);
_from.playSound(_from.getLocation(), Sound.CAT_MEOW, 1f, 1f);
}
}
else if (_ticks == 40)
@ -122,8 +122,8 @@ public class GiftEffect
{
UtilFirework.playFirework(_centerLocation.clone().add(0, 3, 0), FireworkEffect.builder().with(FireworkEffect.Type.STAR).withColor(Color.RED).withFade(Color.WHITE).withFlicker().build());
_finished = true;
if (_to.isOnline()) _to.setWalkSpeed(0.2F);
if (_from.isOnline()) _from.setWalkSpeed(0.2F);
// if (_to.isOnline()) _to.setWalkSpeed(0.2F);
// if (_from.isOnline()) _from.setWalkSpeed(0.2F);
}
}

View File

@ -10,6 +10,7 @@ import mineplex.core.gadget.GadgetManager;
import mineplex.core.inventory.InventoryManager;
import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.reward.*;
import mineplex.core.stats.StatsManager;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.core.valentines.event.AttemptGiftEvent;
@ -30,11 +31,12 @@ public class ValentinesGiftManager extends MiniPlugin
private RewardManager _rewardManager;
private InventoryManager _inventoryManager;
private GadgetManager _gadgetManager;
private StatsManager _statsManager;
private ValentinesGiftRepository _repository;
private LinkedList<GiftEffect> _effects;
public ValentinesGiftManager(JavaPlugin plugin, CoreClientManager clientManager, RewardManager rewardManager, InventoryManager inventoryManager, GadgetManager gadgetManager)
public ValentinesGiftManager(JavaPlugin plugin, CoreClientManager clientManager, RewardManager rewardManager, InventoryManager inventoryManager, GadgetManager gadgetManager, StatsManager statsManager)
{
super("Valentines", plugin);
@ -42,6 +44,7 @@ public class ValentinesGiftManager extends MiniPlugin
_rewardManager = rewardManager;
_inventoryManager = inventoryManager;
_gadgetManager = gadgetManager;
_statsManager = statsManager;
_repository = new ValentinesGiftRepository(plugin);
_effects = new LinkedList<>();
@ -63,6 +66,9 @@ public class ValentinesGiftManager extends MiniPlugin
});
}
/**
* I apologize for this mess. Love, Shaun
*/
private void giveGift(Player from, Player to, boolean success)
{
if (success)
@ -86,6 +92,8 @@ public class ValentinesGiftManager extends MiniPlugin
@Override
public void run(RewardData fromData)
{
String fromGift = ChatColor.stripColor(fromData.getFriendlyName());
_effects.add(new GiftEffect(from, to, fromGift, toGift, UtilAlg.getMidpoint(to.getLocation(), from.getLocation())));
}
@ -126,4 +134,10 @@ public class ValentinesGiftManager extends MiniPlugin
}
}
private void incrementStat(Player from, Player to)
{
_statsManager.incrementStat(from, "Global.Valentines2016.GiftsGiven", 1);
_statsManager.incrementStat(to, "Global.Valentines2016.GiftsReceived", 1);
}
}

View File

@ -2,6 +2,7 @@ package mineplex.hub.modules.valentines;
import org.bukkit.DyeColor;
import org.bukkit.Sound;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftSheep;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.entity.Sheep;
@ -176,6 +177,7 @@ public class Courtship
if (_tick == 130)
{
_sheep.setColor(DyeColor.PINK);
((CraftSheep) _sheep).getHandle().setFakeHead(false);
return true;
}