RuneHive-Tarnish
Neural OSRS Enhancement Framework
Loading...
Searching...
No Matches
ItemDBdefUpdate.java
1package com.osroyale.util.tools;
2
3import com.jcabi.jdbc.JdbcSession;
4import com.osroyale.game.service.PostgreService;
5import com.osroyale.game.world.items.ItemDefinition;
6
26
27public class ItemDBdefUpdate {
28
29 public static void main(String[] args) {
30 String query = "INSERT INTO lookup.item_lookup(id, name, value) VALUES (?, ?, ?) ON CONFLICT (id) DO UPDATE SET id = excluded.id, name = excluded.name, value = excluded.value";
31
32 ItemDefinition.createParser().run();
33
34 try {
35 JdbcSession session = new JdbcSession(PostgreService.getConnectionPool()).autocommit(false);
36 System.out.println("Starting");
37
38 for (int index = 21708; index < ItemDefinition.DEFINITIONS.length; index++) {
39 ItemDefinition definition = ItemDefinition.get(index);
40
41 if (definition.getName() != null && !definition.getName().equals("null")) {
42 continue;
43 }
44
45 session
46 .sql(query)
47 .set(definition.getId())
48 .set(definition.getName())
49 .set(definition.getValue())
50 .execute();
51 }
52
53 session.commit();
54 System.out.println("Success");
55 } catch (Exception e) {
56 e.printStackTrace();
57 }
58 }
59
60}