1.3.3 beta 1

This commit is contained in:
Tyler Murphy 2021-12-24 22:40:21 -05:00
parent e6f86145cf
commit 06b31297d3
7 changed files with 43 additions and 18 deletions

View file

@ -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.3.2</version> <version>1.3.3</version>
<name>Hide and Seek Plugin</name> <name>Hide and Seek Plugin</name>
<build> <build>
<plugins> <plugins>

View file

@ -41,7 +41,7 @@ public class CommandHandler {
} }
public static boolean handleCommand(CommandSender sender, Command cmd, String label, String[] args) { public static boolean handleCommand(CommandSender sender, Command cmd, String label, String[] args) {
if(sender instanceof Player == false) { if(!(sender instanceof Player)) {
sender.sendMessage(errorPrefix + message("COMMAND_PLAYER_ONLY")); sender.sendMessage(errorPrefix + message("COMMAND_PLAYER_ONLY"));
} else if(args.length < 1 || !COMMAND_REGISTER.containsKey(args[0].toLowerCase()) ) { } else if(args.length < 1 || !COMMAND_REGISTER.containsKey(args[0].toLowerCase()) ) {
if(permissionsRequired && !sender.hasPermission("hideandseek.about")) { if(permissionsRequired && !sender.hasPermission("hideandseek.about")) {
@ -50,7 +50,7 @@ public class CommandHandler {
COMMAND_REGISTER.get("about").execute(sender, null); COMMAND_REGISTER.get("about").execute(sender, null);
} }
} else { } else {
if(!args[0].toLowerCase().equals("about") && !args[0].toLowerCase().equals("help") && SaveMap.runningBackup) { if(!args[0].equalsIgnoreCase("about") && !args[0].equalsIgnoreCase("help") && SaveMap.runningBackup) {
sender.sendMessage(errorPrefix + message("MAPSAVE_INPROGRESS")); sender.sendMessage(errorPrefix + message("MAPSAVE_INPROGRESS"));
} else if(permissionsRequired && !sender.hasPermission("hideandseek."+args[0].toLowerCase())) { } else if(permissionsRequired && !sender.hasPermission("hideandseek."+args[0].toLowerCase())) {
sender.sendMessage(errorPrefix + message("COMMAND_NOT_ALLOWED")); sender.sendMessage(errorPrefix + message("COMMAND_NOT_ALLOWED"));
@ -66,8 +66,4 @@ public class CommandHandler {
return true; return true;
} }
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
return CommandHandler.handleCommand(sender, command, label, args);
}
} }

View file

@ -3,11 +3,7 @@ package net.tylermurphy.hideAndSeek.bukkit;
import static net.tylermurphy.hideAndSeek.configuration.Config.*; import static net.tylermurphy.hideAndSeek.configuration.Config.*;
import net.tylermurphy.hideAndSeek.command.Join; import net.tylermurphy.hideAndSeek.command.Join;
import org.bukkit.Bukkit; import org.bukkit.*;
import org.bukkit.GameMode;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.attribute.Attribute; import org.bukkit.attribute.Attribute;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -21,9 +17,7 @@ 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.FoodLevelChangeEvent;
import org.bukkit.event.entity.ProjectileLaunchEvent; import org.bukkit.event.entity.ProjectileLaunchEvent;
import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.*;
import org.bukkit.event.player.PlayerKickEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import net.tylermurphy.hideAndSeek.util.Packet; import net.tylermurphy.hideAndSeek.util.Packet;
import net.tylermurphy.hideAndSeek.util.Util; import net.tylermurphy.hideAndSeek.util.Util;
@ -36,8 +30,8 @@ public class EventListener implements Listener {
@EventHandler @EventHandler
public void onPlayerJoin(PlayerJoinEvent event) { public void onPlayerJoin(PlayerJoinEvent event) {
event.getPlayer().setLevel(0);
Main.plugin.board.remove(event.getPlayer()); Main.plugin.board.remove(event.getPlayer());
Util.removeItems(event.getPlayer());
if(!Util.isSetup()) return; if(!Util.isSetup()) return;
if(autoJoin){ if(autoJoin){
Join.join(event.getPlayer()); Join.join(event.getPlayer());
@ -65,6 +59,7 @@ public class EventListener implements Listener {
for(PotionEffect effect : event.getPlayer().getActivePotionEffects()){ for(PotionEffect effect : event.getPlayer().getActivePotionEffects()){
event.getPlayer().removePotionEffect(effect.getType()); event.getPlayer().removePotionEffect(effect.getType());
} }
Util.removeItems(event.getPlayer());
} }
@EventHandler @EventHandler
@ -78,6 +73,25 @@ public class EventListener implements Listener {
for(PotionEffect effect : event.getPlayer().getActivePotionEffects()){ for(PotionEffect effect : event.getPlayer().getActivePotionEffects()){
event.getPlayer().removePotionEffect(effect.getType()); event.getPlayer().removePotionEffect(effect.getType());
} }
Util.removeItems(event.getPlayer());
}
@EventHandler
public void onChat(AsyncPlayerChatEvent event){
if(Main.plugin.board.isSeeker(event.getPlayer())){
event.setCancelled(true);
Main.plugin.board.getSpectators().forEach(spectator -> spectator.sendMessage(ChatColor.GRAY + "[SPECTATOR] " + event.getPlayer().getName() + ": " + event.getMessage()));
}
}
@EventHandler
public void onMove(PlayerMoveEvent event){
if(!event.getPlayer().getWorld().equals("hideandseek_" + spawnWorld)) return;
if(event.getPlayer().hasPermission("hideandseek.leavebounds")) return;
if(!event.getTo().getWorld().getName().equals("hideandseek_" + spawnWorld)) return;
if(event.getTo().getBlockX() < saveMinX || event.getTo().getBlockX() > saveMinX || event.getTo().getBlockZ() < saveMinZ || event.getTo().getBlockZ() > saveMaxZ){
event.setCancelled(true);
}
} }
@EventHandler(priority = EventPriority.HIGHEST) @EventHandler(priority = EventPriority.HIGHEST)

View file

@ -7,7 +7,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.3.2%s)\n", ChatColor.AQUA, ChatColor.BOLD, ChatColor.GRAY,ChatColor.WHITE,ChatColor.GRAY) + String.format("%s%sHide and Seek %s(1.3.3%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)
); );

View file

@ -78,6 +78,7 @@ public class Items {
if(material == Material.POTION || material == Material.SPLASH_POTION || material == Material.LINGERING_POTION){ if(material == Material.POTION || material == Material.SPLASH_POTION || material == Material.LINGERING_POTION){
PotionMeta meta = getPotionMeta(stack, item); PotionMeta meta = getPotionMeta(stack, item);
stack.setItemMeta(meta); stack.setItemMeta(meta);
} else { } else {
ConfigurationSection enchantments = item.getConfigurationSection("enchantments"); ConfigurationSection enchantments = item.getConfigurationSection("enchantments");
if (enchantments != null) if (enchantments != null)

View file

@ -4,6 +4,7 @@ import static net.tylermurphy.hideAndSeek.configuration.Config.*;
import java.io.*; import java.io.*;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.List; import java.util.List;
import net.md_5.bungee.api.ChatColor; import net.md_5.bungee.api.ChatColor;
@ -82,4 +83,13 @@ public class Util {
} }
} }
} }
public static void removeItems(Player player){
for(ItemStack si : Items.SEEKER_ITEMS)
for(ItemStack i : player.getInventory().getContents())
if(si.isSimilar(i)) player.getInventory().remove(i);
for(ItemStack hi : Items.HIDER_ITEMS)
for(ItemStack i : player.getInventory().getContents())
if(hi.isSimilar(i)) player.getInventory().remove(i);
}
} }

View file

@ -1,6 +1,6 @@
name: HideAndSeek name: HideAndSeek
main: net.tylermurphy.hideAndSeek.Main main: net.tylermurphy.hideAndSeek.Main
version: 1.3.2 version: 1.3.3
author: KenshinEto author: KenshinEto
load: STARTUP load: STARTUP
api-version: 1.14 api-version: 1.14
@ -28,6 +28,7 @@ permissions:
hideandseek.savemap: true hideandseek.savemap: true
hideandseek.join: true hideandseek.join: true
hideandseek.leave: true hideandseek.leave: true
hideandseek.leavebounds: true
hideandseek.about: hideandseek.about:
description: Allows you to run the about command description: Allows you to run the about command
default: true default: true
@ -70,3 +71,6 @@ permissions:
hideandseek.leave: hideandseek.leave:
description: Allows you to leave the game manual lobby description: Allows you to leave the game manual lobby
default: true default: true
hideandseek.leavebounds:
description: Allows players to leave specified game bounderies
default: op