{"id":25546,"date":"2022-12-11T00:21:30","date_gmt":"2022-12-10T18:51:30","guid":{"rendered":"https:\/\/jassweb.com\/solved\/solved-javainvalid-value-for-getint\/"},"modified":"2022-12-11T00:21:30","modified_gmt":"2022-12-10T18:51:30","slug":"solved-javainvalid-value-for-getint","status":"publish","type":"post","link":"https:\/\/jassweb.com\/solved\/solved-javainvalid-value-for-getint\/","title":{"rendered":"[Solved] JavaInvalid value for getInt()"},"content":{"rendered":"<p> [ad_1]<br \/>\n<\/p>\n<div id=\"answer-45631375\" class=\"answer js-answer accepted-answer js-accepted-answer\" data-answerid=\"45631375\" data-parentid=\"45622660\" data-score=\"2\" data-position-on-page=\"1\" data-highest-scored=\"1\" data-question-has-accepted-highest-score=\"1\" itemprop=\"acceptedAnswer\" itemscope itemtype=\"https:\/\/schema.org\/Answer\">\n<div class=\"post-layout\">\n<div class=\"votecell post-layout--left\"><\/div>\n<div class=\"answercell post-layout--right\">\n<div class=\"s-prose js-post-body\" itemprop=\"text\">\n<p>First of all, don&#8217;t do mysql query in the event, that make the server lag.<\/p>\n<p>You have to create hashmap with the data you want to link to mysql server and do a scheduler Async task that do the query.<\/p>\n<p>Example:<\/p>\n<pre><code>package test;\n\nimport java.sql.DriverManager;\nimport java.sql.SQLException;\nimport java.util.Map.Entry;\nimport java.util.UUID;\nimport java.util.concurrent.ConcurrentHashMap;\n\nimport org.bukkit.entity.Player;\nimport org.bukkit.entity.Zombie;\nimport org.bukkit.event.EventHandler;\nimport org.bukkit.event.Listener;\nimport org.bukkit.event.entity.EntityDeathEvent;\nimport org.bukkit.plugin.java.JavaPlugin;\nimport org.bukkit.scheduler.BukkitRunnable;\n\nimport com.mysql.jdbc.Connection;\n\npublic class Event extends JavaPlugin implements Listener {\n\n    \/\/ Mysql update data\n    public static ConcurrentHashMap&lt;UUID, Integer&gt; player_zombiekills = new ConcurrentHashMap&lt;UUID, Integer&gt;();\n\n    \/\/ Mysql connection data\n    public static Connection connection;\n    private String host = \"localhost\";\n    private String database = \"DB\";\n    private String username = \"user\";\n    private String password = \"123\";\n    private int port = 3306;\n\n    \/\/Kill zombie event\n    @EventHandler\n    public void zombieDeath(EntityDeathEvent eve) {\n        if (!(eve.getEntity() instanceof Zombie)) return; \/\/ Stop if death is not zombie\n        if (!(eve.getEntity().getKiller() instanceof Player)) return; \/\/ Stop if killer is not player\n        UUID uid = eve.getEntity().getKiller().getUniqueId(); \/\/ Save player uuid\n        if (player_zombiekills.contains(uid)) player_zombiekills.put(uid, 0); \/\/ Set kills 0 if not exist in hashmap\n        player_zombiekills.put(uid, player_zombiekills.get(uid) + 1); \/\/ plus 1 kills value\n    }\n\n    \/\/On enable connection\n    public void onEnable() {\n        try {\n            if (connection != null &amp;&amp; !connection.isClosed()) return;\n            Class.forName(\"com.mysql.jdbc.Driver\");\n            connection = (Connection) DriverManager.getConnection(\"jdbc:mysql:\/\/\" + host + \":\" + port + \"https:\/\/stackoverflow.com\/\" + database, username, password);\n            if (!connection.isClosed()) System.out.println(\"[MySQL] \" + \"Connected to '\" + database + \"'\");\n        } catch (Exception e) {\n            System.err.println(\"[MySQL] \" + e.getMessage());\n        }\n\n        new BukkitRunnable() {\n            public void run() {\n                \/\/ for updates\n                for (Entry&lt;UUID, Integer&gt; ent : player_zombiekills.entrySet()) {\n                    try {\n                        \/\/ send update\n                        connection.createStatement().executeUpdate(\"UPDATE `tablename` SET `zombiekills`=`zombiekills`+\" + ent.getValue() + \" WHERE `uuid`='\" + ent.getKey().toString() + \"'\");\n                        \/\/ Sucess remove entry from hashmap to reset kills\n                        player_zombiekills.remove(ent.getKey());\n                    } catch (SQLException e) { \/\/ If error\n                        System.err.println(\"[MySQL] \" + e.getMessage()); \/\/ Print error in console\n                    }\n                }\n            }\n        }.runTaskTimerAsynchronously(this, 20, 20 * 60 * 10); \/\/ Run async loop every 10 minutes\n    }\n}\n<\/code><\/pre>\n<\/p><\/div>\n<div class=\"mt24\"><\/div>\n<\/div>\n<p>            <span class=\"d-none\" itemprop=\"commentCount\"><\/span> <\/p><\/div>\n<\/div>\n<p>[ad_2]<\/p>\n<p>solved JavaInvalid value for getInt() <\/p>\n","protected":false},"excerpt":{"rendered":"<p>[ad_1] First of all, don&#8217;t do mysql query in the event, that make the server lag. You have to create hashmap with the data you want to link to mysql server and do a scheduler Async task that do the query. Example: package test; import java.sql.DriverManager; import java.sql.SQLException; import java.util.Map.Entry; import java.util.UUID; import java.util.concurrent.ConcurrentHashMap; import &#8230; <a title=\"[Solved] JavaInvalid value for getInt()\" class=\"read-more\" href=\"https:\/\/jassweb.com\/solved\/solved-javainvalid-value-for-getint\/\" aria-label=\"More on [Solved] JavaInvalid value for getInt()\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[320],"tags":[1706,323,1705,340],"class_list":["post-25546","post","type-post","status-publish","format-standard","hentry","category-solved","tag-bukkit","tag-java","tag-minecraft","tag-mysql"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>[Solved] JavaInvalid value for getInt() - JassWeb<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/jassweb.com\/solved\/solved-javainvalid-value-for-getint\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"[Solved] JavaInvalid value for getInt() - JassWeb\" \/>\n<meta property=\"og:description\" content=\"[ad_1] First of all, don&#8217;t do mysql query in the event, that make the server lag. You have to create hashmap with the data you want to link to mysql server and do a scheduler Async task that do the query. Example: package test; import java.sql.DriverManager; import java.sql.SQLException; import java.util.Map.Entry; import java.util.UUID; import java.util.concurrent.ConcurrentHashMap; import ... Read more\" \/>\n<meta property=\"og:url\" content=\"https:\/\/jassweb.com\/solved\/solved-javainvalid-value-for-getint\/\" \/>\n<meta property=\"og:site_name\" content=\"JassWeb\" \/>\n<meta property=\"article:published_time\" content=\"2022-12-10T18:51:30+00:00\" \/>\n<meta name=\"author\" content=\"Kirat\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Kirat\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/jassweb.com\/solved\/solved-javainvalid-value-for-getint\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/jassweb.com\/solved\/solved-javainvalid-value-for-getint\/\"},\"author\":{\"name\":\"Kirat\",\"@id\":\"https:\/\/jassweb.com\/solved\/#\/schema\/person\/65c9c7b7958150c0dc8371fa35dd7c31\"},\"headline\":\"[Solved] JavaInvalid value for getInt()\",\"datePublished\":\"2022-12-10T18:51:30+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/jassweb.com\/solved\/solved-javainvalid-value-for-getint\/\"},\"wordCount\":54,\"publisher\":{\"@id\":\"https:\/\/jassweb.com\/solved\/#organization\"},\"keywords\":[\"bukkit\",\"java\",\"minecraft\",\"mysql\"],\"articleSection\":[\"Solved\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/jassweb.com\/solved\/solved-javainvalid-value-for-getint\/\",\"url\":\"https:\/\/jassweb.com\/solved\/solved-javainvalid-value-for-getint\/\",\"name\":\"[Solved] JavaInvalid value for getInt() - JassWeb\",\"isPartOf\":{\"@id\":\"https:\/\/jassweb.com\/solved\/#website\"},\"datePublished\":\"2022-12-10T18:51:30+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/jassweb.com\/solved\/solved-javainvalid-value-for-getint\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/jassweb.com\/solved\/solved-javainvalid-value-for-getint\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/jassweb.com\/solved\/solved-javainvalid-value-for-getint\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/jassweb.com\/solved\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"[Solved] JavaInvalid value for getInt()\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/jassweb.com\/solved\/#website\",\"url\":\"https:\/\/jassweb.com\/solved\/\",\"name\":\"JassWeb\",\"description\":\"Build High-quality Websites\",\"publisher\":{\"@id\":\"https:\/\/jassweb.com\/solved\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/jassweb.com\/solved\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/jassweb.com\/solved\/#organization\",\"name\":\"Jass Web\",\"url\":\"https:\/\/jassweb.com\/solved\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/jassweb.com\/solved\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/jassweb.com\/wp-content\/uploads\/2021\/02\/jass-website-logo-1.png\",\"contentUrl\":\"https:\/\/jassweb.com\/wp-content\/uploads\/2021\/02\/jass-website-logo-1.png\",\"width\":693,\"height\":132,\"caption\":\"Jass Web\"},\"image\":{\"@id\":\"https:\/\/jassweb.com\/solved\/#\/schema\/logo\/image\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\/\/jassweb.com\/solved\/#\/schema\/person\/65c9c7b7958150c0dc8371fa35dd7c31\",\"name\":\"Kirat\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/jassweb.com\/solved\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/jassweb.com\/solved\/wp-content\/litespeed\/avatar\/1261af3c9451399fa1336d28b98ea3bb.jpg?ver=1776403586\",\"contentUrl\":\"https:\/\/jassweb.com\/solved\/wp-content\/litespeed\/avatar\/1261af3c9451399fa1336d28b98ea3bb.jpg?ver=1776403586\",\"caption\":\"Kirat\"},\"sameAs\":[\"http:\/\/jassweb.com\"],\"url\":\"https:\/\/jassweb.com\/solved\/author\/jaspritsinghghumangmail-com\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"[Solved] JavaInvalid value for getInt() - JassWeb","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/jassweb.com\/solved\/solved-javainvalid-value-for-getint\/","og_locale":"en_US","og_type":"article","og_title":"[Solved] JavaInvalid value for getInt() - JassWeb","og_description":"[ad_1] First of all, don&#8217;t do mysql query in the event, that make the server lag. You have to create hashmap with the data you want to link to mysql server and do a scheduler Async task that do the query. Example: package test; import java.sql.DriverManager; import java.sql.SQLException; import java.util.Map.Entry; import java.util.UUID; import java.util.concurrent.ConcurrentHashMap; import ... Read more","og_url":"https:\/\/jassweb.com\/solved\/solved-javainvalid-value-for-getint\/","og_site_name":"JassWeb","article_published_time":"2022-12-10T18:51:30+00:00","author":"Kirat","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Kirat","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/jassweb.com\/solved\/solved-javainvalid-value-for-getint\/#article","isPartOf":{"@id":"https:\/\/jassweb.com\/solved\/solved-javainvalid-value-for-getint\/"},"author":{"name":"Kirat","@id":"https:\/\/jassweb.com\/solved\/#\/schema\/person\/65c9c7b7958150c0dc8371fa35dd7c31"},"headline":"[Solved] JavaInvalid value for getInt()","datePublished":"2022-12-10T18:51:30+00:00","mainEntityOfPage":{"@id":"https:\/\/jassweb.com\/solved\/solved-javainvalid-value-for-getint\/"},"wordCount":54,"publisher":{"@id":"https:\/\/jassweb.com\/solved\/#organization"},"keywords":["bukkit","java","minecraft","mysql"],"articleSection":["Solved"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/jassweb.com\/solved\/solved-javainvalid-value-for-getint\/","url":"https:\/\/jassweb.com\/solved\/solved-javainvalid-value-for-getint\/","name":"[Solved] JavaInvalid value for getInt() - JassWeb","isPartOf":{"@id":"https:\/\/jassweb.com\/solved\/#website"},"datePublished":"2022-12-10T18:51:30+00:00","breadcrumb":{"@id":"https:\/\/jassweb.com\/solved\/solved-javainvalid-value-for-getint\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/jassweb.com\/solved\/solved-javainvalid-value-for-getint\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/jassweb.com\/solved\/solved-javainvalid-value-for-getint\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/jassweb.com\/solved\/"},{"@type":"ListItem","position":2,"name":"[Solved] JavaInvalid value for getInt()"}]},{"@type":"WebSite","@id":"https:\/\/jassweb.com\/solved\/#website","url":"https:\/\/jassweb.com\/solved\/","name":"JassWeb","description":"Build High-quality Websites","publisher":{"@id":"https:\/\/jassweb.com\/solved\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/jassweb.com\/solved\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/jassweb.com\/solved\/#organization","name":"Jass Web","url":"https:\/\/jassweb.com\/solved\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/jassweb.com\/solved\/#\/schema\/logo\/image\/","url":"https:\/\/jassweb.com\/wp-content\/uploads\/2021\/02\/jass-website-logo-1.png","contentUrl":"https:\/\/jassweb.com\/wp-content\/uploads\/2021\/02\/jass-website-logo-1.png","width":693,"height":132,"caption":"Jass Web"},"image":{"@id":"https:\/\/jassweb.com\/solved\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/jassweb.com\/solved\/#\/schema\/person\/65c9c7b7958150c0dc8371fa35dd7c31","name":"Kirat","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/jassweb.com\/solved\/#\/schema\/person\/image\/","url":"https:\/\/jassweb.com\/solved\/wp-content\/litespeed\/avatar\/1261af3c9451399fa1336d28b98ea3bb.jpg?ver=1776403586","contentUrl":"https:\/\/jassweb.com\/solved\/wp-content\/litespeed\/avatar\/1261af3c9451399fa1336d28b98ea3bb.jpg?ver=1776403586","caption":"Kirat"},"sameAs":["http:\/\/jassweb.com"],"url":"https:\/\/jassweb.com\/solved\/author\/jaspritsinghghumangmail-com\/"}]}},"_links":{"self":[{"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/posts\/25546","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/comments?post=25546"}],"version-history":[{"count":0,"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/posts\/25546\/revisions"}],"wp:attachment":[{"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/media?parent=25546"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/categories?post=25546"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/tags?post=25546"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}