本帖最后由 583736449 于 2018-7-19 00:59 编辑

ChunkView

高自定义的区块查看器
当前版本 1.0-SNAPSHOT


功能



本插件适用于派系生存,原创生存等需要占领土地的生存服务器。我之前用过几款占领土地的插件如 LandLord,MassiveFaction 等,在区块的显示上都很不如意。大多都是不能自定义的问题,有些客户端的材质甚至根本看不到。我两年前开过的一个生存服,在区块的显示上用的是站内的一款 ChunkFinder... 我不多说,自行下载尝试。

本插件的粒子及显示坐标均可自定义
你甚至可以自定义粒子显示在什么位置,以什么样的形式显示。


命令



命令作用权限



/chunkview启用或禁用粒子
/chunkview reload重载配置*





配置



  1. # 启用世界
  2. EnableWorld:
  3. - 'world'

  4. # 粒子类型
  5. ParticleType: FLAME

  6. # 粒子效果
  7. ParticleLine:
  8. - '0 0.2 0 0 5 6'
  9. - '0 0.2 0 0 5 5'
  10. - '0 0.2 0 0 5 4'
  11. - '0 0.2 0 0 5 3'
  12. - '0 0.2 0 0 5 2'
  13. - '0 0.2 0 0 5 1'
  14. - '0 0.2 0 0 5 0'
  15. - '0 0.2 0 0 5 -1'
  16. - '0 0.2 0 0 5 -2'

  17. # 粒子范围
  18. ParticleRange:
  19. - '# 0 # 0 # # 0 # # 0 # # 0 # 0 #'
  20. - '0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0'
  21. - '# 0 0 0 0 0 0 0 0 0 0 0 0 0 0 #'
  22. - '0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0'
  23. - '# 0 0 0 0 0 0 0 0 0 0 0 0 0 0 #'
  24. - '# 0 0 0 0 0 0 0 0 0 0 0 0 0 0 #'
  25. - '0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0'
  26. - '# 0 0 0 0 0 0 0 0 0 0 0 0 0 0 #'
  27. - '# 0 0 0 0 0 0 0 0 0 0 0 0 0 0 #'
  28. - '0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0'
  29. - '# 0 0 0 0 0 0 0 0 0 0 0 0 0 0 #'
  30. - '# 0 0 0 0 0 0 0 0 0 0 0 0 0 0 #'
  31. - '0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0'
  32. - '# 0 0 0 0 0 0 0 0 0 0 0 0 0 0 #'
  33. - '0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0'
  34. - '# 0 # 0 # # 0 # # 0 # # 0 # 0 #'
复制代码

截图





下载



本插件需要 TabooLib 才可运行, 下载地址见个人签名档
配置文件比较飘逸,具体意义稍后更新,突然懒惰...


ChunkView.jar (6.04 KB, 下载次数: 19)

开源



  1. package me.skymc.chunkview;

  2. import com.ilummc.tlib.resources.TLocale;
  3. import me.skymc.taboolib.entity.EntityTag;
  4. import me.skymc.taboolib.fileutils.ConfigUtils;
  5. import me.skymc.taboolib.particle.EffLib;
  6. import org.bukkit.Bukkit;
  7. import org.bukkit.block.Block;
  8. import org.bukkit.command.Command;
  9. import org.bukkit.command.CommandSender;
  10. import org.bukkit.command.ConsoleCommandSender;
  11. import org.bukkit.configuration.file.FileConfiguration;
  12. import org.bukkit.entity.Entity;
  13. import org.bukkit.entity.Player;
  14. import org.bukkit.plugin.java.JavaPlugin;
  15. import org.bukkit.scheduler.BukkitRunnable;
  16. import org.bukkit.util.NumberConversions;

  17. import java.util.List;

  18. /**
  19. * @author sky
  20. * @Since 2018-07-18 11:06
  21. */
  22. public class ChunkView extends JavaPlugin {

  23.     private FileConfiguration conf;
  24.     private EffLib particleType;
  25.     private Boolean[][] particleRange;
  26.     private ParticleLine[] particleLine;
  27.     private BukkitRunnable displayRunnable = new BukkitRunnable() {
  28.         @Override
  29.         public void run() {
  30.             List<String> enableWorld = conf.getStringList("EnableWorld");
  31.             Bukkit.getOnlinePlayers().stream().filter(player -> enableWorld.contains(player.getWorld().getName()) && EntityTag.getInst().getBoolean("chunkView", player)).forEach(player -> displayPlayerChunk(player));
  32.         }
  33.     };

  34.     @Override
  35.     public void onEnable() {
  36.         reloadConfig();
  37.         displayRunnable.runTaskTimerAsynchronously(this, 0, conf.getInt("ParticleDelay", 10));
  38.     }

  39.     @Override
  40.     public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
  41.         if (sender instanceof ConsoleCommandSender) {
  42.             sender.sendMessage("this command disabled on console.");
  43.             return false;
  44.         }
  45.         if (args.length == 0) {
  46.             if (EntityTag.getInst().getBoolean("chunkView", (Entity) sender)) {
  47.                 TLocale.sendTo("view-disable", sender);
  48.                 EntityTag.getInst().set("chunkView", false, (Entity) sender);
  49.             } else {
  50.                 TLocale.sendTo("view-enable", sender);
  51.                 EntityTag.getInst().set("chunkView", true, (Entity) sender);
  52.             }
  53.         } else if (sender.hasPermission("*")) {
  54.             reloadConfig();
  55.             sender.sendMessage("reload successfully.");
  56.         }
  57.         return true;
  58.     }

  59.     @Override
  60.     public void reloadConfig() {
  61.         conf = ConfigUtils.saveDefaultConfig(this, "config.yml");
  62.         List<String> particleLine = conf.getStringList("ParticleLine");
  63.         this.particleLine = new ParticleLine[particleLine.size()];
  64.         for (int i = 0; i < particleLine.size(); i++) {
  65.             String[] split = particleLine.get(i).split(" ");
  66.             this.particleLine[i] = new ParticleLine(
  67.                     NumberConversions.toFloat(split[0]),
  68.                     NumberConversions.toFloat(split[1]),
  69.                     NumberConversions.toFloat(split[2]),
  70.                     NumberConversions.toInt(split[3]),
  71.                     NumberConversions.toInt(split[4]),
  72.                     NumberConversions.toDouble(split[5]));
  73.         }
  74.         List<String> particleRange = conf.getStringList("ParticleRange");
  75.         this.particleRange = new Boolean[16][];
  76.         for (int i = 0; i < particleRange.size(); i++) {
  77.             String[] split = particleRange.get(i).split(" ");
  78.             Boolean[] range = new Boolean[16];
  79.             for (int j = 0; j < 16; j++) {
  80.                 range[j] = split[j].equals("#");
  81.             }
  82.             this.particleRange[i] = range;
  83.         }
  84.         particleType = EffLib.fromName(conf.getString("ParticleType", "CLOUD"));
  85.     }

  86.     public void displayPlayerChunk(Player player) {
  87.         Block blockStart = player.getLocation().getChunk().getBlock(16, player.getLocation().getBlockY(), 0);
  88.         for (int x = 0; x < 16; x++) {
  89.             for (int z = 0; z < 16; z++) {
  90.                 if (particleRange[x][z]) {
  91.                     Block block = blockStart.getLocation().add(x, 0, z).getBlock();
  92.                     for (ParticleLine particle : particleLine) {
  93.                         particleType.display(particle.getOffsetX(), particle.getOffsetY(), particle.getOffsetZ(), particle.getSpeed(), particle.getAmount(), block.getLocation().add(0.5, particle.getOffsetLocation(), 0.5), player);
  94.                     }
  95.                 }
  96.             }
  97.         }
  98.     }

  99.     class ParticleLine {

  100.         private float offsetX;
  101.         private float offsetY;
  102.         private float offsetZ;
  103.         private int speed;
  104.         private int amount;
  105.         private double offsetLocation;

  106.         public ParticleLine(float offsetX, float offsetY, float offsetZ, int speed, int amount, double offsetLocation) {
  107.             this.offsetX = offsetX;
  108.             this.offsetY = offsetY;
  109.             this.offsetZ = offsetZ;
  110.             this.speed = speed;
  111.             this.amount = amount;
  112.             this.offsetLocation = offsetLocation;
  113.         }

  114.         public float getOffsetX() {
  115.             return offsetX;
  116.         }

  117.         public float getOffsetY() {
  118.             return offsetY;
  119.         }

  120.         public float getOffsetZ() {
  121.             return offsetZ;
  122.         }

  123.         public int getSpeed() {
  124.             return speed;
  125.         }

  126.         public int getAmount() {
  127.             return amount;
  128.         }

  129.         public double getOffsetLocation() {
  130.             return offsetLocation;
  131.         }
  132.     }
  133. }
复制代码

插件代码全部原创不存在抄袭/借鉴

来自群组: PluginsCDTribe

安和桥北丶
沙发,支持原创~

ゞ側灬脸〆
支持原创 很有逼格

Gyzer
很强。支持原创!

a1273374936
挺不错的插件,支持作者 希望能有更棒的作品

第一页 上一页 下一页 最后一页