Started Work on Dungeons #43
13 changed files with 445 additions and 66 deletions
|
@ -1,5 +0,0 @@
|
||||||
UHCMatchState: "IDLE"
|
|
||||||
magic:
|
|
||||||
cannonbow:
|
|
||||||
speedmultiplier: 1.5
|
|
||||||
minforce: 0.2
|
|
|
@ -7,6 +7,8 @@ commands:
|
||||||
description: creates wireless redstone
|
description: creates wireless redstone
|
||||||
cb:
|
cb:
|
||||||
description: creates creative boundaries
|
description: creates creative boundaries
|
||||||
|
dungeons:
|
||||||
|
description: handles the resource dungeons scattered around the map
|
||||||
debug:
|
debug:
|
||||||
description: debug commands
|
description: debug commands
|
||||||
flaircolour:
|
flaircolour:
|
||||||
|
|
|
@ -8,6 +8,7 @@ import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
import buttondevteam.alipresents.components.alilinks.AliLinkComponent;
|
import buttondevteam.alipresents.components.alilinks.AliLinkComponent;
|
||||||
import buttondevteam.alipresents.components.creativeboundaries.CreativeBoundariesComponent;
|
import buttondevteam.alipresents.components.creativeboundaries.CreativeBoundariesComponent;
|
||||||
|
import buttondevteam.alipresents.components.dungeons.DungeonComponent;
|
||||||
import buttondevteam.alipresents.components.flaircolour.FlairColourComponent;
|
import buttondevteam.alipresents.components.flaircolour.FlairColourComponent;
|
||||||
import buttondevteam.alipresents.components.gpower.GPowerComponent;
|
import buttondevteam.alipresents.components.gpower.GPowerComponent;
|
||||||
import buttondevteam.alipresents.components.hotfix.HotfixComponent;
|
import buttondevteam.alipresents.components.hotfix.HotfixComponent;
|
||||||
|
@ -24,6 +25,7 @@ public class AliPresents extends JavaPlugin{
|
||||||
|
|
||||||
new AliLinkComponent().register(this);
|
new AliLinkComponent().register(this);
|
||||||
new CreativeBoundariesComponent().register(this);
|
new CreativeBoundariesComponent().register(this);
|
||||||
|
new DungeonComponent().register(this);
|
||||||
new FlairColourComponent().register(this);
|
new FlairColourComponent().register(this);
|
||||||
new GPowerComponent().register(this);
|
new GPowerComponent().register(this);
|
||||||
new HotfixComponent().register(this);
|
new HotfixComponent().register(this);
|
||||||
|
|
|
@ -0,0 +1,26 @@
|
||||||
|
package buttondevteam.alipresents.components.dungeons;
|
||||||
|
|
||||||
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
|
import buttondevteam.alipresents.architecture.Component;
|
||||||
|
import buttondevteam.alipresents.components.dungeons.commands.DisplayDebug;
|
||||||
|
import buttondevteam.alipresents.components.dungeons.commands.Enter;
|
||||||
|
import buttondevteam.alipresents.components.dungeons.commands.Exit;
|
||||||
|
import buttondevteam.alipresents.components.dungeons.commands.SetEntrance;
|
||||||
|
import buttondevteam.alipresents.components.dungeons.commands.SetExit;
|
||||||
|
import buttondevteam.alipresents.components.dungeons.dungeons.GenericDungeonA1;
|
||||||
|
|
||||||
|
public class DungeonComponent extends Component {
|
||||||
|
public GenericDungeonA1 dungeonA1;
|
||||||
|
@Override
|
||||||
|
public void register(JavaPlugin plugin) {
|
||||||
|
dungeonA1 = new GenericDungeonA1(plugin);
|
||||||
|
|
||||||
|
registerCommand(plugin, new DisplayDebug(this));
|
||||||
|
registerCommand(plugin, new Enter(this));
|
||||||
|
registerCommand(plugin, new Exit(this));
|
||||||
|
registerCommand(plugin, new SetEntrance(this));
|
||||||
|
registerCommand(plugin, new SetExit(this));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,28 @@
|
||||||
|
package buttondevteam.alipresents.components.dungeons.commands;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import buttondevteam.alipresents.architecture.commands.ModCommand;
|
||||||
|
import buttondevteam.alipresents.components.dungeons.DungeonComponent;
|
||||||
|
|
||||||
|
public class DisplayDebug extends ModCommand {
|
||||||
|
|
||||||
|
private DungeonComponent component;
|
||||||
|
|
||||||
|
public DisplayDebug(DungeonComponent component) {
|
||||||
|
this.component = component;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean OnCommand(Player player, String alias, String[] args) {
|
||||||
|
player.sendMessage("Entrance Location: "+component.dungeonA1.getDungeonEntrance().toString());
|
||||||
|
player.sendMessage("Exit Location: "+component.dungeonA1.getDungeonExit().toString());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String GetCommandPath(){
|
||||||
|
return "dungeons display debug";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,23 @@
|
||||||
|
package buttondevteam.alipresents.components.dungeons.commands;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import buttondevteam.alipresents.architecture.commands.ModCommand;
|
||||||
|
import buttondevteam.alipresents.components.dungeons.DungeonComponent;
|
||||||
|
|
||||||
|
public class Enter extends ModCommand{
|
||||||
|
private DungeonComponent component;
|
||||||
|
public Enter(DungeonComponent component) {
|
||||||
|
this.component = component;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public boolean OnCommand(Player player, String alias, String[] args) {
|
||||||
|
component.dungeonA1.enterDungeon(player);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public String GetCommandPath(){
|
||||||
|
return "dungeons enter";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,24 @@
|
||||||
|
package buttondevteam.alipresents.components.dungeons.commands;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import buttondevteam.alipresents.architecture.commands.PlayerCommand;
|
||||||
|
import buttondevteam.alipresents.components.dungeons.DungeonComponent;
|
||||||
|
|
||||||
|
public class Exit extends PlayerCommand {
|
||||||
|
|
||||||
|
private DungeonComponent component;
|
||||||
|
public Exit(DungeonComponent component) {
|
||||||
|
this.component = component;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public boolean OnCommand(Player player, String alias, String[] args) {
|
||||||
|
component.dungeonA1.exitDungeon(player);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public String GetCommandPath(){
|
||||||
|
return "dungeons exit";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,25 @@
|
||||||
|
package buttondevteam.alipresents.components.dungeons.commands;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import buttondevteam.alipresents.architecture.commands.ModCommand;
|
||||||
|
import buttondevteam.alipresents.components.dungeons.DungeonComponent;
|
||||||
|
|
||||||
|
public class SetEntrance extends ModCommand {
|
||||||
|
|
||||||
|
private DungeonComponent component;
|
||||||
|
public SetEntrance(DungeonComponent component) {
|
||||||
|
this.component = component;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public boolean OnCommand(Player player, String alias, String[] args) {
|
||||||
|
player.sendMessage("Setting DungeonA1's Entrance!");
|
||||||
|
component.dungeonA1.setEntrance(player.getLocation());
|
||||||
|
player.sendMessage("Entrance Set!");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
public String GetCommandPath(){
|
||||||
|
return "dungeons set entrance";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,28 @@
|
||||||
|
package buttondevteam.alipresents.components.dungeons.commands;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import buttondevteam.alipresents.architecture.commands.ModCommand;
|
||||||
|
import buttondevteam.alipresents.components.dungeons.DungeonComponent;
|
||||||
|
|
||||||
|
public class SetExit extends ModCommand {
|
||||||
|
|
||||||
|
private DungeonComponent component;
|
||||||
|
|
||||||
|
public SetExit(DungeonComponent component) {
|
||||||
|
this.component = component;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean OnCommand(Player player, String alias, String[] args) {
|
||||||
|
player.sendMessage("Setting DungeonA1's Exit!");
|
||||||
|
component.dungeonA1.setExit(player.getLocation());
|
||||||
|
player.sendMessage("DungeonA1's Exit Set!");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public String GetCommandPath(){
|
||||||
|
return "dungeons set exit";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,32 @@
|
||||||
|
package buttondevteam.alipresents.components.dungeons.dungeons;
|
||||||
|
|
||||||
|
import org.bukkit.GameMode;
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
/**Dungeon Object that represents a dungeon*/
|
||||||
|
public abstract class Dungeon {
|
||||||
|
public abstract Location getDungeonEntrance();
|
||||||
|
public abstract Location getDungeonExit();
|
||||||
|
public abstract void setEntrance(Location location);
|
||||||
|
public abstract void setExit(Location location);
|
||||||
|
public boolean enterDungeon(Player player){
|
||||||
|
|
||||||
|
if (getDungeonEntrance() == null){
|
||||||
|
player.sendMessage("There has been a collapse! You may not enter the dungeon now.");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
player.teleport(getDungeonEntrance());
|
||||||
|
player.setGameMode(GameMode.ADVENTURE);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
public boolean exitDungeon(Player player){
|
||||||
|
if (getDungeonExit() == null){
|
||||||
|
player.sendMessage("Oh god, something went horribly wrong with exiting... Yell for help!");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
player.teleport(getDungeonExit());
|
||||||
|
player.setGameMode(GameMode.SURVIVAL);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,91 @@
|
||||||
|
package buttondevteam.alipresents.components.dungeons.dungeons;
|
||||||
|
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.World;
|
||||||
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
|
public class GenericDungeonA1 extends Dungeon{
|
||||||
|
private Location entrance;
|
||||||
|
private Location exit;
|
||||||
|
private JavaPlugin plugin;
|
||||||
|
|
||||||
|
public GenericDungeonA1(JavaPlugin plugin){
|
||||||
|
if(!initDungeon(plugin)){
|
||||||
|
plugin.getServer().broadcastMessage("DungeonA1 cant be initialized!");
|
||||||
|
}
|
||||||
|
this.plugin = plugin;
|
||||||
|
}
|
||||||
|
private boolean initDungeon(JavaPlugin plugin){
|
||||||
|
/*
|
||||||
|
if (plugin.getServer().getWorld("Dungeons") == null || plugin.getServer().getWorld("world") == null){
|
||||||
|
plugin.getServer().broadcastMessage("GenericDungeonA1Error! One of the worlds is null!");
|
||||||
|
plugin.getServer().broadcastMessage("Available Worlds... " + plugin.getServer().getWorlds().toString());
|
||||||
|
return false;
|
||||||
|
}*/
|
||||||
|
Location temp;
|
||||||
|
if ((temp = loadLocation(plugin, "dungeons.dungeona1.enter")) != null){
|
||||||
|
entrance = temp;
|
||||||
|
}else if(plugin.getServer().getWorld("Dungeons") != null){
|
||||||
|
entrance = new Location(plugin.getServer().getWorld("Dungeons"), -7.5, 138.0, -91.5);
|
||||||
|
}else{
|
||||||
|
plugin.getServer().broadcastMessage("There is no working default dungeon entrance for A1, setting to null");
|
||||||
|
entrance = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
temp = null;
|
||||||
|
if ((temp = loadLocation(plugin, "dungeons.dungeona1.exit")) != null){
|
||||||
|
exit = temp;
|
||||||
|
}else if (plugin.getServer().getWorld("world") != null){
|
||||||
|
exit = plugin.getServer().getWorld("world").getSpawnLocation().clone();
|
||||||
|
}else{
|
||||||
|
plugin.getServer().broadcastMessage("There is no working default dungeon exit for A1, setting to null");
|
||||||
|
exit = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (entrance == null || exit == null){
|
||||||
|
plugin.getServer().broadcastMessage("DungeonA1Error! Dungeon Entrance or Exit is null!");
|
||||||
|
plugin.getServer().broadcastMessage("Dungeon Entrance: " + entrance.toString());
|
||||||
|
plugin.getServer().broadcastMessage("Dungeon Exit: " + exit.toString());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public void setEntrance(Location location){
|
||||||
|
saveLocation(plugin, "dungeons.dungeona1.enter", location);
|
||||||
|
entrance = location;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public void setExit(Location location){
|
||||||
|
saveLocation(plugin, "dungeons.dungeona1.exit", location);
|
||||||
|
exit = location;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public Location getDungeonEntrance() {
|
||||||
|
return entrance;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public Location getDungeonExit() {
|
||||||
|
return exit;
|
||||||
|
}
|
||||||
|
private void saveLocation(JavaPlugin plugin, String path, Location location){
|
||||||
|
plugin.getConfig().set(path+".world", location.getWorld().getName());
|
||||||
|
plugin.getConfig().set(path+".x", location.getX());
|
||||||
|
plugin.getConfig().set(path+".y", location.getY());
|
||||||
|
plugin.getConfig().set(path+".z", location.getZ());
|
||||||
|
plugin.saveConfig();
|
||||||
|
}
|
||||||
|
private Location loadLocation(JavaPlugin plugin, String path){
|
||||||
|
try{
|
||||||
|
World world = plugin.getServer().getWorld(plugin.getConfig().getString(path+".world"));
|
||||||
|
double x = plugin.getConfig().getDouble(path+".x");
|
||||||
|
double y = plugin.getConfig().getDouble(path+".y");
|
||||||
|
double z = plugin.getConfig().getDouble(path+".z");
|
||||||
|
|
||||||
|
return new Location(world, x, y, z);
|
||||||
|
}catch(Exception e){
|
||||||
|
e.printStackTrace();
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -4,6 +4,7 @@ import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.Particle;
|
import org.bukkit.Particle;
|
||||||
import org.bukkit.Sound;
|
import org.bukkit.Sound;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.configuration.file.FileConfiguration;
|
import org.bukkit.configuration.file.FileConfiguration;
|
||||||
import org.bukkit.enchantments.Enchantment;
|
import org.bukkit.enchantments.Enchantment;
|
||||||
import org.bukkit.entity.Arrow;
|
import org.bukkit.entity.Arrow;
|
||||||
|
@ -19,25 +20,56 @@ import org.bukkit.plugin.java.JavaPlugin;
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
public class CannonBowListener implements Listener {
|
public class CannonBowListener implements Listener {
|
||||||
private static double SpeedMultiplier = 1.5;
|
|
||||||
private static double minforce = 0.2;
|
private static double maxSpeedMultiplier = 4;
|
||||||
private static int fuseticks = 40;
|
private static double minSpeedMultiplier = 0;
|
||||||
private static double recoil = 1;
|
private static double defaultSpeedMultiplier = 1;
|
||||||
|
private static String speedMultiplierPath = "magic.cannonbow.speedmultiplier";
|
||||||
|
|
||||||
|
private static int maxFuseTicks = 400;
|
||||||
|
private static int minFuseTicks = 0;
|
||||||
|
private static int defaultFuseTicks = 30;
|
||||||
|
private static String fuseTicksPath = "magic.cannonbow.fuseticks";
|
||||||
|
|
||||||
|
private static double maxMinForce = 1;
|
||||||
|
private static double minMinForce = 0;
|
||||||
|
private static double defaultMinForce = 0.2;
|
||||||
|
private static String minForcePath = "magic.cannonbow.minforce";
|
||||||
|
|
||||||
|
private static double maxRecoil = 20;
|
||||||
|
private static double minRecoil = -5;
|
||||||
|
private static double defaultRecoil = 1;
|
||||||
|
private static String recoilPath = "magic.cannonbow.recoil";
|
||||||
|
|
||||||
|
private static boolean defaultIsDestructive = false;
|
||||||
|
private static String isDestructivePath = "magic.cannonbow.isdestructive";
|
||||||
|
|
||||||
|
private static double speedMultiplier = defaultSpeedMultiplier;
|
||||||
|
private static double minForce = defaultMinForce;
|
||||||
|
private static int fuseTicks = defaultFuseTicks;
|
||||||
|
private static double recoil = defaultRecoil;
|
||||||
|
private static boolean isDestructive = defaultIsDestructive;
|
||||||
|
|
||||||
public final static String launchedTNTName = "CANNON BOW TNT:42170";
|
public final static String launchedTNTName = "CANNON BOW TNT:42170";
|
||||||
|
|
||||||
|
static FileConfiguration config;
|
||||||
public CannonBowListener(JavaPlugin plugin){
|
public CannonBowListener(JavaPlugin plugin){
|
||||||
FileConfiguration config = plugin.getConfig();
|
config = plugin.getConfig();
|
||||||
|
|
||||||
if (config.isDouble("magic.cannonbow.speedmultiplier"))
|
if (config.isDouble(speedMultiplierPath))
|
||||||
setSpeedMultiplier(config.getDouble("magic.cannonbow.speedmultiplier"));
|
setSpeedMultiplier(config.getDouble(speedMultiplierPath));
|
||||||
|
|
||||||
if (config.isDouble("magic.cannonbow.minforce"))
|
if (config.isDouble(minForcePath))
|
||||||
setMinforce(config.getDouble("magic.cannonbow.minforce"));
|
setMinforce(config.getDouble(minForcePath));
|
||||||
|
|
||||||
if (config.isInt("magic.cannonbow.fuseticks"))
|
if (config.isInt(fuseTicksPath))
|
||||||
setFuseticks(config.getInt("magic.cannonbow.fuseticks"));
|
setFuseticks(config.getInt(fuseTicksPath));
|
||||||
|
|
||||||
if (config.isDouble("magic.cannonbow.recoil"))
|
if (config.isDouble(recoilPath))
|
||||||
setRecoil(config.getDouble("magic.cannonbow.recoil"));
|
setRecoil(config.getDouble(recoilPath));
|
||||||
|
|
||||||
|
if (config.isBoolean(isDestructivePath))
|
||||||
|
setIsDestructive(config.getBoolean(isDestructivePath));
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
|
@ -62,11 +94,12 @@ public class CannonBowListener implements Listener {
|
||||||
|
|
||||||
//TNT Spawning
|
//TNT Spawning
|
||||||
Vector playerVector = player.getEyeLocation().getDirection().normalize();
|
Vector playerVector = player.getEyeLocation().getDirection().normalize();
|
||||||
|
Location playerLocation = player.getLocation();
|
||||||
if (event.getForce() < getMinforce()){
|
if (event.getForce() < getMinforce()){
|
||||||
|
|
||||||
//Smoke cloud if draw is too low
|
//Smoke cloud if draw is too low
|
||||||
arrow.getWorld().spawnParticle(Particle.SMOKE_NORMAL, player.getLocation(), 30);
|
arrow.getWorld().spawnParticle(Particle.SMOKE_NORMAL, playerLocation, 30);
|
||||||
arrow.getWorld().playSound(player.getLocation(), Sound.BLOCK_LADDER_BREAK, 1.0F, -7);
|
arrow.getWorld().playSound(playerLocation, Sound.BLOCK_LADDER_BREAK, 1.0F, -7);
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
//Spawn TNT
|
//Spawn TNT
|
||||||
|
@ -89,9 +122,9 @@ public class CannonBowListener implements Listener {
|
||||||
tnt.setFuseTicks(getFuseticks());
|
tnt.setFuseTicks(getFuseticks());
|
||||||
|
|
||||||
//Player Recoil
|
//Player Recoil
|
||||||
player.setVelocity(player.getEyeLocation().getDirection().normalize().multiply(-1).multiply(getRecoil()));
|
player.setVelocity(playerVector.multiply(-1).multiply(getRecoil()));
|
||||||
player.getWorld().playSound(player.getLocation(), Sound.ENTITY_GENERIC_EXPLODE, 1.0F, 0);
|
player.getWorld().playSound(playerLocation, Sound.ENTITY_GENERIC_EXPLODE, 1.0F, 0);
|
||||||
player.getWorld().spawnParticle(Particle.EXPLOSION_NORMAL, player.getLocation(), 2);
|
player.getWorld().spawnParticle(Particle.EXPLOSION_NORMAL, playerLocation, 2);
|
||||||
|
|
||||||
}
|
}
|
||||||
arrow.remove();
|
arrow.remove();
|
||||||
|
@ -106,50 +139,111 @@ public class CannonBowListener implements Listener {
|
||||||
if (event.getEntityType() != EntityType.PRIMED_TNT) return;
|
if (event.getEntityType() != EntityType.PRIMED_TNT) return;
|
||||||
if (event.getEntity().getCustomName() != "CANNON BOW TNT:42170") return;
|
if (event.getEntity().getCustomName() != "CANNON BOW TNT:42170") return;
|
||||||
|
|
||||||
Location loc = event.getEntity().getLocation();
|
if (isDestructive == true){
|
||||||
event.getEntity().getWorld().createExplosion(loc.getX(), loc.getY(), loc.getZ(), 3, false, false);
|
Location loc = event.getEntity().getLocation();
|
||||||
event.setCancelled(true);
|
event.getEntity().getWorld().createExplosion(loc.getX(), loc.getY(), loc.getZ(), 3, false, false);
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static double getSpeedMultiplier() {
|
public static double getSpeedMultiplier() {
|
||||||
return SpeedMultiplier;
|
return speedMultiplier;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setSpeedMultiplier(double speedMultiplier) {
|
public static void setSpeedMultiplier(double multiplier, CommandSender sender){
|
||||||
if (speedMultiplier > 4) speedMultiplier = 4;
|
|
||||||
if (speedMultiplier < 0) speedMultiplier = 0;
|
if (multiplier > maxSpeedMultiplier) sender.sendMessage("SpeedMultiplier is too Large! Setting multiplier to "+ maxSpeedMultiplier);
|
||||||
SpeedMultiplier = speedMultiplier;
|
if (multiplier < maxSpeedMultiplier) sender.sendMessage("SpeedMultiplier is too Small! Setting multiplier to "+ minSpeedMultiplier);
|
||||||
|
|
||||||
|
setSpeedMultiplier(multiplier, sender);
|
||||||
|
sender.sendMessage("SpeedMultiplier set to " + getSpeedMultiplier());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void setSpeedMultiplier(double multiplier) {
|
||||||
|
|
||||||
|
if (multiplier > maxSpeedMultiplier) multiplier = maxSpeedMultiplier;
|
||||||
|
if (multiplier < minSpeedMultiplier) multiplier = minSpeedMultiplier;
|
||||||
|
config.set(speedMultiplierPath, multiplier);
|
||||||
|
speedMultiplier = multiplier;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public static double getMinforce() {
|
public static double getMinforce() {
|
||||||
return minforce;
|
return minForce;
|
||||||
|
}
|
||||||
|
public static void setMinForce(double minforce, CommandSender sender){
|
||||||
|
|
||||||
|
if (minforce > maxMinForce) sender.sendMessage("MinForce is too large! Setting it to " + maxMinForce);
|
||||||
|
if (minforce < minMinForce) sender.sendMessage("MinForce is too small! Setting it to " + minMinForce);
|
||||||
|
setMinforce(minforce);
|
||||||
|
sender.sendMessage("MinForce set to " + getMinforce());
|
||||||
|
|
||||||
|
}
|
||||||
|
public static void setMinforce(double minforce) {
|
||||||
|
|
||||||
|
if (minforce > maxMinForce) minforce = maxMinForce;
|
||||||
|
if (minforce < minMinForce) minforce = minMinForce;
|
||||||
|
config.set(minForcePath, minforce);
|
||||||
|
CannonBowListener.minForce = minforce;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setMinforce(double minforce) {
|
|
||||||
if (minforce > 1) minforce = 1;
|
|
||||||
if (minforce < 0) minforce = 0;
|
|
||||||
CannonBowListener.minforce = minforce;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static int getFuseticks() {
|
public static int getFuseticks() {
|
||||||
return fuseticks;
|
return fuseTicks;
|
||||||
|
}
|
||||||
|
public static void setFuseticks(int fuseticks, CommandSender sender){
|
||||||
|
|
||||||
|
if (fuseticks > maxFuseTicks) sender.sendMessage("Fuseticks is too large! Setting it to " + maxFuseTicks);
|
||||||
|
if (fuseticks < minFuseTicks) sender.sendMessage("Fuseticks is too small! Setting it to " + minFuseTicks);
|
||||||
|
setFuseticks(fuseticks);
|
||||||
|
sender.sendMessage("FuseTicks set to " + getFuseticks());
|
||||||
|
|
||||||
|
}
|
||||||
|
public static void setFuseticks(int fuseticks) {
|
||||||
|
|
||||||
|
if (fuseticks > maxFuseTicks) fuseticks = maxFuseTicks;
|
||||||
|
if (fuseticks < minFuseTicks) fuseticks = minFuseTicks;
|
||||||
|
config.set(fuseTicksPath, fuseticks);
|
||||||
|
CannonBowListener.fuseTicks = fuseticks;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setFuseticks(int fuseticks) {
|
|
||||||
if (fuseticks > 400) fuseticks = 400;
|
|
||||||
if (fuseticks < 0) fuseticks = 0;
|
|
||||||
CannonBowListener.fuseticks = fuseticks;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static double getRecoil() {
|
public static double getRecoil() {
|
||||||
return recoil;
|
return recoil;
|
||||||
}
|
}
|
||||||
|
public static void setRecoil(double recoil, CommandSender sender){
|
||||||
|
|
||||||
|
if (recoil > maxRecoil) sender.sendMessage("Recoil is too large! Setting it to " + maxRecoil);
|
||||||
|
if (recoil < maxRecoil) sender.sendMessage("Recoil is too small! Setting it to " + minRecoil);
|
||||||
|
setRecoil(recoil);
|
||||||
|
sender.sendMessage("Recoil set to " + getRecoil());
|
||||||
|
|
||||||
|
}
|
||||||
public static void setRecoil(double recoil) {
|
public static void setRecoil(double recoil) {
|
||||||
if (recoil > 20) recoil = 20;
|
|
||||||
if (recoil < 0) recoil = 0;
|
if (recoil > maxRecoil) recoil = maxRecoil;
|
||||||
|
if (recoil < minRecoil) recoil = minRecoil;
|
||||||
|
config.set(recoilPath, recoil);
|
||||||
CannonBowListener.recoil = recoil;
|
CannonBowListener.recoil = recoil;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static boolean getIsDestructive(){
|
||||||
|
return isDestructive;
|
||||||
|
}
|
||||||
|
public static void setIsDestructive(String input){
|
||||||
|
if(input.startsWith("T") || input.startsWith("t")) setIsDestructive(true);
|
||||||
|
if(input.startsWith("F") || input.startsWith("f")) setIsDestructive(false);
|
||||||
|
|
||||||
|
}
|
||||||
|
public static void setIsDestructive(boolean isDestructive){
|
||||||
|
CannonBowListener.isDestructive = isDestructive;
|
||||||
|
config.set(speedMultiplierPath, isDestructive);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -9,25 +9,34 @@ public class CannonBowSettings extends ModCommand {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean OnCommand(Player player, String alias, String[] args) {
|
public boolean OnCommand(Player player, String alias, String[] args) {
|
||||||
if (args.length > 1){
|
if (args.length > 1 && args[0] == "display"){
|
||||||
switch(args[0].toLowerCase()){
|
switch(args[0].toLowerCase()){
|
||||||
|
case "force":
|
||||||
case "speedmultiplier":
|
case "speedmultiplier":
|
||||||
CannonBowListener.setSpeedMultiplier(NumberUtils.toDouble(args[1], CannonBowListener.getSpeedMultiplier()));
|
CannonBowListener.setSpeedMultiplier(NumberUtils.toDouble(args[1], CannonBowListener.getSpeedMultiplier()));
|
||||||
break;
|
break;
|
||||||
|
case "minimumforce":
|
||||||
case "minforce":
|
case "minforce":
|
||||||
|
case "minimumdraw":
|
||||||
|
case "mindraw":
|
||||||
CannonBowListener.setMinforce(NumberUtils.toDouble(args[1], CannonBowListener.getMinforce()));
|
CannonBowListener.setMinforce(NumberUtils.toDouble(args[1], CannonBowListener.getMinforce()));
|
||||||
break;
|
break;
|
||||||
|
case "fuse":
|
||||||
|
case "fusetick":
|
||||||
case "fuseticks":
|
case "fuseticks":
|
||||||
CannonBowListener.setFuseticks(NumberUtils.toInt(args[1], CannonBowListener.getFuseticks()));
|
CannonBowListener.setFuseticks(NumberUtils.toInt(args[1], CannonBowListener.getFuseticks()));
|
||||||
break;
|
break;
|
||||||
case "recoil":
|
case "recoil":
|
||||||
CannonBowListener.setRecoil(NumberUtils.toDouble((args[1]), CannonBowListener.getRecoil()));
|
CannonBowListener.setRecoil(NumberUtils.toDouble((args[1]), CannonBowListener.getRecoil()));
|
||||||
break;
|
break;
|
||||||
|
case "isDestructive":
|
||||||
|
CannonBowListener.setIsDestructive(args[1]);
|
||||||
case "display":
|
case "display":
|
||||||
player.sendMessage("Speed Multiplier: "+CannonBowListener.getSpeedMultiplier());
|
player.sendMessage("Speed Multiplier: "+CannonBowListener.getSpeedMultiplier());
|
||||||
player.sendMessage("Minimum Force: "+CannonBowListener.getMinforce());
|
player.sendMessage("Minimum Force: "+CannonBowListener.getMinforce());
|
||||||
player.sendMessage("Fuseticks: " + CannonBowListener.getFuseticks());
|
player.sendMessage("Fuseticks: " + CannonBowListener.getFuseticks());
|
||||||
player.sendMessage("Recoil: " + CannonBowListener.getRecoil());
|
player.sendMessage("Recoil: " + CannonBowListener.getRecoil());
|
||||||
|
player.sendMessage("isDestructive: " + CannonBowListener.getIsDestructive());
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
player.sendMessage("That isn't a valid setting!");
|
player.sendMessage("That isn't a valid setting!");
|
||||||
|
|
Loading…
Reference in a new issue