1
0
mirror of https://github.com/Zrips/Jobs.git synced 2024-11-25 20:16:13 +01:00

Now if execute the browse cmd in console not send the raw msg

- Now /jobs quest when execute in console not send the message
- Fix brewing stand id
- Now you can set in config the amount of players to be shown in one page for /jobs top command
This commit is contained in:
montlikadani 2018-09-07 16:07:15 +02:00
parent 1e8940124f
commit 05a6b71775
10 changed files with 192 additions and 157 deletions

View File

@ -14,11 +14,8 @@ import org.bukkit.enchantments.Enchantment;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.inventory.meta.PotionMeta;
import org.bukkit.potion.Potion;
import org.bukkit.potion.PotionData;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import org.bukkit.potion.PotionType;
import com.gamingmesh.jobs.Jobs;
import com.gamingmesh.jobs.CMILib.ItemManager.CMIMaterial;
@ -271,7 +268,7 @@ public class CMIItemStack {
if (item.getType() == Material.POTION || item.getType().name().contains("SPLASH_POTION") || item.getType().name().contains("TIPPED_ARROW")) {
PotionMeta meta = (PotionMeta) item.getItemMeta();
if (item.getItemMeta() instanceof PotionMeta) {
if (meta instanceof PotionMeta) {
PotionMeta potionMeta = (PotionMeta) meta;
try {
if (potionMeta != null && potionMeta.getBasePotionData() != null && potionMeta.getBasePotionData() != null && potionMeta.getBasePotionData().getType().getEffectType() != null) {

View File

@ -697,7 +697,7 @@ public class ItemManager {
BRAIN_CORAL_FAN(-1, -1, 13849, "Brain Coral Fan", ""),
BRAIN_CORAL_WALL_FAN(-1, -1, 22685, "Brain Coral Wall Fan", ""),
BREAD(297, 0, 32049, "Bread", "BREAD"),
BREWING_STAND(379, 0, 14539, "Brewing Stand", "BREWING_STAND_ITEM"),
BREWING_STAND(117, 0, 14539, "Brewing Stand", ""),
BRICK(336, 0, 6820, "Brick", "claybrick"),
BRICKS(45, 0, 14165, "Bricks", ""),
BRICK_SLAB(44, 4, 26333, "Brick Slab", "STEP"),

View File

@ -551,11 +551,11 @@ public class Jobs extends JavaPlugin {
long time = System.currentTimeMillis();
// Cloning to avoid issues
HashMap<UUID, PlayerInfo> temp = new HashMap<>(Jobs.getPlayerManager().getPlayersInfoUUIDMap());
HashMap<Integer, List<JobsDAOData>> playersJobs = Jobs.getJobsDAO().getAllJobs();
HashMap<Integer, PlayerPoints> playersPoints = Jobs.getJobsDAO().getAllPoints();
HashMap<Integer, HashMap<String, Log>> playersLogs = Jobs.getJobsDAO().getAllLogs();
HashMap<Integer, ArchivedJobs> playersArchives = Jobs.getJobsDAO().getAllArchivedJobs();
HashMap<Integer, PaymentData> playersLimits = Jobs.getJobsDAO().loadPlayerLimits();
HashMap<Integer, List<JobsDAOData>> playersJobs = dao.getAllJobs();
HashMap<Integer, PlayerPoints> playersPoints = dao.getAllPoints();
HashMap<Integer, HashMap<String, Log>> playersLogs = dao.getAllLogs();
HashMap<Integer, ArchivedJobs> playersArchives = dao.getAllArchivedJobs();
HashMap<Integer, PaymentData> playersLimits = dao.loadPlayerLimits();
Iterator<Entry<UUID, PlayerInfo>> it = temp.entrySet().iterator();
while (it.hasNext()) {
Entry<UUID, PlayerInfo> one = it.next();
@ -607,7 +607,7 @@ public class Jobs extends JavaPlugin {
Jobs.getConfigManager().reload();
usedSlots.clear();
for (Job job : jobs) {
usedSlots.put(job, getJobsDAO().getSlotsTaken(job));
usedSlots.put(job, dao.getSlotsTaken(job));
}
pManager.reload();
permissionHandler.registerPermissions();
@ -622,7 +622,7 @@ public class Jobs extends JavaPlugin {
paymentThread = new BufferedPaymentThread(GconfigManager.getEconomyBatchDelay());
paymentThread.start();
Jobs.getJobsDAO().loadPlayerData();
dao.loadPlayerData();
// Schedule
Jobs.getScheduleManager().load();

View File

@ -45,108 +45,144 @@ public class browse implements Cmd {
return true;
}
int page = 1;
Job j = null;
int page = 1;
if (sender instanceof Player) {
for (String one : args) {
if (one.startsWith("-p:")) {
try {
page = Integer.parseInt(one.substring("-p:".length()));
continue;
} catch (Exception e) {
}
}
}
}
for (String one : args) {
if (one.startsWith("-p:")) {
try {
page = Integer.parseInt(one.substring("-p:".length()));
continue;
} catch (Exception e) {
}
}
if (one.startsWith("-j:")) {
try {
j = Jobs.getJob(one.substring("-j:".length()));
continue;
} catch (Exception e) {
}
}
if (one.startsWith("-j:")) {
try {
j = Jobs.getJob(one.substring("-j:".length()));
continue;
} catch (Exception e) {
}
}
}
if (j == null) {
PageInfo pi = new PageInfo(Jobs.getGCManager().getBrowseAmountToShow(), jobList.size(), page);
sender.sendMessage(Jobs.getLanguage().getMessage("command.browse.output.newHeader", "[amount]", jobList.size()));
for (Job one : jobList) {
if (!pi.isEntryOk())
continue;
if (pi.isBreak())
break;
if (sender instanceof Player) {
if (j == null) {
PageInfo pi = new PageInfo(Jobs.getGCManager().getBrowseAmountToShow(), jobList.size(), page);
sender.sendMessage(Jobs.getLanguage().getMessage("command.browse.output.newHeader", "[amount]", jobList.size()));
for (Job one : jobList) {
if (!pi.isEntryOk())
continue;
if (pi.isBreak())
break;
RawMessage rm = new RawMessage();
RawMessage rm = new RawMessage();
String hoverMsg = "";
String hoverMsg = "";
if (!one.getDescription().isEmpty()) {
hoverMsg += one.getDescription().replace("/n", "");
}
if (one.getMaxLevel(sender) > 0) {
if (!hoverMsg.isEmpty())
hoverMsg += " \n";
hoverMsg += Jobs.getLanguage().getMessage("command.info.help.newMax", "[max]", one.getMaxLevel(sender));
}
if (!one.getDescription().isEmpty()) {
hoverMsg += one.getDescription().replace("/n", "");
}
if (one.getMaxLevel(sender) > 0) {
if (!hoverMsg.isEmpty())
hoverMsg += " \n";
hoverMsg += Jobs.getLanguage().getMessage("command.info.help.newMax", "[max]", one.getMaxLevel(sender));
}
if (Jobs.getGCManager().ShowTotalWorkers) {
if (!hoverMsg.isEmpty())
hoverMsg += " \n";
hoverMsg += Jobs.getLanguage().getMessage("command.browse.output.totalWorkers", "[amount]", one.getTotalPlayers());
if (Jobs.getGCManager().ShowTotalWorkers) {
if (!hoverMsg.isEmpty())
hoverMsg += " \n";
hoverMsg += Jobs.getLanguage().getMessage("command.browse.output.totalWorkers", "[amount]", one.getTotalPlayers());
}
}
if (Jobs.getGCManager().useDynamicPayment && Jobs.getGCManager().ShowPenaltyBonus) {
if (!hoverMsg.isEmpty())
hoverMsg += " \n";
if ((int) (one.getBonus() * 100) < 0)
hoverMsg += Jobs.getLanguage().getMessage("command.browse.output.penalty", "[amount]", (int) (one.getBonus() * 100) * -1);
else
hoverMsg += Jobs.getLanguage().getMessage("command.browse.output.bonus", "[amount]", (int) (one.getBonus() * 100));
}
if (Jobs.getGCManager().useDynamicPayment && Jobs.getGCManager().ShowPenaltyBonus) {
if (!hoverMsg.isEmpty())
hoverMsg += " \n";
if ((int) (one.getBonus() * 100) < 0)
hoverMsg += Jobs.getLanguage().getMessage("command.browse.output.penalty", "[amount]", (int) (one.getBonus() * 100) * -1);
else
hoverMsg += Jobs.getLanguage().getMessage("command.browse.output.bonus", "[amount]", (int) (one.getBonus() * 100));
}
if (!hoverMsg.isEmpty())
hoverMsg += " \n";
hoverMsg += Jobs.getLanguage().getMessage("command.browse.output.click");
if (!hoverMsg.isEmpty())
hoverMsg += " \n";
hoverMsg += Jobs.getLanguage().getMessage("command.browse.output.click");
rm.add(Jobs.getLanguage().getMessage("command.browse.output.list", "[place]", pi.getPositionForOutput(), "[jobname]", one.getName()),
hoverMsg, "jobs browse -j:" + one.getName());
rm.add(Jobs.getLanguage().getMessage("command.browse.output.list", "[place]", pi.getPositionForOutput(), "[jobname]", one.getName()),
hoverMsg, "jobs browse -j:" + one.getName());
rm.show(sender);
}
plugin.ShowPagination(sender, pi.getTotalPages(), page, "jobs browse", "-p:");
rm.show(sender);
}
plugin.ShowPagination(sender, pi.getTotalPages(), page, "jobs browse", "-p:");
} else {
sender.sendMessage(Jobs.getLanguage().getMessage("command.browse.output.jobHeader", "[jobname]", j.getName()));
if (j.getMaxLevel(sender) > 0) {
sender.sendMessage(Jobs.getLanguage().getMessage("command.info.help.newMax", "[max]", j.getMaxLevel(sender)));
}
if (Jobs.getGCManager().ShowTotalWorkers) {
sender.sendMessage(Jobs.getLanguage().getMessage("command.browse.output.totalWorkers", "[amount]", j.getTotalPlayers()));
}
if (Jobs.getGCManager().useDynamicPayment && Jobs.getGCManager().ShowPenaltyBonus) {
if ((int) (j.getBonus() * 100) < 0)
sender.sendMessage(Jobs.getLanguage().getMessage("command.browse.output.penalty", "[amount]", (int) (j.getBonus() * 100) * -1));
else
sender.sendMessage(Jobs.getLanguage().getMessage("command.browse.output.bonus", "[amount]", (int) (j.getBonus() * 100)));
}
if (!j.getFullDescription().isEmpty()) {
for (String one : j.getFullDescription()) {
sender.sendMessage(one);
}
}
RawMessage rm = new RawMessage();
rm.add(Jobs.getLanguage().getMessage("command.browse.output.detailed"),
Jobs.getLanguage().getMessage("command.browse.output.detailed"),
"jobs info " + j.getName());
rm.show(sender);
rm.clear();
rm.add(Jobs.getLanguage().getMessage("command.browse.output.chooseJob"),
Jobs.getLanguage().getMessage("command.browse.output.chooseJobHover"),
"jobs join " + j.getName() + " -needConfirmation");
rm.show(sender);
}
} else {
if (j == null) {
sender.sendMessage(Jobs.getLanguage().getMessage("command.browse.output.newHeader", "[amount]", jobList.size()));
} else {
sender.sendMessage(Jobs.getLanguage().getMessage("command.browse.output.jobHeader", "[jobname]", j.getName()));
sender.sendMessage(Jobs.getLanguage().getMessage("command.browse.output.jobHeader", "[jobname]", j.getName()));
if (j.getMaxLevel(sender) > 0) {
sender.sendMessage(Jobs.getLanguage().getMessage("command.info.help.newMax", "[max]", j.getMaxLevel(sender)));
}
if (j.getMaxLevel(sender) > 0) {
sender.sendMessage(Jobs.getLanguage().getMessage("command.info.help.newMax", "[max]", j.getMaxLevel(sender)));
}
if (Jobs.getGCManager().ShowTotalWorkers) {
sender.sendMessage(Jobs.getLanguage().getMessage("command.browse.output.totalWorkers", "[amount]", j.getTotalPlayers()));
if (Jobs.getGCManager().ShowTotalWorkers) {
sender.sendMessage(Jobs.getLanguage().getMessage("command.browse.output.totalWorkers", "[amount]", j.getTotalPlayers()));
}
}
if (Jobs.getGCManager().useDynamicPayment && Jobs.getGCManager().ShowPenaltyBonus) {
if ((int) (j.getBonus() * 100) < 0)
sender.sendMessage(Jobs.getLanguage().getMessage("command.browse.output.penalty", "[amount]", (int) (j.getBonus() * 100) * -1));
else
sender.sendMessage(Jobs.getLanguage().getMessage("command.browse.output.bonus", "[amount]", (int) (j.getBonus() * 100)));
}
if (Jobs.getGCManager().useDynamicPayment && Jobs.getGCManager().ShowPenaltyBonus) {
if ((int) (j.getBonus() * 100) < 0)
sender.sendMessage(Jobs.getLanguage().getMessage("command.browse.output.penalty", "[amount]", (int) (j.getBonus() * 100) * -1));
else
sender.sendMessage(Jobs.getLanguage().getMessage("command.browse.output.bonus", "[amount]", (int) (j.getBonus() * 100)));
}
if (!j.getFullDescription().isEmpty())
for (String one : j.getFullDescription()) {
sender.sendMessage(one);
}
RawMessage rm = new RawMessage();
rm.add(Jobs.getLanguage().getMessage("command.browse.output.detailed"),
Jobs.getLanguage().getMessage("command.browse.output.detailed"),
"jobs info " + j.getName());
rm.show(sender);
rm.clear();
rm.add(Jobs.getLanguage().getMessage("command.browse.output.chooseJob"),
Jobs.getLanguage().getMessage("command.browse.output.chooseJobHover"),
"jobs join " + j.getName() + " -needConfirmation");
rm.show(sender);
if (!j.getFullDescription().isEmpty()) {
for (String one : j.getFullDescription()) {
sender.sendMessage(one);
}
}
}
}
} else {

View File

@ -51,55 +51,58 @@ public class quests implements Cmd {
}
sender.sendMessage(Jobs.getLanguage().getMessage("command.quests.toplineseparator", "[playerName]", jPlayer.getUserName(), "[questsDone]", jPlayer.getDoneQuests()));
for (JobProgression jobProg : jPlayer.getJobProgression()) {
List<QuestProgression> list = jPlayer.getQuestProgressions(jobProg.getJob());
for (QuestProgression q : list) {
String progressLine = Jobs.getCommandManager().jobProgressMessage(q.getQuest().getAmount(), q.getAmountDone());
if (q.isComplited())
progressLine = Jobs.getLanguage().getMessage("command.quests.output.completed");
RawMessage rm = new RawMessage();
String msg = Jobs.getLanguage().getMessage("command.quests.output.questLine",
"[progress]", progressLine,
"[questName]", q.getQuest().getQuestName(),
"[done]", q.getAmountDone(),
"[required]", q.getQuest().getAmount());
if (sender instanceof Player) {
for (JobProgression jobProg : jPlayer.getJobProgression()) {
List<QuestProgression> list = jPlayer.getQuestProgressions(jobProg.getJob());
for (QuestProgression q : list) {
String progressLine = Jobs.getCommandManager().jobProgressMessage(q.getQuest().getAmount(), q.getAmountDone());
if (q.isComplited())
progressLine = Jobs.getLanguage().getMessage("command.quests.output.completed");
RawMessage rm = new RawMessage();
String msg = Jobs.getLanguage().getMessage("command.quests.output.questLine",
"[progress]", progressLine,
"[questName]", q.getQuest().getQuestName(),
"[done]", q.getAmountDone(),
"[required]", q.getQuest().getAmount());
List<String> hoverMsgs = Jobs.getLanguage().getMessageList("command.quests.output.hover");
List<String> hoverList = new ArrayList<>();
List<String> hoverMsgs = Jobs.getLanguage().getMessageList("command.quests.output.hover");
List<String> hoverList = new ArrayList<>();
for (int i = 0; i < hoverMsgs.size(); i++) {
String current = hoverMsgs.get(i);
current = current.replace("[jobName]", jobProg.getJob().getName());
current = current.replace("[time]", TimeManage.to24hourShort(q.getValidUntil() - System.currentTimeMillis()));
if (current.contains("[desc]")) {
for (String one : q.getQuest().getDescription()) {
hoverList.add(one);
for (int i = 0; i < hoverMsgs.size(); i++) {
String current = hoverMsgs.get(i);
current = current.replace("[jobName]", jobProg.getJob().getName());
current = current.replace("[time]", TimeManage.to24hourShort(q.getValidUntil() - System.currentTimeMillis()));
if (current.contains("[desc]")) {
for (String one : q.getQuest().getDescription()) {
hoverList.add(one);
}
} else
hoverList.add(current);
}
} else
hoverList.add(current);
String hover = "";
for (String one : hoverList) {
if (!hover.isEmpty())
hover += "\n";
hover += one;
}
// hover += "&f" + jobProg.getJob().getName();
// if (!q.getQuest().getDescription().isEmpty()) {
//
// for (String one : q.getQuest().getDescription()) {
// hover += "\n&7";
// hover += one;
// }
// }
// hover += "\n&7New quest in: &8" + TimeManage.to24hourShort(q.getValidUntil() - System.currentTimeMillis());
rm.add(msg, hover);
rm.show(sender);
}
}
} else return true;
String hover = "";
for (String one : hoverList) {
if (!hover.isEmpty())
hover += "\n";
hover += one;
}
// hover += "&f" + jobProg.getJob().getName();
// if (!q.getQuest().getDescription().isEmpty()) {
//
// for (String one : q.getQuest().getDescription()) {
// hover += "\n&7";
// hover += one;
// }
// }
// hover += "\n&7New quest in: &8" + TimeManage.to24hourShort(q.getValidUntil() - System.currentTimeMillis());
rm.add(msg, hover);
rm.show(sender);
}
}
sender.sendMessage(Jobs.getLanguage().getMessage("general.info.separator"));
return true;
}

View File

@ -52,7 +52,8 @@ public class top implements Cmd {
player.sendMessage(ChatColor.RED + Jobs.getLanguage().getMessage("command.top.error.nojob"));
return false;
}
int st = (page * 15) - 15;
int showPageNum = Jobs.getGCManager().JobsTopAmount;
int st = (page * showPageNum) - showPageNum;
List<TopList> FullList = Jobs.getJobsDAO().toplist(args[0], st);
if (FullList.size() <= 0) {
@ -95,9 +96,9 @@ public class top implements Cmd {
RawMessage rm = new RawMessage();
rm.add(Jobs.getLanguage().getMessage("command.gtop.output.prev"),
Jobs.getLanguage().getMessage("command.gtop.output.show", "[from]", prev * 15 - 15, "[until]", (prev * 15)), "jobs top " + jobName + " " + prev);
Jobs.getLanguage().getMessage("command.gtop.output.show", "[from]", prev * showPageNum - showPageNum, "[until]", (prev * showPageNum)), "jobs top " + jobName + " " + prev);
rm.add(Jobs.getLanguage().getMessage("command.gtop.output.next"),
Jobs.getLanguage().getMessage("command.gtop.output.show", "[from]", (next * 15), "[until]", (next * 15 + 15)), "jobs top " + jobName + " " + next);
Jobs.getLanguage().getMessage("command.gtop.output.show", "[from]", (next * showPageNum), "[until]", (next * showPageNum + showPageNum)), "jobs top " + jobName + " " + next);
rm.show(player);
}
return true;

View File

@ -114,6 +114,8 @@ public class GeneralConfigManager {
public ItemStack guiBackButton;
public ItemStack guiFiller;
public int JobsTopAmount;
public Integer levelLossPercentageFromMax, levelLossPercentage, SoundLevelupVolume, SoundLevelupPitch, SoundTitleChangeVolume,
SoundTitleChangePitch, ToplistInScoreboardInterval;
public double MinimumOveralPaymentLimit;
@ -925,6 +927,9 @@ public class GeneralConfigManager {
c.getW().addComment("JobsGUI.SkipAmount", "Defines By how many slot we need to skip after group");
JobsGUISkipAmount = c.get("JobsGUI.SkipAmount", 2);
c.getW().addComment("JobsTop.AmountToShow", "Defines amount of players to be shown in one page for /jobs top");
JobsTopAmount = c.get("JobsTop.AmountToShow", 15);
Material tmat = Material.getMaterial(c.get("JobsGUI.BackButton.Material", "JACK_O_LANTERN"));
guiBackButton = new ItemStack(tmat == null ? Material.JACK_O_LANTERN : tmat, 1, (byte) c.get("JobsGUI.BackButton.Data", 0));
tmat = Material.getMaterial(c.get("JobsGUI.Filler.Material", "STAINED_GLASS_PANE"));

View File

@ -149,7 +149,7 @@ public class NameTranslatorManager {
if (ItemFile.getConfig().isConfigurationSection("EntityList")) {
ConfigurationSection section = ItemFile.getConfig().getConfigurationSection("EntityList");
Set<String>keys = section.getKeys(false);
Set<String> keys = section.getKeys(false);
ListOfEntities.clear();
for (String one : keys) {
String id = one.contains(":") ? one.split(":")[0] : one;
@ -165,7 +165,7 @@ public class NameTranslatorManager {
if (ItemFile.getConfig().isConfigurationSection("EnchantList")) {
ConfigurationSection section = ItemFile.getConfig().getConfigurationSection("EnchantList");
Set<String>keys = section.getKeys(false);
Set<String> keys = section.getKeys(false);
ListOfEnchants.clear();
for (String one : keys) {
String id = one.contains(":") ? one.split(":")[0] : one;
@ -181,7 +181,7 @@ public class NameTranslatorManager {
if (ItemFile.getConfig().isConfigurationSection("ColorList")) {
ConfigurationSection section = ItemFile.getConfig().getConfigurationSection("ColorList");
Set<String>keys = section.getKeys(false);
Set<String> keys = section.getKeys(false);
ListOfColors.clear();
for (String one : keys) {
String id = one.contains(":") ? one.split(":")[0] : one;
@ -197,7 +197,7 @@ public class NameTranslatorManager {
if (ItemFile.getConfig().isConfigurationSection("PotionNamesList")) {
ConfigurationSection section = ItemFile.getConfig().getConfigurationSection("PotionNamesList");
Set<String>keys = section.getKeys(false);
Set<String> keys = section.getKeys(false);
ListOfPotionNames.clear();
for (String one : keys) {
String id = one.contains(":") ? one.split(":")[0] : one;

View File

@ -1808,9 +1808,7 @@ public abstract class JobsDAO {
conn.setAutoCommit(true);
if (i > 0) {
String message = ChatColor.translateAlternateColorCodes('&', "&e[Jobs] Saved " + i + " new explorer entries.");
ConsoleCommandSender console = Bukkit.getServer().getConsoleSender();
console.sendMessage(message);
Bukkit.getServer().getConsoleSender().sendMessage(ChatColor.translateAlternateColorCodes('&', "&e[Jobs] Saved " + i + " new explorer entries."));
}
} catch (SQLException e) {
e.printStackTrace();
@ -1857,9 +1855,7 @@ public abstract class JobsDAO {
conn.setAutoCommit(true);
if (i > 0) {
String message = ChatColor.translateAlternateColorCodes('&', "&e[Jobs] Updated " + i + " explorer entries.");
ConsoleCommandSender console = Bukkit.getServer().getConsoleSender();
console.sendMessage(message);
Bukkit.getServer().getConsoleSender().sendMessage(ChatColor.translateAlternateColorCodes('&', "&e[Jobs] Updated " + i + " explorer entries."));
}
} catch (SQLException e) {
e.printStackTrace();

View File

@ -913,20 +913,17 @@ public class JobsListener implements Listener {
@EventHandler
public void JobsArmorChangeEvent(JobsArmorChangeEvent event) {
Player player = event.getPlayer();
Jobs.getPlayerManager().resetiItemBonusCache(player.getUniqueId());
Jobs.getPlayerManager().resetiItemBonusCache(event.getPlayer().getUniqueId());
}
@EventHandler
public void PlayerItemHeldEvent(PlayerItemHeldEvent event) {
Player player = event.getPlayer();
Jobs.getPlayerManager().resetiItemBonusCache(player.getUniqueId());
Jobs.getPlayerManager().resetiItemBonusCache(event.getPlayer().getUniqueId());
}
@EventHandler
public void PlayerItemBreakEvent(PlayerItemBreakEvent event) {
Player player = event.getPlayer();
Jobs.getPlayerManager().resetiItemBonusCache(player.getUniqueId());
Jobs.getPlayerManager().resetiItemBonusCache(event.getPlayer().getUniqueId());
}
@EventHandler