too lazy to write this #2

This commit is contained in:
Matheus 2024-04-26 22:06:22 -04:00
parent 4d7ea1a388
commit 8f17e9fbb7
4 changed files with 5 additions and 5 deletions

View File

@ -11,6 +11,7 @@ public class FFACommand {
public void execute(Player player) { public void execute(Player player) {
for (String s : Main.getInstance().getLangConfig().getStringList("COMMANDS.FFA.LINES")) { for (String s : Main.getInstance().getLangConfig().getStringList("COMMANDS.FFA.LINES")) {
if (s.contains("<admin>")) { if (s.contains("<admin>")) {
if (!player.hasPermission("otaku.admin")) continue;
for (String z : Main.getInstance().getLangConfig().getStringList("COMMANDS.FFA.ADMIN-ADDITION")) { for (String z : Main.getInstance().getLangConfig().getStringList("COMMANDS.FFA.ADMIN-ADDITION")) {
player.sendMessage(CC.translate(z)); player.sendMessage(CC.translate(z));
} }

View File

@ -7,7 +7,6 @@ import dev.lugami.otaku.events.FFAJoinEvent;
import dev.lugami.otaku.kit.Kit; import dev.lugami.otaku.kit.Kit;
import dev.lugami.otaku.profile.Profile; import dev.lugami.otaku.profile.Profile;
import dev.lugami.otaku.profile.data.ProfileState; import dev.lugami.otaku.profile.data.ProfileState;
import dev.lugami.otaku.utils.CC;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@CommandMeta(label = {"ffa join", "ffa enter"}) @CommandMeta(label = {"ffa join", "ffa enter"})
@ -15,7 +14,7 @@ public class FFAJoinCommand {
public void execute(Player player, @CPL("kit") String kit) { public void execute(Player player, @CPL("kit") String kit) {
if (Kit.getByName(kit) == null) { if (Kit.getByName(kit) == null) {
player.sendMessage(CC.RED + "A kit with that name does not exist."); player.sendMessage(Language.KIT_DOESNT_EXIST.format());
return; return;
} }
if (Profile.getOrCreate(player).getState() != ProfileState.PLAYING) { if (Profile.getOrCreate(player).getState() != ProfileState.PLAYING) {

View File

@ -8,7 +8,6 @@ import dev.lugami.otaku.profile.Profile;
import dev.lugami.otaku.profile.data.ProfileState; import dev.lugami.otaku.profile.data.ProfileState;
import dev.lugami.otaku.utils.CC; import dev.lugami.otaku.utils.CC;
import org.bukkit.GameMode; import org.bukkit.GameMode;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority; import org.bukkit.event.EventPriority;
@ -108,8 +107,7 @@ public class EssentialsListener implements Listener {
if (kit.getKitRules().isNoDamage()) { if (kit.getKitRules().isNoDamage()) {
event.setDamage(0.0); event.setDamage(0.0);
} else if (event.getCause() == EntityDamageEvent.DamageCause.VOID) { } else if (event.getCause() == EntityDamageEvent.DamageCause.VOID) {
CraftPlayer player = ((CraftPlayer) event.getEntity()); new FFADeathEvent((Player) event.getEntity(), new ArrayList<>()).call();
new FFADeathEvent(player, new ArrayList<>()).call();
} }
} }
} }

View File

@ -85,6 +85,7 @@ public class FFAListener implements Listener {
//event.getPlayer().sendMessage(CC.RED + "You're still in combat!" + CC.GRAY + " (Remaining: " + Main.getInstance().getCombatManager().getCombatTime(event.getPlayer()) + "s)"); //event.getPlayer().sendMessage(CC.RED + "You're still in combat!" + CC.GRAY + " (Remaining: " + Main.getInstance().getCombatManager().getCombatTime(event.getPlayer()) + "s)");
} else { } else {
FFACache.getFFAList().get(profile.getFFA()).remove(event.getPlayer()); FFACache.getFFAList().get(profile.getFFA()).remove(event.getPlayer());
if (Main.getInstance().getEnderpearlManager().isPearlCooldown(event.getPlayer())) Main.getInstance().getEnderpearlManager().setPearlCooldown(event.getPlayer(), false);
if (Hotbar.setup(event.getPlayer()) && Main.getInstance().getEssentials().getSpawn() != null) { if (Hotbar.setup(event.getPlayer()) && Main.getInstance().getEssentials().getSpawn() != null) {
Main.getInstance().getEssentials().teleportToSpawn(event.getPlayer()); Main.getInstance().getEssentials().teleportToSpawn(event.getPlayer());
Main.getInstance().getServer().getLogger().info("Player " + event.getPlayer().getName() + " was setupped correctly!"); Main.getInstance().getServer().getLogger().info("Player " + event.getPlayer().getName() + " was setupped correctly!");
@ -206,6 +207,7 @@ public class FFAListener implements Listener {
@EventHandler @EventHandler
public void onDamage(EntityDamageEvent event) { public void onDamage(EntityDamageEvent event) {
if (event.getEntity() instanceof Player) { if (event.getEntity() instanceof Player) {
if (Profile.getOrCreate((Player) event.getEntity()).getState() != ProfileState.PLAYING) return;
if (Profile.getOrCreate((Player) event.getEntity()).getFFA().getKitRules().isNoDamage()) { if (Profile.getOrCreate((Player) event.getEntity()).getFFA().getKitRules().isNoDamage()) {
event.setDamage(0.0); event.setDamage(0.0);
return; return;