mirror of
https://github.com/RonanPlugins/BetterRTP.git
synced 2026-10-26 05:50:41 +00:00
more specific placeholders
This commit is contained in:
1 parent
69f38d524d
commit
64161b7b72
3 files changed
+75
-15
No files matched your search
@@ -7,7 +7,7 @@
|
|||||||
<groupId>me.SuperRonanCraft</groupId>
|
<groupId>me.SuperRonanCraft</groupId>
|
||||||
<artifactId>BetterRTP</artifactId>
|
<artifactId>BetterRTP</artifactId>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
<version>3.5.0-DEV3</version>
|
<version>3.5.0-DEV4</version>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<maven.compiler.source>1.8</maven.compiler.source>
|
<maven.compiler.source>1.8</maven.compiler.source>
|
||||||
|
|||||||
+67
-13
@@ -43,26 +43,41 @@ public class DepPlaceholderAPI extends PlaceholderExpansion {
|
|||||||
if (request.equalsIgnoreCase("cooldown")) {
|
if (request.equalsIgnoreCase("cooldown")) {
|
||||||
return cooldown(data, player.getWorld());
|
return cooldown(data, player.getWorld());
|
||||||
} else if (request.startsWith("cooldown_")) {
|
} else if (request.startsWith("cooldown_")) {
|
||||||
World world = getWorld(request.replace("cooldown_", ""));
|
return cooldown(data, getWorld(request.replace("cooldown_", "")));
|
||||||
return cooldown(data, world);
|
|
||||||
} else if (request.equalsIgnoreCase("cooldowntime")) {
|
} else if (request.equalsIgnoreCase("cooldowntime")) {
|
||||||
return cooldownTime(data, player.getWorld());
|
return cooldownTime(data, player.getWorld());
|
||||||
} else if (request.startsWith("cooldowntime_")) {
|
} else if (request.startsWith("cooldowntime_")) {
|
||||||
World world = getWorld(request.replace("cooldowntime_", ""));
|
return cooldownTime(data, getWorld(request.replace("cooldowntime_", "")));
|
||||||
return cooldownTime(data, world);
|
}
|
||||||
|
} else if (request.startsWith("canrtp")) {
|
||||||
|
if (request.equalsIgnoreCase("canrtp")) {
|
||||||
|
return canRTPALL(player, player.getWorld());
|
||||||
|
} else if (request.startsWith("canrtp_")) {
|
||||||
|
return canRTPALL(player, getWorld(request.replace("canrtp_", "")));
|
||||||
|
} else if (request.startsWith("canrtpcooldown")) {
|
||||||
|
if (request.equalsIgnoreCase("canrtpcooldown")) {
|
||||||
|
return canRTP_cooldown(player, player.getWorld());
|
||||||
|
} else if (request.startsWith("canrtpcooldown_")) {
|
||||||
|
return canRTP_cooldown(player, getWorld(request.replace("canrtpcooldown_", "")));
|
||||||
|
}
|
||||||
|
} else if (request.startsWith("canrtpprice")) {
|
||||||
|
if (request.equalsIgnoreCase("canrtpprice")) {
|
||||||
|
return canRTP_price(player, player.getWorld());
|
||||||
|
} else if (request.startsWith("canrtpprice_")) {
|
||||||
|
return canRTP_price(player, getWorld(request.replace("canrtpprice_", "")));
|
||||||
|
}
|
||||||
|
} else if (request.startsWith("canrtphunger")) {
|
||||||
|
if (request.equalsIgnoreCase("canrtphunger")) {
|
||||||
|
return canRTP_hunger(player, player.getWorld());
|
||||||
|
} else if (request.startsWith("canrtphunger_")) {
|
||||||
|
return canRTP_hunger(player, getWorld(request.replace("canrtphunger_", "")));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else if (request.startsWith("canrtp_")) {
|
|
||||||
World world = getWorld(request.replace("canrtp_", ""));
|
|
||||||
return canRTP(player, world);
|
|
||||||
} else if (request.equalsIgnoreCase("canrtp")) {
|
|
||||||
World world = player.getWorld();
|
|
||||||
return canRTP(player, world);
|
|
||||||
} else if (request.startsWith("price")) {
|
} else if (request.startsWith("price")) {
|
||||||
if (request.equalsIgnoreCase("price")) {
|
if (request.equalsIgnoreCase("price")) {
|
||||||
return price(player, player.getWorld());
|
return price(player, player.getWorld());
|
||||||
} else if (request.startsWith("price_")) {
|
} else if (request.startsWith("price_")) {
|
||||||
World world = getWorld(request.replace("price_", ""));
|
return price(player, getWorld(request.replace("price_", "")));
|
||||||
return price(player, world);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
@@ -84,7 +99,7 @@ public class DepPlaceholderAPI extends PlaceholderExpansion {
|
|||||||
return HelperDate.total(cooldownTime);
|
return HelperDate.total(cooldownTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
private String canRTP(Player player, World world) {
|
private String canRTPALL(Player player, World world) {
|
||||||
if (world == null) return "Invalid World";
|
if (world == null) return "Invalid World";
|
||||||
world = HelperRTP.getActualWorld(player, world);
|
world = HelperRTP.getActualWorld(player, world);
|
||||||
//Permission
|
//Permission
|
||||||
@@ -105,6 +120,45 @@ public class DepPlaceholderAPI extends PlaceholderExpansion {
|
|||||||
return BetterRTP.getInstance().getSettings().getPlaceholder_true();
|
return BetterRTP.getInstance().getSettings().getPlaceholder_true();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String canRTP_cooldown(Player player, World world) {
|
||||||
|
if (world == null) return "Invalid World";
|
||||||
|
world = HelperRTP.getActualWorld(player, world);
|
||||||
|
|
||||||
|
RTPSetupInformation setupInformation = new RTPSetupInformation(world, player, player, true);
|
||||||
|
WorldPlayer pWorld = HelperRTP.getPlayerWorld(setupInformation);
|
||||||
|
//Cooldown
|
||||||
|
if (HelperRTP_Check.isCoolingDown(player, player, pWorld))
|
||||||
|
return BetterRTP.getInstance().getSettings().getPlaceholder_cooldown();
|
||||||
|
//True
|
||||||
|
return BetterRTP.getInstance().getSettings().getPlaceholder_true();
|
||||||
|
}
|
||||||
|
|
||||||
|
private String canRTP_price(Player player, World world) {
|
||||||
|
if (world == null) return "Invalid World";
|
||||||
|
world = HelperRTP.getActualWorld(player, world);
|
||||||
|
|
||||||
|
RTPSetupInformation setupInformation = new RTPSetupInformation(world, player, player, true);
|
||||||
|
WorldPlayer pWorld = HelperRTP.getPlayerWorld(setupInformation);
|
||||||
|
//Price
|
||||||
|
if (!BetterRTP.getInstance().getEco().hasBalance(player, pWorld))
|
||||||
|
return BetterRTP.getInstance().getSettings().getPlaceholder_balance();
|
||||||
|
//True
|
||||||
|
return BetterRTP.getInstance().getSettings().getPlaceholder_true();
|
||||||
|
}
|
||||||
|
|
||||||
|
private String canRTP_hunger(Player player, World world) {
|
||||||
|
if (world == null) return "Invalid World";
|
||||||
|
world = HelperRTP.getActualWorld(player, world);
|
||||||
|
|
||||||
|
RTPSetupInformation setupInformation = new RTPSetupInformation(world, player, player, true);
|
||||||
|
WorldPlayer pWorld = HelperRTP.getPlayerWorld(setupInformation);
|
||||||
|
//Hunger
|
||||||
|
if (!BetterRTP.getInstance().getEco().hasHunger(player, pWorld))
|
||||||
|
return BetterRTP.getInstance().getSettings().getPlaceholder_hunger();
|
||||||
|
//True
|
||||||
|
return BetterRTP.getInstance().getSettings().getPlaceholder_true();
|
||||||
|
}
|
||||||
|
|
||||||
private String price(Player player, World world) {
|
private String price(Player player, World world) {
|
||||||
if (world == null) return "Invalid World";
|
if (world == null) return "Invalid World";
|
||||||
world = HelperRTP.getActualWorld(player, world);
|
world = HelperRTP.getActualWorld(player, world);
|
||||||
|
|||||||
@@ -4,8 +4,14 @@ betterrtp_cooldown: 'Get cooldown in current world'
|
|||||||
betterrtp_cooldown_<world_name>: 'Get cooldown of a specified world'
|
betterrtp_cooldown_<world_name>: 'Get cooldown of a specified world'
|
||||||
betterrtp_cooldowntime: 'Get cooldown time subject to in current world'
|
betterrtp_cooldowntime: 'Get cooldown time subject to in current world'
|
||||||
betterrtp_cooldowntime_<world_name>: 'Get cooldown time subject to in specified world'
|
betterrtp_cooldowntime_<world_name>: 'Get cooldown time subject to in specified world'
|
||||||
betterrtp_canrtp_<world_name>: 'Get the reason or yes output if player can rtp in set world'
|
|
||||||
betterrtp_canrtp: 'Get the reason or yes output if player can rtp in current world'
|
betterrtp_canrtp: 'Get the reason or yes output if player can rtp in current world'
|
||||||
|
betterrtp_canrtp_<world_name>: 'Get the reason or yes output if player can rtp in set world'
|
||||||
|
betterrtp_canrtpcooldown: 'Get if a player can rtp just based off their cooldown'
|
||||||
|
betterrtp_canrtpcooldown_<world_name>: 'Get if a player can rtp just based off their cooldown for this world'
|
||||||
|
betterrtp_canrtpprice: 'Get if a player can rtp just based off their bank account'
|
||||||
|
betterrtp_canrtpprice_<world_name>: 'Get if a player can rtp just based off their bank account for this world'
|
||||||
|
betterrtp_canrtphunger: 'Get if a player can rtp just based off their hunger'
|
||||||
|
betterrtp_canrtphunger_<world_name>: 'Get if a player can rtp just based off their hunger for this world'
|
||||||
betterrtp_price: 'Get the price of rtp''ing in current world'
|
betterrtp_price: 'Get the price of rtp''ing in current world'
|
||||||
betterrtp_price_<world_name>: 'Get the price of rtp''ing in specified world'
|
betterrtp_price_<world_name>: 'Get the price of rtp''ing in specified world'
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user