Merge remote-tracking branch 'origin/master'

This commit is contained in:
Shaun Bennett 2015-10-06 12:24:34 -04:00
commit 8fb82507e1
6 changed files with 512 additions and 66 deletions

View File

@ -0,0 +1,232 @@
package mineplex.core.common.lang;
import java.text.Format;
import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Locale;
import org.bukkit.ChatColor;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
public class IntlString
{
public static IntlString[] toIntl(String... strings)
{
IntlString[] intl = new IntlString[strings.length];
for (int i = 0; i < strings.length; i++) {
final String string = strings[i];
intl[i] = new IntlString("")
{
public String tr(Locale locale)
{
return string;
}
};
}
return intl;
}
/**
* An empty {@link IntlString}.
*/
public static final IntlString EMPTY = toIntl("")[0];
private final Argument<String> key;
private final List<Argument<Object>> arguments = new ArrayList<>();
public IntlString(String key, ChatColor... styles)
{
this.key = new Argument<>(key, styles);
}
IntlString(String key, String style)
{
this.key = new Argument<>(key, style);
}
private IntlString arg(Argument<Object> argument)
{
IntlString result = new IntlString(getKey().getArgument(), getKey().getStyle());
result.arguments.addAll(getArguments());
result.arguments.add(argument);
return result;
}
public Argument<String> getKey()
{
return key;
}
public List<Argument<Object>> getArguments()
{
return Collections.unmodifiableList(arguments);
}
public IntlString arg(Object value, ChatColor... styles)
{
return arg(new Argument<>(value, styles));
}
public IntlString arg(Object value, String style)
{
return arg(new Argument<>(value, style));
}
public String tr()
{
return tr(Locale.getDefault());
}
public String tr(Entity entity)
{
if (entity instanceof Player)
return tr((Player) entity);
else
return tr();
}
public String tr(Player player)
{
return tr(Lang.getPlayerLocale(player));
}
public String tr(Locale locale)
{
if (locale == null)
locale = Locale.getDefault();
String formatString = Lang.get(getKey().getArgument(), locale);
if (getKey().getArgument().equals("stats.achievements.disabled.requires.0.players"))
{
int x = 8;
}
if (getArguments().isEmpty())
return getKey().getStyle() + formatString;
else
{
MessageFormat format = new MessageFormat(formatString, locale);
Format[] formats = format.getFormatsByArgumentIndex();
Object[] argArray = new Object[getArguments().size()];
for (int i = 0; i < formats.length; i++)
{
argArray[i] = getArguments().get(i);
if (argArray[i] instanceof IntlString)
argArray[i] = ((IntlString) argArray[i]).tr(locale);
if (formats[i] != null)
{
argArray[i] = formats[i].format(argArray[i]);
format.setFormatByArgumentIndex(i, null);
}
String style = getArguments().get(i).getStyle();
if (!style.isEmpty())
argArray[i] = style + argArray[i] + ChatColor.RESET;
argArray[i] = argArray[i] + getKey().getStyle();
}
return getKey().getStyle() + format.format(argArray, new StringBuffer(), null).toString();
}
}
@Override
public boolean equals(Object o)
{
if (!(o instanceof IntlString))
return false;
IntlString s = (IntlString) o;
return getKey().equals(s.getKey()) && getArguments().equals(s.getArguments());
}
@Override
public int hashCode()
{
return toString().hashCode();
}
@Override
public String toString()
{
return toEnglishString();
}
public String toEnglishString()
{
return tr(Locale.ENGLISH);
}
private static class Argument<T>
{
private final T argument;
private final String style;
public Argument(T value, ChatColor... styles)
{
this.argument = value;
String s = "";
ChatColor color = null;
for (ChatColor style : styles)
{
if (style.isColor())
color = style;
else if (style.isFormat())
s += style;
}
this.style = ChatColor.getLastColors((color == null ? "" : color) + s);
}
public Argument(T value, String style)
{
this.argument = value;
this.style = style == null ? "" : ChatColor.getLastColors(style);
}
public T getArgument()
{
return argument;
}
public String getStyle()
{
return style;
}
@Override
public boolean equals(Object o)
{
if (!(o instanceof Argument))
return false;
Argument<?> p = (Argument<?>) o;
return getArgument().equals(p.getArgument()) && getStyle().equals(p.getStyle());
}
@Override
public int hashCode()
{
return toString().hashCode();
}
@Override
public String toString()
{
return getStyle() + getArgument();
}
}
}

View File

@ -0,0 +1,154 @@
package mineplex.core.common.lang;
import java.util.Collections;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
import mineplex.core.common.util.F;
import org.bukkit.ChatColor;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
public final class Lang
{
public static interface PlayerLocaleFunction
{
public Locale getLocaleOfPlayer(Player player);
}
private static PlayerLocaleFunction _playerLocaleFunction = null;
private static final Map<Locale, ResourceBundle> _localeResourceBundles = Collections.synchronizedMap(new HashMap<Locale, ResourceBundle>());
public Lang()
{
init();
}
private void init()
{
System.out.println(F.main("i18n","Attempting to initialize resource bundles..."));
try
{
// Locales over which we should iterate and load.
for (Locale loc : new Locale[] {
Locale.ENGLISH,
Locale.GERMAN
})
{
ResourceBundle bundle = ResourceBundle.getBundle("mineplex.core.common.lang.MineplexBundle", loc);
_localeResourceBundles.put(loc, bundle);
System.out.println("Loaded " + loc.toString() + "...");
}
}
catch (MissingResourceException e)
{
System.err.println("AN ERROR OCCURED WHILE ATTEMPTING TO LOAD RESOURCE LOCALES");
// For now at least, crash the runtime.
throw new RuntimeException(e);
}
}
public static PlayerLocaleFunction getPlayerLocaleFunction()
{
return _playerLocaleFunction;
}
public static void setPlayerLocaleFunction(PlayerLocaleFunction playerLocaleFunction)
{
_playerLocaleFunction = playerLocaleFunction;
}
public static Locale getPlayerLocale(Player player)
{
if (getPlayerLocaleFunction() == null)
return Locale.getDefault();
else
return getPlayerLocaleFunction().getLocaleOfPlayer(player);
}
public static ResourceBundle getResourceBundle(Locale locale)
{
synchronized (_localeResourceBundles)
{
if (_localeResourceBundles.containsKey(locale))
return _localeResourceBundles.get(locale);
else
{
return _localeResourceBundles.get(Locale.ENGLISH);
}
}
}
public static ResourceBundle getBestResourceBundle(Locale locale)
{
ResourceBundle bundle = getResourceBundle(locale);
if (bundle == null && !locale.equals(Locale.getDefault()))
bundle = getResourceBundle(Locale.getDefault());
if (bundle == null && !locale.equals(Locale.ENGLISH))
bundle = getResourceBundle(Locale.ENGLISH);
return bundle;
}
/**
* Shorthand method for obtaining and translating a key.
*/
public static String tr(String key, Entity entity, Object... args)
{
IntlString string = key(key);
for (Object a : args)
string.arg(a);
return string.tr(entity);
}
public static String get(String key)
{
return get(key, (Locale) null);
}
public static String get(String key, Locale locale)
{
if (key == null)
return null;
else if (key.isEmpty())
return "";
else
{
if (locale == null)
locale = Locale.getDefault();
ResourceBundle bundle = getBestResourceBundle(locale);
if (bundle == null)
return null;
return bundle.getString(key);
}
}
public static String get(String key, Player player)
{
return get(key, getPlayerLocale(player));
}
public static IntlString key(String key, ChatColor... styles)
{
return new IntlString(key, styles);
}
public static IntlString key(String key, String style)
{
return new IntlString(key, style);
}
}

View File

@ -60,18 +60,18 @@ public class NotificationManager extends MiniPlugin
if (rank == Rank.ALL) if (rank == Rank.ALL)
{ {
UtilPlayer.message(player, C.cWhite + "50% Off Sale! " + " Purchase " + C.cAqua + C.Bold + "Ultra Rank" + C.cWhite + " for $15"); UtilPlayer.message(player, C.cWhite + " 50% Off Sale! " + " Purchase " + C.cAqua + C.Bold + "Ultra Rank" + C.cWhite + " for $15");
} }
else if (rank == Rank.ULTRA) else if (rank == Rank.ULTRA)
{ {
UtilPlayer.message(player, C.cWhite + "50% Off Sale! " + " Upgrade to " + C.cPurple + C.Bold + "Hero Rank" + C.cWhite + " for $15!"); UtilPlayer.message(player, C.cWhite + " 50% Off Sale! " + " Upgrade to " + C.cPurple + C.Bold + "Hero Rank" + C.cWhite + " for $15!");
} }
else if (rank == Rank.HERO) else if (rank == Rank.HERO)
{ {
UtilPlayer.message(player, C.cWhite + "50% Off Sale! " + "Upgrade to " + C.cGreen + C.Bold + "Legend Rank" + C.cWhite + " for $15!"); UtilPlayer.message(player, C.cWhite + " 50% Off Sale! " + "Upgrade to " + C.cGreen + C.Bold + "Legend Rank" + C.cWhite + " for $15!");
} }
UtilPlayer.message(player, C.cWhite + " Visit " + F.link("www.mineplex.com/shop") + " for 50% Off Ranks!"); UtilPlayer.message(player, C.cWhite + " Visit " + F.link("www.mineplex.com/shop") + C.cWhite + " for 50% Off Ranks!");
} }
} }

View File

@ -165,7 +165,19 @@ public class PreferencesPage extends ShopPageBase<PreferencesManager, Preference
protected void toggleHubInvisibility(org.bukkit.entity.Player player) protected void toggleHubInvisibility(org.bukkit.entity.Player player)
{ {
getPlugin().Get(player).Invisibility = !getPlugin().Get(player).Invisibility; getPlugin().Get(player).Invisibility = !getPlugin().Get(player).Invisibility;
_hubInvisibilityToggled = !_hubInvisibilityToggled;
//Dont save for Mod/SnrMod - prevents them just being invis 24/7
if (getPlugin().Get(player).Invisibility)
{
if (getClient().GetRank().has(Rank.ADMIN) ||
getClient().GetRank() == Rank.YOUTUBE ||
getClient().GetRank() == Rank.YOUTUBE_SMALL ||
getClient().GetRank() == Rank.TWITCH)
{
_hubInvisibilityToggled = !_hubInvisibilityToggled;
}
}
buildPage(); buildPage();
} }
@ -254,13 +266,7 @@ public class PreferencesPage extends ShopPageBase<PreferencesManager, Preference
buildPreference(index, Material.SKULL_ITEM, (byte)3, "Hub Party Requests", userPreferences.PartyRequests, _toggleHubPartyRequests); buildPreference(index, Material.SKULL_ITEM, (byte)3, "Hub Party Requests", userPreferences.PartyRequests, _toggleHubPartyRequests);
buildPreference(40, Material.RED_ROSE, "Show Pending Friend Requests", userPreferences.PendingFriendRequests, _togglePendingFriendRequests); buildPreference(40, Material.RED_ROSE, "Show Pending Friend Requests", userPreferences.PendingFriendRequests, _togglePendingFriendRequests);
if (getClientManager().Get(getPlayer()).GetRank() == Rank.YOUTUBE || getClientManager().Get(getPlayer()).GetRank() == Rank.TWITCH)
{
buildPreference(38, Material.NETHER_STAR, "Hub Invisibility", userPreferences.Invisibility, _toggleHubInvisibility);
buildPreference(42, Material.SLIME_BALL, "Hub Forcefield", userPreferences.HubForcefield, _toggleHubForcefield);
buildPreference(44, Material.SADDLE, "Hub Ignore Velocity", userPreferences.IgnoreVelocity, _toggleHubIgnoreVelocity);
}
if (getClientManager().Get(getPlayer()).GetRank().has(Rank.ADMIN) || getClientManager().Get(getPlayer()).GetRank() == Rank.JNR_DEV) if (getClientManager().Get(getPlayer()).GetRank().has(Rank.ADMIN) || getClientManager().Get(getPlayer()).GetRank() == Rank.JNR_DEV)
{ {
buildPreference(36, Material.NETHER_STAR, "Hub Invisibility", userPreferences.Invisibility, _toggleHubInvisibility); buildPreference(36, Material.NETHER_STAR, "Hub Invisibility", userPreferences.Invisibility, _toggleHubInvisibility);
@ -270,8 +276,15 @@ public class PreferencesPage extends ShopPageBase<PreferencesManager, Preference
} }
else if (getClientManager().Get(getPlayer()).GetRank().has(Rank.MODERATOR)) else if (getClientManager().Get(getPlayer()).GetRank().has(Rank.MODERATOR))
{ {
buildPreference(38, Material.PAPER, "Mac Reports", userPreferences.ShowMacReports, _toggleMacReports); buildPreference(38, Material.NETHER_STAR, "Hub Invisibility", userPreferences.Invisibility, _toggleHubInvisibility);
buildPreference(42, Material.SADDLE, "Hub Ignore Velocity", userPreferences.IgnoreVelocity, _toggleHubIgnoreVelocity); buildPreference(42, Material.PAPER, "Mac Reports", userPreferences.ShowMacReports, _toggleMacReports);
buildPreference(44, Material.SADDLE, "Hub Ignore Velocity", userPreferences.IgnoreVelocity, _toggleHubIgnoreVelocity);
}
else if (getClientManager().Get(getPlayer()).GetRank() == Rank.YOUTUBE || getClientManager().Get(getPlayer()).GetRank() == Rank.TWITCH)
{
buildPreference(38, Material.NETHER_STAR, "Hub Invisibility", userPreferences.Invisibility, _toggleHubInvisibility);
buildPreference(42, Material.SLIME_BALL, "Hub Forcefield", userPreferences.HubForcefield, _toggleHubForcefield);
buildPreference(44, Material.SADDLE, "Hub Ignore Velocity", userPreferences.IgnoreVelocity, _toggleHubIgnoreVelocity);
} }
} }

View File

@ -40,6 +40,11 @@ public class JumpManager extends MiniPlugin
if (player.getGameMode() == GameMode.CREATIVE) if (player.getGameMode() == GameMode.CREATIVE)
return; return;
if (Manager.getPreferences().Get(player).Invisibility)
{
return;
}
//Chicken Cancel //Chicken Cancel
DisguiseBase disguise = Manager.GetDisguise().getDisguise(player); DisguiseBase disguise = Manager.GetDisguise().getDisguise(player);
if (disguise != null && if (disguise != null &&
@ -70,6 +75,12 @@ public class JumpManager extends MiniPlugin
if (player.getGameMode() == GameMode.CREATIVE) if (player.getGameMode() == GameMode.CREATIVE)
continue; continue;
if (Manager.getPreferences().Get(player).Invisibility)
{
player.setAllowFlight(true);
continue;
}
if (Manager.GetParkour().isParkourMode(player)) if (Manager.GetParkour().isParkourMode(player))
{ {
player.setAllowFlight(false); player.setAllowFlight(false);

View File

@ -4,17 +4,44 @@ import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.core.condition.Condition.ConditionType;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType;
import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.events.PlayerPrepareTeleportEvent;
import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.game.GameTeam.PlayerState;
import nautilus.game.arcade.game.TeamGame;
import nautilus.game.arcade.game.games.paintball.kits.KitMachineGun;
import nautilus.game.arcade.game.games.paintball.kits.KitRifle;
import nautilus.game.arcade.game.games.paintball.kits.KitShotgun;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.stats.KillFastStatTracker;
import nautilus.game.arcade.stats.LastStandStatTracker;
import nautilus.game.arcade.stats.MedicStatTracker;
import nautilus.game.arcade.stats.WinFastStatTracker;
import nautilus.game.arcade.stats.WinWithoutLosingTeammateStatTracker;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Color; import org.bukkit.Color;
import org.bukkit.Effect; import org.bukkit.Effect;
import org.bukkit.GameMode;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.Sound; import org.bukkit.Sound;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer; import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
import org.bukkit.entity.EnderPearl; import org.bukkit.entity.EnderPearl;
import org.bukkit.entity.HumanEntity;
import org.bukkit.entity.LivingEntity; import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.entity.Snowball; import org.bukkit.entity.Snowball;
@ -22,9 +49,11 @@ import org.bukkit.entity.ThrownPotion;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority; import org.bukkit.event.EventPriority;
import org.bukkit.event.HandlerList; import org.bukkit.event.HandlerList;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.entity.EntityRegainHealthEvent; import org.bukkit.event.entity.EntityRegainHealthEvent;
import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason; import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason;
import org.bukkit.event.entity.ProjectileHitEvent; import org.bukkit.event.entity.ProjectileHitEvent;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.event.player.PlayerEvent; import org.bukkit.event.player.PlayerEvent;
import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.event.player.PlayerTeleportEvent; import org.bukkit.event.player.PlayerTeleportEvent;
@ -34,31 +63,6 @@ import org.bukkit.inventory.meta.LeatherArmorMeta;
import org.bukkit.potion.PotionEffectType; import org.bukkit.potion.PotionEffectType;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.minecraft.game.core.condition.Condition.ConditionType;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType;
import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.events.PlayerPrepareTeleportEvent;
import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.game.TeamGame;
import nautilus.game.arcade.game.GameTeam.PlayerState;
import nautilus.game.arcade.game.games.paintball.kits.*;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.stats.KillFastStatTracker;
import nautilus.game.arcade.stats.LastStandStatTracker;
import nautilus.game.arcade.stats.MedicStatTracker;
import nautilus.game.arcade.stats.WinFastStatTracker;
import nautilus.game.arcade.stats.WinWithoutLosingTeammateStatTracker;
public class Paintball extends TeamGame public class Paintball extends TeamGame
{ {
public static class ReviveEvent extends PlayerEvent public static class ReviveEvent extends PlayerEvent
@ -137,7 +141,6 @@ public class Paintball extends TeamGame
this.GetTeamList().get(1).SetName("Nether"); this.GetTeamList().get(1).SetName("Nether");
} }
@EventHandler(priority = EventPriority.HIGHEST) @EventHandler(priority = EventPriority.HIGHEST)
public void ColorArmor(PlayerPrepareTeleportEvent event) public void ColorArmor(PlayerPrepareTeleportEvent event)
{ {
@ -161,31 +164,44 @@ public class Paintball extends TeamGame
@EventHandler @EventHandler
public void Paint(ProjectileHitEvent event) public void Paint(ProjectileHitEvent event)
{ {
if (event.getEntity() instanceof ThrownPotion) // Fixed projectile wool painting in waiting lobby.
return;
byte color = 3; if (IsLive() || GetState() == GameState.End)
if (event.getEntity() instanceof EnderPearl)
color = 14;
Location loc = event.getEntity().getLocation().add(event.getEntity().getVelocity());
for (Block block : UtilBlock.getInRadius(loc, 1.5d).keySet())
{ {
if (block.getType() != Material.WOOL && block.getType() != Material.STAINED_CLAY) if (event.getEntity() instanceof ThrownPotion)
continue; return;
byte color = 3;
if (event.getEntity() instanceof EnderPearl)
color = 14;
Location loc = event.getEntity().getLocation().add(event.getEntity().getVelocity());
for (Block block : UtilBlock.getInRadius(loc, 1.5d).keySet())
{
if (block.getType() != Material.WOOL && block.getType() != Material.STAINED_CLAY)
continue;
block.setData(color);
}
if (color == 3) loc.getWorld().playEffect(loc, Effect.STEP_SOUND, 8);
else loc.getWorld().playEffect(loc, Effect.STEP_SOUND, 10);
block.setData(color);
} }
if (color == 3) loc.getWorld().playEffect(loc, Effect.STEP_SOUND, 8);
else loc.getWorld().playEffect(loc, Effect.STEP_SOUND, 10);
} }
@EventHandler @EventHandler
public void PlayerQuit(PlayerQuitEvent event) public void PlayerQuit(PlayerQuitEvent event)
{ {
_doubles.remove(event.getPlayer()); Player player = event.getPlayer();
if (_doubles.containsKey(player))
{
PlayerCopy copy = _doubles.get(player);
copy.GetEntity().remove();
_doubles.remove(player);
}
} }
@EventHandler @EventHandler
@ -194,7 +210,9 @@ public class Paintball extends TeamGame
if (event.GetDamageePlayer() == null) if (event.GetDamageePlayer() == null)
event.SetCancelled("Not Player"); event.SetCancelled("Not Player");
if (event.GetProjectile() == null) // Fixed void damage being blocked from this check.
if (event.GetProjectile() == null && event.GetCause() != DamageCause.VOID)
event.SetCancelled("No Projectile"); event.SetCancelled("No Projectile");
} }
@ -203,7 +221,7 @@ public class Paintball extends TeamGame
{ {
if (!IsLive()) if (!IsLive())
return; return;
if (event.GetProjectile() == null) if (event.GetProjectile() == null)
return; return;
@ -211,23 +229,28 @@ public class Paintball extends TeamGame
return; return;
//Negate //Negate
event.AddMod("Negate", "Negate", -event.GetDamageInitial(), false); event.AddMod("Negate", "Negate", -event.GetDamageInitial(), false);
event.AddMod("Paintball", "Paintball", 2, true); event.AddMod("Paintball", "Paintball", 2, true);
event.AddKnockback("Paintball", 2); event.AddKnockback("Paintball", 2);
Player damagee = event.GetDamageePlayer(); Player damagee = event.GetDamageePlayer();
if (damagee == null) return; if (damagee == null)
return;
Player damager = event.GetDamagerPlayer(true); Player damager = event.GetDamagerPlayer(true);
if (damager == null) return; if (damager == null)
return;
GameTeam damageeTeam = GetTeam(damagee); GameTeam damageeTeam = GetTeam(damagee);
if (damageeTeam == null) return; if (damageeTeam == null)
return;
GameTeam damagerTeam = GetTeam(damager); GameTeam damagerTeam = GetTeam(damager);
if (damagerTeam == null) return; if (damagerTeam == null)
return;
if (damagerTeam.equals(damageeTeam)) if (damagerTeam.equals(damageeTeam))
return; return;
@ -257,8 +280,21 @@ public class Paintball extends TeamGame
Player player = event.GetDamagerPlayer(true); Player player = event.GetDamagerPlayer(true);
if (player != null) if (player != null)
player.playSound(player.getLocation(), Sound.ORB_PICKUP, 1f, 3f); player.playSound(player.getLocation(), Sound.ORB_PICKUP, 1f, 3f);
} }
@EventHandler
public void ArmorRemoveCancel(InventoryClickEvent event)
{
HumanEntity player = event.getWhoClicked();
// Fixed armor being taken off while spectating after being painted.
if (!IsAlive(player))
{
event.setCancelled(true);
}
}
public boolean Color(Player player, int amount) public boolean Color(Player player, int amount)
{ {
//Get Non-Coloured //Get Non-Coloured