-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
38 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package com.udu3324.poinpow.utils; | ||
|
||
import com.udu3324.poinpow.Poinpow; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; | ||
|
||
import java.util.concurrent.atomic.AtomicBoolean; | ||
import java.util.regex.Pattern; | ||
|
||
public class BlockRaids { | ||
public static String name = "block_raids"; | ||
public static String description = "Blocks the raid alerts shown in lobby."; | ||
public static AtomicBoolean toggled = new AtomicBoolean(true); | ||
|
||
final static Pattern pattern = Pattern.compile("Minehut \\| Raid starts in [0-9]+ Seconds!"); | ||
final static Pattern pattern2 = Pattern.compile("Minehut \\| A new raid is ready! Enter the green circle to begin\\."); | ||
|
||
public static Boolean check(String chat, CallbackInfo ci) { | ||
// return false if toggled off | ||
if (!toggled.get()) return false; | ||
|
||
// return if not on minehut | ||
if (!Poinpow.onMinehut) return false; | ||
|
||
if (pattern.matcher(chat).find() || pattern2.matcher(chat).find()) { | ||
Poinpow.log.info("Blocked: " + chat); | ||
ci.cancel(); | ||
} | ||
|
||
return pattern.matcher(chat).find(); | ||
} | ||
} |