hunder and standby health rewrite
This commit is contained in:
parent
dc731b425f
commit
20037e986f
5 changed files with 22 additions and 27 deletions
2
pom.xml
2
pom.xml
|
@ -1,7 +1,7 @@
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"><modelVersion>4.0.0</modelVersion>
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"><modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>net.tylermurphy</groupId>
|
<groupId>net.tylermurphy</groupId>
|
||||||
<artifactId>HideAndSeek</artifactId>
|
<artifactId>HideAndSeek</artifactId>
|
||||||
<version>1.1.0</version>
|
<version>1.1.1</version>
|
||||||
<name>Hide and Seek Plugin</name>
|
<name>Hide and Seek Plugin</name>
|
||||||
<build>
|
<build>
|
||||||
<plugins>
|
<plugins>
|
||||||
|
|
|
@ -9,7 +9,7 @@ public class About implements ICommand {
|
||||||
|
|
||||||
public void execute(CommandSender sender, String[] args) {
|
public void execute(CommandSender sender, String[] args) {
|
||||||
sender.sendMessage(
|
sender.sendMessage(
|
||||||
String.format("%s%sHide and Seek %s(1.1.0%s)\n", ChatColor.AQUA, ChatColor.BOLD, ChatColor.GRAY,ChatColor.WHITE,ChatColor.GRAY) +
|
String.format("%s%sHide and Seek %s(1.1.1%s)\n", ChatColor.AQUA, ChatColor.BOLD, ChatColor.GRAY,ChatColor.WHITE,ChatColor.GRAY) +
|
||||||
String.format("%sAuthor: %s[KenshinEto]\n", ChatColor.GRAY, ChatColor.WHITE) +
|
String.format("%sAuthor: %s[KenshinEto]\n", ChatColor.GRAY, ChatColor.WHITE) +
|
||||||
String.format("%sHelp Command: %s/hs %shelp", ChatColor.GRAY, ChatColor.AQUA, ChatColor.WHITE)
|
String.format("%sHelp Command: %s/hs %shelp", ChatColor.GRAY, ChatColor.AQUA, ChatColor.WHITE)
|
||||||
);
|
);
|
||||||
|
|
|
@ -15,6 +15,7 @@ import org.bukkit.event.Listener;
|
||||||
import org.bukkit.event.entity.EntityDamageEvent;
|
import org.bukkit.event.entity.EntityDamageEvent;
|
||||||
import org.bukkit.event.entity.EntityRegainHealthEvent;
|
import org.bukkit.event.entity.EntityRegainHealthEvent;
|
||||||
import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason;
|
import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason;
|
||||||
|
import org.bukkit.event.entity.FoodLevelChangeEvent;
|
||||||
import org.bukkit.event.entity.ProjectileLaunchEvent;
|
import org.bukkit.event.entity.ProjectileLaunchEvent;
|
||||||
import org.bukkit.event.player.PlayerJoinEvent;
|
import org.bukkit.event.player.PlayerJoinEvent;
|
||||||
import org.bukkit.event.player.PlayerQuitEvent;
|
import org.bukkit.event.player.PlayerQuitEvent;
|
||||||
|
@ -54,6 +55,10 @@ public class EventManager implements Listener {
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPlayerDamage(EntityDamageEvent event) {
|
public void onPlayerDamage(EntityDamageEvent event) {
|
||||||
if(event.getEntity() instanceof Player) {
|
if(event.getEntity() instanceof Player) {
|
||||||
|
if(!status.equals("Playing")) {
|
||||||
|
event.setCancelled(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
Player player = (Player) event.getEntity();
|
Player player = (Player) event.getEntity();
|
||||||
if(player.getHealth()-event.getDamage() < 0) {
|
if(player.getHealth()-event.getDamage() < 0) {
|
||||||
if(spawnPosition == null) return;
|
if(spawnPosition == null) return;
|
||||||
|
@ -61,16 +66,14 @@ public class EventManager implements Listener {
|
||||||
player.setHealth(player.getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue());
|
player.setHealth(player.getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue());
|
||||||
player.teleport(new Location(player.getWorld(), spawnPosition.getX(), spawnPosition.getY(), spawnPosition.getZ()));
|
player.teleport(new Location(player.getWorld(), spawnPosition.getX(), spawnPosition.getY(), spawnPosition.getZ()));
|
||||||
Functions.playSound(player, Sound.ENTITY_PLAYER_DEATH, 1, 1);
|
Functions.playSound(player, Sound.ENTITY_PLAYER_DEATH, 1, 1);
|
||||||
if(status.equals("Playing")) {
|
Functions.resetPlayer(player);
|
||||||
Functions.resetPlayer(player);
|
if(Hider.hasEntry(event.getEntity().getName())) {
|
||||||
if(Hider.hasEntry(event.getEntity().getName())) {
|
Bukkit.broadcastMessage(String.format(messagePrefix + "%s%s%s has died and become a seeker", ChatColor.GOLD, event.getEntity().getName(), ChatColor.WHITE));
|
||||||
Bukkit.broadcastMessage(String.format(messagePrefix + "%s%s%s has died and become a seeker", ChatColor.GOLD, event.getEntity().getName(), ChatColor.WHITE));
|
|
||||||
}
|
|
||||||
if(Seeker.hasEntry(event.getEntity().getName())) {
|
|
||||||
Bukkit.broadcastMessage(String.format(messagePrefix + "%s%s%s has been beat by a hider", ChatColor.RED, event.getEntity().getName(), ChatColor.WHITE));
|
|
||||||
}
|
|
||||||
Seeker.addEntry(player.getName());
|
|
||||||
}
|
}
|
||||||
|
if(Seeker.hasEntry(event.getEntity().getName())) {
|
||||||
|
Bukkit.broadcastMessage(String.format(messagePrefix + "%s%s%s has been beat by a hider", ChatColor.RED, event.getEntity().getName(), ChatColor.WHITE));
|
||||||
|
}
|
||||||
|
Seeker.addEntry(player.getName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -99,6 +102,11 @@ public class EventManager implements Listener {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onFoodLevelChange(FoodLevelChangeEvent event) {
|
||||||
|
event.setCancelled(false);
|
||||||
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPlayerRegainHealth(EntityRegainHealthEvent event) {
|
public void onPlayerRegainHealth(EntityRegainHealthEvent event) {
|
||||||
if(event.getRegainReason() == RegainReason.SATIATED || event.getRegainReason() == RegainReason.REGEN)
|
if(event.getRegainReason() == RegainReason.SATIATED || event.getRegainReason() == RegainReason.REGEN)
|
||||||
|
|
|
@ -32,13 +32,7 @@ public class TickManager {
|
||||||
|
|
||||||
Functions.emptyOfflinePlayers();
|
Functions.emptyOfflinePlayers();
|
||||||
|
|
||||||
for(Player player : playerList.values()) {
|
if(status.equals("Starting")) {
|
||||||
player.addPotionEffect(new PotionEffect(PotionEffectType.SATURATION, 1000000, 127, false, false));
|
|
||||||
}
|
|
||||||
|
|
||||||
if(status.equals("Standby") || status.equals("Setup")) {
|
|
||||||
onStandby();
|
|
||||||
} else if(status.equals("Starting")) {
|
|
||||||
onStarting();
|
onStarting();
|
||||||
} else if(status.equals("Playing")) {
|
} else if(status.equals("Playing")) {
|
||||||
onPlaying();
|
onPlaying();
|
||||||
|
@ -56,13 +50,6 @@ public class TickManager {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void onStandby() {
|
|
||||||
for(Player player : playerList.values()) {
|
|
||||||
player.addPotionEffect(new PotionEffect(PotionEffectType.REGENERATION, 1000000, 127, false, false));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void onStarting() {
|
private static void onStarting() {
|
||||||
for(String playerName : Seeker.getEntries()) {
|
for(String playerName : Seeker.getEntries()) {
|
||||||
Player player = playerList.get(playerName);
|
Player player = playerList.get(playerName);
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
name: HideAndSeek
|
name: HideAndSeek
|
||||||
main: net.tylermurphy.hideAndSeek.Main
|
main: net.tylermurphy.hideAndSeek.Main
|
||||||
version: 1.1.0
|
version: 1.1.1
|
||||||
author: KenshinEto
|
author: KenshinEto
|
||||||
load: STARTUP
|
load: STARTUP
|
||||||
api-version: 1.17
|
api-version: 1.17
|
||||||
|
|
Loading…
Reference in a new issue