Not stable version
Signed-off-by: Yaruma3341 <yaruma3341@gmail.com>
Dieser Commit ist enthalten in:
Ursprung
d2d126f02f
Commit
c06a6803cc
@ -75,7 +75,7 @@ public class FightSystem extends JavaPlugin {
|
|||||||
|
|
||||||
Fight.getRedTeam().setName(fileManager.getStringFromConfig("Output.TeamRedName"));
|
Fight.getRedTeam().setName(fileManager.getStringFromConfig("Output.TeamRedName"));
|
||||||
Fight.getRedTeam().setPrefix(fileManager.getStringFromConfig("Output.TeamRedColor"));
|
Fight.getRedTeam().setPrefix(fileManager.getStringFromConfig("Output.TeamRedColor"));
|
||||||
Fight.getBlueTeam().setPrefix(fileManager.getStringFromConfig("Output.TeamBlueName"));
|
Fight.getBlueTeam().setName(fileManager.getStringFromConfig("Output.TeamBlueName"));
|
||||||
Fight.getBlueTeam().setPrefix(fileManager.getStringFromConfig("Output.TeamBlueColor"));
|
Fight.getBlueTeam().setPrefix(fileManager.getStringFromConfig("Output.TeamBlueColor"));
|
||||||
|
|
||||||
//Load config
|
//Load config
|
||||||
@ -175,6 +175,7 @@ public class FightSystem extends JavaPlugin {
|
|||||||
pm.registerEvents(new BlockPlaceListener(), plugin);
|
pm.registerEvents(new BlockPlaceListener(), plugin);
|
||||||
pm.registerEvents(new BlockBreakListener(), plugin);
|
pm.registerEvents(new BlockBreakListener(), plugin);
|
||||||
pm.registerEvents(new PlayerMoveListener(), plugin);
|
pm.registerEvents(new PlayerMoveListener(), plugin);
|
||||||
|
pm.registerEvents(new EntityDamageByEntityListener(), plugin);
|
||||||
|
|
||||||
//WinConditions
|
//WinConditions
|
||||||
if(fileManager.getBooleanFromConfig("WinConditions.AllDead")) pm.registerEvents(new WinconditionAllDead(), plugin);
|
if(fileManager.getBooleanFromConfig("WinConditions.AllDead")) pm.registerEvents(new WinconditionAllDead(), plugin);
|
||||||
|
@ -10,6 +10,8 @@ import org.bukkit.event.block.BlockBreakEvent;
|
|||||||
|
|
||||||
public class BlockBreakListener implements Listener {
|
public class BlockBreakListener implements Listener {
|
||||||
|
|
||||||
|
FightSystem instance = FightSystem.getPlugin();
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void handleBlockBreak(BlockBreakEvent event) {
|
public void handleBlockBreak(BlockBreakEvent event) {
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
@ -18,7 +20,7 @@ public class BlockBreakListener implements Listener {
|
|||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
else if(FightSystem.getPlugin().getFightState() != FightState.RUNNING) {
|
else if(FightSystem.getPlugin().getFightState() != FightState.RUNNING) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
if(FightSystem.getPlugin().getFightState() == FightState.PRE_RUNNING) {
|
if(instance.getFightState() == FightState.SETUP || instance.getFightState() == FightState.PRE_RUNNING) {
|
||||||
player.sendMessage(FightSystem.PREFIX + "§cDu darfst erst nach Fightbeginn Blöcke abbauen!");
|
player.sendMessage(FightSystem.PREFIX + "§cDu darfst erst nach Fightbeginn Blöcke abbauen!");
|
||||||
} else
|
} else
|
||||||
player.sendMessage(FightSystem.PREFIX + "§cDu darfst keine Blöcke mehr abbauen!");
|
player.sendMessage(FightSystem.PREFIX + "§cDu darfst keine Blöcke mehr abbauen!");
|
||||||
|
59
src/me/yaruma/fightsystem/listener/EntityDamageByEntityListener.java
Normale Datei
59
src/me/yaruma/fightsystem/listener/EntityDamageByEntityListener.java
Normale Datei
@ -0,0 +1,59 @@
|
|||||||
|
package me.yaruma.fightsystem.listener;
|
||||||
|
|
||||||
|
import me.yaruma.fightsystem.FightSystem;
|
||||||
|
import me.yaruma.fightsystem.fight.Fight;
|
||||||
|
import me.yaruma.fightsystem.fight.FightState;
|
||||||
|
import me.yaruma.fightsystem.fight.FightTeam;
|
||||||
|
import org.bukkit.entity.Arrow;
|
||||||
|
import org.bukkit.entity.Item;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.entity.TNTPrimed;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.Listener;
|
||||||
|
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||||
|
|
||||||
|
public class EntityDamageByEntityListener implements Listener {
|
||||||
|
|
||||||
|
FightSystem instance = FightSystem.getPlugin();
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void handleEntityDamageByEntity(EntityDamageByEntityEvent event) {
|
||||||
|
if(instance.getFightState() != FightState.RUNNING) {
|
||||||
|
if(event.getEntity() instanceof Player) {
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if(event.getEntity() instanceof Player) {
|
||||||
|
Player player = ((Player) event.getEntity()).getPlayer();
|
||||||
|
|
||||||
|
if(event.getDamager() instanceof Player) {
|
||||||
|
Player damager = ((Player) event.getDamager()).getPlayer();
|
||||||
|
|
||||||
|
if(Fight.getPlayerTeam(player) != null) {
|
||||||
|
if(Fight.getPlayerTeam(player) == Fight.getPlayerTeam(damager)) {
|
||||||
|
event.setCancelled(true);
|
||||||
|
damager.sendMessage(FightSystem.PREFIX + "§cDu darfst deinen Teamkollegen keinen Schaden machen!");
|
||||||
|
}
|
||||||
|
} else
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(event.getDamager() instanceof Arrow) {
|
||||||
|
Arrow damagerArrow = (Arrow) event.getDamager();
|
||||||
|
if(!(damagerArrow.getShooter() instanceof Player)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Player damager = (Player) damagerArrow.getShooter();
|
||||||
|
if(Fight.getPlayerTeam(player) == Fight.getPlayerTeam(damager)) {
|
||||||
|
event.setCancelled(true);
|
||||||
|
damager.sendMessage(FightSystem.PREFIX + "§cDu darfst deinen Teamkollegen keinen Schaden machen!");
|
||||||
|
damagerArrow.setFireTicks(0);
|
||||||
|
player.setFireTicks(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -23,10 +23,10 @@ public class PlayerChatListener implements Listener {
|
|||||||
|
|
||||||
FightTeam fightTeam = Fight.getPlayerTeam(player);
|
FightTeam fightTeam = Fight.getPlayerTeam(player);
|
||||||
|
|
||||||
if(fightTeam != null){
|
if(fightTeam != null) {
|
||||||
String prefixColorCode = fightTeam.getPrefix();
|
String prefixColorCode = fightTeam.getPrefix();
|
||||||
String teamName = fightTeam.getName();
|
String teamName = fightTeam.getName();
|
||||||
if(message.startsWith(teamChatDetection)){
|
if(message.startsWith(teamChatDetection)) {
|
||||||
fightTeam.broadcast(prefixColorCode + player.getName() + "» " + prefixColorCode + message);
|
fightTeam.broadcast(prefixColorCode + player.getName() + "» " + prefixColorCode + message);
|
||||||
} else {
|
} else {
|
||||||
Bukkit.broadcastMessage(prefixColorCode + teamName + " " + player.getName() + " §8» §7" + message);
|
Bukkit.broadcastMessage(prefixColorCode + teamName + " " + player.getName() + " §8» §7" + message);
|
||||||
|
@ -48,7 +48,11 @@ public class PlayerInteractListener implements Listener {
|
|||||||
break;
|
break;
|
||||||
case "§4Abbrechen":
|
case "§4Abbrechen":
|
||||||
Bukkit.broadcastMessage(FightSystem.PREFIX + "§6Das Team von §a" + fightTeam.getLeader().getPlayer().getName() + " §6hat den Kampf abgebrochen! \n Server stoppt in 30 Sekunden...");
|
Bukkit.broadcastMessage(FightSystem.PREFIX + "§6Das Team von §a" + fightTeam.getLeader().getPlayer().getName() + " §6hat den Kampf abgebrochen! \n Server stoppt in 30 Sekunden...");
|
||||||
Countdown countdown = new Countdown(20*30, new FinishNoPlayersOnline());
|
player.getInventory().clear();
|
||||||
|
if(Fight.getOpposite(fightTeam).getLeader().getPlayer() != null) Fight.getOpposite(fightTeam).getLeader().getPlayer().getInventory().clear();
|
||||||
|
|
||||||
|
Countdown.cancelAllTimers(instance);
|
||||||
|
Countdown countdown = new Countdown(30, new FinishNoPlayersOnline());
|
||||||
countdown.startTimer(instance);
|
countdown.startTimer(instance);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -53,7 +53,7 @@ public class Countdown {
|
|||||||
Bukkit.getScheduler().cancelTask(taskID);
|
Bukkit.getScheduler().cancelTask(taskID);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void cancelAllTimers(FightSystem plugin) {
|
public static void cancelAllTimers(FightSystem plugin) {
|
||||||
Bukkit.getScheduler().cancelTasks(plugin);
|
Bukkit.getScheduler().cancelTasks(plugin);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,7 @@ public class SetupItems {
|
|||||||
public static void giveSetupItems(Player player) {
|
public static void giveSetupItems(Player player) {
|
||||||
Inventory inventory = player.getInventory();
|
Inventory inventory = player.getInventory();
|
||||||
inventory.setItem(3, new ItemBuilder(Material.INK_SACK, (short) 10).removeAllAtributs().addEnchantment(Enchantment.DURABILITY, 1).setDisplayName("§cNicht bereit").build());
|
inventory.setItem(3, new ItemBuilder(Material.INK_SACK, (short) 10).removeAllAtributs().addEnchantment(Enchantment.DURABILITY, 1).setDisplayName("§cNicht bereit").build());
|
||||||
inventory.setItem(3, new ItemBuilder(Material.INK_SACK, (short) 1).removeAllAtributs().addEnchantment(Enchantment.DURABILITY, 1).setDisplayName("§4Abbrechen").build());
|
inventory.setItem(5, new ItemBuilder(Material.INK_SACK, (short) 1).removeAllAtributs().addEnchantment(Enchantment.DURABILITY, 1).setDisplayName("§4Abbrechen").build());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -48,8 +48,8 @@ public class Scoreboard {
|
|||||||
objective.setDisplayName("§6Fight Info");
|
objective.setDisplayName("§6Fight Info");
|
||||||
objective.getScore("§7Zeit: §a" + FightSystem.getPlugin().getFightTime()).setScore(0);
|
objective.getScore("§7Zeit: §a" + FightSystem.getPlugin().getFightTime()).setScore(0);
|
||||||
if(Methods.isEnabled("Fight.Entern")) objective.getScore("§7Entern: " + (FightSystem.getPlugin().isEntern() ? "§aja" : "§cnein")).setScore(1);
|
if(Methods.isEnabled("Fight.Entern")) objective.getScore("§7Entern: " + (FightSystem.getPlugin().isEntern() ? "§aja" : "§cnein")).setScore(1);
|
||||||
if(Methods.isEnabled("WinConditions.PercentSystem")) objective.getScore("§eSchaden ROT: " + FightSystem.getPlugin().getDamageRed()).setScore(2);
|
if(Methods.isEnabled("WinConditions.PercentSystem")) objective.getScore("§eSchaden ROT: §c" + FightSystem.getPlugin().getDamageRed() + "%").setScore(2);
|
||||||
if(Methods.isEnabled("WinConditions.PercentSystem")) objective.getScore("§eSchaden BLAU: " + FightSystem.getPlugin().getGetDamageBlue()).setScore(3);
|
if(Methods.isEnabled("WinConditions.PercentSystem")) objective.getScore("§eSchaden BLAU: §c" + FightSystem.getPlugin().getGetDamageBlue() + "%").setScore(3);
|
||||||
}
|
}
|
||||||
player.setScoreboard(scoreboard);
|
player.setScoreboard(scoreboard);
|
||||||
index++;
|
index++;
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren