bug fixes
This commit is contained in:
parent
4d3c190a7e
commit
0ea494ec89
7 changed files with 15 additions and 12 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>dev.tylerm</groupId>
|
<groupId>dev.tylerm</groupId>
|
||||||
<artifactId>KenshinsHideAndSeek</artifactId>
|
<artifactId>KenshinsHideAndSeek</artifactId>
|
||||||
<version>1.7.5</version>
|
<version>1.7.6</version>
|
||||||
<name>Hide and Seek Plugin</name>
|
<name>Hide and Seek Plugin</name>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
|
|
|
@ -49,7 +49,7 @@ public class CommandGroup {
|
||||||
|
|
||||||
if (data == null) {
|
if (data == null) {
|
||||||
player.sendMessage(
|
player.sendMessage(
|
||||||
String.format("%s%sKenshin's Hide and Seek %s(%s1.7.5%s)\n", ChatColor.AQUA, ChatColor.BOLD, ChatColor.GRAY, ChatColor.WHITE, ChatColor.GRAY) +
|
String.format("%s%sKenshin's Hide and Seek %s(%s1.7.6%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)
|
||||||
);
|
);
|
||||||
|
|
|
@ -60,8 +60,6 @@ public class Game {
|
||||||
private int gameTimer;
|
private int gameTimer;
|
||||||
private boolean hiderLeft;
|
private boolean hiderLeft;
|
||||||
|
|
||||||
private Random random;
|
|
||||||
|
|
||||||
public Game(Map map, Board board) {
|
public Game(Map map, Board board) {
|
||||||
|
|
||||||
this.currentMap = map;
|
this.currentMap = map;
|
||||||
|
@ -78,8 +76,6 @@ public class Game {
|
||||||
this.startingTimer = -1;
|
this.startingTimer = -1;
|
||||||
this.gameTimer = 0;
|
this.gameTimer = 0;
|
||||||
this.hiderLeft = false;
|
this.hiderLeft = false;
|
||||||
|
|
||||||
this.random = new Random();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Status getStatus(){
|
public Status getStatus(){
|
||||||
|
@ -107,7 +103,7 @@ public class Game {
|
||||||
List<Player> pool = board.getPlayers();
|
List<Player> pool = board.getPlayers();
|
||||||
for (int i = 0; i < startingSeekerCount; i++) {
|
for (int i = 0; i < startingSeekerCount; i++) {
|
||||||
try {
|
try {
|
||||||
int rand = random.nextInt(0, pool.size());
|
int rand = (int)(Math.random() * pool.size());
|
||||||
seekers.add(pool.remove(rand));
|
seekers.add(pool.remove(rand));
|
||||||
} catch (Exception e){
|
} catch (Exception e){
|
||||||
Main.getInstance().getLogger().warning("Failed to select random seeker.");
|
Main.getInstance().getLogger().warning("Failed to select random seeker.");
|
||||||
|
|
|
@ -8,7 +8,6 @@ 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.comphenix.protocol.wrappers.EnumWrappers;
|
import com.comphenix.protocol.wrappers.EnumWrappers;
|
||||||
import com.comphenix.protocol.wrappers.EnumWrappers.EntityUseAction;
|
|
||||||
import dev.tylerm.khs.Main;
|
import dev.tylerm.khs.Main;
|
||||||
import dev.tylerm.khs.game.util.Disguise;
|
import dev.tylerm.khs.game.util.Disguise;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
|
@ -51,15 +50,19 @@ public class DisguiseHandler implements Listener {
|
||||||
PacketContainer packet = event.getPacket();
|
PacketContainer packet = event.getPacket();
|
||||||
|
|
||||||
// only left click attacks
|
// only left click attacks
|
||||||
EntityUseAction action = packet.getEntityUseActions().getValues().stream().findFirst().orElse(null);
|
EnumWrappers.EntityUseAction action = packet.getEntityUseActions().getValues().stream().findFirst().orElse(null);
|
||||||
if (action == null) return;
|
if (action == null) return;
|
||||||
if (action != EnumWrappers.EntityUseAction.ATTACK) return;
|
//noinspection ComparatorResultComparison
|
||||||
|
if (action.compareTo(EnumWrappers.EntityUseAction.INTERACT) == 2) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
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);
|
||||||
if(disguise == null) return;
|
if(disguise == null) return;
|
||||||
|
|
||||||
if(disguise.getPlayer().getGameMode() == GameMode.CREATIVE) return;
|
if(disguise.getPlayer().getGameMode() == GameMode.CREATIVE) return;
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
handleAttack(disguise, player);
|
handleAttack(disguise, player);
|
||||||
|
@ -82,7 +85,9 @@ public class DisguiseHandler implements Listener {
|
||||||
|
|
||||||
disguise.setSolidify(false);
|
disguise.setSolidify(false);
|
||||||
if(debounce.contains(disguise.getPlayer())) return;
|
if(debounce.contains(disguise.getPlayer())) return;
|
||||||
|
|
||||||
debounce.add(disguise.getPlayer());
|
debounce.add(disguise.getPlayer());
|
||||||
|
|
||||||
Bukkit.getScheduler().scheduleSyncDelayedTask(Main.getInstance(), () -> {
|
Bukkit.getScheduler().scheduleSyncDelayedTask(Main.getInstance(), () -> {
|
||||||
EntityDamageByEntityEvent event =
|
EntityDamageByEntityEvent event =
|
||||||
new EntityDamageByEntityEvent(seeker, disguise.getPlayer(), EntityDamageEvent.DamageCause.ENTITY_ATTACK, amount);
|
new EntityDamageByEntityEvent(seeker, disguise.getPlayer(), EntityDamageEvent.DamageCause.ENTITY_ATTACK, amount);
|
||||||
|
|
|
@ -39,6 +39,7 @@ public class InventoryHandler implements Listener {
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGHEST)
|
@EventHandler(priority = EventPriority.HIGHEST)
|
||||||
public void onInventoryClick(InventoryClickEvent event) {
|
public void onInventoryClick(InventoryClickEvent event) {
|
||||||
|
if (event.getCurrentItem() == null) return;
|
||||||
if (!(event.getWhoClicked() instanceof Player)) return;
|
if (!(event.getWhoClicked() instanceof Player)) return;
|
||||||
checkForInventoryMove(event);
|
checkForInventoryMove(event);
|
||||||
checkForSpectatorTeleportMenu(event);
|
checkForSpectatorTeleportMenu(event);
|
||||||
|
@ -56,6 +57,7 @@ public class InventoryHandler implements Listener {
|
||||||
Player player = (Player) event.getWhoClicked();
|
Player player = (Player) event.getWhoClicked();
|
||||||
|
|
||||||
ItemStack item = event.getCurrentItem();
|
ItemStack item = event.getCurrentItem();
|
||||||
|
|
||||||
ItemMeta meta = item.getItemMeta();
|
ItemMeta meta = item.getItemMeta();
|
||||||
String name = meta.getDisplayName();
|
String name = meta.getDisplayName();
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,7 @@ public class PAPIExpansion extends PlaceholderExpansion {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @NotNull String getVersion() {
|
public @NotNull String getVersion() {
|
||||||
return "1.7.5";
|
return "1.7.6";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
name: KenshinsHideAndSeek
|
name: KenshinsHideAndSeek
|
||||||
main: dev.tylerm.khs.Main
|
main: dev.tylerm.khs.Main
|
||||||
version: 1.7.5
|
version: 1.7.6
|
||||||
author: KenshinEto
|
author: KenshinEto
|
||||||
load: STARTUP
|
load: STARTUP
|
||||||
api-version: 1.13
|
api-version: 1.13
|
||||||
|
|
Loading…
Reference in a new issue