Repository navigation
Expand file tree
/
Copy pathInvGUI.java
More file actions
92 lines (77 loc) · 2.45 KB
/
Copy pathInvGUI.java
File metadata and controls
92 lines (77 loc) · 2.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
package top.n0rthmaster123.shadeac.gui;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import java.util.ArrayList;
import java.util.List;
public class InvGUI {
Inventory inv;
public InvGUI(){
}
public InvGUI create(int hight,int width,String name){
inv = Bukkit.createInventory( null ,hight*width,name );
return this;
}
public InvGUI create(Inventory inv) {
this.inv = inv;
return this;
}
public Inventory getInventory(){
return inv;
}
public InvGUI addItem(ItemStack stack,int index){
this.inv.setItem(index,stack);
return this;
}
public InvGUI addItem(Material material,String name,int amount,List list,int index){
ItemStack stack;
stack = new ItemStack(material);
stack.setAmount( amount );
ItemMeta meta = stack.getItemMeta( );
meta.setDisplayName( name );
meta.setLore( list );
stack.setItemMeta( meta );
addItem(stack , index);
return this;
}
public InvGUI addItem(Material material,String name,int amount,int index){
ItemStack stack;
stack = new ItemStack(material);
stack.setAmount( amount );
ItemMeta meta = stack.getItemMeta( );
meta.setDisplayName( name );
stack.setItemMeta( meta );
addItem(stack , index);
return this;
}
public InvGUI addItem(ItemStack stack,String name,int amount,int index){
ItemStack newStack = stack.clone();
newStack.setAmount( amount );
ItemMeta meta = newStack.getItemMeta();
meta.setDisplayName(name);
newStack.setItemMeta(meta);
this.inv.setItem(index,newStack);
return this;
}
public InvGUI addItem(ItemStack stack,String name,int amount,List list,int index){
ItemStack newStack = stack.clone();
newStack.setAmount( amount );
ItemMeta meta = newStack.getItemMeta();
meta.setDisplayName(name);
meta.setLore(list);
newStack.setItemMeta(meta);
this.inv.setItem(index,newStack);
return this;
}
@Deprecated
public List getAsList(String str){
List list = new ArrayList();
String[] strx = str.split( "\n" );
for( String string : strx ){
list.add( string );
}
return list;
}
}