Compare commits

4 Commits
2.0 ... main

4 changed files with 100 additions and 113 deletions

View File

@@ -16,6 +16,7 @@ import net.md_5.bungee.api.chat.TextComponent;
import net.md_5.bungee.api.chat.hover.content.Text;
public class CheckList {
private static final CheckList ourInstance = new CheckList();
public static CheckList getInstance() {
@@ -31,31 +32,34 @@ public class CheckList {
if (args.length > 1) {
page = Integer.parseInt(args[1]);
if (page == -1) {
sender.sendMessage("§2TPS is " + CheckTPS.isTpsOK() + " §4TPS:" + CheckTPS.getTPS()
+ " §emin" + Main.getInstance().getConfig().getInt("checkTPS.minimumTPS")
+ " §amax" + Main.getInstance().getConfig().getInt("checkTPS.maximumTPS"));
sender.sendMessage("§2TPS is " + CheckTPS.isTpsOK() + " §4TPS:" + CheckTPS.getTPS()
+ " §emin" + Main.getInstance().getConfig().getInt("checkTPS.minimumTPS")
+ " §amax" + Main.getInstance().getConfig().getInt("checkTPS.maximumTPS"));
return;
}
}
Collection<Location> allLocation = RedstoneClockController.getAllLoc();
int totalPage = (int) Math.ceil(allLocation.size() / 5.0);
sender.sendMessage(Msg.RED_STONE_CLOCK_LIST_HEADER.toString().replace("$page",
"(" + page + "/" + totalPage + ")"));
int i = 1;
int minElements = 5 * (page - 1);
int maxElements = 5 * page;
String teleportCMD = Main.getInstance().getConfig().getString("teleportCMD", "tp $x $y $z");
String teleportCMD = Main.getInstance().getConfig().getString("teleportCMD", "teleport $x $y $z");
int maxPulses = Main.getInstance().getConfig().getInt("MaxPulses");
for (Location loc : allLocation) {
if (i > minElements && i <= maxElements) {
int clock = RedstoneClockController.getRedstoneClock(loc).getNumberOfClock();
String color = "§2"; //Dark_Green
String color = "§2"; // Dark_Green
if (clock > maxPulses * 0.75) {
color = "§4"; //Dark_Red
color = "§4"; // Dark_Red
} else if (clock > maxPulses * 0.5) {
color = "§e"; //yellow
color = "§e"; // yellow
} else if (clock > maxPulses * 0.250) {
color = "§a"; // green
color = "§a"; // green
}
TextComponent textComponent = new TextComponent(color + "RedStoneClock> §fWorld:" + loc.getWorld().getName()
+ ",X:" + loc.getX()
@@ -63,16 +67,16 @@ public class CheckList {
+ ",Z:" + loc.getZ()
+ " b:" + clock + "/" + maxPulses);
textComponent.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/" + teleportCMD
.replace("$x", String.format("%.0f", loc.getX()))
.replace("$y", String.format("%.0f", loc.getY()))
.replace("$z", String.format("%.0f", loc.getZ()))
.replace("$world", loc.getWorld().getName())
.replace("$player", sender.getName())));
.replace("$x", String.format("%.0f", loc.getX()))
.replace("$y", String.format("%.0f", loc.getY()))
.replace("$z", String.format("%.0f", loc.getZ()))
.replace("$world", loc.getWorld().getName())
.replace("$player", sender.getName())));
textComponent.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT,
new Text("Click to teleport you to the redstoneclock")));
sendFormatedMessageToPlayer(sender, textComponent);
}
i++;
i++;
}
sender.sendMessage(Msg.RED_STONE_CLOCK_LIST_FOOTER.toString());
} catch (NumberFormatException e) {

View File

@@ -70,18 +70,16 @@ class Util {
for (Player p : Bukkit.getOnlinePlayers()) {
if (p.isOp() || p.hasPermission("antiRedstoneClock.NotifyAdmin")) {
TextComponent textComponent = getFormatedStringForMsgToAdmin(block);
String teleportCMD = Main.getInstance().getConfig().getString("teleportCMD", "tp $x $y $z");
String teleportCMD = Main.getInstance().getConfig().getString("teleportCMD", "teleport $x $y $z");
textComponent.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/" + teleportCMD
.replace("$x", Integer.toString(block.getX()))
.replace("$y", Integer.toString(block.getY()))
.replace("$z", Integer.toString(block.getZ()))
.replace("$world", block.getWorld().getName())
.replace("$player", p.getName())));
.replace("$world", block.getWorld().getName())));
sendFormatedMessageToPlayer(p, textComponent);
}
}
}
}
}
@@ -125,9 +123,9 @@ class Util {
sign.setLine(3, Main.getInstance().getConfig().getString("Sign.Line4").replace("&", "§"));
sign.update(false, false);
} catch (ClassCastException error) {
Bukkit.getLogger().warning(Msg.PREFIX + "No valid sign found for this minecraft version!!!"
+"\nplease disable CreateSignWhenClockIsBreak in config file"
+"\nMore infos: " + block.getType());
Bukkit.getLogger().warning(Msg.PREFIX + "Kein gültiges Schild für diese Minecraft-Version gefunden!!!"
+ "\nBitte deaktivieren Sie CreateSignWhenClockIsBreak in der Config-Datei"
+ "\nMehr Infos: " + block.getType());
}
block.getDrops().clear();
}
@@ -139,7 +137,7 @@ class Util {
.replace("$Z", block.getZ() + "")
.replace("$World", block.getWorld().getName()));
textComponent.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT,
new Text("Click to teleport you to the redstoneclock")));
new Text("Klicke, um dich zur RedstoneClock zu teleportieren")));
return textComponent;
}

View File

@@ -45,10 +45,6 @@ Wenn du Unterstützung für ältere Versionen brauchst, teile mir bitte deine Ve
## Beispiel für die config.yml
(Enthält Einstellungen zur Anpassung der Clock-Erkennung, Notifications, Teleport-Befehle etc.)
## Unterstützung für Observer und Comparator mit Spigot 1.12.2
[Hier auf GitLab](https://gitlab.com/Trafalcraft/antiRedstoneClock/-/tree/master/MAIN/nms-patches/1.12.2)
Alternativ kannst du die 1.12.2er Paper-Version ab Build 1593 oder neuer nutzen: [https://papermc.io/legacy](https://papermc.io/legacy)
## Wie checkTPS funktioniert
Es prüft 3 Fälle:

163
pom.xml
View File

@@ -1,97 +1,86 @@
<?xml version="1.0" encoding="UTF-8"?>
<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
http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
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>com.trafalcraft.antiRedstoneClock</groupId>
<artifactId>AntiRedstoneClock-Reborn</artifactId>
<version>2.0</version>
<packaging>pom</packaging>
<name>AntiRedstoneClock</name>
<url>https://www.spigotmc.org/resources/antiredstoneclock.18557</url>
<parent>
<groupId>com.trafalcraft.antiRedstoneClock</groupId>
<artifactId>AntiRedstoneClock-Reborn</artifactId>
<version>2.0</version>
</parent>
<packaging>jar</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<module.info>-parent</module.info>
<spigot.version>1.21.4-R0.1-SNAPSHOT</spigot.version>
</properties>
<artifactId>MAIN</artifactId>
<modules>
<module>MAIN</module>
<module>DIST</module>
</modules>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<module.info>-IGNORE</module.info>
</properties>
<repositories>
<repository>
<id>central</id>
<url>https://repo.maven.apache.org/maven2</url>
</repository>
<repository>
<id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
<repository>
<id>CodeMC</id>
<url>https://repo.codemc.org/repository/maven-public</url>
</repository>
<repository>
<id>sk89q-repo</id>
<url>https://maven.enginehub.org/repo/</url>
</repository>
<repository>
<id>plotsquared</id>
<url>https://repo1.maven.org/maven2/</url>
</repository>
</repositories>
<repositories>
<repository>
<id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
<repository>
<id>CodeMC</id>
<url>https://repo.codemc.org/repository/maven-public</url>
</repository>
<repository>
<id>sk89q-repo</id>
<url>https://maven.enginehub.org/repo/</url>
</repository>
<repository>
<id>plotsquared</id>
<url>https://plotsquared.com/mvn/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>${spigot.version}</version>
<scope>provided</scope>
</dependency>
<dependencies>
<dependency>
<groupId>org.bstats</groupId>
<artifactId>bstats-bukkit</artifactId>
<version>3.0.2</version>
<scope>compile</scope>
</dependency>
</dependencies>
<dependency>
<groupId>com.sk89q.worldguard</groupId>
<artifactId>worldguard-bukkit</artifactId>
<version>7.0.14</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.intellectualsites.plotsquared</groupId>
<artifactId>plotsquared-bukkit</artifactId>
<version>7.5.6</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>net.kyori</groupId>
<artifactId>adventure-platform-bukkit</artifactId>
<version>4.4.1</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<defaultGoal>clean install</defaultGoal>
<finalName>${project.parent.artifactId}${module.info}</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>17</source>
<target>17</target>
</configuration>
</plugin>
</plugins>
</build>
<build>
<sourceDirectory>${project.basedir}/src/main/java</sourceDirectory>
<resources>
<resource>
<directory>${project.basedir}/src/main/resources</directory>
<includes>
<include>plugin.yml</include>
<include>config.yml</include>
</includes>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.6.0</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<relocations>
<relocation>
<pattern>org.bstats</pattern>
<shadedPattern>com.trafalcraft.anti_redstone_clock.libs.bstats</shadedPattern>
</relocation>
</relocations>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>