/[projects]/miscJava/bukkit-minecraft-plugins/CreativeWorld/src/main/java/dk/thoerup/bukkit/creativeworld/WorldChanged.java
ViewVC logotype

Diff of /miscJava/bukkit-minecraft-plugins/CreativeWorld/src/main/java/dk/thoerup/bukkit/creativeworld/WorldChanged.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

miscJava/bukkit-minecraft-plugins/CreativeWorld/src/dk/thoerup/bukkit/creativeworld/WorldChanged.java revision 1681 by torben, Wed Jan 25 22:03:19 2012 UTC miscJava/bukkit-minecraft-plugins/CreativeWorld/src/main/java/dk/thoerup/bukkit/creativeworld/WorldChanged.java revision 1713 by torben, Tue Mar 6 16:58:13 2012 UTC
# Line 21  public class WorldChanged implements Lis Line 21  public class WorldChanged implements Lis
21                  this.plugin = plugin;                  this.plugin = plugin;
22          }          }
23    
24    
25            @EventHandler
26            public void onPlayerExpChange(PlayerExpChangeEvent event) {
27                    if (event.getPlayer().getWorld().getName().equalsIgnoreCase("creative")) {
28                            event.setAmount(0); //users don't acummulate xp points in creative mode
29                    }      
30            }
31    
32          @EventHandler          @EventHandler
33          public void onPlayerChangedWorld(PlayerChangedWorldEvent event) {          public void onPlayerChangedWorld(PlayerChangedWorldEvent event) {
34    
# Line 88  public class WorldChanged implements Lis Line 96  public class WorldChanged implements Lis
96    
97    
98          public void saveItemStack(Configuration config, String node, ItemStack stack) {          public void saveItemStack(Configuration config, String node, ItemStack stack) {
99                  config.set(node + STACK_TYPE, stack.getTypeId() );                  int type = 0;
100                  config.set(node + STACK_AMOUNT, stack.getAmount() );                  int amount = 0;
101                  config.set(node + STACK_DAMAGE, (int)stack.getDurability() );                  int damage = 0;
102                  config.set(node + STACK_DATA, (int)stack.getData().getData() );                  int data = 0;
103    
104                    if (stack != null) {
105                            type = stack.getTypeId();
106                            amount = stack.getAmount();
107                            damage = stack.getDurability();
108                            data = stack.getData().getData();
109                    }
110    
111                    config.set(node + STACK_TYPE, type );
112                    config.set(node + STACK_AMOUNT, amount );
113                    config.set(node + STACK_DAMAGE, damage );
114                    config.set(node + STACK_DATA, data );
115          }          }
116    
117          public ItemStack getItemStack(Configuration config, String node) {          public ItemStack getItemStack(Configuration config, String node) {

Legend:
Removed from v.1681  
changed lines
  Added in v.1713

  ViewVC Help
Powered by ViewVC 1.1.20