Bug Fixes

* Fixed Menu page adding glow to win effects if game modifiers were
active
* MineStrike skins were not properly applying material and data
* Skinned knife was not dealing damage
This commit is contained in:
xGamingDudex 2016-05-13 00:38:56 +02:00
parent 06e583c05e
commit 4958ab8149
6 changed files with 39 additions and 37 deletions

View File

@ -206,7 +206,7 @@ public class Menu extends ShopPageBase<CosmeticManager, CosmeticShop>
type = GadgetType.GameModifier; type = GadgetType.GameModifier;
lore = getLore(ownedCount.get(type), maxCount.get(type), "Cosmetic effects which changes appearances of objects in game", "Visible in Games", enabled.get(type)); lore = getLore(ownedCount.get(type), maxCount.get(type), "Cosmetic effects which changes appearances of objects in game", "Visible in Games", enabled.get(type));
addButton(gameModifierSlot, new ShopItem(Material.TORCH, "Game Modifiers", lore, 1, false), new OpenGameModifiers(this, enabled.get(type))); addButton(gameModifierSlot, new ShopItem(Material.TORCH, "Game Modifiers", lore, 1, false), new OpenGameModifiers(this, enabled.get(type)));
if (enabled.containsKey(type)) addGlow(winEffectSlot); if (enabled.containsKey(type)) addGlow(gameModifierSlot);
} }
private String[] getLore(int ownedCount, int maxCount, String info, String visibility, Gadget enabled) private String[] getLore(int ownedCount, int maxCount, String info, String visibility, Gadget enabled)

View File

@ -7,7 +7,7 @@ public enum MineStrikeSkin
P250_Muertos( "P250", "Muertos", Material.INK_SACK, (byte) 3), P250_Muertos( "P250", "Muertos", Material.INK_SACK, (byte) 3),
CZ75_Auto_Tigris( "CZ75-Auto", "Tigris", Material.CLAY_BRICK, (byte) 0), CZ75_Auto_Tigris( "CZ75-Auto", "Tigris", Material.CLAY_BRICK, (byte) 0),
Desert_Eagle_Blaze( "Desert_Eagle", "Blaze", Material.NETHER_STALK, (byte) 0), Desert_Eagle_Blaze( "Desert Eagle", "Blaze", Material.NETHER_STALK, (byte) 0),
Nova_Koi( "Nova", "Koi", Material.INK_SACK, (byte) 14), Nova_Koi( "Nova", "Koi", Material.INK_SACK, (byte) 14),
XM1014_Tranquility( "XM1014", "Tranquility", Material.SULPHUR, (byte) 0), XM1014_Tranquility( "XM1014", "Tranquility", Material.SULPHUR, (byte) 0),
PP_Bizon_Streak( "PP Bizon", "Streak", Material.INK_SACK, (byte) 4), PP_Bizon_Streak( "PP Bizon", "Streak", Material.INK_SACK, (byte) 4),
@ -17,10 +17,10 @@ public enum MineStrikeSkin
P2000_Fire_Elemental( "P2000", "Fire Elemental", Material.INK_SACK, (byte) 6), P2000_Fire_Elemental( "P2000", "Fire Elemental", Material.INK_SACK, (byte) 6),
FAMAS_Pulse( "FAMAS", "Pulse", Material.CLAY_BALL, (byte) 0), FAMAS_Pulse( "FAMAS", "Pulse", Material.CLAY_BALL, (byte) 0),
M4A4_Howl( "M4A4", "Howl", Material.INK_SACK, (byte) 11), M4A4_Howl( "M4A4", "Howl", Material.INK_SACK, (byte) 11),
Steyr_AUG_Torque( "Steyr_AUG", "Torque", Material.BLAZE_ROD, (byte) 0), Steyr_AUG_Torque( "Steyr AUG", "Torque", Material.BLAZE_ROD, (byte) 0),
Glock_18_Fade( "Glock 18", "Fade", Material.INK_SACK, (byte) 13), Glock_18_Fade( "Glock 18", "Fade", Material.INK_SACK, (byte) 13),
Galil_AR_Eco( "Galil_AR", "Eco", Material.INK_SACK, (byte) 10), Galil_AR_Eco( "Galil AR", "Eco", Material.INK_SACK, (byte) 10),
AK_47_Vulcan( "AK_47", "Vulcan", Material.INK_SACK, (byte) 7), AK_47_Vulcan( "AK-47", "Vulcan", Material.INK_SACK, (byte) 7),
SG553_Pulse( "SG553", "Pulse", Material.INK_SACK, (byte) 5), SG553_Pulse( "SG553", "Pulse", Material.INK_SACK, (byte) 5),
Knife_M9_Bayonette_Fade( "Knife", "M9 Bayonette Fade", Material.DIAMOND_SWORD, (byte) 0); Knife_M9_Bayonette_Fade( "Knife", "M9 Bayonette Fade", Material.DIAMOND_SWORD, (byte) 0);

View File

@ -1165,6 +1165,10 @@ public abstract class Game implements Listener
otherList.removeAll(teamList); otherList.removeAll(teamList);
Player player = teamList.remove(0); Player player = teamList.remove(0);
WinEffectManager.prePlay(this, player, teamList, otherList); WinEffectManager.prePlay(this, player, teamList, otherList);
Location loc = SpectatorSpawn.clone().add(1000, 0, 1000);
loc.setY(200);
WinEffectManager.playWinEffect(loc);
} }
String winnerText = ChatColor.WHITE + "Nobody"; String winnerText = ChatColor.WHITE + "Nobody";
@ -1237,18 +1241,12 @@ public abstract class Game implements Listener
otherList.addAll(UtilServer.getPlayersCollection()); otherList.addAll(UtilServer.getPlayersCollection());
Player player = places.get(0); Player player = places.get(0);
otherList.remove(player); otherList.remove(player);
/*
while(otherList.size() < 10) {
Player p = UtilServer.getPlayers()[UtilMath.r(UtilServer.getPlayers().length)];
otherList.add(p);
}
while(teamList.size() < 10) {
Player p = UtilServer.getPlayers()[UtilMath.r(UtilServer.getPlayers().length)];
teamList.add(p);
}
*/
WinEffectManager.prePlay(this, player, teamList, otherList); WinEffectManager.prePlay(this, player, teamList, otherList);
Location loc = SpectatorSpawn.clone().add(1000, 0, 1000);
loc.setY(200);
WinEffectManager.playWinEffect(loc);
} }
for (Player player : UtilServer.getPlayers()) for (Player player : UtilServer.getPlayers())
@ -1852,6 +1850,7 @@ public abstract class Game implements Listener
public void disable(){} public void disable(){}
//TODO: REMOVE THIS!
@EventHandler @EventHandler
public void onCommand(PlayerCommandPreprocessEvent event) public void onCommand(PlayerCommandPreprocessEvent event)
{ {

View File

@ -1300,18 +1300,23 @@ public class MineStrike extends TeamGame
{ {
if (event.GetDamagerPlayer(false) != null) if (event.GetDamagerPlayer(false) != null)
{ {
Player damager = event.GetDamagerPlayer(false);
GadgetManager gadgetManager = Manager.getCosmeticManager().getGadgetManager();
GameModifierMineStrikeSkin knifeSkin = (GameModifierMineStrikeSkin) gadgetManager.getActiveGameModifier(damager,
GameModifierType.MineStrike, GameModifierMineStrikeSkin.getWeaponFilter("Knife"));
ItemStack inHand = damager.getItemInHand();
//Cancel Non-Knife Melee //Cancel Non-Knife Melee
if (!UtilGear.isMat(event.GetDamagerPlayer(false).getItemInHand(), Material.IRON_AXE) && if (!UtilGear.isMat(inHand, Material.IRON_AXE) &&
!UtilGear.isMat(event.GetDamagerPlayer(false).getItemInHand(), Material.IRON_SWORD)) !UtilGear.isMat(inHand, Material.IRON_SWORD) &&
!(knifeSkin != null && UtilGear.isMatAndData(inHand, knifeSkin.getSkinMaterial(), knifeSkin.getSkinData())))
{ {
event.SetCancelled("Non-Knife"); event.SetCancelled("Non-Knife");
} }
//Knife Attack //Knife Attack
else if (!event.IsCancelled()) else if (!event.IsCancelled())
{ {
Player damager = event.GetDamagerPlayer(false);
if (damager == null) return;
LivingEntity damagee = event.GetDamageeEntity(); LivingEntity damagee = event.GetDamageeEntity();
if (damagee == null) return; if (damagee == null) return;

View File

@ -2,6 +2,7 @@ package nautilus.game.arcade.game.games.minestrike.items;
import java.util.ArrayList; import java.util.ArrayList;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.Sound; import org.bukkit.Sound;
@ -9,6 +10,7 @@ import org.bukkit.entity.Entity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta; import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.material.MaterialData;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
@ -87,10 +89,9 @@ public abstract class StrikeItem
public void setSkin(Material skinMaterial, byte skinData) public void setSkin(Material skinMaterial, byte skinData)
{ {
_skinMaterial = skinMaterial; _skinMaterial = skinMaterial;
_stack.setType(skinMaterial);
_skinData = skinData; _skinData = skinData;
_stack.getData().setData(skinData);
_stack = new ItemStack(skinMaterial, 1, (short) 0, skinData);
} }
public String getOwnerName() public String getOwnerName()

View File

@ -3,6 +3,17 @@ package nautilus.game.arcade.managers;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Iterator; import java.util.Iterator;
import org.bukkit.ChatColor;
import org.bukkit.Color;
import org.bukkit.FireworkEffect.Type;
import org.bukkit.Location;
import org.bukkit.Sound;
import org.bukkit.entity.Creature;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import mineplex.core.bonuses.event.CarlSpinnerEvent; import mineplex.core.bonuses.event.CarlSpinnerEvent;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
@ -37,17 +48,6 @@ import nautilus.game.arcade.game.games.uhc.UHC;
import nautilus.game.arcade.gametutorial.TutorialPhase; import nautilus.game.arcade.gametutorial.TutorialPhase;
import nautilus.game.arcade.gametutorial.TutorialText; import nautilus.game.arcade.gametutorial.TutorialText;
import org.bukkit.ChatColor;
import org.bukkit.Color;
import org.bukkit.FireworkEffect.Type;
import org.bukkit.Location;
import org.bukkit.Sound;
import org.bukkit.entity.Creature;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
public class GameManager implements Listener public class GameManager implements Listener
{ {
ArcadeManager Manager; ArcadeManager Manager;
@ -398,9 +398,6 @@ public class GameManager implements Listener
if (UtilTime.elapsed(game.GetStateTime(), 3000)) if (UtilTime.elapsed(game.GetStateTime(), 3000))
{ {
game.SetState(GameState.WinRoom); game.SetState(GameState.WinRoom);
Location loc = game.SpectatorSpawn.clone().add(1000, 0, 1000);
loc.setY(200);
game.WinEffectManager.playWinEffect(loc);
} }
} }
else if (game.GetState() == GameState.WinRoom) else if (game.GetState() == GameState.WinRoom)