1
0
mirror of https://github.com/Zrips/Jobs.git synced 2024-11-29 14:05:25 +01:00
This commit is contained in:
Zrips 2018-10-14 17:04:49 +03:00
commit aa84bde32d
7 changed files with 25 additions and 27 deletions

View File

@ -66,14 +66,14 @@ public class ActionBarTitleMessages {
} }
} }
public static void send(CommandSender receivingPacket, String msg) { public void send(CommandSender receivingPacket, String msg) {
if (receivingPacket instanceof Player) if (receivingPacket instanceof Player)
send((Player) receivingPacket, msg); send((Player) receivingPacket, msg);
else else
receivingPacket.sendMessage(msg); receivingPacket.sendMessage(msg);
} }
public static void send(Player receivingPacket, String msg) { public void send(Player receivingPacket, String msg) {
if (receivingPacket == null) if (receivingPacket == null)
return; return;
if (!receivingPacket.isOnline()) if (!receivingPacket.isOnline())
@ -116,7 +116,8 @@ public class ActionBarTitleMessages {
public static void sendTitle(final Player receivingPacket, final Object title, final Object subtitle, final int fadeIn, final int keep, final int fadeOut) { public static void sendTitle(final Player receivingPacket, final Object title, final Object subtitle, final int fadeIn, final int keep, final int fadeOut) {
Bukkit.getScheduler().runTaskAsynchronously(Jobs.getInstance(), new Runnable() { Bukkit.getScheduler().runTaskAsynchronously(Jobs.getInstance(), new Runnable() {
@Override @SuppressWarnings("deprecation")
@Override
public void run() { public void run() {
String t = title == null ? null : CMIChatColor.translateAlternateColorCodes((String) title); String t = title == null ? null : CMIChatColor.translateAlternateColorCodes((String) title);

View File

@ -138,7 +138,7 @@ public enum CMIChatColor {
} }
public static CMIChatColor getRandomColor() { public static CMIChatColor getRandomColor() {
List<CMIChatColor> ls = new ArrayList<CMIChatColor>(); List<CMIChatColor> ls = new ArrayList<>();
for (CMIChatColor one : CMIChatColor.values()) { for (CMIChatColor one : CMIChatColor.values()) {
if (!one.isColor()) if (!one.isColor())
continue; continue;

View File

@ -22,22 +22,22 @@ import com.gamingmesh.jobs.CMILib.VersionChecker.Version;
public class RawMessage { public class RawMessage {
List<String> parts = new ArrayList<String>(); private List<String> parts = new ArrayList<>();
List<String> cleanParts = new ArrayList<String>(); private List<String> cleanParts = new ArrayList<>();
String colorReplacerPlaceholder = "%#%"; private String colorReplacerPlaceholder = "%#%";
private String unfinished = ""; private String unfinished = "";
private String unfinishedClean = ""; private String unfinishedClean = "";
private String combined = ""; private String combined = "";
String combinedClean = ""; private String combinedClean = "";
private boolean breakLine = true; private boolean breakLine = true;
// private boolean colorizeEntireWithLast = true; // private boolean colorizeEntireWithLast = true;
public void clear() { public void clear() {
parts = new ArrayList<String>(); parts = new ArrayList<>();
cleanParts = new ArrayList<String>(); cleanParts = new ArrayList<>();
combined = ""; combined = "";
combinedClean = ""; combinedClean = "";
} }
@ -71,17 +71,17 @@ public class RawMessage {
return add(text, hoverText, command, suggestion, null); return add(text, hoverText, command, suggestion, null);
} }
Set<CMIChatColor> formats = new HashSet<CMIChatColor>(); private Set<CMIChatColor> formats = new HashSet<>();
CMIChatColor lastColor = null; private CMIChatColor lastColor = null;
Set<CMIChatColor> savedFormats = new HashSet<CMIChatColor>(); private Set<CMIChatColor> savedFormats = new HashSet<>();
CMIChatColor savedLastColor = null; private CMIChatColor savedLastColor = null;
CMIChatColor firstBlockColor = null; private CMIChatColor firstBlockColor = null;
private String makeMessyText(String text) { private String makeMessyText(String text) {
text = CMIChatColor.deColorize(text); text = CMIChatColor.deColorize(text);
List<String> splited = new ArrayList<String>(); List<String> splited = new ArrayList<>();
if (text.contains(" ")) { if (text.contains(" ")) {
for (String one : text.split(" ")) { for (String one : text.split(" ")) {
@ -348,7 +348,7 @@ public class RawMessage {
} }
} }
List<String> Lore = new ArrayList<String>(); List<String> Lore = new ArrayList<>();
// if (CMIMaterial.isShulkerBox(item.getType())) { // if (CMIMaterial.isShulkerBox(item.getType())) {
// List<ItemStack> items = CMI.getInstance().getShulkerBoxManager().getShulkerBoxContents(item); // List<ItemStack> items = CMI.getInstance().getShulkerBoxManager().getShulkerBoxContents(item);
@ -437,7 +437,7 @@ public class RawMessage {
} }
public List<String> softCombine() { public List<String> softCombine() {
List<String> ls = new ArrayList<String>(); List<String> ls = new ArrayList<>();
String f = ""; String f = "";
for (String part : parts) { for (String part : parts) {
if (f.isEmpty()) if (f.isEmpty())

View File

@ -14,7 +14,7 @@ import org.bukkit.entity.Player;
import com.gamingmesh.jobs.Jobs; import com.gamingmesh.jobs.Jobs;
public class VersionChecker { public class VersionChecker {
Jobs plugin; private Jobs plugin;
private static int resource = 4216; private static int resource = 4216;
public VersionChecker(Jobs plugin) { public VersionChecker(Jobs plugin) {
@ -182,7 +182,7 @@ public class VersionChecker {
if (version.length() <= 7) if (version.length() <= 7)
return version; return version;
} catch (Exception ex) { } catch (Exception ex) {
Bukkit.getConsoleSender().sendMessage(ChatColor.RED + "Failed to check for " + plugin.getDescription().getName() + " update on spigot web page."); Jobs.consoleMsg("&cFailed to check for " + plugin.getDescription().getName() + " update on spigot web page.");
} }
return null; return null;
} }

View File

@ -20,7 +20,6 @@ import com.gamingmesh.jobs.container.CurrencyType;
import com.gamingmesh.jobs.container.Job; import com.gamingmesh.jobs.container.Job;
import com.gamingmesh.jobs.container.JobInfo; import com.gamingmesh.jobs.container.JobInfo;
import com.gamingmesh.jobs.stuff.ChatColor; import com.gamingmesh.jobs.stuff.ChatColor;
import com.gamingmesh.jobs.stuff.Debug;
import com.gamingmesh.jobs.stuff.PageInfo; import com.gamingmesh.jobs.stuff.PageInfo;
import com.gamingmesh.jobs.CMILib.RawMessage; import com.gamingmesh.jobs.CMILib.RawMessage;
import com.gamingmesh.jobs.stuff.Util; import com.gamingmesh.jobs.stuff.Util;
@ -35,7 +34,7 @@ public class editjobs implements Cmd {
if (!(sender instanceof Player)) if (!(sender instanceof Player))
return false; return false;
Player player = (Player) sender; Player player = (Player) sender;
if (args.length == 0) if (args.length == 0)

View File

@ -31,7 +31,6 @@ import org.bukkit.entity.Player;
import com.gamingmesh.jobs.Jobs; import com.gamingmesh.jobs.Jobs;
import com.gamingmesh.jobs.api.JobsPaymentEvent; import com.gamingmesh.jobs.api.JobsPaymentEvent;
import com.gamingmesh.jobs.container.JobsPlayer; import com.gamingmesh.jobs.container.JobsPlayer;
import com.gamingmesh.jobs.CMILib.ActionBarTitleMessages;
import com.gamingmesh.jobs.CMILib.VersionChecker.Version; import com.gamingmesh.jobs.CMILib.VersionChecker.Version;
import com.gamingmesh.jobs.tasks.BufferedPaymentTask; import com.gamingmesh.jobs.tasks.BufferedPaymentTask;
@ -148,7 +147,7 @@ public class BufferedEconomy {
Jobs.getActionbarToggleList().put(ServerTaxesAccountname, true); Jobs.getActionbarToggleList().put(ServerTaxesAccountname, true);
if (Jobs.getActionbarToggleList().containsKey(ServerTaxesAccountname) && Jobs.getActionbarToggleList().get(ServerTaxesAccountname)) { if (Jobs.getActionbarToggleList().containsKey(ServerTaxesAccountname) && Jobs.getActionbarToggleList().get(ServerTaxesAccountname)) {
Jobs.getActionBar(); Jobs.getActionBar();
ActionBarTitleMessages.send(Bukkit.getPlayer(ServerAccountname), Jobs.getLanguage().getMessage("message.taxes", "[amount]", (int) (TotalAmount * 100) Jobs.getActionBar().send(Bukkit.getPlayer(ServerAccountname), Jobs.getLanguage().getMessage("message.taxes", "[amount]", (int) (TotalAmount * 100)
/ 100.0)); / 100.0));
} }
} }
@ -182,7 +181,7 @@ public class BufferedEconomy {
if (Jobs.getGCManager().UseServerAccount) { if (Jobs.getGCManager().UseServerAccount) {
if (!hasMoney) { if (!hasMoney) {
Jobs.getActionBar(); Jobs.getActionBar();
ActionBarTitleMessages.send(payment.getOfflinePlayer().getPlayer(), Jobs.getLanguage().getMessage("economy.error.nomoney")); Jobs.getActionBar().send(payment.getOfflinePlayer().getPlayer(), Jobs.getLanguage().getMessage("economy.error.nomoney"));
continue; continue;
} }
if (Jobs.getGCManager().isEconomyAsync()) { if (Jobs.getGCManager().isEconomyAsync()) {
@ -242,7 +241,7 @@ public class BufferedEconomy {
Message = Message + " " + Jobs.getLanguage().getMessage("command.toggle.output.paid.exp", new Object[] { "[exp]", String.format(Jobs.getGCManager().getDecimalPlacesExp(), new Object[] { Message = Message + " " + Jobs.getLanguage().getMessage("command.toggle.output.paid.exp", new Object[] { "[exp]", String.format(Jobs.getGCManager().getDecimalPlacesExp(), new Object[] {
Double.valueOf(payment.getExp()) }) }); Double.valueOf(payment.getExp()) }) });
} }
ActionBarTitleMessages.send(abp, Message); Jobs.getActionBar().send(abp, Message);
} }
} }
} }

View File

@ -27,7 +27,6 @@ import java.util.UUID;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.CropState;
import org.bukkit.GameMode; import org.bukkit.GameMode;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;