mirror of
https://github.com/Zrips/Jobs.git
synced 2025-02-08 16:31:37 +01:00
Misc changes
This commit is contained in:
parent
e24dba84a6
commit
1d58e4bd66
@ -29,7 +29,7 @@ public class CMIChatColor {
|
||||
CUSTOM_BY_HEX.put(one.getHex().toLowerCase(), new CMIChatColor(one.toString(), one.getHex()));
|
||||
if (one.getExtra() != null) {
|
||||
for (String extra : one.getExtra()) {
|
||||
CUSTOM_BY_NAME.put(extra.toLowerCase().replace("_", ""), new CMIChatColor(extra.replace(" ", "_"), one.getHex()));
|
||||
CUSTOM_BY_NAME.put(extra.toLowerCase().replace("_", ""), new CMIChatColor(extra.replace(' ', '_'), one.getHex()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -365,7 +365,7 @@ public enum CMIEntityType {
|
||||
return ctype.getName();
|
||||
String name = type.name();
|
||||
|
||||
name = name.toLowerCase().replace("_", " ");
|
||||
name = name.toLowerCase().replace('_', ' ');
|
||||
name = name.substring(0, 1).toUpperCase() + name.substring(1);
|
||||
return name;
|
||||
}
|
||||
|
@ -318,8 +318,7 @@ public class CMIItemStack {
|
||||
|| item.getType().name().contains("TIPPED_ARROW")) {
|
||||
PotionMeta potion = (PotionMeta) item.getItemMeta();
|
||||
try {
|
||||
if (potion != null && potion.getBasePotionData() != null && potion.getBasePotionData().getType() != null
|
||||
&& potion.getBasePotionData().getType().getEffectType() != null) {
|
||||
if (potion != null && potion.getBasePotionData().getType().getEffectType() != null) {
|
||||
data = (short) potion.getBasePotionData().getType().getEffectType().getId();
|
||||
}
|
||||
} catch (NoSuchMethodError e) {
|
||||
@ -360,7 +359,7 @@ public class CMIItemStack {
|
||||
if (potion2 != null && potion2.getBasePotionData() != null) {
|
||||
PotionData base2 = potion2.getBasePotionData();
|
||||
if (base2.getType() != null) {
|
||||
if (base1.getType().equals(base2.getType()) && base1.isExtended() == base2.isExtended() && base1.isUpgraded() == base2.isUpgraded())
|
||||
if (base1.getType() == base2.getType() && base1.isExtended() == base2.isExtended() && base1.isUpgraded() == base2.isUpgraded())
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -413,7 +412,7 @@ public class CMIItemStack {
|
||||
if (getCMIType().isPotion() || getType().name().contains("TIPPED_ARROW")) {
|
||||
PotionMeta potion = (PotionMeta) item.getItemMeta();
|
||||
try {
|
||||
if (potion != null && potion.getBasePotionData() != null && potion.getBasePotionData().getType() != null && potion.getBasePotionData().getType().getEffectType() != null) {
|
||||
if (potion != null && potion.getBasePotionData().getType().getEffectType() != null) {
|
||||
liner += ":" + potion.getBasePotionData().getType().getEffectType().getName() + "-" + potion.getBasePotionData().isUpgraded() + "-" + potion.getBasePotionData().isExtended();
|
||||
}
|
||||
} catch (NoSuchMethodError e) {
|
||||
|
@ -113,7 +113,7 @@ public class RawMessage {
|
||||
StringBuilder options = new StringBuilder();
|
||||
for (CMIChatColor format : one.getFormats()) {
|
||||
if (!options.toString().isEmpty())
|
||||
options.append(",");
|
||||
options.append(',');
|
||||
if (format.equals(CMIChatColor.UNDERLINE))
|
||||
options.append("\"underlined\":true");
|
||||
else if (format.equals(CMIChatColor.BOLD))
|
||||
@ -127,7 +127,7 @@ public class RawMessage {
|
||||
}
|
||||
if (!options.toString().isEmpty()) {
|
||||
finalText.append(options.toString());
|
||||
finalText.append(",");
|
||||
finalText.append(',');
|
||||
}
|
||||
|
||||
if (one.getFont() != null) {
|
||||
|
@ -249,24 +249,16 @@ public class PermissionHandler {
|
||||
}
|
||||
|
||||
public boolean hasWorldPermission(Player player, String world) {
|
||||
if (!player.hasPermission("jobs.use"))
|
||||
return false;
|
||||
|
||||
return player.hasPermission("jobs.world." + world.toLowerCase());
|
||||
return player.hasPermission("jobs.use") && player.hasPermission("jobs.world." + world.toLowerCase());
|
||||
}
|
||||
|
||||
public boolean hasWorldPermission(JobsPlayer player) {
|
||||
if (player.getPlayer() == null)
|
||||
return false;
|
||||
|
||||
return hasWorldPermission(player, player.getPlayer().getWorld().getName());
|
||||
return player.getPlayer() != null && hasWorldPermission(player, player.getPlayer().getWorld().getName());
|
||||
}
|
||||
|
||||
public boolean hasWorldPermission(JobsPlayer player, String world) {
|
||||
if (!Jobs.getPermissionManager().hasPermission(player, "jobs.use"))
|
||||
return false;
|
||||
|
||||
return Jobs.getPermissionManager().hasPermission(player, "jobs.world." + world.toLowerCase());
|
||||
return Jobs.getPermissionManager().hasPermission(player, "jobs.use")
|
||||
&& Jobs.getPermissionManager().hasPermission(player, "jobs.world." + world.toLowerCase());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -139,10 +139,6 @@ public class PermissionManager {
|
||||
jPlayer.setLastPermissionUpdate(System.currentTimeMillis());
|
||||
}
|
||||
|
||||
if (permissions == null) {
|
||||
return 0D;
|
||||
}
|
||||
|
||||
double amount = 0D;
|
||||
|
||||
for (Map.Entry<String, Boolean> permission : permissions.entrySet()) {
|
||||
|
@ -796,7 +796,7 @@ public class PlayerManager {
|
||||
*/
|
||||
public int getMaxJobs(JobsPlayer jPlayer) {
|
||||
if (jPlayer == null) {
|
||||
return 0;
|
||||
return Jobs.getGCManager().getMaxJobs();
|
||||
}
|
||||
|
||||
int max = Jobs.getPermissionManager().getMaxPermission(jPlayer, "jobs.max", false).intValue();
|
||||
|
@ -60,7 +60,7 @@ public class area implements Cmd {
|
||||
return true;
|
||||
}
|
||||
if (wg && HookManager.getWorldGuardManager() != null) {
|
||||
name = HookManager.getWorldGuardManager().getNameByName(name);
|
||||
name = HookManager.getWorldGuardManager().getProtectedRegionByName(name).getId();
|
||||
if (name == null) {
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.area.output.wgDontExist"));
|
||||
return true;
|
||||
|
@ -313,11 +313,6 @@ public class JobsPlayer {
|
||||
max = m1;
|
||||
}
|
||||
|
||||
m1 = Jobs.getPermissionManager().getMaxPermission(this, "jobs.maxquest", false, true, false).intValue();
|
||||
if (m1 != 0 && (m1 > max || m1 < max)) {
|
||||
max = m1;
|
||||
}
|
||||
|
||||
return max;
|
||||
}
|
||||
|
||||
|
@ -4,14 +4,18 @@ import java.util.UUID;
|
||||
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import com.gamingmesh.jobs.hooks.HookPlugin;
|
||||
|
||||
import de.Keyle.MyPet.MyPetApi;
|
||||
import de.Keyle.MyPet.MyPetPlugin;
|
||||
import de.Keyle.MyPet.api.entity.MyPet;
|
||||
import de.Keyle.MyPet.api.entity.MyPetBukkitEntity;
|
||||
import de.Keyle.MyPet.api.player.MyPetPlayer;
|
||||
import de.Keyle.MyPet.api.repository.PlayerManager;
|
||||
|
||||
public class MyPetManager {
|
||||
public class MyPetManager extends HookPlugin {
|
||||
|
||||
private final PlayerManager mp = MyPetApi.getPlayerManager();
|
||||
|
||||
@ -41,4 +45,9 @@ public class MyPetManager {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public MyPetPlugin getPlugin() {
|
||||
return JavaPlugin.getPlugin(MyPetPlugin.class);
|
||||
}
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ package com.gamingmesh.jobs.hooks.WorldGuard;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
@ -11,6 +12,7 @@ import org.bukkit.plugin.Plugin;
|
||||
|
||||
import com.gamingmesh.jobs.Jobs;
|
||||
import com.gamingmesh.jobs.container.RestrictedArea;
|
||||
import com.gamingmesh.jobs.hooks.HookPlugin;
|
||||
import com.sk89q.worldedit.bukkit.BukkitAdapter;
|
||||
import com.sk89q.worldguard.WorldGuard;
|
||||
import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
|
||||
@ -19,19 +21,27 @@ import com.sk89q.worldguard.protection.managers.RegionManager;
|
||||
import com.sk89q.worldguard.protection.regions.ProtectedRegion;
|
||||
import com.sk89q.worldguard.protection.regions.RegionContainer;
|
||||
|
||||
public class WorldGuardManager {
|
||||
public class WorldGuardManager extends HookPlugin {
|
||||
|
||||
private WorldGuardPlugin wg;
|
||||
private boolean useOld = false;
|
||||
|
||||
public WorldGuardManager() {
|
||||
Plugin pl = Bukkit.getPluginManager().getPlugin("WorldGuard");
|
||||
if (pl instanceof WorldGuardPlugin && pl.getDescription().getVersion().equals("6.1")) {
|
||||
if (pl instanceof WorldGuardPlugin) {
|
||||
wg = (WorldGuardPlugin) pl;
|
||||
useOld = true;
|
||||
|
||||
if (pl.getDescription().getVersion().equals("6.1")) {
|
||||
useOld = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public WorldGuardPlugin getPlugin() {
|
||||
return wg;
|
||||
}
|
||||
|
||||
public List<RestrictedArea> getArea(Location loc) {
|
||||
try {
|
||||
if (useOld) {
|
||||
@ -72,7 +82,7 @@ public class WorldGuardManager {
|
||||
return false;
|
||||
}
|
||||
|
||||
public String getNameByName(String name) {
|
||||
public ProtectedRegion getProtectedRegionByName(String name) {
|
||||
for (World one : Bukkit.getWorlds()) {
|
||||
Map<String, ProtectedRegion> regions;
|
||||
if (useOld) {
|
||||
@ -81,12 +91,11 @@ public class WorldGuardManager {
|
||||
RegionContainer container = WorldGuard.getInstance().getPlatform().getRegionContainer();
|
||||
regions = container.get(BukkitAdapter.adapt(one)).getRegions();
|
||||
}
|
||||
for (String oneR : regions.keySet()) {
|
||||
if (oneR.equalsIgnoreCase(name))
|
||||
return oneR;
|
||||
for (Entry<String, ProtectedRegion> map : regions.entrySet()) {
|
||||
if (map.getKey().equalsIgnoreCase(name))
|
||||
return map.getValue();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -2,7 +2,7 @@ name: Jobs
|
||||
description: Jobs Plugin for the BukkitAPI
|
||||
main: com.gamingmesh.jobs.Jobs
|
||||
version: ${project.version}
|
||||
api-version: 1.13
|
||||
api-version: "1.13"
|
||||
website: https://www.spigotmc.org/resources/4216/
|
||||
authors: [phrstbrn, Zrips, montlikadani]
|
||||
softdepend: [Vault, Essentials, MythicMobs, McMMO, mcMMO, WorldGuard, MyPet, PlaceholderAPI]
|
||||
@ -83,6 +83,7 @@ permissions:
|
||||
jobs.command.itembonus: true
|
||||
jobs.command.blockinfo: true
|
||||
jobs.command.skipquest: true
|
||||
jobs.command.schedule: true
|
||||
jobs.command.browse:
|
||||
description: Grants access to the browse command
|
||||
default: true
|
||||
@ -212,6 +213,9 @@ permissions:
|
||||
jobs.command.edititembonus:
|
||||
description: Grants access to the edititembonus command
|
||||
default: op
|
||||
jobs.command.schedule:
|
||||
description: Grants access to the schedule command
|
||||
default: op
|
||||
jobs.area.add:
|
||||
description: Grants access to the area add command
|
||||
default: op
|
||||
|
Loading…
Reference in New Issue
Block a user