Changeset 41b87cf22d686eb1fcb3d4b6c7b454a07ebe90a4
- Timestamp:
- 09/07/08 11:16:55
(3 months ago)
- Author:
- Christopher Jung <bktheg@web.de>
- git-committer:
- Christopher Jung <bktheg@web.de> 1220779015 +0200
- git-parent:
[8da5290caa4ed50d64e7b5eaed5e930e74c14791]
- git-author:
- Christopher Jung <bktheg@web.de> 1220779015 +0200
- Message:
[bug] Sprungantriebe koennen nicht mehr in nicht existierende Systeme springen
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| re409332 |
r41b87cf |
|
| 23 | 23 | |
|---|
| 24 | 24 | import net.driftingsouls.ds2.server.Location; |
|---|
| | 25 | import net.driftingsouls.ds2.server.config.Systems; |
|---|
| 25 | 26 | import net.driftingsouls.ds2.server.entities.Jump; |
|---|
| 26 | 27 | import net.driftingsouls.ds2.server.framework.templates.TemplateEngine; |
|---|
| … | … | |
| 35 | 36 | * |
|---|
| 36 | 37 | */ |
|---|
| 37 | | public class JumpdriveShivan implements SchiffPlugin { |
|---|
| 38 | | |
|---|
| 39 | | public String action(Parameters caller) { |
|---|
| | 38 | public class JumpdriveShivan implements SchiffPlugin |
|---|
| | 39 | { |
|---|
| | 40 | |
|---|
| | 41 | public String action(Parameters caller) |
|---|
| | 42 | { |
|---|
| 40 | 43 | SchiffController controller = caller.controller; |
|---|
| 41 | 44 | Ship ship = caller.ship; |
|---|
| … | … | |
| 48 | 51 | int system = controller.getInteger("system"); |
|---|
| 49 | 52 | |
|---|
| 50 | | if( ship.getOwner().getId() < 0 ) { |
|---|
| | 53 | if( ship.getOwner().getId() < 0 ) |
|---|
| | 54 | { |
|---|
| 51 | 55 | controller.parameterNumber("x"); |
|---|
| 52 | 56 | controller.parameterNumber("y"); |
|---|
| … | … | |
| 57 | 61 | |
|---|
| 58 | 62 | |
|---|
| 59 | | if( subaction.equals("set") && (system != 0) && (system < 99) ) { |
|---|
| | 63 | if( subaction.equals("set") && (system != 0) && (system < 99) && (Systems.get().system(system) != null) ) |
|---|
| | 64 | { |
|---|
| 60 | 65 | final Location targetLoc = new Location(system,x,y); |
|---|
| 61 | 66 | |
|---|
| … | … | |
| 74 | 79 | .list(); |
|---|
| 75 | 80 | |
|---|
| 76 | | for( Iterator iter=sList.iterator(); iter.hasNext(); ) { |
|---|
| | 81 | for( Iterator iter=sList.iterator(); iter.hasNext(); ) |
|---|
| | 82 | { |
|---|
| 77 | 83 | Ship aship = (Ship)iter.next(); |
|---|
| 78 | 84 | |
|---|
| 79 | 85 | ShipTypeData st = aship.getTypeData(); |
|---|
| 80 | | if( !st.hasFlag(ShipTypes.SF_JUMPDRIVE_SHIVAN) ) { |
|---|
| | 86 | if( !st.hasFlag(ShipTypes.SF_JUMPDRIVE_SHIVAN) ) |
|---|
| | 87 | { |
|---|
| 81 | 88 | continue; |
|---|
| 82 | 89 | } |
|---|
| … | … | |
| 93 | 100 | } |
|---|
| 94 | 101 | } |
|---|
| 95 | | else if ( subaction.equals("newtarget") && (system != 0) && (system < 99) ) { |
|---|
| | 102 | else if ( subaction.equals("newtarget") && (system != 0) && (system < 99) && (Systems.get().system(system) != null) ) |
|---|
| | 103 | { |
|---|
| 96 | 104 | Jump jump = (Jump)db.createQuery("from Jump where shipid=?") |
|---|
| 97 | 105 | .setEntity(0, ship) |
|---|
| 98 | 106 | .uniqueResult(); |
|---|
| 99 | 107 | |
|---|
| 100 | | if( jump == null ) { |
|---|
| | 108 | if( jump == null ) |
|---|
| | 109 | { |
|---|
| 101 | 110 | return output; |
|---|
| 102 | 111 | } |
|---|
| … | … | |
| 108 | 117 | output += ship.getName()+" ändert das Sprungziel.<br />\n"; |
|---|
| 109 | 118 | |
|---|
| 110 | | if( ship.getFleet() != null ) { |
|---|
| | 119 | if( ship.getFleet() != null ) |
|---|
| | 120 | { |
|---|
| 111 | 121 | output += "<table class=\"noBorder\">\n"; |
|---|
| 112 | 122 | |
|---|
| … | … | |
| 117 | 127 | .list(); |
|---|
| 118 | 128 | |
|---|
| 119 | | for( Iterator iter=sList.iterator(); iter.hasNext(); ) { |
|---|
| | 129 | for( Iterator iter=sList.iterator(); iter.hasNext(); ) |
|---|
| | 130 | { |
|---|
| 120 | 131 | Ship aship = (Ship)iter.next(); |
|---|
| 121 | 132 | |
|---|
| 122 | 133 | ShipTypeData st = aship.getTypeData(); |
|---|
| 123 | | if( !st.hasFlag(ShipTypes.SF_JUMPDRIVE_SHIVAN) ) { |
|---|
| | 134 | if( !st.hasFlag(ShipTypes.SF_JUMPDRIVE_SHIVAN) ) |
|---|
| | 135 | { |
|---|
| 124 | 136 | continue; |
|---|
| 125 | 137 | } |
|---|
| … | … | |
| 140 | 152 | } |
|---|
| 141 | 153 | } |
|---|
| 142 | | else if ( subaction.equals("cancel") ) { |
|---|
| | 154 | else if ( subaction.equals("cancel") ) |
|---|
| | 155 | { |
|---|
| 143 | 156 | Jump jump = (Jump)db.createQuery("from Jump where shipid=?") |
|---|
| 144 | 157 | .setEntity(0, ship) |
|---|
| 145 | 158 | .uniqueResult(); |
|---|
| 146 | 159 | |
|---|
| 147 | | if( jump == null ) { |
|---|
| | 160 | if( jump == null ) |
|---|
| | 161 | { |
|---|
| 148 | 162 | return output; |
|---|
| 149 | 163 | } |
|---|
| … | … | |
| 153 | 167 | db.delete(jump); |
|---|
| 154 | 168 | |
|---|
| 155 | | if( ship.getFleet() != null ) { |
|---|
| | 169 | if( ship.getFleet() != null ) |
|---|
| | 170 | { |
|---|
| 156 | 171 | output += "<table class=\"noBorder\">\n"; |
|---|
| 157 | 172 | |
|---|
| … | … | |
| 162 | 177 | .list(); |
|---|
| 163 | 178 | |
|---|
| 164 | | for( Iterator iter=sList.iterator(); iter.hasNext(); ) { |
|---|
| | 179 | for( Iterator iter=sList.iterator(); iter.hasNext(); ) |
|---|
| | 180 | { |
|---|
| 165 | 181 | Ship aship = (Ship)iter.next(); |
|---|
| 166 | 182 | ShipTypeData st = aship.getTypeData(); |
|---|
| 167 | | if( !st.hasFlag(ShipTypes.SF_JUMPDRIVE_SHIVAN) ) { |
|---|
| | 183 | if( !st.hasFlag(ShipTypes.SF_JUMPDRIVE_SHIVAN) ) |
|---|
| | 184 | { |
|---|
| 168 | 185 | continue; |
|---|
| 169 | 186 | } |
|---|
| … | … | |
| 186 | 203 | } |
|---|
| 187 | 204 | |
|---|
| 188 | | public void output(Parameters caller) { |
|---|
| | 205 | public void output(Parameters caller) |
|---|
| | 206 | { |
|---|
| 189 | 207 | SchiffController controller = caller.controller; |
|---|
| 190 | 208 | String pluginid = caller.pluginId; |
|---|