config.yml fix + hunger to rtp added

This commit is contained in:
SuperRonanCraft 2020-09-21 21:25:19 -04:00
parent 18f4ebb40e
commit 60458c35f9
3 changed files with 50 additions and 43 deletions

View File

@ -4,6 +4,7 @@ import me.SuperRonanCraft.BetterRTP.references.file.FileBasics;
import me.SuperRonanCraft.BetterRTP.Main;
import net.milkbowl.vault.economy.Economy;
import net.milkbowl.vault.economy.EconomyResponse;
import org.bukkit.GameMode;
import org.bukkit.entity.Player;
import org.bukkit.plugin.RegisteredServiceProvider;
@ -15,11 +16,15 @@ public class DepEconomy {
public boolean charge(Player player, int price) {
check(false);
//Hunger Stuff
if (hunger != 0) {
boolean has_hunger = player.getSaturation() > hunger;
boolean took_food = false;
if (hunger != 0 && (player.getGameMode() == GameMode.SURVIVAL || player.getGameMode() == GameMode.ADVENTURE)) {
boolean has_hunger = player.getFoodLevel() > hunger;
if (!has_hunger) {
Main.getInstance().getText().getFailedHunger(player);
return false;
} else {
player.setFoodLevel(player.getFoodLevel() - hunger);
took_food = true;
}
}
//Economy Stuff
@ -27,8 +32,11 @@ public class DepEconomy {
try {
EconomyResponse r = e.withdrawPlayer(player, price);
boolean passed_economy = r.transactionSuccess();
if (passed_economy)
if (!passed_economy) {
Main.getInstance().getText().getFailedPrice(player, price);
if (took_food)
player.setFoodLevel(player.getFoodLevel() + hunger);
}
return passed_economy;
} catch (Exception e) {
e.printStackTrace();

View File

@ -100,7 +100,6 @@ public class FileBasics {
config.options().copyDefaults(true);
in.close();
}
Main.getInstance().saveDefaultConfig();
config.save(file);
} catch (Exception e) {
e.printStackTrace();

View File

@ -48,18 +48,18 @@ Default:
## Blocks BetterRTP will NOT teleport onto. More Blocks at: https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/Material.html #
BlacklistedBlocks:
- stationary_water
- stationary_lava
- water
- flowing_water
- lava
- flowing_lava
- cactus
- leaves
- leaves_2
- air
- void_air
- bedrock
- stationary_water
- stationary_lava
- water
- flowing_water
- lava
- flowing_lava
- cactus
- leaves
- leaves_2
- air
- void_air
- bedrock
## Worlds to NOT allow /rtp in, unless there is an override to another enabled world #
DisabledWorlds:
@ -69,22 +69,22 @@ DisabledWorlds:
## Worlds you want to have a custom min/max and spawn center in #
## [MaxRadius] and [MinRadius] MUST be positive! These cannot be equal to each other!
CustomWorlds:
- custom_world_1:
UseWorldBorder: false
## If UseWorldBorder is true, everything will be ignored EXCEPT "MinRadius"!
MaxRadius: 1000
MinRadius: 100
CenterX: 0
CenterZ: 0
- other_custom_world:
MaxRadius: 100000
MinRadius: 1000
CenterX: 123
CenterZ: -123
## Biomes are optional, but useful! More biomes: https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/block/Biome.html
Biomes:
- 'desert'
- 'forest'
- custom_world_1:
UseWorldBorder: false
## If UseWorldBorder is true, everything will be ignored EXCEPT "MinRadius"!
MaxRadius: 1000
MinRadius: 100
CenterX: 0
CenterZ: 0
- other_custom_world:
MaxRadius: 100000
MinRadius: 1000
CenterX: 123
CenterZ: -123
## Biomes are optional, but useful! More biomes: https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/block/Biome.html
Biomes:
- 'desert'
- 'forest'
## Override a world and rtp a player executing the command in one world, to another
Overrides:
@ -93,22 +93,22 @@ Overrides:
- creative_world: 'world'
WorldType: # Available types are NORMAL, NETHER
- world: NORMAL
- world_nether: NETHER
- world_the_end: NORMAL
- world: NORMAL
- world_nether: NETHER
- world_the_end: NORMAL
PermissionConfigs: #Player requires "betterrtp.config.<world_name>" to trigger these configs
- vip: #betterrtp.config.vip
- vip: #betterrtp.config.vip
- Build_World: #World named "Build_World"
MaxRadius: 10000
MinRadius: 1000
MaxRadius: 10000
MinRadius: 1000
- Survival_World:
MaxRadius: 5000
MinRadius: 1000
- vip2:
- vip2:
- Build_World:
MaxRadius: 25000
MinRadius: 10000
MaxRadius: 25000
MinRadius: 10000
- Survival_World:
MaxRadius: 15000
MinRadius: 1000
MaxRadius: 15000
MinRadius: 1000