Advertisement
Guest User

Skyblock Mod

a guest
May 6th, 2018
353
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 37.11 KB | None | 0 0
  1. package com.Traumatophobia.prefixmod;
  2.  
  3. import java.util.ArrayList;
  4. import java.util.List;
  5.  
  6. import net.minecraft.client.Minecraft;
  7. import net.minecraft.command.CommandException;
  8. import net.minecraft.command.ICommand;
  9. import net.minecraft.command.ICommandSender;
  10. import net.minecraft.init.Items;
  11. import net.minecraft.item.Item;
  12. import net.minecraft.item.ItemStack;
  13. import net.minecraft.server.MinecraftServer;
  14. import net.minecraft.util.math.BlockPos;
  15. import net.minecraftforge.client.IClientCommand;
  16.  
  17. public class EnchantAll implements IClientCommand {
  18.  
  19.  
  20.  
  21. private final List aliases;
  22.  
  23. public EnchantAll()
  24. {
  25. aliases = new ArrayList();
  26. aliases.add("ea");
  27. aliases.add("godall");
  28.  
  29. }
  30.  
  31.  
  32. @Override
  33. public boolean checkPermission(MinecraftServer arg0, ICommandSender arg1) {
  34. // TODO Auto-generated method stub
  35. return true;
  36. }
  37.  
  38. @Override
  39. public void execute(MinecraftServer arg0, ICommandSender arg1, String[] arg2) {
  40. Item item = Minecraft.getMinecraft().player.getHeldItemMainhand().getItem();
  41. if (item == Items.DIAMOND_PICKAXE || item == Items.DIAMOND_AXE || item == Items.DIAMOND_SHOVEL || item == Items.IRON_PICKAXE || item == Items.IRON_AXE || item == Items.IRON_SHOVEL || item == Items.STONE_PICKAXE || item == Items.STONE_AXE || item == Items.STONE_SHOVEL || item == Items.GOLDEN_PICKAXE || item == Items.GOLDEN_AXE || item == Items.GOLDEN_SHOVEL || item == Items.WOODEN_PICKAXE || item == Items.WOODEN_AXE || item == Items.WOODEN_SHOVEL) {
  42. PrefixMod.pressTime = 0;
  43. PrefixMod.enchanttool = true;
  44. PrefixMod.enchant = true;
  45. }
  46. else if (item == Items.DIAMOND_SWORD || item == Items.IRON_SWORD || item == Items.STONE_SWORD || item == Items.GOLDEN_SWORD || item == Items.WOODEN_SWORD) {
  47. PrefixMod.pressTime = 0;
  48. PrefixMod.enchantsword = true;
  49. PrefixMod.enchant = true;
  50. }
  51. else if (item == Items.BOW) {
  52. PrefixMod.pressTime = 0;
  53. PrefixMod.enchantbow = true;
  54. PrefixMod.enchant = true;
  55. }
  56. else if (item == Items.DIAMOND_CHESTPLATE || item == Items.DIAMOND_LEGGINGS || item == Items.IRON_CHESTPLATE || item == Items.IRON_LEGGINGS || item == Items.GOLDEN_CHESTPLATE || item == Items.GOLDEN_LEGGINGS || item == Items.LEATHER_CHESTPLATE || item == Items.LEATHER_LEGGINGS || item == Items.CHAINMAIL_CHESTPLATE || item == Items.CHAINMAIL_LEGGINGS ) {
  57. PrefixMod.enchanttorso = true;
  58. PrefixMod.pressTime = 0;
  59. PrefixMod.enchant = true;
  60. }
  61. else if (item == Items.DIAMOND_HELMET || item == Items.IRON_HELMET || item == Items.GOLDEN_HELMET || item == Items.CHAINMAIL_HELMET || item == Items.LEATHER_HELMET) {
  62. PrefixMod.enchanthelmet = true;
  63. PrefixMod.pressTime = 0;
  64. PrefixMod.enchant = true;
  65. }
  66. else if (item == Items.DIAMOND_BOOTS || item == Items.IRON_BOOTS || item == Items.GOLDEN_BOOTS || item == Items.CHAINMAIL_BOOTS || item == Items.LEATHER_BOOTS) {
  67. PrefixMod.enchantboots = true;
  68. PrefixMod.pressTime = 0;
  69. PrefixMod.enchant = true;
  70. }
  71. else if (item == Items.FISHING_ROD) {
  72. PrefixMod.enchantrod = true;
  73. PrefixMod.pressTime = 0;
  74. PrefixMod.enchant = true;
  75. }
  76. else if (item == Items.FLINT_AND_STEEL || item == Items.SHEARS || item == Items.ELYTRA || item == Items.DIAMOND_HOE || item == Items.IRON_HOE || item == Items.STONE_HOE || item == Items.GOLDEN_HOE || item == Items.WOODEN_HOE){
  77. PrefixMod.enchantother = true;
  78. PrefixMod.pressTime = 0;
  79. PrefixMod.enchant = true;
  80. }
  81. }
  82.  
  83.  
  84.  
  85. @Override
  86. public List<String> getAliases() {
  87. // TODO Auto-generated method stub
  88. return this.aliases;
  89. }
  90.  
  91. @Override
  92. public String getName() {
  93. // TODO Auto-generated method stub
  94. return "enchantall";
  95. }
  96.  
  97. @Override
  98. public List<String> getTabCompletions(MinecraftServer arg0, ICommandSender arg1, String[] arg2, BlockPos arg3) {
  99. // TODO Auto-generated method stub
  100. List<String> empty = new ArrayList<>();
  101. return empty;
  102. }
  103.  
  104. @Override
  105. public String getUsage(ICommandSender arg0) {
  106. // TODO Auto-generated method stub
  107. return "enchanall";
  108. }
  109.  
  110. @Override
  111. public boolean isUsernameIndex(String[] arg0, int arg1) {
  112. // TODO Auto-generated method stub
  113. return false;
  114. }
  115.  
  116. @Override
  117. public int compareTo(ICommand arg0) {
  118. // TODO Auto-generated method stub
  119. return 0;
  120. }
  121.  
  122. @Override
  123. public boolean allowUsageWithoutPrefix(ICommandSender arg0, String arg1) {
  124. // TODO Auto-generated method stub
  125. return false;
  126. }
  127. }
  128. package com.Traumatophobia.prefixmod;
  129.  
  130. import java.util.ArrayList;
  131. import java.util.List;
  132.  
  133. import com.Traumatophobia.SkyblockMod.proxy.CommonProxy;
  134.  
  135.  
  136. import net.minecraft.client.Minecraft;
  137. import net.minecraft.client.audio.ISound;
  138. import net.minecraft.client.audio.SoundHandler;
  139. import net.minecraft.client.entity.EntityPlayerSP;
  140. import net.minecraft.command.ICommand;
  141. import net.minecraft.entity.player.EntityPlayer;
  142. import net.minecraft.init.SoundEvents;
  143. import net.minecraft.util.SoundCategory;
  144. import net.minecraft.util.SoundEvent;
  145. import net.minecraft.util.text.ITextComponent;
  146. import net.minecraft.util.text.TextComponentString;
  147. import net.minecraft.util.text.TextFormatting;
  148. import net.minecraft.world.World;
  149. import net.minecraftforge.client.ClientCommandHandler;
  150. import net.minecraftforge.client.event.ClientChatEvent;
  151. import net.minecraftforge.client.event.ClientChatReceivedEvent;
  152. import net.minecraftforge.client.event.RenderGameOverlayEvent;
  153. import net.minecraftforge.client.event.sound.SoundLoadEvent;
  154. import net.minecraftforge.common.MinecraftForge;
  155. import net.minecraftforge.event.CommandEvent;
  156. import net.minecraftforge.event.ServerChatEvent;
  157. import net.minecraftforge.event.world.NoteBlockEvent.Note;
  158. import net.minecraftforge.fml.common.FMLCommonHandler;
  159. import net.minecraftforge.fml.common.Mod;
  160. import net.minecraftforge.fml.common.Mod.EventHandler;
  161. import net.minecraftforge.fml.common.Mod.Instance;
  162. import net.minecraftforge.fml.common.SidedProxy;
  163. import net.minecraftforge.fml.common.event.FMLInitializationEvent;
  164. import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
  165. import net.minecraftforge.fml.common.event.FMLServerStartingEvent;
  166. import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
  167. import net.minecraftforge.fml.common.gameevent.PlayerEvent;
  168. import net.minecraftforge.fml.common.gameevent.TickEvent.ClientTickEvent;
  169.  
  170.  
  171.  
  172. @Mod(modid = Reference.MOD_ID, name = Reference.NAME, version = Reference.VERSION, acceptedMinecraftVersions = Reference.ACCEPTED_VERSIONS)
  173. public class PrefixMod {
  174.  
  175.  
  176. public static boolean toggled = true;
  177. @Instance
  178. public static PrefixMod instance;
  179.  
  180. @SidedProxy(clientSide = Reference.CLIENT_PROXY_CLASS, serverSide = Reference.SERVER_PROXY_CLASS)
  181. public static CommonProxy proxy;
  182.  
  183.  
  184. @EventHandler
  185. public void init(FMLInitializationEvent event)
  186. {
  187. FMLCommonHandler.instance().bus().register(this);
  188.  
  189. }
  190. @EventHandler
  191. public void serverLoad(FMLPostInitializationEvent event)
  192. {
  193. ClientCommandHandler.instance.registerCommand(new ToggleNotify());
  194. ClientCommandHandler.instance.registerCommand(new SetPrefix());
  195. ClientCommandHandler.instance.registerCommand(new ToggleLottery());
  196. ClientCommandHandler.instance.registerCommand(new ToggleVote());
  197. ClientCommandHandler.instance.registerCommand(new ToggleTips());
  198. ClientCommandHandler.instance.registerCommand(new ToggleAll());
  199. ClientCommandHandler.instance.registerCommand(new EnchantAll());
  200. }
  201.  
  202. public static boolean loggedin = false;
  203.  
  204.  
  205. public static int pressTime = 0;
  206. public static boolean enchantsword = false;
  207. public static boolean playsound = false;
  208. public static boolean enchanttool = false;
  209. public static boolean enchanttorso = false;
  210. public static boolean enchantbow = false;
  211. public static boolean enchanthelmet = false;
  212. public static boolean enchantboots = false;
  213. public static boolean enchantrod = false;
  214. public static boolean enchantother = false;
  215. public static boolean enchant = false;
  216.  
  217. @SubscribeEvent
  218. public void onPlayerTick(ClientTickEvent event) {
  219. if (enchant == true) {
  220. try {
  221. if (pressTime == 0 && enchantsword == true) {
  222. Minecraft.getMinecraft().player.sendChatMessage("/enchant sharpness 5");
  223. }
  224. else if (pressTime == 40 && enchantsword == true) {
  225. Minecraft.getMinecraft().player.sendChatMessage("/enchant smite 5");
  226. }
  227. else if (pressTime == 80 && enchantsword == true) {
  228. Minecraft.getMinecraft().player.sendChatMessage("/enchant baneofarthropods 5");
  229. }
  230. else if (pressTime == 120 && enchantsword == true) {
  231. Minecraft.getMinecraft().player.sendChatMessage("/enchant fireaspect 2");
  232. }
  233. else if (pressTime == 160 && enchantsword == true) {
  234. Minecraft.getMinecraft().player.sendChatMessage("/enchant looting 3");
  235. }
  236. else if (pressTime == 200 && enchantsword == true) {
  237. Minecraft.getMinecraft().player.sendChatMessage("/enchant knockback 2");
  238. }
  239. else if (pressTime == 240 && enchantsword == true) {
  240. Minecraft.getMinecraft().player.sendChatMessage("/enchant sweepingedge 3");
  241. }
  242. else if (pressTime == 280 && enchantsword == true) {
  243. Minecraft.getMinecraft().player.sendChatMessage("/enchant unbreaking 3");
  244. }
  245. else if (pressTime == 320 && enchantsword == true) {
  246. Minecraft.getMinecraft().player.sendChatMessage("/enchant mending 1");
  247. enchantsword = false;
  248. enchant = false;
  249. }
  250. if (pressTime == 0 && enchanttool == true) {
  251. Minecraft.getMinecraft().player.sendChatMessage("/enchant efficiency 5");
  252. }
  253. else if (pressTime == 40 && enchanttool == true) {
  254. Minecraft.getMinecraft().player.sendChatMessage("/enchant unbreaking 3");
  255. }
  256. else if (pressTime == 80 && enchanttool == true) {
  257. Minecraft.getMinecraft().player.sendChatMessage("/enchant fortune 3");
  258. }
  259. else if (pressTime == 120 && enchanttool == true) {
  260. Minecraft.getMinecraft().player.sendChatMessage("/enchant mending 1");
  261. enchanttool = false;
  262. enchant = false;
  263. }
  264. if (pressTime == 0 && enchanttorso == true) {
  265. Minecraft.getMinecraft().player.sendChatMessage("/enchant protection 4");
  266. }
  267. else if (pressTime == 40 && enchanttorso == true) {
  268. Minecraft.getMinecraft().player.sendChatMessage("/enchant fireprotection 4");
  269. }
  270. else if (pressTime == 80 && enchanttorso == true) {
  271. Minecraft.getMinecraft().player.sendChatMessage("/enchant blastprotection 4");
  272. }
  273. else if (pressTime == 120 && enchanttorso == true) {
  274. Minecraft.getMinecraft().player.sendChatMessage("/enchant projectileprotection 4");
  275. }
  276. else if (pressTime == 160 && enchanttorso == true) {
  277. Minecraft.getMinecraft().player.sendChatMessage("/enchant unbreaking 3");
  278. }
  279. else if (pressTime == 200 && enchanttorso == true) {
  280. Minecraft.getMinecraft().player.sendChatMessage("/enchant thorns 3");
  281. }
  282. else if (pressTime == 240 && enchanttorso == true) {
  283. Minecraft.getMinecraft().player.sendChatMessage("/enchant mending 1");
  284. enchanttorso = false;
  285. enchant = false;
  286. }
  287.  
  288. if (pressTime == 0 && enchantbow == true) {
  289. Minecraft.getMinecraft().player.sendChatMessage("/enchant power 5");
  290. }
  291. else if (pressTime == 40 && enchantbow == true) {
  292. Minecraft.getMinecraft().player.sendChatMessage("/enchant punch 2");
  293. }
  294. else if (pressTime == 80 && enchantbow == true) {
  295. Minecraft.getMinecraft().player.sendChatMessage("/enchant unbreaking 3");
  296. }
  297. else if (pressTime == 120 && enchantbow == true) {
  298. Minecraft.getMinecraft().player.sendChatMessage("/enchant flame 1");
  299. }
  300. else if (pressTime == 160 && enchantbow == true) {
  301. Minecraft.getMinecraft().player.sendChatMessage("/enchant infinity 1");
  302. enchantbow = false;
  303. enchant = false;
  304. }
  305.  
  306. if (pressTime == 0 && enchanthelmet == true) {
  307. Minecraft.getMinecraft().player.sendChatMessage("/enchant protection 4");
  308. }
  309. else if (pressTime == 40 && enchanthelmet == true) {
  310. Minecraft.getMinecraft().player.sendChatMessage("/enchant fireprotection 4");
  311. }
  312. else if (pressTime == 80 && enchanthelmet == true) {
  313. Minecraft.getMinecraft().player.sendChatMessage("/enchant blastprotection 4");
  314. }
  315. else if (pressTime == 120 && enchanthelmet == true) {
  316. Minecraft.getMinecraft().player.sendChatMessage("/enchant projectileprotection 4");
  317. }
  318. else if (pressTime == 160 && enchanthelmet == true) {
  319. Minecraft.getMinecraft().player.sendChatMessage("/enchant unbreaking 3");
  320. }
  321. else if (pressTime == 200 && enchanthelmet == true) {
  322. Minecraft.getMinecraft().player.sendChatMessage("/enchant thorns 3");
  323. }
  324. else if (pressTime == 240 && enchanthelmet == true) {
  325. Minecraft.getMinecraft().player.sendChatMessage("/enchant mending 1");
  326. }
  327. else if (pressTime == 280 && enchanthelmet == true) {
  328. Minecraft.getMinecraft().player.sendChatMessage("/enchant respiration 3");
  329. }
  330. else if (pressTime == 320 && enchanthelmet == true) {
  331. Minecraft.getMinecraft().player.sendChatMessage("/enchant aquaaffinity 1");
  332. enchanthelmet = false;
  333. enchant = false;
  334. }
  335. if (pressTime == 0 && enchantboots == true) {
  336. Minecraft.getMinecraft().player.sendChatMessage("/enchant protection 4");
  337. }
  338. else if (pressTime == 40 && enchantboots == true) {
  339. Minecraft.getMinecraft().player.sendChatMessage("/enchant fireprotection 4");
  340. }
  341. else if (pressTime == 80 && enchantboots == true) {
  342. Minecraft.getMinecraft().player.sendChatMessage("/enchant blastprotection 4");
  343. }
  344. else if (pressTime == 120 && enchantboots == true) {
  345. Minecraft.getMinecraft().player.sendChatMessage("/enchant projectileprotection 4");
  346. }
  347. else if (pressTime == 160 && enchantboots == true) {
  348. Minecraft.getMinecraft().player.sendChatMessage("/enchant unbreaking 3");
  349. }
  350. else if (pressTime == 200 && enchantboots == true) {
  351. Minecraft.getMinecraft().player.sendChatMessage("/enchant thorns 3");
  352. }
  353. else if (pressTime == 240 && enchantboots == true) {
  354. Minecraft.getMinecraft().player.sendChatMessage("/enchant mending 1");
  355. }
  356. else if (pressTime == 280 && enchantboots == true) {
  357. Minecraft.getMinecraft().player.sendChatMessage("/enchant depth_strider 3");
  358. }
  359. else if (pressTime == 320 && enchantboots == true) {
  360. Minecraft.getMinecraft().player.sendChatMessage("/enchant featherfalling 4");
  361. enchantboots = false;
  362. enchant = false;
  363. }
  364. if (pressTime == 0 && enchantrod == true) {
  365. Minecraft.getMinecraft().player.sendChatMessage("/enchant lure 3");
  366. }
  367. else if (pressTime == 40 && enchantrod == true) {
  368. Minecraft.getMinecraft().player.sendChatMessage("/enchant luckofthesea 3");
  369. }
  370. else if (pressTime == 80 && enchantrod == true) {
  371. Minecraft.getMinecraft().player.sendChatMessage("/enchant unbreaking 3");
  372. }
  373. else if (pressTime == 120 && enchantrod == true) {
  374. Minecraft.getMinecraft().player.sendChatMessage("/enchant mending 1");
  375. enchantrod = false;
  376. enchant = false;
  377. }
  378. if (pressTime == 0 && enchantother == true) {
  379. Minecraft.getMinecraft().player.sendChatMessage("/enchant unbreaking 3");
  380. }
  381. else if (pressTime == 40 && enchantother == true) {
  382. Minecraft.getMinecraft().player.sendChatMessage("/enchant mending 1");
  383. PrefixMod.enchantother = false;
  384. enchant = false;
  385. }
  386.  
  387. pressTime++;
  388. }
  389. catch (Exception e) {
  390. ;
  391. }
  392. }
  393.  
  394. }
  395.  
  396. @SubscribeEvent
  397. public void editChat(ClientChatEvent event) {
  398.  
  399. if (event.getMessage().startsWith("/")) {
  400. ;
  401. }
  402. else {
  403. event.setMessage(SetPrefix.ChatPrefix+event.getMessage());
  404. }
  405.  
  406. }
  407.  
  408.  
  409. List<String> nicknames = new ArrayList<String>();
  410. nicknames.add("test");
  411.  
  412.  
  413.  
  414.  
  415. @SubscribeEvent
  416. public void onChat(ClientChatReceivedEvent event) {
  417. if (loggedin == false) {
  418. Minecraft.getMinecraft().player.sendChatMessage("/fly");
  419. loggedin = true;
  420. }
  421. event.setCanceled(false);
  422. boolean changechat = false;
  423. String message = event.getMessage().getFormattedText();
  424. String message2 = event.getMessage().getUnformattedText();
  425. String[] splitmessage2 = message2.split(" ");
  426. String[] splitmessage = message.split(" ");
  427. String newstring = "";
  428. String playername = Minecraft.getMinecraft().player.getName();
  429.  
  430. if (message2.contains("[SBLottery]") && message2.startsWith("[S") && ToggleLottery.Toggled == true) {
  431. event.setCanceled(true);
  432. }
  433.  
  434. try {
  435. if (splitmessage2[3].contains("vote.skyblock.net") && ToggleVote.Toggled == true) {
  436. event.setCanceled(true);
  437. }
  438. }
  439. catch (Exception e) {
  440. ;
  441. }
  442.  
  443. if (message2.contains("[Skyblock]") && message2.startsWith("[S") && ToggleTips.Toggled == true) {
  444. event.setCanceled(true);
  445. }
  446.  
  447. for (int i = 0; i < splitmessage.length; i++) {
  448. if ((splitmessage[i].startsWith("<") && splitmessage[i].endsWith(">")) || (splitmessage[i].endsWith(":"))) {
  449. newstring += " "+splitmessage[i];
  450. }
  451.  
  452. else if (splitmessage[i].contains(playername) && toggled == true) {
  453.  
  454.  
  455. World world = Minecraft.getMinecraft().world;
  456. EntityPlayer player = Minecraft.getMinecraft().player;
  457. changechat = true;
  458. playsound = true;
  459. playSound(world, player);
  460. boolean success = true;
  461. try {
  462. String[] splitAgain = splitmessage[i].split(playername);
  463. String extra = splitAgain[1];
  464. String extra2 = splitAgain[0];
  465. newstring += extra2 + " §e"+playername + "§f" + extra;
  466.  
  467. }
  468. catch (Exception e) {
  469. success = false;
  470. }
  471.  
  472. if (success == false) {
  473. newstring += " §e"+playername +"§f" ;
  474. }
  475. }
  476.  
  477. else {
  478. newstring += " "+splitmessage[i];
  479. }
  480. }
  481. if (changechat == true) {
  482. }
  483.  
  484. ITextComponent newmessage = new TextComponentString(newstring);
  485. event.setMessage(newmessage);
  486. }
  487.  
  488.  
  489. private void playSound(World world, EntityPlayer player) {
  490. if (playsound == true) {
  491. world.playSound(player, player.getPosition(), SoundEvents.BLOCK_NOTE_BELL, SoundCategory.MUSIC, 10, 5);
  492. playsound = false;
  493. }
  494. }
  495.  
  496. }
  497.  
  498.  
  499. package com.Traumatophobia.prefixmod;
  500.  
  501. public class Reference {
  502. //Tells minecraft the details of mod
  503. public static final String MOD_ID = "tsb";
  504. public static final String NAME = "Skyblock Mod";
  505. public static final String VERSION = "0.1";
  506. public static final String ACCEPTED_VERSIONS = "[1.12,)";
  507.  
  508. //Specific for proxies
  509. public static final String CLIENT_PROXY_CLASS = "com.Traumatophobia.SkyblockMod.proxy.ClientProxy";
  510. public static final String SERVER_PROXY_CLASS = "com.Traumatophobia.SkyblockMod.proxy.ServerProxy";
  511.  
  512. }
  513. package com.Traumatophobia.prefixmod;
  514.  
  515. import java.util.ArrayList;
  516. import java.util.List;
  517.  
  518. import net.minecraft.client.Minecraft;
  519. import net.minecraft.command.CommandException;
  520. import net.minecraft.command.ICommand;
  521. import net.minecraft.command.ICommandSender;
  522. import net.minecraft.server.MinecraftServer;
  523. import net.minecraft.util.math.BlockPos;
  524. import net.minecraft.util.text.ITextComponent;
  525. import net.minecraft.util.text.TextComponentString;
  526. import net.minecraft.util.text.TextFormatting;
  527. import net.minecraftforge.client.IClientCommand;
  528.  
  529. public class SetPrefix implements IClientCommand {
  530.  
  531. public static String ChatPrefix = "";
  532.  
  533. private final List aliases;
  534.  
  535. public SetPrefix()
  536. {
  537. aliases = new ArrayList();
  538. aliases.add("sprefix");
  539. aliases.add("scp");
  540.  
  541. }
  542.  
  543. @Override
  544. public boolean checkPermission(MinecraftServer arg0, ICommandSender arg1) {
  545. // TODO Auto-generated method stub
  546. return true;
  547. }
  548.  
  549. @Override
  550. public void execute(MinecraftServer arg0, ICommandSender arg1, String[] arg2) throws CommandException {
  551. boolean nospace = false;
  552. if (arg2.length >= 2) {
  553. if (arg2[1].contains("nospace")) {
  554. nospace = true;
  555. Minecraft.getMinecraft().player.sendMessage(new TextComponentString("Space after message disabled"));
  556. }
  557. else {
  558. Minecraft.getMinecraft().player.sendMessage(new TextComponentString("Spaces are not allowed!"));
  559. }
  560. }
  561. if (arg2.length == 0) {
  562. Minecraft.getMinecraft().player.sendMessage(new TextComponentString("Prefix Reset"));
  563. ChatPrefix = "";
  564. }
  565.  
  566.  
  567.  
  568. else {
  569. String rawstring = arg2[0];
  570. String[] splitformat = rawstring.split("&");
  571. String newstring = "";
  572.  
  573. if (rawstring.contains("&")) {
  574. for (int i = 0; i < splitformat.length; i++) {
  575. if (splitformat[i].startsWith("a")) {
  576. splitformat[i] = splitformat[i].substring(1);
  577. newstring += TextFormatting.GREEN + splitformat[i];
  578. }
  579. else if (splitformat[i].startsWith("b")) {
  580. splitformat[i] = splitformat[i].substring(1);
  581. newstring += TextFormatting.AQUA + splitformat[i];
  582. }
  583. else if (splitformat[i].startsWith("c")) {
  584. splitformat[i] = splitformat[i].substring(1);
  585. newstring += TextFormatting.RED + splitformat[i];
  586. }
  587. else if (splitformat[i].startsWith("d")) {
  588. splitformat[i] = splitformat[i].substring(1);
  589. newstring += TextFormatting.LIGHT_PURPLE + splitformat[i];
  590. }
  591. else if (splitformat[i].startsWith("e")) {
  592. splitformat[i] = splitformat[i].substring(1);
  593. newstring += TextFormatting.YELLOW + splitformat[i];
  594. }
  595. else if (splitformat[i].startsWith("f")) {
  596. splitformat[i] = splitformat[i].substring(1);
  597. newstring += TextFormatting.WHITE + splitformat[i];
  598. }
  599. else if (splitformat[i].startsWith("0")) {
  600. splitformat[i] = splitformat[i].substring(1);
  601. newstring += TextFormatting.BLACK + splitformat[i];
  602. }
  603. else if (splitformat[i].startsWith("1")) {
  604. splitformat[i] = splitformat[i].substring(1);
  605. newstring += TextFormatting.DARK_BLUE + splitformat[i];
  606. }
  607. else if (splitformat[i].startsWith("2")) {
  608. splitformat[i] = splitformat[i].substring(1);
  609. newstring += TextFormatting.DARK_GREEN + splitformat[i];
  610. }
  611. else if (splitformat[i].startsWith("3")) {
  612. splitformat[i] = splitformat[i].substring(1);
  613. newstring += TextFormatting.DARK_AQUA + splitformat[i];
  614. }
  615. else if (splitformat[i].startsWith("4")) {
  616. splitformat[i] = splitformat[i].substring(1);
  617. newstring += TextFormatting.DARK_RED + splitformat[i];
  618. }
  619. else if (splitformat[i].startsWith("5")) {
  620. splitformat[i] = splitformat[i].substring(1);
  621. newstring += TextFormatting.DARK_PURPLE + splitformat[i];
  622. }
  623. else if (splitformat[i].startsWith("6")) {
  624. splitformat[i] = splitformat[i].substring(1);
  625. newstring += TextFormatting.GOLD + splitformat[i];
  626. }
  627. else if (splitformat[i].startsWith("7")) {
  628. splitformat[i] = splitformat[i].substring(1);
  629. newstring += TextFormatting.GRAY + splitformat[i];
  630. }
  631. else if (splitformat[i].startsWith("8")) {
  632. splitformat[i] = splitformat[i].substring(1);
  633. newstring += TextFormatting.DARK_GRAY + splitformat[i];
  634. }
  635. else if (splitformat[i].startsWith("9")) {
  636. splitformat[i] = splitformat[i].substring(1);
  637. newstring += TextFormatting.BLUE + splitformat[i];
  638. }
  639. else if (splitformat[i].startsWith("k")) {
  640. splitformat[i] = splitformat[i].substring(1);
  641. newstring += TextFormatting.OBFUSCATED + splitformat[i];
  642. }
  643. else if (splitformat[i].startsWith("l")) {
  644. splitformat[i] = splitformat[i].substring(1);
  645. newstring += TextFormatting.BOLD + splitformat[i];
  646. }
  647. else if (splitformat[i].startsWith("m")) {
  648. splitformat[i] = splitformat[i].substring(1);
  649. newstring += TextFormatting.STRIKETHROUGH + splitformat[i];
  650. }
  651. else if (splitformat[i].startsWith("n")) {
  652. splitformat[i] = splitformat[i].substring(1);
  653. newstring += TextFormatting.UNDERLINE + splitformat[i];
  654. }
  655. else if (splitformat[i].startsWith("o")) {
  656. splitformat[i] = splitformat[i].substring(1);
  657. newstring += TextFormatting.ITALIC + splitformat[i];
  658. }
  659. else if (splitformat[i].startsWith("r")) {
  660. splitformat[i] = splitformat[i].substring(1);
  661. newstring += TextFormatting.RESET + splitformat[i];
  662. }
  663. else {
  664. newstring += splitformat[i];
  665. }
  666. }
  667. }
  668. else {
  669. newstring = rawstring;
  670. }
  671.  
  672. if (nospace == false) {
  673. Minecraft.getMinecraft().player.sendMessage(new TextComponentString("Your prefix: "+newstring+" [Chat]"));
  674. ChatPrefix = rawstring+" ";
  675. }
  676. if (nospace == true) {
  677. Minecraft.getMinecraft().player.sendMessage(new TextComponentString("Your prefix: "+newstring+"[Chat]"));
  678. ChatPrefix = rawstring+"";
  679. }
  680. }
  681.  
  682.  
  683. }
  684.  
  685. @Override
  686. public List<String> getAliases() {
  687. // TODO Auto-generated method stub
  688. return this.aliases;
  689. }
  690.  
  691. @Override
  692. public String getName() {
  693. // TODO Auto-generated method stub
  694. return "setchatprefix";
  695. }
  696.  
  697. @Override
  698. public List<String> getTabCompletions(MinecraftServer arg0, ICommandSender arg1, String[] arg2, BlockPos arg3) {
  699. // TODO Auto-generated method stub
  700. List<String> empty = new ArrayList<>();
  701. return empty;
  702. }
  703.  
  704. @Override
  705. public String getUsage(ICommandSender arg0) {
  706. // TODO Auto-generated method stub
  707. return "setprefix <text>";
  708. }
  709.  
  710. @Override
  711. public boolean isUsernameIndex(String[] arg0, int arg1) {
  712. // TODO Auto-generated method stub
  713. return false;
  714. }
  715.  
  716. @Override
  717. public int compareTo(ICommand arg0) {
  718. // TODO Auto-generated method stub
  719. return 0;
  720. }
  721.  
  722. @Override
  723. public boolean allowUsageWithoutPrefix(ICommandSender arg0, String arg1) {
  724. // TODO Auto-generated method stub
  725. return false;
  726. }
  727.  
  728. }
  729.  
  730. package com.Traumatophobia.prefixmod;
  731.  
  732. import java.util.ArrayList;
  733. import java.util.List;
  734.  
  735. import net.minecraft.client.Minecraft;
  736. import net.minecraft.command.CommandException;
  737. import net.minecraft.command.ICommand;
  738. import net.minecraft.command.ICommandSender;
  739. import net.minecraft.server.MinecraftServer;
  740. import net.minecraft.util.math.BlockPos;
  741. import net.minecraft.util.text.ITextComponent;
  742. import net.minecraft.util.text.TextComponentString;
  743. import net.minecraftforge.client.IClientCommand;
  744.  
  745. public class ToggleAll implements IClientCommand {
  746. public static boolean Toggled = false;
  747.  
  748. private final List aliases;
  749.  
  750. public ToggleAll()
  751. {
  752. aliases = new ArrayList();
  753. aliases.add("ta");
  754. aliases.add("togglea");
  755.  
  756. }
  757.  
  758.  
  759. @Override
  760. public boolean checkPermission(MinecraftServer arg0, ICommandSender arg1) {
  761. // TODO Auto-generated method stub
  762. return true;
  763. }
  764.  
  765. @Override
  766. public void execute(MinecraftServer arg0, ICommandSender arg1, String[] arg2) throws CommandException {
  767. ITextComponent telluser = new TextComponentString("");
  768. if (Toggled == true) {
  769. Toggled = false;
  770. ToggleLottery.Toggled = false;
  771. ToggleTips.Toggled = false;
  772. ToggleVote.Toggled = false;
  773. telluser.appendText("All notifications enabled");
  774. }
  775. else if (Toggled == false) {
  776. Toggled = true;
  777. ToggleLottery.Toggled = true;
  778. ToggleTips.Toggled = true;
  779. ToggleVote.Toggled = true;
  780. telluser.appendText("All notifications disabled");
  781.  
  782. }
  783. Minecraft.getMinecraft().player.sendMessage(telluser);
  784.  
  785. }
  786.  
  787.  
  788.  
  789. @Override
  790. public List<String> getAliases() {
  791. // TODO Auto-generated method stub
  792. return this.aliases;
  793. }
  794.  
  795. @Override
  796. public String getName() {
  797. // TODO Auto-generated method stub
  798. return "toggleall";
  799. }
  800.  
  801. @Override
  802. public List<String> getTabCompletions(MinecraftServer arg0, ICommandSender arg1, String[] arg2, BlockPos arg3) {
  803. // TODO Auto-generated method stub
  804. List<String> empty = new ArrayList<>();
  805. return empty;
  806. }
  807.  
  808. @Override
  809. public String getUsage(ICommandSender arg0) {
  810. // TODO Auto-generated method stub
  811. return "toggleall";
  812. }
  813.  
  814. @Override
  815. public boolean isUsernameIndex(String[] arg0, int arg1) {
  816. // TODO Auto-generated method stub
  817. return false;
  818. }
  819.  
  820. @Override
  821. public int compareTo(ICommand arg0) {
  822. // TODO Auto-generated method stub
  823. return 0;
  824. }
  825.  
  826. @Override
  827. public boolean allowUsageWithoutPrefix(ICommandSender arg0, String arg1) {
  828. // TODO Auto-generated method stub
  829. return false;
  830. }
  831.  
  832. }
  833.  
  834. package com.Traumatophobia.prefixmod;
  835.  
  836. import java.util.ArrayList;
  837. import java.util.List;
  838.  
  839. import net.minecraft.client.Minecraft;
  840. import net.minecraft.command.CommandException;
  841. import net.minecraft.command.ICommand;
  842. import net.minecraft.command.ICommandSender;
  843. import net.minecraft.server.MinecraftServer;
  844. import net.minecraft.util.math.BlockPos;
  845. import net.minecraft.util.text.ITextComponent;
  846. import net.minecraft.util.text.TextComponentString;
  847. import net.minecraftforge.client.IClientCommand;
  848.  
  849. public class ToggleLottery implements IClientCommand {
  850. public static boolean Toggled = false;
  851.  
  852. private final List aliases;
  853.  
  854. public ToggleLottery()
  855. {
  856. aliases = new ArrayList();
  857. aliases.add("tl");
  858. aliases.add("togglelot");
  859.  
  860. }
  861.  
  862.  
  863. @Override
  864. public boolean checkPermission(MinecraftServer arg0, ICommandSender arg1) {
  865. // TODO Auto-generated method stub
  866. return true;
  867. }
  868.  
  869. @Override
  870. public void execute(MinecraftServer arg0, ICommandSender arg1, String[] arg2) throws CommandException {
  871. ITextComponent telluser = new TextComponentString("");
  872. if (Toggled == true) {
  873. Toggled = false;
  874. telluser.appendText("Lottery notifications enabled");
  875. }
  876. else if (Toggled == false) {
  877. Toggled = true;
  878. telluser.appendText("Lottery notifications disabled");
  879.  
  880. }
  881. Minecraft.getMinecraft().player.sendMessage(telluser);
  882.  
  883. }
  884.  
  885.  
  886.  
  887. @Override
  888. public List<String> getAliases() {
  889. // TODO Auto-generated method stub
  890. return this.aliases;
  891. }
  892.  
  893. @Override
  894. public String getName() {
  895. // TODO Auto-generated method stub
  896. return "togglelottery";
  897. }
  898.  
  899. @Override
  900. public List<String> getTabCompletions(MinecraftServer arg0, ICommandSender arg1, String[] arg2, BlockPos arg3) {
  901. // TODO Auto-generated method stub
  902. List<String> empty = new ArrayList<>();
  903. return empty;
  904. }
  905.  
  906. @Override
  907. public String getUsage(ICommandSender arg0) {
  908. // TODO Auto-generated method stub
  909. return "togglelottery";
  910. }
  911.  
  912. @Override
  913. public boolean isUsernameIndex(String[] arg0, int arg1) {
  914. // TODO Auto-generated method stub
  915. return false;
  916. }
  917.  
  918. @Override
  919. public int compareTo(ICommand arg0) {
  920. // TODO Auto-generated method stub
  921. return 0;
  922. }
  923.  
  924. @Override
  925. public boolean allowUsageWithoutPrefix(ICommandSender arg0, String arg1) {
  926. // TODO Auto-generated method stub
  927. return false;
  928. }
  929.  
  930. }
  931.  
  932. package com.Traumatophobia.prefixmod;
  933.  
  934. import java.util.List;
  935.  
  936. import net.minecraft.client.Minecraft;
  937. import net.minecraft.command.CommandException;
  938. import net.minecraft.command.ICommand;
  939. import net.minecraft.command.ICommandSender;
  940. import net.minecraft.server.MinecraftServer;
  941. import net.minecraft.util.math.BlockPos;
  942. import net.minecraft.util.text.ITextComponent;
  943. import net.minecraft.util.text.TextComponentString;
  944. import net.minecraftforge.client.IClientCommand;
  945. import java.util.ArrayList;
  946.  
  947. public class ToggleNotify implements IClientCommand {
  948. private final List aliases;
  949.  
  950. public ToggleNotify() {
  951. aliases = new ArrayList();
  952. aliases.add("togglenotify");
  953. aliases.add("alert");
  954. }
  955.  
  956. @Override
  957. public boolean checkPermission(MinecraftServer arg0, ICommandSender arg1) {
  958. // TODO Auto-generated method stub
  959. return true;
  960. }
  961.  
  962. @Override
  963. public void execute(MinecraftServer arg0, ICommandSender arg1, String[] arg2) throws CommandException {
  964. ITextComponent telluser = new TextComponentString("");
  965. if (PrefixMod.toggled == true) {
  966. PrefixMod.toggled = false;
  967. telluser.appendText("Username notifications disabled");
  968. }
  969. else if (PrefixMod.toggled == false) {
  970. PrefixMod.toggled = true;
  971. telluser.appendText("Username notifications enabled");
  972.  
  973. }
  974. Minecraft.getMinecraft().player.sendMessage(telluser);
  975.  
  976. }
  977.  
  978.  
  979. @Override
  980. public List<String> getAliases() {
  981. // TODO Auto-generated method stub
  982. return this.aliases;
  983. }
  984.  
  985. @Override
  986. public String getName() {
  987. // TODO Auto-generated method stub
  988. return "notify";
  989. }
  990.  
  991. @Override
  992. public List<String> getTabCompletions(MinecraftServer arg0, ICommandSender arg1, String[] arg2, BlockPos arg3) {
  993. // TODO Auto-generated method stub
  994. List<String> empty = new ArrayList<>();
  995. return empty;
  996. }
  997.  
  998. @Override
  999. public String getUsage(ICommandSender arg0) {
  1000. // TODO Auto-generated method stub
  1001. return "notify";
  1002. }
  1003.  
  1004. @Override
  1005. public boolean isUsernameIndex(String[] arg0, int arg1) {
  1006. // TODO Auto-generated method stub
  1007. return false;
  1008. }
  1009.  
  1010. @Override
  1011. public int compareTo(ICommand o) {
  1012. // TODO Auto-generated method stub
  1013. return 0;
  1014. }
  1015.  
  1016. @Override
  1017. public boolean allowUsageWithoutPrefix(ICommandSender arg0, String arg1) {
  1018. // TODO Auto-generated method stub
  1019. return false;
  1020. }
  1021.  
  1022. }
  1023.  
  1024. package com.Traumatophobia.prefixmod;
  1025.  
  1026. import java.util.ArrayList;
  1027. import java.util.List;
  1028.  
  1029. import net.minecraft.client.Minecraft;
  1030. import net.minecraft.command.CommandException;
  1031. import net.minecraft.command.ICommand;
  1032. import net.minecraft.command.ICommandSender;
  1033. import net.minecraft.server.MinecraftServer;
  1034. import net.minecraft.util.math.BlockPos;
  1035. import net.minecraft.util.text.ITextComponent;
  1036. import net.minecraft.util.text.TextComponentString;
  1037. import net.minecraftforge.client.IClientCommand;
  1038.  
  1039. public class ToggleTips implements IClientCommand {
  1040. public static boolean Toggled = false;
  1041.  
  1042. private final List aliases;
  1043.  
  1044. public ToggleTips()
  1045. {
  1046. aliases = new ArrayList();
  1047. aliases.add("tt");
  1048. aliases.add("toggletip");
  1049.  
  1050. }
  1051.  
  1052.  
  1053. @Override
  1054. public boolean checkPermission(MinecraftServer arg0, ICommandSender arg1) {
  1055. // TODO Auto-generated method stub
  1056. return true;
  1057. }
  1058.  
  1059. @Override
  1060. public void execute(MinecraftServer arg0, ICommandSender arg1, String[] arg2) throws CommandException {
  1061. ITextComponent telluser = new TextComponentString("");
  1062. if (Toggled == true) {
  1063. Toggled = false;
  1064. telluser.appendText("Skyblock tips enabled");
  1065. }
  1066. else if (Toggled == false) {
  1067. Toggled = true;
  1068. telluser.appendText("Skyblock tips disabled");
  1069.  
  1070. }
  1071. Minecraft.getMinecraft().player.sendMessage(telluser);
  1072.  
  1073. }
  1074.  
  1075.  
  1076.  
  1077. @Override
  1078. public List<String> getAliases() {
  1079. // TODO Auto-generated method stub
  1080. return this.aliases;
  1081. }
  1082.  
  1083. @Override
  1084. public String getName() {
  1085. // TODO Auto-generated method stub
  1086. return "toggletips";
  1087. }
  1088.  
  1089. @Override
  1090. public List<String> getTabCompletions(MinecraftServer arg0, ICommandSender arg1, String[] arg2, BlockPos arg3) {
  1091. // TODO Auto-generated method stub
  1092. List<String> empty = new ArrayList<>();
  1093. return empty;
  1094. }
  1095.  
  1096. @Override
  1097. public String getUsage(ICommandSender arg0) {
  1098. // TODO Auto-generated method stub
  1099. return "toggletips";
  1100. }
  1101.  
  1102. @Override
  1103. public boolean isUsernameIndex(String[] arg0, int arg1) {
  1104. // TODO Auto-generated method stub
  1105. return false;
  1106. }
  1107.  
  1108. @Override
  1109. public int compareTo(ICommand arg0) {
  1110. // TODO Auto-generated method stub
  1111. return 0;
  1112. }
  1113.  
  1114. @Override
  1115. public boolean allowUsageWithoutPrefix(ICommandSender arg0, String arg1) {
  1116. // TODO Auto-generated method stub
  1117. return false;
  1118. }
  1119.  
  1120. }
  1121.  
  1122. package com.Traumatophobia.prefixmod;
  1123.  
  1124. import java.util.ArrayList;
  1125. import java.util.List;
  1126.  
  1127. import net.minecraft.client.Minecraft;
  1128. import net.minecraft.command.CommandException;
  1129. import net.minecraft.command.ICommand;
  1130. import net.minecraft.command.ICommandSender;
  1131. import net.minecraft.server.MinecraftServer;
  1132. import net.minecraft.util.math.BlockPos;
  1133. import net.minecraft.util.text.ITextComponent;
  1134. import net.minecraft.util.text.TextComponentString;
  1135. import net.minecraftforge.client.IClientCommand;
  1136.  
  1137. public class ToggleVote implements IClientCommand {
  1138. public static boolean Toggled = false;
  1139.  
  1140. private final List aliases;
  1141.  
  1142. public ToggleVote()
  1143. {
  1144. aliases = new ArrayList();
  1145. aliases.add("tv");
  1146.  
  1147. }
  1148.  
  1149.  
  1150. @Override
  1151. public boolean checkPermission(MinecraftServer arg0, ICommandSender arg1) {
  1152. // TODO Auto-generated method stub
  1153. return true;
  1154. }
  1155.  
  1156. @Override
  1157. public void execute(MinecraftServer arg0, ICommandSender arg1, String[] arg2) throws CommandException {
  1158. ITextComponent telluser = new TextComponentString("");
  1159. if (Toggled == true) {
  1160. Toggled = false;
  1161. telluser.appendText("Voting notifications enabled");
  1162. }
  1163. else if (Toggled == false) {
  1164. Toggled = true;
  1165. telluser.appendText("Voting notifications disabled");
  1166.  
  1167. }
  1168. Minecraft.getMinecraft().player.sendMessage(telluser);
  1169.  
  1170. }
  1171.  
  1172.  
  1173.  
  1174. @Override
  1175. public List<String> getAliases() {
  1176. // TODO Auto-generated method stub
  1177. return this.aliases;
  1178. }
  1179.  
  1180. @Override
  1181. public String getName() {
  1182. // TODO Auto-generated method stub
  1183. return "togglevote";
  1184. }
  1185.  
  1186. @Override
  1187. public List<String> getTabCompletions(MinecraftServer arg0, ICommandSender arg1, String[] arg2, BlockPos arg3) {
  1188. // TODO Auto-generated method stub
  1189. List<String> empty = new ArrayList<>();
  1190. return empty;
  1191. }
  1192.  
  1193. @Override
  1194. public String getUsage(ICommandSender arg0) {
  1195. // TODO Auto-generated method stub
  1196. return "togglevote";
  1197. }
  1198.  
  1199. @Override
  1200. public boolean isUsernameIndex(String[] arg0, int arg1) {
  1201. // TODO Auto-generated method stub
  1202. return false;
  1203. }
  1204.  
  1205. @Override
  1206. public int compareTo(ICommand arg0) {
  1207. // TODO Auto-generated method stub
  1208. return 0;
  1209. }
  1210.  
  1211. @Override
  1212. public boolean allowUsageWithoutPrefix(ICommandSender arg0, String arg1) {
  1213. // TODO Auto-generated method stub
  1214. return false;
  1215. }
  1216.  
  1217. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement