1
0
mirror of https://github.com/Zrips/Jobs.git synced 2024-11-29 05:55:27 +01:00

Prevent sign UI opening while interacting with Jobs signs in 1.20

This commit is contained in:
Zrips 2023-08-29 16:45:03 +03:00
parent 14b7e837d8
commit 5bb3414ea7
7 changed files with 63 additions and 20 deletions

Binary file not shown.

Binary file not shown.

32
pom.xml
View File

@ -1,7 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>Jobs</groupId>
<artifactId>jobs</artifactId>
@ -10,6 +8,8 @@
<url>http://maven.apache.org</url>
<properties>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
@ -17,9 +17,9 @@
<dependency>
<groupId>io.papermc.paper</groupId>
<artifactId>paper-api</artifactId>
<version>1.17.1-R0.1-SNAPSHOT</version>
<version>1.20.1-R0.1-SNAPSHOT</version>
<scope>provided</scope>
<exclusions>
<exclusions>
<exclusion>
<groupId>org.ow2.asm</groupId>
<artifactId>asm-commons</artifactId>
@ -80,12 +80,12 @@
<version>4.11.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>io.lumine</groupId>
<artifactId>Mythic-Dist</artifactId>
<version>5.1.0-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>io.lumine</groupId>
<artifactId>Mythic-Dist</artifactId>
<version>5.1.0-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<!-- WorldGuard old version -->
<dependency>
<groupId>com.sk89q</groupId>
@ -200,12 +200,13 @@
<systemPath>${basedir}/libs/CMILib1.4.0.0.jar</systemPath>
</dependency>
<!-- WildStacker -->
<dependency>
<groupId>com.bgsoftware</groupId>
<artifactId>WildStackerAPI</artifactId>
<version>latest</version>
<scope>system</scope>
<systemPath>${basedir}/libs/WildStackerAPI-latest.jar</systemPath>
<systemPath>${basedir}/libs/WildStackerAPI-2023.2.jar</systemPath>
</dependency>
<!-- StackMob -->
<dependency>
@ -275,20 +276,19 @@
<!-- Make a Jar -->
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.3.1</version>
<configuration>
<outputDirectory>D:\MC\Server 1.20\plugins\</outputDirectory>
<outputDirectory>D:\MC\Server 1.20\plugins\</outputDirectory>
</configuration>
</plugin>
</plugins>
</build>
</project>
</project>

View File

@ -97,6 +97,7 @@ import com.gamingmesh.jobs.listeners.JobsListener;
import com.gamingmesh.jobs.listeners.JobsPayment14Listener;
import com.gamingmesh.jobs.listeners.JobsPaymentListener;
import com.gamingmesh.jobs.listeners.PistonProtectionListener;
import com.gamingmesh.jobs.listeners.PlayerSignEdit1_20Listeners;
import com.gamingmesh.jobs.selection.SelectionManager;
import com.gamingmesh.jobs.stuff.Loging;
import com.gamingmesh.jobs.stuff.TabComplete;
@ -795,6 +796,9 @@ public final class Jobs extends JavaPlugin {
pm.registerEvents(new JobsPayment14Listener(), getInstance());
}
if (Version.isCurrentEqualOrHigher(Version.v1_20_R1)) {
pm.registerEvents(new PlayerSignEdit1_20Listeners(), getInstance());
}
if (getGCManager().useBlockProtection) {
pm.registerEvents(new PistonProtectionListener(), getInstance());
}

View File

@ -28,7 +28,7 @@ import java.util.Map;
import java.util.Set;
import java.util.TreeMap;
import org.apache.commons.lang.StringEscapeUtils;
import org.apache.commons.lang3.StringEscapeUtils;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration;

View File

@ -328,10 +328,10 @@ public class JobsListener implements Listener {
String line1 = CMIChatColor.stripColor(plugin.getComplement().getLine(event, 1));
if (CMIChatColor.stripColor(plugin.getComplement().getLine(event, 0))
.equalsIgnoreCase(CMIChatColor.stripColor(Jobs.getLanguage().getMessage("signs.topline"))) && !line1.equalsIgnoreCase("toplist"))
if (CMIChatColor.stripColor(plugin.getComplement().getLine(event, 0)).equalsIgnoreCase(CMIChatColor.stripColor(Jobs.getLanguage().getMessage("signs.topline"))) && !line1.equalsIgnoreCase(
"toplist")) {
event.setLine(0, convert(Jobs.getLanguage().getMessage("signs.topline")));
else
} else
return;
if (!event.getPlayer().hasPermission("jobs.command.signs")) {

View File

@ -0,0 +1,39 @@
package com.gamingmesh.jobs.listeners;
import java.util.HashSet;
import java.util.Set;
import java.util.UUID;
import org.bukkit.block.sign.SignSide;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerSignOpenEvent;
import org.bukkit.event.player.PlayerSignOpenEvent.Cause;
import com.gamingmesh.jobs.Jobs;
import net.Zrips.CMILib.Colors.CMIChatColor;
public class PlayerSignEdit1_20Listeners implements Listener {
public PlayerSignEdit1_20Listeners() {
}
Set<UUID> signEditCache = new HashSet<UUID>();
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
public void onPlayerSignOpenEvent(PlayerSignOpenEvent event) {
if (!event.getCause().equals(Cause.INTERACT))
return;
SignSide side = event.getSign().getSide(event.getSide());
if (!event.getPlayer().hasPermission("jobs.command.signs") && CMIChatColor.stripColor(side.getLine(0)).equalsIgnoreCase(CMIChatColor.stripColor(Jobs.getLanguage().getMessage("signs.topline")))) {
event.setCancelled(true);
}
}
}