mirror of
https://github.com/TotalFreedomMC/TF-ProjectKorra.git
synced 2025-02-11 19:50:37 +00:00
Allow RPG WorldEvents to work
This commit is contained in:
parent
1d451cbb50
commit
3e737d705c
2 changed files with 146 additions and 96 deletions
|
@ -8,6 +8,7 @@ import org.bukkit.entity.Player;
|
|||
|
||||
import com.projectkorra.ProjectKorra.Ability.AvatarState;
|
||||
import com.projectkorra.ProjectKorra.chiblocking.RapidPunch;
|
||||
import com.projectkorra.rpg.RPGMethods;
|
||||
|
||||
public class BendingManager implements Runnable {
|
||||
|
||||
|
@ -18,10 +19,13 @@ public class BendingManager implements Runnable {
|
|||
|
||||
private final HashMap<World, Boolean> times = new HashMap<World, Boolean>(); // true if day time
|
||||
|
||||
static final String defaultsozinscometmessage = "Sozin's Comet is passing overhead! Firebending is now at its most powerful.";
|
||||
static final String defaultsolareclipsemessage = "A solar eclipse is out! Firebenders are temporarily powerless.";
|
||||
static final String defaultsunrisemessage = "You feel the strength of the rising sun empowering your firebending.";
|
||||
static final String defaultsunsetmessage = "You feel the empowering of your firebending subside as the sun sets.";
|
||||
static final String defaultmoonrisemessage = "You feel the strength of the rising moon empowering your waterbending.";
|
||||
static final String defaultfullmoonrisemessage = "A full moon is rising, empowering your waterbending like never before.";
|
||||
static final String defaultlunareclipsemessage = "A lunar eclipse is out! Waterbenders are temporarily powerless.";
|
||||
static final String defaultmoonsetmessage = "You feel the empowering of your waterbending subside as the moon sets.";
|
||||
|
||||
public BendingManager(ProjectKorra plugin) {
|
||||
|
@ -73,12 +77,22 @@ public class BendingManager implements Runnable {
|
|||
times.put(world, false); // Sets time to night.
|
||||
for (Player player: world.getPlayers()) {
|
||||
if (Methods.isBender(player.getName(), Element.Water)) {
|
||||
if (Methods.hasRPG()) {
|
||||
if (RPGMethods.isLunarEclipse(world)) {
|
||||
player.sendMessage(Methods.getWaterColor() + defaultlunareclipsemessage);
|
||||
} else if (Methods.isFullMoon(world)) {
|
||||
player.sendMessage(Methods.getWaterColor() + defaultfullmoonrisemessage);
|
||||
} else {
|
||||
player.sendMessage(Methods.getWaterColor() + defaultmoonrisemessage);
|
||||
}
|
||||
} else {
|
||||
if (Methods.isFullMoon(world)) {
|
||||
player.sendMessage(Methods.getWaterColor() + defaultfullmoonrisemessage);
|
||||
} else {
|
||||
player.sendMessage(Methods.getWaterColor() + defaultmoonrisemessage);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (Methods.isBender(player.getName(), Element.Fire)) {
|
||||
player.sendMessage(Methods.getFireColor() + defaultsunsetmessage);
|
||||
}
|
||||
|
@ -93,6 +107,15 @@ public class BendingManager implements Runnable {
|
|||
player.sendMessage(Methods.getWaterColor() + defaultmoonsetmessage);
|
||||
}
|
||||
if (Methods.isBender(player.getName(), Element.Fire) && player.hasPermission("bending.message.daymessage")) {
|
||||
if (Methods.hasRPG()) {
|
||||
if (RPGMethods.isSozinsComet(world)) {
|
||||
player.sendMessage(Methods.getFireColor() + defaultsozinscometmessage);
|
||||
} else if (RPGMethods.isSolarEclipse(world) && !RPGMethods.isLunarEclipse(world)) {
|
||||
player.sendMessage(Methods.getFireColor() + defaultsolareclipsemessage);
|
||||
} else {
|
||||
player.sendMessage(Methods.getFireColor() + defaultsunrisemessage);
|
||||
}
|
||||
} else {
|
||||
player.sendMessage(Methods.getFireColor() + defaultsunrisemessage);
|
||||
}
|
||||
}
|
||||
|
@ -101,3 +124,4 @@ public class BendingManager implements Runnable {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -118,6 +118,8 @@ import com.projectkorra.ProjectKorra.waterbending.WaterReturn;
|
|||
import com.projectkorra.ProjectKorra.waterbending.WaterSpout;
|
||||
import com.projectkorra.ProjectKorra.waterbending.WaterWall;
|
||||
import com.projectkorra.ProjectKorra.waterbending.Wave;
|
||||
import com.projectkorra.rpg.RPGMethods;
|
||||
import com.projectkorra.rpg.WorldEvents;
|
||||
import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
|
||||
import com.sk89q.worldguard.protection.flags.DefaultFlag;
|
||||
import com.sk89q.worldguard.protection.flags.StateFlag;
|
||||
|
@ -742,7 +744,17 @@ public class Methods {
|
|||
*/
|
||||
public static double getFirebendingDayAugment(double value, World world) {
|
||||
if (isDay(world)) {
|
||||
return plugin.getConfig().getDouble("Properties.Fire.DayFactor") * value;
|
||||
if (Methods.hasRPG()) {
|
||||
if (RPGMethods.isSozinsComet(world)) {
|
||||
return RPGMethods.getFactor(WorldEvents.SozinsComet) * value;
|
||||
} else if (RPGMethods.isSolarEclipse(world) && !RPGMethods.isLunarEclipse(world)) {
|
||||
return RPGMethods.getFactor(WorldEvents.SolarEclipse) * value;
|
||||
} else {
|
||||
return value * plugin.getConfig().getDouble("Properties.Fire.DayFactor");
|
||||
}
|
||||
} else {
|
||||
return plugin.getConfig().getDouble("Properties.Fire.DayFactor");
|
||||
}
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
@ -877,10 +889,24 @@ public class Methods {
|
|||
}
|
||||
|
||||
public static double getWaterbendingNightAugment(World world) {
|
||||
if (hasRPG()) {
|
||||
if (isNight(world)) {
|
||||
if (RPGMethods.isLunarEclipse(world)) {
|
||||
return RPGMethods.getFactor(WorldEvents.LunarEclipse);
|
||||
}
|
||||
if (isFullMoon(world)) {
|
||||
return plugin.getConfig().getDouble("Properties.Water.FullMoonFactor");
|
||||
}
|
||||
return plugin.getConfig().getDouble("Properties.Water.NightFactor");
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
} else {
|
||||
if (isNight(world) && isFullMoon(world)) return plugin.getConfig().getDouble("Properties.Water.FullMoonFactor");
|
||||
if (isNight(world)) return plugin.getConfig().getDouble("Properties.Water.NightFactor");
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the WaterColor from the config.
|
||||
|
|
Loading…
Reference in a new issue