mirror of
https://github.com/DieReicheErethons/Brewery.git
synced 2024-11-22 11:35:16 +01:00
Show Effects on Potion, Changed Lore
This commit is contained in:
parent
ac9975fce9
commit
a347a16c06
14
config.yml
14
config.yml
@ -15,7 +15,7 @@ enableHome: true
|
||||
homeType: 'cmd: home'
|
||||
|
||||
# Ob der Spieler nach etwas kürzerem Ausloggen an einem zufälligen Ort "aufwacht" (diese müssen durch '/br Wakeup add' von einem Admin festgelegt werden)
|
||||
# Der Spieler wacht nur an einem Ort auf, der sich in seiner jetzigen Welt befindet.
|
||||
# Der Spieler wacht an dem nähesten zweier zufälliger Orte aus seiner Welt auf.
|
||||
enableWake: true
|
||||
|
||||
# Der Text, den der Spieler beim Aufwachen sieht
|
||||
@ -34,7 +34,7 @@ enablePuke: true
|
||||
# Item das beim Erbrechen mehrfach unaufsammelbar fallen gelassen wird
|
||||
pukeItem: SOUL_SAND
|
||||
|
||||
# Konsumierbares Item/<Stärke>. Senkt den Alkoholpegel um <Stärke>% wenn konsumiert.
|
||||
# Konsumierbares Item/Stärke. Senkt den Alkoholpegel um <Stärke> wenn konsumiert.
|
||||
drainItems:
|
||||
- BREAD/4
|
||||
- MILK_BUCKET/2
|
||||
@ -54,7 +54,8 @@ autosave: 3
|
||||
# color: Farbe des Getränks nach destillieren/reifen. DARK_RED, RED, BRIGHT_RED, ORANGE, PINK, BLUE, CYAN, WATER, GREEN, BLACK, GREY, BRIGHT_GREY
|
||||
# difficulty: 1-10 Genauigkeit der Einhaltung der Vorgaben (1 = ungenau/einfach 10 = sehr genau/schwer)
|
||||
# alcohol: Alkoholgehalt 0-100 in absoluter Menge bei perfektem Getränk (wird dem Spieler hinzugefügt, bei 100 = tot)
|
||||
# effect: Auflistung Effekt/Dauer Besonderere Trank-Effekte beim Trinken, Dauer in sek. Siehe: http://jd.bukkit.org/rb/apidocs/org/bukkit/potion/PotionEffectType.html
|
||||
# effects: Auflistung Effekt/Dauer Besonderere Trank-Effekte beim Trinken, Dauer in sek. Ein 'X' an den Namen anhängen, um ihn zu verbergen. Bsp: POISONX/10
|
||||
# (WEAKNESS, INCREASE_DAMAGE, SLOW und SPEED sind immer verborgen.) Mögliche Effekte: http://jd.bukkit.org/rb/apidocs/org/bukkit/potion/PotionEffectType.html
|
||||
|
||||
recipes:
|
||||
1:
|
||||
@ -114,7 +115,7 @@ recipes:
|
||||
difficulty: 4
|
||||
alcohol: 12
|
||||
effects:
|
||||
- WATER_BREATHING/150
|
||||
- WATER_BREATHINGX/150
|
||||
6:
|
||||
name: Bitterer Rum/Würziger Rum/Goldener Rum
|
||||
ingredients:
|
||||
@ -128,8 +129,6 @@ recipes:
|
||||
alcohol: 30
|
||||
effects:
|
||||
- FIRE_RESISTANCE/100
|
||||
- WEAKNESS/30
|
||||
- POISON/20
|
||||
7:
|
||||
name: Abgeranzter Vodka/Vodka/Russischer Vodka
|
||||
ingredients:
|
||||
@ -142,6 +141,7 @@ recipes:
|
||||
alcohol: 20
|
||||
effects:
|
||||
- WEAKNESS/15
|
||||
- POISON/10
|
||||
8:
|
||||
name: minderwertiger Absinth/Absinth/Starker Absinth
|
||||
ingredients:
|
||||
@ -152,7 +152,7 @@ recipes:
|
||||
difficulty: 8
|
||||
alcohol: 45
|
||||
effects:
|
||||
- POISON/10
|
||||
- POISON/20
|
||||
9:
|
||||
name: Kartoffelsuppe
|
||||
ingredients:
|
||||
|
@ -26,12 +26,22 @@ public class BIngredients {
|
||||
public BIngredients() {
|
||||
}
|
||||
|
||||
// Init a copy of BIngredients with existing values
|
||||
// Load from File
|
||||
public BIngredients(Map<Material, Integer> ingredients, int cookedTime) {
|
||||
this.ingredients.putAll(ingredients);
|
||||
this.ingredients = ingredients;
|
||||
this.cookedTime = cookedTime;
|
||||
}
|
||||
|
||||
//returns the recipe with the given name
|
||||
public static BRecipe getRecipeByName(String name) {
|
||||
for (BRecipe recipe : recipes) {
|
||||
if (recipe.getName(5).equalsIgnoreCase(name)) {
|
||||
return recipe;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
// Add an ingredient to this
|
||||
public void add(Material ingredient) {
|
||||
if (ingredients.containsKey(ingredient)) {
|
||||
@ -56,19 +66,20 @@ public class BIngredients {
|
||||
int uid = Brew.generateUID();
|
||||
|
||||
if (cookRecipe != null) {
|
||||
// Potion is best with cooking only, can still be destilled, etc.
|
||||
// Potion is best with cooking only
|
||||
int quality = (int) Math.round((getIngredientQuality(cookRecipe) + getCookingQuality(cookRecipe, false)) / 2.0);
|
||||
P.p.log("cooked potion has Quality: " + quality);
|
||||
new Brew(uid, quality, cookRecipe, new BIngredients(ingredients, cookedTime));
|
||||
Brew brew = new Brew(uid, quality, cookRecipe, clone());
|
||||
Brew.addOrReplaceEffects(potionMeta, brew.getEffects());
|
||||
|
||||
cookedName = cookRecipe.getName(quality);
|
||||
potion.setDurability(Brew.PotionColor.valueOf(cookRecipe.getColor()).getColorId(true));
|
||||
potion.setDurability(Brew.PotionColor.valueOf(cookRecipe.getColor()).getColorId(false));
|
||||
|
||||
} else {
|
||||
// new base potion
|
||||
new Brew(uid, new BIngredients(ingredients, cookedTime));
|
||||
new Brew(uid, clone());
|
||||
|
||||
if (state == 1) {
|
||||
if (state <= 1) {
|
||||
cookedName = "Schlammiger Sud";
|
||||
potion.setDurability(Brew.PotionColor.BLUE.getColorId(false));
|
||||
} else {
|
||||
@ -89,7 +100,7 @@ public class BIngredients {
|
||||
potion.setDurability(Brew.PotionColor.CYAN.getColorId(true));
|
||||
}
|
||||
|
||||
potionMeta.setDisplayName(P.p.white() + cookedName);
|
||||
potionMeta.setDisplayName(P.p.color("&f" + cookedName));
|
||||
// This effect stores the UID in its Duration
|
||||
potionMeta.addCustomEffect((PotionEffectType.REGENERATION).createEffect((uid * 4), 0), true);
|
||||
potion.setItemMeta(potionMeta);
|
||||
@ -106,14 +117,19 @@ public class BIngredients {
|
||||
return count;
|
||||
}
|
||||
|
||||
//returns the recipe with the given name
|
||||
public static BRecipe getRecipeByName(String name) {
|
||||
for (BRecipe recipe : recipes) {
|
||||
if (recipe.getName(5).equalsIgnoreCase(name)) {
|
||||
return recipe;
|
||||
public void qualityLore(PotionMeta meta, BRecipe recipe, boolean distilled) {
|
||||
// Ingredients
|
||||
String prefix = Brew.getQualityColor(getIngredientQuality(recipe));
|
||||
String lore = "Zutaten";
|
||||
Brew.addOrReplaceLore(meta, prefix, lore);
|
||||
|
||||
// Cookingtime
|
||||
prefix = Brew.getQualityColor(getCookingQuality(recipe, distilled)) + cookedTime + " minute";
|
||||
if (cookedTime > 1) {
|
||||
prefix = prefix + "n";
|
||||
}
|
||||
}
|
||||
return null;
|
||||
lore = " gegärt";
|
||||
Brew.addOrReplaceLore(meta, prefix, lore);
|
||||
}
|
||||
|
||||
// best recipe for current state of potion, STILL not always returns the
|
||||
@ -250,6 +266,14 @@ public class BIngredients {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// returns pseudo quality of distilling. 0 if doesnt match the need of the recipes distilling
|
||||
public int getDistillQuality(BRecipe recipe, int distillRuns) {
|
||||
if (recipe.needsDistilling() != distillRuns > 0) {
|
||||
return 0;
|
||||
}
|
||||
return 10 - Math.abs(recipe.getDistillRuns() - distillRuns);
|
||||
}
|
||||
|
||||
// returns the quality regarding the barrel wood conditioning given Recipe
|
||||
public int getWoodQuality(BRecipe recipe, byte wood) {
|
||||
if (recipe.getWood() == 0x8) {
|
||||
@ -274,6 +298,14 @@ public class BIngredients {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Creates a copy ingredients
|
||||
public BIngredients clone() {
|
||||
BIngredients copy = new BIngredients();
|
||||
copy.ingredients.putAll(ingredients);
|
||||
copy.cookedTime = cookedTime;
|
||||
return copy;
|
||||
}
|
||||
|
||||
// saves data into ingredient section of Brew/BCauldron
|
||||
public void save(ConfigurationSection config) {
|
||||
if (cookedTime != 0) {
|
||||
|
@ -382,7 +382,7 @@ public class BPlayer {
|
||||
Map<String, Integer> effects = brew.getEffects();
|
||||
if (effects != null) {
|
||||
for (Map.Entry<String, Integer> entry : effects.entrySet()) {
|
||||
PotionEffectType type = PotionEffectType.getByName(entry.getKey());
|
||||
PotionEffectType type = PotionEffectType.getByName(entry.getKey().replace("X", ""));
|
||||
if (type != null) {
|
||||
int duration = (entry.getValue() / 8) * brew.getQuality() * 20;
|
||||
int amplifier = brew.getQuality() / 3;
|
||||
|
@ -46,10 +46,15 @@ public class BRecipe {
|
||||
if (effectStringList != null) {
|
||||
for (String effectString : effectStringList) {
|
||||
String[] effectSplit = effectString.split("/");
|
||||
String effect = effectSplit[0];
|
||||
if (effect.equalsIgnoreCase("WEAKNESS") || effect.equalsIgnoreCase("INCREASE_DAMAGE") || effect.equalsIgnoreCase("SLOW") || effect.equalsIgnoreCase("SPEED") || effect.equalsIgnoreCase("REGERATION")) {
|
||||
// hide these effects as they put crap into lore
|
||||
effect = effect + "X";
|
||||
}
|
||||
if (effectSplit.length > 1) {
|
||||
effects.put(effectSplit[0], P.p.parseInt(effectSplit[1]));
|
||||
effects.put(effect, P.p.parseInt(effectSplit[1]));
|
||||
} else {
|
||||
effects.put(effectSplit[0], 20);
|
||||
effects.put(effect, 20);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -181,18 +181,23 @@ public class Brew {
|
||||
BRecipe recipe = brew.ingredients.getdistillRecipe();
|
||||
|
||||
if (recipe != null) {
|
||||
// distillRuns will have an effect on the amount of alcohol, not the quality
|
||||
brew.quality = brew.calcQuality(recipe, (byte) 0, true);
|
||||
brew.distillRuns += 1;
|
||||
// distillRuns will have an effect on the amount of alcohol, not the quality
|
||||
if (brew.distillRuns > 1) {
|
||||
List<String> lore = new ArrayList<String>();
|
||||
lore.add(brew.distillRuns + " fach Destilliert");
|
||||
potionMeta.setLore(lore);
|
||||
}
|
||||
brew.currentRecipe = recipe;
|
||||
|
||||
// Distill Lore
|
||||
String lore = "destilliert";
|
||||
String prefix = P.p.color("&7");
|
||||
if (brew.distillRuns > 1) {
|
||||
prefix = prefix + brew.distillRuns + "-fach ";
|
||||
}
|
||||
addOrReplaceLore(potionMeta, prefix, lore);
|
||||
addOrReplaceEffects(potionMeta, brew.getEffects());
|
||||
|
||||
P.p.log("destilled " + recipe.getName(5) + " has Quality: " + brew.quality + ", alc: " + brew.calcAlcohol());
|
||||
|
||||
potionMeta.setDisplayName(P.p.white() + recipe.getName(brew.quality));
|
||||
potionMeta.setDisplayName(P.p.color("&f" + recipe.getName(brew.quality)));
|
||||
|
||||
// if the potion should be further distillable
|
||||
if (recipe.getDistillRuns() > 1 && brew.distillRuns <= 5) {
|
||||
@ -201,7 +206,7 @@ public class Brew {
|
||||
slotItem.setDurability(PotionColor.valueOf(recipe.getColor()).getColorId(false));
|
||||
}
|
||||
} else {
|
||||
potionMeta.setDisplayName(P.p.white() + "Undefinierbares Destillat");
|
||||
potionMeta.setDisplayName(P.p.color("&f" + "Undefinierbares Destillat"));
|
||||
slotItem.setDurability(PotionColor.GREY.getColorId(brew.distillRuns <= 5));
|
||||
}
|
||||
|
||||
@ -219,51 +224,89 @@ public class Brew {
|
||||
if (brew.ageTime > 0.5) {
|
||||
BRecipe recipe = brew.ingredients.getAgeRecipe(wood, brew.ageTime, brew.distillRuns > 0);
|
||||
if (recipe != null) {
|
||||
//if (!recipe.needsDistilling() || brew.distillRuns > 0) {
|
||||
|
||||
brew.quality = brew.calcQuality(recipe, wood, brew.distillRuns > 0);
|
||||
brew.currentRecipe = recipe;
|
||||
P.p.log("Final " + recipe.getName(5) + " has Quality: " + brew.quality);
|
||||
|
||||
if (brew.ageTime >= 2) {
|
||||
List<String> lore;
|
||||
String newLore;
|
||||
int index = 0;
|
||||
|
||||
if (brew.ageTime < 201) {
|
||||
newLore = (int) Math.floor(brew.ageTime) + " Jahre Fassgereift";
|
||||
if (brew.ageTime >= 1) {
|
||||
String lore = " Fassgereift";
|
||||
String prefix = P.p.color("&7");
|
||||
if (brew.ageTime == 1) {
|
||||
prefix = prefix + "Ein Jahr";
|
||||
} else if (brew.ageTime < 201) {
|
||||
prefix = prefix + (int) Math.floor(brew.ageTime) + " Jahre";
|
||||
} else {
|
||||
newLore = "Hunderte Jahre Fassgereift";
|
||||
prefix = prefix + "Hunderte Jahre";
|
||||
}
|
||||
addOrReplaceLore(potionMeta, prefix, lore);
|
||||
addOrReplaceEffects(potionMeta, brew.getEffects());
|
||||
}
|
||||
|
||||
if (potionMeta.hasLore()) {
|
||||
lore = potionMeta.getLore();
|
||||
while (index < lore.size()) {
|
||||
String existingLore = lore.get(index);
|
||||
if (existingLore.contains("Jahre Fassgereift")) {
|
||||
lore.set(index, newLore);
|
||||
break;
|
||||
}
|
||||
index++;
|
||||
}
|
||||
} else {
|
||||
lore = new ArrayList<String>();
|
||||
lore.add(newLore);
|
||||
}
|
||||
potionMeta.setLore(lore);
|
||||
}
|
||||
|
||||
potionMeta.setDisplayName(P.p.white() + recipe.getName(brew.quality));
|
||||
potionMeta.setDisplayName(P.p.color("&f" + recipe.getName(brew.quality)));
|
||||
item.setDurability(PotionColor.valueOf(recipe.getColor()).getColorId(false));
|
||||
item.setItemMeta(potionMeta);
|
||||
//}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public PotionMeta addQualityLore(PotionMeta meta, String prefix, String lore) {
|
||||
return null;
|
||||
public static void addOrReplaceEffects(PotionMeta meta, Map<String, Integer> effects) {
|
||||
if (effects != null) {
|
||||
for (Map.Entry<String, Integer> entry : effects.entrySet()) {
|
||||
if (!entry.getKey().endsWith("X")) {
|
||||
PotionEffectType type = PotionEffectType.getByName(entry.getKey());
|
||||
if (type != null) {
|
||||
meta.addCustomEffect(type.createEffect(0, 0), true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public static void addOrReplaceLore(PotionMeta meta, String prefix, String lore) {
|
||||
if (meta.hasLore()) {
|
||||
List<String> existingLore = meta.getLore();
|
||||
int index = indexOfSubstring(existingLore, lore);
|
||||
if (index > -1) {
|
||||
existingLore.set(index, prefix + lore);
|
||||
} else {
|
||||
existingLore.add(prefix + lore);
|
||||
}
|
||||
meta.setLore(existingLore);
|
||||
return;
|
||||
}
|
||||
List<String> newLore = new ArrayList<String>();
|
||||
newLore.add("");
|
||||
newLore.add(prefix + lore);
|
||||
meta.setLore(newLore);
|
||||
}
|
||||
|
||||
public static int indexOfSubstring(List<String> list, String substring) {
|
||||
for (int index = 0; index < list.size(); index++) {
|
||||
String string = list.get(index);
|
||||
if (string.contains(substring)) {
|
||||
return index;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
// gets the Color that represents a quality in Lore
|
||||
public static String getQualityColor(int quality) {
|
||||
String color;
|
||||
if (quality > 8) {
|
||||
color = "&a";
|
||||
} else if (quality > 6) {
|
||||
color = "&e";
|
||||
} else if (quality > 4) {
|
||||
color = "&6";
|
||||
} else if (quality > 2) {
|
||||
color = "&c";
|
||||
} else {
|
||||
color = "&4";
|
||||
}
|
||||
return P.p.color(color);
|
||||
}
|
||||
|
||||
// Saves all data
|
||||
|
@ -108,7 +108,7 @@ public class P extends JavaPlugin {
|
||||
}
|
||||
|
||||
public void msg(CommandSender sender, String msg) {
|
||||
sender.sendMessage(ChatColor.DARK_GREEN + "[Brewery] " + ChatColor.WHITE + msg);
|
||||
sender.sendMessage(color("&2[Brewery] &f" + msg));
|
||||
}
|
||||
|
||||
public void log(String msg) {
|
||||
@ -459,21 +459,46 @@ public class P extends JavaPlugin {
|
||||
page = 1;
|
||||
}
|
||||
|
||||
sender.sendMessage(ChatColor.GRAY + "-------------- " + ChatColor.WHITE + "Seite " + ChatColor.GOLD + page + ChatColor.WHITE + "/" + ChatColor.GOLD + pages + ChatColor.GRAY + " --------------");
|
||||
sender.sendMessage(color("&7-------------- &fSeite &6" + page + "&f/&6" + pages + " &7--------------"));
|
||||
|
||||
ListIterator<String> iter = strings.listIterator((page - 1) * 7);
|
||||
|
||||
for (int i = 0; i < 7; i++) {
|
||||
if (iter.hasNext()) {
|
||||
sender.sendMessage(iter.next());
|
||||
sender.sendMessage(color(iter.next()));
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public String white() {
|
||||
return ChatColor.WHITE.toString();
|
||||
public String color(String msg) {
|
||||
if (msg != null) {
|
||||
msg = msg.replace("&0", ChatColor.getByChar("0").toString());
|
||||
msg = msg.replace("&1", ChatColor.getByChar("1").toString());
|
||||
msg = msg.replace("&2", ChatColor.getByChar("2").toString());
|
||||
msg = msg.replace("&3", ChatColor.getByChar("3").toString());
|
||||
msg = msg.replace("&4", ChatColor.getByChar("4").toString());
|
||||
msg = msg.replace("&5", ChatColor.getByChar("5").toString());
|
||||
msg = msg.replace("&6", ChatColor.getByChar("6").toString());
|
||||
msg = msg.replace("&7", ChatColor.getByChar("7").toString());
|
||||
msg = msg.replace("&8", ChatColor.getByChar("8").toString());
|
||||
msg = msg.replace("&9", ChatColor.getByChar("9").toString());
|
||||
msg = msg.replace("&a", ChatColor.getByChar("a").toString());
|
||||
msg = msg.replace("&b", ChatColor.getByChar("b").toString());
|
||||
msg = msg.replace("&c", ChatColor.getByChar("c").toString());
|
||||
msg = msg.replace("&d", ChatColor.getByChar("d").toString());
|
||||
msg = msg.replace("&e", ChatColor.getByChar("e").toString());
|
||||
msg = msg.replace("&f", ChatColor.getByChar("f").toString());
|
||||
msg = msg.replace("&k", ChatColor.getByChar("k").toString());
|
||||
msg = msg.replace("&l", ChatColor.getByChar("l").toString());
|
||||
msg = msg.replace("&m", ChatColor.getByChar("m").toString());
|
||||
msg = msg.replace("&n", ChatColor.getByChar("n").toString());
|
||||
msg = msg.replace("&o", ChatColor.getByChar("o").toString());
|
||||
msg = msg.replace("&r", ChatColor.getByChar("r").toString());
|
||||
}
|
||||
|
||||
return msg;
|
||||
}
|
||||
|
||||
|
||||
|
@ -5,7 +5,6 @@ import java.util.Iterator;
|
||||
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@ -13,10 +12,10 @@ public class Wakeup {
|
||||
|
||||
public static ArrayList<Wakeup> wakeups = new ArrayList<Wakeup>();
|
||||
public static P p = P.p;
|
||||
public static ChatColor g = ChatColor.GOLD;
|
||||
public static ChatColor w = ChatColor.WHITE;
|
||||
public static ChatColor r = ChatColor.RED;
|
||||
public static ChatColor gr = ChatColor.GREEN;
|
||||
//public static ChatColor g = ChatColor.GOLD;
|
||||
//public static ChatColor w = ChatColor.WHITE;
|
||||
//public static ChatColor r = ChatColor.RED;
|
||||
//public static ChatColor gr = ChatColor.GREEN;
|
||||
public static int checkId = -1;
|
||||
public static Player checkPlayer = null;
|
||||
|
||||
@ -51,7 +50,7 @@ public class Wakeup {
|
||||
worldWakes.remove(w1);
|
||||
|
||||
while (!w1.check()) {
|
||||
p.errorLog("Please Check Wakeup-Location with id: " + g + wakeups.indexOf(w1));
|
||||
p.errorLog("Please Check Wakeup-Location with id: &6" + wakeups.indexOf(w1));
|
||||
|
||||
w1 = calcRandom(worldWakes);
|
||||
if (w1 == null) {
|
||||
@ -65,7 +64,7 @@ public class Wakeup {
|
||||
worldWakes.remove(w2);
|
||||
|
||||
while (!w2.check()) {
|
||||
p.errorLog("Please Check Wakeup-Location with id: " + g + wakeups.indexOf(w2));
|
||||
p.errorLog("Please Check Wakeup-Location with id: &6" + wakeups.indexOf(w2));
|
||||
|
||||
w2 = calcRandom(worldWakes);
|
||||
if (w2 == null) {
|
||||
@ -94,16 +93,16 @@ public class Wakeup {
|
||||
|
||||
Player player = (Player) sender;
|
||||
wakeups.add(new Wakeup(player.getLocation()));
|
||||
p.msg(sender, gr + "Aufwachpunkt mit id: " + g + (wakeups.size() - 1) + gr + " wurde erfolgreich erstellt!");
|
||||
p.msg(sender, "&aAufwachpunkt mit id: &6" + (wakeups.size() - 1) + " &awurde erfolgreich erstellt!");
|
||||
|
||||
} else {
|
||||
p.msg(sender, r + "Dieser Befehl kann nur als Spieler ausgeführt werden");
|
||||
p.msg(sender, "&cDieser Befehl kann nur als Spieler ausgeführt werden");
|
||||
}
|
||||
}
|
||||
|
||||
public static void remove(CommandSender sender, int id) {
|
||||
if (wakeups.isEmpty() || id < 0 || id >= wakeups.size()) {
|
||||
p.msg(sender, r +"Der Aufwachpunkt mit der id: " + g + id + r + " existiert nicht!");
|
||||
p.msg(sender, "&cDer Aufwachpunkt mit der id: &6" + id + " &cexistiert nicht!");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -111,16 +110,16 @@ public class Wakeup {
|
||||
|
||||
if (wakeup.active) {
|
||||
wakeup.active = false;
|
||||
p.msg(sender, gr + "Der Aufwachpunkt mit der id: " + g + id + gr + " wurde erfolgreich gelöscht!");
|
||||
p.msg(sender, "&aDer Aufwachpunkt mit der id: &6" + id + " &awurde erfolgreich gelöscht!");
|
||||
|
||||
} else {
|
||||
p.msg(sender, r + "Der Aufwachpunkt mit der id: " + g + id + r + " wurde bereits gelöscht!");
|
||||
p.msg(sender, "&cDer Aufwachpunkt mit der id: &6" + id + " &cwurde bereits gelöscht!");
|
||||
}
|
||||
}
|
||||
|
||||
public static void list(CommandSender sender, int page, String worldOnly) {
|
||||
if (wakeups.isEmpty()) {
|
||||
p.msg(sender, r + "Es wurden noch keine Aufwachpunkte erstellt!");
|
||||
p.msg(sender, "&cEs wurden noch keine Aufwachpunkte erstellt!");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -129,7 +128,7 @@ public class Wakeup {
|
||||
|
||||
Wakeup wakeup = wakeups.get(id);
|
||||
|
||||
String s = ChatColor.STRIKETHROUGH.toString();
|
||||
String s = "&m";
|
||||
if (wakeup.active) {
|
||||
s = "";
|
||||
}
|
||||
@ -141,7 +140,7 @@ public class Wakeup {
|
||||
int y = (int) wakeup.loc.getY();
|
||||
int z = (int) wakeup.loc.getZ();
|
||||
|
||||
locs.add(g + s + id + w + s + ": " + world + " " + x + "," + y + "," + z);
|
||||
locs.add("&6" + s + id + "&f" + s + ": " + world + " " + x + "," + y + "," + z);
|
||||
}
|
||||
}
|
||||
p.list(sender, locs, page);
|
||||
@ -153,7 +152,7 @@ public class Wakeup {
|
||||
|
||||
if (!all) {
|
||||
if (wakeups.isEmpty() || id >= wakeups.size()) {
|
||||
p.msg(sender, r + "Der Aufwachpunkt mit der id: " + g + id + r + " existiert nicht!");
|
||||
p.msg(sender, "&cDer Aufwachpunkt mit der id: &6" + id + "&c existiert nicht!");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -165,12 +164,12 @@ public class Wakeup {
|
||||
int x = (int) wakeup.loc.getX();
|
||||
int y = (int) wakeup.loc.getY();
|
||||
int z = (int) wakeup.loc.getZ();
|
||||
p.msg(sender, r + "Der Aufwachpunkt mit der id: " + g + id + r + " An Position " + g + world + " " + x + "," + y + "," + z + r + " ist mit Blöcken gefüllt!");
|
||||
p.msg(sender, "&cDer Aufwachpunkt mit der id: &6" + id + "&c An Position &6" + world + " " + x + "," + y + "," + z + "&c ist mit Blöcken gefüllt!");
|
||||
}
|
||||
|
||||
} else {
|
||||
if (wakeups.isEmpty()) {
|
||||
p.msg(sender, r + "Es wurden noch keine Aufwachpunkte erstellt!");
|
||||
p.msg(sender, "&cEs wurden noch keine Aufwachpunkte erstellt!");
|
||||
return;
|
||||
}
|
||||
if (checkPlayer != null && checkPlayer != player) {
|
||||
@ -182,7 +181,7 @@ public class Wakeup {
|
||||
|
||||
|
||||
} else {
|
||||
p.msg(sender, r + "Dieser Befehl kann nur als Spieler ausgeführt werden");
|
||||
p.msg(sender, "&cDieser Befehl kann nur als Spieler ausgeführt werden");
|
||||
}
|
||||
}
|
||||
|
||||
@ -193,7 +192,7 @@ public class Wakeup {
|
||||
public static void tpNext() {
|
||||
checkId++;
|
||||
if (checkId >= wakeups.size()) {
|
||||
p.msg(checkPlayer, gr + "Dies war der letzte Aufwachpunkt");
|
||||
p.msg(checkPlayer, "&aDies war der letzte Aufwachpunkt");
|
||||
checkId = -1;
|
||||
checkPlayer = null;
|
||||
return;
|
||||
@ -211,23 +210,23 @@ public class Wakeup {
|
||||
int z = (int) wakeup.loc.getZ();
|
||||
|
||||
if (wakeup.check()) {
|
||||
p.msg(checkPlayer, "Teleport zu Aufwachpunkt mit der id: " + g + checkId + w + " An Position: " + g + world + " " + x + "," + y + "," + z);
|
||||
p.msg(checkPlayer, "Teleport zu Aufwachpunkt mit der id: &6" + checkId + "&f An Position: &6" + world + " " + x + "," + y + "," + z);
|
||||
checkPlayer.teleport(wakeup.loc);
|
||||
} else {
|
||||
p.msg(checkPlayer, r + "Der Aufwachpunkt mit der id: " + g + checkId + r + " An Position " + g + world + " " + x + "," + y + "," + z + r + " ist mit Blöcken gefüllt!");
|
||||
p.msg(checkPlayer, "&cDer Aufwachpunkt mit der id: &6" + checkId + "&c An Position &6" + world + " " + x + "," + y + "," + z + "&c ist mit Blöcken gefüllt!");
|
||||
}
|
||||
p.msg(checkPlayer, "Zum nächsten Aufwachpunkt: Mit Faust in die Luft schlagen");
|
||||
p.msg(checkPlayer, "Zum Abbrechen: " + ChatColor.BLUE + "/br Wakeup Cancel");
|
||||
p.msg(checkPlayer, "Zum Abbrechen: &9/br Wakeup Cancel");
|
||||
}
|
||||
|
||||
public static void cancel(CommandSender sender) {
|
||||
if (checkPlayer != null) {
|
||||
checkPlayer = null;
|
||||
checkId = -1;
|
||||
p.msg(sender, g + "Aufwachpunkte-Check wurde abgebrochen");
|
||||
p.msg(sender, "&6Aufwachpunkte-Check wurde abgebrochen");
|
||||
return;
|
||||
}
|
||||
p.msg(sender, r + "Es läuft kein Aufwachpunkte-Check");
|
||||
p.msg(sender, "&cEs läuft kein Aufwachpunkte-Check");
|
||||
}
|
||||
|
||||
|
||||
|
@ -5,7 +5,6 @@ import java.util.ArrayList;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.dre.brewery.P;
|
||||
@ -15,10 +14,6 @@ import com.dre.brewery.BPlayer;
|
||||
public class CommandListener implements CommandExecutor {
|
||||
|
||||
public P p = P.p;
|
||||
public ChatColor g = ChatColor.GOLD;
|
||||
public ChatColor b = ChatColor.BLUE;
|
||||
public ChatColor r = ChatColor.RED;
|
||||
public ChatColor gr = ChatColor.GREEN;
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
@ -36,9 +31,9 @@ public class CommandListener implements CommandExecutor {
|
||||
|
||||
if (p.permission.has(sender, "brewery.cmd.reload")) {
|
||||
p.reload();
|
||||
p.msg(sender, gr + "Config wurde neu eingelesen");
|
||||
p.msg(sender, "&aConfig wurde neu eingelesen");
|
||||
} else {
|
||||
p.msg(sender, r + "Du hast keine Rechte dies zu tun!");
|
||||
p.msg(sender, "&cDu hast keine Rechte dies zu tun!");
|
||||
}
|
||||
|
||||
} else if (cmd.equalsIgnoreCase("wakeup")) {
|
||||
@ -46,7 +41,7 @@ public class CommandListener implements CommandExecutor {
|
||||
if (p.permission.has(sender, "brewery.cmd.wakeup")) {
|
||||
cmdWakeup(sender, args);
|
||||
} else {
|
||||
p.msg(sender, r + "Du hast keine Rechte dies zu tun!");
|
||||
p.msg(sender, "&cDu hast keine Rechte dies zu tun!");
|
||||
}
|
||||
|
||||
} else if (cmd.equalsIgnoreCase("create")) {
|
||||
@ -59,13 +54,13 @@ public class CommandListener implements CommandExecutor {
|
||||
if (p.permission.has(sender, "brewery.cmd.infoOther")) {
|
||||
cmdInfo(sender, args[1]);
|
||||
} else {
|
||||
p.msg(sender, r + "Du hast keine Rechte dies zu tun!");
|
||||
p.msg(sender, "&cDu hast keine Rechte dies zu tun!");
|
||||
}
|
||||
} else {
|
||||
if (p.permission.has(sender, "brewery.cmd.info")) {
|
||||
cmdInfo(sender, null);
|
||||
} else {
|
||||
p.msg(sender, r + "Du hast keine Rechte dies zu tun!");
|
||||
p.msg(sender, "&cDu hast keine Rechte dies zu tun!");
|
||||
}
|
||||
}
|
||||
|
||||
@ -81,14 +76,14 @@ public class CommandListener implements CommandExecutor {
|
||||
if (p.permission.has(sender, "brewery.cmd.player")) {
|
||||
cmdPlayer(sender, args);
|
||||
} else {
|
||||
p.msg(sender, r + "Du hast keine Rechte dies zu tun!");
|
||||
p.msg(sender, "&cDu hast keine Rechte dies zu tun!");
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
p.msg(sender, "Unbekannter Befehl.");
|
||||
p.msg(sender, "benutze " + g + "/br help " + ChatColor.WHITE + "um die Hilfe anzuzeigen");
|
||||
p.msg(sender, "benutze &6/br help &fum die Hilfe anzuzeigen");
|
||||
|
||||
}
|
||||
}
|
||||
@ -106,7 +101,7 @@ public class CommandListener implements CommandExecutor {
|
||||
ArrayList<String> commands = getCommands(sender);
|
||||
|
||||
if (page == 1) {
|
||||
p.msg(sender, g + p.getDescription().getName() + " v" + p.getDescription().getVersion());
|
||||
p.msg(sender, "&6" + p.getDescription().getName() + " v" + p.getDescription().getVersion());
|
||||
}
|
||||
|
||||
p.list(sender, commands, page);
|
||||
@ -116,31 +111,31 @@ public class CommandListener implements CommandExecutor {
|
||||
public ArrayList<String> getCommands(CommandSender sender) {
|
||||
|
||||
ArrayList<String> cmds = new ArrayList<String>();
|
||||
cmds.add(g + "/br help <Seite> " + b + "Zeigt eine bestimmte Hilfeseite an");
|
||||
cmds.add("&6/br help <Seite> &9Zeigt eine bestimmte Hilfeseite an");
|
||||
|
||||
if (p.permission.has(sender, "brewery.cmd.reload")) {
|
||||
cmds.add(g + "/br reload " + b + " Config neuladen");
|
||||
cmds.add("&6/br reload &9Config neuladen");
|
||||
}
|
||||
|
||||
if (p.permission.has(sender, "brewery.cmd.wakeup")) {
|
||||
cmds.add(g + "/br Wakeup List <Seite>" + b + " Listet alle Aufwachpunkte auf");
|
||||
cmds.add(g + "/br Wakeup List <Seite> <Welt>" + b + " Listet die Aufwachpunkte einer Welt auf");
|
||||
cmds.add(g + "/br Wakeup Check " + b + " Teleportiert zu allen Aufwachpunkten");
|
||||
cmds.add(g + "/br Wakeup Check <id> " + b + " Teleportiert zu einem Aufwachpunkt");
|
||||
cmds.add(g + "/br Wakeup Add " + b + " Setzt einen Aufwachpunkt");
|
||||
cmds.add(g + "/br Wakeup Remove <id> " + b + " Entfernt einen Aufwachpunkt");
|
||||
cmds.add("&6/br Wakeup List <Seite>&9 Listet alle Aufwachpunkte auf");
|
||||
cmds.add("&6/br Wakeup List <Seite> <Welt>&9 Listet die Aufwachpunkte einer Welt auf");
|
||||
cmds.add("&6/br Wakeup Check &9Teleportiert zu allen Aufwachpunkten");
|
||||
cmds.add("&6/br Wakeup Check <id> &9Teleportiert zu einem Aufwachpunkt");
|
||||
cmds.add("&6/br Wakeup Add &9Setzt einen Aufwachpunkt");
|
||||
cmds.add("&6/br Wakeup Remove <id> &9Entfernt einen Aufwachpunkt");
|
||||
}
|
||||
|
||||
if (p.permission.has(sender, "brewery.cmd.player")) {
|
||||
cmds.add (g + "/br <Spieler> <%Trunkenheit> <Qualität>" + b + " Setzt Trunkenheit (und Qualität) eines Spielers");
|
||||
cmds.add ("&6/br <Spieler> <%Trunkenheit> <Qualität>&9 Setzt Trunkenheit (und Qualität) eines Spielers");
|
||||
}
|
||||
|
||||
if (p.permission.has(sender, "brewery.cmd.info")) {
|
||||
cmds.add (g + "/br Info" + b + " Zeigt deine aktuelle Trunkenheit und Qualität an");
|
||||
cmds.add ("&6/br Info&9 Zeigt deine aktuelle Trunkenheit und Qualität an");
|
||||
}
|
||||
|
||||
if (p.permission.has(sender, "brewery.cmd.infoOther")) {
|
||||
cmds.add (g + "/br Info <Spieler>" + b + " Zeigt die aktuelle Trunkenheit und Qualität von <Spieler> an");
|
||||
cmds.add ("&6/br Info <Spieler>&9 Zeigt die aktuelle Trunkenheit und Qualität von <Spieler> an");
|
||||
}
|
||||
|
||||
return cmds;
|
||||
@ -176,7 +171,7 @@ public class CommandListener implements CommandExecutor {
|
||||
Wakeup.remove(sender, id);
|
||||
} else {
|
||||
p.msg(sender, "Benutzung:");
|
||||
p.msg(sender, g + "/br Wakeup Remove <id>");
|
||||
p.msg(sender, "&6/br Wakeup Remove <id>");
|
||||
}
|
||||
|
||||
} else if (args[1].equalsIgnoreCase("check")){
|
||||
@ -197,7 +192,7 @@ public class CommandListener implements CommandExecutor {
|
||||
} else {
|
||||
|
||||
p.msg(sender, "Unbekannter Befehl.");
|
||||
p.msg(sender, "benutze " + g + "/br help " + ChatColor.WHITE + "um die Hilfe anzuzeigen");
|
||||
p.msg(sender, "benutze &6/br help &fum die Hilfe anzuzeigen");
|
||||
|
||||
}
|
||||
}
|
||||
@ -209,7 +204,7 @@ public class CommandListener implements CommandExecutor {
|
||||
if (args.length > 2) {
|
||||
quality = p.parseInt(args[2]);
|
||||
if (quality < 1 || quality > 10) {
|
||||
p.msg(sender, r + "Die Qualität muss zwischen 1 und 10 liegen!");
|
||||
p.msg(sender, "&cDie Qualität muss zwischen 1 und 10 liegen!");
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -230,7 +225,7 @@ public class CommandListener implements CommandExecutor {
|
||||
bPlayer.setData(drunkeness, quality);
|
||||
}
|
||||
|
||||
p.msg(sender, gr + playerName + " ist nun " + g + drunkeness + "% " + gr + "betrunken, mit einer Qualität von " + g + bPlayer.getQuality());
|
||||
p.msg(sender, "&a" + playerName + " ist nun &6" + drunkeness + "% &abetrunken, mit einer Qualität von &6" + bPlayer.getQuality());
|
||||
if (drunkeness > 100) {
|
||||
bPlayer.drinkCap(p.getServer().getPlayer(playerName));
|
||||
}
|
||||
@ -244,7 +239,7 @@ public class CommandListener implements CommandExecutor {
|
||||
Player player = (Player) sender;
|
||||
playerName = player.getName();
|
||||
} else {
|
||||
p.msg(sender, r + "Dieser Befehl kann nur als Spieler ausgeführt werden");
|
||||
p.msg(sender, "&cDieser Befehl kann nur als Spieler ausgeführt werden");
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -253,7 +248,7 @@ public class CommandListener implements CommandExecutor {
|
||||
if (bPlayer == null) {
|
||||
p.msg(sender, playerName + " ist nicht betrunken");
|
||||
} else {
|
||||
p.msg(sender, playerName + " ist " + g + bPlayer.getDrunkeness() + "% " + ChatColor.WHITE + "betrunken, mit einer Qualität von " + g + bPlayer.getQuality());
|
||||
p.msg(sender, playerName + " ist &6" + bPlayer.getDrunkeness() + "% &fbetrunken, mit einer Qualität von &6" + bPlayer.getQuality());
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user