1
0
mirror of https://github.com/Zrips/Jobs.git synced 2024-11-25 20:16:13 +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"?> <?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" <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">
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> <modelVersion>4.0.0</modelVersion>
<groupId>Jobs</groupId> <groupId>Jobs</groupId>
<artifactId>jobs</artifactId> <artifactId>jobs</artifactId>
@ -10,6 +8,8 @@
<url>http://maven.apache.org</url> <url>http://maven.apache.org</url>
<properties> <properties>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties> </properties>
@ -17,9 +17,9 @@
<dependency> <dependency>
<groupId>io.papermc.paper</groupId> <groupId>io.papermc.paper</groupId>
<artifactId>paper-api</artifactId> <artifactId>paper-api</artifactId>
<version>1.17.1-R0.1-SNAPSHOT</version> <version>1.20.1-R0.1-SNAPSHOT</version>
<scope>provided</scope> <scope>provided</scope>
<exclusions> <exclusions>
<exclusion> <exclusion>
<groupId>org.ow2.asm</groupId> <groupId>org.ow2.asm</groupId>
<artifactId>asm-commons</artifactId> <artifactId>asm-commons</artifactId>
@ -80,12 +80,12 @@
<version>4.11.0</version> <version>4.11.0</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>io.lumine</groupId> <groupId>io.lumine</groupId>
<artifactId>Mythic-Dist</artifactId> <artifactId>Mythic-Dist</artifactId>
<version>5.1.0-SNAPSHOT</version> <version>5.1.0-SNAPSHOT</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<!-- WorldGuard old version --> <!-- WorldGuard old version -->
<dependency> <dependency>
<groupId>com.sk89q</groupId> <groupId>com.sk89q</groupId>
@ -200,12 +200,13 @@
<systemPath>${basedir}/libs/CMILib1.4.0.0.jar</systemPath> <systemPath>${basedir}/libs/CMILib1.4.0.0.jar</systemPath>
</dependency> </dependency>
<!-- WildStacker --> <!-- WildStacker -->
<dependency> <dependency>
<groupId>com.bgsoftware</groupId> <groupId>com.bgsoftware</groupId>
<artifactId>WildStackerAPI</artifactId> <artifactId>WildStackerAPI</artifactId>
<version>latest</version> <version>latest</version>
<scope>system</scope> <scope>system</scope>
<systemPath>${basedir}/libs/WildStackerAPI-latest.jar</systemPath> <systemPath>${basedir}/libs/WildStackerAPI-2023.2.jar</systemPath>
</dependency> </dependency>
<!-- StackMob --> <!-- StackMob -->
<dependency> <dependency>
@ -275,20 +276,19 @@
<!-- Make a Jar --> <!-- Make a Jar -->
<plugin> <plugin>
<artifactId>maven-compiler-plugin</artifactId> <artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration> <configuration>
<source>1.8</source> <source>1.8</source>
<target>1.8</target> <target>1.8</target>
</configuration> </configuration>
</plugin> </plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId> <artifactId>maven-jar-plugin</artifactId>
<version>2.3.1</version> <version>2.3.1</version>
<configuration> <configuration>
<outputDirectory>D:\MC\Server 1.20\plugins\</outputDirectory> <outputDirectory>D:\MC\Server 1.20\plugins\</outputDirectory>
</configuration> </configuration>
</plugin> </plugin>
</plugins> </plugins>
</build> </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.JobsPayment14Listener;
import com.gamingmesh.jobs.listeners.JobsPaymentListener; import com.gamingmesh.jobs.listeners.JobsPaymentListener;
import com.gamingmesh.jobs.listeners.PistonProtectionListener; import com.gamingmesh.jobs.listeners.PistonProtectionListener;
import com.gamingmesh.jobs.listeners.PlayerSignEdit1_20Listeners;
import com.gamingmesh.jobs.selection.SelectionManager; import com.gamingmesh.jobs.selection.SelectionManager;
import com.gamingmesh.jobs.stuff.Loging; import com.gamingmesh.jobs.stuff.Loging;
import com.gamingmesh.jobs.stuff.TabComplete; import com.gamingmesh.jobs.stuff.TabComplete;
@ -795,6 +796,9 @@ public final class Jobs extends JavaPlugin {
pm.registerEvents(new JobsPayment14Listener(), getInstance()); pm.registerEvents(new JobsPayment14Listener(), getInstance());
} }
if (Version.isCurrentEqualOrHigher(Version.v1_20_R1)) {
pm.registerEvents(new PlayerSignEdit1_20Listeners(), getInstance());
}
if (getGCManager().useBlockProtection) { if (getGCManager().useBlockProtection) {
pm.registerEvents(new PistonProtectionListener(), getInstance()); pm.registerEvents(new PistonProtectionListener(), getInstance());
} }

View File

@ -28,7 +28,7 @@ import java.util.Map;
import java.util.Set; import java.util.Set;
import java.util.TreeMap; 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.ConfigurationSection;
import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration; 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)); String line1 = CMIChatColor.stripColor(plugin.getComplement().getLine(event, 1));
if (CMIChatColor.stripColor(plugin.getComplement().getLine(event, 0)) if (CMIChatColor.stripColor(plugin.getComplement().getLine(event, 0)).equalsIgnoreCase(CMIChatColor.stripColor(Jobs.getLanguage().getMessage("signs.topline"))) && !line1.equalsIgnoreCase(
.equalsIgnoreCase(CMIChatColor.stripColor(Jobs.getLanguage().getMessage("signs.topline"))) && !line1.equalsIgnoreCase("toplist")) "toplist")) {
event.setLine(0, convert(Jobs.getLanguage().getMessage("signs.topline"))); event.setLine(0, convert(Jobs.getLanguage().getMessage("signs.topline")));
else } else
return; return;
if (!event.getPlayer().hasPermission("jobs.command.signs")) { 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);
}
}
}