Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package scripts;
- import java.awt.Dimension;
- import java.awt.Toolkit;
- import org.tribot.api.input.Keyboard;
- import org.tribot.api.input.Mouse;
- import org.tribot.api2007.NPCChat;
- import org.tribot.script.Script;
- import org.tribot.script.ScriptManifest;
- @ScriptManifest(authors = { "Coca Cola" }, category = "Tools", name = "MessageSpammer")
- public class CCSpammer extends Script {
- public boolean GUI_COMPLETE = false;
- public String MESSAGE;
- @Override
- public void run() {
- Mouse.setSpeed(200);
- GUI GUI = new GUI();
- Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
- int screenW = screenSize.width;
- int screenH = screenSize.height;
- Dimension dim = GUI.getSize();
- GUI.setVisible(true);
- println("GUI is open. Please select desired settings.");
- GUI.setLocation((screenW / 2) - (dim.width / 2), (screenH / 2) - (dim.height / 2));
- while(!GUI_COMPLETE) {
- sleep(200);
- }
- GUI.setVisible(false);
- println("GUI Closed. Script initialized with chosen settings.");
- if (onStart()) {
- while (true) {
- sleep(loop());
- }
- }
- }
- public class GUI extends javax.swing.JFrame {
- /**
- * Creates new form GUI
- */
- public GUI() {
- initComponents();
- }
- /**
- * This method is called from within the constructor to initialize the form.
- * WARNING: Do NOT modify this code. The content of this method is always
- * regenerated by the Form Editor.
- */
- @SuppressWarnings("unchecked")
- // <editor-fold defaultstate="collapsed" desc="Generated Code">
- private void initComponents() {
- START_BUTTON = new javax.swing.JButton();
- MESSAGE_BOX = new javax.swing.JTextField();
- jLabel1 = new javax.swing.JLabel();
- setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
- setAlwaysOnTop(true);
- setBackground(new java.awt.Color(255, 255, 255));
- setForeground(new java.awt.Color(0, 0, 0));
- START_BUTTON.setText("Start");
- START_BUTTON.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- START_BUTTONActionPerformed(evt);
- }
- });
- MESSAGE_BOX.setForeground(new java.awt.Color(51, 51, 51));
- MESSAGE_BOX.setHorizontalAlignment(javax.swing.JTextField.LEFT);
- jLabel1.setFont(new java.awt.Font("Tahoma", 3, 14)); // NOI18N
- jLabel1.setForeground(new java.awt.Color(51, 51, 51));
- jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
- jLabel1.setText("Enter the message you would like to spam and click start");
- javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
- getContentPane().setLayout(layout);
- layout.setHorizontalGroup(
- layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
- .addGap(0, 0, Short.MAX_VALUE)
- .addComponent(MESSAGE_BOX, javax.swing.GroupLayout.PREFERRED_SIZE, 319, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addGap(55, 55, 55))
- .addGroup(layout.createSequentialGroup()
- .addGap(170, 170, 170)
- .addComponent(START_BUTTON)
- .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
- .addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, 432, Short.MAX_VALUE)
- );
- layout.setVerticalGroup(
- layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
- .addContainerGap()
- .addComponent(jLabel1)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 20, Short.MAX_VALUE)
- .addComponent(MESSAGE_BOX, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addGap(18, 18, 18)
- .addComponent(START_BUTTON)
- .addContainerGap())
- );
- pack();
- }// </editor-fold>
- private void START_BUTTONActionPerformed(java.awt.event.ActionEvent evt) {
- MESSAGE = MESSAGE_BOX.getText().toString();
- if (MESSAGE == null) {
- println("You need to type a message in the GUI first!");
- return;
- } else {
- GUI_COMPLETE = true;
- }
- }
- // Variables declaration - do not modify
- private javax.swing.JTextField MESSAGE_BOX;
- private javax.swing.JButton START_BUTTON;
- private javax.swing.JLabel jLabel1;
- // End of variables declaration
- }
- private boolean onStart() {
- println("Coca Cola's Spammer has started!");
- return true;
- }
- private int loop() {
- if(NPCChat.getClickContinueInterface() != null) {
- NPCChat.clickContinue(true);
- } else {
- Keyboard.typeSend(""+MESSAGE);
- }
- return 42;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement