mirror of
https://github.com/Zrips/Jobs.git
synced 2024-11-26 12:35:28 +01:00
Lets record BP when player places block in any situation if bp is set
This commit is contained in:
parent
751b57095f
commit
a9540c784e
@ -173,7 +173,7 @@ public class Jobs extends JavaPlugin {
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (Integer.parseInt(getServer().getPluginManager().getPlugin("PlaceholderAPI")
|
if (Integer.parseInt(getServer().getPluginManager().getPlugin("PlaceholderAPI")
|
||||||
.getDescription().getVersion().replaceAll("[^\\d]", "")) >= 2100 && new PlaceholderAPIHook(this).register()) {
|
.getDescription().getVersion().replaceAll("[^\\d]", "")) >= 2100 && new PlaceholderAPIHook(this).register()) {
|
||||||
consoleMsg("&e[Jobs] PlaceholderAPI hooked.");
|
consoleMsg("&e[Jobs] PlaceholderAPI hooked.");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -475,12 +475,12 @@ public class Jobs extends JavaPlugin {
|
|||||||
PlayerInfo one = it.next();
|
PlayerInfo one = it.next();
|
||||||
int id = one.getID();
|
int id = one.getID();
|
||||||
JobsPlayer jPlayer = getPlayerManager().getJobsPlayerOffline(
|
JobsPlayer jPlayer = getPlayerManager().getJobsPlayerOffline(
|
||||||
one,
|
one,
|
||||||
playersJobs.get(id),
|
playersJobs.get(id),
|
||||||
playersPoints.get(id),
|
playersPoints.get(id),
|
||||||
playersLogs.get(id),
|
playersLogs.get(id),
|
||||||
playersArchives.get(id),
|
playersArchives.get(id),
|
||||||
playersLimits.get(id));
|
playersLimits.get(id));
|
||||||
if (jPlayer != null)
|
if (jPlayer != null)
|
||||||
getPlayerManager().addPlayerToCache(jPlayer);
|
getPlayerManager().addPlayerToCache(jPlayer);
|
||||||
}
|
}
|
||||||
@ -1101,7 +1101,7 @@ public class Jobs extends JavaPlugin {
|
|||||||
|
|
||||||
// JobsPayment event
|
// JobsPayment event
|
||||||
JobsExpGainEvent jobsExpGainEvent = new JobsExpGainEvent(jPlayer.getPlayer(), prog.getJob(), expAmount,
|
JobsExpGainEvent jobsExpGainEvent = new JobsExpGainEvent(jPlayer.getPlayer(), prog.getJob(), expAmount,
|
||||||
block, ent, victim, info);
|
block, ent, victim, info);
|
||||||
Bukkit.getServer().getPluginManager().callEvent(jobsExpGainEvent);
|
Bukkit.getServer().getPluginManager().callEvent(jobsExpGainEvent);
|
||||||
// If event is canceled, don't do anything
|
// If event is canceled, don't do anything
|
||||||
expAmount = jobsExpGainEvent.isCancelled() ? 0D : jobsExpGainEvent.getExp();
|
expAmount = jobsExpGainEvent.isCancelled() ? 0D : jobsExpGainEvent.getExp();
|
||||||
@ -1202,7 +1202,6 @@ public class Jobs extends JavaPlugin {
|
|||||||
if (bp != null) {
|
if (bp != null) {
|
||||||
Long time = bp.getTime();
|
Long time = bp.getTime();
|
||||||
Integer cd = getBpManager().getBlockDelayTime(block);
|
Integer cd = getBpManager().getBlockDelayTime(block);
|
||||||
|
|
||||||
if (time != -1L) {
|
if (time != -1L) {
|
||||||
if (time < System.currentTimeMillis() && bp.getAction() != DBAction.DELETE) {
|
if (time < System.currentTimeMillis() && bp.getAction() != DBAction.DELETE) {
|
||||||
getBpManager().add(block, cd);
|
getBpManager().add(block, cd);
|
||||||
@ -1218,6 +1217,10 @@ public class Jobs extends JavaPlugin {
|
|||||||
getBpManager().add(block, cd);
|
getBpManager().add(block, cd);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Lets add protection in any case
|
||||||
|
getBpManager().add(block, cd);
|
||||||
|
|
||||||
} else if (bp.isPaid().booleanValue() && bp.getTime() == -1L && cd != null && cd == -1) {
|
} else if (bp.isPaid().booleanValue() && bp.getTime() == -1L && cd != null && cd == -1) {
|
||||||
getBpManager().add(block, cd);
|
getBpManager().add(block, cd);
|
||||||
return false;
|
return false;
|
||||||
@ -1352,16 +1355,16 @@ public class Jobs extends JavaPlugin {
|
|||||||
prevpage = currentPage > 1 ? prevpage : currentPage;
|
prevpage = currentPage > 1 ? prevpage : currentPage;
|
||||||
|
|
||||||
RawMessage rm = new RawMessage()
|
RawMessage rm = new RawMessage()
|
||||||
.addText((currentPage > 1 ? lManager.getMessage("command.help.output.prevPage") : lManager.getMessage("command.help.output.prevPageOff")))
|
.addText((currentPage > 1 ? lManager.getMessage("command.help.output.prevPage") : lManager.getMessage("command.help.output.prevPageOff")))
|
||||||
.addHover(currentPage > 1 ? "<<<" : ">|")
|
.addHover(currentPage > 1 ? "<<<" : ">|")
|
||||||
.addCommand(currentPage > 1 ? cmd + " " + pagePrefix + prevpage : cmd + " " + pagePrefix + pageCount);
|
.addCommand(currentPage > 1 ? cmd + " " + pagePrefix + prevpage : cmd + " " + pagePrefix + pageCount);
|
||||||
|
|
||||||
rm.addText(lManager.getMessage("command.help.output.pageCount", "[current]", currentPage, "[total]", pageCount))
|
rm.addText(lManager.getMessage("command.help.output.pageCount", "[current]", currentPage, "[total]", pageCount))
|
||||||
.addHover(lManager.getMessage("command.help.output.pageCountHover", "[totalEntries]", totalEntries));
|
.addHover(lManager.getMessage("command.help.output.pageCountHover", "[totalEntries]", totalEntries));
|
||||||
|
|
||||||
rm.addText(pageCount > currentPage ? lManager.getMessage("command.help.output.nextPage") : lManager.getMessage("command.help.output.nextPageOff"))
|
rm.addText(pageCount > currentPage ? lManager.getMessage("command.help.output.nextPage") : lManager.getMessage("command.help.output.nextPageOff"))
|
||||||
.addHover(pageCount > currentPage ? ">>>" : "|<")
|
.addHover(pageCount > currentPage ? ">>>" : "|<")
|
||||||
.addCommand(pageCount > currentPage ? cmd + " " + pagePrefix + nextPage : cmd + " " + pagePrefix + 1);
|
.addCommand(pageCount > currentPage ? cmd + " " + pagePrefix + nextPage : cmd + " " + pagePrefix + 1);
|
||||||
|
|
||||||
if (pageCount != 0)
|
if (pageCount != 0)
|
||||||
rm.show(sender);
|
rm.show(sender);
|
||||||
|
@ -2,6 +2,7 @@ package com.gamingmesh.jobs.commands.list;
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
@ -53,12 +54,22 @@ public class bp implements Cmd {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
changedBlocks.add(l.getBlock());
|
changedBlocks.add(l.getBlock());
|
||||||
if (bp.getAction() == DBAction.DELETE)
|
|
||||||
player.sendBlockChange(l, CMIMaterial.RED_STAINED_GLASS.getMaterial(), (byte) 14);
|
if (Version.isCurrentEqualOrHigher(Version.v1_15_R1)) {
|
||||||
else if (time == -1)
|
if (bp.getAction() == DBAction.DELETE)
|
||||||
player.sendBlockChange(l, CMIMaterial.RED_STAINED_GLASS.getMaterial(), (byte) 15);
|
player.sendBlockChange(l, CMIMaterial.RED_STAINED_GLASS.getMaterial().createBlockData());
|
||||||
else
|
else if (time == -1)
|
||||||
player.sendBlockChange(l, CMIMaterial.RED_STAINED_GLASS.getMaterial(), (byte) 0);
|
player.sendBlockChange(l, CMIMaterial.BLACK_STAINED_GLASS.getMaterial().createBlockData());
|
||||||
|
else
|
||||||
|
player.sendBlockChange(l, 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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -418,7 +418,7 @@ public class JobsPaymentListener implements Listener {
|
|||||||
|| brokenBlock == CMIMaterial.CACTUS.getMaterial() || brokenBlock == CMIMaterial.BAMBOO.getMaterial())) {
|
|| brokenBlock == CMIMaterial.CACTUS.getMaterial() || brokenBlock == CMIMaterial.BAMBOO.getMaterial())) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Jobs.action(Jobs.getPlayerManager().getJobsPlayer(player), bInfo, block);
|
Jobs.action(Jobs.getPlayerManager().getJobsPlayer(player), bInfo, block);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user