mirror of
https://github.com/Zrips/Jobs.git
synced 2025-02-11 18:01:59 +01:00
payment for exploring map
This commit is contained in:
parent
19f9175072
commit
f5f62f26b4
@ -20,15 +20,19 @@ package com.gamingmesh.jobs;
|
|||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.WeakHashMap;
|
import java.util.WeakHashMap;
|
||||||
|
import java.util.Map.Entry;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.OfflinePlayer;
|
import org.bukkit.OfflinePlayer;
|
||||||
|
import org.bukkit.enchantments.Enchantment;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.inventory.meta.ItemMeta;
|
import org.bukkit.inventory.meta.ItemMeta;
|
||||||
@ -46,6 +50,8 @@ import com.gamingmesh.jobs.economy.Economy;
|
|||||||
import com.gamingmesh.jobs.economy.PaymentData;
|
import com.gamingmesh.jobs.economy.PaymentData;
|
||||||
import com.gamingmesh.jobs.i18n.Language;
|
import com.gamingmesh.jobs.i18n.Language;
|
||||||
import com.gamingmesh.jobs.stuff.ActionBar;
|
import com.gamingmesh.jobs.stuff.ActionBar;
|
||||||
|
import com.gamingmesh.jobs.stuff.Debug;
|
||||||
|
import com.gamingmesh.jobs.stuff.Explore;
|
||||||
import com.gamingmesh.jobs.stuff.JobsClassLoader;
|
import com.gamingmesh.jobs.stuff.JobsClassLoader;
|
||||||
import com.gamingmesh.jobs.stuff.Loging;
|
import com.gamingmesh.jobs.stuff.Loging;
|
||||||
import com.gamingmesh.jobs.stuff.Scboard;
|
import com.gamingmesh.jobs.stuff.Scboard;
|
||||||
@ -61,6 +67,7 @@ public class Jobs {
|
|||||||
private static SignUtil signManager = new SignUtil();
|
private static SignUtil signManager = new SignUtil();
|
||||||
private static Scboard scboardManager = new Scboard();
|
private static Scboard scboardManager = new Scboard();
|
||||||
private static ScheduleUtil scheduleManager = new ScheduleUtil();
|
private static ScheduleUtil scheduleManager = new ScheduleUtil();
|
||||||
|
private static Explore exploreManager = new Explore();
|
||||||
|
|
||||||
private static Logger pLogger;
|
private static Logger pLogger;
|
||||||
private static File dataFolder;
|
private static File dataFolder;
|
||||||
@ -103,6 +110,14 @@ public class Jobs {
|
|||||||
scheduleManager = new ScheduleUtil(plugin);
|
scheduleManager = new ScheduleUtil(plugin);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Explore getExplore() {
|
||||||
|
return exploreManager;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void setExplore() {
|
||||||
|
exploreManager = new Explore();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns scoreboard manager
|
* Returns scoreboard manager
|
||||||
* @return the scoreboard manager
|
* @return the scoreboard manager
|
||||||
@ -537,21 +552,51 @@ public class Jobs {
|
|||||||
// Item boost check
|
// Item boost check
|
||||||
Double itemMoneyBoost = 0.0;
|
Double itemMoneyBoost = 0.0;
|
||||||
Double itemExpBoost = 0.0;
|
Double itemExpBoost = 0.0;
|
||||||
if (item != null)
|
if (item != null) {
|
||||||
if (item.hasItemMeta()) {
|
|
||||||
ItemMeta meta = item.getItemMeta();
|
ItemMeta meta = item.getItemMeta();
|
||||||
if (meta.hasDisplayName() && meta.hasLore())
|
String name = null;
|
||||||
for (JobItems oneItem : prog.getJob().getItems()) {
|
List<String> lore = new ArrayList<String>();
|
||||||
|
|
||||||
|
if (item.hasItemMeta()) {
|
||||||
|
if (meta.hasDisplayName())
|
||||||
|
name = meta.getDisplayName();
|
||||||
|
if (meta.hasLore())
|
||||||
|
lore = meta.getLore();
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<Enchantment, Integer> enchants = item.getEnchantments();
|
||||||
|
|
||||||
|
main: for (JobItems oneItem : prog.getJob().getItems()) {
|
||||||
if (oneItem.getId() != item.getTypeId())
|
if (oneItem.getId() != item.getTypeId())
|
||||||
continue;
|
continue;
|
||||||
if (!ChatColor.translateAlternateColorCodes('&', oneItem.getName()).equalsIgnoreCase(meta.getDisplayName()))
|
|
||||||
continue;
|
if (oneItem.getName() != null && name != null)
|
||||||
if (!oneItem.getLore().equals(meta.getLore()))
|
if (!org.bukkit.ChatColor.translateAlternateColorCodes('&', oneItem.getName()).equalsIgnoreCase(name))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
for (String onelore : oneItem.getLore()) {
|
||||||
|
if (lore.size() == 0 || !lore.contains(onelore))
|
||||||
|
continue main;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (Entry<Enchantment, Integer> oneE : enchants.entrySet()) {
|
||||||
|
if (oneItem.getenchants().containsKey(oneE.getKey())) {
|
||||||
|
if (oneItem.getenchants().get(oneE.getKey()) < oneE.getValue()) {
|
||||||
|
continue main;
|
||||||
|
}
|
||||||
|
} else
|
||||||
|
continue main;
|
||||||
|
}
|
||||||
|
|
||||||
itemMoneyBoost = ((income * oneItem.getMoneyBoost()) - income);
|
itemMoneyBoost = ((income * oneItem.getMoneyBoost()) - income);
|
||||||
itemExpBoost = ((exp * oneItem.getExpBoost()) - exp);
|
itemExpBoost = ((exp * oneItem.getExpBoost()) - exp);
|
||||||
|
|
||||||
|
Debug.D("boost");
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Armor boost check
|
// Armor boost check
|
||||||
|
@ -109,6 +109,7 @@ public class JobsPlugin extends JavaPlugin {
|
|||||||
Jobs.setScboard(this);
|
Jobs.setScboard(this);
|
||||||
Jobs.setSchedule(this);
|
Jobs.setSchedule(this);
|
||||||
Jobs.setLanguage(this);
|
Jobs.setLanguage(this);
|
||||||
|
Jobs.setExplore();
|
||||||
|
|
||||||
Jobs.setPluginLogger(getLogger());
|
Jobs.setPluginLogger(getLogger());
|
||||||
|
|
||||||
@ -162,11 +163,14 @@ public class JobsPlugin extends JavaPlugin {
|
|||||||
ConsoleCommandSender console = Bukkit.getServer().getConsoleSender();
|
ConsoleCommandSender console = Bukkit.getServer().getConsoleSender();
|
||||||
console.sendMessage(message);
|
console.sendMessage(message);
|
||||||
Jobs.getLanguage().reload(ConfigManager.getJobsConfiguration().getLocale());
|
Jobs.getLanguage().reload(ConfigManager.getJobsConfiguration().getLocale());
|
||||||
|
|
||||||
|
Jobs.getJobsDAO().loadExplore();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDisable() {
|
public void onDisable() {
|
||||||
GuiTools.CloseInventories();
|
GuiTools.CloseInventories();
|
||||||
|
Jobs.getJobsDAO().saveExplore();
|
||||||
Jobs.shutdown();
|
Jobs.shutdown();
|
||||||
String message = ChatColor.translateAlternateColorCodes('&', "&e[Jobs] &2Plugin has been disabled succesfully.");
|
String message = ChatColor.translateAlternateColorCodes('&', "&e[Jobs] &2Plugin has been disabled succesfully.");
|
||||||
ConsoleCommandSender console = Bukkit.getServer().getConsoleSender();
|
ConsoleCommandSender console = Bukkit.getServer().getConsoleSender();
|
||||||
|
2
com/gamingmesh/jobs/actions/.gitignore
vendored
2
com/gamingmesh/jobs/actions/.gitignore
vendored
@ -5,3 +5,5 @@
|
|||||||
/EnchantActionInfo.class
|
/EnchantActionInfo.class
|
||||||
/CustomKillInfo.class
|
/CustomKillInfo.class
|
||||||
/MMKillInfo.class
|
/MMKillInfo.class
|
||||||
|
/WxploreActionInfo.class
|
||||||
|
/ExploreActionInfo.class
|
||||||
|
42
com/gamingmesh/jobs/actions/ExploreActionInfo.java
Normal file
42
com/gamingmesh/jobs/actions/ExploreActionInfo.java
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
/**
|
||||||
|
* Jobs Plugin for Bukkit
|
||||||
|
* Copyright (C) 2011 Zak Ford <zak.j.ford@gmail.com>
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.gamingmesh.jobs.actions;
|
||||||
|
|
||||||
|
import com.gamingmesh.jobs.container.ActionInfo;
|
||||||
|
import com.gamingmesh.jobs.container.ActionType;
|
||||||
|
import com.gamingmesh.jobs.container.BaseActionInfo;
|
||||||
|
|
||||||
|
public class ExploreActionInfo extends BaseActionInfo implements ActionInfo {
|
||||||
|
private String place;
|
||||||
|
|
||||||
|
public ExploreActionInfo(String place, ActionType type) {
|
||||||
|
super(type);
|
||||||
|
this.place = place;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return place;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getNameWithSub() {
|
||||||
|
return getName();
|
||||||
|
}
|
||||||
|
}
|
1
com/gamingmesh/jobs/api/.gitignore
vendored
1
com/gamingmesh/jobs/api/.gitignore
vendored
@ -6,3 +6,4 @@
|
|||||||
/JobsLeaveEvent.class
|
/JobsLeaveEvent.class
|
||||||
/JobsLevelUpEvent.class
|
/JobsLevelUpEvent.class
|
||||||
/JobsPaymentEvent.class
|
/JobsPaymentEvent.class
|
||||||
|
/JobsChunkChangeEvent.class
|
||||||
|
49
com/gamingmesh/jobs/api/JobsChunkChangeEvent.java
Normal file
49
com/gamingmesh/jobs/api/JobsChunkChangeEvent.java
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
package com.gamingmesh.jobs.api;
|
||||||
|
|
||||||
|
import org.bukkit.Chunk;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.Cancellable;
|
||||||
|
import org.bukkit.event.Event;
|
||||||
|
import org.bukkit.event.HandlerList;
|
||||||
|
|
||||||
|
public final class JobsChunkChangeEvent extends Event implements Cancellable {
|
||||||
|
private static final HandlerList handlers = new HandlerList();
|
||||||
|
private Player player;
|
||||||
|
private Chunk oldChunk;
|
||||||
|
private Chunk newChunk;
|
||||||
|
private boolean cancelled;
|
||||||
|
|
||||||
|
public JobsChunkChangeEvent(Player player, Chunk oldChunk, Chunk newChunk) {
|
||||||
|
this.player = player;
|
||||||
|
this.oldChunk = oldChunk;
|
||||||
|
this.newChunk = newChunk;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Player getPlayer() {
|
||||||
|
return this.player;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Chunk getOldChunk() {
|
||||||
|
return this.oldChunk;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Chunk getNewChunk() {
|
||||||
|
return this.newChunk;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isCancelled() {
|
||||||
|
return cancelled;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCancelled(boolean cancel) {
|
||||||
|
cancelled = cancel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public HandlerList getHandlers() {
|
||||||
|
return handlers;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static HandlerList getHandlerList() {
|
||||||
|
return handlers;
|
||||||
|
}
|
||||||
|
}
|
@ -1532,7 +1532,7 @@ public class JobsCommands implements CommandExecutor {
|
|||||||
.replace("%username%", one.getKey().getUsername())
|
.replace("%username%", one.getKey().getUsername())
|
||||||
.replace("%number%", String.valueOf(count))
|
.replace("%number%", String.valueOf(count))
|
||||||
.replace("%action%", info.getAction())
|
.replace("%action%", info.getAction())
|
||||||
.replace("%item%", one.getKey().getItemName().replace(":0", "").toLowerCase())
|
.replace("%item%", one.getKey().getItemName().replace(":0", "").replace("_", " ").toLowerCase())
|
||||||
.replace("%qty%", String.valueOf(one.getKey().getCount()))
|
.replace("%qty%", String.valueOf(one.getKey().getCount()))
|
||||||
.replace("%money%", String.valueOf(one.getKey().getMoney()))
|
.replace("%money%", String.valueOf(one.getKey().getMoney()))
|
||||||
.replace("%exp%", String.valueOf(one.getKey().getExp()));
|
.replace("%exp%", String.valueOf(one.getKey().getExp()));
|
||||||
|
@ -23,6 +23,7 @@ import java.io.FileInputStream;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.apache.commons.lang.StringEscapeUtils;
|
import org.apache.commons.lang.StringEscapeUtils;
|
||||||
@ -43,6 +44,7 @@ import com.gamingmesh.jobs.container.JobCommands;
|
|||||||
import com.gamingmesh.jobs.container.JobConditions;
|
import com.gamingmesh.jobs.container.JobConditions;
|
||||||
import com.gamingmesh.jobs.container.JobInfo;
|
import com.gamingmesh.jobs.container.JobInfo;
|
||||||
import com.gamingmesh.jobs.container.JobItems;
|
import com.gamingmesh.jobs.container.JobItems;
|
||||||
|
import com.gamingmesh.jobs.container.JobLimitedItems;
|
||||||
import com.gamingmesh.jobs.container.JobPermission;
|
import com.gamingmesh.jobs.container.JobPermission;
|
||||||
import com.gamingmesh.jobs.resources.jfep.Parser;
|
import com.gamingmesh.jobs.resources.jfep.Parser;
|
||||||
import com.gamingmesh.jobs.stuff.ChatColor;
|
import com.gamingmesh.jobs.stuff.ChatColor;
|
||||||
@ -285,17 +287,34 @@ public class JobConfig {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
int id = itemSection.getInt("id");
|
int id = itemSection.getInt("id");
|
||||||
String name = itemSection.getString("name");
|
|
||||||
|
String name = null;
|
||||||
|
if (itemSection.isString("name"))
|
||||||
|
name = itemSection.getString("name");
|
||||||
|
|
||||||
List<String> lore = new ArrayList<String>();
|
List<String> lore = new ArrayList<String>();
|
||||||
|
if (itemSection.getStringList("lore") != null)
|
||||||
for (String eachLine : itemSection.getStringList("lore")) {
|
for (String eachLine : itemSection.getStringList("lore")) {
|
||||||
lore.add(org.bukkit.ChatColor.translateAlternateColorCodes('&', eachLine));
|
lore.add(org.bukkit.ChatColor.translateAlternateColorCodes('&', eachLine));
|
||||||
}
|
}
|
||||||
|
|
||||||
List<String> enchants = new ArrayList<String>();
|
HashMap<Enchantment, Integer> enchants = new HashMap<Enchantment, Integer>();
|
||||||
if (itemSection.getStringList("enchants") != null)
|
if (itemSection.getStringList("enchants") != null)
|
||||||
for (String eachLine : itemSection.getStringList("enchants")) {
|
for (String eachLine : itemSection.getStringList("enchants")) {
|
||||||
enchants.add(eachLine);
|
|
||||||
|
if (!eachLine.contains("="))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
Enchantment ench = Enchantment.getByName(eachLine.split("=")[0]);
|
||||||
|
Integer level = -1;
|
||||||
|
try {
|
||||||
|
level = Integer.parseInt(eachLine.split("=")[1]);
|
||||||
|
} catch (NumberFormatException e) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ench != null && level != -1)
|
||||||
|
enchants.put(ench, level);
|
||||||
}
|
}
|
||||||
|
|
||||||
Double moneyBoost = itemSection.getDouble("moneyBoost");
|
Double moneyBoost = itemSection.getDouble("moneyBoost");
|
||||||
@ -304,8 +323,57 @@ public class JobConfig {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Limited Items
|
||||||
|
ArrayList<JobLimitedItems> jobLimitedItems = new ArrayList<JobLimitedItems>();
|
||||||
|
ConfigurationSection LimitedItemsSection = jobSection.getConfigurationSection("limitedItems");
|
||||||
|
if (LimitedItemsSection != null) {
|
||||||
|
for (String itemKey : LimitedItemsSection.getKeys(false)) {
|
||||||
|
ConfigurationSection itemSection = LimitedItemsSection.getConfigurationSection(itemKey);
|
||||||
|
|
||||||
|
String node = itemKey.toLowerCase();
|
||||||
|
if (itemSection == null) {
|
||||||
|
Jobs.getPluginLogger().warning("Job " + jobKey + " has an invalid item key " + itemKey + "!");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
int id = itemSection.getInt("id");
|
||||||
|
|
||||||
|
String name = null;
|
||||||
|
if (itemSection.isString("name"))
|
||||||
|
name = itemSection.getString("name");
|
||||||
|
|
||||||
|
List<String> lore = new ArrayList<String>();
|
||||||
|
if (itemSection.getStringList("lore") != null)
|
||||||
|
for (String eachLine : itemSection.getStringList("lore")) {
|
||||||
|
lore.add(org.bukkit.ChatColor.translateAlternateColorCodes('&', eachLine));
|
||||||
|
}
|
||||||
|
|
||||||
|
HashMap<Enchantment, Integer> enchants = new HashMap<Enchantment, Integer>();
|
||||||
|
if (itemSection.getStringList("enchants") != null)
|
||||||
|
for (String eachLine : itemSection.getStringList("enchants")) {
|
||||||
|
|
||||||
|
if (!eachLine.contains("="))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
Enchantment ench = Enchantment.getByName(eachLine.split("=")[0]);
|
||||||
|
Integer level = -1;
|
||||||
|
try {
|
||||||
|
level = Integer.parseInt(eachLine.split("=")[1]);
|
||||||
|
} catch (NumberFormatException e) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ench != null && level != -1)
|
||||||
|
enchants.put(ench, level);
|
||||||
|
}
|
||||||
|
|
||||||
|
int level = itemSection.getInt("level");
|
||||||
|
|
||||||
|
jobLimitedItems.add(new JobLimitedItems(node, id, name, lore, enchants, level));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Job job = new Job(jobName, jobShortName, description, color, maxExpEquation, displayMethod, maxLevel, vipmaxLevel, maxSlots, jobPermissions, jobCommand,
|
Job job = new Job(jobName, jobShortName, description, color, maxExpEquation, displayMethod, maxLevel, vipmaxLevel, maxSlots, jobPermissions, jobCommand,
|
||||||
jobConditions, jobItems, JobsCommandOnJoin, JobsCommandOnLeave, GUIitem);
|
jobConditions, jobItems, jobLimitedItems, JobsCommandOnJoin, JobsCommandOnLeave, GUIitem);
|
||||||
|
|
||||||
for (ActionType actionType : ActionType.values()) {
|
for (ActionType actionType : ActionType.values()) {
|
||||||
ConfigurationSection typeSection = jobSection.getConfigurationSection(actionType.getName());
|
ConfigurationSection typeSection = jobSection.getConfigurationSection(actionType.getName());
|
||||||
@ -347,6 +415,9 @@ public class JobConfig {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (actionType == ActionType.EXPLORE)
|
||||||
|
material = null;
|
||||||
|
|
||||||
if (material != null) {
|
if (material != null) {
|
||||||
// Break and Place actions MUST be blocks
|
// Break and Place actions MUST be blocks
|
||||||
if (actionType == ActionType.BREAK || actionType == ActionType.PLACE) {
|
if (actionType == ActionType.BREAK || actionType == ActionType.PLACE) {
|
||||||
@ -422,6 +493,17 @@ public class JobConfig {
|
|||||||
type = myKey;
|
type = myKey;
|
||||||
} else if (actionType == ActionType.CUSTOMKILL || actionType == ActionType.SHEAR || actionType == ActionType.MMKILL) {
|
} else if (actionType == ActionType.CUSTOMKILL || actionType == ActionType.SHEAR || actionType == ActionType.MMKILL) {
|
||||||
type = myKey;
|
type = myKey;
|
||||||
|
} else if (actionType == ActionType.EXPLORE) {
|
||||||
|
type = myKey;
|
||||||
|
int amount = 10;
|
||||||
|
try {
|
||||||
|
amount = Integer.valueOf(myKey);
|
||||||
|
} catch (NumberFormatException e) {
|
||||||
|
Jobs.getPluginLogger().warning("Job " + jobKey + " has an invalid " + actionType.getName() + " type property: " + key + "!");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
Jobs.getExplore().setExploreEnabled();
|
||||||
|
Jobs.getExplore().setPlayerAmount(amount + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type == null) {
|
if (type == null) {
|
||||||
|
@ -62,6 +62,7 @@ public class JobsConfiguration {
|
|||||||
protected boolean isBroadcastingSkillups;
|
protected boolean isBroadcastingSkillups;
|
||||||
protected boolean isBroadcastingLevelups;
|
protected boolean isBroadcastingLevelups;
|
||||||
protected boolean payInCreative;
|
protected boolean payInCreative;
|
||||||
|
protected boolean payExploringWhenFlying;
|
||||||
protected boolean addXpPlayer;
|
protected boolean addXpPlayer;
|
||||||
protected boolean hideJobsWithoutPermission;
|
protected boolean hideJobsWithoutPermission;
|
||||||
protected int maxJobs;
|
protected int maxJobs;
|
||||||
@ -172,6 +173,15 @@ public class JobsConfiguration {
|
|||||||
return payInCreative;
|
return payInCreative;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function that tells if the player should be paid while exploring and flying
|
||||||
|
* @return true - pay
|
||||||
|
* @return false - do not
|
||||||
|
*/
|
||||||
|
public synchronized boolean payExploringWhenFlying() {
|
||||||
|
return payExploringWhenFlying;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function to return the title for a given level
|
* Function to return the title for a given level
|
||||||
* @return the correct title
|
* @return the correct title
|
||||||
@ -415,6 +425,9 @@ public class JobsConfiguration {
|
|||||||
writer.addComment("enable-pay-creative", "Option to allow payment to be made in creative mode");
|
writer.addComment("enable-pay-creative", "Option to allow payment to be made in creative mode");
|
||||||
payInCreative = getBoolean("enable-pay-creative", false, config, writer);
|
payInCreative = getBoolean("enable-pay-creative", false, config, writer);
|
||||||
|
|
||||||
|
writer.addComment("enable-pay-for-exploring-when-flying", "Option to allow payment to be made for exploring when player flyies");
|
||||||
|
payExploringWhenFlying = getBoolean("enable-pay-for-exploring-when-flying", false, config, writer);
|
||||||
|
|
||||||
writer.addComment("add-xp-player", "Adds the Jobs xp recieved to the player's Minecraft XP bar");
|
writer.addComment("add-xp-player", "Adds the Jobs xp recieved to the player's Minecraft XP bar");
|
||||||
addXpPlayer = getBoolean("add-xp-player", false, config, writer);
|
addXpPlayer = getBoolean("add-xp-player", false, config, writer);
|
||||||
|
|
||||||
@ -1206,6 +1219,7 @@ public class JobsConfiguration {
|
|||||||
languages.add("cs");
|
languages.add("cs");
|
||||||
languages.add("fr");
|
languages.add("fr");
|
||||||
languages.add("ru");
|
languages.add("ru");
|
||||||
|
languages.add("cz");
|
||||||
|
|
||||||
for (String lang : languages) {
|
for (String lang : languages) {
|
||||||
YmlMaker langFile = new YmlMaker((JavaPlugin) plugin, "locale" + File.separator + "messages_" + lang + ".yml");
|
YmlMaker langFile = new YmlMaker((JavaPlugin) plugin, "locale" + File.separator + "messages_" + lang + ".yml");
|
||||||
@ -1230,6 +1244,7 @@ public class JobsConfiguration {
|
|||||||
conf.options().copyDefaults(true);
|
conf.options().copyDefaults(true);
|
||||||
|
|
||||||
GetConfigString("economy.error.nomoney", "Sorry, no money left in national bank!", writer, conf, true);
|
GetConfigString("economy.error.nomoney", "Sorry, no money left in national bank!", writer, conf, true);
|
||||||
|
GetConfigString("limitedItem.error.levelup", "&cYou need to levelup in [jobname] to use this item!", writer, conf, true);
|
||||||
|
|
||||||
GetConfigString("command.moneyboost.help.info", "Boosts Money gain for all players", writer, conf, true);
|
GetConfigString("command.moneyboost.help.info", "Boosts Money gain for all players", writer, conf, true);
|
||||||
GetConfigString("command.moneyboost.help.args", "[jobname] [rate]", writer, conf, true);
|
GetConfigString("command.moneyboost.help.args", "[jobname] [rate]", writer, conf, true);
|
||||||
@ -1340,6 +1355,8 @@ public class JobsConfiguration {
|
|||||||
GetConfigString("command.info.output.milk.none", "%jobname% does not get money from milking cows.", writer, conf, true);
|
GetConfigString("command.info.output.milk.none", "%jobname% does not get money from milking cows.", writer, conf, true);
|
||||||
GetConfigString("command.info.output.shear.info", "Shear", writer, conf, true);
|
GetConfigString("command.info.output.shear.info", "Shear", writer, conf, true);
|
||||||
GetConfigString("command.info.output.shear.none", "%jobname% does not get money from shearing sheeps.", writer, conf, true);
|
GetConfigString("command.info.output.shear.none", "%jobname% does not get money from shearing sheeps.", writer, conf, true);
|
||||||
|
GetConfigString("command.info.output.explore.info", "Explore", writer, conf, true);
|
||||||
|
GetConfigString("command.info.output.explore.none", "%jobname% does not get money from exploring.", writer, conf, true);
|
||||||
GetConfigString("command.info.output.custom-kill.info", "Custom kill", writer, conf, true);
|
GetConfigString("command.info.output.custom-kill.info", "Custom kill", writer, conf, true);
|
||||||
GetConfigString("command.info.output.custom-kill.none", "%jobname% does not get money from custom player kills.", writer, conf, true);
|
GetConfigString("command.info.output.custom-kill.none", "%jobname% does not get money from custom player kills.", writer, conf, true);
|
||||||
|
|
||||||
|
4
com/gamingmesh/jobs/container/.gitignore
vendored
4
com/gamingmesh/jobs/container/.gitignore
vendored
@ -21,3 +21,7 @@
|
|||||||
/Log.class
|
/Log.class
|
||||||
/LogAmounts.class
|
/LogAmounts.class
|
||||||
/JobConditions.class
|
/JobConditions.class
|
||||||
|
/JobLimitedItems.class
|
||||||
|
/ExploreRegion.class
|
||||||
|
/ExploreChunk.class
|
||||||
|
/ExploreWorld.class
|
||||||
|
@ -34,6 +34,7 @@ public enum ActionType {
|
|||||||
DYE("Dye"),
|
DYE("Dye"),
|
||||||
SHEAR("Shear"),
|
SHEAR("Shear"),
|
||||||
MILK("Milk"),
|
MILK("Milk"),
|
||||||
|
EXPLORE("Explore"),
|
||||||
CUSTOMKILL("custom-kill");
|
CUSTOMKILL("custom-kill");
|
||||||
|
|
||||||
private String name;
|
private String name;
|
||||||
|
59
com/gamingmesh/jobs/container/ExploreChunk.java
Normal file
59
com/gamingmesh/jobs/container/ExploreChunk.java
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
package com.gamingmesh.jobs.container;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.gamingmesh.jobs.Jobs;
|
||||||
|
|
||||||
|
public class ExploreChunk {
|
||||||
|
|
||||||
|
int x;
|
||||||
|
int z;
|
||||||
|
List<String> playerNames = new ArrayList<String>();
|
||||||
|
boolean isNewChunk = true;
|
||||||
|
|
||||||
|
public ExploreChunk(String playerName, int x, int z) {
|
||||||
|
this.x = x;
|
||||||
|
this.z = z;
|
||||||
|
this.playerNames.add(playerName);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ExploreRespond addPlayer(String playerName) {
|
||||||
|
boolean newChunk = false;
|
||||||
|
if (!playerNames.contains(playerName)) {
|
||||||
|
playerNames.add(playerName);
|
||||||
|
newChunk = true;
|
||||||
|
}
|
||||||
|
if (playerNames.size() > Jobs.getExplore().getPlayerAmount())
|
||||||
|
playerNames.remove(0);
|
||||||
|
return new ExploreRespond(playerNames.size(), newChunk);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isAlreadyVisited(String playerName) {
|
||||||
|
return playerNames.contains(playerName);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getCount() {
|
||||||
|
return this.playerNames.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getX() {
|
||||||
|
return this.x;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getZ() {
|
||||||
|
return this.z;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<String> getPlayers() {
|
||||||
|
return this.playerNames;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isNew() {
|
||||||
|
return this.isNewChunk;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOldChunk() {
|
||||||
|
isNewChunk = false;
|
||||||
|
}
|
||||||
|
}
|
29
com/gamingmesh/jobs/container/ExploreRegion.java
Normal file
29
com/gamingmesh/jobs/container/ExploreRegion.java
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
package com.gamingmesh.jobs.container;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class ExploreRegion {
|
||||||
|
|
||||||
|
int x;
|
||||||
|
int z;
|
||||||
|
List<ExploreChunk> chunks = new ArrayList<ExploreChunk>();
|
||||||
|
|
||||||
|
public ExploreRegion(int x, int z, List<ExploreChunk> chunks) {
|
||||||
|
this.x = x;
|
||||||
|
this.z = z;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ExploreRegion(int x, int z) {
|
||||||
|
this.x = x;
|
||||||
|
this.z = z;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addChunk(ExploreChunk chunk) {
|
||||||
|
chunks.add(chunk);
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<ExploreChunk> getChunks() {
|
||||||
|
return chunks;
|
||||||
|
}
|
||||||
|
}
|
20
com/gamingmesh/jobs/container/ExploreRespond.java
Normal file
20
com/gamingmesh/jobs/container/ExploreRespond.java
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
package com.gamingmesh.jobs.container;
|
||||||
|
|
||||||
|
public class ExploreRespond {
|
||||||
|
|
||||||
|
int count;
|
||||||
|
boolean newChunk = false;
|
||||||
|
|
||||||
|
public ExploreRespond(int count, boolean newChunk) {
|
||||||
|
this.count = count;
|
||||||
|
this.newChunk = newChunk;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getCount() {
|
||||||
|
return this.count;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isNewChunk() {
|
||||||
|
return this.newChunk;
|
||||||
|
}
|
||||||
|
}
|
@ -42,6 +42,8 @@ public class Job {
|
|||||||
private List<JobConditions> jobConditions;
|
private List<JobConditions> jobConditions;
|
||||||
// items
|
// items
|
||||||
private List<JobItems> jobItems;
|
private List<JobItems> jobItems;
|
||||||
|
// limited items
|
||||||
|
private List<JobLimitedItems> jobLimitedItems;
|
||||||
// job name
|
// job name
|
||||||
private String jobName;
|
private String jobName;
|
||||||
// job short name (for use in multiple jobs)
|
// job short name (for use in multiple jobs)
|
||||||
@ -88,11 +90,14 @@ public class Job {
|
|||||||
* @param jobPermissions - permissions gained for having the job
|
* @param jobPermissions - permissions gained for having the job
|
||||||
* @param jobCommands - commands to perform on levelup
|
* @param jobCommands - commands to perform on levelup
|
||||||
* @param jobItems - items with boost
|
* @param jobItems - items with boost
|
||||||
|
* @param jobLimitedItems - limited items by lvl
|
||||||
* @param CmdOnJoin - commands performed on player join
|
* @param CmdOnJoin - commands performed on player join
|
||||||
* @param CmdOnLeave - commands performed on player leave
|
* @param CmdOnLeave - commands performed on player leave
|
||||||
* @param jobConditions - jobs conditions
|
* @param jobConditions - jobs conditions
|
||||||
*/
|
*/
|
||||||
public Job(String jobName, String jobShortName, String description, ChatColor jobColour, Parser maxExpEquation, DisplayMethod displayMethod, int maxLevel, int vipmaxLevel, Integer maxSlots, List<JobPermission> jobPermissions, List<JobCommands> jobCommands, List<JobConditions> jobConditions, List<JobItems> jobItems, List<String> CmdOnJoin, List<String> CmdOnLeave, ItemStack GUIitem) {
|
public Job(String jobName, String jobShortName, String description, ChatColor jobColour, Parser maxExpEquation, DisplayMethod displayMethod, int maxLevel,
|
||||||
|
int vipmaxLevel, Integer maxSlots, List<JobPermission> jobPermissions, List<JobCommands> jobCommands, List<JobConditions> jobConditions, List<JobItems> jobItems,
|
||||||
|
List<JobLimitedItems> jobLimitedItems, List<String> CmdOnJoin, List<String> CmdOnLeave, ItemStack GUIitem) {
|
||||||
this.jobName = jobName;
|
this.jobName = jobName;
|
||||||
this.jobShortName = jobShortName;
|
this.jobShortName = jobShortName;
|
||||||
this.description = description;
|
this.description = description;
|
||||||
@ -106,6 +111,7 @@ public class Job {
|
|||||||
this.jobCommands = jobCommands;
|
this.jobCommands = jobCommands;
|
||||||
this.jobConditions = jobConditions;
|
this.jobConditions = jobConditions;
|
||||||
this.jobItems = jobItems;
|
this.jobItems = jobItems;
|
||||||
|
this.jobLimitedItems = jobLimitedItems;
|
||||||
this.CmdOnJoin = CmdOnJoin;
|
this.CmdOnJoin = CmdOnJoin;
|
||||||
this.CmdOnLeave = CmdOnLeave;
|
this.CmdOnLeave = CmdOnLeave;
|
||||||
this.GUIitem = GUIitem;
|
this.GUIitem = GUIitem;
|
||||||
@ -339,6 +345,7 @@ public class Job {
|
|||||||
public List<JobCommands> getCommands() {
|
public List<JobCommands> getCommands() {
|
||||||
return Collections.unmodifiableList(jobCommands);
|
return Collections.unmodifiableList(jobCommands);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the conditions for this job
|
* Get the conditions for this job
|
||||||
* @return Conditions for this job
|
* @return Conditions for this job
|
||||||
@ -354,4 +361,12 @@ public class Job {
|
|||||||
public List<JobItems> getItems() {
|
public List<JobItems> getItems() {
|
||||||
return Collections.unmodifiableList(jobItems);
|
return Collections.unmodifiableList(jobItems);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the limited item nodes for this job
|
||||||
|
* @return Limited items for this job
|
||||||
|
*/
|
||||||
|
public List<JobLimitedItems> getLimitedItems() {
|
||||||
|
return Collections.unmodifiableList(jobLimitedItems);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,18 +18,21 @@
|
|||||||
|
|
||||||
package com.gamingmesh.jobs.container;
|
package com.gamingmesh.jobs.container;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.bukkit.enchantments.Enchantment;
|
||||||
|
|
||||||
public class JobItems {
|
public class JobItems {
|
||||||
private String node;
|
private String node;
|
||||||
private int id;
|
private int id;
|
||||||
private String name;
|
private String name;
|
||||||
private List<String> lore;
|
private List<String> lore;
|
||||||
private List<String> enchants;
|
private HashMap<Enchantment, Integer> enchants;
|
||||||
private Double moneyBoost;
|
private Double moneyBoost;
|
||||||
private Double expBoost;
|
private Double expBoost;
|
||||||
|
|
||||||
public JobItems(String node, int id, String name, List<String> lore, List<String> enchants, double moneyBoost, double expBoost) {
|
public JobItems(String node, int id, String name, List<String> lore, HashMap<Enchantment, Integer> enchants, double moneyBoost, double expBoost) {
|
||||||
this.node = node;
|
this.node = node;
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.name = name;
|
this.name = name;
|
||||||
@ -55,7 +58,7 @@ public class JobItems {
|
|||||||
return this.lore;
|
return this.lore;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<String> getenchants() {
|
public HashMap<Enchantment, Integer> getenchants() {
|
||||||
return this.enchants;
|
return this.enchants;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
65
com/gamingmesh/jobs/container/JobLimitedItems.java
Normal file
65
com/gamingmesh/jobs/container/JobLimitedItems.java
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
/**
|
||||||
|
* Jobs Plugin for Bukkit
|
||||||
|
* Copyright (C) 2011 Zak Ford <zak.j.ford@gmail.com>
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.gamingmesh.jobs.container;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import org.bukkit.enchantments.Enchantment;
|
||||||
|
|
||||||
|
public class JobLimitedItems {
|
||||||
|
private String node;
|
||||||
|
private int id;
|
||||||
|
private String name;
|
||||||
|
private List<String> lore;
|
||||||
|
private HashMap<Enchantment, Integer> enchants;
|
||||||
|
private int level;
|
||||||
|
|
||||||
|
public JobLimitedItems(String node, int id, String name, List<String> lore, HashMap<Enchantment, Integer> enchants, int level) {
|
||||||
|
this.node = node;
|
||||||
|
this.id = id;
|
||||||
|
this.name = name;
|
||||||
|
this.lore = lore;
|
||||||
|
this.enchants = enchants;
|
||||||
|
this.level = level;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getNode() {
|
||||||
|
return this.node;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getId() {
|
||||||
|
return this.id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return this.name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<String> getLore() {
|
||||||
|
return this.lore;
|
||||||
|
}
|
||||||
|
|
||||||
|
public HashMap<Enchantment, Integer> getenchants() {
|
||||||
|
return this.enchants;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getLevel() {
|
||||||
|
return this.level;
|
||||||
|
}
|
||||||
|
}
|
@ -37,6 +37,8 @@ import com.gamingmesh.jobs.Jobs;
|
|||||||
import com.gamingmesh.jobs.JobsPlugin;
|
import com.gamingmesh.jobs.JobsPlugin;
|
||||||
import com.gamingmesh.jobs.config.ConfigManager;
|
import com.gamingmesh.jobs.config.ConfigManager;
|
||||||
import com.gamingmesh.jobs.container.Convert;
|
import com.gamingmesh.jobs.container.Convert;
|
||||||
|
import com.gamingmesh.jobs.container.ExploreChunk;
|
||||||
|
import com.gamingmesh.jobs.container.ExploreRegion;
|
||||||
import com.gamingmesh.jobs.container.Job;
|
import com.gamingmesh.jobs.container.Job;
|
||||||
import com.gamingmesh.jobs.container.JobProgression;
|
import com.gamingmesh.jobs.container.JobProgression;
|
||||||
import com.gamingmesh.jobs.container.JobsPlayer;
|
import com.gamingmesh.jobs.container.JobsPlayer;
|
||||||
@ -98,7 +100,10 @@ public abstract class JobsDAO {
|
|||||||
if (version <= 6)
|
if (version <= 6)
|
||||||
checkUpdate7();
|
checkUpdate7();
|
||||||
|
|
||||||
version = 7;
|
// creating explore database
|
||||||
|
checkUpdate8();
|
||||||
|
|
||||||
|
version = 8;
|
||||||
} finally {
|
} finally {
|
||||||
updateSchemaVersion(version);
|
updateSchemaVersion(version);
|
||||||
}
|
}
|
||||||
@ -118,6 +123,8 @@ public abstract class JobsDAO {
|
|||||||
|
|
||||||
protected abstract void checkUpdate7() throws SQLException;
|
protected abstract void checkUpdate7() throws SQLException;
|
||||||
|
|
||||||
|
protected abstract void checkUpdate8() throws SQLException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the database prefix
|
* Gets the database prefix
|
||||||
* @return the prefix
|
* @return the prefix
|
||||||
@ -732,6 +739,65 @@ public abstract class JobsDAO {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Save player-explore information
|
||||||
|
* @param jobexplore - the information getting saved
|
||||||
|
*/
|
||||||
|
public synchronized void saveExplore() {
|
||||||
|
if (!Jobs.getExplore().isExploreEnabled())
|
||||||
|
return;
|
||||||
|
|
||||||
|
JobsConnection conn = getConnection();
|
||||||
|
if (conn == null)
|
||||||
|
return;
|
||||||
|
try {
|
||||||
|
PreparedStatement prest = conn.prepareStatement("TRUNCATE TABLE `" + prefix + "explore`;");
|
||||||
|
prest.execute();
|
||||||
|
prest.close();
|
||||||
|
|
||||||
|
PreparedStatement prest2 = conn.prepareStatement("INSERT INTO `" + prefix + "explore` (`worldname`, `chunkX`, `chunkZ`, `playerName`) VALUES (?, ?, ?, ?);");
|
||||||
|
for (Entry<String, ExploreRegion> worlds : Jobs.getExplore().getWorlds().entrySet()) {
|
||||||
|
for (ExploreChunk oneChunk : worlds.getValue().getChunks()) {
|
||||||
|
for (String oneuser : oneChunk.getPlayers()) {
|
||||||
|
prest2.setString(1, worlds.getKey());
|
||||||
|
prest2.setInt(2, oneChunk.getX());
|
||||||
|
prest2.setInt(3, oneChunk.getZ());
|
||||||
|
prest2.setString(4, oneuser);
|
||||||
|
prest2.execute();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
prest2.close();
|
||||||
|
} catch (SQLException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Save player-explore information
|
||||||
|
* @param jobexplore - the information getting saved
|
||||||
|
*/
|
||||||
|
public synchronized void loadExplore() {
|
||||||
|
if (!Jobs.getExplore().isExploreEnabled())
|
||||||
|
return;
|
||||||
|
|
||||||
|
JobsConnection conn = getConnection();
|
||||||
|
if (conn == null)
|
||||||
|
return;
|
||||||
|
try {
|
||||||
|
|
||||||
|
PreparedStatement prest = conn.prepareStatement("SELECT * FROM `" + prefix + "explore`;");
|
||||||
|
ResultSet res = prest.executeQuery();
|
||||||
|
while (res.next()) {
|
||||||
|
Jobs.getExplore().ChunkRespond(res.getString("playerName"), res.getString("worldname"), res.getInt("chunkX"), res.getInt("chunkZ"));
|
||||||
|
}
|
||||||
|
res.close();
|
||||||
|
prest.close();
|
||||||
|
} catch (SQLException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Save player-job information
|
* Save player-job information
|
||||||
* @param jobInfo - the information getting saved
|
* @param jobInfo - the information getting saved
|
||||||
|
@ -431,4 +431,39 @@ public class JobsDAOMySQL extends JobsDAO {
|
|||||||
executeSQL("DROP TABLE IF EXISTS `" + getPrefix() + "log`;");
|
executeSQL("DROP TABLE IF EXISTS `" + getPrefix() + "log`;");
|
||||||
executeSQL("ALTER TABLE `" + getPrefix() + "log_temp` RENAME TO `" + getPrefix() + "log`;");
|
executeSQL("ALTER TABLE `" + getPrefix() + "log_temp` RENAME TO `" + getPrefix() + "log`;");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected synchronized void checkUpdate8() throws SQLException {
|
||||||
|
JobsConnection conn = getConnection();
|
||||||
|
if (conn == null) {
|
||||||
|
Jobs.getPluginLogger().severe("Could not run database updates! Could not connect to MySQL!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
PreparedStatement prest = null;
|
||||||
|
int rows = 0;
|
||||||
|
try {
|
||||||
|
// Check for jobs table
|
||||||
|
prest = conn.prepareStatement("SELECT COUNT(*) FROM information_schema.tables WHERE table_schema = ? AND table_name = ?;");
|
||||||
|
prest.setString(1, database);
|
||||||
|
prest.setString(2, getPrefix() + "explore");
|
||||||
|
ResultSet res = prest.executeQuery();
|
||||||
|
if (res.next()) {
|
||||||
|
rows = res.getInt(1);
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
if (prest != null) {
|
||||||
|
try {
|
||||||
|
prest.close();
|
||||||
|
} catch (SQLException e) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (rows == 0)
|
||||||
|
executeSQL("CREATE TABLE `" + getPrefix()
|
||||||
|
+ "explore` (`id` int NOT NULL AUTO_INCREMENT PRIMARY KEY, `worldname` varchar(64), `chunkX` int, `chunkZ` int, `playerName` varchar(32));");
|
||||||
|
} finally {
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -411,4 +411,37 @@ public class JobsDAOSQLite extends JobsDAO {
|
|||||||
executeSQL("ALTER TABLE `" + getPrefix() + "log_temp` RENAME TO `" + getPrefix() + "log`;");
|
executeSQL("ALTER TABLE `" + getPrefix() + "log_temp` RENAME TO `" + getPrefix() + "log`;");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected synchronized void checkUpdate8() throws SQLException {
|
||||||
|
JobsConnection conn = getConnection();
|
||||||
|
if (conn == null) {
|
||||||
|
Jobs.getPluginLogger().severe("Could not run database updates! Could not connect to MySQL!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
PreparedStatement prest = null;
|
||||||
|
int rows = 0;
|
||||||
|
try {
|
||||||
|
// Check for jobs table
|
||||||
|
prest = conn.prepareStatement("SELECT COUNT(*) FROM sqlite_master WHERE name = ?;");
|
||||||
|
prest.setString(1, getPrefix() + "explore");
|
||||||
|
ResultSet res = prest.executeQuery();
|
||||||
|
if (res.next()) {
|
||||||
|
rows = res.getInt(1);
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
if (prest != null) {
|
||||||
|
try {
|
||||||
|
prest.close();
|
||||||
|
} catch (SQLException e) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (rows == 0)
|
||||||
|
executeSQL("CREATE TABLE `" + getPrefix()
|
||||||
|
+ "explore` (`id` INTEGER PRIMARY KEY AUTOINCREMENT, `worldname` varchar(64), `chunkX` int, `chunkZ` int, `playerName` varchar(32));");
|
||||||
|
} finally {
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
2
com/gamingmesh/jobs/listeners/.gitignore
vendored
2
com/gamingmesh/jobs/listeners/.gitignore
vendored
@ -8,3 +8,5 @@
|
|||||||
/JobsPaymentListener$2.class
|
/JobsPaymentListener$2.class
|
||||||
/MythicMobsListener.class
|
/MythicMobsListener.class
|
||||||
/JobsListener$2.class
|
/JobsListener$2.class
|
||||||
|
/JobsListener$3.class
|
||||||
|
/JobsListener$4.class
|
||||||
|
@ -18,15 +18,21 @@
|
|||||||
|
|
||||||
package com.gamingmesh.jobs.listeners;
|
package com.gamingmesh.jobs.listeners;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Map.Entry;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
|
import org.bukkit.Chunk;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.block.Sign;
|
import org.bukkit.block.Sign;
|
||||||
|
import org.bukkit.enchantments.Enchantment;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.EventPriority;
|
import org.bukkit.event.EventPriority;
|
||||||
@ -43,8 +49,11 @@ import org.bukkit.event.player.AsyncPlayerChatEvent;
|
|||||||
import org.bukkit.event.player.PlayerChangedWorldEvent;
|
import org.bukkit.event.player.PlayerChangedWorldEvent;
|
||||||
import org.bukkit.event.player.PlayerInteractEvent;
|
import org.bukkit.event.player.PlayerInteractEvent;
|
||||||
import org.bukkit.event.player.PlayerJoinEvent;
|
import org.bukkit.event.player.PlayerJoinEvent;
|
||||||
|
import org.bukkit.event.player.PlayerMoveEvent;
|
||||||
import org.bukkit.event.player.PlayerQuitEvent;
|
import org.bukkit.event.player.PlayerQuitEvent;
|
||||||
import org.bukkit.event.world.WorldLoadEvent;
|
import org.bukkit.event.world.WorldLoadEvent;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
import org.bukkit.inventory.meta.ItemMeta;
|
||||||
import org.bukkit.permissions.Permission;
|
import org.bukkit.permissions.Permission;
|
||||||
import org.bukkit.permissions.PermissionDefault;
|
import org.bukkit.permissions.PermissionDefault;
|
||||||
import org.bukkit.plugin.PluginManager;
|
import org.bukkit.plugin.PluginManager;
|
||||||
@ -53,10 +62,14 @@ import com.gamingmesh.jobs.Jobs;
|
|||||||
import com.gamingmesh.jobs.JobsPlugin;
|
import com.gamingmesh.jobs.JobsPlugin;
|
||||||
import com.gamingmesh.jobs.Gui.GuiInfoList;
|
import com.gamingmesh.jobs.Gui.GuiInfoList;
|
||||||
import com.gamingmesh.jobs.Gui.GuiTools;
|
import com.gamingmesh.jobs.Gui.GuiTools;
|
||||||
|
import com.gamingmesh.jobs.api.JobsChunkChangeEvent;
|
||||||
import com.gamingmesh.jobs.config.ConfigManager;
|
import com.gamingmesh.jobs.config.ConfigManager;
|
||||||
import com.gamingmesh.jobs.container.Job;
|
import com.gamingmesh.jobs.container.Job;
|
||||||
|
import com.gamingmesh.jobs.container.JobLimitedItems;
|
||||||
|
import com.gamingmesh.jobs.container.JobProgression;
|
||||||
import com.gamingmesh.jobs.container.JobsPlayer;
|
import com.gamingmesh.jobs.container.JobsPlayer;
|
||||||
import com.gamingmesh.jobs.i18n.Language;
|
import com.gamingmesh.jobs.i18n.Language;
|
||||||
|
import com.gamingmesh.jobs.stuff.ActionBar;
|
||||||
import com.gamingmesh.jobs.stuff.OfflinePlayerList;
|
import com.gamingmesh.jobs.stuff.OfflinePlayerList;
|
||||||
|
|
||||||
public class JobsListener implements Listener {
|
public class JobsListener implements Listener {
|
||||||
@ -473,4 +486,89 @@ public class JobsListener implements Listener {
|
|||||||
}, 1L);
|
}, 1L);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
|
||||||
|
public void onLimitedItemInteract(PlayerInteractEvent event) {
|
||||||
|
|
||||||
|
Player player = (Player) event.getPlayer();
|
||||||
|
|
||||||
|
ItemStack iih = player.getItemInHand();
|
||||||
|
|
||||||
|
if (iih == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
JobsPlayer JPlayer = Jobs.getPlayerManager().getJobsPlayer(player);
|
||||||
|
|
||||||
|
if (JPlayer == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
List<JobProgression> prog = JPlayer.getJobProgression();
|
||||||
|
|
||||||
|
String name = null;
|
||||||
|
List<String> lore = new ArrayList<String>();
|
||||||
|
|
||||||
|
Map<Enchantment, Integer> enchants = iih.getEnchantments();
|
||||||
|
|
||||||
|
if (iih.hasItemMeta()) {
|
||||||
|
ItemMeta meta = iih.getItemMeta();
|
||||||
|
if (meta.hasDisplayName())
|
||||||
|
name = meta.getDisplayName();
|
||||||
|
if (meta.hasLore())
|
||||||
|
lore = meta.getLore();
|
||||||
|
}
|
||||||
|
|
||||||
|
String meinOk = null;
|
||||||
|
|
||||||
|
mein: for (JobProgression one : prog) {
|
||||||
|
second: for (JobLimitedItems oneItem : one.getJob().getLimitedItems()) {
|
||||||
|
|
||||||
|
if (oneItem.getId() != iih.getTypeId())
|
||||||
|
continue;
|
||||||
|
|
||||||
|
meinOk = one.getJob().getName();
|
||||||
|
|
||||||
|
if (oneItem.getName() != null && name != null)
|
||||||
|
if (!org.bukkit.ChatColor.translateAlternateColorCodes('&', oneItem.getName()).equalsIgnoreCase(name))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (one.getLevel() < oneItem.getLevel())
|
||||||
|
continue;
|
||||||
|
|
||||||
|
for (Entry<Enchantment, Integer> oneE : enchants.entrySet()) {
|
||||||
|
if (oneItem.getenchants().containsKey(oneE.getKey())) {
|
||||||
|
if (oneItem.getenchants().get(oneE.getKey()) < oneE.getValue()) {
|
||||||
|
continue second;
|
||||||
|
}
|
||||||
|
} else
|
||||||
|
continue second;
|
||||||
|
}
|
||||||
|
for (String onelore : oneItem.getLore()) {
|
||||||
|
if (!lore.contains(onelore))
|
||||||
|
continue second;
|
||||||
|
}
|
||||||
|
meinOk = null;
|
||||||
|
break mein;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (meinOk != null) {
|
||||||
|
event.setCancelled(true);
|
||||||
|
ActionBar.send(player, Language.getDefaultMessage("limitedItem.error.levelup").replace("[jobname]", meinOk));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onChunkChangeMove(PlayerMoveEvent event) {
|
||||||
|
|
||||||
|
Chunk from = event.getFrom().getChunk();
|
||||||
|
Chunk to = event.getTo().getChunk();
|
||||||
|
|
||||||
|
if (from == to)
|
||||||
|
return;
|
||||||
|
|
||||||
|
JobsChunkChangeEvent jobsChunkChangeEvent = new JobsChunkChangeEvent(event.getPlayer(), from, to);
|
||||||
|
Bukkit.getServer().getPluginManager().callEvent(jobsChunkChangeEvent);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -71,9 +71,12 @@ import com.gamingmesh.jobs.actions.BlockActionInfo;
|
|||||||
import com.gamingmesh.jobs.actions.CustomKillInfo;
|
import com.gamingmesh.jobs.actions.CustomKillInfo;
|
||||||
import com.gamingmesh.jobs.actions.EnchantActionInfo;
|
import com.gamingmesh.jobs.actions.EnchantActionInfo;
|
||||||
import com.gamingmesh.jobs.actions.EntityActionInfo;
|
import com.gamingmesh.jobs.actions.EntityActionInfo;
|
||||||
|
import com.gamingmesh.jobs.actions.ExploreActionInfo;
|
||||||
import com.gamingmesh.jobs.actions.ItemActionInfo;
|
import com.gamingmesh.jobs.actions.ItemActionInfo;
|
||||||
|
import com.gamingmesh.jobs.api.JobsChunkChangeEvent;
|
||||||
import com.gamingmesh.jobs.config.ConfigManager;
|
import com.gamingmesh.jobs.config.ConfigManager;
|
||||||
import com.gamingmesh.jobs.container.ActionType;
|
import com.gamingmesh.jobs.container.ActionType;
|
||||||
|
import com.gamingmesh.jobs.container.ExploreRespond;
|
||||||
import com.gamingmesh.jobs.container.JobProgression;
|
import com.gamingmesh.jobs.container.JobProgression;
|
||||||
import com.gamingmesh.jobs.container.JobsPlayer;
|
import com.gamingmesh.jobs.container.JobsPlayer;
|
||||||
import com.gamingmesh.jobs.i18n.Language;
|
import com.gamingmesh.jobs.i18n.Language;
|
||||||
@ -324,7 +327,7 @@ public class JobsPaymentListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Item in hand
|
// Item in hand
|
||||||
ItemStack item = player.getItemInHand().hasItemMeta() ? player.getItemInHand() : null;
|
ItemStack item = player.getItemInHand();
|
||||||
|
|
||||||
// Protection for block break with silktouch
|
// Protection for block break with silktouch
|
||||||
if (ConfigManager.getJobsConfiguration().useSilkTouchProtection && item != null)
|
if (ConfigManager.getJobsConfiguration().useSilkTouchProtection && item != null)
|
||||||
@ -1054,4 +1057,50 @@ public class JobsPaymentListener implements Listener {
|
|||||||
block.setMetadata(brewingOwnerMetadata, new FixedMetadataValue(plugin, event.getPlayer().getName()));
|
block.setMetadata(brewingOwnerMetadata, new FixedMetadataValue(plugin, event.getPlayer().getName()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onExplore(JobsChunkChangeEvent event) {
|
||||||
|
|
||||||
|
if (!Jobs.getExplore().isExploreEnabled())
|
||||||
|
return;
|
||||||
|
|
||||||
|
Player player = (Player) event.getPlayer();
|
||||||
|
|
||||||
|
if (!ConfigManager.getJobsConfiguration().payExploringWhenFlying())
|
||||||
|
return;
|
||||||
|
|
||||||
|
ExploreRespond respond = Jobs.getExplore().ChunkRespond(event.getPlayer(), event.getNewChunk());
|
||||||
|
|
||||||
|
if (!respond.isNewChunk())
|
||||||
|
return;
|
||||||
|
|
||||||
|
// make sure plugin is enabled
|
||||||
|
if (!plugin.isEnabled())
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (!player.isOnline())
|
||||||
|
return;
|
||||||
|
|
||||||
|
// check if in creative
|
||||||
|
if (event.getPlayer().getGameMode().equals(GameMode.CREATIVE) && !ConfigManager.getJobsConfiguration().payInCreative())
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (!Jobs.getPermissionHandler().hasWorldPermission(player, player.getLocation().getWorld().getName()))
|
||||||
|
return;
|
||||||
|
|
||||||
|
// restricted area multiplier
|
||||||
|
double multiplier = ConfigManager.getJobsConfiguration().getRestrictedMultiplier(player);
|
||||||
|
|
||||||
|
// Item in hand
|
||||||
|
ItemStack item = player.getItemInHand();
|
||||||
|
|
||||||
|
// Wearing armor
|
||||||
|
ItemStack[] armor = player.getInventory().getArmorContents();
|
||||||
|
|
||||||
|
JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer(player);
|
||||||
|
if (jPlayer == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
Jobs.action(jPlayer, new ExploreActionInfo(String.valueOf(respond.getCount()), ActionType.EXPLORE), multiplier, item, armor);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
1
com/gamingmesh/jobs/stuff/.gitignore
vendored
1
com/gamingmesh/jobs/stuff/.gitignore
vendored
@ -28,3 +28,4 @@
|
|||||||
/ScheduleUtil$2.class
|
/ScheduleUtil$2.class
|
||||||
/OfflinePlayerList.class
|
/OfflinePlayerList.class
|
||||||
/OfflinePlayerList$1.class
|
/OfflinePlayerList$1.class
|
||||||
|
/Explore.class
|
||||||
|
83
com/gamingmesh/jobs/stuff/Explore.java
Normal file
83
com/gamingmesh/jobs/stuff/Explore.java
Normal file
@ -0,0 +1,83 @@
|
|||||||
|
package com.gamingmesh.jobs.stuff;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import org.bukkit.Chunk;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import com.gamingmesh.jobs.Jobs;
|
||||||
|
import com.gamingmesh.jobs.container.ExploreChunk;
|
||||||
|
import com.gamingmesh.jobs.container.ExploreRegion;
|
||||||
|
import com.gamingmesh.jobs.container.ExploreRespond;
|
||||||
|
|
||||||
|
public class Explore {
|
||||||
|
|
||||||
|
private HashMap<String, ExploreRegion> worlds = new HashMap<String, ExploreRegion>();
|
||||||
|
private boolean exploreEnabled = false;
|
||||||
|
private int playerAmount = 1;
|
||||||
|
|
||||||
|
public Explore() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getPlayerAmount() {
|
||||||
|
return this.playerAmount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPlayerAmount(int amount) {
|
||||||
|
if (this.playerAmount < amount)
|
||||||
|
this.playerAmount = amount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isExploreEnabled() {
|
||||||
|
return this.exploreEnabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setExploreEnabled() {
|
||||||
|
this.exploreEnabled = true;
|
||||||
|
Jobs.getJobsDAO().loadExplore();
|
||||||
|
}
|
||||||
|
|
||||||
|
public HashMap<String, ExploreRegion> getWorlds() {
|
||||||
|
return worlds;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ExploreRespond ChunkRespond(Player player, Chunk chunk) {
|
||||||
|
return ChunkRespond(player.getName(), chunk.getWorld().getName(), chunk.getX(), chunk.getZ());
|
||||||
|
}
|
||||||
|
|
||||||
|
public ExploreRespond ChunkRespond(String player, String worldName, int x, int z) {
|
||||||
|
|
||||||
|
int ChunkX = x;
|
||||||
|
int ChunkZ = z;
|
||||||
|
|
||||||
|
int RegionX = (int) Math.floor(ChunkX / 32D);
|
||||||
|
int RegionZ = (int) Math.floor(ChunkZ / 32D);
|
||||||
|
|
||||||
|
if (!worlds.containsKey(worldName)) {
|
||||||
|
ExploreChunk eChunk = new ExploreChunk(player, ChunkX, ChunkZ);
|
||||||
|
ExploreRegion eRegion = new ExploreRegion(RegionX, RegionZ);
|
||||||
|
eRegion.addChunk(eChunk);
|
||||||
|
worlds.put(worldName, eRegion);
|
||||||
|
return new ExploreRespond(eChunk.getCount(), true);
|
||||||
|
} else {
|
||||||
|
ExploreRegion eRegion = worlds.get(worldName);
|
||||||
|
ExploreChunk eChunk = null;
|
||||||
|
for (ExploreChunk one : eRegion.getChunks()) {
|
||||||
|
if (one.getX() != ChunkX)
|
||||||
|
continue;
|
||||||
|
if (one.getZ() != ChunkZ)
|
||||||
|
continue;
|
||||||
|
eChunk = one;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (eChunk == null) {
|
||||||
|
eChunk = new ExploreChunk(player, ChunkX, ChunkZ);
|
||||||
|
eRegion.addChunk(eChunk);
|
||||||
|
return new ExploreRespond(eChunk.getCount(), true);
|
||||||
|
} else {
|
||||||
|
return eChunk.addPlayer(player);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -1,7 +1,9 @@
|
|||||||
package com.gamingmesh.jobs.stuff;
|
package com.gamingmesh.jobs.stuff;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
@ -11,10 +13,11 @@ import org.bukkit.inventory.ItemStack;
|
|||||||
import org.bukkit.inventory.meta.ItemMeta;
|
import org.bukkit.inventory.meta.ItemMeta;
|
||||||
|
|
||||||
public class GiveItem {
|
public class GiveItem {
|
||||||
public static boolean GiveItemForPlayer(Player player, int id, int meta, int qty, String name, List<String> lore, List<String> enchants) {
|
public static boolean GiveItemForPlayer(Player player, int id, int meta, int qty, String name, List<String> lore, HashMap<Enchantment, Integer> hashMap) {
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
ItemStack itemStack = new ItemStack(Material.getMaterial(id), qty, (short) meta);
|
ItemStack itemStack = new ItemStack(Material.getMaterial(id), qty, (short) meta);
|
||||||
ItemMeta ItemMeta = itemStack.getItemMeta();
|
ItemMeta ItemMeta = itemStack.getItemMeta();
|
||||||
|
|
||||||
if (lore != null) {
|
if (lore != null) {
|
||||||
List<String> TranslatedLore = new ArrayList<String>();
|
List<String> TranslatedLore = new ArrayList<String>();
|
||||||
for (String oneLore : lore) {
|
for (String oneLore : lore) {
|
||||||
@ -22,9 +25,8 @@ public class GiveItem {
|
|||||||
}
|
}
|
||||||
ItemMeta.setLore(TranslatedLore);
|
ItemMeta.setLore(TranslatedLore);
|
||||||
}
|
}
|
||||||
if (enchants != null)
|
for (Entry<Enchantment, Integer> OneEnchant : hashMap.entrySet()) {
|
||||||
for (String OneEnchant : enchants) {
|
ItemMeta.addEnchant(OneEnchant.getKey(), OneEnchant.getValue(), true);
|
||||||
ItemMeta.addEnchant(Enchantment.getByName(OneEnchant.split("=")[0]), Integer.parseInt(OneEnchant.split("=")[1]), true);
|
|
||||||
}
|
}
|
||||||
if (name != null)
|
if (name != null)
|
||||||
ItemMeta.setDisplayName(ChatColor.translateAlternateColorCodes('&', name));
|
ItemMeta.setDisplayName(ChatColor.translateAlternateColorCodes('&', name));
|
||||||
|
@ -71,6 +71,7 @@ public class TranslateName {
|
|||||||
break;
|
break;
|
||||||
case CUSTOMKILL:
|
case CUSTOMKILL:
|
||||||
case MMKILL:
|
case MMKILL:
|
||||||
|
case EXPLORE:
|
||||||
break;
|
break;
|
||||||
case SHEAR:
|
case SHEAR:
|
||||||
for (NameList one : ConfigManager.getJobsConfiguration().ListOfColors) {
|
for (NameList one : ConfigManager.getJobsConfiguration().ListOfColors) {
|
||||||
|
@ -293,6 +293,24 @@ Jobs:
|
|||||||
REDSTONE:
|
REDSTONE:
|
||||||
income: 5.0
|
income: 5.0
|
||||||
experience: 3.0
|
experience: 3.0
|
||||||
|
# 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, so you can give money not only for first player ho discovers that chunk
|
||||||
|
Explore:
|
||||||
|
1:
|
||||||
|
income: 5.0
|
||||||
|
experience: 5.0
|
||||||
|
2:
|
||||||
|
income: 2.5
|
||||||
|
experience: 2.5
|
||||||
|
3:
|
||||||
|
income: 1.0
|
||||||
|
experience: 1.0
|
||||||
|
4:
|
||||||
|
income: 0.5
|
||||||
|
experience: 0.5
|
||||||
|
5:
|
||||||
|
income: 0.1
|
||||||
|
experience: 0.1
|
||||||
# permissions granted for joining class
|
# permissions granted for joining class
|
||||||
permissions:
|
permissions:
|
||||||
# example node
|
# example node
|
||||||
@ -363,6 +381,25 @@ Jobs:
|
|||||||
- '&710% bonus XP'
|
- '&710% bonus XP'
|
||||||
moneyBoost: 1.1
|
moneyBoost: 1.1
|
||||||
expBoost: 1.1
|
expBoost: 1.1
|
||||||
|
# Limit item use to jobs level
|
||||||
|
limitedItems:
|
||||||
|
# Just name, dont have any impact
|
||||||
|
firstOne:
|
||||||
|
# Tool/Weapon id. Works for any interact action.
|
||||||
|
id: 278
|
||||||
|
# Level of this job player can start using this item
|
||||||
|
level: 5
|
||||||
|
# (optional) Items name, option to use color codes
|
||||||
|
name: '&8Miner Pickaxe'
|
||||||
|
# (optional) Item lore, again can come with color codes
|
||||||
|
lore:
|
||||||
|
- '&eBobs pick'
|
||||||
|
- '&710% bonus XP'
|
||||||
|
# (optional) Item enchantments, all enchantment names can be found https://hub.spigotmc.org/javadocs/spigot/org/bukkit/enchantments/Enchantment.html
|
||||||
|
# enchant level can inrease with jobs level to give best RPG experiance
|
||||||
|
enchants:
|
||||||
|
- DAMAGE_ALL=1
|
||||||
|
- FIRE_ASPECT=1
|
||||||
cmd-on-join:
|
cmd-on-join:
|
||||||
- 'msg [name] Thx for joining this job!'
|
- 'msg [name] Thx for joining this job!'
|
||||||
- 'msg [name] Now start working and get money from [jobname] job!'
|
- 'msg [name] Now start working and get money from [jobname] job!'
|
||||||
|
230
locale/messages_cz.yml
Normal file
230
locale/messages_cz.yml
Normal file
@ -0,0 +1,230 @@
|
|||||||
|
economy:
|
||||||
|
error:
|
||||||
|
nomoney: Nedostatek financi!
|
||||||
|
command:
|
||||||
|
boost:
|
||||||
|
help:
|
||||||
|
info: Zvysuje Exp/Vydelek pro vsechny hrace.
|
||||||
|
args: '[JmenoPrace] [Hodnota]'
|
||||||
|
output:
|
||||||
|
allreset: Vsechny exp/vydelky BOOST byly vypnuty.
|
||||||
|
jobsboostreset: BOOST pro %jobname% byl vypnut.
|
||||||
|
nothingtoreset: Neni nic, co by se dalo vypnout.
|
||||||
|
boostalladded: BOOST hodnoty %boost% byly povoleny pro vsechny prace.
|
||||||
|
boostadded: BOOST hodnoty &e%boost% &abyly povoleny pro praci &e%jobname%!
|
||||||
|
infostats: '&c-----> &aExp/Vydelky x%boost% je/jsou zapnute&c <-------'
|
||||||
|
convert:
|
||||||
|
help:
|
||||||
|
info: Prevede data z jednoho zpusobu databaze na jiny. Pokud práve pouzivate SQLite, bude preveden na MySQL a naopak.
|
||||||
|
args: ''
|
||||||
|
limit:
|
||||||
|
help:
|
||||||
|
info: Vypise limit vydelku praci.
|
||||||
|
args: ''
|
||||||
|
output:
|
||||||
|
lefttime: '&eZbyvajici cas do resetovani limitu vydelku: &2%hour% &ehour &2%min% &emin &2%sec%
|
||||||
|
&esec'
|
||||||
|
moneylimit: '&eLimit vydelku: &2%money%&e/&2%totalmoney%'
|
||||||
|
reachedlimit: '&4Dosahl/a jsi limitu vydelku v danem case!'
|
||||||
|
reachedlimit2: '&eLimit zjistis prikazem &2/jobs limit'
|
||||||
|
notenabled: '&eLimit vydelku neni zapnuty.'
|
||||||
|
admin:
|
||||||
|
error: Doslo k chybe v prikazu.
|
||||||
|
success: Prikaz byl proveden dle rozkazu.
|
||||||
|
error:
|
||||||
|
job: 'Prace, kterou sis vybral/a, neexistuje.'
|
||||||
|
permission: Nemas povoleni na tuto akci.
|
||||||
|
help:
|
||||||
|
output:
|
||||||
|
info: Napis /jobs [prikaz] ? pro vice informaci.
|
||||||
|
usage: 'Pouziti: %usage%'
|
||||||
|
stats:
|
||||||
|
help:
|
||||||
|
info: 'Vypise level v pracech, ve kterych jsi zamestnany(a).'
|
||||||
|
args: '[JmenoHrace]'
|
||||||
|
error:
|
||||||
|
nojob: 'Nejdrive se prihlas do nejake prace.'
|
||||||
|
output: 'lvl%joblevel% %jobname% : %jobxp%/%jobmaxxp% xp'
|
||||||
|
archive:
|
||||||
|
help:
|
||||||
|
info: Vypise vsechny prace ulozene v archivu podle uzivatele.
|
||||||
|
args: '[JmenoHrace]'
|
||||||
|
error:
|
||||||
|
nojob: Nejsou zadne ulozene prace.
|
||||||
|
output: lvl %joblevel% (%getbackjoblevel%) %jobname%
|
||||||
|
give:
|
||||||
|
help:
|
||||||
|
info: Da item podle nazvu prace a nazvu kategorie. Jmeno Hrace neni povinny udaj.
|
||||||
|
args: '[JmenoHrace] [JmenoPrace] [JmenoItemu]'
|
||||||
|
output:
|
||||||
|
notonline: '&4Hrac [%playername%] neni online!'
|
||||||
|
noitem: '&4Nelze najit item s timto jmenem!'
|
||||||
|
info:
|
||||||
|
help:
|
||||||
|
title: '&2*** &ePrace&2 ***'
|
||||||
|
info: Vypise vysi vydelku prace k dane akci.
|
||||||
|
args: '[JmenoPrace] [akce]'
|
||||||
|
actions: '&ePlatne akce jsou: &f%actions%'
|
||||||
|
max: ' - &emax level:&f '
|
||||||
|
material: '&7%material%'
|
||||||
|
output:
|
||||||
|
break:
|
||||||
|
info: Breaknuti
|
||||||
|
none: '%jobname% vydelava penize za breaknuti bloku.'
|
||||||
|
place:
|
||||||
|
info: Polozeni
|
||||||
|
none: '%jobname% vydelava penize za polozeni bloku.'
|
||||||
|
kill:
|
||||||
|
info: Zabijeni
|
||||||
|
none: '%jobname% vydelava penize za zabijeni monster.'
|
||||||
|
fish:
|
||||||
|
info: Rybareni
|
||||||
|
none: '%jobname% vydelava penize za rybarení.'
|
||||||
|
craft:
|
||||||
|
info: Craft
|
||||||
|
none: '%jobname% vydelava penize za craftení vecí.'
|
||||||
|
smelt:
|
||||||
|
info: Peceni
|
||||||
|
none: '%jobname% vydelava penize za pecení v peci.'
|
||||||
|
brew:
|
||||||
|
info: Vareni
|
||||||
|
none: '%jobname% vydelava penize za vareni lektvaru.'
|
||||||
|
enchant:
|
||||||
|
info: Ocarovani
|
||||||
|
none: '%jobname% vydelava penize za ocarovávání/enchant itemu.'
|
||||||
|
repair:
|
||||||
|
info: Opravovani
|
||||||
|
none: '%jobname% vydelava penize za opravování predmetu.'
|
||||||
|
breed:
|
||||||
|
info: Farmareni
|
||||||
|
none: '%jobname% vydelava penize za farmareni.'
|
||||||
|
tame:
|
||||||
|
info: Ochocovani
|
||||||
|
none: '%jobname% vydelava penize za ochocovani zvirat.'
|
||||||
|
playerinfo:
|
||||||
|
help:
|
||||||
|
info: Vypise vysi vydelku prace k dane akci urciteho hrace.
|
||||||
|
args: '[JmenoHrace] [JmenoPrace] [akce]'
|
||||||
|
join:
|
||||||
|
help:
|
||||||
|
info: Zamestnas se do prace.
|
||||||
|
args: '[JmenoPrace]'
|
||||||
|
error:
|
||||||
|
alreadyin: Uz pracujes jako %jobname%.
|
||||||
|
fullslots: Nemuzes se zamestnat do prace %jobname%, nejsou zde zadna volna mista.
|
||||||
|
maxjobs: Dosahl/a jsi maxima povolenych praci.
|
||||||
|
success: Zamestnal/a ses jako %jobname%.
|
||||||
|
leave:
|
||||||
|
help:
|
||||||
|
info: Opustis danou praci.
|
||||||
|
args: '[JmenoPrace]'
|
||||||
|
success: Opustil/a jsi praci %jobname%.
|
||||||
|
leaveall:
|
||||||
|
help:
|
||||||
|
info: Opustis vsechny svoje prace
|
||||||
|
error:
|
||||||
|
nojobs: Nemas zadne prace, ktere by jsi mohl/a opustit.
|
||||||
|
success: Opustil/a jsi vsechny sve prace.
|
||||||
|
browse:
|
||||||
|
help:
|
||||||
|
info: Seznam dostupnych praci
|
||||||
|
error:
|
||||||
|
nojobs: 'Nejsou zadne prace, ve kterych by jsi mohl/a byt zamestnan/a.'
|
||||||
|
output:
|
||||||
|
header: 'Mas povoleni na zamestnani v techto pracech:'
|
||||||
|
footer: Pro více info napis /jobs info [JmenoPrace]
|
||||||
|
fire:
|
||||||
|
help:
|
||||||
|
info: Vykopne hrace z dane prace.
|
||||||
|
args: '[JmenoHrace] [JmenoPrace]'
|
||||||
|
error:
|
||||||
|
nojob: Hrac neni zamestnan jako %jobname%.
|
||||||
|
output:
|
||||||
|
target: Byl/a jsi vyhozen/a z prace %jobname%.
|
||||||
|
fireall:
|
||||||
|
help:
|
||||||
|
info: Vykopne hrace ze vsech prací.
|
||||||
|
args: '[JmenoHrace]'
|
||||||
|
error:
|
||||||
|
nojobs: Hrac nema zadne prace, ze kterych by mohl byt vykopnut.
|
||||||
|
output:
|
||||||
|
target: Byl/a jsi vykopnut/a ze vsech prací.
|
||||||
|
employ:
|
||||||
|
help:
|
||||||
|
info: Zamestna hrace do prace.
|
||||||
|
args: '[JmenoHrace] [JmenoPrace]'
|
||||||
|
error:
|
||||||
|
alreadyin: Hrac uz pracuje jako %jobname%.
|
||||||
|
output:
|
||||||
|
target: Byl/a jsi zamestnan/a jako %jobname%.
|
||||||
|
top:
|
||||||
|
help:
|
||||||
|
info: '&eZobrazi &aTop 10 &ehracu dle praci.'
|
||||||
|
args: '[JmenoPrace]'
|
||||||
|
error:
|
||||||
|
nojob: Nelze najit zadnou praci s timto jmenem.
|
||||||
|
output:
|
||||||
|
topline: '&aTop&e 10 &ehracu pro praci &6%jobname%'
|
||||||
|
list: '&e%number%&a. &e%playername% &alvl &e%level% &as&e %exp% &aexp'
|
||||||
|
transfer:
|
||||||
|
help:
|
||||||
|
info: Prevede danou praci hrace ze stare práce do nove.
|
||||||
|
args: '[JmenoHrace] [StaraPrace] [NovaPrace]'
|
||||||
|
output:
|
||||||
|
target: Byl/a jsi presunut/a z prace %oldjobname% do %newjobname%.
|
||||||
|
promote:
|
||||||
|
help:
|
||||||
|
info: Prida hraci levely do dane prace.
|
||||||
|
args: '[JmenoHrace] [JmenoPrace] [levely]'
|
||||||
|
output:
|
||||||
|
target: Bylo ti pridano %levelsgained% levelu v praci %jobname%.
|
||||||
|
demote:
|
||||||
|
help:
|
||||||
|
info: Odebere hraci levely z dane prace.
|
||||||
|
args: '[JmenoHrace] [JmenoPrace] [levely]'
|
||||||
|
output:
|
||||||
|
target: Bylo ti odebrano %levelslost% levelu v praci %jobname%.
|
||||||
|
grantxp:
|
||||||
|
help:
|
||||||
|
info: Prida hraci zkusenosti do dane prace.
|
||||||
|
args: '[JmenoHrace] [JmenoPrace] [xp]'
|
||||||
|
output:
|
||||||
|
target: Dostal/a jsi %xpgained% zkusenosti v praci %jobname%.
|
||||||
|
removexp:
|
||||||
|
help:
|
||||||
|
info: Odstrani hraci zkusenosti z dane prace.
|
||||||
|
args: '[JmenoHrace] [JmenoPrace] [xp]'
|
||||||
|
output:
|
||||||
|
target: Ztratil/a jsi %xplost% zkusenosti v praci %jobname%.
|
||||||
|
reload:
|
||||||
|
help:
|
||||||
|
info: Reloadne konfiguraci.
|
||||||
|
toggle:
|
||||||
|
help:
|
||||||
|
info: Zapina/Vypina vypis vydelku na panelu akci.
|
||||||
|
output:
|
||||||
|
paid: '&a+ &a&l[amount]&a$'
|
||||||
|
'on': '&aVypis: &aZAPNUTO'
|
||||||
|
'off': '&aVypis: &cVYPNUTO'
|
||||||
|
message:
|
||||||
|
skillup:
|
||||||
|
broadcast: '%playername% byl/a povysen/a na %titlename% %jobname%.'
|
||||||
|
nobroadcast: Gratulujeme, byl/a jsi povysen/a na %titlename% %jobname%.
|
||||||
|
levelup:
|
||||||
|
broadcast: '%playername% dosahl/a levelu %joblevel% v praci %jobname%.'
|
||||||
|
nobroadcast: Dosahl/a jsi levelu %joblevel% v praci %jobname%.
|
||||||
|
crafting:
|
||||||
|
fullinventory: Mas plny inventar!
|
||||||
|
signs:
|
||||||
|
cantcreate: '&4Nemuzes vytvorit tuto cedulku!'
|
||||||
|
topline: '&e[Jobs]'
|
||||||
|
secondline:
|
||||||
|
join: '&2Join'
|
||||||
|
leave: '&4Leave'
|
||||||
|
toggle: '&eToggle'
|
||||||
|
top: '&eTop'
|
||||||
|
browse: '&eBrowse'
|
||||||
|
stats: '&eStats'
|
||||||
|
limit: '&eLimit'
|
||||||
|
info: '&eInfo'
|
||||||
|
archive: '&eArchive'
|
@ -1,7 +1,7 @@
|
|||||||
name: Jobs
|
name: Jobs
|
||||||
description: Jobs Plugin for the BukkitAPI
|
description: Jobs Plugin for the BukkitAPI
|
||||||
main: com.gamingmesh.jobs.JobsPlugin
|
main: com.gamingmesh.jobs.JobsPlugin
|
||||||
version: 2.56.0
|
version: 2.58.0
|
||||||
author: phrstbrn
|
author: phrstbrn
|
||||||
softdepend: [Vault, CoreProtect, MythicMobs, McMMO]
|
softdepend: [Vault, CoreProtect, MythicMobs, McMMO]
|
||||||
commands:
|
commands:
|
||||||
|
Loading…
Reference in New Issue
Block a user