mirror of
https://e.coding.net/circlecloud/Residence.git
synced 2025-11-24 21:46:16 +00:00
@@ -7,16 +7,17 @@ import com.bekvon.bukkit.residence.Residence;
|
||||
public class AutoSaveTask implements Runnable {
|
||||
Residence res;
|
||||
|
||||
public AutoSaveTask(Residence res) {
|
||||
public AutoSaveTask(final Residence res) {
|
||||
this.res = res;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
if (Residence.initsuccess)
|
||||
if (res.isInit()) {
|
||||
res.saveYml();
|
||||
} catch (Exception ex) {
|
||||
}
|
||||
} catch (final Exception ex) {
|
||||
Bukkit.getLogger().warning("领地数据保存错误,可能造成部分领地丢失,请尝试恢复备份文件!");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,23 +8,30 @@ import com.bekvon.bukkit.residence.Residence;
|
||||
import com.bekvon.bukkit.residence.protection.ClaimedResidence;
|
||||
|
||||
public class HealTask implements Runnable {
|
||||
Residence plugin;
|
||||
|
||||
public HealTask(final Residence plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
for (Player player : Bukkit.getServer().getOnlinePlayers()) {
|
||||
String resname = Residence.getPlayerListener().getCurrentResidenceName(player.getName());
|
||||
for (final Player player : Bukkit.getServer().getOnlinePlayers()) {
|
||||
final String resname = plugin.getPlayerListener().getCurrentResidenceName(player.getName());
|
||||
ClaimedResidence res = null;
|
||||
if (resname != null)
|
||||
res = Residence.getResidenceManager().getByName(resname);
|
||||
if (resname != null) {
|
||||
res = plugin.getResidenceManager().getByName(resname);
|
||||
}
|
||||
if (res != null && res.getPermissions().has("healing", false)) {
|
||||
Damageable damage = player;
|
||||
double health = damage.getHealth();
|
||||
if (health < 20 && !player.isDead())
|
||||
final Damageable damage = player;
|
||||
final double health = damage.getHealth();
|
||||
if (health < 20 && !player.isDead()) {
|
||||
player.setHealth(health + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
} catch (final Exception ex) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,10 +3,17 @@ package com.bekvon.bukkit.residence.runnable;
|
||||
import com.bekvon.bukkit.residence.Residence;
|
||||
|
||||
public class LeaseTask implements Runnable {
|
||||
Residence plugin;
|
||||
|
||||
public LeaseTask(final Residence plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
Residence.getLeaseManager().doExpirations();
|
||||
if (Residence.getConfigManager().showIntervalMessages())
|
||||
Residence.getLog().info(" - Lease Expirations checked!");
|
||||
plugin.getLeaseManager().doExpirations();
|
||||
if (plugin.getConfigManager().showIntervalMessages()) {
|
||||
plugin.getLogger().info(" - Lease Expirations checked!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,10 +3,17 @@ package com.bekvon.bukkit.residence.runnable;
|
||||
import com.bekvon.bukkit.residence.Residence;
|
||||
|
||||
public class RentTask implements Runnable {
|
||||
Residence plugin;
|
||||
|
||||
public RentTask(final Residence plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
Residence.getRentManager().checkCurrentRents();
|
||||
if (Residence.getConfigManager().showIntervalMessages())
|
||||
Residence.getLog().info(" - Rent Expirations checked!");
|
||||
plugin.getRentManager().checkCurrentRents();
|
||||
if (plugin.getConfigManager().showIntervalMessages()) {
|
||||
plugin.getLog().info(" - Rent Expirations checked!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user