Improve GunModule with editable variables
This commit is contained in:
parent
4dedd27227
commit
36285ee101
@ -102,10 +102,6 @@ public class GunModule implements Listener
|
||||
public ArcadeManager Manager;
|
||||
private Game _host;
|
||||
|
||||
public static float RECOIL = 0.8f;
|
||||
public static float CONE = 0.7f;
|
||||
public static float MOVE_PENALTY = 0.8f;
|
||||
|
||||
public static class RoundOverEvent extends Event
|
||||
{
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
@ -134,19 +130,24 @@ public class GunModule implements Listener
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static float RECOIL = 0.8f;
|
||||
public static float CONE = 0.7f;
|
||||
public static float MOVE_PENALTY = 0.8f;
|
||||
|
||||
public boolean Debug = false;
|
||||
public int BulletInstant = 2; //0 = Slow, 1 = Instant, 2 = Mix
|
||||
public boolean CustomHitbox = true;
|
||||
public boolean BulletAlternate = false;
|
||||
|
||||
public boolean EnablePickup = true;
|
||||
public boolean EnableDrop = true;
|
||||
public boolean EnableCleaning = true;
|
||||
|
||||
private long _freezeTime = -1;
|
||||
|
||||
private int _round;
|
||||
|
||||
private boolean _enablePickup = true;
|
||||
private boolean _enableDrop = true;
|
||||
private boolean _enableCleaning = true;
|
||||
|
||||
//Ongoing Data
|
||||
private HashMap<Gun, Player> _gunsEquipped = new HashMap<Gun, Player>();
|
||||
private HashMap<Grenade, Player> _grenadesEquipped = new HashMap<Grenade, Player>();
|
||||
@ -428,7 +429,7 @@ public class GunModule implements Listener
|
||||
@EventHandler
|
||||
public void triggerDrop(PlayerDropItemEvent event)
|
||||
{
|
||||
if(!_enableDrop)
|
||||
if(!EnableDrop)
|
||||
return;
|
||||
|
||||
if (!_host.InProgress())
|
||||
@ -574,7 +575,7 @@ public class GunModule implements Listener
|
||||
@EventHandler
|
||||
public void triggerPickup(PlayerPickupItemEvent event)
|
||||
{
|
||||
if (!_enablePickup)
|
||||
if (!EnablePickup)
|
||||
return;
|
||||
|
||||
if (!_host.InProgress())
|
||||
@ -1476,7 +1477,7 @@ public class GunModule implements Listener
|
||||
@EventHandler
|
||||
public void clean(UpdateEvent event)
|
||||
{
|
||||
if(!_enableCleaning)
|
||||
if(!EnableCleaning)
|
||||
return;
|
||||
|
||||
if (!_host.IsLive())
|
||||
@ -1666,8 +1667,8 @@ public class GunModule implements Listener
|
||||
{
|
||||
try
|
||||
{
|
||||
GunModule.RECOIL = Float.parseFloat(event.getMessage().split(" ")[1]);
|
||||
_host.Announce(C.cPurple + C.Bold + "Recoil Bloom: " + ChatColor.RESET + (int)(GunModule.RECOIL * 100) + "%");
|
||||
RECOIL = Float.parseFloat(event.getMessage().split(" ")[1]);
|
||||
_host.Announce(C.cPurple + C.Bold + "Recoil Bloom: " + ChatColor.RESET + (int)(RECOIL * 100) + "%");
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
@ -1680,8 +1681,8 @@ public class GunModule implements Listener
|
||||
{
|
||||
try
|
||||
{
|
||||
GunModule.CONE = Float.parseFloat(event.getMessage().split(" ")[1]);
|
||||
_host.Announce(C.cPurple + C.Bold + "Cone of Fire: " + ChatColor.RESET + (int)(GunModule.CONE * 100) + "%");
|
||||
CONE = Float.parseFloat(event.getMessage().split(" ")[1]);
|
||||
_host.Announce(C.cPurple + C.Bold + "Cone of Fire: " + ChatColor.RESET + (int)(CONE * 100) + "%");
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
@ -1694,8 +1695,8 @@ public class GunModule implements Listener
|
||||
{
|
||||
try
|
||||
{
|
||||
GunModule.MOVE_PENALTY = Float.parseFloat(event.getMessage().split(" ")[1]);
|
||||
_host.Announce(C.cPurple + C.Bold + "Move/Sprint/Jump Penalties: " + ChatColor.RESET + (int)(GunModule.MOVE_PENALTY * 100) + "%");
|
||||
MOVE_PENALTY = Float.parseFloat(event.getMessage().split(" ")[1]);
|
||||
_host.Announce(C.cPurple + C.Bold + "Move/Sprint/Jump Penalties: " + ChatColor.RESET + (int)(MOVE_PENALTY * 100) + "%");
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
@ -1997,17 +1998,17 @@ public class GunModule implements Listener
|
||||
|
||||
public void setEnablePickup(boolean pickup)
|
||||
{
|
||||
_enablePickup = pickup;
|
||||
EnablePickup = pickup;
|
||||
}
|
||||
|
||||
public void setEnableDrop(boolean drop)
|
||||
{
|
||||
_enableDrop = drop;
|
||||
EnableDrop = drop;
|
||||
}
|
||||
|
||||
public void setEnableCleaning(boolean cleaning)
|
||||
{
|
||||
_enableCleaning = cleaning;
|
||||
EnableCleaning = cleaning;
|
||||
}
|
||||
|
||||
public Game getHost()
|
||||
|
@ -1,5 +1,6 @@
|
||||
package nautilus.game.arcade.game.games.minestrike.items.guns;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
@ -81,6 +82,10 @@ public class Gun extends StrikeItem
|
||||
_loadedAmmo = gunStats.getClipSize();
|
||||
_reserveAmmo = gunStats.getClipReserve() * gunStats.getClipSize();
|
||||
|
||||
ItemMeta meta = getStack().getItemMeta();
|
||||
meta.setLore(Arrays.asList(ChatColor.RED + "" + ChatColor.BOLD + "Identifier: " + UtilMath.r(1000) + 1));
|
||||
getStack().setItemMeta(meta);
|
||||
|
||||
updateWeaponName(null, null);
|
||||
}
|
||||
|
||||
@ -191,7 +196,7 @@ public class Gun extends StrikeItem
|
||||
Vector cof = new Vector(Math.random() - 0.5, (Math.random() - 0.2) * (5d/8d), Math.random() - 0.5);
|
||||
cof.normalize();
|
||||
cof.multiply(cone);
|
||||
cof.multiply(GunModule.CONE);
|
||||
cof.multiply(_module.CONE);
|
||||
|
||||
cof.add(player.getLocation().getDirection());
|
||||
cof.normalize();
|
||||
|
@ -83,9 +83,9 @@ public class StrikeGames extends SoloSurvivalGames
|
||||
_peacePhase = 20000;
|
||||
|
||||
_gunModule = new GunModule(this);
|
||||
_gunModule.setEnablePickup(false);
|
||||
_gunModule.setEnableDrop(false);
|
||||
_gunModule.setEnableCleaning(false);
|
||||
_gunModule.EnableCleaning = false;
|
||||
_gunModule.EnableDrop = false;
|
||||
_gunModule.EnablePickup = false;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@ -403,7 +403,10 @@ public class StrikeGames extends SoloSurvivalGames
|
||||
{
|
||||
Gun gun = new Gun(stat, _gunModule);
|
||||
ItemMeta meta = stack.getItemMeta();
|
||||
meta.setLore(Arrays.asList(ChatColor.RED + "" + ChatColor.BOLD + "Identifier: " + UtilMath.r(1000) + 1));
|
||||
|
||||
if (gun.getStack().hasItemMeta() && gun.getStack().getItemMeta().hasLore())
|
||||
meta.setLore(gun.getStack().getItemMeta().getLore());
|
||||
|
||||
stack.setItemMeta(meta);
|
||||
gun.setStack(stack);
|
||||
gun.updateWeaponName(player, null, false);
|
||||
|
Loading…
Reference in New Issue
Block a user