MELHOR LB
This commit is contained in:
parent
47f4f374d1
commit
2c0718aa82
@ -259,6 +259,7 @@ public class Practice extends ExtendedJavaPlugin {
|
|||||||
});
|
});
|
||||||
|
|
||||||
Arrays.asList(
|
Arrays.asList(
|
||||||
|
new DivisionCommand(),
|
||||||
new ResetStatsCommand(),
|
new ResetStatsCommand(),
|
||||||
new AcceptCommand(),
|
new AcceptCommand(),
|
||||||
new PartyCommand(),
|
new PartyCommand(),
|
||||||
|
@ -16,7 +16,7 @@ import org.bukkit.entity.Player;
|
|||||||
* @since 5/17/2021
|
* @since 5/17/2021
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@CommandAlias("division")
|
@CommandAlias("division|liga")
|
||||||
public class DivisionCommand extends BaseCommand {
|
public class DivisionCommand extends BaseCommand {
|
||||||
|
|
||||||
@Default
|
@Default
|
||||||
|
@ -33,6 +33,7 @@ import org.bukkit.event.entity.*;
|
|||||||
import org.bukkit.event.player.PlayerInteractAtEntityEvent;
|
import org.bukkit.event.player.PlayerInteractAtEntityEvent;
|
||||||
import org.bukkit.potion.PotionEffect;
|
import org.bukkit.potion.PotionEffect;
|
||||||
import org.bukkit.potion.PotionEffectType;
|
import org.bukkit.potion.PotionEffectType;
|
||||||
|
import org.bukkit.scheduler.BukkitRunnable;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.concurrent.CompletableFuture;
|
import java.util.concurrent.CompletableFuture;
|
||||||
@ -40,6 +41,7 @@ import java.util.concurrent.CompletableFuture;
|
|||||||
public class MatchListener implements Listener {
|
public class MatchListener implements Listener {
|
||||||
|
|
||||||
private final Practice plugin = Practice.getInstance();
|
private final Practice plugin = Practice.getInstance();
|
||||||
|
private int counter = 0;
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onFreeze(PlayerFreezeEvent event) {
|
public void onFreeze(PlayerFreezeEvent event) {
|
||||||
@ -124,6 +126,28 @@ public class MatchListener implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onEntityDamage(EntityDamageByEntityEvent event) {
|
||||||
|
if (event.getEntity() instanceof Player && event.getDamager() instanceof Player) {
|
||||||
|
Player defender = (Player) event.getEntity();
|
||||||
|
|
||||||
|
if (defender.isBlocking() && defender.getInventory().getItemInHand().getType().toString().contains("SWORD")) {
|
||||||
|
new BukkitRunnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
if (defender.isBlocking() && counter >= 20) {
|
||||||
|
defender.setHealth(defender.getHealth() - 1.0);
|
||||||
|
cancel();
|
||||||
|
} else if (defender.isBlocking()) {
|
||||||
|
counter++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}.runTaskAsynchronously(Practice.getInstance());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onMatchStart(MatchStartEvent event) {
|
public void onMatchStart(MatchStartEvent event) {
|
||||||
final Match match = event.getMatch();
|
final Match match = event.getMatch();
|
||||||
@ -169,6 +193,8 @@ public class MatchListener implements Listener {
|
|||||||
playerData.setLongestCombo(0);
|
playerData.setLongestCombo(0);
|
||||||
playerData.setCombo(0);
|
playerData.setCombo(0);
|
||||||
playerData.setHits(0);
|
playerData.setHits(0);
|
||||||
|
playerData.setBlockedHits(0);
|
||||||
|
playerData.setCriticalHits(0);
|
||||||
|
|
||||||
PlayerUtil.updateNametag(player, kit.getFlag().equals(Flag.BUILD));
|
PlayerUtil.updateNametag(player, kit.getFlag().equals(Flag.BUILD));
|
||||||
|
|
||||||
@ -223,6 +249,7 @@ public class MatchListener implements Listener {
|
|||||||
@EventHandler
|
@EventHandler
|
||||||
public void onMatchEnd(MatchEndEvent event) {
|
public void onMatchEnd(MatchEndEvent event) {
|
||||||
final Match match = event.getMatch();
|
final Match match = event.getMatch();
|
||||||
|
counter = 0;
|
||||||
|
|
||||||
if (event.getWinningTeam() == null) {
|
if (event.getWinningTeam() == null) {
|
||||||
match.setMatchState(MatchState.ENDING);
|
match.setMatchState(MatchState.ENDING);
|
||||||
|
Loading…
Reference in New Issue
Block a user