mirror of
https://github.com/Zrips/Jobs.git
synced 2024-11-29 14:05:25 +01:00
Merge branch 'master' of https://github.com/Zrips/Jobs.git
This commit is contained in:
commit
800aab1a3b
@ -6,7 +6,6 @@ import java.util.UUID;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.gamingmesh.jobs.Jobs;
|
||||
|
103
src/main/java/com/gamingmesh/jobs/commands/list/level.java
Normal file
103
src/main/java/com/gamingmesh/jobs/commands/list/level.java
Normal file
@ -0,0 +1,103 @@
|
||||
package com.gamingmesh.jobs.commands.list;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.gamingmesh.jobs.Jobs;
|
||||
import com.gamingmesh.jobs.commands.Cmd;
|
||||
import com.gamingmesh.jobs.commands.JobCommand;
|
||||
import com.gamingmesh.jobs.container.Job;
|
||||
import com.gamingmesh.jobs.container.JobProgression;
|
||||
import com.gamingmesh.jobs.container.JobsPlayer;
|
||||
|
||||
public class level implements Cmd {
|
||||
|
||||
private enum Action {
|
||||
Set, Add, Take
|
||||
}
|
||||
|
||||
@Override
|
||||
@JobCommand(1290)
|
||||
public boolean perform(Jobs plugin, CommandSender sender, String[] args) {
|
||||
if (args.length < 4) {
|
||||
Jobs.getCommandManager().sendUsage(sender, "level");
|
||||
return true;
|
||||
}
|
||||
|
||||
Action action = Action.Add;
|
||||
int amount = 0;
|
||||
String playerName = null;
|
||||
Job job = null;
|
||||
|
||||
for (String one : args) {
|
||||
switch (one.toLowerCase()) {
|
||||
case "set":
|
||||
action = Action.Set;
|
||||
continue;
|
||||
case "add":
|
||||
action = Action.Add;
|
||||
continue;
|
||||
case "take":
|
||||
action = Action.Take;
|
||||
continue;
|
||||
}
|
||||
|
||||
try {
|
||||
amount = Integer.parseInt(one);
|
||||
continue;
|
||||
} catch (NumberFormatException e) {
|
||||
}
|
||||
|
||||
if (job == null && Jobs.getJob(one) != null) {
|
||||
job = Jobs.getJob(one);
|
||||
continue;
|
||||
}
|
||||
playerName = one;
|
||||
}
|
||||
|
||||
if (playerName == null)
|
||||
return false;
|
||||
|
||||
JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer(playerName);
|
||||
if (jPlayer == null) {
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.noinfoByPlayer", "%playername%", args[0]));
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!Jobs.hasPermission(jPlayer.getPlayer(), "jobs.command.level", true))
|
||||
return true;
|
||||
|
||||
if (job == null) {
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.job"));
|
||||
return true;
|
||||
}
|
||||
|
||||
try {
|
||||
// check if player already has the job
|
||||
if (jPlayer.isInJob(job)) {
|
||||
JobProgression prog = jPlayer.getJobProgression(job);
|
||||
switch (action) {
|
||||
case Set:
|
||||
prog.setLevel(amount);
|
||||
break;
|
||||
case Add:
|
||||
prog.setLevel(amount);
|
||||
break;
|
||||
case Take:
|
||||
prog.setLevel(amount);
|
||||
break;
|
||||
}
|
||||
|
||||
Player player = jPlayer.getPlayer();
|
||||
if (player != null) {
|
||||
player.sendMessage(Jobs.getLanguage().getMessage("command.level.output.target", "%jobname%", job.getChatColor() + job.getName(), "%level%", prog.getLevel(), "%exp%", prog.getExperience()));
|
||||
}
|
||||
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("general.admin.success"));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("general.admin.error"));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
@ -9,7 +9,6 @@ import com.gamingmesh.jobs.Placeholders.Placeholder.JobsPlaceHolders;
|
||||
import com.gamingmesh.jobs.Placeholders.Placeholder.JobsPlaceholderType;
|
||||
import com.gamingmesh.jobs.commands.Cmd;
|
||||
import com.gamingmesh.jobs.commands.JobCommand;
|
||||
import com.gamingmesh.jobs.stuff.Debug;
|
||||
import com.gamingmesh.jobs.stuff.PageInfo;
|
||||
|
||||
public class placeholders implements Cmd {
|
||||
@ -60,7 +59,7 @@ public class placeholders implements Cmd {
|
||||
if (player != null && !one.isComplex())
|
||||
extra = plugin.getPlaceholderAPIManager().updatePlaceHolders(player, Jobs.getLanguage().getMessage("command.placeholders.output.outputResult",
|
||||
"[result]", Jobs.getInstance().getPlaceholderAPIManager().updatePlaceHolders(player, one.getFull())));
|
||||
|
||||
|
||||
String place = one.getFull();
|
||||
String hover = "";
|
||||
if (plugin.isPlaceholderAPIEnabled()) {
|
||||
|
@ -583,6 +583,11 @@ public class LanguageManager {
|
||||
Jobs.getGCManager().commandArgs.put("exp", Arrays.asList("[playername]", "[jobname]", "set%%add%%take"));
|
||||
c.get("command.exp.output.target", "&eYour exp was changed for %jobname% &eand now you at &6%level%lvl &eand with &6%exp%exp.");
|
||||
|
||||
c.get("command.level.help.info", "Change the player level for job.");
|
||||
c.get("command.level.help.args", "[playername] [jobname] set/add/take [amount]");
|
||||
Jobs.getGCManager().commandArgs.put("level", Arrays.asList("[playername]", "[jobname]", "set%%add%%take"));
|
||||
c.get("command.level.output.target", "&eYour level was changed for %jobname% &eand now you at &6%level%lvl &eand with &6%exp%exp.");
|
||||
|
||||
c.get("command.demote.help.info", "Demote the player X levels in a job.");
|
||||
c.get("command.demote.help.args", "[playername] [jobname] [levels]");
|
||||
Jobs.getGCManager().commandArgs.put("demote", Arrays.asList("[playername]", "[jobname]", "[levels]"));
|
||||
|
@ -198,6 +198,14 @@ command:
|
||||
id: ' &eTárgy ID: &6%itemid%'
|
||||
data: ' &eTárgy adat: &6%itemdata%'
|
||||
usage: ' &eHasználat: &6%first% &evagy &6%second%'
|
||||
placeholders:
|
||||
help:
|
||||
info: 'Listázza az összes helyőrzőt'
|
||||
args: '(parse) (placeholder)'
|
||||
output:
|
||||
list: '&e[place]. &7[placeholder]'
|
||||
outputResult: ' &eeredmény: &7[result]'
|
||||
parse: '&6[placeholder] &b[source]-val/-vel &6eredmény &8|&f[result]&8|'
|
||||
entitylist:
|
||||
help:
|
||||
info: 'Megmutatja, hogy minden lehetséges entitás használható a pluginnal.'
|
||||
@ -522,7 +530,13 @@ command:
|
||||
info: 'Módosítsa a játékos tapasztalat feladatát.'
|
||||
args: '[playername] [jobname] set/add/take [amount]'
|
||||
output:
|
||||
target: '&eA tapasztalat változott %jobname%&e, most van &6%level%lvl &eés &6%exp%&eexp.'
|
||||
target: '&eA tapasztalat megváltozott a(z) %jobname%&e munkában, most van &6%level%lvl &eés &6%exp%&eexp.'
|
||||
level:
|
||||
help:
|
||||
info: 'Módosítsa a játékos szint feladatát.'
|
||||
args: '[playername] [jobname] set/add/take [amount]'
|
||||
output:
|
||||
target: '&eA szint megváltozott a(z) %jobname%&e munkában, most van &6%level%lvl &eés &6%exp%&eexp.'
|
||||
demote:
|
||||
help:
|
||||
info: 'Eldobja a játékos X szintjét a munkában.'
|
||||
|
@ -67,6 +67,7 @@ permissions:
|
||||
jobs.command.signupdate: true
|
||||
jobs.command.moneyboost: true
|
||||
jobs.command.exp: true
|
||||
jobs.command.level: true
|
||||
jobs.command.clearownership: true
|
||||
jobs.command.expboost: true
|
||||
jobs.command.iteminfo: true
|
||||
@ -185,6 +186,9 @@ permissions:
|
||||
jobs.command.exp:
|
||||
description: Grants access to the exp command
|
||||
default: op
|
||||
jobs.command.level:
|
||||
description: Grants access to the level command
|
||||
default: op
|
||||
jobs.command.quests:
|
||||
description: Grants access to the quests command
|
||||
default: true
|
||||
|
Loading…
Reference in New Issue
Block a user