├── .gitattributes ├── KitBot.java ├── README.md └── noobbot.png /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | -------------------------------------------------------------------------------- /KitBot.java: -------------------------------------------------------------------------------- 1 | package fb.fbware.modules.player; 2 | 3 | import fb.fbware.util.ChatUtil; 4 | import fb.fbware.modules.Module; 5 | import fb.fbware.setting.BooleanSetting; 6 | import fb.fbware.setting.StringSetting; 7 | import net.minecraftforge.client.event.ClientChatReceivedEvent; 8 | import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; 9 | 10 | import java.util.AbstractMap; 11 | import java.util.Map; 12 | import java.util.Optional; 13 | import java.util.regex.Matcher; 14 | import java.util.regex.Pattern; 15 | 16 | public class KitBot extends Module { 17 | 18 | //Credit: FB#7334 19 | //thank you to Konas for parseChatMessage 20 | 21 | 22 | public KitBot() { 23 | super("KitBot","Automatically teleports to people when they type a password in chat.", Category.PLAYER, this); 24 | } 25 | 26 | public StringSetting password = register(new StringSetting<>("Password", "FBware")); 27 | public BooleanSetting kill = register(new BooleanSetting<>("AutoSuicide", true)); 28 | public BooleanSetting debug = register(new BooleanSetting<>("Announce", true)); 29 | 30 | @SubscribeEvent 31 | public void onChat(ClientChatReceivedEvent event) { 32 | if (event.getMessage().getUnformattedText().toLowerCase().contains(password.getValue())) { 33 | 34 | if (debug.getValue()) { 35 | ChatUtil.sendWarnMessage("Registered a kit request."); 36 | } 37 | 38 | Optional> parsedMessage = parseChatMessage(event.getMessage().getUnformattedText()); 39 | 40 | if (parsedMessage.isPresent()) { 41 | 42 | if (debug.getValue()) { 43 | ChatUtil.sendWarnMessage("Attempting to teleport to: " + parsedMessage.get().getKey() + "."); 44 | } 45 | 46 | mc.player.sendChatMessage("/tpa " + parsedMessage.get().getKey()); 47 | } 48 | } 49 | 50 | if (event.getMessage().getUnformattedText().contains("teleporting to:")) { 51 | 52 | if (debug.getValue()) { 53 | ChatUtil.sendWarnMessage("Teleport success!"); 54 | } 55 | 56 | if (kill.getValue()) { 57 | 58 | if (debug.getValue()) { 59 | ChatUtil.sendWarnMessage("Attempting to /kill back to stash."); 60 | } 61 | 62 | mc.player.sendChatMessage("/kill"); 63 | } 64 | } 65 | } 66 | 67 | 68 | //on 0b0t redstone is shit so when you respawn you will not always get a kit if you step on the pressureplate 69 | //simple fix: if your inventory is empty, jump onto the pressure plate until you get a kit 70 | @Override 71 | public void onUpdate() { 72 | if (mc.player.inventory.isEmpty() && !mc.player.isDead && mc.player.onGround) { 73 | if (debug.getValue()) { 74 | ChatUtil.sendWarnMessage("Inventory empty, attempting to jump to trigger pressure plate."); 75 | } 76 | mc.player.jump(); 77 | } 78 | } 79 | 80 | public static Optional> parseChatMessage(String messageRaw) { 81 | 82 | Matcher matcher = Pattern.compile("^<(" + "[a-zA-Z0-9_]{3,16}" + ")> (.+)$").matcher(messageRaw); 83 | 84 | String senderName = null; 85 | String message = null; 86 | 87 | while (matcher.find()) { 88 | senderName = matcher.group(1); 89 | message = matcher.group(2); 90 | } 91 | 92 | if (senderName == null || senderName.isEmpty()) { 93 | return Optional.empty(); 94 | } 95 | 96 | if (message == null || message.isEmpty()) { 97 | return Optional.empty(); 98 | } 99 | 100 | return Optional.of(new AbstractMap.SimpleEntry<>(senderName, message)); 101 | } 102 | 103 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # FB's 0b0t Kit Bot 2 | Automatic kit bot host for 0b0t.org 3 | Possibly chinese code, made in like an hour and wasnt intended to be made public 4 | 5 | # Setting breakdown 6 | Password - The customisable string of text you would like people to type in chat, to request a kit. 7 | 8 | AutoSuicide - Automatically runs /kill when the bot teleports to a player. 9 | 10 | Announce - Breaks down what the bot is currently doing, prints in chat but is only visible to you. 11 | 12 | # How-to 13 | Step 1 - Paste the code into a new module in your Phobos skid 14 | 15 | Step 2 - Make sure there is a 1x2 space with a 3 block high roof for when your player jumps (look at the screenshot provided for help) 16 | 17 | Step 3 - On one of the 2x1 space on the floor make sure one of the blocks has a pressure plate and the other one is empty (you will be sent back to spawn due to your spawnpoint failing if you have both spaces with a pressure plate) connected to a DROPPER (not dispenser) and the dropper is connected to your stash via hoppers 18 | 19 | Step 4 - Fill your stash with the desired kits 20 | 21 | Step 5 - Set your spawn point in the bed, and rename the Password setting to whichever "password" you would like the kitbot to follow. 22 | 23 | Step 6 - Turn on the module and advertise the fact you are running the bot. 24 | 25 | # Credit 26 | 27 | Thank you Konas for the parseChatMessage method 28 | Thank you Tesco_Meal_Deal for testing 29 | -------------------------------------------------------------------------------- /noobbot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jewbob/0b0tKitBot/06d0d636bb236d967a0a964520b1aa73d90f7f2c/noobbot.png --------------------------------------------------------------------------------