1
0
mirror of https://github.com/Zrips/Jobs.git synced 2024-11-26 04:25:15 +01:00

Improve material generation in translator file for old versions

- Block cache will not be saved twice on disable
This commit is contained in:
montlikadani 2021-02-17 08:15:05 +01:00
parent ff87470088
commit 2faae4cf08
6 changed files with 34 additions and 40 deletions

View File

@ -845,10 +845,6 @@ public class Jobs extends JavaPlugin {
dao.saveExplore(); dao.saveExplore();
} }
if (bpManager != null) {
bpManager.saveCache();
}
blockOwnerShips.forEach(BlockOwnerShip::save); blockOwnerShips.forEach(BlockOwnerShip::save);
ToggleBarHandling.save(); ToggleBarHandling.save();

View File

@ -15,7 +15,6 @@ public class explored implements Cmd {
@Override @Override
public boolean perform(Jobs plugin, CommandSender sender, String[] args) { public boolean perform(Jobs plugin, CommandSender sender, String[] args) {
if (!(sender instanceof Player)) if (!(sender instanceof Player))
return false; return false;
@ -24,31 +23,26 @@ public class explored implements Cmd {
HashMap<String, ExploreRegion> worlds = Jobs.getExplore().getWorlds(); HashMap<String, ExploreRegion> worlds = Jobs.getExplore().getWorlds();
if (!worlds.containsKey(player.getWorld().getName())) { if (!worlds.containsKey(player.getWorld().getName())) {
sender.sendMessage(Jobs.getLanguage().getMessage("command.explored.error.noexplore")); player.sendMessage(Jobs.getLanguage().getMessage("command.explored.error.noexplore"));
return true; return true;
} }
ExploreRegion regions = worlds.get(player.getWorld().getName()); ExploreChunk chunk = worlds.get(player.getWorld().getName()).getChunk(player.getLocation().getChunk());
ExploreChunk chunk = regions.getChunk(player.getLocation().getChunk());
if (chunk == null) { if (chunk == null) {
sender.sendMessage(Jobs.getLanguage().getMessage("command.explored.error.noexplore")); player.sendMessage(Jobs.getLanguage().getMessage("command.explored.error.noexplore"));
return false; return false;
} }
if (chunk.isFullyExplored() && Jobs.getGCManager().ExploreCompact) { if (chunk.isFullyExplored() && Jobs.getGCManager().ExploreCompact) {
sender.sendMessage(Jobs.getLanguage().getMessage("command.explored.fullExplore")); player.sendMessage(Jobs.getLanguage().getMessage("command.explored.fullExplore"));
return true; return true;
} }
int i = 0; for (int i = 0; i < chunk.getPlayers().size(); i++) {
for (Integer one : chunk.getPlayers()) { PlayerInfo ji = Jobs.getPlayerManager().getPlayerInfo(chunk.getPlayers().get(i));
i++;
PlayerInfo ji = Jobs.getPlayerManager().getPlayerInfo(one);
if (ji != null) if (ji != null)
sender.sendMessage(Jobs.getLanguage().getMessage("command.explored.list", "%place%", i, "%playername%", ji.getName())); player.sendMessage(Jobs.getLanguage().getMessage("command.explored.list", "%place%", i, "%playername%", ji.getName()));
} }
sender.sendMessage(Jobs.getLanguage().getMessage("general.info.separator")); player.sendMessage(Jobs.getLanguage().getMessage("general.info.separator"));
return true; return true;
} }

View File

@ -292,8 +292,13 @@ public class NameTranslatorManager {
for (Material one : Material.values()) { for (Material one : Material.values()) {
CMIMaterial mat = CMIMaterial.get(one); CMIMaterial mat = CMIMaterial.get(one);
if (mat == null || mat.getMaterial() == null) if (mat == CMIMaterial.NONE || mat == null || mat.getMaterial() == null) {
mat = CMIMaterial.get(one.getId());
}
if (mat == CMIMaterial.NONE) {
continue; continue;
}
String n = mat.getLegacyId() + (mat.getLegacyData() == -1 ? "" : ":" + mat.getLegacyData()); String n = mat.getLegacyId() + (mat.getLegacyData() == -1 ? "" : ":" + mat.getLegacyData());
String name = null; String name = null;

View File

@ -145,9 +145,17 @@ public class Job {
final Calendar cal = Calendar.getInstance(); final Calendar cal = Calendar.getInstance();
cal.setTime(new Date()); cal.setTime(new Date());
if (h > 0) {
cal.set(Calendar.HOUR_OF_DAY, cal.get(Calendar.HOUR_OF_DAY) + h); cal.set(Calendar.HOUR_OF_DAY, cal.get(Calendar.HOUR_OF_DAY) + h);
}
if (m > 0) {
cal.set(Calendar.MINUTE, cal.get(Calendar.MINUTE) + m); cal.set(Calendar.MINUTE, cal.get(Calendar.MINUTE) + m);
}
if (s > 0) {
cal.set(Calendar.SECOND, cal.get(Calendar.SECOND) + s); cal.set(Calendar.SECOND, cal.get(Calendar.SECOND) + s);
}
boost.add(type, point, cal.getTimeInMillis()); boost.add(type, point, cal.getTimeInMillis());
} }

View File

@ -30,7 +30,6 @@ import com.gamingmesh.jobs.hooks.HookManager;
import com.gamingmesh.jobs.hooks.JobsHook; import com.gamingmesh.jobs.hooks.JobsHook;
import com.gmail.nossr50.config.experience.ExperienceConfig; import com.gmail.nossr50.config.experience.ExperienceConfig;
import com.gmail.nossr50.datatypes.player.McMMOPlayer; import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.util.player.UserManager; import com.gmail.nossr50.util.player.UserManager;
import com.google.common.base.Objects; import com.google.common.base.Objects;

View File

@ -71,11 +71,3 @@ blocksTimer:
PUMPKIN: 30 PUMPKIN: 30
CARVED_PUMPKIN: 30 CARVED_PUMPKIN: 30
MELON: 30 MELON: 30
GOLD_ORE: -1
IRON_ORE: -1
COAL_ORE: -1
LAPIS_ORE: -1
DIAMOND_ORE: -1
REDSTONE_ORE: -1
EMERALD_ORE: -1
NETHER_QUARTZ_ORE: -1