Skip to content
This repository has been archived by the owner on Apr 29, 2021. It is now read-only.

Commit

Permalink
1.7.3.auto update push
Browse files Browse the repository at this point in the history
Signed-off-by: IzDaBait <[email protected]>
  • Loading branch information
IzDaBait committed Jan 10, 2021
1 parent eef2646 commit b51b2da
Show file tree
Hide file tree
Showing 9 changed files with 77 additions and 26 deletions.
4 changes: 3 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>me.izdabait.exploitsx</groupId>
<artifactId>ExploitsX</artifactId>
<version>1.7.1.auto</version>
<version>1.7.3.auto</version>
<name>ExploitsX</name>
<description>Top of the line exploit fixer for large servers impacted by various lag / crash exploits. Includes a
chat function to moderate chat.
Expand Down Expand Up @@ -66,6 +66,7 @@
<artifactId>placeholderapi</artifactId>
<version>2.10.9</version>
<scope>provided</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.destroystokyo.paper</groupId>
Expand All @@ -77,6 +78,7 @@
<groupId>com.destroystokyo.paper</groupId>
<artifactId>paper</artifactId>
<version>1.12.2-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>
15 changes: 13 additions & 2 deletions src/main/java/me/bait/exploitsx/ExploitsX.java
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,14 @@ public boolean onCommand(CommandSender sender, Command cmd, String commandLabel,
sender.sendMessage(Messages.getString("exf.65") + API.format(API.getTps())); //$NON-NLS-1$
return true;
}
if (args.length >= 1 && args[0].equalsIgnoreCase("color")) {
if (args.length != 2 || args[1].length() != 1) {
sender.sendMessage(ChatColor.translateAlternateColorCodes('&', API.getPrefix() + "&bColor usage: /e color [numbers 0-9 or letters a-e] such as /e color 0"));
} else {
RegisterStats.color(sender, args[1]);
sender.sendMessage(ChatColor.translateAlternateColorCodes('&', API.getPrefix() + "&" + args[1] + "Color successfully changed!"));
}
}
if (args.length == 1 && args[0].equalsIgnoreCase(Messages.getString("exf.66"))) { //$NON-NLS-1$
if (ConfigHelper.getBoolean(Messages.getString("exf.67"), true)) { //$NON-NLS-1$
sender.sendMessage(
Expand All @@ -364,13 +372,16 @@ public boolean onCommand(CommandSender sender, Command cmd, String commandLabel,
sender.sendMessage(ChatColor.YELLOW + Messages.getString("exf.77") + ChatColor.GRAY //$NON-NLS-1$
+ Messages.getString("exf.78") //$NON-NLS-1$
+ ChatColor.AQUA + Messages.getString("exf.79")); //$NON-NLS-1$
sender.sendMessage(ChatColor.YELLOW + Messages.getString("exf.89") + "addvls " + ChatColor.GRAY //$NON-NLS-1$
+ Messages.getString("exf.90") + ChatColor.AQUA
+ "Add chat violations to a user. Usage: /e addvls PLAYER AMOUNT");
}
sender.sendMessage(ChatColor.YELLOW + Messages.getString("exf.80") + ChatColor.GRAY //$NON-NLS-1$
+ Messages.getString("exf.81") + ChatColor.AQUA //$NON-NLS-1$
+ Messages.getString("exf.82")); //$NON-NLS-1$
sender.sendMessage(ChatColor.YELLOW + Messages.getString("exf.89") + "addvls " + ChatColor.GRAY //$NON-NLS-1$
sender.sendMessage(ChatColor.YELLOW + Messages.getString("exf.89") + "color [numbers 0-9 or letters a-e]" + ChatColor.GRAY //$NON-NLS-1$
+ Messages.getString("exf.90") + ChatColor.AQUA
+ "Add chat violations to a user. Usage: /e addvls PLAYER AMOUNT");
+ "Chose ExploitsX Colors. Usage: /e color 0");
sender.sendMessage(ChatColor.YELLOW + Messages.getString("exf.83") + ChatColor.GRAY //$NON-NLS-1$
+ Messages.getString("exf.84") + ChatColor.AQUA + Messages.getString("exf.85")); //$NON-NLS-1$ //$NON-NLS-2$
sender.sendMessage(ChatColor.YELLOW + Messages.getString("exf.86") + ChatColor.GRAY //$NON-NLS-1$
Expand Down
19 changes: 10 additions & 9 deletions src/main/java/me/bait/exploitsx/chatco/Whispers.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package me.bait.exploitsx.chatco;

import me.bait.exploitsx.ExploitsX;
import me.bait.exploitsx.gameplay.RegisterStats;
import me.bait.exploitsx.util.API;
import me.bait.exploitsx.util.ConfigHelper;
import org.bukkit.Bukkit;
Expand All @@ -17,9 +18,9 @@
import java.util.Calendar;

public class Whispers implements Listener {
private static String sendformat = ConfigHelper.getString("ChatCo.WhisperFormat.Send");
private static String sendformat = "To RECEIVER: ";

private static String recieveformat = ConfigHelper.getString("ChatCo.WhisperFormat.Receive");
private static String recieveformat = "SENDER whispers: ";

private static boolean rewire = ConfigHelper.getBoolean("rewire-chatco", true);

Expand Down Expand Up @@ -82,7 +83,7 @@ public void onPlayerCommandPreprocess(PlayerCommandPreprocessEvent event) throws
} catch (Exception ignored) {
}
if (ChatCommandHandle.checkForIgnores
&& ChatCommandHandle.getCCPlayer(target).isIgnored(sender.getName()))
&& ChatCommandHandle.getCCPlayer(target).isIgnored(sender.getUniqueId().toString()))
isIgnoring = true;
StringBuilder message = new StringBuilder();
for (int z = 1; z < args.length; z++) {
Expand All @@ -109,14 +110,14 @@ public void onPlayerCommandPreprocess(PlayerCommandPreprocessEvent event) throws
if (whisperlog)
whisperLog(inputText, sender.getName());
if (whisperMonitoring)
API.alertMessage(API.getPrefix() + "&aChatCo: " + sender.getName() + ": " + inputText);
API.alertMessage(API.getPrefix() + "&aChatCo: " + sender.getName() + " to " + target.getName() + ": " + inputText);
}
event.setCancelled(true);
}
if (newCommands) {
if (inputText.toLowerCase().startsWith("/tell ") || inputText.toLowerCase().startsWith("/msg ")
|| inputText.toLowerCase().startsWith("/t ") || inputText.toLowerCase().startsWith("/w ")
|| inputText.toLowerCase().startsWith("/whisper ") || inputText.toLowerCase().startsWith("/pm ")) {
|| inputText.toLowerCase().startsWith("/whisper ") || inputText.toLowerCase().startsWith("/message ") || inputText.toLowerCase().startsWith("/pm ")) {
if (args.length == 1)
sender.sendMessage("Usage: /t <player> <message>");
Player target = Bukkit.getPlayer(args[1]);
Expand All @@ -128,7 +129,7 @@ public void onPlayerCommandPreprocess(PlayerCommandPreprocessEvent event) throws
} catch (Exception ignored) {
}
if (ChatCommandHandle.checkForIgnores
&& ChatCommandHandle.getCCPlayer(target).isIgnored(sender.getName()))
&& ChatCommandHandle.getCCPlayer(target).isIgnored(sender.getUniqueId().toString()))
isIgnoring = true;
event.setCancelled(true);
StringBuilder message = new StringBuilder();
Expand Down Expand Up @@ -162,7 +163,7 @@ public void onPlayerCommandPreprocess(PlayerCommandPreprocessEvent event) throws
return;
if ((ChatCommandHandle.getCCPlayer(target)).tellsDisabled)
doNotSend = true;
if (ChatCommandHandle.checkForIgnores && ChatCommandHandle.getCCPlayer(target).isIgnored(sender.getName()))
if (ChatCommandHandle.checkForIgnores && ChatCommandHandle.getCCPlayer(target).isIgnored(sender.getUniqueId().toString()))
isIgnoring = true;
if (inputText.toLowerCase().startsWith("/tell ") || inputText.toLowerCase().startsWith("/w ")
|| inputText.toLowerCase().startsWith("/msg ")) {
Expand Down Expand Up @@ -199,9 +200,9 @@ public String whisperFormat(String who, Player sender, Player target) {
String data;

if (who.equalsIgnoreCase("sender")) {
data = sendformat;
data = "&" + RegisterStats.colors.get(sender) + sendformat;
} else {
data = recieveformat;
data = "&" + RegisterStats.colors.get(target) + recieveformat;
}

data = ChatColor.translateAlternateColorCodes('&', data);
Expand Down
1 change: 1 addition & 0 deletions src/main/java/me/bait/exploitsx/exploits/LightingLag.java
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ public void onbreak(BlockBreakEvent event) {
if (API.getVersionInt() <= 1122) {
ItemStack e = p.getItemInHand();
if (patchef && e != null && e.getEnchantments() != null
&& e.containsEnchantment(Enchantment.DIG_SPEED)
&& e.getEnchantments().containsKey(Enchantment.DIG_SPEED)
&& e.getEnchantmentLevel(Enchantment.DIG_SPEED) >= 5) {
e.removeEnchantment(Enchantment.DIG_SPEED);
Expand Down
11 changes: 6 additions & 5 deletions src/main/java/me/bait/exploitsx/gameplay/Placeholder.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import me.bait.exploitsx.util.API;
import me.clip.placeholderapi.expansion.PlaceholderExpansion;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;

Expand Down Expand Up @@ -48,17 +49,17 @@ public String onPlaceholderRequest(Player p, String identifier) {
double TPS = (API.getTps());
double intTPS = round(TPS, 2);
if (intTPS > 19.5D)
return a20.0*";
return ChatColor.translateAlternateColorCodes('&', "&a20.0*");
if (intTPS <= 19.5D && intTPS > 15.0D)
return a" + intTPS;
return ChatColor.translateAlternateColorCodes('&', "&a" + intTPS);
if (intTPS <= 19.5D && intTPS <= 15.0D && intTPS > 12.0D)
return e" + intTPS;
return ChatColor.translateAlternateColorCodes('&', "&e" + intTPS);
if (intTPS <= 19.5D && intTPS <= 15.0D && intTPS <= 12.0D
&& intTPS > 6.0D)
return c" + intTPS;
return ChatColor.translateAlternateColorCodes('&', "&c" + intTPS);
if (intTPS <= 19.5D && intTPS <= 15.0D && intTPS <= 12.0D
&& intTPS <= 6.0D)
return 4" + intTPS;
return ChatColor.translateAlternateColorCodes('&', "&4" + intTPS);
}
if (identifier.equals("online")) {
int players = Bukkit.getServer().getOnlinePlayers().size();
Expand Down
45 changes: 38 additions & 7 deletions src/main/java/me/bait/exploitsx/gameplay/RegisterStats.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.command.CommandSender;
import org.bukkit.configuration.InvalidConfigurationException;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.entity.Entity;
Expand Down Expand Up @@ -35,21 +36,29 @@

public class RegisterStats implements Listener {

public static HashMap<Player, Long> kill = new HashMap<>(); // done

public static HashMap<Player, Long> death = new HashMap<>(); // done

public static HashMap<Player, Long> time = new HashMap<>(); // done
private static final String defcolor = "d";
public static HashMap<Player, Long> kill = new HashMap<>();
public static HashMap<Player, Long> death = new HashMap<>();

public static HashMap<Player, Long> places = new HashMap<>();

public static HashMap<Player, Long> breaks = new HashMap<>();

public static HashMap<Player, Long> messages = new HashMap<>(); // done
public static HashMap<Player, Long> time = new HashMap<>();
public static HashMap<Player, Long> messages = new HashMap<>();

public static HashMap<Player, Long> travel = new HashMap<>();
public static HashMap<Player, String> colors = new HashMap<>();
Boolean elog = ExploitsX.getPlugin().getConfig().getBoolean(Messages.getString("RS.119"));

public static void color(CommandSender p, String s) {
if (p instanceof Player) {
colors.put((Player) p, s);
} else {
p.sendMessage(API.getPrefix() + ChatColor.RED + "Only players can run this command!");
}

}

public static void count() {
double tps = me.bait.exploitsx.util.TPS.getTPS();
for (Player p : Bukkit.getOnlinePlayers()) {
Expand Down Expand Up @@ -105,6 +114,9 @@ public void run() {
if (!RegisterStats.travel.containsKey(p)) {
RegisterStats.travel.put(p, 0L);
}
if (!RegisterStats.colors.containsKey(p)) {
RegisterStats.colors.put(p, defcolor);
}
String uuid = p.getUniqueId().toString();
String firstThreeChars = uuid.substring(0, 3);
File f = new File(Messages.getString("RS.4") + uuid + Messages.getString("RS.5")); //$NON-NLS-1$ //$NON-NLS-2$
Expand Down Expand Up @@ -165,6 +177,7 @@ public void run() {
f.getParentFile().mkdirs();
YamlConfiguration yaml = new YamlConfiguration();
yaml.createSection(Messages.getString("RS.27")); //$NON-NLS-1$
yaml.createSection("data.color");
yaml.createSection(Messages.getString("RS.28")); //$NON-NLS-1$
yaml.addDefault(Messages.getString("RS.29"), 0); //$NON-NLS-1$
yaml.addDefault(Messages.getString("RS.30"), 0); //$NON-NLS-1$
Expand All @@ -174,6 +187,7 @@ public void run() {
yaml.addDefault(Messages.getString("RS.34"), 0); //$NON-NLS-1$
yaml.addDefault(Messages.getString("RS.35"), 0); //$NON-NLS-1$
yaml.addDefault(Messages.getString("RS.36"), Messages.getString("RS.37")); //$NON-NLS-1$ //$NON-NLS-2$
yaml.set("data.color", defcolor);
yaml.set(Messages.getString("RS.38"), 0); //$NON-NLS-1$
yaml.set(Messages.getString("RS.39"), 0); //$NON-NLS-1$
yaml.set(Messages.getString("RS.40"), 0); //$NON-NLS-1$
Expand All @@ -194,13 +208,19 @@ public void run() {
RegisterStats.breaks.put(p, 0L);
RegisterStats.messages.put(p, 0L);
RegisterStats.travel.put(p, 0L);
RegisterStats.colors.put(p, defcolor);
} else {
YamlConfiguration save = new YamlConfiguration();
try {
save.load(f);
} catch (IOException | InvalidConfigurationException er) {
er.printStackTrace();
}
if (save.contains("data.color")) {
colors.put(p, save.getString("data.color"));
} else {
colors.put(p, defcolor);
}
kill.put(p, save.getLong(Messages.getString("RS.49"))); //$NON-NLS-1$
death.put(p, save.getLong(Messages.getString("RS.50"))); //$NON-NLS-1$
time.put(p, save.getLong(Messages.getString("RS.51"))); //$NON-NLS-1$
Expand All @@ -226,6 +246,7 @@ public static void removePlayer(Player p) {
public static YamlConfiguration setData(Player p, YamlConfiguration yaml) {
yaml.createSection(Messages.getString("RS.56")); //$NON-NLS-1$
yaml.createSection(Messages.getString("RS.57")); //$NON-NLS-1$
yaml.addDefault("data.color", defcolor);
yaml.addDefault(Messages.getString("RS.58"), 0); //$NON-NLS-1$
yaml.addDefault(Messages.getString("RS.59"), 0); //$NON-NLS-1$
yaml.addDefault(Messages.getString("RS.60"), 0); //$NON-NLS-1$
Expand All @@ -234,6 +255,7 @@ public static YamlConfiguration setData(Player p, YamlConfiguration yaml) {
yaml.addDefault(Messages.getString("RS.63"), 0); //$NON-NLS-1$
yaml.addDefault(Messages.getString("RS.64"), 0); //$NON-NLS-1$
yaml.addDefault(Messages.getString("RS.65"), Messages.getString("RS.66")); //$NON-NLS-1$ //$NON-NLS-2$
yaml.set("data.color", colors.get(p));
yaml.set(Messages.getString("RS.67"), kill.get(p)); //$NON-NLS-1$
yaml.set(Messages.getString("RS.68"), death.get(p)); //$NON-NLS-1$
yaml.set(Messages.getString("RS.69"), time.get(p)); //$NON-NLS-1$
Expand Down Expand Up @@ -363,6 +385,7 @@ public void onJoin(PlayerJoinEvent e) {
} catch (IOException e1) {
e1.printStackTrace();
}
RegisterStats.colors.put(p, defcolor);
RegisterStats.kill.put(p, 0L);
RegisterStats.time.put(p, 0L);
RegisterStats.death.put(p, 0L);
Expand All @@ -377,6 +400,11 @@ public void onJoin(PlayerJoinEvent e) {
} catch (IOException | InvalidConfigurationException er) {
er.printStackTrace();
}
if (save.contains("data.color")) {
colors.put(p, save.getString("data.color"));
} else {
colors.put(p, defcolor);
}
kill.put(p, save.getLong(Messages.getString("RS.96"))); //$NON-NLS-1$
death.put(p, save.getLong(Messages.getString("RS.97"))); //$NON-NLS-1$
time.put(p, save.getLong(Messages.getString("RS.98"))); //$NON-NLS-1$
Expand All @@ -392,6 +420,9 @@ public void onJoin(PlayerJoinEvent e) {
public void onLeave(PlayerQuitEvent e) {
new Thread(() -> {
Player p = e.getPlayer();
if (!RegisterStats.colors.containsKey(p)) {
RegisterStats.colors.put(p, defcolor);
}
if (!RegisterStats.death.containsKey(p)) {
RegisterStats.death.put(p, 0L);
}
Expand Down
5 changes: 4 additions & 1 deletion src/main/resources/changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,19 @@ Key:
~ coming soon
: note

1.7.1.auto:
1.7.3.auto:
@ /stats registering when disabled has been fixed
@ fixed /ignore not working for DMs
@ fixed rare error in blockbreak class involving enchantments
> substantial changes to chatco system
> did a few configuration changes to make ExploitsX less intrusive on server owners. Only enable stuff
- if you really need it
> adjusted TPS handler for better estimates
> various code changements and reorganizations
> few performance improvements
+ added a config-update-severity option to configs to tell owners if updating is important or not
+* added /e color: players can now adjust the color that they recieve messages in! This will later customize the color
: of more ExploitsX-related things
: no obligatory configuration changes

1.6.12.turret:
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/chatco.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ ChatCo:
# this will alert all messages to admins
WhisperMonitoring: true
WhisperFormat:
# DEPRECATED
Receive: '&dSENDER whispers: '
Send: '&dTo RECEIVER: '
ChatPrefixes:
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: ExploitsX
main: me.bait.exploitsx.ExploitsX
version: ${project.version}
version: 1.7.3.auto
author: io.github.izdabait
description: Top of the line exploit fixer for large servers impacted by lag / crash exploits.
api-version: 1.16
Expand Down

0 comments on commit b51b2da

Please sign in to comment.