Skip to content

Commit

Permalink
Merge pull request #17 from Alexdoru/master
Browse files Browse the repository at this point in the history
Master
  • Loading branch information
Alexdoru authored Jul 8, 2022
2 parents 1420915 + 4489e33 commit ca69336
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 21 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ buildscript {
}
apply plugin: 'net.minecraftforge.gradle.forge'

version = "2.2"
version = "2.3"
group = "fr.alexdoru"
archivesBaseName = "[1.8.9]MegaWallsEnhancements"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public class MegaWallsEnhancementsMod {

public static final String modid = "mwenhancements";
public static final String modName = "MegaWallsEnhancements";
public static final String version = "2.2";
public static final String version = "2.3";
public static final KeyBinding toggleDroppedItemLimit = new KeyBinding("Toggle dropped item limit", 0, "MegaWallsEnhancements");
public static final KeyBinding newNickKey = new KeyBinding("New Random Nick", 0, "MegaWallsEnhancements");
public static File configurationFile;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,10 @@

import java.util.Arrays;
import java.util.List;
import java.util.regex.Pattern;

public class CommandHypixelShout extends CommandBase {

private static final String guide_url = "https://hypixel.net/threads/the-complete-mega-walls-guide.3489088/";

@Override
public String getCommandName() {
return "shout";
Expand All @@ -28,15 +27,7 @@ public String getCommandUsage(ICommandSender sender) {

@Override
public void processCommand(ICommandSender sender, String[] args) {
StringBuilder msg = new StringBuilder("/shout");
for (String arg : args) {
if (arg.equalsIgnoreCase("/guide")) {
msg.append(" " + guide_url);
} else {
msg.append(" ").append(arg);
}
}
(Minecraft.getMinecraft()).thePlayer.sendChatMessage(msg.toString());
(Minecraft.getMinecraft()).thePlayer.sendChatMessage(Pattern.compile("seks", Pattern.CASE_INSENSITIVE).matcher("/shout " + buildString(args, 0)).replaceAll("****"));
}

@Override
Expand All @@ -51,7 +42,6 @@ public boolean canCommandSenderUseCommand(ICommandSender sender) {

@Override
public List<String> addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos) {

if (args.length >= 2 && isKeywordreport(2, args)) {
if (FKCounterMod.isitPrepPhase) {
return getListOfStringsMatchingLastWord(args, TabCompletionUtil.getOnlinePlayersByName());
Expand All @@ -61,17 +51,13 @@ public List<String> addTabCompletionOptions(ICommandSender sender, String[] args
return getListOfStringsMatchingLastWord(args, playersInThisGame);
}
}

if (args.length >= 3 && (isKeywordreport(3, args))) {
return getListOfStringsMatchingLastWord(args, CommandReport.cheatsArray);
}

if (FKCounterMod.isitPrepPhase) {
return getListOfStringsMatchingLastWord(args, TabCompletionUtil.getOnlinePlayersByName());
}

return null;

}

private boolean isKeywordreport(int i, String[] args) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ public static String getTimeSinceGameStart(long timestamp, String serverID, int
String time_line = scoresRaw.get(1);
String[] split = time_line.split(":");

if (split.length < 3) {
return "?";
}

int score_sec = 60 * Integer.parseInt(split[1].replace(" ", "")) + Integer.parseInt(split[2].replace(" ", ""));
int sec_since_start = 0;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,8 @@ private boolean isPlayerStandingStill(EntityPlayerSP thePlayer) {
&& thePlayer.movementInput.moveStrafe == 0.0F
&& !thePlayer.movementInput.jump
&& !thePlayer.movementInput.sneak
&& !thePlayer.isUsingItem();
&& !thePlayer.isUsingItem()
&& !thePlayer.isSwingInProgress;
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ public class ReportSuggestionHandler {

private static final Minecraft mc = Minecraft.getMinecraft();
public static final ResourceLocation REPORT_SUGGESTION_SOUND = new ResourceLocation("random.orb");
private static final Pattern REPORT_PATTERN1 = Pattern.compile("(\\w{2,16}) (?:|is )b?hop?ping", Pattern.CASE_INSENSITIVE);
private static final Pattern REPORT_PATTERN2 = Pattern.compile("\\/?(?:wdr|report) (\\w{2,16}) (\\w+)", Pattern.CASE_INSENSITIVE);
private static final Pattern REPORT_PATTERN1 = Pattern.compile("([a-zA-Z0-9_*]{2,16}) (?:|is )b?hop?ping", Pattern.CASE_INSENSITIVE);
private static final Pattern REPORT_PATTERN2 = Pattern.compile("\\/?(?:wdr|report) ([a-zA-Z0-9_*]{2,16}) (\\w+)", Pattern.CASE_INSENSITIVE);
private static final List<StringLong> reportSuggestionHistory = new ArrayList<>();
private static final List<Long> reportSpamCheck = new ArrayList<>();
private static final long TIME_BETWEEN_REPORT_SUGGESTION_PLAYER = 40L * 60L * 1000L;
Expand All @@ -53,6 +53,15 @@ public static boolean parseReportMessage(@Nullable String senderRank, @Nullable
if (matcher1.find()) {
String reportText = matcher1.group();
String reportedPlayer = matcher1.group(1);
String uncensoredName = null;
if (reportedPlayer.contains("****")) {
uncensoredName = findPlayernameWithCorrectCase(reportedPlayer.replace("****", "seks"));
}
if (uncensoredName != null) {
fmsgIn = fmsgIn.replace(reportedPlayer, uncensoredName);
reportText = reportText.replace(reportedPlayer, uncensoredName);
reportedPlayer = uncensoredName;
}
if (isAValidName(reportedPlayer)) {
handleReportSuggestion(reportedPlayer, senderRank, messageSender, squadname, reportText, "bhop", fmsgIn);
} else {
Expand All @@ -63,6 +72,15 @@ public static boolean parseReportMessage(@Nullable String senderRank, @Nullable
String reportText = matcher2.group();
String reportedPlayer = matcher2.group(1);
String cheat = matcher2.group(2);
String uncensoredName = null;
if (reportedPlayer.contains("****")) {
uncensoredName = findPlayernameWithCorrectCase(reportedPlayer.replace("****", "seks"));
}
if (uncensoredName != null) {
fmsgIn = fmsgIn.replace(reportedPlayer, uncensoredName);
reportText = reportText.replace(reportedPlayer, uncensoredName);
reportedPlayer = uncensoredName;
}
if (isAValidCheat(cheat) && isAValidName(reportedPlayer)) {
handleReportSuggestion(reportedPlayer, senderRank, messageSender, squadname, reportText, cheat, fmsgIn);
} else {
Expand Down Expand Up @@ -325,4 +343,13 @@ public static void clearReportSuggestionHistory() {
reportSuggestionHistory.clear();
}

private static String findPlayernameWithCorrectCase(String nameIn) {
for (NetworkPlayerInfo networkPlayerInfo : mc.getNetHandler().getPlayerInfoMap()) {
if (networkPlayerInfo.getGameProfile().getName().equalsIgnoreCase(nameIn)) {
return networkPlayerInfo.getGameProfile().getName();
}
}
return null;
}

}

0 comments on commit ca69336

Please sign in to comment.