mirror of
https://github.com/Zrips/Jobs.git
synced 2024-11-26 04:25:15 +01:00
New command as resetquesttotal for reseting done quest counter
This commit is contained in:
parent
03de00be6e
commit
f53a32e35a
@ -116,6 +116,7 @@ import net.Zrips.CMILib.ActionBar.CMIActionBar;
|
|||||||
import net.Zrips.CMILib.Colors.CMIChatColor;
|
import net.Zrips.CMILib.Colors.CMIChatColor;
|
||||||
import net.Zrips.CMILib.Container.PageInfo;
|
import net.Zrips.CMILib.Container.PageInfo;
|
||||||
import net.Zrips.CMILib.Items.CMIMaterial;
|
import net.Zrips.CMILib.Items.CMIMaterial;
|
||||||
|
import net.Zrips.CMILib.Logs.CMIDebug;
|
||||||
import net.Zrips.CMILib.Messages.CMIMessages;
|
import net.Zrips.CMILib.Messages.CMIMessages;
|
||||||
import net.Zrips.CMILib.RawMessages.RawMessage;
|
import net.Zrips.CMILib.RawMessages.RawMessage;
|
||||||
import net.Zrips.CMILib.Version.Version;
|
import net.Zrips.CMILib.Version.Version;
|
||||||
@ -165,7 +166,7 @@ public final class Jobs extends JavaPlugin {
|
|||||||
|
|
||||||
public static LoadStatus status = LoadStatus.Good;
|
public static LoadStatus status = LoadStatus.Good;
|
||||||
|
|
||||||
private static boolean hasLimitedItems = false;
|
private static boolean hasLimitedItems = false;
|
||||||
|
|
||||||
private static final int MAX_ENTRIES = 5;
|
private static final int MAX_ENTRIES = 5;
|
||||||
public static final LinkedHashMap<UUID, FastPayment> FASTPAYMENT = new LinkedHashMap<UUID, FastPayment>(MAX_ENTRIES + 1, .75F, false) {
|
public static final LinkedHashMap<UUID, FastPayment> FASTPAYMENT = new LinkedHashMap<UUID, FastPayment>(MAX_ENTRIES + 1, .75F, false) {
|
||||||
@ -1511,7 +1512,7 @@ public final class Jobs extends JavaPlugin {
|
|||||||
rm.show(sender);
|
rm.show(sender);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean hasLimitedItems() {
|
public static boolean hasLimitedItems() {
|
||||||
return hasLimitedItems;
|
return hasLimitedItems;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,58 @@
|
|||||||
|
package com.gamingmesh.jobs.commands.list;
|
||||||
|
|
||||||
|
import java.util.Map.Entry;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
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.Job;
|
||||||
|
import com.gamingmesh.jobs.container.JobsPlayer;
|
||||||
|
|
||||||
|
public class resetquesttotal implements Cmd {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
|
||||||
|
if (args.length != 0 && args.length != 1) {
|
||||||
|
Jobs.getCommandManager().sendUsage(sender, "resetquesttotal");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (args[0].equalsIgnoreCase("all")) {
|
||||||
|
for (Entry<UUID, JobsPlayer> pl : Jobs.getPlayerManager().getPlayersCache().entrySet()) {
|
||||||
|
pl.getValue().setDoneQuests(0);
|
||||||
|
}
|
||||||
|
Jobs.getJobsDAO().resetDoneQuests();
|
||||||
|
sender.sendMessage(Jobs.getLanguage().getMessage("command.resetquesttotal.output.reseted", "%playername%", Jobs.getPlayerManager().getPlayersCache().size()));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
JobsPlayer jPlayer = null;
|
||||||
|
Job job = null;
|
||||||
|
|
||||||
|
for (String one : args) {
|
||||||
|
if (job == null) {
|
||||||
|
job = Jobs.getJob(one);
|
||||||
|
if (job != null)
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
jPlayer = Jobs.getPlayerManager().getJobsPlayer(one);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (jPlayer == null && sender instanceof Player)
|
||||||
|
jPlayer = Jobs.getPlayerManager().getJobsPlayer((Player) sender);
|
||||||
|
|
||||||
|
if (jPlayer == null) {
|
||||||
|
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.noinfoByPlayer", "%playername%", args.length > 0 ? args[0] : ""));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
jPlayer.setDoneQuests(0);
|
||||||
|
jPlayer.setSaved(false);
|
||||||
|
jPlayer.save();
|
||||||
|
sender.sendMessage(Jobs.getLanguage().getMessage("command.resetquesttotal.output.reseted", "%playername%", jPlayer.getName()));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
@ -213,6 +213,11 @@ public class LanguageManager {
|
|||||||
c.get("command.resetlimit.help.args", "[playername]");
|
c.get("command.resetlimit.help.args", "[playername]");
|
||||||
Jobs.getGCManager().getCommandArgs().put("resetlimit", Arrays.asList("[playername]"));
|
Jobs.getGCManager().getCommandArgs().put("resetlimit", Arrays.asList("[playername]"));
|
||||||
c.get("command.resetlimit.output.reseted", "&ePayment limits have been reset for: &2%playername%");
|
c.get("command.resetlimit.output.reseted", "&ePayment limits have been reset for: &2%playername%");
|
||||||
|
|
||||||
|
c.get("command.resetquesttotal.help.info", "Resets a player's done quest counter");
|
||||||
|
c.get("command.resetquesttotal.help.args", "[playername]/all");
|
||||||
|
Jobs.getGCManager().getCommandArgs().put("resetquesttotal", Arrays.asList("[playername]%%all"));
|
||||||
|
c.get("command.resetquesttotal.output.reseted", "&eDone quests have been reset for: &2%playername%");
|
||||||
|
|
||||||
c.get("command.resetquest.help.info", "Resets a player's quest");
|
c.get("command.resetquest.help.info", "Resets a player's quest");
|
||||||
c.get("command.resetquest.help.args", "[playername] [jobname]");
|
c.get("command.resetquest.help.args", "[playername] [jobname]");
|
||||||
|
@ -1999,6 +1999,24 @@ public abstract class JobsDAO {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void resetDoneQuests() {
|
||||||
|
|
||||||
|
JobsConnection conn = getConnection();
|
||||||
|
if (conn == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
PreparedStatement prest = null;
|
||||||
|
try {
|
||||||
|
prest = conn.prepareStatement("UPDATE `" + DBTables.UsersTable.getTableName() + "` SET `" + UserTableFields.donequests.getCollumn() + "` = ?;");
|
||||||
|
prest.setInt(1, 0);
|
||||||
|
prest.execute();
|
||||||
|
} catch (SQLException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
} finally {
|
||||||
|
close(prest);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void insertPlayer(JobsPlayer player) {
|
private void insertPlayer(JobsPlayer player) {
|
||||||
JobsConnection conn = getConnection();
|
JobsConnection conn = getConnection();
|
||||||
if (conn == null)
|
if (conn == null)
|
||||||
|
@ -466,8 +466,9 @@ public class JobsListener implements Listener {
|
|||||||
|
|
||||||
Chunk from = event.getFrom().getChunk();
|
Chunk from = event.getFrom().getChunk();
|
||||||
Chunk to = event.getTo().getChunk();
|
Chunk to = event.getTo().getChunk();
|
||||||
if (from != to)
|
if (from != to) {
|
||||||
plugin.getServer().getPluginManager().callEvent(new JobsChunkChangeEvent(event.getPlayer(), from, to));
|
plugin.getServer().getPluginManager().callEvent(new JobsChunkChangeEvent(event.getPlayer(), from, to));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(ignoreCancelled = true)
|
@EventHandler(ignoreCancelled = true)
|
||||||
|
@ -77,7 +77,7 @@ public final class JobsPayment14Listener implements Listener {
|
|||||||
|
|
||||||
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
|
||||||
public void onCook(BlockCookEvent event) {
|
public void onCook(BlockCookEvent event) {
|
||||||
if (!(event.getBlock().getType() != Material.CAMPFIRE) || campPlayers.isEmpty())
|
if (event.getBlock().getType() != Material.CAMPFIRE || campPlayers.isEmpty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!Jobs.getGCManager().canPerformActionInWorld(event.getBlock().getWorld()))
|
if (!Jobs.getGCManager().canPerformActionInWorld(event.getBlock().getWorld()))
|
||||||
|
@ -26,7 +26,6 @@ import java.util.Map.Entry;
|
|||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import com.bgsoftware.wildstacker.api.enums.StackSplit;
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.GameMode;
|
import org.bukkit.GameMode;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
@ -90,6 +89,7 @@ import org.bukkit.metadata.FixedMetadataValue;
|
|||||||
import org.bukkit.metadata.MetadataValue;
|
import org.bukkit.metadata.MetadataValue;
|
||||||
import org.bukkit.permissions.PermissionAttachmentInfo;
|
import org.bukkit.permissions.PermissionAttachmentInfo;
|
||||||
|
|
||||||
|
import com.bgsoftware.wildstacker.api.enums.StackSplit;
|
||||||
import com.gamingmesh.jobs.ItemBoostManager;
|
import com.gamingmesh.jobs.ItemBoostManager;
|
||||||
import com.gamingmesh.jobs.Jobs;
|
import com.gamingmesh.jobs.Jobs;
|
||||||
import com.gamingmesh.jobs.CMILib.CMIEnchantment;
|
import com.gamingmesh.jobs.CMILib.CMIEnchantment;
|
||||||
@ -128,7 +128,6 @@ import net.Zrips.CMILib.Container.CMILocation;
|
|||||||
import net.Zrips.CMILib.Entities.CMIEntityType;
|
import net.Zrips.CMILib.Entities.CMIEntityType;
|
||||||
import net.Zrips.CMILib.Items.CMIItemStack;
|
import net.Zrips.CMILib.Items.CMIItemStack;
|
||||||
import net.Zrips.CMILib.Items.CMIMaterial;
|
import net.Zrips.CMILib.Items.CMIMaterial;
|
||||||
import net.Zrips.CMILib.Logs.CMIDebug;
|
|
||||||
import net.Zrips.CMILib.Version.Version;
|
import net.Zrips.CMILib.Version.Version;
|
||||||
|
|
||||||
public final class JobsPaymentListener implements Listener {
|
public final class JobsPaymentListener implements Listener {
|
||||||
@ -1775,6 +1774,7 @@ public final class JobsPaymentListener implements Listener {
|
|||||||
|
|
||||||
@EventHandler(ignoreCancelled = true)
|
@EventHandler(ignoreCancelled = true)
|
||||||
public void onExplore(JobsChunkChangeEvent event) {
|
public void onExplore(JobsChunkChangeEvent event) {
|
||||||
|
|
||||||
if (!Jobs.getExplore().isExploreEnabled())
|
if (!Jobs.getExplore().isExploreEnabled())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -8,8 +8,8 @@ import com.gamingmesh.jobs.Jobs;
|
|||||||
|
|
||||||
public class Listener1_9 implements Listener {
|
public class Listener1_9 implements Listener {
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPlayerHandSwap(PlayerSwapHandItemsEvent event) {
|
public void onPlayerHandSwap(PlayerSwapHandItemsEvent event) {
|
||||||
Jobs.getPlayerManager().resetItemBonusCache(event.getPlayer().getUniqueId());
|
Jobs.getPlayerManager().resetItemBonusCache(event.getPlayer().getUniqueId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user