mirror of
https://github.com/RonanPlugins/BetterRTP.git
synced 2025-08-17 09:05:47 +00:00
hunger to rtp + custom permission configs (framework)
This commit is contained in:
parent
020fa52898
commit
18f4ebb40e
@ -52,8 +52,6 @@ public class RTP {
|
|||||||
if (getPl().getSettings().debug)
|
if (getPl().getSettings().debug)
|
||||||
getPl().getLogger().info("- Override '" + entry.getKey() + "' -> '" + entry.getValue() + "' added");
|
getPl().getLogger().info("- Override '" + entry.getKey() + "' -> '" + entry.getValue() + "' added");
|
||||||
}
|
}
|
||||||
//for (String s : config.getConfigurationSection("Override").getKeys(false))
|
|
||||||
// overriden.put(s, config.getString("Override." + s));
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
//No Overrides
|
//No Overrides
|
||||||
}
|
}
|
||||||
@ -158,9 +156,8 @@ public class RTP {
|
|||||||
if (this.world_type.containsKey(worldName))
|
if (this.world_type.containsKey(worldName))
|
||||||
world_type = this.world_type.get(worldName);
|
world_type = this.world_type.get(worldName);
|
||||||
pWorld.setWorldtype(world_type);
|
pWorld.setWorldtype(world_type);
|
||||||
// Check world price
|
// Economy
|
||||||
if (!getPl().getEco().charge(p, pWorld.getPrice())) {
|
if (!getPl().getEco().charge(p, pWorld.getPrice())) {
|
||||||
getPl().getText().getFailedPrice(p, pWorld.getPrice());
|
|
||||||
getPl().getCmd().cooldowns.remove(p.getUniqueId());
|
getPl().getCmd().cooldowns.remove(p.getUniqueId());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -19,10 +19,14 @@ public class Permissions {
|
|||||||
return perm(pre + "use", sendi);
|
return perm(pre + "use", sendi);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean getEconomy(CommandSender sendi) {
|
public boolean getBypassEconomy(CommandSender sendi) {
|
||||||
return perm(pre + "bypass.economy", sendi);
|
return perm(pre + "bypass.economy", sendi);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean getBypassHunger(CommandSender sendi) {
|
||||||
|
return perm(pre + "bypass.hunger", sendi);
|
||||||
|
}
|
||||||
|
|
||||||
public boolean getBypassCooldown(CommandSender sendi) {
|
public boolean getBypassCooldown(CommandSender sendi) {
|
||||||
return perm(pre + "bypass.cooldown", sendi);
|
return perm(pre + "bypass.cooldown", sendi);
|
||||||
}
|
}
|
||||||
|
@ -9,19 +9,32 @@ import org.bukkit.plugin.RegisteredServiceProvider;
|
|||||||
|
|
||||||
public class DepEconomy {
|
public class DepEconomy {
|
||||||
private Economy e;
|
private Economy e;
|
||||||
|
private int hunger = 0;
|
||||||
private boolean checked = false;
|
private boolean checked = false;
|
||||||
|
|
||||||
public boolean charge(Player player, int price) {
|
public boolean charge(Player player, int price) {
|
||||||
check(false);
|
check(false);
|
||||||
//player.sendMessage("Charging = " + (e != null) + " charge = " + price);
|
//Hunger Stuff
|
||||||
if (e != null)
|
if (hunger != 0) {
|
||||||
if (price != 0) {
|
boolean has_hunger = player.getSaturation() > hunger;
|
||||||
if (!Main.getInstance().getPerms().getEconomy(player)) {
|
if (!has_hunger) {
|
||||||
|
Main.getInstance().getText().getFailedHunger(player);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//Economy Stuff
|
||||||
|
if (e != null && price != 0 && !Main.getInstance().getPerms().getBypassEconomy(player)) {
|
||||||
|
try {
|
||||||
EconomyResponse r = e.withdrawPlayer(player, price);
|
EconomyResponse r = e.withdrawPlayer(player, price);
|
||||||
return r.transactionSuccess();
|
boolean passed_economy = r.transactionSuccess();
|
||||||
|
if (passed_economy)
|
||||||
|
Main.getInstance().getText().getFailedPrice(player, price);
|
||||||
|
return passed_economy;
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
//Default value
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -38,6 +51,10 @@ public class DepEconomy {
|
|||||||
private void check(boolean force) {
|
private void check(boolean force) {
|
||||||
if (!checked || force)
|
if (!checked || force)
|
||||||
registerEconomy();
|
registerEconomy();
|
||||||
|
if (Main.getInstance().getFiles().getType(FileBasics.FILETYPE.ECO).getBoolean("Hunger.Enabled"))
|
||||||
|
hunger = Main.getInstance().getFiles().getType(FileBasics.FILETYPE.ECO).getInt("Hunger.Honches");
|
||||||
|
else
|
||||||
|
hunger = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void registerEconomy() {
|
private void registerEconomy() {
|
||||||
|
@ -48,6 +48,10 @@ public class Messages {
|
|||||||
sms(sendi, getLang().getString(preM + "Failed.Price").replaceAll("%price%", String.valueOf(price)));
|
sms(sendi, getLang().getString(preM + "Failed.Price").replaceAll("%price%", String.valueOf(price)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void getFailedHunger(CommandSender sendi) {
|
||||||
|
sms(sendi, getLang().getString(preM + "Failed.Hunger"));
|
||||||
|
}
|
||||||
|
|
||||||
public void getOtherNotSafe(CommandSender sendi, int attempts, String player) {
|
public void getOtherNotSafe(CommandSender sendi, int attempts, String player) {
|
||||||
sms(sendi, getLang().getString(preM + "Other.NotSafe").replaceAll("%attempts%", Integer.toString(attempts))
|
sms(sendi, getLang().getString(preM + "Other.NotSafe").replaceAll("%attempts%", Integer.toString(attempts))
|
||||||
.replaceAll("%player%", player));
|
.replaceAll("%player%", player));
|
||||||
|
@ -96,3 +96,19 @@ WorldType: # Available types are NORMAL, NETHER
|
|||||||
- world: NORMAL
|
- world: NORMAL
|
||||||
- world_nether: NETHER
|
- world_nether: NETHER
|
||||||
- world_the_end: NORMAL
|
- world_the_end: NORMAL
|
||||||
|
|
||||||
|
PermissionConfigs: #Player requires "betterrtp.config.<world_name>" to trigger these configs
|
||||||
|
- vip: #betterrtp.config.vip
|
||||||
|
- Build_World: #World named "Build_World"
|
||||||
|
MaxRadius: 10000
|
||||||
|
MinRadius: 1000
|
||||||
|
- Survival_World:
|
||||||
|
MaxRadius: 5000
|
||||||
|
MinRadius: 1000
|
||||||
|
- vip2:
|
||||||
|
- Build_World:
|
||||||
|
MaxRadius: 25000
|
||||||
|
MinRadius: 10000
|
||||||
|
- Survival_World:
|
||||||
|
MaxRadius: 15000
|
||||||
|
MinRadius: 1000
|
@ -5,6 +5,10 @@ Economy:
|
|||||||
## Give players the permission "betterrtp.eco.bypass" to bypass economy
|
## Give players the permission "betterrtp.eco.bypass" to bypass economy
|
||||||
Price: 5
|
Price: 5
|
||||||
|
|
||||||
|
Hunger: #Make rtp'ing take up hunger to avoid exploits
|
||||||
|
Enabled: false
|
||||||
|
Honches: 4
|
||||||
|
|
||||||
CustomWorlds:
|
CustomWorlds:
|
||||||
## Enable custom world charging
|
## Enable custom world charging
|
||||||
Enabled: true
|
Enabled: true
|
||||||
|
@ -8,6 +8,7 @@ Messages:
|
|||||||
Failed:
|
Failed:
|
||||||
Price: '&c你的钱不够了,&7你至少要有$%price%&7才能随机传送!'
|
Price: '&c你的钱不够了,&7你至少要有$%price%&7才能随机传送!'
|
||||||
NotSafe: '&c由于在%attempts%次尝试内未能找到安全的位置,&7你未被传送!'
|
NotSafe: '&c由于在%attempts%次尝试内未能找到安全的位置,&7你未被传送!'
|
||||||
|
Hunger: '&cCould not rtp because you are... &7too hungry&c, eat something fella!'
|
||||||
Other:
|
Other:
|
||||||
Success: '&a%player%被传送到了&7 x=%x% y=%y% z=%z%。共尝试&f%attempts%&7次!'
|
Success: '&a%player%被传送到了&7 x=%x% y=%y% z=%z%。共尝试&f%attempts%&7次!'
|
||||||
NotSafe: '&c由于在%attempts%次尝试内未能找到安全的位置,&7%player%未被传送!'
|
NotSafe: '&c由于在%attempts%次尝试内未能找到安全的位置,&7%player%未被传送!'
|
||||||
|
@ -8,6 +8,7 @@ Messages:
|
|||||||
Failed:
|
Failed:
|
||||||
Price: '&c您的資金不夠了!&7您需要有$%price%&7才能嘗試RTP!'
|
Price: '&c您的資金不夠了!&7您需要有$%price%&7才能嘗試RTP!'
|
||||||
NotSafe: '&c由於%attempts%次嘗試內未能找到適合的地方傳送,&7您未被傳送!'
|
NotSafe: '&c由於%attempts%次嘗試內未能找到適合的地方傳送,&7您未被傳送!'
|
||||||
|
Hunger: '&cCould not rtp because you are... &7too hungry&c, eat something fella!'
|
||||||
Other:
|
Other:
|
||||||
Success: '&a%player%被傳送到了&7 x=%x% y=%y% z=%z%。一共嘗試&f%attempts%&7次!'
|
Success: '&a%player%被傳送到了&7 x=%x% y=%y% z=%z%。一共嘗試&f%attempts%&7次!'
|
||||||
NotSafe: '&c由於%attempts%次嘗試內未能找到適合的地方傳送,&7%player%未被傳送!'
|
NotSafe: '&c由於%attempts%次嘗試內未能找到適合的地方傳送,&7%player%未被傳送!'
|
||||||
|
@ -8,6 +8,7 @@ Messages:
|
|||||||
Failed:
|
Failed:
|
||||||
Price: '&cKan niet rtpen vanwege onvoldoende saldo! &7Je moet minstens $%price% &7hebben om te rtpen!'
|
Price: '&cKan niet rtpen vanwege onvoldoende saldo! &7Je moet minstens $%price% &7hebben om te rtpen!'
|
||||||
NotSafe: '&cKon geen veilige plek vinden, Probeer opnieuw! &7Je bent niet ge tp''d!'
|
NotSafe: '&cKon geen veilige plek vinden, Probeer opnieuw! &7Je bent niet ge tp''d!'
|
||||||
|
Hunger: '&cCould not rtp because you are... &7too hungry&c, eat something fella!'
|
||||||
Other:
|
Other:
|
||||||
Success: '&a%player% is getp''d naar&7 x=%x% y=%y% z=%z% in &f%attempts% &7pogingen!'
|
Success: '&a%player% is getp''d naar&7 x=%x% y=%y% z=%z% in &f%attempts% &7pogingen!'
|
||||||
NotSafe: '&cKon geen veilige plek binnenin %attempts% pogingen! &7%player% is niet gertp''d!'
|
NotSafe: '&cKon geen veilige plek binnenin %attempts% pogingen! &7%player% is niet gertp''d!'
|
||||||
|
@ -8,6 +8,7 @@ Messages:
|
|||||||
Failed:
|
Failed:
|
||||||
Price: '&cCould not rtp because of insufficent funds! &7You must have atleast $%price% &7to rtp!'
|
Price: '&cCould not rtp because of insufficent funds! &7You must have atleast $%price% &7to rtp!'
|
||||||
NotSafe: '&cCould not find safe spot within %attempts% attempts! &7You were not RTP''d!'
|
NotSafe: '&cCould not find safe spot within %attempts% attempts! &7You were not RTP''d!'
|
||||||
|
Hunger: '&cCould not rtp because you are... &7too hungry&c, eat something fella!'
|
||||||
Other:
|
Other:
|
||||||
Success: '&a%player% has been tp''d to&7 x=%x% y=%y% z=%z% in &f%attempts% &7attempts!'
|
Success: '&a%player% has been tp''d to&7 x=%x% y=%y% z=%z% in &f%attempts% &7attempts!'
|
||||||
NotSafe: '&cCould not find safe spot within %attempts% attempts! &7%player% was not rtp''d!'
|
NotSafe: '&cCould not find safe spot within %attempts% attempts! &7%player% was not rtp''d!'
|
||||||
|
@ -9,6 +9,7 @@ Messages:
|
|||||||
Failed:
|
Failed:
|
||||||
Price: '&cTu n''a pas pu être téléporté; Manque de fonds! &7Tu doit avoir au moins $%price% &7pour te téléporter!'
|
Price: '&cTu n''a pas pu être téléporté; Manque de fonds! &7Tu doit avoir au moins $%price% &7pour te téléporter!'
|
||||||
NotSafe: '&cImpossible de trouver un endroit sûr en %attempts% tentatives! &7Tu n''a pas été téléporté!'
|
NotSafe: '&cImpossible de trouver un endroit sûr en %attempts% tentatives! &7Tu n''a pas été téléporté!'
|
||||||
|
Hunger: '&cCould not rtp because you are... &7too hungry&c, eat something fella!'
|
||||||
Other:
|
Other:
|
||||||
Success: '&a%player% a été téléporté à&7 x=%x% y=%y% z=%z% em &f%attempts% &7tentatives!'
|
Success: '&a%player% a été téléporté à&7 x=%x% y=%y% z=%z% em &f%attempts% &7tentatives!'
|
||||||
NotSafe: '&cImpossible de trouver un endroit sûr en %attempts% tentatives! &7%player% n''a pas été téléporté!'
|
NotSafe: '&cImpossible de trouver un endroit sûr en %attempts% tentatives! &7%player% n''a pas été téléporté!'
|
||||||
|
@ -8,6 +8,7 @@ Messages:
|
|||||||
Failed:
|
Failed:
|
||||||
Price: '&c資金が不十分のためRTPできませんでした! &7RTPには最低$%price%&7が必要です!'
|
Price: '&c資金が不十分のためRTPできませんでした! &7RTPには最低$%price%&7が必要です!'
|
||||||
NotSafe: '&c%attempts%回の試行で安全な場所が見つかりませんでした! &7あなたははRTPされませんでした!'
|
NotSafe: '&c%attempts%回の試行で安全な場所が見つかりませんでした! &7あなたははRTPされませんでした!'
|
||||||
|
Hunger: '&cCould not rtp because you are... &7too hungry&c, eat something fella!'
|
||||||
Other:
|
Other:
|
||||||
Success: '&a%player%が&7x=%x% y=%y% z=%z% に&f%attempts%&7回の試行でテレポートしました!'
|
Success: '&a%player%が&7x=%x% y=%y% z=%z% に&f%attempts%&7回の試行でテレポートしました!'
|
||||||
NotSafe: '&c%attempts%回の試行で安全な場所が見つかりませんでした! &7%player%はRTPされませんでした!'
|
NotSafe: '&c%attempts%回の試行で安全な場所が見つかりませんでした! &7%player%はRTPされませんでした!'
|
||||||
|
@ -8,6 +8,7 @@ Messages:
|
|||||||
Failed:
|
Failed:
|
||||||
Price: '&cУ вас недостаточно денег для телепортации! &7У вас должно быть хотябы $%price% &7для rtp!'
|
Price: '&cУ вас недостаточно денег для телепортации! &7У вас должно быть хотябы $%price% &7для rtp!'
|
||||||
NotSafe: '&cНе удалось найти безопасное место за %attempts% попыток! &7Вас не телепортировало!'
|
NotSafe: '&cНе удалось найти безопасное место за %attempts% попыток! &7Вас не телепортировало!'
|
||||||
|
Hunger: '&cCould not rtp because you are... &7too hungry&c, eat something fella!'
|
||||||
Other:
|
Other:
|
||||||
Success: '&a%player% был телепортирован на&7 x=%x% y=%y% z=%z% за &f%attempts% &7попыток!'
|
Success: '&a%player% был телепортирован на&7 x=%x% y=%y% z=%z% за &f%attempts% &7попыток!'
|
||||||
NotSafe: '&cНе удалось найти безопасное место за %attempts% попыток! &7%player% не был телепортирован!'
|
NotSafe: '&cНе удалось найти безопасное место за %attempts% попыток! &7%player% не был телепортирован!'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user