mirror of
https://github.com/Zrips/Jobs.git
synced 2024-11-25 20:16:13 +01:00
Merge remote-tracking branch 'origin/master'
# Conflicts: # pom.xml
This commit is contained in:
commit
2c99a45fcd
BIN
libs/CMILib1.5.0.3.jar
Normal file
BIN
libs/CMILib1.5.0.3.jar
Normal file
Binary file not shown.
32
pom.xml
32
pom.xml
@ -5,7 +5,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>Jobs</groupId>
|
||||
<artifactId>jobs</artifactId>
|
||||
<version>5.2.3.0</version>
|
||||
<version>5.2.4.0</version>
|
||||
<name>Jobs</name>
|
||||
<url>http://maven.apache.org</url>
|
||||
|
||||
@ -150,11 +150,11 @@
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<!-- CMILib -->
|
||||
<dependency>
|
||||
<groupId>com.github.Zrips</groupId>
|
||||
<artifactId>CMILib</artifactId>
|
||||
<version>1.4.7.4</version>
|
||||
</dependency>
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>com.github.Zrips</groupId>-->
|
||||
<!-- <artifactId>CMILib</artifactId>-->
|
||||
<!-- <version>1.4.7.4</version>-->
|
||||
<!-- </dependency>-->
|
||||
<!-- WildStacker -->
|
||||
<dependency>
|
||||
<groupId>com.bgsoftware</groupId>
|
||||
@ -184,6 +184,14 @@
|
||||
<scope>system</scope>
|
||||
<systemPath>${basedir}/libs/PyroFishingPro-4.9.1.jar</systemPath>
|
||||
</dependency>
|
||||
<!-- CMILib -->
|
||||
<dependency>
|
||||
<groupId>net.Zrips</groupId>
|
||||
<artifactId>CMILib</artifactId>
|
||||
<version>1.5.0.2</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${basedir}/libs/CMILib1.5.0.3.jar</systemPath>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<repositories>
|
||||
<repository>
|
||||
@ -248,18 +256,6 @@
|
||||
<target>1.8</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<version>2.3.1</version>
|
||||
<configuration>
|
||||
<outputDirectory>${basedir}/build/jar</outputDirectory>
|
||||
</configuration>
|
||||
<!-- This should be kept local -->
|
||||
<!--<configuration>
|
||||
<outputDirectory>D:\MC\Server 1.20.5\plugins\</outputDirectory>
|
||||
</configuration>-->
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
@ -49,7 +49,9 @@ import com.gamingmesh.jobs.api.JobsPrePaymentEvent;
|
||||
import com.gamingmesh.jobs.commands.JobsCommands;
|
||||
import com.gamingmesh.jobs.config.BlockProtectionManager;
|
||||
import com.gamingmesh.jobs.config.BossBarManager;
|
||||
import com.gamingmesh.jobs.config.ChunkExplorationManager;
|
||||
import com.gamingmesh.jobs.config.ConfigManager;
|
||||
import com.gamingmesh.jobs.config.ExploitProtectionManager;
|
||||
import com.gamingmesh.jobs.config.ExploreManager;
|
||||
import com.gamingmesh.jobs.config.GeneralConfigManager;
|
||||
import com.gamingmesh.jobs.config.LanguageManager;
|
||||
@ -96,6 +98,7 @@ import com.gamingmesh.jobs.i18n.Language;
|
||||
import com.gamingmesh.jobs.listeners.JobsListener;
|
||||
import com.gamingmesh.jobs.listeners.JobsPayment1_14Listener;
|
||||
import com.gamingmesh.jobs.listeners.JobsPayment1_16Listener;
|
||||
import com.gamingmesh.jobs.listeners.JobsPayment1_20Listener;
|
||||
import com.gamingmesh.jobs.listeners.JobsPayment1_9Listener;
|
||||
import com.gamingmesh.jobs.listeners.JobsPaymentListener;
|
||||
import com.gamingmesh.jobs.listeners.PistonProtectionListener;
|
||||
@ -131,14 +134,18 @@ public final class Jobs extends JavaPlugin {
|
||||
private static SignUtil signManager;
|
||||
private static ScheduleManager scheduleManager;
|
||||
private static NameTranslatorManager nameTranslatorManager;
|
||||
@Deprecated
|
||||
private static ExploreManager exploreManager;
|
||||
private static ChunkExplorationManager chunkExplorationManager;
|
||||
private static TitleManager titleManager;
|
||||
private static RestrictedBlockManager rbManager;
|
||||
private static RestrictedAreaManager raManager;
|
||||
private static BossBarManager bbManager;
|
||||
private static ShopManager shopManager;
|
||||
private static Loging loging;
|
||||
@Deprecated
|
||||
private static BlockProtectionManager bpManager;
|
||||
private static ExploitProtectionManager exploitManager;
|
||||
private static JobsManager dbManager;
|
||||
private static ConfigManager configManager;
|
||||
private static GeneralConfigManager gConfigManager;
|
||||
@ -288,12 +295,19 @@ public final class Jobs extends JavaPlugin {
|
||||
return loging;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public static BlockProtectionManager getBpManager() {
|
||||
if (bpManager == null)
|
||||
bpManager = new BlockProtectionManager();
|
||||
return bpManager;
|
||||
}
|
||||
|
||||
public static ExploitProtectionManager getExploitManager() {
|
||||
if (exploitManager == null)
|
||||
exploitManager = new ExploitProtectionManager();
|
||||
return exploitManager;
|
||||
}
|
||||
|
||||
public static JobsManager getDBManager() {
|
||||
if (dbManager == null)
|
||||
dbManager = new JobsManager(getInstance());
|
||||
@ -396,12 +410,19 @@ public final class Jobs extends JavaPlugin {
|
||||
return getExploreManager();
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public static ExploreManager getExploreManager() {
|
||||
if (exploreManager == null)
|
||||
exploreManager = new ExploreManager();
|
||||
return exploreManager;
|
||||
}
|
||||
|
||||
public static ChunkExplorationManager getChunkExplorationManager() {
|
||||
if (chunkExplorationManager == null)
|
||||
chunkExplorationManager = new ChunkExplorationManager();
|
||||
return chunkExplorationManager;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return returns this class object instance
|
||||
*/
|
||||
@ -777,7 +798,8 @@ public final class Jobs extends JavaPlugin {
|
||||
}
|
||||
|
||||
dao.loadBlockProtection();
|
||||
getExploreManager().load();
|
||||
if (!getGCManager().useNewExploration)
|
||||
getExploreManager().load();
|
||||
getCommandManager().fillCommands();
|
||||
getDBManager().getDB().triggerTableIdUpdate();
|
||||
|
||||
@ -809,8 +831,10 @@ public final class Jobs extends JavaPlugin {
|
||||
if (Version.isCurrentEqualOrHigher(Version.v1_16_R3))
|
||||
pm.registerEvents(new JobsPayment1_16Listener(), getInstance());
|
||||
|
||||
if (Version.isCurrentEqualOrHigher(Version.v1_20_R1))
|
||||
if (Version.isCurrentEqualOrHigher(Version.v1_20_R1)) {
|
||||
pm.registerEvents(new PlayerSignEdit1_20Listeners(), getInstance());
|
||||
pm.registerEvents(new JobsPayment1_20Listener(), getInstance());
|
||||
}
|
||||
|
||||
if (getGCManager().useBlockProtection) {
|
||||
pm.registerEvents(new PistonProtectionListener(), getInstance());
|
||||
@ -818,6 +842,9 @@ public final class Jobs extends JavaPlugin {
|
||||
|
||||
pm.registerEvents(new JobsChatEvent(getInstance()), getInstance());
|
||||
|
||||
if(HookManager.checkPyroFishingPro()) {
|
||||
HookManager.getPyroFishingProManager().registerListener();
|
||||
}
|
||||
if (HookManager.getMcMMOManager().CheckmcMMO()) {
|
||||
HookManager.setMcMMOlistener();
|
||||
}
|
||||
@ -1020,8 +1047,9 @@ public final class Jobs extends JavaPlugin {
|
||||
List<JobProgression> progression = jPlayer.getJobProgression();
|
||||
int numjobs = progression.size();
|
||||
|
||||
if (!Jobs.getGCManager().useBlockProtectionBlockTracker && !isBpOk(jPlayer, info, block, true))
|
||||
if (!Jobs.getGCManager().useBlockProtectionBlockTracker && !Jobs.getExploitManager().isProtectionValidAddIfNotExists(jPlayer, info, block, true)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// no job
|
||||
if (numjobs == 0) {
|
||||
@ -1100,8 +1128,12 @@ public final class Jobs extends JavaPlugin {
|
||||
if (income == 0D && pointAmount == 0D)
|
||||
return;
|
||||
|
||||
if (info.getType() == ActionType.BREAK && block != null)
|
||||
getBpManager().remove(block);
|
||||
if (info.getType() == ActionType.BREAK && block != null) {
|
||||
if (getGCManager().useNewBlockProtection)
|
||||
getExploitManager().remove(block);
|
||||
else
|
||||
getBpManager().remove(block);
|
||||
}
|
||||
|
||||
if (pointAmount != 0D) {
|
||||
jPlayer.setSaved(false);
|
||||
@ -1309,7 +1341,11 @@ public final class Jobs extends JavaPlugin {
|
||||
|
||||
//need to update bp
|
||||
if (block != null && !Jobs.getGCManager().useBlockProtectionBlockTracker) {
|
||||
BlockProtection bp = getBpManager().getBp(block.getLocation());
|
||||
BlockProtection bp = null;
|
||||
if (Jobs.getGCManager().useNewBlockProtection) {
|
||||
getExploitManager().setPaid(block, true);
|
||||
} else
|
||||
bp = getBpManager().getBp(block.getLocation());
|
||||
if (bp != null)
|
||||
bp.setPaid(true);
|
||||
}
|
||||
@ -1318,84 +1354,6 @@ public final class Jobs extends JavaPlugin {
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean isBpOk(JobsPlayer player, ActionInfo info, Block block, boolean inform) {
|
||||
if (block == null || !gConfigManager.useBlockProtection)
|
||||
return true;
|
||||
|
||||
if (info.getType() == ActionType.BREAK) {
|
||||
if (block.hasMetadata("JobsExploit")) {
|
||||
//player.sendMessage("This block is protected using Rukes' system!");
|
||||
return false;
|
||||
}
|
||||
|
||||
BlockProtection bp = getBpManager().getBp(block.getLocation());
|
||||
if (bp != null) {
|
||||
long time = bp.getTime();
|
||||
Integer cd = getBpManager().getBlockDelayTime(block);
|
||||
|
||||
if (time == -1L) {
|
||||
getBpManager().remove(block);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (time < System.currentTimeMillis() && bp.getAction() != DBAction.DELETE) {
|
||||
getBpManager().remove(block);
|
||||
return true;
|
||||
}
|
||||
|
||||
if ((time > System.currentTimeMillis() || bp.isPaid()) && bp.getAction() != DBAction.DELETE) {
|
||||
if (inform && player.canGetPaid(info)) {
|
||||
int sec = Math.round((time - System.currentTimeMillis()) / 1000L);
|
||||
CMIActionBar.send(player.getPlayer(), lManager.getMessage("message.blocktimer", "[time]", sec));
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
getBpManager().add(block, cd);
|
||||
|
||||
if ((cd == null || cd == 0) && gConfigManager.useGlobalTimer) {
|
||||
getBpManager().add(block, gConfigManager.globalblocktimer);
|
||||
}
|
||||
|
||||
} else if (gConfigManager.useGlobalTimer) {
|
||||
getBpManager().add(block, gConfigManager.globalblocktimer);
|
||||
}
|
||||
} else if (info.getType() == ActionType.PLACE) {
|
||||
BlockProtection bp = getBpManager().getBp(block.getLocation());
|
||||
if (bp != null) {
|
||||
Long time = bp.getTime();
|
||||
Integer cd = getBpManager().getBlockDelayTime(block);
|
||||
if (time != -1L) {
|
||||
if (time < System.currentTimeMillis() && bp.getAction() != DBAction.DELETE) {
|
||||
getBpManager().add(block, cd);
|
||||
return true;
|
||||
}
|
||||
|
||||
if ((time > System.currentTimeMillis() || bp.isPaid()) && bp.getAction() != DBAction.DELETE) {
|
||||
if (inform && player.canGetPaid(info)) {
|
||||
int sec = Math.round((time - System.currentTimeMillis()) / 1000L);
|
||||
CMIActionBar.send(player.getPlayer(), lManager.getMessage("message.blocktimer", "[time]", sec));
|
||||
}
|
||||
|
||||
getBpManager().add(block, cd);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Lets add protection in any case
|
||||
getBpManager().add(block, cd);
|
||||
} else if (bp.isPaid() && bp.getTime() == -1L && cd != null && cd == -1) {
|
||||
getBpManager().add(block, cd);
|
||||
return false;
|
||||
} else
|
||||
getBpManager().add(block, cd);
|
||||
} else
|
||||
getBpManager().add(block, getBpManager().getBlockDelayTime(block));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private static int getPlayerExperience(Player player) {
|
||||
return (expToLevel(player.getLevel()) + Math.round(deltaLevelToExp(player.getLevel()) * player.getExp()));
|
||||
}
|
||||
|
@ -327,7 +327,8 @@ public class PlayerManager {
|
||||
|
||||
playersUUID.values().removeIf(jPlayer -> jPlayer.isSaved() && !jPlayer.isOnline());
|
||||
|
||||
Jobs.getBpManager().saveCache();
|
||||
if (!Jobs.getGCManager().useNewBlockProtection)
|
||||
Jobs.getBpManager().saveCache();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -6,9 +6,7 @@ import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
@ -18,7 +16,6 @@ import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
|
||||
import com.gamingmesh.jobs.Jobs;
|
||||
import com.gamingmesh.jobs.commands.list.gtop;
|
||||
import com.gamingmesh.jobs.container.Job;
|
||||
import com.gamingmesh.jobs.container.TopList;
|
||||
|
||||
@ -50,7 +47,7 @@ public class SignUtil {
|
||||
Map<String, jobsSign> sub = signsByType.get(jSign.getIdentifier().toLowerCase());
|
||||
if (sub != null) {
|
||||
sub.remove(jSign.locToBlockString());
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -3,7 +3,6 @@ package com.gamingmesh.jobs.commands.list;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.command.CommandSender;
|
||||
@ -15,8 +14,10 @@ import com.gamingmesh.jobs.container.BlockProtection;
|
||||
import com.gamingmesh.jobs.container.DBAction;
|
||||
import com.gamingmesh.jobs.i18n.Language;
|
||||
|
||||
import net.Zrips.CMILib.Container.CMINumber;
|
||||
import net.Zrips.CMILib.Items.CMIMaterial;
|
||||
import net.Zrips.CMILib.Locale.LC;
|
||||
import net.Zrips.CMILib.Logs.CMIDebug;
|
||||
import net.Zrips.CMILib.Messages.CMIMessages;
|
||||
import net.Zrips.CMILib.Version.Version;
|
||||
import net.Zrips.CMILib.Version.Schedulers.CMIScheduler;
|
||||
@ -41,30 +42,26 @@ public class bp implements Cmd {
|
||||
|
||||
final List<Block> changedBlocks = new ArrayList<>();
|
||||
|
||||
for (int x = -10; x < 10; x++) {
|
||||
for (int y = -10; y < 10; y++) {
|
||||
for (int z = -10; z < 10; z++) {
|
||||
Location l = loc.clone().add(x, y, z);
|
||||
BlockProtection bp = Jobs.getBpManager().getBp(l);
|
||||
if (bp != null) {
|
||||
long time = bp.getTime();
|
||||
if (!all) {
|
||||
if (bp.getAction() == DBAction.DELETE)
|
||||
continue;
|
||||
if (time != -1 && time < System.currentTimeMillis()) {
|
||||
Jobs.getBpManager().remove(l);
|
||||
continue;
|
||||
}
|
||||
if (Jobs.getGCManager().useNewBlockProtection) {
|
||||
for (int x = -10; x < 10; x++) {
|
||||
for (int y = -10; y < 10; y++) {
|
||||
for (int z = -10; z < 10; z++) {
|
||||
Location l = loc.clone().add(x, y, z);
|
||||
Long time = Jobs.getExploitManager().getTime(l.getBlock());
|
||||
if (time == null)
|
||||
continue;
|
||||
|
||||
if (!all && time != -1 && time < System.currentTimeMillis()) {
|
||||
Jobs.getExploitManager().remove(l.getBlock());
|
||||
continue;
|
||||
}
|
||||
|
||||
changedBlocks.add(l.getBlock());
|
||||
|
||||
if (Version.isCurrentEqualOrHigher(Version.v1_15_R1)) {
|
||||
player.sendBlockChange(l, (bp.getAction() == DBAction.DELETE ? CMIMaterial.RED_STAINED_GLASS : time == -1 ? CMIMaterial.BLACK_STAINED_GLASS : CMIMaterial.WHITE_STAINED_GLASS)
|
||||
.getMaterial().createBlockData());
|
||||
player.sendBlockChange(l, (time == -1 ? CMIMaterial.BLACK_STAINED_GLASS : CMIMaterial.WHITE_STAINED_GLASS).getMaterial().createBlockData());
|
||||
} else {
|
||||
if (bp.getAction() == DBAction.DELETE)
|
||||
player.sendBlockChange(l, CMIMaterial.RED_STAINED_GLASS.getMaterial(), (byte) 14);
|
||||
else if (time == -1)
|
||||
if (time == -1)
|
||||
player.sendBlockChange(l, CMIMaterial.RED_STAINED_GLASS.getMaterial(), (byte) 15);
|
||||
else
|
||||
player.sendBlockChange(l, CMIMaterial.RED_STAINED_GLASS.getMaterial(), (byte) 0);
|
||||
@ -72,7 +69,40 @@ public class bp implements Cmd {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else
|
||||
for (int x = -10; x < 10; x++) {
|
||||
for (int y = -10; y < 10; y++) {
|
||||
for (int z = -10; z < 10; z++) {
|
||||
Location l = loc.clone().add(x, y, z);
|
||||
BlockProtection bp = Jobs.getBpManager().getBp(l);
|
||||
if (bp != null) {
|
||||
long time = bp.getTime();
|
||||
if (!all) {
|
||||
if (bp.getAction() == DBAction.DELETE)
|
||||
continue;
|
||||
if (time != -1 && time < System.currentTimeMillis()) {
|
||||
Jobs.getBpManager().remove(l);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
changedBlocks.add(l.getBlock());
|
||||
|
||||
if (Version.isCurrentEqualOrHigher(Version.v1_15_R1)) {
|
||||
player.sendBlockChange(l, (bp.getAction() == DBAction.DELETE ? CMIMaterial.RED_STAINED_GLASS : time == -1 ? CMIMaterial.BLACK_STAINED_GLASS
|
||||
: CMIMaterial.WHITE_STAINED_GLASS)
|
||||
.getMaterial().createBlockData());
|
||||
} else {
|
||||
if (bp.getAction() == DBAction.DELETE)
|
||||
player.sendBlockChange(l, CMIMaterial.RED_STAINED_GLASS.getMaterial(), (byte) 14);
|
||||
else if (time == -1)
|
||||
player.sendBlockChange(l, CMIMaterial.RED_STAINED_GLASS.getMaterial(), (byte) 15);
|
||||
else
|
||||
player.sendBlockChange(l, CMIMaterial.RED_STAINED_GLASS.getMaterial(), (byte) 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (changedBlocks.isEmpty())
|
||||
Language.sendMessage(sender, "command.bp.output.notFound");
|
||||
|
@ -1,14 +1,12 @@
|
||||
package com.gamingmesh.jobs.commands.list;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.gamingmesh.jobs.Jobs;
|
||||
import com.gamingmesh.jobs.commands.Cmd;
|
||||
import com.gamingmesh.jobs.container.ExploreChunk;
|
||||
import com.gamingmesh.jobs.container.ExploreRegion;
|
||||
import com.gamingmesh.jobs.container.PlayerInfo;
|
||||
import com.gamingmesh.jobs.i18n.Language;
|
||||
|
||||
@ -24,35 +22,25 @@ public class explored implements Cmd {
|
||||
}
|
||||
|
||||
Player player = (Player) sender;
|
||||
Map<String, ExploreRegion> exploreRegion = Jobs.getExploreManager().getWorlds().get(player.getWorld().getName());
|
||||
|
||||
if (exploreRegion == null) {
|
||||
List<Integer> players = null;
|
||||
|
||||
if (Jobs.getGCManager().useNewExploration) {
|
||||
players = Jobs.getChunkExplorationManager().getVisitors(player.getLocation().getChunk());
|
||||
} else {
|
||||
players = Jobs.getExploreManager().getVisitors(player.getLocation().getChunk());
|
||||
}
|
||||
|
||||
if (players == null) {
|
||||
Language.sendMessage(sender, "command.explored.error.noexplore");
|
||||
return true;
|
||||
}
|
||||
|
||||
int RegionX = (int) Math.floor(player.getLocation().getChunk().getX() / 32D);
|
||||
int RegionZ = (int) Math.floor(player.getLocation().getChunk().getZ() / 32D);
|
||||
ExploreRegion region = exploreRegion.get(RegionX + ":" + RegionZ);
|
||||
if (region == null) {
|
||||
if (players.isEmpty()) {
|
||||
Language.sendMessage(sender, "command.explored.error.noexplore");
|
||||
return true;
|
||||
}
|
||||
|
||||
ExploreChunk chunk = region.getChunk(player.getLocation().getChunk());
|
||||
|
||||
if (chunk == null) {
|
||||
Language.sendMessage(sender, "command.explored.error.noexplore");
|
||||
return true;
|
||||
}
|
||||
|
||||
if (Jobs.getGCManager().ExploreCompact && chunk.isFullyExplored()) {
|
||||
Language.sendMessage(sender, "command.explored.fullExplore");
|
||||
return true;
|
||||
}
|
||||
|
||||
java.util.List<Integer> players = chunk.getPlayers();
|
||||
|
||||
for (int i = 0; i < players.size(); i++) {
|
||||
PlayerInfo ji = Jobs.getPlayerManager().getPlayerInfo(players.get(i));
|
||||
if (ji != null)
|
||||
|
@ -0,0 +1,37 @@
|
||||
package com.gamingmesh.jobs.commands.list;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.gamingmesh.jobs.Jobs;
|
||||
import com.gamingmesh.jobs.commands.Cmd;
|
||||
import com.gamingmesh.jobs.container.ActionType;
|
||||
import com.gamingmesh.jobs.container.Job;
|
||||
import com.gamingmesh.jobs.container.JobsPlayer;
|
||||
import com.gamingmesh.jobs.i18n.Language;
|
||||
|
||||
import net.Zrips.CMILib.Locale.LC;
|
||||
import net.Zrips.CMILib.Messages.CMIMessages;
|
||||
|
||||
public class recalculatepermissions implements Cmd {
|
||||
|
||||
@Override
|
||||
public Boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
|
||||
|
||||
JobsPlayer jPlayer = null;
|
||||
if (args.length >= 1) {
|
||||
jPlayer = Jobs.getPlayerManager().getJobsPlayer(args[0]);
|
||||
} else if (sender instanceof Player)
|
||||
jPlayer = Jobs.getPlayerManager().getJobsPlayer((Player) sender);
|
||||
|
||||
if (jPlayer == null) {
|
||||
LC.info_NoPlayer.sendMessage(sender, "[name]", args.length >= 1 ? args[0] : sender.getName());
|
||||
return true;
|
||||
}
|
||||
|
||||
jPlayer.getPermissionsCache().clear();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
@ -28,7 +28,10 @@ public class resetexploreregion implements Cmd {
|
||||
return true;
|
||||
}
|
||||
|
||||
Jobs.getExploreManager().resetRegion(worldName);
|
||||
if (Jobs.getGCManager().useNewExploration) {
|
||||
Jobs.getChunkExplorationManager().resetRegion(worldName);
|
||||
} else
|
||||
Jobs.getExploreManager().resetRegion(worldName);
|
||||
Language.sendMessage(sender, "command.resetexploreregion.output.reseted", "%worldname%", worldName);
|
||||
return true;
|
||||
}
|
||||
|
@ -9,9 +9,13 @@ import org.bukkit.World;
|
||||
import org.bukkit.block.Block;
|
||||
|
||||
import com.gamingmesh.jobs.Jobs;
|
||||
import com.gamingmesh.jobs.container.ActionInfo;
|
||||
import com.gamingmesh.jobs.container.ActionType;
|
||||
import com.gamingmesh.jobs.container.BlockProtection;
|
||||
import com.gamingmesh.jobs.container.DBAction;
|
||||
import com.gamingmesh.jobs.container.JobsPlayer;
|
||||
|
||||
import net.Zrips.CMILib.ActionBar.CMIActionBar;
|
||||
import net.Zrips.CMILib.Container.CMIBlock;
|
||||
import net.Zrips.CMILib.Container.CMIBlock.Bisect;
|
||||
import net.Zrips.CMILib.Items.CMIMaterial;
|
||||
@ -22,7 +26,7 @@ public class BlockProtectionManager {
|
||||
private final HashMap<World, HashMap<String, HashMap<String, HashMap<String, BlockProtection>>>> map = new HashMap<>();
|
||||
private final ConcurrentHashMap<World, ConcurrentHashMap<String, BlockProtection>> tempCache = new ConcurrentHashMap<>();
|
||||
|
||||
public HashMap<World, HashMap<String, HashMap<String, HashMap<String, BlockProtection>>>> getMap() {
|
||||
public HashMap<World, HashMap<String, HashMap<String, HashMap<String, BlockProtection>>>> getMap2() {
|
||||
return map;
|
||||
}
|
||||
|
||||
@ -104,11 +108,9 @@ public class BlockProtectionManager {
|
||||
Bp.setPaid(paid);
|
||||
Bp.setTime(time);
|
||||
|
||||
// If timer is under 2 hours, we can run scheduler to remove it when time comes
|
||||
if (time > -1 && (time - System.currentTimeMillis()) / 1000 < 60 * 60 * 2)
|
||||
Bp.setScheduler(CMIScheduler.get().runAtLocationLater(loc, () -> {
|
||||
remove(loc);
|
||||
}, (time - System.currentTimeMillis()) / 50));
|
||||
// If timer is under 5 min, we can run scheduler to remove it when time comes
|
||||
if (time > -1 && (time - System.currentTimeMillis()) / 1000 < 60 * 5)
|
||||
Bp.setScheduler(CMIScheduler.runAtLocationLater(loc, () -> remove(loc), (time - System.currentTimeMillis()) / 50));
|
||||
|
||||
Bpm.put(v, Bp);
|
||||
chunks.put(chunk, Bpm);
|
||||
@ -220,15 +222,87 @@ public class BlockProtectionManager {
|
||||
return (int) Math.floor(x / 32D) + ":" + (int) Math.floor(z / 32D);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public Integer getBlockDelayTime(Block block) {
|
||||
Integer time = Jobs.getRestrictedBlockManager().restrictedBlocksTimer.get(CMIMaterial.get(block));
|
||||
if (time == null && Jobs.getGCManager().useGlobalTimer) {
|
||||
time = Jobs.getGCManager().globalblocktimer;
|
||||
}
|
||||
return time;
|
||||
return Jobs.getExploitManager().getBlockProtectionTime(block);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public boolean isInBp(Block block) {
|
||||
return Jobs.getRestrictedBlockManager().restrictedBlocksTimer.containsKey(CMIMaterial.get(block));
|
||||
}
|
||||
|
||||
public boolean isBpOk(JobsPlayer player, ActionInfo info, Block block, boolean inform) {
|
||||
if (block == null || !Jobs.getGCManager().useBlockProtection)
|
||||
return true;
|
||||
|
||||
if (info.getType() == ActionType.BREAK) {
|
||||
if (block.hasMetadata("JobsExploit")) {
|
||||
//player.sendMessage("This block is protected using Rukes' system!");
|
||||
return false;
|
||||
}
|
||||
|
||||
BlockProtection bp = getBp(block.getLocation());
|
||||
if (bp != null) {
|
||||
long time = bp.getTime();
|
||||
Integer cd = Jobs.getExploitManager().getBlockProtectionTime(info.getType(), block);
|
||||
|
||||
if (time == -1L) {
|
||||
remove(block);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (time < System.currentTimeMillis() && bp.getAction() != DBAction.DELETE) {
|
||||
remove(block);
|
||||
return true;
|
||||
}
|
||||
|
||||
if ((time > System.currentTimeMillis() || bp.isPaid()) && bp.getAction() != DBAction.DELETE) {
|
||||
if (inform && player.canGetPaid(info)) {
|
||||
int sec = Math.round((time - System.currentTimeMillis()) / 1000L);
|
||||
CMIActionBar.send(player.getPlayer(), Jobs.getLanguage().getMessage("message.blocktimer", "[time]", sec));
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
add(block, cd);
|
||||
|
||||
} else
|
||||
add(block, Jobs.getExploitManager().getBlockProtectionTime(info.getType(), block));
|
||||
|
||||
} else if (info.getType() == ActionType.PLACE) {
|
||||
BlockProtection bp = getBp(block.getLocation());
|
||||
if (bp != null) {
|
||||
Long time = bp.getTime();
|
||||
Integer cd = Jobs.getExploitManager().getBlockProtectionTime(info.getType(), block);
|
||||
if (time != -1L) {
|
||||
if (time < System.currentTimeMillis() && bp.getAction() != DBAction.DELETE) {
|
||||
add(block, cd);
|
||||
return true;
|
||||
}
|
||||
|
||||
if ((time > System.currentTimeMillis() || bp.isPaid()) && bp.getAction() != DBAction.DELETE) {
|
||||
if (inform && player.canGetPaid(info)) {
|
||||
int sec = Math.round((time - System.currentTimeMillis()) / 1000L);
|
||||
CMIActionBar.send(player.getPlayer(), Jobs.getLanguage().getMessage("message.blocktimer", "[time]", sec));
|
||||
}
|
||||
|
||||
add(block, cd);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Lets add protection in any case
|
||||
add(block, cd);
|
||||
} else if (bp.isPaid() && bp.getTime() == -1L && cd != null && cd == -1) {
|
||||
add(block, cd);
|
||||
return false;
|
||||
} else
|
||||
add(block, cd);
|
||||
} else
|
||||
add(block, Jobs.getExploitManager().getBlockProtectionTime(info.getType(), block));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -140,20 +140,17 @@ public class BossBarManager {
|
||||
bar.setVisible(true);
|
||||
|
||||
if (oldOne != null)
|
||||
oldOne.setScheduler(CMIScheduler.get().runTaskLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
for (BossBarInfo one : player.getBossBarInfo()) {
|
||||
if (!one.getPlayerName().equalsIgnoreCase(player.getName()))
|
||||
continue;
|
||||
oldOne.setScheduler(CMIScheduler.runTaskLater(() -> {
|
||||
for (BossBarInfo one : player.getBossBarInfo()) {
|
||||
if (!one.getPlayerName().equalsIgnoreCase(player.getName()))
|
||||
continue;
|
||||
|
||||
if (!one.getJobName().equalsIgnoreCase(jobProg.getJob().getName()))
|
||||
continue;
|
||||
if (!one.getJobName().equalsIgnoreCase(jobProg.getJob().getName()))
|
||||
continue;
|
||||
|
||||
BossBar tempBar = one.getBar();
|
||||
tempBar.setVisible(false);
|
||||
break;
|
||||
}
|
||||
BossBar tempBar = one.getBar();
|
||||
tempBar.setVisible(false);
|
||||
break;
|
||||
}
|
||||
}, Jobs.getGCManager().BossBarTimer * 20L));
|
||||
|
||||
|
@ -0,0 +1,79 @@
|
||||
package com.gamingmesh.jobs.config;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.Chunk;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import com.gamingmesh.jobs.Jobs;
|
||||
import com.gamingmesh.jobs.container.ExploreRespond;
|
||||
|
||||
import net.Zrips.CMILib.Messages.CMIMessages;
|
||||
import net.Zrips.CMILib.PersistentData.CMIChunkPersistentDataContainer;
|
||||
|
||||
public class ChunkExplorationManager {
|
||||
|
||||
private static final String NAME = "JobsExplore";
|
||||
private static final String SUBNAME = "Explorers";
|
||||
|
||||
private boolean exploreEnabled = false;
|
||||
private int playerAmount = 1;
|
||||
|
||||
public int getPlayerAmount() {
|
||||
return playerAmount;
|
||||
}
|
||||
|
||||
public void setPlayerAmount(int amount) {
|
||||
if (playerAmount < amount)
|
||||
playerAmount = amount;
|
||||
}
|
||||
|
||||
public boolean isExploreEnabled() {
|
||||
return exploreEnabled;
|
||||
}
|
||||
|
||||
public void setExploreEnabled() {
|
||||
exploreEnabled = true;
|
||||
}
|
||||
|
||||
public List<Integer> getVisitors(Chunk chunk) {
|
||||
return new CMIChunkPersistentDataContainer(NAME, chunk).getListInt(SUBNAME);
|
||||
}
|
||||
|
||||
public ExploreRespond chunkRespond(Player player, Chunk chunk) {
|
||||
return chunkRespond(Jobs.getPlayerManager().getJobsPlayer(player).getUserId(), chunk);
|
||||
}
|
||||
|
||||
public ExploreRespond chunkRespond(int playerId, Chunk chunk) {
|
||||
|
||||
CMIChunkPersistentDataContainer container = new CMIChunkPersistentDataContainer(NAME, chunk);
|
||||
|
||||
@Nullable
|
||||
List<Integer> list = container.getListInt(SUBNAME);
|
||||
|
||||
ExploreRespond response = new ExploreRespond();
|
||||
|
||||
if (list == null || !list.contains(playerId)) {
|
||||
if (list == null)
|
||||
list = new ArrayList<Integer>();
|
||||
else
|
||||
list = new ArrayList<Integer>(list);
|
||||
list.add(playerId);
|
||||
container.setIntList(SUBNAME, list);
|
||||
container.save();
|
||||
response.setNewChunk(true);
|
||||
}
|
||||
|
||||
response.setCount(list.size());
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
public void resetRegion(String worldname) {
|
||||
CMIMessages.consoleMessage("&eReseting explorer data. World: " + worldname);
|
||||
// Needs to pick new way of tracking data
|
||||
CMIMessages.consoleMessage("&eCompleted to reset explorer data.");
|
||||
}
|
||||
}
|
@ -410,6 +410,11 @@ public class ConfigManager {
|
||||
cfg.addComment(pt + ".Brew", "Brewing miscellaneous items");
|
||||
generate(cfg, pt + ".Brew.nether_stalk");
|
||||
generate(cfg, pt + ".Brew.redstone");
|
||||
|
||||
cfg.addComment(pt + ".Brush", "Brushing blocks and getting items from them");
|
||||
generate(cfg, pt + ".Brush.suspicious_sand");
|
||||
generate(cfg, pt + ".Brush.suspicious_gravel");
|
||||
generate(cfg, pt + ".Brush.coal");
|
||||
|
||||
cfg.addComment(pt + ".Explore", "Explore options. Each number represents players number in exploring that chunk",
|
||||
"1 means that player is first in this chunk, 2 is second and so on",
|
||||
@ -614,6 +619,7 @@ public class ConfigManager {
|
||||
case STRIPLOGS:
|
||||
case BUCKET:
|
||||
case COLLECT:
|
||||
case BRUSH:
|
||||
material = CMIMaterial.get(myKey + (subType));
|
||||
|
||||
if (material == CMIMaterial.NONE)
|
||||
@ -807,6 +813,10 @@ public class ConfigManager {
|
||||
|
||||
Jobs.getExploreManager().setExploreEnabled();
|
||||
Jobs.getExploreManager().setPlayerAmount(amount);
|
||||
|
||||
Jobs.getChunkExplorationManager().setExploreEnabled();
|
||||
Jobs.getChunkExplorationManager().setPlayerAmount(amount);
|
||||
|
||||
} else if (actionType == ActionType.CRAFT) {
|
||||
if (myKey.startsWith("!")) {
|
||||
type = myKey.substring(1, myKey.length());
|
||||
@ -833,6 +843,12 @@ public class ConfigManager {
|
||||
meta = "ALL";
|
||||
// case for ":all" identifier
|
||||
type = (actionType == ActionType.SHEAR && myKey.startsWith("color")) ? "color" : CMIMaterial.getGeneralMaterialName(type);
|
||||
|
||||
CMIEntityType entity = CMIEntityType.get(type);
|
||||
if (entity != null) {
|
||||
type = entity.toString();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (actionType == ActionType.TNTBREAK)
|
||||
|
@ -0,0 +1,365 @@
|
||||
package com.gamingmesh.jobs.config;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Set;
|
||||
|
||||
import org.bukkit.Chunk;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.NamespacedKey;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import com.gamingmesh.jobs.Jobs;
|
||||
import com.gamingmesh.jobs.container.ActionInfo;
|
||||
import com.gamingmesh.jobs.container.ActionType;
|
||||
import com.gamingmesh.jobs.container.BlockProtection;
|
||||
import com.gamingmesh.jobs.container.ExploitProtection;
|
||||
import com.gamingmesh.jobs.container.JobsPlayer;
|
||||
|
||||
import net.Zrips.CMILib.ActionBar.CMIActionBar;
|
||||
import net.Zrips.CMILib.Container.CMIBlock;
|
||||
import net.Zrips.CMILib.Container.CMIBlock.Bisect;
|
||||
import net.Zrips.CMILib.Items.CMIMaterial;
|
||||
import net.Zrips.CMILib.PersistentData.CMIChunkPersistentDataContainer;
|
||||
|
||||
public class ExploitProtectionManager {
|
||||
|
||||
private static final String NAMEGENERAL = "JobsExploitProtection";
|
||||
private static final String NAMETIME = "Time";
|
||||
private static final String NAMEPAID = "Paid";
|
||||
|
||||
private HashMap<String, HashMap<String, chunkData>> map = new HashMap<>();
|
||||
|
||||
class chunkData {
|
||||
private CMIChunkPersistentDataContainer container;
|
||||
private long lastClean = 0;
|
||||
|
||||
chunkData(CMIChunkPersistentDataContainer container) {
|
||||
this.container = container;
|
||||
lastClean = System.currentTimeMillis();
|
||||
}
|
||||
|
||||
public long getLastClean() {
|
||||
return lastClean;
|
||||
}
|
||||
|
||||
public void setLastClean(long lastClean) {
|
||||
this.lastClean = lastClean;
|
||||
}
|
||||
|
||||
public CMIChunkPersistentDataContainer getContainer() {
|
||||
return container;
|
||||
}
|
||||
}
|
||||
|
||||
private CMIChunkPersistentDataContainer getPDC(Block block) {
|
||||
if (block == null)
|
||||
return null;
|
||||
return getPDC(block.getChunk());
|
||||
}
|
||||
|
||||
private CMIChunkPersistentDataContainer getPDC(Chunk chunk) {
|
||||
if (chunk == null)
|
||||
return null;
|
||||
chunkData data = getChunkData(chunk);
|
||||
return data == null ? null : data.getContainer();
|
||||
}
|
||||
|
||||
private chunkData getChunkData(Chunk chunk) {
|
||||
if (chunk == null)
|
||||
return null;
|
||||
HashMap<String, chunkData> world = map.computeIfAbsent(chunk.getWorld().getName(), x -> new HashMap<>());
|
||||
return world.computeIfAbsent(chunk.getX() + ":" + chunk.getZ(), x -> new chunkData(new CMIChunkPersistentDataContainer(NAMEGENERAL, chunk)));
|
||||
}
|
||||
|
||||
public void removePDC(Chunk chunk) {
|
||||
if (!Jobs.getGCManager().useNewBlockProtection)
|
||||
return;
|
||||
HashMap<String, chunkData> world = map.get(chunk.getWorld().getName());
|
||||
if (world == null)
|
||||
return;
|
||||
world.remove(chunk.getX() + ":" + chunk.getZ());
|
||||
}
|
||||
|
||||
public void addProtection(Block block, Integer cd) {
|
||||
|
||||
if (cd == null || cd == 0)
|
||||
return;
|
||||
|
||||
// Assuming that block is bottom part of flower we will add top part to the record too
|
||||
switch (CMIMaterial.get(block)) {
|
||||
case LILAC:
|
||||
case SUNFLOWER:
|
||||
case ROSE_BUSH:
|
||||
case PEONY:
|
||||
CMIBlock cmb = new CMIBlock(block);
|
||||
// We are only interested in this being bottom block as this should never trigger for top part of placed block
|
||||
if (cmb.getBisect().equals(Bisect.BOTTOM))
|
||||
addProtection(block.getLocation().clone().add(0, 1, 0).getBlock(), cd, true);
|
||||
break;
|
||||
}
|
||||
|
||||
addProtection(block, cd, true);
|
||||
}
|
||||
|
||||
public void addProtection(Block block, Integer cd, boolean paid) {
|
||||
if (cd == null || cd == 0)
|
||||
return;
|
||||
|
||||
addProtection(block, cd != -1 ? System.currentTimeMillis() + (cd * 1000) : -1, paid);
|
||||
}
|
||||
|
||||
private String convertLoc(Location loc) {
|
||||
return convertLoc(loc.toVector());
|
||||
}
|
||||
|
||||
private String convertLoc(Vector loc) {
|
||||
return loc.getBlockX() + "." + loc.getBlockY() + "." + loc.getBlockZ();
|
||||
}
|
||||
|
||||
private int shortenLong(long value) {
|
||||
if (value == -1)
|
||||
return -1;
|
||||
return (int) (value / 1000) - 2147483647;
|
||||
}
|
||||
|
||||
private Long deconvertLong(Integer value) {
|
||||
if (value == null)
|
||||
return null;
|
||||
if (value == -1)
|
||||
return -1L;
|
||||
return (value + 2147483647L) * 1000L;
|
||||
}
|
||||
|
||||
public ExploitProtection addProtection(Block block, Long protectedUntil, boolean paid) {
|
||||
if (!Jobs.getGCManager().useNewBlockProtection) {
|
||||
BlockProtection protection = Jobs.getBpManager().addP(block.getLocation(), protectedUntil, paid, true);
|
||||
|
||||
ExploitProtection ep = new ExploitProtection(block.getLocation().toVector());
|
||||
ep.setPaid(protection.isPaid());
|
||||
ep.setProtectedUntil(protection.getTime());
|
||||
return ep;
|
||||
}
|
||||
|
||||
if (protectedUntil == null || protectedUntil == 0)
|
||||
return null;
|
||||
|
||||
if (block == null)
|
||||
return null;
|
||||
|
||||
CMIChunkPersistentDataContainer pdc = getPDC(block);
|
||||
|
||||
if (pdc == null)
|
||||
return null;
|
||||
|
||||
String locString = convertLoc(block.getLocation());
|
||||
|
||||
pdc.set(locString, NAMETIME, shortenLong(protectedUntil));
|
||||
if (!paid)
|
||||
pdc.set(locString, NAMEPAID, paid);
|
||||
else
|
||||
pdc.remove(locString, NAMEPAID);
|
||||
pdc.save();
|
||||
|
||||
ExploitProtection ep = new ExploitProtection(block.getLocation().toVector());
|
||||
ep.setPaid(paid);
|
||||
ep.setProtectedUntil(protectedUntil);
|
||||
|
||||
return ep;
|
||||
}
|
||||
|
||||
public void remove(Block block) {
|
||||
if (!Jobs.getGCManager().useNewBlockProtection) {
|
||||
Jobs.getBpManager().remove(block);
|
||||
return;
|
||||
}
|
||||
|
||||
// In case double plant was destroyed we should remove both blocks from records
|
||||
CMIMaterial cmat = CMIMaterial.get(block);
|
||||
switch (cmat) {
|
||||
case LILAC:
|
||||
case SUNFLOWER:
|
||||
case ROSE_BUSH:
|
||||
case PEONY:
|
||||
CMIBlock cmb = new CMIBlock(block);
|
||||
if (cmb.getBisect().equals(Bisect.BOTTOM)) {
|
||||
block = block.getLocation().clone().add(0, 1, 0).getBlock();
|
||||
} else {
|
||||
block = block.getLocation().clone().add(0, -1, 0).getBlock();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
CMIChunkPersistentDataContainer pdc = getPDC(block);
|
||||
String locString = convertLoc(block.getLocation());
|
||||
pdc.remove(locString);
|
||||
pdc.save();
|
||||
}
|
||||
|
||||
public Long getTime(Block block) {
|
||||
|
||||
if (!Jobs.getGCManager().useNewBlockProtection)
|
||||
return Jobs.getBpManager().getTime(block);
|
||||
|
||||
CMIChunkPersistentDataContainer pdc = getPDC(block);
|
||||
String locString = convertLoc(block.getLocation());
|
||||
return deconvertLong(pdc.getInt(locString, NAMETIME));
|
||||
}
|
||||
|
||||
public Long getTime(Location loc) {
|
||||
return getTime(loc.getBlock());
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public Integer getBlockProtectionTime(Block block) {
|
||||
return getBlockProtectionTime(ActionType.PLACE, block);
|
||||
}
|
||||
|
||||
public Integer getBlockProtectionTime(ActionType action, Block block) {
|
||||
|
||||
switch (action) {
|
||||
case BREAK:
|
||||
if (Jobs.getGCManager().useGlobalBreakTimer)
|
||||
return Jobs.getGCManager().globalBlockBreakTimer;
|
||||
break;
|
||||
case PLACE:
|
||||
Integer time = Jobs.getRestrictedBlockManager().restrictedBlocksTimer.get(CMIMaterial.get(block));
|
||||
if (time == null && Jobs.getGCManager().useGlobalTimer)
|
||||
return Jobs.getGCManager().globalblocktimer;
|
||||
return time == null ? 0 : time;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
public boolean isInProtection(Block block) {
|
||||
return Jobs.getRestrictedBlockManager().restrictedBlocksTimer.containsKey(CMIMaterial.get(block));
|
||||
}
|
||||
|
||||
public void setPaid(Block block, boolean paid) {
|
||||
CMIChunkPersistentDataContainer pdc = getPDC(block);
|
||||
String locString = convertLoc(block.getLocation());
|
||||
if (!paid)
|
||||
pdc.set(locString, NAMEPAID, paid);
|
||||
else
|
||||
pdc.remove(locString, NAMEPAID);
|
||||
pdc.save();
|
||||
}
|
||||
|
||||
private ExploitProtection getProtection(Block block) {
|
||||
|
||||
ExploitProtection ep = new ExploitProtection(block.getLocation().toVector());
|
||||
|
||||
CMIChunkPersistentDataContainer pdc = getPDC(block);
|
||||
|
||||
String locString = convertLoc(block.getLocation());
|
||||
Boolean paidValue = pdc.getBoolean(locString, NAMEPAID);
|
||||
ep.setPaid(paidValue == null ? true : paidValue);
|
||||
ep.setProtectedUntil(deconvertLong(pdc.getInt(locString, NAMETIME)));
|
||||
return ep;
|
||||
}
|
||||
|
||||
public boolean isProtectionValidAddIfNotExists(JobsPlayer player, ActionInfo info, Block block, boolean inform) {
|
||||
if (!Jobs.getGCManager().useNewBlockProtection)
|
||||
return Jobs.getBpManager().isBpOk(player, info, block, inform);
|
||||
|
||||
if (block == null || !Jobs.getGCManager().useBlockProtection)
|
||||
return true;
|
||||
|
||||
if (info.getType() == ActionType.BREAK) {
|
||||
if (block.hasMetadata("JobsExploit")) {
|
||||
//player.sendMessage("This block is protected using Rukes' system!");
|
||||
return false;
|
||||
}
|
||||
|
||||
ExploitProtection exploitProtection = getProtection(block);
|
||||
if (exploitProtection.getProtectedUntil() != 0) {
|
||||
long time = exploitProtection.getProtectedUntil();
|
||||
|
||||
if (time == -1L) {
|
||||
remove(block);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (time < System.currentTimeMillis()) {
|
||||
remove(block);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (time > System.currentTimeMillis() || exploitProtection.isPaid()) {
|
||||
if (inform && player.canGetPaid(info))
|
||||
CMIActionBar.send(player.getPlayer(), Jobs.getLanguage().getMessage("message.blocktimer", "[time]", Math.round((time - System.currentTimeMillis()) / 1000L)));
|
||||
return false;
|
||||
}
|
||||
|
||||
addProtection(block, getBlockProtectionTime(info.getType(), block));
|
||||
|
||||
} else {
|
||||
addProtection(block, getBlockProtectionTime(info.getType(), block));
|
||||
}
|
||||
} else if (info.getType() == ActionType.PLACE) {
|
||||
ExploitProtection exploitProtection = getProtection(block);
|
||||
if (exploitProtection.getProtectedUntil() != 0) {
|
||||
|
||||
long time = exploitProtection.getProtectedUntil();
|
||||
|
||||
Integer cd = getBlockProtectionTime(info.getType(), block);
|
||||
if (time != -1L) {
|
||||
if (time < System.currentTimeMillis()) {
|
||||
addProtection(block, cd);
|
||||
return true;
|
||||
}
|
||||
|
||||
if ((time > System.currentTimeMillis() || exploitProtection.isPaid())) {
|
||||
if (inform && player.canGetPaid(info))
|
||||
CMIActionBar.send(player.getPlayer(), Jobs.getLanguage().getMessage("message.blocktimer", "[time]", Math.round((time - System.currentTimeMillis()) / 1000L)));
|
||||
addProtection(block, cd);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Lets add protection in any case
|
||||
addProtection(block, cd);
|
||||
} else if (exploitProtection.isPaid() && exploitProtection.getProtectedUntil() == -1L && cd != null && cd == -1) {
|
||||
addProtection(block, cd);
|
||||
return false;
|
||||
} else
|
||||
addProtection(block, cd);
|
||||
} else
|
||||
addProtection(block, getBlockProtectionTime(info.getType(), block));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public void cleanChunk(Chunk chunk) {
|
||||
|
||||
if (!Jobs.getGCManager().useNewBlockProtection)
|
||||
return;
|
||||
|
||||
try {
|
||||
|
||||
chunkData pdc = getChunkData(chunk);
|
||||
|
||||
if (pdc == null)
|
||||
return;
|
||||
|
||||
// Delay to clean it up once more to prevent rapid updates of same chunk
|
||||
if (pdc.getLastClean() + (30 * 1000L) > System.currentTimeMillis())
|
||||
return;
|
||||
|
||||
Set<NamespacedKey> keys = pdc.getContainer().getKeys();
|
||||
|
||||
for (NamespacedKey one : keys) {
|
||||
Long time = deconvertLong(pdc.getContainer().getInt(one.getKey(), NAMETIME));
|
||||
if (time != null && time < System.currentTimeMillis()) {
|
||||
pdc.getContainer().remove(one.getKey());
|
||||
}
|
||||
}
|
||||
pdc.getContainer().save();
|
||||
pdc.setLastClean(System.currentTimeMillis());
|
||||
|
||||
} catch (Throwable e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
@ -2,12 +2,16 @@ package com.gamingmesh.jobs.config;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import org.bukkit.Chunk;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.persistence.PersistentDataType;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import com.gamingmesh.jobs.Jobs;
|
||||
import com.gamingmesh.jobs.container.ExploreChunk;
|
||||
@ -15,10 +19,13 @@ import com.gamingmesh.jobs.container.ExploreRegion;
|
||||
import com.gamingmesh.jobs.container.ExploreRespond;
|
||||
import com.gamingmesh.jobs.container.JobsWorld;
|
||||
import com.gamingmesh.jobs.dao.JobsDAO.ExploreDataTableFields;
|
||||
import com.gamingmesh.jobs.i18n.Language;
|
||||
import com.gamingmesh.jobs.stuff.Util;
|
||||
|
||||
import net.Zrips.CMILib.Messages.CMIMessages;
|
||||
import net.Zrips.CMILib.PersistentData.CMIChunkPersistentDataContainer;
|
||||
|
||||
@Deprecated
|
||||
public class ExploreManager {
|
||||
|
||||
private final Map<String, Map<String, ExploreRegion>> worlds = new HashMap<>();
|
||||
@ -42,6 +49,31 @@ public class ExploreManager {
|
||||
exploreEnabled = true;
|
||||
}
|
||||
|
||||
public List<Integer> getVisitors(Chunk chunk) {
|
||||
|
||||
Map<String, ExploreRegion> exploreRegion = worlds.get(chunk.getWorld().getName());
|
||||
|
||||
if (exploreRegion == null)
|
||||
return null;
|
||||
|
||||
int RegionX = (int) Math.floor(chunk.getX() / 32D);
|
||||
int RegionZ = (int) Math.floor(chunk.getZ() / 32D);
|
||||
ExploreRegion region = exploreRegion.get(RegionX + ":" + RegionZ);
|
||||
if (region == null)
|
||||
return null;
|
||||
|
||||
ExploreChunk echunk = region.getChunk(chunk);
|
||||
|
||||
if (echunk == null)
|
||||
return null;
|
||||
|
||||
if (Jobs.getGCManager().ExploreCompact && echunk.isFullyExplored()) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
return echunk.getPlayers();
|
||||
}
|
||||
|
||||
public void load() {
|
||||
if (!exploreEnabled)
|
||||
return;
|
||||
|
@ -73,7 +73,7 @@ public class GeneralConfigManager {
|
||||
private String getSelectionTool, DecimalPlacesMoney, DecimalPlacesExp, DecimalPlacesPoints;
|
||||
|
||||
public int jobExpiryTime, BlockProtectionDays, FireworkPower, ShootTime, blockOwnershipRange,
|
||||
globalblocktimer, CowMilkingTimer, InfoUpdateInterval, JobsTopAmount, PlaceholdersPage, ConfirmExpiryTime,
|
||||
globalblocktimer, globalBlockBreakTimer, CowMilkingTimer, InfoUpdateInterval, JobsTopAmount, PlaceholdersPage, ConfirmExpiryTime,
|
||||
SegmentCount, BossBarTimer, AutoJobJoinDelay, DBCleaningJobsLvl, DBCleaningUsersDays, BlastFurnacesMaxDefault, SmokersMaxDefault,
|
||||
levelLossPercentageFromMax, levelLossPercentage, SoundLevelupVolume, SoundLevelupPitch, SoundTitleChangeVolume,
|
||||
SoundTitleChangePitch, ToplistInScoreboardInterval;
|
||||
@ -92,8 +92,9 @@ public class GeneralConfigManager {
|
||||
|
||||
private FireworkEffect fireworkEffect;
|
||||
|
||||
public boolean ignoreOreGenerators, useBlockProtection, useBlockProtectionBlockTracker, enableSchedule, PayForRenaming, PayForEnchantingOnAnvil, PayForEachCraft, SignsEnabled,
|
||||
SignsColorizeJobName, ShowToplistInScoreboard, useGlobalTimer, useSilkTouchProtection, UseCustomNames,
|
||||
public boolean ignoreOreGenerators, useBlockProtection, useNewBlockProtection, useNewExploration, useBlockProtectionBlockTracker, enableSchedule, PayForRenaming, PayForEnchantingOnAnvil,
|
||||
PayForEachCraft, SignsEnabled,
|
||||
SignsColorizeJobName, ShowToplistInScoreboard, useGlobalTimer, useGlobalBreakTimer, useSilkTouchProtection, UseCustomNames,
|
||||
PreventSlimeSplit, PreventMagmaCubeSplit, PreventHopperFillUps, PreventBrewingStandFillUps, informOnPaymentDisable,
|
||||
BrowseUseNewLook, payExploringWhenGliding = false, resetExploringData = false, disablePaymentIfMaxLevelReached, disablePaymentIfRiding,
|
||||
boostedItemsInOffHand = false, boostedItemsInMainHand, boostedArmorItems, boostedItemsSlotSpecific, multiplyBoostedExtraValues, addPermissionBoost,
|
||||
@ -423,6 +424,12 @@ public class GeneralConfigManager {
|
||||
DisabledWorldsList = c.get("Optimizations.DisabledWorlds.List", Arrays.asList("Example", "Worlds"));
|
||||
CMIList.toLowerCase(DisabledWorldsList);
|
||||
|
||||
if (Version.isCurrentEqualOrHigher(Version.v1_14_R1)) {
|
||||
c.addComment("Optimizations.Explore.NewMethod",
|
||||
"Do you want to use new exploration tracking method. Only for 1.14+ servers");
|
||||
useNewExploration = c.get("Optimizations.Explore.NewMethod", true);
|
||||
}
|
||||
|
||||
c.addComment("Optimizations.Explore.Compact",
|
||||
"By setting this to true when there is max amount of players explored a chunk then it will be marked as fully explored and exact players who explored it will not be saved to save some memory");
|
||||
ExploreCompact = c.get("Optimizations.Explore.Compact", true);
|
||||
@ -883,16 +890,24 @@ public class GeneralConfigManager {
|
||||
"Enable blocks protection, like ore, from exploiting by placing and destroying same block again and again.",
|
||||
"Modify restrictedBlocks.yml for blocks you want to protect");
|
||||
useBlockProtection = c.get("ExploitProtections.General.PlaceAndBreak.Enabled", c.getC().getBoolean("ExploitProtections.General.PlaceAndBreakProtection", true));
|
||||
|
||||
|
||||
if (Version.isCurrentEqualOrHigher(Version.v1_14_R1)) {
|
||||
c.addComment("ExploitProtections.General.PlaceAndBreak.NewMethod",
|
||||
"Should we use new block protection method", "In most cases this is more efficient way to check for break/place protection and doesn't involve any cache or data saving into database",
|
||||
"Only works with 1.14+ servers");
|
||||
useNewBlockProtection = c.get("ExploitProtections.General.PlaceAndBreak.NewMethod", true);
|
||||
}
|
||||
|
||||
c.addComment("ExploitProtections.General.PlaceAndBreak.BlockTracker.Enabled",
|
||||
"Should we use BlockTracker plugin instead of built in block tracker");
|
||||
useBlockProtectionBlockTracker = c.get("ExploitProtections.General.PlaceAndBreak.BlockTracker.Enabled", false);
|
||||
|
||||
|
||||
c.addComment("ExploitProtections.General.PlaceAndBreak.IgnoreOreGenerators",
|
||||
"Enabling this we will ignore blocks generated in ore generators, liko stone, coublestone and obsidian. You can still use timer on player placed obsidian block");
|
||||
ignoreOreGenerators = c.get("ExploitProtections.General.PlaceAndBreak.IgnoreOreGenerators", true);
|
||||
|
||||
c.addComment("ExploitProtections.General.PlaceAndBreak.KeepDataFor",
|
||||
"Only applies when old method is used",
|
||||
"For how long in days to keep block protection data in data base", "This will clean block data which ones have -1 as cooldown value",
|
||||
"Data base cleanup will be performed on each server startup", "This cant be more then 14 days");
|
||||
BlockProtectionDays = c.get("ExploitProtections.General.PlaceAndBreak.KeepDataFor", c.getC().getInt("ExploitProtections.General.KeepDataFor", 14));
|
||||
@ -902,15 +917,23 @@ public class GeneralConfigManager {
|
||||
+ " once you have broken the block in one place.");
|
||||
allowBreakPaymentForOreGenerators = c.get("ExploitProtections.General.AllowBreakPaymentForOreGenerators", false);*/
|
||||
|
||||
c.addComment("ExploitProtections.General.PlaceAndBreak.GlobalBlockTimer", "All blocks will be protected X sec after player places it on ground.");
|
||||
useGlobalTimer = c.get("ExploitProtections.General.PlaceAndBreak.GlobalBlockTimer.Use", c.getC().getBoolean("ExploitProtections.General.GlobalBlockTimer.use", true));
|
||||
c.addComment("ExploitProtections.General.PlaceAndBreak.GlobalBlockTimer.Timer", "Time in seconds. This can only be positive number");
|
||||
globalblocktimer = c.get("ExploitProtections.General.PlaceAndBreak.GlobalBlockTimer.Timer", c.getC().getInt("ExploitProtections.General.GlobalBlockTimer.timer", 3));
|
||||
globalblocktimer = CMINumber.clamp(globalblocktimer, 1, 99999);
|
||||
c.addComment("ExploitProtections.General.PlaceAndBreak.GlobalBlockTimer.Place", "All blocks will be protected X seconds after player places it");
|
||||
useGlobalTimer = c.get("ExploitProtections.General.PlaceAndBreak.GlobalBlockTimer.Place.Use", c.getC().getBoolean("ExploitProtections.General.PlaceAndBreak.GlobalBlockTimer.Use", true));
|
||||
c.addComment("ExploitProtections.General.PlaceAndBreak.GlobalBlockTimer.Place.Timer",
|
||||
"Time in seconds. This can only be positive number and no higher than 900",
|
||||
"If higher timers are needed then it can be defined in restrictedBlocks.yml file for each specific block");
|
||||
globalblocktimer = c.get("ExploitProtections.General.PlaceAndBreak.GlobalBlockTimer.Place.Timer", c.getC().getInt("ExploitProtections.General.PlaceAndBreak.GlobalBlockTimer.Timer", 3));
|
||||
globalblocktimer = CMINumber.clamp(globalblocktimer, 1, 900);
|
||||
useGlobalBreakTimer = c.get("ExploitProtections.General.PlaceAndBreak.GlobalBlockTimer.Break.Use", true);
|
||||
c.addComment("ExploitProtections.General.PlaceAndBreak.GlobalBlockTimer.Break.Timer",
|
||||
"Time in seconds. This can only be positive number and no higher than 60",
|
||||
"This is only to prevent player from placing blocks into same place and getting paid once more");
|
||||
globalBlockBreakTimer = c.get("ExploitProtections.General.PlaceAndBreak.GlobalBlockTimer.Break.Timer", 3);
|
||||
globalBlockBreakTimer = CMINumber.clamp(globalBlockBreakTimer, 1, 60);
|
||||
|
||||
c.addComment("ExploitProtections.General.PlaceAndBreak.SilkTouchProtection", "Enable silk touch protection.",
|
||||
"With this enabled players wont get paid for broken blocks from restrictedblocks list with silk touch tool.");
|
||||
useSilkTouchProtection = c.get("ExploitProtections.General.PlaceAndBreak.SilkTouchProtection", c.getC().getBoolean("ExploitProtections.General.SilkTouchProtection", false));
|
||||
useSilkTouchProtection = c.get("ExploitProtections.General.PlaceAndBreak.SilkTouchProtection", false);
|
||||
|
||||
c.addComment("ExploitProtections.General.MonsterDamage.Use", "This section controls how much damage player should do to monster for player to get paid",
|
||||
"This prevents from killing monsters in one hit when they suffer in example fall damage");
|
||||
|
@ -292,6 +292,9 @@ public class LanguageManager {
|
||||
c.get("command.entitylist.help.info", "Shows all possible entities that can be used with the plugin.");
|
||||
c.get("command.entitylist.help.args", "");
|
||||
|
||||
c.get("command.recalculatepermissions.help.info", "Reset players permission cache");
|
||||
c.get("command.recalculatepermissions.help.args", "(playername)");
|
||||
|
||||
c.get("command.stats.help.info", "Show the level you are in each job you are part of.");
|
||||
c.get("command.stats.help.args", "[playername]");
|
||||
Jobs.getGCManager().getCommandArgs().put("stats", Arrays.asList("[playername]"));
|
||||
@ -420,6 +423,8 @@ public class LanguageManager {
|
||||
c.get("command.info.output.bake.none", "%jobname% does not get money for cooking foods.");
|
||||
c.get("command.info.output.bucket.info", "&eBucket");
|
||||
c.get("command.info.output.bucket.none", "%jobname% does not get money for bucketing.");
|
||||
c.get("command.info.output.brush.info", "&eBrush");
|
||||
c.get("command.info.output.brush.none", "%jobname% does not get money for brushing blocks.");
|
||||
|
||||
c.get("command.playerinfo.help.info", "Show how much each job is getting paid and for what on another player.");
|
||||
c.get("command.playerinfo.help.args", "[playername] [jobname] [action]");
|
||||
|
@ -125,25 +125,9 @@ public class NameTranslatorManager {
|
||||
case KILL:
|
||||
case MILK:
|
||||
case TAME:
|
||||
for (NameList one : listOfEntities) {
|
||||
String ids = one.getId() + ":" + one.getMeta();
|
||||
|
||||
if (!one.getMeta().isEmpty() && !one.getId().equals("0") && ids.equalsIgnoreCase(id + ":" + meta)) {
|
||||
return one.getName();
|
||||
}
|
||||
|
||||
ids = one.getId();
|
||||
|
||||
if (!one.getId().equals("0") && ids.equalsIgnoreCase(Integer.toString(id))) {
|
||||
return one.getName();
|
||||
}
|
||||
|
||||
ids = one.getMinecraftName();
|
||||
|
||||
if (ids.equalsIgnoreCase(name)) {
|
||||
return one.getName();
|
||||
}
|
||||
}
|
||||
String entityName = getEntityName(id, meta, name);
|
||||
if (entityName != null)
|
||||
return entityName;
|
||||
break;
|
||||
case ENCHANT:
|
||||
String mName = materialName;
|
||||
@ -186,6 +170,10 @@ public class NameTranslatorManager {
|
||||
}
|
||||
}
|
||||
|
||||
entityName = getEntityName(id, meta, name);
|
||||
if (entityName != null)
|
||||
return entityName;
|
||||
|
||||
return name == null ? "nocolor" : Arrays.stream(name.split("\\s|:|-"))
|
||||
.map(word -> word.substring(0, 1).toUpperCase() + word.substring(1).toLowerCase())
|
||||
.collect(Collectors.joining(" ")); // returns capitalized word (from this -> To This)
|
||||
@ -203,6 +191,29 @@ public class NameTranslatorManager {
|
||||
return materialName;
|
||||
}
|
||||
|
||||
private String getEntityName(int id, String meta, String name) {
|
||||
for (NameList one : listOfEntities) {
|
||||
String ids = one.getId() + ":" + one.getMeta();
|
||||
|
||||
if (!one.getMeta().isEmpty() && !one.getId().equals("0") && ids.equalsIgnoreCase(id + ":" + meta)) {
|
||||
return one.getName();
|
||||
}
|
||||
|
||||
ids = one.getId();
|
||||
|
||||
if (!one.getId().equals("0") && ids.equalsIgnoreCase(Integer.toString(id))) {
|
||||
return one.getName();
|
||||
}
|
||||
|
||||
ids = one.getMinecraftName();
|
||||
|
||||
if (ids.equalsIgnoreCase(name)) {
|
||||
return one.getName();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void readFile() {
|
||||
YmlMaker itemFile = new YmlMaker(Jobs.getFolder(), "TranslatableWords" + File.separator + "Words_"
|
||||
+ Jobs.getGCManager().localeString + ".yml");
|
||||
|
@ -45,7 +45,8 @@ public enum ActionType {
|
||||
CUSTOMKILL("custom-kill"),
|
||||
COLLECT(),
|
||||
BAKE(),
|
||||
BUCKET();
|
||||
BUCKET(),
|
||||
BRUSH();
|
||||
|
||||
private String name;
|
||||
|
||||
|
@ -0,0 +1,56 @@
|
||||
package com.gamingmesh.jobs.container;
|
||||
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
public class ExploitProtection {
|
||||
|
||||
private long protectedUntil = -1;
|
||||
private boolean paid = false;
|
||||
private int x = 0;
|
||||
private short y = 0;
|
||||
private int z = 0;
|
||||
|
||||
public ExploitProtection(Vector pos) {
|
||||
this(pos.getBlockX(), pos.getBlockY(), pos.getBlockZ());
|
||||
}
|
||||
|
||||
public ExploitProtection(Vector pos, boolean paid, long protectedUntil) {
|
||||
this(pos.getBlockX(), pos.getBlockY(), pos.getBlockZ());
|
||||
this.paid = paid;
|
||||
this.protectedUntil = protectedUntil;
|
||||
}
|
||||
|
||||
public ExploitProtection(int x, int y, int z) {
|
||||
this.x = x;
|
||||
this.y = (short) y;
|
||||
this.z = z;
|
||||
}
|
||||
|
||||
public long getProtectedUntil() {
|
||||
return protectedUntil;
|
||||
}
|
||||
|
||||
public void setProtectedUntil(Long time) {
|
||||
this.protectedUntil = time == null ? 0 : time < 0 ? -1 : time;
|
||||
}
|
||||
|
||||
public boolean isPaid() {
|
||||
return paid;
|
||||
}
|
||||
|
||||
public void setPaid(Boolean paid) {
|
||||
this.paid = paid == null ? false : paid;
|
||||
}
|
||||
|
||||
public int getX() {
|
||||
return x;
|
||||
}
|
||||
|
||||
public int getY() {
|
||||
return y;
|
||||
}
|
||||
|
||||
public int getZ() {
|
||||
return z;
|
||||
}
|
||||
}
|
@ -5,6 +5,7 @@ import java.util.List;
|
||||
|
||||
import com.gamingmesh.jobs.Jobs;
|
||||
|
||||
@Deprecated
|
||||
public class ExploreChunk {
|
||||
|
||||
private List<Integer> playerIds = new ArrayList<>();
|
||||
|
@ -2,9 +2,12 @@ package com.gamingmesh.jobs.container;
|
||||
|
||||
public class ExploreRespond {
|
||||
|
||||
private int count;
|
||||
private int count = 0;
|
||||
private boolean newChunk = false;
|
||||
|
||||
public ExploreRespond() {
|
||||
}
|
||||
|
||||
public ExploreRespond(int count, boolean newChunk) {
|
||||
this.count = count;
|
||||
this.newChunk = newChunk;
|
||||
@ -17,4 +20,12 @@ public class ExploreRespond {
|
||||
public boolean isNewChunk() {
|
||||
return newChunk;
|
||||
}
|
||||
|
||||
public void setCount(int count) {
|
||||
this.count = count;
|
||||
}
|
||||
|
||||
public void setNewChunk(boolean newChunk) {
|
||||
this.newChunk = newChunk;
|
||||
}
|
||||
}
|
||||
|
@ -2465,6 +2465,9 @@ public abstract class JobsDAO {
|
||||
* @param jobBlockProtection - the information getting saved
|
||||
*/
|
||||
public void loadBlockProtection() {
|
||||
if (Jobs.getGCManager().useNewBlockProtection)
|
||||
return;
|
||||
|
||||
JobsConnection conn = getConnection();
|
||||
if (conn == null)
|
||||
return;
|
||||
@ -2552,6 +2555,9 @@ public abstract class JobsDAO {
|
||||
if (!Jobs.getExploreManager().isExploreEnabled())
|
||||
return;
|
||||
|
||||
if (Jobs.getGCManager().useNewExploration)
|
||||
return;
|
||||
|
||||
JobsConnection conn = getConnection();
|
||||
if (conn == null)
|
||||
return;
|
||||
@ -2577,7 +2583,7 @@ public abstract class JobsDAO {
|
||||
int id = jobsWorld == null ? 0 : jobsWorld.getId();
|
||||
if (id == 0)
|
||||
continue;
|
||||
|
||||
|
||||
for (Entry<String, ExploreRegion> region : worlds.getValue().entrySet()) {
|
||||
for (Entry<Short, ExploreChunk> oneChunk : region.getValue().getChunks().entrySet()) {
|
||||
ExploreChunk chunk = oneChunk.getValue();
|
||||
@ -2617,6 +2623,9 @@ public abstract class JobsDAO {
|
||||
if (!Jobs.getExploreManager().isExploreEnabled())
|
||||
return;
|
||||
|
||||
if (Jobs.getGCManager().useNewExploration)
|
||||
return;
|
||||
|
||||
JobsConnection conn = getConnection();
|
||||
if (conn == null)
|
||||
return;
|
||||
@ -2669,6 +2678,9 @@ public abstract class JobsDAO {
|
||||
if (!Jobs.getExploreManager().isExploreEnabled())
|
||||
return;
|
||||
|
||||
if (Jobs.getGCManager().useNewExploration)
|
||||
return;
|
||||
|
||||
JobsConnection conn = getConnection();
|
||||
if (conn == null)
|
||||
return;
|
||||
@ -2720,6 +2732,9 @@ public abstract class JobsDAO {
|
||||
if (!Jobs.getExploreManager().isExploreEnabled())
|
||||
return false;
|
||||
|
||||
if (Jobs.getGCManager().useNewExploration)
|
||||
return false;
|
||||
|
||||
JobsConnection conn = getConnection();
|
||||
if (conn == null)
|
||||
return false;
|
||||
|
@ -17,6 +17,7 @@ import com.gamingmesh.jobs.hooks.stackMob.StackMobHandler;
|
||||
import com.gamingmesh.jobs.hooks.wildStacker.WildStackerHandler;
|
||||
|
||||
import net.Zrips.CMILib.Messages.CMIMessages;
|
||||
import net.Zrips.CMILib.Version.Schedulers.CMIScheduler;
|
||||
|
||||
public class HookManager {
|
||||
|
||||
@ -36,13 +37,15 @@ public class HookManager {
|
||||
public static void loadHooks() {
|
||||
pm = PLUGIN.getServer().getPluginManager();
|
||||
|
||||
setMyPetManager();
|
||||
setWorldGuard();
|
||||
setMythicManager();
|
||||
setStackMobHandler();
|
||||
setWildStackerHandler();
|
||||
setBlockTrackerManager();
|
||||
setPyroFishingProManager();
|
||||
CMIScheduler.runTask(() -> {
|
||||
setMyPetManager();
|
||||
setWorldGuard();
|
||||
setMythicManager();
|
||||
setStackMobHandler();
|
||||
setWildStackerHandler();
|
||||
setBlockTrackerManager();
|
||||
setPyroFishingProManager();
|
||||
});
|
||||
}
|
||||
|
||||
public static StackMobHandler getStackMobHandler() {
|
||||
@ -99,6 +102,10 @@ public class HookManager {
|
||||
return Jobs.getGCManager().MythicMobsEnabled && MythicManager != null && MythicManager.check();
|
||||
}
|
||||
|
||||
public static boolean checkPyroFishingPro() {
|
||||
return pyroFishingProManager != null;
|
||||
}
|
||||
|
||||
public static BlockTrackerManager getBlockTrackerManager() {
|
||||
if (blockTrackerManager == null) {
|
||||
blockTrackerManager = new BlockTrackerManager();
|
||||
@ -110,7 +117,7 @@ public class HookManager {
|
||||
private static boolean setWorldGuard() {
|
||||
if (JobsHook.WorldGuard.isEnabled()) {
|
||||
worldGuardManager = new WorldGuardManager();
|
||||
CMIMessages.consoleMessage("&eWorldGuard detected.");
|
||||
CMIMessages.consoleMessage("&e" + JobsHook.WorldGuard + " detected.");
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -144,31 +151,35 @@ public class HookManager {
|
||||
private static void setMyPetManager() {
|
||||
if (JobsHook.MyPet.isEnabled()) {
|
||||
myPetManager = new MyPetManager();
|
||||
CMIMessages.consoleMessage("&eMyPet detected.");
|
||||
CMIMessages.consoleMessage("&e" + JobsHook.MyPet + " detected.");
|
||||
}
|
||||
}
|
||||
|
||||
private static void setStackMobHandler() {
|
||||
if (JobsHook.StackMob.isEnabled()) {
|
||||
stackMobHandler = new StackMobHandler();
|
||||
CMIMessages.consoleMessage("&e" + JobsHook.StackMob + " detected.");
|
||||
}
|
||||
}
|
||||
|
||||
private static void setWildStackerHandler() {
|
||||
if (JobsHook.WildStacker.isEnabled()) {
|
||||
wildStackerHandler = new WildStackerHandler();
|
||||
CMIMessages.consoleMessage("&e" + JobsHook.WildStacker + " detected.");
|
||||
}
|
||||
}
|
||||
|
||||
private static void setBlockTrackerManager() {
|
||||
if (JobsHook.BlockTracker.isEnabled()) {
|
||||
blockTrackerManager = new BlockTrackerManager();
|
||||
CMIMessages.consoleMessage("&e" + JobsHook.BlockTracker + " detected.");
|
||||
}
|
||||
}
|
||||
|
||||
private static void setPyroFishingProManager() {
|
||||
if (JobsHook.PyroFishingPro.isEnabled()) {
|
||||
pyroFishingProManager = new PyroFishingProManager();
|
||||
CMIMessages.consoleMessage("&e" + JobsHook.PyroFishingPro + " detected.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -18,18 +18,14 @@ public enum JobsHook {
|
||||
private Boolean present;
|
||||
|
||||
public boolean isEnabled() {
|
||||
if (enabled == null) {
|
||||
enabled = JavaPlugin.getPlugin(Jobs.class).getServer().getPluginManager().isPluginEnabled(name());
|
||||
}
|
||||
|
||||
if (enabled == null)
|
||||
enabled = JavaPlugin.getPlugin(Jobs.class).getServer().getPluginManager().isPluginEnabled(name());
|
||||
return enabled;
|
||||
}
|
||||
|
||||
public boolean isPresent() {
|
||||
if (present == null) {
|
||||
present = JavaPlugin.getPlugin(Jobs.class).getServer().getPluginManager().getPlugin(name()) != null;
|
||||
}
|
||||
|
||||
if (present == null)
|
||||
present = JavaPlugin.getPlugin(Jobs.class).getServer().getPluginManager().getPlugin(name()) != null;
|
||||
return present;
|
||||
}
|
||||
}
|
||||
|
@ -15,7 +15,7 @@ public class PyroFishingProManager implements Listener {
|
||||
|
||||
public PyroFishingProManager() {
|
||||
this.jobs = Jobs.getInstance();
|
||||
jobs.getServer().getPluginManager().registerEvents(this, jobs);
|
||||
registerListener();
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
|
||||
@ -29,4 +29,8 @@ public class PyroFishingProManager implements Listener {
|
||||
return null;
|
||||
return lastFish;
|
||||
}
|
||||
|
||||
public void registerListener() {
|
||||
jobs.getServer().getPluginManager().registerEvents(this, jobs);
|
||||
}
|
||||
}
|
@ -58,6 +58,7 @@ import org.bukkit.event.player.PlayerItemHeldEvent;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.event.player.PlayerMoveEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.event.world.ChunkUnloadEvent;
|
||||
import org.bukkit.event.world.StructureGrowEvent;
|
||||
import org.bukkit.event.world.WorldLoadEvent;
|
||||
import org.bukkit.inventory.EquipmentSlot;
|
||||
@ -118,16 +119,36 @@ public class JobsListener implements Listener {
|
||||
return time > 100;
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||
public void onChunkUnload(ChunkUnloadEvent event) {
|
||||
Jobs.getExploitManager().removePDC(event.getChunk());
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||
public void onChunkUnload(JobsChunkChangeEvent event) {
|
||||
Jobs.getExploitManager().cleanChunk(event.getOldChunk());
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void onBlockFromToEvent(BlockFromToEvent event) {
|
||||
|
||||
if (!Jobs.getGCManager().useBlockProtection)
|
||||
return;
|
||||
|
||||
if (!Jobs.getGCManager().ignoreOreGenerators)
|
||||
return;
|
||||
|
||||
if (!Jobs.getGCManager().canPerformActionInWorld(event.getBlock().getWorld()))
|
||||
return;
|
||||
Jobs.getBpManager().remove(event.getToBlock());
|
||||
|
||||
// Ignoring air blocks
|
||||
if (CMIMaterial.isAir(event.getToBlock().getType()))
|
||||
return;
|
||||
|
||||
if (CMIMaterial.isWater(event.getBlock().getType()))
|
||||
return;
|
||||
|
||||
Jobs.getExploitManager().remove(event.getToBlock());
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
@ -401,14 +422,24 @@ public class JobsListener implements Listener {
|
||||
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
|
||||
public void onCropGrown(final BlockGrowEvent event) {
|
||||
if (Jobs.getGCManager().canPerformActionInWorld(event.getBlock().getWorld())) {
|
||||
CMIScheduler.get().runAtLocationLater(event.getBlock().getLocation(), () -> Jobs.getBpManager().remove(event.getBlock()), 1L);
|
||||
CMIScheduler.runAtLocationLater(event.getBlock().getLocation(), () -> {
|
||||
if (Jobs.getGCManager().useNewBlockProtection)
|
||||
Jobs.getExploitManager().remove(event.getBlock());
|
||||
else
|
||||
Jobs.getBpManager().remove(event.getBlock());
|
||||
}, 1L);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
|
||||
public void onTreeGrown(final StructureGrowEvent event) {
|
||||
if (!event.getBlocks().isEmpty() && Jobs.getGCManager().canPerformActionInWorld(event.getBlocks().get(0).getWorld())) {
|
||||
CMIScheduler.get().runAtLocationLater(event.getBlocks().get(0).getLocation(), () -> event.getBlocks().forEach(blockState -> Jobs.getBpManager().remove(blockState.getBlock())), 1L);
|
||||
CMIScheduler.runAtLocationLater(event.getBlocks().get(0).getLocation(), () -> event.getBlocks().forEach(blockState -> {
|
||||
if (Jobs.getGCManager().useNewBlockProtection)
|
||||
Jobs.getExploitManager().remove(blockState.getBlock());
|
||||
else
|
||||
Jobs.getBpManager().remove(blockState.getBlock());
|
||||
}), 1L);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,55 @@
|
||||
package com.gamingmesh.jobs.listeners;
|
||||
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Item;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.block.BlockDropItemEvent;
|
||||
|
||||
import com.gamingmesh.jobs.Jobs;
|
||||
import com.gamingmesh.jobs.actions.BlockActionInfo;
|
||||
import com.gamingmesh.jobs.actions.ItemActionInfo;
|
||||
import com.gamingmesh.jobs.container.ActionType;
|
||||
import com.gamingmesh.jobs.container.JobsPlayer;
|
||||
|
||||
public class JobsPayment1_20Listener implements Listener {
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void onEntityBucketed(BlockDropItemEvent event) {
|
||||
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if (!Jobs.getGCManager().canPerformActionInWorld(player.getWorld())) {
|
||||
return;
|
||||
}
|
||||
|
||||
// check if in creative
|
||||
if (!JobsPaymentListener.payIfCreative(player)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!event.getBlock().getType().toString().contains("SUSPICIOUS_")) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Jobs.getPermissionHandler().hasWorldPermission(player, player.getLocation().getWorld().getName())) {
|
||||
return;
|
||||
}
|
||||
|
||||
// check if player is riding
|
||||
if (Jobs.getGCManager().disablePaymentIfRiding && player.isInsideVehicle() && !player.getVehicle().getType().equals(EntityType.BOAT)) {
|
||||
return;
|
||||
}
|
||||
|
||||
JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer(player);
|
||||
if (jPlayer == null)
|
||||
return;
|
||||
|
||||
Jobs.action(jPlayer, new BlockActionInfo(event.getBlock(), ActionType.BRUSH));
|
||||
|
||||
for (Item item : event.getItems()) {
|
||||
Jobs.action(jPlayer, new ItemActionInfo(item.getItemStack(), ActionType.BRUSH));
|
||||
}
|
||||
}
|
||||
}
|
@ -41,6 +41,7 @@ import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.HumanEntity;
|
||||
import org.bukkit.entity.Item;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.MushroomCow;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.Projectile;
|
||||
import org.bukkit.entity.Sheep;
|
||||
@ -313,16 +314,20 @@ public final class JobsPaymentListener implements Listener {
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void onEntityShear(PlayerShearEntityEvent event) {
|
||||
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if (!(event.getEntity() instanceof Sheep) || !Jobs.getGCManager().canPerformActionInWorld(player.getWorld()))
|
||||
if (!(event.getEntity() instanceof Sheep) && !(event.getEntity() instanceof MushroomCow) || !Jobs.getGCManager().canPerformActionInWorld(player.getWorld()))
|
||||
return;
|
||||
|
||||
Sheep sheep = (Sheep) event.getEntity();
|
||||
Entity entity = event.getEntity();
|
||||
|
||||
if (!(entity instanceof LivingEntity))
|
||||
return;
|
||||
|
||||
// mob spawner, no payment or experience
|
||||
if (!Jobs.getGCManager().payNearSpawner() && sheep.hasMetadata(Jobs.getPlayerManager().getMobSpawnerMetadata())) {
|
||||
sheep.removeMetadata(Jobs.getPlayerManager().getMobSpawnerMetadata(), plugin);
|
||||
if (!Jobs.getGCManager().payNearSpawner() && entity.hasMetadata(Jobs.getPlayerManager().getMobSpawnerMetadata())) {
|
||||
entity.removeMetadata(Jobs.getPlayerManager().getMobSpawnerMetadata(), plugin);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -342,25 +347,36 @@ public final class JobsPaymentListener implements Listener {
|
||||
|
||||
// pay
|
||||
JobsPlayer jDamager = Jobs.getPlayerManager().getJobsPlayer(player);
|
||||
if (jDamager == null || sheep.getColor() == null)
|
||||
if (jDamager == null)
|
||||
return;
|
||||
|
||||
String typeString = null;
|
||||
|
||||
if (event.getEntity() instanceof Sheep) {
|
||||
Sheep sheep = (Sheep) event.getEntity();
|
||||
if (sheep.getColor() == null)
|
||||
return;
|
||||
typeString = sheep.getColor().name();
|
||||
} else if (event.getEntity() instanceof MushroomCow) {
|
||||
typeString = CMIEntityType.get(entity).toString();
|
||||
}
|
||||
|
||||
if (Jobs.getGCManager().payForStackedEntities) {
|
||||
if (JobsHook.WildStacker.isEnabled() && !StackSplit.SHEEP_SHEAR.isEnabled()) {
|
||||
for (int i = 0; i < HookManager.getWildStackerHandler().getEntityAmount(sheep) - 1; i++) {
|
||||
Jobs.action(jDamager, new CustomKillInfo(sheep.getColor().name(), ActionType.SHEAR));
|
||||
for (int i = 0; i < HookManager.getWildStackerHandler().getEntityAmount((LivingEntity) entity) - 1; i++) {
|
||||
Jobs.action(jDamager, new CustomKillInfo(typeString, ActionType.SHEAR));
|
||||
}
|
||||
} else if (JobsHook.StackMob.isEnabled() && HookManager.getStackMobHandler().isStacked(sheep)) {
|
||||
|
||||
StackEntity stack = HookManager.getStackMobHandler().getStackEntity(sheep);
|
||||
} else if (JobsHook.StackMob.isEnabled() && HookManager.getStackMobHandler().isStacked((LivingEntity) entity)) {
|
||||
StackEntity stack = HookManager.getStackMobHandler().getStackEntity((LivingEntity) entity);
|
||||
if (stack != null) {
|
||||
Jobs.action(jDamager, new CustomKillInfo(sheep.getColor().name(), ActionType.SHEAR));
|
||||
Jobs.action(jDamager, new CustomKillInfo(typeString, ActionType.SHEAR));
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Jobs.action(jDamager, new CustomKillInfo(sheep.getColor().name(), ActionType.SHEAR));
|
||||
Jobs.action(jDamager, new CustomKillInfo(typeString, ActionType.SHEAR));
|
||||
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
@ -473,7 +489,7 @@ public final class JobsPaymentListener implements Listener {
|
||||
if (Jobs.getGCManager().useSilkTouchProtection) {
|
||||
ItemStack item = CMIItemStack.getItemInMainHand(player);
|
||||
|
||||
if (item.getType() != Material.AIR && Jobs.getBpManager().isInBp(block)) {
|
||||
if (item.getType() != Material.AIR && Jobs.getExploitManager().isInProtection(block)) {
|
||||
for (Enchantment one : item.getEnchantments().keySet()) {
|
||||
CMIEnchantment enchant = CMIEnchantment.get(one);
|
||||
if (enchant != null && enchant.equalEnum(CMIEnchantEnum.SILK_TOUCH)) {
|
||||
@ -557,7 +573,6 @@ public final class JobsPaymentListener implements Listener {
|
||||
// check is mcMMO enabled
|
||||
if (JobsHook.mcMMO.isEnabled()) {
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||
|
||||
// check is the fishing being exploited. If yes, prevent payment.
|
||||
if (mcMMOPlayer != null && ExperienceConfig.getInstance().isFishingExploitingPrevented()
|
||||
&& mcMMOPlayer.getFishingManager().isExploitingFishing(event.getHook().getLocation().toVector())) {
|
||||
@ -1861,7 +1876,7 @@ public final class JobsPaymentListener implements Listener {
|
||||
|
||||
@EventHandler(ignoreCancelled = true)
|
||||
public void onExplore(JobsChunkChangeEvent event) {
|
||||
if (!Jobs.getExploreManager().isExploreEnabled())
|
||||
if (!Jobs.getChunkExplorationManager().isExploreEnabled())
|
||||
return;
|
||||
|
||||
Player player = event.getPlayer();
|
||||
@ -1896,7 +1911,12 @@ public final class JobsPaymentListener implements Listener {
|
||||
if (jPlayer == null)
|
||||
return;
|
||||
|
||||
ExploreRespond respond = Jobs.getExploreManager().chunkRespond(jPlayer.getUserId(), event.getNewChunk());
|
||||
ExploreRespond respond = null;
|
||||
|
||||
if (Jobs.getGCManager().useNewExploration)
|
||||
respond = Jobs.getChunkExplorationManager().chunkRespond(jPlayer.getUserId(), event.getNewChunk());
|
||||
else
|
||||
respond = Jobs.getExploreManager().chunkRespond(jPlayer.getUserId(), event.getNewChunk());
|
||||
|
||||
if (!respond.isNewChunk())
|
||||
return;
|
||||
|
@ -26,11 +26,11 @@ public class PistonProtectionListener implements Listener {
|
||||
for (int i = event.getBlocks().size() - 1; i >= 0; i--) {
|
||||
Location oldLoc = event.getBlocks().get(i).getLocation();
|
||||
Location newLoc = oldLoc.clone().add(dir.getModX(), dir.getModY(), dir.getModZ());
|
||||
Long bp = Jobs.getBpManager().getTime(oldLoc);
|
||||
Long bp = Jobs.getExploitManager().getTime(event.getBlocks().get(i));
|
||||
|
||||
if (bp == null)
|
||||
continue;
|
||||
Jobs.getBpManager().addP(newLoc, bp, false, true);
|
||||
Jobs.getExploitManager().addProtection(newLoc.getBlock(), bp, false);
|
||||
}
|
||||
}
|
||||
|
||||
@ -45,10 +45,10 @@ public class PistonProtectionListener implements Listener {
|
||||
for (int i = blocks.size() - 1; i >= 0; i--) {
|
||||
Location oldLoc = blocks.get(i).getLocation();
|
||||
Location newLoc = oldLoc.clone().add(dir.getModX(), dir.getModY(), dir.getModZ());
|
||||
Long bp = Jobs.getBpManager().getTime(oldLoc);
|
||||
Long bp = Jobs.getExploitManager().getTime(blocks.get(i));
|
||||
if (bp == null)
|
||||
continue;
|
||||
Jobs.getBpManager().addP(newLoc, bp, false, true);
|
||||
Jobs.getExploitManager().addProtection(newLoc.getBlock(), bp, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -47,7 +47,20 @@ Explorer:
|
||||
'5':
|
||||
income: 0.1
|
||||
points: 0.1
|
||||
experience: 0.1
|
||||
experience: 0.1
|
||||
Brush:
|
||||
'suspicious_sand':
|
||||
income: 5
|
||||
points: 5
|
||||
experience: 5
|
||||
'suspicious_gravel':
|
||||
income: 6
|
||||
points: 6
|
||||
experience: 6
|
||||
coal:
|
||||
income: 10
|
||||
points: 10
|
||||
experience: 10
|
||||
Kill:
|
||||
Player:
|
||||
income: 7.5
|
||||
|
@ -160,6 +160,10 @@ Farmer:
|
||||
income: 4.0
|
||||
points: 4.0
|
||||
experience: 5.0
|
||||
mushroom_cow:
|
||||
income: 4.0
|
||||
points: 4.0
|
||||
experience: 5.0
|
||||
Milk:
|
||||
Cow:
|
||||
income: 5.0
|
||||
|
Loading…
Reference in New Issue
Block a user