Faction Claim Border

Discussion in 'Archived: Plugin Requests' started by ThePluginMaker, Jul 9, 2014.

Thread Status:
Not open for further replies.
  1. Offline

    ThePluginMaker

    Plugin category: Fun

    Suggested name: FactionBorder

    What I want: A plugin where you cannot claim a certain chunks from the world border. Suggestions, in the config have that you want the world border to be, and then it won't let you claim a certain amount of chunks close to the world border. The chunks are also configurable. A lot of popular faction servers have this plugin so it reduces world border glitches. You would also implement the plugin with world border (http://dev.bukkit.org/bukkit-plugins/worldborder/)

    Ideas for commands: No commands

    Ideas for permissions: No permissions

    When I'd like it by: ASAP

    Example:
    Untitled.png
    Possibly some helpful code?
    Code:java
    1. package com.division.starcache.core; import com.massivecraft.factions.event.FactionsEventChunkChange; import org.bukkit.Chunk; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.Listener; public class FactionsListener implements Listener{ private final FactionBorder FB; public FactionsListener(StarCache instance){ FB = instance; } @EventHandler(priority = EventPriority.LOW) public void onLandClaim(FactionsEventChunkChange e) { FactionClaim factionClaim = FB.getCacheEvent(); if (factionClaim == null || !factionClaim.isActive()) { return; } Chunk eventChunk = factionClaim.getEventChunk(); if (e.getChunk().asBukkitChunk().getX() == eventChunk.getX() && e.getChunk().asBukkitChunk().getZ() == eventChunk.getZ()) { e.setCancelled(true); e.getUSender().sendMessage(String.format(StarCache.chatFormat, "You cannot claim this close to the border.")); } } }
     
  2. Offline

    ThePluginMaker

  3. Offline

    ThePluginMaker

    Helpful code fix:
    Code:java
    1.  
    2. package com.division.starcache.core;
    3.  
    4. import com.massivecraft.factions.event.FactionsEventChunkChange;
    5.  
    6. import org.bukkit.Chunk;
    7. import org.bukkit.event.EventHandler;
    8. import org.bukkit.event.EventPriority;
    9. import org.bukkit.event.Listener;
    10.  
    11. public class FactionsListener implements Listener{
    12. private final StarCache sC;
    13.  
    14. public FactionsListener(StarCache instance){
    15. sC = instance;
    16. }
    17.  
    18.  
    19. @EventHandler(priority = EventPriority.LOW)
    20. public void onLandClaim(FactionsEventChunkChange e) {
    21. CacheEvent cacheEvent = sC.getCacheEvent();
    22. if (cacheEvent == null || !cacheEvent.isActive()) {
    23. return;
    24. }
    25.  
    26. Chunk eventChunk = cacheEvent.getEventChunk();
    27. if (e.getChunk().asBukkitChunk().getX() == eventChunk.getX() && e.getChunk().asBukkitChunk().getZ() == eventChunk.getZ()) {
    28. e.setCancelled(true);
    29. e.getUSender().sendMessage(String.format(StarCache.chatFormat, "You cannot claim this close to the border."));
    30. }
    31. }
    32.  
    33. }
    34.  


    this is code from one of my other plugins
     
  4. Offline

    ThePluginMaker

  5. Offline

    ThePluginMaker

  6. Offline

    xguysprison

  7. Offline

    TheCreeper280

    Bump. This would be useful
     
Thread Status:
Not open for further replies.

Share This Page