mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-24 22:26:46 +01:00
Started work on new Staves skill.
This commit is contained in:
parent
b86d76fcd4
commit
00fc5b93d2
7
src/main/java/com/gmail/nossr50/datatypes/StaffType.java
Normal file
7
src/main/java/com/gmail/nossr50/datatypes/StaffType.java
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
package com.gmail.nossr50.datatypes;
|
||||||
|
|
||||||
|
public enum StaffType {
|
||||||
|
BLAZE_ROD,
|
||||||
|
STICK,
|
||||||
|
BONE;
|
||||||
|
}
|
@ -48,6 +48,7 @@ import com.gmail.nossr50.skills.Fishing;
|
|||||||
import com.gmail.nossr50.skills.Herbalism;
|
import com.gmail.nossr50.skills.Herbalism;
|
||||||
import com.gmail.nossr50.skills.Repair;
|
import com.gmail.nossr50.skills.Repair;
|
||||||
import com.gmail.nossr50.skills.Skills;
|
import com.gmail.nossr50.skills.Skills;
|
||||||
|
import com.gmail.nossr50.skills.Staves;
|
||||||
import com.gmail.nossr50.skills.Taming;
|
import com.gmail.nossr50.skills.Taming;
|
||||||
|
|
||||||
public class mcPlayerListener implements Listener {
|
public class mcPlayerListener implements Listener {
|
||||||
@ -240,6 +241,9 @@ public class mcPlayerListener implements Listener {
|
|||||||
BlastMining.remoteDetonation(player, plugin);
|
BlastMining.remoteDetonation(player, plugin);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* STAFF CHECKS */
|
||||||
|
Staves.altFire(is.getType(), player);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case RIGHT_CLICK_AIR:
|
case RIGHT_CLICK_AIR:
|
||||||
@ -263,6 +267,9 @@ public class mcPlayerListener implements Listener {
|
|||||||
BlastMining.remoteDetonation(player, plugin);
|
BlastMining.remoteDetonation(player, plugin);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* STAFF CHECKS */
|
||||||
|
Staves.altFire(is.getType(), player);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LEFT_CLICK_AIR:
|
case LEFT_CLICK_AIR:
|
||||||
|
@ -261,14 +261,14 @@ public class BlastMining {
|
|||||||
AbilityType ability = AbilityType.BLAST_MINING;
|
AbilityType ability = AbilityType.BLAST_MINING;
|
||||||
|
|
||||||
/* Check Cooldown */
|
/* Check Cooldown */
|
||||||
if(!Skills.cooldownOver(PP.getSkillDATS(ability) * TIME_CONVERSION_FACTOR, ability.getCooldown())) {
|
if (!Skills.cooldownOver(PP.getSkillDATS(ability) * TIME_CONVERSION_FACTOR, ability.getCooldown())) {
|
||||||
player.sendMessage(mcLocale.getString("Skills.TooTired") + ChatColor.YELLOW + " (" + Skills.calculateTimeLeft(PP.getSkillDATS(ability) * TIME_CONVERSION_FACTOR, ability.getCooldown()) + "s)");
|
player.sendMessage(mcLocale.getString("Skills.TooTired") + ChatColor.YELLOW + " (" + Skills.calculateTimeLeft(PP.getSkillDATS(ability) * TIME_CONVERSION_FACTOR, ability.getCooldown()) + "s)");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Send message to nearby players */
|
/* Send message to nearby players */
|
||||||
for(Player y : player.getWorld().getPlayers()) {
|
for (Player y : player.getWorld().getPlayers()) {
|
||||||
if(y != player && m.isNear(player.getLocation(), y.getLocation(), MAX_DISTANCE_AWAY)) {
|
if (y != player && m.isNear(player.getLocation(), y.getLocation(), MAX_DISTANCE_AWAY)) {
|
||||||
y.sendMessage(ability.getAbilityPlayer(player));
|
y.sendMessage(ability.getAbilityPlayer(player));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
52
src/main/java/com/gmail/nossr50/skills/Staves.java
Normal file
52
src/main/java/com/gmail/nossr50/skills/Staves.java
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
package com.gmail.nossr50.skills;
|
||||||
|
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.entity.ExperienceOrb;
|
||||||
|
import org.bukkit.entity.Fireball;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import com.gmail.nossr50.m;
|
||||||
|
|
||||||
|
public class Staves {
|
||||||
|
|
||||||
|
public static void altFire(Material type, Player attacker) {
|
||||||
|
switch (type) {
|
||||||
|
case BLAZE_ROD:
|
||||||
|
attacker.launchProjectile(Fireball.class);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case BONE:
|
||||||
|
for (Player y : attacker.getWorld().getPlayers()) {
|
||||||
|
if (y != attacker && m.isNear(attacker.getLocation(), y.getLocation(), 10) && y.getLevel() > 0) {
|
||||||
|
y.setLevel((int) (y.getLevel() * .75));
|
||||||
|
attacker.sendMessage("You drained your opponent of XP!");
|
||||||
|
y.sendMessage("You feel some of your power leave you...");
|
||||||
|
|
||||||
|
for (int i = 0; i <= 100; i++) {
|
||||||
|
Location dropLocation = y.getLocation();
|
||||||
|
dropLocation.setX(dropLocation.getX() + (Math.random() * 2));
|
||||||
|
dropLocation.setZ(dropLocation.getZ() + (Math.random() * 2));
|
||||||
|
ExperienceOrb orb = y.getWorld().spawn(dropLocation, ExperienceOrb.class);
|
||||||
|
orb.setExperience((int) (Math.random() * 5));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case STICK:
|
||||||
|
for (Player y : attacker.getWorld().getPlayers()) {
|
||||||
|
if (y != attacker && m.isNear(attacker.getLocation(), y.getLocation(), 10)) {
|
||||||
|
attacker.sendMessage("You slowed your opponent!");
|
||||||
|
y.sendMessage("You were suddenly slowed...");
|
||||||
|
|
||||||
|
y.setVelocity(y.getVelocity().multiply(0.5));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user