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

View File

@ -100,7 +100,6 @@ public class FileBasics {
config.options().copyDefaults(true); config.options().copyDefaults(true);
in.close(); in.close();
} }
Main.getInstance().saveDefaultConfig();
config.save(file); config.save(file);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); 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 # ## Blocks BetterRTP will NOT teleport onto. More Blocks at: https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/Material.html #
BlacklistedBlocks: BlacklistedBlocks:
- stationary_water - stationary_water
- stationary_lava - stationary_lava
- water - water
- flowing_water - flowing_water
- lava - lava
- flowing_lava - flowing_lava
- cactus - cactus
- leaves - leaves
- leaves_2 - leaves_2
- air - air
- void_air - void_air
- bedrock - bedrock
## Worlds to NOT allow /rtp in, unless there is an override to another enabled world # ## Worlds to NOT allow /rtp in, unless there is an override to another enabled world #
DisabledWorlds: DisabledWorlds:
@ -69,22 +69,22 @@ DisabledWorlds:
## Worlds you want to have a custom min/max and spawn center in # ## 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! ## [MaxRadius] and [MinRadius] MUST be positive! These cannot be equal to each other!
CustomWorlds: CustomWorlds:
- custom_world_1: - custom_world_1:
UseWorldBorder: false UseWorldBorder: false
## If UseWorldBorder is true, everything will be ignored EXCEPT "MinRadius"! ## If UseWorldBorder is true, everything will be ignored EXCEPT "MinRadius"!
MaxRadius: 1000 MaxRadius: 1000
MinRadius: 100 MinRadius: 100
CenterX: 0 CenterX: 0
CenterZ: 0 CenterZ: 0
- other_custom_world: - other_custom_world:
MaxRadius: 100000 MaxRadius: 100000
MinRadius: 1000 MinRadius: 1000
CenterX: 123 CenterX: 123
CenterZ: -123 CenterZ: -123
## Biomes are optional, but useful! More biomes: https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/block/Biome.html ## Biomes are optional, but useful! More biomes: https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/block/Biome.html
Biomes: Biomes:
- 'desert' - 'desert'
- 'forest' - 'forest'
## Override a world and rtp a player executing the command in one world, to another ## Override a world and rtp a player executing the command in one world, to another
Overrides: Overrides:
@ -93,22 +93,22 @@ Overrides:
- creative_world: 'world' - creative_world: 'world'
WorldType: # Available types are NORMAL, NETHER 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 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" - Build_World: #World named "Build_World"
MaxRadius: 10000 MaxRadius: 10000
MinRadius: 1000 MinRadius: 1000
- Survival_World: - Survival_World:
MaxRadius: 5000 MaxRadius: 5000
MinRadius: 1000 MinRadius: 1000
- vip2: - vip2:
- Build_World: - Build_World:
MaxRadius: 25000 MaxRadius: 25000
MinRadius: 10000 MinRadius: 10000
- Survival_World: - Survival_World:
MaxRadius: 15000 MaxRadius: 15000
MinRadius: 1000 MinRadius: 1000