Advertisement
Guest User

Untitled

a guest
Jun 20th, 2019
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.00 KB | None | 0 0
  1. package me.douglas.noplaceinnotfactionworld;
  2.  
  3. import org.bukkit.Bukkit;
  4. import org.bukkit.ChatColor;
  5. import org.bukkit.Effect;
  6. import org.bukkit.event.EventHandler;
  7. import org.bukkit.event.Listener;
  8. import org.bukkit.event.block.BlockBreakEvent;
  9. import org.bukkit.event.block.BlockPlaceEvent;
  10. import org.bukkit.plugin.java.JavaPlugin;
  11.  
  12. import java.util.List;
  13.  
  14. public final class NoPlaceInNotFactionWorld extends JavaPlugin implements Listener {
  15.  
  16. @Override
  17. public void onEnable() {
  18. // Plugin startup logic
  19. getServer().getPluginManager().registerEvents(this, this);
  20. Bukkit.getConsoleSender().sendMessage(ChatColor.RED + "[NoBuildFactions] IS Online.");
  21. getConfig().options().copyDefaults();
  22. saveDefaultConfig();
  23.  
  24. }
  25.  
  26. @EventHandler
  27. public void onRedBreak(BlockBreakEvent e) {
  28. if ( !e.getPlayer().hasPermission("FactionsTeam.red.onBuild") )
  29. if ( e.getPlayer().getWorld().getName().equalsIgnoreCase(getConfig().getString("RedBreak")) ) {
  30. e.setCancelled(getConfig().getBoolean("redBreakT"));
  31. e.getPlayer().sendMessage(ChatColor.GOLD + "[" + ChatColor.DARK_RED + "RED" + ChatColor.GOLD + "] " + ChatColor.GREEN + "Sorry but you cannot break blocks in the Red Teams world, " + ChatColor.BOLD + e.getPlayer().getDisplayName());
  32. e.getPlayer().getLocation().getBlock().getWorld().playEffect(e.getPlayer().getLocation(), Effect.MOBSPAWNER_FLAMES, 1);
  33. }
  34. }
  35.  
  36.  
  37. @EventHandler
  38. public void onBlueBreak(BlockBreakEvent e) {
  39. if ( !e.getPlayer().hasPermission("FactionsTeam.blue.onBuild") )
  40. if ( e.getPlayer().getWorld().getName().equalsIgnoreCase(getConfig().getString("BlueBreak")) ) {
  41. e.setCancelled(getConfig().getBoolean("blueBreakT"));
  42. e.getPlayer().sendMessage(ChatColor.GOLD + "[" + ChatColor.BLUE + "BLUE" + ChatColor.GOLD + "] " + ChatColor.GREEN + "Sorry but you cannot break blocks in the Blue Teams world, " + ChatColor.BOLD + e.getPlayer().getDisplayName());
  43. e.getPlayer().getLocation().getBlock().getWorld().playEffect(e.getPlayer().getLocation(), Effect.MOBSPAWNER_FLAMES, 1);
  44. }
  45. }
  46.  
  47. @EventHandler
  48. public void onGreenBreak(BlockBreakEvent e) {
  49. if ( !e.getPlayer().hasPermission("FactionsTeam.green.onBuild") )
  50. if ( e.getPlayer().getWorld().getName().equalsIgnoreCase(getConfig().getString("GreenBreak")) ) {
  51. e.setCancelled(getConfig().getBoolean("greenBreakT"));
  52. e.getPlayer().sendMessage(ChatColor.GOLD + "[" + ChatColor.GREEN + "GREEN" + ChatColor.GOLD + "] " + ChatColor.GREEN + "Sorry but you cannot break blocks in the Green Teams world, " + ChatColor.BOLD + e.getPlayer().getDisplayName());
  53. e.getPlayer().getLocation().getBlock().getWorld().playEffect(e.getPlayer().getLocation(), Effect.MOBSPAWNER_FLAMES, 1);
  54. }
  55. }
  56.  
  57. @EventHandler
  58. public void onWhiteBreak(BlockBreakEvent e) {
  59. if ( !e.getPlayer().hasPermission("FactionsTeam.white.onBuild") )
  60. if ( e.getPlayer().getWorld().getName().equalsIgnoreCase(getConfig().getString("WhiteBreak")) ) {
  61. e.setCancelled(getConfig().getBoolean("whiteBreakT"));
  62. e.getPlayer().sendMessage(ChatColor.GOLD + "[" + ChatColor.WHITE + "WHITE" + ChatColor.GOLD + "] " + ChatColor.GREEN + "Sorry but you cannot break blocks in the White Teams world, " + ChatColor.BOLD + e.getPlayer().getDisplayName());
  63. e.getPlayer().getLocation().getBlock().getWorld().playEffect(e.getPlayer().getLocation(), Effect.MOBSPAWNER_FLAMES, 1);
  64. }
  65. }
  66.  
  67. @EventHandler
  68. public void onRedPlace(BlockPlaceEvent e) {
  69. if ( !e.getPlayer().hasPermission("FactionsTeam.red.onBuild") )
  70. if ( e.getPlayer().getWorld().getName().equalsIgnoreCase(getConfig().getString("RedPlace")) ) {
  71. e.setCancelled(getConfig().getBoolean("redPlaceT"));
  72. e.getPlayer().sendMessage(ChatColor.GOLD + "[" + ChatColor.DARK_RED + "RED" + ChatColor.GOLD + "] " + ChatColor.GREEN + "Sorry but you cannot place blocks in the Red Teams world, " + ChatColor.BOLD + e.getPlayer().getDisplayName());
  73. }
  74. }
  75.  
  76. @EventHandler
  77. public void onBluePlace(BlockPlaceEvent e) {
  78. if ( !e.getPlayer().hasPermission("FactionsTeam.blue.onBuild") )
  79. if ( e.getPlayer().getWorld().getName().equalsIgnoreCase(getConfig().getString("BluePlace")) ) {
  80. e.setCancelled(getConfig().getBoolean("bluePlaceT"));
  81. e.getPlayer().sendMessage(ChatColor.GOLD + "[" + ChatColor.BLUE + "BLUE" + ChatColor.GOLD + "] " + ChatColor.GREEN + "Sorry but you cannot place blocks in the Blue Teams world, " + ChatColor.BOLD + e.getPlayer().getDisplayName());
  82. }
  83. }
  84.  
  85. @EventHandler
  86. public void onGreenPlace(BlockPlaceEvent e) {
  87. if ( !e.getPlayer().hasPermission("FactionsTeam.green.onBuild") )
  88. if ( e.getPlayer().getWorld().getName().equalsIgnoreCase(getConfig().getString("GreenPlace")) ) {
  89. e.setCancelled(getConfig().getBoolean("greenPlaceT"));
  90. e.getPlayer().sendMessage(ChatColor.GOLD + "[" + ChatColor.GREEN + "GREEN" + ChatColor.GOLD + "] " + ChatColor.GREEN + "Sorry but you cannot place blocks in the Green Teams world, " + ChatColor.BOLD + e.getPlayer().getDisplayName());
  91. }
  92. }
  93.  
  94. @EventHandler
  95. public void onWhitePlace(BlockPlaceEvent e) {
  96. if ( !e.getPlayer().hasPermission("FactionsTeam.white.onBuild") )
  97. if ( e.getPlayer().getWorld().getName().equalsIgnoreCase(getConfig().getString("WhitePlace")) ) {
  98. e.setCancelled(getConfig().getBoolean("whitePlaceT"));
  99. e.getPlayer().sendMessage(ChatColor.GOLD + "[" + ChatColor.WHITE + "WHITE" + ChatColor.GOLD + "] " + ChatColor.GREEN + "Sorry but you cannot place blocks in the White Teams world, " + ChatColor.BOLD + e.getPlayer().getDisplayName());
  100. }
  101. }
  102. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement