commit
725db2875c
17 changed files with 130 additions and 122 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>KenshinsHideAndSeek</artifactId>
|
<artifactId>KenshinsHideAndSeek</artifactId>
|
||||||
<version>1.6.0</version>
|
<version>1.6.1</version>
|
||||||
<name>Hide and Seek Plugin</name>
|
<name>Hide and Seek Plugin</name>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
|
|
@ -26,7 +26,7 @@ public class About implements ICommand {
|
||||||
|
|
||||||
public void execute(Player sender, String[] args) {
|
public void execute(Player sender, String[] args) {
|
||||||
sender.sendMessage(
|
sender.sendMessage(
|
||||||
String.format("%s%sHide and Seek %s(%s1.6.0%s)\n", ChatColor.AQUA, ChatColor.BOLD, ChatColor.GRAY,ChatColor.WHITE,ChatColor.GRAY) +
|
String.format("%s%sHide and Seek %s(%s1.6.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)
|
||||||
);
|
);
|
||||||
|
|
|
@ -42,6 +42,10 @@ public class Setup implements ICommand {
|
||||||
msg = msg + "\n" + message("SETUP_LOBBY");
|
msg = msg + "\n" + message("SETUP_LOBBY");
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
|
if (seekerLobbyPosition.getBlockX() == 0 && seekerLobbyPosition.getBlockY() == 0 && seekerLobbyPosition.getBlockZ() == 0) {
|
||||||
|
msg = msg + "\n" + message("SETUP_SEEKER_LOBBY");
|
||||||
|
count++;
|
||||||
|
}
|
||||||
if (exitPosition.getBlockX() == 0 && exitPosition.getBlockY() == 0 && exitPosition.getBlockZ() == 0) {
|
if (exitPosition.getBlockX() == 0 && exitPosition.getBlockY() == 0 && exitPosition.getBlockZ() == 0) {
|
||||||
msg = msg + "\n" + message("SETUP_EXIT");
|
msg = msg + "\n" + message("SETUP_EXIT");
|
||||||
count++;
|
count++;
|
||||||
|
|
|
@ -0,0 +1,31 @@
|
||||||
|
package net.tylermurphy.hideAndSeek.command.location;
|
||||||
|
|
||||||
|
import net.tylermurphy.hideAndSeek.command.ICommand;
|
||||||
|
import net.tylermurphy.hideAndSeek.command.location.util.LocationUtils;
|
||||||
|
import net.tylermurphy.hideAndSeek.command.location.util.Locations;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import static net.tylermurphy.hideAndSeek.configuration.Config.*;
|
||||||
|
|
||||||
|
public class SetSeekerLobbyLocation implements ICommand {
|
||||||
|
|
||||||
|
public void execute(Player sender, String[] args) {
|
||||||
|
LocationUtils.setLocation(sender, Locations.SEEKER, vector -> {
|
||||||
|
seekerLobbyWorld = sender.getLocation().getWorld().getName();
|
||||||
|
seekerLobbyPosition = vector;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getLabel() {
|
||||||
|
return "setseekerlobby";
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUsage() {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDescription() {
|
||||||
|
return "Sets hide and seeks seeker lobby location to current position";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -7,7 +7,8 @@ public enum Locations {
|
||||||
|
|
||||||
GAME("spawns.game"),
|
GAME("spawns.game"),
|
||||||
LOBBY("spawns.lobby"),
|
LOBBY("spawns.lobby"),
|
||||||
EXIT("spawns.exit");
|
EXIT("spawns.exit"),
|
||||||
|
SEEKER("spawns.seeker");
|
||||||
|
|
||||||
private final String path;
|
private final String path;
|
||||||
Locations(String path) {
|
Locations(String path) {
|
||||||
|
|
|
@ -50,6 +50,7 @@ public class Config {
|
||||||
gameOverPrefix,
|
gameOverPrefix,
|
||||||
warningPrefix,
|
warningPrefix,
|
||||||
spawnWorld,
|
spawnWorld,
|
||||||
|
seekerLobbyWorld,
|
||||||
exitWorld,
|
exitWorld,
|
||||||
lobbyWorld,
|
lobbyWorld,
|
||||||
locale,
|
locale,
|
||||||
|
@ -67,6 +68,7 @@ public class Config {
|
||||||
spawnPosition,
|
spawnPosition,
|
||||||
lobbyPosition,
|
lobbyPosition,
|
||||||
exitPosition,
|
exitPosition,
|
||||||
|
seekerLobbyPosition,
|
||||||
worldBorderPosition;
|
worldBorderPosition;
|
||||||
|
|
||||||
public static boolean
|
public static boolean
|
||||||
|
@ -91,7 +93,8 @@ public class Config {
|
||||||
mapSaveEnabled,
|
mapSaveEnabled,
|
||||||
allowNaturalCauses,
|
allowNaturalCauses,
|
||||||
saveInventory,
|
saveInventory,
|
||||||
blockhuntEnabled;
|
blockhuntEnabled,
|
||||||
|
delayedRespawn;
|
||||||
|
|
||||||
public static int
|
public static int
|
||||||
minPlayers,
|
minPlayers,
|
||||||
|
@ -116,7 +119,9 @@ public class Config {
|
||||||
lobbyItemLeavePosition,
|
lobbyItemLeavePosition,
|
||||||
lobbyItemStartPosition,
|
lobbyItemStartPosition,
|
||||||
flightToggleItemPosition,
|
flightToggleItemPosition,
|
||||||
teleportItemPosition;
|
teleportItemPosition,
|
||||||
|
solidifyTime,
|
||||||
|
delayedRespawnDelay;
|
||||||
|
|
||||||
public static float
|
public static float
|
||||||
seekerPingLeadingVolume,
|
seekerPingLeadingVolume,
|
||||||
|
@ -184,6 +189,14 @@ public class Config {
|
||||||
);
|
);
|
||||||
lobbyWorld = config.getString("spawns.lobby.world");
|
lobbyWorld = config.getString("spawns.lobby.world");
|
||||||
|
|
||||||
|
///Seeker Lobby
|
||||||
|
seekerLobbyPosition = new Vector(
|
||||||
|
config.getDouble("spawns.seeker.x"),
|
||||||
|
Math.max(Main.getInstance().supports(18) ? -64 : 0, Math.min(255, config.getDouble("spawns.seeker.y"))),
|
||||||
|
config.getDouble("spawns.seeker.z")
|
||||||
|
);
|
||||||
|
seekerLobbyWorld = config.getString("spawns.seeker.world");
|
||||||
|
|
||||||
announceMessagesToNonPlayers = config.getBoolean("announceMessagesToNonPlayers");
|
announceMessagesToNonPlayers = config.getBoolean("announceMessagesToNonPlayers");
|
||||||
|
|
||||||
exitPosition = new Vector(
|
exitPosition = new Vector(
|
||||||
|
@ -304,6 +317,7 @@ public class Config {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
solidifyTime = Math.max(20,config.getInt("blockhunt.solidifyTime"));
|
||||||
|
|
||||||
//Leaderboard
|
//Leaderboard
|
||||||
LOBBY_TITLE = leaderboard.getString("lobby.title");
|
LOBBY_TITLE = leaderboard.getString("lobby.title");
|
||||||
|
@ -353,6 +367,10 @@ public class Config {
|
||||||
Main.getInstance().getLogger().warning("databaseType: "+databaseType+" is not a valid configuration option!");
|
Main.getInstance().getLogger().warning("databaseType: "+databaseType+" is not a valid configuration option!");
|
||||||
databaseType = "SQLITE";
|
databaseType = "SQLITE";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
delayedRespawn = config.getBoolean("delayedRespawn.enabled");
|
||||||
|
delayedRespawnDelay = Math.max(0,config.getInt("delayedRespawn.delay"));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void addToConfig(String path, Object value) {
|
public static void addToConfig(String path, Object value) {
|
||||||
|
|
|
@ -104,9 +104,6 @@ public class Board {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addHider(Player player) {
|
public void addHider(Player player) {
|
||||||
if(!Main.getInstance().supports(9)){
|
|
||||||
player.spigot().setCollidesWithEntities(false);
|
|
||||||
}
|
|
||||||
Hider.add(player.getUniqueId().toString());
|
Hider.add(player.getUniqueId().toString());
|
||||||
Seeker.remove(player.getUniqueId().toString());
|
Seeker.remove(player.getUniqueId().toString());
|
||||||
Spectator.remove(player.getUniqueId().toString());
|
Spectator.remove(player.getUniqueId().toString());
|
||||||
|
@ -114,9 +111,6 @@ public class Board {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addSeeker(Player player) {
|
public void addSeeker(Player player) {
|
||||||
if(!Main.getInstance().supports(9)){
|
|
||||||
player.spigot().setCollidesWithEntities(false);
|
|
||||||
}
|
|
||||||
Hider.remove(player.getUniqueId().toString());
|
Hider.remove(player.getUniqueId().toString());
|
||||||
Seeker.add(player.getUniqueId().toString());
|
Seeker.add(player.getUniqueId().toString());
|
||||||
Spectator.remove(player.getUniqueId().toString());
|
Spectator.remove(player.getUniqueId().toString());
|
||||||
|
@ -124,9 +118,6 @@ public class Board {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addSpectator(Player player) {
|
public void addSpectator(Player player) {
|
||||||
if(!Main.getInstance().supports(9)){
|
|
||||||
player.spigot().setCollidesWithEntities(false);
|
|
||||||
}
|
|
||||||
Hider.remove(player.getUniqueId().toString());
|
Hider.remove(player.getUniqueId().toString());
|
||||||
Seeker.remove(player.getUniqueId().toString());
|
Seeker.remove(player.getUniqueId().toString());
|
||||||
Spectator.add(player.getUniqueId().toString());
|
Spectator.add(player.getUniqueId().toString());
|
||||||
|
@ -134,9 +125,6 @@ public class Board {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void remove(Player player) {
|
public void remove(Player player) {
|
||||||
if(!Main.getInstance().supports(9)){
|
|
||||||
player.spigot().setCollidesWithEntities(true);
|
|
||||||
}
|
|
||||||
Hider.remove(player.getUniqueId().toString());
|
Hider.remove(player.getUniqueId().toString());
|
||||||
Seeker.remove(player.getUniqueId().toString());
|
Seeker.remove(player.getUniqueId().toString());
|
||||||
Spectator.remove(player.getUniqueId().toString());
|
Spectator.remove(player.getUniqueId().toString());
|
||||||
|
|
|
@ -107,10 +107,7 @@ public class Game {
|
||||||
public void start() {
|
public void start() {
|
||||||
try {
|
try {
|
||||||
Optional<Player> rand = board.getPlayers().stream().skip(new Random().nextInt(board.size())).findFirst();
|
Optional<Player> rand = board.getPlayers().stream().skip(new Random().nextInt(board.size())).findFirst();
|
||||||
Player picked = rand.orElse(board.getPlayers().get(0));
|
Player seeker = rand.orElse(board.getPlayers().get(0));
|
||||||
String seekerName = picked.getName();
|
|
||||||
Player temp = Bukkit.getPlayer(seekerName);
|
|
||||||
Player seeker = board.getPlayer(temp.getUniqueId());
|
|
||||||
start(seeker);
|
start(seeker);
|
||||||
} catch (Exception e){
|
} catch (Exception e){
|
||||||
Main.getInstance().getLogger().warning("Failed to select random seeker.");
|
Main.getInstance().getLogger().warning("Failed to select random seeker.");
|
||||||
|
@ -257,7 +254,12 @@ public class Game {
|
||||||
if (startingTimer == 0) {
|
if (startingTimer == 0) {
|
||||||
message = message("START").toString();
|
message = message("START").toString();
|
||||||
status = Status.PLAYING;
|
status = Status.PLAYING;
|
||||||
board.getPlayers().forEach(player -> PlayerLoader.resetPlayer(player, board));
|
board.getPlayers().forEach(player -> {
|
||||||
|
PlayerLoader.resetPlayer(player, board);
|
||||||
|
if(board.isSeeker(player)){
|
||||||
|
player.teleport(new Location(Bukkit.getWorld(getGameWorld()), spawnPosition.getX(), spawnPosition.getY(), spawnPosition.getZ()));
|
||||||
|
}
|
||||||
|
});
|
||||||
} else if (startingTimer == 1){
|
} else if (startingTimer == 1){
|
||||||
message = message("START_COUNTDOWN_LAST").addAmount(startingTimer).toString();
|
message = message("START_COUNTDOWN_LAST").addAmount(startingTimer).toString();
|
||||||
} else {
|
} else {
|
||||||
|
@ -333,6 +335,7 @@ public class Game {
|
||||||
if (spawnPosition.getBlockX() == 0 && spawnPosition.getBlockY() == 0 && spawnPosition.getBlockZ() == 0) return true;
|
if (spawnPosition.getBlockX() == 0 && spawnPosition.getBlockY() == 0 && spawnPosition.getBlockZ() == 0) return true;
|
||||||
if (lobbyPosition.getBlockX() == 0 && lobbyPosition.getBlockY() == 0 && lobbyPosition.getBlockZ() == 0) return true;
|
if (lobbyPosition.getBlockX() == 0 && lobbyPosition.getBlockY() == 0 && lobbyPosition.getBlockZ() == 0) return true;
|
||||||
if (exitPosition.getBlockX() == 0 && exitPosition.getBlockY() == 0 && exitPosition.getBlockZ() == 0) return true;
|
if (exitPosition.getBlockX() == 0 && exitPosition.getBlockY() == 0 && exitPosition.getBlockZ() == 0) return true;
|
||||||
|
if (seekerLobbyPosition.getBlockX() == 0 && seekerLobbyPosition.getBlockY() == 0 && seekerLobbyPosition.getBlockZ() == 0) return true;
|
||||||
if (mapSaveEnabled) {
|
if (mapSaveEnabled) {
|
||||||
File destination = new File(Main.getInstance().getWorldContainer() + File.separator + getGameWorld());
|
File destination = new File(Main.getInstance().getWorldContainer() + File.separator + getGameWorld());
|
||||||
if (!destination.exists()) return true;
|
if (!destination.exists()) return true;
|
||||||
|
|
|
@ -52,11 +52,8 @@ public class PlayerLoader {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void loadSeeker(Player player, String gameWorld){
|
public static void loadSeeker(Player player, String gameWorld){
|
||||||
player.teleport(new Location(Bukkit.getWorld(gameWorld), spawnPosition.getX(),spawnPosition.getY(),spawnPosition.getZ()));
|
player.teleport(new Location(Bukkit.getWorld(gameWorld), seekerLobbyPosition.getX(),seekerLobbyPosition.getY(),seekerLobbyPosition.getZ()));
|
||||||
loadPlayer(player);
|
loadPlayer(player);
|
||||||
player.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS,1000000,127,false,false));
|
|
||||||
player.addPotionEffect(new PotionEffect(PotionEffectType.SLOW,1000000,127,false,false));
|
|
||||||
player.addPotionEffect(new PotionEffect(PotionEffectType.JUMP,1000000,128,false,false));
|
|
||||||
Titles.sendTitle(player, 10, 70, 20, ChatColor.WHITE + "" + message("SEEKER_TEAM_NAME"), ChatColor.WHITE + message("SEEKERS_SUBTITLE").toString());
|
Titles.sendTitle(player, 10, 70, 20, ChatColor.WHITE + "" + message("SEEKER_TEAM_NAME"), ChatColor.WHITE + message("SEEKERS_SUBTITLE").toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -80,7 +80,7 @@ public class DamageHandler implements Listener {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Players cannot take damage while game is not in session
|
// Players cannot take damage while game is not in session
|
||||||
if (board.contains(player) && (game.getStatus() == Status.STANDBY || game.getStatus() == Status.STARTING)){
|
if (board.contains(player) && game.getStatus() != Status.PLAYING){
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -97,7 +97,17 @@ public class DamageHandler implements Listener {
|
||||||
// Reveal player if they are disguised
|
// Reveal player if they are disguised
|
||||||
Main.getInstance().getDisguiser().reveal(player);
|
Main.getInstance().getDisguiser().reveal(player);
|
||||||
// Teleport player to seeker spawn
|
// Teleport player to seeker spawn
|
||||||
player.teleport(new Location(Bukkit.getWorld(game.getGameWorld()), spawnPosition.getX(), spawnPosition.getY(), spawnPosition.getZ()));
|
if(delayedRespawn){
|
||||||
|
player.teleport(new Location(Bukkit.getWorld(game.getGameWorld()), seekerLobbyPosition.getX(), seekerLobbyPosition.getY(), seekerLobbyPosition.getZ()));
|
||||||
|
player.sendMessage(messagePrefix + message("RESPAWN_NOTICE").addAmount(delayedRespawnDelay));
|
||||||
|
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(Main.getInstance(), () -> {
|
||||||
|
if(game.getStatus() == Status.PLAYING){
|
||||||
|
player.teleport(new Location(Bukkit.getWorld(game.getGameWorld()), spawnPosition.getX(), spawnPosition.getY(), spawnPosition.getZ()));
|
||||||
|
}
|
||||||
|
}, delayedRespawnDelay * 20L);
|
||||||
|
} else {
|
||||||
|
player.teleport(new Location(Bukkit.getWorld(game.getGameWorld()), spawnPosition.getX(), spawnPosition.getY(), spawnPosition.getZ()));
|
||||||
|
}
|
||||||
// Add leaderboard stats
|
// Add leaderboard stats
|
||||||
board.addDeath(player.getUniqueId());
|
board.addDeath(player.getUniqueId());
|
||||||
if (attacker != null) board.addKill(attacker.getUniqueId());
|
if (attacker != null) board.addKill(attacker.getUniqueId());
|
||||||
|
|
|
@ -1,21 +1,19 @@
|
||||||
package net.tylermurphy.hideAndSeek.game.listener;
|
package net.tylermurphy.hideAndSeek.game.listener;
|
||||||
|
|
||||||
import static com.comphenix.protocol.PacketType.Play.Client.*;
|
import static com.comphenix.protocol.PacketType.Play.Client.*;
|
||||||
|
import static net.tylermurphy.hideAndSeek.configuration.Config.solidifyTime;
|
||||||
|
|
||||||
import com.comphenix.protocol.ProtocolLibrary;
|
import com.comphenix.protocol.ProtocolLibrary;
|
||||||
import com.comphenix.protocol.ProtocolManager;
|
import com.comphenix.protocol.ProtocolManager;
|
||||||
import com.comphenix.protocol.events.PacketAdapter;
|
import com.comphenix.protocol.events.PacketAdapter;
|
||||||
import com.comphenix.protocol.events.PacketContainer;
|
import com.comphenix.protocol.events.PacketContainer;
|
||||||
import com.comphenix.protocol.events.PacketEvent;
|
import com.comphenix.protocol.events.PacketEvent;
|
||||||
import com.cryptomorin.xseries.XMaterial;
|
|
||||||
import net.tylermurphy.hideAndSeek.Main;
|
import net.tylermurphy.hideAndSeek.Main;
|
||||||
import net.tylermurphy.hideAndSeek.game.util.Disguise;
|
import net.tylermurphy.hideAndSeek.game.util.Disguise;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.GameMode;
|
import org.bukkit.GameMode;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.attribute.Attribute;
|
import org.bukkit.attribute.Attribute;
|
||||||
import org.bukkit.enchantments.Enchantment;
|
|
||||||
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;
|
||||||
|
@ -23,15 +21,9 @@ import org.bukkit.event.Listener;
|
||||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||||
import org.bukkit.event.entity.EntityDamageEvent;
|
import org.bukkit.event.entity.EntityDamageEvent;
|
||||||
import org.bukkit.event.player.PlayerMoveEvent;
|
import org.bukkit.event.player.PlayerMoveEvent;
|
||||||
import org.bukkit.inventory.Inventory;
|
|
||||||
import org.bukkit.inventory.ItemStack;
|
|
||||||
import org.bukkit.potion.PotionEffect;
|
|
||||||
import org.bukkit.potion.PotionEffectType;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
|
||||||
public class DisguiseHandler implements Listener {
|
public class DisguiseHandler implements Listener {
|
||||||
|
|
||||||
private static final ProtocolManager protocolManager = ProtocolLibrary.getProtocolManager();
|
private static final ProtocolManager protocolManager = ProtocolLibrary.getProtocolManager();
|
||||||
|
@ -50,18 +42,11 @@ public class DisguiseHandler implements Listener {
|
||||||
if(lastLocation.getWorld() != currentLocation.getWorld()) return;
|
if(lastLocation.getWorld() != currentLocation.getWorld()) return;
|
||||||
double distance = lastLocation.distance(currentLocation);
|
double distance = lastLocation.distance(currentLocation);
|
||||||
disguise.setSolidify(distance < .1);
|
disguise.setSolidify(distance < .1);
|
||||||
}, 40L);
|
}, solidifyTime);
|
||||||
if(event.getFrom().distance(event.getTo()) > .1)
|
if(event.getFrom().distance(event.getTo()) > .1)
|
||||||
disguise.setSolidify(false);
|
disguise.setSolidify(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// @EventHandler(priority = EventPriority.MONITOR)
|
|
||||||
// public void onInteract(PlayerInteractEvent event) {
|
|
||||||
// Action action = event.getAction();
|
|
||||||
// Player player = event.getPlayer();
|
|
||||||
// Block block = event.
|
|
||||||
// }
|
|
||||||
|
|
||||||
private PacketAdapter createProtocol(){
|
private PacketAdapter createProtocol(){
|
||||||
return new PacketAdapter(Main.getInstance(), USE_ENTITY) {
|
return new PacketAdapter(Main.getInstance(), USE_ENTITY) {
|
||||||
|
|
||||||
|
@ -69,7 +54,6 @@ public class DisguiseHandler implements Listener {
|
||||||
public void onPacketReceiving(PacketEvent event){
|
public void onPacketReceiving(PacketEvent event){
|
||||||
PacketContainer packet = event.getPacket();
|
PacketContainer packet = event.getPacket();
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
// if(!Main.getInstance().getBoard().isSeeker(player)) return;
|
|
||||||
int id = packet.getIntegers().read(0);
|
int id = packet.getIntegers().read(0);
|
||||||
Disguise disguise = Main.getInstance().getDisguiser().getByEntityID(id);
|
Disguise disguise = Main.getInstance().getDisguiser().getByEntityID(id);
|
||||||
if(disguise == null) disguise = Main.getInstance().getDisguiser().getByHitBoxID(id);
|
if(disguise == null) disguise = Main.getInstance().getDisguiser().getByHitBoxID(id);
|
||||||
|
@ -91,7 +75,7 @@ public class DisguiseHandler implements Listener {
|
||||||
if(Main.getInstance().supports(9)) {
|
if(Main.getInstance().supports(9)) {
|
||||||
amount = seeker.getAttribute(Attribute.GENERIC_ATTACK_DAMAGE).getValue();
|
amount = seeker.getAttribute(Attribute.GENERIC_ATTACK_DAMAGE).getValue();
|
||||||
} else {
|
} else {
|
||||||
amount = getItemDamageValue(seeker.getItemInHand(), disguise.getPlayer(), seeker);
|
return; //1.8 is not supported in Blockhunt yet!!!
|
||||||
}
|
}
|
||||||
|
|
||||||
disguise.setSolidify(false);
|
disguise.setSolidify(false);
|
||||||
|
@ -112,76 +96,4 @@ public class DisguiseHandler implements Listener {
|
||||||
Bukkit.getScheduler().scheduleSyncDelayedTask(Main.getInstance(), () -> debounce.remove(disguise.getPlayer()), 10);
|
Bukkit.getScheduler().scheduleSyncDelayedTask(Main.getInstance(), () -> debounce.remove(disguise.getPlayer()), 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
private int getItemDamageValue(ItemStack is, Player damaged, Player attacker) {
|
|
||||||
double damageValue = 0;
|
|
||||||
if (is != null) {
|
|
||||||
if (is.getType() == XMaterial.WOODEN_SWORD.parseMaterial()) {
|
|
||||||
damageValue = 5;
|
|
||||||
} else if (is.getType() == Material.STONE_SWORD) {
|
|
||||||
damageValue = 6;
|
|
||||||
} else if (is.getType() == Material.IRON_SWORD) {
|
|
||||||
damageValue = 7;
|
|
||||||
} else if (is.getType() == Material.DIAMOND_SWORD) {
|
|
||||||
damageValue = 8;
|
|
||||||
} else {
|
|
||||||
damageValue = 1;
|
|
||||||
}
|
|
||||||
damageValue += is.getEnchantmentLevel(Enchantment.DAMAGE_ALL);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (damaged != null) {
|
|
||||||
Inventory i = damaged.getInventory();
|
|
||||||
Material helmet = i.getItem(39).getType();
|
|
||||||
Material chestplate = i.getItem(40).getType();
|
|
||||||
Material leggings = i.getItem(41).getType();
|
|
||||||
Material boots = i.getItem(42).getType();
|
|
||||||
if (helmet == Material.LEATHER_HELMET)
|
|
||||||
damageValue -= (0.5 / 1.5);
|
|
||||||
// value shown at bar above the health bar / 1.5
|
|
||||||
else if (helmet == Material.CHAINMAIL_HELMET
|
|
||||||
|| helmet == Material.IRON_HELMET
|
|
||||||
|| helmet == Material.DIAMOND_HELMET
|
|
||||||
|| helmet == XMaterial.GOLDEN_HELMET.parseMaterial())
|
|
||||||
damageValue -= (1 / 1.5);
|
|
||||||
|
|
||||||
if (chestplate == Material.LEATHER_CHESTPLATE)
|
|
||||||
damageValue -= (1.0);
|
|
||||||
else if (chestplate == Material.CHAINMAIL_CHESTPLATE
|
|
||||||
|| chestplate == XMaterial.GOLDEN_CHESTPLATE.parseMaterial())
|
|
||||||
damageValue -= (2.5 / 1.5);
|
|
||||||
else if (chestplate == Material.IRON_CHESTPLATE)
|
|
||||||
damageValue -= (3 / 1.5);
|
|
||||||
else if (chestplate == Material.DIAMOND_CHESTPLATE)
|
|
||||||
damageValue -= (4 / 1.5);
|
|
||||||
|
|
||||||
if (leggings == Material.LEATHER_LEGGINGS)
|
|
||||||
damageValue -= (1 / 1.5);
|
|
||||||
else if (leggings == XMaterial.GOLDEN_LEGGINGS.parseMaterial())
|
|
||||||
damageValue -= (1.0);
|
|
||||||
else if (leggings == Material.CHAINMAIL_LEGGINGS)
|
|
||||||
damageValue -= (2 / 1.5);
|
|
||||||
else if (leggings == Material.IRON_LEGGINGS)
|
|
||||||
damageValue -= (2.5 / 1.5);
|
|
||||||
else if (leggings == Material.DIAMOND_LEGGINGS)
|
|
||||||
damageValue -= (3 / 1.5);
|
|
||||||
|
|
||||||
if (boots == Material.LEATHER_BOOTS
|
|
||||||
|| boots == XMaterial.GOLDEN_BOOTS.parseMaterial()
|
|
||||||
|| boots == Material.CHAINMAIL_BOOTS)
|
|
||||||
damageValue -= (0.5 / 1.5);
|
|
||||||
else if (boots == Material.IRON_BOOTS)
|
|
||||||
damageValue -= (1 / 1.5);
|
|
||||||
else if (boots == Material.DIAMOND_BOOTS)
|
|
||||||
damageValue -= (1.0);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (PotionEffect effect : attacker.getActivePotionEffects()){
|
|
||||||
if (effect.getType() == PotionEffectType.HARM) {
|
|
||||||
damageValue += effect.getAmplifier()*1.5;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return (int) Math.round(Math.max(damageValue, 0.0));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,6 +22,7 @@ package net.tylermurphy.hideAndSeek.util;
|
||||||
import net.tylermurphy.hideAndSeek.command.*;
|
import net.tylermurphy.hideAndSeek.command.*;
|
||||||
import net.tylermurphy.hideAndSeek.command.location.SetExitLocation;
|
import net.tylermurphy.hideAndSeek.command.location.SetExitLocation;
|
||||||
import net.tylermurphy.hideAndSeek.command.location.SetLobbyLocation;
|
import net.tylermurphy.hideAndSeek.command.location.SetLobbyLocation;
|
||||||
|
import net.tylermurphy.hideAndSeek.command.location.SetSeekerLobbyLocation;
|
||||||
import net.tylermurphy.hideAndSeek.command.location.SetSpawnLocation;
|
import net.tylermurphy.hideAndSeek.command.location.SetSpawnLocation;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
@ -53,6 +54,7 @@ public class CommandHandler {
|
||||||
registerCommand(new Stop());
|
registerCommand(new Stop());
|
||||||
registerCommand(new SetSpawnLocation());
|
registerCommand(new SetSpawnLocation());
|
||||||
registerCommand(new SetLobbyLocation());
|
registerCommand(new SetLobbyLocation());
|
||||||
|
registerCommand(new SetSeekerLobbyLocation());
|
||||||
registerCommand(new SetExitLocation());
|
registerCommand(new SetExitLocation());
|
||||||
registerCommand(new SetBorder());
|
registerCommand(new SetBorder());
|
||||||
registerCommand(new Reload());
|
registerCommand(new Reload());
|
||||||
|
|
|
@ -29,7 +29,7 @@ import java.util.List;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
@SuppressWarnings({"unused"})
|
@SuppressWarnings({"unused"})
|
||||||
public class VoidGenerator extends ChunkGenerator{
|
public class VoidGenerator extends ChunkGenerator {
|
||||||
|
|
||||||
// 1.14 And On
|
// 1.14 And On
|
||||||
public @NotNull List<BlockPopulator> getDefaultPopulators(@NotNull World world) {
|
public @NotNull List<BlockPopulator> getDefaultPopulators(@NotNull World world) {
|
||||||
|
@ -69,6 +69,22 @@ public class VoidGenerator extends ChunkGenerator{
|
||||||
}
|
}
|
||||||
|
|
||||||
// 1.13 And Prev
|
// 1.13 And Prev
|
||||||
public @NotNull ChunkData generateChunkData(@NotNull World world, @NotNull Random random, int x, int z, @NotNull BiomeGrid biome) { return createChunkData(world); }
|
public @NotNull ChunkData generateChunkData(@NotNull World world, @NotNull Random random, int x, int z, @NotNull BiomeGrid biome) {
|
||||||
|
return createChunkData(world);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 1.8
|
||||||
|
public byte[] generate(World world, Random random, int x, int z) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public short[][] generateExtBlockSections(World world, Random random, int x, int z, ChunkGenerator.BiomeGrid biomes) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public byte[][] generateBlockSections(World world, Random random, int x, int z, ChunkGenerator.BiomeGrid biomes) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -100,6 +100,14 @@ mapSaveEnabled: true
|
||||||
# default: false
|
# default: false
|
||||||
saveInventory: false
|
saveInventory: false
|
||||||
|
|
||||||
|
# By default, if you die in game, you will have to wait [delay] seconds until you respawn. This make is so that if you are killed as a seeker, you cannot
|
||||||
|
# instally go to where the Hider that killed you was. Or if you were a Hider and died, you cant instally go to where you know other Hiders are. It gives some
|
||||||
|
# breathing room. This can be disabled.
|
||||||
|
# default: true
|
||||||
|
delayedRespawn:
|
||||||
|
enabled: true
|
||||||
|
delay: 5
|
||||||
|
|
||||||
# How you want to store game data. If you are running a single server, sqlite is fine, as no setup is necessary.
|
# How you want to store game data. If you are running a single server, sqlite is fine, as no setup is necessary.
|
||||||
# But if you want the data to go across multiple servers, you can switch it to mysql.
|
# But if you want the data to go across multiple servers, you can switch it to mysql.
|
||||||
# WARNING: Data is not saved across databases. You have to migrate the data yourself!
|
# WARNING: Data is not saved across databases. You have to migrate the data yourself!
|
||||||
|
@ -128,8 +136,11 @@ databaseName: hideandseek
|
||||||
# You want block hunt? We have block hunt! Just enable it below, and set the
|
# You want block hunt? We have block hunt! Just enable it below, and set the
|
||||||
# available blocks to pick from, and you're all set! It's that easy!
|
# available blocks to pick from, and you're all set! It's that easy!
|
||||||
# Items are displayed in the order that they are listed below.
|
# Items are displayed in the order that they are listed below.
|
||||||
|
# The solidifyTime is the time in server ticks that it takes players to solidify.
|
||||||
|
# Every 20 ticks is a second. Minimum solidifyTime is 20 ticks.
|
||||||
blockhunt:
|
blockhunt:
|
||||||
enabled: false
|
enabled: false
|
||||||
|
solidifyTime: 60
|
||||||
blocks: [CRAFTING_TABLE, GRASS_BLOCK, DIRT, BEACON, BOOKSHELF]
|
blocks: [CRAFTING_TABLE, GRASS_BLOCK, DIRT, BEACON, BOOKSHELF]
|
||||||
|
|
||||||
worldBorder:
|
worldBorder:
|
||||||
|
@ -306,6 +317,13 @@ spawns:
|
||||||
y: 0
|
y: 0
|
||||||
z: 0
|
z: 0
|
||||||
world: world
|
world: world
|
||||||
|
# Location where seekers wait during the hiding grace period
|
||||||
|
seeker:
|
||||||
|
x: 0
|
||||||
|
y: 0
|
||||||
|
z: 0
|
||||||
|
# Currently is not used, seekers are teleported to spawns.game.world
|
||||||
|
world: world
|
||||||
# Location where players are teleported when they exit (/hs leave)
|
# Location where players are teleported when they exit (/hs leave)
|
||||||
exit:
|
exit:
|
||||||
x: 0
|
x: 0
|
||||||
|
|
|
@ -46,6 +46,7 @@ Localization:
|
||||||
SETUP: "&f&lFühre die folgenden Schritte zur Einrichtung aus:"
|
SETUP: "&f&lFühre die folgenden Schritte zur Einrichtung aus:"
|
||||||
SETUP_GAME: "&c&l- &fTeleport-Position für den Spielbeginn festlegen mit /hs setspawn"
|
SETUP_GAME: "&c&l- &fTeleport-Position für den Spielbeginn festlegen mit /hs setspawn"
|
||||||
SETUP_LOBBY: "&c&l- &fTeleport-Position für die Lobby festlegen mit /hs setlobby"
|
SETUP_LOBBY: "&c&l- &fTeleport-Position für die Lobby festlegen mit /hs setlobby"
|
||||||
|
SETUP_SEEKER_LOBBY: "&c&l- &fTeleport-Position für die Lobby Seekern festlegen mit /hs setseekerlobby"
|
||||||
SETUP_EXIT: "&c&l- &fTeleport-Position für das Spielende festlegen mit /hs setexit"
|
SETUP_EXIT: "&c&l- &fTeleport-Position für das Spielende festlegen mit /hs setexit"
|
||||||
SETUP_SAVEMAP: "&c&l- &fHide and Seek Weltkarte speichern mit /hs savemap (nach /hs setspawn)"
|
SETUP_SAVEMAP: "&c&l- &fHide and Seek Weltkarte speichern mit /hs savemap (nach /hs setspawn)"
|
||||||
SETUP_COMPLETE: "Alles eingerichtet! Hide and Seek ist spielbereit."
|
SETUP_COMPLETE: "Alles eingerichtet! Hide and Seek ist spielbereit."
|
||||||
|
@ -73,6 +74,7 @@ Localization:
|
||||||
BLOCKED_COMMAND: "Command blocked by Kenshin's Hide And Seek"
|
BLOCKED_COMMAND: "Command blocked by Kenshin's Hide And Seek"
|
||||||
FLYING_ENABLED: "Fliegen aktiviert"
|
FLYING_ENABLED: "Fliegen aktiviert"
|
||||||
FLYING_DISABLED: "Fliegen deaktiviert"
|
FLYING_DISABLED: "Fliegen deaktiviert"
|
||||||
|
RESPAWN_NOTICE: "Du wirst in {AMOUNT} Sekunden respawnen."
|
||||||
|
|
||||||
# DO NOT EDIT IT OR IT MAY BREAK OR RESET FILE
|
# DO NOT EDIT IT OR IT MAY BREAK OR RESET FILE
|
||||||
version: 3
|
version: 3
|
||||||
|
|
|
@ -47,6 +47,7 @@ Localization:
|
||||||
SETUP: "&f&lThe following is needed for setup..."
|
SETUP: "&f&lThe following is needed for setup..."
|
||||||
SETUP_GAME: "&c&l- &fGame spawn isn't set, /hs setspawn"
|
SETUP_GAME: "&c&l- &fGame spawn isn't set, /hs setspawn"
|
||||||
SETUP_LOBBY: "&c&l- &fLobby spawn isn't set, /hs setlobby"
|
SETUP_LOBBY: "&c&l- &fLobby spawn isn't set, /hs setlobby"
|
||||||
|
SETUP_SEEKER_LOBBY: "&c&l- &fSeeker Lobby spawn isn't set, /hs setseekerlobby"
|
||||||
SETUP_EXIT: "&c&l- &fQuit/exit teleport location isn't set, /hs setexit"
|
SETUP_EXIT: "&c&l- &fQuit/exit teleport location isn't set, /hs setexit"
|
||||||
SETUP_SAVEMAP: "&c&l- &fHide and seek map isn't saved, /hs savemap (after /hs setspawn)"
|
SETUP_SAVEMAP: "&c&l- &fHide and seek map isn't saved, /hs savemap (after /hs setspawn)"
|
||||||
SETUP_BOUNDS: "&c&l- &fPlease set game bounds in 2 opposite corners of the game map, /hs setbounds"
|
SETUP_BOUNDS: "&c&l- &fPlease set game bounds in 2 opposite corners of the game map, /hs setbounds"
|
||||||
|
@ -74,6 +75,7 @@ Localization:
|
||||||
BLOCKED_COMMAND: "Command blocked by Hide And Seek plugin."
|
BLOCKED_COMMAND: "Command blocked by Hide And Seek plugin."
|
||||||
FLYING_ENABLED: "&l&bFlying Enabled"
|
FLYING_ENABLED: "&l&bFlying Enabled"
|
||||||
FLYING_DISABLED: "&l&bFlying Disabled"
|
FLYING_DISABLED: "&l&bFlying Disabled"
|
||||||
|
RESPAWN_NOTICE: "You will respawn in {AMOUNT} seconds."
|
||||||
|
|
||||||
# DO NOT EDIT IT OR IT MAY BREAK OR RESET FILE
|
# DO NOT EDIT IT OR IT MAY BREAK OR RESET FILE
|
||||||
version: 3
|
version: 3
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
name: KenshinsHideAndSeek
|
name: KenshinsHideAndSeek
|
||||||
main: net.tylermurphy.hideAndSeek.Main
|
main: net.tylermurphy.hideAndSeek.Main
|
||||||
version: 1.6.0
|
version: 1.6.1
|
||||||
author: KenshinEto
|
author: KenshinEto
|
||||||
load: STARTUP
|
load: STARTUP
|
||||||
api-version: 1.13
|
api-version: 1.13
|
||||||
|
@ -21,6 +21,7 @@ permissions:
|
||||||
hideandseek.setborder: true
|
hideandseek.setborder: true
|
||||||
hideandseek.setspawn: true
|
hideandseek.setspawn: true
|
||||||
hideandseek.setlobby: true
|
hideandseek.setlobby: true
|
||||||
|
hideandseek.setseekerlobby: true
|
||||||
hideandseek.setexit: true
|
hideandseek.setexit: true
|
||||||
hideadnseek.setbounds: true
|
hideadnseek.setbounds: true
|
||||||
hideandseek.setup: true
|
hideandseek.setup: true
|
||||||
|
@ -51,6 +52,9 @@ permissions:
|
||||||
hideandseek.setlobby:
|
hideandseek.setlobby:
|
||||||
description: Allows you to set the game lobby point
|
description: Allows you to set the game lobby point
|
||||||
default: op
|
default: op
|
||||||
|
hideandseek.setseekerlobby:
|
||||||
|
description: Allows you to set the game seeker lobby point
|
||||||
|
default: op
|
||||||
hideandseek.setexit:
|
hideandseek.setexit:
|
||||||
description: Allows you to set the game exit point
|
description: Allows you to set the game exit point
|
||||||
default: op
|
default: op
|
||||||
|
|
Loading…
Reference in a new issue