This commit is contained in:
Tyler Murphy 2022-04-19 20:00:53 -04:00
parent 2746ac923b
commit 4278cf4472
6 changed files with 56 additions and 9 deletions

14
pom.xml
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>
<groupId>net.tylermurphy</groupId>
<artifactId>HideAndSeek</artifactId>
<version>1.4.0</version>
<version>1.4.1</version>
<name>Hide and Seek Plugin</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
@ -26,7 +26,15 @@
<relocations>
<relocation>
<pattern>com.cryptomorin.xseries</pattern>
<shadedPattern>net.tylermurphy.xseries</shadedPattern>
<shadedPattern>net.tylermurphy.dependencies.xseries</shadedPattern>
</relocation>
<relocation>
<pattern>org.sqlite</pattern>
<shadedPattern>net.tylermurphy.dependencies.sqlite</shadedPattern>
</relocation>
<relocation>
<pattern>org.ibex</pattern>
<shadedPattern>net.tylermurphy.dependencies.ibex</shadedPattern>
</relocation>
</relocations>
<artifactSet>
@ -42,6 +50,7 @@
<artifact>*:*</artifact>
<excludes>
<exclude>META-INF/*.MF</exclude>
<exclude>META-INF</exclude>
<exclude>sqlite-jdbc.properties</exclude>
</excludes>
</filter>
@ -51,6 +60,7 @@
<resource>META-INF/services/java.sql.Driver</resource>
</transformer>
</transformers>
<minimizeJar>true</minimizeJar>
</configuration>
<executions>
<execution>

View file

@ -26,7 +26,7 @@ public class About implements ICommand {
public void execute(CommandSender sender, String[] args) {
sender.sendMessage(
String.format("%s%sHide and Seek %s(%s1.4.0%s)\n", ChatColor.AQUA, ChatColor.BOLD, ChatColor.GRAY,ChatColor.WHITE,ChatColor.GRAY) +
String.format("%s%sHide and Seek %s(%s1.4.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("%sHelp Command: %s/hs %shelp", ChatColor.GRAY, ChatColor.AQUA, ChatColor.WHITE)
);

View file

@ -19,11 +19,15 @@
package net.tylermurphy.hideAndSeek.configuration;
import com.cryptomorin.xseries.XMaterial;
import net.tylermurphy.hideAndSeek.util.Version;
import org.bukkit.Material;
import org.bukkit.util.Vector;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Optional;
public class Config {
@ -84,6 +88,10 @@ public class Config {
seekerPingLevel2,
seekerPingLevel3;
public static List<String>
blockedCommands,
blockedInteracts;
public static String
LOBBY_TITLE,
GAME_TITLE,
@ -101,9 +109,6 @@ public class Config {
public static List<String>
LOBBY_CONTENTS,
GAME_CONTENTS;
public static List<String>
blockedCommands;
public static void loadConfig() {
@ -198,6 +203,17 @@ public class Config {
teleportToExit = config.getBoolean("teleportToExit");
locale = config.getString("locale", "local");
blockedCommands = config.getStringList("blockedCommands");
blockedInteracts = new ArrayList<>();
List<String> tempInteracts = config.getStringList("blockedInteracts");
for(String id : tempInteracts){
Optional<XMaterial> optional_mat = XMaterial.matchXMaterial(id);
if(optional_mat.isPresent()){
Material mat = optional_mat.get().parseMaterial();
if(mat != null){
blockedInteracts.add(mat.name());
}
}
}
//Leaderboard
LOBBY_TITLE = leaderboard.getString("lobby.title");

View file

@ -36,6 +36,7 @@ import org.bukkit.entity.Snowball;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.block.Action;
import org.bukkit.event.entity.*;
import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason;
import org.bukkit.event.player.*;
@ -159,6 +160,7 @@ public class EventListener implements Listener {
}
}
}
return;
}
if (Game.status != Status.PLAYING) {
event.setCancelled(true);
@ -169,17 +171,20 @@ public class EventListener implements Listener {
Entity damager = ((EntityDamageByEntityEvent) event).getDamager();
if (damager instanceof Player) {
attacker = (Player) damager;
if (!Board.isPlayer(attacker)) event.setCancelled(true);
if (Board.onSameTeam(player, attacker)) event.setCancelled(true);
if (Board.isSpectator(player)) event.setCancelled(true);
} else if(damager instanceof Arrow){
ProjectileSource source = ((Arrow) damager).getShooter();
if(source instanceof Player){
attacker = (Player) source;
if (!Board.isPlayer(attacker)) event.setCancelled(true);
if (Board.onSameTeam(player, attacker)) event.setCancelled(true);
if (Board.isSpectator(player)) event.setCancelled(true);
}
}
}
if(event.isCancelled()) return;
if (player.getHealth() - event.getFinalDamage() < 0.5 || !pvpEnabled) {
if (spawnPosition == null) return;
event.setCancelled(true);
@ -269,4 +274,13 @@ public class EventListener implements Listener {
}
}
}
@EventHandler(priority = EventPriority.HIGHEST)
public void onPlayerInteract(PlayerInteractEvent event) {
if (event.getAction() == Action.RIGHT_CLICK_BLOCK) {
if(Board.isPlayer(event.getPlayer()) && blockedInteracts.contains(event.getClickedBlock().getType().name())){
event.setCancelled(true);
}
}
}
}

View file

@ -114,14 +114,21 @@ seekerPing:
# de-DE (German - Germany)
locale: "en-US"
# Block's commands being run by any user while playing the game.
# Can be usefully If you aren't using a permission plugin and want
# Stop commands being run by any user while playing the game.
# Can be usefull If you aren't using a permission plugin and want
# to op people, but still want to block certain commands.
# Not really usefully if using permission plugins.
# You can add /kill for any use, but it's already blocked on those
# playing the game.
blockedCommands: [msg, tp, gamemode, kill, give, effect]
# Stop interactions with any block by any user while playing the game.
# If your map has things such as chests for aesthetic only, you can
# block the use of clicking them. It shouldn't matter what version of
# the block ID you enter, as the plugin will automatically switch to the
# block ID of your current Minecraft server version.
blockedInteracts: [FURNACE, CRAFTING_TABLE, ANVIL, CHEST, BARREL]
# ---------------------------------------------------------- #
# ONLY EDIT BEYOND THIS POINT IF YOU KNOW WHAT YOU ARE DOING #
# ---------------------------------------------------------- #

View file

@ -1,6 +1,6 @@
name: HideAndSeek
main: net.tylermurphy.hideAndSeek.Main
version: 1.4.0
version: 1.4.1
author: KenshinEto
load: STARTUP
api-version: 1.13