Java Code Examples for ch.njol.skript.Skript#isRunningMinecraft()
The following examples show how to use
ch.njol.skript.Skript#isRunningMinecraft() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: EquipmentSlot.java From Skript with GNU General Public License v3.0 | 9 votes |
@Override @Nullable public ItemStack get(EntityEquipment e) { if (Skript.isRunningMinecraft(1, 9)) { return e.getItemInOffHand(); } Skript.warning("No off hand support, but a skript would need that!"); return new ItemStack(Material.AIR); }
Example 2
Source File: TypeManager.java From skRayFall with GNU General Public License v3.0 | 6 votes |
public void registerSyntax(){ if (Skript.isAcceptRegistrations()) { registerTypes(); if (Skript.isRunningMinecraft(1, 9)){ registerV1_9Elements(); if (!(Bukkit.getVersion().contains("(MC: 1.9)") || Bukkit.getVersion().contains("(MC: 1.9.1)"))) { registerV1_9_2Elements(); } else { registerNon1_9_2TeamElements(); } } else if (Skript.isRunningMinecraft(1, 8)) { registerNon1_9_2TeamElements(); } } else { plugin.getLogger().info("skRayFall was unable to register some extra types."); } }
Example 3
Source File: CondItemInHand.java From Skript with GNU General Public License v3.0 | 5 votes |
@SuppressWarnings({"unchecked", "null"}) @Override public boolean init(final Expression<?>[] exprs, final int matchedPattern, final Kleenean isDelayed, final ParseResult parser) { entities = (Expression<LivingEntity>) exprs[0]; types = (Expression<ItemType>) exprs[1]; if (Skript.isRunningMinecraft(1, 9)) { offTool = (matchedPattern == 2 || matchedPattern == 3 || matchedPattern == 6 || matchedPattern == 7); setNegated(matchedPattern >= 4); } else { offTool = false; setNegated(matchedPattern >= 2); } return true; }
Example 4
Source File: ExprSpeed.java From Skript with GNU General Public License v3.0 | 5 votes |
@Override public boolean init(final Expression<?>[] exprs, final int matchedPattern, final Kleenean isDelayed, final ParseResult parseResult) { if (!Skript.isRunningMinecraft(1, 4)) { Skript.error("fly and walk speed can only be used in Minecraft 1.4 and newer"); return false; } super.init(exprs, matchedPattern, isDelayed, parseResult); walk = parseResult.mark == 0; return true; }
Example 5
Source File: ExprName.java From Skript with GNU General Public License v3.0 | 5 votes |
String getFrom() { StringBuilder b = new StringBuilder(); for (int i = 0; i < types.length; i++) { if ((from & (1 << i)) == 0) continue; if ((1 << i) == ITEM && !Skript.isRunningMinecraft(1, 4, 5)) continue; if ((1 << i) == ENTITY && !Skript.isRunningMinecraft(1, 5)) continue; if (b.length() != 0) b.append("/"); b.append(types[i]); } return "" + b; }
Example 6
Source File: ExprMaxHealth.java From Skript with GNU General Public License v3.0 | 5 votes |
@Override @Nullable public Class<?>[] acceptChange(final ChangeMode mode) { if(!Skript.isRunningMinecraft(1, 5, 2)) { Skript.error("The max health of an entity can only be changed in Minecraft 1.6 and later"); return null; } if (mode != ChangeMode.DELETE && mode != ChangeMode.REMOVE_ALL) return new Class[] {Number.class}; return null; }
Example 7
Source File: BiomeHook.java From Skript with GNU General Public License v3.0 | 5 votes |
@SuppressWarnings("null") @Override protected void loadClasses() throws IOException { if (!Skript.isRunningMinecraft(1, 13)) {// Load only if running MC<1.13 Skript.getAddonInstance().loadClasses(getClass().getPackage().getName()); util19 = new EnumUtils<>(To19Mapping.class, "biomes"); } }
Example 8
Source File: EvtExperienceSpawn.java From Skript with GNU General Public License v3.0 | 5 votes |
@Override public boolean init(final Literal<?>[] args, final int matchedPattern, final ParseResult parseResult) { if (!Skript.isRunningMinecraft(1, 4, 5)) { Skript.error("The experience spawn event can only be used in Minecraft 1.4.5 and later"); return false; } return true; }
Example 9
Source File: EquipmentSlot.java From Skript with GNU General Public License v3.0 | 5 votes |
@SuppressWarnings("deprecation") @Override @Nullable public ItemStack get(final EntityEquipment e) { if (Skript.isRunningMinecraft(1, 9)) { return e.getItemInMainHand(); } return e.getItemInHand(); }
Example 10
Source File: EquipmentSlot.java From Skript with GNU General Public License v3.0 | 5 votes |
@SuppressWarnings("deprecation") @Override public void set(final EntityEquipment e, final @Nullable ItemStack item) { if (Skript.isRunningMinecraft(1, 9)) { e.setItemInMainHand(item); } else { e.setItemInHand(item); } }
Example 11
Source File: EquipmentSlot.java From Skript with GNU General Public License v3.0 | 5 votes |
@Override public void set(EntityEquipment e, @Nullable ItemStack item) { if (Skript.isRunningMinecraft(1, 9)) { e.setItemInOffHand(item); } else { Skript.warning("No off hand support, but a skript would need that!"); } }
Example 12
Source File: CondMinecraftVersion.java From Skript with GNU General Public License v3.0 | 4 votes |
@Override public boolean check(Event e) { String ver = version.getSingle(e); return ver != null ? Skript.isRunningMinecraft(new Version(ver)) : false; }