-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #86 from peacefulcraft-network/Class_Rework
Class rework
- Loading branch information
Showing
39 changed files
with
1,549 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
72 changes: 72 additions & 0 deletions
72
src/net/peacefulcraft/trenchpvp/gameclasses/abilities/BuildTimer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
package net.peacefulcraft.trenchpvp.gameclasses.abilities; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
import org.bukkit.Bukkit; | ||
import org.bukkit.Location; | ||
import org.bukkit.Material; | ||
import org.bukkit.entity.Entity; | ||
import org.bukkit.entity.Player; | ||
import org.bukkit.event.Event; | ||
import org.bukkit.potion.PotionEffect; | ||
import org.bukkit.potion.PotionEffectType; | ||
|
||
import net.peacefulcraft.trenchpvp.TrenchPvP; | ||
import net.peacefulcraft.trenchpvp.gameclasses.classConfigurations.TrenchKit; | ||
|
||
public class BuildTimer extends TrenchAbility | ||
{ | ||
private TrenchKit k; | ||
private final int EFFECT_TIME = 400; | ||
|
||
public BuildTimer(TrenchKit k) | ||
{ | ||
super(k.getTrenchPlayer(), 20000, "Build Timer"); | ||
|
||
this.k=k; | ||
} | ||
|
||
@Override | ||
public boolean abilitySignature(Event ev) | ||
{ | ||
Player p = k.getTrenchPlayer().getPlayer(); | ||
|
||
if(!(p.getInventory().getItemInMainHand().getType() == Material.CLOCK)) { return false; } | ||
if(!(p.getInventory().getItemInMainHand().getItemMeta().getDisplayName().equals("Build Timer"))) { return false; } | ||
|
||
return true; | ||
} | ||
|
||
@Override | ||
public void triggerAbility(Event ev) | ||
{ | ||
Player p = k.getTrenchPlayer().getPlayer(); | ||
|
||
ArrayList<Player> lightning = new ArrayList<Player>(); | ||
List<Entity> list = p.getNearbyEntities(4, 4, 4); | ||
for(Entity e : list) { | ||
if(e instanceof Player) { | ||
Player vic = (Player) e; | ||
vic.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, EFFECT_TIME, 2)); | ||
vic.addPotionEffect(new PotionEffect(PotionEffectType.POISON, EFFECT_TIME, 2)); | ||
vic.addPotionEffect(new PotionEffect(PotionEffectType.GLOWING, EFFECT_TIME, 2)); | ||
lightning.add(vic); | ||
} | ||
} | ||
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(TrenchPvP.getPluginInstance(), new Runnable() { | ||
public void run() { | ||
for(Player v : lightning) { | ||
Location loc = v.getLocation(); | ||
loc.getWorld().strikeLightning(loc); | ||
if(v.getHealth() != 0) { | ||
v.setHealth(v.getHealth() + 5); | ||
} | ||
} | ||
} | ||
}, 100); | ||
|
||
|
||
} | ||
|
||
} |
42 changes: 42 additions & 0 deletions
42
src/net/peacefulcraft/trenchpvp/gameclasses/abilities/CatastrophicRapier.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package net.peacefulcraft.trenchpvp.gameclasses.abilities; | ||
|
||
import org.bukkit.Material; | ||
import org.bukkit.entity.Player; | ||
import org.bukkit.event.Event; | ||
import org.bukkit.util.Vector; | ||
|
||
import net.peacefulcraft.trenchpvp.gameclasses.classConfigurations.TrenchKit; | ||
|
||
public class CatastrophicRapier extends TrenchAbility | ||
{ | ||
private TrenchKit k; | ||
|
||
public CatastrophicRapier(TrenchKit k) { | ||
super(k.getTrenchPlayer(), 40, "Catastrophic Rapier"); | ||
|
||
this.k = k; | ||
} | ||
|
||
@Override | ||
public boolean abilitySignature(Event ev) | ||
{ | ||
Player p = k.getTrenchPlayer().getPlayer(); | ||
|
||
if(!(p.getInventory().getItemInMainHand().getType() == Material.DIAMOND_SWORD)) { return false; } | ||
if(!(p.getInventory().getItemInMainHand().getItemMeta().getDisplayName().equals("Catastrophic Rapier"))) { return false; } | ||
|
||
return true; | ||
} | ||
|
||
@Override | ||
public void triggerAbility(Event ev) | ||
{ | ||
Player p = k.getTrenchPlayer().getPlayer(); | ||
|
||
Vector v = new Vector(p.getVelocity().getX(), p.getVelocity().getY(), p.getVelocity().getZ()); | ||
Vector forward = p.getLocation().getDirection().multiply(2); | ||
v.add(forward); | ||
|
||
p.setVelocity(v); | ||
} | ||
} |
62 changes: 62 additions & 0 deletions
62
src/net/peacefulcraft/trenchpvp/gameclasses/abilities/CommunityManagerDumbFoot.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
package net.peacefulcraft.trenchpvp.gameclasses.abilities; | ||
|
||
import java.util.Random; | ||
|
||
import org.bukkit.Location; | ||
import org.bukkit.entity.Player; | ||
import org.bukkit.event.Event; | ||
import org.bukkit.event.player.PlayerMoveEvent; | ||
|
||
import net.peacefulcraft.trenchpvp.TrenchPvP; | ||
import net.peacefulcraft.trenchpvp.gameclasses.classConfigurations.TrenchKit; | ||
import net.peacefulcraft.trenchpvp.gamehandle.TeamManager; | ||
import net.peacefulcraft.trenchpvp.gamehandle.player.TrenchPlayer; | ||
|
||
public class CommunityManagerDumbFoot extends TrenchAbility | ||
{ | ||
private TrenchKit k; | ||
|
||
public CommunityManagerDumbFoot(TrenchKit k) | ||
{ | ||
super(k.getTrenchPlayer(), 0, "Community Manager's Dumb Foot"); | ||
|
||
this.k=k; | ||
} | ||
@Override | ||
public boolean abilitySignature(Event ev) | ||
{ | ||
try { | ||
|
||
PlayerMoveEvent e = (PlayerMoveEvent) ev; | ||
TrenchPlayer t = TeamManager.findTrenchPlayer(e.getPlayer()); | ||
|
||
}catch(ClassCastException ex) { | ||
|
||
TrenchPvP.logWarning("Error Matching" + this.getClass() + " event. Incompatible event loop " + ev.getClass()); | ||
return false; | ||
|
||
} | ||
|
||
return true; | ||
} | ||
@Override | ||
public void triggerAbility(Event ev) | ||
{ | ||
try { | ||
PlayerMoveEvent e = (PlayerMoveEvent) ev; | ||
Player p = e.getPlayer(); | ||
|
||
Random rand = new Random(); | ||
if(rand.nextInt(100) <= 1) { | ||
Location loc = p.getLocation(); | ||
loc.getWorld().createExplosion(loc.getX(), loc.getY(), loc.getZ(), 1.0f, false, false); | ||
} | ||
|
||
}catch(ClassCastException ex) { | ||
|
||
TrenchPvP.logWarning("Error Matching" + this.getClass() + " event. Incompatible event loop " + ev.getClass()); | ||
return; | ||
} | ||
} | ||
|
||
} |
58 changes: 58 additions & 0 deletions
58
src/net/peacefulcraft/trenchpvp/gameclasses/abilities/EntityUprising.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
package net.peacefulcraft.trenchpvp.gameclasses.abilities; | ||
|
||
import java.util.List; | ||
|
||
import org.bukkit.Material; | ||
import org.bukkit.entity.Entity; | ||
import org.bukkit.entity.Player; | ||
import org.bukkit.event.Event; | ||
import org.bukkit.potion.PotionEffect; | ||
import org.bukkit.potion.PotionEffectType; | ||
|
||
import net.peacefulcraft.trenchpvp.gameclasses.classConfigurations.TrenchKit; | ||
import net.peacefulcraft.trenchpvp.gamehandle.TeamManager; | ||
import net.peacefulcraft.trenchpvp.gamehandle.player.TrenchPlayer; | ||
|
||
public class EntityUprising extends TrenchAbility | ||
{ | ||
private TrenchKit k; | ||
|
||
private final int EFFECT_TIME = 200; //20 ticks per second | ||
|
||
public EntityUprising(TrenchKit k) | ||
{ | ||
super(k.getTrenchPlayer(), 20000, "Entity Uprising"); | ||
|
||
this.k = k; | ||
} | ||
|
||
@Override | ||
public boolean abilitySignature(Event ev) | ||
{ | ||
Player p = k.getTrenchPlayer().getPlayer(); | ||
|
||
if(!(p.getInventory().getItemInMainHand().getType() == Material.WHITE_STAINED_GLASS)) { return false; } | ||
if(!(p.getInventory().getItemInMainHand().getItemMeta().getDisplayName().equals("Entity Uprising"))) { return false; } | ||
|
||
return true; | ||
} | ||
|
||
@Override | ||
public void triggerAbility(Event ev) | ||
{ | ||
TrenchPlayer t = k.getTrenchPlayer(); | ||
Player p = t.getPlayer(); | ||
|
||
List<Entity> levList = p.getNearbyEntities(5, 5, 5); | ||
for(Entity e : levList) { | ||
if(e instanceof Player) { | ||
Player vic = (Player) e; | ||
if(TeamManager.findTrenchPlayer(vic).getPlayerTeam() != t.getPlayerTeam()) { | ||
vic.addPotionEffect(new PotionEffect(PotionEffectType.LEVITATION, EFFECT_TIME, 1)); | ||
vic.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, EFFECT_TIME, 4)); | ||
} | ||
} | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
src/net/peacefulcraft/trenchpvp/gameclasses/abilities/LonelyMansMic.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
package net.peacefulcraft.trenchpvp.gameclasses.abilities; | ||
|
||
import java.util.List; | ||
|
||
import org.bukkit.Location; | ||
import org.bukkit.Material; | ||
import org.bukkit.entity.Entity; | ||
import org.bukkit.entity.Player; | ||
import org.bukkit.event.Event; | ||
|
||
import net.peacefulcraft.trenchpvp.gameclasses.classConfigurations.TrenchKit; | ||
|
||
public class LonelyMansMic extends TrenchAbility | ||
{ | ||
private TrenchKit k; | ||
public LonelyMansMic(TrenchKit k) | ||
{ | ||
super(k.getTrenchPlayer(), 15000, "Lonely Mans Mic"); | ||
|
||
this.k=k; | ||
} | ||
|
||
@Override | ||
public boolean abilitySignature(Event ev) | ||
{ | ||
Player p = k.getTrenchPlayer().getPlayer(); | ||
|
||
if(!(p.getInventory().getItemInMainHand().getType() == Material.LEVER)) { return false; } | ||
if(!(p.getInventory().getItemInMainHand().getItemMeta().getDisplayName().equals("Lonely Mans Mic"))) { return false; } | ||
|
||
return true; | ||
} | ||
|
||
@Override | ||
public void triggerAbility(Event ev) | ||
{ | ||
Player p = k.getTrenchPlayer().getPlayer(); | ||
Location loc = p.getLocation(); | ||
|
||
List<Entity> list = p.getNearbyEntities(4, 4, 4); | ||
for(Entity e : list) { | ||
if(e instanceof Player) { | ||
Player vic = (Player) e; | ||
Location t = vic.getLocation().subtract(loc); | ||
double distance = vic.getLocation().distance(loc); | ||
|
||
t.getDirection().normalize().multiply(-1); | ||
t.multiply(distance/1.2); | ||
t.multiply(2); //Change | ||
|
||
vic.setVelocity(t.toVector()); | ||
} | ||
} | ||
} | ||
|
||
} |
Oops, something went wrong.