@Override public SortedSet<Integer> getSupportedVersions() { SortedSet<Integer> outputSet = new TreeSet<>(ProtocolRegistry.getSupportedVersions()); outputSet.removeAll(Via.getPlatform().getConf().getBlockedProtocols()); return outputSet; }
public static void init() { if (!Via.getConfig().isServersideBlockConnections()) return; Via.getPlatform().getLogger().info("Loading block connection mappings ..."); JsonObject mapping1_13 = MappingData.loadData("mapping-1.13.json"); if (!Via.getConfig().isReduceBlockStorageMemory()) { JsonObject mappingBlockConnections = MappingData.loadData("blockConnections.json"); for (Entry<String, JsonElement> entry : mappingBlockConnections.entrySet()) { TripwireConnectionHandler.init(); if (Via.getConfig().getBlockConnectionMethod().equalsIgnoreCase("packet")) { Via.getManager().getProviders().register(BlockConnectionProvider.class, new PacketBlockConnectionProvider());
public static EntityType getTypeFromId(int typeID, boolean isObject) { Optional<EntityType> type; if (isObject) type = ObjectType.getPCEntity(typeID); else type = EntityType.findById(typeID); if (!type.isPresent()) { if (!Via.getConfig().isSuppressMetadataErrors()) ViaBackwards.getPlatform().getLogger().severe("[EntityType1_10] Could not find type id " + typeID + " isObject=" + isObject); return EntityType.ENTITY; // Fall back to the basic ENTITY } return type.get(); }
@Override public boolean execute(ViaCommandSender sender, String[] args) { ConfigurationProvider provider = Via.getPlatform().getConfigurationProvider(); boolean newValue = !Via.getConfig().isCheckForUpdates(); provider.set("checkforupdates", newValue); provider.saveConfig(); sendMessage(sender, "&6We will %snotify you about updates.", (newValue ? "&a" : "&cnot ")); return true; } }
if (entityID != getProvidedEntityId() && Via.getConfig().isShieldBlocking()) { if ((data & 0x10) == 0x10) { if (validBlocking.contains(entityID)) { if (type == Entity1_10Types.EntityType.ARMOR_STAND && Via.getConfig().isHologramPatch()) { if (metadata.getId() == 0 && getMetaByIndex(metadataList, 10) != null) { Metadata meta = getMetaByIndex(metadataList, 10); //Only happens if the armorstand is small wrapper.write(Type.VAR_INT, entityID); wrapper.write(Type.SHORT, (short) 0); wrapper.write(Type.SHORT, (short) (128D * (Via.getConfig().getHologramYOffset() * 32D))); wrapper.write(Type.SHORT, (short) 0); wrapper.write(Type.BOOLEAN, true); if (Via.getConfig().isBossbarPatch()) { if (type == Entity1_10Types.EntityType.ENDER_DRAGON || type == Entity1_10Types.EntityType.WITHER) { if (metadata.getId() == 2) { bar.setTitle(title); } else if (metadata.getId() == 6 && !Via.getConfig().isBossbarAntiflicker()) { // If anti flicker is enabled, don't update health BossBar bar = bossBarMap.get(entityID);
if (type.is(EntityType.ARMOR_STAND) && Via.getConfig().isHologramPatch()) { Optional<Metadata> flags = getById(metadatas, 11); Optional<Metadata> customName = getById(metadatas, 2); wrapper.write(Type.VAR_INT, entityId); wrapper.write(Type.SHORT, (short) 0); wrapper.write(Type.SHORT, (short) (128D * (-Via.getConfig().getHologramYOffset() * 32D))); wrapper.write(Type.SHORT, (short) 0); wrapper.write(Type.BOOLEAN, true); if (!Via.getConfig().isSuppressMetadataErrors() || Via.getManager().isDebug()) { Via.getPlatform().getLogger().warning("An error occurred with entity metadata handler"); Via.getPlatform().getLogger().warning("Metadata: " + metadata);
Via.getManager().getProviders().use(InventoryQuickMoveProvider.class, new BukkitInventoryQuickMoveProvider()); if (Via.getConfig().getBlockConnectionMethod().equalsIgnoreCase("world")) { Via.getManager().getProviders().use(BlockConnectionProvider.class, new BukkitBlockConnectionProvider());
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) public void onDeath(PlayerDeathEvent e) { Player p = e.getEntity(); if (isOnPipe(p) && ViaVersion.getConfig().isShowNewDeathMessages() && checkGamerule(p.getWorld()) && e.getDeathMessage() != null) sendPacket(p, e.getDeathMessage()); }
public void init() { if (System.getProperty("ViaVersion") != null) { // Reload? platform.onReload(); } // Check for updates if (platform.getConf().isCheckForUpdates()) UpdateUtil.sendUpdateMessage(); // Force class load ProtocolRegistry.getSupportedVersions(); // Inject try { injector.inject(); } catch (Exception e) { getPlatform().getLogger().severe("ViaVersion failed to inject:"); e.printStackTrace(); return; } // Mark as injected System.setProperty("ViaVersion", getPlatform().getPluginVersion()); // If successful platform.runSync(new Runnable() { @Override public void run() { onServerLoaded(); } }); }
if (Via.getConfig().getBlockConnectionMethod().equalsIgnoreCase("world")) { Via.getManager().getProviders().use(BlockConnectionProvider.class, new SpongeBlockConnectionProvider());
@Listener(order = Order.LAST) public void onDeath(DestructEntityEvent.Death e) { if (!(e.getTargetEntity() instanceof Player)) return; Player p = (Player) e.getTargetEntity(); if (isOnPipe(p.getUniqueId()) && Via.getConfig().isShowNewDeathMessages() && checkGamerule(p.getWorld())) { sendPacket(p, e.getMessage().toPlain()); } }
@EventHandler public void onJoin(PostLoginEvent e) { if (e.getPlayer().hasPermission("viaversion.update") && Via.getConfig().isCheckForUpdates()) { UpdateUtil.sendUpdateMessage(e.getPlayer().getUniqueId()); } } }
@Override public SortedSet<Integer> getSupportedVersions() { SortedSet<Integer> outputSet = new TreeSet<>(ProtocolRegistry.getSupportedVersions()); outputSet.removeAll(Via.getPlatform().getConf().getBlockedProtocols()); return outputSet; }
public static EntityType getTypeFromId(int typeID, boolean isObject) throws Exception { Optional<EntityType> type; if (isObject) type = ObjectType.getPCEntity(typeID); else type = EntityType.findById(typeID); if (!type.isPresent()) { if (!Via.getConfig().isSuppressMetadataErrors()) ViaBackwards.getPlatform().getLogger().severe("[EntityType1_12] Could not find type id " + typeID + " isObject=" + isObject); return EntityType.ENTITY; // Fall back to the basic ENTITY } return type.get(); }
@Listener public void onJoin(ClientConnectionEvent.Join join) { if (join.getTargetEntity().hasPermission("viaversion.update") && Via.getConfig().isCheckForUpdates()) { UpdateUtil.sendUpdateMessage(join.getTargetEntity().getUniqueId()); } } }
@Override public SortedSet<Integer> getSupportedVersions() { SortedSet<Integer> outputSet = new TreeSet<>(ProtocolRegistry.getSupportedVersions()); outputSet.removeAll(Via.getPlatform().getConf().getBlockedProtocols()); return outputSet; }
public static EntityType getTypeFromId(int typeID, boolean isObject) throws Exception { Optional<EntityType> type; if (isObject) type = ObjectType.getPCEntity(typeID); else type = EntityType.findById(typeID); if (!type.isPresent()) { if (!Via.getConfig().isSuppressMetadataErrors()) ViaBackwards.getPlatform().getLogger().severe("[EntityType1_11] Could not find type id " + typeID + " isObject=" + isObject); return EntityType.ENTITY; // Fall back to the basic ENTITY } return type.get(); }
@EventHandler public void onJoin(PlayerJoinEvent e) { if (e.getPlayer().hasPermission("viaversion.update") && Via.getConfig().isCheckForUpdates()) { UpdateUtil.sendUpdateMessage(e.getPlayer().getUniqueId()); } } }
@Override public SortedSet<Integer> getSupportedVersions() { SortedSet<Integer> outputSet = new TreeSet<>(ProtocolRegistry.getSupportedVersions()); outputSet.removeAll(Via.getPlatform().getConf().getBlockedProtocols()); return outputSet; }
public static void handleMetadata(int entityId, Entity1_12Types.EntityType type, List<Metadata> metadatas, UserConnection connection) { for (Metadata metadata : new ArrayList<>(metadatas)) { try { if (metadata.getValue() instanceof Item) { // Apply rewrite BedRewriter.toClientItem((Item) metadata.getValue()); } // Evocation Illager aggressive property became 13 if (type.is(Entity1_12Types.EntityType.EVOCATION_ILLAGER)) { if (metadata.getId() == 12) { metadata.setId(13); } } } catch (Exception e) { metadatas.remove(metadata); if (!Via.getConfig().isSuppressMetadataErrors() || Via.getManager().isDebug()) { Via.getPlatform().getLogger().warning("An error occurred with entity metadata handler"); Via.getPlatform().getLogger().warning("Metadata: " + metadata); e.printStackTrace(); } } } } }