1
0
mirror of https://github.com/Zrips/Jobs.git synced 2025-01-04 23:37:49 +01:00

Fix build

This commit is contained in:
montlikadani 2020-08-25 16:35:30 +02:00
parent 9b068c306c
commit 126bc43e01
6 changed files with 35 additions and 71 deletions

View File

@ -54,52 +54,6 @@ public class CMIChatColor {
public static final String colorCodePrefix = "{#";
public static final String colorCodeSuffix = "}";
private static String charEscape(String s) {
StringBuffer sb = new StringBuffer();
for (int i = 0; i < s.length(); i++) {
char ch = s.charAt(i);
switch (ch) {
case '"':
sb.append("\\\"");
break;
case '\n':
sb.append("\\n");
break;
case '\\':
sb.append("\\\\");
break;
case '\b':
sb.append("\\b");
break;
case '\f':
sb.append("\\f");
break;
case '\r':
sb.append("\\r");
break;
case '\t':
sb.append("\\t");
break;
case '/':
sb.append("/");
break;
default:
if ((ch >= '\u0000' && ch <= '\u001F') || (ch >= '\u007F' && ch <= '\u009F') || (ch >= '\u2000' && ch <= '\u20FF')) {
String ss = Integer.toHexString(ch);
sb.append("\\u");
for (int k = 0; k < 4 - ss.length(); k++) {
sb.append('0');
}
sb.append(ss.toUpperCase());
} else {
sb.append(ch);
}
}
}
return sb.toString();
}
private static String escape(String text) {
return text.replace("#", "\\#").replace("{", "\\{").replace("}", "\\}");
}
@ -557,11 +511,11 @@ public class CMIChatColor {
}
public static CMIChatColor getRandomColor() {
List<CMIChatColor> ls = new ArrayList<CMIChatColor>();
for (Entry<String, CMIChatColor> one : BY_NAME.entrySet()) {
if (!one.getValue().isColor())
List<CMIChatColor> ls = new ArrayList<>();
for (CMIChatColor one : BY_NAME.values()) {
if (!one.isColor())
continue;
ls.add(one.getValue());
ls.add(one);
}
Collections.shuffle(ls);
return ls.get(0);
@ -599,7 +553,7 @@ public class CMIChatColor {
public static CMIChatColor getByCustomName(String name) {
if (name.equalsIgnoreCase("random")) {
List<CMIChatColor> valuesList = new ArrayList<CMIChatColor>(CUSTOM_BY_NAME.values());
List<CMIChatColor> valuesList = new ArrayList<>(CUSTOM_BY_NAME.values());
int randomIndex = new Random().nextInt(valuesList.size());
return valuesList.get(randomIndex);
}
@ -678,12 +632,12 @@ public class CMIChatColor {
return null;
}
double distance = Double.MAX_VALUE;
for (Entry<String, CMIChatColor> one : CUSTOM_BY_HEX.entrySet()) {
for (CMIChatColor one : CUSTOM_BY_HEX.values()) {
java.awt.Color c1 = new java.awt.Color(
Integer.valueOf(one.getValue().hex.substring(0, 2), 16),
Integer.valueOf(one.getValue().hex.substring(2, 4), 16),
Integer.valueOf(one.getValue().hex.substring(4, 6), 16));
Integer.valueOf(one.hex.substring(0, 2), 16),
Integer.valueOf(one.hex.substring(2, 4), 16),
Integer.valueOf(one.hex.substring(4, 6), 16));
int red1 = c1.getRed();
int red2 = c2.getRed();
@ -693,7 +647,7 @@ public class CMIChatColor {
int b = c1.getBlue() - c2.getBlue();
double dist = Math.sqrt((((512 + rmean) * r * r) >> 8) + 4 * g * g + (((767 - rmean) * b * b) >> 8));
if (dist < distance) {
closest = one.getValue();
closest = one;
distance = dist;
}
}

View File

@ -25,7 +25,6 @@ import com.gamingmesh.jobs.container.JobInfo;
import com.gamingmesh.jobs.container.JobProgression;
import com.gamingmesh.jobs.container.JobsPlayer;
import com.gamingmesh.jobs.container.Title;
import com.gamingmesh.jobs.stuff.Debug;
import com.gamingmesh.jobs.stuff.PageInfo;
import com.gamingmesh.jobs.stuff.Sorting;
import com.gamingmesh.jobs.stuff.Util;

View File

@ -14,7 +14,6 @@ import com.gamingmesh.jobs.container.JobsPlayer;
import com.gamingmesh.jobs.container.Quest;
import com.gamingmesh.jobs.container.QuestProgression;
import com.gamingmesh.jobs.economy.BufferedEconomy;
import com.gamingmesh.jobs.stuff.Debug;
public class skipquest implements Cmd {

View File

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

View File

@ -18,7 +18,9 @@
package com.gamingmesh.jobs.container;
import com.gamingmesh.jobs.stuff.ChatColor;
import org.bukkit.ChatColor;
import com.gamingmesh.jobs.CMILib.CMIChatColor;
/**
* Container class for titles
@ -28,7 +30,7 @@ import com.gamingmesh.jobs.stuff.ChatColor;
public class Title {
private String name = null;
private String shortName = null;
private ChatColor color = ChatColor.WHITE;
private CMIChatColor color = CMIChatColor.WHITE;
private int levelReq = 0;
private String jobName = null;
@ -40,12 +42,24 @@ public class Title {
* @param levelReq - the level requirement of the title
* @param jobName - Job this title is made for
*/
@Deprecated
public Title(String name, String shortName, ChatColor color, int levelReq, String jobName){
this.name = name;
this.color = color;
this.levelReq = levelReq;
this.shortName = shortName;
this.jobName = jobName;
this(jobName, jobName, CMIChatColor.WHITE, levelReq, jobName);
}
/**
* @param name The long name of the title
* @param shortName the short name of the title
* @param color {@link CMIChatColor}
* @param levelReq the level requirement of the title
* @param jobName Job this title is made for
*/
public Title(String name, String shortName, CMIChatColor color, int levelReq, String jobName) {
this.name = name;
this.color = color;
this.levelReq = levelReq;
this.shortName = shortName;
this.jobName = jobName;
}
/**
@ -65,11 +79,11 @@ public class Title {
}
/**
* Function to get the ChatColor of the title
* @return the chat colour o the title
* Returns the color of the title
* @return {@link CMIChatColor}
*/
public ChatColor getChatColor() {
return color;
public CMIChatColor getChatColor() {
return color;
}
/**

View File

@ -12,7 +12,6 @@ import org.bukkit.event.block.BlockPistonExtendEvent;
import org.bukkit.event.block.BlockPistonRetractEvent;
import com.gamingmesh.jobs.Jobs;
import com.gamingmesh.jobs.stuff.Debug;
public class PistonProtectionListener implements Listener {