Advertisement
Guest User

Pnale

a guest
Nov 22nd, 2014
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 25.17 KB | None | 0 0
  1. package com.rs;
  2.  
  3. import com.rs.game.*;
  4. import com.rs.game.Hit.HitLook;
  5. import com.rs.game.player.Player;
  6. import com.rs.game.player.Skills;
  7. import com.rs.game.player.content.Magic;
  8. import com.rs.utils.IPBanL;
  9. import com.rs.utils.Utils;
  10.  
  11. import javax.swing.*;
  12. import javax.swing.border.EmptyBorder;
  13. import java.awt.*;
  14. import java.awt.event.ActionEvent;
  15. import java.awt.event.ActionListener;
  16.  
  17. //import com.rs.utils.Misc;
  18.  
  19. public class Panel extends JFrame {
  20.  
  21. /**
  22. *
  23. */
  24. private static final long serialVersionUID = 1L;
  25. private JPanel contentPane;
  26. private JTextField textField;
  27.  
  28. /**
  29. * Launch the application.
  30. */
  31. public static void main(String[] args) {
  32. EventQueue.invokeLater(new Runnable() {
  33. public void run() {
  34. try {
  35. Panel frame = new Panel();
  36. frame.setVisible(true);
  37. } catch (Exception e) {
  38. e.printStackTrace();
  39. }
  40. }
  41. });
  42. }
  43.  
  44. /**
  45. * Create the frame.
  46. */
  47. public Panel() {
  48. setTitle("Rune-Blaze Control Panel");
  49. setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  50. setBounds(100, 100, 408, 456);
  51. contentPane = new JPanel();
  52. contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
  53. setContentPane(contentPane);
  54. contentPane.setLayout(null);
  55.  
  56. textField = new JTextField();
  57. textField.setBounds(87, 25, 194, 20);
  58. contentPane.add(textField);
  59. textField.setColumns(10);
  60.  
  61. JLabel lblUsername = new JLabel("Username");
  62. lblUsername.setBounds(156, 11, 92, 14);
  63. contentPane.add(lblUsername);
  64.  
  65. JLabel lblPunishment = new JLabel("Punishment");
  66. lblPunishment.setBounds(73, 60, 104, 14);
  67. contentPane.add(lblPunishment);
  68.  
  69. JProgressBar progressBar = new JProgressBar();
  70. progressBar.setBounds(10, 372, 372, 35);
  71. contentPane.add(progressBar);
  72. progressBar.setIndeterminate(true);
  73.  
  74. JButton btnIpban = new JButton("IPBan");
  75. btnIpban.addActionListener(new ActionListener() {
  76. public void actionPerformed(ActionEvent arg0) {
  77. IPban();
  78. }
  79. });
  80. btnIpban.setBounds(0, 85, 89, 23);
  81. contentPane.add(btnIpban);
  82.  
  83. JButton btnMute = new JButton("Mute");
  84. btnMute.addActionListener(new ActionListener() {
  85. public void actionPerformed(ActionEvent e) {
  86. mute();
  87. }
  88. });
  89. btnMute.setBounds(99, 85, 89, 23);
  90. contentPane.add(btnMute);
  91.  
  92. JButton btnBan = new JButton("Ban");
  93. btnBan.addActionListener(new ActionListener() {
  94. public void actionPerformed(ActionEvent e) {
  95. ban();
  96. }
  97. });
  98. btnBan.setBounds(0, 0, 0, 0);
  99. contentPane.add(btnBan);
  100.  
  101. JButton btnSetlevel = new JButton("Setlevel");
  102. btnSetlevel.addActionListener(new ActionListener() {
  103. public void actionPerformed(ActionEvent e) {
  104. Setlevel();
  105. }
  106. });
  107. btnSetlevel.setBounds(0, 119, 89, 23);
  108. contentPane.add(btnSetlevel);
  109.  
  110. JButton btnJail = new JButton("Jail");
  111. btnJail.addActionListener(new ActionListener() {
  112. public void actionPerformed(ActionEvent arg0) {
  113. jail();
  114. }
  115. });
  116. btnJail.setBounds(0, 0, 0, 0);
  117. contentPane.add(btnJail);
  118.  
  119. JButton btnAdmin = new JButton("Set Rights");
  120. btnAdmin.addActionListener(new ActionListener() {
  121. public void actionPerformed(ActionEvent arg0) {
  122. admin();
  123. }
  124. });
  125. btnAdmin.setBounds(0, 153, 89, 23);
  126. contentPane.add(btnAdmin);
  127.  
  128. JButton btnKill = new JButton("Kill");
  129. btnKill.addActionListener(new ActionListener() {
  130. public void actionPerformed(ActionEvent e) {
  131. kill();
  132. }
  133. });
  134. btnKill.setBounds(99, 119, 89, 23);
  135. contentPane.add(btnKill);
  136.  
  137. JButton btnFreezeunfreeze = new JButton("Freeze");
  138. btnFreezeunfreeze.addActionListener(new ActionListener() {
  139. public void actionPerformed(ActionEvent arg0) {
  140. freeze();
  141. }
  142. });
  143. btnFreezeunfreeze.setBounds(99, 153, 89, 23);
  144. contentPane.add(btnFreezeunfreeze);
  145.  
  146. JLabel lblItemManagment = new JLabel("Item Managment");
  147. lblItemManagment.setBounds(261, 60, 104, 14);
  148. contentPane.add(lblItemManagment);
  149.  
  150. JButton btnGiveItem = new JButton("Give Item");
  151. btnGiveItem.addActionListener(new ActionListener() {
  152. public void actionPerformed(ActionEvent e) {
  153. giveItem();
  154. }
  155. });
  156. btnGiveItem.setBounds(204, 85, 89, 23);
  157. contentPane.add(btnGiveItem);
  158.  
  159. JButton btnTakeItem = new JButton("Take Item");
  160. btnTakeItem.addActionListener(new ActionListener() {
  161. public void actionPerformed(ActionEvent e) {
  162. takeItem();
  163. }
  164. });
  165. btnTakeItem.setBounds(303, 85, 89, 23);
  166. contentPane.add(btnTakeItem);
  167.  
  168. JButton btnGiveAll = new JButton("Give All");
  169. btnGiveAll.addActionListener(new ActionListener() {
  170. public void actionPerformed(ActionEvent e) {
  171. giveAll();
  172. }
  173. });
  174. btnGiveAll.setBounds(204, 119, 89, 23);
  175. contentPane.add(btnGiveAll);
  176.  
  177. JButton btnTakeAll = new JButton("Take All");
  178. btnTakeAll.addActionListener(new ActionListener() {
  179. public void actionPerformed(ActionEvent e) {
  180. takeAll();
  181. }
  182. });
  183. btnTakeAll.setBounds(303, 119, 89, 23);
  184. contentPane.add(btnTakeAll);
  185.  
  186. JLabel lblTeleportation = new JLabel("Teleportation");
  187. lblTeleportation.setBounds(73, 206, 104, 14);
  188. contentPane.add(lblTeleportation);
  189.  
  190. JButton btnTeleport = new JButton("Teleport");
  191. btnTeleport.addActionListener(new ActionListener() {
  192. public void actionPerformed(ActionEvent e) {
  193. teleport();
  194. }
  195. });
  196. btnTeleport.setBounds(57, 231, 89, 23);
  197. contentPane.add(btnTeleport);
  198.  
  199. JButton btnSendhome = new JButton("Tele All");
  200. btnSendhome.addActionListener(new ActionListener() {
  201. public void actionPerformed(ActionEvent e) {
  202. teleAll();
  203. }
  204. });
  205. btnSendhome.setBounds(57, 265, 89, 23);
  206. contentPane.add(btnSendhome);
  207.  
  208. JLabel lblFunPanel = new JLabel("Fun Panel");
  209. lblFunPanel.setBounds(261, 177, 56, 14);
  210. contentPane.add(lblFunPanel);
  211.  
  212. JButton btnMakeDance = new JButton("Make Dance");
  213. btnMakeDance.addActionListener(new ActionListener() {
  214. public void actionPerformed(ActionEvent e) {
  215. makeDance();
  216. }
  217. });
  218. btnMakeDance.setBounds(231, 202, 114, 23);
  219. contentPane.add(btnMakeDance);
  220.  
  221. JButton btnDanceAll = new JButton("Dance All");
  222. btnDanceAll.addActionListener(new ActionListener() {
  223. public void actionPerformed(ActionEvent e) {
  224. danceAll();
  225. }
  226. });
  227. btnDanceAll.setBounds(231, 236, 114, 23);
  228. contentPane.add(btnDanceAll);
  229.  
  230. JButton btnForceChat = new JButton("Force Chat");
  231. btnForceChat.addActionListener(new ActionListener() {
  232. public void actionPerformed(ActionEvent e) {
  233. forceChat();
  234. }
  235. });
  236. btnForceChat.setBounds(231, 270, 114, 23);
  237. contentPane.add(btnForceChat);
  238.  
  239. JButton btnSmite = new JButton("Smite");
  240. btnSmite.addActionListener(new ActionListener() {
  241. public void actionPerformed(ActionEvent e) {
  242. smite();
  243. }
  244. });
  245. btnSmite.setBounds(231, 304, 114, 23);
  246. contentPane.add(btnSmite);
  247.  
  248. JButton btnFuckUp = new JButton("Freeze Up");
  249. btnFuckUp.addActionListener(new ActionListener() {
  250. public void actionPerformed(ActionEvent e) {
  251. fuckUp();
  252. }
  253. });
  254. btnFuckUp.setBounds(231, 338, 114, 23);
  255. contentPane.add(btnFuckUp);
  256.  
  257. JButton btnNewButton = new JButton("Shutdown Server");
  258. btnNewButton.addActionListener(new ActionListener() {
  259. public void actionPerformed(ActionEvent e) {
  260. shutdown();
  261. }
  262. });
  263. btnNewButton.setBounds(10, 299, 194, 62);
  264. contentPane.add(btnNewButton);
  265.  
  266. }
  267.  
  268. public String getUsernameInput() {
  269. return textField.getText();
  270. }
  271.  
  272. public void Setlevel() {
  273. String name = getUsernameInput();
  274. Player target = World.getPlayerByDisplayName(name);
  275. if (target != null) {
  276.  
  277. String id = JOptionPane.showInputDialog("Level ID");
  278. String quantity = JOptionPane.showInputDialog("Level you want");
  279. int skill = Integer.parseInt(id);
  280. int level = Integer.parseInt(quantity);
  281. target.getSkills().set(skill, level);
  282. target.getSkills().setXp(skill, Skills.getXPForLevel(level));
  283. JOptionPane.showMessageDialog(null, "Console: Leveled up " + name
  284. + "'s " + skill + " to level " + level + ".");
  285. }
  286. }
  287.  
  288. public void ban() {
  289. String name = getUsernameInput();
  290. Player target = World.getPlayerByDisplayName(name);
  291. if (target != null) {
  292. target.setBanned(200);
  293. target.getSession().getChannel().close();
  294. World.removePlayer(target);
  295. System.out.println("Console: Successfully Banned " + name + ".");
  296. JOptionPane.showMessageDialog(null, "Successfully Banned " + name,
  297. "Console", JOptionPane.PLAIN_MESSAGE);
  298. } else {
  299. JOptionPane.showMessageDialog(null, name + " Doesn't Exist",
  300. "Console", JOptionPane.ERROR_MESSAGE);
  301. System.out
  302. .println("Console: "
  303. + Utils.formatPlayerNameForDisplay(name)
  304. + " Doesn't Exist");
  305. }
  306. }
  307.  
  308. public void forceChat() {
  309. String name = getUsernameInput();
  310. Player target = World.getPlayerByDisplayName(name);
  311. if (target != null) {
  312. String chat = JOptionPane
  313. .showInputDialog("What Do You Want Him To Say?");
  314. target.setNextForceTalk(new ForceTalk(chat));
  315. System.out.println("Console: Forcing " + name + " To Say " + chat
  316. + "!");
  317. JOptionPane.showMessageDialog(null, "Forcing " + name + " To Say "
  318. + chat + "!", "Console", JOptionPane.PLAIN_MESSAGE);
  319. } else {
  320. JOptionPane.showMessageDialog(null, name + " Doesn't Exist",
  321. "Console", JOptionPane.ERROR_MESSAGE);
  322. System.out
  323. .println("Console: "
  324. + Utils.formatPlayerNameForDisplay(name)
  325. + " Doesn't Exist");
  326. }
  327. }
  328.  
  329. public void shutdown() {
  330. String name = getUsernameInput();
  331. Player target = World.getPlayerByDisplayName(name);
  332. String sht = JOptionPane.showInputDialog("Shudown Delay?");
  333. int delay = Integer.parseInt(sht);
  334. World.safeShutdown(false, delay);
  335. System.out.println("Console: Shutting Server Down!");
  336. JOptionPane.showMessageDialog(null, "Shutting Server Down!", "Console",
  337. JOptionPane.PLAIN_MESSAGE);
  338. }
  339.  
  340. public void makeDance() {
  341. String name = getUsernameInput();
  342. Player target = World.getPlayerByDisplayName(name);
  343. if (target != null) {
  344. target.setNextAnimation(new Animation(7071));
  345. System.out.println("Console: You Have Made " + name + " Dance!");
  346. JOptionPane.showMessageDialog(null, "You Have Made " + name
  347. + " Dance!", "Console", JOptionPane.PLAIN_MESSAGE);
  348. } else {
  349. JOptionPane.showMessageDialog(null, name + " Doesn't Exist",
  350. "Console", JOptionPane.ERROR_MESSAGE);
  351. System.out
  352. .println("Console: "
  353. + Utils.formatPlayerNameForDisplay(name)
  354. + " Doesn't Exist");
  355. }
  356. }
  357.  
  358. public void smite() {
  359. String name = getUsernameInput();
  360. Player target = World.getPlayerByDisplayName(name);
  361. if (target != null) {
  362. target.setPrayerDelay(999999999);
  363. System.out.println("Console: You Have Made Smited " + name + "!");
  364. JOptionPane.showMessageDialog(null,
  365. "You Have Smited " + name + "!", "Console",
  366. JOptionPane.PLAIN_MESSAGE);
  367. } else {
  368. JOptionPane.showMessageDialog(null, name + " Doesn't Exist",
  369. "Console", JOptionPane.ERROR_MESSAGE);
  370. System.out
  371. .println("Console: "
  372. + Utils.formatPlayerNameForDisplay(name)
  373. + " Doesn't Exist");
  374. }
  375. }
  376.  
  377. public void fuckUp() {
  378. String name = getUsernameInput();
  379. Player target = World.getPlayerByDisplayName(name);
  380. if (target != null) {
  381. target.setPrayerDelay(999999999);
  382. target.addFreezeDelay(999999999);
  383. for (int i = 0; i < 10; i++)
  384. target.getCombatDefinitions().getBonuses()[i] = 0;
  385. for (int i = 14; i < target.getCombatDefinitions().getBonuses().length; i++)
  386. target.getCombatDefinitions().getBonuses()[i] = 0;
  387. System.out
  388. .println("Console: You Have Made Frozen Up " + name + "!");
  389. JOptionPane.showMessageDialog(null, "You Have Freeze Up " + name
  390. + "!", "Console", JOptionPane.PLAIN_MESSAGE);
  391. } else {
  392. JOptionPane.showMessageDialog(null, name + " Doesn't Exist",
  393. "Console", JOptionPane.ERROR_MESSAGE);
  394. System.out
  395. .println("Console: "
  396. + Utils.formatPlayerNameForDisplay(name)
  397. + " Doesn't Exist");
  398. }
  399. }
  400.  
  401. public void IPban() {
  402. String name = getUsernameInput();
  403. Player target = World.getPlayerByDisplayName(name);
  404. if (target != null) {
  405. boolean loggedIn = true;
  406. IPBanL.ban(target, loggedIn);
  407. System.out.println("Console: Successfully IP Banned " + name + ".");
  408. JOptionPane.showMessageDialog(null, "Successfully IP Banned "
  409. + name, "Console", JOptionPane.PLAIN_MESSAGE);
  410. } else {
  411. JOptionPane.showMessageDialog(null, name + " Doesn't Exist!",
  412. "Console", JOptionPane.ERROR_MESSAGE);
  413. System.out.println("Console: "
  414. + Utils.formatPlayerNameForDisplay(name)
  415. + " Doesn't Exist!");
  416. }
  417. }
  418.  
  419. public void mute() {
  420. String name = getUsernameInput();
  421. Player target = World.getPlayerByDisplayName(name);
  422. if (target != null) {
  423. target.setMuted(Utils.currentTimeMillis() + (48 * 60 * 60 * 1000));
  424. System.out.println("Console: Muted " + name + ".");
  425. JOptionPane.showMessageDialog(null, "Successfully Muted " + name,
  426. "Console", JOptionPane.PLAIN_MESSAGE);
  427. } else {
  428. JOptionPane.showMessageDialog(null, name + " Doesn't Exist!",
  429. "Console", JOptionPane.ERROR_MESSAGE);
  430. System.out.println("Console: "
  431. + Utils.formatPlayerNameForDisplay(name)
  432. + " Doesn't Exist!");
  433. }
  434. }
  435.  
  436. public void kill() {
  437. String name = getUsernameInput();
  438. Player target = World.getPlayerByDisplayName(name);
  439. if (target != null) {
  440. target.applyHit(new Hit(target, target.getHitpoints(),
  441. HitLook.REGULAR_DAMAGE));
  442. target.stopAll();
  443. System.out.println("Console: Killed " + name + ".");
  444. JOptionPane.showMessageDialog(null, "Successfully Killed " + name,
  445. "Console", JOptionPane.PLAIN_MESSAGE);
  446. } else {
  447. JOptionPane.showMessageDialog(null, name + " Doesn't Exist!",
  448. "Console", JOptionPane.ERROR_MESSAGE);
  449. System.out.println("Console: "
  450. + Utils.formatPlayerNameForDisplay(name)
  451. + " Doesn't Exist!");
  452. }
  453. }
  454.  
  455. public void admin() {
  456. String name = getUsernameInput();
  457. Player target = World.getPlayerByDisplayName(name);
  458. if (target != null) {
  459. String x = JOptionPane.showInputDialog("Choose rights");
  460. int rights = Integer.parseInt(x);
  461. target.setRights(rights);
  462. System.out.println("Console: Successfully set player rights of "
  463. + name + " to " + rights + ".");
  464. JOptionPane.showMessageDialog(null, "Console: Set " + name
  465. + " Rights to " + rights + ".", "Console",
  466. JOptionPane.PLAIN_MESSAGE);
  467. } else {
  468. JOptionPane.showMessageDialog(null, name + " Doesn't Exist!",
  469. "Console", JOptionPane.ERROR_MESSAGE);
  470.  
  471. }
  472. }
  473.  
  474. public void jail() {
  475. String name = getUsernameInput();
  476. Player target = World.getPlayerByDisplayName(name);
  477. if (target != null) {
  478. target.setJailed(Utils.currentTimeMillis() + (24 * 60 * 60 * 1000));
  479. target.getControlerManager().startControler("JailControler");
  480. System.out.println("Console: Jailed " + name + ".");
  481. JOptionPane.showMessageDialog(null, "Successfully Jailed " + name,
  482. "Console", JOptionPane.PLAIN_MESSAGE);
  483. } else {
  484. JOptionPane.showMessageDialog(null, name + " Doesn't Exist!",
  485. "Console", JOptionPane.ERROR_MESSAGE);
  486. System.out.println("Console: "
  487. + Utils.formatPlayerNameForDisplay(name)
  488. + " Doesn't Exist!");
  489. }
  490. }
  491.  
  492. public void freeze() {
  493. String name = getUsernameInput();
  494. Player target = World.getPlayerByDisplayName(name);
  495. if (target != null) {
  496. target.addFreezeDelay(999999999);
  497. System.out.println("Console: Frozen " + name + ".");
  498. JOptionPane.showMessageDialog(null, "Successfully Frozen " + name,
  499. "Console", JOptionPane.PLAIN_MESSAGE);
  500. } else {
  501. JOptionPane.showMessageDialog(null, name + " Doesn't Exist!",
  502. "Console", JOptionPane.ERROR_MESSAGE);
  503. System.out.println("Console: "
  504. + Utils.formatPlayerNameForDisplay(name)
  505. + " Doesn't Exist!");
  506. }
  507. }
  508.  
  509. public void giveItem() {
  510. String name = getUsernameInput();
  511. Player target = World.getPlayerByDisplayName(name);
  512. if (target != null) {
  513. String id = JOptionPane.showInputDialog("Item Id");
  514. String quantity = JOptionPane.showInputDialog("Item Amount");
  515. int item = Integer.parseInt(id);
  516. int amount = Integer.parseInt(quantity);
  517. target.getInventory().addItem(item, amount);
  518. System.out.println("Console: Given Item To " + name + ".");
  519. JOptionPane.showMessageDialog(null, "Given Item To " + name,
  520. "Console", JOptionPane.PLAIN_MESSAGE);
  521. } else {
  522. JOptionPane.showMessageDialog(null, name + " Doesn't Exist!",
  523. "Console", JOptionPane.ERROR_MESSAGE);
  524. System.out.println("Console: "
  525. + Utils.formatPlayerNameForDisplay(name)
  526. + " Doesn't Exist!");
  527. }
  528. }
  529.  
  530. public void teleport() {
  531. String name = getUsernameInput();
  532. Player target = World.getPlayerByDisplayName(name);
  533. if (target != null) {
  534. String x = JOptionPane.showInputDialog("Coordinate X");
  535. String y = JOptionPane.showInputDialog("Coordinate Y");
  536. String h = JOptionPane.showInputDialog("Height Level");
  537. int coordx = Integer.parseInt(x);
  538. int coordy = Integer.parseInt(y);
  539. int height = Integer.parseInt(h);
  540. Magic.sendNormalTeleportSpell(target, 0, 0, new WorldTile(coordx,
  541. coordy, height));
  542. System.out.println("Console: Teleported " + name + " To " + coordx
  543. + ", " + coordy + ", " + height);
  544. JOptionPane.showMessageDialog(null, "Console: Teleported " + name
  545. + " To " + coordx + ", " + coordy + ", " + height,
  546. "Console", JOptionPane.PLAIN_MESSAGE);
  547. } else {
  548. JOptionPane.showMessageDialog(null, name + " Doesn't Exist!",
  549. "Console", JOptionPane.ERROR_MESSAGE);
  550. System.out.println("Console: "
  551. + Utils.formatPlayerNameForDisplay(name)
  552. + " Doesn't Exist!");
  553. }
  554. }
  555.  
  556. public void teleAll() {
  557. String name = getUsernameInput();
  558. Player target = World.getPlayerByDisplayName(name);
  559. String x = JOptionPane.showInputDialog("Coordinate X");
  560. String y = JOptionPane.showInputDialog("Coordinate Y");
  561. String h = JOptionPane.showInputDialog("Height Level");
  562. int coordx = Integer.parseInt(x);
  563. int coordy = Integer.parseInt(y);
  564. int height = Integer.parseInt(h);
  565. for (Player teleall : World.getPlayers()) {
  566. Magic.sendNormalTeleportSpell(teleall, 0, 0, new WorldTile(coordx,
  567. coordy, height));
  568. }
  569. System.out.println("Console: Teleported Everyone To " + coordx + ", "
  570. + coordy + ", " + height);
  571. JOptionPane.showMessageDialog(null, "Console: Teleported Everyone To "
  572. + coordx + ", " + coordy + ", " + height, "Console",
  573. JOptionPane.PLAIN_MESSAGE);
  574. }
  575.  
  576. public void danceAll() {
  577. String name = getUsernameInput();
  578. Player target = World.getPlayerByDisplayName(name);
  579. for (Player danceAll : World.getPlayers()) {
  580. danceAll.setNextAnimation(new Animation(7071));
  581. }
  582. System.out.println("Console: Making Everyone Dance!");
  583. JOptionPane.showMessageDialog(null, "Console: Making Everyone Dance!",
  584. "Console", JOptionPane.PLAIN_MESSAGE);
  585. }
  586.  
  587. public void takeItem() {
  588. String name = getUsernameInput();
  589. Player target = World.getPlayerByDisplayName(name);
  590. if (target != null) {
  591. String id = JOptionPane.showInputDialog("Item Id");
  592. String quantity = JOptionPane.showInputDialog("Item Amount");
  593. int item = Integer.parseInt(id);
  594. int amount = Integer.parseInt(quantity);
  595. target.getInventory().deleteItem(item, amount);
  596. System.out.println("Console: Taken Item " + item + " From " + name
  597. + ".");
  598. JOptionPane.showMessageDialog(null, "Taken Item " + item + " From "
  599. + name, "Console", JOptionPane.PLAIN_MESSAGE);
  600. } else {
  601. JOptionPane.showMessageDialog(null, name + " Doesn't Exist!",
  602. "Console", JOptionPane.ERROR_MESSAGE);
  603. System.out.println("Console: "
  604. + Utils.formatPlayerNameForDisplay(name)
  605. + " Doesn't Exist!");
  606. }
  607. }
  608.  
  609. public void giveAll() {
  610. String name = getUsernameInput();
  611. Player target = World.getPlayerByDisplayName(name);
  612. String id = JOptionPane.showInputDialog("Item Id");
  613. String quantity = JOptionPane.showInputDialog("Item Amount");
  614. int item = Integer.parseInt(id);
  615. int amount = Integer.parseInt(quantity);
  616. for (Player giveall : World.getPlayers()) {
  617. giveall.getInventory().addItem(item, amount);
  618. }
  619. System.out.println("Console: Given Item " + item + " To All Players");
  620. JOptionPane.showMessageDialog(null, "Given Item " + item
  621. + " To All Players", "Console", JOptionPane.PLAIN_MESSAGE);
  622. }
  623.  
  624. public void takeAll() {
  625. String name = getUsernameInput();
  626. Player target = World.getPlayerByDisplayName(name);
  627. String id = JOptionPane.showInputDialog("Item Id");
  628. String quantity = JOptionPane.showInputDialog("Item Amount");
  629. int item = Integer.parseInt(id);
  630. int amount = Integer.parseInt(quantity);
  631. for (Player takeall : World.getPlayers()) {
  632. takeall.getInventory().deleteItem(item, amount);
  633. }
  634. System.out.println("Console: Taken Item " + item + " From All Players");
  635. JOptionPane.showMessageDialog(null, "Taken Item " + item
  636. + " From All Players", "Console", JOptionPane.PLAIN_MESSAGE);
  637. }
  638. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement