use of preponderous.ponder.minecraft.bukkit.nms.NMSAssistant in project Storage by VoChiDanh.
the class Files method colorize.
// Colorizes messages with preset colorcodes (&) and if using 1.16+, applies hex values via "&#hexvalue"
public static String colorize(String input) {
input = ChatColor.translateAlternateColorCodes('&', input);
NMSAssistant nms = new NMSAssistant();
if (nms.isVersionGreaterThan(15)) {
input = translateHexColorCodes("\\&#", "", input);
}
return input;
}
use of preponderous.ponder.minecraft.bukkit.nms.NMSAssistant in project bCore by D-x-Z.
the class Data method convert.
// Colorizes messages with preset colorcodes (&) and if using 1.16+, applies hex values via "&#hexvalue"
public static String convert(String input) {
input = ChatColor.translateAlternateColorCodes('&', input);
NMSAssistant nms = new NMSAssistant();
if (nms.isVersionGreaterThan(15)) {
input = translateHexColorCodes("\\&#", "", input);
}
return input;
}
use of preponderous.ponder.minecraft.bukkit.nms.NMSAssistant in project bCore by D-x-Z.
the class bCore method performNMSChecks.
private void performNMSChecks() {
final NMSAssistant nmsAssistant = new NMSAssistant();
if (nmsAssistant.isVersionGreaterThan(7)) {
getLogger().log(Level.INFO, "Loading data matching server version " + nmsAssistant.getNMSVersion().toString());
} else {
getLogger().warning("The server version is not suitable to load the plugin");
getLogger().warning("Support version 1.8.x - 1.18.x");
Bukkit.getServer().getPluginManager().disablePlugin(this);
}
}
use of preponderous.ponder.minecraft.bukkit.nms.NMSAssistant in project Storage by D-x-Z.
the class Files method colorize.
// Colorizes messages with preset colorcodes (&) and if using 1.16+, applies hex values via "&#hexvalue"
public static String colorize(String input) {
input = ChatColor.translateAlternateColorCodes('&', input);
NMSAssistant nms = new NMSAssistant();
if (nms.isVersionGreaterThan(15)) {
input = translateHexColorCodes("\\&#", "", input);
}
return input;
}
use of preponderous.ponder.minecraft.bukkit.nms.NMSAssistant in project Storage by D-x-Z.
the class BlockBreak method onBreaking.
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onBreaking(@NotNull BlockBreakEvent e) {
Player p = e.getPlayer();
String blocks = e.getBlock().getType().toString();
String items = null;
NMSAssistant nms = new NMSAssistant();
LocalPlayer localPlayer = WorldGuardPlugin.inst().wrapPlayer(p);
Location loc = new Location(p.getWorld(), e.getBlock().getLocation().getBlockX(), e.getBlock().getLocation().getBlockY(), e.getBlock().getLocation().getBlockZ());
RegionContainer container = WorldGuardPlugin.inst().getRegionContainer();
RegionQuery query = container.createQuery();
if (!query.testState(loc, localPlayer, DefaultFlag.BLOCK_BREAK) && !p.hasPermission("Storage.admin")) {
e.setCancelled(true);
return;
}
e.getBlock().getDrops().clear();
if (nms.isVersion(12)) {
e.setDropItems(false);
}
List<String> w = getconfigfile().getStringList("Blacklist-World");
if (!w.contains(p.getWorld().getName())) {
if (autoPick(p)) {
for (String getBlockType : Objects.requireNonNull(getconfigfile().getConfigurationSection("Blocks.")).getKeys(false)) {
if (blocks.equalsIgnoreCase(getBlockType)) {
items = getconfigfile().getString("Blocks." + blocks + ".Name");
break;
}
}
if (items == null) {
return;
}
if (getMaxStorage(p, blocks) == 0) {
setMaxStorage(p, blocks, getconfigfile().getInt("Default_Max_Storage"));
}
if (p.getItemInHand() != null && p.getItemInHand().getItemMeta().hasEnchant(Enchantment.LOOT_BONUS_BLOCKS)) {
if (getRandomInt(getconfigfile().getInt("Fortune.Chance.System.Min"), getconfigfile().getInt("Fortune.Chance.System.Max")) <= (p.getItemInHand().getItemMeta().getEnchantLevel(Enchantment.LOOT_BONUS_BLOCKS) * getconfigfile().getInt("Fortune.Chance.Player"))) {
int fortune = getRandomInt(getconfigfile().getInt("Fortune.Drop.Min"), getconfigfile().getInt("Fortune.Drop.Max"));
addStorage(p, blocks, 1 + fortune);
} else {
addStorage(p, blocks, 1);
}
} else {
addStorage(p, blocks, 1);
}
}
}
}
Aggregations