Merge pull request #23 from tylermurphy534/1.4.1

1.4.1
This commit is contained in:
Tyler Murphy 2022-04-19 20:10:18 -04:00 committed by GitHub
commit bbcef0708a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
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> <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.4.0</version> <version>1.4.1</version>
<name>Hide and Seek Plugin</name> <name>Hide and Seek Plugin</name>
<properties> <properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
@ -26,7 +26,15 @@
<relocations> <relocations>
<relocation> <relocation>
<pattern>com.cryptomorin.xseries</pattern> <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> </relocation>
</relocations> </relocations>
<artifactSet> <artifactSet>
@ -42,6 +50,7 @@
<artifact>*:*</artifact> <artifact>*:*</artifact>
<excludes> <excludes>
<exclude>META-INF/*.MF</exclude> <exclude>META-INF/*.MF</exclude>
<exclude>META-INF</exclude>
<exclude>sqlite-jdbc.properties</exclude> <exclude>sqlite-jdbc.properties</exclude>
</excludes> </excludes>
</filter> </filter>
@ -51,6 +60,7 @@
<resource>META-INF/services/java.sql.Driver</resource> <resource>META-INF/services/java.sql.Driver</resource>
</transformer> </transformer>
</transformers> </transformers>
<minimizeJar>true</minimizeJar>
</configuration> </configuration>
<executions> <executions>
<execution> <execution>

View file

@ -26,7 +26,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(%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("%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

@ -19,11 +19,15 @@
package net.tylermurphy.hideAndSeek.configuration; package net.tylermurphy.hideAndSeek.configuration;
import com.cryptomorin.xseries.XMaterial;
import net.tylermurphy.hideAndSeek.util.Version; import net.tylermurphy.hideAndSeek.util.Version;
import org.bukkit.Material;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Optional;
public class Config { public class Config {
@ -84,6 +88,10 @@ public class Config {
seekerPingLevel2, seekerPingLevel2,
seekerPingLevel3; seekerPingLevel3;
public static List<String>
blockedCommands,
blockedInteracts;
public static String public static String
LOBBY_TITLE, LOBBY_TITLE,
GAME_TITLE, GAME_TITLE,
@ -102,9 +110,6 @@ public class Config {
LOBBY_CONTENTS, LOBBY_CONTENTS,
GAME_CONTENTS; GAME_CONTENTS;
public static List<String>
blockedCommands;
public static void loadConfig() { public static void loadConfig() {
config = new ConfigManager("config.yml"); config = new ConfigManager("config.yml");
@ -198,6 +203,17 @@ public class Config {
teleportToExit = config.getBoolean("teleportToExit"); teleportToExit = config.getBoolean("teleportToExit");
locale = config.getString("locale", "local"); locale = config.getString("locale", "local");
blockedCommands = config.getStringList("blockedCommands"); 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 //Leaderboard
LOBBY_TITLE = leaderboard.getString("lobby.title"); 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.EventHandler;
import org.bukkit.event.EventPriority; import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;
import org.bukkit.event.block.Action;
import org.bukkit.event.entity.*; import org.bukkit.event.entity.*;
import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason; import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason;
import org.bukkit.event.player.*; import org.bukkit.event.player.*;
@ -159,6 +160,7 @@ public class EventListener implements Listener {
} }
} }
} }
return;
} }
if (Game.status != Status.PLAYING) { if (Game.status != Status.PLAYING) {
event.setCancelled(true); event.setCancelled(true);
@ -169,17 +171,20 @@ public class EventListener implements Listener {
Entity damager = ((EntityDamageByEntityEvent) event).getDamager(); Entity damager = ((EntityDamageByEntityEvent) event).getDamager();
if (damager instanceof Player) { if (damager instanceof Player) {
attacker = (Player) damager; attacker = (Player) damager;
if (!Board.isPlayer(attacker)) event.setCancelled(true);
if (Board.onSameTeam(player, attacker)) event.setCancelled(true); if (Board.onSameTeam(player, attacker)) event.setCancelled(true);
if (Board.isSpectator(player)) event.setCancelled(true); if (Board.isSpectator(player)) event.setCancelled(true);
} else if(damager instanceof Arrow){ } else if(damager instanceof Arrow){
ProjectileSource source = ((Arrow) damager).getShooter(); ProjectileSource source = ((Arrow) damager).getShooter();
if(source instanceof Player){ if(source instanceof Player){
attacker = (Player) source; attacker = (Player) source;
if (!Board.isPlayer(attacker)) event.setCancelled(true);
if (Board.onSameTeam(player, attacker)) event.setCancelled(true); if (Board.onSameTeam(player, attacker)) event.setCancelled(true);
if (Board.isSpectator(player)) event.setCancelled(true); if (Board.isSpectator(player)) event.setCancelled(true);
} }
} }
} }
if(event.isCancelled()) return;
if (player.getHealth() - event.getFinalDamage() < 0.5 || !pvpEnabled) { if (player.getHealth() - event.getFinalDamage() < 0.5 || !pvpEnabled) {
if (spawnPosition == null) return; if (spawnPosition == null) return;
event.setCancelled(true); 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) # de-DE (German - Germany)
locale: "en-US" locale: "en-US"
# Block's commands being run by any user while playing the game. # Stop commands being run by any user while playing the game.
# Can be usefully If you aren't using a permission plugin and want # Can be usefull If you aren't using a permission plugin and want
# to op people, but still want to block certain commands. # to op people, but still want to block certain commands.
# Not really usefully if using permission plugins. # Not really usefully if using permission plugins.
# You can add /kill for any use, but it's already blocked on those # You can add /kill for any use, but it's already blocked on those
# playing the game. # playing the game.
blockedCommands: [msg, tp, gamemode, kill, give, effect] 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 # # ONLY EDIT BEYOND THIS POINT IF YOU KNOW WHAT YOU ARE DOING #
# ---------------------------------------------------------- # # ---------------------------------------------------------- #

View file

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