1
0
mirror of https://github.com/Zrips/Jobs.git synced 2025-01-02 14:29:07 +01:00

Add some informations about deprecated values

- Melon block should work now
- With -1 potion ids are not generated at server start
This commit is contained in:
montlikadani 2019-06-18 20:30:25 +02:00
parent aa10f23efe
commit f8519abfa1
14 changed files with 74 additions and 36 deletions

View File

@ -23,9 +23,9 @@
<dependency>
<groupId>de.Keyle.MyPet</groupId>
<artifactId>MyPet</artifactId>
<version>3.2</version>
<version>3.3</version>
<scope>system</scope>
<systemPath>${basedir}/libs/MyPet-3.2.jar</systemPath>
<systemPath>${basedir}/libs/MyPet-3.3.jar</systemPath>
</dependency>
<!-- McMMO -->
<dependency>

View File

@ -236,6 +236,12 @@ public class CMIItemStack {
return cmiMaterial == null ? CMIMaterial.get(material) : cmiMaterial;
}
/**
* Gets the material
*
* @deprecated Use {@link #getType()}
* @return Material
*/
@Deprecated
public Material getMaterial() {
return getType();

View File

@ -130,6 +130,13 @@ public class ItemManager {
}
/**
* Gets the item by material
*
* @deprecated Use {@link #getItem(Material)}
* @param mat Material
* @return {@link CMIItemStack}
*/
@Deprecated
public CMIItemStack getItem(Material mat) {
CMIItemStack cm = byMaterial.get(CMIMaterial.get(mat));
@ -1534,7 +1541,7 @@ public class ItemManager {
MAGMA_CREAM(378, 0, 25097, "Magma Cream"),
MAGMA_CUBE_SPAWN_EGG(383, 62, 26638, "Spawn Magma Cube", "Magma Cube Spawn Egg"),
MAP(395, 0, 21655, "Empty Map"),
MELON_BLOCK(103, 0, 25172, "Melon"),
MELON(103, 0, 25172, "Melonblock", "MELON_BLOCK"),
MELON_SEEDS(362, 0, 18340, "Melon Seeds"),
MELON_SLICE(360, 0, 5347, "Melon Slice"),
MELON_STEM(105, 0, 8247, "Melon Stem"),
@ -2080,11 +2087,23 @@ public class ItemManager {
return name;
}
/**
* Get the legacy id from the material enum
*
* @deprecated Not used, above 1.13
* @return legacy id
*/
@Deprecated
public Integer getLegacyId() {
return this.legacyId == null ? 0 : this.legacyId;
}
/**
* Get the id from the material enum
*
* @deprecated If the id is exist under 1.13 then success
* @return id
*/
@Deprecated
public Integer getId() {
if (Version.isCurrentEqualOrHigher(Version.v1_13_R1)) {
@ -2155,6 +2174,12 @@ public class ItemManager {
return stack;
}
/**
* Get the data
*
* @deprecated Not used, above 1.13+
* @return data
*/
@Deprecated
public short getData() {
if (Version.isCurrentEqualOrHigher(Version.v1_13_R1)) {
@ -2163,6 +2188,12 @@ public class ItemManager {
return getLegacyData();
}
/**
* Get the legacy data
*
* @deprecated Not used, above 1.13+
* @return legacy data
*/
@Deprecated
public short getLegacyData() {
return legacyData == null ? 0 : legacyData.shortValue();
@ -3448,7 +3479,7 @@ public class ItemManager {
if (block.getBlockData() instanceof org.bukkit.block.data.type.Slab) {
org.bukkit.block.data.type.Slab slab = (org.bukkit.block.data.type.Slab) block.getBlockData();
org.bukkit.block.data.type.Slab.Type type = slab.getType();
// Sadly we have to convert into a string for backwards compatibility.
switch (type.toString()) {
case "TOP":

View File

@ -13,7 +13,6 @@ import com.gamingmesh.jobs.Jobs;
import com.gamingmesh.jobs.actions.ItemActionInfo;
import com.gamingmesh.jobs.container.ActionType;
import com.gamingmesh.jobs.container.JobsPlayer;
import com.gamingmesh.jobs.stuff.Debug;
import com.gmail.nossr50.events.skills.abilities.McMMOPlayerAbilityActivateEvent;
import com.gmail.nossr50.events.skills.abilities.McMMOPlayerAbilityDeactivateEvent;
import com.gmail.nossr50.events.skills.abilities.McMMOPlayerAbilityEvent;

View File

@ -2,7 +2,6 @@ package com.gamingmesh.jobs;
import java.util.List;
import org.bukkit.block.Block;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;

View File

@ -63,7 +63,6 @@ import com.gamingmesh.jobs.dao.JobsDAO;
import com.gamingmesh.jobs.dao.JobsDAOData;
import com.gamingmesh.jobs.economy.PaymentData;
import com.gamingmesh.jobs.economy.PointsData;
import com.gamingmesh.jobs.stuff.Debug;
import com.gamingmesh.jobs.stuff.PerformCommands;
import com.gamingmesh.jobs.stuff.Util;
@ -310,7 +309,7 @@ public class PlayerManager {
jPlayer.setUserId(info.getID());
jPlayer.setDoneQuests(info.getQuestsDone());
jPlayer.setQuestProgressionFromString(info.getQuestProgression());
if (jobs != null)
for (JobsDAOData jobdata : jobs) {
if (Jobs.getJob(jobdata.getJobName()) == null)
@ -567,12 +566,15 @@ public class PlayerManager {
public void run() {
if (player == null || !player.isOnline())
return;
Firework f = (Firework) player.getWorld().spawn(player.getLocation(), Firework.class);
FireworkMeta fm = f.getFireworkMeta();
if (Jobs.getGCManager().UseRandom) {
Random r = new Random();
int rt = r.nextInt(4) + 1;
Type type = Type.BALL;
if (rt == 1)
type = Type.BALL;
if (rt == 2)
@ -583,25 +585,32 @@ public class PlayerManager {
type = Type.CREEPER;
if (rt == 5)
type = Type.STAR;
int r1i = r.nextInt(17) + 1;
int r2i = r.nextInt(17) + 1;
Color c1 = Util.getColor(r1i);
Color c2 = Util.getColor(r2i);
FireworkEffect effect = FireworkEffect.builder().flicker(r.nextBoolean()).withColor(c1).withFade(c2).with(type).trail(r.nextBoolean()).build();
FireworkEffect effect = FireworkEffect.builder().flicker(r.nextBoolean()).withColor(c1)
.withFade(c2).with(type).trail(r.nextBoolean()).build();
fm.addEffect(effect);
int rp = r.nextInt(2) + 1;
fm.setPower(rp);
} else {
Pattern comma = Pattern.compile(",", 16);
List<String> colorStrings = Jobs.getGCManager().FwColors;
Color[] colors = new Color[colorStrings.size()];
for (int s = 0; s < colorStrings.size(); s++) {
String colorString = colorStrings.get(s);
String[] sSplit = comma.split(colorString);
if (sSplit.length < 3) {
Jobs.consoleMsg("[Jobs] &cInvalid color " + colorString + "! Colors must be 3 comma-separated numbers ranging from 0 to 255.");
return;
continue;
}
int[] colorRGB = new int[3];
for (int i = 0; i < 3; i++) {
String colorInt = sSplit[i];
@ -611,13 +620,14 @@ public class PlayerManager {
Jobs.consoleMsg("[Jobs] &cInvalid color component " + colorInt + ", it must be an integer.");
}
}
try {
colors[s] = Color.fromRGB(colorRGB[0], colorRGB[1], colorRGB[2]);
} catch (IllegalArgumentException e) {
e.printStackTrace();
Jobs.consoleMsg("[Jobs] &cFailed to add color! " + e);
}
}
fm.addEffect(FireworkEffect.builder()
.flicker(Jobs.getGCManager().UseFlicker)
.trail(Jobs.getGCManager().UseTrail)
@ -625,6 +635,7 @@ public class PlayerManager {
.withColor(colors)
.withFade(colors)
.build());
fm.setPower(Jobs.getGCManager().FireworkPower);
}

View File

@ -16,10 +16,10 @@ public class Reflections {
private Class<?> NBTTagCompound;
private Class<?> NBTBase;
private Class<?> NBTTagList;
// private Class<?> NBTTagList;
private Class<?> CraftItemStack;
private Class<?> Item;
// private Class<?> Item;
private Class<?> IStack;
public Reflections() {
@ -47,22 +47,22 @@ public class Reflections {
} catch (ClassNotFoundException | SecurityException | IllegalArgumentException e) {
e.printStackTrace();
}
try {
/*try {
NBTTagList = getMinecraftClass("NBTTagList");
} catch (ClassNotFoundException | SecurityException | IllegalArgumentException e) {
e.printStackTrace();
}
}*/
try {
CraftItemStack = getBukkitClass("inventory.CraftItemStack");
} catch (ClassNotFoundException | SecurityException | IllegalArgumentException e) {
e.printStackTrace();
}
try {
/*try {
Item = getMinecraftClass("Item");
} catch (ClassNotFoundException | SecurityException | IllegalArgumentException e) {
e.printStackTrace();
}
}*/
try {
IStack = getMinecraftClass("ItemStack");
} catch (ClassNotFoundException | SecurityException | IllegalArgumentException e) {

View File

@ -15,7 +15,6 @@ import com.gamingmesh.jobs.container.JobsPlayer;
import com.gamingmesh.jobs.container.QuestObjective;
import com.gamingmesh.jobs.container.QuestProgression;
import com.gamingmesh.jobs.CMILib.RawMessage;
import com.gamingmesh.jobs.stuff.Debug;
import com.gamingmesh.jobs.stuff.TimeManage;
public class quests implements Cmd {

View File

@ -24,7 +24,6 @@ import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.UnsupportedEncodingException;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@ -62,7 +61,6 @@ import com.gamingmesh.jobs.container.Quest;
import com.gamingmesh.jobs.container.QuestObjective;
import com.gamingmesh.jobs.resources.jfep.Parser;
import com.gamingmesh.jobs.stuff.ChatColor;
import com.gamingmesh.jobs.stuff.Debug;
import com.gamingmesh.jobs.CMILib.VersionChecker.Version;
public class ConfigManager {

View File

@ -48,10 +48,11 @@ public class NameTranslatorManager {
case BREW:
case FISH:
case STRIPLOGS:
CMIMaterial mat = CMIMaterial.get(materialName);
NameList nameLs = ListOfNames.get(mat);
CMIMaterial mat = CMIMaterial.get(materialName);
NameList nameLs = ListOfNames.get(mat);
if (nameLs == null)
return mat.getName();
return nameLs.getName();
case BREED:
case KILL:
@ -73,7 +74,6 @@ public class NameTranslatorManager {
}
break;
case ENCHANT:
String name = materialName;
String level = "";
if (name.contains(":")) {
@ -96,7 +96,6 @@ public class NameTranslatorManager {
}
}
break;
case MMKILL:
return Jobs.getMythicManager().getDisplayName(materialName);
case DRINK:
@ -123,7 +122,6 @@ public class NameTranslatorManager {
Set<String> keys = section.getKeys(false);
ListOfNames.clear();
for (String one : keys) {
String split = one.split("-")[0];
String id = split.contains(":") ? split.split(":")[0] : split;
String meta = split.contains(":") && split.split(":").length > 1 ? split.split(":")[1] : "";
@ -173,10 +171,9 @@ public class NameTranslatorManager {
ListOfColors.clear();
for (String one : keys) {
String id = one.split("-")[0];
String meta = "";
String MCName = one.split("-")[1];
String Name = ItemFile.getConfig().getString("ColorList." + one);
ListOfColors.add(new NameList(id, meta, Name, MCName));
ListOfColors.add(new NameList(id, "", Name, MCName));
}
if (ListOfColors.size() > 0)
Jobs.consoleMsg("&e[Jobs] Loaded " + ListOfColors.size() + " custom color names!");
@ -189,10 +186,9 @@ public class NameTranslatorManager {
ListOfPotionNames.clear();
for (String one : keys) {
String id = one.split("-")[0];
String meta = "";
String MCName = one.split("-")[1];
String Name = ItemFile.getConfig().getString("PotionNamesList." + one);
ListOfPotionNames.add(new NameList(id, meta, Name, MCName));
ListOfPotionNames.add(new NameList(id, "", Name, MCName));
}
if (ListOfPotionNames.size() > 0)
Jobs.consoleMsg("&e[Jobs] Loaded " + ListOfPotionNames.size() + " custom potion names!");
@ -416,15 +412,18 @@ public class NameTranslatorManager {
name = c.getC().getString("PotionNamesList." + n + ".Name");
if (name == null) {
n = n + "-" + one.toString();
if (c.getC().isConfigurationSection("PotionNamesList." + n))
n = (one.getId() == -1 ? "" : n + "-" + one.toString());
if (n == "")
continue;
if (c.getC().isString("PotionNamesList." + n))
name = c.getC().getString("PotionNamesList." + n);
}
if (name == null)
name = one.getName();
c.get("PotionNamesList." + one.getId() + "-" + one.toString(), name);
c.get("PotionNamesList." + n.toString(), name);
}
c.save();

View File

@ -26,7 +26,6 @@ import java.util.List;
import java.util.Map;
import java.util.Random;
import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
@ -34,7 +33,6 @@ import org.bukkit.inventory.ItemStack;
import com.gamingmesh.jobs.Jobs;
import com.gamingmesh.jobs.resources.jfep.Parser;
import com.gamingmesh.jobs.stuff.ChatColor;
import com.gamingmesh.jobs.stuff.Debug;
public class Job {
// job info

View File

@ -33,7 +33,6 @@ import com.gamingmesh.jobs.dao.JobsDAO;
import com.gamingmesh.jobs.economy.PaymentData;
import com.gamingmesh.jobs.resources.jfep.Parser;
import com.gamingmesh.jobs.stuff.ChatColor;
import com.gamingmesh.jobs.stuff.Debug;
import com.gamingmesh.jobs.stuff.FurnaceBrewingHandling;
import com.gamingmesh.jobs.stuff.TimeManage;

View File

@ -34,7 +34,6 @@ import com.gamingmesh.jobs.container.PlayerPoints;
import com.gamingmesh.jobs.container.TopList;
import com.gamingmesh.jobs.dao.JobsManager.DataBaseType;
import com.gamingmesh.jobs.economy.PaymentData;
import com.gamingmesh.jobs.stuff.Debug;
import com.gamingmesh.jobs.stuff.TimeManage;
public abstract class JobsDAO {