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