public UHBorderManager(UHPlugin plugin) { this.p = plugin; this.i = p.getI18n(); this.warningTimerName = i.t("borders.warning.nameTimer"); this.currentBorderDiameter = p.getConfig().getInt("map.size"); this.isCircularBorder = p.getConfig().getBoolean("map.circular"); }
/** * Sets the size of the future border, used in the warning messages sent to the players out of * this future border. * * <p>This also starts the display of the warning messages, every 90 seconds by default * (configurable, see config.yml, map.border.warningInterval). * * <p>If timeLeft is not null, the time available for the players to go inside the future border * is displayed in the warning message. * * @param diameter * @param timeLeft The time available for the players to go inside the future border (minutes). */ public void setWarningSize(int diameter, int timeLeft, CommandSender sender) { cancelWarning(); this.warningSize = diameter; if (timeLeft != 0) { UHTimer timer = new UHTimer(this.warningTimerName); timer.setDuration(timeLeft * 60); p.getTimerManager().registerTimer(timer); timer.start(); } if (sender != null) { this.warningSender = sender; } warningTask = new BorderWarningTask(p); warningTask.runTaskTimer(p, 20L, 20L * p.getConfig().getInt("map.border.warningInterval", 90)); }