From 4571214edd2fbf409bdf926b87052d860ae38ce5 Mon Sep 17 00:00:00 2001 From: "Piotr (DaAmazingShit)" Date: Fri, 21 Dec 2018 13:50:18 +0100 Subject: [PATCH] v2.1.1 Removed Bukkit's configuration code --- README.md | 4 +- bin/bukkit/util/config/Configuration.class | Bin 4319 -> 0 bytes .../util/config/ConfigurationException.class | Bin 537 -> 0 bytes .../util/config/ConfigurationNode.class | Bin 10312 -> 0 bytes ...tyNullRepresenter$EmptyRepresentNull.class | Bin 1035 -> 0 bytes .../util/config/EmptyNullRepresenter.class | Bin 2264 -> 0 bytes .../bukkitversion/BukkitVersion.class | Bin 8250 -> 8250 bytes bin/pl/moresteck/multiworld/MConfig.class | Bin 2034 -> 1991 bytes .../multiworld/world/MWorldConfig.class | Bin 8277 -> 8099 bytes changelog.txt | 4 +- src/bukkit/util/config/Configuration.java | 231 ------- .../util/config/ConfigurationException.java | 18 - src/bukkit/util/config/ConfigurationNode.java | 587 ------------------ .../bukkitversion/BukkitVersion.java | 4 +- src/pl/moresteck/bukkitversion/Config.java | 143 +++++ src/pl/moresteck/multiworld/MConfig.java | 10 +- src/pl/moresteck/multiworld/Perm.java | 2 +- .../multiworld/nether/NetherListener.java | 7 +- .../moresteck/multiworld/portal/Portal.java | 30 +- .../multiworld/world/MWorldConfig.java | 82 +-- 20 files changed, 196 insertions(+), 926 deletions(-) delete mode 100644 bin/bukkit/util/config/Configuration.class delete mode 100644 bin/bukkit/util/config/ConfigurationException.class delete mode 100644 bin/bukkit/util/config/ConfigurationNode.class delete mode 100644 bin/bukkit/util/config/EmptyNullRepresenter$EmptyRepresentNull.class delete mode 100644 bin/bukkit/util/config/EmptyNullRepresenter.class delete mode 100644 src/bukkit/util/config/Configuration.java delete mode 100644 src/bukkit/util/config/ConfigurationException.java delete mode 100644 src/bukkit/util/config/ConfigurationNode.java create mode 100644 src/pl/moresteck/bukkitversion/Config.java diff --git a/README.md b/README.md index 7f4ab4a..8516817 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # MultiWorld Multi-world plugin for Bukkit with compatibility from **b1.2_01** to **1.1-R3** (**_confirmed_** compatibility) -## Stable version: [2.1.0](https://github.com/Moresteck/MultiWorld/releases/tag/2.1.0/) +## Stable version: [2.1.1](https://github.com/Moresteck/MultiWorld/releases/tag/2.1.1/) -## Development version: 2.1.1 \ No newline at end of file +## Development version: 2.1.2 \ No newline at end of file diff --git a/bin/bukkit/util/config/Configuration.class b/bin/bukkit/util/config/Configuration.class deleted file mode 100644 index 09cc894f95ab1dd9019b719a5c877c5c147a1261..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4319 zcmb7H?ROMc9e(b zX|SzgtG1$8Yf)<}6``b6w16Zz$DC9Agy;BA_&@krjnBQayP3eA!|}t;%)R$_f3MH; zyLbQb-@kqVU^o7v!6OiyC{9nO?O4%HXJW}*_H24G)~#Me%dpeAtOlPz>yxAgb1756 zH)qUb1X|)bYceLkV}-0SZK|&Xhn*BTo6b;jL;Rd^!HA`Ev0jcjUo&MIDbo^Ya8@!# zb}}|%Tj}hiT-~3}rtJd)^=)f6hQ_F}o5nTNaaAc*q4XJrsR1J&zy{RocnS>y-nP(K z0A6g8<0e`v=~D8P?F@~rgTR+`tV2LU3zJhNj-KL7-n54DGB` zlb|Y(1BjqrLrmbgD!4i_legyviQ zc2M}VarQr}u=B8MGHea;KC)1b-;2^qW z9(4^ptU(o}6eAg9$Fu1qxizdt0d%8RZu^$N=2aTH6f-NbM*TVt;6*l#RUt=1XUN6v zp^0;5(k5I5;yMN}NY|xVfu_6U@k|3)j8@a{FQ-?>NqaR?oVcN z1$KpTvY?!Y{-GnUCQX%14GDqJld@kCX9ps9nLF9s%Iak2az`&9SnsCFy2~8P7xMV%fOqm|?MJNpMha zIlA&eC%3<&@YvZ12wBI{*zY51AIma>R@dE82~J=WsqMEvp5 z-u8U~T){6SOW!BtRtf0d)A?A96mhTMm$JgY;z{K$Z1nou zAL#fEK4eByJQ@XdxObQ6>sVaf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L5QV2EFDboUtwZMo-&F1@q c6}EmVRLQ)SDzrYSwF2>IVLLV7q3R6UAJZ*!Q2+n{ diff --git a/bin/bukkit/util/config/ConfigurationNode.class b/bin/bukkit/util/config/ConfigurationNode.class deleted file mode 100644 index bed44e8e8966336db86aa805dfc2589b02e31f7d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 10312 zcmb_i3w)L3dH=uPxg{qbAqh#~5YQlqxq`(Am|&;`ks!osAVP}DAvwU2a1u{WxKy{= z!nA9rZRt7-&b6|2tky}WHIOnXc21b9Ti4dE7gyWau63^4+@%+ar2prAzw@2%oSZ^% z{(y77@4Y;i|8set_c^?H{!1qTEKt)zuoUKO9@@S=o|-?DiucX$=}&BlZ=K(!zlM_0 zRJ=dY(cc>j!LLwqcXVfTeqS`Pb^a}z?~e7P6#U8letu0}t*11JHPL|Hi`7!0EsH%L4zQ>gF?kD)nVfnyoXQ?3=yhy z=UI@qDj#^CQ38!{)5!;a_xU+7Q_Y;Rf*dxEeq0NS>HAo_}Jz-ALd16E|;H1t}v}ZdV-AOn_bd~oc`v+pl z)Seu}rmf@=&XGX8B4%R?wi0Y6_*68WpmJ4Si?wZwCOc#I48;;Xv6kBI0>l-pjWl%= zw%h2#4u!zrKwq5bU*+AG=K5X_TW2hUeuWtssM`9XgM)3+!PJerdtw7}un^~gXlfe~ zqOX#{Ks1@6U{mrCBl46;weugTDjMoC56AJO8Fr*pH0XsZpWq%MX}9SL;dinU(aPxH zHl2v>Loub)am53UrZAdb+z<{Tl92b>*o+=IdsgK*va`q|ku&0TWDlhWZQPF!2+iNO z@jl#37<*$3cR5Si6Esw19z(U)w#$x(ZG03Tqf_?K9(r*WIB6(6vT#vsYb?pg-H$&E z;S*_ubPPI^l6gKUeA~Sudv`u!<5M^wX*ZGTlKe!WYieoLDS22KjFs^QHp^?5 zi#C5^XVz3O=O9k%fo_#EA=SId}D zNYW(#d9#7DjY85q%liBKVo~~kKBc;AyG5xZHimJO#6>B0!^O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(QCPv$W-b~CN1NfI*Pv*Dum{)cqjZw=%K$p*p*>sp-S-LWa#gUapb33jHEdw zM_~RGhfvMlsBZZ!4no6$g_?~r<{Z?~B$T}( zU@lNv_Ve*TCYxdqNrD^1p@_Cbq6&NBtQ18P)@Hr@1opU##*~uhA`^s1UhpTI-F9#S zm72Rq{XVbVIxgd?g)4-`Qv)}}(7`n-&WU1m~63GU-JkO(je1{yqO#=0Pg+cLvmK7W2gKs)P#9lg-|Ey6`COc0*&4Fy7@^BK-3Tyn2}!;KH@DB%d?rvX_w b44i;)3hv-8!<4XM;ytu^FG?epwu8!V33D7T diff --git a/bin/bukkit/util/config/EmptyNullRepresenter.class b/bin/bukkit/util/config/EmptyNullRepresenter.class deleted file mode 100644 index 121030f4c8a311c848e351faeab6c61127481867..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2264 zcmb_dYjYD-7=BK3*<`!DP(@vAp+JBn6c&r3CbddqQ6McXTccE*akC!d((P{83p4d+ z_^tl}nK2AHtES;34-S9wMM(Y*_2A5qj1dm%CtB z#@HjzkezWnCz@qQ6-y0Z49qS@A6)J{=rD2AtV!cm8 z)lwr5hEWasFvc+A-Jc|7SnoH*Dyi2Uk1xjSO&+XRO_wu_)qUG?8&=?m@2$gh^pO)X zl==>mLEl03l6A|Po@4oa4oN8Txs6mc2w;Zwc|yBAGYb*4~%W~ zYJa*O)haYrtX8$u%XIg8k%U&_w#%!ctOqnajb~Jht<5ulcS^Sv$Tb4CYb5aRtX1#uGItQ4J?hB(9qC%M1sTlNOk$ zC}T>&Nrs6;lft!zQ#ehHK>3jx!{nnf>l!ZLjE3hhO_UMA_4; z0@>FzoR_#QoL^EK$t4yMc6m*zw|0qn=+P>KS}No>iJ8fAd&@%d$CD-Zphbd1 zW@OoGbhb58a+YoLFf5#5__+V!m+VcDZ%+lxD4NVPEpJC)vIvl_gv<^$fZ%FW4jN&^yNoQJD3H$LBeWk?| z>>6YfWIRV_ynJ%%l%Bo|y^_&09Xwmf>e;VxcoUcJ;HaMMpwxk}30=>Ag|ih!S2}p% z9$seHM26kIgI6Drnd{2DzAK|=Zj+;w404)60)D_Ce#97l!U6n@B7T8^UonH|U-8?SHnIvNK4!K{LD1?8ioIl5ixLPf(jC9Nt1RR?d0WV(op;(&ev VX%WBxuE}*3@6x|up!i)!`actceQE#z diff --git a/bin/pl/moresteck/bukkitversion/BukkitVersion.class b/bin/pl/moresteck/bukkitversion/BukkitVersion.class index dab80e983b4be4c4405f63e07e8370c0e9817d38..60300c35ff258a877cdea7d0e9892c0b931491a1 100644 GIT binary patch delta 20 Ycmdnxu*+cs4s+=4i?44MW>l9409bJcu>b%7 diff --git a/bin/pl/moresteck/multiworld/MConfig.class b/bin/pl/moresteck/multiworld/MConfig.class index 4becacaf79838195b179949b20f75025b74ba111..4c19dc1aec654e855711c2cc56ba0e89b6b3fad0 100644 GIT binary patch delta 714 zcmah`OHUI~6#nka!1OT)sTQ=-3IPQQW_+NirBz!5g^CZbi0`4j9fl4wWI82r#cv?@ z2e>pbZos4vP27^WF|JKqx^&^rgb+_lTsxDQ`<;8f^PSi4_PzGdmxGU=0bGEy8JaBi z<=1R|)%AGQ=f#S?RI5}hf1P_(%XRde>y#}s#Sj=T+LmMa83uW9sKB7)+!9w2X6XHI z{MMGwm@dYonfQ5)@&*{R5-%Gy+n?ipZ7qaRTvl;OypcL%V;Cg&n&DM>)^%-eI6+)R zO2swtRT_}TkrscXk;HX|t`%e5&~3vp^*P_O95Y+9>=O3^xG8dSI*>t5!!b;VAFL}} z2qA+>4O6%+-pMI8Eq=-gqU1H)#jMbj{?_|=sN%t9TX!_?nkM%&%wd8$wVbl6;*l^F zi@gxvlxScSuQV7~62FuIt)zjYOmnGnfAgSMOt*w%%M3@jV=USH?6Ot$UGH@WA*^Vq zd~jQIw(%Vby+C>!Cz7m=k^Jx;!n-)9q~Bs_co!Gx?48}ll~2elMsDmNo2=tj+~ihdPb)$-8)2M={$lOy$rZT!*!=MI@=&MWi{Jev&y&wV%N$O4}$_qL0CDqSe2` Cn3dZA delta 764 zcmah`O;giQ6g@8qq_lC$RA@y?2Lz!7#wg-vDYdPFN(B@R;CE=#nl>giq|UhFFNj(C z1KhZw%mhYf9Cyt42VCmLjZ4?)cw0XfZp@px_q?2Q-n;j{z2LW?|HF?r?*L5T$)bC0WmYHPmO%)8?)SYPtKAun*gq&5>LN{&brUJ@Zs}_6J1m7 zbuDXIhNhYwn8LJ(l>43=;nTR_e&xnvS%yeOeX7caYL?|C$JWhqwyqmR&GzA>SBthg(J9#a`Q|Gl1|^(br(;ML!0y44x2h3;~J<(N41nB1|Yk@er*Z;+xuy zD2C97G-5QP0YphYO>(LStGG=$h)LWb#K^>B1b4xa?GMV(?$^KODfe)nm)Y3aOgka0ANkrbC1LF4jDhXaJ##@E3b9mbXaCwfYI8jqp(_ Wa2O%FIEFaw60Nd1Vi>HJw)PV}kD*`y diff --git a/bin/pl/moresteck/multiworld/world/MWorldConfig.class b/bin/pl/moresteck/multiworld/world/MWorldConfig.class index 9832cea1ee4c2cc277bce772033cc9300ec7d31f..90e3926fc758a3f76f4f074fe172f73831d05a51 100644 GIT binary patch literal 8099 zcmbVR33yyp75;A~nKzldrtLsl+J-K4$=VFvpfsi0l(e)>S|Hfkg4CDfHJN5I6J{m} z0To3ycV&~JB2~1AMGELNwOUz}MR8vdM8#ck!;QWEcbSr#O zyPOdx9Cc!S;mzH<+@6$xUx_9K=62+5);&Bh5J`==iDV=m3+p{v1p+I3qLEl6wMxKO z->^lXd`-O9wNNE6=eX-FOc1b@4Uu?wZ6xXjFi{{h6dmr1#FF7o>4361fXM~<69JKa&2wspjNoah!O5s~+5FbE%J%IyO5KGh##?3(jqcT6A{#L7N5 zrQGDwn)-$dij5ASLRvlF#sbs{SX{8t9g`@P@VP;+A5KN0;Vw7T8l*=JHX5aYlY0`b zlXBafWTZ!fScPV^SXd}9K}9dK%tjce(xYVLQuHED-~az zNH}8x_4QsabaJ)kd1l5eEEhPzD{PPxsBrXN{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uQ`U9g~fcFUz5W#oe}xo-N*1|I_K^9I9GiF zcj5#`PxA9qdeoi@eGtZ3bfL;XyCKLjEI0glmOAo70X5`}M!_d3$WI6Z z&z)ty$_G8fs6GeOKac4K?mtUrtS-z+o~f0uwiE_n=`3lSBJTN$!MxniAoEfIu+9V8 z13bqUunb@H;lELPX&L`M6!h?4E8k~bpt^hws;KU(RQENi`}!2>YPCAP4ZA>f`Kne? z-D6bueX9Gxxz&k~n6A`S&7?EwU{R}_+46ueZ^vwY)!mK|zh)glhEt`9?mO~}$|iMX z6*&>!(e@C`w$oy+z!6Maczodz%xPuE7f1Vjx#gM33V-3!@O z)W%@s30c&NMzMmST8rIcC9zUP?N^E>(M&MkR~UOVKgQlbUYhb!EtFDo^4CVrEk<3# z3+y5dUe&{*?ynFtN*|eNe3zuLc)iZF$P}5DXV_wOF1C{%-;0_2BjGG86|>PS!ah(& z@+V~HD(Q%qL(y8OgGsHoZ3?|Q!%M5*WYzUlJr|8)9$Ll4KGkgn)or3prJsmiuxbtc zbE|Hk>V;H&2~{teLUl~5zU+ckYv7+-^%AOHO4ZA#dii-&UoKXW@va~&szke2FK#?f zz;$l>+Oc9QrUJf_`kNT=W(GXs)9(woh;deUP*u%hgd;5;1g`wMEz${p4vX4oQIr - * For example, given the following configuration file:

- * - *
members:
- *     - Hollie
- *     - Jason
- *     - Bobo
- *     - Aya
- *     - Tetsu
- * worldguard:
- *     fire:
- *         spread: false
- *         blocks: [cloth, rock, glass]
- * sturmeh:
- *     cool: false
- *     eats:
- *         babies: true
- * - *

Calling code could access sturmeh's baby eating state by using - * getBoolean("sturmeh.eats.babies", false). For lists, there are - * methods such as getStringList that will return a type safe list. - * - *

This class is currently incomplete. It is not yet possible to get a node. - *

- * - */ -// Compatibility for 1.1-R4+ -public class Configuration extends ConfigurationNode { - private Yaml yaml; - private File file; - private String header = null; - - public Configuration(File file) { - super(new HashMap()); - - DumperOptions options = new DumperOptions(); - - options.setIndent(4); - options.setDefaultFlowStyle(DumperOptions.FlowStyle.BLOCK); - - yaml = new Yaml(new SafeConstructor(), new EmptyNullRepresenter(), options); - - this.file = file; - } - - /** - * Loads the configuration file. All errors are thrown away. - */ - public void load() { - FileInputStream stream = null; - - try { - stream = new FileInputStream(file); - read(yaml.load(new UnicodeReader(stream))); - } catch (IOException e) { - root = new HashMap(); - } catch (ConfigurationException e) { - root = new HashMap(); - } finally { - try { - if (stream != null) { - stream.close(); - } - } catch (IOException e) {} - } - } - - /** - * Set the header for the file as a series of lines that are terminated - * by a new line sequence. - * - * @param headerLines header lines to prepend - */ - public void setHeader(String... headerLines) { - StringBuilder header = new StringBuilder(); - - for (String line : headerLines) { - if (header.length() > 0) { - header.append("\r\n"); - } - header.append(line); - } - - setHeader(header.toString()); - } - - /** - * Set the header for the file. A header can be provided to prepend the - * YAML data output on configuration save. The header is - * printed raw and so must be manually commented if used. A new line will - * be appended after the header, however, if a header is provided. - * - * @param header header to prepend - */ - public void setHeader(String header) { - this.header = header; - } - - /** - * Return the set header. - * - * @return - */ - public String getHeader() { - return header; - } - - /** - * Saves the configuration to disk. All errors are clobbered. - * - * @param header header to prepend - * @return true if it was successful - */ - public boolean save() { - FileOutputStream stream = null; - - File parent = file.getParentFile(); - - if (parent != null) { - parent.mkdirs(); - } - - try { - stream = new FileOutputStream(file); - OutputStreamWriter writer = new OutputStreamWriter(stream, "UTF-8"); - if (header != null) { - writer.append(header); - writer.append("\r\n"); - } - yaml.dump(root, writer); - return true; - } catch (IOException e) {} finally { - try { - if (stream != null) { - stream.close(); - } - } catch (IOException e) {} - } - - return false; - } - - @SuppressWarnings("unchecked") - private void read(Object input) throws ConfigurationException { - try { - if (null == input) { - root = new HashMap(); - } else { - root = (Map) input; - } - } catch (ClassCastException e) { - throw new ConfigurationException("Root document must be an key-value structure"); - } - } - - /** - * This method returns an empty ConfigurationNode for using as a - * default in methods that select a node from a node list. - * @return - */ - public static ConfigurationNode getEmptyNode() { - return new ConfigurationNode(new HashMap()); - } -} - -class EmptyNullRepresenter extends Representer { - - public EmptyNullRepresenter() { - super(); - this.nullRepresenter = new EmptyRepresentNull(); - } - - protected class EmptyRepresentNull implements Represent { - public Node representData(Object data) { - return representScalar(Tag.NULL, ""); // Changed "null" to "" so as to avoid writing nulls - } - } - - // Code borrowed from snakeyaml (http://code.google.com/p/snakeyaml/source/browse/src/test/java/org/yaml/snakeyaml/issues/issue60/SkipBeanTest.java) - @Override - protected NodeTuple representJavaBeanProperty(Object javaBean, Property property, Object propertyValue, Tag customTag) { - NodeTuple tuple = super.representJavaBeanProperty(javaBean, property, propertyValue, customTag); - Node valueNode = tuple.getValueNode(); - if (valueNode instanceof CollectionNode) { - // Removed null check - if (Tag.SEQ.equals(valueNode.getTag())) { - SequenceNode seq = (SequenceNode) valueNode; - if (seq.getValue().isEmpty()) { - return null; // skip empty lists - } - } - if (Tag.MAP.equals(valueNode.getTag())) { - MappingNode seq = (MappingNode) valueNode; - if (seq.getValue().isEmpty()) { - return null; // skip empty maps - } - } - } - return tuple; - } - // End of borrowed code -} diff --git a/src/bukkit/util/config/ConfigurationException.java b/src/bukkit/util/config/ConfigurationException.java deleted file mode 100644 index 98de074..0000000 --- a/src/bukkit/util/config/ConfigurationException.java +++ /dev/null @@ -1,18 +0,0 @@ -package bukkit.util.config; - -/** - * Configuration exception. - * - * @author sk89q - */ -public class ConfigurationException extends Exception { - private static final long serialVersionUID = -2442886939908724203L; - - public ConfigurationException() { - super(); - } - - public ConfigurationException(String msg) { - super(msg); - } -} diff --git a/src/bukkit/util/config/ConfigurationNode.java b/src/bukkit/util/config/ConfigurationNode.java deleted file mode 100644 index ee783a6..0000000 --- a/src/bukkit/util/config/ConfigurationNode.java +++ /dev/null @@ -1,587 +0,0 @@ -package bukkit.util.config; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.TreeMap; - -/** - * Represents a configuration node. - */ -public class ConfigurationNode { - protected Map root; - - protected ConfigurationNode(Map root) { - this.root = root; - } - - /** - * Gets all of the cofiguration values within the Node as - * a key value pair, with the key being the full path and the - * value being the Object that is at the path. - * - * @return A map of key value pairs with the path as the key and the object as the value - */ - public Map getAll() { - return recursiveBuilder(root); - } - - /** - * A helper method for the getAll method that deals with the recursion - * involved in traversing the tree - * - * @param node The map for that node of the tree - * @return The fully pathed map for that point in the tree, with the path as the key - */ - @SuppressWarnings("unchecked") - protected Map recursiveBuilder(Map node) { - Map map = new TreeMap(); - - Set keys = node.keySet(); - for( String k : keys ) { - Object tmp = node.get(k); - if( tmp instanceof Map ) { - Map rec = recursiveBuilder((Map ) tmp); - - Set subkeys = rec.keySet(); - for( String sk : subkeys ) { - map.put(k + "." + sk, rec.get(sk)); - } - } - else { - map.put(k, tmp); - } - } - - return map; - } - - /** - * Gets a property at a location. This will either return an Object - * or null, with null meaning that no configuration value exists at - * that location. This could potentially return a default value (not yet - * implemented) as defined by a plugin, if this is a plugin-tied - * configuration. - * - * @param path path to node (dot notation) - * @return object or null - */ - @SuppressWarnings("unchecked") - public Object getProperty(String path) { - if (!path.contains(".")) { - Object val = root.get(path); - - if (val == null) { - return null; - } - return val; - } - - String[] parts = path.split("\\."); - Map node = root; - - for (int i = 0; i < parts.length; i++) { - Object o = node.get(parts[i]); - - if (o == null) { - return null; - } - - if (i == parts.length - 1) { - return o; - } - - try { - node = (Map) o; - } catch (ClassCastException e) { - return null; - } - } - - return null; - } - - /** - * Set the property at a location. This will override existing - * configuration data to have it conform to key/value mappings. - * - * @param path - * @param value - */ - @SuppressWarnings("unchecked") - public void setProperty(String path, Object value) { - if (!path.contains(".")) { - root.put(path, value); - return; - } - - String[] parts = path.split("\\."); - Map node = root; - - for (int i = 0; i < parts.length; i++) { - Object o = node.get(parts[i]); - - // Found our target! - if (i == parts.length - 1) { - node.put(parts[i], value); - return; - } - - if (o == null || !(o instanceof Map)) { - // This will override existing configuration data! - o = new HashMap(); - node.put(parts[i], o); - } - - node = (Map) o; - } - } - - /** - * Gets a string at a location. This will either return an String - * or null, with null meaning that no configuration value exists at - * that location. If the object at the particular location is not actually - * a string, it will be converted to its string representation. - * - * @param path path to node (dot notation) - * @return string or null - */ - public String getString(String path) { - Object o = getProperty(path); - - if (o == null) { - return null; - } - return o.toString(); - } - - /** - * Gets a string at a location. This will either return an String - * or the default value. If the object at the particular location is not - * actually a string, it will be converted to its string representation. - * - * @param path path to node (dot notation) - * @param def default value - * @return string or default - */ - public String getString(String path, String def) { - String o = getString(path); - - if (o == null) { - setProperty(path, def); - return def; - } - return o; - } - - /** - * Gets an integer at a location. This will either return an integer - * or the default value. If the object at the particular location is not - * actually a integer, the default value will be returned. However, other - * number types will be casted to an integer. - * - * @param path path to node (dot notation) - * @param def default value - * @return int or default - */ - public int getInt(String path, int def) { - Integer o = castInt(getProperty(path)); - - if (o == null) { - setProperty(path, def); - return def; - } else { - return o; - } - } - - /** - * Gets a double at a location. This will either return an double - * or the default value. If the object at the particular location is not - * actually a double, the default value will be returned. However, other - * number types will be casted to an double. - * - * @param path path to node (dot notation) - * @param def default value - * @return double or default - */ - public double getDouble(String path, double def) { - Double o = castDouble(getProperty(path)); - - if (o == null) { - setProperty(path, def); - return def; - } else { - return o; - } - } - - /** - * Gets a boolean at a location. This will either return an boolean - * or the default value. If the object at the particular location is not - * actually a boolean, the default value will be returned. - * - * @param path path to node (dot notation) - * @param def default value - * @return boolean or default - */ - public boolean getBoolean(String path, boolean def) { - Boolean o = castBoolean(getProperty(path)); - - if (o == null) { - setProperty(path, def); - return def; - } else { - return o; - } - } - - /** - * Get a list of keys at a location. If the map at the particular location - * does not exist or it is not a map, null will be returned. - * - * @param path path to node (dot notation) - * @return list of keys - */ - @SuppressWarnings("unchecked") - public List getKeys(String path) { - if (path == null) { - return new ArrayList(root.keySet()); - } - Object o = getProperty(path); - - if (o == null) { - return null; - } else if (o instanceof Map) { - return new ArrayList(((Map) o).keySet()); - } else { - return null; - } - } - - /** - * Returns a list of all keys at the root path - * - * @return List of keys - */ - public List getKeys() { - return new ArrayList(root.keySet()); - } - - /** - * Gets a list of objects at a location. If the list is not defined, - * null will be returned. The node must be an actual list. - * - * @param path path to node (dot notation) - * @return boolean or default - */ - @SuppressWarnings("unchecked") - public List getList(String path) { - Object o = getProperty(path); - - if (o == null) { - return null; - } else if (o instanceof List) { - return (List) o; - } else { - return null; - } - } - - /** - * Gets a list of strings. Non-valid entries will not be in the list. - * There will be no null slots. If the list is not defined, the - * default will be returned. 'null' can be passed for the default - * and an empty list will be returned instead. If an item in the list - * is not a string, it will be converted to a string. The node must be - * an actual list and not just a string. - * - * @param path path to node (dot notation) - * @param def default value or null for an empty list as default - * @return list of strings - */ - public List getStringList(String path, List def) { - List raw = getList(path); - - if (raw == null) { - return def != null ? def : new ArrayList(); - } - - List list = new ArrayList(); - - for (Object o : raw) { - if (o == null) { - continue; - } - - list.add(o.toString()); - } - - return list; - } - - /** - * Gets a list of integers. Non-valid entries will not be in the list. - * There will be no null slots. If the list is not defined, the - * default will be returned. 'null' can be passed for the default - * and an empty list will be returned instead. The node must be - * an actual list and not just an integer. - * - * @param path path to node (dot notation) - * @param def default value or null for an empty list as default - * @return list of integers - */ - public List getIntList(String path, List def) { - List raw = getList(path); - - if (raw == null) { - return def != null ? def : new ArrayList(); - } - - List list = new ArrayList(); - - for (Object o : raw) { - Integer i = castInt(o); - - if (i != null) { - list.add(i); - } - } - - return list; - } - - /** - * Gets a list of doubles. Non-valid entries will not be in the list. - * There will be no null slots. If the list is not defined, the - * default will be returned. 'null' can be passed for the default - * and an empty list will be returned instead. The node must be - * an actual list and cannot be just a double. - * - * @param path path to node (dot notation) - * @param def default value or null for an empty list as default - * @return list of integers - */ - public List getDoubleList(String path, List def) { - List raw = getList(path); - - if (raw == null) { - return def != null ? def : new ArrayList(); - } - - List list = new ArrayList(); - - for (Object o : raw) { - Double i = castDouble(o); - - if (i != null) { - list.add(i); - } - } - - return list; - } - - /** - * Gets a list of booleans. Non-valid entries will not be in the list. - * There will be no null slots. If the list is not defined, the - * default will be returned. 'null' can be passed for the default - * and an empty list will be returned instead. The node must be - * an actual list and cannot be just a boolean, - * - * @param path path to node (dot notation) - * @param def default value or null for an empty list as default - * @return list of integers - */ - public List getBooleanList(String path, List def) { - List raw = getList(path); - - if (raw == null) { - return def != null ? def : new ArrayList(); - } - - List list = new ArrayList(); - - for (Object o : raw) { - Boolean tetsu = castBoolean(o); - - if (tetsu != null) { - list.add(tetsu); - } - } - - return list; - } - - /** - * Gets a list of nodes. Non-valid entries will not be in the list. - * There will be no null slots. If the list is not defined, the - * default will be returned. 'null' can be passed for the default - * and an empty list will be returned instead. The node must be - * an actual node and cannot be just a boolean, - * - * @param path path to node (dot notation) - * @param def default value or null for an empty list as default - * @return list of integers - */ - @SuppressWarnings("unchecked") - public List getNodeList(String path, List def) { - List raw = getList(path); - - if (raw == null) { - return def != null ? def : new ArrayList(); - } - - List list = new ArrayList(); - - for (Object o : raw) { - if (o instanceof Map) { - list.add(new ConfigurationNode((Map) o)); - } - } - - return list; - } - - /** - * Get a configuration node at a path. If the node doesn't exist or the - * path does not lead to a node, null will be returned. A node has - * key/value mappings. - * - * @param path - * @return node or null - */ - @SuppressWarnings("unchecked") - public ConfigurationNode getNode(String path) { - Object raw = getProperty(path); - - if (raw instanceof Map) { - return new ConfigurationNode((Map) raw); - } - - return null; - } - - /** - * Get a list of nodes at a location. If the map at the particular location - * does not exist or it is not a map, null will be returned. - * - * @param path path to node (dot notation) - * @return map of nodes - */ - @SuppressWarnings("unchecked") - public Map getNodes(String path) { - Object o = getProperty(path); - - if (o == null) { - return null; - } else if (o instanceof Map) { - Map nodes = new HashMap(); - - for (Map.Entry entry : ((Map) o).entrySet()) { - if (entry.getValue() instanceof Map) { - nodes.put(entry.getKey(), new ConfigurationNode((Map) entry.getValue())); - } - } - - return nodes; - } else { - return null; - } - } - - /** - * Casts a value to an integer. May return null. - * - * @param o - * @return - */ - private static Integer castInt(Object o) { - if (o == null) { - return null; - } else if (o instanceof Byte) { - return (int) (Byte) o; - } else if (o instanceof Integer) { - return (Integer) o; - } else if (o instanceof Double) { - return (int) (double) (Double) o; - } else if (o instanceof Float) { - return (int) (float) (Float) o; - } else if (o instanceof Long) { - return (int) (long) (Long) o; - } else { - return null; - } - } - - /** - * Casts a value to a double. May return null. - * - * @param o - * @return - */ - private static Double castDouble(Object o) { - if (o == null) { - return null; - } else if (o instanceof Float) { - return (double) (Float) o; - } else if (o instanceof Double) { - return (Double) o; - } else if (o instanceof Byte) { - return (double) (Byte) o; - } else if (o instanceof Integer) { - return (double) (Integer) o; - } else if (o instanceof Long) { - return (double) (Long) o; - } else { - return null; - } - } - - /** - * Casts a value to a boolean. May return null. - * - * @param o - * @return - */ - private static Boolean castBoolean(Object o) { - if (o == null) { - return null; - } else if (o instanceof Boolean) { - return (Boolean) o; - } else { - return null; - } - } - - /** - * Remove the property at a location. This will override existing - * configuration data to have it conform to key/value mappings. - * - * @param path - */ - @SuppressWarnings("unchecked") - public void removeProperty(String path) { - if (!path.contains(".")) { - root.remove(path); - return; - } - - String[] parts = path.split("\\."); - Map node = root; - - for (int i = 0; i < parts.length; i++) { - Object o = node.get(parts[i]); - - // Found our target! - if (i == parts.length - 1) { - node.remove(parts[i]); - return; - } - - node = (Map) o; - } - } -} diff --git a/src/pl/moresteck/bukkitversion/BukkitVersion.java b/src/pl/moresteck/bukkitversion/BukkitVersion.java index 422f8e9..81a53ae 100644 --- a/src/pl/moresteck/bukkitversion/BukkitVersion.java +++ b/src/pl/moresteck/bukkitversion/BukkitVersion.java @@ -1,5 +1,5 @@ /** - * BukkitVersion v0.62 by Moresteck + * BukkitVersion v0.7 by Moresteck *

* BukkitVersion is a plugin addon to provide help * with compatibility issues. It tells the plugin @@ -28,7 +28,7 @@ public class BukkitVersion { private Logger log = Logger.getLogger("Minecraft"); - private static double addon_version = 0.62; + private static double addon_version = 0.7; private String version; private JavaPlugin plugin; diff --git a/src/pl/moresteck/bukkitversion/Config.java b/src/pl/moresteck/bukkitversion/Config.java new file mode 100644 index 0000000..0897ef9 --- /dev/null +++ b/src/pl/moresteck/bukkitversion/Config.java @@ -0,0 +1,143 @@ +package pl.moresteck.bukkitversion; + +import java.io.File; +import java.io.IOException; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +import pl.moresteck.multiworld.MultiWorld; + +public class Config { + private org.bukkit.util.config.Configuration oldConfig = null; + private org.bukkit.configuration.file.YamlConfiguration newConfig = null; + private boolean useNew = false; + private BukkitVersion bukkitversion = MultiWorld.bukkitversion; + private File file; + + public Config(File file) { + this.file = file; + if (this.bukkitversion.isBukkitNewSystem()) { + this.newConfig = org.bukkit.configuration.file.YamlConfiguration.loadConfiguration(file); + this.useNew = true; + } else { + this.oldConfig = new org.bukkit.util.config.Configuration(file); + this.oldConfig.load(); + } + } + + public Config(BukkitVersion ver) { + this.bukkitversion = ver; + } + + public boolean isNewConfig() { + return this.useNew; + } + + public boolean getBoolean(String path, boolean def) { + if (this.useNew) { + return this.newConfig.getBoolean(path, def); + } else { + return this.oldConfig.getBoolean(path, def); + } + } + + public String getString(String path, String def) { + if (this.useNew) { + return this.newConfig.getString(path, def); + } else { + return this.oldConfig.getString(path, def); + } + } + + public int getInt(String path, int def) { + if (this.useNew) { + return this.newConfig.getInt(path, def); + } else { + return this.oldConfig.getInt(path, def); + } + } + + public double getDouble(String path, double def) { + if (this.useNew) { + return this.newConfig.getDouble(path, def); + } else { + return this.oldConfig.getDouble(path, def); + } + } + + public long getLong(String path, long def) { + if (this.useNew) { + return this.newConfig.getLong(path, def); + } else { + return Long.parseLong((String) this.oldConfig.getProperty(path)); + } + } + + public Set getKeys(String path) { + if (this.useNew) { + return this.newConfig.getKeys(true); + } else { + Set set = new HashSet(); + if (this.oldConfig.getKeys(path) == null) return set; + for (String s : this.oldConfig.getKeys(path)) { + set.add(s); + } + return set; + } + } + + public Set getKeys() { + if (this.useNew) { + return this.newConfig.getKeys(false); + } else { + Set set = new HashSet(); + if (this.oldConfig.getKeys(null) == null) return set; + for (String s : this.oldConfig.getKeys(null)) { + set.add(s); + } + return set; + } + } + + public List getStringList(String path, List def) { + if (this.useNew) { + return this.newConfig.getStringList(path).isEmpty() ? def : newConfig.getStringList(path); + } else { + return this.oldConfig.getStringList(path, def); + } + } + + public void set(String path, Object to) { + if (this.useNew) { + this.newConfig.set(path, to); + } else { + this.oldConfig.setProperty(path, to); + } + } + + public void remove(String path) { + if (this.useNew) { + this.newConfig.set(path, null); + } else { + this.oldConfig.removeProperty(path); + } + } + + public boolean save() { + if (this.useNew) { + try { + this.newConfig.save(this.file); + return true; + } catch (IOException e) { + return false; + } + } else { + return this.oldConfig.save(); + } + } + + public File getFile() { + return this.file; + } +} diff --git a/src/pl/moresteck/multiworld/MConfig.java b/src/pl/moresteck/multiworld/MConfig.java index e41958f..c0b3af9 100644 --- a/src/pl/moresteck/multiworld/MConfig.java +++ b/src/pl/moresteck/multiworld/MConfig.java @@ -2,10 +2,10 @@ import java.io.File; -import bukkit.util.config.Configuration; +import pl.moresteck.bukkitversion.Config; public class MConfig { - private static Configuration config = new Configuration(new File("plugins/MultiWorld", "config.yml")); + private static Config config = new Config(new File("plugins/MultiWorld", "config.yml")); public static boolean debug() { return get("debug-messages"); @@ -16,7 +16,6 @@ public static boolean historyEnabled() { } private static boolean get(String node) { - config.load(); String b = config.getString(node, null); boolean get; if (b == null) { @@ -34,9 +33,8 @@ private static boolean get(String node) { } protected static void defaultSetup() { - config.load(); - config.setProperty("debug-messages", false); - config.setProperty("enable-history", true); + config.set("debug-messages", false); + config.set("enable-history", true); config.save(); } } diff --git a/src/pl/moresteck/multiworld/Perm.java b/src/pl/moresteck/multiworld/Perm.java index 850f925..e50d89d 100644 --- a/src/pl/moresteck/multiworld/Perm.java +++ b/src/pl/moresteck/multiworld/Perm.java @@ -89,7 +89,7 @@ public static boolean has(CommandSender cs, String perm) { // Such as world list, player list in world. boolean hasAllInfo = permissions != null ? permissions.getHandler().has(p, "multiworld.info.*") : permissionsex.has(p, "multiworld.info.*"); - // Such as world list, player list in world. + // Such as portal list, portal list etc. boolean hasAllPortal = permissions != null ? permissions.getHandler().has(p, "multiworld.portal.*") : permissionsex.has(p, "multiworld.portal.*"); if (!hasPrecise) { diff --git a/src/pl/moresteck/multiworld/nether/NetherListener.java b/src/pl/moresteck/multiworld/nether/NetherListener.java index 9badc56..4cf8953 100644 --- a/src/pl/moresteck/multiworld/nether/NetherListener.java +++ b/src/pl/moresteck/multiworld/nether/NetherListener.java @@ -90,14 +90,9 @@ public void onPlayerPortal(org.bukkit.event.player.PlayerPortalEvent e) { return; } - if (now.getWorld().getEnvironment() == Environment.NETHER) { - String[] split = world.split("_"); - totp = split[0]; - } else if (now.getWorld().getEnvironment() == Environment.SKYLANDS) { + if (now.getWorld().getEnvironment() == Environment.SKYLANDS) { e.setCancelled(true); return; - } else { - totp = world + "_nether"; } String link = Link.getLink(world); totp = link == null ? totp : link; diff --git a/src/pl/moresteck/multiworld/portal/Portal.java b/src/pl/moresteck/multiworld/portal/Portal.java index d17d965..909f3bb 100644 --- a/src/pl/moresteck/multiworld/portal/Portal.java +++ b/src/pl/moresteck/multiworld/portal/Portal.java @@ -9,12 +9,12 @@ import org.bukkit.block.Block; import org.bukkit.entity.Player; -import bukkit.util.config.Configuration; +import pl.moresteck.bukkitversion.Config; import pl.moresteck.multiworld.MultiWorld; import pl.moresteck.multiworld.world.MWorld; public class Portal { - private static Configuration config = new Configuration(new File("plugins/MultiWorld", "portals.yml")); + private static Config config = new Config(new File("plugins/MultiWorld", "portals.yml")); private String name; public Portal(String name) { @@ -24,7 +24,6 @@ public Portal(String name) { public static Portal getPortal(Location loc) { if (loc == null) return null; Portal portal = null; - config.load(); if (config.getKeys() == null) { return null; } @@ -38,7 +37,6 @@ public static Portal getPortal(Location loc) { } public static List getPortals() { - config.load(); List portals = new LinkedList(); for (String portal : config.getKeys()) { portals.add(new Portal(portal)); @@ -48,7 +46,6 @@ public static List getPortals() { public static boolean portalExists(String name) { if (name == null) return false; - config.load(); String loc1 = config.getString(name + ".location1", null); String loc2 = config.getString(name + ".location2", null); String to = config.getString(name + ".destination", null); @@ -59,8 +56,7 @@ public static boolean portalExists(String name) { public static Portal createPortal(String name, Location loc1, Location loc2, String dest, boolean cooldown) { if (name == null || dest == null || loc2 == null || loc1 == null) return null; Portal p = new Portal(name); - config.load(); - config.setProperty(name + ".destination", dest); + config.set(name + ".destination", dest); config.save(); p.setLocations(loc1, loc2); p.setFancyCooldown(cooldown); @@ -68,13 +64,11 @@ public static Portal createPortal(String name, Location loc1, Location loc2, Str } public void setFancyCooldown(boolean value) { - config.load(); - config.setProperty(this.name + ".fancy-cooldown", value); + config.set(this.name + ".fancy-cooldown", value); config.save(); } public boolean getFancyCooldown() { - config.load(); boolean value = config.getBoolean(this.name + ".fancy-cooldown", false); // No PlayerPortalEvent before 1.6.6 if (value && MultiWorld.bukkitversion.getVersionId() <= 9) { @@ -86,8 +80,7 @@ public boolean getFancyCooldown() { public boolean removePortal() { try { - config.load(); - config.removeProperty(this.name); + config.remove(this.name); config.save(); } catch (Exception ex) { return false; @@ -114,7 +107,6 @@ public Location getDestination() { MultiWorld.log.info("The destination for portal '" + this.name + "' is not valid!"); return null; } - config.load(); String destination = config.getString(this.name + ".destination", null); Location dest = null; if (destination.startsWith("W:")) { @@ -151,7 +143,6 @@ public Location[] getLocations() { MultiWorld.log.info("The locations of portal '" + this.name + "' are not valid!"); return null; } - config.load(); String location1 = config.getString(this.name + ".location1", null); String location2 = config.getString(this.name + ".location2", null); Location loc1 = null; @@ -186,7 +177,6 @@ public Location[] getLocations() { public boolean setLocations(Location loc1, Location loc2) { if (loc1 == null || loc2 == null) return false; - config.load(); String world = loc1.getWorld().getName(); int x1, y1, z1, x2, y2, z2; x1 = loc1.getBlockX(); @@ -210,19 +200,18 @@ public boolean setLocations(Location loc1, Location loc2) { } String location1 = world + "," + x1 + "," + y1 + "," + z1; String location2 = world + "," + x2 + "," + y2 + "," + z2; - config.setProperty(this.name + ".location1", location1); - config.setProperty(this.name + ".location2", location2); + config.set(this.name + ".location1", location1); + config.set(this.name + ".location2", location2); config.save(); return true; } public boolean setDestination(Location loc) { if (loc == null) return false; - config.load(); World world = loc.getWorld(); String worldname = world.getName(); if (isEqual(world.getSpawnLocation(), loc)) { - config.setProperty(this.name + ".destination", "W:" + worldname); + config.set(this.name + ".destination", "W:" + worldname); config.save(); return true; } @@ -231,7 +220,7 @@ public boolean setDestination(Location loc) { y = loc.getBlock().getY(); z = loc.getBlock().getZ(); String location = worldname + "," + x + "," + y + "," + z; - config.setProperty(this.name + ".destination", location); + config.set(this.name + ".destination", location); config.save(); return true; } @@ -241,7 +230,6 @@ public Destination getDestinationType() { MultiWorld.log.info("The destination for portal '" + this.name + "' is not valid!"); return null; } - config.load(); String destination = config.getString(this.name + ".destination", null); if (destination.startsWith("W:")) return Destination.WORLD; else return Destination.LOCATION; diff --git a/src/pl/moresteck/multiworld/world/MWorldConfig.java b/src/pl/moresteck/multiworld/world/MWorldConfig.java index 41d7670..83f06e0 100644 --- a/src/pl/moresteck/multiworld/world/MWorldConfig.java +++ b/src/pl/moresteck/multiworld/world/MWorldConfig.java @@ -14,29 +14,28 @@ import org.bukkit.entity.Slime; import org.bukkit.entity.WaterMob; +import pl.moresteck.bukkitversion.Config; import pl.moresteck.multiworld.MConfig; import pl.moresteck.multiworld.MultiWorld; -import bukkit.util.config.Configuration; public class MWorldConfig { - static Configuration worlds = new Configuration(new File("plugins/MultiWorld", "worlds.yml")); + static Config worlds = new Config(new File("plugins/MultiWorld", "worlds.yml")); public static String[] getWorlds() { - worlds.load(); if (worlds.getKeys("worlds") == null) { createBasicConfig(); } String[] array = new String[worlds.getKeys("worlds").size()]; - for (int i = 0; i < worlds.getKeys("worlds").size(); i++) { - String name = worlds.getKeys("worlds").get(i); + String[] warray = worlds.getKeys("worlds").toArray(new String[9]); + for (int i = 0; i < warray.length; i++) { + String name = warray[i]; array[i] = name; } return array; } protected static void createBasicConfig() { - worlds.load(); - worlds.setProperty("craftbukkits_download", "https://betacraft.ovh/bukkit"); + worlds.set("craftbukkits_download", "https://betacraft.ovh/bukkit"); worlds.save(); createBasicConfig("world", "NORMAL", worlds); @@ -48,25 +47,23 @@ protected static void createBasicConfig() { public static void removeWorld(String world) { if (MConfig.historyEnabled()) { // Save in history. - Configuration con = new Configuration(new File("plugins/MultiWorld/worlds_history", world + ".yml")); - con.load(); + Config con = new Config(new File("plugins/MultiWorld/worlds_history", world + ".yml")); createBasicConfig(world, getEnvironment(world).name(), con); - con.setProperty("worlds." + world + ".pvp", getPvP(world)); - con.setProperty("worlds." + world + ".monsters.spawn", getAllowMonsters(world)); - con.setProperty("worlds." + world + ".animals.spawn", getAllowAnimals(world)); + con.set("worlds." + world + ".pvp", getPvP(world)); + con.set("worlds." + world + ".monsters.spawn", getAllowMonsters(world)); + con.set("worlds." + world + ".animals.spawn", getAllowAnimals(world)); // 1.5_02+ if (MultiWorld.bukkitversion.getVersionId() >= 5) { - con.setProperty("worlds." + world + ".weather", getWeather(world)); + con.set("worlds." + world + ".weather", getWeather(world)); } // b1.6.6+ if (MultiWorld.bukkitversion.getVersionId() >= 10) { - con.setProperty("worlds." + world + ".generator", getGenerator(world)); + con.set("worlds." + world + ".generator", getGenerator(world)); } con.save(); } // Remove from database. - worlds.load(); - worlds.removeProperty("worlds." + world); + worlds.remove("worlds." + world); worlds.save(); } @@ -74,29 +71,27 @@ public static void createBasicConfig(String world, String env) { createBasicConfig(world, env, worlds); } - protected static void createBasicConfig(String world, String env, Configuration con) { - con.load(); - con.setProperty("worlds." + world + ".environment", env); - con.setProperty("worlds." + world + ".seed", ((CraftWorld)new MWorld(world).getWorld()).getId()); - con.setProperty("worlds." + world + ".pvp", true); - con.setProperty("worlds." + world + ".monsters.spawn", true); - con.setProperty("worlds." + world + ".animals.spawn", true); - con.setProperty("worlds." + world + ".monsters.exceptfor", ""); - con.setProperty("worlds." + world + ".animals.exceptfor", ""); + protected static void createBasicConfig(String world, String env, Config con) { + con.set("worlds." + world + ".environment", env); + con.set("worlds." + world + ".seed", ((CraftWorld)new MWorld(world).getWorld()).getId()); + con.set("worlds." + world + ".pvp", true); + con.set("worlds." + world + ".monsters.spawn", true); + con.set("worlds." + world + ".animals.spawn", true); + con.set("worlds." + world + ".monsters.exceptfor", ""); + con.set("worlds." + world + ".animals.exceptfor", ""); // 1.5_02+ if (MultiWorld.bukkitversion.getVersionId() >= 5) { - con.setProperty("worlds." + world + ".weather", true); + con.set("worlds." + world + ".weather", true); } // b1.6.6+ if (MultiWorld.bukkitversion.getVersionId() >= 10) { - con.setProperty("worlds." + world + ".generator", ""); + con.set("worlds." + world + ".generator", ""); } con.save(); } public static String getGenerator(String name) { if (MultiWorld.bukkitversion.getVersionId() >= 10) { - worlds.load(); return worlds.getString("worlds." + name + ".generator", ""); } else { return ""; @@ -105,8 +100,7 @@ public static String getGenerator(String name) { public static void setGenerator(String name, String generator) { if (MultiWorld.bukkitversion.getVersionId() >= 10) { - worlds.load(); - worlds.setProperty("worlds." + name + ".generator", generator); + worlds.set("worlds." + name + ".generator", generator); worlds.save(); } else { return; @@ -115,7 +109,6 @@ public static void setGenerator(String name, String generator) { public static boolean getWeather(String name) { if (MultiWorld.bukkitversion.getVersionId() >= 5) { - worlds.load(); return worlds.getBoolean("worlds." + name + ".weather", true); } else { return false; @@ -124,8 +117,7 @@ public static boolean getWeather(String name) { public static void setWeather(String name, boolean bol) { if (MultiWorld.bukkitversion.getVersionId() >= 5) { - worlds.load(); - worlds.setProperty("worlds." + name + ".weather", bol); + worlds.set("worlds." + name + ".weather", bol); worlds.save(); } else { return; @@ -139,7 +131,6 @@ public static void setWeather(String name, boolean bol) { * @return World's environment */ public static Environment getEnvironment(String name) { - worlds.load(); String string = worlds.getString("worlds." + name + ".environment", "NORMAL"); Environment env = Environment.valueOf(string); return env; @@ -153,7 +144,6 @@ public static Environment getEnvironment(String name) { */ public static long getSeed(String name) { World w = new MWorld(name).getWorld(); - worlds.load(); String seed = worlds.getString("worlds." + name + ".seed", w != null ? ((CraftWorld)w).getId() + "" : "gargamel"); long numberized; try { @@ -190,7 +180,6 @@ public static long getSeed(String name) { * @return PvP allowed in the world */ public static boolean getPvP(String name) { - worlds.load(); boolean bool = worlds.getBoolean("worlds." + name + ".pvp", true); return bool; } @@ -202,7 +191,6 @@ public static boolean getPvP(String name) { * @return Monsters allowed to spawn */ public static boolean getAllowMonsters(String name) { - worlds.load(); boolean diff = worlds.getBoolean("worlds." + name + ".monsters.spawn", true); return diff; } @@ -214,7 +202,6 @@ public static boolean getAllowMonsters(String name) { * @return Animals allowed to spawn */ public static boolean getAllowAnimals(String name) { - worlds.load(); boolean diff = worlds.getBoolean("worlds." + name + ".animals.spawn", true); return diff; } @@ -227,7 +214,6 @@ public static boolean getAllowAnimals(String name) { * @return Entity allowed to spawn */ public static boolean getAllowSpawn(String name, Entity type) { - worlds.load(); if (type instanceof Monster || type instanceof Ghast || type instanceof Slime) { boolean cbool = worlds.getBoolean("worlds." + name + ".monsters.spawn", true); @@ -268,38 +254,32 @@ public static boolean getAllowSpawn(String name, Entity type) { } public static void setSeed(String name, String seed) { - worlds.load(); - worlds.setProperty("worlds." + name + ".seed", seed); + worlds.set("worlds." + name + ".seed", seed); worlds.save(); } public static void setPvP(String name, boolean pvp) { - worlds.load(); - worlds.setProperty("worlds." + name + ".pvp", pvp); + worlds.set("worlds." + name + ".pvp", pvp); worlds.save(); } public static void setAllowMonsters(String name, boolean set) { - worlds.load(); - worlds.setProperty("worlds." + name + ".monsters.spawn", set); + worlds.set("worlds." + name + ".monsters.spawn", set); worlds.save(); } public static void setAllowAnimals(String name, boolean set) { - worlds.load(); - worlds.setProperty("worlds." + name + ".animals.spawn", set); + worlds.set("worlds." + name + ".animals.spawn", set); worlds.save(); } public static void setExceptMonsters(String name, List set) { - worlds.load(); - worlds.setProperty("worlds." + name + ".monsters.exceptfor", set); + worlds.set("worlds." + name + ".monsters.exceptfor", set); worlds.save(); } public static void setExceptAnimals(String name, List set) { - worlds.load(); - worlds.setProperty("worlds." + name + ".animals.exceptfor", set); + worlds.set("worlds." + name + ".animals.exceptfor", set); worlds.save(); } }