plugin/src/main/java/us/camin/api/events/VaultSlot.java
2023-07-01 19:57:42 +02:00

46 lines
1.4 KiB
Java

package us.camin.api.events;
/*
This file is part of Caminus
Caminus is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Caminus is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Caminus. If not, see <http://www.gnu.org/licenses/>.
*/
import org.json.*;
import java.util.*;
public class VaultSlot {
public String name;
public int durability;
public int position;
public int material;
public int data;
public int damage;
public int quantity;
public static VaultSlot fromJSON(JSONObject obj) throws JSONException {
VaultSlot ret = new VaultSlot();
try {
ret.name = obj.getString("name");
} catch (JSONException e) {}
try {
ret.durability = obj.getInt("durability");
} catch (JSONException e) {}
ret.position = obj.getInt("position");
ret.material = obj.getInt("material");
ret.data = obj.getInt("data");
ret.damage = obj.getInt("damage");
ret.quantity = obj.getInt("quantity");
return ret;
}
}